6e933196156f0cd18a7297d7ec5ea378ae42aadf
[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 (bug 47326)
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]] (bug 49926)
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]] (bug 49926)
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 !! test
937 Italics and bold: multiple quote sequences: (2,4,2)
938 !! options
939 parsoid=wt2html
940 !! wikitext
941 ''foo''''bar''
942 !! html/*
943 <p><i>foo'<b>bar</b></i>
944 </p>
945 !!end
946
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
959 !! test
960 Italics and bold: multiple quote sequences: (2,4,3)
961 !! options
962 parsoid=wt2html
963 !! wikitext
964 ''foo''''bar'''
965 !! html/*
966 <p><i>foo'<b>bar</b></i>
967 </p>
968 !!end
969
970
971 # same html as previous, but wikitext adjusted to match parsoid html2wt
972 !! test
973 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
974 !! wikitext
975 ''foo'<nowiki/>'''bar'''''
976 !! html
977 <p><i>foo'<b>bar</b></i>
978 </p>
979 !! end
980
981
982 !! test
983 Italics and bold: multiple quote sequences: (2,4,4)
984 !! options
985 parsoid=wt2html
986 !! wikitext
987 ''foo''''bar''''
988 !! html/*
989 <p><i>foo'<b>bar'</b></i>
990 </p>
991 !!end
992
993
994 # same html as previous, but wikitext adjusted to match parsoid html2wt
995 !! test
996 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
997 !! wikitext
998 ''foo'<nowiki/>'''bar'<nowiki/>'''''
999 !! html
1000 <p><i>foo'<b>bar'</b></i>
1001 </p>
1002 !! end
1003
1004
1005 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1006 !! test
1007 Italics and bold: multiple quote sequences: (3,4,2)
1008 !! options
1009 parsoid=wt2html
1010 !! wikitext
1011 '''foo''''bar''
1012 !! html/php
1013 <p><b>foo'</b>bar
1014 </p>
1015 !! html/parsoid
1016 <p><b>foo'</b>bar<i></i>
1017 </p>
1018 !!end
1019
1020 # same html as previous, but wikitext adjusted to match parsoid html2wt
1021 !! test
1022 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1023 !! options
1024 parsoid
1025 !! wikitext
1026 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
1027 !! html/php
1028 <p><b>foo'</b>bar
1029 </p>
1030 !! html/parsoid
1031 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1032 </p>
1033 !! end
1034
1035
1036 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1037 !! test
1038 Italics and bold: multiple quote sequences: (3,4,3)
1039 !! options
1040 parsoid=wt2html
1041 !! wikitext
1042 '''foo''''bar'''
1043 !! html/php
1044 <p><b>foo'</b>bar
1045 </p>
1046 !! html/parsoid
1047 <p><b>foo'</b>bar<b></b>
1048 </p>
1049 !!end
1050
1051 # same html as previous, but wikitext adjusted to match parsoid html2wt
1052 !! test
1053 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1054 !! wikitext
1055 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1056 !! html/php
1057 <p><b>foo'</b>bar
1058 </p>
1059 !! html/parsoid
1060 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1061 </p>
1062 !! end
1063
1064 ###
1065 ### other quote tests
1066 ###
1067 !! test
1068 Italics and bold: other quote tests: (2,3,5)
1069 !! wikitext
1070 ''this is about '''foo's family'''''
1071 !! html
1072 <p><i>this is about <b>foo's family</b></i>
1073 </p>
1074 !!end
1075
1076
1077 !! test
1078 Italics and bold: other quote tests: (2,(3,3),2)
1079 !! wikitext
1080 ''this is about '''foo's''' family''
1081 !! html
1082 <p><i>this is about <b>foo's</b> family</i>
1083 </p>
1084 !!end
1085
1086
1087 !! test
1088 Italics and bold: other quote tests: (3,2,3,2)
1089 !! options
1090 parsoid=wt2html
1091 !! wikitext
1092 '''this is about ''foo'''s family''
1093 !! html/*
1094 <p><b>this is about <i>foo</i></b><i>s family</i>
1095 </p>
1096 !!end
1097
1098
1099 # same html as previous, but wikitext adjusted to match parsoid html2wt
1100 !! test
1101 Italics and bold: other quote tests: (3,2,3+2+2,2)
1102 !! wikitext
1103 '''this is about ''foo'''''<nowiki/>''s family''
1104 !! html
1105 <p><b>this is about <i>foo</i></b><i>s family</i>
1106 </p>
1107 !! end
1108
1109
1110 !! test
1111 Italics and bold: other quote tests: (3,2,3,3)
1112 !! wikitext
1113 '''this is about ''foo'''s family'''
1114 !! html/*
1115 <p>'<i>this is about </i>foo<b>s family</b>
1116 </p>
1117 !!end
1118
1119
1120 !! test
1121 Italics and bold: other quote tests: (3,(2,2),3)
1122 !! wikitext
1123 '''this is about ''foo's'' family'''
1124 !! html
1125 <p><b>this is about <i>foo's</i> family</b>
1126 </p>
1127 !!end
1128
1129
1130 !! test
1131 Italicized possessive
1132 !! wikitext
1133 The ''[[Main Page]]'''s talk page.
1134 !! html/php
1135 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1136 </p>
1137 !! html/parsoid
1138 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1139 !! end
1140
1141 !! test
1142 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1143 (Requires tidy for PHP parser output to be fixed up)
1144 !! options
1145 parsoid=wt2html,wt2wt
1146 !! wikitext
1147 {|
1148 !''a!!''b
1149 |''a||''b
1150 |}
1151 !! html/php+tidy
1152 <table>
1153 <tr>
1154 <th><i>a</i></th>
1155 <th><i>b</i></th>
1156 <td><i>a</i></td>
1157 <td><i>b</i></td>
1158 </tr>
1159 </table>
1160 !! html/parsoid
1161 <table>
1162 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1163 <td><i>a</i></td><td><i>b</i></td></tr>
1164 </tbody></table>
1165 !! end
1166
1167 ###
1168 ### Non-html5 tags
1169 ###
1170
1171 !! test
1172 Non-html5 tags should be accepted
1173 !! wikitext
1174 <center>''foo''</center>
1175 <big>''foo''</big>
1176 <font>''foo''</font>
1177 <strike>''foo''</strike>
1178 <tt>''foo''</tt>
1179 !! html
1180 <center><i>foo</i></center>
1181 <p><big><i>foo</i></big>
1182 <font><i>foo</i></font>
1183 <strike><i>foo</i></strike>
1184 <tt><i>foo</i></tt>
1185 </p>
1186 !! end
1187
1188 !! test
1189 <wbr> is valid wikitext (bug 52468)
1190 !! wikitext
1191 <wbr>
1192 !! html
1193 <p><wbr />
1194 </p>
1195 !! end
1196
1197 # <strike> is HTML4, <s> is HTML4/5.
1198 !! test
1199 <s> or <strike> for strikethrough
1200 !! wikitext
1201 <strike>strike</strike>
1202
1203 <s>s</s>
1204 !! html
1205 <p><strike>strike</strike>
1206 </p><p><s>s</s>
1207 </p>
1208 !! end
1209
1210 ## a not permitted
1211 ## i,b,br omitted
1212 !! test
1213 Text-level semantic html elements in wikitext
1214 !! wikitext
1215 <em>text</em>
1216 <strong>text</strong>
1217 <small>text</small>
1218 <s>text</s>
1219 <cite>text</cite>
1220 <q>text</q>
1221 <dfn>text</dfn>
1222 <abbr>text</abbr>
1223 <data>text</data>
1224 <time>text</time>
1225 <code>text</code>
1226 <var>text</var>
1227 <samp>text</samp>
1228 <kbd>text</kbd>
1229 <sub>text</sub>
1230 <u>text</u>
1231 <mark>text</mark>
1232 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1233 <bdi>text</bdi>
1234 <bdo>text</bdo>
1235 <span>text</span>
1236 <wbr />
1237 !! html
1238 <p><em>text</em>
1239 <strong>text</strong>
1240 <small>text</small>
1241 <s>text</s>
1242 <cite>text</cite>
1243 <q>text</q>
1244 <dfn>text</dfn>
1245 <abbr>text</abbr>
1246 <data>text</data>
1247 <time>text</time>
1248 <code>text</code>
1249 <var>text</var>
1250 <samp>text</samp>
1251 <kbd>text</kbd>
1252 <sub>text</sub>
1253 <u>text</u>
1254 <mark>text</mark>
1255 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1256 <bdi>text</bdi>
1257 <bdo>text</bdo>
1258 <span>text</span>
1259 <wbr />
1260 </p>
1261 !! end
1262
1263 # test cases taken from
1264 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1265 !! test
1266 Ruby markup (W3C-style)
1267 !! wikitext
1268 ; Mono-ruby for individual base characters
1269 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1270 ; Group ruby
1271 : <ruby>今日<rt>きょう</rt></ruby>
1272 ; Jukugo ruby
1273 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1274 ; Inline ruby
1275 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1276 ; Double-sided ruby
1277 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1278 <ruby>
1279 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1280 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1281 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1282 </ruby>
1283 !! html
1284 <dl><dt> Mono-ruby for individual base characters</dt>
1285 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1286 <dt> Group ruby</dt>
1287 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1288 <dt> Jukugo ruby</dt>
1289 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1290 <dt> Inline ruby</dt>
1291 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1292 <dt> Double-sided ruby</dt>
1293 <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>
1294 <p><ruby>
1295 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1296 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1297 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1298 </ruby>
1299 </p>
1300 !! end
1301
1302 # The next two test different paths in the sanitizer.
1303 !! test
1304 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1305 !! wikitext
1306 <blockquote|>a</blockquote>
1307
1308 <b→> doesn't terminate </b→>
1309
1310 <bä> doesn't terminate </bä>
1311
1312 <boo> doesn't terminate </boo>
1313
1314 <s.foo> doesn't terminate </s.foo>
1315
1316 <sub-ID#1>
1317 !! html
1318 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1319 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1320 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1321 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1322 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1323 </p><p>&lt;sub-ID#1&gt;
1324 </p>
1325 !! end
1326
1327 # There is a tidy bug here: https://sourceforge.net/p/tidy/bugs/946/
1328 # If the non-word-character tag made it through the sanitizer, tidy
1329 # would munge it up.
1330 !! test
1331 Non-word characters don't terminate tag names + tidy
1332 !! wikitext
1333 <blockquote|>a</blockquote>
1334
1335 <b→> doesn't terminate </b→>
1336
1337 <bä> doesn't terminate </bä>
1338
1339 <boo> doesn't terminate </boo>
1340
1341 <s.foo> doesn't terminate </s.foo>
1342
1343 <sub-ID#1>
1344 !! html+tidy
1345 <p>&lt;blockquote|&gt;a</p>
1346 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1347 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1348 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1349 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1350 <p>&lt;sub-ID#1&gt;</p>
1351 !! end
1352
1353 ###
1354 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1355 ### This checks that HTML5 tags (with non-word characters in the tag
1356 ### name) make it safely through the parser -- the Sanitizer will
1357 ### munge them later, as it should.
1358 ###
1359 !! test
1360 Non-word characters are valid in extension tags (T19663)
1361 !! wikitext
1362 <tåg>tåg</tåg>
1363 !! html/php
1364 <pre>
1365 'tåg'
1366 array (
1367 )
1368 </pre>
1369
1370 !! html/parsoid
1371 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1372 !! end
1373
1374 !! test
1375 Isolated close tags should be treated as literal text (bug 52760)
1376 !! options
1377 parsoid=wt2html
1378 !! wikitext
1379 </b>
1380
1381 <s.foo>s</s>
1382 !! html/php+tidy
1383 <p>&lt;s.foo&gt;s</p>
1384 !! html/parsoid
1385 <p>&lt;s.foo&gt;s</p>
1386 !! end
1387
1388 ###
1389 ### Special characters
1390 ###
1391
1392 !! test
1393 Bare pipe character (bug 52363)
1394 !! wikitext
1395 |
1396 !! html
1397 <p>|
1398 </p>
1399 !! end
1400
1401 !! test
1402 Bare pipe character from a template (bug 52363)
1403 !! wikitext
1404 {{pipe}}
1405 !! html
1406 <p>|
1407 </p>
1408 !! end
1409
1410 ###
1411 ### <nowiki> test cases
1412 ###
1413
1414 !! test
1415 <nowiki> unordered list
1416 !! wikitext
1417 <nowiki>* This is not an unordered list item.</nowiki>
1418 !! html/php
1419 <p>* This is not an unordered list item.
1420 </p>
1421 !! html/parsoid
1422 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1423 !! end
1424
1425 !! test
1426 <nowiki> spacing
1427 !! wikitext
1428 <nowiki>Lorem ipsum dolor
1429
1430 sed abit.
1431 sed nullum.
1432
1433 :and a colon
1434 </nowiki>
1435 !! html/php
1436 <p>Lorem ipsum dolor
1437
1438 sed abit.
1439 sed nullum.
1440
1441 :and a colon
1442
1443 </p>
1444 !! html/parsoid
1445 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1446
1447 sed abit.
1448 sed nullum.
1449
1450 :and a colon
1451 </span></p>
1452 !! end
1453
1454 !! test
1455 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1456 !! wikitext
1457 <nowiki><span class="error"></nowiki>
1458 !! html/php
1459 <p>&lt;span class="error"&gt;
1460 </p>
1461 !! html/parsoid
1462 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1463 !! end
1464
1465 !! test
1466 nowiki 3
1467 !! wikitext
1468 :There is not nowiki.
1469 :There is <nowiki>nowiki</nowiki>.
1470
1471 #There is not nowiki.
1472 #There is <nowiki>nowiki</nowiki>.
1473
1474 *There is not nowiki.
1475 *There is <nowiki>nowiki</nowiki>.
1476 !! html/php
1477 <dl><dd>There is not nowiki.</dd>
1478 <dd>There is nowiki.</dd></dl>
1479 <ol><li>There is not nowiki.</li>
1480 <li>There is nowiki.</li></ol>
1481 <ul><li>There is not nowiki.</li>
1482 <li>There is nowiki.</li></ul>
1483
1484 !! html/parsoid
1485 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1486 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1487
1488 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1489 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1490
1491 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1492 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1493 !! end
1494
1495 !! test
1496 Entities inside <nowiki>
1497 !! wikitext
1498 <nowiki>&lt;</nowiki>
1499 !! html
1500 <p>&lt;
1501 </p>
1502 !! end
1503
1504 !! test
1505 Entities inside template parameters
1506 !! wikitext
1507 {{echo|&ndash;}}
1508 !! html/php+tidy
1509 <p>–</p>
1510 !! html/parsoid
1511 <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>
1512 !! end
1513
1514 !! test
1515 Properly escape nowiki when combined with other wiki markup
1516 !! options
1517 parsoid=html2wt
1518 !! html/parsoid
1519 <p>* &lt;/nowiki&gt; tag</p>
1520 !! wikitext
1521 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1522 !! end
1523
1524 !! test
1525 T93824: Put escaped HTML tags inside nowiki
1526 !! options
1527 parsoid=html2wt
1528 !! html/parsoid
1529 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1530 !! wikitext
1531 <nowiki><h2>foo</h2></nowiki>
1532 !! end
1533
1534 !! test
1535 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1536 !! options
1537 parsoid=html2wt
1538 !! html/parsoid
1539 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1540 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1541 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1542 !! wikitext
1543 This text: L'[[Foo]]
1544 This text: L<nowiki>''</nowiki>[[Foo]]
1545 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1546 !! end
1547
1548 # This test fails because wikitext whitespace is not normalized before comparing.
1549 !! test
1550 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1551 !! options
1552 parsoid=html2wt
1553 !! html/parsoid
1554 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1555 </p>
1556 !! wikitext
1557 This text : L<nowiki>''</nowiki>[[Foo]]
1558 !! end
1559
1560 # This test and the next one are html2wt only as they test that incorrect wikitext
1561 # passed in template arguments gets escaped or wrapped in nowikis where required.
1562 !! test
1563 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1564 !! options
1565 parsoid=html2wt
1566 !! html/parsoid
1567 <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>
1568 <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>
1569 !! wikitext
1570 {{echo|foo{{!}}bar}}
1571 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1572 !! end
1573
1574 !! test
1575 T53961: Output correct nowikis in template arguments
1576 !! options
1577 parsoid=html2wt
1578 !! html/parsoid
1579 <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>
1580 <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>
1581 <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>
1582 <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>
1583 <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>
1584 !! wikitext
1585 {{echo|a [ b}}
1586 {{echo|<nowiki>a }} b</nowiki>}}
1587 {{echo|<nowiki>a [[ b</nowiki>}}
1588 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1589 {{echo|a <nowiki>}</nowiki>}}
1590 !! end
1591
1592 !! test
1593 Cases where "!!" needs nowiki protection
1594 !! options
1595 parsoid=html2wt
1596 !! html/parsoid
1597 <table>
1598 <tr><th>this needs protection !! here</th></tr>
1599 </table>
1600
1601 <table>
1602 <tr><th>this does not need
1603 protection !! here</th></tr>
1604 </table>
1605 !! wikitext
1606 {|
1607 !<nowiki>this needs protection !! here</nowiki>
1608 |}
1609
1610 {|
1611 !this does not need
1612 protection !! here
1613 |}
1614 !! end
1615
1616 ###
1617 ### Comments
1618 ###
1619 !! test
1620 Comments and Indent-Pre
1621 !! wikitext
1622 <!-- comment 1 --> asdf
1623
1624 <!-- comment 1 --> asdf
1625 <!-- comment 2 -->
1626
1627 <!-- comment 1 --> asdf
1628 <!-- comment 2 -->xyz
1629
1630 <!-- comment 1 --> asdf
1631 <!-- comment 2 --> xyz
1632 !! html
1633 <pre>asdf
1634 </pre>
1635 <pre>asdf
1636 </pre>
1637 <pre>asdf
1638 </pre>
1639 <p>xyz
1640 </p>
1641 <pre>asdf
1642 xyz
1643 </pre>
1644 !! end
1645
1646 !! test
1647 Comment test 2a
1648 !! wikitext
1649 asdf
1650 <!-- comment 1 -->
1651 jkl
1652 !! html
1653 <p>asdf
1654 jkl
1655 </p>
1656 !! end
1657
1658 !! test
1659 Comment test 2b
1660 !! wikitext
1661 asdf
1662 <!-- comment 1 -->
1663
1664 jkl
1665 !! html
1666 <p>asdf
1667 </p><p>jkl
1668 </p>
1669 !! end
1670
1671 !! test
1672 Comment test 3
1673 !! wikitext
1674 asdf
1675 <!-- comment 1 -->
1676 <!-- comment 2 -->
1677 jkl
1678 !! html
1679 <p>asdf
1680 jkl
1681 </p>
1682 !! end
1683
1684 !! test
1685 Comment test 4
1686 !! wikitext
1687 asdf<!-- comment 1 -->jkl
1688 !! html
1689 <p>asdfjkl
1690 </p>
1691 !! end
1692
1693 !! test
1694 Comment spacing
1695 !! wikitext
1696 a
1697 <!-- foo --> b <!-- bar -->
1698 c
1699 !! html
1700 <p>a
1701 </p>
1702 <pre> b
1703 </pre>
1704 <p>c
1705 </p>
1706 !! end
1707
1708 !! test
1709 Comment whitespace
1710 !! wikitext
1711 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1712 !! html
1713
1714 !! end
1715
1716 !! test
1717 Comment semantics and delimiters
1718 !! wikitext
1719 <!-- --><!----><!-----><!------>
1720 !! html/php
1721
1722 !! html/parsoid
1723 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1724 !! end
1725
1726 !! test
1727 Comment semantics and delimiters, redux
1728 !! wikitext
1729 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1730 -- foo -- funky huh? ... -->
1731 !! html/php
1732
1733 !! html/parsoid
1734 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1735 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1736 !! end
1737
1738 !! test
1739 Comment semantics and delimiters: directors cut
1740 !! wikitext
1741 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1742 everything starting with < followed by !-- until the first -- and > we see,
1743 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1744 -->-->
1745 !! html/php
1746 <p>--&gt;
1747 </p>
1748 !! html/parsoid
1749 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1750 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1751 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1752 --><p>--></p>
1753 !! end
1754
1755 !! test
1756 Comment semantics: nesting
1757 !! wikitext
1758 <!--<!-- no, we're not going to do anything fancy here -->-->
1759 !! html/php
1760 <p>--&gt;
1761 </p>
1762 !! html/parsoid
1763 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1764 !! end
1765
1766 # Parsoid closes the unclosed comment, even if it means a slight
1767 # round-trip diff.
1768 !! test
1769 Comment semantics: unclosed comment at end
1770 !! options
1771 parsoid=wt2html,html2html
1772 !! wikitext
1773 <!--This comment will run out to the end of the document
1774 !! html/php
1775
1776 !! html/parsoid
1777 <!--This comment will run out to the end of the document-->
1778 !! end
1779
1780 !! test
1781 Comment semantics: normalize comments to play nice with XML and browsers
1782 !! wikitext
1783 <!-- Browsers --!> think this is closed -->
1784 <!--> This would normally be text -->
1785 <!---> As would this -->
1786 <!-- XML doesn't like trailing dashes -------->
1787 <!-- Nor doubled hyphens -- anywhere in the data -->
1788 But this is not a comment.
1789 !! html/php
1790 <p>But this is not a comment.
1791 </p>
1792 !! html/parsoid
1793 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1794 <!--&#x3E; This would normally be text -->
1795 <!--&#x2D;&#x3E; As would this -->
1796 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1797 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1798 <p>But this is not a comment.</p>
1799 !! end
1800
1801 !! test
1802 Comment semantics: round-trip even text which contains encoded -->
1803 !! wikitext
1804 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1805 !! html/parsoid
1806 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1807 !! end
1808
1809 !! test
1810 Comment in template title
1811 !! wikitext
1812 {{f<!---->oo}}
1813 !! html
1814 <p>FOO
1815 </p>
1816 !! end
1817
1818 !! test
1819 Comment on its own line post-expand
1820 !! wikitext
1821 a
1822 {{blank}}<!---->
1823 b
1824 !! html
1825 <p>a
1826 </p><p>b
1827 </p>
1828 !! end
1829
1830 !! test
1831 Comment on its own line post-expand with non-significant whitespace
1832 !! wikitext
1833 a
1834 {{blank}} <!---->
1835 b
1836 !! html
1837 <p>a
1838 </p><p>b
1839 </p>
1840 !! end
1841
1842 !! test
1843 Multiple comments should still parse as SOL-transparent
1844 !! options
1845 parsoid=wt2html,wt2wt
1846 !! wikitext
1847 <!--c1-->*a
1848 <!--c2--><!--c3--><!--c4-->*b
1849 !! html/php
1850 <ul><li>a</li>
1851 <li>b</li></ul>
1852
1853 !! html/parsoid
1854 <!--c1--><ul>
1855 <li>a
1856 </li>
1857 <!--c2--><!--c3--><!--c4-->
1858 <li>b
1859 </li>
1860 </ul>
1861 !! end
1862
1863 ###
1864 ### paragraph wrapping tests
1865 ###
1866 !! test
1867 No block tags
1868 !! wikitext
1869 a
1870
1871 b
1872 !! html
1873 <p>a
1874 </p><p>b
1875 </p>
1876 !! end
1877
1878 !! test
1879 Block tag on one line (<div>)
1880 !! wikitext
1881 a <div>foo</div>
1882
1883 b
1884 !! html
1885 a <div>foo</div>
1886 <p>b
1887 </p>
1888 !! html+tidy
1889 <p>a</p>
1890 <div>foo</div>
1891 <p>b</p>
1892 !! end
1893
1894 !! test
1895 Block tag on one line (<blockquote>)
1896 !! wikitext
1897 a <blockquote>foo</blockquote>
1898
1899 b
1900 !! html
1901 a <blockquote>foo</blockquote>
1902 <p>b
1903 </p>
1904 !! html+tidy
1905 <p>a</p>
1906 <blockquote>
1907 <p>foo</p>
1908 </blockquote>
1909 <p>b</p>
1910 !! end
1911
1912 !! test
1913 Block tag on both lines (<div>)
1914 !! wikitext
1915 a <div>foo</div>
1916
1917 b <div>foo</div>
1918 !! html
1919 a <div>foo</div>
1920 b <div>foo</div>
1921
1922 !! html+tidy
1923 <p>a</p>
1924 <div>foo</div>
1925 <p>b</p>
1926 <div>foo</div>
1927 !! end
1928
1929 !! test
1930 Block tag on both lines (<blockquote>)
1931 !! wikitext
1932 a <blockquote>foo</blockquote>
1933
1934 b <blockquote>foo</blockquote>
1935 !! html
1936 a <blockquote>foo</blockquote>
1937 b <blockquote>foo</blockquote>
1938
1939 !! html+tidy
1940 <p>a</p>
1941 <blockquote>
1942 <p>foo</p>
1943 </blockquote>
1944 <p>b</p>
1945 <blockquote>
1946 <p>foo</p>
1947 </blockquote>
1948 !! end
1949
1950 !! test
1951 Multiple lines without block tags
1952 !! wikitext
1953 <div>foo</div> a
1954 b
1955 c
1956 d<!--foo--> e
1957 x <div>foo</div> z
1958 !! html
1959 <div>foo</div> a
1960 <p>b
1961 c
1962 d e
1963 </p>
1964 x <div>foo</div> z
1965
1966 !! html+tidy
1967 <div>foo</div>
1968 <p>a</p>
1969 <p>b c d e</p>
1970 <p>x</p>
1971 <div>foo</div>
1972 <p>z</p>
1973 !! end
1974
1975 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1976 # So, we have a separate section for Parsoid. We don't want
1977 # to mimic this stripping behavior in Parsoid. It affects
1978 # editing experience and also requires us to maintain additional
1979 # info for RT-ing.
1980 !! test
1981 Empty lines between lines with block tags
1982 !! wikitext
1983 <div></div>
1984
1985
1986 <div></div>a
1987
1988 b
1989 <div>a</div>b
1990
1991 <div>b</div>d
1992
1993
1994 <div>e</div>
1995 !! html
1996 <div></div>
1997 <p><br />
1998 </p>
1999 <div></div>a
2000 <p>b
2001 </p>
2002 <div>a</div>b
2003 <div>b</div>d
2004 <p><br />
2005 </p>
2006 <div>e</div>
2007
2008 !! html+tidy
2009 <p><br /></p>
2010 <p>a</p>
2011 <p>b</p>
2012 <div>a</div>
2013 <p>b</p>
2014 <div>b</div>
2015 <p>d</p>
2016 <p><br /></p>
2017 <div>e</div>
2018 !! html/parsoid
2019 <div data-parsoid='{"stx":"html"}'></div>
2020
2021 <p><br /></p>
2022 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2023
2024 <p>b</p>
2025 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2026
2027 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2028
2029 <p><br /></p>
2030 <div data-parsoid='{"stx":"html"}'>e</div>
2031 !! end
2032
2033 ## PHP parser emits output which is broken
2034 !! test
2035 Unclosed HTML p-tags should be handled properly
2036 !! wikitext
2037 <div><p>foo</div>
2038 a
2039
2040 b
2041 !! html/php+tidy
2042 <div>
2043 <p>foo</p>
2044 </div>
2045 <p>a</p>
2046 <p>b</p>
2047 !! html/parsoid
2048 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2049 <p>a</p>
2050 <p>b</p>
2051 !! end
2052
2053 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2054 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2055 ## them for now.
2056 !! test
2057 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2058 !! options
2059 parsoid=wt2html
2060 !! wikitext
2061 a [[Category:A1]] [[Category:A2]]
2062 [[Category:A3]]
2063 [[Category:A4]]
2064 !! html/parsoid
2065 <p>a</p>
2066 <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"/>
2067 !! end
2068
2069 !! test
2070 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2071 !! options
2072 parsoid=wt2html
2073 !! wikitext
2074 [[Category:A1]]a
2075 !! html/parsoid
2076 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2077 !! end
2078
2079 ###
2080 ### Preformatted text
2081 ###
2082 !! test
2083 Preformatted text
2084 !! wikitext
2085 This is some
2086 Preformatted text
2087 With ''italic''
2088 And '''bold'''
2089 And a [[Main Page|link]]
2090 !! html
2091 <pre>This is some
2092 Preformatted text
2093 With <i>italic</i>
2094 And <b>bold</b>
2095 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2096 </pre>
2097 !! end
2098
2099 !! test
2100 Tabs don't trigger preformatted text
2101 !! wikitext
2102 This is not
2103 preformatted text.
2104 This is preformatted text.
2105 So is this.
2106 !! html/php
2107 <p> This is not
2108 preformatted text.
2109 </p>
2110 <pre>This is preformatted text.
2111 So is this.
2112 </pre>
2113 !! html/parsoid
2114 <p> This is not
2115 preformatted text.</p>
2116 <pre>This is preformatted text.
2117 So is this.</pre>
2118 !! end
2119
2120 !! test
2121 Space before tab needs nowiki pre protection
2122 !! options
2123 parsoid=html2wt
2124 !! html/parsoid
2125 <p> a</p>
2126 !! wikitext
2127 <nowiki> </nowiki> a
2128 !! end
2129
2130 !! test
2131 Ident preformatting with inline content
2132 !! wikitext
2133 a
2134 ''b''
2135 !! html
2136 <pre>a
2137 <i>b</i>
2138 </pre>
2139 !! end
2140
2141 !! test
2142 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2143 !! wikitext
2144 <pre><nowiki>
2145 <b>
2146 <cite>
2147 <em>
2148 </nowiki></pre>
2149 !! html
2150 <pre>
2151 &lt;b&gt;
2152 &lt;cite&gt;
2153 &lt;em&gt;
2154 </pre>
2155
2156 !! end
2157
2158 !! test
2159 Regression with preformatted in <center>
2160 !! wikitext
2161 <center>
2162 Blah
2163 </center>
2164 !! html
2165 <center>
2166 <pre>Blah
2167 </pre>
2168 </center>
2169
2170 !! end
2171
2172 !! test
2173 Bug 52763: Preformatted in <blockquote>
2174 !! wikitext
2175 <blockquote>
2176 Blah
2177 {|
2178 |
2179 indented cell (no pre-wrapping!)
2180 |}
2181 </blockquote>
2182 !! html
2183 <blockquote>
2184 <p> Blah
2185 </p>
2186 <table>
2187 <tr>
2188 <td>
2189 <p> indented cell (no pre-wrapping!)
2190 </p>
2191 </td></tr></table>
2192 </blockquote>
2193
2194 !! end
2195
2196 !! test
2197 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2198 !! wikitext
2199 <blockquote>
2200 Foo
2201
2202 Bar
2203 </blockquote>
2204 !! html
2205 <blockquote>
2206 <p>Foo
2207 </p><p>Bar
2208 </p>
2209 </blockquote>
2210
2211 !! end
2212
2213 !! test
2214 Bug 15491: <ins>/<del> in blockquote
2215 !! wikitext
2216 <blockquote>
2217 Foo <del>bar</del> <ins>baz</ins> quux
2218 </blockquote>
2219 !! html
2220 <blockquote>
2221 <p>Foo <del>bar</del> <ins>baz</ins> quux
2222 </p>
2223 </blockquote>
2224
2225 !! end
2226
2227 # Note that the p-wrapping is newline sensitive, which could be
2228 # considered a bug: tidy will wrap only the 'Foo' in the example
2229 # below in a <p> tag. (see comment 23-25 of bug #6200)
2230 !! test
2231 Bug 15491: <ins>/<del> in blockquote (2)
2232 !! wikitext
2233 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2234 </blockquote>
2235 !! html
2236 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2237 </blockquote>
2238
2239 !! html+tidy
2240 <blockquote>
2241 <p>Foo</p>
2242 <del>bar</del> <ins>baz</ins> quux</blockquote>
2243 !! end
2244
2245 !! test
2246 <pre> with attributes (bug 3202)
2247 !! wikitext
2248 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2249 !! html
2250 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2251
2252 !! end
2253
2254 !! test
2255 <pre> with width attribute (bug 3202)
2256 !! wikitext
2257 <pre width="8">Narrow screen goodies</pre>
2258 !! html
2259 <pre width="8">Narrow screen goodies</pre>
2260
2261 !! end
2262
2263 !! test
2264 <pre> with forbidden attribute (bug 3202)
2265 !! wikitext
2266 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2267 !! html
2268 <pre width="8">Narrow screen goodies</pre>
2269
2270 !! end
2271
2272 !! test
2273 Entities inside <pre>
2274 !! wikitext
2275 <pre>&lt;</pre>
2276 !! html
2277 <pre>&lt;</pre>
2278
2279 !! end
2280
2281 !! test
2282 <pre> with forbidden attribute values (bug 3202)
2283 !! wikitext
2284 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2285 !! html
2286 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2287
2288 !! end
2289
2290 !! test
2291 <nowiki> inside <pre> (bug 13238)
2292 !! wikitext
2293 <pre>
2294 <nowiki>
2295 </pre>
2296 <pre>
2297 <nowiki></nowiki>
2298 </pre>
2299 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2300 !! html
2301 <pre>
2302 &lt;nowiki&gt;
2303 </pre>
2304 <pre>
2305
2306 </pre>
2307 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2308
2309 !! end
2310
2311 !! test
2312 <nowiki> inside of #tag:pre
2313 !! wikitext
2314 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2315 !! html/php
2316 <pre>Foo &#8594;bar</pre>
2317
2318 !! html/parsoid
2319 <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>
2320 !! end
2321
2322 !! test
2323 <nowiki> and <pre> preference (first one wins)
2324 !! wikitext
2325 <pre>
2326 <nowiki>
2327 </pre>
2328 </nowiki>
2329 </pre>
2330
2331 <nowiki>
2332 <pre>
2333 <nowiki>
2334 </pre>
2335 </nowiki>
2336 </pre>
2337
2338 !! html/php
2339 <pre>
2340 &lt;nowiki&gt;
2341 </pre>
2342 <p>&lt;/nowiki&gt;
2343 &lt;/pre&gt;
2344 </p><p>
2345 &lt;pre&gt;
2346 &lt;nowiki&gt;
2347 &lt;/pre&gt;
2348
2349 &lt;/pre&gt;
2350 </p>
2351 !! html/parsoid
2352 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2353 </pre>
2354 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2355 &lt;/pre></p>
2356
2357 <p><span typeof="mw:Nowiki">
2358 &lt;pre>
2359 &lt;nowiki>
2360 &lt;/pre>
2361 </span>
2362 &lt;/pre></p>
2363 !! end
2364
2365 !! test
2366 </pre> inside nowiki
2367 !! wikitext
2368 <nowiki></pre></nowiki>
2369 !! html
2370 <p>&lt;/pre&gt;
2371 </p>
2372 !! end
2373
2374 # Parsoid doesn't strip empty tags, like Tidy does.
2375 !! test
2376 Empty pre; pre inside other HTML tags (bug 54946)
2377 !! options
2378 parsoid=wt2html,wt2wt
2379 !! wikitext
2380 a
2381
2382 <div><pre>
2383 foo
2384 </pre></div>
2385 <pre></pre>
2386 !! html/php
2387 <p>a
2388 </p>
2389 <div><pre>
2390 foo
2391 </pre></div>
2392 <pre></pre>
2393
2394 !! html/php+tidy
2395 <p>a</p>
2396 <div>
2397 <pre>
2398 foo
2399 </pre></div>
2400 !! html/parsoid
2401 <p>a</p>
2402
2403 <div><pre>foo
2404 </pre></div>
2405 <pre></pre>
2406 !! end
2407
2408 !! test
2409 HTML pre followed by indent-pre
2410 !! wikitext
2411 <pre>foo</pre>
2412 bar
2413 !! html
2414 <pre>foo</pre>
2415 <pre>bar
2416 </pre>
2417 !! end
2418
2419 # Note that tidy removes the empty <p> tags from the start and end.
2420 # Parsoid does not, by design.
2421 !!test
2422 Block tag pre
2423 !! wikitext
2424 <p><pre>foo</pre></p>
2425 !! html/php+tidy
2426 <pre>
2427 foo
2428 </pre>
2429 !! html/parsoid
2430 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2431 !!end
2432
2433 !!test
2434 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2435 !! wikitext
2436 {{echo|}}
2437 !! html
2438
2439 !!end
2440
2441 !!test
2442 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2443 !! wikitext
2444 {{echo|
2445 foo}}
2446 !! html
2447 <p>foo
2448 </p>
2449 !!end
2450
2451 !! test
2452 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2453 !! wikitext
2454 {{echo|a
2455 b}}
2456 !! html
2457 <pre>a
2458 </pre>
2459 <p>b
2460 </p>
2461 !!end
2462
2463 !! test
2464 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2465 !! wikitext
2466 {{echo|a
2467 b
2468 c
2469 d
2470 e
2471 }}
2472 !! html
2473 <pre>a
2474 </pre>
2475 <p>b
2476 c
2477 </p>
2478 <pre>d
2479 </pre>
2480 <p>e
2481 </p>
2482 !!end
2483
2484 !!test
2485 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2486 !! wikitext
2487 {{echo| foo}}
2488
2489 {{echo| foo}}{{echo| bar}}
2490
2491 {{echo| foo}}
2492 {{echo| bar}}
2493
2494 {{echo|<!--cmt--> foo}}
2495
2496 <!--cmt-->{{echo| foo}}
2497
2498 {{echo|{{echo| }}bar}}
2499 !! html
2500 <pre>foo
2501 </pre>
2502 <pre>foo bar
2503 </pre>
2504 <pre>foo
2505 bar
2506 </pre>
2507 <pre>foo
2508 </pre>
2509 <pre>foo
2510 </pre>
2511 <pre>bar
2512 </pre>
2513 !!end
2514
2515 !! test
2516 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2517 !! wikitext
2518 {{echo| }}a
2519
2520 {{echo|
2521 }}a
2522
2523 {{echo|
2524 b}}
2525
2526 {{echo|a
2527 }}b
2528
2529 {{echo|a
2530 }} b
2531 !! html
2532 <pre>a
2533 </pre>
2534 <p><br />
2535 </p>
2536 <pre>a
2537 </pre>
2538 <p><br />
2539 </p>
2540 <pre>b
2541 </pre>
2542 <p>a
2543 </p>
2544 <pre>b
2545 </pre>
2546 <p>a
2547 </p>
2548 <pre>b
2549 </pre>
2550 !!end
2551
2552 !! test
2553 Pres with newline attributes
2554 !! wikitext
2555 <pre class="one
2556 two">hi</pre>
2557 !! html/php
2558 <pre class="one two">hi</pre>
2559
2560 !! html/parsoid
2561 <pre class="one
2562 two" data-parsoid='{"stx":"html"}'>hi</pre>
2563 !! end
2564
2565 !! test
2566 Things that look like <pre> tags aren't treated as such
2567 !! wikitext
2568 Barack Obama <President> of the United States
2569 <President></President>
2570 !! html
2571 <p>Barack Obama &lt;President&gt; of the United States
2572 &lt;President&gt;&lt;/President&gt;
2573 </p>
2574 !! end
2575
2576 !! test
2577 Handle broken pre-like tags (bug 64025)
2578 !! options
2579 parsoid=wt2html
2580 !! wikitext
2581 {{echo|<pre <pre>x</pre>}}
2582
2583 <table><pre </table>
2584 !! html/php
2585 <pre>x</pre>
2586 <table>&lt;pre </table>
2587
2588 !! html/php+tidy
2589 <pre>
2590 x
2591 </pre>
2592 <p>&lt;pre</p>
2593 !! html/parsoid
2594 <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>
2595
2596
2597 <p>&lt;pre </p>
2598
2599 <table></table>
2600 !! end
2601
2602 !! test
2603 Parsoid: handle pre with space after attribute
2604 !! options
2605 parsoid=wt2html
2606 !! wikitext
2607 <pre style="width:50%;" >{{echo|foo}}</pre>
2608 !! html/php
2609 <pre style="width:50%;">{{echo|foo}}</pre>
2610
2611 !! html/parsoid
2612 <pre style="width:50%;">{{echo|foo}}</pre>
2613 !! end
2614
2615 # TODO / maybe: fix wt2wt for this
2616 !! test
2617 Parsoid: Don't paragraph-wrap fosterable content
2618 !! options
2619 parsoid=wt2html
2620 !! wikitext
2621 {|
2622 <td></td>
2623 <td></td>
2624
2625
2626
2627 |}
2628 !! html
2629 <table>
2630
2631 <tbody>
2632 <tr>
2633 <td></td>
2634
2635 <td></td></tr>
2636
2637
2638
2639 </tbody></table>
2640 !! end
2641
2642 !! test
2643 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2644 !! options
2645 parsoid=wt2html
2646 !! wikitext
2647 {|
2648 <td>
2649 <td>
2650 </td>
2651
2652
2653
2654 |}
2655 !! html
2656 <table>
2657
2658 <tbody>
2659 <tr>
2660 <td></td>
2661
2662 <td>
2663 </td></tr>
2664
2665
2666
2667 </tbody></table>
2668 !! end
2669
2670
2671 #--------------------------------------------------------------------
2672 # Transclusion parameter whitespace stripping tests
2673 # Behavior is different for positional and named parameters
2674 #--------------------------------------------------------------------
2675 !! test
2676 Templates: Strip leading and trailing whitespace from named-param values
2677 !! wikitext
2678 {{echo|1= a }}
2679
2680 {{echo|1= {{echo|b}} }}
2681
2682 {{echo| 1 =
2683 c }}
2684
2685 {{echo| 1 =
2686 * d
2687 }}
2688 !! html
2689 <p>a
2690 </p><p>b
2691 </p><p>c
2692 </p>
2693 <ul><li> d</li></ul>
2694
2695 !! end
2696
2697 !! test
2698 Templates: Don't strip whitespace from positional-param values
2699 !! wikitext
2700 {{echo|a }}
2701
2702 {{echo|{{echo|b}} }}
2703
2704 {{echo| c
2705 }}
2706
2707 {{echo| {{echo|d}}
2708 }}
2709
2710 {{echo|
2711 e}}
2712
2713 {{echo|
2714 * f}}
2715
2716 {{echo|
2717 }}g
2718 !! html
2719 <p>a
2720 </p><p>b
2721 </p>
2722 <pre>c
2723 </pre>
2724 <p><br />
2725 </p>
2726 <pre>d
2727 </pre>
2728 <p><br />
2729 </p>
2730 <pre>e
2731 </pre>
2732 <p><br />
2733 </p>
2734 <ul><li> f</li></ul>
2735 <p><br />
2736 </p>
2737 <pre>g
2738 </pre>
2739 !! end
2740
2741 !! test
2742 Templates: Handle empty comment-and-ws-only lines correctly
2743 !! wikitext
2744 {{echo|foo
2745 <!--should be ignored-->
2746 <!--should be ignored as well-->
2747 bar}}
2748 !! html/php
2749 <p>foo
2750 bar
2751 </p>
2752 !! html/parsoid
2753 <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>
2754 !! end
2755
2756 !! test
2757 Templates: Handle comments in the target
2758 !! wikitext
2759 {{echo
2760 <!-- should be ignored -->
2761 |foo}}
2762
2763 {{echo
2764 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2765 |foo}}
2766
2767 {{echo<!-- should be ignored -->
2768 |foo}}
2769
2770 {{echo<!-- should be ignored -->|foo}}
2771
2772 {{<!-- should be ignored -->echo|foo}}
2773 !! html/php
2774 <p>foo
2775 </p><p>foo
2776 </p><p>foo
2777 </p><p>foo
2778 </p><p>foo
2779 </p>
2780 !! html/parsoid
2781 <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>
2782
2783 <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>
2784
2785 <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>
2786
2787 <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>
2788
2789 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2790 !!end
2791
2792 !! test
2793 Templates: Handle comments in parameter names (bug 67657)
2794 !! wikitext
2795 {{echo|1
2796 <!-- should be ignored -->
2797 =foo}}
2798
2799 {{echo|
2800 <!-- should be ignored -->
2801 1 = foo}}
2802
2803 {{echo|1<!-- should be ignored -->=foo}}
2804
2805 {{echo|<!-- should be ignored -->1=foo}}
2806 !! html/php
2807 <p>foo
2808 </p><p>foo
2809 </p><p>foo
2810 </p><p>foo
2811 </p>
2812 !! html/parsoid
2813 <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>
2814
2815 <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>
2816
2817 <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>
2818
2819 <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>
2820 !!end
2821
2822 !! test
2823 Templates: Other wikitext in parameter names (bug 67657)
2824 !! wikitext
2825 {{echo|''1''=foo}}
2826 !! html/php
2827 <p>{{{1}}}
2828 </p>
2829 !! html/parsoid
2830 <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>
2831 !!end
2832
2833 #--------------------------------------------------------------------
2834 # Transclusion parameter escaping tests
2835 #--------------------------------------------------------------------
2836 !! test
2837 Templates: Parsoid parameter escaping test 1
2838 !! wikitext
2839 {{echo|[foo]|{{echo|[bar]}}}}
2840 !! html/php+tidy
2841 <p>[foo]</p>
2842 !! html/parsoid
2843 <p about="#mwt1" typeof="mw:Transclusion"
2844 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2845 !! end
2846
2847 !! test
2848 Parsoid: Pipes in external links in template parameter
2849 !! wikitext
2850 {{echo|[{{echo|http://example.com}} link]}}
2851 !! html/php+tidy
2852 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2853 !! html/parsoid
2854 <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>
2855 !! end
2856
2857 !! test
2858 Parsoid: pipe in transclusion parameter
2859 !! wikitext
2860 {{echo|http://foo.com/a&#124;b}}
2861 !! html/php+tidy
2862 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2863 !! html/parsoid
2864 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2865 typeof="mw:Transclusion"
2866 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|b</a></p>
2867 !! end
2868
2869 !! test
2870 Parsoid: Pipe in external link target and content in template parameter
2871 !! options
2872 parsoid=html2wt,wt2wt
2873 !! wikitext
2874 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2875 !! html/php+tidy
2876 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2877 !! html/parsoid
2878 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2879 typeof="mw:Transclusion"
2880 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2881 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2882 !! end
2883
2884 !! test
2885 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2886 !! options
2887 parsoid
2888 !! wikitext
2889 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2890 !! html
2891 <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>
2892 !! end
2893
2894 !! test
2895 Templates: Don't escape already nowiki-escaped text in template parameters
2896 !! options
2897 parsoid=html2wt,wt2wt
2898 !! wikitext
2899 {{echo|foo<nowiki>|</nowiki>bar}}
2900 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2901 {{echo|<nowiki></nowiki>}}
2902 !! html/php+tidy
2903 <p>foo|bar &lt;div&gt;</p>
2904 !! html/parsoid
2905 <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>
2906 <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>
2907 <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>
2908 </p>
2909 !! end
2910
2911 ## Bug 52824
2912 !! test
2913 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2914 !! options
2915 parsoid=html2wt,wt2wt
2916 !! wikitext
2917 {{echo|{{echo|1=bar}}}}
2918 !! html/php+tidy
2919 <p>bar</p>
2920 !! html/parsoid
2921 <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>
2922 !! end
2923
2924 ## Bug 56733
2925 !! test
2926 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2927 !! wikitext
2928 {{echo|a : b}}
2929 !! html/php+tidy
2930 <p>a&#160;: b</p>
2931 !! html/parsoid
2932 <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>
2933 !! end
2934
2935 ## Bug T73412
2936 !! test
2937 Templates: Preserve blank parameter names
2938 !! wikitext
2939 {{echo|=foo}}
2940 !! html/php+tidy
2941 <p>{{{1}}}</p>
2942 !! html/parsoid
2943 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2944 !! end
2945
2946 !! test
2947 Templates: Preserve blank parameter names in other positions
2948 !! wikitext
2949 {{blank_param|bar|=foo}}
2950 !! html/php+tidy
2951 <p>bar foo</p>
2952 !! html/parsoid
2953 <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
2954 foo</p>
2955 !! end
2956
2957 ###
2958 ### Parsoid-centric tests for testing RT edge cases for pre
2959 ###
2960
2961 !!test
2962 1a. Indent-Pre and Comments
2963 !! wikitext
2964 a
2965 <!--a-->
2966 c
2967 !! html
2968 <pre>a
2969 </pre>
2970 <p>c
2971 </p>
2972 !!end
2973
2974 !!test
2975 1b. Indent-Pre and Comments
2976 !! wikitext
2977 a
2978 <!--a-->
2979 c
2980 !! html
2981 <pre>a
2982 </pre>
2983 <p>c
2984 </p>
2985 !!end
2986
2987 !!test
2988 1c. Indent-Pre and Comments
2989 !! wikitext
2990 <!--a--> a
2991
2992 <!--a--> a
2993 !! html
2994 <pre> a
2995 </pre>
2996 <pre> a
2997 </pre>
2998 !!end
2999
3000 !!test
3001 1d. Indent-Pre and Comments
3002 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3003 !! wikitext
3004 <!--a--> a
3005
3006 <!--b-->b
3007 !! html
3008 <pre>a
3009 </pre>
3010 <pre>b
3011 </pre>
3012 !!end
3013
3014 !!test
3015 2a. Indent-Pre and tables
3016 !! wikitext
3017 {|
3018 |-
3019 !h1!!h2
3020 |foo||bar
3021 |}
3022 !! html
3023 <table>
3024
3025 <tr>
3026 <th>h1</th>
3027 <th>h2
3028 </th>
3029 <td>foo</td>
3030 <td>bar
3031 </td></tr></table>
3032
3033 !!end
3034
3035 !!test
3036 2b. Indent-Pre and tables
3037 !! wikitext
3038 {|
3039 |-
3040 |foo
3041 |}
3042 !! html
3043 <table>
3044
3045 <tr>
3046 <td>foo
3047 </td></tr></table>
3048
3049 !!end
3050
3051 !!test
3052 2c. Indent-Pre and tables (bug 42252)
3053 !! wikitext
3054 {|
3055 |+ foo
3056 ! | bar
3057 |}
3058 !! html
3059 <table>
3060 <caption> foo
3061 </caption>
3062 <tr>
3063 <th> bar
3064 </th></tr></table>
3065
3066 !!end
3067
3068 !!test
3069 2d. Indent-Pre and tables
3070 !! wikitext
3071 a
3072 {|
3073 | b
3074 |}
3075 !! html/php
3076 <pre>a
3077 </pre>
3078 <table>
3079 <tr>
3080 <td> b
3081 </td></tr></table>
3082
3083 !! html/parsoid
3084 <pre>a</pre>
3085 <table>
3086 <tbody><tr><td> b</td></tr>
3087 </tbody></table>
3088 !!end
3089
3090 !!test
3091 2e. Indent-Pre and table-line syntax
3092 !! wikitext
3093 a
3094 | b
3095 | c
3096 !! html/php
3097 <pre>a
3098 | b
3099 | c
3100 </pre>
3101 !!end
3102
3103 !!test
3104 2f. Indent-pre started by table-line syntax
3105 !! wikitext
3106 a
3107 | b
3108 | c
3109 !! html/php
3110 <p>a
3111 </p>
3112 <pre>| b
3113 | c
3114 </pre>
3115 !! html/parsoid
3116 <p>a</p>
3117 <pre>
3118 | b
3119 | c</pre>
3120 !!end
3121
3122 !! test
3123 2g. Indented table markup mixed with indented pre content (proposed in bug 6200)
3124 !! wikitext
3125 <table>
3126 <tr>
3127 <td>
3128 Text that should be rendered preformatted
3129 </td>
3130 </tr>
3131 </table>
3132 !! html
3133 <table>
3134 <tr>
3135 <td>
3136 <pre>Text that should be rendered preformatted
3137 </pre>
3138 </td>
3139 </tr>
3140 </table>
3141
3142 !! end
3143
3144 !!test
3145 3a. Indent-Pre and block tags (single-line html)
3146 !! wikitext
3147 a <p> foo </p>
3148 b <div> foo </div>
3149 c <blockquote> foo </blockquote>
3150 <span> foo </span>
3151 !! html
3152 a <p> foo </p>
3153 b <div> foo </div>
3154 c <blockquote> foo </blockquote>
3155 <pre><span> foo </span>
3156 </pre>
3157 !! html/parsoid
3158 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3159 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3160 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3161 <pre><span> foo </span>
3162 </pre>
3163 !! html+tidy
3164 <p>a</p>
3165 <p>foo</p>
3166 <p>b</p>
3167 <div>foo</div>
3168 <p>c</p>
3169 <blockquote>
3170 <p>foo</p>
3171 </blockquote>
3172 <pre>
3173 <span> foo </span>
3174 </pre>
3175 !! end
3176
3177 !!test
3178 3b. Indent-Pre and block tags (multi-line html)
3179 !! wikitext
3180 a <span>foo</span>
3181 b <div> foo </div>
3182 !! html
3183 <pre>a <span>foo</span>
3184 </pre>
3185 b <div> foo </div>
3186
3187 !! html/parsoid
3188 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3189 b <div data-parsoid='{"stx":"html"}'> foo </div>
3190 !! html+tidy
3191 <pre>
3192 a <span>foo</span>
3193 </pre>
3194 <p>b</p>
3195 <div>foo</div>
3196 !!end
3197
3198 !!test
3199 3c. Indent-Pre and block tags (pre-content on separate line)
3200 !! wikitext
3201 <p>
3202 foo
3203 </p>
3204
3205 <div>
3206 foo
3207 </div>
3208
3209 <center>
3210 foo
3211 </center>
3212
3213 <blockquote>
3214 foo
3215 </blockquote>
3216
3217 <blockquote>
3218 <pre>
3219 foo
3220 </pre>
3221 </blockquote>
3222
3223 <table><tr><td>
3224 foo
3225 </td></tr></table>
3226
3227 <ul><li>
3228 foo
3229 </li></ul>
3230
3231 !! html
3232 <p>
3233 foo
3234 </p>
3235 <div>
3236 <pre>foo
3237 </pre>
3238 </div>
3239 <center>
3240 <pre>foo
3241 </pre>
3242 </center>
3243 <blockquote>
3244 <p> foo
3245 </p>
3246 </blockquote>
3247 <blockquote>
3248 <pre>
3249 foo
3250 </pre>
3251 </blockquote>
3252 <table><tr><td>
3253 <pre>foo
3254 </pre>
3255 </td></tr></table>
3256 <ul><li>
3257 foo
3258 </li></ul>
3259
3260 !!end
3261
3262 !! test
3263 4. Indent-Pre and extension tags
3264 !! wikitext
3265 a <tag />
3266 !! html/php
3267 a <pre>
3268 NULL
3269 array (
3270 )
3271 </pre>
3272
3273 !! html/parsoid
3274 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3275 !! end
3276
3277 !!test
3278 Render paragraphs when indent-pre is suppressed in blocklevels
3279 !! wikitext
3280 <blockquote>
3281 foo
3282
3283 bar
3284 </blockquote>
3285 !! html
3286 <blockquote>
3287 <p> foo
3288 </p><p> bar
3289 </p>
3290 </blockquote>
3291
3292 !!end
3293
3294 !!test
3295 4. Multiple spaces at start-of-line
3296 !! wikitext
3297 <p> foo </p>
3298 foo
3299 {|
3300 |foo
3301 |}
3302 !! html
3303 <p> foo </p>
3304 <pre> foo
3305 </pre>
3306 <table>
3307 <tr>
3308 <td>foo
3309 </td></tr></table>
3310
3311 !!end
3312
3313 ## NOTE: the leading white-space chars on empty line are significant
3314 !! test
3315 5a. White-space in indent-pre
3316 !! wikitext
3317 a<br />
3318
3319 b
3320 !! html
3321 <pre>a<br />
3322
3323 b
3324 </pre>
3325 !! end
3326
3327 ## NOTE: the leading white-space chars on empty line are significant
3328 !! test
3329 5b. White-space in indent-pre
3330 !! wikitext
3331 a
3332
3333 b
3334
3335
3336 c
3337 !! html
3338 <pre>a
3339
3340 b
3341
3342
3343 c
3344 </pre>
3345 !! end
3346
3347 !! test
3348 5c. White-space in indent-pre
3349 !! wikitext
3350 ''a''
3351 ''b''
3352 ''c''
3353 !! html
3354 <pre><i>a</i>
3355 <i>b</i>
3356 <i>c</i>
3357 </pre>
3358 !! end
3359
3360 !! test
3361 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3362 !! wikitext
3363 a
3364
3365 <!-- continue -->
3366 b
3367
3368 c
3369
3370 d
3371 !! html
3372 <pre>a
3373
3374 b
3375 </pre>
3376 <pre>c
3377
3378 </pre>
3379 <p>d
3380 </p>
3381 !! end
3382
3383 !! test
3384 7a. Indent-pre and category links
3385 !! options
3386 parsoid=wt2html,wt2wt
3387 !! wikitext
3388 [[Category:foo]] <!-- No pre-wrapping -->
3389 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3390 !! html/php+tidy
3391 !! html/parsoid
3392 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3393 <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 -->
3394 !! end
3395
3396 ## We used to, but no longer wt2wt this test since the default serializer
3397 ## will normalize all categories to serialize on their own line.
3398 ## This wikitext usage is going to be fairly uncommon in production and
3399 ## selser will take care of preserving formatting in those scenarios.
3400 !! test
3401 7b. Indent-pre and category links
3402 !! options
3403 parsoid=wt2html
3404 !! wikitext
3405 [[Category:foo]] a
3406 [[Category:foo]] {{echo|b}}
3407 !! html/parsoid
3408 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3409 <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>
3410 !! end
3411
3412 !! test
3413 Indent-Pre: Newlines in comments shouldn't affect sol state
3414 !! wikitext
3415 a <!--
3416 foo
3417 --> b
3418 !! html/php+tidy
3419 <p>a b</p>
3420 !! html/parsoid
3421 <p>a <!--
3422 foo
3423 --> b</p>
3424 !! end
3425
3426 ###
3427 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3428 ###
3429
3430 !!test
3431 HTML-pre: 1. embedded newlines
3432 !! wikitext
3433 <pre>foo</pre>
3434
3435 <pre>
3436 foo
3437 </pre>
3438
3439 <pre>
3440
3441 foo
3442 </pre>
3443
3444 <pre>
3445
3446
3447 foo
3448 </pre>
3449 !! html/php+tidy
3450 <pre>
3451 foo
3452 </pre>
3453 <pre>
3454 foo
3455 </pre>
3456 <pre>
3457
3458 foo
3459 </pre>
3460 <pre>
3461
3462
3463 foo
3464 </pre>
3465 !! html/parsoid
3466 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3467
3468 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3469 foo
3470 </pre>
3471
3472 <pre data-parsoid='{"stx":"html"}'>
3473
3474 foo
3475 </pre>
3476
3477 <pre data-parsoid='{"stx":"html"}'>
3478
3479
3480 foo
3481 </pre>
3482 !!end
3483
3484 !! test
3485 HTML-pre: big spaces
3486 !! wikitext
3487 <pre>
3488
3489
3490
3491
3492 haha
3493
3494
3495
3496
3497 haha
3498
3499
3500
3501
3502 </pre>
3503 !! html/php+tidy
3504 <pre>
3505
3506
3507
3508
3509 haha
3510
3511
3512
3513
3514 haha
3515
3516
3517
3518
3519 </pre>
3520 !! html/parsoid
3521 <pre data-parsoid='{"stx":"html"}'>
3522
3523
3524
3525
3526 haha
3527
3528
3529
3530
3531 haha
3532
3533
3534
3535
3536 </pre>
3537 !! end
3538
3539 !!test
3540 HTML-pre: 2: indented text
3541 !! wikitext
3542 <pre>
3543 foo
3544 </pre>
3545 !! html
3546 <pre>
3547 foo
3548 </pre>
3549
3550 !!end
3551
3552 !!test
3553 HTML-pre: 3: other wikitext
3554 !! wikitext
3555 <pre>
3556 * foo
3557 # bar
3558 = no-h =
3559 '' no-italic ''
3560 [[ NoLink ]]
3561 </pre>
3562 !! html/php
3563 <pre>
3564 * foo
3565 # bar
3566 = no-h =
3567 '' no-italic ''
3568 [[ NoLink ]]
3569 </pre>
3570
3571 !! html/parsoid
3572 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3573 # bar
3574 = no-h =
3575 '' no-italic ''
3576 [[ NoLink ]]
3577 </pre>
3578 !!end
3579
3580 ###
3581 ### Definition lists
3582 ###
3583 !! test
3584 Simple definition
3585 !! wikitext
3586 ; name : Definition
3587 !! html
3588 <dl><dt> name&#160;</dt>
3589 <dd> Definition</dd></dl>
3590
3591 !! end
3592
3593 !! test
3594 Definition list for indentation only
3595 !! wikitext
3596 : Indented text
3597 !! html
3598 <dl><dd> Indented text</dd></dl>
3599
3600 !! end
3601
3602 !! test
3603 Definition list with no space
3604 !! wikitext
3605 ;name:Definition
3606 !! html
3607 <dl><dt>name</dt>
3608 <dd>Definition</dd></dl>
3609
3610 !!end
3611
3612 !! test
3613 Definition list with URL link
3614 !! wikitext
3615 ; http://example.com/ : definition
3616 !! html
3617 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3618 <dd> definition</dd></dl>
3619
3620 !! end
3621
3622 !! test
3623 Definition list with bracketed URL link
3624 !! wikitext
3625 ;[http://www.example.com/ Example]:Something about it
3626 !! html
3627 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3628 <dd>Something about it</dd></dl>
3629
3630 !! end
3631
3632 !! test
3633 Definition list with wikilink containing colon
3634 !! wikitext
3635 ; [[Help:FAQ]]: The least-read page on Wikipedia
3636 !! html
3637 <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>
3638 <dd> The least-read page on Wikipedia</dd></dl>
3639
3640 !! end
3641
3642 # At Brion's and JeLuF's insistence... :)
3643 !! test
3644 Definition list with news link containing colon
3645 !! wikitext
3646 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3647 !! html/php
3648 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3649 <dd> This isn't even a real newsgroup!</dd></dl>
3650
3651 !! html/parsoid
3652 <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>
3653 !! end
3654
3655 !! test
3656 Malformed definition list with colon
3657 !! wikitext
3658 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3659 !! html
3660 <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>
3661
3662 !! end
3663
3664 !! test
3665 Definition lists: colon in external link text
3666 !! wikitext
3667 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3668 !! html
3669 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3670 <dd> OK, I made that up</dd></dl>
3671
3672 !! end
3673
3674 !! test
3675 Definition lists: colon in HTML attribute
3676 !! wikitext
3677 ;<b style="display: inline">bold</b>
3678 !! html
3679 <dl><dt><b style="display: inline">bold</b></dt></dl>
3680
3681 !! end
3682
3683 !! test
3684 Definition lists: self-closed tag
3685 !! wikitext
3686 ;one<br/>two : two-line fun
3687 !! html
3688 <dl><dt>one<br />two&#160;</dt>
3689 <dd> two-line fun</dd></dl>
3690
3691 !! end
3692
3693 !! test
3694 Bug 11748: Literal closing tags
3695 !! wikitext
3696 <dl>
3697 <dt>test 1</dt>
3698 <dd>test test test test test</dd>
3699 <dt>test 2</dt>
3700 <dd>test test test test test</dd>
3701 </dl>
3702 !! html
3703 <dl>
3704 <dt>test 1</dt>
3705 <dd>test test test test test</dd>
3706 <dt>test 2</dt>
3707 <dd>test test test test test</dd>
3708 </dl>
3709
3710 !! end
3711
3712 !! test
3713 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3714 !! wikitext
3715 <ul><li>
3716 ; term : description
3717 * unordered
3718 </li></ul>
3719 !! html
3720 <ul><li>
3721 <dl><dt> term&#160;</dt>
3722 <dd> description</dd></dl>
3723 <ul><li> unordered</li></ul>
3724 </li></ul>
3725
3726 !! end
3727
3728 !! test
3729 Definition list with empty definition and following paragraph
3730 !! wikitext
3731 ; term:
3732 Paragraph text
3733 !! html
3734 <dl><dt> term</dt>
3735 <dd></dd></dl>
3736 <p>Paragraph text
3737 </p>
3738 !! end
3739
3740 !! test
3741 Nested definition lists using html syntax
3742 !! wikitext
3743 <dl><dt>x</dt>
3744 <dd>a</dd>
3745 <dd>b</dd></dl>
3746 !! html
3747 <dl><dt>x</dt>
3748 <dd>a</dd>
3749 <dd>b</dd></dl>
3750
3751 !! end
3752
3753 !! test
3754 Definition Lists: No nesting: Multiple dd's
3755 !! wikitext
3756 ;x
3757 :a
3758 :b
3759 !! html
3760 <dl><dt>x</dt>
3761 <dd>a</dd>
3762 <dd>b</dd></dl>
3763
3764 !! end
3765
3766 !! test
3767 Definition Lists: Indentation: Regular
3768 !! wikitext
3769 :i1
3770 ::i2
3771 :::i3
3772 !! html
3773 <dl><dd>i1
3774 <dl><dd>i2
3775 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3776
3777 !! end
3778
3779 !! test
3780 Definition Lists: Indentation: Missing 1st level
3781 !! wikitext
3782 ::i2
3783 :::i3
3784 !! html
3785 <dl><dd><dl><dd>i2
3786 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3787
3788 !! end
3789
3790 !! test
3791 Definition Lists: Indentation: Multi-level indent
3792 !! wikitext
3793 :::i3
3794 !! html
3795 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3796
3797 !! end
3798
3799 !! test
3800 Definition Lists: Hacky use to indent tables
3801 !! wikitext
3802 ::{|
3803 |foo
3804 |bar
3805 |}
3806 this text
3807 should be left alone
3808 !! html
3809 <dl><dd><dl><dd><table>
3810 <tr>
3811 <td>foo
3812 </td>
3813 <td>bar
3814 </td></tr></table></dd></dl></dd></dl>
3815 <p>this text
3816 should be left alone
3817 </p>
3818 !! end
3819
3820 !! test
3821 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3822 !! wikitext
3823 <!-- foo -->
3824 ::{|
3825 |foo
3826 |bar
3827 |}<!-- bar -->
3828 this text
3829 should be left alone
3830 !! html/parsoid
3831 <!-- foo -->
3832 <dl><dd><dl><dd><table><tr>
3833 <td>foo</td>
3834 <td>bar</td>
3835 </tr></table><!-- bar --></dd></dl></dd></dl>
3836 <p>this text
3837 should be left alone</p>
3838 !! end
3839
3840 !! test
3841 Definition Lists: Hacky use to indent tables, with comment before table
3842 !! wikitext
3843 ::<!-- foo -->{|
3844 |foo
3845 |}
3846 !! html/parsoid
3847 <dl><dd><dl><dd><!-- foo --><table><tr>
3848 <td>foo</td>
3849 </tr></table></dd></dl></dd></dl>
3850 !! end
3851
3852 # The trailing whitespace in this test is to catch a regression in
3853 # Parsoid after T54473.
3854 !! test
3855 Definition Lists: Hacky use to indent tables (WS-insensitive)
3856 !! wikitext
3857 : {|
3858 |a
3859 |}
3860 !! html/php
3861 <dl><dd><table>
3862 <tr>
3863 <td>a
3864 </td></tr></table></dd></dl>
3865
3866 !! html/parsoid
3867 <dl><dd> <table>
3868 <tbody><tr><td>a</td></tr>
3869 </tbody></table> </dd></dl>
3870 !! end
3871
3872 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3873 ## as an empty dt item. It also ignores all but the last ";" when followed
3874 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3875 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3876 ## ";"s.
3877 ##
3878 ## Ex: ";;t2 ::d2" is transformed into:
3879 ##
3880 ## <dl>
3881 ## <dt>t2 </dt>
3882 ## <dd>
3883 ## <dl>
3884 ## <dt></dt>
3885 ## <dd>d2</dd>
3886 ## </dl>
3887 ## </dd>
3888 ## </dl>
3889 ##
3890 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3891 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3892 ##
3893 ## <dl>
3894 ## <dt>
3895 ## <dl>
3896 ## <dt>t2 </dt>
3897 ## <dd>:d2</dd>
3898 ## </dl>
3899 ## </dt>
3900 ## </dl>
3901 ##
3902 ## All Parsoid only definition list tests have this difference.
3903 ##
3904 ## See also: https://phabricator.wikimedia.org/T8569
3905 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3906
3907 !! test
3908 Table / list interaction: indented table with lists in table contents
3909 !! wikitext
3910 :{|
3911 |-
3912 | a
3913 * b
3914 |-
3915 | c
3916 * d
3917 |}
3918 !! html
3919 <dl><dd><table>
3920
3921 <tr>
3922 <td> a
3923 <ul><li> b</li></ul>
3924 </td></tr>
3925 <tr>
3926 <td> c
3927 <ul><li> d</li></ul>
3928 </td></tr></table></dd></dl>
3929
3930 !! end
3931
3932 !!test
3933 Table / list interaction: lists nested in tables nested in indented lists
3934 !! wikitext
3935 :{|
3936 |
3937 :a
3938 :b
3939 |
3940 *c
3941 *d
3942 |}
3943
3944 *e
3945 *f
3946 !! html
3947 <dl><dd><table>
3948 <tr>
3949 <td>
3950 <dl><dd>a</dd>
3951 <dd>b</dd></dl>
3952 </td>
3953 <td>
3954 <ul><li>c</li>
3955 <li>d</li></ul>
3956 </td></tr></table></dd></dl>
3957 <ul><li>e</li>
3958 <li>f</li></ul>
3959
3960 !!end
3961
3962 !! test
3963 Definition Lists: Nesting: Multi-level (Parsoid only)
3964 !! options
3965 parsoid
3966 !! wikitext
3967 ;t1 :d1
3968 ;;t2 ::d2
3969 ;;;t3 :::d3
3970 !! html
3971 <dl>
3972 <dt>t1 </dt>
3973 <dd>d1</dd>
3974 <dt>
3975 <dl>
3976 <dt>t2 </dt>
3977 <dd>:d2</dd>
3978 <dt>
3979 <dl>
3980 <dt>t3 </dt>
3981 <dd>::d3</dd>
3982 </dl>
3983 </dt>
3984 </dl>
3985 </dt>
3986 </dl>
3987
3988
3989 !! end
3990
3991
3992 !! test
3993 Definition Lists: Nesting: Test 2 (Parsoid only)
3994 !! wikitext
3995 ;t1
3996 ::d2
3997 !! html/php+tidy
3998 <dl>
3999 <dt>t1</dt>
4000 <dd>
4001 <dl>
4002 <dd>d2</dd>
4003 </dl>
4004 </dd>
4005 </dl>
4006 !! html/parsoid
4007 <dl>
4008 <dt>t1</dt>
4009 <dd>
4010 <dl>
4011 <dd>d2</dd>
4012 </dl>
4013 </dd>
4014 </dl>
4015
4016 !! end
4017
4018
4019 !! test
4020 Definition Lists: Nesting: Test 3 (Parsoid only)
4021 !! wikitext
4022 :;t1
4023 ::::d2
4024 !! html/php+tidy
4025 <dl>
4026 <dd>
4027 <dl>
4028 <dt>t1</dt>
4029 <dd>
4030 <dl>
4031 <dd>
4032 <dl>
4033 <dd>d2</dd>
4034 </dl>
4035 </dd>
4036 </dl>
4037 </dd>
4038 </dl>
4039 </dd>
4040 </dl>
4041 !! html/parsoid
4042 <dl>
4043 <dd>
4044 <dl>
4045 <dt>t1</dt>
4046 <dd>
4047 <dl>
4048 <dd>
4049 <dl>
4050 <dd>d2</dd>
4051 </dl>
4052 </dd>
4053 </dl>
4054 </dd>
4055 </dl>
4056 </dd>
4057 </dl>
4058
4059 !! end
4060
4061
4062 !! test
4063 Definition Lists: Nesting: Test 4
4064 !! wikitext
4065 ::;t3
4066 :::d3
4067 !! html
4068 <dl><dd><dl><dd><dl><dt>t3</dt>
4069 <dd>d3</dd></dl></dd></dl></dd></dl>
4070
4071 !! end
4072
4073
4074 ## The Parsoid team believes the following three test exposes a
4075 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4076 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4077 ## It also exposes a "misfeature" in tidy, which doesn't like
4078 ## <dl> tags with a single <dt> child; it converts the <dt> into
4079 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4080 !! test
4081 Definition Lists: Mixed Lists: Test 1
4082 !! wikitext
4083 :;* foo
4084 ::* bar
4085 :; baz
4086 !! html/php
4087 <dl><dd><dl><dt><ul><li> foo</li>
4088 <li> bar</li></ul></dt></dl>
4089 <dl><dt> baz</dt></dl></dd></dl>
4090
4091 !! html/php+tidy
4092 <dl>
4093 <dd>
4094 <dl>
4095 <dd>
4096 <ul>
4097 <li>foo</li>
4098 <li>bar</li>
4099 </ul>
4100 </dd>
4101 </dl>
4102 <dl>
4103 <dt>baz</dt>
4104 </dl>
4105 </dd>
4106 </dl>
4107 !! html/parsoid
4108 <dl>
4109 <dd><dl>
4110 <dt><ul>
4111 <li> foo
4112 </li>
4113 </ul></dt>
4114 <dd><ul>
4115 <li> bar
4116 </li>
4117 </ul></dd>
4118 <dt> baz</dt>
4119 </dl></dd>
4120 </dl>
4121 !! end
4122
4123 !! test
4124 Definition Lists: Mixed Lists: Test 2
4125 !! wikitext
4126 *: d1
4127 *: d2
4128 !! html
4129 <ul><li><dl><dd> d1</dd>
4130 <dd> d2</dd></dl></li></ul>
4131
4132 !! end
4133
4134
4135 !! test
4136 Definition Lists: Mixed Lists: Test 3
4137 !! wikitext
4138 *::: d1
4139 *::: d2
4140 !! html
4141 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4142 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4143
4144 !! end
4145
4146
4147 !! test
4148 Definition Lists: Mixed Lists: Test 4
4149 !! wikitext
4150 *;d1 :d2
4151 *;d3 :d4
4152 !! html
4153 <ul><li><dl><dt>d1&#160;</dt>
4154 <dd>d2</dd>
4155 <dt>d3&#160;</dt>
4156 <dd>d4</dd></dl></li></ul>
4157
4158 !! end
4159
4160
4161 !! test
4162 Definition Lists: Mixed Lists: Test 5
4163 !! wikitext
4164 *:d1
4165 *:: d2
4166 !! html
4167 <ul><li><dl><dd>d1
4168 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4169
4170 !! end
4171
4172
4173 !! test
4174 Definition Lists: Mixed Lists: Test 6
4175 !! wikitext
4176 #*:d1
4177 #*::: d3
4178 !! html
4179 <ol><li><ul><li><dl><dd>d1
4180 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4181
4182 !! end
4183
4184
4185 !! test
4186 Definition Lists: Mixed Lists: Test 7
4187 !! wikitext
4188 :* d1
4189 :* d2
4190 !! html
4191 <dl><dd><ul><li> d1</li>
4192 <li> d2</li></ul></dd></dl>
4193
4194 !! end
4195
4196
4197 !! test
4198 Definition Lists: Mixed Lists: Test 8
4199 !! wikitext
4200 :* d1
4201 ::* d2
4202 !! html
4203 <dl><dd><ul><li> d1</li></ul>
4204 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4205
4206 !! end
4207
4208
4209 !! test
4210 Definition Lists: Mixed Lists: Test 9
4211 !! wikitext
4212 *;foo :bar
4213 !! html
4214 <ul><li><dl><dt>foo&#160;</dt>
4215 <dd>bar</dd></dl></li></ul>
4216
4217 !! end
4218
4219
4220 !! test
4221 Definition Lists: Mixed Lists: Test 10
4222 !! wikitext
4223 *#;foo :bar
4224 !! html
4225 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4226 <dd>bar</dd></dl></li></ol></li></ul>
4227
4228 !! end
4229
4230 # The Parsoid team disagrees with the PHP parser's seemingly-random
4231 # rules regarding dd/dt on the next two tests. Parsoid is more
4232 # consistent, and recognizes the shared nesting and keeps the
4233 # still-open tags around until the nesting is complete.
4234 # (And tidy again converts <dt> to <dd> before 'bar'.)
4235
4236 !! test
4237 Definition Lists: Mixed Lists: Test 11
4238 !! wikitext
4239 *#*#;*;;foo :bar
4240 *#*#;boo :baz
4241 !! html/php
4242 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4243 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4244 <dl><dt>boo&#160;</dt>
4245 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4246
4247 !! html/php+tidy
4248 <ul>
4249 <li>
4250 <ol>
4251 <li>
4252 <ul>
4253 <li>
4254 <ol>
4255 <li>
4256 <dl>
4257 <dt>foo&#160;</dt>
4258 <dd>
4259 <ul>
4260 <li>
4261 <dl>
4262 <dd>
4263 <dl>
4264 <dt>bar</dt>
4265 </dl>
4266 </dd>
4267 </dl>
4268 </li>
4269 </ul>
4270 </dd>
4271 </dl>
4272 <dl>
4273 <dt>boo&#160;</dt>
4274 <dd>baz</dd>
4275 </dl>
4276 </li>
4277 </ol>
4278 </li>
4279 </ul>
4280 </li>
4281 </ol>
4282 </li>
4283 </ul>
4284 !! html/parsoid
4285 <ul>
4286 <li>
4287 <ol>
4288 <li>
4289 <ul>
4290 <li>
4291 <ol>
4292 <li>
4293 <dl>
4294 <dt>
4295 <ul>
4296 <li>
4297 <dl>
4298 <dt>
4299 <dl>
4300 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4301 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4302 </dl></dt>
4303 </dl></li>
4304 </ul></dt>
4305 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4306 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4307 </dl></li>
4308 </ol></li>
4309 </ul></li>
4310 </ol></li>
4311 </ul>
4312 !! end
4313
4314
4315 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4316 # From whitelist:
4317 # * The test is wrong, there are two colons where there should be :;
4318 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4319 !! test
4320 Definition Lists: Weird Ones: Test 1
4321 !! wikitext
4322 *#;*::;; foo : bar (who uses this?)
4323 !! html/php
4324 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4325 <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>
4326
4327 !! html/php+tidy
4328 <ul>
4329 <li>
4330 <ol>
4331 <li>
4332 <dl>
4333 <dt>foo&#160;</dt>
4334 <dd>
4335 <ul>
4336 <li>
4337 <dl>
4338 <dd>
4339 <dl>
4340 <dd>
4341 <dl>
4342 <dd>
4343 <dl>
4344 <dt>bar (who uses this?)</dt>
4345 </dl>
4346 </dd>
4347 </dl>
4348 </dd>
4349 </dl>
4350 </dd>
4351 </dl>
4352 </li>
4353 </ul>
4354 </dd>
4355 </dl>
4356 </li>
4357 </ol>
4358 </li>
4359 </ul>
4360 !! html/parsoid
4361 <ul>
4362 <li>
4363 <ol>
4364 <li>
4365 <dl>
4366 <dt>
4367 <ul>
4368 <li>
4369 <dl>
4370 <dd>
4371 <dl>
4372 <dd>
4373 <dl>
4374 <dt>
4375 <dl>
4376 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4377 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4378 </dl></dt>
4379 </dl></dd>
4380 </dl></dd>
4381 </dl></li>
4382 </ul></dt>
4383 </dl></li>
4384 </ol></li>
4385 </ul>
4386 !! end
4387
4388 !! test
4389 Definition Lists: colons occurring in tags
4390 !! wikitext
4391 ;a:b
4392 ;'''a:b'''
4393 ;<i>a:b</i>
4394 ;<span>a:b</span>
4395 ;<div>a:b</div>
4396 ;<div>a
4397 :b</div>
4398 ;{{echo|a:b}}
4399 ;{{echo|''a:b''}}
4400 ;;;''a:b''
4401 !! html+tidy
4402 <dl>
4403 <dt>a</dt>
4404 <dd>b</dd>
4405 <dt><b>a:b</b></dt>
4406 <dt><i>a:b</i></dt>
4407 <dt><span>a:b</span></dt>
4408 <dd>
4409 <div>a:b</div>
4410 </dd>
4411 <dd>
4412 <div>a
4413 <dl>
4414 <dd>b</dd>
4415 </dl>
4416 </div>
4417 </dd>
4418 <dt>a</dt>
4419 <dd>b</dd>
4420 <dt><i>a:b</i></dt>
4421 </dl>
4422 <dl>
4423 <dd>
4424 <dl>
4425 <dd>
4426 <dl>
4427 <dt><i>a:b</i></dt>
4428 </dl>
4429 </dd>
4430 </dl>
4431 </dd>
4432 </dl>
4433 !! html/parsoid
4434 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4435 <dt><b>a:b</b></dt>
4436 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4437 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4438 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4439 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4440 <dd>b</dd>
4441 <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>
4442 <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>
4443 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4444 !! end
4445
4446 !! test
4447 Definition Lists: colons and tables 1
4448 !! wikitext
4449 :{|
4450 | x
4451 |}
4452 :{|
4453 | y
4454 |}
4455 !! html
4456 <dl><dd><table>
4457 <tr>
4458 <td> x
4459 </td></tr></table></dd></dl>
4460 <dl><dd><table>
4461 <tr>
4462 <td> y
4463 </td></tr></table></dd></dl>
4464
4465 !! end
4466
4467 # Parsoid's output (as documented below) differs from php's in this case.
4468 # This is probably a bug. If we fixup parsoid to match php's output, the
4469 # above test should pass and the below test case can be removed. It is
4470 # unclear which output is more desirable.
4471
4472 !! test
4473 Definition Lists: colons and tables 2
4474 !! wikitext
4475 :{|
4476 | x
4477 |}
4478 :{|
4479 | y
4480 |}
4481 !! html/parsoid
4482 <dl><dd><table>
4483 <tr>
4484 <td> x
4485 </td></tr></table></dd>
4486 <dd><table>
4487 <tr>
4488 <td> y
4489 </td></tr></table></dd></dl>
4490 !! end
4491
4492 !! test
4493 Definition Lists: template interaction
4494 !! wikitext
4495 ::{{definition_list}}
4496
4497 :one
4498 ::{{definition_list}}
4499 :::two
4500 :::three
4501 ::four
4502 !! html/parsoid
4503 <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">
4504 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4505
4506 <dl><dd data-parsoid='{}'>one
4507 <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">
4508 </span><dd about="#mwt2">two
4509 <dl><dd>two</dd>
4510 <dd>three</dd></dl></dd>
4511 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4512 !! end
4513
4514
4515 ###
4516 ### External links
4517 ###
4518 !! test
4519 External links: non-bracketed
4520 !! wikitext
4521 Non-bracketed: http://example.com
4522 !! html
4523 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4524 </p>
4525 !! end
4526
4527 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4528 !! test
4529 External links: numbered
4530 !! wikitext
4531 Numbered: [http://example.com]
4532 Numbered: [http://example.net]
4533 Numbered: [http://example.com]
4534 !! html/php
4535 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4536 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4537 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4538 </p>
4539 !! html/parsoid
4540 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4541 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4542 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4543 !!end
4544
4545 !! test
4546 External links: specified text
4547 !! wikitext
4548 Specified text: [http://example.com link]
4549 !! html
4550 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4551 </p>
4552 !!end
4553
4554 !! test
4555 External links: trail
4556 !! wikitext
4557 Linktrails should not work for external links: [http://example.com link]s
4558 !! html
4559 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4560 </p>
4561 !! end
4562
4563 !! test
4564 External links: dollar sign in URL
4565 !! wikitext
4566 http://example.com/1$2345
4567 !! html
4568 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4569 </p>
4570 !! end
4571
4572 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4573 !! test
4574 External links: dollar sign in URL (autonumber)
4575 !! wikitext
4576 [http://example.com/1$2345]
4577 !! html/php
4578 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4579 </p>
4580 !! html/parsoid
4581 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4582 !!end
4583
4584 !! test
4585 External links: open square bracket forbidden in URL (bug 4377)
4586 !! options
4587 parsoid=wt2html,wt2wt,html2html
4588 !! wikitext
4589 http://example.com/1[2345
4590 !! html/php
4591 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4592 </p>
4593 !! html/parsoid
4594 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4595 !! end
4596
4597 !! test
4598 External links: open square bracket forbidden in URL (named) (bug 4377)
4599 !! options
4600 parsoid=wt2html,html2html
4601 !! wikitext
4602 [http://example.com/1[2345]
4603 !! html/php
4604 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4605 </p>
4606 !! html/parsoid
4607 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4608 !!end
4609
4610 # parsoid adds a space before the link name
4611 !! test
4612 External links: open square bracket forbidden in URL (named) (bug 4377)
4613 Parsoid variant.
4614 !! wikitext
4615 [http://example.com/1 [2345]
4616 !! html
4617 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4618 </p>
4619 !!end
4620
4621 !! test
4622 External links: nowiki in URL link text (bug 6230)
4623 !! wikitext
4624 [http://example.com/ <nowiki>''example site''</nowiki>]
4625 !! html
4626 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4627 </p>
4628 !! end
4629
4630 !! test
4631 External links: newline forbidden in text (bug 6230 regression check)
4632 !! wikitext
4633 [http://example.com/ first
4634 second]
4635 !! html
4636 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4637 second]
4638 </p>
4639 !!end
4640
4641 !! test
4642 External links: Pipe char between url and text
4643 !! wikitext
4644 [http://example.com | link]
4645 !! html
4646 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4647 </p>
4648 !!end
4649
4650 !! test
4651 External links: protocol-relative URL in brackets
4652 !! wikitext
4653 [//example.com/ Test]
4654 !! html
4655 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4656 </p>
4657 !! end
4658
4659 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4660 !! test
4661 External links: protocol-relative URL in brackets without text
4662 !! wikitext
4663 [//example.com]
4664 !! html/php
4665 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4666 </p>
4667 !! html/parsoid
4668 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4669 !! end
4670
4671 !! test
4672 External links: protocol-relative URL in free text is left alone
4673 !! wikitext
4674 //example.com/Foo
4675 !! html
4676 <p>//example.com/Foo
4677 </p>
4678 !!end
4679
4680 !! test
4681 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4682 !! wikitext
4683 foo//example.com/Foo
4684 !! html
4685 <p>foo//example.com/Foo
4686 </p>
4687 !! end
4688
4689 !! test
4690 External links: with no contents
4691 !! wikitext
4692 [http://en.wikipedia.org/wiki/Foo]
4693
4694 [[wikipedia:Foo|Bar]]
4695
4696 [[wikipedia:Foo|<span>Bar</span>]]
4697 !! html/php
4698 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4699 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4700 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4701 </p>
4702 !! html/parsoid
4703 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4704 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4705 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4706 !! end
4707
4708 !! test
4709 External links: Free with trailing punctuation
4710 !! wikitext
4711 http://example.com,
4712 http://example.com;
4713 http://example.com\
4714 http://example.com.
4715 http://example.com:
4716 http://example.com!
4717 http://example.com?
4718 http://example.com)
4719 http://example.com/url_with_(brackets)
4720 (http://example.com/url_without_brackets)
4721 http://example.com/url_with_entity&amp;
4722 http://example.com/url_with_entity&#x26;
4723 http://example.com/url_with_entity&#038;
4724 http://example.com/url_with_entity&nbsp;
4725 http://example.com/url_with_entity&#xA0;
4726 http://example.com/url_with_entity&#160;
4727 http://example.com/url_with_entity&lt;
4728 http://example.com/url_with_entity&#x3C;
4729 http://example.com/url_with_entity&#60;
4730 !! html/php
4731 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4732 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4733 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4734 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4735 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4736 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4737 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4738 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4739 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4740 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4741 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4742 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4743 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4744 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4745 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4746 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4747 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4748 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4749 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4750 </p>
4751 !! html/parsoid
4752 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4753 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4754 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4755 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4756 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4757 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4758 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4759 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4760 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4761 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4762 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4763 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4764 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4765 <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>
4766 <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>
4767 <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>
4768 <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>
4769 <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>
4770 <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>
4771 !! end
4772
4773 !! test
4774 External links: tricky Parsoid html2html case
4775 !! options
4776 parsoid=wt2html,wt2wt,html2html
4777 !! wikitext
4778 http://example.com/url_with_entity&amp;amp;
4779 !! html/php
4780 <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>;
4781 </p>
4782 !! html/parsoid
4783 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4784 !! end
4785
4786 !! test
4787 External links: Free with trailing quotes (T113666)
4788 !! wikitext
4789 '''News:''' Stuff here
4790
4791 news:'a'b''c''d e
4792 !! html/php
4793 <p><b>News:</b> Stuff here
4794 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4795 </p>
4796 !! html/parsoid
4797 <p><b>News:</b> Stuff here</p>
4798 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4799 !! end
4800
4801 !! test
4802 External links: Lone protocols are never linked (T105697)
4803 !! wikitext
4804 http://
4805 http://;
4806 (http://)
4807 bitcoin:
4808 bitcoin:;
4809 (bitcoin:)
4810 !! html
4811 <p>http://
4812 http://;
4813 (http://)
4814 bitcoin:
4815 bitcoin:;
4816 (bitcoin:)
4817 </p>
4818 !! end
4819
4820 !! test
4821 External links: No preceding word characters allowed (bug 65278)
4822 !! wikitext
4823 NOPEhttp://example.com
4824 N0http://example.com
4825 ok:http://example.com
4826 ok-http://example.com
4827 !! html
4828 <p>NOPEhttp://example.com
4829 N0http://example.com
4830 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4831 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4832 </p>
4833 !! end
4834
4835 !! test
4836 External links: nofollow domain exception
4837 !! wikitext
4838 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4839 !! html
4840 <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>.
4841 </p>
4842 !!end
4843
4844 !! test
4845 External image
4846 !! wikitext
4847 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4848 !! html
4849 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4850 </p>
4851 !! end
4852
4853 !! test
4854 External image from https
4855 !! wikitext
4856 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4857 !! html
4858 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4859 </p>
4860 !! end
4861
4862 !! test
4863 External image (when not allowed)
4864 !! options
4865 wgAllowExternalImages=0
4866 !! wikitext
4867 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4868 !! html
4869 <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>
4870 </p>
4871 !! end
4872
4873 !! test
4874 Link to non-http image, no img tag
4875 !! wikitext
4876 Link to non-http image, no img tag: ftp://example.com/test.jpg
4877 !! html
4878 <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>
4879 </p>
4880 !! end
4881
4882 !! test
4883 External links: terminating separator
4884 !! wikitext
4885 Terminating separator: http://example.com/thing,
4886 !! html
4887 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4888 </p>
4889 !! end
4890
4891 !! test
4892 External links: intervening separator
4893 !! wikitext
4894 Intervening separator: http://example.com/1,2,3
4895 !! html
4896 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4897 </p>
4898 !! end
4899
4900 !! test
4901 External links: old bug with URL in query
4902 !! wikitext
4903 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4904 !! html
4905 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4906 </p>
4907 !! end
4908
4909 !! test
4910 External links: old URL-in-URL bug, mixed protocols
4911 !! wikitext
4912 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4913 !! html
4914 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4915 </p>
4916 !!end
4917
4918 # Since Parsoid is starting to emit canonical wikitext for links,
4919 # [http://example.com http://example.com] will not RT back to that
4920 # form anymore.
4921 !! test
4922 External links: URL in text
4923 !! options
4924 parsoid=wt2html
4925 !! wikitext
4926 URL in text: [http://example.com http://example.com]
4927 !! html/php
4928 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4929 </p>
4930 !! html/parsoid
4931 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4932 !! end
4933
4934 !! test
4935 External links: Clickable images
4936 !! wikitext
4937 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4938 !! html/php
4939 <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>
4940 </p>
4941 !! html/parsoid
4942 <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>
4943 !! end
4944
4945 !! test
4946 External links: raw ampersand
4947 !! wikitext
4948 Old &amp; use: http://x&y
4949 !! html
4950 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4951 </p>
4952 !! end
4953
4954 !! test
4955 External links: encoded ampersand
4956 !! wikitext
4957 Old &amp; use: http://x&amp;y
4958 !! html/php
4959 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4960 </p>
4961 !! html/parsoid
4962 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4963 !! end
4964
4965 !! test
4966 External links: encoded equals (bug 6102)
4967 !! wikitext
4968 http://example.com/?foo&#61;bar
4969 !! html/php
4970 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4971 </p>
4972 !! html/parsoid
4973 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4974 !! end
4975
4976 ##
4977 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4978 ## does it number them. As discussed in bug 53505, we can identify
4979 ## autonumbered links via CSS.
4980 ##
4981
4982 !! test
4983 External links: [raw ampersand]
4984 !! wikitext
4985 Old &amp; use: [http://x&y]
4986 !! html/php
4987 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4988 </p>
4989 !! html/parsoid
4990 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4991 !! end
4992
4993 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4994 # mode will return the [raw ampersand] wikitext
4995 !! test
4996 External links: [encoded ampersand]
4997 !! options
4998 parsoid=wt2html,wt2wt,html2html
4999 !! wikitext
5000 Old &amp; use: [http://x&amp;y]
5001 !! html/php
5002 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5003 </p>
5004 !! html/parsoid
5005 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5006 !! end
5007
5008 !! test
5009 External links: [raw equals]
5010 !! wikitext
5011 [http://example.com/?foo=bar]
5012 !! html/php
5013 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5014 </p>
5015 !! html/parsoid
5016 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5017 !! end
5018
5019 # note that parsoid html is identical to [raw equals] case; so html2wt
5020 # mode will return the [raw equals] wikitext
5021 !! test
5022 External links: [encoded equals] (bug 6102)
5023 !! options
5024 parsoid=wt2html,wt2wt,html2html
5025 !! wikitext
5026 [http://example.com/?foo&#61;bar]
5027 !! html/php
5028 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5029 </p>
5030 !! html/parsoid
5031 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5032 !! end
5033
5034 # xxx parsoid strips the IDN character, so the round-trip tests will
5035 # obviously fail and are disabled. --cscott
5036 !! test
5037 External links: [IDN ignored character reference in hostname; strip it right off]
5038 !! options
5039 parsoid=wt2html,wt2wt,html2html
5040 !! wikitext
5041 [http://e&zwnj;xample.com/]
5042 !! html/php
5043 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5044 </p>
5045 !! html/parsoid
5046 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5047 !! end
5048
5049 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5050 # Where an external link could easily circumvent the sanitization of the text of
5051 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5052 # test demands a higher standard. That's a bit strange.
5053 #
5054 # Example:
5055 #
5056 # http://e‌xample.com -> [http://example.com|http://example.com]
5057 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5058 #
5059 # The first example is sanitized, but the second is not. Any security benefits
5060 # from this production are trivial to circumvent. Either remove this test and
5061 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5062 # the test accordingly.
5063 #
5064 # All our love,
5065 # The Parsoid team.
5066 # xxx parsoid strips the IDN character, so the round-trip tests will
5067 # obviously fail and are disabled. --cscott
5068 !! test
5069 External links: IDN ignored character reference in hostname; strip it right off
5070 !! options
5071 parsoid=wt2html,html2html
5072 !! wikitext
5073 http://e&zwnj;xample.com/
5074 !! html/php
5075 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5076 </p>
5077 !! html/parsoid
5078 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5079 !! end
5080
5081 !! test
5082 External links: www.jpeg.org (bug 554)
5083 !! wikitext
5084 http://www.jpeg.org
5085 !! html
5086 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5087 </p>
5088 !! end
5089
5090 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5091 !! test
5092 External links: URL within URL (original bug 2)
5093 !! wikitext
5094 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5095 !! html/php
5096 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5097 </p>
5098 !! html/parsoid
5099 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5100 !! end
5101
5102 !! test
5103 BUG 361: URL inside bracketed URL
5104 !! wikitext
5105 [http://www.example.com/foo http://www.example.com/bar]
5106 !! html
5107 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5108 </p>
5109 !! end
5110
5111 !! test
5112 BUG 361: URL within URL, not bracketed
5113 !! wikitext
5114 http://www.example.com/foo?=http://www.example.com/bar
5115 !! html
5116 <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>
5117 </p>
5118 !! end
5119
5120 !! test
5121 BUG 289: ">"-token in URL-tail
5122 !! wikitext
5123 http://www.example.com/<hello>
5124 !! html
5125 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5126 </p>
5127 !!end
5128
5129 !! test
5130 BUG 289: literal ">"-token in URL-tail
5131 !! wikitext
5132 http://www.example.com/<b>html</b>
5133 !! html/php
5134 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5135 </p>
5136 !! html/parsoid
5137 <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>
5138 !! end
5139
5140 !! test
5141 BUG 289: ">"-token in bracketed URL
5142 !! wikitext
5143 [http://www.example.com/<hello> stuff]
5144 !! html
5145 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5146 </p>
5147 !!end
5148
5149 !! test
5150 BUG 289: literal ">"-token in bracketed URL
5151 !! wikitext
5152 [http://www.example.com/<b>html</b> stuff]
5153 !! html
5154 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5155 </p>
5156 !!end
5157
5158 !! test
5159 BUG 289: literal double quote at end of URL
5160 !! wikitext
5161 http://www.example.com/"hello"
5162 !! html
5163 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5164 </p>
5165 !!end
5166
5167 !! test
5168 BUG 289: literal double quote in bracketed URL
5169 !! wikitext
5170 [http://www.example.com/"hello" stuff]
5171 !! html
5172 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5173 </p>
5174 !!end
5175
5176 !! test
5177 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5178 !! wikitext
5179 [http://www.example.com test]
5180 !! html
5181 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5182 </p>
5183 !! end
5184
5185 !! test
5186 External links: link text with spaces
5187 !! wikitext
5188 [http://www.example.com a b c]
5189 [http://www.example.com ''a'' ''b'']
5190 !! html
5191 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5192 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5193 </p>
5194 !! end
5195
5196 !! test
5197 External links: wiki links within external link (Bug 3695)
5198 !! options
5199 parsoid=wt2html,html2html
5200 !! wikitext
5201 [http://example.com [[wikilink]] embedded in ext link]
5202 !! html/php
5203 <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>
5204 </p>
5205 !! html/parsoid
5206 <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>
5207 !! end
5208
5209 !! test
5210 BUG 787: Links with one slash after the url protocol are invalid
5211 !! wikitext
5212 http:/example.com
5213
5214 [http:/example.com title]
5215 !! html
5216 <p>http:/example.com
5217 </p><p>[http:/example.com title]
5218 </p>
5219 !! end
5220
5221 !! test
5222 Bracketed external links with template-generated invalid target
5223 !! wikitext
5224 [{{echo|http:/example.com}} title]
5225 !! html
5226 <p>[http:/example.com title]
5227 </p>
5228 !! end
5229
5230 !! test
5231 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5232 !! wikitext
5233 ''[http://example.com text'']
5234 [http://example.com '''text]'''
5235 ''Something [http://example.com in italic'']
5236 ''Something [http://example.com mixed''''', even bold]'''
5237 '''''Now [http://example.com both''''']
5238 !! html
5239 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5240 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5241 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5242 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5243 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5244 </p>
5245 !! end
5246
5247
5248 !! test
5249 Bug 4781: %26 in URL
5250 !! wikitext
5251 http://www.example.com/?title=AT%26T
5252 !! html/php
5253 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5254 </p>
5255 !! html/parsoid
5256 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5257 !! end
5258
5259 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5260 # % is actually legal in HTML5. Any change in output would need testing though.
5261 !! test
5262 Bug 4781, 5267: %25 in URL
5263 !! wikitext
5264 http://www.example.com/?title=100%25_Bran
5265 !! html/php
5266 <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>
5267 </p>
5268 !! html/parsoid
5269 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5270 !! end
5271
5272 !! test
5273 Bug 4781, 5267: %28, %29 in URL
5274 !! wikitext
5275 http://www.example.com/?title=Ben-Hur_%281959_film%29
5276 !! html/php
5277 <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>
5278 </p>
5279 !! html/parsoid
5280 <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>
5281 !! end
5282
5283
5284 !! test
5285 Bug 4781: %26 in autonumber URL
5286 !! wikitext
5287 [http://www.example.com/?title=AT%26T]
5288 !! html/php
5289 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5290 </p>
5291 !! html/parsoid
5292 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5293 !! end
5294
5295 !! test
5296 Bug 4781, 5267: %26 in autonumber URL
5297 !! wikitext
5298 [http://www.example.com/?title=100%25_Bran]
5299 !! html/php
5300 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5301 </p>
5302 !! html/parsoid
5303 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5304 !! end
5305
5306 !! test
5307 Bug 4781, 5267: %28, %29 in autonumber URL
5308 !! wikitext
5309 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5310 !! html/php
5311 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5312 </p>
5313 !! html/parsoid
5314 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5315 !! end
5316
5317
5318 !! test
5319 Bug 4781: %26 in bracketed URL
5320 !! wikitext
5321 [http://www.example.com/?title=AT%26T link]
5322 !! html/php
5323 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5324 </p>
5325 !! html/parsoid
5326 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5327 !! end
5328
5329 !! test
5330 Bug 4781, 5267: %25 in bracketed URL
5331 !! wikitext
5332 [http://www.example.com/?title=100%25_Bran link]
5333 !! html
5334 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5335 </p>
5336 !! end
5337
5338 !! test
5339 Bug 4781, 5267: %28, %29 in bracketed URL
5340 !! wikitext
5341 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5342 !! html/php
5343 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5344 </p>
5345 !! html/parsoid
5346 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5347 !! end
5348
5349 !! test
5350 External link containing a period in the anchor. (bug 63947)
5351 !! wikitext
5352 [//foo.org/bar#baz. bang]
5353
5354 [//foo.org/bar. bang]
5355 !! html/php
5356 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5357 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5358 </p>
5359 !! html/parsoid
5360 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5361 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5362 !! end
5363
5364 !! test
5365 External link containing a single quote. (bug 63947)
5366 !! wikitext
5367 [//foo.org/bar'baz]
5368
5369 [//foo.org/bar'baz bang]
5370 !! html/php
5371 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5372 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5373 </p>
5374 !! html/parsoid
5375 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5376 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5377 !! end
5378
5379 !! test
5380 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5381 !! wikitext
5382 Some [http://example.com/ pretty ''italics'' and stuff]!
5383 !! html
5384 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5385 </p>
5386 !! end
5387
5388 !! test
5389 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5390 !! wikitext
5391 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5392 !! html
5393 <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>
5394 </p>
5395 !! end
5396
5397 !! test
5398 External link containing double-single-quotes with no space separating the url from text in italics
5399 !! wikitext
5400 [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]].]
5401 !! html/php
5402 <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>
5403 </p>
5404 !! html/php+tidy
5405 <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>
5406 !! html/parsoid
5407 <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>
5408 !! end
5409
5410 !! test
5411 External link with comments in link text
5412 !! wikitext
5413 [http://www.google.com Google <!-- comment -->]
5414 !! html/php
5415 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5416 </p>
5417 !! html/parsoid
5418 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5419 !! end
5420
5421 !! test
5422 External link to bare IPv4 address
5423 !! wikitext
5424 [http://192.168.0.1 Link]
5425 !! html/php
5426 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5427 </p>
5428 !! html/parsoid
5429 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5430 !! end
5431
5432 !! test
5433 URL-encoding in URL functions (single parameter)
5434 !! wikitext
5435 {{localurl:Some page|amp=&}}
5436 !! html
5437 <p>/index.php?title=Some_page&amp;amp=&amp;
5438 </p>
5439 !! end
5440
5441 !! test
5442 URL-encoding in URL functions (multiple parameters)
5443 !! wikitext
5444 {{localurl:Some page|q=?&amp=&}}
5445 !! html
5446 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5447 </p>
5448 !! end
5449
5450 !! test
5451 Brackets in urls
5452 !! wikitext
5453 http://example.com/index.php?foozoid%5B%5D=bar
5454
5455 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5456 !! html/php
5457 <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>
5458 </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>
5459 </p>
5460 !! html/parsoid
5461 <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>
5462
5463 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5464 !! end
5465
5466 !! test
5467 IPv6 urls, autolink format (T23261)
5468 !! wikitext
5469 http://[2404:130:0:1000::187:2]/index.php
5470
5471 Examples from RFC 2373, section 2.2:
5472 * http://[1080::8:800:200C:417A]/unicast
5473 * http://[FF01::101]/multicast
5474 * http://[::1]/loopback
5475 * http://[::]/unspecified
5476 * http://[::13.1.68.3]/ipv4compat
5477 * http://[::FFFF:129.144.52.38]/ipv4compat
5478
5479 Examples from RFC 2732, section 2:
5480 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5481 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5482 * http://[3ffe:2a00:100:7031::1]
5483 * http://[1080::8:800:200C:417A]/foo
5484 * http://[::192.9.5.5]/ipng
5485 * http://[::FFFF:129.144.52.38]:80/index.html
5486 * http://[2010:836B:4179::836B:4179]
5487
5488 !! html/php
5489 <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>
5490 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5491 </p>
5492 <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>
5493 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5494 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5495 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5496 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5497 <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>
5498 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5499 </p>
5500 <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>
5501 <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>
5502 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5503 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5504 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5505 <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>
5506 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5507
5508 !! html/parsoid
5509 <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>
5510
5511 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5512 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5513 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5514 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5515 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5516 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5517 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5518
5519 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5520 <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>
5521 <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>
5522 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5523 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5524 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5525 <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>
5526 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5527 !! end
5528
5529 !! test
5530 IPv6 urls, bracketed format (T23261)
5531 !! wikitext
5532 [http://[2404:130:0:1000::187:2]/index.php test]
5533
5534 Examples from RFC 2373, section 2.2:
5535 * [http://[1080::8:800:200C:417A] unicast]
5536 * [http://[FF01::101] multicast]
5537 * [http://[::1]/ loopback]
5538 * [http://[::] unspecified]
5539 * [http://[::13.1.68.3] ipv4compat]
5540 * [http://[::FFFF:129.144.52.38] ipv4compat]
5541
5542 Examples from RFC 2732, section 2:
5543 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5544 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5545 * [http://[3ffe:2a00:100:7031::1] 3]
5546 * [http://[1080::8:800:200C:417A]/foo 4]
5547 * [http://[::192.9.5.5]/ipng 5]
5548 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5549 * [http://[2010:836B:4179::836B:4179] 7]
5550
5551 !! html/php
5552 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5553 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5554 </p>
5555 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5556 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5557 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5558 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5559 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5560 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5561 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5562 </p>
5563 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5564 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5565 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5566 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5567 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5568 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5569 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5570
5571 !! html/parsoid
5572 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5573
5574 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5575 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5576 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5577 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5578 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5579 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5580 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5581
5582 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5583 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5584 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5585 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5586 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5587 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5588 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5589 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5590 !! end
5591
5592 !! test
5593 Non-extlinks in brackets
5594 !! wikitext
5595 [foo]
5596 [foo bar]
5597 [foo ''bar'']
5598 [fool's] errand
5599 [fool's errand]
5600 [{{echo|foo}}]
5601 [{{echo|foo}} bar]
5602 [{{echo|foo}} ''bar'']
5603 [{{echo|foo}}l's] errand
5604 [{{echo|foo}}l's errand]
5605 [url={{echo|foo}}]
5606 [url=http://example.com]
5607 [http:// bare protocols don't count]
5608 !! html/php
5609 <p>[foo]
5610 [foo bar]
5611 [foo <i>bar</i>]
5612 [fool's] errand
5613 [fool's errand]
5614 [foo]
5615 [foo bar]
5616 [foo <i>bar</i>]
5617 [fool's] errand
5618 [fool's errand]
5619 [url=foo]
5620 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5621 [http:// bare protocols don't count]
5622 </p>
5623 !! html/parsoid
5624 <p>[foo]
5625 [foo bar]
5626 [foo <i>bar</i>]
5627 [fool's] errand
5628 [fool's errand]
5629 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5630 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5631 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5632 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5633 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5634 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5635 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5636 [http:// bare protocols don't count]</p>
5637 !! end
5638
5639 !! test
5640 Percent encoding in external links
5641 !! wikitext
5642 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5643 !! html/php
5644 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5645 </p>
5646 !! html/parsoid
5647 <p><a rel="mw:ExtLink"
5648 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5649 !! end
5650
5651 !! test
5652 Use url link syntax for links where the content is equal the link target
5653 !! wikitext
5654 http://example.com
5655 !! html/php
5656 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5657 </p>
5658 !! html/parsoid
5659 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5660 !! end
5661
5662 !! test
5663 Parenthesis in external links, especially URL links
5664 !! wikitext
5665 http://example.com)
5666
5667 http://example.com/test)
5668
5669 http://example.com/(test)
5670
5671 http://example.com/((test)
5672
5673 (http://example.com/(test))
5674
5675 (http://example.com/(test)))))
5676
5677 http://example.com/a)b
5678
5679 [http://example.com) foo]
5680 !! html/php
5681 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5682 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5683 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5684 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5685 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5686 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5687 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5688 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5689 </p>
5690 !! html/parsoid
5691 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5692 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5693 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5694 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5695 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5696 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5697 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5698 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5699 !! end
5700
5701 !! test
5702 Parenthesis in external links, w/ transclusion or comment
5703 !! wikitext
5704 (http://example.com/{{echo|hi}})
5705
5706 (http://example.com<!-- hi -->)
5707 !! html/php
5708 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5709 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5710 </p>
5711 !! html/parsoid
5712 <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>
5713
5714 <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>
5715 !! end
5716
5717 !! test
5718 Serialize <a> tags with invalid link targets as plain text
5719 !! options
5720 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5721 !! html/parsoid
5722 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5723 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5724 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5725 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5726 !! wikitext
5727 text
5728 <nowiki>*</nowiki>text
5729 <nowiki>[[foo]]</nowiki>
5730 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5731 !! end
5732
5733 !! test
5734 mw:ExtLink -vs- mw:WikiLink (T94723)
5735 !! options
5736 parsoid=html2wt
5737 !! html/parsoid
5738 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5739 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5740 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5741 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5742 <p>
5743 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5744 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5745 </p>
5746 !! wikitext
5747 [[Foo|Bar]]
5748 [[Foo|Bar]]
5749 [[wikipedia:Foo|Bar]]
5750 [[wikipedia:Foo|Bar]]
5751
5752 [[wikipedia:European_Robin|European Robin]]
5753 [[wikipedia:European_Robin|European Robin]]
5754 !! end
5755
5756 !! test
5757 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5758 !! options
5759 parsoid=wt2wt
5760 !! wikitext
5761 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5762 !! html/parsoid
5763 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5764 !! end
5765
5766
5767 ###
5768 ### Quotes
5769 ###
5770
5771 !! test
5772 Quotes
5773 !! wikitext
5774 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5775
5776 Normal text. '''''Bold italic text.''''' Normal text.
5777 !! html
5778 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5779 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5780 </p>
5781 !! end
5782
5783
5784 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5785 # parser strips. The wikitext contains just the first half of the bold
5786 # quote pair.
5787 !! test
5788 Unclosed and unmatched quotes
5789 !! wikitext
5790 '''''Bold italic text '''with bold deactivated''' in between.'''''
5791
5792 '''''Bold italic text ''with italic deactivated'' in between.'''''
5793
5794 '''Bold text..
5795
5796 ..spanning two paragraphs (should not work).'''
5797
5798 '''Bold tag left open
5799
5800 ''Italic tag left open
5801
5802 Normal text.
5803
5804 <!-- Unmatching number of opening, closing tags: -->
5805 '''This year''''s election ''should'' beat '''last year''''s.
5806
5807 ''Tom'''s car is bigger than ''Susan'''s.
5808
5809 Plain ''italic'''s plain
5810 !! html/php
5811 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5812 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5813 </p><p><b>Bold text..</b>
5814 </p><p>..spanning two paragraphs (should not work).
5815 </p><p><b>Bold tag left open</b>
5816 </p><p><i>Italic tag left open</i>
5817 </p><p>Normal text.
5818 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5819 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5820 </p><p>Plain <i>italic'</i>s plain
5821 </p>
5822 !! html/parsoid
5823 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5824 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5825 </p><p><b>Bold text..</b>
5826 </p><p>..spanning two paragraphs (should not work).<b></b>
5827 </p><p><b>Bold tag left open</b>
5828 </p><p><i>Italic tag left open</i>
5829 </p><p>Normal text.
5830 </p>
5831 <!-- Unmatching number of opening, closing tags: -->
5832 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5833 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5834 </p><p>Plain <i>italic'</i>s plain
5835 </p>
5836 !! end
5837
5838 ###
5839 ### Tables
5840 ###
5841 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5842 ###
5843
5844 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5845 # is the bare minimum required by the spec, see:
5846 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5847 # Parsoid team replies: empty table tags are legal in HTML5
5848 !! test
5849 A table with no data.
5850 !! options
5851 parsoid=wt2html
5852 !! wikitext
5853 {||}
5854 !! html/php
5855
5856 !! html/parsoid
5857 <table></table>
5858
5859 !! end
5860
5861 !! test
5862 A table with stray table end tags on start tag line (wt2html)
5863 !! options
5864 parsoid=wt2html
5865 !! wikitext
5866 {|style="color: red;"|}
5867
5868 {|style="color: red;" |}
5869 |foo
5870 |}
5871
5872 {|style="color: red;"|} id="foo"
5873 |foo
5874 |}
5875
5876 {|style="color: red;" |} id="foo"
5877 |foo
5878 |}
5879 !! html
5880 <table style="color: red;"></table>
5881
5882 <table style="color: red;">
5883 <tbody><tr>
5884 <td>foo</td>
5885 </tr></tbody>
5886 </table>
5887
5888 <table style="color: red;" id="foo">
5889 <tbody><tr>
5890 <td>foo</td>
5891 </tr></tbody>
5892 </table>
5893
5894 <table style="color: red;" id="foo">
5895 <tbody><tr>
5896 <td>foo</td>
5897 </tr></tbody>
5898 </table>
5899
5900 !! end
5901
5902 !! test
5903 A table with no data (take 2)
5904 !! wikitext
5905 {|
5906 |}
5907 !! html/parsoid
5908 <table></table>
5909 !! end
5910
5911 # A table with nothing but a caption is invalid XHTML, we might want to render
5912 # this as <p>caption</p>
5913 # Parsoid team replies: table with only a caption is legal in HTML5
5914 !! test
5915 A table with nothing but a caption
5916 !! wikitext
5917 {|
5918 |+ caption
5919 |}
5920 !! html/php
5921 <table>
5922 <caption> caption
5923 </caption><tr><td></td></tr></table>
5924
5925 !! html/parsoid
5926 <table><caption> caption</caption></table>
5927 !! end
5928
5929 !! test
5930 A table with caption with default-spaced attributes and a table row
5931 !! wikitext
5932 {|
5933 |+ style="color: red;" | caption1
5934 |-
5935 | foo
5936 |}
5937 !! html
5938 <table>
5939 <caption style="color: red;"> caption1
5940 </caption>
5941 <tr>
5942 <td> foo
5943 </td></tr></table>
5944
5945 !! end
5946
5947 !! test
5948 A table with captions with non-default spaced attributes and a table row
5949 !! wikitext
5950 {|
5951 |+style="color: red;"|caption2
5952 |+ style="color: red;"| caption3
5953 |-
5954 | foo
5955 |}
5956 !! html
5957 <table>
5958 <caption style="color: red;">caption2
5959 </caption>
5960 <caption style="color: red;"> caption3
5961 </caption>
5962 <tr>
5963 <td> foo
5964 </td></tr></table>
5965
5966 !! end
5967
5968 !! test
5969 Table td-cell syntax variations
5970 !! wikitext
5971 {|
5972 | foo bar foo | baz
5973 | foo bar foo || baz
5974 | style='color:red;' | baz
5975 | style='color:red;' || baz
5976 |}
5977 !! html
5978 <table>
5979 <tr>
5980 <td> baz
5981 </td>
5982 <td> foo bar foo </td>
5983 <td> baz
5984 </td>
5985 <td style="color:red;"> baz
5986 </td>
5987 <td> style='color:red;' </td>
5988 <td> baz
5989 </td></tr></table>
5990
5991 !! end
5992
5993 !! test
5994 Simple table
5995 !! wikitext
5996 {|
5997 | 1 || 2
5998 |-
5999 | 3 || 4
6000 |}
6001 !! html
6002 <table>
6003 <tr>
6004 <td> 1 </td>
6005 <td> 2
6006 </td></tr>
6007 <tr>
6008 <td> 3 </td>
6009 <td> 4
6010 </td></tr></table>
6011
6012 !! end
6013
6014 !! test
6015 Simple table but with multiple dashes for row wikitext
6016 !! wikitext
6017 {|
6018 | foo
6019 |-----
6020 | bar
6021 |}
6022 !! html
6023 <table>
6024 <tr>
6025 <td> foo
6026 </td></tr>
6027 <tr>
6028 <td> bar
6029 </td></tr></table>
6030
6031 !! end
6032
6033 !! test
6034 Multiplication table
6035 !! wikitext
6036 {| border="1" cellpadding="2"
6037 |+Multiplication table
6038 |-
6039 ! &times; !! 1 !! 2 !! 3
6040 |-
6041 ! 1
6042 | 1 || 2 || 3
6043 |-
6044 ! 2
6045 | 2 || 4 || 6
6046 |-
6047 ! 3
6048 | 3 || 6 || 9
6049 |-
6050 ! 4
6051 | 4 || 8 || 12
6052 |-
6053 ! 5
6054 | 5 || 10 || 15
6055 |}
6056 !! html
6057 <table border="1" cellpadding="2">
6058 <caption>Multiplication table
6059 </caption>
6060 <tr>
6061 <th> &#215; </th>
6062 <th> 1 </th>
6063 <th> 2 </th>
6064 <th> 3
6065 </th></tr>
6066 <tr>
6067 <th> 1
6068 </th>
6069 <td> 1 </td>
6070 <td> 2 </td>
6071 <td> 3
6072 </td></tr>
6073 <tr>
6074 <th> 2
6075 </th>
6076 <td> 2 </td>
6077 <td> 4 </td>
6078 <td> 6
6079 </td></tr>
6080 <tr>
6081 <th> 3
6082 </th>
6083 <td> 3 </td>
6084 <td> 6 </td>
6085 <td> 9
6086 </td></tr>
6087 <tr>
6088 <th> 4
6089 </th>
6090 <td> 4 </td>
6091 <td> 8 </td>
6092 <td> 12
6093 </td></tr>
6094 <tr>
6095 <th> 5
6096 </th>
6097 <td> 5 </td>
6098 <td> 10 </td>
6099 <td> 15
6100 </td></tr></table>
6101
6102 !! end
6103
6104 !! test
6105 Accept "||" in table headings
6106 !! wikitext
6107 {|
6108 !h1 || h2
6109 |}
6110 !! html
6111 <table>
6112 <tr>
6113 <th>h1 </th>
6114 <th> h2
6115 </th></tr></table>
6116
6117 !! end
6118
6119 !! test
6120 Accept "!!" in table data
6121 !! wikitext
6122 {|
6123 | Foo!! ||
6124 |}
6125 !! html
6126 <table>
6127 <tr>
6128 <td> Foo!! </td>
6129 <td>
6130 </td></tr></table>
6131
6132 !! html/parsoid
6133 <table>
6134 <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>
6135 </tbody></table>
6136 !! end
6137
6138 !! test
6139 Accept "||" in indented table headings
6140 !! wikitext
6141 :{|
6142 !h1 || h2
6143 |}
6144 !! html
6145 <dl><dd><table>
6146 <tr>
6147 <th>h1 </th>
6148 <th> h2
6149 </th></tr></table></dd></dl>
6150
6151 !! end
6152
6153 !! test
6154 Accept "!!" in templates
6155 !! wikitext
6156 {|
6157 !a {{echo|b!!c}}
6158 |}
6159 !! html/php
6160 <table>
6161 <tr>
6162 <th>a b</th>
6163 <th>c
6164 </th></tr></table>
6165
6166 !! html/parsoid
6167 <table>
6168 <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>
6169 !! end
6170
6171 !! test
6172 Accept "!!" in table headings after newline
6173 !! wikitext
6174 {|
6175 !a
6176 b!!c
6177 |}
6178 !! html/php
6179 <table>
6180 <tr>
6181 <th>a
6182 <p>b!!c
6183 </p>
6184 </th></tr></table>
6185
6186 !! html/parsoid
6187 <table>
6188 <tbody><tr><th>a
6189 <p>b!!c</p></th></tr>
6190 </tbody></table>
6191 !! end
6192
6193 !! test
6194 Accept "!!" in table data of mixed wikitext / html syntax
6195 !! wikitext
6196 {|
6197 !a
6198 <tr><td>b!!c</td></tr>
6199 |}
6200 !! html+tidy
6201 <table>
6202 <tr>
6203 <th>a</th>
6204 </tr>
6205 <tr>
6206 <td>b!!c</td>
6207 </tr>
6208 </table>
6209 !! html/parsoid
6210 <table>
6211 <tbody><tr><th>a</th></tr>
6212 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6213 </tbody></table>
6214 !! end
6215
6216 !! test
6217 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6218 !! wikitext
6219 {|
6220 !| h1
6221 || a
6222 |}
6223 !! html
6224 <table>
6225 <tr>
6226 <th> h1
6227 </th>
6228 <td> a
6229 </td></tr></table>
6230
6231 !! end
6232
6233 !!test
6234 Accept "| !" at start of line in tables (ignore !-attribute)
6235 !! wikitext
6236 {|
6237 |-
6238 | !style="color:red" | bar
6239 |}
6240 !! html
6241 <table>
6242
6243 <tr>
6244 <td> bar
6245 </td></tr></table>
6246
6247 !!end
6248
6249 !!test
6250 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 +/-
6251 !! wikitext
6252 {|
6253 |-
6254 |style='color:red;'|+1
6255 |style='color:blue;'|-1
6256 |-
6257 | 1 || 2 || 3
6258 | 1 ||+2 ||-3
6259 |-
6260 | +1
6261 | -1
6262 |}
6263 !! html
6264 <table>
6265
6266 <tr>
6267 <td style="color:red;">+1
6268 </td>
6269 <td style="color:blue;">-1
6270 </td></tr>
6271 <tr>
6272 <td> 1 </td>
6273 <td> 2 </td>
6274 <td> 3
6275 </td>
6276 <td> 1 </td>
6277 <td>+2 </td>
6278 <td>-3
6279 </td></tr>
6280 <tr>
6281 <td> +1
6282 </td>
6283 <td> -1
6284 </td></tr></table>
6285
6286 !!end
6287
6288 !! test
6289 Table rowspan
6290 !! wikitext
6291 {| border=1
6292 | Cell 1, row 1
6293 |rowspan=2| Cell 2, row 1 (and 2)
6294 | Cell 3, row 1
6295 |-
6296 | Cell 1, row 2
6297 | Cell 3, row 2
6298 |}
6299 !! html
6300 <table border="1">
6301 <tr>
6302 <td> Cell 1, row 1
6303 </td>
6304 <td rowspan="2"> Cell 2, row 1 (and 2)
6305 </td>
6306 <td> Cell 3, row 1
6307 </td></tr>
6308 <tr>
6309 <td> Cell 1, row 2
6310 </td>
6311 <td> Cell 3, row 2
6312 </td></tr></table>
6313
6314 !! end
6315
6316 !! test
6317 Nested table
6318 !! wikitext
6319 {| border=1
6320 | &alpha;
6321 |
6322 {| bgcolor=#ABCDEF border=2
6323 |nested
6324 |-
6325 |table
6326 |}
6327 |the original table again
6328 |}
6329 !! html
6330 <table border="1">
6331 <tr>
6332 <td> &#945;
6333 </td>
6334 <td>
6335 <table bgcolor="#ABCDEF" border="2">
6336 <tr>
6337 <td>nested
6338 </td></tr>
6339 <tr>
6340 <td>table
6341 </td></tr></table>
6342 </td>
6343 <td>the original table again
6344 </td></tr></table>
6345
6346 !! end
6347
6348 !! test
6349 Invalid attributes in table cell (bug 1830)
6350 !! wikitext
6351 {|
6352 |Cell:|broken
6353 |}
6354 !! html
6355 <table>
6356 <tr>
6357 <td>broken
6358 </td></tr></table>
6359
6360 !! end
6361
6362 !! test
6363 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6364 !! wikitext
6365 {|
6366 | title="foo" |bar
6367 | title="foo<nowiki>|</nowiki>" |bar
6368 | title="foo<nowiki>|</nowiki>" bar
6369 |}
6370 !! html/php
6371 <table>
6372 <tr>
6373 <td title="foo">bar
6374 </td>
6375 <td title="foo&#124;">bar
6376 </td>
6377 <td> title="foo|" bar
6378 </td></tr></table>
6379
6380 !! html/parsoid
6381 <table>
6382 <tbody><tr><td title="foo">bar</td>
6383 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6384 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6385 </tbody></table>
6386 !! end
6387
6388 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6389 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6390 # *2wt modes will fail.
6391 !! test
6392 Table security: embedded pipes
6393 !! options
6394 parsoid=wt2html,html2html
6395 !! wikitext
6396 {|
6397 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6398 !! html/php
6399 <table>
6400 <tr>
6401 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6402 <td>]" onmouseover="alert(document.cookie)"&gt;test
6403 </td>
6404 </tr>
6405 </table>
6406
6407 !! html/parsoid
6408 <table><tbody>
6409 <tr>
6410 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6411 !! end
6412
6413 !! test
6414 Element attributes with double ! should not be broken up by <th>
6415 !! wikitext
6416 {|
6417 ! hi <div class="!!">ha</div> ho
6418 |}
6419 !! html/php
6420 <table>
6421 <tr>
6422 <th> hi <div class="!!">ha</div> ho
6423 </th></tr></table>
6424
6425 !! html/parsoid
6426 <table>
6427 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6428 </tbody></table>
6429 !! end
6430
6431 !! test
6432 ! and || in element attributes should not be parsed as <th>/<td>
6433 !! wikitext
6434 {|
6435 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6436 |}
6437 !! html/php
6438 <table>
6439 <tr>
6440 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6441 </td></tr></table>
6442
6443 !! html/parsoid
6444 <table>
6445 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6446 </tbody></table>
6447 !! end
6448
6449 # FIXME: The output seems broken. Filed as T110268.
6450 !! test
6451 ! and || in td attributes should not be parsed as <th>/<td>
6452 !! options
6453 parsoid=wt2html
6454 !! wikitext
6455 {|
6456 | style="color: red !important;" data-contrived="put this here ||" | foo
6457 |}
6458 !! html/php
6459 <table>
6460 <tr>
6461 <td> style="color: red !important;" data-contrived="put this here </td>
6462 <td> foo
6463 </td></tr></table>
6464
6465 !! html/parsoid
6466 <table>
6467 <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>
6468 </tbody></table>
6469 !! end
6470
6471 !! test
6472 Break on | in element attribute in template
6473 !! options
6474 parsoid=wt2html,html2html
6475 !! wikitext
6476 {{echo|1=<div class="hi|ho">ha</div>}}
6477 !! html/php
6478 <p>ho"&gt;ha&lt;/div&gt;
6479 </p>
6480 !! html/parsoid
6481 <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>
6482 !! end
6483
6484 !! test
6485 Break on | in element attribute name in template
6486 !! wikitext
6487 {{echo|<div cla|ss="hiho">ha</div>}}
6488 !! html/parsoid
6489 <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>
6490 !! end
6491
6492 !! test
6493 Don't break on | in extension attribute in template
6494 !! wikitext
6495 {{echo|<ref name="hi|ho">ha</ref>}}
6496
6497 <references />
6498 !! html/parsoid
6499 <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>
6500
6501 <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>
6502 !! end
6503
6504 ## We don't support roundtripping of these attributes in Parsoid.
6505 ## Selective serialization takes care of preventing dirty diffs.
6506 ## But, on edits, we dirty-diff the invalid attribute text.
6507 !! test
6508 Invalid text in table attributes should be discarded
6509 !! options
6510 parsoid=wt2html
6511 !! wikitext
6512 {| <span>boo</span> style='border:1px solid black'
6513 | <span>boo</span> style='color:blue' | 1
6514 |<span>boo</span> style='color:blue'| 2
6515 |}
6516 !! html/php
6517 <table style="border:1px solid black">
6518 <tr>
6519 <td style="color:blue"> 1
6520 </td>
6521 <td style="color:blue"> 2
6522 </td></tr></table>
6523
6524 !! html/parsoid
6525 <table style="border:1px solid black">
6526 <tr>
6527 <td style="color:blue"> 1</td>
6528 <td style="color:blue"> 2</td>
6529 </tr>
6530 </table>
6531 !! end
6532
6533 !! test
6534 Invalid text in table attributes should be preserved by selective serializer
6535 !! options
6536 parsoid={
6537 "modes": ["selser"],
6538 "changes": [
6539 ["td:first-child", "text", "abc"],
6540 ["td + td", "text", "xyz"]
6541 ]
6542 }
6543 !! wikitext
6544 {| <span>boo</span> style='border:1px solid black'
6545 | <span>boo</span> style='color:blue' | 1
6546 |<span>boo</span> style='color:blue'| 2
6547 |}
6548 !! wikitext/edited
6549 {| <span>boo</span> style='border:1px solid black'
6550 | <span>boo</span> style='color:blue' |abc
6551 |<span>boo</span> style='color:blue'|xyz
6552 |}
6553 !! end
6554
6555 !! test
6556 1. Template-generated table cell attributes and cell content
6557 !! wikitext
6558 {|
6559 |{{table_attribs}}
6560 | {{table_attribs}}
6561 || {{table_attribs_5}}
6562 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6563 |align=center {{table_attribs}}
6564 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6565 |}
6566 !! html
6567 <table>
6568 <tr>
6569 <td style="color:red;">Foo
6570 </td>
6571 <td style="color:red;">Foo
6572 </td>
6573 <td> style="color:red;"</td>
6574 <td>Bar
6575 </td>
6576 <td style="color:red;">Foo
6577 </td>
6578 <td align="center" style="color:red;">Foo
6579 </td>
6580 <td align="center" style="color:red;">Foo
6581 </td></tr></table>
6582
6583 !! end
6584
6585 !! test
6586 2. Template-generated table cell attributes and cell content
6587 !! wikitext
6588 {|
6589 |{{table_attribs_2}}
6590 |}
6591 !! html/php
6592 <table>
6593 <tr>
6594 <td style="color:red;">Foo
6595 </td>
6596 <td>Bar</td>
6597 <td>Baz
6598 </td></tr></table>
6599
6600 !! html/parsoid
6601 <table>
6602 <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>
6603 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6604 </tbody></table>
6605 !! end
6606
6607 !! test
6608 3. Template-generated table cell attributes and cell content
6609 !! wikitext
6610 {|
6611 !align=center {{table_header_cells}}
6612 |-
6613 |align=center {{table_cells}}
6614 |}
6615 !! html/php
6616 <table>
6617 <tr>
6618 <th align="center" style="color:red;">Foo</th>
6619 <th style="color:red;"><i>Bar</i></th>
6620 <th style="color:brown;"><i>Foo</i> and Baz
6621 </th></tr>
6622 <tr>
6623 <td align="center" style="color:red;">Foo</td>
6624 <td style="color:red;"><i>Bar</i></td>
6625 <td style="color:brown;"><i>Foo</i> and Baz
6626 </td></tr></table>
6627
6628 !! html/parsoid
6629 <table>
6630 <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>
6631 <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>
6632 </tbody></table>
6633 !! end
6634
6635 !! test
6636 4. Template-generated table cell attributes and cell content inside a templated table
6637 !! wikitext
6638 {{tbl-start}}
6639 !align=center {{table_header_cells}}
6640 |-
6641 |align=center {{table_cells}}
6642 {{tbl-end}}
6643 !! html/php
6644 <table>
6645 <tr>
6646 <th align="center" style="color:red;">Foo</th>
6647 <th style="color:red;"><i>Bar</i></th>
6648 <th style="color:brown;"><i>Foo</i> and Baz
6649 </th></tr>
6650 <tr>
6651 <td align="center" style="color:red;">Foo</td>
6652 <td style="color:red;"><i>Bar</i></td>
6653 <td style="color:brown;"><i>Foo</i> and Baz
6654 </td></tr></table>
6655
6656 !! html/parsoid
6657 <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}}]}'>
6658 <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>
6659 <tr>
6660 <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>
6661 </tbody></table>
6662 !! end
6663
6664 ## Edge case fix to prevent future regressions
6665 !! test
6666 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6667 !! wikitext
6668 {|
6669 |{{table_attribs_7}}
6670 |}
6671 <references />
6672 !! html/parsoid
6673 <table>
6674 <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>
6675 </tbody></table>
6676 <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>
6677 !! end
6678
6679 !! test
6680 Table with row followed by newlines and table heading
6681 !! options
6682 parsoid=wt2html,html2html
6683 !! wikitext
6684 {|
6685 |-
6686
6687 ! foo
6688 |}
6689 !! html/*
6690 <table>
6691
6692
6693 <tr>
6694 <th> foo
6695 </th></tr></table>
6696
6697 !! end
6698
6699 !! test
6700 Table with empty line following the start tag
6701 !! options
6702 parsoid=wt2html,html2html
6703 !! wikitext
6704 {|
6705
6706 |-
6707 | foo
6708 |}
6709 !! html/*
6710 <table>
6711
6712
6713 <tr>
6714 <td> foo
6715 </td></tr></table>
6716
6717 !! end
6718
6719 !! test
6720 Table attributes with empty value
6721 !! options
6722 parsoid=wt2html,html2html
6723 !! wikitext
6724 {|
6725 | style=| hello
6726 |}
6727 !! html/php
6728 <table>
6729 <tr>
6730 <td style=""> hello
6731 </td></tr></table>
6732
6733 !! html/parsoid
6734 <table>
6735 <tbody><tr><td style=""> hello</td></tr>
6736 </tbody></table>
6737 !! end
6738
6739 !! test
6740 Wikitext table with a lot of comments
6741 !! wikitext
6742 {|
6743 <!-- c0 -->
6744 | foo
6745 <!-- c1 -->
6746 |-<!-- c2 -->
6747 <!-- c3 -->
6748 |<!-- c4 -->
6749 <!-- c5 -->
6750 |}
6751 !! html
6752 <table>
6753 <tr>
6754 <td> foo
6755 </td></tr>
6756 <tr>
6757 <td>
6758 </td></tr></table>
6759
6760 !! end
6761
6762 !! test
6763 Wikitext table comments represented in parsoid dom
6764 !! wikitext
6765 {|<!--c1--><!--c2-->
6766 |-<!--c3-->
6767 | x
6768 |}
6769 !! html/php+tidy
6770 <table>
6771 <tr>
6772 <td>x</td>
6773 </tr>
6774 </table>
6775 !! html/parsoid
6776 <table><!--c1--><!--c2-->
6777 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6778 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6779 </tbody></table>
6780 !! end
6781
6782 !! test
6783 Wikitext table with double-line table cell
6784 !! wikitext
6785 {|
6786 |a
6787 b
6788 |}
6789 !! html
6790 <table>
6791 <tr>
6792 <td>a
6793 <p>b
6794 </p>
6795 </td></tr></table>
6796
6797 !! end
6798
6799 !! test
6800 Table cell with a single comment
6801 !! wikitext
6802 {|
6803 | <!-- c1 -->
6804 | a
6805 |}
6806 !! html
6807 <table>
6808 <tr>
6809 <td>
6810 </td>
6811 <td> a
6812 </td></tr></table>
6813
6814 !! end
6815
6816 !! test
6817 Table-cell after a comment-only-empty-line
6818 !! wikitext
6819 {|
6820 |a
6821 <!--c1-->
6822 <!--c2-->| b
6823 |}
6824 !! html
6825 <table>
6826 <tr>
6827 <td>a
6828 </td>
6829 <td> b
6830 </td></tr></table>
6831
6832 !! html/parsoid
6833 <table>
6834 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6835 <!--c1-->
6836 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6837 </tbody></table>
6838
6839 !! end
6840
6841 !! test
6842 Build table with {{!}}
6843 !! wikitext
6844 {{{!}} class="wikitable"
6845 ! header
6846 ! second header
6847 {{!}}- style="color:red;"
6848 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6849 {{!}}}
6850 !! html
6851 <table class="wikitable">
6852 <tr>
6853 <th> header
6854 </th>
6855 <th> second header
6856 </th></tr>
6857 <tr style="color:red;">
6858 <td> data </td>
6859 <td style="color:red;"> second data
6860 </td></tr></table>
6861
6862 !! end
6863
6864 !! test
6865 Build table with pipe as data
6866 !! wikitext
6867 {| class="wikitable"
6868 ! header
6869 ! second header
6870 |- style="color:red;"
6871 | data || style="color:red;" | second data
6872 |-
6873 | style="color:red;" | data with | || style="color:red;" | second data with |
6874 |-
6875 || data with | ||| second data with |
6876 |}
6877 !! html
6878 <table class="wikitable">
6879 <tr>
6880 <th> header
6881 </th>
6882 <th> second header
6883 </th></tr>
6884 <tr style="color:red;">
6885 <td> data </td>
6886 <td style="color:red;"> second data
6887 </td></tr>
6888 <tr>
6889 <td style="color:red;"> data with | </td>
6890 <td style="color:red;"> second data with |
6891 </td></tr>
6892 <tr>
6893 <td> data with | </td>
6894 <td> second data with |
6895 </td></tr></table>
6896
6897 !! end
6898
6899 !! test
6900 Build table with wikilink
6901 !! wikitext
6902 {| class="wikitable"
6903 ! header || second header
6904 |- style="color:red;"
6905 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6906 |-
6907 | data || second data [[Main Page|link|text with pipe]]
6908 |}
6909 !! html
6910 <table class="wikitable">
6911 <tr>
6912 <th> header </th>
6913 <th> second header
6914 </th></tr>
6915 <tr style="color:red;">
6916 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6917 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6918 </td></tr>
6919 <tr>
6920 <td> data </td>
6921 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6922 </td></tr></table>
6923
6924 !! end
6925
6926 # The expected HTML structure in this test is debatable. The PHP parser does
6927 # not parse this kind of table at all. The main focus for Parsoid is on
6928 # round-tripping, so this output is ok for now. TODO: revisit!
6929 !! test
6930 Wikitext table with html-syntax row
6931 !! wikitext
6932 {|
6933 |-
6934 <td>foo</td>
6935 |}
6936 !! html/parsoid
6937 <table>
6938 <tbody>
6939 <tr>
6940 <td>foo</td></tr></tbody></table>
6941 !! end
6942
6943 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6944 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6945 ## PHP parser, which tidy then compounds by fostering the content
6946 ## entirely out of the table. Parsoid recognizes the table context
6947 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6948 ## depends on PHP's treatment of broken table markup!
6949 !! test
6950 Implicit <td> after a |-
6951 !! options
6952 parsoid=wt2html,html2html
6953 !! wikitext
6954 {|
6955 |-
6956 a
6957 |}
6958 !! html/php
6959 <table>
6960
6961 a
6962 </table>
6963
6964 !! html/php+tidy
6965 <p>a</p>
6966 !! html/parsoid
6967 <table>
6968 <tr><td>a</td></tr>
6969 </table>
6970 !! end
6971
6972 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6973 !! test
6974 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6975 !! options
6976 parsoid=wt2html,html2html
6977 !! wikitext
6978 {|
6979 |-
6980 |
6981 a
6982 |-
6983 b
6984 |}
6985 !! html/php
6986 <table>
6987
6988 <tr>
6989 <td>
6990 <pre>a
6991 </pre>
6992 </td></tr>
6993 b
6994 </table>
6995
6996 !! html/php+tidy
6997 <p>b</p>
6998 <table>
6999 <tr>
7000 <td>
7001 <pre>
7002 a
7003 </pre></td>
7004 </tr>
7005 </table>
7006 !! html/parsoid
7007 <table>
7008 <tbody>
7009 <tr><td><pre>a</pre></td></tr>
7010 <tr><td> b</td></tr>
7011 </tbody>
7012 </table>
7013 !! end
7014
7015 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
7016 # Parsoid generates the missing <td>, so wt2wt won't succeed.
7017 !! test
7018 Lists should be recognized in an implicit <td> context
7019 !! options
7020 parsoid=wt2html,html2html
7021 !! wikitext
7022 {|
7023 |-
7024 *a
7025 |}
7026 !! html/php
7027 <table>
7028
7029 <ul><li>a</li></ul>
7030 </table>
7031
7032 !! html/php+tidy
7033 <ul>
7034 <li>a</li>
7035 </ul>
7036 !! html/parsoid
7037 <table>
7038 <tr>
7039 <td><ul>
7040 <li>a</li>
7041 </ul></td>
7042 </tr>
7043 </table>
7044 !! end
7045
7046 !! test
7047 Table cells not properly parsed in an implicit-td context
7048 !! wikitext
7049 {|
7050 |-
7051 {{table_attribs_4}} || a || b
7052 |}
7053 !! html/php+tidy
7054 <table>
7055 <tr>
7056 <td style="background-color:#DC241f;" width="10px"></td>
7057 <td>a</td>
7058 <td>b</td>
7059 </tr>
7060 </table>
7061 !! html/parsoid
7062 <table>
7063 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7064 <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>
7065 </tbody></table>
7066 !! end
7067
7068 !! test
7069 Parsoid: Round-trip tables directly followed by content (bug 51219)
7070 !! options
7071 parsoid=wt2html,wt2wt
7072 !! wikitext
7073 {|
7074 |foo
7075 |} bar
7076
7077 {|
7078 |baz
7079 |}<b>quux</b>
7080 !! html+tidy
7081 <table>
7082 <tr>
7083 <td>foo</td>
7084 </tr>
7085 </table>
7086 <p>bar</p>
7087 <table>
7088 <tr>
7089 <td>baz</td>
7090 </tr>
7091 </table>
7092 <p><b>quux</b></p>
7093 !! end
7094
7095 !! test
7096 Parsoid: Default to a newline after tables in new content (bug 51219)
7097 !! options
7098 parsoid=html2wt
7099 !! html/parsoid
7100 <table><tbody>
7101 <tr><td>foo</td></tr></tbody></table> bar
7102 <table><tbody>
7103 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7104 !! wikitext
7105 {|
7106 |foo
7107 |}
7108 <nowiki> </nowiki>bar
7109 {|
7110 |baz
7111 |}
7112 '''quux'''
7113 !! end
7114
7115 !! test
7116 Parsoid: newline inducing block nodes don't suppress <nowiki>
7117 !! options
7118 parsoid=html2wt
7119 !! html/parsoid
7120 a<h1>foo</h1>
7121 !! wikitext
7122 <nowiki> </nowiki>a
7123
7124 = foo =
7125 !! end
7126
7127 !! test
7128 Parsoid: Row-syntax table headings followed by comment & table cells
7129 !! options
7130 parsoid=wt2html,wt2wt
7131 !! wikitext
7132 {|
7133 ! foo || bar
7134 <!-- foo --> || baz || quux
7135 |}
7136 !! html/php
7137 <table>
7138 <tr>
7139 <th> foo </th>
7140 <th> bar
7141 </th>
7142 <td> baz </td>
7143 <td> quux
7144 </td></tr></table>
7145
7146 !! html/parsoid
7147 <table>
7148 <tbody><tr><th> foo </th><th> bar
7149 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7150 </tbody></table>
7151 !! end
7152
7153 !!test
7154 Parsoid: Recover better from broken table attributes
7155 !!options
7156 parsoid=wt2html
7157 !!wikitext
7158 {| class="foo
7159 | class="bar" |
7160 foo
7161 |}
7162 !!html/php+tidy
7163 <table class="foo">
7164 <tr>
7165 <td class="bar">
7166 <p>foo</p>
7167 </td>
7168 </tr>
7169 </table>
7170 !!html/parsoid
7171 <table class="foo">
7172 <tr>
7173 <td class="bar">
7174 <p>foo</p></td></tr>
7175 </tbody></table>
7176 !!end
7177
7178 !! test
7179 Tables: Digest broken attributes on table and tr tag
7180 !! options
7181 parsoid=wt2html
7182 !! wikitext
7183 {| || |} ++
7184 |- || || ++ --
7185 |- > [
7186 |}
7187 !! html
7188 <table>
7189 <tbody>
7190 <tr></tr>
7191 <tr></tr>
7192 </tbody></table>
7193 !! end
7194
7195 # T137406: Whitespace in the HTML
7196 !! test
7197 1. Generate correct wikitext for tables with thead/tbody/tfoot
7198 !! options
7199 parsoid=html2wt
7200 !! html/parsoid
7201 <table>
7202 <caption>Test</caption>
7203 <thead>
7204 <tr>
7205 <th>Month</th>
7206 <th>Savings</th>
7207 </tr>
7208 </thead>
7209 <tbody>
7210 <tr>
7211 <td>January</td>
7212 <td>$100</td>
7213 </tr>
7214 <tr>
7215 <td>February</td>
7216 <td>$80</td>
7217 </tr>
7218 </tbody>
7219 <tfoot>
7220 <tr>
7221 <td>Sum</td>
7222 <td>$180</td>
7223 </tr>
7224 </tfoot>
7225 </table>
7226 !! wikitext
7227 {|
7228 |+Test
7229 !Month
7230 !Savings
7231 |-
7232 |January
7233 |$100
7234 |-
7235 |February
7236 |$80
7237 |-
7238 |Sum
7239 |$180
7240 |}
7241 !! html/php+tidy
7242 <table>
7243 <caption>Test</caption>
7244 <tr>
7245 <th>Month</th>
7246 <th>Savings</th>
7247 </tr>
7248 <tr>
7249 <td>January</td>
7250 <td>$100</td>
7251 </tr>
7252 <tr>
7253 <td>February</td>
7254 <td>$80</td>
7255 </tr>
7256 <tr>
7257 <td>Sum</td>
7258 <td>$180</td>
7259 </tr>
7260 </table>
7261 !! end
7262
7263 # T137406: No whitespace in the HTML
7264 !! test
7265 2. Generate correct wikitext for tables with thead/tbody/tfoot
7266 !! options
7267 parsoid=html2wt
7268 !! html/parsoid
7269 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7270 !! wikitext
7271 {|
7272 !heading
7273 |-
7274 |foo
7275 |}
7276 !! end
7277
7278 !! test
7279 Testing serialization after deletion in references
7280 !! options
7281 parsoid={
7282 "modes": ["wt2wt"],
7283 "changes": [
7284 ["#x", "remove"]
7285 ]
7286 }
7287 !! wikitext
7288 hi <ref><div id="x">ho</div></ref>
7289
7290 <references />
7291 !! wikitext/edited
7292 hi <ref></ref>
7293
7294 <references />
7295 !! end
7296
7297 !!test
7298 Testing serialization after deletion of table cells
7299 !!options
7300 parsoid={
7301 "modes": ["wt2wt", "selser"],
7302 "changes": [
7303 ["#x", "remove"]
7304 ]
7305 }
7306 !!wikitext
7307 {|
7308 !h1 !!h2 !!h3
7309 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7310 |}
7311 !! wikitext/edited
7312 {|
7313 !h1 !!h2 !!h3
7314 |c2 |||c3
7315 |}
7316 !!end
7317
7318 !! test
7319 Testing selser after addition of new row before first row (T125419)
7320 !! options
7321 parsoid={
7322 "modes": ["wt2wt", "selser"],
7323 "changes": [
7324 [ "tr", "before", "<tr><td>X</td></tr>" ]
7325 ]
7326 }
7327 !! wikitext
7328 {|
7329 |a
7330 |}
7331 !! wikitext/edited
7332 {|
7333 |X
7334 |-
7335 |a
7336 |}
7337 !! end
7338
7339 !! test
7340 Serialize new table rows in a HTML table using HTML tags
7341 !! options
7342 parsoid={
7343 "modes": ["wt2wt", "selser"],
7344 "changes": [
7345 [ "tr", "before", "<tr><td>X</td></tr>" ]
7346 ]
7347 }
7348 !! wikitext
7349 <table><tr><td>a</td></tr></table>
7350 !! wikitext/edited
7351 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7352 !! end
7353
7354 !! test
7355 Serialize new table cells in a HTML row using HTML tags
7356 !! options
7357 parsoid={
7358 "modes": ["wt2wt", "selser"],
7359 "changes": [
7360 [ "td", "before", "<td>X</td>" ]
7361 ]
7362 }
7363 !! wikitext
7364 <table><tr><td>a</td></tr></table>
7365 !! wikitext/edited
7366 <table><tr><td>X</td><td>a</td></tr></table>
7367 !! end
7368
7369 !! test
7370 Wikitext tables can be nested inside HTML tables
7371 !! options
7372 parsoid=html2wt
7373 !! html
7374 <table data-parsoid='{"stx":"html"}'>
7375 <tr><td>
7376 <table>
7377 <tr><td>foo</td></tr>
7378 </table>
7379 </td></tr>
7380 </table>
7381 !! wikitext
7382 <table>
7383 <tr><td>
7384 {|
7385 |foo
7386 |}
7387 </td></tr>
7388 </table>
7389 !! end
7390
7391 !! test
7392 Serialize wikitext list items as HTML list items when embedded in a HTML list
7393 !! options
7394 parsoid=html2wt
7395 !! html
7396 <ul data-parsoid='{"stx": "html"}'>
7397 <li data-parsoid='{}'>a</li>
7398 <li>b</li>
7399 </ul>
7400 !! wikitext
7401 <ul>
7402 <li>a</li>
7403 <li>b</li>
7404 </ul>
7405 !! end
7406
7407 # SSS FIXME: Is this actually a good thing given the
7408 # odd nested list output that is generated by MW?
7409 # <ul><li>foo<ul>..</ul></li></ul> instead of
7410 # <ul><li>foo</li><ul>..</ul></ul>
7411 !! test
7412 Wikitext lists can be nested inside HTML lists
7413 !! options
7414 parsoid=html2wt
7415 !! html
7416 <ul data-parsoid='{"stx": "html"}'>
7417 <li data-parsoid='{"stx": "html"}'>a
7418 <ul><li>b</li></ul>
7419 </li>
7420 </ul>
7421
7422 <ul data-parsoid='{"stx": "html"}'>
7423 <li>x
7424 <ul><li>y</li></ul>
7425 </li>
7426 </ul>
7427 !! wikitext
7428 <ul>
7429 <li>a
7430 * b
7431 </li>
7432 </ul>
7433
7434 <ul>
7435 <li>x
7436 * y
7437 </li>
7438 </ul>
7439 !! end
7440
7441 ###
7442 ### Internal links
7443 ###
7444 !! test
7445 Plain link, capitalized
7446 !! wikitext
7447 [[Main Page]]
7448 !! html
7449 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7450 </p>
7451 !! end
7452
7453 !! test
7454 Plain link, uncapitalized
7455 !! wikitext
7456 [[main Page]]
7457 !! html
7458 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7459 </p>
7460 !! end
7461
7462 !! test
7463 Piped link
7464 !! wikitext
7465 [[Main Page|The Main Page]]
7466 !! html
7467 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7468 </p>
7469 !! end
7470
7471 !! test
7472 Piped link with comment in link text
7473 !! wikitext
7474 [[Main Page|The Main<!--front--> Page]]
7475 !! html
7476 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7477 </p>
7478 !! end
7479
7480 !! test
7481 Piped link with multiple pipe characters in link text
7482 !! wikitext
7483 [[Main Page||The|Main|Page|]]
7484 !! html/php
7485 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7486 </p>
7487 !! html/parsoid
7488 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7489 !! end
7490
7491 !! test
7492 Piped link with no link text
7493 !! wikitext
7494 [[Thomas Bek (bishop of St David's)|]]
7495 !! html/php
7496 <p>[[Thomas Bek (bishop of St David's)|]]
7497 </p>
7498 !! html/parsoid
7499 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7500 !! end
7501
7502 !! test
7503 Piped link with empty link text
7504 !! wikitext
7505 [[Main Page|<nowiki />]] - empty nowiki
7506 [[Main Page| ]] - empty space
7507 [[Main Page|&nbsp;]] - empty non breaking space
7508 !! html/php
7509 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7510 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7511 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7512 </p>
7513 !! html/parsoid
7514 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki />"}'/></a> - empty nowiki
7515 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7516 <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>
7517 !! end
7518
7519 !! test
7520 Broken link
7521 !! wikitext
7522 [[Zigzagzogzagzig]]
7523 !! html
7524 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7525 </p>
7526 !! end
7527
7528 !! test
7529 Broken link with fragment
7530 !! wikitext
7531 [[Zigzagzogzagzig#zug]]
7532 !! html
7533 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7534 </p>
7535 !! end
7536
7537 !! test
7538 Special page link with fragment
7539 !! wikitext
7540 [[Special:Version#anchor]]
7541 !! html
7542 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7543 </p>
7544 !! end
7545
7546 !! test
7547 Nonexistent special page link with fragment
7548 !! wikitext
7549 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7550 !! html
7551 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7552 </p>
7553 !! end
7554
7555 !! test
7556 Link with prefix
7557 !! wikitext
7558 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7559 !! html
7560 <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>
7561 </p>
7562 !! end
7563
7564 !! test
7565 Link with suffix
7566 !! wikitext
7567 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7568 !! html
7569 <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>!!!
7570 </p>
7571 !! end
7572
7573 !! article
7574 prefixed article
7575 !! text
7576 Some text
7577 !! endarticle
7578
7579 !! test
7580 Bug 43661: Piped links with identical prefixes
7581 !! wikitext
7582 [[prefixed article|prefixed articles with spaces]]
7583
7584 [[prefixed article|prefixed articlesaoeu]]
7585
7586 [[Main Page|Main Page test]]
7587 !! html
7588 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7589 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7590 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7591 </p>
7592 !! end
7593
7594
7595 !! test
7596 Link with HTML entity in suffix / tail
7597 !! wikitext
7598 [[Main Page]]&quot;, [[Main Page]]&#97;
7599 !! html/php
7600 <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;
7601 </p>
7602 !! html/parsoid
7603 <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>
7604 !! end
7605
7606 !! test
7607 Link with 3 brackets
7608 !! wikitext
7609 [[[Main Page]]]
7610 Foo [[[Main Page]]]
7611 !! html
7612 <p>[[[Main Page]]]
7613 Foo [[[Main Page]]]
7614 </p>
7615 !! end
7616
7617 !! test
7618 Link with 4 brackets
7619 !! wikitext
7620 [[[[Main Page]]]]
7621 !! html
7622 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7623 </p>
7624 !! end
7625
7626 !! test
7627 Piped link with 3 brackets
7628 !! wikitext
7629 [[[main page|the main page]]]
7630 !! html
7631 <p>[[[main page|the main page]]]
7632 </p>
7633 !! end
7634
7635 !! test
7636 Piped link with extlink-like text
7637 !! wikitext
7638 [[Main Page|[bar]]]
7639 [[Main Page|This is a [bar]]]
7640 !! html/php
7641 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7642 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7643 </p>
7644 !! html/parsoid
7645 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7646 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7647 !! end
7648
7649 !! test
7650 Link with multiple pipes
7651 !! wikitext
7652 [[Main Page|The|Main|Page]]
7653 !! html
7654 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7655 </p>
7656 !! end
7657
7658 !! test
7659 Anchor containing a #. (bug 63430)
7660 !! wikitext
7661 [[Main Page#And#Link]]
7662 !! html/php
7663 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7664 </p>
7665 !! html/parsoid
7666 <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>
7667 !! end
7668
7669 !! test
7670 Link to namespaces
7671 !! wikitext
7672 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7673 !! html
7674 <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>
7675 </p>
7676 !! end
7677
7678 !! test
7679 Link with space in namespace
7680 !! wikitext
7681 [[User talk:Foo bar]]
7682 !! html
7683 <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>
7684 </p>
7685 !! end
7686
7687 !! article
7688 MemoryAlpha:AlphaTest
7689 !! text
7690 This is an article in the MemoryAlpha namespace
7691 (which shadows the memoryalpha interwiki link).
7692 !! endarticle
7693
7694 !! test
7695 Namespace takes precedence over interwiki link (bug 51680)
7696 !! wikitext
7697 [[MemoryAlpha:AlphaTest]]
7698 !! html
7699 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7700 </p>
7701 !! end
7702
7703 # The previous test doesn't work correctly in html2*, due to not recognizing the
7704 # link as an internal one. This one checks for the correct behavior.
7705 !! test
7706 Link to namespace preferred over interwiki with correct rel attribute
7707 !! options
7708 parsoid=html2wt,html2html
7709 !! html/parsoid
7710 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7711 !! wikitext
7712 [[MemoryAlpha:AlphaTest]]
7713 !! end
7714
7715 !! test
7716 Piped link to namespace
7717 !! wikitext
7718 [[Meta:Disclaimers|The disclaimers]]
7719 !! html
7720 <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>
7721 </p>
7722 !! end
7723
7724 !! test
7725 Link containing }
7726 !! wikitext
7727 [[Usually caused by a typo (oops}]]
7728 !! html
7729 <p>[[Usually caused by a typo (oops}]]
7730 </p>
7731 !! end
7732
7733 !! article
7734 7% Solution
7735 !! text
7736 Just a test of an article title containing a percent.
7737 !! endarticle
7738
7739 !! test
7740 Link containing % (not as a hex sequence)
7741 !! wikitext
7742 [[7% Solution]]
7743 [[7% Solution|7%25 Solution]]
7744 !! html/php
7745 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7746 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7747 </p>
7748 !! html/parsoid
7749 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7750 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7751 !! end
7752
7753 # note that the parsoid HTML is identical to the previous test output,
7754 # so the previous test ensures that the html2wt mode will generate the
7755 # "not as a hex sequence" wikitext.
7756 !! test
7757 Link containing % as a single hex sequence interpreted to char
7758 !! options
7759 parsoid=wt2wt,wt2html,html2html
7760 !! wikitext
7761 [[7%25 Solution]]
7762 [[7%25 Solution|7%25 Solution]]
7763 !! html/php
7764 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7765 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7766 </p>
7767 !! html/parsoid
7768 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7769 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7770 !!end
7771
7772 !! test
7773 Link containing % as a double hex sequence interpreted to hex sequence
7774 !! wikitext
7775 [[7%2525 Solution]]
7776 !! html
7777 <p>[[7%2525 Solution]]
7778 </p>
7779 !!end
7780
7781 ## Example for such a section: == < ==
7782 !! test
7783 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7784 !! wikitext
7785 [[%23%3c]][[%23%3e]]
7786 !! html/php
7787 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7788 </p>
7789 !! html/parsoid
7790 <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>
7791 !! end
7792
7793 !! test
7794 Link containing "<#" and ">#" as a hex sequences
7795 !! wikitext
7796 [[%3c%23]][[%3e%23]]
7797 !! html
7798 <p>[[%3c%23]][[%3e%23]]
7799 </p>
7800 !! end
7801
7802 !! test
7803 Link containing an equals sign
7804 !! wikitext
7805 [[Special:BookSources/isbn=4-00-026157-6]]
7806 !! html/php
7807 <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>
7808 </p>
7809 !! html/parsoid
7810 <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>
7811 !! end
7812
7813 !! article
7814 Foo~bar
7815 !! text
7816 Just a test of an article title containing a tilde.
7817 !! endarticle
7818
7819 # note that links containing signatures, like [[Foo~~~~]], are
7820 # massaged by the pre-save transform (PST) and so the tildes are never
7821 # seen by the parser.
7822 !! test
7823 Link containing a tilde
7824 !! wikitext
7825 [[Foo~bar]]
7826 !! html/php
7827 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7828 </p>
7829 !! html/parsoid
7830 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7831 !! end
7832
7833 !! test
7834 Link containing double-single-quotes '' (bug 4598)
7835 !! wikitext
7836 [[Lista d''e paise d''o munno]]
7837 !! html/php
7838 <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>
7839 </p>
7840 !! html/parsoid
7841 <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>
7842 !! end
7843
7844 !! test
7845 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7846 !! wikitext
7847 Some [[Link|pretty ''italics'' and stuff]]!
7848 !! html/php
7849 <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>!
7850 </p>
7851 !! html/parsoid
7852 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7853 !! end
7854
7855 !! test
7856 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7857 !! wikitext
7858 ''Some [[Link|pretty ''italics'' and stuff]]!''
7859 !! html
7860 <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>
7861 </p>
7862 !! end
7863
7864 !! test
7865 Link with double quotes in title part (literal) and alternate part (interpreted)
7866 !! wikitext
7867 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7868
7869 [[''Pentecoste'']]
7870
7871 [[''Pentecoste''|Pentecoste]]
7872
7873 [[''Pentecoste''|''Pentecoste'']]
7874 !! html/php
7875 <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>
7876 </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>
7877 </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>
7878 </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>
7879 </p>
7880 !! html/parsoid
7881 <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>
7882 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7883 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7884 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7885 !! end
7886
7887 !! test
7888 Broken image links with HTML captions (bug 39700)
7889 !! wikitext
7890 [[File:Nonexistent|<script></script>]]
7891 [[File:Nonexistent|100x100px|<script></script>]]
7892 [[File:Nonexistent|&lt;]]
7893 [[File:Nonexistent|a<i>b</i>c]]
7894 !! html/php
7895 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7896 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7897 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7898 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7899 </p>
7900 !! html/parsoid
7901 <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>
7902 <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>
7903 <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>
7904 <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>
7905 !! end
7906
7907 !! test
7908 Plain link to URL
7909 !! wikitext
7910 [[http://www.example.com]]
7911 !! html/php
7912 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7913 </p>
7914 !! html/parsoid
7915 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7916 !! end
7917
7918 !! test
7919 Plain link to URL with link text
7920 !! wikitext
7921 [[http://www.example.com Link text]]
7922 !! html
7923 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7924 </p>
7925 !! end
7926
7927 !! test
7928 Plain link to protocol-relative URL
7929 !! wikitext
7930 [[//www.example.com]]
7931 !! html/php
7932 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7933 </p>
7934 !! html/parsoid
7935 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7936 !! end
7937
7938 !! test
7939 Plain link to protocol-relative URL with link text
7940 !! wikitext
7941 [[//www.example.com Link text]]
7942 !! html
7943 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7944 </p>
7945 !! end
7946
7947 !! test
7948 Plain link to page with question mark in title
7949 !! wikitext
7950 [[A?b]]
7951
7952 [[A?b|Baz]]
7953 !! html
7954 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7955 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7956 </p>
7957 !! end
7958
7959
7960 # I'm fairly sure the expected result here is wrong.
7961 # We want these to be URL links, not pseudo-pages with URLs for titles....
7962 # However the current output is also pretty screwy.
7963 #
7964 # ----
7965 # I'm changing it to match the current output--it arguably makes more
7966 # sense in the light of the test above. Old expected result was:
7967 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7968 #</p>
7969 # But I think this test is bordering on "garbage in, garbage out" anyway.
7970 # -- wtm
7971 !! test
7972 Piped link to URL
7973 !! wikitext
7974 Piped link to URL: [[http://www.example.com|an example URL]]
7975 !! html/php
7976 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7977 </p>
7978 !! html/parsoid
7979 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7980 !! end
7981
7982 !! test
7983 BUG 2: [[page|http://url/]] should link to page, not http://url/
7984 !! wikitext
7985 [[Main Page|http://url/]]
7986 !! html/php
7987 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7988 </p>
7989 !! html/parsoid
7990 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7991 !! end
7992
7993 # Parsoid does not mark self-links, by design.
7994 !! test
7995 BUG 337: Escaped self-links should be bold
7996 !! options
7997 title=[[Bug462]]
7998 !! wikitext
7999 [[Bu&#103;462]] [[Bug462]]
8000 !! html/php
8001 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
8002 </p>
8003 !! html/php+tidy
8004 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
8005 !! html/parsoid
8006 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8007 !! end
8008
8009 !! test
8010 Self-link to section should not be bold
8011 !! options
8012 title=[[Main Page]]
8013 !! wikitext
8014 [[Main Page#section]]
8015 !! html
8016 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8017 </p>
8018 !! end
8019
8020 !! article
8021 00
8022 !! text
8023 This is 00.
8024 !! endarticle
8025
8026 !!test
8027 Self-link to numeric title
8028 !!options
8029 title=[[0]]
8030 !! wikitext
8031 [[0]]
8032 !! html
8033 <p><strong class="selflink">0</strong>
8034 </p>
8035 !!end
8036
8037 !!test
8038 Link to numeric-equivalent title
8039 !!options
8040 title=[[0]]
8041 !! wikitext
8042 [[00]]
8043 !! html
8044 <p><a href="/wiki/00" title="00">00</a>
8045 </p>
8046 !!end
8047
8048 !! test
8049 <nowiki> inside a link
8050 !! wikitext
8051 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8052 !! html
8053 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8054 </p>
8055 !! end
8056
8057 !! test
8058 Non-breaking spaces in title
8059 !! wikitext
8060 [[&nbsp; Main &nbsp; Page &nbsp;]]
8061 !! html
8062 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8063 </p>
8064 !!end
8065
8066 !! test
8067 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
8068 !! options
8069 language=ca
8070 !! wikitext
8071 '''[[Main Page]]'''
8072 !! html
8073 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8074 </p>
8075 !! end
8076
8077 !! test
8078 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
8079 !! options
8080 language=ca
8081 !! wikitext
8082 ''[[Main Page]]''
8083 !! html
8084 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8085 </p>
8086 !! end
8087
8088 !! test
8089 Internal link with en linktrail: no apostrophes (bug 27473)
8090 !! options
8091 language=en
8092 !! wikitext
8093 [[Something]]'nice
8094 !! html
8095 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8096 </p>
8097 !! end
8098
8099 !! test
8100 Internal link with ca linktrail with apostrophes (bug 27473)
8101 !! options
8102 language=ca
8103 !! wikitext
8104 [[Something]]'nice
8105 !! html
8106 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8107 </p>
8108 !! end
8109
8110 !! test
8111 Internal link with kaa linktrail with apostrophes (bug 27473)
8112 !! options
8113 language=kaa
8114 !! wikitext
8115 [[Something]]'nice
8116 !! html
8117 <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>
8118 </p>
8119 !! end
8120
8121 !! test
8122 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
8123 !! wikitext
8124 [[User:Foo/Test/63636:Bar|Test]]
8125 !! html/php
8126 <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>
8127 </p>
8128 !! html/parsoid
8129 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8130 !! end
8131
8132 ## Mainly a sanity check for Parsoid
8133 !! test
8134 Handle title parsing for subpages
8135 !! options
8136 title=[[/123123]]
8137 subpage
8138 !! wikitext
8139 123
8140 !! html/php
8141 <p>123
8142 </p>
8143 !! html/parsoid
8144 <p>123</p>
8145 !! end
8146
8147 !! article
8148 User:Test/123
8149 !! text
8150 test 123
8151 !! endarticle
8152
8153 !! test
8154 Link to a subpage from a namespace other than main
8155 !! options
8156 title=[[User:Test]]
8157 subpage
8158 !! wikitext
8159 [[/123]]
8160 !! html/php
8161 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8162 </p>
8163 !! html/parsoid
8164 <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>
8165 !! end
8166
8167 !! test
8168 Ensure that transclusion titles are not url-decoded
8169 !! options
8170 subpage title=[[Test]]
8171 parsoid=wt2html
8172 !! wikitext
8173 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8174 !! html/php
8175 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8176 </p>
8177 !! html/parsoid
8178 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8179 !! end
8180
8181 !! test
8182 Purely hash wikilink
8183 !! options
8184 title=[[User:Test/123]]
8185 subpage
8186 !! wikitext
8187 [[#a|b]]
8188 !! html/php
8189 <p><a href="#a">b</a>
8190 </p>
8191 !! html/parsoid
8192 <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>
8193 !! end
8194
8195 !! test
8196 1. Interaction of linktrail and template encapsulation
8197 !! options
8198 parsoid
8199 !! wikitext
8200 {{echo|[[Foo]]}}l
8201 !! html
8202 <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>
8203 !! end
8204
8205 !! test
8206 2. Interaction of linktrail and template encapsulation
8207 !! options
8208 parsoid
8209 !! wikitext
8210 {{echo|Some [[Fool]]}}s
8211 !! html
8212 <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>
8213 !! end
8214
8215 !! test
8216 3. Interaction of linktrail and template encapsulation
8217 !! options
8218 parsoid
8219 !! wikitext
8220 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8221 !! html
8222 <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>
8223 !! end
8224
8225 !! article
8226 Söfnuður
8227 !! text
8228 Test.
8229 !! endarticle
8230
8231 !! test
8232 Internal link with is link prefix
8233 !! options
8234 language=is
8235 !! wikitext
8236 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8237 !! html
8238 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8239 </p>
8240 !! end
8241
8242 !! article
8243 Mótmælendatrú
8244 !! text
8245 Test.
8246 !! endarticle
8247
8248 !! test
8249 Internal link with is link trail and link prefix
8250 !! options
8251 language=is
8252 !! wikitext
8253 [[mótmælendatrú|xxx]]ar
8254 [[mótmælendatrú]]ar
8255 mótmælenda[[söfnuður]]
8256 mótmælenda[[söfnuður|söfnuðir]]
8257 mótmælenda[[söfnuður|söfnuðir]]xxx
8258 !! html
8259 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8260 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8261 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8262 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8263 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8264 </p>
8265 !! end
8266
8267 !! test
8268 Parsoid link trail escaping
8269 !! options
8270 parsoid=html2wt,html2html
8271 !! html/parsoid
8272 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
8273 !! wikitext
8274 [[apple]]<nowiki/>s
8275 !! end
8276
8277 !! test
8278 Parsoid link prefix escaping
8279 !! options
8280 language=is
8281 parsoid=html2wt,html2html
8282 !! html/parsoid
8283 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
8284 !! wikitext
8285 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8286 !! end
8287
8288 !! test
8289 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8290 !! wikitext
8291 [[Foo| bar]]
8292
8293 [[Foo| ''bar'']]
8294
8295 [http://wp.org foo]
8296
8297 [http://wp.org ''foo'']
8298 !! html
8299 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8300 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8301 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8302 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8303 </p>
8304 !! end
8305
8306 !! test
8307 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8308 !! options
8309 parsoid
8310 !! wikitext
8311 [[Foo|{{echo|a}} b {{echo|c}}]]
8312 !! html
8313 <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>
8314 !! end
8315
8316 !! test
8317 Link with angle bracket after anchor
8318 !! wikitext
8319 [[Foo#<bar>]]
8320 !! html/php
8321 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8322 </p>
8323 !! html/parsoid
8324 <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>
8325 !! end
8326
8327 ###
8328 ### Interwiki links (see maintenance/interwiki.sql)
8329 ###
8330
8331 !! test
8332 Inline interwiki link
8333 !! options
8334 parsoid=wt2html,wt2wt,html2html
8335 !! wikitext
8336 [[MeatBall:SoftSecurity]]
8337 !! html/php
8338 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8339 </p>
8340 !! html/parsoid
8341 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8342 !! end
8343
8344 !! test
8345 Inline interwiki link with empty title (bug 2372)
8346 !! options
8347 parsoid=wt2html,wt2wt,html2html
8348 !! wikitext
8349 [[MeatBall:]]
8350 !! html/php
8351 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8352 </p>
8353 !! html/parsoid
8354 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8355 !! end
8356
8357 !! test
8358 Interwiki link encoding conversion (bug 1636)
8359 !! wikitext
8360 *[[Wikipedia:ro:Olteni&#0355;a]]
8361 *[[Wikipedia:ro:Olteni&#355;a]]
8362 !! html
8363 <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>
8364 <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>
8365
8366 !! html+tidy
8367 <ul>
8368 <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>
8369 <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>
8370 </ul>
8371 !! end
8372
8373 !! test
8374 Interwiki link with fragment (bug 2130)
8375 !! wikitext
8376 [[MeatBall:SoftSecurity#foo]]
8377 !! html
8378 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8379 </p>
8380 !! end
8381
8382 !! test
8383 Link scenarios with escaped fragments
8384 !! wikitext
8385 [[#Is this great?]]
8386 [[Foo#Is this great?]]
8387 [[meatball:Foo#Is this great?]]
8388 !! html/php
8389 <p><a href="#Is_this_great.3F">#Is this great?</a>
8390 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8391 <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>
8392 </p>
8393 !! html/parsoid
8394 <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>
8395 <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>
8396 <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>
8397 !! end
8398
8399 # Ideally the wikipedia: prefix here should be proto-relative too
8400 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8401 # define the 'en' prefix, and originally the test used 'wikipedia',
8402 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8403 # article.
8404 !! test
8405 Different interwiki prefixes mapping to the same URL
8406 !! wikitext
8407 [[:en:Foo]]
8408
8409 [[:en:Foo|Foo]]
8410
8411 [[wikipedia:Foo]]
8412
8413 [[:wikipedia:Foo|Foo]]
8414
8415 [[wikipedia:en:Foo]]
8416
8417 [[:wikipedia:en:Foo]]
8418
8419 [[ wikiPEdia :Foo]]
8420 !! html/parsoid
8421 <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>
8422
8423 <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>
8424
8425 <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>
8426
8427 <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>
8428
8429 <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>
8430
8431 <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>
8432
8433 <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>
8434 !! end
8435
8436 !! test
8437 Interwiki links that cannot be represented in wiki syntax
8438 !! wikitext
8439 [[meatball:ok]]
8440 [[meatball:ok#foo|ok with fragment]]
8441 [[meatball:ok_as_well?|ok ending with ? mark]]
8442 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8443 [http://de.wikipedia.org/wiki/#foo is just fragment]
8444
8445 !! html/php
8446 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8447 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8448 <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>
8449 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8450 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8451 </p>
8452 !! html/parsoid
8453 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8454 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8455 <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>
8456 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8457 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8458 !! end
8459
8460 !! test
8461 Interwiki links: trail
8462 !! wikitext
8463 [[wikipedia:Foo|Ba]]r
8464 !! html/php
8465 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8466 </p>
8467 !! html/parsoid
8468 <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>
8469 !! end
8470
8471 !! test
8472 Local interwiki link
8473 !! options
8474 parsoid=wt2html,wt2wt,html2html
8475 !! wikitext
8476 [[local:Template:Foo]]
8477 !! html/php
8478 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8479 </p>
8480 !! html/parsoid
8481 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8482 !! end
8483
8484 # Parsoid does not mark self-links, by design.
8485 !! test
8486 Local interwiki link: self-link to current page
8487 !! options
8488 title=[[Main Page]]
8489 parsoid=wt2html,wt2wt,html2html
8490 !! wikitext
8491 [[local:Main Page]]
8492 !! html/php
8493 <p><strong class="selflink">local:Main Page</strong>
8494 </p>
8495 !! html/parsoid
8496 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8497 !! end
8498
8499 !! test
8500 Local interwiki link: prefix only (bug 64167)
8501 !! options
8502 parsoid=wt2html,wt2wt,html2html
8503 !! wikitext
8504 [[local:]]
8505 !! html/php
8506 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8507 </p>
8508 !! html/parsoid
8509 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8510 !! end
8511
8512 !! test
8513 Local interwiki link: with additional interwiki prefix (bug 61357)
8514 !! options
8515 parsoid=wt2html,wt2wt,html2html
8516 !! wikitext
8517 [[local:meatball:Hello]]
8518 !! html/php
8519 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8520 </p>
8521 !! html/parsoid
8522 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8523 !! end
8524
8525 !! test
8526 Multiple local interwiki link prefixes
8527 !! wikitext
8528 [[local:local:local:local:mi:local:Foo]]
8529 !! options
8530 parsoid=wt2html,wt2wt,html2html
8531 !! html/php
8532 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8533 </p>
8534 !! html/parsoid
8535 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8536 !! end
8537
8538 ###
8539 ### Interlanguage links
8540 ### Language links (so that searching for '### language' matches..)
8541 ###
8542
8543 !! test
8544 Interlanguage link
8545 !! wikitext
8546 Blah blah blah
8547 [[zh:Chinese]]
8548 !! html/php
8549 <p>Blah blah blah
8550 </p>
8551 !! html/parsoid
8552 <p>Blah blah blah</p>
8553 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8554 !! end
8555
8556 ## parsoid html2wt will lose the space variations
8557 !! test
8558 Interlanguage link with spacing
8559 !! options
8560 parsoid=wt2html,wt2wt,html2html
8561 !! wikitext
8562 Blah blah blah
8563 [[ zh : Chinese ]]
8564 !! html/php
8565 <p>Blah blah blah
8566 </p>
8567 !! html/parsoid
8568 <p>Blah blah blah</p>
8569 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8570 !! end
8571
8572 !! test
8573 Double interlanguage link
8574 !! wikitext
8575 Blah blah blah
8576 [[es:Spanish]]
8577 [[zh:Chinese]]
8578 !! html/php
8579 <p>Blah blah blah
8580 </p>
8581 !! html/parsoid
8582 <p>Blah blah blah</p>
8583 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8584 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8585 !! end
8586
8587 ## parsoid html2wt will lose the space variations
8588 !! test
8589 Interlanguage link variations
8590 !! options
8591 parsoid=wt2html,wt2wt,html2html
8592 !! wikitext
8593 Blah blah blah
8594 [[ es :Spanish]]
8595 [[ ZH :Chinese]]
8596 [[es:Foo_bar]]
8597 !! html/php
8598 <p>Blah blah blah
8599 </p>
8600 !! html/parsoid
8601 <p>Blah blah blah</p>
8602 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8603 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8604 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8605 !! end
8606
8607 !! test
8608 Escaping of interlanguage links
8609 !! wikitext
8610 Blah blah blah
8611 [[:es:Spanish]]
8612 [[ : zh : Chinese ]]
8613 !! html/php
8614 <p>Blah blah blah
8615 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8616 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8617 </p>
8618 !! html/parsoid
8619 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8620 <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8621 !! end
8622
8623 ## parsoid html2wt will normalize the space to _
8624 !! test
8625 Space and question mark encoding in interlanguage links (T95473)
8626 !! options
8627 parsoid=wt2html,wt2wt,html2html
8628 !! wikitext
8629 Blah blah blah
8630 [[es:Foo bar?]]
8631 !! html/php
8632 <p>Blah blah blah
8633 </p>
8634 !! html/parsoid
8635 <p>Blah blah blah</p>
8636 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8637 !! end
8638
8639 !! test
8640 Interlanguage link, with prefix links
8641 !! options
8642 language=ln
8643 !! wikitext
8644 Blah blah blah
8645 [[zh:Chinese]]
8646 !! html/php
8647 <p>Blah blah blah
8648 </p>
8649 !! html/parsoid
8650 <p>Blah blah blah</p>
8651 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8652 !! end
8653
8654 !! test
8655 Double interlanguage link, with prefix links (bug 8897)
8656 !! options
8657 language=ln
8658 !! wikitext
8659 Blah blah blah
8660 [[es:Spanish]]
8661 [[zh:Chinese]]
8662 !! html/php
8663 <p>Blah blah blah
8664 </p>
8665 !! html/parsoid
8666 <p>Blah blah blah</p>
8667 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8668 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8669 !! end
8670
8671 !! test
8672 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8673 !! wikitext
8674 Blah blah blah
8675 [[mul:Article]]
8676 !! html/php
8677 <p>Blah blah blah
8678 </p>
8679 !! html/parsoid
8680 <p>Blah blah blah</p>
8681 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8682 !! end
8683
8684 ## PHP parser tests script needs an update
8685 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8686 !! test
8687 Language links render as inline links if $wgInterwikiMagic=false
8688 !! options
8689 wgInterwikiMagic=false
8690 parsoid=wt2html,wt2wt,html2html
8691 !! wikitext
8692 Blah blah blah
8693 [[zh:Chinese]]
8694 !! html/parsoid
8695 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8696 !! end
8697
8698 ## PHP parser tests script needs an update
8699 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8700 !! test
8701 Language links render as inline links in the Talk namespace
8702 !! options
8703 title=Talk:Foo
8704 parsoid=wt2html,wt2wt,html2html
8705 !! wikitext
8706 Blah blah blah
8707 [[zh:Chinese]]
8708 !! html/parsoid
8709 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8710 !! end
8711
8712 !! test
8713 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8714 !! options
8715 language=ln
8716 !! wikitext
8717 [[WW&nbsp;II]]
8718 !! html
8719 <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>
8720 </p>
8721 !! end
8722
8723 !! test
8724 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8725 !! options
8726 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8727 !! html/parsoid
8728 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8729 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8730 !! wikitext
8731 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8732
8733 He&amp;nbsp;llo He&amp;nbsp;llo
8734 !! html/php
8735 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8736 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8737 </p>
8738 !! end
8739
8740 # html2wt will fail because of title normalization without data-parsoid
8741 !! test
8742 Parsoid: handle constructor well
8743 !! options
8744 parsoid=wt2html,wt2wt
8745 !! wikitext
8746 [[constructor]]
8747
8748 [[constructor:foo]]
8749 !! html/php
8750 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8751 </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>
8752 </p>
8753 !! html/parsoid
8754 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8755
8756 <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>
8757 !! end
8758
8759 !! article
8760 ko:
8761 !! text
8762 Test.
8763 !! endarticle
8764
8765 # Note that `ko` isn't a known interlanguage prefix
8766 !! test
8767 Parsoid: recognize interlanguage links without a target page
8768 !! options
8769 ill
8770 !! wikitext
8771 [[es:]]
8772
8773 [[ko:]]
8774 !! html/php
8775 es:
8776 !! html/parsoid
8777 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8778
8779 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8780 !! end
8781
8782 # Note that `ko` isn't a known interwiki prefix
8783 !! test
8784 Parsoid: recognize interwiki links without a target page
8785 !! options
8786 parsoid=wt2html,wt2wt,html2html
8787 !! wikitext
8788 [[:es:]]
8789
8790 [[:ko:]]
8791 !! html/php
8792 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8793 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8794 </p>
8795 !! html/parsoid
8796 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8797 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8798 !! end
8799
8800 !! test
8801 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8802 !! wikitext
8803 [[mi:Foo]]
8804 !! html/php
8805 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8806 </p>
8807 !! html/parsoid
8808 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8809 !! end
8810
8811 !! test
8812 Interlanguage link with preceding local interwiki link (bug 68085)
8813 !! options
8814 parsoid=wt2html,wt2wt,html2html
8815 !! wikitext
8816 Blah blah blah
8817 [[local:es:Spanish]]
8818 !! html/php
8819 <p>Blah blah blah
8820 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8821 </p>
8822 !! html/parsoid
8823 <p>Blah blah blah
8824 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8825 !! end
8826
8827 !! test
8828 Looks like an interlanguage link, but is actually a local interwiki
8829 !! options
8830 parsoid=wt2html,wt2wt,html2html
8831 !! wikitext
8832 Blah blah blah
8833 [[mi:Template:Foo]]
8834 !! html/php
8835 <p>Blah blah blah
8836 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8837 </p>
8838 !! html/parsoid
8839 <p>Blah blah blah
8840 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8841 !! end
8842
8843 ###
8844 ### Redirects, Parsoid-only
8845 ###
8846
8847 !! test
8848 1. Simple redirect to page
8849 !! wikitext
8850 #REDIRECT [[Main Page]]
8851 !! html/parsoid
8852 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8853 !! end
8854
8855 !! test
8856 2. Other redirect variants
8857 !! wikitext
8858 #REDIRECT [[Main_Page]]
8859 !! html/parsoid
8860 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8861 !! end
8862
8863 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8864 # This tests the Parsoid bail-out code.
8865 !! test
8866 3. Other redirect variants
8867 !! wikitext
8868 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8869 !! html/parsoid
8870 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8871 !! end
8872
8873 !! test
8874 4. Redirect to a templated destination
8875 !! wikitext
8876 #REDIRECT [[{{echo|Foo}}bar]]
8877 !! html/parsoid
8878 <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"}]]}'/>
8879 !! end
8880
8881 !! test
8882 Empty redirect
8883 !! options
8884 parsoid=wt2html,wt2wt
8885 !! wikitext
8886 #REDIRECT [[]]
8887 !! html/parsoid
8888 <ol>
8889 <li>REDIRECT [[]]</li></ol>
8890 !! end
8891
8892 !! test
8893 Optional colon in #REDIRECT
8894 !! options
8895 # the colon is archaic syntax. we support it for wt2html, but we
8896 # don't care that it roundtrips back to the modern syntax.
8897 parsoid=wt2html,html2html
8898 !! wikitext
8899 #REDIRECT:[[Main Page]]
8900 !! html/parsoid
8901 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8902 !! end
8903
8904 !! test
8905 Whitespace in #REDIRECT with optional colon
8906 !! options
8907 # the colon and gratuitous whitespace is archaic syntax. we support
8908 # it for wt2html, but we don't care that it roundtrips back to the
8909 # modern syntax (without extra whitespace)
8910 parsoid=wt2html,html2html
8911 !! wikitext
8912
8913 #REDIRECT
8914 :
8915 [[Main Page]]
8916 !! html/parsoid
8917 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8918 !! end
8919
8920 !! test
8921 Piped link in #REDIRECT
8922 !! options
8923 # content after piped link is ignored. we support this syntax,
8924 # but don't care that the piped link is lost when we roundtrip this.
8925 parsoid=wt2html
8926 !! wikitext
8927 #REDIRECT [[Main Page|bar]]
8928 !! html/parsoid
8929 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8930 !! end
8931
8932 !! test
8933 Redirect to category (T104502)
8934 !! options
8935 parsoid=wt2html,wt2wt
8936 !! wikitext
8937 #REDIRECT [[Category:Foo]]
8938 !! html/parsoid
8939 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8940 !! end
8941
8942 !! test
8943 Redirect to category with URL encoding (T104502)
8944 !! options
8945 parsoid=wt2html
8946 !! wikitext
8947 #REDIRECT [[Category%3AFoo]]
8948 !! html/parsoid
8949 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8950 !! end
8951
8952 !! test
8953 Redirect to category page
8954 !! wikitext
8955 #REDIRECT [[:Category:Foo]]
8956 !! html/parsoid
8957 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8958 !! end
8959
8960 !! test
8961 Redirect to image page (1)
8962 !! wikitext
8963 #REDIRECT [[File:Wiki.png]]
8964 !! html/parsoid
8965 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8966 !! end
8967
8968 !! test
8969 Redirect to image page (2)
8970 !! wikitext
8971 #REDIRECT [[Image:Wiki.png]]
8972 !! html/parsoid
8973 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8974 !! end
8975
8976 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8977 # Next test confirms this.
8978 !! test
8979 Redirect to language (1) (T104918)
8980 !! options
8981 parsoid=wt2html,wt2wt,html2html
8982 !! wikitext
8983 #REDIRECT [[en:File:Wiki.png]]
8984 !! html/parsoid
8985 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8986 !! end
8987
8988 !! test
8989 Redirect to language (2) (T104918)
8990 !! wikitext
8991 #REDIRECT [[:en:File:Wiki.png]]
8992 !! html/parsoid
8993 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8994 !! end
8995
8996 !! test
8997 Redirect to interwiki (T104918)
8998 !! wikitext
8999 #REDIRECT [[meatball:File:Wiki.png]]
9000 !! html/parsoid
9001 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9002 !! end
9003
9004 !! test
9005 Non-English #REDIRECT
9006 !! options
9007 language=is
9008 !! wikitext
9009 #TILVÍSUN [[Main Page]]
9010 !! html/parsoid
9011 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9012 !! end
9013
9014 !! test
9015 Redirect syntax under text isn't considered a redirect
9016 !! wikitext
9017 some text
9018 #redirect [[Main Page]]
9019 !! html/parsoid
9020 <p>some text</p>
9021 <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>
9022 !! end
9023
9024 # FIXME: Should hoist the redirect to the top of the page and ensure there
9025 # is only one.
9026 !! test
9027 New redirect
9028 !! options
9029 parsoid=html2wt
9030 !! html/parsoid
9031 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9032 !! wikitext
9033 Foo
9034 #REDIRECT [[Foo]]
9035 !! end
9036
9037 ##
9038 ## XHTML tidiness
9039 ###
9040
9041 !! test
9042 <br> to <br />
9043 !! wikitext
9044 1<br>2<br />3
9045 !! html
9046 <p>1<br />2<br />3
9047 </p>
9048 !! end
9049
9050 !! test
9051 Broken br tag sanitization
9052 !! wikitext
9053 </br>
9054 !! html/php
9055 <p>&lt;/br&gt;
9056 </p>
9057 !! end
9058
9059 # TODO: Fix html2html mode (bug 51055)!
9060 !! test
9061 Parsoid: Broken br tag recognition
9062 !! options
9063 parsoid=wt2html
9064 !! wikitext
9065 </br>
9066
9067 <br/ >
9068 !! html+tidy
9069 <p><br /></p>
9070 <p><br /></p>
9071 !! end
9072
9073 !! test
9074 Incorrecly removing closing slashes from correctly formed XHTML
9075 !! wikitext
9076 <br style="clear:both;" />
9077 !! html
9078 <p><br style="clear:both;" />
9079 </p>
9080 !! end
9081
9082 !! test
9083 Failing to transform badly formed HTML into correct XHTML
9084 !! wikitext
9085 <br style="clear: left;">
9086 <br style="clear: right;">
9087 <br style="clear: both;">
9088 !! html
9089 <p><br style="clear: left;" />
9090 <br style="clear: right;" />
9091 <br style="clear: both;" />
9092 </p>
9093 !!end
9094
9095 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9096 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9097 !! test
9098 Handling html with a div self-closing tag
9099 !! wikitext
9100 <div title />
9101 <div title/>
9102 <div title/ >
9103 <div title=bar />
9104 <div title=bar/>
9105 <div title=bar/ >
9106 !! html/php
9107 <p>&lt;div title /&gt;
9108 &lt;div title/&gt;
9109 </p>
9110 <div>
9111 <p>&lt;div title=bar /&gt;
9112 &lt;div title=bar/&gt;
9113 </p>
9114 <div title="bar/"></div>
9115 </div>
9116
9117 !! html/parsoid
9118 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9119 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9120 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9121 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9122 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9123 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9124 !! end
9125
9126 !! test
9127 Handling html with a br self-closing tag
9128 !! wikitext
9129 <br title />
9130 <br title/>
9131 <br title/ >
9132 <br title=bar />
9133 <br title=bar/>
9134 <br title=bar/ >
9135 !! html/php
9136 <p><br title="" />
9137 <br title="" />
9138 <br />
9139 <br title="bar" />
9140 <br title="bar" />
9141 <br title="bar/" />
9142 </p>
9143 !! html/parsoid
9144 <p><br title="" />
9145 <br title="" />
9146 <br title="" />
9147 <br title="bar" />
9148 <br title="bar" />
9149 <br title="bar/" />
9150 </p>
9151 !! end
9152
9153 !! test
9154 Horizontal ruler (should it add that extra space?)
9155 !! wikitext
9156 <hr>
9157 <hr >
9158 foo <hr
9159 > bar
9160 !! html+tidy
9161 <hr />
9162 <hr />
9163 <p>foo</p>
9164 <hr />
9165 <p>bar</p>
9166 !! end
9167
9168 !! test
9169 Horizontal ruler -- 4+ dashes render hr
9170 !! wikitext
9171 ----
9172 !! html
9173 <hr />
9174
9175 !! end
9176
9177 !! test
9178 Horizontal ruler -- eats additional dashes on the same line
9179 !! wikitext
9180 ---------
9181 !! html
9182 <hr />
9183
9184 !! end
9185
9186 !! test
9187 Horizontal ruler -- does not collapse dashes on consecutive lines
9188 !! wikitext
9189 ----
9190 ----
9191 !! html
9192 <hr />
9193 <hr />
9194
9195 !! end
9196
9197 !! test
9198 Horizontal ruler -- <4 dashes render as plain text
9199 !! wikitext
9200 ---
9201 !! html
9202 <p>---
9203 </p>
9204 !! end
9205
9206 !! test
9207 Horizontal ruler -- Supports content following dashes on same line
9208 !! wikitext
9209 ---- Foo
9210 !! html
9211 <hr /> Foo
9212
9213 !! html+tidy
9214 <hr />
9215 <p>Foo</p>
9216 !! end
9217
9218 ###
9219 ### Block-level elements
9220 ###
9221 !! test
9222 Common list
9223 !! wikitext
9224 *Common list
9225 * item 2
9226 *item 3
9227 !! html
9228 <ul><li>Common list</li>
9229 <li> item 2</li>
9230 <li>item 3</li></ul>
9231
9232 !! end
9233
9234 !! test
9235 Numbered list
9236 !! wikitext
9237 #Numbered list
9238 #item 2
9239 # item 3
9240 !! html
9241 <ol><li>Numbered list</li>
9242 <li>item 2</li>
9243 <li> item 3</li></ol>
9244
9245 !! end
9246
9247 !! test
9248 Mixed list
9249 !! wikitext
9250 *Mixed list
9251 *# with numbers
9252 ** and bullets
9253 *# and numbers
9254 *bullets again
9255 **bullet level 2
9256 ***bullet level 3
9257 ***#Number on level 4
9258 **bullet level 2
9259 **#Number on level 3
9260 **#Number on level 3
9261 *#number level 2
9262 *Level 1
9263 *** Level 3
9264 #** Level 3, but ordered
9265 !! html
9266 <ul><li>Mixed list
9267 <ol><li> with numbers</li></ol>
9268 <ul><li> and bullets</li></ul>
9269 <ol><li> and numbers</li></ol></li>
9270 <li>bullets again
9271 <ul><li>bullet level 2
9272 <ul><li>bullet level 3
9273 <ol><li>Number on level 4</li></ol></li></ul></li>
9274 <li>bullet level 2
9275 <ol><li>Number on level 3</li>
9276 <li>Number on level 3</li></ol></li></ul>
9277 <ol><li>number level 2</li></ol></li>
9278 <li>Level 1
9279 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9280 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9281
9282 !! end
9283
9284 !! test
9285 1. Nested mixed wikitext and html list
9286 !! wikitext
9287 * hi
9288 * <ul><li>ho</li></ul>
9289 * hi
9290 ** ho
9291 !! html/php
9292 <ul><li> hi</li>
9293 <li> <ul><li>ho</li></ul></li>
9294 <li> hi
9295 <ul><li> ho</li></ul></li></ul>
9296
9297 !! html/parsoid
9298 <ul><li> hi</li>
9299 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9300 <li> hi
9301 <ul><li> ho</li></ul></li></ul>
9302 !! end
9303
9304 !! test
9305 2. Nested mixed wikitext and html list (incompatible)
9306 !! wikitext
9307 ; hi
9308 : {{echo|<li>ho</li>}}
9309 !! html/php
9310 <dl><dt> hi</dt>
9311 <dd> <li>ho</li></dd></dl>
9312
9313 !! html/parsoid
9314 <dl><dt> hi</dt>
9315 <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>
9316 !! end
9317
9318 !! test
9319 Nested lists 1
9320 !! wikitext
9321 *foo
9322 **bar
9323 !! html
9324 <ul><li>foo
9325 <ul><li>bar</li></ul></li></ul>
9326
9327 !! end
9328
9329 !! test
9330 Nested lists 2
9331 !! wikitext
9332 **foo
9333 *bar
9334 !! html
9335 <ul><li><ul><li>foo</li></ul></li>
9336 <li>bar</li></ul>
9337
9338 !! end
9339
9340 !! test
9341 Nested lists 3 (first element empty)
9342 !! wikitext
9343 *
9344 **bar
9345 !! html
9346 <ul><li>
9347 <ul><li>bar</li></ul></li></ul>
9348
9349 !! end
9350
9351 !! test
9352 Nested lists 4 (first element empty)
9353 !! wikitext
9354 **
9355 *bar
9356 !! html
9357 <ul><li><ul><li></li></ul></li>
9358 <li>bar</li></ul>
9359
9360 !! end
9361
9362 !! test
9363 Nested lists 5 (both elements empty)
9364 !! wikitext
9365 **
9366 *
9367 !! html
9368 <ul><li><ul><li></li></ul></li>
9369 <li></li></ul>
9370
9371 !! end
9372
9373 !! test
9374 Nested lists 6 (both elements empty)
9375 !! wikitext
9376 *
9377 **
9378 !! html
9379 <ul><li>
9380 <ul><li></li></ul></li></ul>
9381
9382 !! end
9383
9384 !! test
9385 Nested lists 7 (skip initial nesting levels)
9386 !! wikitext
9387 *** foo
9388 !! html
9389 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9390
9391 !! end
9392
9393 !! test
9394 Nested lists 8 (multiple nesting transitions)
9395 !! wikitext
9396 * foo
9397 *** bar
9398 ** baz
9399 * boo
9400 !! html
9401 <ul><li> foo
9402 <ul><li><ul><li> bar</li></ul></li>
9403 <li> baz</li></ul></li>
9404 <li> boo</li></ul>
9405
9406 !! end
9407
9408 !! test
9409 Nested lists 9 (extension interaction)
9410 !! options
9411 parsoid
9412 !! wikitext
9413 *<references />
9414 !! html/parsoid
9415 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9416 !! end
9417
9418 !! test
9419 1. Lists with start-of-line-transparent tokens before bullets: Comments
9420 !! wikitext
9421 *foo
9422 *<!--cmt-->bar
9423 <!--cmt-->*baz
9424 !! html
9425 <ul><li>foo</li>
9426 <li>bar</li>
9427 <li>baz</li></ul>
9428
9429 !! end
9430
9431 !! test
9432 2. Lists with start-of-line-transparent tokens before bullets: Template close
9433 !! wikitext
9434 *foo {{echo|bar
9435 }}*baz
9436 !! html
9437 <ul><li>foo bar</li>
9438 <li>baz</li></ul>
9439
9440 !! end
9441
9442 !! test
9443 List items are not parsed correctly following a <pre> block (bug 785)
9444 !! wikitext
9445 * <pre>foo</pre>
9446 * <pre>bar</pre>
9447 * zar
9448 !! html/php
9449 <ul><li> <pre>foo</pre></li>
9450 <li> <pre>bar</pre></li>
9451 <li> zar</li></ul>
9452
9453 !! html/parsoid
9454 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9455 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9456 <li> zar</li></ul>
9457 !! end
9458
9459 !! test
9460 List items from template
9461 !! wikitext
9462
9463 {{inner list}}
9464 * item 2
9465
9466 * item 0
9467 {{inner list}}
9468 * item 2
9469
9470 * item 0
9471 * notSOL{{inner list}}
9472 * item 2
9473 !! html
9474 <ul><li> item 1</li>
9475 <li> item 2</li></ul>
9476 <ul><li> item 0</li>
9477 <li> item 1</li>
9478 <li> item 2</li></ul>
9479 <ul><li> item 0</li>
9480 <li> notSOL</li>
9481 <li> item 1</li>
9482 <li> item 2</li></ul>
9483
9484 !! end
9485
9486 !! test
9487 List interrupted by empty line or heading
9488 !! wikitext
9489 * foo
9490
9491 ** bar
9492 == A heading ==
9493 * Another list item
9494 !! html
9495 <ul><li> foo</li></ul>
9496 <ul><li><ul><li> bar</li></ul></li></ul>
9497 <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>
9498 <ul><li> Another list item</li></ul>
9499
9500 !!end
9501
9502 !!test
9503 Multiple list tags generated by templates
9504 !! wikitext
9505 {{echo|<li>}}a
9506 {{echo|<li>}}b
9507 {{echo|<li>}}c
9508 !! html
9509 <li>a
9510 <li>b
9511 <li>c</li>
9512 </li>
9513 </li>
9514
9515 !! html+tidy
9516 <ul>
9517 <li>a</li>
9518 <li>b</li>
9519 <li>c</li>
9520 </ul>
9521 !!end
9522
9523 !!test
9524 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9525 !! wikitext
9526 *a
9527 <!--This line will NOT split the list-->
9528 *b
9529 <!--This line will NOT split the list either-->
9530 *c
9531 <!--foo--> <!----> <!--This line NOT split the list either-->
9532 *d
9533 !! html
9534 <ul><li>a</li>
9535 <li>b</li>
9536 <li>c</li>
9537 <li>d</li></ul>
9538
9539 !!end
9540
9541 !!test
9542 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9543 !! wikitext
9544 *a
9545 <!--This line will NOT split the list-->
9546 *b
9547 <!--This line will NOT split the list either-->
9548 *c
9549 <!--foo--> <!----> <!--This line NOT split the list
9550 either-->
9551 *d
9552 !! html
9553 <ul><li>a</li>
9554 <li>b</li>
9555 <li>c</li>
9556 <li>d</li></ul>
9557
9558 !!end
9559
9560 !!test
9561 Test the li-hack
9562 (The PHP parser relies on Tidy for the hack)
9563 !!options
9564 parsoid=wt2html,wt2wt
9565 !! wikitext
9566 * foo
9567 * <li>li-hack
9568 * {{echo|<li>templated li-hack}}
9569 * <!--foo--> <li> unsupported li-hack with preceding comments
9570
9571 <ul>
9572 <li><li>not a li-hack
9573 </li>
9574 </ul>
9575 !! html+tidy
9576 <ul>
9577 <li>foo</li>
9578 <li>li-hack</li>
9579 <li>templated li-hack</li>
9580 <li>unsupported li-hack with preceding comments</li>
9581 </ul>
9582 <ul>
9583 <li>not a li-hack</li>
9584 </ul>
9585 !!end
9586
9587 !! test
9588 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9589 !! options
9590 parsoid
9591 !! wikitext
9592 # foo
9593 ## bar
9594 * foo
9595 ** bar
9596 : foo
9597 :: bar
9598 !! html
9599 <ol>
9600 <li> foo<ol>
9601 <li> bar</li>
9602 </ol></li>
9603 </ol><ul>
9604 <li> foo<ul>
9605 <li> bar</li>
9606 </ul></li>
9607 </ul><dl>
9608 <dd> foo<dl>
9609 <dd> bar</dd>
9610 </dl></dd>
9611 </dl>
9612 !! end
9613
9614 !! test
9615 Parsoid: Test of whitespace serialization with Templated bullets
9616 !! options
9617 parsoid
9618 !! wikitext
9619 * {{bullet}}
9620 !! html
9621 <ul>
9622 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9623 </ul>
9624 !! end
9625
9626 # ------------------------------------------------------------------------
9627 # The next set of tests are about Parsoid's ability to handle badly nested
9628 # tags (parse, minimize scope of fixup, and roundtrip back)
9629 # ------------------------------------------------------------------------
9630
9631 !! test
9632 Unbalanced closing block tags break a list
9633 (php parser relies on Tidy to fix up)
9634 !! wikitext
9635 <div>
9636 *a</div><div>
9637 *b</div>
9638 !! html+tidy
9639 <div>
9640 <ul>
9641 <li>a</li>
9642 </ul>
9643 </div>
9644 <div>
9645 <ul>
9646 <li>b</li>
9647 </ul>
9648 </div>
9649 !! end
9650
9651 # Parsoid fails this test, but it might be tricky to support properly.
9652 # See bug 68395.
9653 !! test
9654 Unbalanced closing non-block tags don't break a list
9655 (php parser relies on Tidy to fix up)
9656 !! wikitext
9657 <span>
9658 *a</span><span>
9659 *b</span>
9660 !! html/php+tidy
9661 <ul>
9662 <li><span>a</span></li>
9663 <li><span>b</span></li>
9664 </ul>
9665 !! html/parsoid
9666 <span>
9667 <ul>
9668 <li>a<span></span>
9669 </li>
9670 <li>b
9671 </li>
9672 </ul>
9673 </span>
9674 !! end
9675
9676 !! test
9677 Unclosed formatting tags that straddle lists are closed and reopened
9678 (php parser relies on Tidy to fix up)
9679 !! options
9680 parsoid=wt2html,wt2wt,html2html
9681 !! wikitext
9682 # <s> a
9683 # b </s>
9684 !! html/php+tidy
9685 <ol>
9686 <li><s>a</s></li>
9687 <li><s>b</s></li>
9688 </ol>
9689 !! html/parsoid
9690 <ol><li> <s> a</s></li>
9691 <li><s> b </s></li></ol>
9692 !! end
9693
9694 # See bug 68395.
9695 !!test
9696 1. List embedded in a formatting tag
9697 !! wikitext
9698 <small>
9699 * foo
9700 </small>
9701 !! html/php+tidy
9702 <ul>
9703 <li><small>foo</small></li>
9704 </ul>
9705 !! html/parsoid
9706 <small>
9707 <ul>
9708 <li> foo</li>
9709 </ul>
9710 </small>
9711 !!end
9712
9713 ## Ugly Parsoid output here
9714 ## Not sure what the right output is.
9715 !!test
9716 2. List embedded in a formatting tag
9717 !! wikitext
9718 <small>
9719 *a
9720 *b</small>
9721 !! html/php+tidy
9722 <ul>
9723 <li><small>a</small></li>
9724 <li><small>b</small></li>
9725 </ul>
9726 !! html/parsoid
9727 <small></small>
9728 <ul><small>
9729 <li>a</li>
9730 </small>
9731 <li><small>b</small></li>
9732 </ul>
9733 !!end
9734
9735 # Ugly Parsoid and PHP parser output here
9736 # Not sure if we want to make this a test!
9737 #
9738 ## !!test
9739 ## 3. Unclosed formatting tags in list elements
9740 ## !! wikitext
9741 ## *<small>a
9742 ## *<small>b
9743 ## !! html/php+tidy
9744 ## <ul>
9745 ## <li><small>a</small></li>
9746 ## <li><small><small>b</small></small></li>
9747 ## </ul>
9748 ## !! html/parsoid
9749 ## <ul>
9750 ## <li><small>a</small></li>
9751 ## <small>
9752 ## <li><small>b</small></li>
9753 ## </small></ul>
9754 ## !!end
9755
9756 # This is a bug in the PHP parser + tidy combination.
9757 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9758 # and then fostered out of the table by tidy.)
9759 # We believe the Parsoid output to be correct.
9760 !! test
9761 Table with missing opening <tr> tag
9762 !! options
9763 parsoid=wt2html,wt2wt
9764 !! wikitext
9765 <table>
9766 <td>foo</td>
9767 </tr>
9768 </table>
9769 !! html+tidy
9770 <table>
9771 <tr>
9772 <td>foo</td>
9773 </tr>
9774 </table>
9775 !! end
9776
9777 ###
9778 ### Magic Words
9779 ###
9780
9781 # Note that the current date is hard-coded as
9782 # 1970-01-01T00:02:03Z (a Thursday)
9783 # when running parser tests. The timezone is also fixed to GMT, so
9784 # local date will be identical to current date.
9785
9786 !! test
9787 Magic Word: {{CURRENTDAY}}
9788 !! wikitext
9789 {{CURRENTDAY}}
9790 !! html
9791 <p>1
9792 </p>
9793 !! end
9794
9795 !! test
9796 Magic Word: {{CURRENTDAY2}}
9797 !! wikitext
9798 {{CURRENTDAY2}}
9799 !! html
9800 <p>01
9801 </p>
9802 !! end
9803
9804 !! test
9805 Magic Word: {{CURRENTDAYNAME}}
9806 !! wikitext
9807 {{CURRENTDAYNAME}}
9808 !! html
9809 <p>Thursday
9810 </p>
9811 !! end
9812
9813 !! test
9814 Magic Word: {{CURRENTDOW}}
9815 !! wikitext
9816 {{CURRENTDOW}}
9817 !! html
9818 <p>4
9819 </p>
9820 !! end
9821
9822 !! test
9823 Magic Word: {{CURRENTMONTH}}
9824 !! wikitext
9825 {{CURRENTMONTH}}
9826 !! html
9827 <p>01
9828 </p>
9829 !! end
9830
9831 !! test
9832 Magic Word: {{CURRENTMONTH1}}
9833 !! wikitext
9834 {{CURRENTMONTH1}}
9835 !! html
9836 <p>1
9837 </p>
9838 !! end
9839
9840 !! test
9841 Magic Word: {{CURRENTMONTHABBREV}}
9842 !! wikitext
9843 {{CURRENTMONTHABBREV}}
9844 !! html
9845 <p>Jan
9846 </p>
9847 !! end
9848
9849 !! test
9850 Magic Word: {{CURRENTMONTHNAME}}
9851 !! wikitext
9852 {{CURRENTMONTHNAME}}
9853 !! html
9854 <p>January
9855 </p>
9856 !! end
9857
9858 !! test
9859 Magic Word: {{CURRENTMONTHNAMEGEN}}
9860 !! wikitext
9861 {{CURRENTMONTHNAMEGEN}}
9862 !! html
9863 <p>January
9864 </p>
9865 !! end
9866
9867 !! test
9868 Magic Word: {{CURRENTTIME}}
9869 !! wikitext
9870 {{CURRENTTIME}}
9871 !! html
9872 <p>00:02
9873 </p>
9874 !! end
9875
9876 !! test
9877 Magic Word: {{CURRENTHOUR}}
9878 !! wikitext
9879 {{CURRENTHOUR}}
9880 !! html
9881 <p>00
9882 </p>
9883 !! end
9884
9885 !! test
9886 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9887 !! wikitext
9888 {{CURRENTWEEK}}
9889 !! html
9890 <p>1
9891 </p>
9892 !! end
9893
9894 !! test
9895 Magic Word: {{CURRENTYEAR}}
9896 !! wikitext
9897 {{CURRENTYEAR}}
9898 !! html
9899 <p>1970
9900 </p>
9901 !! end
9902
9903 !! test
9904 Magic Word: {{CURRENTTIMESTAMP}}
9905 !! wikitext
9906 {{CURRENTTIMESTAMP}}
9907 !! html
9908 <p>19700101000203
9909 </p>
9910 !! end
9911
9912 !! test
9913 Magic Words LOCAL (UTC)
9914 !! wikitext
9915 * {{LOCALMONTH}}
9916 * {{LOCALMONTH1}}
9917 * {{LOCALMONTHNAME}}
9918 * {{LOCALMONTHNAMEGEN}}
9919 * {{LOCALMONTHABBREV}}
9920 * {{LOCALDAY}}
9921 * {{LOCALDAY2}}
9922 * {{LOCALDAYNAME}}
9923 * {{LOCALYEAR}}
9924 * {{LOCALTIME}}
9925 * {{LOCALHOUR}}
9926 * {{LOCALWEEK}}
9927 * {{LOCALDOW}}
9928 * {{LOCALTIMESTAMP}}
9929 !! html
9930 <ul><li> 01</li>
9931 <li> 1</li>
9932 <li> January</li>
9933 <li> January</li>
9934 <li> Jan</li>
9935 <li> 1</li>
9936 <li> 01</li>
9937 <li> Thursday</li>
9938 <li> 1970</li>
9939 <li> 00:02</li>
9940 <li> 00</li>
9941 <li> 1</li>
9942 <li> 4</li>
9943 <li> 19700101000203</li></ul>
9944
9945 !! end
9946
9947 !! test
9948 Magic Word: {{FULLPAGENAME}}
9949 !! options
9950 title=[[User:Ævar Arnfjörð Bjarmason]]
9951 !! wikitext
9952 {{FULLPAGENAME}}
9953 !! html
9954 <p>User:Ævar Arnfjörð Bjarmason
9955 </p>
9956 !! end
9957
9958 !! test
9959 Magic Word: {{FULLPAGENAMEE}}
9960 !! options
9961 title=[[User:Ævar Arnfjörð Bjarmason]]
9962 !! wikitext
9963 {{FULLPAGENAMEE}}
9964 !! html
9965 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9966 </p>
9967 !! end
9968
9969 !! test
9970 Magic Word: {{TALKSPACE}}
9971 !! options
9972 title=[[User:Ævar Arnfjörð Bjarmason]]
9973 !! wikitext
9974 {{TALKSPACE}}
9975 !! html
9976 <p>User talk
9977 </p>
9978 !! end
9979
9980 !! test
9981 Magic Word: {{TALKSPACE}}, same namespace
9982 !! options
9983 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9984 !! wikitext
9985 {{TALKSPACE}}
9986 !! html
9987 <p>User talk
9988 </p>
9989 !! end
9990
9991 !! test
9992 Magic Word: {{TALKSPACE}}, main namespace
9993 !! options
9994 title=[[Parser Test]]
9995 !! wikitext
9996 {{TALKSPACE}}
9997 !! html
9998 <p>Talk
9999 </p>
10000 !! end
10001
10002 !! test
10003 Magic Word: {{TALKSPACEE}}
10004 !! options
10005 title=[[User:Ævar Arnfjörð Bjarmason]]
10006 !! wikitext
10007 {{TALKSPACEE}}
10008 !! html
10009 <p>User_talk
10010 </p>
10011 !! end
10012
10013 !! test
10014 Magic Word: {{SUBJECTSPACE}}
10015 !! options
10016 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10017 !! wikitext
10018 {{SUBJECTSPACE}}
10019 !! html
10020 <p>User
10021 </p>
10022 !! end
10023
10024 !! test
10025 Magic Word: {{SUBJECTSPACE}}, same namespace
10026 !! options
10027 title=[[User:Ævar Arnfjörð Bjarmason]]
10028 !! wikitext
10029 {{SUBJECTSPACE}}
10030 !! html
10031 <p>User
10032 </p>
10033 !! end
10034
10035 !! test
10036 Magic Word: {{SUBJECTSPACE}}, main namespace
10037 !! options
10038 title=[[Parser Test]]
10039 !! wikitext
10040 {{SUBJECTSPACE}}
10041 !! html
10042
10043 !! end
10044
10045 !! test
10046 Magic Word: {{SUBJECTSPACEE}}
10047 !! options
10048 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10049 !! wikitext
10050 {{SUBJECTSPACEE}}
10051 !! html
10052 <p>User
10053 </p>
10054 !! end
10055
10056 !! test
10057 Magic Word: {{NAMESPACE}}
10058 !! options
10059 title=[[User:Ævar Arnfjörð Bjarmason]]
10060 !! wikitext
10061 {{NAMESPACE}}
10062 !! html
10063 <p>User
10064 </p>
10065 !! end
10066
10067 !! test
10068 Magic Word: {{NAMESPACEE}}
10069 !! options
10070 title=[[User:Ævar Arnfjörð Bjarmason]]
10071 !! wikitext
10072 {{NAMESPACEE}}
10073 !! html
10074 <p>User
10075 </p>
10076 !! end
10077
10078 !! test
10079 Magic Word: {{NAMESPACENUMBER}}
10080 !! options
10081 title=[[User:Ævar Arnfjörð Bjarmason]]
10082 !! wikitext
10083 {{NAMESPACENUMBER}}
10084 !! html
10085 <p>2
10086 </p>
10087 !! end
10088
10089 !! test
10090 Magic Word: {{SUBPAGENAME}}
10091 !! options
10092 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10093 !! wikitext
10094 {{SUBPAGENAME}}
10095 !! html
10096 <p>sub ö
10097 </p>
10098 !! end
10099
10100 !! test
10101 Magic Word: {{SUBPAGENAMEE}}
10102 !! options
10103 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10104 !! wikitext
10105 {{SUBPAGENAMEE}}
10106 !! html
10107 <p>sub_%C3%B6
10108 </p>
10109 !! end
10110
10111 !! test
10112 Magic Word: {{ROOTPAGENAME}}
10113 !! options
10114 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10115 !! wikitext
10116 {{ROOTPAGENAME}}
10117 !! html
10118 <p>Ævar Arnfjörð Bjarmason
10119 </p>
10120 !! end
10121
10122 !! test
10123 Magic Word: {{ROOTPAGENAMEE}}
10124 !! options
10125 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10126 !! wikitext
10127 {{ROOTPAGENAMEE}}
10128 !! html
10129 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10130 </p>
10131 !! end
10132
10133 !! test
10134 Magic Word: {{BASEPAGENAME}}
10135 !! options
10136 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10137 !! wikitext
10138 {{BASEPAGENAME}}
10139 !! html
10140 <p>Ævar Arnfjörð Bjarmason
10141 </p>
10142 !! end
10143
10144 !! test
10145 Magic Word: {{BASEPAGENAMEE}}
10146 !! options
10147 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10148 !! wikitext
10149 {{BASEPAGENAMEE}}
10150 !! html
10151 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10152 </p>
10153 !! end
10154
10155 !! test
10156 Magic Word: {{TALKPAGENAME}}
10157 !! options
10158 title=[[User:Ævar Arnfjörð Bjarmason]]
10159 !! wikitext
10160 {{TALKPAGENAME}}
10161 !! html
10162 <p>User talk:Ævar Arnfjörð Bjarmason
10163 </p>
10164 !! end
10165
10166 !! test
10167 Magic Word: {{TALKPAGENAMEE}}
10168 !! options
10169 title=[[User:Ævar Arnfjörð Bjarmason]]
10170 !! wikitext
10171 {{TALKPAGENAMEE}}
10172 !! html
10173 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10174 </p>
10175 !! end
10176
10177 !! test
10178 Magic Word: {{SUBJECTPAGENAME}}
10179 !! options
10180 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10181 !! wikitext
10182 {{SUBJECTPAGENAME}}
10183 !! html
10184 <p>User:Ævar Arnfjörð Bjarmason
10185 </p>
10186 !! end
10187
10188 !! test
10189 Magic Word: {{SUBJECTPAGENAMEE}}
10190 !! options
10191 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10192 !! wikitext
10193 {{SUBJECTPAGENAMEE}}
10194 !! html
10195 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10196 </p>
10197 !! end
10198
10199 !! test
10200 Magic Word: {{NUMBEROFFILES}}
10201 !! wikitext
10202 {{NUMBEROFFILES}}
10203 !! html
10204 <p>7
10205 </p>
10206 !! end
10207
10208 !! test
10209 Magic Word: {{PAGENAME}}
10210 !! options
10211 title=[[User:Ævar Arnfjörð Bjarmason]]
10212 !! wikitext
10213 {{PAGENAME}}
10214 !! html
10215 <p>Ævar Arnfjörð Bjarmason
10216 </p>
10217 !! end
10218
10219 !! test
10220 Magic Word: {{PAGENAME}} with metacharacters
10221 !! options
10222 title=[['foo & bar = baz']]
10223 !! wikitext
10224 ''{{PAGENAME}}''
10225 !! html/php
10226 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10227 </p>
10228 !! html+tidy
10229 <p><i>'foo &amp; bar = baz'</i></p>
10230 !! end
10231
10232 !! test
10233 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
10234 !! options
10235 title=[[*RFC 1234 http://example.com/]]
10236 !! wikitext
10237 {{PAGENAME}}
10238 !! html/php
10239 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10240 </p>
10241 !! html+tidy
10242 <p>*RFC 1234 http://example.com/</p>
10243 !! end
10244
10245 !! test
10246 Magic Word: {{PAGENAMEE}}
10247 !! options
10248 title=[[User:Ævar Arnfjörð Bjarmason]]
10249 !! wikitext
10250 {{PAGENAMEE}}
10251 !! html
10252 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10253 </p>
10254 !! end
10255
10256 !! test
10257 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10258 !! options
10259 title=[[*RFC 1234 http://example.com/]]
10260 !! wikitext
10261 {{PAGENAMEE}}
10262 !! html/php
10263 <p>&#42;RFC_1234_http&#58;//example.com/
10264 </p>
10265 !! html+tidy
10266 <p>*RFC_1234_http://example.com/</p>
10267 !! end
10268
10269 !! test
10270 Magic Word: {{REVISIONID}}
10271 !! wikitext
10272 {{REVISIONID}}
10273 !! html
10274 <p>1337
10275 </p>
10276 !! end
10277
10278 !! test
10279 Magic Word: {{SCRIPTPATH}}
10280 !! wikitext
10281 {{SCRIPTPATH}}
10282 !! html
10283
10284 !! end
10285
10286 !! test
10287 Magic Word: {{STYLEPATH}}
10288 !! wikitext
10289 {{STYLEPATH}}
10290 !! html
10291 <p>/skins
10292 </p>
10293 !! end
10294
10295 !! test
10296 Magic Word: {{SERVER}}
10297 !! wikitext
10298 {{SERVER}}
10299 !! html
10300 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10301 </p>
10302 !! end
10303
10304 !! test
10305 Magic Word: {{SERVERNAME}}
10306 !! wikitext
10307 {{SERVERNAME}}
10308 !! html
10309 <p>example.org
10310 </p>
10311 !! end
10312
10313 !! test
10314 Magic Word: {{SITENAME}}
10315 !! wikitext
10316 {{SITENAME}}
10317 !! html
10318 <p>MediaWiki
10319 </p>
10320 !! end
10321
10322 !! test
10323 Magic Word: {{PAGELANGUAGE}}
10324 !! options
10325 language=fr
10326 !! wikitext
10327 {{PAGELANGUAGE}}
10328 !! html
10329 <p>fr
10330 </p>
10331 !! end
10332
10333 !! test
10334 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10335 !! wikitext
10336 {{PAGELANGUAGE}}
10337 !! html
10338 <p>en
10339 </p>
10340 !! end
10341
10342 !! test
10343 Case-sensitive magic words, when cased differently, should just be template transclusions
10344 !! wikitext
10345 {{CurrentMonth}}
10346 {{currentday}}
10347 {{cURreNTweEK}}
10348 {{currentHour}}
10349 !! html
10350 <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>
10351 <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>
10352 <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>
10353 <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>
10354 </p>
10355 !! end
10356
10357 !! test
10358 Case-insensitive magic words should still work with weird casing.
10359 !! wikitext
10360 {{sErVeRNaMe}}
10361 {{LCFirst:AOEU}}
10362 {{ucFIRST:aoeu}}
10363 {{SERver}}
10364 !! html
10365 <p>example.org
10366 aOEU
10367 Aoeu
10368 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10369 </p>
10370 !! end
10371
10372 # From plwiki:PLOS_ONE
10373 !! test
10374 Parsoid: Page property magic word with magic word contents
10375 !! wikitext
10376 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10377 !! html/parsoid
10378 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" 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=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
10379 !! end
10380
10381 !! test
10382 Parsoid: Template-generated DISPLAYTITLE
10383 !! wikitext
10384 {{{{echo|DISPLAYTITLE}}:Foo}}
10385 !! html/parsoid
10386 <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}}]}'/>
10387 !! end
10388
10389 !! test
10390 Namespace 1 {{ns:1}}
10391 !! wikitext
10392 {{ns:1}}
10393 !! html
10394 <p>Talk
10395 </p>
10396 !! end
10397
10398 !! test
10399 Namespace 1 {{ns:01}}
10400 !! wikitext
10401 {{ns:01}}
10402 !! html
10403 <p>Talk
10404 </p>
10405 !! end
10406
10407 !! test
10408 Namespace 0 {{ns:0}} (bug 4783)
10409 !! wikitext
10410 {{ns:0}}
10411 !! html
10412
10413 !! end
10414
10415 !! test
10416 Namespace 0 {{ns:00}} (bug 4783)
10417 !! wikitext
10418 {{ns:00}}
10419 !! html
10420
10421 !! end
10422
10423 !! test
10424 Namespace -1 {{ns:-1}}
10425 !! wikitext
10426 {{ns:-1}}
10427 !! html
10428 <p>Special
10429 </p>
10430 !! end
10431
10432 !! test
10433 Namespace User {{ns:User}}
10434 !! wikitext
10435 {{ns:User}}
10436 !! html
10437 <p>User
10438 </p>
10439 !! end
10440
10441 !! test
10442 Namespace User talk {{ns:User_talk}}
10443 !! wikitext
10444 {{ns:User_talk}}
10445 !! html
10446 <p>User talk
10447 </p>
10448 !! end
10449
10450 !! test
10451 Namespace User talk {{ns:uSeR tAlK}}
10452 !! wikitext
10453 {{ns:uSeR tAlK}}
10454 !! html
10455 <p>User talk
10456 </p>
10457 !! end
10458
10459 !! test
10460 Namespace File {{ns:File}}
10461 !! wikitext
10462 {{ns:File}}
10463 !! html
10464 <p>File
10465 </p>
10466 !! end
10467
10468 !! test
10469 Namespace File {{ns:Image}}
10470 !! wikitext
10471 {{ns:Image}}
10472 !! html
10473 <p>File
10474 </p>
10475 !! end
10476
10477 !! test
10478 Namespace (lang=de) Benutzer {{ns:User}}
10479 !! options
10480 language=de
10481 !! wikitext
10482 {{ns:User}}
10483 !! html
10484 <p>Benutzer
10485 </p>
10486 !! end
10487
10488 !! test
10489 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10490 !! options
10491 language=de
10492 !! wikitext
10493 {{ns:3}}
10494 !! html
10495 <p>Benutzer Diskussion
10496 </p>
10497 !! end
10498
10499 !! test
10500 Urlencode
10501 !! wikitext
10502 {{urlencode:hi world?!}}
10503 {{urlencode:hi world?!|WIKI}}
10504 {{urlencode:hi world?!|PATH}}
10505 {{urlencode:hi world?!|QUERY}}
10506 !! html/php
10507 <p>hi+world%3F%21
10508 hi_world%3F!
10509 hi%20world%3F%21
10510 hi+world%3F%21
10511 </p>
10512 !! end
10513
10514 !! test
10515 Magic Word: prioritize type info over data-parsoid
10516 !! options
10517 parsoid=html2wt
10518 !! html/parsoid
10519 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10520 !! wikitext
10521 __FORCETOC__
10522 !! end
10523
10524 !! test
10525 Magic Word: serialize on separate line (parsoid)
10526 !! options
10527 parsoid=wt2wt,html2wt
10528 !! wikitext
10529 foo
10530 __NOTOC__
10531 bar
10532 !! html/parsoid
10533 foo<meta property="mw:PageProp/notoc"/>bar
10534 !! end
10535
10536 !! test
10537 Magic Word: rt non-english wikis
10538 !! options
10539 parsoid=wt2wt
10540 language=de
10541 !! wikitext
10542 __NOEDITSECTION__
10543 !! html/parsoid
10544 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10545 !! end
10546
10547 !!test
10548 __proto__ is treated as normal wikitext (T105997)
10549 !!wikitext
10550 __proto__
10551 !!html
10552 <p>__proto__
10553 </p>
10554 !!end
10555
10556 ###
10557 ### Magic links
10558 ###
10559 !! test
10560 Magic links: internal link to RFC (bug 479)
10561 !! wikitext
10562 [[RFC 123]]
10563 !! html/php
10564 <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>
10565 </p>
10566 !! html/parsoid
10567 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10568 !! end
10569
10570 !! test
10571 Magic links: RFC (bug 479)
10572 !! wikitext
10573 RFC 822
10574 !! html/php
10575 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10576 </p>
10577 !! html/parsoid
10578 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10579 !! end
10580
10581 !! test
10582 Magic links: RFC (bug 65278)
10583 !! wikitext
10584 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10585 !! html/php
10586 <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.
10587 </p>
10588 !! html/parsoid
10589 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10590 !! end
10591
10592 !! test
10593 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10594 !! wikitext
10595 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10596 RFC
10597 822
10598 !! html/php
10599 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10600 RFC
10601 822
10602 </p>
10603 !! html/parsoid
10604 <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>
10605 RFC
10606 822</p>
10607 !! end
10608
10609 !! test
10610 Magic links: ISBN (bug 1937)
10611 !! wikitext
10612 ISBN 0-306-40615-2
10613 !! html/php
10614 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10615 </p>
10616 !! html/parsoid
10617 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10618 !! end
10619
10620 !! test
10621 Magic links: ISBN (bug 65278)
10622 !! wikitext
10623 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10624 !! html/php
10625 <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.
10626 </p>
10627 !! html/parsoid
10628 <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>
10629 !! end
10630
10631 !! test
10632 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10633 !! wikitext
10634 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10635 ISBN
10636 9780316098113
10637 ISBN 978
10638 0316098113
10639 !! html/php
10640 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10641 ISBN
10642 9780316098113
10643 ISBN 978
10644 0316098113
10645 </p>
10646 !! html/parsoid
10647 <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>
10648 ISBN
10649 9780316098113
10650 ISBN 978
10651 0316098113</p>
10652 !! end
10653
10654 !! test
10655 Magic links: PMID incorrectly converts space to underscore
10656 !! wikitext
10657 PMID 1234
10658 !! html/php
10659 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10660 </p>
10661 !! html/parsoid
10662 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10663 !! end
10664
10665 !! test
10666 Magic links: PMID (bug 65278)
10667 !! wikitext
10668 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10669 !! html/php
10670 <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.
10671 </p>
10672 !! html/parsoid
10673 <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>
10674 !! end
10675
10676 !! test
10677 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10678 !! wikitext
10679 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10680 PMID
10681 1234
10682 !! html/php
10683 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10684 PMID
10685 1234
10686 </p>
10687 !! html/parsoid
10688 <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>
10689 PMID
10690 1234</p>
10691 !! end
10692
10693 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10694 # since these are ExtLinkText, not MagicLinkText
10695 !! test
10696 Magic links: use appropriate serialization for "almost" magic links.
10697 !! wikitext
10698 X[[Special:BookSources/0978739256|foo]]
10699
10700 X[//tools.ietf.org/html/rfc1234 foo]
10701 !! html/php
10702 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10703 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10704 </p>
10705 !! html/parsoid
10706 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10707 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10708 !! end
10709
10710 !! test
10711 Magic links: All disabled (T47942)
10712 !! options
10713 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10714 !! wikitext
10715 ISBN 0-306-40615-2
10716 PMID 1234
10717 RFC 4321
10718 !! html/php
10719 <p>ISBN 0-306-40615-2
10720 PMID 1234
10721 RFC 4321
10722 </p>
10723 !! end
10724
10725 ###
10726 ### Templates
10727 ####
10728
10729 !! test
10730 Nonexistent template
10731 !! wikitext
10732 {{thistemplatedoesnotexist}}
10733 !! html
10734 <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>
10735 </p>
10736 !! end
10737
10738 !! test
10739 Template with invalid target containing tags
10740 !! wikitext
10741 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10742 !! html
10743 <p>{{a<b>b</b>|foo|a=b|a = b}}
10744 </p>
10745 !! end
10746
10747 !! test
10748 Template with invalid target containing unclosed tag
10749 !! wikitext
10750 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10751 !! html
10752 <p>{{a<b>|foo|a=b|a = b}}</b>
10753 </p>
10754 !! end
10755
10756 !! test
10757 Template with invalid target containing wikilink
10758 !! wikitext
10759 {{[[Main Page]]}}
10760 !! html/php
10761 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10762 </p>
10763 !! html/parsoid
10764 <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>
10765 !! end
10766
10767 !! test
10768 Template with just whitespace in it, bug #68421
10769 !! wikitext
10770 {{echo|{{ }}}}
10771 !! html/parsoid
10772 <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>
10773 !! end
10774
10775 !! article
10776 Template:test
10777 !! text
10778 This is a test template
10779 !! endarticle
10780
10781 !! test
10782 Simple template
10783 !! wikitext
10784 {{test}}
10785 !! html
10786 <p>This is a test template
10787 </p>
10788 !! end
10789
10790 !! test
10791 Template with explicit namespace
10792 !! wikitext
10793 {{Template:test}}
10794 !! html
10795 <p>This is a test template
10796 </p>
10797 !! end
10798
10799
10800 !! article
10801 Template:paramtest
10802 !! text
10803 This is a test template with parameter {{{param}}}
10804 !! endarticle
10805
10806 !! test
10807 Template parameter
10808 !! wikitext
10809 {{paramtest|param=foo}}
10810 !! html
10811 <p>This is a test template with parameter foo
10812 </p>
10813 !! end
10814
10815 !! article
10816 Template:paramtestnum
10817 !! text
10818 [[{{{1}}}|{{{2}}}]]
10819 !! endarticle
10820
10821 !! test
10822 Template unnamed parameter
10823 !! wikitext
10824 {{paramtestnum|Main Page|the main page}}
10825 !! html
10826 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10827 </p>
10828 !! end
10829
10830 !! article
10831 Template:templatesimple
10832 !! text
10833 (test)
10834 !! endarticle
10835
10836 !! article
10837 Template:templateredirect
10838 !! text
10839 #redirect [[Template:templatesimple]]
10840 !! endarticle
10841
10842 !! article
10843 Template:templateasargtestnum
10844 !! text
10845 {{{{{1}}}}}
10846 !! endarticle
10847
10848 !! article
10849 Template:templateasargtest
10850 !! text
10851 {{template{{{templ}}}}}
10852 !! endarticle
10853
10854 !! article
10855 Template:templateasargtest2
10856 !! text
10857 {{{{{templ}}}}}
10858 !! endarticle
10859
10860 !! test
10861 Template with template name as unnamed argument
10862 !! wikitext
10863 {{templateasargtestnum|templatesimple}}
10864 !! html
10865 <p>(test)
10866 </p>
10867 !! end
10868
10869 !! test
10870 Template with template name as argument
10871 !! wikitext
10872 {{templateasargtest|templ=simple}}
10873 !! html
10874 <p>(test)
10875 </p>
10876 !! end
10877
10878 !! test
10879 Template with template name as argument (2)
10880 !! wikitext
10881 {{templateasargtest2|templ=templatesimple}}
10882 !! html
10883 <p>(test)
10884 </p>
10885 !! end
10886
10887 !! article
10888 Template:templateasargtestdefault
10889 !! text
10890 {{{{{templ|templatesimple}}}}}
10891 !! endarticle
10892
10893 !! article
10894 Template:templa
10895 !! text
10896 '''templ'''
10897 !! endarticle
10898
10899 !! test
10900 Template with default value
10901 !! wikitext
10902 {{templateasargtestdefault}}
10903 !! html
10904 <p>(test)
10905 </p>
10906 !! end
10907
10908 !! test
10909 Template with default value (value set)
10910 !! wikitext
10911 {{templateasargtestdefault|templ=templa}}
10912 !! html
10913 <p><b>templ</b>
10914 </p>
10915 !! end
10916
10917 !! test
10918 Template redirect
10919 !! wikitext
10920 {{templateredirect}}
10921 !! html/php
10922 <p>(test)
10923 </p>
10924 !! html/parsoid
10925 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10926 !! end
10927
10928 !! test
10929 Template with argument in separate line
10930 !! wikitext
10931 {{ templateasargtest |
10932 templ = simple }}
10933 !! html
10934 <p>(test)
10935 </p>
10936 !! end
10937
10938 !! test
10939 Template with complex template as argument
10940 !! wikitext
10941 {{paramtest|
10942 param ={{ templateasargtest |
10943 templ = simple }}}}
10944 !! html
10945 <p>This is a test template with parameter (test)
10946 </p>
10947 !! end
10948
10949 !! test
10950 Template with thumb image (with link in description)
10951 !! wikitext
10952 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10953 !! html/php
10954 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>
10955
10956 !! html+tidy
10957 <p>This is a test template with parameter</p>
10958 <div class="thumb tright">
10959 <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>
10960 <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>
10961 </div>
10962 </div>
10963 !! html/parsoid
10964 <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>
10965 !! end
10966
10967 !! article
10968 Template:complextemplate
10969 !! text
10970 {{{1}}} {{paramtest|
10971 param ={{{param}}}}}
10972 !! endarticle
10973
10974 !! test
10975 Template with complex arguments
10976 !! wikitext
10977 {{complextemplate|
10978 param ={{ templateasargtest |
10979 templ = simple }}|[[Template:complextemplate|link]]}}
10980 !! html
10981 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10982 </p>
10983 !! end
10984
10985 !! test
10986 BUG 553: link with two variables in a piped link
10987 !! wikitext
10988 {|
10989 |[[{{{1}}}|{{{2}}}]]
10990 |}
10991 !! html/php
10992 <table>
10993 <tr>
10994 <td>[[{{{1}}}|{{{2}}}]]
10995 </td></tr></table>
10996
10997 !! html/parsoid
10998 <table>
10999 <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>
11000 </tbody></table>
11001 !! end
11002
11003 # See: T2553
11004 !! test
11005 Abort table cell attribute parsing on wikilink
11006 !! wikitext
11007 {|
11008 | testing [[one|two]] | three || four
11009 | testing one two | three || four
11010 | testing="[[one|two]]" | three || four
11011 |}
11012 !! html/php
11013 <table>
11014 <tr>
11015 <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>
11016 <td> four
11017 </td>
11018 <td> three </td>
11019 <td> four
11020 </td>
11021 <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>
11022 <td> four
11023 </td></tr></table>
11024
11025 !! html/parsoid
11026 <table>
11027 <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>
11028 <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>
11029 <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>
11030 </tbody></table>
11031 !! end
11032
11033 !! test
11034 Don't abort table cell attribute parsing if wikilink is found in template arg
11035 !! wikitext
11036 {|
11037 | Test {{#tag:ref|One two "[[three]]" four}}
11038 |}
11039 !! html/parsoid
11040 <table>
11041 <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>
11042 </tbody></table>
11043 !! end
11044
11045 !! test
11046 Magic variable as template parameter
11047 !! wikitext
11048 {{paramtest|param={{SITENAME}}}}
11049 !! html
11050 <p>This is a test template with parameter MediaWiki
11051 </p>
11052 !! end
11053
11054 !! article
11055 Template:linktest
11056 !! text
11057 [[{{{param}}}|link]]
11058 !! endarticle
11059
11060 !! test
11061 Template parameter as link source
11062 !! wikitext
11063 {{linktest|param=Main Page}}
11064 !! html
11065 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11066 </p>
11067 !! end
11068
11069 !!article
11070 Template:paramtest2
11071 !! text
11072 including another template, {{paramtest|param={{{arg}}}}}
11073 !! endarticle
11074
11075 !! test
11076 Template passing argument to another template
11077 !! wikitext
11078 {{paramtest2|arg='hmm'}}
11079 !! html
11080 <p>including another template, This is a test template with parameter 'hmm'
11081 </p>
11082 !! end
11083
11084 !! article
11085 Template:Linktest2
11086 !! text
11087 Main Page
11088 !! endarticle
11089
11090 !! test
11091 Template as link source
11092 !! wikitext
11093 [[{{linktest2}}]]
11094
11095 [[{{linktest2}}|Main Page]]
11096
11097 [[{{linktest2}}]]Page
11098 !! html
11099 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11100 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11101 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11102 </p>
11103 !! end
11104
11105
11106 !! article
11107 Template:loop1
11108 !! text
11109 {{loop2}}
11110 !! endarticle
11111
11112 !! article
11113 Template:loop2
11114 !! text
11115 {{loop1}}
11116 !! endarticle
11117
11118 !! test
11119 Template infinite loop
11120 !! wikitext
11121 {{loop1}}
11122 !! html
11123 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11124 </p>
11125 !! end
11126
11127 !! test
11128 Template from main namespace
11129 !! wikitext
11130 {{:Main Page}}
11131 !! html
11132 <p>blah blah
11133 </p>
11134 !! end
11135
11136 !! article
11137 Template:table
11138 !! text
11139 {|
11140 | 1 || 2
11141 |-
11142 | 3 || 4
11143 |}
11144 !! endarticle
11145
11146 !! test
11147 BUG 529: Template with table, not included at beginning of line
11148 !! wikitext
11149 foo {{table}}
11150 !! html
11151 <p>foo
11152 </p>
11153 <table>
11154 <tr>
11155 <td> 1 </td>
11156 <td> 2
11157 </td></tr>
11158 <tr>
11159 <td> 3 </td>
11160 <td> 4
11161 </td></tr></table>
11162
11163 !! end
11164
11165 !! test
11166 BUG 523: Template shouldn't eat newline (or add an extra one before table)
11167 !! wikitext
11168 foo
11169 {{table}}
11170 !! html
11171 <p>foo
11172 </p>
11173 <table>
11174 <tr>
11175 <td> 1 </td>
11176 <td> 2
11177 </td></tr>
11178 <tr>
11179 <td> 3 </td>
11180 <td> 4
11181 </td></tr></table>
11182
11183 !! end
11184
11185 !! test
11186 BUG 41: Template parameters shown as broken links
11187 !! wikitext
11188 {{{parameter}}}
11189 !! html
11190 <p>{{{parameter}}}
11191 </p>
11192 !! end
11193
11194 !! test
11195 Template with targets containing wikilinks
11196 !! wikitext
11197 {{[[foo]]}}
11198
11199 {{[[{{echo|foo}}]]}}
11200
11201 {{{{echo|[[foo}}]]}}
11202 !! html
11203 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11204 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11205 </p><p>{{[[foo}}]]
11206 </p>
11207 !! end
11208
11209 !! article
11210 Template:''
11211 !! text
11212 bar
11213 !! endarticle
11214
11215 !! test
11216 Templates: Double quotes as template target
11217 !! wikitext
11218 foo {{''}} baz
11219 !! html/php
11220 <p>foo bar baz
11221 </p>
11222 !! html/parsoid
11223 <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
11224 </p>
11225 !! end
11226
11227 ## This test is about making sure Parsoid's data-mw is well formed in the
11228 ## face of multiple templates with intersecting and overlapping ranges. The
11229 ## wikitext itself is wretched.
11230 !! test
11231 Templates with intersecting and overlapping ranges
11232 !! wikitext
11233 {|{{echo|
11234 <p>ha</p>}}
11235 {|{{echo|
11236 <p>ho</p>}}
11237 {{echo|{{!}}hi}}
11238 |}
11239 !! html/php+tidy
11240 <p>ha</p>
11241 <p>ho</p>
11242 <table>
11243 <tr>
11244 <td></td>
11245 </tr>
11246 <tr>
11247 <td>hi</td>
11248 </tr>
11249 </table>
11250 <table>
11251 <tr>
11252 <td></td>
11253 </tr>
11254 </table>
11255 !! html/parsoid
11256 <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":""}]]}'>
11257
11258 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11259
11260 <tbody><tr><td>hi</td></tr>
11261 </tbody></table>
11262 !! end
11263
11264 !! article
11265 Template:MSGNW test
11266 !! text
11267 ''None'' of '''this''' should be
11268 * interpreted
11269 but rather passed unmodified
11270 {{test}}
11271 <gallery>
11272 File:Foobar.jpg
11273 </gallery>
11274 <!-- comment -->
11275 !! endarticle
11276
11277 # hmm, fix this or just deprecate msgnw and document its behavior?
11278 !! test
11279 msgnw keyword
11280 !! wikitext
11281 {{msgnw:MSGNW test}}
11282 !! html/php
11283 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11284 &#42; interpreted
11285 &#32;but rather passed unmodified
11286 &#123;&#123;test&#125;&#125;
11287 &#60;gallery&#62;
11288 File:Foobar.jpg
11289 &#60;/gallery&#62;
11290 &#60;!-- comment --&#62;
11291 </p>
11292 !! end
11293
11294 !! test
11295 int keyword
11296 !! wikitext
11297 {{int:youhavenewmessages|lots of money|not!}}
11298 !! html
11299 <p>You have lots of money (not!).
11300 </p>
11301 !! end
11302
11303 !! test
11304 int keyword - non-existing message
11305 !! wikitext
11306 {{int:var}}
11307 !! html
11308 <p>⧼var⧽
11309 </p>
11310 !! end
11311
11312 !! article
11313 Template:Includes
11314 !! text
11315 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11316 !! endarticle
11317
11318 !! test
11319 <includeonly> and <noinclude> being included
11320 !! wikitext
11321 {{Includes}}
11322 !! html
11323 <p>Foobar
11324 </p>
11325 !! end
11326
11327 !! article
11328 Template:Includes2
11329 !! text
11330 <onlyinclude>Foo</onlyinclude>bar
11331 !! endarticle
11332
11333 !! test
11334 <onlyinclude> being included
11335 !! wikitext
11336 {{Includes2}}
11337 !! html
11338 <p>Foo
11339 </p>
11340 !! end
11341
11342
11343 !! article
11344 Template:Includes3
11345 !! text
11346 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11347 !! endarticle
11348
11349 !! test
11350 <onlyinclude> and <includeonly> being included
11351 !! wikitext
11352 {{Includes3}}
11353 !! html
11354 <p>Foo
11355 </p>
11356 !! end
11357
11358 !! test
11359 <includeonly> and <noinclude> on a page
11360 !! wikitext
11361 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11362 !! html
11363 <p>Foozar
11364 </p>
11365 !! end
11366
11367 !! test
11368 Un-closed <noinclude>
11369 !! wikitext
11370 <noinclude>
11371 !! html
11372 !! end
11373
11374 !! test
11375 <onlyinclude> on a page
11376 !! wikitext
11377 <onlyinclude>Foo</onlyinclude>bar
11378 !! html
11379 <p>Foobar
11380 </p>
11381 !! end
11382
11383 !! test
11384 Un-closed <onlyinclude>
11385 !! wikitext
11386 <onlyinclude>
11387 !! html
11388 !! end
11389
11390 !!test
11391 Self-closed noinclude, includeonly, onlyinclude tags
11392 !! wikitext
11393 <noinclude />
11394 <includeonly />
11395 <onlyinclude />
11396 !! html
11397 <p><br />
11398 </p>
11399 !!end
11400
11401 !!test
11402 Unbalanced includeonly and noinclude tags
11403 !! wikitext
11404 {|
11405 |a</noinclude>
11406 |b</noinclude></noinclude>
11407 |c</noinclude></includeonly>
11408 |d</includeonly></includeonly>
11409 |}
11410 !! html
11411 <table>
11412 <tr>
11413 <td>a
11414 </td>
11415 <td>b
11416 </td>
11417 <td>c&lt;/includeonly&gt;
11418 </td>
11419 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11420 </td></tr></table>
11421
11422 !!end
11423
11424 !! article
11425 Template:Includeonly section
11426 !! text
11427 <includeonly>
11428 ==Includeonly section==
11429 </includeonly>
11430 ==Section T-1==
11431 !!endarticle
11432
11433 !! test
11434 Bug 6563: Edit link generation for section shown by <includeonly>
11435 !! wikitext
11436 {{includeonly section}}
11437 !! html
11438 <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>
11439 <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>
11440
11441 !! end
11442
11443 # Uses same input as the contents of [[Template:Includeonly section]]
11444 !! test
11445 Bug 6563: Section extraction for section shown by <includeonly>
11446 !! options
11447 section=T-2
11448 !! wikitext
11449 <includeonly>
11450 ==Includeonly section==
11451 </includeonly>
11452 ==Section T-2==
11453 !! html
11454 ==Section T-2==
11455 !! end
11456
11457 !! test
11458 Bug 6563: Edit link generation for section suppressed by <includeonly>
11459 !! wikitext
11460 <includeonly>
11461 ==Includeonly section==
11462 </includeonly>
11463 ==Section 1==
11464 !! html
11465 <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>
11466
11467 !! end
11468
11469 !! test
11470 Bug 6563: Section extraction for section suppressed by <includeonly>
11471 !! options
11472 section=1
11473 !! wikitext
11474 <includeonly>
11475 ==Includeonly section==
11476 </includeonly>
11477 ==Section 1==
11478 !! html
11479 ==Section 1==
11480 !! end
11481
11482 !! test
11483 Un-closed <includeonly>
11484 !! wikitext
11485 <includeonly>
11486 !! html/php
11487 !! html/parsoid
11488 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11489 !! end
11490
11491 ## We used to, but no longer wt2wt this test since the default serializer
11492 ## will normalize the include directives to serialize on their own line.
11493 ## Selser will take care of preserving formatting in scenarios where they
11494 ## intermingled with other wikitext.
11495 !! test
11496 Includes and comments at SOL
11497 !! options
11498 parsoid=wt2html,html2html
11499 !! wikitext
11500 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11501
11502 <noinclude>
11503 some
11504 </noinclude>* stuff
11505 * here
11506
11507 <includeonly>can have stuff</includeonly>=== here ===
11508
11509 !! html/php
11510 <h2><span class="mw-headline" id="hu">hu</span></h2>
11511 <p>some
11512 </p>
11513 <ul><li> stuff</li>
11514 <li> here</li></ul>
11515 <h3><span class="mw-headline" id="here">here</span></h3>
11516
11517 !! html/parsoid
11518 <!-- 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>
11519
11520 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11521 <p>some</p>
11522 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11523 <li> here</li></ul>
11524
11525 <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>
11526
11527 !! end
11528
11529 # TODO: test with DOM fragment reuse!
11530 !! test
11531 Parsoid: DOM fragment reuse
11532 !! options
11533 parsoid=wt2wt,wt2html
11534 !! wikitext
11535 a{{echo|b<table></table>c}}d
11536
11537 a{{echo|b
11538 <table></table>
11539 c}}d
11540
11541 {{echo|a
11542
11543 <table></table>
11544
11545 b}}
11546 !! html
11547 <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>
11548
11549 <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">
11550 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11551 </span><p about="#mwt2">cd</p>
11552
11553 <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">
11554
11555 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11556
11557 </span><p about="#mwt3">b</p>
11558 !! end
11559
11560 !! test
11561 Parsoid: Merge double tds (T52603)
11562 !! options
11563 parsoid
11564 !! wikitext
11565 {|
11566 |{{echo|{{!}} foo}}
11567 |}
11568 !! html
11569 <table><tbody>
11570 <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>
11571 </tbody></table>
11572 !! end
11573
11574 !! test
11575 Parsoid: Merge double tds in nested transclusion content (T52603)
11576 !! options
11577 parsoid
11578 !! wikitext
11579 {{echo|<div>}}
11580 {|
11581 |{{echo|{{!}} foo}}
11582 |}
11583 {{echo|</div>}}
11584 !! html
11585 <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}}]}'>
11586 <table><tbody>
11587 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11588 </tbody></table>
11589 </div>
11590 !! end
11591
11592 ###
11593 ### <includeonly> and <noinclude> in attributes
11594 ###
11595 !!test
11596 0. includeonly around the entire attribute
11597 !! wikitext
11598 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11599 !! html
11600 <p><span id="v2">bar</span>
11601 </p>
11602 !!end
11603
11604 !!test
11605 1. includeonly in html attr key
11606 !! wikitext
11607 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11608 !! html
11609 <p><span id="foo">bar</span>
11610 </p>
11611 !!end
11612
11613 !!test
11614 2. includeonly in html attr value
11615 !! wikitext
11616 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11617 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11618 !! html
11619 <p><span id="v1">bar</span>
11620 <span id="v1">bar</span>
11621 </p>
11622 !!end
11623
11624 !!test
11625 3. includeonly in part of an attr value
11626 !! wikitext
11627 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11628 !! html
11629 <p><span style="color:red;">bar</span>
11630 </p>
11631 !!end
11632
11633 !!test
11634 4. includeonly in table attributes
11635 !! wikitext
11636 {|
11637 |- <noinclude>
11638 |-
11639 |a
11640 </noinclude>
11641 |- <includeonly>
11642 |-
11643 |b
11644 </includeonly>
11645 |}
11646 !! html
11647 <table>
11648
11649
11650 <tr>
11651 <td>a
11652 </td></tr>
11653 </table>
11654
11655 !!end
11656
11657 ###
11658 ### Token Stream Patcher tests
11659 ###
11660 ### These tests won't always pass wt2wt and other modes because
11661 ### on serialization, the table will be output on a new line.
11662 ### For now, we are blacklisting them, and using this to test selser.
11663 ###
11664
11665 !!test
11666 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11667 !!options
11668 parsoid=wt2html,wt2wt
11669 !!wikitext
11670 {{echo|}}{| width = '100%'
11671 |foo
11672 |}
11673 !!html/parsoid
11674 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11675 <tbody><tr><td>foo</td></tr>
11676 </tbody></table>
11677 !!end
11678
11679 ## We used to, but no longer wt2wt this test since the default serializer
11680 ## will normalize the include directives to serialize on their own line.
11681 ## Selser will take care of preserving formatting in scenarios where they
11682 ## intermingled with other wikitext.
11683 !!test
11684 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11685 !!options
11686 parsoid=wt2html
11687 !!wikitext
11688 <includeonly>a</includeonly>{| {{{b}}}
11689 |c
11690 |}
11691 !!html/parsoid
11692 <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":""}]]}'>
11693 <tbody><tr><td>c</td></tr>
11694 </tbody></table>
11695 !!end
11696
11697 !! test
11698 Table wikitext syntax outside wiki-tables
11699 !! wikitext
11700 a
11701 |+ not a caption
11702 ! not a table heading
11703 |- not a table row
11704 | not a table cell
11705 | class="foo bar" | baz
11706 b
11707 |}
11708 |-
11709 c
11710 !! html
11711 <p>a
11712 |+ not a caption
11713 ! not a table heading
11714 |- not a table row
11715 | not a table cell
11716 | class="foo bar" | baz
11717 b
11718 |}
11719 |-
11720 c
11721 </p>
11722 !! end
11723
11724 ###
11725 ### Testing parsing of templates where a template arg
11726 ### has the same name as the template itself.
11727 ###
11728
11729 !! article
11730 Template:quote
11731 !! text
11732 {{{quote|{{{1}}}}}}
11733 !! endarticle
11734
11735 !!test
11736 Templates: Template Name/Arg clash: 1. Use of positional param
11737 !! wikitext
11738 {{quote|foo}}
11739 !! html
11740 <p>foo
11741 </p>
11742 !!end
11743
11744 !!test
11745 Templates: Template Name/Arg clash: 2. Use of named param
11746 !! wikitext
11747 {{quote|quote=foo}}
11748 !! html
11749 <p>foo
11750 </p>
11751 !!end
11752
11753 !!test
11754 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11755 !! wikitext
11756 {{quote|quote}}
11757 !! html
11758 <p>quote
11759 </p>
11760 !!end
11761
11762 ###
11763 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11764 ###
11765
11766 !!test
11767 Templates: 1. Simple use
11768 !! wikitext
11769 {{echo|Foo}}
11770 !! html
11771 <p>Foo
11772 </p>
11773 !!end
11774
11775 !!test
11776 Templates: 2. Inside a block tag
11777 !! wikitext
11778 <div>{{echo|Foo}}</div>
11779 <blockquote>{{echo|Foo}}</blockquote>
11780 !! html
11781 <div>Foo</div>
11782 <blockquote>Foo</blockquote>
11783
11784 !! html+tidy
11785 <div>Foo</div>
11786 <blockquote>
11787 <p>Foo</p>
11788 </blockquote>
11789 !!end
11790
11791 !!test
11792 Templates: P-wrapping: 1a. Templates on consecutive lines
11793 !! wikitext
11794 {{echo|Foo}}
11795 {{echo|bar}}
11796 !! html
11797 <p>Foo
11798 bar
11799 </p>
11800 !!end
11801
11802 !!test
11803 Templates: P-wrapping: 1b. Templates on consecutive lines
11804 !! wikitext
11805 Foo
11806
11807 {{echo|bar}}
11808 {{echo|baz}}
11809 !! html
11810 <p>Foo
11811 </p><p>bar
11812 baz
11813 </p>
11814 !!end
11815
11816 !!test
11817 Templates: P-wrapping: 1c. Templates on consecutive lines
11818 !! wikitext
11819 {{echo|Foo}}
11820 {{echo|bar}} <div>baz</div>
11821 !! html
11822 <p>Foo
11823 </p>
11824 bar <div>baz</div>
11825
11826 !! html+tidy
11827 <p>Foo</p>
11828 <p>bar</p>
11829 <div>baz</div>
11830 !! end
11831
11832 !!test
11833 Templates: P-wrapping: 1d. Template preceded by comment-only line
11834 !!options
11835 parsoid
11836 !! wikitext
11837 <!-- foo -->
11838 {{echo|Bar}}
11839 !! html
11840 <!-- foo -->
11841
11842 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11843 !!end
11844
11845 !!test
11846 Templates: Inline Text: 1. Multiple template uses
11847 !! wikitext
11848 {{echo|Foo}}bar{{echo|baz}}
11849 !! html
11850 <p>Foobarbaz
11851 </p>
11852 !!end
11853
11854 !!test
11855 Templates: Inline Text: 2. Back-to-back template uses
11856 !! wikitext
11857 {{echo|Foo}}{{echo|bar}}
11858 !! html
11859 <p>Foobar
11860 </p>
11861 !!end
11862
11863 !!test
11864 Templates: Block Tags: 1. Multiple template uses
11865 !! wikitext
11866 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11867 !! html
11868 <div>Foo</div><div>bar</div><div>baz</div>
11869
11870 !!end
11871
11872 !!test
11873 Templates: Block Tags: 2. Back-to-back template uses
11874 !! wikitext
11875 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11876 !! html
11877 <div>Foo</div><div>bar</div>
11878
11879 !!end
11880
11881 # This is an edge case relating to paragraph wrapping.
11882 !!test
11883 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11884 !! wikitext
11885 {{echo|a
11886 b</p>}}
11887 !! html/parsoid
11888 <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
11889 b</p>
11890 !!end
11891
11892 !!test
11893 Templates: Links: 1. Simple example
11894 !! wikitext
11895 {{echo|[[Foo|bar]]}}
11896 !! html
11897 <p><a href="/wiki/Foo" title="Foo">bar</a>
11898 </p>
11899 !!end
11900
11901 !!test
11902 Templates: Links: 2. Generation of link href
11903 !! wikitext
11904 [[{{echo|Foo}}|bar]]
11905 !! html
11906 <p><a href="/wiki/Foo" title="Foo">bar</a>
11907 </p>
11908 !!end
11909
11910 !!test
11911 Templates: Links: 3. Generation of part of a link href
11912 !! wikitext
11913 [[Fo{{echo|o}}|bar]]
11914
11915 [[Foo{{echo|bar}}]]
11916
11917 [[Foo{{echo|bar}}baz]]
11918
11919 [[Foo{{echo|bar}}|bar]]
11920
11921 [[:Foo{{echo|bar}}]]
11922
11923 [[:Foo{{echo|bar}}|bar]]
11924 !! html
11925 <p><a href="/wiki/Foo" title="Foo">bar</a>
11926 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11927 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11928 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11929 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11930 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11931 </p>
11932 !!end
11933
11934 !!test
11935 Templates: Links: 4. Multiple templates generating link href
11936 !! wikitext
11937 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11938 !! html
11939 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11940 </p>
11941 !!end
11942
11943 !!test
11944 Templates: Links: 5. Generation of link text
11945 !! wikitext
11946 [[Foo|{{echo|bar}}]]
11947 !! html
11948 <p><a href="/wiki/Foo" title="Foo">bar</a>
11949 </p>
11950 !!end
11951
11952 !!test
11953 Templates: Links: 5. Nested templates (only outermost template should be marked)
11954 !! wikitext
11955 {{echo|[[{{echo|Foo}}|bar]]}}
11956 !! html
11957 <p><a href="/wiki/Foo" title="Foo">bar</a>
11958 </p>
11959 !!end
11960
11961 !!test
11962 Templates: HTML Tag: 1. Generation of HTML attr. key
11963 !! wikitext
11964 <div {{echo|style}}="color:red;">foo</div>
11965 !! html
11966 <div style="color:red;">foo</div>
11967
11968 !!end
11969
11970 !!test
11971 Templates: HTML Tag: 2. Generation of HTML attr. value
11972 !! wikitext
11973 <div style={{echo|'color:red;'}}>foo</div>
11974 !! html
11975 <div style="color:red;">foo</div>
11976
11977 !!end
11978
11979 !!test
11980 Templates: HTML Tag: 3. Generation of HTML attr key and value
11981 !! wikitext
11982 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11983 !! html
11984 <div style="color:red;">foo</div>
11985
11986 !!end
11987
11988 !!test
11989 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11990 !! wikitext
11991 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11992 !! html
11993 <div title="This is a long title with just one piece templated">foo</div>
11994
11995 !!end
11996
11997 !!test
11998 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11999 !! wikitext
12000 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12001 !! html
12002 <div title="This is a long title with just one piece templated">foo</div>
12003
12004 !!end
12005
12006 !!test
12007 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12008 !! wikitext
12009 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12010 !! html
12011 <div title="This is a long title with just one piece templated">foo</div>
12012
12013 !!end
12014
12015 # SSS FIXME: While it is great we added support for all this,
12016 # do we want to make this part of the spec? Maybe we want to
12017 # deprecate this kind of usage in the future?
12018 !!test
12019 Templates: HTML Tag: 7. Generation of partial attribute key string
12020 !! wikitext
12021 <div st{{echo|yle}}="color:red;">foo</div>
12022 !! html
12023 <div style="color:red;">foo</div>
12024
12025 !!end
12026
12027 !! test
12028 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12029 !! wikitext
12030 <div {{echo|1=id="v1"}}>bar</div>
12031 !! html
12032 <div id="v1">bar</div>
12033
12034 !!end
12035
12036 !! test
12037 Templates: HTML Tag: 9. Multiple template-generated attributes
12038 !! wikitext
12039 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12040 !! html
12041 <div id="v1" title="foo">bar</div>
12042
12043 !!end
12044
12045 !! test
12046 Templates: Support for templates generating attributes and content
12047 !! wikitext
12048 {| {{mixed_attr_content_template}}
12049 |-
12050 |bar
12051 |}
12052 !! html/php
12053 <table style="color:red;" title="T48811">
12054
12055 <tr>
12056 <td>foo
12057 </td></tr>
12058 <tr>
12059 <td>bar
12060 </td></tr></table>
12061
12062 !! html/parsoid
12063 <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|}"]}'>
12064 <tbody><tr>
12065 <td>foo</td></tr>
12066 <tr>
12067 <td>bar</td></tr>
12068 </tbody></table>
12069 !!end
12070
12071 !! test
12072 1. Entities and nowikis inside templated attributes should be handled correctly
12073 !! wikitext
12074 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12075 !! html/php
12076 <div style="background:#f9f9f9;">foo</div>
12077
12078 !! html/parsoid
12079 <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>
12080 !! end
12081
12082 !! test
12083 2. Entities and nowikis inside templated attributes should be handled correctly
12084 !! wikitext
12085 {|
12086 |{{table_attribs_3}}
12087 |}
12088 !! html/php
12089 <table>
12090 <tr>
12091 <td style="background:#f9f9f9;">Foo
12092 </td></tr></table>
12093
12094 !! html/parsoid
12095 <table>
12096 <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>
12097 </tbody></table>
12098 !! end
12099
12100 !! test
12101 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12102 !! wikitext
12103 {{tbl-start}}
12104 |{{table_attribs_3}}
12105 {{tbl-end}}
12106 !! html/php
12107 <table>
12108 <tr>
12109 <td style="background:#f9f9f9;">Foo
12110 </td></tr></table>
12111
12112 !! html/parsoid
12113 <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}}]}'>
12114 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12115 </tbody></table>
12116 !! end
12117
12118 # T107622
12119 !! test
12120 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12121 !! wikitext
12122 {|
12123 | {{table_attribs_6}} hi
12124 |}
12125 !! html/php
12126 <table>
12127 <tr>
12128 <td style="background: red;"> hi
12129 </td></tr></table>
12130
12131 !! html/parsoid
12132 <table>
12133 <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>
12134 </tbody></table>
12135 !! end
12136
12137 !!test
12138 Templates: HTML Tables: 1. Generating start of a HTML table
12139 !! wikitext
12140 {{echo|<table><tr><td>foo</td>}}</tr></table>
12141 !! html
12142 <table><tr><td>foo</td></tr></table>
12143
12144 !!end
12145
12146 !!test
12147 Templates: HTML Tables: 2a. Generating middle of a HTML table
12148 !! wikitext
12149 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12150 !! html
12151 <table><tr><td>foo</td></tr></table>
12152
12153 !!end
12154
12155 !!test
12156 Templates: HTML Tables: 2b. Generating middle of a HTML table
12157 !! wikitext
12158 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12159 !! html
12160 <table><tr><td>foo</td></tr></table>
12161
12162 !!end
12163
12164 !!test
12165 Templates: HTML Tables: 3. Generating end of a HTML table
12166 !! wikitext
12167 <table><tr>{{echo|<td>foo</td></tr></table>}}
12168 !! html
12169 <table><tr><td>foo</td></tr></table>
12170
12171 !!end
12172
12173 !!test
12174 Templates: HTML Tables: 4a. Generating a single tag 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: 4b. Generating a single tag of a HTML table
12184 !! wikitext
12185 <table>{{echo|<tr>}}<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: 4c. Generating a single tag of a HTML table
12193 !! wikitext
12194 <table><tr>{{echo|<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: 4d. Generating a single tag of a HTML table
12202 !! wikitext
12203 <table><tr><td>foo{{echo|</td>}}</tr></table>
12204 !! html
12205 <table><tr><td>foo</td></tr></table>
12206
12207 !!end
12208
12209 !!test
12210 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12211 !! wikitext
12212 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12213 !! html
12214 <table><tr><td>foo</td></tr></table>
12215
12216 !!end
12217
12218 !!test
12219 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12220 !! wikitext
12221 <table><tr><td>foo</td></tr>{{echo|</table>}}
12222 !! html
12223 <table><tr><td>foo</td></tr></table>
12224
12225 !!end
12226
12227 !!test
12228 Templates: HTML Tables: 5. Proper fostering of categories from inside
12229 !!options
12230 parsoid=wt2html,wt2wt
12231 !! wikitext
12232 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12233 <!--Two categories (Bug 50330)-->
12234 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12235 !! html
12236 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12237 <!--Two categories (Bug 50330)-->
12238 <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>
12239 !!end
12240
12241 !!test
12242 Templates: Wiki Tables: 1a. Fostering of entire template content
12243 !! wikitext
12244 {|
12245 {{echo|a}}
12246 |}
12247 !! html
12248 <table>
12249 a
12250 <tr><td></td></tr></table>
12251
12252 !! html+tidy
12253 <p>a</p>
12254 <table>
12255 <tr>
12256 <td></td>
12257 </tr>
12258 </table>
12259 !! end
12260
12261 !!test
12262 Templates: Wiki Tables: 1b. Fostering of entire template content
12263 !! wikitext
12264 {|
12265 {{echo|<div>}}
12266 foo
12267 {{echo|</div>}}
12268 |}
12269 !! html
12270 <table>
12271 <div>
12272 <p>foo
12273 </p>
12274 </div>
12275 <tr><td></td></tr></table>
12276
12277 !! html+tidy
12278 <div>
12279 <p>foo</p>
12280 </div>
12281 <table>
12282 <tr>
12283 <td></td>
12284 </tr>
12285 </table>
12286 !! end
12287
12288 !!test
12289 Templates: Wiki Tables: 2. Fostering of partial template content
12290 !! wikitext
12291 {|
12292 {{echo|a
12293 <div>b</div>}}
12294 |}
12295 !! html
12296 <table>
12297 a
12298 <div>b</div>
12299 <tr><td></td></tr></table>
12300
12301 !! html+tidy
12302 <p>a</p>
12303 <div>b</div>
12304 <table>
12305 <tr>
12306 <td></td>
12307 </tr>
12308 </table>
12309 !! end
12310
12311 !!test
12312 Templates: Wiki Tables: 3. td-content via multiple templates
12313 !! wikitext
12314 {|
12315 {{echo|{{pipe}}a}}{{echo|b}}
12316 |}
12317 !! html
12318 <table>
12319 <tr>
12320 <td>ab
12321 </td></tr></table>
12322
12323 !!end
12324
12325 !!test
12326 Templates: Wiki Tables: 4. Templated tags, no content
12327 !! wikitext
12328 {{tbl-start}}
12329 {{tbl-end}}
12330 !! html
12331 <table>
12332 <tr><td></td></tr></table>
12333
12334 !!end
12335
12336 !!test
12337 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12338 !! wikitext
12339 {{tbl-start}}
12340 |foo
12341 {{tbl-end}}
12342 !! html
12343 <table>
12344 <tr>
12345 <td>foo
12346 </td></tr></table>
12347
12348 !!end
12349
12350 !!test
12351 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12352 !! wikitext
12353 {{tbl-start}}
12354 {{!}}foo
12355 {{tbl-end}}
12356 !! html
12357 <table>
12358 <tr>
12359 <td>foo
12360 </td></tr></table>
12361
12362 !!end
12363
12364 ## This test case is very specific to Parsoid's internals
12365 ## and is hence only tested for Parsoid's code. Parsoid uses
12366 ## a <meta> marker tag for <ref> tags and they are expanded
12367 ## much later. We are verifying that this <meta> tag usage
12368 ## doesn't prevent foster parenting.
12369 !!test
12370 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12371 !!wikitext
12372 {{PartialTable}}<ref>foo</ref>
12373 |}
12374
12375 <references />
12376 !!html/parsoid
12377 <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">
12378 <tbody>
12379 </tbody></table>
12380
12381 <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>
12382 !!end
12383
12384 !! test
12385 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12386 !! wikitext
12387 {{echo|
12388 {{{!}}
12389 {{!}}-}}
12390 <onlyinclude>
12391 |foo
12392 </onlyinclude>
12393 {{!}}}
12394 !! html/parsoid
12395 <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{{!}}}"]}'>
12396 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12397 <tbody><tr>
12398
12399 <td>foo
12400 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12401 </tbody></table>
12402 !! end
12403
12404 !!test
12405 Templates: Lists: Multi-line list-items via templates
12406 !! wikitext
12407 *{{echo|a {{nonexistent|
12408 unused}}}}
12409 *{{echo|b {{nonexistent|
12410 unused}}}}
12411 !! html
12412 <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>
12413 <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>
12414
12415 !!end
12416
12417 !!test
12418 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12419 !! wikitext
12420 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12421 !! html
12422 <p><i>ab</i>c<i>d</i>e
12423 </p>
12424 !!end
12425
12426 !!test
12427 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12428 (PHP parser generates misnested html)
12429 !! wikitext
12430 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12431 !! html/parsoid
12432 <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>
12433 !!end
12434
12435 !!test
12436 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12437 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12438 !! options
12439 parsoid=wt2html,wt2wt
12440 !! wikitext
12441 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12442 !! html
12443 <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>
12444 <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>
12445 <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>
12446 !!end
12447
12448 !!test
12449 Templates: Ugly nesting: 4. Divs opened/closed across templates
12450 !! wikitext
12451 a<div>b{{echo|c</div>d}}e
12452 !! html
12453 a<div>bc</div>de
12454
12455 !! html+tidy
12456 <p>a</p>
12457 <div>bc</div>
12458 <p>de</p>
12459 !! end
12460
12461 !!test
12462 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12463 (Parsoid-centric)
12464 !! options
12465 parsoid
12466 !! wikitext
12467 {|
12468 |{{echo|foo</table>}}
12469 |bar
12470 |}
12471 !! html
12472 <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|}"]}'>
12473
12474 <tbody>
12475 <tr>
12476 <td>foo</td></tr></tbody></table><span about="#mwt1">
12477 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12478 |}</span>
12479 !!end
12480
12481 !!test
12482 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12483 (Parsoid-centric)
12484 !! options
12485 parsoid
12486 !! wikitext
12487 <table>
12488 <tr>
12489 <td>
12490 <table>
12491 <tr>
12492 <td>1. {{echo|foo </table>}}</td>
12493 <td> bar </td>
12494 <td>2. {{echo|baz </table>}}</td>
12495 </tr>
12496 <tr>
12497 <td>abc</td>
12498 </tr>
12499 </table>
12500 </td>
12501 </tr>
12502 <tr>
12503 <td>xyz</td>
12504 </tr>
12505 </table>
12506 !! html
12507 <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>"]}'>
12508 <tbody><tr>
12509 <td>
12510 <table>
12511 <tbody><tr>
12512 <td>1. foo </td></tr></tbody></table></td>
12513 <td> bar </td>
12514 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12515 </span><span about="#mwt2">
12516 </span><span about="#mwt2">
12517 </span><span about="#mwt2">abc</span><span about="#mwt2">
12518 </span><span about="#mwt2">
12519 </span><span about="#mwt2">
12520 </span><span about="#mwt2">
12521 </span><span about="#mwt2">
12522 </span><span about="#mwt2">
12523 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12524 </span><span about="#mwt2">
12525 </span>
12526 !!end
12527
12528 !! test
12529 Templates: Ugly templates: 3. newline-only template parameter
12530 !! wikitext
12531 foo {{echo|
12532 }}
12533 !! html
12534 <p>foo
12535 </p>
12536 !! end
12537
12538 # This looks like a bug: a single newline triggers p/br for some reason.
12539 !! test
12540 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12541 !! wikitext
12542 {{echo|
12543 }}
12544 !! html
12545 <p><br />
12546 </p>
12547 !! end
12548
12549 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12550 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12551 !! test
12552 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12553 !! wikitext
12554 {{echo|<table>}}
12555 {{echo|<div>foo}}
12556 {{echo|</table>}}
12557 !! html/parsoid
12558 <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
12559 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12560 </table>
12561 !! end
12562
12563 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12564 # that are "identical" and generate nesting cycles in the algorithm
12565 !! test
12566 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12567 !! wikitext
12568 {{echo|<table><tr><td><table>}}
12569 {{echo|<div>}}
12570 {{echo|</div>}}
12571 !! html/parsoid
12572 <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"}'>
12573 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12574 </table></td></tr></tbody></table>
12575 !! end
12576
12577 !! test
12578 Templates: Parameters substituted at the top-level
12579 !! wikitext
12580 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12581
12582 {{{foo|bar|baz}}}
12583 !! html/php
12584 <p><i>who</i> me? <b>never!</b>
12585 </p><p>bar
12586 </p>
12587 !! html/parsoid
12588 <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>
12589
12590 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
12591 !! end
12592
12593 !!test
12594 Parser Functions: 1. Simple example
12595 !! wikitext
12596 {{uc:foo}}
12597 !! html
12598 <p>FOO
12599 </p>
12600 !!end
12601
12602 !!test
12603 Parser Functions: 2. Nested use (only outermost should be marked up)
12604 !! wikitext
12605 {{uc:{{lc:FOO}}}}
12606 !! html
12607 <p>FOO
12608 </p>
12609 !!end
12610
12611 ###
12612 ### Pre-save transform tests
12613 ###
12614 !! test
12615 pre-save transform: subst:
12616 !! options
12617 pst
12618 !! wikitext
12619 {{subst:test}}
12620 !! html/php
12621 This is a test template
12622 !! end
12623
12624 !! test
12625 pre-save transform: normal template
12626 !! options
12627 pst
12628 !! wikitext
12629 {{test}}
12630 !! html/php
12631 {{test}}
12632 !! end
12633
12634 !! test
12635 pre-save transform: nonexistent template
12636 !! options
12637 pst
12638 !! wikitext
12639 {{thistemplatedoesnotexist}}
12640 !! html/php
12641 {{thistemplatedoesnotexist}}
12642 !! end
12643
12644 !! test
12645 pre-save transform: subst magic variables
12646 !! options
12647 pst
12648 !! wikitext
12649 {{subst:SITENAME}}
12650 !! html/php
12651 MediaWiki
12652 !! end
12653
12654 # This is bug 89, which I fixed. -- wtm
12655 !! test
12656 pre-save transform: subst: templates with parameters
12657 !! options
12658 pst
12659 !! wikitext
12660 {{subst:paramtest|param="something else"}}
12661 !! html/php
12662 This is a test template with parameter "something else"
12663 !! end
12664
12665 !! article
12666 Template:nowikitest
12667 !! text
12668 <nowiki>'''not wiki'''</nowiki>
12669 !! endarticle
12670
12671 !! test
12672 pre-save transform: nowiki in subst (bug 1188)
12673 !! options
12674 pst
12675 !! wikitext
12676 {{subst:nowikitest}}
12677 !! html/php
12678 <nowiki>'''not wiki'''</nowiki>
12679 !! end
12680
12681 !! article
12682 Template:commenttest
12683 !! text
12684 This template has <!-- a comment --> in it.
12685 !! endarticle
12686
12687 !! test
12688 pre-save transform: comment in subst (bug 1936)
12689 !! options
12690 pst
12691 !! wikitext
12692 {{subst:commenttest}}
12693 !! html/php
12694 This template has <!-- a comment --> in it.
12695 !! end
12696
12697 !! test
12698 pre-save transform: unclosed tag
12699 !! options
12700 pst
12701 !! wikitext
12702 <nowiki>'''not wiki'''
12703 !! html/php
12704 <nowiki>'''not wiki'''
12705 !! end
12706
12707 !! test
12708 pre-save transform: mixed tag case
12709 !! options
12710 pst
12711 !! wikitext
12712 <NOwiki>'''not wiki'''</noWIKI>
12713 !! html/php
12714 <NOwiki>'''not wiki'''</noWIKI>
12715 !! end
12716
12717 !! test
12718 pre-save transform: unclosed comment in <nowiki>
12719 !! options
12720 pst
12721 !! wikitext
12722 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12723 !! html/php
12724 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12725 !!end
12726
12727 # Leading @ in this template definition works around a limitation
12728 # in parsoid's parserTests which otherwise strips the <span> from the
12729 # result (confusing it for a template wrapper)
12730 !! article
12731 Template:dangerous
12732 !!text
12733 @<span onmouseover="alert('crap')">Oh no</span>
12734 !!endarticle
12735
12736 !!test
12737 (confirming safety of fix for subst bug 1936)
12738 !! wikitext
12739 {{Template:dangerous}}
12740 !! html
12741 <p>@<span>Oh no</span>
12742 </p>
12743 !! end
12744
12745 !! test
12746 pre-save transform: comment containing gallery (bug 5024)
12747 !! options
12748 pst
12749 !! wikitext
12750 <!-- <gallery>data</gallery> -->
12751 !! html/php
12752 <!-- <gallery>data</gallery> -->
12753 !!end
12754
12755 !! test
12756 pre-save transform: comment containing extension
12757 !! options
12758 pst
12759 !! wikitext
12760 <!-- <tag>data</tag> -->
12761 !! html/php
12762 <!-- <tag>data</tag> -->
12763 !!end
12764
12765 !! test
12766 pre-save transform: comment containing nowiki
12767 !! options
12768 pst
12769 !! wikitext
12770 <!-- <nowiki>data</nowiki> -->
12771 !! html/php
12772 <!-- <nowiki>data</nowiki> -->
12773 !!end
12774
12775 !! test
12776 pre-save transform: <noinclude> in subst (bug 3298)
12777 !! options
12778 pst
12779 !! wikitext
12780 {{subst:Includes}}
12781 !! html/php
12782 Foobar
12783 !! end
12784
12785 !! test
12786 pre-save transform: <onlyinclude> in subst (bug 3298)
12787 !! options
12788 pst
12789 !! wikitext
12790 {{subst:Includes2}}
12791 !! html/php
12792 Foo
12793 !! end
12794
12795 !! article
12796 Template:SubstTest
12797 !!text
12798 {{<includeonly>subst:</includeonly>Includes}}
12799 !! endarticle
12800
12801 !! article
12802 Template:SafeSubstTest
12803 !! text
12804 {{<includeonly>safesubst:</includeonly>Includes}}
12805 !! endarticle
12806
12807 !! test
12808 bug 22297: safesubst: works during PST
12809 !! options
12810 pst
12811 !! wikitext
12812 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12813 !! html/php
12814 FoobarFoobar
12815 !! end
12816
12817 !! test
12818 bug 22297: safesubst: works during normal parse
12819 !! wikitext
12820 {{SafeSubstTest}}
12821 !! html
12822 <p>Foobar
12823 </p>
12824 !! end
12825
12826 !! test
12827 subst: does not work during normal parse
12828 !! wikitext
12829 {{SubstTest}}
12830 !! html
12831 <p>{{subst:Includes}}
12832 </p>
12833 !! end
12834
12835 !! test
12836 pre-save transform: context links ("pipe trick")
12837 !! options
12838 pst
12839 !! wikitext
12840 [[Article (context)|]]
12841 [[Bar:Article|]]
12842 [[:Bar:Article|]]
12843 [[Bar:Article (context)|]]
12844 [[:Bar:Article (context)|]]
12845 [[|Article]]
12846 [[|Article (context)]]
12847 [[Bar:X (Y) Z|]]
12848 [[:Bar:X (Y) Z|]]
12849 !! html/php
12850 [[Article (context)|Article]]
12851 [[Bar:Article|Article]]
12852 [[:Bar:Article|Article]]
12853 [[Bar:Article (context)|Article]]
12854 [[:Bar:Article (context)|Article]]
12855 [[Article]]
12856 [[Article (context)]]
12857 [[Bar:X (Y) Z|X (Y) Z]]
12858 [[:Bar:X (Y) Z|X (Y) Z]]
12859 !! end
12860
12861 !! test
12862 pre-save transform: context links ("pipe trick") with interwiki prefix
12863 !! options
12864 pst
12865 !! wikitext
12866 [[interwiki:Article|]]
12867 [[:interwiki:Article|]]
12868 [[interwiki:Bar:Article|]]
12869 [[:interwiki:Bar:Article|]]
12870 !! html/php
12871 [[interwiki:Article|Article]]
12872 [[:interwiki:Article|Article]]
12873 [[interwiki:Bar:Article|Bar:Article]]
12874 [[:interwiki:Bar:Article|Bar:Article]]
12875 !! end
12876
12877 !! test
12878 pre-save transform: context links ("pipe trick") with parens in title
12879 !! options
12880 pst title=[[Somearticle (context)]]
12881 !! wikitext
12882 [[|Article]]
12883 !! html/php
12884 [[Article (context)|Article]]
12885 !! end
12886
12887 !! test
12888 pre-save transform: context links ("pipe trick") with comma in title
12889 !! options
12890 pst title=[[Someplace, Somewhere]]
12891 !! wikitext
12892 [[|Otherplace]]
12893 [[Otherplace, Elsewhere|]]
12894 [[Otherplace, Elsewhere, Anywhere|]]
12895 !! html/php
12896 [[Otherplace, Somewhere|Otherplace]]
12897 [[Otherplace, Elsewhere|Otherplace]]
12898 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12899 !! end
12900
12901 !! test
12902 pre-save transform: context links ("pipe trick") with parens and comma
12903 !! options
12904 pst title=[[Someplace (IGNORED), Somewhere]]
12905 !! wikitext
12906 [[|Otherplace]]
12907 [[Otherplace (place), Elsewhere|]]
12908 !! html/php
12909 [[Otherplace, Somewhere|Otherplace]]
12910 [[Otherplace (place), Elsewhere|Otherplace]]
12911 !! end
12912
12913 !! test
12914 pre-save transform: context links ("pipe trick") with comma and parens
12915 !! options
12916 pst title=[[Who, me? (context)]]
12917 !! wikitext
12918 [[|Yes, you.]]
12919 [[Me, Myself, and I (1937 song)|]]
12920 !! html/php
12921 [[Yes, you. (context)|Yes, you.]]
12922 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12923 !! end
12924
12925 !! test
12926 pre-save transform: context links ("pipe trick") with namespace
12927 !! options
12928 pst title=[[Ns:Somearticle]]
12929 !! wikitext
12930 [[|Article]]
12931 !! html/php
12932 [[Ns:Article|Article]]
12933 !! end
12934
12935 !! test
12936 pre-save transform: context links ("pipe trick") with namespace and parens
12937 !! options
12938 pst title=[[Ns:Somearticle (context)]]
12939 !! wikitext
12940 [[|Article]]
12941 !! html/php
12942 [[Ns:Article (context)|Article]]
12943 !! end
12944
12945 !! test
12946 pre-save transform: context links ("pipe trick") with namespace and comma
12947 !! options
12948 pst title=[[Ns:Somearticle, Context, Whatever]]
12949 !! wikitext
12950 [[|Article]]
12951 !! html/php
12952 [[Ns:Article, Context, Whatever|Article]]
12953 !! end
12954
12955 !! test
12956 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12957 !! options
12958 pst title=[[Ns:Somearticle, Context (context)]]
12959 !! wikitext
12960 [[|Article]]
12961 !! html/php
12962 [[Ns:Article (context)|Article]]
12963 !! end
12964
12965 !! test
12966 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12967 !! options
12968 pst title=[[Ns:Somearticle (IGNORED), Context]]
12969 !! wikitext
12970 [[|Article]]
12971 !! html/php
12972 [[Ns:Article, Context|Article]]
12973 !! end
12974
12975 !! test
12976 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12977 !! options
12978 pst
12979 !! wikitext
12980 [[Article(context)|]]
12981 [[Bar:Article(context)|]]
12982 [[:Bar:Article(context)|]]
12983 [[|Article(context)]]
12984 [[Bar:X(Y)Z|]]
12985 [[:Bar:X(Y)Z|]]
12986 !! html/php
12987 [[Article(context)|Article]]
12988 [[Bar:Article(context)|Article]]
12989 [[:Bar:Article(context)|Article]]
12990 [[Article(context)]]
12991 [[Bar:X(Y)Z|X(Y)Z]]
12992 [[:Bar:X(Y)Z|X(Y)Z]]
12993 !! end
12994
12995 !! test
12996 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12997 !! options
12998 pst
12999 !! wikitext
13000 [[Article (context)|]]
13001 [[Bar:Article (context)|]]
13002 [[:Bar:Article (context)|]]
13003 [[|Article (context)]]
13004 [[Bar:X (Y) Z|]]
13005 [[:Bar:X (Y) Z|]]
13006 !! html/php
13007 [[Article (context)|Article]]
13008 [[Bar:Article (context)|Article]]
13009 [[:Bar:Article (context)|Article]]
13010 [[Article (context)]]
13011 [[Bar:X (Y) Z|X (Y) Z]]
13012 [[:Bar:X (Y) Z|X (Y) Z]]
13013 !! end
13014
13015 !! test
13016 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
13017 !! options
13018 pst
13019 !! wikitext
13020 [[Article(context)|]]
13021 [[Bar:Article(context)|]]
13022 [[:Bar:Article(context)|]]
13023 [[|Article(context)]]
13024 [[Bar:X(Y)Z|]]
13025 [[:Bar:X(Y)Z|]]
13026 !! html/php
13027 [[Article(context)|Article]]
13028 [[Bar:Article(context)|Article]]
13029 [[:Bar:Article(context)|Article]]
13030 [[Article(context)]]
13031 [[Bar:X(Y)Z|X(Y)Z]]
13032 [[:Bar:X(Y)Z|X(Y)Z]]
13033 !! end
13034
13035 !! test
13036 pre-save transform: context links ("pipe trick") with commas (bug 21660)
13037 !! options
13038 pst
13039 !! wikitext
13040 [[Article (context), context|]]
13041 [[Article (context),context|]]
13042 [[Bar:Article (context), context|]]
13043 [[Bar:Article (context),context|]]
13044 [[:Bar:Article (context), context|]]
13045 [[:Bar:Article (context),context|]]
13046 !! html/php
13047 [[Article (context), context|Article]]
13048 [[Article (context),context|Article]]
13049 [[Bar:Article (context), context|Article]]
13050 [[Bar:Article (context),context|Article]]
13051 [[:Bar:Article (context), context|Article]]
13052 [[:Bar:Article (context),context|Article]]
13053 !! end
13054
13055 !! test
13056 pre-save transform: trim trailing empty lines
13057 !! options
13058 pst
13059 !! wikitext
13060 Empty lines are trimmed
13061
13062
13063
13064
13065 !! html/php
13066 Empty lines are trimmed
13067 !! end
13068
13069 !! test
13070 pre-save transform: Signature expansion
13071 !! options
13072 pst
13073 !! wikitext
13074 * ~~~
13075 * <noinclude>~~~</noinclude>
13076 * <includeonly>~~~</includeonly>
13077 * <onlyinclude>~~~</onlyinclude>
13078 !! html/php
13079 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13080 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13081 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13082 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13083 !! end
13084
13085
13086 !! test
13087 pre-save transform: Signature expansion in nowiki tags (bug 93)
13088 !! options
13089 pst disabled
13090 !! wikitext
13091 Shall not expand:
13092
13093 <nowiki>~~~~</nowiki>
13094
13095 <includeonly><nowiki>~~~~</nowiki></includeonly>
13096
13097 <noinclude><nowiki>~~~~</nowiki></noinclude>
13098
13099 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13100
13101 {{subst:Foo}} shall be converted to FOO
13102
13103 As well as inside noinclude/onlyinclude
13104 <noinclude>{{subst:Foo}}</noinclude>
13105 <onlyinclude>{{subst:Foo}}</onlyinclude>
13106
13107 But not inside includeonly
13108 <includeonly>{{subst:Foo}}</includeonly>
13109 !! html/php
13110 Shall not expand:
13111
13112 <nowiki>~~~~</nowiki>
13113
13114 <includeonly><nowiki>~~~~</nowiki></includeonly>
13115
13116 <noinclude><nowiki>~~~~</nowiki></noinclude>
13117
13118 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13119
13120 FOO shall be converted to FOO
13121
13122 As well as inside noinclude/onlyinclude
13123 <noinclude>FOO</noinclude>
13124 <onlyinclude>FOO</onlyinclude>
13125
13126 But not inside includeonly
13127 <includeonly>{{subst:Foo}}</includeonly>
13128 !! end
13129
13130 !! test
13131 Parsoid: Recognize nowiki with trailing space in tags
13132 !! options
13133 parsoid=wt2html
13134 !! wikitext
13135 <nowiki ><div>[[foo]]</nowiki >
13136
13137 a<nowiki / >b
13138
13139 c<nowiki />d
13140
13141 e<nowiki/ >f
13142 !! html
13143 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13144 <p>ab</p>
13145 <p>cd</p>
13146 <p>ef</p>
13147 !! end
13148
13149 !! test
13150 Parsoid: Recognize nowiki with odd capitalization
13151 !! options
13152 parsoid=wt2html
13153 !! wikitext
13154 <noWikI ><div>[[foo]]</Nowiki >
13155 !! html
13156 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13157 !! end
13158
13159
13160 !! test
13161 Parsoid: Escape nowiki with trailing space in tags
13162 !! options
13163 parsoid=html2wt
13164 !! html/parsoid
13165 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13166 <p>a&lt;nowiki /&gt;b</p>
13167 <p>c&lt;nowiki/ &gt;d</p>
13168 !! wikitext
13169 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13170
13171 a&lt;nowiki /&gt;b
13172
13173 c&lt;nowiki/ &gt;d
13174 !! end
13175
13176 !! test
13177 Parsoid: Escape weird noWikI capitalizations
13178 !! options
13179 parsoid=html2wt
13180 !! html/parsoid
13181 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13182 !! wikitext
13183 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13184 !! end
13185
13186 ###
13187 ### Message transform tests
13188 ###
13189 !! test
13190 message transform: magic variables
13191 !! options
13192 msg
13193 !! wikitext
13194 {{SITENAME}}
13195 !! html
13196 MediaWiki
13197 !! end
13198
13199 !! test
13200 message transform: should not transform wiki markup
13201 !! options
13202 msg
13203 !! wikitext
13204 ''test''
13205 !! html
13206 ''test''
13207 !! end
13208
13209 !! test
13210 message transform: <noinclude> in transcluded template (bug 4926)
13211 !! options
13212 msg
13213 !! wikitext
13214 {{Includes}}
13215 !! html
13216 Foobar
13217 !! end
13218
13219 !! test
13220 message transform: <onlyinclude> in transcluded template (bug 4926)
13221 !! options
13222 msg
13223 !! wikitext
13224 {{Includes2}}
13225 !! html
13226 Foo
13227 !! end
13228
13229 !! test
13230 {{#special:}} page name, known
13231 !! options
13232 msg
13233 !! wikitext
13234 {{#special:Recentchanges}}
13235 !! html
13236 Special:RecentChanges
13237 !! end
13238
13239 !! test
13240 {{#special:}} page name with subpage, known
13241 !! options
13242 msg
13243 !! wikitext
13244 {{#special:Recentchanges/param}}
13245 !! html
13246 Special:RecentChanges/param
13247 !! end
13248
13249 !! test
13250 {{#special:}} page name, unknown
13251 !! options
13252 msg
13253 !! wikitext
13254 {{#special:foobar nonexistent}}
13255 !! html
13256 Special:Foobar nonexistent
13257 !! end
13258
13259 !! test
13260 {{#speciale:}} page name, known
13261 !! options
13262 msg
13263 !! wikitext
13264 {{#speciale:Recentchanges}}
13265 !! html
13266 Special:RecentChanges
13267 !! end
13268
13269 !! test
13270 {{#speciale:}} page name with subpage, known
13271 !! options
13272 msg
13273 !! wikitext
13274 {{#speciale:Recentchanges/param}}
13275 !! html
13276 Special:RecentChanges/param
13277 !! end
13278
13279 !! test
13280 {{#speciale:}} page name, unknown
13281 !! options
13282 msg
13283 !! wikitext
13284 {{#speciale:foobar nonexistent}}
13285 !! html
13286 Special:Foobar_nonexistent
13287 !! end
13288
13289 ###
13290 ### Images
13291 ###
13292 ### For Parsoid-specific tests, see
13293 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13294
13295 !! test
13296 Simple image
13297 !! options
13298 parsoid=wt2html,wt2wt,html2html
13299 !! wikitext
13300 [[Image:foobar.jpg]]
13301 !! html/php
13302 <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>
13303 </p>
13304 !! html/parsoid
13305 <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>
13306 !! end
13307
13308 !! test
13309 Simple image (using File: namespace, now canonical)
13310 !! wikitext
13311 [[File:Foobar.jpg]]
13312 !! html/php
13313 <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>
13314 </p>
13315 !! html/parsoid
13316 <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>
13317 !! end
13318
13319 !! test
13320 Right-aligned image
13321 !! wikitext
13322 [[File:Foobar.jpg|right]]
13323 !! html/php
13324 <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>
13325
13326 !! html/parsoid
13327 <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>
13328 !! end
13329
13330 !! test
13331 Image with caption
13332 !! wikitext
13333 [[File:Foobar.jpg|right|Caption text]]
13334 !! html/php
13335 <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>
13336
13337 !! html/parsoid
13338 <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>
13339 !! end
13340
13341 !! test
13342 Image with caption, bug 53312 #1
13343 !! wikitext
13344 [[File:Foobar.jpg|right|Caption page stuff]]
13345 !! html/php
13346 <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>
13347
13348 !! html/parsoid
13349 <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>
13350 !! end
13351
13352 !! test
13353 Image with caption, bug 53312 #2
13354 !! wikitext
13355 [[File:Foobar.jpg|right|Caption page=]]
13356 !! html/php
13357 <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>
13358
13359 !! html/parsoid
13360 <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>
13361 !! end
13362
13363 !! test
13364 Image with caption, bug 53312 #3
13365 !! wikitext
13366 [[File:Foobar.jpg|right|Caption page=stuff]]
13367 !! html/php
13368 <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>
13369
13370 !! html/parsoid
13371 <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>
13372 !! end
13373
13374 !! test
13375 Allow empty links in image captions (Bug 60753)
13376 !! options
13377 thumbsize=220
13378 !! wikitext
13379 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13380 [[]]
13381 [[Link2]]
13382 ]]
13383 !! html/php
13384 <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>
13385
13386 !! html/parsoid
13387 <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>
13388 [[]]
13389 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13390 </figcaption></figure>
13391 !! end
13392
13393 !! test
13394 Titles in unlinked images (T23454)
13395 !! wikitext
13396 [[File:Foobar.jpg|link=|stuff]]
13397 !! html/php
13398 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13399 </p>
13400 !! end
13401
13402 !! test
13403 Link with empty target
13404 !! wikitext
13405 [[]]
13406 !! html
13407 <p>[[]]
13408 </p>
13409 !! end
13410
13411 !! test
13412 Image with link trail
13413 !! wikitext
13414 Linktrails should not work for images: [[File:Foobar.jpg]]s
13415 !! html/php
13416 <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
13417 </p>
13418 !! html/parsoid
13419 <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>
13420 !! end
13421
13422 !! test
13423 Image with empty attribute
13424 !! options
13425 parsoid=wt2html,wt2wt,html2html
13426 !! wikitext
13427 [[File:Foobar.jpg|right||Caption text]]
13428 !! html/php
13429 <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>
13430
13431 !! html/parsoid
13432 <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>
13433 !! end
13434
13435 !! test
13436 1. Block image with individual attributes from templates
13437 !! wikitext
13438 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13439 !! html/php
13440 <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>
13441
13442 !! html/parsoid
13443 <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>
13444 !! end
13445
13446 !! test
13447 2. Block Image with individual attributes from templates
13448 !! wikitext
13449 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13450 !! html/php
13451 <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>
13452
13453 !! html/parsoid
13454 <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>
13455 !! end
13456
13457 !! test
13458 3. Inline image with individual attributes from templates
13459 !! wikitext
13460 [[File:Foobar.jpg|{{echo|50px}}]]
13461 !! html/php
13462 <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>
13463 </p>
13464 !! html/parsoid
13465 <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>
13466 !! end
13467
13468 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13469 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13470 !! test
13471 Image with multiple attributes from the same template
13472 !! wikitext
13473 [[File:Foobar.jpg|{{image_attribs}}]]
13474 !! html/php
13475 <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>
13476
13477 !! html/parsoid
13478 <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>
13479 !! end
13480
13481 !! test
13482 Image with link tails
13483 !! options
13484 thumbsize=220
13485 !! wikitext
13486 123[[File:Foobar.jpg]]456
13487 123[[File:Foobar.jpg|right]]456
13488 123[[File:Foobar.jpg|thumb]]456
13489 !! html/php
13490 <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
13491 </p>
13492 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
13493 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
13494
13495 !! html/php+tidy
13496 <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>
13497 <p>123</p>
13498 <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>
13499 <p>456 123</p>
13500 <div class="thumb tright">
13501 <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>
13502 <div class="thumbcaption">
13503 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13504 </div>
13505 </div>
13506 </div>
13507 <p>456</p>
13508 !! html/parsoid
13509 <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>
13510 <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>
13511 <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>
13512 !! end
13513
13514 !! test
13515 Image with multiple captions -- only last one is accepted
13516 !! wikitext
13517 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13518 !! html/php
13519 <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>
13520
13521 !! html/parsoid
13522 <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>
13523 !! end
13524
13525 !! test
13526 Image with multiple widths -- use last
13527 !! wikitext
13528 [[File:Foobar.jpg|200px|300px|caption]]
13529 !! html/php
13530 <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>
13531 </p>
13532 !! html/parsoid
13533 <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>
13534 !! end
13535
13536 !! test
13537 Image with multiple alignments -- use first (bug 48664)
13538 !! options
13539 thumbsize=220
13540 !! wikitext
13541 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13542
13543 [[File:Foobar.jpg|middle|text-top|caption]]
13544 !! html/php
13545 <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>
13546 <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>
13547 </p>
13548 !! html/parsoid
13549 <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>
13550 <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>
13551 !! end
13552
13553 !! test
13554 Image with width attribute at different positions
13555 !! wikitext
13556 [[File:Foobar.jpg|200px|right|Caption]]
13557 [[File:Foobar.jpg|right|200px|Caption]]
13558 [[File:Foobar.jpg|right|Caption|200px]]
13559 !! html/php
13560 <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>
13561 <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>
13562 <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>
13563
13564 !! html/parsoid
13565 <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>
13566 <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>
13567 <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>
13568 !! end
13569
13570 # a sad bit of backward-compatibility
13571 !! test
13572 Image with size specified with pxpx (bug 13500, 51628)
13573 !! options
13574 parsoid=wt2html,wt2wt,html2html
13575 !! wikitext
13576 [[File:Foobar.jpg|20pxpx]]
13577 [[File:Foobar.jpg|200x20pxpx]]
13578 !! html/php
13579 <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>
13580 <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>
13581 </p>
13582 !! html/parsoid
13583 <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>
13584 !! end
13585
13586 !! test
13587 Image with link parameter, wiki target
13588 !! wikitext
13589 [[File:Foobar.jpg|link=Main Page]]
13590 !! html/php
13591 <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>
13592 </p>
13593 !! html/parsoid
13594 <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>
13595 !! end
13596
13597 # parsoid bug 49293 (part 1)
13598 !! test
13599 Image with link parameter, URL target
13600 !! wikitext
13601 [[File:Foobar.jpg|link=http://example.com/]]
13602 !! html/php
13603 <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>
13604 </p>
13605 !! html/parsoid
13606 <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>
13607 !! end
13608
13609 # parsoid bug 49293 (part 2)
13610 !! test
13611 Image with link parameter, protocol-less URL target
13612 !! wikitext
13613 [[File:Foobar.jpg|link=//example.com/]]
13614 !! html/php
13615 <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>
13616 </p>
13617 !! html/parsoid
13618 <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>
13619 !! end
13620
13621 !! test
13622 Escaping non-block captions (T107435)
13623 !! options
13624 parsoid={
13625 "modes": ["wt2wt"],
13626 "changes": [
13627 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13628 ]
13629 }
13630 !! wikitext
13631 [[Image:Foobar.jpg|caption]]
13632 !! wikitext/edited
13633 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13634 !! end
13635
13636 # wgExternalLinkTarget not supported by Parsoid
13637 !! test
13638 Image with link parameter, wgExternalLinkTarget
13639 !! wikitext
13640 [[Image:foobar.jpg|link=http://example.com/]]
13641 !! config
13642 wgExternalLinkTarget='foobar'
13643 !! html/php
13644 <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>
13645 </p>
13646 !! end
13647
13648 !! test
13649 Image with link parameter, wgNoFollowLinks set to false
13650 !! wikitext
13651 [[Image:foobar.jpg|link=http://example.com/]]
13652 !! config
13653 wgNoFollowLinks=false
13654 !! html
13655 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13656 </p>
13657 !! end
13658
13659 !! test
13660 Image with link parameter, wgNoFollowDomainExceptions
13661 !! wikitext
13662 [[Image:foobar.jpg|link=http://example.com/]]
13663 !! config
13664 wgNoFollowDomainExceptions='example.com'
13665 !! html
13666 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13667 </p>
13668 !! end
13669
13670 # wgExternalLinkTarget not supported by Parsoid
13671 !! test
13672 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13673 !! wikitext
13674 [[Image:foobar.jpg|link=http://example.com/|Title]]
13675 !! config
13676 wgExternalLinkTarget='foobar'
13677 !! html/php
13678 <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>
13679 </p>
13680 !! end
13681
13682 !! test
13683 Image with empty link parameter
13684 !! wikitext
13685 [[File:Foobar.jpg|link=]]
13686 !! html/php
13687 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13688 </p>
13689 !! html/parsoid
13690 <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>
13691 !! end
13692
13693 !! test
13694 Image with link parameter (wiki target) and unnamed parameter
13695 !! wikitext
13696 [[File:Foobar.jpg|link=Main_Page|Title]]
13697 !! html/php
13698 <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>
13699 </p>
13700 !! html/parsoid
13701 <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>
13702 !! end
13703
13704 !! test
13705 Image with link parameter (URL target) and unnamed parameter
13706 !! wikitext
13707 [[File:Foobar.jpg|link=http://example.com/|Title]]
13708 !! html/php
13709 <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>
13710 </p>
13711 !! html/parsoid
13712 <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>
13713 !! end
13714
13715 !! test
13716 Thumbnail image with link parameter
13717 !! options
13718 thumbsize=220
13719 parsoid=wt2html,wt2wt,html2html
13720 !! wikitext
13721 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13722 !! html/php
13723 <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>
13724
13725 !! html/parsoid
13726 <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>
13727 !! end
13728
13729 !! test
13730 Manually-specified thumbnail image
13731 !! options
13732 thumbsize=220
13733 !! wikitext
13734 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13735 !! html/php
13736 <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>
13737
13738 !! html/parsoid
13739 <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>
13740 !! end
13741
13742 !! test
13743 Manually-specified thumbnail image with explicit link to wiki page
13744 !! options
13745 thumbsize=220
13746 parsoid=wt2html,wt2wt,html2html
13747 !! wikitext
13748 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13749 !! html/php
13750 <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>
13751
13752 !! html/parsoid
13753 <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>
13754 !! end
13755
13756 !! test
13757 Manually-specified thumbnail image with explicit link to url
13758 !! options
13759 thumbsize=220
13760 parsoid=wt2html,wt2wt,html2html
13761 !! wikitext
13762 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13763 !! html/php
13764 <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>
13765
13766 !! html/parsoid
13767 <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>
13768 !! end
13769
13770 !! test
13771 Manually-specified thumbnail image with explicit no link
13772 !! options
13773 thumbsize=220
13774 parsoid=wt2html,wt2wt,html2html
13775 !! wikitext
13776 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13777 !! html/php
13778 <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>
13779
13780 !! html/parsoid
13781 <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>
13782 !! end
13783
13784 !! test
13785 Manually-specified thumbnail image with explicit link and alt text
13786 !! options
13787 thumbsize=220
13788 parsoid=wt2html,wt2wt,html2html
13789 !! wikitext
13790 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13791 !! html/php
13792 <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>
13793
13794 !! html/parsoid
13795 <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>
13796 !! end
13797
13798 !! test
13799 Image with frame and link
13800 !! options
13801 parsoid=wt2html,wt2wt,html2html
13802 !! wikitext
13803 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13804 !! html/php
13805 <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>
13806
13807 !! html/parsoid
13808 <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>
13809 !! end
13810
13811 !! test
13812 Image with frame and link and explicit alt
13813 !! options
13814 parsoid=wt2html,wt2wt,html2html
13815 !! wikitext
13816 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13817 !! html/php
13818 <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>
13819
13820 !! html/parsoid
13821 <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>
13822 !! end
13823
13824 !! test
13825 Image with wiki markup in implicit alt
13826 !! wikitext
13827 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13828
13829 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13830 !! html/php
13831 <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>
13832 </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>
13833 </p>
13834 !! html/parsoid
13835 <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>
13836
13837 <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>
13838 !! end
13839
13840 !! test
13841 Alt image option should handle most kinds of wikitext without barfing
13842 !! wikitext
13843 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13844 !! html/php
13845 <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>
13846
13847 !! html/parsoid
13848 <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>
13849 !! end
13850
13851 ###################
13852 # Conflicting image format options.
13853 # First option specified should 'win'.
13854 # All three cases in each test should be identical.
13855
13856 !! test
13857 Image with 'frameless' first.
13858 !! options
13859 parsoid=wt2html,wt2wt,html2html
13860 !! wikitext
13861 [[File:Foobar.jpg|frameless|caption]]
13862
13863 [[File:Foobar.jpg|frameless|frame|caption]]
13864
13865 [[File:Foobar.jpg|frameless|thumb|caption]]
13866 !! html/php
13867 <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>
13868 </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>
13869 </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>
13870 </p>
13871 !! html/parsoid
13872 <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>
13873 <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>
13874 <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>
13875 !! end
13876
13877 !! test
13878 Image with 'frame' first.
13879 !! options
13880 parsoid=wt2html,wt2wt,html2html
13881 !! wikitext
13882 [[File:Foobar.jpg|frame|caption]]
13883 [[File:Foobar.jpg|frame|frameless|caption]]
13884 [[File:Foobar.jpg|frame|thumb|caption]]
13885 !! html/php
13886 <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>
13887 <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>
13888 <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>
13889
13890 !! html/parsoid
13891 <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>
13892 <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>
13893 <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>
13894 !! end
13895
13896 !! test
13897 Image with 'thumb' first.
13898 !! options
13899 parsoid=wt2html,wt2wt,html2html
13900 !! wikitext
13901 [[File:Foobar.jpg|thumb|caption]]
13902 [[File:Foobar.jpg|thumb|frameless|caption]]
13903 [[File:Foobar.jpg|thumb|frame|caption]]
13904 !! html/php
13905 <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>
13906 <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>
13907 <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>
13908
13909 !! html/parsoid
13910 <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>
13911 <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>
13912 <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>
13913 !! end
13914
13915 ###################
13916 # Image sizing.
13917 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13918 # and https://phabricator.wikimedia.org/T64258
13919 # Foobar has actual size of 1941x220
13920 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13921 # a scalable format.
13922 # 2. Framed images always ignore size options; always render at default size.
13923 # 3. "Unspecified format" and border are the only types which can be
13924 # enlarged.
13925
13926 !! test
13927 Image: "unspecified format" and border enlarge
13928 !! options
13929 parsoid=wt2html,wt2wt,html2html
13930 !! wikitext
13931 [[File:Foobar.jpg|2000px]]
13932
13933 [[File:Foobar.jpg|border|2000px]]
13934 !! html/php
13935 <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>
13936 </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>
13937 </p>
13938 !! html/parsoid
13939 <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>
13940 <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>
13941 !! end
13942
13943 !! test
13944 Image: "unspecified format" and border reduce
13945 !! options
13946 parsoid=wt2html,wt2wt,html2html
13947 !! wikitext
13948 [[File:Foobar.jpg|1000px]]
13949
13950 [[File:Foobar.jpg|border|1000px]]
13951 !! html/php
13952 <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>
13953 </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>
13954 </p>
13955 !! html/parsoid
13956 <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>
13957 <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>
13958 !! end
13959
13960 !! test
13961 Image: thumbs reduce
13962 !! options
13963 parsoid=wt2html,wt2wt,html2html
13964 !! wikitext
13965 [[File:Foobar.jpg|thumb|50px]]
13966 !! html/php
13967 <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>
13968
13969 !! html/parsoid
13970 <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>
13971 !! end
13972
13973 !! test
13974 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13975 !! options
13976 parsoid=wt2html,wt2wt,html2html
13977 !! wikitext
13978 [[File:Foobar.jpg|thumb|2000px]]
13979
13980 [[File:Foobar.svg|thumb|2000px]]
13981 !! html/php
13982 <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>
13983 <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>
13984
13985 !! html/parsoid
13986 <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>
13987 <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>
13988 !! end
13989
13990 !! test
13991 Image: frameless can reduce in size
13992 !! options
13993 parsoid=wt2html,wt2wt,html2html
13994 !! wikitext
13995 [[File:Foobar.jpg|frameless|50px]]
13996 !! html/php
13997 <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>
13998 </p>
13999 !! html/parsoid
14000 <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>
14001 !! end
14002
14003 !! test
14004 Image: bitmap frameless can't be enlarged past original size, but vector can
14005 !! options
14006 parsoid=wt2html,wt2wt,html2html
14007 !! wikitext
14008 [[File:Foobar.jpg|frameless|2000px]]
14009
14010 [[File:Foobar.svg|frameless|2000px]]
14011 !! html/php
14012 <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>
14013 </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>
14014 </p>
14015 !! html/parsoid
14016 <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>
14017 <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>
14018 !! end
14019
14020 !! test
14021 Image: framed images are always unscaled.
14022 !! options
14023 parsoid=wt2html,wt2wt,html2html
14024 !! wikitext
14025 [[File:Foobar.jpg|frame]]
14026
14027 [[File:Foobar.jpg|frame|50px]]
14028
14029 [[File:Foobar.jpg|frame|50x50px]]
14030
14031 [[File:Foobar.jpg|frame|2000px]]
14032 !! html/php
14033 <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>
14034 <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>
14035 <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>
14036 <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>
14037
14038 !! html/parsoid
14039 <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>
14040 <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>
14041 <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>
14042 <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>
14043 !! end
14044
14045 ###################
14046
14047 !! test
14048 Link to image page- image page normally doesn't exists, hence edit link
14049 Add test with existing image page
14050 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14051 !! wikitext
14052 [[:Image:test]]
14053 !! html
14054 <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>
14055 </p>
14056 !! end
14057
14058 !! test
14059 bug 18784 Link to non-existent image page with caption should use caption as link text
14060 !! wikitext
14061 [[:Image:test|caption]]
14062 !! html
14063 <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>
14064 </p>
14065 !! end
14066
14067 !! test
14068 Frameless image caption with a free URL
14069 !! wikitext
14070 [[File:Foobar.jpg|http://example.com]]
14071 !! html/php
14072 <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>
14073 </p>
14074 !! html/parsoid
14075 <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>
14076 !! end
14077
14078 !! test
14079 Thumbnail image caption with a free URL
14080 !! options
14081 thumbsize=220
14082 !! wikitext
14083 [[File:Foobar.jpg|thumb|http://example.com]]
14084 !! html/php
14085 <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>
14086
14087 !! html/parsoid
14088 <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>
14089 !! end
14090
14091 !! test
14092 Thumbnail image caption with a free URL and explicit alt
14093 !! options
14094 thumbsize=220
14095 parsoid=wt2html,wt2wt,html2html
14096 !! wikitext
14097 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14098 !! html/php
14099 <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>
14100
14101 !! html/parsoid
14102 <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>
14103 !! end
14104
14105 !! test
14106 SVG thumbnails with no language set
14107 !! options
14108 !! wikitext
14109 [[File:Foobar.svg|thumb|caption]]
14110 !! html/php
14111 <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>
14112
14113 !! html/parsoid
14114 <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>
14115 !! end
14116
14117 !! test
14118 SVG thumbnails with language de
14119 !! options
14120 parsoid=wt2html,wt2wt,html2html
14121 !! wikitext
14122 [[File:Foobar.svg|thumb|caption|lang=de]]
14123 !! html/php
14124 <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>
14125
14126 !! html/parsoid
14127 <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>
14128 !! end
14129
14130 !! test
14131 SVG thumbnails with invalid language code
14132 !! options
14133 parsoid=wt2html,wt2wt,html2html
14134 !! wikitext
14135 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14136 !! html/php
14137 <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>
14138
14139 !! html/parsoid
14140 <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>
14141 !! end
14142
14143 !! test
14144 BUG 1887: A ISBN with a thumbnail
14145 !! wikitext
14146 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14147 !! html/php
14148 <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>
14149
14150 !! html/parsoid
14151 <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>
14152 !! end
14153
14154 !! test
14155 BUG 1887: A RFC with a thumbnail
14156 !! wikitext
14157 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14158 !! html/php
14159 <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>
14160
14161 !! html/parsoid
14162 <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>
14163 !! end
14164
14165 !! test
14166 BUG 1887: A mailto link with a thumbnail
14167 !! wikitext
14168 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14169 !! html/php
14170 <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>
14171
14172 !! html/parsoid
14173 <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>
14174 !! end
14175
14176 # Pending resolution to bug 368
14177 !! test
14178 BUG 648: Frameless image caption with a link
14179 !! wikitext
14180 [[File:Foobar.jpg|text with a [[link]] in it]]
14181 !! html/php
14182 <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>
14183 </p>
14184 !! html/parsoid
14185 <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>
14186 !! end
14187
14188 !! test
14189 BUG 648: Frameless image caption with a link (suffix)
14190 !! wikitext
14191 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14192 !! html/php
14193 <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>
14194 </p>
14195 !! html/parsoid
14196 <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>
14197 !! end
14198
14199 !! test
14200 BUG 648: Frameless image caption with an interwiki link
14201 !! wikitext
14202 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14203 !! html/php
14204 <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>
14205 </p>
14206 !! html/parsoid
14207 <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>
14208 !! end
14209
14210 !! test
14211 BUG 648: Frameless image caption with a piped interwiki link
14212 !! wikitext
14213 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14214 !! html/php
14215 <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>
14216 </p>
14217 !! html/parsoid
14218 <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>
14219 !! end
14220
14221 !! test
14222 T107474: Frameless image caption with <nowiki>
14223 !! wikitext
14224 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14225 !! html/parsoid
14226 <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>
14227 !! end
14228
14229 !! test
14230 Escape HTML special chars in image alt text
14231 !! wikitext
14232 [[File:Foobar.jpg|& < > "]]
14233 !! html/php
14234 <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>
14235 </p>
14236 !! html/parsoid
14237 <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>
14238 !! end
14239
14240 !! test
14241 Escape HTML special chars in image alt text with LanguageConverter
14242 !! options
14243 language=zh
14244 !! wikitext
14245 [[File:Foobar.jpg|& < > "]]
14246 !! html/php
14247 <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>
14248 </p>
14249 !! html/parsoid
14250 <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>
14251 !! end
14252
14253 !! test
14254 Entities in file name and attributes
14255 !! wikitext
14256 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14257 !! html/php
14258 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14259 </p>
14260 !! html/parsoid
14261 <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>
14262 !! end
14263
14264 !! test
14265 BUG 499: Alt text should have &#1234;, not &amp;1234;
14266 !! wikitext
14267 [[File:Foobar.jpg|&#9792;]]
14268 !! html/php
14269 <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>
14270 </p>
14271 !! html/parsoid
14272 <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>
14273 !! end
14274
14275 !! test
14276 Broken image caption with link
14277 !! options
14278 parsoid=wt2html,wt2wt,html2html
14279 !! wikitext
14280 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14281 !! html/php
14282 <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.
14283 </p>
14284 !! html/parsoid
14285 <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>
14286 !! end
14287
14288 !! test
14289 Image caption containing another image
14290 !! wikitext
14291 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14292 !! html/php
14293 <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>
14294
14295 !! html/parsoid
14296 <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>
14297 !! end
14298
14299 !! test
14300 Image: caption containing a newline
14301 !! wikitext
14302 [[File:Foobar.jpg|This
14303 *is some text]]
14304 !! html/php
14305 <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>
14306 </p>
14307 !! html/parsoid
14308 <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>
14309 !!end
14310
14311 !!test
14312 Image: caption containing leading space
14313 (The leading space should not trigger nowiki escaping in wt2wt mode)
14314 !! wikitext
14315 [[File:Foobar.jpg|thumb| bar]]
14316 !! html/php
14317 <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>
14318
14319 !! html/parsoid
14320 <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>
14321 !!end
14322
14323 !! test
14324 Image: caption containing a table
14325 !! options
14326 parsoid=wt2html,wt2wt,html2html
14327 !! wikitext
14328 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14329 {|
14330 ! Foo !! Bar
14331 |-
14332 | Foo1 || Bar1
14333 |}
14334 and some more text.]]
14335 !! html/php
14336 <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>
14337
14338 !! html/parsoid
14339 <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
14340 <table>
14341 <tbody>
14342 <tr><th>Foo </th><th>Bar</th></tr>
14343 <tr>
14344 <td>Foo1 </td>
14345 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14346 !! end
14347
14348 !! test
14349 Bug 3090: External links other than http: in image captions
14350 !! wikitext
14351 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14352 !! html/php
14353 <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>
14354
14355 !! html/parsoid
14356 <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>
14357 !! end
14358
14359 !! test
14360 Custom class
14361 !! options
14362 parsoid=wt2html,wt2wt,html2html
14363 !! wikitext
14364 [[Image:foobar.jpg|a|class=b]]
14365 !! html/php
14366 <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>
14367 </p>
14368 !! html/parsoid
14369 <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>
14370 !! end
14371
14372 !! test
14373 Localized image handling (1).
14374 !! options
14375 parsoid=wt2html,wt2wt,html2html
14376 language=es
14377 !! wikitext
14378 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14379 !! html/php
14380 <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>
14381
14382 !! html/parsoid
14383 <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>
14384 !! end
14385
14386 !! test
14387 Localized image handling (2).
14388 !! options
14389 thumbsize=220
14390 parsoid=wt2html,wt2wt,html2html
14391 language=es
14392 !! wikitext
14393 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14394 !! html/php
14395 <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>
14396
14397 !! html/parsoid
14398 <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>
14399 !! end
14400
14401 !! test
14402 Localized image handling (3).
14403 !! options
14404 language=fa
14405 parsoid=html2wt
14406 !! html/parsoid
14407 <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>
14408 !! wikitext
14409 [[File:Foobar.jpg|بندانگشتی]]
14410 !! end
14411
14412 !! test
14413 "border", "frameless" and "class" attributes on an image.
14414 !! options
14415 thumbsize=220
14416 parsoid=wt2html,wt2wt,html2html
14417 !! wikitext
14418 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14419 !! html/php
14420 <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>
14421 </p>
14422 !! html/parsoid
14423 <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>
14424 !! end
14425
14426 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14427 !! test
14428 Invalid image attributes (bug 62500)
14429 !! options
14430 thumbsize=220
14431 parsoid=wt2html,wt2wt,html2html
14432 !! wikitext
14433 [[File:Foobar.jpg|thumb|float|left|caption]]
14434
14435 [[File:Foobar.jpg|thumb|righ|caption]]
14436
14437 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14438 !! html/php
14439 <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>
14440 <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>
14441 <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>
14442
14443 !! html/parsoid
14444 <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>
14445 <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>
14446 <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>
14447 !! end
14448
14449 !! article
14450 File:Barfoo.jpg
14451 !! text
14452 #REDIRECT [[File:Barfoo.jpg]]
14453 !! endarticle
14454
14455 # FIXME: Parsoid should run this test -- but we'd need to teach the
14456 # mockAPI about the redirected Barfoo.jpg image.
14457 !! test
14458 Redirected image
14459 !! wikitext
14460 [[Image:Barfoo.jpg]]
14461 !! html/php
14462 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14463 </p>
14464 !! end
14465
14466 !! test
14467 Missing image with uploads disabled
14468 !! options
14469 wgEnableUploads=0
14470 !! wikitext
14471 [[File:Foobaz.jpg]]
14472 !! html/php
14473 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14474 </p>
14475 !! html/parsoid
14476 <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>
14477 !! end
14478
14479 # Parsoid-specific testing for images
14480 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14481 # Currently imperfect due to a flaw in the Parsoid testrunner
14482 # Work in progress
14483 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14484 # image tests.
14485
14486 !! test
14487 Parsoid-specific image handling - simple image with size and middle alignment
14488 !! wikitext
14489 [[File:Foobar.jpg|middle|50px]]
14490 !! html/parsoid
14491 <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>
14492 !! end
14493
14494 !! test
14495 Parsoid-specific image handling - simple image with size, middle alignment,
14496 non-standard namespace alias
14497 !! options
14498 parsoid=wt2wt,wt2html,html2html
14499 !! wikitext
14500 [[Image:Foobar.jpg|middle|50px]]
14501 !! html/parsoid
14502 <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>
14503 !! end
14504
14505 !! test
14506 Parsoid-specific image handling - simple image with size and middle alignment
14507 (existing content)
14508 !! wikitext
14509 [[File:Foobar.jpg|50px|middle]]
14510 !! html/parsoid
14511 <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>
14512 !! end
14513
14514 !! test
14515 Parsoid-specific image handling - simple image with size and middle alignment
14516 and non-standard namespace name
14517 !! options
14518 parsoid=wt2html,wt2wt,html2html
14519 !! wikitext
14520 [[Image:Foobar.jpg|50px|middle]]
14521 !! html/parsoid
14522 <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>
14523 !! end
14524
14525 !! test
14526 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14527 !! wikitext
14528 [[File:Foobar.jpg|500x10px|baseline|caption]]
14529 !! html/parsoid
14530 <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>
14531 !! end
14532
14533 !! test
14534 Parsoid-specific image handling - simple image with border and size spec
14535 !! wikitext
14536 [[File:Foobar.jpg|50px|border|caption]]
14537 !! html/parsoid
14538 <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>
14539 !! end
14540
14541 !! test
14542 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14543 !! wikitext
14544 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14545 !! html/parsoid
14546 <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>
14547 !! end
14548
14549 !! test
14550 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14551 (existing content)
14552 !! wikitext
14553 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14554 !! html/parsoid
14555 <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>
14556 !! end
14557
14558 !! test
14559 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14560 !! wikitext
14561 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14562 !! html/parsoid
14563 <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>
14564 !! end
14565
14566 !! test
14567 Parsoid-specific image handling - thumbnail with specific size, halign,
14568 valign, and caption (existing content)
14569 !! wikitext
14570 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14571 !! html/parsoid
14572 <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>
14573 !! end
14574
14575 !! test
14576 Parsoid-specific image handling - framed image with specific size and caption
14577 (size is ignored)
14578 !! options
14579 parsoid=wt2html,wt2wt,html2html
14580 !! wikitext
14581 [[File:Foobar.jpg|frame|500x50px|caption]]
14582 !! html/parsoid
14583 <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>
14584 !! end
14585
14586 !! test
14587 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14588 (size is ignored)
14589 !! options
14590 parsoid=wt2html,wt2wt,html2html
14591 !! wikitext
14592 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14593 !! html/parsoid
14594 <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>
14595 !! end
14596
14597 !! test
14598 Parsoid-specific image handling - frameless image with specific size, border, and caption
14599 !! wikitext
14600 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14601 !! html/parsoid
14602 <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>
14603 !! end
14604
14605 !! test
14606 Parsoid-specific image handling - simple image with a formatted caption
14607 !! wikitext
14608 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14609 !! html/parsoid
14610 <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>
14611 !! end
14612
14613 !! test
14614 Parsoid-specific image handling - caption with a template in it
14615 !! wikitext
14616 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14617 !! html/parsoid
14618 <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>
14619 !! end
14620
14621 !! test
14622 Parsoid-specific image handling - caption with unbalanced tags in it
14623 !! options
14624 parsoid=wt2html,wt2wt,html2html
14625 !! wikitext
14626 foo
14627 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14628 bar
14629 !! html/parsoid
14630 <p>foo</p>
14631 <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>
14632 <p>bar</p>
14633 !! end
14634
14635 !! test
14636 Parsoid-specific image handling - empty caption (1)
14637 !! options
14638 parsoid=wt2html,wt2wt
14639 !! wikitext
14640 [[File:Foobar.jpg|thumb|]]
14641 !! html/parsoid
14642 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption></figcaption></figure>
14643 !! end
14644
14645 # empty captions don't get serialized unless we're in the "round trip" case
14646 !! test
14647 Parsoid-specific image handling - empty caption (2)
14648 !! options
14649 parsoid=html2wt
14650 !! html/parsoid
14651 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14652 <a href="./File:Foobar.jpg">
14653 <img resource="./File:Foobar.jpg"
14654 src="//example.com/images/3/3a/Foobar.jpg"
14655 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14656 height="25" width="220"/>
14657 </a>
14658 <figcaption></figcaption>
14659 </figure>
14660 !! wikitext
14661 [[File:Foobar.jpg|thumb]]
14662 !! end
14663
14664 !! test
14665 Parsoid-specific image handling - whitespace caption
14666 !! wikitext
14667 [[File:Foobar.jpg|thumb| ]]
14668 !! html/parsoid
14669 <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>
14670 !! end
14671
14672 !! test
14673 Parsoid-specific image handling - lang option
14674 !! wikitext
14675 foo
14676 [[File:Foobar.svg|lang=de|caption]]
14677 bar
14678 !! html/parsoid
14679 <p>foo
14680 <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>
14681 bar</p>
14682 !! end
14683
14684 ## Edge case bugs in Parsoid from T93580
14685 !! test
14686 T93580: 1. Templated <ref> inside block images
14687 !! wikitext
14688 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14689
14690 <references />
14691 !! html/parsoid
14692 <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>
14693
14694 <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>
14695 !! end
14696
14697 !! test
14698 T93580: 2. <ref> inside inline images
14699 !! wikitext
14700 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14701
14702 <references />
14703 !! html/parsoid
14704 <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>
14705
14706 <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>
14707 !! end
14708
14709 !! test
14710 T93580: 3. Templated <ref> inside inline images
14711 !! wikitext
14712 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14713
14714 <references />
14715 !! html/parsoid
14716 <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>
14717
14718 <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>
14719 !! end
14720
14721 ###
14722 ### Subpages
14723 ###
14724 !! article
14725 Subpage test/subpage
14726 !! text
14727 foo
14728 !! endarticle
14729
14730 !! test
14731 Subpage link
14732 !! options
14733 subpage title=[[Subpage test]]
14734 !! wikitext
14735 [[/subpage]]
14736 !! html
14737 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14738 </p>
14739 !! end
14740
14741 !! test
14742 Subpage noslash link
14743 !! options
14744 subpage title=[[Subpage test]]
14745 !! wikitext
14746 [[/subpage/]]
14747 !! html
14748 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14749 </p>
14750 !! end
14751
14752 !! article
14753 Subpage test/1/2/subpage
14754 !! text
14755 blah
14756 !! endarticle
14757
14758 !! test
14759 Relative subpage noslash link
14760 !! options
14761 parsoid=wt2wt,wt2html,html2html
14762 subpage title=[[Subpage test/1/2/3/4]]
14763 !! wikitext
14764 [[../../subpage/]]
14765
14766 [[../../subpage]]
14767 !! html/php
14768 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14769 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14770 </p>
14771 !! html/parsoid
14772 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14773 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14774 !! end
14775
14776 !! test
14777 Parsoid: dot-slash prefixed wikilinks
14778 !! wikitext
14779 [[./foo]]
14780
14781 [[././bar]]
14782
14783 [[././baz/]]
14784 !! html/php
14785 <p>[[./foo]]
14786 </p><p>[[././bar]]
14787 </p><p>[[././baz/]]
14788 </p>
14789 !! html/parsoid
14790 <p>[[./foo]]
14791 </p><p>[[././bar]]
14792 </p><p>[[././baz/]]
14793 </p>
14794 !! end
14795
14796 !! test
14797 Render invalid page names as plain text (bug 51090)
14798 !! wikitext
14799 [[./../foo|bar]]
14800 [[foo�|bar]]
14801 [[foo/.|bar]]
14802 [[foo/..|bar]]
14803 [[foo~~~bar]]
14804 [[foo>bar]]
14805 [[foo[bar]]
14806 [[.]]
14807 [[..]]
14808 [[foo././bar]]
14809
14810 [[{{echo|./../foo}}|bar]]
14811 [[{{echo|foo/.}}|bar]]
14812 [[{{echo|foo/..}}|bar]]
14813 [[{{echo|foo~~~~bar}}]]
14814 [[{{echo|foo>bar}}]]
14815 [[{{echo|foo././bar}}]]
14816 [[{{echo|foo{bar}}]]
14817 [[{{echo|foo}bar}}]]
14818 [[{{echo|foo[bar}}]]
14819 [[{{echo|foo]bar}}]]
14820 [[{{echo|foo<bar}}]]
14821 !!html/php
14822 <p>[[./../foo|bar]]
14823 [[foo�|bar]]
14824 [[foo/.|bar]]
14825 [[foo/..|bar]]
14826 [[foo~~~bar]]
14827 [[foo&gt;bar]]
14828 [[foo[bar]]
14829 [[.]]
14830 [[..]]
14831 [[foo././bar]]
14832 </p><p>[[./../foo|bar]]
14833 [[foo/.|bar]]
14834 [[foo/..|bar]]
14835 [[foo~~~~bar]]
14836 [[foo&gt;bar]]
14837 [[foo././bar]]
14838 [[foo{bar]]
14839 [[foo}bar]]
14840 [[foo[bar]]
14841 [[foo]bar]]
14842 [[foo&lt;bar]]
14843 </p>
14844 !!html/parsoid
14845 <p>[[./../foo|bar]]
14846 [[foo�|bar]]
14847 [[foo/.|bar]]
14848 [[foo/..|bar]]
14849 [[foo~~~bar]]
14850 [[foo>bar]]
14851 [[foo[bar]]
14852 [[.]]
14853 [[..]]
14854 [[foo././bar]]</p>
14855
14856 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14857 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14858 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14859 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14860 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14861 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14862 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14863 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14864 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14865 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14866 [[<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>
14867 !!end
14868
14869 !! test
14870 Disabled subpages
14871 !! wikitext
14872 [[/subpage]]
14873 !! html
14874 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14875 </p>
14876 !! end
14877
14878 !! test
14879 BUG 561: {{/Subpage}}
14880 !! options
14881 subpage title=[[Page]]
14882 !! wikitext
14883 {{/Subpage}}
14884 !! html
14885 <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>
14886 </p>
14887 !! end
14888
14889 ###
14890 ### Categories
14891 ###
14892 !! article
14893 Category:MediaWiki User's Guide
14894 !! text
14895 blah
14896 !! endarticle
14897
14898 !! test
14899 Link to category
14900 !! wikitext
14901 [[:Category:MediaWiki User's Guide]]
14902 !! html
14903 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14904 </p>
14905 !! end
14906
14907 !! test
14908 Simple category
14909 !! options
14910 cat
14911 !! wikitext
14912 [[Category:MediaWiki User's Guide]]
14913 !! html/php
14914 cat=MediaWiki_User's_Guide sort=
14915 !! html/parsoid
14916 <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"}}'/>
14917 !! end
14918
14919 !! test
14920 PAGESINCATEGORY invalid title fatal (r33546 fix)
14921 !! wikitext
14922 {{PAGESINCATEGORY:<bogus>}}
14923 !! html
14924 <p>0
14925 </p>
14926 !! end
14927
14928 !! test
14929 Category with different sort key
14930 !! options
14931 cat
14932 !! wikitext
14933 [[Category:MediaWiki User's Guide|Foo]]
14934 !! html/php
14935 cat=MediaWiki_User's_Guide sort=Foo
14936 !! html/parsoid
14937 <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"}}'/>
14938 !! end
14939
14940 !! test
14941 Category with identical sort key
14942 !! options
14943 cat
14944 !! wikitext
14945 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14946 !! html/php
14947 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
14948 !! html/parsoid
14949 <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"}}'/>
14950 !! end
14951
14952 !! test
14953 Category with empty sort key
14954 !! options
14955 cat
14956 pst
14957 !! wikitext
14958 [[Category:MediaWiki User's Guide|]]
14959 !! html/php
14960 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14961 !! end
14962
14963 !! test
14964 Category with empty sort key and parentheses
14965 !! options
14966 cat
14967 pst
14968 !! wikitext
14969 [[Category:Foo (bar)|]]
14970 !! html/php
14971 [[Category:Foo (bar)|Foo]]
14972 !! end
14973
14974 !! test
14975 Category with link tail
14976 !! options
14977 cat
14978 pst
14979 !! wikitext
14980 123[[Category:Foo]]456
14981 !! html/php
14982 123[[Category:Foo]]456
14983 !! end
14984
14985 !! test
14986 Category with template
14987 !! options
14988 cat
14989 pst
14990 !! wikitext
14991 [[Category:{{echo|Foo}}]]
14992 !! html/php
14993 [[Category:{{echo|Foo}}]]
14994 !! end
14995
14996 !! test
14997 Category with template in sort key
14998 !! options
14999 cat
15000 pst
15001 !! wikitext
15002 [[Category:Foo|{{echo|Bar}}]]
15003 !! html/php
15004 [[Category:Foo|{{echo|Bar}}]]
15005 !! end
15006
15007 !! test
15008 Category with template in sort key and title
15009 !! options
15010 cat
15011 pst
15012 !! wikitext
15013 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15014 !! html/php
15015 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15016 !! end
15017
15018 ## We used to, but no longer wt2wt this test since the default serializer
15019 ## will normalize all categories to serialize on their own line.
15020 ## This wikitext usage is going to be fairly uncommon in production and
15021 ## selser will take care of preserving formatting in those scenarios.
15022 !! test
15023 Category / paragraph interactions
15024 !! options
15025 parsoid=wt2html
15026 !! wikitext
15027 Foo [[Category:Baz]] Bar
15028
15029 Foo [[Category:Baz]]
15030 Bar
15031
15032 Foo
15033 [[Category:Baz]]
15034 Bar
15035
15036 Foo
15037 [[Category:Baz]] Bar
15038
15039 Foo
15040 [[Category:Baz]]
15041 [[Category:Baz]]
15042 [[Category:Baz]]
15043 Bar
15044
15045 [[Category:Baz]]
15046 [[Category:Baz]]
15047 [[Category:Baz]]
15048
15049 [[Category:Baz]]
15050 {{echo|[[Category:Baz]]}}
15051 [[Category:Baz]]
15052 !! html/php
15053 <p>Foo Bar
15054 </p><p>Foo
15055 Bar
15056 </p><p>Foo
15057 Bar
15058 </p><p>Foo Bar
15059 </p><p>Foo
15060 Bar
15061 </p>
15062 !! html/parsoid
15063 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
15064 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
15065 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
15066 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
15067 <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>
15068 <link rel="mw:PageProp/Category" href="Category:Baz"/>
15069 !! end
15070
15071 ## We used to, but no longer wt2wt this test since the default serializer
15072 ## will normalize all categories to serialize on their own line.
15073 ## This wikitext usage is going to be fairly uncommon in production and
15074 ## selser will take care of preserving formatting in those scenarios.
15075 ##
15076 ## The whitespace on the empty line is part of the test. Please do not delete
15077 !! test
15078 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
15079 !! options
15080 parsoid=wt2html
15081 !! wikitext
15082 This
15083
15084 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15085
15086 {{echo|[[Category:Foo]] and so should this!}}
15087 !! html/php
15088 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15089 </p>
15090 !! html/parsoid
15091 <p>This
15092
15093 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15094
15095 <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>
15096 !! end
15097
15098 ## Parsoid will not try to wt2wt this while preserving newlines because
15099 ## it suppresses excess newlines within list items -- and we don't want to
15100 ## introduce a special case just for categories, which is, in reality somewhat
15101 ## odd behavior -- categories are unlikely to be used in list items like this
15102 ## in top-level pages and are only likely to show up in template-generated
15103 ## list items where this RT-ing is a non-issue.
15104 ##
15105 ## The whitespace on the empty line is part of the test. Please do not delete
15106 !! test
15107 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
15108 !! options
15109 parsoid=wt2html
15110 !! wikitext
15111 * This
15112
15113 [[Category:Foo]] and this should be part of the same list item
15114 * So should this
15115
15116 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15117 !! html
15118 <ul><li>This and this should be part of the same list item</li>
15119 <li>So should this and this should be part of the same list item</li></ul>
15120 !! html/parsoid
15121 <ul>
15122 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15123 <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>
15124 </ul>
15125 !! end
15126
15127 ## Newlines and categories that follow the last item of a list
15128 ## are treated differently because this (list followed by categories)
15129 ## is an extremely common pattern on wikis.
15130 !! test
15131 3. Categories and newlines: newline suppression for last list item should RT properly
15132 !! wikitext
15133 * a
15134 * b
15135
15136 [[Category:Foo]]
15137
15138 [[Category:Bar]]
15139 [[Category:Baz]]
15140 !! html/parsoid
15141 <ul><li> a</li>
15142 <li> b</li></ul>
15143
15144 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15145
15146 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15147 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15148 !! end
15149
15150 !! test
15151 4. Categories and newlines: newline suppression for last list item should RT properly
15152 !! wikitext
15153 * a
15154 **** b
15155
15156 [[Category:Foo]]
15157 !! html/parsoid
15158 <ul><li> a
15159 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15160
15161 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15162 !! end
15163
15164 ## only wt2html for this to make sure the algo only applies to the rightmost path
15165 !! test
15166 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15167 !! options
15168 parsoid=wt2html
15169 !! wikitext
15170 * a
15171 ** b
15172 [[Category:Foo]]
15173 * c
15174 ** d
15175 [[Category:Foo]]
15176 !! html/parsoid
15177 <ul><li> a
15178 <ul><li> b
15179 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15180 <li> c
15181 <ul><li> d</li></ul></li></ul>
15182 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15183 !! end
15184
15185 ## We used to, but no longer wt2wt this test since the default serializer
15186 ## will normalize all categories to serialize on their own line.
15187 ## This wikitext usage is going to be fairly uncommon in production and
15188 ## selser will take care of preserving formatting in those scenarios.
15189 !! test
15190 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15191 !! options
15192 parsoid=wt2html
15193 !! wikitext
15194 * a [[Category:Foo]]
15195 !! html/parsoid
15196 <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>
15197 !! end
15198
15199 # This test also demonstrates because of newline+category tunneling
15200 # through the list hander, template wrapping doesn't expand to the
15201 # containing list when the list item swallows the category.
15202 !! test
15203 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15204 !! wikitext
15205 * {{echo|a
15206 [[Category:Foo]]}}
15207 !! html/parsoid
15208 <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
15209 </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>
15210 !! end
15211
15212 !! test
15213 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15214 !! wikitext
15215 * a
15216
15217 {{echo|[[Category:Foo]]
15218 [[Category:Bar]]}}
15219 [[Category:Baz]]
15220 !! html/parsoid
15221 <ul><li> a</li></ul>
15222
15223 <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">
15224 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15225 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15226 !! end
15227
15228 !! test
15229 Category links with multiple namespaces
15230 !! wikitext
15231 [[Category:Project:Foo]]
15232 !! html/parsoid
15233 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15234 !! end
15235
15236 !! test
15237 Parsoid: Serialize link to category page with colon escape
15238 !! options
15239 parsoid
15240 !! wikitext
15241
15242 [[:Category:Foo]]
15243 [[:Category:Foo|Bar]]
15244 !! html
15245 <p>
15246 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15247 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15248 </p>
15249 !! end
15250
15251 # We used to, but no longer wt2wt this test since the default serializer
15252 # will normalize all categories to serialize on their own line.
15253 # This wikitext usage is going to be fairly uncommon in production and
15254 # selser will take care of preventing whitespace insertion if this
15255 # occurs in an article.
15256 #
15257 # html2html disabled for the same reason (whitespace insertion between
15258 # x and y).
15259 #
15260 # html2wt disabled because it localizes the "Category" namespace.
15261 !! test
15262 Link prefix/suffixes aren't applied to category links
15263 !! options
15264 parsoid=wt2html
15265 language=is
15266 !! wikitext
15267 x[[Category:Foo]]y
15268 !! html/php
15269 <p>xy
15270 </p>
15271 !! html/parsoid
15272 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15273 !! end
15274
15275 !! test
15276 Parsoid: Serialize link to file page with colon escape
15277 !! options
15278 parsoid
15279 !! wikitext
15280
15281 [[:File:Foo.png]]
15282 [[:File:Foo.png|Bar]]
15283 !! html
15284 <p>
15285 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15286 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15287 </p>
15288 !! end
15289
15290 !! test
15291 Parsoid: Serialize a genuine category link without colon escape
15292 !! options
15293 parsoid
15294 !! wikitext
15295 [[Category:Foo]]
15296 [[Category:Foo|Bar]]
15297 !! html
15298 <link rel="mw:PageProp/Category" href="./Category:Foo">
15299 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15300 !! end
15301
15302 !! test
15303 Normalize hrefs properly before testing for invalid link targets (bug 70894)
15304 !! options
15305 parsoid=html2wt
15306 !! html/parsoid
15307 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15308 !! wikitext
15309 [[Category:Toxine bactérienne]]
15310 !! end
15311
15312 !! test
15313 Parsoid: Defaultsort
15314 !! wikitext
15315 {{DEFAULTSORT:Foo}}
15316 !! html/parsoid
15317 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15318 !! end
15319
15320 !! test
15321 Parsoid: Defaultsort (template-generated)
15322 !! wikitext
15323 {{{{echo|DEFAULTSORT}}:Foo}}
15324 !! html/parsoid
15325 <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}}]}'/>
15326 !! end
15327
15328 ###
15329 ### Inter-language links
15330 ###
15331 !! test
15332 Interlanguage links
15333 !! options
15334 ill
15335 !! wikitext
15336 [[es:Alimento]]
15337 [[fr:Nourriture]]
15338 [[zh:食品]]
15339 !! html/php
15340 es:Alimento fr:Nourriture zh:食品
15341 !! html/parsoid
15342 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15343 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15344 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15345 !! end
15346
15347 !! test
15348 Duplicate interlanguage links (bug 24502)
15349 !! options
15350 ill
15351 !! wikitext
15352 [[es:1]]
15353 [[es:2]]
15354 [[fr:1]]
15355 [[fr:2]]
15356 !! html/php
15357 es:1 fr:1
15358 !! html/parsoid
15359 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15360 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15361 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15362 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15363 !! end
15364
15365 ###
15366 ### Sections
15367 ###
15368 !! test
15369 Basic section headings
15370 !! wikitext
15371 == Headline 1 ==
15372 Some text
15373
15374 ==Headline 2==
15375 More
15376 ===Smaller headline===
15377 Blah blah
15378 !! html
15379 <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>
15380 <p>Some text
15381 </p>
15382 <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>
15383 <p>More
15384 </p>
15385 <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>
15386 <p>Blah blah
15387 </p>
15388 !! end
15389
15390 !! test
15391 Section headings with TOC
15392 !! wikitext
15393 == Headline 1 ==
15394 === Subheadline 1 ===
15395 ===== Skipping a level =====
15396 ====== Skipping a level ======
15397
15398 == Headline 2 ==
15399 Some text
15400 ===Another headline===
15401 !! html
15402 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15403 <ul>
15404 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15405 <ul>
15406 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15407 <ul>
15408 <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>
15409 <ul>
15410 <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>
15411 </ul>
15412 </li>
15413 </ul>
15414 </li>
15415 </ul>
15416 </li>
15417 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15418 <ul>
15419 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15420 </ul>
15421 </li>
15422 </ul>
15423 </div>
15424
15425 <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>
15426 <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>
15427 <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>
15428 <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>
15429 <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>
15430 <p>Some text
15431 </p>
15432 <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>
15433
15434 !! end
15435
15436 !! test
15437 TOC anchors don't collide
15438 !! wikitext
15439 __FORCETOC__
15440 == Headline 2 ==
15441 == Headline ==
15442 == Headline 2 ==
15443 == Headline ==
15444 !! html/php
15445 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15446 <ul>
15447 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15448 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15449 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15450 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15451 </ul>
15452 </div>
15453
15454 <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>
15455 <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>
15456 <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>
15457 <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>
15458
15459 !! end
15460
15461 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15462 !! test
15463 Handling of sections up to level 6 and beyond
15464 !! wikitext
15465 = Level 1 Heading=
15466 == Level 2 Heading==
15467 === Level 3 Heading===
15468 ==== Level 4 Heading====
15469 ===== Level 5 Heading=====
15470 ====== Level 6 Heading======
15471 ======= Level 7 Heading=======
15472 ======== Level 8 Heading========
15473 ========= Level 9 Heading=========
15474 ========== Level 10 Heading==========
15475 !! html
15476 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15477 <ul>
15478 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15479 <ul>
15480 <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>
15481 <ul>
15482 <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>
15483 <ul>
15484 <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>
15485 <ul>
15486 <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>
15487 <ul>
15488 <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>
15489 <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>
15490 <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>
15491 <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>
15492 <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>
15493 </ul>
15494 </li>
15495 </ul>
15496 </li>
15497 </ul>
15498 </li>
15499 </ul>
15500 </li>
15501 </ul>
15502 </li>
15503 </ul>
15504 </div>
15505
15506 <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>
15507 <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>
15508 <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>
15509 <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>
15510 <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>
15511 <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>
15512 <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>
15513 <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>
15514 <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>
15515 <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>
15516
15517 !! end
15518
15519 !! test
15520 TOC regression (T11764)
15521 !! wikitext
15522 == title 1 ==
15523 === title 1.1 ===
15524 ==== title 1.1.1 ====
15525 === title 1.2 ===
15526 == title 2 ==
15527 === title 2.1 ===
15528 !! html
15529 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15530 <ul>
15531 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15532 <ul>
15533 <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>
15534 <ul>
15535 <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>
15536 </ul>
15537 </li>
15538 <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>
15539 </ul>
15540 </li>
15541 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15542 <ul>
15543 <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>
15544 </ul>
15545 </li>
15546 </ul>
15547 </div>
15548
15549 <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>
15550 <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>
15551 <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>
15552 <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>
15553 <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>
15554 <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>
15555
15556 !! end
15557
15558 !! test
15559 TOC for heading containing <span id="..."></span> (T96153)
15560 !! wikitext
15561 __FORCETOC__
15562 ==<span id="old-anchor"></span>New title==
15563 !! html/php
15564 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15565 <ul>
15566 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15567 </ul>
15568 </div>
15569
15570 <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>
15571
15572 !! end
15573
15574 !! test
15575 TOC with wgMaxTocLevel=3 (bug 6204)
15576 !! options
15577 wgMaxTocLevel=3
15578 !! wikitext
15579 == title 1 ==
15580 === title 1.1 ===
15581 ==== title 1.1.1 ====
15582 === title 1.2 ===
15583 == title 2 ==
15584 === title 2.1 ===
15585 !! html
15586 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15587 <ul>
15588 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15589 <ul>
15590 <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>
15591 <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>
15592 </ul>
15593 </li>
15594 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15595 <ul>
15596 <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>
15597 </ul>
15598 </li>
15599 </ul>
15600 </div>
15601
15602 <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>
15603 <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>
15604 <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>
15605 <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>
15606 <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>
15607 <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>
15608
15609 !! end
15610
15611 !! test
15612 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15613 !! options
15614 wgMaxTocLevel=3
15615 !! wikitext
15616 ==Section 1==
15617 ===Section 1.1===
15618 ====Section 1.1.1====
15619 ====Section 1.1.1.1====
15620 ==Section 2==
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="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15625 <ul>
15626 <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>
15627 </ul>
15628 </li>
15629 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15630 </ul>
15631 </div>
15632
15633 <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>
15634 <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>
15635 <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>
15636 <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>
15637 <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>
15638
15639 !! end
15640
15641
15642 !! test
15643 Resolving duplicate section names
15644 !! wikitext
15645 == Foo bar ==
15646 == Foo bar ==
15647 !! html
15648 <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>
15649 <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>
15650
15651 !! end
15652
15653 !! test
15654 Resolving duplicate section names with differing case (bug 10721)
15655 !! wikitext
15656 == Foo bar ==
15657 == Foo Bar ==
15658 !! html
15659 <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>
15660 <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>
15661
15662 !! end
15663
15664 !! article
15665 Template:sections
15666 !! text
15667 ===Section 1===
15668 ==Section 2==
15669 !! endarticle
15670
15671 !! test
15672 Template with sections, __NOTOC__
15673 !! wikitext
15674 __NOTOC__
15675 ==Section 0==
15676 {{sections}}
15677 ==Section 4==
15678 !! html
15679 <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>
15680 <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>
15681 <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>
15682 <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>
15683
15684 !! end
15685
15686 !! test
15687 __NOEDITSECTION__ keyword
15688 !! wikitext
15689 __NOEDITSECTION__
15690 ==Section 1==
15691 ==Section 2==
15692 !! html
15693 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15694 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15695
15696 !! end
15697
15698 !! test
15699 Link inside a section heading
15700 !! wikitext
15701 ==Section with a [[Main Page|link]] in it==
15702 !! html
15703 <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>
15704
15705 !! end
15706
15707 !! test
15708 TOC regression (T14077)
15709 !! wikitext
15710 __TOC__
15711 == title 1 ==
15712 === title 1.1 ===
15713 == title 2 ==
15714 !! html
15715 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15716 <ul>
15717 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15718 <ul>
15719 <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>
15720 </ul>
15721 </li>
15722 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15723 </ul>
15724 </div>
15725
15726 <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>
15727 <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>
15728 <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>
15729
15730 !! end
15731
15732 !! test
15733 BUG 1219 URL next to image (good)
15734 !! wikitext
15735 http://example.com [[File:Foobar.jpg]]
15736 !! html/php
15737 <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>
15738 </p>
15739 !! html/parsoid
15740 <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>
15741 !!end
15742
15743 !! test
15744 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15745 !! wikitext
15746 ===
15747 The line above must have a trailing space!
15748 === <!--
15749 --> <!-- -->
15750 But just in case it doesn't...
15751 !! html
15752 <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>
15753 <p>The line above must have a trailing space!
15754 </p>
15755 <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>
15756 <p>But just in case it doesn't...
15757 </p>
15758 !! end
15759
15760 !! test
15761 Header with special characters (bug 25462)
15762 !! wikitext
15763 The tooltips shall not show entities to the user (ie. be double escaped)
15764
15765 == text > text ==
15766 section 1
15767
15768 == text < text ==
15769 section 2
15770
15771 == text & text ==
15772 section 3
15773
15774 == text ' text ==
15775 section 4
15776
15777 == text " text ==
15778 section 5
15779 !! html
15780 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15781 </p>
15782 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15783 <ul>
15784 <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>
15785 <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>
15786 <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>
15787 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15788 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15789 </ul>
15790 </div>
15791
15792 <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>
15793 <p>section 1
15794 </p>
15795 <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>
15796 <p>section 2
15797 </p>
15798 <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>
15799 <p>section 3
15800 </p>
15801 <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>
15802 <p>section 4
15803 </p>
15804 <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>
15805 <p>section 5
15806 </p>
15807 !! end
15808
15809 !! test
15810 Header with space, plus and underscore as entity
15811 !! wikitext
15812 Id should not contain + for spaces
15813
15814 == Space between Text ==
15815 section 1
15816
15817 == Space-Entity&#32;between&#32;Text ==
15818 section 2
15819
15820 == Plus+between+Text ==
15821 section 3
15822
15823 == Plus-Entity&#43;between&#43;Text ==
15824 section 4
15825
15826 == Underscore_between_Text ==
15827 section 5
15828
15829 == Underscore-Entity&#95;between&#95;Text ==
15830 section 6
15831
15832 [[#Space between Text]]
15833 [[#Space-Entity&#32;between&#32;Text]]
15834 [[#Plus+between+Text]]
15835 [[#Plus-Entity&#43;between&#43;Text]]
15836 [[#Underscore_between_Text]]
15837 [[#Underscore-Entity&#95;between&#95;Text]]
15838 !! html
15839 <p>Id should not contain + for spaces
15840 </p>
15841 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15842 <ul>
15843 <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>
15844 <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>
15845 <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>
15846 <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>
15847 <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>
15848 <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>
15849 </ul>
15850 </div>
15851
15852 <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>
15853 <p>section 1
15854 </p>
15855 <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>
15856 <p>section 2
15857 </p>
15858 <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>
15859 <p>section 3
15860 </p>
15861 <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>
15862 <p>section 4
15863 </p>
15864 <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>
15865 <p>section 5
15866 </p>
15867 <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>
15868 <p>section 6
15869 </p><p><a href="#Space_between_Text">#Space between Text</a>
15870 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15871 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15872 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15873 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15874 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15875 </p>
15876 !! end
15877
15878 !! test
15879 Headers with excess '=' characters
15880 (Are similar tests necessary beyond the 1st level?)
15881 !! wikitext
15882 =foo==
15883 ==foo=
15884 =''italic'' heading==
15885 ==''italic'' heading=
15886 !! html
15887 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15888 <ul>
15889 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15890 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15891 <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>
15892 <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>
15893 </ul>
15894 </div>
15895
15896 <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>
15897 <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>
15898 <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>
15899 <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>
15900
15901 !! end
15902
15903 !! test
15904 HTML headers vs TOC (bug 23393)
15905 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15906 !! wikitext
15907 <h1>Header 1</h1>
15908 == Header 1.1 ==
15909 == Header 1.2 ==
15910
15911 <h1>Header 2
15912 </h1>
15913 == Header 2.1 ==
15914 == Header 2.2 ==
15915 __NOEDITSECTION__
15916 !! html
15917 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15918 <ul>
15919 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15920 <ul>
15921 <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>
15922 <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>
15923 </ul>
15924 </li>
15925 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15926 <ul>
15927 <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>
15928 <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>
15929 </ul>
15930 </li>
15931 </ul>
15932 </div>
15933
15934 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15935 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15936 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15937 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15938 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15939 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15940
15941 !! end
15942
15943 !! test
15944 Single-line or multiline-comments can follow headings
15945 !! options
15946 parsoid=wt2html,wt2wt
15947 !! wikitext
15948 ==foo==<!---->
15949 ==bar==<!--c1-->
15950 ==baz==<!--
15951 c2
15952 c3-->
15953 !! html
15954 <h2><span class="mw-headline" id="foo">foo</span></h2>
15955 <h2><span class="mw-headline" id="bar">bar</span></h2>
15956 <h2><span class="mw-headline" id="baz">baz</span></h2>
15957
15958 !! end
15959
15960 !! test
15961 BUG 1219 URL next to image (broken)
15962 !! wikitext
15963 http://example.com[[File:Foobar.jpg]]
15964 !! html/php
15965 <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>
15966 </p>
15967 !! html/parsoid
15968 <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>
15969 !!end
15970
15971 !! test
15972 Bug 1186 news: in the middle of text
15973 !! wikitext
15974 http://en.wikinews.org/wiki/Wikinews:Workplace
15975 !! html
15976 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15977 </p>
15978 !!end
15979
15980
15981 !! test
15982 Namespaced link must have a title
15983 !! wikitext
15984 [[Project:]]
15985 !! html
15986 <p>[[Project:]]
15987 </p>
15988 !!end
15989
15990 !! test
15991 Namespaced link must have a title (bad fragment version)
15992 !! wikitext
15993 [[Project:#fragment]]
15994 !! html
15995 <p>[[Project:#fragment]]
15996 </p>
15997 !!end
15998
15999
16000 ###
16001 ### HTML tags and HTML attributes
16002 ###
16003
16004 !! test
16005 div with no attributes
16006 !! wikitext
16007 <div>HTML rocks</div>
16008 !! html
16009 <div>HTML rocks</div>
16010
16011 !! end
16012
16013 !! test
16014 div with double-quoted attribute
16015 !! wikitext
16016 <div id="rock">HTML rocks</div>
16017 !! html
16018 <div id="rock">HTML rocks</div>
16019
16020 !! end
16021
16022 !! test
16023 div with single-quoted attribute
16024 !! wikitext
16025 <div id='rock'>HTML rocks</div>
16026 !! html
16027 <div id="rock">HTML rocks</div>
16028
16029 !! end
16030
16031 !! test
16032 div with unquoted attribute
16033 !! wikitext
16034 <div id=rock>HTML rocks</div>
16035 !! html
16036 <div id="rock">HTML rocks</div>
16037
16038 !! end
16039
16040 !! test
16041 div with illegal double attributes
16042 !! wikitext
16043 <div id="a" id="b">HTML rocks</div>
16044 !! html
16045 <div id="b">HTML rocks</div>
16046
16047 !!end
16048
16049 !! test
16050 div with empty attribute value, space before equals
16051 !! options
16052 parsoid=wt2html,html2html
16053 !! wikitext
16054 <div class =>HTML rocks</div>
16055 !! html/php
16056 <div class="">HTML rocks</div>
16057
16058 !! html/parsoid
16059 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16060 !! end
16061
16062 !! test
16063 div with multiple empty attribute values
16064 !! options
16065 parsoid=wt2html,html2html
16066 !! wikitext
16067 <div id= title=>HTML rocks</div>
16068 !! html/php
16069 <div id="title.3D">HTML rocks</div>
16070
16071 !! html/parsoid
16072 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16073 !! end
16074
16075 !! test
16076 table with multiple empty attribute values
16077 !! options
16078 parsoid=wt2html,html2html
16079 !! wikitext
16080 {| title= id=
16081 | hi
16082 |}
16083 !! html/php
16084 <table title="id=">
16085 <tr>
16086 <td> hi
16087 </td></tr></table>
16088
16089 !! html/parsoid
16090 <table title="id=">
16091 <tbody><tr><td> hi</td></tr>
16092 </tbody></table>
16093 !! end
16094
16095 !! test
16096 div with braces in attribute value
16097 !! wikitext
16098 <div title="{}">Foo</div>
16099 !! html/php
16100 <div title="&#123;}">Foo</div>
16101
16102 !! html/parsoid
16103 <div title="{}">Foo</div>
16104 !! end
16105
16106 !! test
16107 div with empty attribute value, no space before equals
16108 !! options
16109 parsoid=wt2html,html2html
16110 !! wikitext
16111 <div class=>HTML rocks</div>
16112 !! html/php
16113 <div class="">HTML rocks</div>
16114
16115 !! html/parsoid
16116 <div class="">HTML rocks</div>
16117 !! end
16118
16119 !! test
16120 HTML multiple attributes correction
16121 !! wikitext
16122 <p class="error" class="awesome">Awesome!</p>
16123 !! html
16124 <p class="awesome">Awesome!</p>
16125
16126 !!end
16127
16128 !! test
16129 Table multiple attributes correction
16130 !! wikitext
16131 {|
16132 !+ class="error" class="awesome"| status
16133 |}
16134 !! html
16135 <table>
16136 <tr>
16137 <th class="awesome"> status
16138 </th></tr></table>
16139
16140 !!end
16141
16142 !! test
16143 DIV IN UPPERCASE
16144 !! wikitext
16145 <DIV ID="x">HTML ROCKS</DIV>
16146 !! html
16147 <div id="x">HTML ROCKS</div>
16148
16149 !!end
16150
16151 !! test
16152 Non-ASCII pseudo-tags are rendered as text
16153 !! wikitext
16154 <khyô>
16155 !! html
16156 <p>&lt;khyô&gt;
16157 </p>
16158 !! end
16159
16160 !! test
16161 Pseudo-tag with URL 'name' renders as url link
16162 !! wikitext
16163 <http://example.com/>
16164 !! html
16165 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16166 </p>
16167 !! end
16168
16169 !! test
16170 text with amp in the middle of nowhere
16171 !! wikitext
16172 Remember AT&T?
16173 !! html
16174 <p>Remember AT&amp;T?
16175 </p>
16176 !! end
16177
16178 !! test
16179 text with character entity: eacute
16180 !! wikitext
16181 I always thought &eacute; was a cute letter.
16182 !! html
16183 <p>I always thought &#233; was a cute letter.
16184 </p>
16185 !! html+tidy
16186 <p>I always thought é was a cute letter.</p>
16187 !! end
16188
16189 !! test
16190 text with entity-escaped character entity-like string: eacute
16191 !! wikitext
16192 I always thought &amp;eacute; was a cute letter.
16193 !! html
16194 <p>I always thought &amp;eacute; was a cute letter.
16195 </p>
16196 !! end
16197
16198 !! test
16199 text with undefined character entity: xacute
16200 !! wikitext
16201 I always thought &xacute; was a cute letter.
16202 !! html
16203 <p>I always thought &amp;xacute; was a cute letter.
16204 </p>
16205 !! end
16206
16207 !! test
16208 HTML5 tags
16209 !! wikitext
16210 <data value="5">five</data>
16211 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16212 <mark>This highlighted text</mark>
16213 !! html
16214 <p><data value="5">five</data>
16215 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16216 <mark>This highlighted text</mark>
16217 </p>
16218 !! end
16219
16220 !! test
16221 HTML tag with leading space is parsed as text
16222 !! wikitext
16223 < div>foo< /div>
16224 !! html
16225 <p>&lt; div&gt;foo&lt; /div&gt;
16226 </p>
16227 !! end
16228
16229 ###
16230 ### Nesting tests (see bug 41545, 50604, 51081)
16231 ###
16232
16233 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
16234 # Note that html2wt is considerably more difficult if we use <b> in
16235 # the test case, instead of <big>
16236 !! test
16237 Ensure that HTML adoption agency algorithm is properly implemented.
16238 !! wikitext
16239 <big>X<big>Y</big>Z</big>
16240 !! html
16241 <p><big>X<big>Y</big>Z</big>
16242 </p>
16243 !! end
16244
16245 # This was bug 41545 in the PHP parser.
16246 # Note that tidy doesn't handle this correctly.
16247 !! test
16248 Nesting of <kbd>
16249 !! wikitext
16250 <kbd>X<kbd>Y</kbd>Z</kbd>
16251 !! html
16252 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16253 </p>
16254 !! end
16255
16256 # The following cases were bug 51081 in the PHP parser.
16257 # Note that there are some other nestable tags (b, i, etc) which are
16258 # not covered; see bug 51081 for discussion.
16259
16260 # Note that tidy doesn't handle this correctly.
16261 !! test
16262 Nesting of <em>
16263 !! wikitext
16264 <em>X<em>Y</em>Z</em>
16265 !! html
16266 <p><em>X<em>Y</em>Z</em>
16267 </p>
16268 !! end
16269
16270 # Note that tidy doesn't handle this correctly.
16271 !! test
16272 Nesting of <strong>
16273 !! wikitext
16274 <strong>X<strong>Y</strong>Z</strong>
16275 !! html
16276 <p><strong>X<strong>Y</strong>Z</strong>
16277 </p>
16278 !! end
16279
16280 !! test
16281 Nesting of <q>
16282 !! wikitext
16283 <q>X<q>Y</q>Z</q>
16284 !! html+tidy
16285 <p><q>X<q>Y</q>Z</q></p>
16286 !! end
16287
16288 # Note that tidy doesn't handle this correctly.
16289 !! test
16290 Nesting of <ruby>
16291 !! wikitext
16292 <ruby>X<ruby>Y</ruby>Z</ruby>
16293 !! html
16294 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16295 </p>
16296 !! end
16297
16298 # Note that tidy doesn't handle this correctly.
16299 !! test
16300 Nesting of <bdo>
16301 !! wikitext
16302 <bdo>X<bdo>Y</bdo>Z</bdo>
16303 !! html
16304 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16305 </p>
16306 !! end
16307
16308
16309 ###
16310 ### Media links
16311 ###
16312
16313 !! test
16314 Media link
16315 !! wikitext
16316 [[Media:Foobar.jpg]]
16317 !! html
16318 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16319 </p>
16320 !! end
16321
16322 !! test
16323 Media link with text
16324 !! wikitext
16325 [[Media:Foobar.jpg|A neat file to look at]]
16326 !! html
16327 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16328 </p>
16329 !! end
16330
16331 # FIXME: this is still bad HTML tag nesting
16332 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16333 !! test
16334 Media link with nasty text
16335 !! wikitext
16336 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16337 !! html
16338 <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>
16339
16340 !! html+tidy
16341 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16342 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16343 !! end
16344
16345 !! test
16346 Media link to nonexistent file (bug 1702)
16347 !! wikitext
16348 [[Media:No such.jpg]]
16349 !! html
16350 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16351 </p>
16352 !! end
16353
16354 !! test
16355 Image link to nonexistent file (bug 1850 - good)
16356 !! wikitext
16357 [[File:No_such.jpg]]
16358 !! html/php
16359 <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>
16360 </p>
16361 !! html/parsoid
16362 <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>
16363 !! end
16364
16365 !! test
16366 :Image link to nonexistent file (bug 1850 - bad)
16367 !! wikitext
16368 [[:Image:No such.jpg]]
16369 !! html/php
16370 <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>
16371 </p>
16372 !! html/parsoid
16373 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16374 !! end
16375
16376
16377
16378 !! test
16379 Character reference normalization in link text (bug 1938)
16380 !! wikitext
16381 [[Main Page|this&that]]
16382 !! html
16383 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16384 </p>
16385 !!end
16386
16387 !! article
16388 אַ
16389 !! text
16390 Test for unicode normalization
16391
16392 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16393 !! endarticle
16394
16395 !! test
16396 (bug 19451) Links should refer to the normalized form.
16397 !! wikitext
16398 [[&#xFB2E;]]
16399 [[&#x5d0;&#x5b7;]]
16400 [[&#x5d0;ַ]]
16401 [[א&#x5b7;]]
16402 [[אַ]]
16403 !! html
16404 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16405 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16406 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16407 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16408 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16409 </p>
16410 !! end
16411
16412 !! test
16413 Empty attribute crash test (bug 2067)
16414 !! wikitext
16415 <font color="">foo</font>
16416 !! html
16417 <p><font color="">foo</font>
16418 </p>
16419 !! end
16420
16421 !! test
16422 Empty attribute crash test single-quotes (bug 2067)
16423 !! wikitext
16424 <font color=''>foo</font>
16425 !! html
16426 <p><font color="">foo</font>
16427 </p>
16428 !! end
16429
16430 !! test
16431 Attribute test: equals, then nothing
16432 !! options
16433 parsoid=wt2html,html2html
16434 !! wikitext
16435 <font color=>foo</font>
16436 !! html/php
16437 <p><font color="">foo</font>
16438 </p>
16439 !! html/parsoid
16440 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16441 !! end
16442
16443 !! test
16444 Attribute test: unquoted value
16445 !! options
16446 parsoid=wt2html,html2html
16447 !! wikitext
16448 <font color=x>foo</font>
16449 !! html/php
16450 <p><font color="x">foo</font>
16451 </p>
16452 !! html/parsoid
16453 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16454 !! end
16455
16456 !! test
16457 Attribute test: unquoted but illegal value (hash)
16458 !! wikitext
16459 <font color=#x>foo</font>
16460 !! html
16461 <p><font color="#x">foo</font>
16462 </p>
16463 !! end
16464
16465 # Parsoid does not serialize to empty attribute syntax,
16466 # so wt2wt and html2wt cases are skipped
16467 !! test
16468 Attribute test: no value (T54330)
16469 !! options
16470 parsoid=wt2html,html2html
16471 !! wikitext
16472 <font color>foo</font>
16473 !! html/php
16474 <p><font color="">foo</font>
16475 </p>
16476 !! html/parsoid
16477 <p><font color="">foo</font></p>
16478 !! end
16479
16480 !! test
16481 Bug 2095: link with three closing brackets
16482 !! wikitext
16483 [[Main Page]]]
16484 !! html/php
16485 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16486 </p>
16487 !! html/parsoid
16488 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16489 !! end
16490
16491 !! test
16492 Bug 2095: link with pipe and three closing brackets
16493 !! wikitext
16494 [[Main Page|link]]]
16495 !! html/php
16496 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16497 </p>
16498 !! html/parsoid
16499 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16500 !! end
16501
16502 !! test
16503 Bug 2095: link with pipe and three closing brackets, version 2
16504 !! wikitext
16505 [[Main Page|[http://example.com/]]]
16506 !! html/php
16507 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16508 </p>
16509 !! html/parsoid
16510 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16511 !! end
16512
16513
16514 ###
16515 ### Safety
16516 ###
16517
16518 !! article
16519 Template:Dangerous attribute
16520 !! text
16521 " onmouseover="alert(document.cookie)
16522 !! endarticle
16523
16524 !! article
16525 Template:Dangerous style attribute
16526 !! text
16527 border-size: expression(alert(document.cookie))
16528 !! endarticle
16529
16530 !! article
16531 Template:Div style
16532 !! text
16533 <div style="float: right; {{{1}}}">Magic div</div>
16534 !! endarticle
16535
16536 !! test
16537 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16538 !! wikitext
16539 <div title="{{test}}"></div>
16540 !! html
16541 <div title="This is a test template"></div>
16542
16543 !! end
16544
16545 # Parsoid has enough context to handle this case
16546 !! test
16547 Bug 2304: HTML attribute safety (dangerous template; 2309)
16548 !! wikitext
16549 <div title="{{dangerous attribute}}"></div>
16550 !! html/php
16551 <div title=""></div>
16552
16553 !! html/parsoid
16554 <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>
16555 !! end
16556
16557 !! test
16558 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16559 !! wikitext
16560 <div style="{{dangerous style attribute}}"></div>
16561 !! html
16562 <div style="/* insecure input */"></div>
16563
16564 !! end
16565
16566 !! test
16567 Bug 2304: HTML attribute safety (safe parameter; 2309)
16568 !! wikitext
16569 {{div style|width: 200px}}
16570 !! html
16571 <div style="float: right; width: 200px">Magic div</div>
16572
16573 !! end
16574
16575 !! test
16576 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16577 !! wikitext
16578 {{div style|width: expression(alert(document.cookie))}}
16579 !! html
16580 <div style="/* insecure input */">Magic div</div>
16581
16582 !! end
16583
16584 !! test
16585 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16586 !! wikitext
16587 {{div style|"><script>alert(document.cookie)</script>}}
16588 !! html
16589 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16590
16591 !! end
16592
16593 !! test
16594 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16595 !! wikitext
16596 {{div style|" ><script>alert(document.cookie)</script>}}
16597 !! html
16598 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16599
16600 !! end
16601
16602 !! test
16603 Bug 2304: HTML attribute safety (link)
16604 !! wikitext
16605 <div title="[[Main Page]]"></div>
16606 !! html
16607 <div title="&#91;&#91;Main Page]]"></div>
16608
16609 !! end
16610
16611 !! test
16612 Bug 2304: HTML attribute safety (italics)
16613 !! wikitext
16614 <div title="''foobar''"></div>
16615 !! html
16616 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16617
16618 !! end
16619
16620 !! test
16621 Bug 2304: HTML attribute safety (bold)
16622 !! wikitext
16623 <div title="'''foobar'''"></div>
16624 !! html
16625 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16626
16627 !! end
16628
16629
16630 !! test
16631 Bug 2304: HTML attribute safety (ISBN)
16632 !! wikitext
16633 <div title="ISBN 1234567890"></div>
16634 !! html
16635 <div title="&#73;SBN 1234567890"></div>
16636
16637 !! end
16638
16639 !! test
16640 Bug 2304: HTML attribute safety (RFC)
16641 !! wikitext
16642 <div title="RFC 1234"></div>
16643 !! html
16644 <div title="&#82;FC 1234"></div>
16645
16646 !! end
16647
16648 !! test
16649 Bug 2304: HTML attribute safety (PMID)
16650 !! wikitext
16651 <div title="PMID 1234567890"></div>
16652 !! html
16653 <div title="&#80;MID 1234567890"></div>
16654
16655 !! end
16656
16657 !! test
16658 Bug 2304: HTML attribute safety (web link)
16659 !! wikitext
16660 <div title="http://example.com/"></div>
16661 !! html
16662 <div title="http&#58;//example.com/"></div>
16663
16664 !! end
16665
16666 !! test
16667 Bug 2304: HTML attribute safety (named web link)
16668 !! wikitext
16669 <div title="[http://example.com/ link]"></div>
16670 !! html
16671 <div title="&#91;http&#58;//example.com/ link]"></div>
16672
16673 !! end
16674
16675 !! test
16676 Bug 3244: HTML attribute safety (extension; safe)
16677 !! wikitext
16678 <div style="<nowiki>background:blue</nowiki>"></div>
16679 !! html
16680 <div style="background:blue"></div>
16681
16682 !! end
16683
16684 !! test
16685 Bug 3244: HTML attribute safety (extension; unsafe)
16686 !! wikitext
16687 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16688 !! html
16689 <div style="/* insecure input */"></div>
16690
16691 !! end
16692
16693 # More MSIE fun discovered by Tom Gilder
16694
16695 !! test
16696 MSIE CSS safety test: spurious slash
16697 !! wikitext
16698 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16699 !! html
16700 <div style="/* insecure input */">evil</div>
16701
16702 !! end
16703
16704 !! test
16705 MSIE CSS safety test: hex code
16706 !! wikitext
16707 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16708 !! html
16709 <div style="/* insecure input */">evil</div>
16710
16711 !! end
16712
16713 !! test
16714 MSIE CSS safety test: comment in url
16715 !! wikitext
16716 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16717 !! html
16718 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16719
16720 !! end
16721
16722 !! test
16723 MSIE CSS safety test: comment in expression
16724 !! wikitext
16725 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16726 !! html
16727 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16728
16729 !! end
16730
16731 !! test
16732 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16733 !! wikitext
16734 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16735 !! html
16736 <p style="/* invalid control char */">A</p>
16737
16738 !! end
16739
16740 !! test
16741 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16742 !! wikitext
16743 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16744 <div style="top:EXPRESSION(alert())">B</div>
16745 !! html
16746 <p style="/* insecure input */">A</p>
16747 <div style="/* insecure input */">B</div>
16748
16749 !! end
16750
16751 !! test
16752 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16753 !! wikitext
16754 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16755 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16756 !! html
16757 <div style="/* insecure input */">A</div>
16758 <p style="/* insecure input */">B</p>
16759
16760 !! end
16761
16762 !! test
16763 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16764 !! wikitext
16765 <div style="background-image:url⁽javascript:alert())">A</div>
16766 <div style="background-image:url₍javascript:alert())">B</div>
16767 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16768 !! html
16769 <div style="/* insecure input */">A</div>
16770 <div style="/* insecure input */">B</div>
16771 <p style="/* insecure input */">C</p>
16772
16773 !! end
16774
16775 # FIXME: Parsoid fails to sanitize this! See T58846.
16776 !! test
16777 Opera -o-link CSS
16778 !! wikitext
16779 <div
16780 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;"
16781 style="-o-link:attr(title);-o-link-source:current">X</div>
16782 !! html
16783 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16784
16785 !! end
16786
16787 !! test
16788 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16789 !! wikitext
16790 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16791 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16792 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16793 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16794 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16795 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16796 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16797 !! html
16798 <p style="/* insecure input */">A</p>
16799 <p style="/* insecure input */">B</p>
16800 <p style="/* insecure input */">C</p>
16801 <p style="/* insecure input */">D</p>
16802 <p style="/* insecure input */">E</p>
16803 <p style="/* insecure input */">F</p>
16804 <p style="/* insecure input */">G</p>
16805
16806 !! end
16807
16808 !! test
16809 Table attribute legitimate extension
16810 !! wikitext
16811 {|
16812 !+ style="<nowiki>color:blue</nowiki>"| status
16813 |}
16814 !! html
16815 <table>
16816 <tr>
16817 <th style="color:blue"> status
16818 </th></tr></table>
16819
16820 !!end
16821
16822 !! test
16823 Table attribute safety
16824 !! wikitext
16825 {|
16826 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16827 |}
16828 !! html
16829 <table>
16830 <tr>
16831 <th style="/* insecure input */"> status
16832 </th></tr></table>
16833
16834 !! end
16835
16836 !! test
16837 CSS line continuation 1
16838 !! wikitext
16839 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16840 !! html
16841 <div style="/* insecure input */"></div>
16842
16843 !! end
16844
16845 !! test
16846 CSS line continuation 2
16847 !! wikitext
16848 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16849 !! html
16850 <div style="/* invalid control char */"></div>
16851
16852 !! end
16853
16854 !! article
16855 Template:Identity
16856 !! text
16857 {{{1}}}
16858 !! endarticle
16859
16860 !! test
16861 Expansion of multi-line templates in attribute values (bug 6255)
16862 !! wikitext
16863 <div style="background: {{identity|#00FF00}}">-</div>
16864 !! html
16865 <div style="background: #00FF00">-</div>
16866
16867 !! end
16868
16869
16870 !! test
16871 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16872 !! wikitext
16873 <div style="background:
16874 #00FF00">-</div>
16875 !! html/php
16876 <div style="background: #00FF00">-</div>
16877
16878 !! html/parsoid
16879 <div style="background:
16880 #00FF00">-</div>
16881 !! end
16882
16883 !! test
16884 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16885 !! wikitext
16886 <div style="background: &#10;#00FF00">-</div>
16887 !! html
16888 <div style="background: &#10;#00FF00">-</div>
16889
16890 !! end
16891
16892 !! test
16893 Tags which are hidden from Tidy cannot pass through the Sanitizer
16894 !! wikitext
16895 <mw:toc><script>alert();</script></mw:toc>
16896 !! html+tidy
16897 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
16898 !! end
16899
16900 ###
16901 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16902 ###
16903 !! test
16904 Parser hook: empty input
16905 !! wikitext
16906 <tag></tag>
16907 !! html/php
16908 <pre>
16909 ''
16910 array (
16911 )
16912 </pre>
16913
16914 !! html/parsoid
16915 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16916 !! end
16917
16918 ## Don't expect parsoid to rt this form.
16919 !! test
16920 Parser hook: empty input using terminated empty elements
16921 !! options
16922 parsoid=wt2html,html2html
16923 !! wikitext
16924 <tag/>
16925 !! html/php
16926 <pre>
16927 NULL
16928 array (
16929 )
16930 </pre>
16931
16932 !! html/parsoid
16933 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16934 !! end
16935
16936 !! test
16937 Parser hook: empty input using terminated empty elements (space before)
16938 !! wikitext
16939 <tag />
16940 !! html/php
16941 <pre>
16942 NULL
16943 array (
16944 )
16945 </pre>
16946
16947 !! html/parsoid
16948 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16949 !! end
16950
16951 !! test
16952 Parser hook: basic input
16953 !! wikitext
16954 <tag>input</tag>
16955 !! html/php
16956 <pre>
16957 'input'
16958 array (
16959 )
16960 </pre>
16961
16962 !! html/parsoid
16963 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16964 !! end
16965
16966 ## Don't expect parsoid to rt this form.
16967 !! test
16968 Parser hook: case insensitive
16969 !! options
16970 parsoid=wt2html,html2html
16971 !! wikitext
16972 <TAG>input</TAG>
16973 !! html/php
16974 <pre>
16975 'input'
16976 array (
16977 )
16978 </pre>
16979
16980 !! html/parsoid
16981 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16982 !! end
16983
16984 ## Don't expect parsoid to rt this form.
16985 !! test
16986 Parser hook: case insensitive, redux
16987 !! options
16988 parsoid=wt2html,html2html
16989 !! wikitext
16990 <TaG>input</TAg>
16991 !! html/php
16992 <pre>
16993 'input'
16994 array (
16995 )
16996 </pre>
16997
16998 !! html/parsoid
16999 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17000 !! end
17001
17002 !! test
17003 Parser hook: nested tags
17004 !! wikitext
17005 <tag><tag></tag></tag>
17006 !! html/php
17007 <pre>
17008 '<tag>'
17009 array (
17010 )
17011 </pre>&lt;/tag&gt;
17012
17013 !! html/parsoid
17014 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
17015 !! end
17016
17017 !! test
17018 Parser hook: basic arguments
17019 !! wikitext
17020 <tag width="200" height="100" depth="50" square=""></tag>
17021 !! html/php
17022 <pre>
17023 ''
17024 array (
17025 'width' => '200',
17026 'height' => '100',
17027 'depth' => '50',
17028 'square' => '',
17029 )
17030 </pre>
17031
17032 !! html/parsoid
17033 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17034 !! end
17035
17036 ## Don't expect parsoid to rt this form.
17037 !! test
17038 Parser hook: basic arguments, variations
17039 !! options
17040 parsoid=wt2html,html2html
17041 !! wikitext
17042 <tag width=200 height = "100" depth = '50' square></tag>
17043 !! html/php
17044 <pre>
17045 ''
17046 array (
17047 'width' => '200',
17048 'height' => '100',
17049 'depth' => '50',
17050 'square' => '',
17051 )
17052 </pre>
17053
17054 !! html/parsoid
17055 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17056 !! end
17057
17058 !! test
17059 Parser hook: argument containing a forward slash (bug 5344)
17060 !! wikitext
17061 <tag filename="/tmp/bla"></tag>
17062 !! html/php
17063 <pre>
17064 ''
17065 array (
17066 'filename' => '/tmp/bla',
17067 )
17068 </pre>
17069
17070 !! html/parsoid
17071 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17072 !! end
17073
17074 ## Don't expect parsoid to rt this form.
17075 !! test
17076 Parser hook: empty input using terminated empty elements (bug 2374)
17077 !! options
17078 parsoid=wt2html,html2html
17079 !! wikitext
17080 <tag foo=bar/>text
17081 !! html/php
17082 <pre>
17083 NULL
17084 array (
17085 'foo' => 'bar',
17086 )
17087 </pre>text
17088
17089 !! html/parsoid
17090 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
17091 !! end
17092
17093 ## </tag> should be output literally since there is no matching tag that begins it
17094 ## Don't expect parsoid to rt this form.
17095 !! test
17096 Parser hook: basic arguments using terminated empty elements (bug 2374)
17097 !! options
17098 parsoid=wt2html
17099 !! wikitext
17100 <tag width=200 height = "100" depth = '50' square/>
17101 other stuff
17102 </tag>
17103 !! html/php
17104 <pre>
17105 NULL
17106 array (
17107 'width' => '200',
17108 'height' => '100',
17109 'depth' => '50',
17110 'square' => '',
17111 )
17112 </pre>
17113 <p>other stuff
17114 &lt;/tag&gt;
17115 </p>
17116 !! html/parsoid
17117 <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
17118 &lt;/tag></p>
17119 !! end
17120
17121 ## Don't expect parsoid to rt this form.
17122 !! test
17123 Parser hook: Don't allow unclosed extension tags
17124 !! options
17125 parsoid=wt2html
17126 !! wikitext
17127 test <tag>123
17128
17129 this is a '''test'''
17130 !! html/php
17131 <p>test &lt;tag&gt;123
17132 </p><p>this is a <b>test</b>
17133 </p>
17134 !! html/parsoid
17135 <p>test &lt;tag>123</p>
17136
17137 <p>this is a <b>test</b></p>
17138 !! end
17139
17140 ###
17141 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17142 ###
17143
17144 !! test
17145 Parser hook: static parser hook not inside a comment
17146 !! wikitext
17147 <statictag>hello, world</statictag>
17148
17149 <statictag action="flush" />
17150 !! html/php
17151 <p><br />
17152 hello, world
17153 </p>
17154 !! html/parsoid
17155 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17156 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17157 !! end
17158
17159 !! test
17160 Parser hook: static parser hook inside a comment
17161 !! wikitext
17162 <!-- <statictag>hello, world</statictag> -->
17163 <statictag action="flush" />
17164 !! html/php
17165 <p><br />
17166 </p>
17167 !! html/parsoid
17168 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17169 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17170 !! end
17171
17172 # Nested template calls; this case was broken by Parser.php rev 1.506,
17173 # since reverted.
17174
17175 !! article
17176 Template:One-parameter
17177 !! text
17178 (My parameter is: {{{1}}})
17179 !! endarticle
17180
17181 !! article
17182 Template:Map-one-parameter
17183 !! text
17184 {{{{{1}}}|{{{2}}}}}
17185 !! endarticle
17186
17187 !! test
17188 Nested template calls
17189 !! wikitext
17190 {{Map-one-parameter|One-parameter|param}}
17191 !! html
17192 <p>(My parameter is: param)
17193 </p>
17194 !! end
17195
17196
17197 ###
17198 ### Sanitizer
17199 ###
17200
17201 # HTML+Tidy effectively strips out the empty tags completely
17202 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17203 # which Tidy would have done for the PHP parser had there been content inside it.
17204 !! test
17205 Sanitizer: Closing of open tags
17206 !! wikitext
17207 <s></s><table></table>
17208 !! html
17209 <s></s><table></table>
17210
17211 !! html/parsoid
17212 <p><s></s></p><table></table>
17213 !! end
17214
17215 !! test
17216 Sanitizer: Closing of open but not closed tags
17217 !! wikitext
17218 <s>foo
17219 !! html
17220 <p><s>foo</s>
17221 </p>
17222 !! end
17223
17224 !! test
17225 Sanitizer: Closing of closed but not open tags
17226 !! options
17227 parsoid=wt2html
17228 !! wikitext
17229 </s>
17230 !! html/php+tidy
17231 !! html/parsoid
17232 !! end
17233
17234 !! test
17235 Sanitizer: Closing of closed but not open table tags
17236 !! options
17237 parsoid=wt2html
17238 !! wikitext
17239 Table not started</td></tr></table>
17240 !! html/php+tidy
17241 <p>Table not started</p>
17242 !! html/parsoid
17243 <p>Table not started</p>
17244 !! end
17245
17246 !! test
17247 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17248 !! wikitext
17249 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17250 !! html/php
17251 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17252 </p>
17253 !! html/parsoid
17254 <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>
17255 !! end
17256
17257 # In HTML5, the restrictions are that id must contain at least one character,
17258 # and must not contain any space characters.
17259 !! test
17260 Sanitizer: Validating the contents of the id attribute (bug 4515)
17261 !! options
17262 disabled
17263 !! wikitext
17264 <br id="" /><br id="a space" />
17265 !! html
17266 Something ...
17267 !! end
17268
17269 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17270 !! test
17271 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
17272 !! options
17273 disabled
17274 !! wikitext
17275 <br id="foo" /><br id="foo" />
17276 !! html
17277 Something need to be done. foo-2 ?
17278 !! end
17279
17280 !! test
17281 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17282 !! wikitext
17283 <div itemscope>
17284 <meta itemprop="hello" content="world">
17285 <meta http-equiv="refresh" content="5">
17286 <meta itemprop="hello" http-equiv="refresh" content="5">
17287 <link itemprop="hello" href="{{SERVER}}">
17288 <link rel="stylesheet" href="{{SERVER}}">
17289 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17290 </div>
17291 !! html
17292 <div itemscope="">
17293 <p> <meta itemprop="hello" content="world" />
17294 &lt;meta http-equiv="refresh" content="5"&gt;
17295 <meta itemprop="hello" content="5" />
17296 </p>
17297 <link itemprop="hello" href="http&#58;//example.org" />
17298 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17299 <link itemprop="hello" href="http&#58;//example.org" />
17300 </div>
17301
17302 !! end
17303
17304 !! test
17305 Language converter: output gets cut off unexpectedly (bug 5757)
17306 !! options
17307 language=zh
17308 !! wikitext
17309 this bit is safe: }-
17310
17311 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17312
17313 then we get cut off here: }-
17314
17315 all additional text is vanished
17316 !! html
17317 <p>this bit is safe: }-
17318 </p><p>but if we add a conversion instance: xxx
17319 </p><p>then we get cut off here: }-
17320 </p><p>all additional text is vanished
17321 </p>
17322 !! end
17323
17324 !! test
17325 Self closed html pairs (bug 5487)
17326 !! options
17327 !! wikitext
17328 <center><font id="bug" />Centered text</center>
17329 <div><font id="bug2" />In div text</div>
17330 !! html
17331 <center>&lt;font id="bug" /&gt;Centered text</center>
17332 <div>&lt;font id="bug2" /&gt;In div text</div>
17333
17334 !! end
17335
17336 #
17337 #
17338 #
17339
17340 !! test
17341 Punctuation: nbsp before exclamation
17342 !! wikitext
17343 C'est grave !
17344 !! html
17345 <p>C'est grave&#160;!
17346 </p>
17347 !! end
17348
17349 !! test
17350 Punctuation: CSS !important (bug 11874)
17351 !! wikitext
17352 <div style="width:50% !important">important</div>
17353 !! html
17354 <div style="width:50% !important">important</div>
17355
17356 !!end
17357
17358 !! test
17359 Punctuation: CSS ! important (bug 11874; with space after)
17360 !! wikitext
17361 <div style="width:50% ! important">important</div>
17362 !! html
17363 <div style="width:50% ! important">important</div>
17364
17365 !!end
17366
17367 !! test
17368 HTML bullet list, closed tags (bug 5497)
17369 !! wikitext
17370 <ul>
17371 <li>One</li>
17372 <li>Two</li>
17373 </ul>
17374 !! html/php
17375 <ul>
17376 <li>One</li>
17377 <li>Two</li>
17378 </ul>
17379
17380 !! html/parsoid
17381 <ul data-parsoid='{"stx":"html"}'>
17382 <li data-parsoid='{"stx":"html"}'>One</li>
17383 <li data-parsoid='{"stx":"html"}'>Two</li>
17384 </ul>
17385
17386 !! end
17387
17388 !! test
17389 HTML bullet list, unclosed tags (bug 5497)
17390 !! wikitext
17391 <ul>
17392 <li>One
17393 <li>Two
17394 </ul>
17395 !! html/php+tidy
17396 <ul>
17397 <li>One</li>
17398 <li>Two</li>
17399 </ul>
17400 !! html/parsoid
17401 <ul data-parsoid='{"stx":"html"}'>
17402 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17403 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17404 </ul>
17405
17406 !! end
17407
17408 !! test
17409 HTML ordered list, closed tags (bug 5497)
17410 !! wikitext
17411 <ol>
17412 <li>One</li>
17413 <li>Two</li>
17414 </ol>
17415 !! html/php
17416 <ol>
17417 <li>One</li>
17418 <li>Two</li>
17419 </ol>
17420
17421 !! html/parsoid
17422 <ol data-parsoid='{"stx":"html"}'>
17423 <li data-parsoid='{"stx":"html"}'>One</li>
17424 <li data-parsoid='{"stx":"html"}'>Two</li>
17425 </ol>
17426
17427 !! end
17428
17429 !! test
17430 HTML ordered list, unclosed tags (bug 5497)
17431 !! options
17432 !! wikitext
17433 <ol>
17434 <li>One
17435 <li>Two
17436 </ol>
17437 !! html/php+tidy
17438 <ol>
17439 <li>One</li>
17440 <li>Two</li>
17441 </ol>
17442 !! html/parsoid
17443 <ol data-parsoid='{"stx":"html"}'>
17444 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17445 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17446 </ol>
17447
17448 !! end
17449
17450 !! test
17451 HTML nested bullet list, closed tags (bug 5497)
17452 !! wikitext
17453 <ul>
17454 <li>One</li>
17455 <li>Two:
17456 <ul>
17457 <li>Sub-one</li>
17458 <li>Sub-two</li>
17459 </ul>
17460 </li>
17461 </ul>
17462 !! html/php
17463 <ul>
17464 <li>One</li>
17465 <li>Two:
17466 <ul>
17467 <li>Sub-one</li>
17468 <li>Sub-two</li>
17469 </ul>
17470 </li>
17471 </ul>
17472
17473 !! html/parsoid
17474 <ul data-parsoid='{"stx":"html"}'>
17475 <li data-parsoid='{"stx":"html"}'>One</li>
17476 <li data-parsoid='{"stx":"html"}'>Two:
17477 <ul data-parsoid='{"stx":"html"}'>
17478 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17479 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17480 </ul>
17481 </li>
17482 </ul>
17483 !! end
17484
17485 !! test
17486 HTML nested bullet list, open tags (bug 5497)
17487 !! wikitext
17488 <ul>
17489 <li>One
17490 <li>Two:
17491 <ul>
17492 <li>Sub-one
17493 <li>Sub-two
17494 </ul>
17495 </ul>
17496 !! html/php+tidy
17497 <ul>
17498 <li>One</li>
17499 <li>Two:
17500 <ul>
17501 <li>Sub-one</li>
17502 <li>Sub-two</li>
17503 </ul>
17504 </li>
17505 </ul>
17506 !! html/parsoid
17507 <ul>
17508 <li>One
17509 </li>
17510 <li>Two:
17511 <ul>
17512 <li>Sub-one
17513 </li>
17514 <li>Sub-two
17515 </li>
17516 </ul>
17517 </li>
17518 </ul>
17519
17520 !! end
17521
17522 !! test
17523 HTML nested ordered list, closed tags (bug 5497)
17524 !! wikitext
17525 <ol>
17526 <li>One</li>
17527 <li>Two:
17528 <ol>
17529 <li>Sub-one</li>
17530 <li>Sub-two</li>
17531 </ol>
17532 </li>
17533 </ol>
17534 !! html
17535 <ol>
17536 <li>One</li>
17537 <li>Two:
17538 <ol>
17539 <li>Sub-one</li>
17540 <li>Sub-two</li>
17541 </ol>
17542 </li>
17543 </ol>
17544
17545 !! end
17546
17547 !! test
17548 HTML nested ordered list, open tags (bug 5497)
17549 !! wikitext
17550 <ol>
17551 <li>One
17552 <li>Two:
17553 <ol>
17554 <li>Sub-one
17555 <li>Sub-two
17556 </ol>
17557 </ol>
17558 !! html/php
17559 <ol>
17560 <li>One
17561 <li>Two:
17562 <ol>
17563 <li>Sub-one
17564 <li>Sub-two
17565 </ol>
17566 </ol>
17567
17568 !! html/parsoid
17569 <ol>
17570 <li>One
17571 </li>
17572 <li>Two:
17573 <ol>
17574 <li>Sub-one
17575 </li>
17576 <li>Sub-two
17577 </li>
17578 </ol>
17579 </li>
17580 </ol>
17581
17582 !! end
17583
17584 !! test
17585 HTML ordered list item with parameters oddity
17586 !! wikitext
17587 <ol><li id="fragment">One</li>
17588 </ol>
17589 !! html
17590 <ol><li id="fragment">One</li>
17591 </ol>
17592
17593 !! end
17594
17595 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17596 !!test
17597 bug 5918: autonumbering
17598 !! wikitext
17599 [http://first/] [http://second] [ftp://ftp]
17600
17601 ftp://inlineftp
17602
17603 [mailto:enclosed@mail.tld With target]
17604
17605 [mailto:enclosed@mail.tld]
17606
17607 mailto:inline@mail.tld
17608 !! html/php
17609 <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>
17610 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17611 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17612 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17613 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17614 </p>
17615 !! html/parsoid
17616 <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>
17617 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17618 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17619 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17620 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17621 !! end
17622
17623
17624 #
17625 # Security and HTML correctness
17626 # From Nick Jenkins' fuzz testing
17627 #
17628
17629 !! test
17630 Fuzz testing: Parser13
17631 !! wikitext
17632 {|
17633 | http://a|
17634 !! html
17635 <table>
17636 <tr>
17637 <td>
17638 </td>
17639 </tr>
17640 </table>
17641
17642 !! end
17643
17644 !! test
17645 Fuzz testing: Parser14
17646 !! wikitext
17647 == onmouseover= ==
17648 http://__TOC__
17649 !! html
17650 <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>
17651 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17652 <ul>
17653 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17654 </ul>
17655 </div>
17656
17657
17658 !! html+tidy
17659 <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>
17660 <p>http://</p>
17661 <div id="toc" class="toc">
17662 <div id="toctitle">
17663 <h2>Contents</h2>
17664 </div>
17665 <ul>
17666 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17667 </ul>
17668 </div>
17669 <p></p>
17670 !! end
17671
17672 !! test
17673 Fuzz testing: Parser14-table
17674 !! options
17675 parsoid=wt2html,html2html
17676 !! wikitext
17677 ==a==
17678 {| STYLE=__TOC__
17679 !! html
17680 <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>
17681 <table style="&#95;_TOC&#95;_">
17682 <tr><td></td></tr>
17683 </table>
17684
17685 !! html+tidy
17686 <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>
17687 <table style="__TOC__">
17688 <tr>
17689 <td></td>
17690 </tr>
17691 </table>
17692 !! html/parsoid
17693 <h2>a</h2>
17694 <table style="__TOC__"></table>
17695 !! end
17696
17697 # Known to produce bogus xml (extra </td>)
17698 !! test
17699 Fuzz testing: Parser16
17700 !! wikitext
17701 {|
17702 !https://||||||
17703 !! html
17704 <table>
17705 <tr>
17706 <th>https://</th>
17707 <th></th>
17708 <th></th>
17709 <th>
17710 </td>
17711 </tr>
17712 </table>
17713
17714 !! html+tidy
17715 <table>
17716 <tr>
17717 <th>https://</th>
17718 <th></th>
17719 <th></th>
17720 <th></th>
17721 </tr>
17722 </table>
17723 !! end
17724
17725 !! test
17726 Fuzz testing: Parser21
17727 !! wikitext
17728 {|
17729 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17730 |
17731 !! html
17732 <table>
17733 <tr>
17734 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17735 </th>
17736 <td>
17737 </td>
17738 </tr>
17739 </table>
17740
17741 !! end
17742
17743 !! test
17744 Fuzz testing: Parser22
17745 !! wikitext
17746 http://===r:::https://b
17747
17748 {|
17749 !! html
17750 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17751 </p>
17752 <table>
17753 <tr><td></td></tr>
17754 </table>
17755
17756 !! end
17757
17758 # Known to produce bad XML for now
17759 !! test
17760 Fuzz testing: Parser24
17761 !! options
17762 parsoid=wt2html
17763 !! wikitext
17764 {|
17765 {{{|
17766 <u CLASS=
17767 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17768 <br style="onmouseover='alert(document.cookie);' " />
17769
17770 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17771 |
17772 !! html/php
17773 <table>
17774 {{{|
17775 <u class="&#124;">}}}} &gt;
17776 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17777
17778 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17779 <tr>
17780 <td></u>
17781 </td>
17782 </tr>
17783 </table>
17784
17785 !! html/parsoid
17786 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
17787 <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":""}]]}'>
17788 <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}'>
17789
17790
17791
17792 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
17793 !! end
17794
17795 # Note: the current result listed for this is not what the original one was,
17796 # but the original bug was JavaScript injection, which is fixed in any case.
17797 # It's not clear that the original result listed was any more correct than the
17798 # current one. Original result:
17799 # <p>{{{|
17800 # </p>
17801 # <li class="&#124;&#124;">
17802 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17803 !!test
17804 Fuzz testing: Parser25 (bug 6055)
17805 !! wikitext
17806 {{{
17807 |
17808 <LI CLASS=||
17809 >
17810 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17811 !! html/php
17812 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17813 </p>
17814 !! html/parsoid
17815 <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"]}'>
17816 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
17817 !! end
17818
17819 !!test
17820 Fuzz testing: URL adjacent extension (with space, clean)
17821 !! wikitext
17822 http://example.com <nowiki>junk</nowiki>
17823 !! html/php
17824 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17825 </p>
17826 !! html/parsoid
17827 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17828 !! end
17829
17830 !!test
17831 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17832 !! wikitext
17833 http://example.com<nowiki>junk</nowiki>
17834 !! html/php
17835 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17836 </p>
17837 !! html/parsoid
17838 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17839 !! end
17840
17841 !!test
17842 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17843 !! wikitext
17844 http://example.com<pre>junk</pre>
17845 !! html/php
17846 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17847
17848 !! html/php+tidy
17849 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17850 <pre>
17851 junk
17852 </pre>
17853 !! html/parsoid
17854 <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>
17855 !!end
17856
17857 !!test
17858 Fuzz testing: image with bogus manual thumbnail
17859 !! wikitext
17860 [[Image:foobar.jpg|thumbnail= ]]
17861 !! html/php
17862 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17863
17864 !! html/parsoid
17865 <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>
17866 !!end
17867
17868 !! test
17869 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17870 !! wikitext
17871 <pre dir="&#10;"></pre>
17872 !! html
17873 <pre dir="&#10;"></pre>
17874
17875 !! end
17876
17877 !! test
17878 Parsing optional HTML elements (Bug 6171)
17879 !! options
17880 !! wikitext
17881 <table>
17882 <tr>
17883 <td> Some tabular data</td>
17884 <td> More tabular data ...
17885 <td> And yet som tabular data</td>
17886 </tr>
17887 </table>
17888 !! html
17889 <table>
17890 <tr>
17891 <td> Some tabular data</td>
17892 <td> More tabular data ...
17893 </td><td> And yet som tabular data</td>
17894 </tr>
17895 </table>
17896
17897 !! end
17898
17899 !! test
17900 Correct handling of <td>, <tr> (Bug 6171)
17901 !! options
17902 !! wikitext
17903 <table>
17904 <tr>
17905 <td> Some tabular data</td>
17906 <td> More tabular data ...</td>
17907 <td> And yet som tabular data</td>
17908 </tr>
17909 </table>
17910 !! html
17911 <table>
17912 <tr>
17913 <td> Some tabular data</td>
17914 <td> More tabular data ...</td>
17915 <td> And yet som tabular data</td>
17916 </tr>
17917 </table>
17918
17919 !! end
17920
17921
17922 !! test
17923 Parsing crashing regression (fr:JavaScript)
17924 !! wikitext
17925 </body></x>
17926 !! html
17927 <p>&lt;/body&gt;&lt;/x&gt;
17928 </p>
17929 !! end
17930
17931 !! test
17932 Inline wiki vs wiki block nesting
17933 !! wikitext
17934 '''Bold paragraph
17935
17936 New wiki paragraph
17937 !! html
17938 <p><b>Bold paragraph</b>
17939 </p><p>New wiki paragraph
17940 </p>
17941 !! end
17942
17943 # FIXME: The current php output is documented
17944 # and desired output is the parsoid target.
17945 !! test
17946 Inline HTML vs wiki block nesting
17947 !! wikitext
17948 <b>Bold paragraph
17949
17950 New wiki paragraph
17951 !! html/php
17952 <p><b>Bold paragraph
17953 </p><p>New wiki paragraph</b>
17954 </p>
17955 !! html/parsoid
17956 <p><b>Bold paragraph</b>
17957 </p><p>New wiki paragraph
17958 </p>
17959 !! end
17960
17961 # Original result was this:
17962 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17963 # </p>
17964 # While that might be marginally more intuitive, maybe, the six-apostrophe
17965 # construct is clearly pathological and the result stated here (which is what
17966 # the parser actually does) is about as reasonable as anything.
17967 !!test
17968 Mixing markup for italics and bold
17969 !! options
17970 !! wikitext
17971 '''bold''''''bold''bolditalics'''''
17972 !! html
17973 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17974 </p>
17975 !! end
17976
17977
17978 !! article
17979 Xyzzyx
17980 !! text
17981 Article for special page transclusion test
17982 !! endarticle
17983
17984 !! test
17985 Special page transclusion
17986 !! options
17987 !! wikitext
17988 {{Special:Prefixindex/Xyzzyx}}
17989 !! html
17990 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17991 </ul>
17992
17993 !! end
17994
17995 !! test
17996 Special page transclusion twice (bug 5021)
17997 !! options
17998 !! wikitext
17999 {{Special:Prefixindex/Xyzzyx}}
18000 {{Special:Prefixindex/Xyzzyx}}
18001 !! html
18002 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18003 </ul>
18004 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18005 </ul>
18006
18007 !! end
18008
18009 !! test
18010 Transclusion of default MediaWiki message
18011 !! wikitext
18012 {{MediaWiki:Mainpage}}
18013 !! html
18014 <p>Main Page
18015 </p>
18016 !! end
18017
18018 !! test
18019 Transclusion of nonexistent MediaWiki message
18020 !! wikitext
18021 {{MediaWiki:Mainpagexxx}}
18022 !! html
18023 <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>
18024 </p>
18025 !! end
18026
18027 !! test
18028 Transclusion of MediaWiki message with underscore
18029 !! wikitext
18030 {{MediaWiki:history_short}}
18031 !! html
18032 <p>History
18033 </p>
18034 !! end
18035
18036 !! test
18037 Transclusion of MediaWiki message with space
18038 !! wikitext
18039 {{MediaWiki:history short}}
18040 !! html
18041 <p>History
18042 </p>
18043 !! end
18044
18045 !! test
18046 Invalid header with following text
18047 !! wikitext
18048 = x = y
18049 !! html
18050 <p>= x = y
18051 </p>
18052 !! end
18053
18054
18055 !! test
18056 Section extraction test (section 0)
18057 !! options
18058 section=0
18059 !! wikitext
18060 start
18061 ==a==
18062 ===aa===
18063 ====aaa====
18064 ==b==
18065 ===ba===
18066 ===bb===
18067 ====bba====
18068 ===bc===
18069 ==c==
18070 ===ca===
18071 !! html/php
18072 start
18073 !! end
18074
18075 !! test
18076 Section extraction test (section 1)
18077 !! options
18078 section=1
18079 !! wikitext
18080 start
18081 ==a==
18082 ===aa===
18083 ====aaa====
18084 ==b==
18085 ===ba===
18086 ===bb===
18087 ====bba====
18088 ===bc===
18089 ==c==
18090 ===ca===
18091 !! html/php
18092 ==a==
18093 ===aa===
18094 ====aaa====
18095 !! end
18096
18097 !! test
18098 Section extraction test (section 2)
18099 !! options
18100 section=2
18101 !! wikitext
18102 start
18103 ==a==
18104 ===aa===
18105 ====aaa====
18106 ==b==
18107 ===ba===
18108 ===bb===
18109 ====bba====
18110 ===bc===
18111 ==c==
18112 ===ca===
18113 !! html/php
18114 ===aa===
18115 ====aaa====
18116 !! end
18117
18118 !! test
18119 Section extraction test (section 3)
18120 !! options
18121 section=3
18122 !! wikitext
18123 start
18124 ==a==
18125 ===aa===
18126 ====aaa====
18127 ==b==
18128 ===ba===
18129 ===bb===
18130 ====bba====
18131 ===bc===
18132 ==c==
18133 ===ca===
18134 !! html/php
18135 ====aaa====
18136 !! end
18137
18138 !! test
18139 Section extraction test (section 4)
18140 !! options
18141 section=4
18142 !! wikitext
18143 start
18144 ==a==
18145 ===aa===
18146 ====aaa====
18147 ==b==
18148 ===ba===
18149 ===bb===
18150 ====bba====
18151 ===bc===
18152 ==c==
18153 ===ca===
18154 !! html/php
18155 ==b==
18156 ===ba===
18157 ===bb===
18158 ====bba====
18159 ===bc===
18160 !! end
18161
18162 !! test
18163 Section extraction test (section 5)
18164 !! options
18165 section=5
18166 !! wikitext
18167 start
18168 ==a==
18169 ===aa===
18170 ====aaa====
18171 ==b==
18172 ===ba===
18173 ===bb===
18174 ====bba====
18175 ===bc===
18176 ==c==
18177 ===ca===
18178 !! html/php
18179 ===ba===
18180 !! end
18181
18182 !! test
18183 Section extraction test (section 6)
18184 !! options
18185 section=6
18186 !! wikitext
18187 start
18188 ==a==
18189 ===aa===
18190 ====aaa====
18191 ==b==
18192 ===ba===
18193 ===bb===
18194 ====bba====
18195 ===bc===
18196 ==c==
18197 ===ca===
18198 !! html/php
18199 ===bb===
18200 ====bba====
18201 !! end
18202
18203 !! test
18204 Section extraction test (section 7)
18205 !! options
18206 section=7
18207 !! wikitext
18208 start
18209 ==a==
18210 ===aa===
18211 ====aaa====
18212 ==b==
18213 ===ba===
18214 ===bb===
18215 ====bba====
18216 ===bc===
18217 ==c==
18218 ===ca===
18219 !! html/php
18220 ====bba====
18221 !! end
18222
18223 !! test
18224 Section extraction test (section 8)
18225 !! options
18226 section=8
18227 !! wikitext
18228 start
18229 ==a==
18230 ===aa===
18231 ====aaa====
18232 ==b==
18233 ===ba===
18234 ===bb===
18235 ====bba====
18236 ===bc===
18237 ==c==
18238 ===ca===
18239 !! html/php
18240 ===bc===
18241 !! end
18242
18243 !! test
18244 Section extraction test (section 9)
18245 !! options
18246 section=9
18247 !! wikitext
18248 start
18249 ==a==
18250 ===aa===
18251 ====aaa====
18252 ==b==
18253 ===ba===
18254 ===bb===
18255 ====bba====
18256 ===bc===
18257 ==c==
18258 ===ca===
18259 !! html/php
18260 ==c==
18261 ===ca===
18262 !! end
18263
18264 !! test
18265 Section extraction test (section 10)
18266 !! options
18267 section=10
18268 !! wikitext
18269 start
18270 ==a==
18271 ===aa===
18272 ====aaa====
18273 ==b==
18274 ===ba===
18275 ===bb===
18276 ====bba====
18277 ===bc===
18278 ==c==
18279 ===ca===
18280 !! html/php
18281 ===ca===
18282 !! end
18283
18284 !! test
18285 Section extraction test (nonexistent section 11)
18286 !! options
18287 section=11
18288 !! wikitext
18289 start
18290 ==a==
18291 ===aa===
18292 ====aaa====
18293 ==b==
18294 ===ba===
18295 ===bb===
18296 ====bba====
18297 ===bc===
18298 ==c==
18299 ===ca===
18300 !! html/php
18301 !! end
18302
18303 !! test
18304 Section extraction test with bogus heading (section 1)
18305 !! options
18306 section=1
18307 !! wikitext
18308 ==a==
18309 ==bogus== not a legal section
18310 ==b==
18311 !! html/php
18312 ==a==
18313 ==bogus== not a legal section
18314 !! end
18315
18316 !! test
18317 Section extraction test with bogus heading (section 2)
18318 !! options
18319 section=2
18320 !! wikitext
18321 ==a==
18322 ==bogus== not a legal section
18323 ==b==
18324 !! html/php
18325 ==b==
18326 !! end
18327
18328 !! test
18329 Section extraction test with comment after heading (section 1)
18330 !! options
18331 section=1
18332 !! wikitext
18333 ==a==
18334 ==b== <!-- -->
18335 ==c==
18336 !! html/php
18337 ==a==
18338 !! end
18339
18340 !! test
18341 Section extraction test with comment after heading (section 2)
18342 !! options
18343 section=2
18344 !! wikitext
18345 ==a==
18346 ==b== <!-- -->
18347 ==c==
18348 !! html/php
18349 ==b== <!-- -->
18350 !! end
18351
18352 !! test
18353 Section extraction test with bogus <nowiki> heading (section 1)
18354 !! options
18355 section=1
18356 !! wikitext
18357 ==a==
18358 ==bogus== <nowiki>not a legal section</nowiki>
18359 ==b==
18360 !! html/php
18361 ==a==
18362 ==bogus== <nowiki>not a legal section</nowiki>
18363 !! end
18364
18365 !! test
18366 Section extraction test with bogus <nowiki> heading (section 2)
18367 !! options
18368 section=2
18369 !! wikitext
18370 ==a==
18371 ==bogus== <nowiki>not a legal section</nowiki>
18372 ==b==
18373 !! html/php
18374 ==b==
18375 !! end
18376
18377 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18378 # instead of respecting commented sections
18379 !! test
18380 Section extraction prefixed by comment (section 1)
18381 !! options
18382 section=1
18383 !! wikitext
18384 <!-- -->==sec1==
18385 ==sec2==
18386 !! html/php
18387 ==sec2==
18388 !!end
18389
18390 !! test
18391 Section extraction prefixed by comment (section 2)
18392 !! options
18393 section=2
18394 !! wikitext
18395 <!-- -->==sec1==
18396 ==sec2==
18397 !! html/php
18398
18399 !!end
18400
18401 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18402 # instead of respecting HTML-style headings
18403 !! test
18404 Section extraction, mixed wiki and html (section 1)
18405 !! options
18406 section=1
18407 !! wikitext
18408 <h2>unmarked</h2>
18409 unmarked
18410 ==1==
18411 one
18412 ==2==
18413 two
18414 !! html/php
18415 ==1==
18416 one
18417 !! end
18418
18419 !! test
18420 Section extraction, mixed wiki and html (section 2)
18421 !! options
18422 section=2
18423 !! wikitext
18424 <h2>unmarked</h2>
18425 unmarked
18426 ==1==
18427 one
18428 ==2==
18429 two
18430 !! html/php
18431 ==2==
18432 two
18433 !! end
18434
18435
18436 # Formerly testing for bug 3342
18437 !! test
18438 Section extraction, heading surrounded by <noinclude>
18439 !! options
18440 section=1
18441 !! wikitext
18442 <noinclude>==unmarked==</noinclude>
18443 ==marked==
18444 !! html/php
18445 ==marked==
18446 !!end
18447
18448 # Test behavior of bug 19910
18449 !! test
18450 Sectiion with all-equals
18451 !! options
18452 section=2
18453 !! wikitext
18454 ===
18455 The line above must have a trailing space
18456 === <!--
18457 --> <!-- -->
18458 But just in case it doesn't...
18459 !! html/php
18460 === <!--
18461 --> <!-- -->
18462 But just in case it doesn't...
18463 !! end
18464
18465 !! test
18466 Section replacement test (section 0)
18467 !! options
18468 replace=0,"xxx"
18469 !! wikitext
18470 start
18471 ==a==
18472 ===aa===
18473 ====aaa====
18474 ==b==
18475 ===ba===
18476 ===bb===
18477 ====bba====
18478 ===bc===
18479 ==c==
18480 ===ca===
18481 !! html/php
18482 xxx
18483
18484 ==a==
18485 ===aa===
18486 ====aaa====
18487 ==b==
18488 ===ba===
18489 ===bb===
18490 ====bba====
18491 ===bc===
18492 ==c==
18493 ===ca===
18494 !! end
18495
18496 !! test
18497 Section replacement test (section 1)
18498 !! options
18499 replace=1,"xxx"
18500 !! wikitext
18501 start
18502 ==a==
18503 ===aa===
18504 ====aaa====
18505 ==b==
18506 ===ba===
18507 ===bb===
18508 ====bba====
18509 ===bc===
18510 ==c==
18511 ===ca===
18512 !! html/php
18513 start
18514 xxx
18515
18516 ==b==
18517 ===ba===
18518 ===bb===
18519 ====bba====
18520 ===bc===
18521 ==c==
18522 ===ca===
18523 !! end
18524
18525 !! test
18526 Section replacement test (section 2)
18527 !! options
18528 replace=2,"xxx"
18529 !! wikitext
18530 start
18531 ==a==
18532 ===aa===
18533 ====aaa====
18534 ==b==
18535 ===ba===
18536 ===bb===
18537 ====bba====
18538 ===bc===
18539 ==c==
18540 ===ca===
18541 !! html/php
18542 start
18543 ==a==
18544 xxx
18545
18546 ==b==
18547 ===ba===
18548 ===bb===
18549 ====bba====
18550 ===bc===
18551 ==c==
18552 ===ca===
18553 !! end
18554
18555 !! test
18556 Section replacement test (section 3)
18557 !! options
18558 replace=3,"xxx"
18559 !! wikitext
18560 start
18561 ==a==
18562 ===aa===
18563 ====aaa====
18564 ==b==
18565 ===ba===
18566 ===bb===
18567 ====bba====
18568 ===bc===
18569 ==c==
18570 ===ca===
18571 !! html/php
18572 start
18573 ==a==
18574 ===aa===
18575 xxx
18576
18577 ==b==
18578 ===ba===
18579 ===bb===
18580 ====bba====
18581 ===bc===
18582 ==c==
18583 ===ca===
18584 !! end
18585
18586 !! test
18587 Section replacement test (section 4)
18588 !! options
18589 replace=4,"xxx"
18590 !! wikitext
18591 start
18592 ==a==
18593 ===aa===
18594 ====aaa====
18595 ==b==
18596 ===ba===
18597 ===bb===
18598 ====bba====
18599 ===bc===
18600 ==c==
18601 ===ca===
18602 !! html/php
18603 start
18604 ==a==
18605 ===aa===
18606 ====aaa====
18607 xxx
18608
18609 ==c==
18610 ===ca===
18611 !! end
18612
18613 !! test
18614 Section replacement test (section 5)
18615 !! options
18616 replace=5,"xxx"
18617 !! wikitext
18618 start
18619 ==a==
18620 ===aa===
18621 ====aaa====
18622 ==b==
18623 ===ba===
18624 ===bb===
18625 ====bba====
18626 ===bc===
18627 ==c==
18628 ===ca===
18629 !! html/php
18630 start
18631 ==a==
18632 ===aa===
18633 ====aaa====
18634 ==b==
18635 xxx
18636
18637 ===bb===
18638 ====bba====
18639 ===bc===
18640 ==c==
18641 ===ca===
18642 !! end
18643
18644 !! test
18645 Section replacement test (section 6)
18646 !! options
18647 replace=6,"xxx"
18648 !! wikitext
18649 start
18650 ==a==
18651 ===aa===
18652 ====aaa====
18653 ==b==
18654 ===ba===
18655 ===bb===
18656 ====bba====
18657 ===bc===
18658 ==c==
18659 ===ca===
18660 !! html/php
18661 start
18662 ==a==
18663 ===aa===
18664 ====aaa====
18665 ==b==
18666 ===ba===
18667 xxx
18668
18669 ===bc===
18670 ==c==
18671 ===ca===
18672 !! end
18673
18674 !! test
18675 Section replacement test (section 7)
18676 !! options
18677 replace=7,"xxx"
18678 !! wikitext
18679 start
18680 ==a==
18681 ===aa===
18682 ====aaa====
18683 ==b==
18684 ===ba===
18685 ===bb===
18686 ====bba====
18687 ===bc===
18688 ==c==
18689 ===ca===
18690 !! html/php
18691 start
18692 ==a==
18693 ===aa===
18694 ====aaa====
18695 ==b==
18696 ===ba===
18697 ===bb===
18698 xxx
18699
18700 ===bc===
18701 ==c==
18702 ===ca===
18703 !! end
18704
18705 !! test
18706 Section replacement test (section 8)
18707 !! options
18708 replace=8,"xxx"
18709 !! wikitext
18710 start
18711 ==a==
18712 ===aa===
18713 ====aaa====
18714 ==b==
18715 ===ba===
18716 ===bb===
18717 ====bba====
18718 ===bc===
18719 ==c==
18720 ===ca===
18721 !! html/php
18722 start
18723 ==a==
18724 ===aa===
18725 ====aaa====
18726 ==b==
18727 ===ba===
18728 ===bb===
18729 ====bba====
18730 xxx
18731
18732 ==c==
18733 ===ca===
18734 !!end
18735
18736 !! test
18737 Section replacement test (section 9)
18738 !! options
18739 replace=9,"xxx"
18740 !! wikitext
18741 start
18742 ==a==
18743 ===aa===
18744 ====aaa====
18745 ==b==
18746 ===ba===
18747 ===bb===
18748 ====bba====
18749 ===bc===
18750 ==c==
18751 ===ca===
18752 !! html/php
18753 start
18754 ==a==
18755 ===aa===
18756 ====aaa====
18757 ==b==
18758 ===ba===
18759 ===bb===
18760 ====bba====
18761 ===bc===
18762 xxx
18763 !! end
18764
18765 !! test
18766 Section replacement test (section 10)
18767 !! options
18768 replace=10,"xxx"
18769 !! wikitext
18770 start
18771 ==a==
18772 ===aa===
18773 ====aaa====
18774 ==b==
18775 ===ba===
18776 ===bb===
18777 ====bba====
18778 ===bc===
18779 ==c==
18780 ===ca===
18781 !! html/php
18782 start
18783 ==a==
18784 ===aa===
18785 ====aaa====
18786 ==b==
18787 ===ba===
18788 ===bb===
18789 ====bba====
18790 ===bc===
18791 ==c==
18792 xxx
18793 !! end
18794
18795 !! test
18796 Section replacement test with initial whitespace (bug 13728)
18797 !! options
18798 replace=2,"xxx"
18799 !! wikitext
18800 Preformatted initial line
18801 ==a==
18802 ===a===
18803 !! html/php
18804 Preformatted initial line
18805 ==a==
18806 xxx
18807 !! end
18808
18809
18810 !! test
18811 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18812 !! options
18813 section=1
18814 !! wikitext
18815 ==a==
18816 a
18817 !! html/php
18818 ==a==
18819 a
18820 !! end
18821
18822 !! test
18823 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18824 !! options
18825 section=1
18826 !! wikitext
18827 ==a==
18828 a
18829 !! html/php
18830 ==a==
18831 a
18832 !! end
18833
18834
18835 !! test
18836 Section extraction, <pre> around bogus header (bug 10309)
18837 !! options
18838 section=2
18839 !! wikitext
18840 == Section One ==
18841 <pre>
18842 =======
18843 </pre>
18844
18845 == Section Two ==
18846 stuff
18847 !! html/php
18848 == Section Two ==
18849 stuff
18850 !! end
18851
18852 !! test
18853 Section replacement, <pre> around bogus header (bug 10309)
18854 !! options
18855 replace=2,"xxx"
18856 !! wikitext
18857 == Section One ==
18858 <pre>
18859 =======
18860 </pre>
18861
18862 == Section Two ==
18863 stuff
18864 !! html/php
18865 == Section One ==
18866 <pre>
18867 =======
18868 </pre>
18869
18870 xxx
18871 !! end
18872
18873
18874 !! test
18875 Handling of &#x0A; in URLs
18876 !! wikitext
18877 ** irc://&#x0A;a
18878 !! html/php
18879 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18880
18881 !! html/parsoid
18882 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18883 a">irc://
18884 a</a></li></ul></li></ul>
18885 !! end
18886
18887 !! test
18888 Handling of %0A in URLs
18889 !! wikitext
18890 ** irc://%0Aa
18891 !! html/php
18892 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18893
18894 !! html/parsoid
18895 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18896 !! end
18897
18898
18899 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18900 !! test
18901 5 quotes, code coverage +1 line
18902 !! options
18903 parsoid=wt2html
18904 !! wikitext
18905 '''''
18906 !! html/php
18907 !! html/parsoid
18908 <p><b><i></i></b></p>
18909 !! end
18910
18911 # same html as previous, but wikitext adjusted to match parsoid html2wt
18912 # note that wt2html and html2html will put the <i> before the <b>
18913 !! test
18914 5 quotes, code coverage +1 line w/ nowiki (1)
18915 !! options
18916 parsoid=wt2wt,html2wt
18917 !! wikitext
18918 '''''<nowiki/>'''''
18919 !! html/php
18920 <p><i></i>
18921 </p>
18922 !! html/parsoid
18923 <p><b><i></i></b></p>
18924 !! end
18925
18926 # same as previous, just swapping the <i> and <b>
18927 !! test
18928 5 quotes, code coverage +1 line w/ nowiki (2)
18929 !! wikitext
18930 '''''<nowiki/>'''''
18931 !! html/php
18932 <p><i></i>
18933 </p>
18934 !! html/parsoid
18935 <p><i><b></b></i></p>
18936 !! end
18937
18938 !! test
18939 Special:Search page linking.
18940 !! wikitext
18941 {{Special:search}}
18942 !! html
18943 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18944 </p>
18945 !! end
18946
18947 !! test
18948 {{!}} is a magic word
18949 !! wikitext
18950 {{!}} is a magic word there and {{!}} is still a magic word here
18951 | is not a magic word here but {{!}} is still a magic word here
18952 !! html/php
18953 <p>| is a magic word there and | is still a magic word here
18954 | is not a magic word here but | is still a magic word here
18955 </p>
18956 !! html/parsoid
18957 <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
18958 | 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>
18959
18960 !! end
18961
18962 !! test
18963 Say the magic word
18964 !! options
18965 title=[[Parser test]]
18966 !! wikitext
18967 * {{PAGENAME}}
18968 * {{PAGENAMEE}}
18969 * {{FULLPAGENAME}}
18970 * {{FULLPAGENAMEE}}
18971 * {{BASEPAGENAME}}
18972 * {{BASEPAGENAMEE}}
18973 * {{SUBPAGENAME}}
18974 * {{SUBPAGENAMEE}}
18975 * {{ROOTPAGENAME}}
18976 * {{ROOTPAGENAMEE}}
18977 * {{TALKPAGENAME}}
18978 * {{TALKPAGENAMEE}}
18979 * {{SUBJECTPAGENAME}}
18980 * {{SUBJECTPAGENAMEE}}
18981 * {{NAMESPACEE}}
18982 * {{NAMESPACE}}
18983 * {{NAMESPACENUMBER}}
18984 * {{TALKSPACE}}
18985 * {{TALKSPACEE}}
18986 * {{SUBJECTSPACE}}
18987 * {{SUBJECTSPACEE}}
18988 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18989 !! html
18990 <ul><li> Parser test</li>
18991 <li> Parser_test</li>
18992 <li> Parser test</li>
18993 <li> Parser_test</li>
18994 <li> Parser test</li>
18995 <li> Parser_test</li>
18996 <li> Parser test</li>
18997 <li> Parser_test</li>
18998 <li> Parser test</li>
18999 <li> Parser_test</li>
19000 <li> Talk:Parser test</li>
19001 <li> Talk:Parser_test</li>
19002 <li> Parser test</li>
19003 <li> Parser_test</li>
19004 <li> </li>
19005 <li> </li>
19006 <li> 0</li>
19007 <li> Talk</li>
19008 <li> Talk</li>
19009 <li> </li>
19010 <li> </li>
19011 <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>
19012
19013 !! end
19014 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
19015
19016 ## Parsoid thinks the "centre" here is a property, not a caption.
19017 !! test
19018 Gallery
19019 !! options
19020 parsoid={
19021 "modes": ["wt2html"],
19022 "nativeGallery": true
19023 }
19024 !! wikitext
19025 <gallery>
19026 image1.png |
19027 image2.gif|||||
19028
19029 image3|
19030 image4 |300px| centre
19031 image5.svg| http://///////
19032 [[x|xx]]]]
19033 * image6
19034 </gallery>
19035 !! html/php
19036 <ul class="gallery mw-gallery-traditional">
19037 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19038 <div class="thumb" style="height: 150px;">Image1.png</div>
19039 <div class="gallerytext">
19040 </div>
19041 </div></li>
19042 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19043 <div class="thumb" style="height: 150px;">Image2.gif</div>
19044 <div class="gallerytext">
19045 </div>
19046 </div></li>
19047 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19048 <div class="thumb" style="height: 150px;">Image3</div>
19049 <div class="gallerytext">
19050 </div>
19051 </div></li>
19052 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19053 <div class="thumb" style="height: 150px;">Image4</div>
19054 <div class="gallerytext">
19055 <pre>centre
19056 </pre>
19057 </div>
19058 </div></li>
19059 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19060 <div class="thumb" style="height: 150px;">Image5.svg</div>
19061 <div class="gallerytext">
19062 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
19063 </p>
19064 </div>
19065 </div></li>
19066 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19067 <div class="thumb" style="height: 150px;">* image6</div>
19068 <div class="gallerytext">
19069 </div>
19070 </div></li>
19071 </ul>
19072
19073 !! html/parsoid
19074 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19075 <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>
19076 <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>
19077 <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>
19078 <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>
19079 <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>
19080 <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>
19081 </ul>
19082 !! end
19083
19084 !! test
19085 Gallery (with options, html)
19086 !! options
19087 parsoid={
19088 "modes": ["wt2html", "html2html"],
19089 "nativeGallery": true
19090 }
19091 !! wikitext
19092 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19093 File:Nonexistent.jpg|caption
19094 File:Nonexistent.jpg
19095 image:foobar.jpg|some '''caption''' [[Main Page]]
19096 image:foobar.jpg
19097 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19098 </gallery>
19099 !! html/php
19100 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19101 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19102 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19103 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19104 <div class="gallerytext">
19105 <p>caption
19106 </p>
19107 </div>
19108 </div></li>
19109 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19110 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19111 <div class="gallerytext">
19112 </div>
19113 </div></li>
19114 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19115 <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>
19116 <div class="gallerytext">
19117 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19118 </p>
19119 </div>
19120 </div></li>
19121 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19122 <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>
19123 <div class="gallerytext">
19124 </div>
19125 </div></li>
19126 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19127 <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>
19128 <div class="gallerytext">
19129 <p>blabla.
19130 </p>
19131 </div>
19132 </div></li>
19133 </ul>
19134
19135 !! html/parsoid
19136 <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":{}}'>
19137 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19138 <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>
19139 <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>
19140 <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>
19141 <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>
19142 <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>
19143 </ul>
19144 !! end
19145
19146 !! test
19147 Gallery (with options, extsrc)
19148 !! options
19149 parsoid={
19150 "nativeGallery": false
19151 }
19152 !! wikitext
19153 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19154 File:Nonexistent.jpg|caption
19155 File:Nonexistent.jpg
19156 image:foobar.jpg|some '''caption''' [[Main Page]]
19157 image:foobar.jpg
19158 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19159 </gallery>
19160 !! html/php
19161 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19162 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19163 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19164 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19165 <div class="gallerytext">
19166 <p>caption
19167 </p>
19168 </div>
19169 </div></li>
19170 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19171 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19172 <div class="gallerytext">
19173 </div>
19174 </div></li>
19175 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19176 <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>
19177 <div class="gallerytext">
19178 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19179 </p>
19180 </div>
19181 </div></li>
19182 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19183 <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>
19184 <div class="gallerytext">
19185 </div>
19186 </div></li>
19187 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19188 <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>
19189 <div class="gallerytext">
19190 <p>blabla.
19191 </p>
19192 </div>
19193 </div></li>
19194 </ul>
19195
19196 !! html/parsoid
19197 <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"}}'>
19198 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19199 <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>
19200 <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>
19201 <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>
19202 <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>
19203 <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>
19204 </ul>
19205 !! end
19206
19207 !! test
19208 Gallery with link that has fragment
19209 !! options
19210 parsoid={
19211 "modes": ["wt2html", "html2html"],
19212 "nativeGallery": true
19213 }
19214 !! wikitext
19215 <gallery>
19216 image:foobar.jpg|link=Main_Page
19217 image:foobar.jpg|link=Main_Page#section
19218 image:foobar.jpg|link=Main Page#section|caption
19219 </gallery>
19220 !! html/php
19221 <ul class="gallery mw-gallery-traditional">
19222 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19223 <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>
19224 <div class="gallerytext">
19225 </div>
19226 </div></li>
19227 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19228 <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>
19229 <div class="gallerytext">
19230 </div>
19231 </div></li>
19232 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19233 <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>
19234 <div class="gallerytext">
19235 <p>caption
19236 </p>
19237 </div>
19238 </div></li>
19239 </ul>
19240
19241 !! html/parsoid
19242 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19243 <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>
19244 <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>
19245 <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>
19246 </ul>
19247 !! end
19248
19249 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19250 !! test
19251 Gallery with template inside caption
19252 !! options
19253 parsoid={
19254 "nativeGallery": true
19255 }
19256 !! wikitext
19257 <gallery caption="{{echo|hi}}">
19258 File:Foobar.jpg|{{echo|ho}}
19259 </gallery>
19260 !! html/php
19261 <ul class="gallery mw-gallery-traditional">
19262 <li class='gallerycaption'>{{echo|hi}}</li>
19263 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19264 <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>
19265 <div class="gallerytext">
19266 <p>ho
19267 </p>
19268 </div>
19269 </div></li>
19270 </ul>
19271
19272 !! html/parsoid
19273 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19274 <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>
19275 <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>
19276 </ul>
19277 !! end
19278
19279 !! test
19280 Gallery with wikitext inside caption
19281 !! options
19282 parsoid={
19283 "nativeGallery": true
19284 }
19285 !! wikitext
19286 <gallery>
19287 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19288 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19289 </gallery>
19290 !! html/php
19291 <ul class="gallery mw-gallery-traditional">
19292 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19293 <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>
19294 <div class="gallerytext">
19295 <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>
19296 </p>
19297 </div>
19298 </div></li>
19299 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19300 <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>
19301 <div class="gallerytext">
19302 <p>This is a test template
19303 </p>
19304 </div>
19305 </div></li>
19306 </ul>
19307
19308 !! html/parsoid
19309 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19310 <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>
19311 <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>
19312 </ul>
19313 !! end
19314
19315 !! test
19316 Gallery (with showfilename option)
19317 !! options
19318 parsoid={
19319 "nativeGallery": true
19320 }
19321 !! wikitext
19322 <gallery showfilename="">
19323 File:Nonexistent.jpg|caption
19324 File:Nonexistent.jpg
19325 File:Foobar.jpg|some '''caption''' [[Main Page]]
19326 File:Foobar.jpg
19327 </gallery>
19328 !! html/php
19329 <ul class="gallery mw-gallery-traditional">
19330 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19331 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19332 <div class="gallerytext">
19333 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19334 caption
19335 </p>
19336 </div>
19337 </div></li>
19338 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19339 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19340 <div class="gallerytext">
19341 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19342 </p>
19343 </div>
19344 </div></li>
19345 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19346 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
19347 <div class="gallerytext">
19348 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19349 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19350 </p>
19351 </div>
19352 </div></li>
19353 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19354 <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>
19355 <div class="gallerytext">
19356 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19357 </p>
19358 </div>
19359 </div></li>
19360 </ul>
19361
19362 !! html/parsoid
19363 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
19364 <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>
19365 <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>
19366 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./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>
19367 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./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>
19368 </ul>
19369 !! end
19370
19371 ## Should Parsoid be preserving these variations?
19372 !! test
19373 Gallery (with namespace-less filenames)
19374 !! options
19375 parsoid={
19376 "modes": ["wt2html", "html2html"],
19377 "nativeGallery": true
19378 }
19379 !! wikitext
19380 <gallery>
19381 File:Nonexistent.jpg
19382 Nonexistent.jpg
19383 image:foobar.jpg
19384 foobar.jpg
19385 </gallery>
19386 !! html/php
19387 <ul class="gallery mw-gallery-traditional">
19388 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19389 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19390 <div class="gallerytext">
19391 </div>
19392 </div></li>
19393 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19394 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19395 <div class="gallerytext">
19396 </div>
19397 </div></li>
19398 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19399 <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>
19400 <div class="gallerytext">
19401 </div>
19402 </div></li>
19403 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19404 <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>
19405 <div class="gallerytext">
19406 </div>
19407 </div></li>
19408 </ul>
19409
19410 !! html/parsoid
19411 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19412 <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>
19413 <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>
19414 <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>
19415 <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>
19416 </ul>
19417 !! end
19418
19419 !! test
19420 Gallery override link with WikiLink (T36852)
19421 !! options
19422 parsoid={
19423 "nativeGallery": true
19424 }
19425 !! wikitext
19426 <gallery>
19427 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
19428 </gallery>
19429 !! html/php
19430 <ul class="gallery mw-gallery-traditional">
19431 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19432 <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>
19433 <div class="gallerytext">
19434 </div>
19435 </div></li>
19436 </ul>
19437
19438 !! html/parsoid
19439 <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":{}}'>
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 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>
19441 </ul>
19442 !! end
19443
19444 !! test
19445 Gallery override link with absolute external link (T36852)
19446 !! options
19447 parsoid={
19448 "nativeGallery": true
19449 }
19450 !! wikitext
19451 <gallery>
19452 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
19453 </gallery>
19454 !! html/php
19455 <ul class="gallery mw-gallery-traditional">
19456 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19457 <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>
19458 <div class="gallerytext">
19459 </div>
19460 </div></li>
19461 </ul>
19462
19463 !! html/parsoid
19464 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19465 <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>
19466 </ul>
19467 !! end
19468
19469 !! test
19470 Gallery override link with malicious javascript (T36852)
19471 !! options
19472 parsoid={
19473 "modes": ["wt2html", "html2html"],
19474 "nativeGallery": true
19475 }
19476 !! wikitext
19477 <gallery>
19478 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19479 </gallery>
19480 !! html/php
19481 <ul class="gallery mw-gallery-traditional">
19482 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19483 <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>
19484 <div class="gallerytext">
19485 </div>
19486 </div></li>
19487 </ul>
19488
19489 !! html/parsoid
19490 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
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="./&quot;_onclick=&quot;alert('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>
19492 </ul>
19493 !! end
19494
19495 !! test
19496 Gallery with invalid title as link (T45964)
19497 !! options
19498 parsoid={
19499 "modes": ["wt2html", "html2html"],
19500 "nativeGallery": true
19501 }
19502 !! wikitext
19503 <gallery>
19504 File:Foobar.jpg|link=<
19505 </gallery>
19506 !! html/php
19507 <ul class="gallery mw-gallery-traditional">
19508 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19509 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
19510 <div class="gallerytext">
19511 </div>
19512 </div></li>
19513 </ul>
19514
19515 !! html/parsoid
19516 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19517 <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>
19518 </ul>
19519 !! end
19520
19521 !! test
19522 HTML Hex character encoding (spells the word "JavaScript")
19523 !! options
19524 parsoid=wt2html,wt2wt,html2html
19525 !! wikitext
19526 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19527 !! html/php
19528 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19529 </p>
19530 !! html/php+tidy
19531 <p>JavaScript</p>
19532 !! html/parsoid
19533 <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>
19534 !! end
19535
19536 !! test
19537 HTML Hex character encoding bogus encoding (bug 26437 regression check)
19538 !! wikitext
19539 &#xsee;&#XSEE;
19540 !! html/php
19541 <p>&amp;#xsee;&amp;#XSEE;
19542 </p>
19543 !! html/parsoid
19544 <p>&amp;#xsee;&amp;#XSEE;</p>
19545 !! end
19546
19547 !! test
19548 HTML Hex character encoding mixed case
19549 !! options
19550 parsoid=wt2html,wt2wt,html2html
19551 !! wikitext
19552 &#xEE;&#Xee;
19553 !! html/php
19554 <p>&#xee;&#xee;
19555 </p>
19556 !! html/php+tidy
19557 <p>îî</p>
19558 !! html/parsoid
19559 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19560 !! end
19561
19562 # See: https://www.w3.org/TR/html5/syntax.html#character-references
19563 # Note that U+000C (form feed) is not a valid XML character, so
19564 # it is banned even though allowed in HTML5.
19565 !! test
19566 Illegal character references (T106578)
19567 !! wikitext
19568 ; Null: &#00;
19569 ; FF: &#xC;
19570 ; CR: &#xD;
19571 ; Control (low): &#8;
19572 ; Control (high): &#x7F; &#x9F;
19573 ; Surrogate: &#xD83D;&#xDCA9;
19574 ; This is an okay astral character: &#x1F4A9;
19575 !! html+tidy
19576 <dl>
19577 <dt>Null</dt>
19578 <dd>&amp;#00;</dd>
19579 <dt>FF</dt>
19580 <dd>&amp;#xC;</dd>
19581 <dt>CR</dt>
19582 <dd>&amp;#xD;</dd>
19583 <dt>Control (low)</dt>
19584 <dd>&amp;#8;</dd>
19585 <dt>Control (high)</dt>
19586 <dd>&amp;#x7F; &amp;#x9F;</dd>
19587 <dt>Surrogate</dt>
19588 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19589 <dt>This is an okay astral character</dt>
19590 <dd>💩</dd>
19591 </dl>
19592 !! end
19593
19594 !! test
19595 __FORCETOC__ override
19596 !! wikitext
19597 __NEWSECTIONLINK__
19598 __FORCETOC__
19599 !! html/php
19600 <p><br />
19601 </p>
19602 !! end
19603
19604 !! test
19605 ISBN code coverage
19606 !! wikitext
19607 ISBN 978-0-1234-56&#x20;789
19608 !! html
19609 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19610 </p>
19611 !! html+tidy
19612 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19613 !! html/parsoid
19614 <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>
19615 !! end
19616
19617 !! test
19618 ISBN followed by 5 spaces
19619 !! wikitext
19620 ISBN
19621 !! html
19622 <p>ISBN
19623 </p>
19624 !! end
19625
19626 !! test
19627 Double ISBN
19628 !! wikitext
19629 ISBN ISBN 1234567890
19630 !! html/php
19631 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19632 </p>
19633 !! html/parsoid
19634 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19635 !! end
19636
19637 # Uppercase X and lowercase x as well
19638 !! test
19639 ISBN with an X
19640 !! wikitext
19641 ISBN 3-462-04561-X
19642 ISBN 3-462-04561-x
19643 ISBN 080442957X
19644 ISBN 080442957x
19645 ISBN 978080442957X
19646 ISBN 978080442957x
19647 !! html/php
19648 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19649 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19650 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19651 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19652 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19653 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19654 </p>
19655 !! html/parsoid
19656 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19657 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19658 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19659 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19660 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19661 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19662 !! end
19663
19664 !! test
19665 ISBN with empty prefix (parsoid test)
19666 !! wikitext
19667 ISBN 1234567890
19668 !! html/php
19669 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19670 </p>
19671 !! html/parsoid
19672 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19673 !! end
19674
19675 !! test
19676 Bug 22905: <abbr> followed by ISBN followed by </a>
19677 !! wikitext
19678 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19679 !! html/php
19680 <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>
19681 </p>
19682 !! html/parsoid
19683 <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>
19684 !! end
19685
19686 !! test
19687 Double RFC
19688 !! wikitext
19689 RFC RFC 1234
19690 !! html
19691 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19692 </p>
19693 !! end
19694
19695 !! test
19696 Double RFC with a wiki link
19697 !! wikitext
19698 RFC [[RFC 1234]]
19699 !! html
19700 <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>
19701 </p>
19702 !! end
19703
19704 !! test
19705 RFC code coverage
19706 !! wikitext
19707 RFC 983&#x20;987
19708 !! html
19709 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19710 </p>
19711 !! html+tidy
19712 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19713 !! end
19714
19715 !! test
19716 Centre-aligned image
19717 !! wikitext
19718 [[Image:foobar.jpg|centre]]
19719 !! html
19720 <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>
19721
19722 !!end
19723
19724 !! test
19725 None-aligned image
19726 !! wikitext
19727 [[Image:foobar.jpg|none]]
19728 !! html
19729 <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>
19730
19731 !!end
19732
19733 !! test
19734 Width + Height sized image (using px) (height is ignored)
19735 !! wikitext
19736 [[Image:foobar.jpg|640x480px]]
19737 !! html
19738 <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>
19739 </p>
19740 !!end
19741
19742 !! test
19743 Width-sized image (using px, no following whitespace)
19744 !! wikitext
19745 [[Image:foobar.jpg|640px]]
19746 !! html
19747 <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>
19748 </p>
19749 !!end
19750
19751 !! test
19752 Width-sized image (using px, with following whitespace - test regression from r39467)
19753 !! wikitext
19754 [[Image:foobar.jpg|640px ]]
19755 !! html
19756 <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>
19757 </p>
19758 !!end
19759
19760 !! test
19761 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19762 !! wikitext
19763 [[Image:foobar.jpg| 640px]]
19764 !! html
19765 <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>
19766 </p>
19767 !!end
19768
19769 !! test
19770 Image with page parameter
19771 !! options
19772 djvu
19773 !! wikitext
19774 [[File:LoremIpsum.djvu|page=2]]
19775 !! html/php
19776 <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>
19777 </p>
19778 !! html/parsoid
19779 <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>
19780 !! end
19781
19782 !! test
19783 Another italics / bold test
19784 !! wikitext
19785 ''' ''x'
19786 !! html
19787 <pre>'<i> </i>x'
19788 </pre>
19789 !!end
19790
19791 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19792 !! test
19793 dt/dd/dl test
19794 !! wikitext
19795 :;;;::
19796 !! html/php
19797 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19798
19799 !! html/parsoid
19800 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19801
19802 !!end
19803
19804
19805 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19806 !! test
19807 Images with the "|" character in the comment
19808 !! wikitext
19809 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19810 !! html/php
19811 <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>
19812
19813 !! html/parsoid
19814 <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=|left|&amp;param2=|x">external</a> URL</figcaption></figure>
19815 !! end
19816
19817 !! test
19818 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19819 !! wikitext
19820 <html><script>alert(1);</script></html>
19821 !! html
19822 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19823 </p>
19824 !! end
19825
19826 !! test
19827 HTML with raw HTML ($wgRawHtml==true)
19828 !! options
19829 wgRawHtml=1
19830 !! wikitext
19831 <html><script>alert(1);</script></html>
19832 !! html
19833 <p><script>alert(1);</script>
19834 </p>
19835 !! end
19836
19837 !! test
19838 Parents of subpages, one level up
19839 !! options
19840 subpage title=[[Subpage test/L1/L2/L3]]
19841 !! wikitext
19842 [[../|L2]]
19843 !! html
19844 <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>
19845 </p>
19846 !! end
19847
19848
19849 !! test
19850 Parents of subpages, one level up, not named
19851 !! options
19852 subpage title=[[Subpage test/L1/L2/L3]]
19853 !! wikitext
19854 [[../]]
19855 !! html
19856 <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>
19857 </p>
19858 !! end
19859
19860
19861
19862 !! test
19863 Parents of subpages, two levels up
19864 !! options
19865 subpage title=[[Subpage test/L1/L2/L3]]
19866 !! wikitext
19867 [[../../|L1]]2
19868
19869 [[../../|L1]]l
19870 !! html
19871 <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
19872 </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>
19873 </p>
19874 !! end
19875
19876 !! test
19877 Parents of subpages, two levels up, without trailing slash or name.
19878 !! options
19879 subpage title=[[Subpage test/L1/L2/L3]]
19880 !! wikitext
19881 [[../..]]
19882 !! html
19883 <p>[[../..]]
19884 </p>
19885 !! end
19886
19887 !! test
19888 Parents of subpages, two levels up, with lots of extra trailing slashes.
19889 !! options
19890 subpage title=[[Subpage test/L1/L2/L3]]
19891 !! wikitext
19892 [[../../////]]
19893 !! html
19894 <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>
19895 </p>
19896 !! end
19897
19898 !! article
19899 Subpage test/L1/L2/L3Sibling
19900 !! text
19901 Sibling article
19902 !! endarticle
19903
19904 !! test
19905 Transclusion of a sibling page (one level up)
19906 !! options
19907 subpage title=[[Subpage test/L1/L2/L3]]
19908 !! wikitext
19909 {{../L3Sibling}}
19910 !! html
19911 <p>Sibling article
19912 </p>
19913 !! end
19914
19915 !! test
19916 Transclusion of a child page
19917 !! options
19918 subpage title=[[Subpage test/L1/L2]]
19919 !! wikitext
19920 {{/L3Sibling}}
19921 !! html
19922 <p>Sibling article
19923 </p>
19924 !! end
19925
19926 # This is wt2html only in Parsoid because we add <nowiki>
19927 # because of {{..}} and we don't expect to fix that to
19928 # eliminate the nowikis selective for {{..}} markup.
19929 !! test
19930 Non-transclusion because of too many up levels
19931 !! options
19932 subpage title=[[Subpage test/L1/L2/L3]]
19933 parsoid=wt2html
19934 !! wikitext
19935 {{../../../../More than parent}}
19936 !! html/php
19937 <p>{{../../../../More than parent}}
19938 </p>
19939 !! html/parsoid
19940 <p>{{../../../../More than parent}}</p>
19941 !! end
19942
19943 !! test
19944 Definition list code coverage
19945 !! wikitext
19946 ; title : def
19947 ; title : def
19948 ;title: def
19949 !! html/php
19950 <dl><dt> title &#160;</dt>
19951 <dd> def</dd>
19952 <dt> title&#160;</dt>
19953 <dd> def</dd>
19954 <dt>title</dt>
19955 <dd> def</dd></dl>
19956
19957 !! html/parsoid
19958 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19959 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19960 <dt>title</dt><dd> def</dd></dl>
19961 !! end
19962
19963 !! test
19964 Don't fall for the self-closing div
19965 !! wikitext
19966 <div>hello world</div/>
19967 !! html
19968 <div>hello world</div>
19969
19970 !! end
19971
19972 !! test
19973 MSGNW magic word
19974 !! wikitext
19975 {{MSGNW:msg}}
19976 !! html/php
19977 <p>&#91;&#91;:Template:Msg&#93;&#93;
19978 </p>
19979 !! end
19980
19981 !! test
19982 RAW magic word
19983 !! wikitext
19984 {{RAW:QUERTY}}
19985 !! html
19986 <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>
19987 </p>
19988 !! end
19989
19990 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19991 !! test
19992 Always escape literal '>' in output, not just after '<'
19993 !! wikitext
19994 ><>
19995 !! html
19996 <p>&gt;&lt;&gt;
19997 </p>
19998 !! end
19999
20000 !! test
20001 Template caching
20002 !! wikitext
20003 {{Test}}
20004 {{Test}}
20005 !! html
20006 <p>This is a test template
20007 This is a test template
20008 </p>
20009 !! end
20010
20011
20012 !! article
20013 MediaWiki:Fake
20014 !! text
20015 ==header==
20016 !! endarticle
20017
20018 !! test
20019 Inclusion of !userCanEdit() content
20020 !! wikitext
20021 {{MediaWiki:Fake}}
20022 !! html
20023 <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>
20024
20025 !! end
20026
20027
20028 !! test
20029 Out-of-order TOC heading levels
20030 !! wikitext
20031 ==2==
20032 ======6======
20033 ===3===
20034 =1=
20035 =====5=====
20036 ==2==
20037 !! html
20038 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20039 <ul>
20040 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
20041 <ul>
20042 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
20043 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
20044 </ul>
20045 </li>
20046 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
20047 <ul>
20048 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
20049 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
20050 </ul>
20051 </li>
20052 </ul>
20053 </div>
20054
20055 <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>
20056 <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>
20057 <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>
20058 <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>
20059 <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>
20060 <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>
20061
20062 !! end
20063
20064
20065 !! test
20066 ISBN with a dummy number
20067 !! wikitext
20068 ISBN ---
20069 !! html
20070 <p>ISBN ---
20071 </p>
20072 !! end
20073
20074
20075 !! test
20076 ISBN with space-delimited number
20077 !! wikitext
20078 ISBN 92 9017 032 8
20079 !! html
20080 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
20081 </p>
20082 !! end
20083
20084
20085 !! test
20086 ISBN with multiple spaces, no number
20087 !! wikitext
20088 ISBN foo
20089 !! html
20090 <p>ISBN foo
20091 </p>
20092 !! end
20093
20094
20095 !! test
20096 ISBN length
20097 !! wikitext
20098 ISBN 123456789
20099
20100 ISBN 1234567890
20101
20102 ISBN 12345678901
20103 !! html
20104 <p>ISBN 123456789
20105 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20106 </p><p>ISBN 12345678901
20107 </p>
20108 !! end
20109
20110
20111 !! test
20112 ISBN with trailing year (bug 8110)
20113 !! wikitext
20114 ISBN 1-234-56789-0 - 2006
20115
20116 ISBN 1 234 56789 0 - 2006
20117 !! html
20118 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
20119 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20120 </p>
20121 !! end
20122
20123
20124 !! test
20125 anchorencode
20126 !! wikitext
20127 {{anchorencode:foo bar©#%n}}
20128 !! html
20129 <p>foo_bar.C2.A9.23.25n
20130 </p>
20131 !! end
20132
20133 !! test
20134 anchorencode trims spaces
20135 !! wikitext
20136 {{anchorencode: __pretty__please__}}
20137 !! html
20138 <p>pretty_please
20139 </p>
20140 !! end
20141
20142 !! test
20143 anchorencode deals with links
20144 !! wikitext
20145 {{anchorencode: [[hello|world]] [[hi]]}}
20146 !! html
20147 <p>world_hi
20148 </p>
20149 !! end
20150
20151 !! test
20152 anchorencode deals with templates
20153 !! wikitext
20154 {{anchorencode: {{Foo}} }}
20155 !! html
20156 <p>FOO
20157 </p>
20158 !! end
20159
20160 !! test
20161 anchorencode encodes like the TOC generator: (bug 18431)
20162 !! wikitext
20163 === _ +:.3A%3A&&amp;]] ===
20164 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20165 __NOEDITSECTION__
20166 !! html
20167 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20168 <p>.2B:.3A.253A.26.26.5D.5D
20169 </p>
20170 !! end
20171
20172 !! test
20173 Bug 6200: blockquotes and paragraph formatting
20174 !! wikitext
20175 <blockquote>
20176 foo
20177 </blockquote>
20178
20179 bar
20180
20181 baz
20182 !! html
20183 <blockquote>
20184 <p>foo
20185 </p>
20186 </blockquote>
20187 <p>bar
20188 </p>
20189 <pre>baz
20190 </pre>
20191 !! end
20192
20193 !! test
20194 Bug 8293: Use of center tag ruins paragraph formatting
20195 !! wikitext
20196 <center>
20197 foo
20198 </center>
20199
20200 bar
20201
20202 baz
20203 !! html
20204 <center>
20205 <p>foo
20206 </p>
20207 </center>
20208 <p>bar
20209 </p>
20210 <pre>baz
20211 </pre>
20212 !! end
20213
20214 !!test
20215 Parsing of overlapping (improperly nested) inline html tags
20216 !! wikitext
20217 <span><s>x</span></s>
20218 !! html/php
20219 <p><span><s>x&lt;/span&gt;</s></span>
20220 </p>
20221 !! html/parsoid
20222 <p><span><s>x</s></span>
20223 </p>
20224 !!end
20225
20226 ###
20227 ### Language variants related tests
20228 ###
20229 !! test
20230 Self-link in language variants
20231 !! options
20232 title=[[Dunav]] language=sr
20233 !! wikitext
20234 Both [[Dunav]] and [[Дунав]] are names for this river.
20235 !! html
20236 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
20237 </p>
20238 !!end
20239
20240 !! article
20241 Дуна
20242 !! text
20243 content
20244 !! endarticle
20245
20246 !! test
20247 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
20248 !! options
20249 title=[[Duna]] language=sr
20250 !! wikitext
20251 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
20252 !! html
20253 <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.
20254 </p>
20255 !! end
20256
20257 !! test
20258 Link to a section of a variant of this title shouldn't be parsed as self-link
20259 !! options
20260 title=[[Duna]] language=sr
20261 !! wikitext
20262 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
20263 !! html
20264 <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.
20265 </p>
20266 !! end
20267
20268 !! test
20269 Link to pages in language variants
20270 !! options
20271 language=sr
20272 !! wikitext
20273 Main Page can be written as [[Маин Паге]]
20274 !! html
20275 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
20276 </p>
20277 !!end
20278
20279
20280 !! test
20281 Multiple links to pages in language variants
20282 !! options
20283 language=sr
20284 !! wikitext
20285 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
20286 !! html
20287 <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>.
20288 </p>
20289 !!end
20290
20291
20292 !! test
20293 Simple template in language variants
20294 !! options
20295 language=sr
20296 !! wikitext
20297 {{тест}}
20298 !! html
20299 <p>This is a test template
20300 </p>
20301 !! end
20302
20303
20304 !! test
20305 Template with explicit namespace in language variants
20306 !! options
20307 language=sr
20308 !! wikitext
20309 {{Template:тест}}
20310 !! html
20311 <p>This is a test template
20312 </p>
20313 !! end
20314
20315
20316 !! test
20317 Basic test for template parameter in language variants
20318 !! options
20319 language=sr
20320 !! wikitext
20321 {{парамтест|param=foo}}
20322 !! html
20323 <p>This is a test template with parameter foo
20324 </p>
20325 !! end
20326
20327 !! test
20328 Simple category in language variants
20329 !! options
20330 language=sr cat
20331 !! wikitext
20332 [[Category:МедиаWики Усер'с Гуиде]]
20333 !! html/php
20334 cat=МедиаWики_Усер'с_Гуиде sort=
20335 !! html/parsoid
20336 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
20337 !! end
20338
20339 !! article
20340 Category:分类
20341 !! text
20342 blah
20343 !! endarticle
20344
20345 !! article
20346 Category:分類
20347 !! text
20348 blah
20349 !! endarticle
20350
20351 ## We used to, but no longer wt2wt this test since the default serializer
20352 ## will normalize all categories to serialize on their own line.
20353 ## This wikitext usage is going to be fairly uncommon in production and
20354 ## selser will take care of preserving formatting in those scenarios.
20355 !! test
20356 Don't convert blue categorylinks to another variant (bug 33210)
20357 !! options
20358 cat
20359 language=zh
20360 parsoid=wt2html
20361 !! wikitext
20362 [[A]][[Category:分类]]
20363 !! html/php
20364 cat=分类 sort=
20365 !! html/parsoid
20366 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
20367 <link rel="mw:PageProp/Category" href="Category:分类"/>
20368 !! end
20369
20370 !! test
20371 Stripping -{}- tags (language variants)
20372 !! options
20373 language=sr
20374 !! wikitext
20375 Latin proverb: -{Ne nuntium necare}-
20376 !! html
20377 <p>Latin proverb: Ne nuntium necare
20378 </p>
20379 !! end
20380
20381
20382 !! test
20383 Prevent conversion with -{}- tags (language variants)
20384 !! options
20385 language=sr variant=sr-ec
20386 !! wikitext
20387 Latinski: -{Ne nuntium necare}-
20388 !! html
20389 <p>Латински: Ne nuntium necare
20390 </p>
20391 !! end
20392
20393
20394 !! test
20395 Prevent conversion of text with -{}- tags (language variants)
20396 !! options
20397 language=sr variant=sr-ec
20398 !! wikitext
20399 Latinski: -{Ne nuntium necare}-
20400 !! html
20401 <p>Латински: Ne nuntium necare
20402 </p>
20403 !! end
20404
20405
20406 !! test
20407 Prevent conversion of links with -{}- tags (language variants)
20408 !! options
20409 language=sr variant=sr-ec
20410 !! wikitext
20411 -{[[Main Page]]}-
20412 !! html
20413 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20414 </p>
20415 !! end
20416
20417
20418 !! test
20419 -{}- tags within headlines (within html for parserConvert())
20420 !! options
20421 language=sr variant=sr-ec
20422 !! wikitext
20423 == -{Naslov}- ==
20424 !! html
20425 <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>
20426
20427 !! end
20428
20429
20430 !! test
20431 Explicit definition of language variant alternatives
20432 !! options
20433 language=zh variant=zh-tw
20434 !! wikitext
20435 -{zh:China;zh-tw:Taiwan}-, not China
20436 !! html
20437 <p>Taiwan, not China
20438 </p>
20439 !! end
20440
20441
20442 !! test
20443 Conversion around HTML tags
20444 !! options
20445 language=sr variant=sr-ec
20446 !! wikitext
20447 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
20448 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
20449 !! html
20450 <p>
20451 <span title="ЛаCтин">ски</span>
20452 </p>
20453 !! end
20454
20455
20456 !! test
20457 Explicit session-wise language variant mapping (A flag and - flag)
20458 !! options
20459 language=zh variant=zh-tw
20460 !! wikitext
20461 Taiwan is not China.
20462 But -{A|zh:China;zh-tw:Taiwan}- is China,
20463 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20464 and -{China}- is China.
20465 !! html
20466 <p>Taiwan is not China.
20467 But Taiwan is Taiwan,
20468 (This should be stripped!)
20469 and China is China.
20470 </p>
20471 !! end
20472
20473 !! test
20474 Explicit session-wise language variant mapping (H flag for hide)
20475 !! options
20476 language=zh variant=zh-tw
20477 !! wikitext
20478 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20479 Taiwan is China.
20480 !! html
20481 <p>(This should be stripped!)
20482 Taiwan is Taiwan.
20483 </p>
20484 !! end
20485
20486 !! test
20487 Adding explicit conversion rule for title (T flag)
20488 !! options
20489 language=zh variant=zh-tw showtitle
20490 !! wikitext
20491 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20492 !! html
20493 Taiwan
20494 <p>Should be stripped!
20495 </p>
20496 !! end
20497
20498 !! test
20499 Testing that changing the language variant here in the tests actually works
20500 !! options
20501 language=zh variant=zh showtitle
20502 !! wikitext
20503 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20504 !! html
20505 China
20506 <p>Should be stripped!
20507 </p>
20508 !! end
20509
20510 !! test
20511 Recursive conversion of alt and title attrs shouldn't clear converter state
20512 !! options
20513 language=zh variant=zh-cn showtitle
20514 !! wikitext
20515 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20516 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20517 !! html
20518 China
20519 <p>
20520 Should be stripped<span title="Exclamation">!</span>
20521 </p>
20522 !! end
20523
20524 !! test
20525 Bug 24072: more test on conversion rule for title
20526 !! options
20527 language=zh variant=zh-tw showtitle
20528 !! wikitext
20529 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20530 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20531 !! html
20532 Taiwan
20533 <p>This should be stripped!
20534 This won't take interferes with the title rule.
20535 </p>
20536 !! end
20537
20538 !! test
20539 Partly disable title conversion if variant == main language code
20540 !! options
20541 language=zh variant=zh title=[[ZH]] showtitle
20542 !! wikitext
20543 -{T|zh-cn:CN;zh-tw:TW}-
20544 !! html
20545 ZH
20546 <p>
20547 </p>
20548 !! end
20549
20550 !! test
20551 Partly disable title conversion if variant == main language code, more
20552 !! options
20553 language=zh variant=zh title=[[ZH]] showtitle
20554 !! wikitext
20555 -{T|TW}-
20556 !! html
20557 ZH
20558 <p>
20559 </p>
20560 !! end
20561
20562 !! test
20563 Raw output of variant escape tags (R flag)
20564 !! options
20565 language=zh variant=zh-tw
20566 !! wikitext
20567 Raw: -{R|zh:China;zh-tw:Taiwan}-
20568 !! html
20569 <p>Raw: zh:China;zh-tw:Taiwan
20570 </p>
20571 !! end
20572
20573 !! test
20574 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20575 !! options
20576 language=zh variant=zh-cn
20577 !! input
20578 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20579 !! result
20580 <p>0
20581 </p>
20582 !! end
20583
20584 !! test
20585 Conversion rules from [numeric-only string] to [something else] (T48634)
20586 !! options
20587 language=zh variant=zh-cn
20588 !! input
20589 -{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
20590 !! result
20591 <p>D12345EE12345
20592 </p>
20593 !! end
20594
20595 !! test
20596 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20597 !! options
20598 language=zh variant=zh-cn
20599 !! input
20600 -{H|zh-cn:foo;zh-tw:;}-foobar
20601 !! result
20602 <p>foobar
20603 </p>
20604 !! end
20605
20606 !! test
20607 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20608 !! options
20609 language=zh variant=zh-cn
20610 !! input
20611 -{H|=>zh-cn:foo;}-foobar
20612 !! result
20613 <p>foobar
20614 </p>
20615 !! end
20616
20617 !! test
20618 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20619 !! options
20620 language=zh variant=zh-cn
20621 !! input
20622 -{H|}-foobar
20623 !! result
20624 <p>foobar
20625 </p>
20626 !! end
20627
20628 !! test
20629 Nested using of manual convert syntax
20630 !! options
20631 language=zh variant=zh-hk
20632 !! wikitext
20633 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20634 !! html
20635 <p>Nested: Hello Hong Kong!
20636 </p>
20637 !! end
20638
20639 # Since Parsoid is starting to emit canonical wikitext for links,
20640 # [http://example.com http://example.com] will not RT back to that
20641 # form anymore.
20642 !! test
20643 Proper conversion of text in external links
20644 !! options
20645 language=sr variant=sr-ec
20646 parsoid=wt2html
20647 !! wikitext
20648 http://www.google.com
20649 gopher://www.google.com
20650 [http://www.google.com http://www.google.com]
20651 [gopher://www.google.com gopher://www.google.com]
20652 [https://www.google.com irc://www.google.com]
20653 [ftp://www.google.com www.google.com/ftp://dir]
20654 [//www.google.com www.google.com]
20655 !! html/php
20656 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20657 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20658 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20659 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20660 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20661 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20662 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20663 </p>
20664 !! html/parsoid
20665 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20666 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20667 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20668 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20669 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20670 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20671 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20672 !! end
20673
20674 !! test
20675 Do not convert roman numbers to language variants
20676 !! options
20677 language=sr variant=sr-ec
20678 !! wikitext
20679 Fridrih IV je car.
20680 !! html
20681 <p>Фридрих IV је цар.
20682 </p>
20683 !! end
20684
20685 !! test
20686 Unclosed language converter markup "-{"
20687 !! options
20688 language=sr
20689 !! wikitext
20690 -{T|hello
20691 !! html
20692 <p>-{T|hello
20693 </p>
20694 !! end
20695
20696 !! test
20697 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20698 !! options
20699 language=sr
20700 !! wikitext
20701 -{R|=&gt;}-
20702 !! html
20703 <p>=&gt;
20704 </p>
20705 !!end
20706
20707 !! test
20708 Don't break link parsing if language converter markup is in the caption.
20709 !! options
20710 language=sr variant=sr-ec
20711 !! wikitext
20712 [[Main Page|-{R|main page}-]]
20713 !! html
20714 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20715 </p>
20716 !! end
20717
20718 # FIXME: This test is currently broken in the PHP parser T153761
20719 !! test
20720 T146304: Don't break template parsing if language converter markup is in the parameter.
20721 !! options
20722 language=sr variant=sr-ec
20723 disabled
20724 !! wikitext
20725 {{echo|-{R|foo}-}}
20726 !! html/php
20727 <p>foo
20728 </p>
20729 !! end
20730
20731 !! test
20732 T146305: Don't break image parsing if language converter markup is in the caption.
20733 !! options
20734 language=sr
20735 !! wikitext
20736 [[File:Foobar.jpg|thumb|-{R|caption:}-]]
20737 !! html/php
20738 <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>
20739
20740 !! html/parsoid
20741 <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>
20742 !! end
20743
20744 !! test
20745 T146305: Don't break image parsing if nested language converter markup is in the caption.
20746 !! options
20747 language=zh variant=zh-cn
20748 !! wikitext
20749 [[File:Foobar.jpg|thumb|-{zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
20750 !! html/php
20751 <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>
20752
20753 !! html/parsoid
20754 <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>
20755 !! end
20756
20757 !! test
20758 Don't break gallery if language converter markup is inside.
20759 !! options
20760 language=zh
20761 !! wikitext
20762 <gallery>
20763 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
20764 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
20765 </gallery>
20766 !! html
20767 <ul class="gallery mw-gallery-traditional">
20768 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20769 <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>
20770 <div class="gallerytext">
20771 <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>
20772 </p>
20773 </div>
20774 </div></li>
20775 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20776 <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>
20777 <div class="gallerytext">
20778 <p>This is a test template
20779 </p>
20780 </div>
20781 </div></li>
20782 </ul>
20783
20784 !! end
20785
20786 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20787 !! test
20788 Don't break list handling if language converter markup is in the item.
20789 !! options
20790 language=zh variant=zh-cn
20791 !! wikitext
20792 ;-{zh-cn:AAA;zh-tw:BBB}-
20793 !! html/php
20794 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20795
20796 !! html/parsoid
20797 <dl><dt>AAA
20798 </dt></dl>
20799 !! end
20800
20801 !! test
20802 T153140: Don't break table handling if language converter markup is in the cell.
20803 !! options
20804 language=sr variant=sr-ec
20805 !! wikitext
20806 {|
20807 |-
20808 | -{R|B}-
20809 |}
20810 !! html/php
20811 <table>
20812
20813 <tr>
20814 <td> B
20815 </td></tr></table>
20816
20817 !! html/parsoid
20818 <table>
20819
20820 <tr>
20821 <td> B
20822 </td></tr></table>
20823
20824 !! end
20825
20826 !! test
20827 Bug 529: Uncovered bullet
20828 !! wikitext
20829 * Foo {{bullet}}
20830 !! html
20831 <ul><li> Foo </li>
20832 <li> Bar</li></ul>
20833
20834 !! end
20835
20836 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20837 # Templates in Wikipedia rely on this behavior, as tidy has always been
20838 # enabled there. These tests are normally run *without* tidy, so specify the
20839 # full output here.
20840 # To test realistic parsing behavior, apply a tidy-like transformation to both
20841 # the expected output and your parser's output.
20842 !! test
20843 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20844 !! wikitext
20845 ******* Foo {{bullet}}
20846 !! html
20847 <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>
20848 <li> Bar</li></ul>
20849
20850 !! end
20851
20852 !! test
20853 Bug 529: Uncovered table already at line-start
20854 !! wikitext
20855 x
20856
20857 {{table}}
20858 y
20859 !! html
20860 <p>x
20861 </p>
20862 <table>
20863 <tr>
20864 <td> 1 </td>
20865 <td> 2
20866 </td></tr>
20867 <tr>
20868 <td> 3 </td>
20869 <td> 4
20870 </td></tr></table>
20871 <p>y
20872 </p>
20873 !! end
20874
20875 !! test
20876 Bug 529: Uncovered bullet in parser function result
20877 !! wikitext
20878 * Foo {{lc:{{bullet}} }}
20879 !! html
20880 <ul><li> Foo </li>
20881 <li> bar</li></ul>
20882
20883 !! end
20884
20885 !! test
20886 Bug 5678: Double-parsed template argument
20887 !! wikitext
20888 {{lc:{{{1}}}|hello}}
20889 !! html
20890 <p>{{{1}}}
20891 </p>
20892 !! end
20893
20894 !! test
20895 Bug 5678: Double-parsed template invocation
20896 !! wikitext
20897 {{lc:{{paramtest {{!}} param = hello }} }}
20898 !! html
20899 <p>{{paramtest | param = hello }}
20900 </p>
20901 !! end
20902
20903 !! test
20904 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20905 !! options
20906 language=cs
20907 title=[[Main Page]]
20908 !! wikitext
20909 {{PRVNÍVELKÉ:ěščř}}
20910 {{prvnívelké:ěščř}}
20911 {{PRVNÍMALÉ:ěščř}}
20912 {{prvnímalé:ěščř}}
20913 {{MALÁ:ěščř}}
20914 {{malá:ěščř}}
20915 {{VELKÁ:ěščř}}
20916 {{velká:ěščř}}
20917 !! html
20918 <p>Ěščř
20919 Ěščř
20920 ěščř
20921 ěščř
20922 ěščř
20923 ěščř
20924 ĚŠČŘ
20925 ĚŠČŘ
20926 </p>
20927 !! end
20928
20929 !! test
20930 Morwen/13: Unclosed link followed by heading
20931 !! wikitext
20932 [[link
20933 ==heading==
20934 !! html
20935 <p>[[link
20936 </p>
20937 <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>
20938
20939 !! end
20940
20941 !! test
20942 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20943 !! wikitext
20944 {{foo|
20945 =heading=
20946 !! html
20947 <p>{{foo|
20948 </p>
20949 <h1><span class="mw-headline" id="heading">heading</span></h1>
20950
20951 !! end
20952
20953 !! test
20954 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20955 !! wikitext
20956 {{foo|
20957 ==heading==
20958 !! html
20959 <p>{{foo|
20960 </p>
20961 <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>
20962
20963 !! end
20964
20965 !! test
20966 Tildes in comments
20967 !! options
20968 pst
20969 !! wikitext
20970 <!-- ~~~~ -->
20971 !! html/php
20972 <!-- ~~~~ -->
20973 !! end
20974
20975 !! test
20976 Paragraphs inside divs (no extra line breaks)
20977 !! wikitext
20978 <div>Line one
20979
20980 Line two</div>
20981 !! html
20982 <div>Line one
20983 Line two</div>
20984
20985 !! end
20986
20987 !! test
20988 Paragraphs inside divs (extra line break on open)
20989 !! wikitext
20990 <div>
20991 Line one
20992
20993 Line two</div>
20994 !! html
20995 <div>
20996 <p>Line one
20997 </p>
20998 Line two</div>
20999
21000 !! end
21001
21002 !! test
21003 Paragraphs inside divs (extra line break on close)
21004 !! wikitext
21005 <div>Line one
21006
21007 Line two
21008 </div>
21009 !! html
21010 <div>Line one
21011 <p>Line two
21012 </p>
21013 </div>
21014
21015 !! end
21016
21017 !! test
21018 Paragraphs inside divs (extra line break on open and close)
21019 !! wikitext
21020 <div>
21021 Line one
21022
21023 Line two
21024 </div>
21025 !! html
21026 <div>
21027 <p>Line one
21028 </p><p>Line two
21029 </p>
21030 </div>
21031
21032 !! end
21033
21034 !! test
21035 Nesting tags, paragraphs on lines which begin with <div>
21036 !! wikitext
21037 <div></div><strong>A
21038 B</strong>
21039 !! html/php+tidy
21040 <p><strong>A</strong></p>
21041 <p><strong>B</strong></p>
21042 !! html/parsoid
21043 <div></div>
21044 <p><strong>A
21045 B</strong>
21046 </p>
21047 !! end
21048
21049 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
21050 !! test
21051 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
21052 !! wikitext
21053 <blockquote>Line one
21054
21055 Line two</blockquote>
21056 !! html
21057 <blockquote>Line one
21058 Line two</blockquote>
21059
21060 !! html+tidy
21061 <blockquote>
21062 <p>Line one Line two</p>
21063 </blockquote>
21064 !! end
21065
21066 !! test
21067 Bug 6200: paragraphs inside blockquotes (extra line break on open)
21068 !! wikitext
21069 <blockquote>
21070 Line one
21071
21072 Line two</blockquote>
21073 !! html
21074 <blockquote>
21075 <p>Line one
21076 </p>
21077 Line two</blockquote>
21078
21079 !! html+tidy
21080 <blockquote>
21081 <p>Line one</p>
21082 Line two</blockquote>
21083 !! end
21084
21085 !! test
21086 Bug 6200: paragraphs inside blockquotes (extra line break on close)
21087 !! wikitext
21088 <blockquote>Line one
21089
21090 Line two
21091 </blockquote>
21092 !! html
21093 <blockquote>Line one
21094 <p>Line two
21095 </p>
21096 </blockquote>
21097
21098 !! html+tidy
21099 <blockquote>
21100 <p>Line one</p>
21101 <p>Line two</p>
21102 </blockquote>
21103 !! end
21104
21105 !! test
21106 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
21107 !! wikitext
21108 <blockquote>
21109 Line one
21110
21111 Line two
21112 </blockquote>
21113 !! html
21114 <blockquote>
21115 <p>Line one
21116 </p><p>Line two
21117 </p>
21118 </blockquote>
21119
21120 !! html+tidy
21121 <blockquote>
21122 <p>Line one</p>
21123 <p>Line two</p>
21124 </blockquote>
21125 !! end
21126
21127 !! test
21128 Paragraphs inside blockquotes/divs (no extra line breaks)
21129 !! wikitext
21130 <blockquote><div>Line one
21131
21132 Line two</div></blockquote>
21133 !! html
21134 <blockquote><div>Line one
21135 Line two</div></blockquote>
21136
21137 !! end
21138
21139 !! test
21140 Paragraphs inside blockquotes/divs (extra line break on open)
21141 !! wikitext
21142 <blockquote><div>
21143 Line one
21144
21145 Line two</div></blockquote>
21146 !! html
21147 <blockquote><div>
21148 <p>Line one
21149 </p>
21150 Line two</div></blockquote>
21151
21152 !! end
21153
21154 !! test
21155 Paragraphs inside blockquotes/divs (extra line break on close)
21156 !! wikitext
21157 <blockquote><div>Line one
21158
21159 Line two
21160 </div></blockquote>
21161 !! html
21162 <blockquote><div>Line one
21163 <p>Line two
21164 </p>
21165 </div></blockquote>
21166
21167 !! end
21168
21169 !! test
21170 Paragraphs inside blockquotes/divs (extra line break on open and close)
21171 !! wikitext
21172 <blockquote><div>
21173 Line one
21174
21175 Line two
21176 </div></blockquote>
21177 !! html
21178 <blockquote><div>
21179 <p>Line one
21180 </p><p>Line two
21181 </p>
21182 </div></blockquote>
21183
21184 !! end
21185
21186 !! test
21187 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
21188 !! options
21189 wgLinkHolderBatchSize=0
21190 !! wikitext
21191 [[meatball:1]]
21192 [[meatball:2]]
21193 [[meatball:3]]
21194 !! html
21195 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
21196 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
21197 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
21198 </p>
21199 !! end
21200
21201 !! test
21202 Free external link invading image caption
21203 !! wikitext
21204 [[Image:Foobar.jpg|thumb|http://x|hello]]
21205 !! html
21206 <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>
21207
21208 !! end
21209
21210 !! test
21211 Bug 15196: localised external link numbers
21212 !! options
21213 language=fa
21214 !! wikitext
21215 [http://en.wikipedia.org/]
21216 !! html/php
21217 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
21218 </p>
21219 !! html/parsoid
21220 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
21221 !! end
21222
21223 !! test
21224 Multibyte character in padleft
21225 !! wikitext
21226 {{padleft:-Hello|7|Æ}}
21227 !! html
21228 <p>Æ-Hello
21229 </p>
21230 !! end
21231
21232 !! test
21233 Multibyte character in padright
21234 !! wikitext
21235 {{padright:Hello-|7|Æ}}
21236 !! html
21237 <p>Hello-Æ
21238 </p>
21239 !! end
21240
21241 !!test
21242 formatdate parser function
21243 !! wikitext
21244 {{#formatdate:2009-03-24}}
21245 !! html
21246 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
21247 </p>
21248 !! end
21249
21250 !!test
21251 formatdate parser function, with default format
21252 !! wikitext
21253 {{#formatdate:2009-03-24|mdy}}
21254 !! html
21255 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
21256 </p>
21257 !! end
21258
21259 !! test
21260 Spacing of numbers in formatted dates
21261 !! wikitext
21262 {{#formatdate:January 15}}
21263 !! html
21264 <p><span class="mw-formatted-date" title="01-15">January 15</span>
21265 </p>
21266 !! end
21267
21268 !! test
21269 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
21270 !! options
21271 language=nl title=[[MediaWiki:Common.css]]
21272 !! wikitext
21273 {{#formatdate:2009-03-24|dmy}}
21274 !! html
21275 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
21276 </p>
21277 !! end
21278
21279 #
21280 #
21281 #
21282
21283 #
21284 # Edit comments
21285 #
21286
21287 !! test
21288 Edit comment with link
21289 !! options
21290 comment
21291 !! wikitext
21292 I like the [[Main Page]] a lot
21293 !! html/php
21294 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
21295 !!end
21296
21297 !! test
21298 Edit comment with link and link text
21299 !! options
21300 comment
21301 !! wikitext
21302 I like the [[Main Page|best pages]] a lot
21303 !! html/php
21304 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21305 !!end
21306
21307 !! test
21308 Edit comment with link and link text with suffix
21309 !! options
21310 comment
21311 !! wikitext
21312 I like the [[Main Page|best page]]s a lot
21313 !! html/php
21314 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21315 !!end
21316
21317 !! test
21318 Edit comment with section link (non-local, eg in history list)
21319 !! options
21320 comment title=[[Main Page]]
21321 !! wikitext
21322 /* External links */ removed bogus entries
21323 !! html/php
21324 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21325 !!end
21326
21327 !! test
21328 Edit comment with section link and text before it (non-local, eg in history list)
21329 !! options
21330 comment title=[[Main Page]]
21331 !! wikitext
21332 pre-comment text /* External links */ removed bogus entries
21333 !! html/php
21334 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>
21335 !!end
21336
21337 !! test
21338 Edit comment with section link (local, eg in diff view)
21339 !! options
21340 comment local title=[[Main Page]]
21341 !! wikitext
21342 /* External links */ removed bogus entries
21343 !! html/php
21344 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21345 !!end
21346
21347 !! test
21348 Edit comment with subpage link (bug 14080)
21349 !! options
21350 comment
21351 subpage
21352 title=[[Subpage test]]
21353 !! wikitext
21354 Poked at a [[/subpage]] here...
21355 !! html/php
21356 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
21357 !!end
21358
21359 !! test
21360 Edit comment with subpage link and link text (bug 14080)
21361 !! options
21362 comment
21363 subpage
21364 title=[[Subpage test]]
21365 !! wikitext
21366 Poked at a [[/subpage|neat little page]] here...
21367 !! html/php
21368 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
21369 !!end
21370
21371 !! test
21372 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
21373 !! options
21374 comment
21375 title=[[Subpage test]]
21376 !! wikitext
21377 Poked at a [[/subpage]] here...
21378 !! html/php
21379 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...
21380 !!end
21381
21382 !! test
21383 Edit comment with bare anchor link (local, as on diff)
21384 !! options
21385 comment
21386 local
21387 title=[[Main Page]]
21388 !! wikitext
21389 [[#section]]
21390 !! html/php
21391 <a href="#section">#section</a>
21392 !! end
21393
21394 !! test
21395 Edit comment with bare anchor link (non-local, as on history)
21396 !! options
21397 comment
21398 title=[[Main Page]]
21399 !! wikitext
21400 [[#section]]
21401 !! html/php
21402 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
21403 !! end
21404
21405 !! test
21406 Anchor starting with underscore
21407 !! options
21408 title=[[Foo]]
21409 !! wikitext
21410 [[#_ref|One]]
21411 !! html/php
21412 <p><a href="#_ref">One</a>
21413 </p>
21414 !! html/parsoid
21415 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
21416 !! end
21417
21418 !! test
21419 Id starting with underscore
21420 !! wikitext
21421 <div id="_ref"></div>
21422 !! html/*
21423 <div id="_ref"></div>
21424
21425 !! end
21426
21427 !! test
21428 Edit comment with link with more than one pipe (T99346)
21429 !! options
21430 comment
21431 !! wikitext
21432 [[Main Page|Many|pipes]]
21433 !! html/php
21434 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
21435 !! end
21436
21437 !! test
21438 Complex edit comment with link with more than one pipe (T99346)
21439 !! options
21440 comment
21441 !! wikitext
21442 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
21443 !! html/php
21444 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;
21445 !! end
21446
21447 !! test
21448 Space normalisation on autocomment (bug 22784)
21449 !! options
21450 comment
21451 title=[[Main Page]]
21452 !! wikitext
21453 /* __hello__world__ */
21454 !! html/php
21455 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
21456 !! end
21457
21458 !! test
21459 percent-encoding and + signs in comments (Bug 26410)
21460 !! options
21461 comment
21462 !! wikitext
21463 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
21464 !! html/php
21465 <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>
21466 !! end
21467
21468 # Parsoid doesn't support this yet: see bug 73581
21469 # but it *should* omit the 'src' attribute if the image is bad.
21470 # PHP side of tests was disabled in
21471 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
21472 # because of issues in the PHP parserTests infrastructure
21473 # (but the output below is indeed what the PHP side emits)
21474 !! test
21475 Bad images - basic functionality
21476 !! wikitext
21477 [[File:Bad.jpg]]
21478 !! DISABLED/html/php
21479 !! html/parsoid
21480 <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>
21481 !! end
21482
21483 !! test
21484 Bad images - bug 16039: text after bad image disappears
21485 !! wikitext
21486 Foo bar
21487 [[File:Bad.jpg]]
21488 Bar foo
21489 !! DISABLED/html/php
21490 <p>Foo bar
21491 </p><p>Bar foo
21492 </p>
21493 !! html/parsoid
21494 <p>Foo bar
21495 <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>
21496 Bar foo</p>
21497 !! end
21498
21499 !! test
21500 Verify that displaytitle works (bug #22501) no displaytitle
21501 !! options
21502 showtitle
21503 !! config
21504 wgAllowDisplayTitle=true
21505 wgRestrictDisplayTitle=false
21506 !! wikitext
21507 this is not the the title
21508 !! html/php
21509 Parser test
21510 <p>this is not the the title
21511 </p>
21512 !! end
21513
21514 !! test
21515 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
21516 !! options
21517 showtitle
21518 title=[[Screen]]
21519 !! config
21520 wgAllowDisplayTitle=true
21521 wgRestrictDisplayTitle=false
21522 !! wikitext
21523 this is not the the title
21524 {{DISPLAYTITLE:whatever}}
21525 !! html/php
21526 whatever
21527 <p>this is not the the title
21528 </p>
21529 !! end
21530
21531 !! test
21532 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
21533 !! options
21534 showtitle
21535 title=[[Screen]]
21536 !! config
21537 wgAllowDisplayTitle=true
21538 wgRestrictDisplayTitle=true
21539 !! wikitext
21540 this is not the the title
21541 {{DISPLAYTITLE:whatever}}
21542 !! html/php
21543 Screen
21544 <p>this is not the the title
21545 </p>
21546 !! end
21547
21548 !! test
21549 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
21550 !! options
21551 showtitle
21552 title=[[Screen]]
21553 !! config
21554 wgAllowDisplayTitle=true
21555 wgRestrictDisplayTitle=true
21556 !! wikitext
21557 this is not the the title
21558 {{DISPLAYTITLE:screen}}
21559 !! html/php
21560 screen
21561 <p>this is not the the title
21562 </p>
21563 !! end
21564
21565 !! test
21566 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
21567 !! options
21568 showtitle
21569 title=[[Screen]]
21570 !! config
21571 wgAllowDisplayTitle=false
21572 !! wikitext
21573 this is not the the title
21574 {{DISPLAYTITLE:screen}}
21575 !! html/php
21576 Screen
21577 <p>this is not the the title
21578 <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>
21579 </p>
21580 !! end
21581
21582 !! test
21583 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
21584 !! options
21585 showtitle
21586 title=[[Screen]]
21587 !! config
21588 wgAllowDisplayTitle=false
21589 !! wikitext
21590 this is not the the title
21591 !! html/php
21592 Screen
21593 <p>this is not the the title
21594 </p>
21595 !! end
21596
21597 !! test
21598 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
21599 !! options
21600 showtitle
21601 title=[[Screen]]
21602 !! config
21603 wgAllowDisplayTitle=true
21604 wgRestrictDisplayTitle=true
21605 !! wikitext
21606 this is not the the title
21607 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21608 !! html/php
21609 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21610 <p>this is not the the title
21611 </p>
21612 !! end
21613
21614 !! test
21615 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
21616 !! options
21617 showtitle
21618 title=[[Screen]]
21619 !! config
21620 wgAllowDisplayTitle=true
21621 wgRestrictDisplayTitle=true
21622 !! wikitext
21623 this is not the the title
21624 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21625 !! html/php
21626 <span style="color: red;">s</span>creen
21627 <p>this is not the the title
21628 </p>
21629 !! end
21630
21631 !! test
21632 Page status indicators: Empty name is invalid
21633 !! options
21634 showindicators
21635 !! wikitext
21636 <indicator name=" "></indicator>
21637 <indicator></indicator>
21638 !! html
21639 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21640 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21641 </p>
21642 !! end
21643
21644 !! test
21645 Page status indicators: Weird syntaxes that are okay
21646 !! options
21647 showindicators
21648 !! wikitext
21649 <indicator name="empty" />
21650 <indicator name="name"></indicator>
21651 !! html
21652 empty=
21653 name=
21654 <p><br />
21655 </p>
21656 !! end
21657
21658 !! test
21659 Page status indicators: Torture test
21660 !! options
21661 showindicators
21662 !! wikitext
21663 <indicator name="01">hello world</indicator>
21664 <indicator name="02">[[Main Page]]</indicator>
21665 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21666 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21667 <indicator name="05">* foo
21668 * bar</indicator>
21669 <indicator name="06"><nowiki>foo</nowiki></indicator>
21670 <indicator name="07"> Preformatted</indicator>
21671 <indicator name="08"><div>Broken tag</indicator>
21672 <indicator name="09">{| class=wikitable
21673 | cell
21674 |}</indicator>
21675 <indicator name="10">Two
21676
21677 paragraphs</indicator>
21678 !! html
21679 01=hello world
21680 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21681 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" />
21682 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>
21683 05=<ul><li> foo</li>
21684 <li> bar</li></ul>
21685
21686 06=foo
21687 07=<pre>Preformatted
21688 </pre>
21689 08=<div>Broken tag</div>
21690
21691 09=<table class="wikitable">
21692 <tr>
21693 <td> cell
21694 </td></tr></table>
21695
21696 10=<p>Two
21697 </p><p>paragraphs
21698 </p>
21699 <p><br />
21700 </p><p><br />
21701 </p><p><br />
21702 </p><p><br />
21703 </p><p><br />
21704 </p>
21705 !! end
21706
21707 !! test
21708 preload: check <noinclude> and <includeonly>
21709 !! options
21710 preload
21711 !! wikitext
21712 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21713 !! html/php
21714 Hello kind world.
21715 !! end
21716
21717 !! test
21718 preload: check <onlyinclude>
21719 !! options
21720 preload
21721 !! wikitext
21722 Goodbye <onlyinclude>Hello world</onlyinclude>
21723 !! html/php
21724 Hello world
21725 !! end
21726
21727 !! test
21728 preload: can pass tags through if we want to
21729 !! options
21730 preload
21731 !! wikitext
21732 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21733 !! html/php
21734 <includeonly>Hello world</includeonly>
21735 !! end
21736
21737 !! test
21738 preload: check that it doesn't try to do tricks
21739 !! options
21740 preload
21741 !! wikitext
21742 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21743 !! html/php
21744 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21745 !! end
21746
21747 !! test
21748 Play a bit with r67090 and bug 3158
21749 !! wikitext
21750 <div style="width:50% !important">&nbsp;</div>
21751 <div style="width:50%&nbsp;!important">&nbsp;</div>
21752 <div style="width:50%&#160;!important">&nbsp;</div>
21753 <div style="border : solid;">&nbsp;</div>
21754 !! html/php
21755 <div style="width:50% !important">&#160;</div>
21756 <div style="width:50% !important">&#160;</div>
21757 <div style="width:50% !important">&#160;</div>
21758 <div style="border&#160;: solid;">&#160;</div>
21759
21760 !! html/parsoid
21761 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21762 <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>
21763 <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>
21764 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21765
21766 !! end
21767
21768 !! test
21769 HTML5 data attributes
21770 !! wikitext
21771 <span data-foo="bar">Baz</span>
21772 <p data-abc-def_hij="">Quuz</p>
21773 !! html/php
21774 <p><span data-foo="bar">Baz</span>
21775 </p>
21776 <p data-abc-def_hij="">Quuz</p>
21777
21778 !! html/parsoid
21779 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21780 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21781 !! end
21782
21783 !! test
21784 Strip reserved data attributes
21785 !! wikitext
21786 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21787 !! html/php
21788 <div data-ok="fred">d</div>
21789
21790 !! html/parsoid
21791 <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>
21792 !! end
21793
21794 !! test
21795 percent-encoding and + signs in internal links (Bug 26410)
21796 !! wikitext
21797 [[User:+%]] [[Page+title%]]
21798 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21799 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21800 [[%33%45]] [[%33%45+]]
21801 !! html/php
21802 <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>
21803 <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>
21804 <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>
21805 <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>
21806 </p>
21807 !! html/parsoid
21808 <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>
21809 <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>
21810 <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>
21811 <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>
21812 !! end
21813
21814 !! test
21815 Special characters in embedded file links (bug 27679)
21816 !! wikitext
21817 [[File:Contains & ampersand.jpg]]
21818 [[File:Does not exist.jpg|Title with & ampersand]]
21819 !! html/php
21820 <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>
21821 <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>
21822 </p>
21823 !! html/parsoid
21824 <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>
21825 <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>
21826 !! end
21827
21828 !! test
21829 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21830 !! wikitext
21831 Text&apos;s been normalized?
21832 !! html
21833 <p>Text&#39;s been normalized?
21834 </p>
21835 !! end
21836
21837 !! test
21838 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21839 !! wikitext
21840 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21841 !! html
21842 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21843 </p>
21844 !! end
21845
21846 !! test
21847 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21848 !! wikitext
21849 [http://www.example.org/ ideograms]
21850 !! html
21851 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21852 </p>
21853 !! end
21854
21855 !! test
21856 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21857 !! wikitext
21858 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21859 !! html
21860 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21861 </p>
21862 !! end
21863
21864 !! article
21865 Mediawiki:loop1
21866 !! text
21867 {{Identical|A}}
21868 !! endarticle
21869
21870 !! article
21871 Mediawiki:loop2
21872 !! text
21873 {{Identical|B}}
21874 !! endarticle
21875
21876 !! article
21877 Template:Identical
21878 !! text
21879 {{int:loop1}}
21880 {{int:loop2}}
21881 !! endarticle
21882
21883 !! test
21884 Bug 31098 Template which includes system messages which includes the template
21885 !! wikitext
21886 {{Identical}}
21887 !! html
21888 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21889 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21890 </p>
21891 !! end
21892
21893 !! test
21894 Bug31490 Turkish: ucfirst 'blah'
21895 !! options
21896 language=tr
21897 !! wikitext
21898 {{ucfirst:blah}}
21899 !! html
21900 <p>Blah
21901 </p>
21902 !! end
21903
21904 !! test
21905 Bug31490 Turkish: ucfirst 'ix'
21906 !! options
21907 language=tr
21908 !! wikitext
21909 {{ucfirst:ix}}
21910 !! html
21911 <p>İx
21912 </p>
21913 !! end
21914
21915 !! test
21916 Bug31490 Turkish: lcfirst 'BLAH'
21917 !! options
21918 language=tr
21919 !! wikitext
21920 {{lcfirst:BLAH}}
21921 !! html
21922 <p>bLAH
21923 </p>
21924 !! end
21925
21926 !! test
21927 Bug31490 Turkish: ucfırst (with a dotless i)
21928 !! options
21929 language=tr
21930 !! wikitext
21931 {{ucfırst:blah}}
21932 !! html
21933 <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>
21934 </p>
21935 !! end
21936
21937 !! test
21938 Bug31490 ucfırst (with a dotless i) with English language
21939 !! options
21940 language=en
21941 !! wikitext
21942 {{ucfırst:blah}}
21943 !! html
21944 <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>
21945 </p>
21946 !! end
21947
21948 !! test
21949 Bug 26375: TOC with italics
21950 !! options
21951 title=[[Main Page]]
21952 !! wikitext
21953 __TOC__
21954 == ''Lost'' episodes ==
21955 !! html
21956 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21957 <ul>
21958 <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>
21959 </ul>
21960 </div>
21961
21962 <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>
21963
21964 !! end
21965
21966 !! test
21967 Bug 26375: TOC with bold
21968 !! options
21969 title=[[Main Page]]
21970 !! wikitext
21971 __TOC__
21972 == '''should be bold''' then normal text ==
21973 !! html
21974 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21975 <ul>
21976 <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>
21977 </ul>
21978 </div>
21979
21980 <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>
21981
21982 !! end
21983
21984 !! test
21985 Bug 33845: Headings become cursive in TOC when they contain an image
21986 !! options
21987 title=[[Main Page]]
21988 !! wikitext
21989 __TOC__
21990 == Image [[Image:foobar.jpg]] ==
21991 !! html
21992 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21993 <ul>
21994 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21995 </ul>
21996 </div>
21997
21998 <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>
21999
22000 !! end
22001
22002 !! test
22003 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
22004 !! options
22005 title=[[Main Page]]
22006 !! wikitext
22007 __TOC__
22008 == <blockquote>Quote</blockquote> ==
22009 !! html
22010 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22011 <ul>
22012 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22013 </ul>
22014 </div>
22015
22016 <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>
22017
22018 !! html+tidy
22019 <p></p>
22020 <div id="toc" class="toc">
22021 <div id="toctitle">
22022 <h2>Contents</h2>
22023 </div>
22024 <ul>
22025 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22026 </ul>
22027 </div>
22028 <p></p>
22029 <h2><span class="mw-headline" id="Quote"></span></h2>
22030 <blockquote>
22031 <p><span class="mw-headline" id="Quote">Quote</span></p>
22032 </blockquote>
22033 <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>
22034 !! end
22035
22036 !! test
22037 Unclosed tags in TOC
22038 !! options
22039 title=[[Main Page]]
22040 !! wikitext
22041 __TOC__
22042 == Proof: 2 < 3 ==
22043 <small>Hanc marginis exiguitas non caperet.</small>
22044 QED
22045 !! html
22046 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22047 <ul>
22048 <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>
22049 </ul>
22050 </div>
22051
22052 <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>
22053 <p><small>Hanc marginis exiguitas non caperet.</small>
22054 QED
22055 </p>
22056 !! end
22057
22058 !! test
22059 Multiple tags in TOC
22060 !! wikitext
22061 __TOC__
22062 == <i>Foo</i> <b>Bar</b> ==
22063
22064 == <i>Foo</i> <blockquote>Bar</blockquote> ==
22065 !! html
22066 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22067 <ul>
22068 <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>
22069 <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>
22070 </ul>
22071 </div>
22072
22073 <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>
22074 <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>
22075
22076 !! html+tidy
22077 <p></p>
22078 <div id="toc" class="toc">
22079 <div id="toctitle">
22080 <h2>Contents</h2>
22081 </div>
22082 <ul>
22083 <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>
22084 <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>
22085 </ul>
22086 </div>
22087 <p></p>
22088 <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>
22089 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
22090 <blockquote>
22091 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
22092 </blockquote>
22093 <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>
22094 !! end
22095
22096 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
22097 # html5 tag parsing.
22098 !! test
22099 Tags with parameters in TOC
22100 !! options
22101 parsoid=wt2html
22102 !! wikitext
22103 __TOC__
22104 == <sup class="in-h2">Hello</sup> ==
22105
22106 == <sup class="a > b">Evilbye</sup> ==
22107 !! html/php
22108 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22109 <ul>
22110 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
22111 <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>
22112 </ul>
22113 </div>
22114
22115 <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>
22116 <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>
22117
22118 !! html/parsoid
22119 <meta property="mw:PageProp/toc" />
22120 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
22121
22122 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
22123 !! end
22124
22125 !! test
22126 span tags with directionality in TOC
22127 !! wikitext
22128 __TOC__
22129 == <span dir="ltr">C++</span> ==
22130
22131 == <span dir="rtl">זבנג!</span> ==
22132
22133 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
22134
22135 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
22136
22137 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
22138 !! html
22139 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22140 <ul>
22141 <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>
22142 <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>
22143 <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>
22144 <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>
22145 <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>
22146 </ul>
22147 </div>
22148
22149 <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>
22150 <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>
22151 <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>
22152 <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>
22153 <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>
22154
22155 !! end
22156
22157 !! test
22158 Bug 72884: bdi element in ToC
22159 !! wikitext
22160 __TOC__
22161 == <bdi>test</bdi> ==
22162 !! html
22163 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22164 <ul>
22165 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
22166 </ul>
22167 </div>
22168
22169 <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>
22170
22171 !! end
22172
22173 !! test
22174 T35715: s/strike element in ToC
22175 !! wikitext
22176 __TOC__
22177 == <s>test</s> test <strike>test</strike> ==
22178 !! html
22179 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22180 <ul>
22181 <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>
22182 </ul>
22183 </div>
22184
22185 <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>
22186
22187 !! end
22188
22189 # Note that the html output does not have the <p></p>, but the
22190 # html+tidy output *does*. This is because the empty <p></p> is
22191 # removed by the sanitizer, but only when tidy is *not* enabled (!).
22192 !! test
22193 Empty <p> tag in TOC, removed by Sanitizer (T92892)
22194 !! wikitext
22195 __TOC__
22196 == x ==
22197 !! html
22198 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22199 <ul>
22200 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22201 </ul>
22202 </div>
22203
22204 <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>
22205
22206 !! html+tidy
22207 <p></p>
22208 <div id="toc" class="toc">
22209 <div id="toctitle">
22210 <h2>Contents</h2>
22211 </div>
22212 <ul>
22213 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22214 </ul>
22215 </div>
22216 <p></p>
22217 <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>
22218 !! end
22219
22220 !! article
22221 MediaWiki:Bug32057
22222 !! text
22223 == {{int:headline_sample}} ==
22224 !! endarticle
22225
22226 !! test
22227 Bug 32057: Title needed when expanding <h> nodes.
22228 !! options
22229 title=[[Main Page]]
22230 !! wikitext
22231 {{int:Bug32057}}
22232 !! html
22233 <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>
22234
22235 !! end
22236
22237 !! test
22238 Strip marker in urlencode
22239 !! wikitext
22240 {{urlencode:x<nowiki/>y}}
22241 {{urlencode:x<nowiki/>y|wiki}}
22242 {{urlencode:x<nowiki/>y|path}}
22243 {{urlencode:x<pre id="one">two</pre>y}}
22244 !! html/php
22245 <p>xy
22246 xy
22247 xy
22248 xy
22249 </p>
22250 !! end
22251
22252 !! test
22253 Strip marker in lc
22254 !! wikitext
22255 {{lc:x<nowiki/>y}}
22256 !! html
22257 <p>xy
22258 </p>
22259 !! end
22260
22261 !! test
22262 Strip marker in uc
22263 !! wikitext
22264 {{uc:x<nowiki/>y}}
22265 !! html
22266 <p>XY
22267 </p>
22268 !! end
22269
22270 !! test
22271 Strip marker in formatNum
22272 !! wikitext
22273 {{formatnum:1<nowiki/>2}}
22274 {{formatnum:1<nowiki/>2|R}}
22275 !! html
22276 <p>12
22277 12
22278 </p>
22279 !! end
22280
22281 !! test
22282 Check noCommafy in formatNum
22283 !! options
22284 language=be-tarask
22285 !! wikitext
22286 {{formatnum:123456.78}}
22287 {{formatnum:123456.78|NOSEP}}
22288 !! html
22289 <p>123 456,78
22290 123456.78
22291 </p>
22292 !! end
22293
22294 !! test
22295 Wrong option for formatNum (bug 56199)
22296 !! wikitext
22297 {{formatnum:1,234.56|Random}}
22298 {{formatnum:1,234.56|EVERYTHING}}
22299 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
22300 !! html
22301 <p>1,234.56
22302 1,234.56
22303 1,234.56
22304 </p>
22305 !! end
22306
22307 !! test
22308 Strip marker in grammar
22309 !! options
22310 language=fi
22311 !! wikitext
22312 {{grammar:elative|foo<nowiki/>bar}}
22313 !! html
22314 <p>foobarista
22315 </p>
22316 !! end
22317
22318 !! test
22319 Strip marker in padleft
22320 !! wikitext
22321 {{padleft:|2|x<nowiki/>y}}
22322 !! html
22323 <p>xy
22324 </p>
22325 !! end
22326
22327 !! test
22328 Strip marker in padright
22329 !! wikitext
22330 {{padright:|2|x<nowiki/>y}}
22331 !! html
22332 <p>xy
22333 </p>
22334 !! end
22335
22336 !! test
22337 Strip marker in anchorencode
22338 !! wikitext
22339 {{anchorencode:x<nowiki/>y}}
22340 !! html
22341 <p>xy
22342 </p>
22343 !! end
22344
22345 !! test
22346 nowiki inside link inside heading (bug 18295)
22347 !! wikitext
22348 ==[[foo|x<nowiki>y</nowiki>z]]==
22349 !! html
22350 <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>
22351
22352 !! end
22353
22354 !! test
22355 new support for bdi element (bug 31817)
22356 !! wikitext
22357 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22358 !! html
22359 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22360
22361 !!end
22362
22363 !! test
22364 Ignore pipe between table row attributes
22365 !! wikitext
22366 {|
22367 | quux
22368 |- id=foo | style='color: red'
22369 | bar
22370 |}
22371 !! html
22372 <table>
22373 <tr>
22374 <td> quux
22375 </td></tr>
22376 <tr id="foo" style="color: red">
22377 <td> bar
22378 </td></tr></table>
22379
22380 !! end
22381
22382 !!test
22383 Gallery override link with WikiLink (bug 34852)
22384 !! wikitext
22385 <gallery>
22386 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
22387 </gallery>
22388 !! html
22389 <ul class="gallery mw-gallery-traditional">
22390 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22391 <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>
22392 <div class="gallerytext">
22393 <p>caption
22394 </p>
22395 </div>
22396 </div></li>
22397 </ul>
22398
22399 !! end
22400
22401 !!test
22402 Gallery override link with absolute external link (bug 34852)
22403 !! wikitext
22404 <gallery>
22405 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
22406 </gallery>
22407 !! html
22408 <ul class="gallery mw-gallery-traditional">
22409 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22410 <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>
22411 <div class="gallerytext">
22412 <p>caption
22413 </p>
22414 </div>
22415 </div></li>
22416 </ul>
22417
22418 !! end
22419
22420 !! test
22421 Gallery override link with absolute external link with LanguageConverter
22422 !! options
22423 language=zh
22424 !! input
22425 <gallery>
22426 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
22427 </gallery>
22428 !! result
22429 <ul class="gallery mw-gallery-traditional">
22430 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22431 <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>
22432 <div class="gallerytext">
22433 <p>caption
22434 </p>
22435 </div>
22436 </div></li>
22437 </ul>
22438
22439 !! end
22440
22441 !!test
22442 Gallery override link with malicious javascript (bug 34852)
22443 !! wikitext
22444 <gallery>
22445 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
22446 </gallery>
22447 !! html
22448 <ul class="gallery mw-gallery-traditional">
22449 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22450 <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>
22451 <div class="gallerytext">
22452 <p>caption
22453 </p>
22454 </div>
22455 </div></li>
22456 </ul>
22457
22458 !! end
22459
22460 !!test
22461 Gallery with invalid title as link (bug 43964)
22462 !! wikitext
22463 <gallery>
22464 File:foobar.jpg|link=<
22465 </gallery>
22466 !! html
22467 <ul class="gallery mw-gallery-traditional">
22468 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22469 <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>
22470 <div class="gallerytext">
22471 </div>
22472 </div></li>
22473 </ul>
22474
22475 !! end
22476
22477 !!test
22478 Language parser function
22479 !! wikitext
22480 {{#language:ar}}
22481 !! html
22482 <p>العربية
22483 </p>
22484 !! end
22485
22486 !!test
22487 Padleft and padright as substr
22488 !! wikitext
22489 {{padleft:|3|abcde}}
22490 {{padright:|3|abcde}}
22491 !! html
22492 <p>abc
22493 abc
22494 </p>
22495 !! end
22496
22497 !!test
22498 Special parser function
22499 !! wikitext
22500 {{#special:RandomPage}}
22501 {{#special:BaDtItLe}}
22502 {{#special:Foobar}}
22503 !! html
22504 <p>Special:Random
22505 Special:Badtitle
22506 Special:Foobar
22507 </p>
22508 !! end
22509
22510 !!test
22511 Bug 34939 - Case insensitive link parsing ([HttP://])
22512 !! wikitext
22513 [HttP://MediaWiki.Org/]
22514 !! html/php
22515 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
22516 </p>
22517 !! html/parsoid
22518 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
22519 !! end
22520
22521 !!test
22522 Bug 34939 - Case insensitive link parsing ([HttP:// title])
22523 !! wikitext
22524 [HttP://MediaWiki.Org/ MediaWiki]
22525 !! html
22526 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22527 </p>
22528 !! end
22529
22530 !!test
22531 Bug 34939 - Case insensitive link parsing (HttP://)
22532 !! wikitext
22533 HttP://MediaWiki.Org/
22534 !! html/php
22535 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22536 </p>
22537 !! html/parsoid
22538 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22539 !! end
22540
22541 !!test
22542 Disable TOC
22543 !! options
22544 notoc
22545 !! wikitext
22546 Lead
22547 == Section 1 ==
22548 == Section 2 ==
22549 == Section 3 ==
22550 == Section 4 ==
22551 == Section 5 ==
22552 !! html
22553 <p>Lead
22554 </p>
22555
22556 <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>
22557 <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>
22558 <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>
22559 <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>
22560 <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>
22561
22562 !! end
22563
22564
22565 ###
22566 ### Parsoid-specific tests
22567 ### Parsoid-PHP parser incompatibilities
22568 ###
22569 !!test
22570 1. SOL-sensitive wikitext tokens as template-args
22571 !!options
22572 parsoid=wt2html,wt2wt
22573 !! wikitext
22574 {{echo|*a}}
22575 {{echo|#a}}
22576 {{echo|:a}}
22577 !! html
22578 <span about="#mwt1" typeof="mw:Transclusion">
22579 </span><ul about="#mwt1"><li>a</li>
22580 </ul>
22581 <span about="#mwt2" typeof="mw:Transclusion">
22582 </span><ol about="#mwt2"><li>a</li>
22583 </ol>
22584 <span about="#mwt3" typeof="mw:Transclusion">
22585 </span><dl about="#mwt3"><dd>a</dd>
22586 </dl>
22587 !!end
22588
22589 #### -----------------------------------------------------------------
22590 #### Parsoid-specific functionality tests
22591 #### -----------------------------------------------------------------
22592
22593 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
22594 # We know wt2wt will fail, but we expect selser to pass.
22595 # Due to the nature of our testing, wt2wt and selser tests will enter the
22596 # blacklist and we'll catch selser regressions based on changes to the
22597 # blacklist entries for selser tests.
22598 !! test
22599 1. Bad treebuilder fixup of formatting elt is cleaned up
22600 !! options
22601 parsoid=wt2html,wt2wt
22602 !! wikitext
22603 {|
22604 |
22605 <small>
22606 [[Image:Foobar.jpg|right|Test]]
22607 </small>
22608 |}
22609 !! html/parsoid
22610 <table>
22611 <tbody><tr><td>
22612 <small>
22613 <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>
22614 </small>
22615 </td></tr>
22616 </tbody></table>
22617 !! end
22618
22619 !! test
22620 2. Bad treebuilder fixup of formatting elt is cleaned up
22621 !! options
22622 parsoid=wt2html,wt2wt
22623 !! wikitext
22624 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22625
22626 <small>[[Image:Foobar.jpg|right|300px]]</small>
22627 !! html/parsoid
22628
22629 <p><b>foo</b></p>
22630 <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>
22631 <p><b>bar</b></p>
22632 <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>
22633 !! end
22634
22635 !! test
22636 3. Bad treebuilder fixup of formatting elt is cleaned up
22637 !! options
22638 parsoid=wt2html,wt2wt
22639 !! wikitext
22640 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22641 !! html/parsoid
22642 <p><small><b>foo</b></small></p>
22643 <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>
22644 <p><small><b>bar</b></small></p>
22645 !! end
22646
22647 !! test
22648 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22649 !! options
22650 parsoid=wt2html,wt2wt
22651 !! wikitext
22652 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22653 !! html/parsoid
22654 <p><b><small></small></b></p>
22655 <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>
22656 <p></p>
22657 !! end
22658
22659 #### ----------------------------------------------------------------
22660 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22661 #### tags. Parsoid's output for these tags differs from that of the
22662 #### PHP parser.
22663 #### ----------------------------------------------------------------
22664
22665 !!test
22666 Ref: 1. ref-location should be replaced with an index span
22667 !! wikitext
22668 A <ref>foo</ref>
22669 B <ref name="x">foo</ref>
22670 C <ref name="y" />
22671 <references />
22672 !! html/parsoid
22673 <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>
22674 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>
22675 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>
22676 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22677 <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>
22678 <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>
22679 <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>
22680 </ol>
22681 !!end
22682
22683 !!test
22684 Ref: 2. ref-tags with identical names should all get the same index
22685 !! wikitext
22686 A <ref name="x">foo</ref>
22687 B <ref name="x" />
22688 <references />
22689 !! html/parsoid
22690 <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>
22691 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>
22692 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22693 <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>
22694 </ol>
22695 !!end
22696
22697 !!test
22698 Ref: 3. spaces in ref-names should be ignored
22699 !! wikitext
22700 A <ref name="x">foo</ref>
22701 B <ref name=" x " />
22702 C <ref name= x />
22703 <references />
22704 !! html/parsoid
22705 <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>
22706 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>
22707 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>
22708 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22709 <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>
22710 </ol>
22711 !!end
22712
22713 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22714 !!test
22715 Ref: 4. 'constructor' should be accepted as a valid ref-name
22716 !! wikitext
22717 A <ref name="constructor">foo</ref>
22718 <references />
22719 !! html/parsoid
22720 <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>
22721 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22722 <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>
22723 </ol>
22724 !!end
22725
22726 !!test
22727 Ref: 5. body should accept generic wikitext
22728 !! wikitext
22729 A <ref>
22730 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22731 </ref>
22732
22733 <references />
22734 !! html/parsoid
22735 <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>
22736
22737 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22738 <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>
22739 </span></li>
22740 </ol>
22741 !!end
22742
22743 !!test
22744 Ref: 6. indent-pres should not be output in ref-body
22745 !! wikitext
22746 A <ref>
22747 foo
22748 bar
22749 baz
22750 </ref>
22751
22752 <references />
22753 !! html/parsoid
22754 <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>
22755
22756 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22757 <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
22758 bar
22759 baz
22760 </span></li>
22761 </ol>
22762 !!end
22763
22764 !!test
22765 Ref: 7. No p-wrapping in ref-body
22766 !! wikitext
22767 A <ref>
22768 foo
22769
22770 bar
22771
22772
22773 baz
22774
22775
22776
22777 booz
22778 </ref>
22779
22780 <references />
22781 !! html/parsoid
22782 <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>
22783
22784 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22785 <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
22786
22787 bar
22788
22789
22790 baz
22791
22792
22793
22794 booz
22795 </span></li>
22796 </ol>
22797 !!end
22798
22799 !!test
22800 Ref: 8. transclusion wikitext has lower precedence
22801 !! wikitext
22802 A <ref> foo {{echo|</ref> B C}}
22803
22804 <references />
22805 !! html/parsoid
22806 <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>
22807 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22808 <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>
22809 </ol>
22810 !!end
22811
22812 !!test
22813 Ref: 9. unclosed comments should not leak out of ref-body
22814 !! wikitext
22815 A <ref> foo <!--</ref> B C
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> B C</p>
22819 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22820 <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>
22821 </ol>
22822 !!end
22823
22824 !!test
22825 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22826 !! wikitext
22827 A <ref> <b> foo </ref> B C
22828
22829 <references />
22830 !! html/parsoid
22831 <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>
22832
22833
22834 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22835 <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>
22836 </ol>
22837 !!end
22838
22839 !!test
22840 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22841 !! wikitext
22842 A <ref>foo</ref> B
22843 C <ref>bar</ref> D
22844 <references />
22845 !! html/parsoid
22846 <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
22847 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>
22848 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22849 <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>
22850 <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>
22851 </ol>
22852 !!end
22853
22854 !!test
22855 Ref: 12. ref-tags act as trailing newline migration barrier
22856 !! wikitext
22857 <!--the newline at the end of this line moves out of the p tag-->a
22858
22859 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22860 <ref />
22861
22862 c
22863 <references />
22864 !! html/parsoid
22865 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22866
22867
22868 <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>
22869 <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>
22870
22871 <p>c</p>
22872 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22873 <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>
22874 <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>
22875 !!end
22876
22877 !!test
22878 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22879 !! wikitext
22880 <ref>foo</ref> A
22881 <ref>bar
22882 </ref> B
22883 <references />
22884 !! html/parsoid
22885 <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
22886 <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>
22887 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22888 <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>
22889 <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
22890 </span></li>
22891 </ol>
22892 !!end
22893
22894 ## Roundtripping fails because of nowiki'ing
22895 !! test
22896 Ref: 14. A nested ref-tag should be emitted as plain text
22897 !! options
22898 parsoid=wt2html
22899 !! wikitext
22900 <ref>foo <ref>bar</ref> baz</ref>
22901
22902 <references />
22903 !! html/parsoid
22904 <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>
22905
22906 <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>
22907 !! end
22908
22909 !!test
22910 Ref: 15. ref-tags with identical names should get identical indexes
22911 !! wikitext
22912 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22913 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22914
22915 <references />
22916 !! html/parsoid
22917 <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>
22918 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>
22919
22920 <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>
22921 </ol>
22922 !!end
22923
22924 ## We don't bother wt2wt-ing non-standard whitespace
22925 !!test
22926 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22927 !!options
22928 parsoid=wt2html
22929 !! wikitext
22930 A <ref >foo</ref >
22931
22932 <references />
22933 !! html/parsoid
22934 <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>
22935 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22936 <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>
22937 !!end
22938
22939 !!test
22940 Ref: 17. Generate valid HTML5 id/about attributes
22941 !!wikitext
22942 <ref name="a b">foo</ref>
22943 <ref name=":0">ve-created name</ref>
22944
22945 <references />
22946 !!html/parsoid
22947 <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>
22948 <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>
22949
22950 <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>
22951
22952 !!end
22953
22954 !!test
22955 Ref: 18. T58916: Extension attributes should be parsed as plain text
22956 !!wikitext
22957 <ref name="{{echo|a}}">foo</ref>
22958
22959 <references />
22960 !!html/parsoid
22961 <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>
22962 </p>
22963
22964 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22965 <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>
22966 </ol>
22967 !!end
22968
22969 !!test
22970 Ref: 19. ref-tags with identical name encodings should get identical indexes
22971 !! wikitext
22972 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22973
22974 <references />
22975 !! html/parsoid
22976 <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>
22977 </p>
22978 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22979 <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>
22980 </ol>
22981 !!end
22982
22983 !!test
22984 Ref: 20. ref-tags with identical names but different content should keep it
22985 !! wikitext
22986 A <ref name="foo">Foo one</ref>
22987 B <ref name="foo">Foo two</ref>
22988 C <ref name="foo" />
22989
22990 <references />
22991 !! html/parsoid
22992 <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>
22993 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>
22994 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>
22995
22996 <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>
22997 </ol>
22998 !!end
22999
23000 !!test
23001 References: 1. references tag without any refs should be handled properly
23002 !! wikitext
23003 <references />
23004 !! html/parsoid
23005 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
23006 !!end
23007
23008 !!test
23009 References: 2. references tag with group only outputs references from that group
23010 !! wikitext
23011 A <ref group="a">foo</ref>
23012 B <ref group="b">bar</ref>
23013 C <ref>baz</ref>
23014
23015 <references group="a" />
23016 <references />
23017 <references group="b" />
23018 !! html/parsoid
23019 <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>
23020 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>
23021 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>
23022
23023 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
23024 <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>
23025 </ol>
23026 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
23027 <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>
23028 </ol>
23029 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
23030 <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>
23031 </ol>
23032 !!end
23033
23034 !!test
23035 References: 3. ref list should be cleared after processing references
23036 !! wikitext
23037 A <ref>foo</ref>
23038
23039 <references />
23040
23041 B <ref>bar</ref>
23042
23043 <references />
23044 !! html/parsoid
23045 <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>
23046
23047 <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>
23048 </ol>
23049
23050 <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>
23051
23052 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
23053 <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>
23054 </ol>
23055 !!end
23056
23057 !!test
23058 References: 4. only referenced group should be cleared after processing references
23059 !! wikitext
23060 A <ref group="a">afoo</ref>
23061 B <ref>bfoo</ref>
23062
23063 <references group="a" />
23064
23065 C <ref>cfoo</ref>
23066
23067 <references />
23068 !! html/parsoid
23069 <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>
23070 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>
23071
23072 <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>
23073 </ol>
23074
23075 <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>
23076
23077 <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>
23078 </ol>
23079 !!end
23080
23081 ## Don't expect this to rt since we're dropping content
23082 !! test
23083 References: 5. ref tags in references should be processed while ignoring all other content
23084 !! options
23085 parsoid=wt2html,html2html
23086 !! wikitext
23087 A <ref name="a" />
23088 B <ref name="b">bar</ref>
23089
23090 <references>
23091 <ref name="a">foo</ref>
23092 This should just get lost.
23093 </references>
23094 !! html/parsoid
23095 <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>
23096 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>
23097
23098
23099 <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>
23100 </ol>
23101 !! end
23102
23103 !! test
23104 References: 6. <references /> from a transclusion
23105 !! wikitext
23106 <ref>Foo</ref> {{echo|<references />}}
23107 !! html/parsoid
23108 <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>
23109 </ol>
23110 !! end
23111
23112 !! test
23113 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
23114 !! wikitext
23115 A <ref>foo bar for a</ref>
23116 B <ref group="X" name="b" />
23117
23118 <references />
23119
23120 <references group="X">
23121 <ref name="b">foo</ref>
23122 </references>
23123 !! html/parsoid
23124 <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>
23125 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>
23126 </p>
23127
23128 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
23129 <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>
23130 </ol>
23131
23132 <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"}}'>
23133 <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>
23134 </ol>
23135 !! end
23136
23137 !! test
23138 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
23139 !! wikitext
23140 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
23141 <references />
23142 !! html/parsoid
23143 <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>
23144 <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>
23145 </ol>
23146 !!end
23147
23148 # This test only works in wt2html now as the <references /> are always generated
23149 # unless selser is active. Once T72722 is fixed, we should add a changes test
23150 # here to ensure that unrelated changes don't add the new <references />
23151 # when selser is active.
23152 !! test
23153 References: 9. Generate missing references list at the end
23154 !! wikitext
23155 A <ref>foo</ref>
23156 B <ref group="inexistent">bar</ref>
23157 !! html/parsoid
23158 <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>
23159 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
23160 <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>
23161 </ol>
23162 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
23163 <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>
23164 </ol>
23165 !! end
23166
23167 !! test
23168 References: 10. New <references/> shouldn't be added for unrelated edits.
23169 !! options
23170 parsoid={
23171 "modes": ["selser"],
23172 "changes": [["#x", "remove"]],
23173 "selser": "noauto"
23174 }
23175 !! wikitext
23176 Unrelated text<span id="x"> that's going to disappear</span>.
23177 A <ref>foo</ref>
23178 !! wikitext/edited
23179 Unrelated text.
23180 A <ref>foo</ref>
23181 !!end
23182
23183 !! test
23184 Entities in ref name
23185 !! wikitext
23186 <ref name="test &amp; me">hi</ref>
23187 <references />
23188 !! html/parsoid
23189 <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>
23190 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23191 <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>
23192 </ol>
23193 !! end
23194
23195 ## The output here may look funny, but it's what the php parser will do. The
23196 ## unclosed references tag becomes escaped text, and then a new references
23197 ## tag is auto-generated. The test is wt2html only because it roundtrips with
23198 ## nowiki tags, and the auto-generated references tag is only dropped in
23199 ## rtTestMode.
23200 !! test
23201 Generate references for unclosed references tag
23202 !! options
23203 parsoid=wt2html
23204 !! wikitext
23205 a<ref>foo</ref>
23206
23207 <references>
23208 !! html/parsoid
23209 <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>
23210
23211 <p>&lt;references></p>
23212 <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>
23213 !! end
23214
23215 !! test
23216 New reference serializes on its own line
23217 !! options
23218 parsoid=wt2wt,html2wt
23219 !! wikitext
23220 foo
23221 <references />
23222 !! html/parsoid
23223 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
23224 !! end
23225
23226 #### ----------------------------------------------------------------
23227 #### Parsoid-only testing of Parsoid's impl of LST
23228 #### Not implemented yet, see
23229 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
23230 #### ----------------------------------------------------------------
23231
23232 ## We still need to support serializing the older format while content is stored.
23233 !! test
23234 LST Sections: Backwards compatibility
23235 !! options
23236 parsoid={
23237 "suppressErrors": true,
23238 "modes": ["html2wt"]
23239 }
23240 !! wikitext
23241 <section begin="2011-05-16" />
23242 <section end="2014-04-10 (MW 1.23wmf22)" />
23243 !! html/parsoid
23244 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
23245 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
23246 !! end
23247
23248 ## The unconventional output is the result of `usePHPPreProcessor` being
23249 ## disabled in parserTests.js. This test is mainly just to show <section> is
23250 ## recognized as an extension tag w/o a native handler.
23251 !! test
23252 LST Sections: Newfangled approach
23253 !! options
23254 parsoid={ "suppressErrors": true }
23255 !! wikitext
23256 <section begin="2011-05-16" />
23257 <section end="2014-04-10 (MW 1.23wmf22)" />
23258 !! html/parsoid
23259 <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>
23260 <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>
23261 !! end
23262
23263 #--------- Test stripping of empty nodes in template content ----------
23264 !!test
23265 Empty LI and TR nodes should be stripped from template content
23266 !!wikitext
23267 {{EmptyLITest}}
23268 {{EmptyTRTest}}
23269 !!html/parsoid
23270 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
23271 <li>a</li>
23272 <li>b</li>
23273 </ul>
23274 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
23275 <tbody>
23276 <tr>
23277 <td>foo</td>
23278 </tr>
23279 <tr>
23280 <td>bar</td>
23281 </tr>
23282 </tbody>
23283 </table>
23284 !!end
23285
23286 !!test
23287 Empty LI and TR nodes should not be stripped from top-level content
23288 !!wikitext
23289 * a
23290 *
23291 * b
23292 {|
23293 |-
23294 |-
23295 |foo
23296 |}
23297 !!html/parsoid
23298 <ul>
23299 <li> a</li>
23300 <li></li>
23301 <li> b</li>
23302 </ul>
23303 <table>
23304 <tbody>
23305 <tr></tr>
23306 <tr>
23307 <td>foo</td>
23308 </tr>
23309 </tbody>
23310 </table>
23311 !!end
23312
23313 !!test
23314 Empty TR nodes should not be stripped if they have any attributes set
23315 !!wikitext
23316 {{EmptyTRWithHTMLAttrTest}}
23317 !!html/parsoid
23318 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
23319 <tr align="center"></tr>
23320 <tr><td>foo</td></tr>
23321 <tr align="center"></tr>
23322 <tr><td>bar</td></tr>
23323 </table>
23324 !!end
23325
23326 #### ----------------------------------------------------------------
23327 #### The following section of tests are primarily to test
23328 #### wikitext escaping capabilities of Parsoid. Given that
23329 #### escaping can be done any number of ways, the wikitext (input)
23330 #### is always adjusted to reflect how Parsoid adds nowiki
23331 #### escape tags.
23332 ####
23333 #### We are marking several tests as parsoid-only since the
23334 #### HTML in the result section is different from what the
23335 #### PHP parser generates for it.
23336 #### ----------------------------------------------------------------
23337
23338
23339 #### --------------- Headings ---------------
23340 #### 0. Unnested
23341 #### 1. Nested inside html <h1>=foo=</h1>
23342 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
23343 #### 3. Nested inside html with wikitext split by html tags
23344 #### 4. No escape needed
23345 #### 5. Empty headings <h1></h1>
23346 #### 6. Heading chars in SOL context
23347 #### ----------------------------------------
23348 !! test
23349 Headings: 0. Unnested
23350 !! options
23351 parsoid=html2wt
23352 !! html/parsoid
23353 <p>=foo=</p>
23354
23355 <p> =foo=
23356 <!--cmt-->
23357 =foo=</p>
23358
23359 <p>=foo<i>a</i>=</p>
23360 !! wikitext
23361 <nowiki>=foo=</nowiki>
23362
23363 <nowiki> </nowiki>=foo=
23364 <!--cmt-->
23365 <nowiki>=foo=</nowiki>
23366
23367 =foo''a''<nowiki>=</nowiki>
23368 !!end
23369
23370 # New headings and existing headings are handled differently
23371 !! test
23372 Headings: 1. Nested inside html
23373 !! options
23374 parsoid=html2wt
23375 !! html/parsoid
23376 <h1>=foo=</h1>
23377 <h2>=foo=</h2>
23378 <h3>=foo=</h3>
23379
23380 <h1 data-parsoid=''>=foo=</h1>
23381 <h2 data-parsoid=''>=foo=</h2>
23382 <h3 data-parsoid=''>=foo=</h3>
23383 <h4 data-parsoid=''>=foo=</h4>
23384 <h5 data-parsoid=''>=foo=</h5>
23385 <h6 data-parsoid=''>=foo=</h6>
23386 !! wikitext
23387 = =foo= =
23388
23389 == =foo= ==
23390
23391 === =foo= ===
23392
23393 =<nowiki>=foo=</nowiki>=
23394 ==<nowiki>=foo=</nowiki>==
23395 ===<nowiki>=foo=</nowiki>===
23396 ====<nowiki>=foo=</nowiki>====
23397 =====<nowiki>=foo=</nowiki>=====
23398 ======<nowiki>=foo=</nowiki>======
23399
23400 !!end
23401
23402 !! test
23403 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
23404 !! options
23405 parsoid=html2wt
23406 !! html/parsoid
23407 <h1>foo</h1>*bar
23408 <h1>foo</h1>=bar
23409 <h1>foo</h1>=bar=
23410 !! wikitext
23411 = foo =
23412 <nowiki>*</nowiki>bar
23413
23414 = foo =
23415 =bar
23416
23417 = foo =
23418 <nowiki>=bar=</nowiki>
23419 !!end
23420
23421 !! test
23422 Headings: 3. Nested inside html with wikitext split by html tags
23423 !! options
23424 parsoid=html2wt
23425 !! html/parsoid
23426 <h1>=<b>bold</b>foo=</h1>
23427 !! wikitext
23428 = ='''bold'''foo= =
23429 !!end
23430
23431 !! test
23432 Headings: 4a. No escaping needed (testing just h1 and h2)
23433 !! options
23434 parsoid=html2wt
23435 !! html/parsoid
23436 <h1>=foo</h1>
23437 <h1>foo=</h1>
23438 <h1> =foo= </h1>
23439 <h1>=foo= bar</h1>
23440 <h2>=foo</h2>
23441 <h2>foo=</h2>
23442 <h1>=</h1>
23443 <h1><i>=</i>foo=</h1>
23444 !! wikitext
23445 = =foo =
23446
23447 = foo= =
23448
23449 = =foo= =
23450
23451 = =foo= bar =
23452
23453 == =foo ==
23454
23455 == foo= ==
23456
23457 = = =
23458
23459 = ''=''foo= =
23460 !!end
23461
23462 !! test
23463 Headings: 4b. No escaping needed (inside p-tags)
23464 !! options
23465 parsoid=html2wt
23466 !! html/parsoid
23467 <p>===
23468 =foo= x
23469 =foo= <s></s>
23470 </p>
23471 !! wikitext
23472 ===
23473 =foo= x
23474 =foo= <s></s>
23475 !!end
23476
23477 !! test
23478 Headings: 5. Empty headings
23479 !! options
23480 parsoid=html2wt
23481 !! html/parsoid
23482 <h1 data-parsoid='{}'></h1>
23483
23484 <h2 data-parsoid='{}'></h2>
23485
23486 <h3 data-parsoid='{}'></h3>
23487
23488 <h4 data-parsoid='{}'></h4>
23489
23490 <h5 data-parsoid='{}'></h5>
23491
23492 <h6 data-parsoid='{}'></h6>
23493 !! wikitext
23494 =<nowiki/>=
23495
23496 ==<nowiki/>==
23497
23498 ===<nowiki/>===
23499
23500 ====<nowiki/>====
23501
23502 =====<nowiki/>=====
23503
23504 ======<nowiki/>======
23505 !!end
23506
23507 !! test
23508 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23509 !! options
23510 parsoid=html2wt
23511 !! html/parsoid
23512 <p>=a=</p>
23513
23514 <p>=a=</p>
23515
23516 <p>=a=</p>
23517 !! wikitext
23518 <nowiki>=a=</nowiki>
23519
23520 <nowiki>=a=</nowiki>
23521
23522 <nowiki>=a=</nowiki>
23523 !!end
23524
23525 !! test
23526 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23527 !! options
23528 parsoid=html2wt
23529 !! html/parsoid
23530 <p>=a=
23531 b</p>
23532
23533 <p>=a=
23534 b</p>
23535
23536 <p>=a=
23537 b</p>
23538 !! wikitext
23539 <nowiki>=a=</nowiki>
23540 b
23541
23542 <nowiki>=a=</nowiki>
23543 b
23544
23545 <nowiki>=a=</nowiki>
23546 b
23547 !!end
23548
23549 !! test
23550 Headings: 6c. Heading chars in SOL context (leading newline break)
23551 !! options
23552 parsoid=html2wt
23553 !! html/parsoid
23554 <p>a
23555 =b=</p>
23556 !! wikitext
23557 a
23558 <nowiki>=b=</nowiki>
23559 !!end
23560
23561 !! test
23562 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23563 !! options
23564 parsoid=html2wt
23565 !! html/parsoid
23566 <!--c0--><p>=a=</p>
23567
23568 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23569 !! wikitext
23570 <!--c0--><nowiki>=a=</nowiki>
23571
23572 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23573 !!end
23574
23575 !! test
23576 Headings: 6d. Heading chars in SOL context (No escaping needed)
23577 !! options
23578 parsoid=html2wt
23579 !! html/parsoid
23580 =a=<div>b</div>
23581 !! wikitext
23582 =a=<div>b</div>
23583 !!end
23584
23585 !! test
23586 Headings: 7. Insert a newline between new content and headings
23587 !! options
23588 parsoid=html2wt
23589 !! html/parsoid
23590 <h2>NEW</h2>
23591 <p>new</p>
23592 <h2 data-parsoid='{}'>A</h2>
23593 <p data-parsoid='{}'>a</p>
23594 !! wikitext
23595 == NEW ==
23596 new
23597
23598 ==A==
23599 a
23600
23601 !! end
23602
23603 #### --------------- Lists ---------------
23604 #### 0. Outside nests (*foo, etc.)
23605 #### 1. Nested inside html <ul><li>*foo</li></ul>
23606 #### 2. Inside definition lists
23607 #### 3. Only bullets at start should be escaped
23608 #### 4. No escapes needed
23609 #### 5. No unnecessary escapes
23610 #### 6. Escape bullets in SOL position
23611 #### 7. Escape bullets in a multi-line context
23612 #### ----------------------------------------
23613
23614 !! test
23615 Lists: 0. Outside nests
23616 !! options
23617 parsoid=html2wt
23618 !! html/parsoid
23619 <p>*foo</p>
23620
23621 <p>#foo</p>
23622
23623 <p>;Foo:bar</p>
23624 !! wikitext
23625 <nowiki>*</nowiki>foo
23626
23627 <nowiki>#</nowiki>foo
23628
23629 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23630 !!end
23631
23632 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23633 ## to test wikitext escaping, and insignificant whitespace diffs
23634 ## cause PHP parser tests to barf
23635 !! test
23636 Lists: 1. Nested inside html (No unnecessary escapes)
23637 !! options
23638 parsoid=html2wt
23639 !! html/parsoid
23640 <ul>
23641 <li>*foo</li>
23642 <li>#foo</li>
23643 <li>:foo</li>
23644 <li>;foo</li>
23645 <li data-parsoid='{}'>*foo</li>
23646 <li data-parsoid='{}'>#foo</li>
23647 <li data-parsoid='{}'>:foo</li>
23648 <li data-parsoid='{}'>;foo</li>
23649 </ul>
23650
23651 <ol>
23652 <li>*foo</li>
23653 <li>#foo</li>
23654 <li>:foo</li>
23655 <li>;foo</li>
23656 <li data-parsoid='{}'>*foo</li>
23657 <li data-parsoid='{}'>#foo</li>
23658 <li data-parsoid='{}'>:foo</li>
23659 <li data-parsoid='{}'>;foo</li>
23660 </ol>
23661 !! wikitext
23662 * *foo
23663 * #foo
23664 * :foo
23665 * ;foo
23666 *<nowiki>*foo</nowiki>
23667 *<nowiki>#foo</nowiki>
23668 *<nowiki>:foo</nowiki>
23669 *<nowiki>;foo</nowiki>
23670
23671 # *foo
23672 # #foo
23673 # :foo
23674 # ;foo
23675 #<nowiki>*foo</nowiki>
23676 #<nowiki>#foo</nowiki>
23677 #<nowiki>:foo</nowiki>
23678 #<nowiki>;foo</nowiki>
23679 !!end
23680
23681 !! test
23682 Lists: 2. Inside definition lists
23683 !! options
23684 parsoid=html2wt
23685 !! html/parsoid
23686 <dl><dt>;foo</dt></dl>
23687 <dl><dt>:foo</dt></dl>
23688 <dl><dt>:foo</dt>
23689 <dd>bar</dd></dl>
23690 <dl><dd>:foo</dd></dl>
23691 !! wikitext
23692 ; ;foo
23693
23694 ; <nowiki>:foo</nowiki>
23695
23696 ; <nowiki>:foo</nowiki>
23697 : bar
23698
23699 : :foo
23700 !!end
23701
23702 !! test
23703 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23704 !! options
23705 parsoid=html2wt
23706 !! html/parsoid
23707 <ul>
23708 <li>*foo*bar</li>
23709 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23710 </ul>
23711 !! wikitext
23712 * *foo*bar
23713 *<nowiki>*foo</nowiki>''it''*bar
23714 !!end
23715
23716 !! test
23717 Lists: 4. No escapes needed
23718 !! options
23719 parsoid=html2wt
23720 !! html/parsoid
23721 <ul>
23722 <li>foo*bar
23723 </li>
23724 </ul>
23725 <ul>
23726 <li><i>foo</i>*bar
23727 </li>
23728 </ul>
23729 <ul>
23730 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23731 </li>
23732 </ul>
23733 <ul>
23734 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23735 </li>
23736 </ul>
23737 !! wikitext
23738 *foo*bar
23739
23740 *''foo''*bar
23741
23742 *[[Foo]]: bar
23743
23744 *[[Foo]]*bar
23745 !!end
23746
23747 !! test
23748 Lists: 5. No unnecessary escapes
23749 !! options
23750 parsoid=html2wt
23751 !! html/parsoid
23752 <ul><li> bar <span>[[foo]]</span></li></ul>
23753 <ul><li> =bar <span>[[foo]]</span></li></ul>
23754 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23755 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23756 <ul><li> =bar <span>foo]]</span>=</li></ul>
23757 <ul><li> <s></s>: a</li></ul>
23758 <ul><li> <i>* foo</i></li></ul>
23759
23760 !! wikitext
23761 * bar <span><nowiki>[[foo]]</nowiki></span>
23762
23763 * =bar <span><nowiki>[[foo]]</nowiki></span>
23764
23765 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23766
23767 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23768
23769 * =bar <span>foo]]</span>=
23770
23771 * <s></s>: a
23772
23773 * ''* foo''
23774 !!end
23775
23776 !! test
23777 Lists: 6. Escape bullets in SOL position
23778 !! options
23779 parsoid=html2wt
23780 !! html/parsoid
23781 <p><!--cmt-->*foo</p>
23782 !! wikitext
23783 <!--cmt--><nowiki>*</nowiki>foo
23784 !!end
23785
23786 !! test
23787 Lists: 7. Escape bullets in a multi-line context
23788 !! options
23789 parsoid=html2wt
23790 !! html/parsoid
23791 <p>a
23792 *b
23793 </p>
23794 !! wikitext
23795 a
23796 <nowiki>*</nowiki>b
23797 !!end
23798
23799 !! test
23800 Lists: 8. Escape colons only if not present in tags
23801 !! options
23802 parsoid=html2wt
23803 !! html/parsoid
23804 <dl><dt>a:b<i>c:d</i></dt></dl>
23805 !! wikitext
23806 ; <nowiki>a:b</nowiki>''c:d''
23807 !! end
23808
23809 #### --------------- HRs ---------------
23810 #### 1. Single line
23811 #### -----------------------------------
23812
23813 !! test
23814 HRs: 1. Single line
23815 !! options
23816 parsoid=html2wt
23817 !! html/parsoid
23818 <hr />----
23819 <hr />=foo=
23820 <hr />*foo
23821 !! wikitext
23822 ----<nowiki>----</nowiki>
23823 ----=foo=
23824 ----*foo
23825 !! end
23826
23827 #### --------------- Tables ---------------
23828 #### 1a. Simple example
23829 #### 1b. No escaping needed (!foo)
23830 #### 1c. No escaping needed (|foo)
23831 #### 1d. No escaping needed (|}foo)
23832 ####
23833 #### 2a. Nested in td (<td>foo|bar</td>)
23834 #### 2b. Nested in td (<td>foo||bar</td>)
23835 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23836 ####
23837 #### 3a. Nested in th (<th>foo!bar</th>)
23838 #### 3b. Nested in th (<th>foo!!bar</th>)
23839 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23840 ####
23841 #### 4a. Escape -
23842 #### 4b. Escape +
23843 #### 4c. No escaping needed
23844 #### --------------------------------------
23845
23846 !! test
23847 Tables: 1a. Simple example
23848 !! options
23849 parsoid=html2wt
23850 !! html/parsoid
23851 <p>{|
23852 |}
23853 </p>
23854 !! wikitext
23855 <nowiki>{|</nowiki>
23856 |}
23857 !! end
23858
23859 !! test
23860 Tables: 1b. No escaping needed
23861 !! options
23862 parsoid=html2wt
23863 !! html/parsoid
23864 <p>!foo
23865 </p>
23866 !! wikitext
23867 !foo
23868 !! end
23869
23870 !! test
23871 Tables: 1c. No escaping needed
23872 !! options
23873 parsoid=html2wt
23874 !! html/parsoid
23875 <p>|foo
23876 </p>
23877 !! wikitext
23878 |foo
23879 !! end
23880
23881 !! test
23882 Tables: 1d. No escaping needed
23883 !! options
23884 parsoid=html2wt
23885 !! html/parsoid
23886 <p>|}foo
23887 </p>
23888 !! wikitext
23889 |}foo
23890 !! end
23891
23892 !! test
23893 Tables: 2a. Nested in td
23894 !! options
23895 parsoid=html2wt
23896 !! html/parsoid
23897 <table><tbody><tr>
23898 <td>foo|bar</td></tr>
23899 <tr><td>x<div>a|b</div></td>
23900 </tbody></table>
23901 !! wikitext
23902 {|
23903 |<nowiki>foo|bar</nowiki>
23904 |-
23905 |x<div><nowiki>a|b</nowiki></div>
23906 |}
23907 !! html/php+tidy
23908 <table>
23909 <tr>
23910 <td>foo|bar</td>
23911 </tr>
23912 <tr>
23913 <td>x
23914 <div>a|b</div>
23915 </td>
23916 </tr>
23917 </table>
23918 !! end
23919
23920 !! test
23921 Tables: 2b. Nested in td
23922 !! options
23923 parsoid=html2wt
23924 !! html/parsoid
23925 <table><tbody><tr>
23926 <td>foo||bar</td>
23927 <td>a<i>b||c</i></td>
23928 <td>a<i><div>b||c</div></i></td>
23929 </tr></tbody></table>
23930 !! wikitext
23931 {|
23932 |<nowiki>foo||bar</nowiki>
23933 |a''<nowiki>b||c</nowiki>''
23934 |a''<div><nowiki>b||c</nowiki></div>''
23935 |}
23936 !! html/php
23937 <table>
23938 <tr>
23939 <td>foo||bar
23940 </td>
23941 <td>a<i>b||c</i>
23942 </td>
23943 <td>a<i><div>b||c</div></i>
23944 </td></tr></table>
23945
23946 !! end
23947
23948 !! test
23949 Tables: 2c. Nested in td -- no escaping needed
23950 !! options
23951 parsoid=html2wt
23952 !! html/*
23953 <table>
23954 <tr>
23955 <td>foo!!bar
23956 </td></tr></table>
23957
23958 !! wikitext
23959 {|
23960 |foo!!bar
23961 |}
23962 !! end
23963
23964 !! test
23965 Tables: 3a. Nested in th
23966 !! options
23967 parsoid=html2wt
23968 !! html/*
23969 <table>
23970 <tr>
23971 <th>foo!bar
23972 </th></tr></table>
23973
23974 !! wikitext
23975 {|
23976 !foo!bar
23977 |}
23978 !! end
23979
23980 !! test
23981 Tables: 3b. Nested in th
23982 !! options
23983 parsoid=html2wt
23984 !! html/parsoid
23985 <table><tbody>
23986 <tr><th>foo!!bar</th>
23987 <th><i>foo|bar</i></th>
23988 <th><i>foo!!bar</i></th>
23989 <th><i><span>foo!!bar</span></i></th>
23990 </tr></tbody></table>
23991 !! wikitext
23992 {|
23993 !<nowiki>foo!!bar</nowiki>
23994 !''<nowiki>foo|bar</nowiki>''
23995 !''<nowiki>foo!!bar</nowiki>''
23996 !''<span><nowiki>foo!!bar</nowiki></span>''
23997 |}
23998 !! html/php
23999 <table>
24000 <tr>
24001 <th>foo!!bar
24002 </th>
24003 <th><i>foo|bar</i>
24004 </th>
24005 <th><i>foo!!bar</i>
24006 </th>
24007 <th><i><span>foo!!bar</span></i>
24008 </th></tr></table>
24009
24010 !! end
24011
24012 !! test
24013 Tables: 3c. Nested in th
24014 !! options
24015 parsoid=html2wt
24016 !! html/parsoid
24017 <table><tbody>
24018 <tr><th>foo||bar</th>
24019 <th><span typeof="mw:Nowiki">foo||bar</span></th>
24020 </tr></tbody></table>
24021 !! wikitext
24022 {|
24023 !<nowiki>foo||bar</nowiki>
24024 !<nowiki>foo||bar</nowiki>
24025 |}
24026 !! html/php
24027 <table>
24028 <tr>
24029 <th>foo||bar
24030 </th>
24031 <th>foo||bar
24032 </th></tr></table>
24033
24034 !! end
24035
24036 !! test
24037 Tables: 4a. Escape -
24038 !! options
24039 parsoid=html2wt
24040 !! html/*
24041 <table>
24042 <tr>
24043 <th>-bar
24044 </th></tr>
24045 <tr>
24046 <td>-bar
24047 </td></tr></table>
24048
24049 !! wikitext
24050 {|
24051 !-bar
24052 |-
24053 |<nowiki>-bar</nowiki>
24054 |}
24055 !! end
24056
24057 !! test
24058 Tables: 4b. Escape +
24059 !! options
24060 parsoid=html2wt
24061 !! html/*
24062 <table>
24063 <tr>
24064 <th>+bar
24065 </th></tr>
24066 <tr>
24067 <td>+bar
24068 </td></tr></table>
24069
24070 !! wikitext
24071 {|
24072 !+bar
24073 |-
24074 |<nowiki>+bar</nowiki>
24075 |}
24076 !! end
24077
24078 !! test
24079 Tables: 4c. No escaping needed
24080 !! options
24081 parsoid=html2wt
24082 !! html/parsoid
24083 <table><tbody>
24084 <tr><td>foo-bar</td><td>foo+bar</td></tr>
24085 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
24086 <tr><td>foo
24087 <p>bar|baz
24088 +bar
24089 -bar</p></td></tr>
24090 <tr><td>x
24091 <div>a|b</div></td>
24092 </tbody></table>
24093 !! wikitext
24094 {|
24095 |foo-bar
24096 |foo+bar
24097 |-
24098 |''foo''-bar
24099 |''foo''+bar
24100 |-
24101 |foo
24102 bar|baz
24103 +bar
24104 -bar
24105 |-
24106 |x
24107 <div>a|b</div>
24108 |}
24109 !! html/php
24110 <table>
24111 <tr>
24112 <td>foo-bar
24113 </td>
24114 <td>foo+bar
24115 </td></tr>
24116 <tr>
24117 <td><i>foo</i>-bar
24118 </td>
24119 <td><i>foo</i>+bar
24120 </td></tr>
24121 <tr>
24122 <td>foo
24123 <p>bar|baz
24124 +bar
24125 -bar
24126 </p>
24127 </td></tr>
24128 <tr>
24129 <td>x
24130 <div>a|b</div>
24131 </td></tr></table>
24132
24133 !! end
24134
24135 !! test
24136 Tables: 4d. No escaping needed
24137 !! options
24138 parsoid=html2wt
24139 !! html/parsoid
24140 <table>
24141 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
24142 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
24143 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
24144 </tbody></table>
24145 !! wikitext
24146 {|
24147 |[[Foo]]-bar
24148 ||+1
24149 ||-2
24150 |}
24151 !! html/php
24152 <table>
24153 <tr>
24154 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
24155 </td>
24156 <td>+1
24157 </td>
24158 <td>-2
24159 </td></tr></table>
24160
24161 !! end
24162
24163 !! test
24164 T97430: Don't emit empty nowiki pairs around marker meta tags
24165 !! options
24166 parsoid=html2wt
24167 !! html/parsoid
24168 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24169 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
24170 !! wikitext
24171 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24172 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
24173 !! end
24174
24175 !! test
24176 Unclosed xmlish element in table line shouldn't eat end delimiters
24177 !! options
24178 parsoid=html2wt
24179 !! html/parsoid
24180 <table>
24181 <tbody><tr><td> &lt;foo</td>
24182 <td> bar></td></tr>
24183 </tbody></table>
24184 !! wikitext
24185 {|
24186 | <foo
24187 | bar>
24188 |}
24189 !! html/php
24190 <table>
24191 <tr>
24192 <td> &lt;foo
24193 </td>
24194 <td> bar&gt;
24195 </td></tr></table>
24196
24197 !! end
24198
24199 #### --------------- Links ----------------
24200 #### 1. Quote marks in link text
24201 #### 2. Wikilinks: Escapes needed
24202 #### 3. Wikilinks: No escapes needed
24203 #### 4. Extlinks: Escapes needed
24204 #### 5. Extlinks: No escapes needed
24205 #### --------------------------------------
24206 !! test
24207 Links 1. WikiLinks: No escapes needed
24208 !! options
24209 parsoid=html2wt
24210 !! html/parsoid
24211 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
24212 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
24213 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
24214 !! wikitext
24215 [[Foo|Foo''boo'']]
24216 [[Foo|[Foobar]]]
24217 [[Foo|x [Foobar] x]]
24218 !! html/php
24219 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
24220 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
24221 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
24222 </p>
24223 !! end
24224
24225 !! test
24226 Links 2. WikiLinks: Escapes needed
24227 !! options
24228 parsoid=html2wt
24229 !! html/parsoid
24230 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
24231 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
24232 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
24233 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
24234 <a href="Foo" rel="mw:WikiLink">|Bar</a>
24235 <a href="Foo" rel="mw:WikiLink">]]bar</a>
24236 <a href="Foo" rel="mw:WikiLink">[[bar</a>
24237 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
24238 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
24239 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
24240 !! wikitext
24241 [[Foo|<nowiki>Foobar]</nowiki>]]
24242 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
24243 [[Foo|<nowiki>[[Bar]]</nowiki>]]
24244 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
24245 [[Foo|<nowiki>|Bar</nowiki>]]
24246 [[Foo|<nowiki>]]bar</nowiki>]]
24247 [[Foo|<nowiki>[[bar</nowiki>]]
24248 [[Foo|<nowiki>x [[ y</nowiki>]]
24249 [[Foo|<nowiki>x ]] y</nowiki>]]
24250 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
24251 !! html/php
24252 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
24253 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
24254 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
24255 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
24256 <a href="/wiki/Foo" title="Foo">|Bar</a>
24257 <a href="/wiki/Foo" title="Foo">]]bar</a>
24258 <a href="/wiki/Foo" title="Foo">[[bar</a>
24259 <a href="/wiki/Foo" title="Foo">x [[ y</a>
24260 <a href="/wiki/Foo" title="Foo">x ]] y</a>
24261 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
24262 </p>
24263 !! end
24264
24265 !! test
24266 Links 3. WikiLinks: No escapes needed
24267 !! options
24268 parsoid=html2wt
24269 !! html/parsoid
24270 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
24271 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
24272 !! wikitext
24273 [[Foo|[Foobar]]
24274 [[Foo|foo|bar]]
24275 !! html/php
24276 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
24277 <a href="/wiki/Foo" title="Foo">foo|bar</a>
24278 </p>
24279 !! end
24280
24281 !! test
24282 Links 4. ExtLinks: Escapes needed
24283 !! options
24284 parsoid=html2wt
24285 !! html/parsoid
24286 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
24287 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
24288 <p>[http://google.com]</p>
24289 <p>[http://google.com google]</p>
24290 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
24291 <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>
24292 !! wikitext
24293 [http://google.com <nowiki>[google]</nowiki>]
24294 [http://google.com <nowiki>google]</nowiki>]
24295
24296 <nowiki>[http://google.com]</nowiki>
24297
24298 <nowiki>[http://google.com google]</nowiki>
24299
24300 [http://google.com<nowiki>]</nowiki>
24301
24302 [{{echo|http://google.com}}<nowiki>]</nowiki>
24303 !! html/php
24304 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
24305 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
24306 </p><p>[http://google.com]
24307 </p><p>[http://google.com google]
24308 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24309 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24310 </p>
24311 !! end
24312
24313 !! test
24314 Links 5. ExtLinks: No escapes needed
24315 !! options
24316 parsoid=html2wt
24317 !! html/parsoid
24318 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
24319 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
24320 !! wikitext
24321 [http://google.com [google]
24322
24323 [[http://google.com]]
24324 !! html/php
24325 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
24326 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
24327 </p>
24328 !! end
24329
24330 !! test
24331 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
24332 !! options
24333 parsoid=html2wt
24334 !! html/parsoid
24335 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
24336 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
24337 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
24338 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
24339 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
24340 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
24341 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24342 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
24343 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24344 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
24345 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
24346 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
24347 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
24348 </p>
24349 !! wikitext
24350 x<nowiki/>http://example.com<nowiki/>y
24351 http://example.com<nowiki/>?x
24352 http://example.com<nowiki/>&x
24353 http://example.com<nowiki/>'x
24354 http://example.com<nowiki/>,x
24355 http://example.com<nowiki/>.x
24356 http://example.com<nowiki/>;x
24357 http://example.com<nowiki/>:x
24358 http://example.com<nowiki/>;x
24359 http://example.com<nowiki/>!x
24360 http://example.com<nowiki/>=x
24361 http://example.com<nowiki/>(x)
24362 http://example.com(x<nowiki/>)
24363 !! end
24364
24365 !! test
24366 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24367 !! options
24368 parsoid=html2wt
24369 !! html/parsoid
24370 <p>x
24371 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
24372 y
24373 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
24374 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
24375 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
24376 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
24377 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
24378 </p>
24379 !! wikitext
24380 x
24381 http://example.com
24382 y
24383 "http://example.com"
24384 (http://example.com)
24385 (http://example.com) foo
24386 http://example.com,
24387 http://example.com, foo
24388 !! html/php
24389 <p>x
24390 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
24391 y
24392 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
24393 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
24394 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
24395 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
24396 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
24397 </p>
24398 !! end
24399
24400 !! test
24401 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24402 !! options
24403 parsoid=html2wt
24404 !! html/parsoid
24405 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
24406 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
24407 !! wikitext
24408 http://example.com.,;:!?\
24409 -http://example.com:
24410 !! html/php
24411 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
24412 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
24413 </p>
24414 !! end
24415
24416 !! test
24417 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
24418 !! options
24419 parsoid=html2wt
24420 !! html/parsoid
24421 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
24422 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
24423 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
24424 !! wikitext
24425 RFC 123<nowiki/>4
24426 RFC 123<nowiki/>y
24427 X<nowiki/>RFC 123<nowiki/>y
24428 !! end
24429
24430 !! test
24431 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
24432 !! options
24433 parsoid=html2wt
24434 !! html/parsoid
24435 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24436 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24437 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24438 </p>
24439 !! wikitext
24440 RFC 123?foo
24441 RFC 123&foo
24442 -RFC 123-
24443 !! html/php
24444 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24445 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24446 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24447 </p>
24448 !! end
24449
24450 !! test
24451 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
24452 !! options
24453 parsoid=html2wt
24454 !! html/parsoid
24455 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24456 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24457 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24458 !! wikitext
24459 PMID 123<nowiki/>4
24460 PMID 123<nowiki/>y
24461 X<nowiki/>PMID 123<nowiki/>y
24462 !! end
24463
24464 !! test
24465 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
24466 !! options
24467 parsoid=html2wt
24468 !! html/parsoid
24469 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24470 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24471 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24472 </p>
24473 !! wikitext
24474 PMID 123?foo
24475 PMID 123&foo
24476 -PMID 123-
24477 !! html/php
24478 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24479 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24480 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24481 </p>
24482 !! end
24483
24484 !! test
24485 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
24486 !! options
24487 parsoid=html2wt
24488 !! html/parsoid
24489 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24490 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24491 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24492 </p>
24493 !! wikitext
24494 ISBN 1234567890<nowiki/>1
24495 ISBN 1234567890<nowiki/>x
24496 a<nowiki/>ISBN 1234567890<nowiki/>b
24497 !! end
24498
24499 !! test
24500 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
24501 !! options
24502 parsoid=html2wt
24503 !! html/parsoid
24504 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24505 !! wikitext
24506 -ISBN 1234567890's
24507 !! html/php
24508 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24509 </p>
24510 !! end
24511
24512 !! test
24513 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24514 !! options
24515 parsoid=html2wt
24516 !! html/*
24517 <p>this is not a link: http://example.com
24518 </p>
24519 !! wikitext
24520 this is not a link: <nowiki>http://example.com</nowiki>
24521 !! end
24522
24523 !! test
24524 Links 15. Link trails can't become link prefixes.
24525 !! options
24526 language=is
24527 parsoid=html2wt
24528 !! html/parsoid
24529 <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>
24530 !! wikitext
24531 [[Söfnuður]]-[[00]]
24532 !! html/php
24533 <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>
24534 </p>
24535 !! end
24536
24537 #### --------------- Quotes ---------------
24538 #### 1. Quotes inside <b> and <i>
24539 #### 2. Link fragments separated by <i> and <b> tags
24540 #### 3. Link fragments inside <i> and <b>
24541 #### 4. No escaping needed
24542 #### --------------------------------------
24543 !! test
24544 1a. Quotes inside <b> and <i>
24545 !! options
24546 parsoid=html2wt
24547 !! html/*
24548 <p><i>'foo'</i>
24549 <i>''foo''</i>
24550 <i>'''foo'''</i>
24551 <i>foo</i>'s
24552 <b>'foo'</b>
24553 <b>''foo''</b>
24554 <b>'''foo'''</b>
24555 <b>foo'<i>bar'</i>baz</b>
24556 <b>foo</b>'s
24557 '<i>foo</i>
24558 <i>foo</i>'
24559 <i>foo'</i>'
24560 '<i>foo</i>'
24561 '<b>foo</b>
24562 <b>foo</b>'
24563 '<b>foo</b>'
24564 <i>fools'<span> errand</span></i>
24565 <i><span>fool</span>'s errand</i>
24566 '<i>foo</i> bar '<i>baz</i>
24567 a|!*#-:;+-~[]{}b'<i>x</i>
24568 </p>
24569 !! wikitext
24570 ''<nowiki/>'foo'''
24571 ''<nowiki>''foo''</nowiki>''
24572 ''<nowiki>'''foo'''</nowiki>''
24573 ''foo''<nowiki/>'s
24574 '''<nowiki/>'foo''''
24575 '''<nowiki>''foo''</nowiki>'''
24576 '''<nowiki>'''foo'''</nowiki>'''
24577 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24578 '''foo'''<nowiki/>'s
24579 '''foo''
24580 ''foo''<nowiki/>'
24581 ''foo'''<nowiki/>'
24582 '''foo''<nowiki/>'
24583 ''''foo'''
24584 '''foo'''<nowiki/>'
24585 ''''foo'''<nowiki/>'
24586 ''fools'<span> errand</span>''
24587 ''<span>fool</span>'s errand''
24588 '<nowiki/>''foo'' bar '''baz''
24589 a|!*#-:;+-~[]{}b'''x''
24590 !! end
24591
24592 !! test
24593 1b. Quotes inside <b> and <i> with other tags on same line
24594 !! options
24595 parsoid=html2wt
24596 !! html/parsoid
24597 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24598 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24599 <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>
24600 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24601 '<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>
24602 '<i>foo</i> <div title="name">test</div>
24603 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24604 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24605 <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>
24606 </ol>
24607 !! wikitext
24608 '''a'' foo ''[[bar]]''
24609 ''a''' foo ''[[bar]]''
24610 ''a''' foo '''{{echo|[[bar]]}}'''
24611 [[foo]] x'''[[bar]]''
24612 '''foo'' <ref>test</ref>
24613 '''foo'' <div title="name">test</div>
24614 '''foo'' and <br> bar
24615 <references />
24616 !! end
24617
24618 !! test
24619 2. Link fragments separated by <i> and <b> tags
24620 !! options
24621 parsoid=html2wt
24622 !! html/parsoid
24623 <p>[[<i>foo</i>hello]]</p>
24624 <p>[[<b>foo</b>hello]]</p>
24625 !! wikitext
24626 [[''foo''<nowiki>hello]]</nowiki>
24627
24628 [['''foo'''<nowiki>hello]]</nowiki>
24629 !! end
24630
24631 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24632 # this is one of the shortcomings of this format
24633 !! test
24634 3. Link fragments inside <i> and <b>
24635 !! options
24636 parsoid=html2wt
24637 !! html/parsoid
24638 <p><i>[[foo</i>]]</p>
24639 <p><b>[[foo</b>]]</p>
24640 !! wikitext
24641 ''[[foo''<nowiki>]]</nowiki>
24642
24643 '''[[foo'''<nowiki>]]</nowiki>
24644 !! end
24645
24646 !! test
24647 4. No escaping needed
24648 !! options
24649 options=html2wt
24650 !! html/parsoid
24651 <p>'<span><i>bar</i></span>'
24652 '<span><b>bar</b></span>'
24653 'a:b'foo
24654 </p>
24655 !! wikitext
24656 '<span>''bar''</span>'
24657 '<span>'''bar'''</span>'
24658 'a:b'foo
24659 !! end
24660
24661 #### ----------- Paragraphs ---------------
24662 #### 1. No unnecessary escapes
24663 #### --------------------------------------
24664
24665 !! test
24666 1. No unnecessary escapes
24667 !! options
24668 parsoid=html2wt
24669 !! html/parsoid
24670 <p>bar <span>[[foo]]</span>
24671 </p><p>=bar <span>[[foo]]</span>
24672 </p><p>[[bar <span>[[foo]]</span>
24673 </p><p>]]bar <span>[[foo]]</span>
24674 </p><p>=bar <span>foo]]</span>=
24675 </p>
24676 !! wikitext
24677 bar <span><nowiki>[[foo]]</nowiki></span>
24678
24679 =bar <span><nowiki>[[foo]]</nowiki></span>
24680
24681 [[bar <span><nowiki>[[foo]]</nowiki></span>
24682
24683 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24684
24685 =bar <span>foo]]</span><nowiki>=</nowiki>
24686 !!end
24687
24688 #### ----------------------- PRE --------------------------
24689 #### 1. Leading whitespace in SOL context should be escaped
24690 #### ------------------------------------------------------
24691 !! test
24692 1. Leading whitespace in SOL context should be escaped
24693 !! options
24694 parsoid=html2wt
24695 !! html/parsoid
24696 <p> a</p>
24697
24698 <p> a</p>
24699
24700 <p> a(tab)</p>
24701
24702 <p> a
24703 <!--cmt-->
24704 a</p>
24705
24706 <p>a
24707 b</p>
24708
24709 <p>a
24710 b</p>
24711
24712 <p>a
24713 b</p>
24714 !! wikitext
24715 <nowiki> </nowiki>a
24716
24717 <nowiki> </nowiki> a
24718
24719 a(tab)
24720
24721 <nowiki> </nowiki> a
24722 <!--cmt-->
24723 <nowiki> </nowiki>a
24724
24725 a
24726 <nowiki> </nowiki>b
24727
24728 a
24729 b
24730
24731 a
24732 b
24733 !! html/php
24734 <p> a
24735 </p><p> a
24736 </p><p> a(tab)
24737 </p><p> a
24738 a
24739 </p><p>a
24740 b
24741 </p><p>a
24742 b
24743 </p><p>a
24744 b
24745 </p>
24746 !! end
24747
24748 !! test
24749 2. Leading whitespace in non-indent-pre contexts should not be escaped
24750 !! options
24751 parsoid=html2wt
24752 !! html/parsoid
24753 <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>
24754 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24755 <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>
24756 b</span></li>
24757 </ol>
24758 !! wikitext
24759 foo <ref>''a''
24760 b</ref>
24761 <references />
24762 !! end
24763
24764 !! test
24765 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24766 !! options
24767 parsoid=html2wt
24768 !! html/parsoid
24769 <blockquote>
24770 <p>
24771 a
24772 <span>b</span>
24773 c</p>
24774 </blockquote>
24775 !! wikitext
24776 <blockquote>
24777 a
24778 <span>b</span>
24779 c
24780 </blockquote>
24781 !! end
24782
24783 !! test
24784 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24785 !! options
24786 options=html2wt
24787 !! html/parsoid
24788 <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>
24789 !! wikitext
24790 [[File:Foobar.jpg|thumb|caption]]
24791 !! end
24792
24793 !! test
24794 5. Nowiki escaping should account for indent-pres
24795 !! options
24796 parsoid=html2wt
24797 !! html/parsoid
24798 <pre>==foo==</pre>
24799 !! wikitext
24800 ==foo==
24801 !! end
24802
24803 !!test
24804 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24805 !! options
24806 parsoid=html2wt
24807 !! html/parsoid
24808 <pre>
24809 * foo
24810 * bar
24811 </pre>
24812 !! wikitext
24813 * foo
24814 * bar
24815 !! end
24816
24817 #### --------------- Behavior Switches --------------------
24818
24819 !! test
24820 1. Valid behavior switches should be escaped
24821 !! options
24822 parsoid=html2wt
24823 !! html/parsoid
24824 __TOC__
24825 <i>__TOC__</i>
24826 !! wikitext
24827 <nowiki>__TOC__</nowiki>
24828 ''<nowiki>__TOC__</nowiki>''
24829 !! end
24830
24831 !! test
24832 2. Invalid behavior switches should not be escaped
24833 !! options
24834 parsoid=html2wt
24835 !! html/parsoid
24836 __TOO__
24837 __|__
24838 !! wikitext
24839 __TOO__
24840 __|__
24841 !! end
24842
24843 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24844 !! test
24845 Behavior switches should be SOL-transparent
24846 !! options
24847 parsoid=html2wt
24848 !! html/parsoid
24849 <meta property="mw:PageProp/toc" />
24850
24851 <!-- this one's bogus -->
24852 <pre>__TOO__</pre>
24853
24854 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24855
24856 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24857 !! wikitext
24858 __TOC__
24859
24860 <!-- this one's bogus -->
24861 __TOO__
24862
24863 __TOC__ foo
24864
24865 __TOC__
24866 bar
24867 !! end
24868
24869 #### --------------- HTML tags ---------------
24870 #### 1. a tags
24871 #### 2. other tags
24872 #### 3. multi-line html tag
24873 #### 4. extension tags
24874 #### -----------------------------------------
24875 !! test
24876 1. a tags
24877 !! options
24878 parsoid=html2wt
24879 !! html/parsoid
24880 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24881 !! wikitext
24882 <a href="http://google.com">google</a>
24883 !! end
24884
24885 !! test
24886 2. other tags
24887 !! options
24888 parsoid=html2wt
24889 !! html/parsoid
24890 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24891 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24892 <li> &lt;td&gt;</li></ul>
24893
24894 !! wikitext
24895 * <nowiki><div>foo</div></nowiki>
24896 * <nowiki><div style="color:red">foo</div></nowiki>
24897 * <nowiki><td></nowiki>
24898 !! end
24899
24900 !! test
24901 3. multi-line html tag
24902 !! options
24903 parsoid=html2wt
24904 !! html/parsoid
24905 <p>&lt;div
24906 &gt;foo&lt;/div
24907 &gt;
24908 </p>
24909 !! wikitext
24910 <nowiki><div
24911 >foo</div
24912 ></nowiki>
24913 !! end
24914
24915 !! test
24916 4. extension tags
24917 !! options
24918 parsoid=html2wt
24919 !! html/parsoid
24920 <p>&lt;ref&gt;foo&lt;/ref&gt;
24921 </p><p>&lt;ref&gt;bar
24922 </p><p>baz&lt;/ref&gt;
24923 </p>
24924 !! wikitext
24925 <nowiki><ref>foo</ref></nowiki>
24926
24927 <nowiki><ref>bar</nowiki>
24928
24929 baz<nowiki></ref></nowiki>
24930 !! end
24931
24932 #### --------------- Others ---------------
24933 !! test
24934 Escaping nowikis
24935 !! options
24936 parsoid=html2wt
24937 !! html/parsoid
24938 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24939 </p>
24940 !! wikitext
24941 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24942 !! end
24943
24944 ## The quote-char in the input is necessary for triggering the bug
24945 !! test
24946 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24947 !! options
24948 parsoid=html2wt
24949 !! html/parsoid
24950 <p>foo's bar :</p>
24951 !! wikitext
24952 foo's bar :
24953 !! end
24954
24955 #----------- End of wikitext escaping tests --------------
24956
24957 !! test
24958
24959 Tag-like HTML structures are passed through as text
24960 !! wikitext
24961 <x y>
24962
24963 <x.y>
24964
24965 <x-y>
24966
24967 1>2
24968
24969 x<y
24970
24971 a>b
24972
24973 1<d e>f
24974 !! html
24975 <p>&lt;x y&gt;
24976 </p><p>&lt;x.y&gt;
24977 </p><p>&lt;x-y&gt;
24978 </p><p>1&gt;2
24979 </p><p>x&lt;y
24980 </p><p>a&gt;b
24981 </p><p>1&lt;d e&gt;f
24982 </p>
24983 !! end
24984
24985 !! test
24986 HTML tag with necessary entities in attributes
24987 !! wikitext
24988 <span title="&amp;amp;">foo</span>
24989 !! html
24990 <p><span title="&amp;amp;">foo</span>
24991 </p>
24992 !! end
24993
24994 !! test
24995 HTML tag with 'unnecessary' entity encoding in attributes
24996 !! wikitext
24997 <span title="&amp;">foo</span>
24998 !! html
24999 <p><span title="&amp;">foo</span>
25000 </p>
25001 !! end
25002
25003 !! test
25004 HTML tag with broken attribute value quoting
25005 !! options
25006 parsoid=wt2html,html2html
25007 !! wikitext
25008 <span title="Hello world>Foo</span>
25009 !! html/php
25010 <p><span title="Hello world">Foo</span>
25011 </p>
25012 !! html/parsoid
25013 <p><span title="Hello world">Foo</span></p>
25014 !! end
25015
25016 !! test
25017 Self-closed tag with broken attribute value quoting
25018 !! options
25019 parsoid=wt2html,html2html
25020 !! wikitext
25021 <div title="Hello world />Foo
25022 !! html/php+tidy
25023 <div title="Hello world"></div>
25024 <p>Foo</p>
25025 !! html/parsoid
25026 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
25027 !! end
25028
25029 !! test
25030 Table with broken attribute value quoting
25031 !! options
25032 parsoid=wt2html,html2html
25033 !! wikitext
25034 {|
25035 | title="Hello world|Foo
25036 |}
25037 !! html/php
25038 <table>
25039 <tr>
25040 <td title="Hello world">Foo
25041 </td></tr></table>
25042
25043 !! html/parsoid
25044 <table>
25045 <tr>
25046 <td title="Hello world">Foo
25047 </td></tr></table>
25048
25049 !! end
25050
25051 !! test
25052 Table with broken attribute value quoting on consecutive lines
25053 !! options
25054 parsoid=wt2html,html2html
25055 !! wikitext
25056 {|
25057 | title="Hello world|Foo
25058 | style="color:red|Bar
25059 |}
25060 !! html/php
25061 <table>
25062 <tr>
25063 <td title="Hello world">Foo
25064 </td>
25065 <td style="color:red">Bar
25066 </td></tr></table>
25067
25068 !! html/parsoid
25069 <table><tbody>
25070 <tr>
25071 <td title="Hello world">Foo
25072 </td><td style="color: red">Bar
25073 </td></tr></tbody></table>
25074
25075 !! end
25076
25077 !!test
25078 Accept empty td cell attribute
25079 !! wikitext
25080 {|
25081 | align="center" | foo || |
25082 |}
25083 !! html
25084 <table>
25085 <tr>
25086 <td align="center"> foo </td>
25087 <td>
25088 </td></tr></table>
25089
25090 !!end
25091
25092 !!test
25093 Non-empty attributes in th-cells
25094 !! wikitext
25095 {|
25096 ! Foo !! style="color: red" | Bar
25097 |}
25098 !! html
25099 <table>
25100 <tr>
25101 <th> Foo </th>
25102 <th style="color: red"> Bar
25103 </th></tr></table>
25104
25105 !!end
25106
25107 !!test
25108 Accept empty attributes in th-cells
25109 !! wikitext
25110 {|
25111 !| foo !!| bar
25112 |}
25113 !! html
25114 <table>
25115 <tr>
25116 <th> foo </th>
25117 <th> bar
25118 </th></tr></table>
25119
25120 !!end
25121
25122 !!test
25123 Empty table rows go away
25124 !! wikitext
25125 {|
25126 | Hello
25127 | there
25128 |- class="foo"
25129 |-
25130 |}
25131 !! html
25132 <table>
25133 <tr>
25134 <td> Hello
25135 </td>
25136 <td> there
25137 </td></tr>
25138
25139 </table>
25140
25141 !! end
25142
25143 ###
25144 ### Parsoid-centric tests for testing RTing of inter-element separators
25145 ### Edge cases not tested by existing parser tests and specific to
25146 ### Parsoid-specific serialization strategies.
25147 ###
25148
25149 !!test
25150 RT-ed inter-element separators should be valid separators
25151 !! wikitext
25152 {|
25153 |- [[foo]]
25154 |}
25155 !! html/php
25156 <table>
25157
25158 </table>
25159
25160 !! html/parsoid
25161 <table>
25162 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
25163 </tbody></table>
25164 !!end
25165
25166 # Parsoid-only since PHP parser relies on Tidy for correct output
25167 !!test
25168 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
25169 !!options
25170 parsoid
25171 !! wikitext
25172 {|
25173 |<small>foo
25174 bar
25175 |}
25176
25177 {|
25178 |<small>foo<small>
25179 |}
25180 !! html
25181 <table>
25182 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
25183 <p>bar</p></small></td></tr>
25184 </tbody></table>
25185
25186 <table>
25187 <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>
25188 </tbody></table>
25189 !!end
25190
25191 # Note that the "style" attribute is really a template parameter here.
25192 # The = would have to be {{=}} if you wanted the literal.
25193 !!test
25194 Empty TD followed by TD with tpl-generated attribute
25195 !! wikitext
25196 {|
25197 |-
25198 |
25199 |{{echo|style='color:red'}}|foo
25200 |}
25201 !! html
25202 <table>
25203
25204 <tr>
25205 <td>
25206 </td>
25207 <td>foo
25208 </td></tr></table>
25209
25210 !!end
25211
25212 !!test
25213 Indented table with an empty td
25214 !! wikitext
25215 {|
25216 |-
25217 |
25218 |foo
25219 |}
25220 !! html
25221 <table>
25222
25223 <tr>
25224 <td>
25225 </td>
25226 <td>foo
25227 </td></tr></table>
25228
25229 !!end
25230
25231 ## We have some newline diffs RT-ing this edge case
25232 ## and it is not important enough -- we seem to be emitting
25233 ## at most 2 newlines after a </tr> and this is unrelated to
25234 ## the issue from T85627 that this is testing.
25235 !!test
25236 Indented table with blank lines in between (T85627)
25237 !! options
25238 parsoid=wt2html
25239 !! wikitext
25240 {|
25241 |foo
25242
25243
25244 |}
25245 !! html
25246 <table>
25247
25248 <tr>
25249 <td>foo
25250 </td></tr></table>
25251
25252 !!end
25253
25254 !!test
25255 Indented block & table
25256 !! wikitext
25257 <div>foo</div>
25258 {|
25259 |foo
25260 |}
25261 !! html/php
25262 <div>foo</div>
25263 <table>
25264 <tr>
25265 <td>foo
25266 </td></tr></table>
25267
25268 !! html/parsoid
25269 <div data-parsoid='{"stx":"html"}'>foo</div>
25270 <table><tbody>
25271 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
25272 </tbody></table>
25273 !!end
25274
25275 !! test
25276 Indent and comment before table row
25277 !! wikitext
25278 {|
25279 <!--hi-->|-
25280 | there
25281 |}
25282 !! html/php
25283 <table>
25284
25285 <tr>
25286 <td> there
25287 </td></tr></table>
25288
25289 !! html/parsoid
25290 <table>
25291 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
25292 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
25293 </tbody></table>
25294 !! end
25295
25296 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
25297 !!test
25298 Empty TR followed by a template-generated TR
25299 !!options
25300 parsoid
25301 !! wikitext
25302 {|
25303 |-
25304 {{echo|<tr><td>foo</td></tr>}}
25305 |}
25306 !! html
25307 <table>
25308 <tbody>
25309 <tr></tr>
25310 <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}}]}'>
25311 <td>foo</td></tr>
25312 </tbody></table>
25313 !!end
25314
25315 ## PHP and parsoid output differ for this, and since this is primarily
25316 ## for testing Parsoid's serializer, marking this Parsoid only
25317 !!test
25318 Empty TR followed by mixed-ws-comment line should RT correctly
25319 !!options
25320 parsoid
25321 !! wikitext
25322 {|
25323 |-
25324 <!--c-->
25325 |-
25326 <!--c--> <!--d-->
25327 |}
25328 !! html
25329 <table>
25330 <tbody>
25331 <tr></tr>
25332 <!--c-->
25333 <tr>
25334 <!--c--> </tr><!--d-->
25335 </tbody></table>
25336
25337 !!end
25338
25339 !!test
25340 Multi-line image caption generated by templates with/without trailing newlines
25341 !! wikitext
25342 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
25343 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
25344 !! html/parsoid
25345 <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>
25346 <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>
25347 !!end
25348
25349 !! test
25350 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
25351 !! options
25352 parsoid=html2wt
25353 !! html/parsoid
25354 <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>
25355
25356 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
25357 !! wikitext
25358 <includeonly>foo</includeonly>
25359 new para
25360
25361 [[Category:Foo]]
25362
25363 = new heading =
25364 !! end
25365
25366 ## PHP emits broken html for this, and since this is primarily
25367 ## a Parsoid serializer test, marking this Parsoid only
25368 !!test
25369 Improperly nested inline or quotes tags with whitespace in between
25370 !! wikitext
25371 <span> <s>x</span> </s>
25372 ''' ''x''' ''
25373 !! html/parsoid
25374 <p><span> <s>x</s></span><s> </s>
25375 <b> <i>x</i></b><i> </i>
25376 </p>
25377 !!end
25378
25379 !!test
25380 Encapsulate protected attributes from wt
25381 !! wikitext
25382 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
25383
25384 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
25385 | ok
25386 |}
25387 !! html/parsoid
25388 <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>
25389
25390 <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">
25391 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
25392 </tbody></table>
25393 !!end
25394
25395 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
25396 ## Having nested or stray pre tags results in the attempt to add duplicates,
25397 ## causing an assertion fail. This test tries to prevent that situation.
25398 !!test
25399 Ensure ParagraphWrapper can deal with stray closing pre tags
25400 !!options
25401 parsoid=wt2html
25402 !! wikitext
25403 plain text</pre>
25404 !! html/parsoid
25405 plain text
25406 !!end
25407
25408 !!test
25409 1. Ensure fostered text content is wrapped in element nodes
25410 !!options
25411 parsoid=wt2html
25412 !! wikitext
25413 <table>hi</table><table>ho</table>
25414 !! html/parsoid
25415 <p>hi</p>
25416 <table></table>
25417 <p>ho</p>
25418 <table></table>
25419 !!end
25420
25421 !!test
25422 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
25423 !!options
25424 parsoid=wt2html,wt2wt
25425 !! wikitext
25426 <table>
25427 <tr> || ||
25428 <td> a
25429 </table>
25430 !! html/parsoid
25431 <p> || ||
25432 </p><table>
25433 <tbody><tr><td> a</td></tr>
25434 </tbody></table>
25435 !!end
25436
25437 !!test
25438 Encapsulation properly handles null DSR information from foster box
25439 !!options
25440 parsoid=wt2html,wt2wt
25441 !! wikitext
25442 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25443 !! html/parsoid
25444 <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>
25445 !!end
25446
25447 !!test
25448 1. Encapsulate foster-parented transclusion content
25449 !!options
25450 parsoid=wt2wt,wt2html
25451 !! wikitext
25452 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25453 !! html/parsoid
25454 <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>
25455 <tbody>
25456 <tr>
25457 <td>bar</td>
25458 </tr>
25459 </tbody>
25460 </table>
25461 !!end
25462
25463 !!test
25464 2. Encapsulate foster-parented transclusion content
25465 !!options
25466 parsoid=wt2wt,wt2html
25467 !! wikitext
25468 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25469 !! html/parsoid
25470 <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>
25471 <table>
25472 <tbody>
25473 <tr>
25474 <td>bar</td>
25475 </tr>
25476 </tbody>
25477 </table>
25478 !!end
25479
25480 !!test
25481 3. Encapsulate foster-parented transclusion content
25482 !!options
25483 parsoid=wt2wt,wt2html
25484 !! wikitext
25485 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25486 !! html/parsoid
25487 <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;]}">
25488 <p>foo</p>
25489 </div>
25490 <table>
25491 <tbody>
25492 <tr>
25493 <td>bar</td>
25494 </tr>
25495 </tbody>
25496 </table>
25497 !!end
25498
25499 !!test
25500 4. Encapsulate foster-parented transclusion content
25501 !!options
25502 parsoid=wt2wt,wt2html
25503 !! wikitext
25504 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25505 !! html/parsoid
25506 <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;]}">
25507 <p>foo</p>
25508 </div>
25509 <table>
25510 <tbody>
25511 <tr>
25512 <td>bar</td>
25513 </tr>
25514 </tbody>
25515 </table>
25516 !!end
25517
25518 !!test
25519 5. Encapsulate foster-parented transclusion content
25520 !!options
25521 parsoid=wt2wt,wt2html
25522 !! wikitext
25523 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25524 !! html/parsoid
25525 <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>
25526 <table>
25527 <tbody>
25528 <tr>
25529 <td>
25530 <div>
25531 <p>foo</p>
25532 </div>
25533 </td>
25534 </tr>
25535 </tbody>
25536 </table>
25537 !!end
25538
25539 !!test
25540 6. Encapsulate foster-parented transclusion content
25541 !!options
25542 parsoid=wt2wt,wt2html
25543 !! wikitext
25544 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25545 !! html/parsoid
25546 <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>
25547 <table>
25548 <tbody>
25549 <tr>
25550 <td>
25551 <div>
25552 <p>foo</p>
25553 </div>
25554 </td>
25555 </tr>
25556 </tbody>
25557 </table>
25558 <p>ok</p>
25559 !!end
25560
25561 !!test
25562 7. Encapsulate foster-parented transclusion content
25563 !!options
25564 parsoid=wt2wt,wt2html
25565 !! wikitext
25566 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25567 !! html/parsoid
25568 <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>
25569 <table>
25570 <tbody>
25571 <tr>
25572 <td>bar</td>
25573 </tr>
25574 </tbody>
25575 </table>
25576 !!end
25577
25578 # Note that the wt is broken on purpose: the = should be {{=}} if you
25579 # don't want it to be a template parameter key.
25580 !!test
25581 8. Encapsulate foster-parented transclusion content
25582 !!options
25583 parsoid=wt2wt,wt2html
25584 !! wikitext
25585 {{echo|a
25586 }}{|{{echo|style='color:red'}}
25587 |-
25588 |b
25589 |}
25590 !! html/parsoid
25591 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25592 <span> </span>
25593 <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>
25594 <table>
25595 <tbody>
25596 <tr>
25597 <td>b</td>
25598 </tr>
25599 </tbody>
25600 </table>
25601 !!end
25602
25603 !!test
25604 9. Encapsulate foster-parented transclusion content
25605 !!options
25606 parsoid=wt2wt,wt2html
25607 !! wikitext
25608 <table>{{echo|hi</table>hello}}
25609 !! html/parsoid
25610 <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>
25611 !!end
25612
25613 !!test
25614 Table in fosterable position
25615 !!options
25616 parsoid=wt2html
25617 !! wikitext
25618 {{OpenTable}}
25619 <div>
25620 {|
25621 |}
25622 </div>
25623 |}
25624 !! html/parsoid
25625 <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">
25626 </span>
25627 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25628
25629 <table>
25630 </table>
25631 !!end
25632
25633 # Parsoid only for bug 64747
25634 !! test
25635 Properly encapsulate empty-content transclusions in fosterable positions
25636 !! wikitext
25637 <table>
25638 {{#if:|
25639 <td>foo</td>
25640 }}
25641 </table>
25642 !! html/parsoid
25643 <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"}]]}'>
25644
25645 </table>
25646 !! end
25647
25648 !! test
25649 Always encapsulate foster box when template range is expanded to table
25650 !! options
25651 parsoid=wt2wt
25652 !! wikitext
25653 {|
25654 hello
25655 {{OpenTable}}
25656 |}
25657 !! html/parsoid
25658
25659 !! end
25660
25661 !! test
25662 T115289: Unclosed table
25663 !! wikitext
25664 {{echo|<table>}}<!--c-->[[Category:Two]]
25665 !! html/parsoid
25666 <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>
25667 !! end
25668
25669 !! test
25670 T115289: Don't migrate newlines out of tables with fostered content
25671 !! wikitext
25672 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25673 !! html/parsoid
25674 <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>
25675 !! end
25676
25677 !! test
25678 T73074: More fostering fun
25679 !! wikitext
25680 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25681 !! html/parsoid
25682 <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>
25683 !! end
25684
25685 !!test
25686 Support <object> element with .data attribute
25687 !!options
25688 parsoid=html2wt
25689 !! html/parsoid
25690 <object data="test.swf"></object>
25691 !! wikitext
25692 <object data="test.swf"></object>
25693 !!end
25694
25695 !! test
25696 Don't block XML namespace declaration
25697 !! wikitext
25698 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25699 !! html/php
25700 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25701 </p>
25702 !! html/parsoid
25703 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25704 !! end
25705
25706 # -----------------------------------------------------------------
25707 # The following section of tests are primarily to spec requirements
25708 # around Parsoid's serialization (old, new, edited content)
25709 #
25710 # All these tests are marked Parsoid html2wt and html2html only
25711 # ----------------------------------------------------------------
25712
25713 !! test
25714 Ignore rel attribute in a-tags during serialization to url-links
25715 !! options
25716 parsoid=html2wt
25717 !! html/parsoid
25718 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25719 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25720 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25721 !! wikitext
25722 http://en.wikipedia.org/wiki/Foobar
25723 http://en.wikipedia.org/wiki/Foobar
25724 http://en.wikipedia.org/wiki/Foobar
25725 !! end
25726
25727 # 'mi' is a localinterwiki prefix as well as a language
25728 !! test
25729 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
25730 !! options
25731 parsoid=html2wt
25732 !! html/parsoid
25733 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25734 !! wikitext
25735 [[Foo]]
25736 !! end
25737
25738 # See T93839
25739 !! test
25740 New wikilinks should be serialized properly
25741 !! options
25742 parsoid=html2wt
25743 !! html/parsoid
25744 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25745 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25746 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25747 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25748 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25749 !! wikitext
25750 [[Foo]]
25751 [[Foo]]
25752 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25753 http://en.wikipedia.org/wiki/Foo
25754 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25755 !! end
25756
25757 !! test
25758 New wiki links (href variations)
25759 !! options
25760 parsoid=html2wt
25761 !! html/parsoid
25762 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25763 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25764 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25765 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25766 !! wikitext
25767 [[Foo_bar]]
25768 [[Foo_bar]]
25769 [[Foo_bar]]
25770 [[Toxine bactérienne]]
25771 !! end
25772
25773 !! test
25774 New wiki links (content string variations)
25775 !! options
25776 parsoid=html2wt
25777 !! html/parsoid
25778 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25779 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25780 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25781 !! wikitext
25782 [[Foo_bar]]
25783 [[Foo bar]]
25784 [[Foo_bar|./Foo_bar]]
25785 !! end
25786
25787 !! test
25788 New category links (href variations)
25789 !! options
25790 parsoid=html2wt
25791 !! html/parsoid
25792 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25793 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25794 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25795 !! wikitext
25796 [[Category:Toxine bactérienne]]
25797 [[Category:Toxine bactérienne]]
25798 [[Category:Toxine bactérienne]]
25799 !! end
25800
25801 !! test
25802 New sol transparent links don't need indent-pre nowiki protection
25803 !! options
25804 parsoid=html2wt
25805 language=de
25806 !! html/parsoid
25807 <link rel="mw:PageProp/redirect" href="./Main_Page">
25808 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25809 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25810 !! wikitext
25811 #WEITERLEITUNG [[Main Page]]
25812 <!-- this is good --> [[Category:Good]]
25813 <!-- this is great --> [[Kategorie:Great]]
25814 !! end
25815
25816 !! test
25817 New interlanguage links (href variations)
25818 !! options
25819 parsoid=html2wt
25820 !! html/parsoid
25821 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25822 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25823 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25824 !! wikitext
25825 [[es:Toxine bactérienne]]
25826 [[es:Toxine_bactérienne]]
25827 [[es:Toxine_bactérienne]]
25828 !! end
25829
25830 !! test
25831 Image: Modifying size of an image (1)
25832 !! options
25833 parsoid={
25834 "modes": ["wt2wt"],
25835 "changes": [
25836 ["img[height]", "attr", "height", "22"],
25837 ["img[width]", "attr", "width", "200"]
25838 ]
25839 }
25840 !! wikitext
25841 [[Image:Foobar.jpg|230x230px]]
25842 !! wikitext/edited
25843 [[Image:Foobar.jpg|200x200px]]
25844 !!end
25845
25846 !! test
25847 Image: Modifying size of an image (2)
25848 !! options
25849 parsoid={
25850 "modes": ["wt2wt"],
25851 "changes": [
25852 ["img[height]", "attr", "height", "100"],
25853 ["img[width]", "attr", "width", "500"]
25854 ]
25855 }
25856 !! wikitext
25857 [[Image:Foobar.jpg|230x230px]]
25858 !! wikitext/edited
25859 [[Image:Foobar.jpg|500x500px]]
25860 !!end
25861
25862 # Change in size is ignored so long as class='mw-default-size'
25863 !! test
25864 Image: Modifying size of an image (3)
25865 !! options
25866 parsoid={
25867 "modes": ["wt2wt"],
25868 "changes": [
25869 ["figure[class]", "removeClass", "mw-default-size"],
25870 ["figure img", "attr", "height", "19"],
25871 ["figure img", "attr", "width", "170"]
25872 ]
25873 }
25874 !! wikitext
25875 [[Image:Foobar.jpg|thumb]]
25876 !! wikitext/edited
25877 [[Image:Foobar.jpg|thumb|170x170px]]
25878 !!end
25879
25880 !! test
25881 Image: Modifying alignment of an image (bug 48665)
25882 !! options
25883 parsoid={
25884 "modes": ["wt2wt"],
25885 "changes": [
25886 ["figure[class]", "removeClass", "mw-halign-right"],
25887 ["figure[class]", "addClass", "mw-halign-left"]
25888 ]
25889 }
25890 !! wikitext
25891 [[Image:Foobar.jpg|thumb|caption|right]]
25892 !! wikitext/edited
25893 [[Image:Foobar.jpg|thumb|caption|left]]
25894 !! end
25895
25896 !! test
25897 Image: Modifying mw-default-size of an frameless image (bug 62805)
25898 !! options
25899 parsoid={
25900 "modes": ["wt2wt"],
25901 "changes": [
25902 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25903 ]
25904 }
25905 !! wikitext
25906 [[Image:Foobar.jpg|frameless|right]]
25907 !! wikitext/edited
25908 [[Image:Foobar.jpg|frameless|right|220x220px]]
25909 !! end
25910
25911 !! test
25912 Image: Modifying valign of an image (bug 49221)
25913 !! options
25914 parsoid={
25915 "modes": ["wt2wt"],
25916 "changes": [
25917 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25918 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25919 ]
25920 }
25921 !! wikitext
25922 [[File:Foobar.jpg|20px|middle]]
25923 !! wikitext/edited
25924 [[File:Foobar.jpg|20px|text-top]]
25925 !! end
25926
25927 !! test
25928 Image: Modifying alt attribute of an image (bug 56400)
25929 !! options
25930 parsoid={
25931 "modes": ["wt2wt"],
25932 "changes": [
25933 ["img[alt]", "attr", "alt", "some alternate edited text"]
25934 ]
25935 }
25936 !! wikitext
25937 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25938 !! wikitext/edited
25939 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25940 !!end
25941
25942 !! test
25943 Image: Modifying caption of an image
25944 !! options
25945 parsoid={
25946 "modes": ["wt2wt"],
25947 "changes": [
25948 ["figcaption", "text", "new caption"]
25949 ]
25950 }
25951 !! wikitext
25952 [[Image:Foobar.jpg|thumb|original caption]]
25953 !! wikitext/edited
25954 [[Image:Foobar.jpg|thumb|new caption]]
25955 !!end
25956
25957 !! test
25958 Image: empty alt attribute (bug 48924)
25959 !! options
25960 parsoid
25961 !! wikitext
25962 [[File:Foobar.jpg|thumb|alt=|bar]]
25963 !! html
25964 <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>
25965 !! end
25966
25967 !! test
25968 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25969 !! options
25970 parsoid=html2wt
25971 language=ar
25972 disabled
25973 !! html/parsoid
25974 <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>
25975 !! wikitext
25976 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25977 !! end
25978
25979 !! test
25980 Image: Block level image should have \n before and after
25981 !! wikitext
25982 123
25983 [[File:Foobar.jpg|right|thumb|150x150px]]
25984 456
25985 !! html/parsoid
25986 <p>123</p>
25987 <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>
25988 <p>456</p>
25989 !!end
25990
25991 !! test
25992 Image: New block level image should have \n before and after (existing content)
25993 !! wikitext
25994 123
25995 [[File:Foobar.jpg|right|thumb|150x150px]]
25996 456
25997 !! html/parsoid
25998 <p>123</p>
25999 <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>
26000 <p>456</p>
26001 !!end
26002
26003 !! test
26004 Image: upright option (parsoid)
26005 !! wikitext
26006 [[File:Foobar.jpg|thumb|upright|caption]]
26007 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
26008 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
26009 !! html/parsoid
26010 <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>
26011 <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>
26012 <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>
26013 !!end
26014
26015 !! test
26016 Image: upright option is ignored on inline and frame images (parsoid)
26017 !! wikitext
26018 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
26019 !! html/parsoid
26020 <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>
26021 !!end
26022
26023 !! test
26024 Image: from basic HTML (1)
26025 !! options
26026 parsoid=html2wt
26027 !! html/parsoid
26028 <span typeof="mw:Image">
26029 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
26030 </span>
26031 !! wikitext
26032 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
26033 !! end
26034
26035 !! test
26036 Image: from basic HTML (2)
26037 !! options
26038 parsoid=html2wt
26039 !! html/parsoid
26040 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
26041 !! wikitext
26042 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
26043 !! end
26044
26045 !! test
26046 Image: from basic HTML (3)
26047 !! options
26048 parsoid=html2wt
26049 !! html/parsoid
26050 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
26051 !! wikitext
26052 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
26053 !! end
26054
26055 !! test
26056 Image: from basic HTML (4)
26057 !! options
26058 parsoid=html2wt
26059 !! html/parsoid
26060 <img src="./File:Foobar.jpg">
26061 !! wikitext
26062 [[File:Foobar.jpg|link=]]
26063 !! end
26064
26065 !! test
26066 Image: Invalid title as link
26067 !! wikitext
26068 [[File:Foobar.jpg|link=<]]
26069 !! html/php
26070 <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>
26071 </p>
26072 !! html/parsoid
26073 <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>
26074 !! end
26075
26076 !! test
26077 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
26078 !! options
26079 parsoid=html2wt
26080 !! html/parsoid
26081 <ul>
26082 <li><p>foo</p></li>
26083 </ul>
26084 !! wikitext
26085 * foo
26086 !! end
26087
26088 !! test
26089 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
26090 !! options
26091 parsoid=html2wt
26092 !! html/parsoid
26093 <ul> <li>foo</li></ul>
26094 !! wikitext
26095 * foo
26096 !! end
26097
26098 !! test
26099 Don't strip leading whitespace when handling indent-pre suppressing tags
26100 !! options
26101 parsoid=html2wt
26102 !! html/parsoid
26103 <table>
26104 <tr><td> indented row</td></tr>
26105 </table>
26106 <blockquote><p>
26107 <b>This is very bold of you!</b>
26108 </p>
26109 <table><tr><td>
26110 indented cell (no pre-wrapping!)
26111 </td></tr></table>
26112 </blockquote>
26113 <p>foo</p>
26114 <div>bar</div>
26115 !! wikitext
26116 {|
26117 | indented row
26118 |}
26119 <blockquote>
26120 '''This is very bold of you!'''
26121
26122 {|
26123 |
26124 indented cell (no pre-wrapping!)
26125 |}
26126 </blockquote>
26127 foo
26128 <div>bar</div>
26129 !! end
26130
26131 !! test
26132 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
26133 !! options
26134 parsoid=html2wt
26135 !! html/parsoid
26136 <p>foo</p>
26137 <span>bar</span>
26138
26139 <span>foo2
26140 </span>bar2
26141
26142 <div>foo</div>
26143 <span>bar</span>
26144
26145 <div>
26146 <span>foo</span>
26147 </div>
26148 !! wikitext
26149 foo
26150
26151 <span>bar</span>
26152
26153 <span>foo2
26154 <nowiki> </nowiki></span>bar2
26155
26156 <div>foo</div>
26157 <nowiki> </nowiki><span>bar</span>
26158
26159 <div>
26160 <nowiki> </nowiki><span>foo</span>
26161 </div>
26162 !! end
26163
26164 !! test
26165 Lists: Dont insert newlines in a serialized list item.
26166 !! options
26167 parsoid=html2wt
26168 !! html/parsoid
26169 <ul><li>a<br>b</li><li>c</li></ul>
26170 !! wikitext
26171 * a<br>b
26172 * c
26173 !! end
26174
26175 !! test
26176 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
26177 !! options
26178 parsoid={
26179 "modes": ["html2wt"],
26180 "scrubWikitext": false
26181 }
26182 !! html/parsoid
26183 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26184 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26185
26186 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26187 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26188
26189 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
26190
26191 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26192 !! wikitext
26193 == hello there [[Category:A1]] ==
26194
26195 == [[Category:A2]] hi pal ==
26196
26197 == <!--foo--> [[Category:A3]] how goes it ==
26198
26199 == it goes well [[Category:A4]] <!--bar--> ==
26200
26201 ==howdy [[Category:A5]]==
26202
26203 == __TOC__ ok ==
26204 !! end
26205
26206 !! test
26207 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
26208 !! options
26209 parsoid={
26210 "modes": ["html2wt"],
26211 "scrubWikitext": true
26212 }
26213 !! html/parsoid
26214 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26215 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26216
26217 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26218 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26219
26220 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26221 !! wikitext
26222 == hello there ==
26223 [[Category:A1]]
26224 [[Category:A2]]
26225
26226 == hi pal ==
26227
26228 <!--foo--> [[Category:A3]]
26229
26230 == how goes it ==
26231
26232 == it goes well ==
26233 [[Category:A4]] <!--bar-->
26234
26235 __TOC__
26236
26237 == ok ==
26238 !! end
26239
26240 !! test
26241 Headings: Don't hoist metas that come from templates
26242 !! options
26243 parsoid={
26244 "modes": ["html2wt"],
26245 "scrubWikitext": true
26246 }
26247 !! html/parsoid
26248 <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>
26249 !! wikitext
26250 == {{echo|foo [[Category:Foo]]}} ==
26251 !! end
26252
26253 !! test
26254 Headings: Category in ref isn't hoisted
26255 !! options
26256 parsoid={
26257 "modes": ["html2wt"],
26258 "scrubWikitext": true
26259 }
26260 !! html/parsoid
26261 <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>
26262
26263 <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>
26264 !! wikitext
26265 == foo <ref>bar
26266 [[Category:Baz]] </ref> ==
26267
26268 <references />
26269 !! end
26270
26271 !! test
26272 Parsoid: Serialize positional parameters with = in them as named parameter
26273 !! options
26274 parsoid=html2wt
26275 !! html/parsoid
26276 <p about="#mwt1" typeof="mw:Transclusion"
26277 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
26278
26279 <p about="#mwt1" typeof="mw:Transclusion"
26280 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
26281
26282 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26283 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26284 <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>
26285 !! wikitext
26286 {{echo|1=f=oo}}
26287
26288 {{echo|1=f=oo|2=bar}}
26289
26290 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26291 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26292 {{echo|<nowiki>f=oo</nowiki>|bar}}
26293 !! end
26294
26295 !! test
26296 Parsoid: Serialize positional parameters with = in extlink as named parameter
26297 !! options
26298 parsoid=html2wt
26299 !! html/parsoid
26300 <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>
26301 !! wikitext
26302 {{echo|1=http://stuff?is=ok}}
26303 !! end
26304
26305 !! test
26306 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
26307 !! options
26308 parsoid=html2wt
26309 !! html/parsoid
26310 <div>a<p>b</p></div>
26311 <div>a
26312 <p>b</p></div>
26313 <div>
26314 a
26315 <p>b</p></div>
26316 !! wikitext
26317 <div>a
26318 b
26319 </div>
26320 <div>a
26321 b
26322 </div>
26323 <div>
26324 a
26325
26326 b
26327 </div>
26328 !! end
26329
26330 !! test
26331 Substrings resembling wikitext in hrefs should not get nowiki escapes
26332 !! options
26333 parsoid=html2wt
26334 !! html/parsoid
26335 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
26336 !! wikitext
26337 [[Foo''bar''baz]]
26338 !! end
26339
26340 !! test
26341 Enforce single-line context in the serializer
26342 !! options
26343 parsoid=html2wt
26344 !! html/parsoid
26345 <h2>testing
26346 123</h2>
26347
26348 <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">
26349 </span><span about="#mwt1">you</span> </h2>
26350
26351 <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>
26352
26353 <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
26354 there</span></li></ol>
26355
26356 <ul><li>asd
26357 sdf</li></ul>
26358
26359 <ul><li>foo
26360 bar
26361 baz</li>
26362 <li>foo <b>bar</b>
26363 baz</li></ul>
26364
26365 <dl><dt>hi
26366 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
26367 ho</dd></dl>
26368
26369 <dl><dd> <table>
26370 <tbody><tr><td> ha
26371 ha
26372 ha</td></tr>
26373 </tbody></table></dd></dl>
26374 !! wikitext
26375 == testing 123 ==
26376
26377 == hi {{bogus|there
26378 you}} ==
26379
26380 == foo <ref>hello
26381 there</ref> ==
26382
26383 <references />
26384
26385 * asd sdf
26386
26387 * foo bar baz
26388 * foo '''bar''' baz
26389
26390 ; hi ho : hi ho
26391
26392 : {|
26393 | ha
26394 ha
26395 ha
26396 |}
26397 !! end
26398
26399 !! test
26400 Serialize new placeholder space without spans
26401 !! options
26402 parsoid=html2wt
26403 !! html/parsoid
26404 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
26405
26406 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
26407
26408 <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>
26409 !! wikitext
26410 foo : bar
26411
26412 foo : bar
26413
26414 <ref>foo : bar</ref>ok
26415 !! end
26416
26417
26418 #-----------------------
26419 # Tag minimization tests
26420 #-----------------------
26421
26422 !! test
26423 1. I/B quote minimization: wikitext-only tags should be combined
26424 !! options
26425 parsoid=html2wt
26426 !! html/parsoid
26427 <p><i>A</i><i>B</i></p>
26428 <p><b>A</b><b>B</b></p>
26429 <p><i>A</i><b><i>B</i></b></p>
26430 <p><b>A</b><i><b>B</b></i></p>
26431 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
26432 <p><i><b>A</b></i><i><b>B</b></i></p>
26433 <p><i><b>A</b></i><b><i>B</i></b></p>
26434 <p><b><i>A</i></b><i><b>B</b></i></p>
26435 !! wikitext
26436 ''AB''
26437
26438 '''AB'''
26439
26440 ''A'''B'''''
26441
26442 '''A''B'''''
26443
26444 '''A''BC''D'''
26445
26446 '''''AB'''''
26447
26448 '''''AB'''''
26449
26450 '''''AB'''''
26451 !! end
26452
26453 !! test
26454 2. I/B quote minimization: wikitext and html tags should not be combined
26455 !! options
26456 parsoid=html2wt
26457 !! html/parsoid
26458 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26459 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26460 !! wikitext
26461 ''A''<i>B</i>
26462
26463 ''A''<nowiki/>'''<i>B</i>'''
26464 !! end
26465
26466 !! test
26467 3. I/B quote minimization: templated content stops minimization
26468 !! options
26469 parsoid=html2wt
26470 !! html/parsoid
26471 <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>
26472 <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>
26473 !! wikitext
26474 ''A''{{echo|''B''}}
26475
26476 ''A''{{echo|'''''B'''''}}
26477 !! end
26478
26479 !! test
26480 4. I/B quote minimization: new content should be mimimized with adjacent old content
26481 !! options
26482 parsoid=html2wt
26483 !! html/parsoid
26484 <p><i>A</i><i>B</i></p>
26485 <p><b>A</b><b>B</b></p>
26486 <p><i>A</i><b><i>B</i></b></p>
26487 !! wikitext
26488 ''AB''
26489
26490 '''AB'''
26491
26492 ''A'''B'''''
26493 !! end
26494
26495 !! test
26496 5a. Merge adjacent quote nodes if they've been edited
26497 !! options
26498 parsoid={
26499 "modes": ["wt2wt", "selser"],
26500 "changes": [
26501 ["p", "contents", "remove", ":contains('b')"]
26502 ]
26503 }
26504 !! wikitext
26505 ''a''b''c''
26506 !! wikitext/edited
26507 ''ac''
26508 !! end
26509
26510 !! test
26511 5b. Merge adjacent quote nodes if they've been edited
26512 !! options
26513 parsoid={
26514 "modes": ["wt2wt", "selser"],
26515 "changes": [
26516 ["#x", "remove"]
26517 ]
26518 }
26519 !! wikitext
26520 ''a''<span id="x">b</span>''c''
26521 !! wikitext/edited
26522 ''ac''
26523 !! end
26524
26525 !! test
26526 1. Merge adjacent link nodes as long as at least one element is new
26527 !! options
26528 parsoid={
26529 "modes": ["html2wt"],
26530 "scrubWikitext": true
26531 }
26532 !! html/parsoid
26533 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26534 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26535 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26536 !! wikitext
26537 [[Football]]
26538 [[Football]]
26539 [[Football|Foot]][[Football|ball]]
26540 !! end
26541
26542 !! test
26543 2. Merge adjacent link nodes and enable additional normalizations
26544 !! options
26545 parsoid={
26546 "modes": ["html2wt"],
26547 "scrubWikitext": true
26548 }
26549 !! html/parsoid
26550 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26551 !! wikitext
26552 [[Football|''Football'']]
26553 !! end
26554
26555 !! test
26556 3. Don't merge adjacent link nodes if scrubWikitext is false
26557 !! options
26558 parsoid={
26559 "modes": ["html2wt"],
26560 "scrubWikitext": false
26561 }
26562 !! html/parsoid
26563 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26564 !! wikitext
26565 [[Football|Foot]][[Football|ball]]
26566 !! end
26567
26568 #------------------------------
26569 # End of tag minimization tests
26570 #------------------------------
26571
26572 !!test
26573 Bug 54262: New entities
26574 !! options
26575 parsoid=html2wt
26576 !! html/parsoid
26577 <span typeof="mw:Entity">&nbsp;</span>
26578 !! wikitext
26579 &nbsp;
26580 !! end
26581
26582 ## Note that there is no wikitext output for 'unknownproperty' ##
26583 ## Unknown magic words are silently dropped ##
26584
26585 !! test
26586 Magic words
26587 !! options
26588 parsoid=html2wt
26589 !! html/parsoid
26590 <meta property='mw:PageProp/toc' />
26591 <meta property='mw:PageProp/notoc' />
26592 <meta property='mw:PageProp/forcetoc' />
26593 <meta property='mw:PageProp/index' />
26594 <meta property='mw:PageProp/noindex' />
26595 <meta property='mw:PageProp/nogallery' />
26596 <meta property='mw:PageProp/noeditsection' />
26597 <meta property='mw:PageProp/notitleconvert' />
26598 <meta property='mw:PageProp/nocontentconvert' />
26599 <meta property='mw:PageProp/unknownproperty' />
26600 !! wikitext
26601 __TOC__
26602 __NOTOC__
26603 __FORCETOC__
26604 __INDEX__
26605 __NOINDEX__
26606 __NOGALLERY__
26607 __NOEDITSECTION__
26608 __NOTITLECONVERT__
26609 __NOCONTENTCONVERT__
26610 !! end
26611
26612 !! test
26613 Consecutive <pre>s should not get merged
26614 !! options
26615 parsoid=html2wt,html2html
26616 !! html/parsoid
26617 <pre>a</pre><pre>b</pre>
26618
26619 <pre>c
26620 </pre><pre>
26621 d</pre>
26622
26623 <pre>e
26624
26625 </pre><pre>
26626
26627 f</pre>
26628 !! wikitext
26629 a
26630
26631 b
26632
26633 c
26634
26635 d
26636
26637 e
26638
26639
26640
26641 f
26642 !! end
26643
26644 !! test
26645 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26646 !! options
26647 parsoid=html2wt
26648 !! html/parsoid
26649 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26650 !! wikitext
26651 [[Special:BookSources/1234567890|ISBN 1234567895]]
26652 !! end
26653
26654 !! test
26655 Edited RFC links not serializable as RFC links should serialize as extlinks
26656 !! options
26657 parsoid=html2wt
26658 !! html/parsoid
26659 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26660 !! wikitext
26661 [//tools.ietf.org/html/rfc123 New RFC]
26662 !! end
26663
26664 !! test
26665 Edited PMID links not serializable as PMID links should serialize as extlinks
26666 !! options
26667 parsoid=html2wt
26668 !! html/parsoid
26669 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26670 !! wikitext
26671 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26672 !! end
26673
26674 !! test
26675 WTS of autolinks with trailing/surrounding context
26676 !! options
26677 parsoid=html2wt
26678 !! html/parsoid
26679 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26680 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26681 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26682 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26683 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26684 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26685 !! wikitext
26686 http://cscott.net'''foo'''
26687
26688 http://cscott.net<b>foo</b>
26689
26690 '''http://cscott.net'''
26691
26692 '''http://cscott.net '''
26693
26694 '''http://cscott.net<nowiki/>x'''
26695
26696 http://cscott.net<nowiki/>x
26697 !! end
26698
26699 !! test
26700 WTS of autolinks with nowikis (round-trip)
26701 !! wikitext
26702 x<nowiki/>http://cscott.net<nowiki/>x
26703 !! html/parsoid
26704 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26705 !! end
26706
26707 # this is the "easy" test because it leaves in place all the
26708 # data-parsoid information indicating this is an autolink
26709 !! test
26710 WTS of autolinks with escapes (editing)
26711 !! options
26712 parsoid={
26713 "modes": ["wt2wt"],
26714 "changes": [
26715 [ "meta", "remove" ]
26716 ]
26717 }
26718 !! wikitext
26719 x<nowiki/>http://cscott.net<nowiki/>x
26720 !! wikitext/edited
26721 x<nowiki/>http://cscott.net<nowiki/>x
26722 !! end
26723
26724 !! test
26725 WTS of edited autolink-like text (T103364)
26726 !! options
26727 parsoid={
26728 "modes": ["wt2wt"],
26729 "changes": [
26730 [ "span[typeof]", "removeAttr", "typeof" ]
26731 ]
26732 }
26733 !! wikitext
26734 Not a link: <nowiki>http://example.com</nowiki>.
26735 !! wikitext/edited
26736 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26737 !! end
26738
26739 !! test
26740 WTS of newly-authored autolink-like text (T103364)
26741 !! options
26742 parsoid=html2wt
26743 !! html/parsoid
26744 <p>http://example.com is not a link.</p>
26745 !! wikitext
26746 <nowiki>http://example.com</nowiki> is not a link.
26747 !! end
26748
26749 !! test
26750 WTS of autolink-like text after an autolink (T108563)
26751 !! options
26752 parsoid=html2wt
26753 !! html/parsoid
26754 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26755 !! wikitext
26756 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26757 !! end
26758
26759 !! test
26760 Magic links inside links (not autolinked)
26761 !! wikitext
26762 [[Foo|http://example.com]]
26763 [[Foo|RFC 1234]]
26764 [[Foo|PMID 1234]]
26765 [[Foo|ISBN 123456789x]]
26766
26767 [http://foo.com http://example.com]
26768 [http://foo.com RFC 1234]
26769 [http://foo.com PMID 1234]
26770 [http://foo.com ISBN 123456789x]
26771 !! html+tidy
26772 <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>
26773 <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>
26774 !! html/parsoid
26775 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26776 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26777 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26778 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26779
26780 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26781 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26782 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26783 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26784 !! end
26785
26786 !! test
26787 Magic links inside image captions (autolinked)
26788 !! wikitext
26789 [[File:Foobar.jpg|thumb|http://example.com]]
26790 [[File:Foobar.jpg|thumb|RFC 1234]]
26791 [[File:Foobar.jpg|thumb|PMID 1234]]
26792 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26793 !! html+tidy
26794 <div class="thumb tright">
26795 <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>
26796 <div class="thumbcaption">
26797 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26798 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26799 </div>
26800 </div>
26801 <div class="thumb tright">
26802 <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>
26803 <div class="thumbcaption">
26804 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26805 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26806 </div>
26807 </div>
26808 <div class="thumb tright">
26809 <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>
26810 <div class="thumbcaption">
26811 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26812 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26813 </div>
26814 </div>
26815 <div class="thumb tright">
26816 <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>
26817 <div class="thumbcaption">
26818 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26819 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26820 </div>
26821 </div>
26822 !! html/parsoid
26823 <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>
26824 <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>
26825 <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>
26826 <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>
26827 !! end
26828
26829 !! test
26830 WTS of magic word text (T109371)
26831 !! options
26832 parsoid=html2wt
26833 !! html/parsoid
26834 <p>RFC 1234</p>
26835 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26836 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26837 !! wikitext
26838 <nowiki>RFC 1234</nowiki>
26839
26840 [http://foo.com RFC 1234]
26841
26842 [[Foo|RFC 1234]]
26843 !! end
26844
26845 !! test
26846 Edited Redirect link should emit a non-piped wikitext link
26847 !! options
26848 parsoid=html2wt
26849 !! html/parsoid
26850 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26851 !! wikitext
26852 #REDIRECT [[Bar]]
26853 !! end
26854
26855 !! test
26856 T75121: Infer extension name from typeOf if data-mw is not present
26857 !! options
26858 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26859 !! html/parsoid
26860 <div typeOf="mw:Extension/foo"></div>
26861 !! wikitext
26862 <foo />
26863 !! end
26864
26865 # Note that the <p> wrapping isn't present in PHP parser output
26866 # The important thing for this test is that P-wrapping doesn't
26867 # interfere with the <nowiki> protection for leading - in <td>
26868 # (which isn't necessary for <th>).
26869 !! test
26870 T88318: p-wrapped dash in table.
26871 !! options
26872 parsoid=html2wt,wt2wt
26873 !! html/parsoid
26874 <table><tbody>
26875 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26876 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26877 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26878 </tbody></table>
26879 !! wikitext
26880 {|
26881 !-
26882 !-
26883 |-
26884 |<nowiki>-</nowiki>
26885 |<nowiki>- </nowiki>
26886 |-
26887 |<small>-</small>
26888 |<br>
26889 -
26890 |<br>
26891 -
26892 |}
26893 !! html/php+tidy
26894 <table>
26895 <tr>
26896 <th>-</th>
26897 <th>-</th>
26898 </tr>
26899 <tr>
26900 <td>-</td>
26901 <td>-</td>
26902 </tr>
26903 <tr>
26904 <td><small>-</small></td>
26905 <td><br />
26906 <p>-</p>
26907 </td>
26908 <td><br />
26909 <p>-</p>
26910 </td>
26911 </tr>
26912 </table>
26913 !! end
26914
26915 !! test
26916 T149209: WTS: Handle newlines in table cells properly
26917 !! options
26918 parsoid=html2wt
26919 !! html/parsoid
26920 <table>
26921 <tbody>
26922 <tr><td>a
26923 b
26924 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
26925 <tr><td><p>x</p>
26926 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
26927 </tbody></table>
26928 <table>
26929 <tbody>
26930 <tr><th>a
26931 b
26932 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
26933 <tr><th><p>x</h>
26934 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
26935 </tbody></table>
26936 !! wikitext
26937 {|
26938 |a
26939 b
26940 |c
26941 |-
26942 |x
26943 {{!}}y
26944 |}
26945 {|
26946 !a
26947 b
26948 !c
26949 |-
26950 !x
26951 !y
26952 |}
26953 !! end
26954
26955 !! test
26956 T149209: Selser: Handle newlines in table cells properly
26957 !! options
26958 parsoid={
26959 "modes": ["selser"],
26960 "changes": [
26961 [ "#h1", "html", "a\nb\n" ],
26962 [ "#h2", "html", "a\nb\n" ],
26963 [ "#c1", "html", "a\nb\n" ],
26964 [ "#c2", "html", "<p>a</p>" ],
26965 [ "#c3", "html", "<p>a</p>" ],
26966 [ "#c4", "html", "edit-me<p>a</p>" ]
26967 ]
26968 }
26969 !! wikitext
26970 {|
26971 ! id="h1" |edit-me!!1
26972 |-
26973 ! id="h2" |edit-me||2
26974 |-
26975 | id="c1" |edit-me||3
26976 |-
26977 | id="c2" |edit-me||4
26978 |-
26979 | id="c3" |edit-me||p||q||r
26980 |-
26981 | id="c4" |edit-me||p||q||r
26982 |}
26983 !! wikitext/edited
26984 {|
26985 ! id="h1" |a
26986 b
26987 !1
26988 |-
26989 ! id="h2" |a
26990 b
26991 !2
26992 |-
26993 | id="c1" |a
26994 b
26995 |3
26996 |-
26997 | id="c2" |a
26998 |4
26999 |-
27000 | id="c3" |a
27001 |p||q||r
27002 |-
27003 | id="c4" |edit-me
27004 a
27005 |p||q||r
27006 |}
27007 !! end
27008
27009 !! test
27010 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
27011 !! options
27012 parsoid=html2wt
27013 !! html/parsoid
27014 <table id='mwAb'>
27015 <td id='mwAc'>foo</td>
27016 <td id='serialize-this'>bar</td>
27017 </table>
27018 !! wikitext
27019 {|
27020 |foo
27021 | id="serialize-this" |bar
27022 |}
27023 !! end
27024
27025 !! test
27026 Parsoid-like element ids should not be serialized to wikitext unless shadowed
27027 !! options
27028 parsoid=html2wt
27029 !! html/parsoid
27030 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
27031 !! wikitext
27032 <div id="hello">ok</div>
27033 !! end
27034
27035 !! test
27036 WTS change modes
27037 !! options
27038 parsoid={
27039 "modes": ["wt2wt"],
27040 "changes": [
27041 [ "#xyz", "before", "<b>before</b> stuff " ],
27042 [ "#xyz", "after", " stuff <i>after</i>" ],
27043 [ "#xyz", "html", "x <b>y</b> z" ]
27044 ]
27045 }
27046 !! wikitext
27047 <span id="xyz">hello</span>
27048 !! wikitext/edited
27049 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
27050 !! end
27051
27052 !! test
27053 Never serialize a-tag as html, regardless of what data-parsoid has to say
27054 !! options
27055 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27056 !! html/parsoid
27057 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
27058 !! wikitext
27059 [[Foo]]
27060 !! end
27061
27062 ## SSS FIXME: This is broken output nevertheless.
27063 ## What might be a reasonable non-broken output for this?
27064 ## This is an edge case unlikely to be seen in production
27065 ## that I am not wasting more time on this right now.
27066 !! test
27067 Never serialize a-tag as html, no matter what attributes it has
27068 !! options
27069 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27070 !! html/parsoid
27071 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
27072 !! wikitext
27073 [http://boo.org http://boohoo.org]
27074 !! end
27075
27076 # Misnested is an indication that selser can reuse the source but these have
27077 # shown to sneak through on occasion. See T101768.
27078 # The original wikitext here is: [http://test.com [[one]] two three]
27079 !! test
27080 Strip span tags added to mark misnested links
27081 !! options
27082 parsoid=html2wt
27083 !! html/parsoid
27084 <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>
27085 !! wikitext
27086 [http://test.com][[one]] two three
27087 !! end
27088
27089 !! test
27090 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
27091 !! options
27092 parsoid=html2wt
27093 !! html/parsoid
27094 <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|}"]}'>
27095 <tbody><tr><td>d
27096 </td></tr>
27097 </tbody></table>
27098 !! wikitext
27099 {{echo|a}}
27100 {|{{echo|c
27101 {{!}}d
27102 }}
27103 |}
27104 !! end
27105
27106 ## This test verifies the presence and computation of this attribute indirectly
27107 ## by making an edit and ensuring that the serialization is correct (which it would be
27108 ## only if firstWikitextNode is properly set).
27109 !! test
27110 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
27111 !! options
27112 parsoid= {
27113 "modes": ["wt2wt"],
27114 "changes": [
27115 [ "div#x", "remove" ],
27116 [ "div", "before", "<div>new</div>" ]
27117 ]
27118 }
27119 !! wikitext
27120 <div id="x">foo</div>
27121 {|
27122 {{echo|<div>boo</div>
27123 {{!}}b}}
27124 |c
27125 |}
27126 !! wikitext/edited
27127
27128 <div>new</div>
27129 {|
27130 {{echo|<div>boo</div>
27131 {{!}}b}}
27132 |c
27133 |}
27134 !! end
27135
27136 # --------------------------------------------
27137 # Tests spec'ing wikitext serialization norms |
27138 # --------------------------------------------
27139
27140 !! test
27141 1. Categories should always be serialized on their own line
27142 !! options
27143 parsoid=html2wt
27144 !! html/parsoid
27145 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
27146 !! wikitext
27147 foo
27148 [[Category:Foo]]
27149 bar
27150 !! end
27151
27152 !! test
27153 2. Categories that are part of templates should not introduce a line break
27154 !! wikitext
27155 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
27156 !! html/parsoid
27157 <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>
27158 !! end
27159
27160 # Careful while editing these next 2 tests. There are \u200f characters
27161 # before and after the <link> tags in the HTML and following some
27162 # of the categories in wikitext
27163 # Do not remove these characters in edits.
27164 #
27165 # As part of the serialization, these bidi characters will get stripped.
27166 !! test
27167 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
27168 !! options
27169 parsoid={
27170 "modes": ["html2wt"],
27171 "scrubWikitext": true
27172 }
27173 !! html/parsoid
27174 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
27175 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
27176 !! wikitext
27177 [[קטגוריה:טקסים]]
27178 [[קטגוריה: שיטות משפט]]
27179 !! end
27180
27181 !! test
27182 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
27183 !! options
27184 parsoid={
27185 "modes": ["html2wt"],
27186 "scrubWikitext": true
27187 }
27188 !! html/parsoid
27189 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
27190 !! wikitext
27191 [[קטגוריה:טקסים]]
27192 ‏y
27193 !! end
27194
27195 !! test
27196 Lists: Add space after bullets
27197 !! options
27198 parsoid=html2wt
27199 !! html/parsoid
27200 <ul>
27201 <li>foo</li>
27202 <li> bar</li>
27203 <li><span> baz</span></li>
27204 </ul>
27205 !! wikitext
27206 * foo
27207 * bar
27208 * <span> baz</span>
27209 !! end
27210
27211 !! test
27212 1. Headings: Add space before/after == (T53744)
27213 !! options
27214 parsoid=html2wt
27215 !! html/parsoid
27216 <h2>foo</h2>
27217 <h2> bar</h2>
27218 <h2>baz </h2>
27219 <h2><span> baz</span></h2>
27220 !! wikitext
27221 == foo ==
27222
27223 == bar ==
27224
27225 == baz ==
27226
27227 == <span> baz</span> ==
27228 !! end
27229
27230 !! test
27231 2. Headings: Add space before/after == even after hoisted content
27232 !! options
27233 parsoid={
27234 "modes": ["html2wt"],
27235 "scrubWikitext": true
27236 }
27237 !! html/parsoid
27238 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
27239 !! wikitext
27240 [[Category:A2]]
27241
27242 == ok ==
27243 !! end
27244
27245 !! test
27246 1. Headings: suppress newly created empty headings
27247 !! options
27248 parsoid={
27249 "modes": ["html2wt"],
27250 "scrubWikitext": true
27251 }
27252 !! html/parsoid
27253 <h2></h2>
27254 !! wikitext
27255 !! end
27256
27257 !! test
27258 2. Headings: don't suppress empty headings if scrubWikitext is false
27259 !! options
27260 parsoid=html2wt
27261 !! html/parsoid
27262 <h2></h2>
27263 !! wikitext
27264 ==<nowiki/>==
27265 !! end
27266
27267 !! test
27268 3. Headings: suppress empty headings on edits
27269 !! options
27270 parsoid={
27271 "modes": ["selser"],
27272 "scrubWikitext": true,
27273 "changes": [
27274 [ "#x", "remove"]
27275 ]
27276 }
27277 !! wikitext
27278 ==<span id="x">foo</span>==
27279 !! wikitext/edited
27280 !! end
27281
27282 !! test
27283 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
27284 !! options
27285 parsoid={
27286 "modes": ["html2wt"],
27287 "scrubWikitext": true
27288 }
27289 !! html/parsoid
27290 <h2>foo<br/>bar</h2>
27291 <h2>foo <span><br/>bar</span> baz</h2>
27292 !! wikitext
27293 == foo bar ==
27294
27295 == foo <span> bar</span> baz ==
27296 !! end
27297
27298 !! test
27299 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
27300 !! options
27301 parsoid={
27302 "modes": ["html2wt"],
27303 "scrubWikitext": false
27304 }
27305 !! html/parsoid
27306 <h2>foo<br/>bar</h2>
27307 !! wikitext
27308 == foo<br> bar ==
27309 !! end
27310
27311 !! test
27312 1. WT Quote Tags: suppress newly created empty style tags
27313 !! options
27314 parsoid={
27315 "modes": ["html2wt"],
27316 "scrubWikitext": true
27317 }
27318 !! html/parsoid
27319 <i></i><b></b>
27320 !! wikitext
27321 !! end
27322
27323 !! test
27324 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
27325 !! options
27326 parsoid=html2wt
27327 !! html/parsoid
27328 <i></i><b></b>
27329 !! wikitext
27330 ''<nowiki/>'''''<nowiki/>'''
27331 !! end
27332
27333 !! test
27334 3. WT Quote Tags: suppress empty style tags on edits
27335 !! options
27336 parsoid={
27337 "modes": ["selser"],
27338 "scrubWikitext": true,
27339 "changes": [
27340 [ "#x", "remove"]
27341 ]
27342 }
27343 !! wikitext
27344 '''<span id="x">foo</span>'''
27345 !! wikitext/edited
27346 !! end
27347
27348 !! test
27349 1. Anchors: suppress newly created empty anchors
27350 !! options
27351 parsoid={
27352 "modes": ["html2wt"],
27353 "scrubWikitext": true
27354 }
27355 !! html/parsoid
27356 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27357 !! wikitext
27358 !! end
27359
27360 !! test
27361 2. Anchors: don't suppress empty anchors if scrubWikitext is false
27362 !! options
27363 parsoid={
27364 "modes": ["html2wt"],
27365 "scrubWikitext": false
27366 }
27367 !! html/parsoid
27368 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27369 !! wikitext
27370 [[Test|<nowiki/>]]
27371 !! end
27372
27373 !! test
27374 3. Anchors: suppress empty anchors on edits
27375 !! options
27376 parsoid={
27377 "modes": ["selser"],
27378 "scrubWikitext": true,
27379 "changes": [
27380 [ "#x", "remove"]
27381 ]
27382 }
27383 !! wikitext
27384 [[Test|<span id="x">foo</span>]]
27385 !! wikitext/edited
27386 !! end
27387
27388 !! test
27389 3a. Anchors: do not suppress numbered extlinks
27390 !! options
27391 parsoid={
27392 "modes": ["wt2wt"],
27393 "scrubWikitext": true
27394 }
27395 !! wikitext
27396 [http://foo.com]
27397 !! html/parsoid
27398 <a rel="mw:ExtLink" href="http://foo.com"></a>
27399 !! end
27400
27401 !! test
27402 3b. Anchors: do not suppress numbered extlinks
27403 !! options
27404 parsoid={
27405 "modes": ["wt2wt"],
27406 "scrubWikitext": true,
27407 "changes": [
27408 [ "#x", "remove"]
27409 ]
27410 }
27411 !! wikitext
27412 [http://foo.com <span id="x">foo</span>]
27413 !! wikitext/edited
27414 [http://foo.com]
27415 !! end
27416
27417 !!test
27418 Normalizations should be restricted to edited content
27419 !!options
27420 parsoid={
27421 "modes": ["selser"],
27422 "scrubWikitext": true,
27423 "changes": [
27424 [ "h1", "before", "<i></i>"]
27425 ]
27426 }
27427 !!wikitext
27428 a
27429 = =
27430 b
27431 !!wikitext/edited
27432 a
27433 = =
27434 b
27435 !!end
27436
27437 !! test
27438 1. Multiple normalizations (html2wt)
27439 !! options
27440 parsoid={
27441 "modes": ["html2wt"],
27442 "scrubWikitext": true
27443 }
27444 !! html
27445 <h2><i></i></h2>
27446 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27447 </a><b><i></i></b>x</p>
27448 !! wikitext
27449
27450 [[foo]]
27451 x
27452
27453 !! end
27454
27455 !! test
27456 2. Multiple normalizations (selser)
27457 !! options
27458 parsoid={
27459 "modes": ["selser"],
27460 "scrubWikitext": true,
27461 "changes": [
27462 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27463 ]
27464 }
27465 !! wikitext
27466 <span id="x">foo</span>
27467 !! wikitext/edited
27468 <span id="x">foo</span>
27469
27470 x
27471 !! end
27472
27473 !! test
27474 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27475 !! options
27476 parsoid={
27477 "modes": ["html2wt"],
27478 "scrubWikitext": true
27479 }
27480 !! html/parsoid
27481 <p> hi</p>
27482 <p> hello</p>
27483 !! wikitext
27484 hi
27485
27486 hello
27487 !! end
27488
27489 !! test
27490 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27491 !! options
27492 parsoid=html2wt
27493 !! html/parsoid
27494 <p> hi</p>
27495 <p> hello</p>
27496 !! wikitext
27497 <nowiki> </nowiki>hi
27498
27499 <nowiki> </nowiki> hello
27500 !! end
27501
27502 !! test
27503 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27504 !! options
27505 parsoid={
27506 "modes": ["html2wt"],
27507 "scrubWikitext": true
27508 }
27509 !! html/parsoid
27510 <p>Foo
27511 bar
27512 baz</p>
27513
27514 <table><tr><td>Foo
27515 bar
27516 baz bang</td></tr></table>
27517
27518 <p><!--boo--> foo
27519 bar</p>
27520
27521 <p> foo
27522 bar<span>boo</span></p>
27523 !! wikitext
27524 Foo
27525 bar
27526 baz
27527
27528 {|
27529 |Foo
27530 bar
27531 baz bang
27532 |}
27533
27534 <!--boo-->foo
27535 bar
27536
27537 foo
27538 bar<span>boo</span>
27539 !! end
27540
27541 !! test
27542 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27543 !! options
27544 parsoid={
27545 "modes": ["selser"],
27546 "scrubWikitext": true,
27547 "changes": [
27548 [ "p", "html", " a\n b" ]
27549 ]
27550 }
27551 !! wikitext
27552 xyz
27553 !! wikitext/edited
27554 a
27555 b
27556 !! end
27557
27558 !! test
27559 1. New links that end in spaces
27560 !! options
27561 parsoid={
27562 "modes": ["html2wt"],
27563 "scrubWikitext": false
27564 }
27565 !! html/parsoid
27566 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27567 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27568 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27569 !! wikitext
27570 [[Berlin ]]<nowiki/>is the capital of Germany.
27571
27572 [[Foo ]]'''bar'''
27573
27574 [[Boston ]] is a city.
27575 !! end
27576
27577 !! test
27578 2. New links that end in spaces
27579 !! options
27580 parsoid={
27581 "modes": ["html2wt"],
27582 "scrubWikitext": true
27583 }
27584 !! html/parsoid
27585 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27586 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27587 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27588 !! wikitext
27589 [[Berlin]] is the capital of Germany.
27590
27591 [[Foo]] '''bar'''
27592
27593 [[Boston]] is a city.
27594 !! end
27595
27596 !! test
27597 1. Table cells with escapable prefixes
27598 !! options
27599 parsoid={
27600 "modes": ["html2wt"],
27601 "scrubWikitext": false
27602 }
27603 !! html
27604 <table>
27605 <tr><td>a</td></tr>
27606 <tr><td>-</td></tr>
27607 <tr><td>+</td></tr>
27608 </table>
27609 !! wikitext
27610 {|
27611 |a
27612 |-
27613 |<nowiki>-</nowiki>
27614 |-
27615 |<nowiki>+</nowiki>
27616 |}
27617 !! end
27618
27619 !! test
27620 2. Table cells with escapable prefixes
27621 !! options
27622 parsoid={
27623 "modes": ["html2wt"],
27624 "scrubWikitext": true
27625 }
27626 !! html
27627 <table>
27628 <tr><td>a</td></tr>
27629 <tr><td>-</td></tr>
27630 <tr><td>+</td></tr>
27631 </table>
27632 !! wikitext
27633 {|
27634 |a
27635 |-
27636 | -
27637 |-
27638 | +
27639 |}
27640 !! end
27641
27642 !! test
27643 3a. Table cells with escapable prefixes after edits
27644 !! options
27645 parsoid={
27646 "modes": ["selser"],
27647 "scrubWikitext": true,
27648 "changes": [
27649 [ "table tbody tr:first-child td:first-child", "remove"]
27650 ]
27651 }
27652 !! wikitext
27653 {|
27654 |a||-
27655 |}
27656 !! wikitext/edited
27657 {|
27658 | -
27659 |}
27660 !! end
27661
27662 !! test
27663 3b. Table cells with escapable prefixes after edits
27664 !! options
27665 parsoid={
27666 "modes": ["selser"],
27667 "scrubWikitext": true,
27668 "changes": [
27669 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27670 [ "#x", "remove" ]
27671 ]
27672 }
27673 !! wikitext
27674 {|
27675 |pqr
27676 |<span id="x">foo</span>+
27677 |}
27678 !! wikitext/edited
27679 {|
27680 | -
27681 | +
27682 |}
27683 !! end
27684
27685 # FIXME: This test will fail because
27686 # normalization doesn't realize that the id attribute
27687 # will eliminate the escapable scenario
27688 !! test
27689 4a. Table cells without escapable prefixes after edits
27690 !! options
27691 parsoid={
27692 "modes": ["selser"],
27693 "scrubWikitext": true,
27694 "changes": [
27695 [ "#x", "html", "-" ]
27696 ]
27697 }
27698 !! wikitext
27699 {|
27700 | id="x" |abcd
27701 |}
27702 !! wikitext/edited
27703 {|
27704 | id="x" |-
27705 |}
27706 !! end
27707
27708 ## This tests normalizer's ability to discriminate between
27709 ## cells having identical content.
27710 !! test
27711 4b. Table cells without escapable prefixes after edits
27712 !! options
27713 parsoid={
27714 "modes": ["selser"],
27715 "scrubWikitext": true,
27716 "changes": [
27717 [ "td", "html", "-" ]
27718 ]
27719 }
27720 !! wikitext
27721 {|
27722 |a||b
27723 |}
27724 !! wikitext/edited
27725 {|
27726 | -||-
27727 |}
27728 !! end
27729
27730 ## This tests normalizer's ability to not be tripped by
27731 ## comments (and whitespace)
27732 !! test
27733 4c. Table cells without escapable prefixes after edits
27734 !! options
27735 parsoid={
27736 "modes": ["selser"],
27737 "scrubWikitext": true,
27738 "changes": [
27739 [ "table tbody tr td:first-child", "remove" ]
27740 ]
27741 }
27742 !! wikitext
27743 {|
27744 |-
27745 <!--foo--> |a||-
27746 |}
27747 !! wikitext/edited
27748 {|
27749 |-
27750 <!--foo--> | -
27751 |}
27752 !! end
27753
27754 ## This tests normalizer's ability to handle HTML cells
27755 !! test
27756 4d. Table cells without escapable prefixes after edits
27757 !! options
27758 parsoid={
27759 "modes": ["selser"],
27760 "scrubWikitext": true,
27761 "changes": [
27762 [ "td", "html", "-" ]
27763 ]
27764 }
27765 !! wikitext
27766 <table>
27767 <tr><td>a</td></tr>
27768 </table>
27769 !! wikitext/edited
27770 <table>
27771 <tr><td>-</td></tr>
27772 </table>
27773 !! end
27774
27775 ## T111151 Remove font elements without attributes
27776 !! test
27777 5a. font tags without attributes should be dropped in scrubWikitext mode
27778 !! options
27779 parsoid={
27780 "modes": ["html2wt"],
27781 "scrubWikitext": true
27782 }
27783 !! html
27784 <font>foo</font>
27785 <font><font>bar</font></font>
27786 <font class="x">boo</font>
27787 !! wikitext
27788 foo
27789 bar
27790 <font class="x">boo</font>
27791 !! end
27792
27793 !! test
27794 5b. font tags should not be dropped without scrubWikitext being enabled
27795 !! options
27796 parsoid={
27797 "modes": ["html2wt"],
27798 "scrubWikitext": false
27799 }
27800 !! html
27801 <font>foo</font>
27802 !! wikitext
27803 <font>foo</font>
27804 !! end
27805
27806 !! test
27807 Escape nowiki DOM elements
27808 !! options
27809 parsoid=html2wt
27810 !! html/parsoid
27811 <nowiki><i>foo</i></nowiki>
27812 !! wikitext
27813 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27814 !! end
27815
27816 # This is meant to be an interim fix while we go about figuring out
27817 # how to not introduce these trailing <nowiki/>s in the first place.
27818 !! test
27819 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27820 !! options
27821 parsoid=html2wt
27822 !! html/parsoid
27823 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27824 y</p>
27825 <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>
27826 <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>
27827 !! wikitext
27828 x
27829 y
27830
27831 {{echo|
27832 1 = <nowiki/>}}
27833
27834 {{echo|
27835 1 = <nowiki/>
27836 }}
27837 !! end
27838
27839 # ---------------------------------------------------
27840 # End of tests spec'ing wikitext serialization norms |
27841 # ---------------------------------------------------
27842
27843 # T104032
27844 !! test
27845 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27846 !! options
27847 parsoid=html2wt
27848 !! html/parsoid
27849 a<p>b</p>
27850 <b>c</b><p>d</p>
27851 <table><tr>
27852 <td>a<p>b</p></td>
27853 <td><b>c</b><p>d</p></td>
27854 </tr></table>
27855 !! wikitext
27856 a
27857
27858 b
27859
27860 '''c'''
27861
27862 d
27863 {|
27864 |a
27865 b
27866 |'''c'''
27867 d
27868 |}
27869 !! end
27870
27871 # -----------------------------------------------------------------
27872 # End of section for Parsoid-only html2wt tests for serialization
27873 # of new content
27874 # -----------------------------------------------------------------
27875
27876 # -----------------------------------------------------------------
27877 # The following section of tests are primarily to spec behavior of
27878 # the selective serializer. All these tests have manual selser
27879 # changes. The automated selser changes for all tests handle the
27880 # wide variation of changes, but these tests here capture specs
27881 # deterministically.
27882 # ----------------------------------------------------------------
27883
27884 ## T90517
27885 !! test
27886 Selser: New comments should not be lost
27887 !! options
27888 parsoid={
27889 "modes": ["selser"],
27890 "changes": [
27891 [ "#a", "after", "<!--c1-->" ],
27892 [ "#b", "before", "<!--c2-->" ]
27893 ]
27894 }
27895 !! wikitext
27896 <span id="a">a</span>
27897
27898 <span id="b">b</span>
27899 !! wikitext/edited
27900 <span id="a">a</span><!--c1-->
27901
27902 <!--c2--><span id="b">b</span>
27903 !! end
27904
27905 ## T89383
27906 !! test
27907 Selser: Check for validity of DSR before using it
27908 !! options
27909 parsoid={
27910 "modes": ["selser"],
27911 "changes": [
27912 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27913 ]
27914 }
27915 !! wikitext
27916 <span id="a">a</span>
27917 !! wikitext/edited
27918 {{DISPLAYTITLE:foo}}
27919 <span id="a">a</span>
27920 !! end
27921
27922 !! test
27923 1. DOMDiff: Changes to <ref> content should be looked up using id
27924 !! options
27925 parsoid={
27926 "modes": ["selser"],
27927 "changes": [
27928 ["#X", "after", "bar"],
27929 ["#Y", "after", "baz"]
27930 ]
27931 }
27932 !! wikitext
27933 X <ref><span id="X">foo</span></ref>
27934 Y <ref name="a" />
27935 <references>
27936 <ref name="a"><span id="Y">foo</span></ref>
27937 </references>
27938 !! wikitext/edited
27939 X <ref><span id="X">foo</span>bar</ref>
27940 Y <ref name="a" />
27941 <references>
27942 <ref name="a"><span id="Y">foo</span>baz</ref>
27943 </references>
27944 !! end
27945
27946 !! test
27947 2. DOMDiff: Changes to <ref> content should be looked up using id
27948 !! options
27949 parsoid={
27950 "modes": ["selser"],
27951 "changes": [
27952 ["#Z", "after", "bar"]
27953 ]
27954 }
27955 !! wikitext
27956 A <ref>foo bar for a</ref>
27957 B <ref group="X" name="b" />
27958
27959 <references />
27960
27961 <references group="X">
27962 <ref name="b"><span id="Z">foo</span></ref>
27963 </references>
27964 !! wikitext/edited
27965 A <ref>foo bar for a</ref>
27966 B <ref group="X" name="b" />
27967
27968 <references />
27969
27970 <references group="X">
27971 <ref name="b"><span id="Z">foo</span>bar</ref>
27972 </references>
27973 !! end
27974
27975 !! test
27976 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27977 !! options
27978 parsoid={
27979 "modes": ["selser"],
27980 "changes": [
27981 [ "div:first-child", "text", "bar" ]
27982 ]
27983 }
27984 !! wikitext
27985 <div style="{{1x|color:red;}}%">foo</div>
27986 !! wikitext/edited
27987 <div style="{{1x|color:red;}}%">bar</div>
27988 !! end
27989
27990 !! test
27991 Empty LI (T49673)
27992 !! wikitext
27993 * a
27994 *
27995 *
27996 * b
27997 !! html/php+tidy
27998 <ul>
27999 <li>a</li>
28000 <li class="mw-empty-elt"></li>
28001 <li class="mw-empty-elt"></li>
28002 <li>b</li>
28003 </ul>
28004 !! end
28005
28006 !! test
28007 Thumbnail output
28008 !! wikitext
28009 [[File:Thumb.png|thumb]]
28010 !! html/php+tidy
28011 <div class="thumb tright">
28012 <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>
28013 <div class="thumbcaption">
28014 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
28015 </div>
28016 </div>
28017 </div>
28018 !! end
28019
28020 !! test
28021 unclosed internal link XSS (T137264)
28022 !! wikitext
28023 [[#%3Cscript%3Ealert(1)%3C/script%3E|
28024 !! html/php
28025 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
28026 </p>
28027 !! html/parsoid
28028 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
28029 !! end