Sync up with Parsoid parserTests.
[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
937 !! test
938 Italics and bold: multiple quote sequences: (2,4,2)
939 !! options
940 parsoid=wt2html
941 !! wikitext
942 ''foo''''bar''
943 !! html/*
944 <p><i>foo'<b>bar</b></i>
945 </p>
946 !! end
947
948 # same html as previous, but wikitext adjusted to match parsoid html2wt
949 !! test
950 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
951 !! wikitext
952 ''foo'<nowiki/>'''bar'''''
953 !! html
954 <p><i>foo'<b>bar</b></i>
955 </p>
956 !! end
957
958 !! test
959 Italics and bold: multiple quote sequences: (2,4,3)
960 !! options
961 parsoid=wt2html
962 !! wikitext
963 ''foo''''bar'''
964 !! html/*
965 <p><i>foo'<b>bar</b></i>
966 </p>
967 !! end
968
969 # same html as previous, but wikitext adjusted to match parsoid html2wt
970 !! test
971 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
972 !! wikitext
973 ''foo'<nowiki/>'''bar'''''
974 !! html
975 <p><i>foo'<b>bar</b></i>
976 </p>
977 !! end
978
979 !! test
980 Italics and bold: multiple quote sequences: (2,4,4)
981 !! options
982 parsoid=wt2html
983 !! wikitext
984 ''foo''''bar''''
985 !! html/*
986 <p><i>foo'<b>bar'</b></i>
987 </p>
988 !! end
989
990 # same html as previous, but wikitext adjusted to match parsoid html2wt
991 !! test
992 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
993 !! wikitext
994 ''foo'<nowiki/>'''bar'<nowiki/>'''''
995 !! html
996 <p><i>foo'<b>bar'</b></i>
997 </p>
998 !! end
999
1000 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1001 !! test
1002 Italics and bold: multiple quote sequences: (3,4,2)
1003 !! options
1004 parsoid=wt2html
1005 !! wikitext
1006 '''foo''''bar''
1007 !! html/php
1008 <p><b>foo'</b>bar
1009 </p>
1010 !! html/parsoid
1011 <p><b>foo'</b>bar<i></i>
1012 </p>
1013 !! end
1014
1015 # same html as previous, but wikitext adjusted to match parsoid html2wt
1016 !! test
1017 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1018 !! wikitext
1019 '''foo''''bar''<nowiki/>''
1020 !! html/php
1021 <p><b>foo'</b>bar
1022 </p>
1023 !! html/parsoid
1024 <p><b>foo'</b>bar<i></i>
1025 </p>
1026 !! end
1027
1028 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1029 !! test
1030 Italics and bold: multiple quote sequences: (3,4,3)
1031 !! options
1032 parsoid=wt2html
1033 !! wikitext
1034 '''foo''''bar'''
1035 !! html/php
1036 <p><b>foo'</b>bar
1037 </p>
1038 !! html/parsoid
1039 <p><b>foo'</b>bar<b></b>
1040 </p>
1041 !! end
1042
1043 # same html as previous, but wikitext adjusted to match parsoid html2wt
1044 !! test
1045 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1046 !! wikitext
1047 '''foo''''bar'''<nowiki/>'''
1048 !! html/php
1049 <p><b>foo'</b>bar
1050 </p>
1051 !! html/parsoid
1052 <p><b>foo'</b>bar<b></b>
1053 </p>
1054 !! end
1055
1056 ###
1057 ### other quote tests
1058 ###
1059 !! test
1060 Italics and bold: other quote tests: (2,3,5)
1061 !! wikitext
1062 ''this is about '''foo's family'''''
1063 !! html
1064 <p><i>this is about <b>foo's family</b></i>
1065 </p>
1066 !!end
1067
1068
1069 !! test
1070 Italics and bold: other quote tests: (2,(3,3),2)
1071 !! wikitext
1072 ''this is about '''foo's''' family''
1073 !! html
1074 <p><i>this is about <b>foo's</b> family</i>
1075 </p>
1076 !!end
1077
1078
1079 !! test
1080 Italics and bold: other quote tests: (3,2,3,2)
1081 !! options
1082 parsoid=wt2html
1083 !! wikitext
1084 '''this is about ''foo'''s family''
1085 !! html/*
1086 <p><b>this is about <i>foo</i></b><i>s family</i>
1087 </p>
1088 !!end
1089
1090
1091 # same html as previous, but wikitext adjusted to match parsoid html2wt
1092 !! test
1093 Italics and bold: other quote tests: (3,2,3+2+2,2)
1094 !! wikitext
1095 '''this is about ''foo'''''<nowiki/>''s family''
1096 !! html
1097 <p><b>this is about <i>foo</i></b><i>s family</i>
1098 </p>
1099 !! end
1100
1101
1102 !! test
1103 Italics and bold: other quote tests: (3,2,3,3)
1104 !! wikitext
1105 '''this is about ''foo'''s family'''
1106 !! html/*
1107 <p>'<i>this is about </i>foo<b>s family</b>
1108 </p>
1109 !!end
1110
1111
1112 !! test
1113 Italics and bold: other quote tests: (3,(2,2),3)
1114 !! wikitext
1115 '''this is about ''foo's'' family'''
1116 !! html
1117 <p><b>this is about <i>foo's</i> family</b>
1118 </p>
1119 !!end
1120
1121
1122 !! test
1123 Italicized possessive
1124 !! wikitext
1125 The ''[[Main Page]]'''s talk page.
1126 !! html/php
1127 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1128 </p>
1129 !! html/parsoid
1130 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1131 !! end
1132
1133 !! test
1134 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1135 (Requires tidy for PHP parser output to be fixed up)
1136 !! options
1137 parsoid=wt2html,wt2wt
1138 !! wikitext
1139 {|
1140 !''a!!''b
1141 |''a||''b
1142 |}
1143 !! html/php+tidy
1144 <table>
1145 <tr>
1146 <th><i>a</i></th>
1147 <th><i>b</i></th>
1148 <td><i>a</i></td>
1149 <td><i>b</i></td>
1150 </tr>
1151 </table>
1152 !! html/parsoid
1153 <table>
1154 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1155 <td><i>a</i></td><td><i>b</i></td></tr>
1156 </tbody></table>
1157 !! end
1158
1159 ###
1160 ### Non-html5 tags
1161 ###
1162
1163 !! test
1164 Non-html5 tags should be accepted
1165 !! wikitext
1166 <center>''foo''</center>
1167 <big>''foo''</big>
1168 <font>''foo''</font>
1169 <strike>''foo''</strike>
1170 <tt>''foo''</tt>
1171 !! html
1172 <center><i>foo</i></center>
1173 <p><big><i>foo</i></big>
1174 <font><i>foo</i></font>
1175 <strike><i>foo</i></strike>
1176 <tt><i>foo</i></tt>
1177 </p>
1178 !! end
1179
1180 !! test
1181 <wbr> is valid wikitext (bug 52468)
1182 !! wikitext
1183 <wbr>
1184 !! html
1185 <p><wbr />
1186 </p>
1187 !! end
1188
1189 # <strike> is HTML4, <s> is HTML4/5.
1190 !! test
1191 <s> or <strike> for strikethrough
1192 !! wikitext
1193 <strike>strike</strike>
1194
1195 <s>s</s>
1196 !! html
1197 <p><strike>strike</strike>
1198 </p><p><s>s</s>
1199 </p>
1200 !! end
1201
1202 ## a not permitted
1203 ## i,b,br omitted
1204 !! test
1205 Text-level semantic html elements in wikitext
1206 !! wikitext
1207 <em>text</em>
1208 <strong>text</strong>
1209 <small>text</small>
1210 <s>text</s>
1211 <cite>text</cite>
1212 <q>text</q>
1213 <dfn>text</dfn>
1214 <abbr>text</abbr>
1215 <data>text</data>
1216 <time>text</time>
1217 <code>text</code>
1218 <var>text</var>
1219 <samp>text</samp>
1220 <kbd>text</kbd>
1221 <sub>text</sub>
1222 <u>text</u>
1223 <mark>text</mark>
1224 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1225 <bdi>text</bdi>
1226 <bdo>text</bdo>
1227 <span>text</span>
1228 <wbr />
1229 !! html
1230 <p><em>text</em>
1231 <strong>text</strong>
1232 <small>text</small>
1233 <s>text</s>
1234 <cite>text</cite>
1235 <q>text</q>
1236 <dfn>text</dfn>
1237 <abbr>text</abbr>
1238 <data>text</data>
1239 <time>text</time>
1240 <code>text</code>
1241 <var>text</var>
1242 <samp>text</samp>
1243 <kbd>text</kbd>
1244 <sub>text</sub>
1245 <u>text</u>
1246 <mark>text</mark>
1247 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1248 <bdi>text</bdi>
1249 <bdo>text</bdo>
1250 <span>text</span>
1251 <wbr />
1252 </p>
1253 !! end
1254
1255 # test cases taken from
1256 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1257 !! test
1258 Ruby markup (W3C-style)
1259 !! wikitext
1260 ; Mono-ruby for individual base characters
1261 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1262 ; Group ruby
1263 : <ruby>今日<rt>きょう</rt></ruby>
1264 ; Jukugo ruby
1265 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1266 ; Inline ruby
1267 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1268 ; Double-sided ruby
1269 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1270 <ruby>
1271 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1272 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1273 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1274 </ruby>
1275 !! html
1276 <dl><dt> Mono-ruby for individual base characters</dt>
1277 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1278 <dt> Group ruby</dt>
1279 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1280 <dt> Jukugo ruby</dt>
1281 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1282 <dt> Inline ruby</dt>
1283 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1284 <dt> Double-sided ruby</dt>
1285 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1286 <p><ruby>
1287 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1288 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1289 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1290 </ruby>
1291 </p>
1292 !! end
1293
1294 # The next two test different paths in the sanitizer.
1295 !! test
1296 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1297 !! wikitext
1298 <blockquote|>a</blockquote>
1299
1300 <b→> doesn't terminate </b→>
1301
1302 <bä> doesn't terminate </bä>
1303
1304 <boo> doesn't terminate </boo>
1305
1306 <s.foo> doesn't terminate </s.foo>
1307
1308 <sub-ID#1>
1309 !! html
1310 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1311 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1312 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1313 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1314 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1315 </p><p>&lt;sub-ID#1&gt;
1316 </p>
1317 !! end
1318
1319 # There is a tidy bug here: https://sourceforge.net/p/tidy/bugs/946/
1320 # If the non-word-character tag made it through the sanitizer, tidy
1321 # would munge it up.
1322 !! test
1323 Non-word characters don't terminate tag names + tidy
1324 !! wikitext
1325 <blockquote|>a</blockquote>
1326
1327 <b→> doesn't terminate </b→>
1328
1329 <bä> doesn't terminate </bä>
1330
1331 <boo> doesn't terminate </boo>
1332
1333 <s.foo> doesn't terminate </s.foo>
1334
1335 <sub-ID#1>
1336 !! html+tidy
1337 <p>&lt;blockquote|&gt;a</p>
1338 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1339 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1340 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1341 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1342 <p>&lt;sub-ID#1&gt;</p>
1343 !! end
1344
1345 ###
1346 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1347 ### This checks that HTML5 tags (with non-word characters in the tag
1348 ### name) make it safely through the parser -- the Sanitizer will
1349 ### munge them later, as it should.
1350 ###
1351 !! test
1352 Non-word characters are valid in extension tags (T19663)
1353 !! wikitext
1354 <tåg>tåg</tåg>
1355 !! html/php
1356 <pre>
1357 'tåg'
1358 array (
1359 )
1360 </pre>
1361
1362 !! html/parsoid
1363 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1364 !! end
1365
1366 !! test
1367 Isolated close tags should be treated as literal text (bug 52760)
1368 !! options
1369 parsoid=wt2html
1370 !! wikitext
1371 </b>
1372
1373 <s.foo>s</s>
1374 !! html/php+tidy
1375 <p>&lt;s.foo&gt;s</p>
1376 !! html/parsoid
1377 <p>&lt;s.foo&gt;s</p>
1378 !! end
1379
1380 ###
1381 ### Special characters
1382 ###
1383
1384 !! test
1385 Bare pipe character (bug 52363)
1386 !! wikitext
1387 |
1388 !! html
1389 <p>|
1390 </p>
1391 !! end
1392
1393 !! test
1394 Bare pipe character from a template (bug 52363)
1395 !! wikitext
1396 {{pipe}}
1397 !! html
1398 <p>|
1399 </p>
1400 !! end
1401
1402 ###
1403 ### <nowiki> test cases
1404 ###
1405
1406 !! test
1407 <nowiki> unordered list
1408 !! wikitext
1409 <nowiki>* This is not an unordered list item.</nowiki>
1410 !! html/php
1411 <p>* This is not an unordered list item.
1412 </p>
1413 !! html/parsoid
1414 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1415 !! end
1416
1417 !! test
1418 <nowiki> spacing
1419 !! wikitext
1420 <nowiki>Lorem ipsum dolor
1421
1422 sed abit.
1423 sed nullum.
1424
1425 :and a colon
1426 </nowiki>
1427 !! html/php
1428 <p>Lorem ipsum dolor
1429
1430 sed abit.
1431 sed nullum.
1432
1433 :and a colon
1434
1435 </p>
1436 !! html/parsoid
1437 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1438
1439 sed abit.
1440 sed nullum.
1441
1442 :and a colon
1443 </span></p>
1444 !! end
1445
1446 !! test
1447 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1448 !! wikitext
1449 <nowiki><span class="error"></nowiki>
1450 !! html/php
1451 <p>&lt;span class="error"&gt;
1452 </p>
1453 !! html/parsoid
1454 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1455 !! end
1456
1457 !! test
1458 nowiki 3
1459 !! wikitext
1460 :There is not nowiki.
1461 :There is <nowiki>nowiki</nowiki>.
1462
1463 #There is not nowiki.
1464 #There is <nowiki>nowiki</nowiki>.
1465
1466 *There is not nowiki.
1467 *There is <nowiki>nowiki</nowiki>.
1468 !! html/php
1469 <dl><dd>There is not nowiki.</dd>
1470 <dd>There is nowiki.</dd></dl>
1471 <ol><li>There is not nowiki.</li>
1472 <li>There is nowiki.</li></ol>
1473 <ul><li>There is not nowiki.</li>
1474 <li>There is nowiki.</li></ul>
1475
1476 !! html/parsoid
1477 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1478 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1479
1480 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1481 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1482
1483 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1484 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1485 !! end
1486
1487 !! test
1488 Entities inside <nowiki>
1489 !! wikitext
1490 <nowiki>&lt;</nowiki>
1491 !! html
1492 <p>&lt;
1493 </p>
1494 !! end
1495
1496 !! test
1497 Entities inside template parameters
1498 !! wikitext
1499 {{echo|&ndash;}}
1500 !! html/php+tidy
1501 <p>–</p>
1502 !! html/parsoid
1503 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1504 !! end
1505
1506 !! test
1507 Properly escape nowiki when combined with other wiki markup
1508 !! options
1509 parsoid=html2wt
1510 !! html/parsoid
1511 <p>* &lt;/nowiki&gt; tag</p>
1512 !! wikitext
1513 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1514 !! end
1515
1516 !! test
1517 T93824: Put escaped HTML tags inside nowiki
1518 !! options
1519 parsoid=html2wt
1520 !! html/parsoid
1521 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1522 !! wikitext
1523 <nowiki><h2>foo</h2></nowiki>
1524 !! end
1525
1526 !! test
1527 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1528 !! options
1529 parsoid=html2wt
1530 !! html/parsoid
1531 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1532 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1533 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1534 !! wikitext
1535 This text: L'[[Foo]]
1536 This text: L<nowiki>''</nowiki>[[Foo]]
1537 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1538 !! end
1539
1540 # This test fails because wikitext whitespace is not normalized before comparing.
1541 !! test
1542 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1543 !! options
1544 parsoid=html2wt
1545 !! html/parsoid
1546 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1547 </p>
1548 !! wikitext
1549 This text : L<nowiki>''</nowiki>[[Foo]]
1550 !! end
1551
1552 # This test and the next one are html2wt only as they test that incorrect wikitext
1553 # passed in template arguments gets escaped or wrapped in nowikis where required.
1554 !! test
1555 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1556 !! options
1557 parsoid=html2wt
1558 !! html/parsoid
1559 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1560 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1561 !! wikitext
1562 {{echo|foo{{!}}bar}}
1563 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1564 !! end
1565
1566 !! test
1567 T53961: Output correct nowikis in template arguments
1568 !! options
1569 parsoid=html2wt
1570 !! html/parsoid
1571 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1572 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1573 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1574 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1575 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1576 !! wikitext
1577 {{echo|a [ b}}
1578 {{echo|<nowiki>a }} b</nowiki>}}
1579 {{echo|<nowiki>a [[ b</nowiki>}}
1580 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1581 {{echo|a <nowiki>}</nowiki>}}
1582 !! end
1583
1584 !! test
1585 Cases where "!!" needs nowiki protection
1586 !! options
1587 parsoid=html2wt
1588 !! html/parsoid
1589 <table>
1590 <tr><th>this needs protection !! here</th></tr>
1591 </table>
1592
1593 <table>
1594 <tr><th>this does not need
1595 protection !! here</th></tr>
1596 </table>
1597 !! wikitext
1598 {|
1599 !<nowiki>this needs protection !! here</nowiki>
1600 |}
1601
1602 {|
1603 !this does not need
1604 protection !! here
1605 |}
1606 !! end
1607
1608 ###
1609 ### Comments
1610 ###
1611 !! test
1612 Comments and Indent-Pre
1613 !! wikitext
1614 <!-- comment 1 --> asdf
1615
1616 <!-- comment 1 --> asdf
1617 <!-- comment 2 -->
1618
1619 <!-- comment 1 --> asdf
1620 <!-- comment 2 -->xyz
1621
1622 <!-- comment 1 --> asdf
1623 <!-- comment 2 --> xyz
1624 !! html
1625 <pre>asdf
1626 </pre>
1627 <pre>asdf
1628 </pre>
1629 <pre>asdf
1630 </pre>
1631 <p>xyz
1632 </p>
1633 <pre>asdf
1634 xyz
1635 </pre>
1636 !! end
1637
1638 !! test
1639 Comment test 2a
1640 !! wikitext
1641 asdf
1642 <!-- comment 1 -->
1643 jkl
1644 !! html
1645 <p>asdf
1646 jkl
1647 </p>
1648 !! end
1649
1650 !! test
1651 Comment test 2b
1652 !! wikitext
1653 asdf
1654 <!-- comment 1 -->
1655
1656 jkl
1657 !! html
1658 <p>asdf
1659 </p><p>jkl
1660 </p>
1661 !! end
1662
1663 !! test
1664 Comment test 3
1665 !! wikitext
1666 asdf
1667 <!-- comment 1 -->
1668 <!-- comment 2 -->
1669 jkl
1670 !! html
1671 <p>asdf
1672 jkl
1673 </p>
1674 !! end
1675
1676 !! test
1677 Comment test 4
1678 !! wikitext
1679 asdf<!-- comment 1 -->jkl
1680 !! html
1681 <p>asdfjkl
1682 </p>
1683 !! end
1684
1685 !! test
1686 Comment spacing
1687 !! wikitext
1688 a
1689 <!-- foo --> b <!-- bar -->
1690 c
1691 !! html
1692 <p>a
1693 </p>
1694 <pre> b
1695 </pre>
1696 <p>c
1697 </p>
1698 !! end
1699
1700 !! test
1701 Comment whitespace
1702 !! wikitext
1703 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1704 !! html
1705
1706 !! end
1707
1708 !! test
1709 Comment semantics and delimiters
1710 !! wikitext
1711 <!-- --><!----><!-----><!------>
1712 !! html/php
1713
1714 !! html/parsoid
1715 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1716 !! end
1717
1718 !! test
1719 Comment semantics and delimiters, redux
1720 !! wikitext
1721 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1722 -- foo -- funky huh? ... -->
1723 !! html/php
1724
1725 !! html/parsoid
1726 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1727 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1728 !! end
1729
1730 !! test
1731 Comment semantics and delimiters: directors cut
1732 !! wikitext
1733 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1734 everything starting with < followed by !-- until the first -- and > we see,
1735 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1736 -->-->
1737 !! html/php
1738 <p>--&gt;
1739 </p>
1740 !! html/parsoid
1741 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1742 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1743 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1744 --><p>--></p>
1745 !! end
1746
1747 !! test
1748 Comment semantics: nesting
1749 !! wikitext
1750 <!--<!-- no, we're not going to do anything fancy here -->-->
1751 !! html/php
1752 <p>--&gt;
1753 </p>
1754 !! html/parsoid
1755 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1756 !! end
1757
1758 # Parsoid closes the unclosed comment, even if it means a slight
1759 # round-trip diff.
1760 !! test
1761 Comment semantics: unclosed comment at end
1762 !! options
1763 parsoid=wt2html,html2html
1764 !! wikitext
1765 <!--This comment will run out to the end of the document
1766 !! html/php
1767
1768 !! html/parsoid
1769 <!--This comment will run out to the end of the document-->
1770 !! end
1771
1772 !! test
1773 Comment semantics: normalize comments to play nice with XML and browsers
1774 !! wikitext
1775 <!-- Browsers --!> think this is closed -->
1776 <!--> This would normally be text -->
1777 <!---> As would this -->
1778 <!-- XML doesn't like trailing dashes -------->
1779 <!-- Nor doubled hyphens -- anywhere in the data -->
1780 But this is not a comment.
1781 !! html/php
1782 <p>But this is not a comment.
1783 </p>
1784 !! html/parsoid
1785 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1786 <!--&#x3E; This would normally be text -->
1787 <!--&#x2D;&#x3E; As would this -->
1788 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1789 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1790 <p>But this is not a comment.</p>
1791 !! end
1792
1793 !! test
1794 Comment semantics: round-trip even text which contains encoded -->
1795 !! wikitext
1796 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1797 !! html/parsoid
1798 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1799 !! end
1800
1801 !! test
1802 Comment in template title
1803 !! wikitext
1804 {{f<!---->oo}}
1805 !! html
1806 <p>FOO
1807 </p>
1808 !! end
1809
1810 !! test
1811 Comment on its own line post-expand
1812 !! wikitext
1813 a
1814 {{blank}}<!---->
1815 b
1816 !! html
1817 <p>a
1818 </p><p>b
1819 </p>
1820 !! end
1821
1822 !! test
1823 Comment on its own line post-expand with non-significant whitespace
1824 !! wikitext
1825 a
1826 {{blank}} <!---->
1827 b
1828 !! html
1829 <p>a
1830 </p><p>b
1831 </p>
1832 !! end
1833
1834 !! test
1835 Multiple comments should still parse as SOL-transparent
1836 !! options
1837 parsoid=wt2html,wt2wt
1838 !! wikitext
1839 <!--c1-->*a
1840 <!--c2--><!--c3--><!--c4-->*b
1841 !! html/php
1842 <ul><li>a</li>
1843 <li>b</li></ul>
1844
1845 !! html/parsoid
1846 <!--c1--><ul>
1847 <li>a
1848 </li>
1849 <!--c2--><!--c3--><!--c4-->
1850 <li>b
1851 </li>
1852 </ul>
1853 !! end
1854
1855 ###
1856 ### paragraph wrapping tests
1857 ###
1858 !! test
1859 No block tags
1860 !! wikitext
1861 a
1862
1863 b
1864 !! html
1865 <p>a
1866 </p><p>b
1867 </p>
1868 !! end
1869
1870 !! test
1871 Block tag on one line (<div>)
1872 !! wikitext
1873 a <div>foo</div>
1874
1875 b
1876 !! html
1877 a <div>foo</div>
1878 <p>b
1879 </p>
1880 !! html+tidy
1881 <p>a</p>
1882 <div>foo</div>
1883 <p>b</p>
1884 !! end
1885
1886 !! test
1887 Block tag on one line (<blockquote>)
1888 !! wikitext
1889 a <blockquote>foo</blockquote>
1890
1891 b
1892 !! html
1893 a <blockquote>foo</blockquote>
1894 <p>b
1895 </p>
1896 !! html+tidy
1897 <p>a</p>
1898 <blockquote>
1899 <p>foo</p>
1900 </blockquote>
1901 <p>b</p>
1902 !! end
1903
1904 !! test
1905 Block tag on both lines (<div>)
1906 !! wikitext
1907 a <div>foo</div>
1908
1909 b <div>foo</div>
1910 !! html
1911 a <div>foo</div>
1912 b <div>foo</div>
1913
1914 !! html+tidy
1915 <p>a</p>
1916 <div>foo</div>
1917 <p>b</p>
1918 <div>foo</div>
1919 !! end
1920
1921 !! test
1922 Block tag on both lines (<blockquote>)
1923 !! wikitext
1924 a <blockquote>foo</blockquote>
1925
1926 b <blockquote>foo</blockquote>
1927 !! html
1928 a <blockquote>foo</blockquote>
1929 b <blockquote>foo</blockquote>
1930
1931 !! html+tidy
1932 <p>a</p>
1933 <blockquote>
1934 <p>foo</p>
1935 </blockquote>
1936 <p>b</p>
1937 <blockquote>
1938 <p>foo</p>
1939 </blockquote>
1940 !! end
1941
1942 !! test
1943 Multiple lines without block tags
1944 !! wikitext
1945 <div>foo</div> a
1946 b
1947 c
1948 d<!--foo--> e
1949 x <div>foo</div> z
1950 !! html
1951 <div>foo</div> a
1952 <p>b
1953 c
1954 d e
1955 </p>
1956 x <div>foo</div> z
1957
1958 !! html+tidy
1959 <div>foo</div>
1960 <p>a</p>
1961 <p>b c d e</p>
1962 <p>x</p>
1963 <div>foo</div>
1964 <p>z</p>
1965 !! end
1966
1967 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1968 # So, we have a separate section for Parsoid. We don't want
1969 # to mimic this stripping behavior in Parsoid. It affects
1970 # editing experience and also requires us to maintain additional
1971 # info for RT-ing.
1972 !! test
1973 Empty lines between lines with block tags
1974 !! wikitext
1975 <div></div>
1976
1977
1978 <div></div>a
1979
1980 b
1981 <div>a</div>b
1982
1983 <div>b</div>d
1984
1985
1986 <div>e</div>
1987 !! html
1988 <div></div>
1989 <p><br />
1990 </p>
1991 <div></div>a
1992 <p>b
1993 </p>
1994 <div>a</div>b
1995 <div>b</div>d
1996 <p><br />
1997 </p>
1998 <div>e</div>
1999
2000 !! html+tidy
2001 <p><br /></p>
2002 <p>a</p>
2003 <p>b</p>
2004 <div>a</div>
2005 <p>b</p>
2006 <div>b</div>
2007 <p>d</p>
2008 <p><br /></p>
2009 <div>e</div>
2010 !! html/parsoid
2011 <div data-parsoid='{"stx":"html"}'></div>
2012
2013 <p><br /></p>
2014 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2015
2016 <p>b</p>
2017 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2018
2019 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2020
2021 <p><br /></p>
2022 <div data-parsoid='{"stx":"html"}'>e</div>
2023 !! end
2024
2025 ## PHP parser emits output which is broken
2026 !! test
2027 Unclosed HTML p-tags should be handled properly
2028 !! wikitext
2029 <div><p>foo</div>
2030 a
2031
2032 b
2033 !! html/php+tidy
2034 <div>
2035 <p>foo</p>
2036 </div>
2037 <p>a</p>
2038 <p>b</p>
2039 !! html/parsoid
2040 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2041 <p>a</p>
2042 <p>b</p>
2043 !! end
2044
2045 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2046 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2047 ## them for now.
2048 !! test
2049 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2050 !! options
2051 parsoid=wt2html
2052 !! wikitext
2053 a [[Category:A1]] [[Category:A2]]
2054 [[Category:A3]]
2055 [[Category:A4]]
2056 !! html/parsoid
2057 <p>a</p>
2058 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2059 !! end
2060
2061 !! test
2062 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2063 !! options
2064 parsoid=wt2html
2065 !! wikitext
2066 [[Category:A1]]a
2067 !! html/parsoid
2068 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2069 !! end
2070
2071 ###
2072 ### Preformatted text
2073 ###
2074 !! test
2075 Preformatted text
2076 !! wikitext
2077 This is some
2078 Preformatted text
2079 With ''italic''
2080 And '''bold'''
2081 And a [[Main Page|link]]
2082 !! html
2083 <pre>This is some
2084 Preformatted text
2085 With <i>italic</i>
2086 And <b>bold</b>
2087 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2088 </pre>
2089 !! end
2090
2091 !! test
2092 Tabs don't trigger preformatted text
2093 !! wikitext
2094 This is not
2095 preformatted text.
2096 This is preformatted text.
2097 So is this.
2098 !! html/php
2099 <p> This is not
2100 preformatted text.
2101 </p>
2102 <pre>This is preformatted text.
2103 So is this.
2104 </pre>
2105 !! html/parsoid
2106 <p> This is not
2107 preformatted text.</p>
2108 <pre>This is preformatted text.
2109 So is this.</pre>
2110 !! end
2111
2112 !! test
2113 Space before tab needs nowiki pre protection
2114 !! options
2115 parsoid=html2wt
2116 !! html/parsoid
2117 <p> a</p>
2118 !! wikitext
2119 <nowiki> </nowiki> a
2120 !! end
2121
2122 !! test
2123 Ident preformatting with inline content
2124 !! wikitext
2125 a
2126 ''b''
2127 !! html
2128 <pre>a
2129 <i>b</i>
2130 </pre>
2131 !! end
2132
2133 !! test
2134 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2135 !! wikitext
2136 <pre><nowiki>
2137 <b>
2138 <cite>
2139 <em>
2140 </nowiki></pre>
2141 !! html
2142 <pre>
2143 &lt;b&gt;
2144 &lt;cite&gt;
2145 &lt;em&gt;
2146 </pre>
2147
2148 !! end
2149
2150 !! test
2151 Regression with preformatted in <center>
2152 !! wikitext
2153 <center>
2154 Blah
2155 </center>
2156 !! html
2157 <center>
2158 <pre>Blah
2159 </pre>
2160 </center>
2161
2162 !! end
2163
2164 !! test
2165 Bug 52763: Preformatted in <blockquote>
2166 !! wikitext
2167 <blockquote>
2168 Blah
2169 {|
2170 |
2171 indented cell (no pre-wrapping!)
2172 |}
2173 </blockquote>
2174 !! html
2175 <blockquote>
2176 <p> Blah
2177 </p>
2178 <table>
2179 <tr>
2180 <td>
2181 <p> indented cell (no pre-wrapping!)
2182 </p>
2183 </td></tr></table>
2184 </blockquote>
2185
2186 !! end
2187
2188 !! test
2189 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2190 !! wikitext
2191 <blockquote>
2192 Foo
2193
2194 Bar
2195 </blockquote>
2196 !! html
2197 <blockquote>
2198 <p>Foo
2199 </p><p>Bar
2200 </p>
2201 </blockquote>
2202
2203 !! end
2204
2205 !! test
2206 Bug 15491: <ins>/<del> in blockquote
2207 !! wikitext
2208 <blockquote>
2209 Foo <del>bar</del> <ins>baz</ins> quux
2210 </blockquote>
2211 !! html
2212 <blockquote>
2213 <p>Foo <del>bar</del> <ins>baz</ins> quux
2214 </p>
2215 </blockquote>
2216
2217 !! end
2218
2219 # Note that the p-wrapping is newline sensitive, which could be
2220 # considered a bug: tidy will wrap only the 'Foo' in the example
2221 # below in a <p> tag. (see comment 23-25 of bug #6200)
2222 !! test
2223 Bug 15491: <ins>/<del> in blockquote (2)
2224 !! wikitext
2225 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2226 </blockquote>
2227 !! html
2228 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2229 </blockquote>
2230
2231 !! html+tidy
2232 <blockquote>
2233 <p>Foo</p>
2234 <del>bar</del> <ins>baz</ins> quux</blockquote>
2235 !! end
2236
2237 !! test
2238 <pre> with attributes (bug 3202)
2239 !! wikitext
2240 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2241 !! html
2242 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2243
2244 !! end
2245
2246 !! test
2247 <pre> with width attribute (bug 3202)
2248 !! wikitext
2249 <pre width="8">Narrow screen goodies</pre>
2250 !! html
2251 <pre width="8">Narrow screen goodies</pre>
2252
2253 !! end
2254
2255 !! test
2256 <pre> with forbidden attribute (bug 3202)
2257 !! wikitext
2258 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2259 !! html
2260 <pre width="8">Narrow screen goodies</pre>
2261
2262 !! end
2263
2264 !! test
2265 Entities inside <pre>
2266 !! wikitext
2267 <pre>&lt;</pre>
2268 !! html
2269 <pre>&lt;</pre>
2270
2271 !! end
2272
2273 !! test
2274 <pre> with forbidden attribute values (bug 3202)
2275 !! wikitext
2276 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2277 !! html
2278 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2279
2280 !! end
2281
2282 !! test
2283 <nowiki> inside <pre> (bug 13238)
2284 !! wikitext
2285 <pre>
2286 <nowiki>
2287 </pre>
2288 <pre>
2289 <nowiki></nowiki>
2290 </pre>
2291 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2292 !! html
2293 <pre>
2294 &lt;nowiki&gt;
2295 </pre>
2296 <pre>
2297
2298 </pre>
2299 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2300
2301 !! end
2302
2303 !! test
2304 <nowiki> inside of #tag:pre
2305 !! wikitext
2306 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2307 !! html/php
2308 <pre>Foo &#8594;bar</pre>
2309
2310 !! html/parsoid
2311 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"#tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
2312 !! end
2313
2314 !! test
2315 <nowiki> and <pre> preference (first one wins)
2316 !! wikitext
2317 <pre>
2318 <nowiki>
2319 </pre>
2320 </nowiki>
2321 </pre>
2322
2323 <nowiki>
2324 <pre>
2325 <nowiki>
2326 </pre>
2327 </nowiki>
2328 </pre>
2329
2330 !! html/php
2331 <pre>
2332 &lt;nowiki&gt;
2333 </pre>
2334 <p>&lt;/nowiki&gt;
2335 &lt;/pre&gt;
2336 </p><p>
2337 &lt;pre&gt;
2338 &lt;nowiki&gt;
2339 &lt;/pre&gt;
2340
2341 &lt;/pre&gt;
2342 </p>
2343 !! html/parsoid
2344 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2345 </pre>
2346 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2347 &lt;/pre></p>
2348
2349 <p><span typeof="mw:Nowiki">
2350 &lt;pre>
2351 &lt;nowiki>
2352 &lt;/pre>
2353 </span>
2354 &lt;/pre></p>
2355 !! end
2356
2357 !! test
2358 </pre> inside nowiki
2359 !! wikitext
2360 <nowiki></pre></nowiki>
2361 !! html
2362 <p>&lt;/pre&gt;
2363 </p>
2364 !! end
2365
2366 # Parsoid doesn't strip empty tags, like Tidy does.
2367 !! test
2368 Empty pre; pre inside other HTML tags (bug 54946)
2369 !! options
2370 parsoid=wt2html,wt2wt
2371 !! wikitext
2372 a
2373
2374 <div><pre>
2375 foo
2376 </pre></div>
2377 <pre></pre>
2378 !! html/php
2379 <p>a
2380 </p>
2381 <div><pre>
2382 foo
2383 </pre></div>
2384 <pre></pre>
2385
2386 !! html/php+tidy
2387 <p>a</p>
2388 <div>
2389 <pre>
2390 foo
2391 </pre></div>
2392 !! html/parsoid
2393 <p>a</p>
2394
2395 <div><pre>foo
2396 </pre></div>
2397 <pre></pre>
2398 !! end
2399
2400 !! test
2401 HTML pre followed by indent-pre
2402 !! wikitext
2403 <pre>foo</pre>
2404 bar
2405 !! html
2406 <pre>foo</pre>
2407 <pre>bar
2408 </pre>
2409 !! end
2410
2411 # Note that tidy removes the empty <p> tags from the start and end.
2412 # Parsoid does not, by design.
2413 !!test
2414 Block tag pre
2415 !! wikitext
2416 <p><pre>foo</pre></p>
2417 !! html/php+tidy
2418 <pre>
2419 foo
2420 </pre>
2421 !! html/parsoid
2422 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2423 !!end
2424
2425 !!test
2426 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2427 !! wikitext
2428 {{echo|}}
2429 !! html
2430
2431 !!end
2432
2433 !!test
2434 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2435 !! wikitext
2436 {{echo|
2437 foo}}
2438 !! html
2439 <p>foo
2440 </p>
2441 !!end
2442
2443 !! test
2444 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2445 !! wikitext
2446 {{echo|a
2447 b}}
2448 !! html
2449 <pre>a
2450 </pre>
2451 <p>b
2452 </p>
2453 !!end
2454
2455 !! test
2456 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2457 !! wikitext
2458 {{echo|a
2459 b
2460 c
2461 d
2462 e
2463 }}
2464 !! html
2465 <pre>a
2466 </pre>
2467 <p>b
2468 c
2469 </p>
2470 <pre>d
2471 </pre>
2472 <p>e
2473 </p>
2474 !!end
2475
2476 !!test
2477 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2478 !! wikitext
2479 {{echo| foo}}
2480
2481 {{echo| foo}}{{echo| bar}}
2482
2483 {{echo| foo}}
2484 {{echo| bar}}
2485
2486 {{echo|<!--cmt--> foo}}
2487
2488 <!--cmt-->{{echo| foo}}
2489
2490 {{echo|{{echo| }}bar}}
2491 !! html
2492 <pre>foo
2493 </pre>
2494 <pre>foo bar
2495 </pre>
2496 <pre>foo
2497 bar
2498 </pre>
2499 <pre>foo
2500 </pre>
2501 <pre>foo
2502 </pre>
2503 <pre>bar
2504 </pre>
2505 !!end
2506
2507 !! test
2508 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2509 !! wikitext
2510 {{echo| }}a
2511
2512 {{echo|
2513 }}a
2514
2515 {{echo|
2516 b}}
2517
2518 {{echo|a
2519 }}b
2520
2521 {{echo|a
2522 }} b
2523 !! html
2524 <pre>a
2525 </pre>
2526 <p><br />
2527 </p>
2528 <pre>a
2529 </pre>
2530 <p><br />
2531 </p>
2532 <pre>b
2533 </pre>
2534 <p>a
2535 </p>
2536 <pre>b
2537 </pre>
2538 <p>a
2539 </p>
2540 <pre>b
2541 </pre>
2542 !!end
2543
2544 !! test
2545 Pres with newline attributes
2546 !! wikitext
2547 <pre class="one
2548 two">hi</pre>
2549 !! html/php
2550 <pre class="one two">hi</pre>
2551
2552 !! html/parsoid
2553 <pre class="one
2554 two" data-parsoid='{"stx":"html"}'>hi</pre>
2555 !! end
2556
2557 !! test
2558 Things that look like <pre> tags aren't treated as such
2559 !! wikitext
2560 Barack Obama <President> of the United States
2561 <President></President>
2562 !! html
2563 <p>Barack Obama &lt;President&gt; of the United States
2564 &lt;President&gt;&lt;/President&gt;
2565 </p>
2566 !! end
2567
2568 !! test
2569 Handle broken pre-like tags (bug 64025)
2570 !! options
2571 parsoid=wt2html
2572 !! wikitext
2573 {{echo|<pre <pre>x</pre>}}
2574
2575 <table><pre </table>
2576 !! html/php
2577 <pre>x</pre>
2578 <table>&lt;pre </table>
2579
2580 !! html/php+tidy
2581 <pre>
2582 x
2583 </pre>
2584 <p>&lt;pre</p>
2585 !! html/parsoid
2586 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2587
2588
2589 <p>&lt;pre </p>
2590
2591 <table></table>
2592 !! end
2593
2594 !! test
2595 Parsoid: handle pre with space after attribute
2596 !! options
2597 parsoid=wt2html
2598 !! wikitext
2599 <pre style="width:50%;" >{{echo|foo}}</pre>
2600 !! html/php
2601 <pre style="width:50%;">{{echo|foo}}</pre>
2602
2603 !! html/parsoid
2604 <pre style="width:50%;">{{echo|foo}}</pre>
2605 !! end
2606
2607 # TODO / maybe: fix wt2wt for this
2608 !! test
2609 Parsoid: Don't paragraph-wrap fosterable content
2610 !! options
2611 parsoid=wt2html
2612 !! wikitext
2613 {|
2614 <td></td>
2615 <td></td>
2616
2617
2618
2619 |}
2620 !! html
2621 <table>
2622
2623 <tbody>
2624 <tr>
2625 <td></td>
2626
2627 <td></td></tr>
2628
2629
2630
2631 </tbody></table>
2632 !! end
2633
2634 !! test
2635 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2636 !! options
2637 parsoid=wt2html
2638 !! wikitext
2639 {|
2640 <td>
2641 <td>
2642 </td>
2643
2644
2645
2646 |}
2647 !! html
2648 <table>
2649
2650 <tbody>
2651 <tr>
2652 <td></td>
2653
2654 <td>
2655 </td></tr>
2656
2657
2658
2659 </tbody></table>
2660 !! end
2661
2662
2663 #--------------------------------------------------------------------
2664 # Transclusion parameter whitespace stripping tests
2665 # Behavior is different for positional and named parameters
2666 #--------------------------------------------------------------------
2667 !! test
2668 Templates: Strip leading and trailing whitespace from named-param values
2669 !! wikitext
2670 {{echo|1= a }}
2671
2672 {{echo|1= {{echo|b}} }}
2673
2674 {{echo| 1 =
2675 c }}
2676
2677 {{echo| 1 =
2678 * d
2679 }}
2680 !! html
2681 <p>a
2682 </p><p>b
2683 </p><p>c
2684 </p>
2685 <ul><li> d</li></ul>
2686
2687 !! end
2688
2689 !! test
2690 Templates: Don't strip whitespace from positional-param values
2691 !! wikitext
2692 {{echo|a }}
2693
2694 {{echo|{{echo|b}} }}
2695
2696 {{echo| c
2697 }}
2698
2699 {{echo| {{echo|d}}
2700 }}
2701
2702 {{echo|
2703 e}}
2704
2705 {{echo|
2706 * f}}
2707
2708 {{echo|
2709 }}g
2710 !! html
2711 <p>a
2712 </p><p>b
2713 </p>
2714 <pre>c
2715 </pre>
2716 <p><br />
2717 </p>
2718 <pre>d
2719 </pre>
2720 <p><br />
2721 </p>
2722 <pre>e
2723 </pre>
2724 <p><br />
2725 </p>
2726 <ul><li> f</li></ul>
2727 <p><br />
2728 </p>
2729 <pre>g
2730 </pre>
2731 !! end
2732
2733 !! test
2734 Templates: Handle empty comment-and-ws-only lines correctly
2735 !! wikitext
2736 {{echo|foo
2737 <!--should be ignored-->
2738 <!--should be ignored as well-->
2739 bar}}
2740 !! html/php
2741 <p>foo
2742 bar
2743 </p>
2744 !! html/parsoid
2745 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo\n&lt;!--should be ignored-->\n &lt;!--should be ignored as well-->\nbar"}},"i":0}}]}'>foo <!--should be ignored--> <!--should be ignored as well--> bar</p>
2746 !! end
2747
2748 !! test
2749 Templates: Handle comments in the target
2750 !! wikitext
2751 {{echo
2752 <!-- should be ignored -->
2753 |foo}}
2754
2755 {{echo
2756 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2757 |foo}}
2758
2759 {{echo<!-- should be ignored -->
2760 |foo}}
2761
2762 {{echo<!-- should be ignored -->|foo}}
2763
2764 {{<!-- should be ignored -->echo|foo}}
2765 !! html/php
2766 <p>foo
2767 </p><p>foo
2768 </p><p>foo
2769 </p><p>foo
2770 </p><p>foo
2771 </p>
2772 !! html/parsoid
2773 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2774
2775 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored and spaces on next line should not trip us up (T147742) -->\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2776
2777 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2778
2779 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2780
2781 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2782 !!end
2783
2784 !! test
2785 Templates: Handle comments in parameter names (bug 67657)
2786 !! wikitext
2787 {{echo|1
2788 <!-- should be ignored -->
2789 =foo}}
2790
2791 {{echo|
2792 <!-- should be ignored -->
2793 1 = foo}}
2794
2795 {{echo|1<!-- should be ignored -->=foo}}
2796
2797 {{echo|<!-- should be ignored -->1=foo}}
2798 !! html/php
2799 <p>foo
2800 </p><p>foo
2801 </p><p>foo
2802 </p><p>foo
2803 </p>
2804 !! html/parsoid
2805 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2806
2807 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2808
2809 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2810
2811 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2812 !!end
2813
2814 !! test
2815 Templates: Other wikitext in parameter names (bug 67657)
2816 !! wikitext
2817 {{echo|''1''=foo}}
2818 !! html/php
2819 <p>{{{1}}}
2820 </p>
2821 !! html/parsoid
2822 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2823 !!end
2824
2825 #--------------------------------------------------------------------
2826 # Transclusion parameter escaping tests
2827 #--------------------------------------------------------------------
2828 !! test
2829 Templates: Parsoid parameter escaping test 1
2830 !! wikitext
2831 {{echo|[foo]|{{echo|[bar]}}}}
2832 !! html/php+tidy
2833 <p>[foo]</p>
2834 !! html/parsoid
2835 <p about="#mwt1" typeof="mw:Transclusion"
2836 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2837 !! end
2838
2839 !! test
2840 Parsoid: Pipes in external links in template parameter
2841 !! wikitext
2842 {{echo|[{{echo|http://example.com}} link]}}
2843 !! html/php+tidy
2844 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2845 !! html/parsoid
2846 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2847 !! end
2848
2849 !! test
2850 Parsoid: pipe in transclusion parameter
2851 !! wikitext
2852 {{echo|http://foo.com/a&#124;b}}
2853 !! html/php+tidy
2854 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2855 !! html/parsoid
2856 <p><a rel="mw:ExtLink" href="http://foo.com/a%7Cb" about="#mwt1"
2857 typeof="mw:Transclusion"
2858 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a%7Cb</a></p>
2859 !! end
2860
2861 !! test
2862 Parsoid: Pipe in external link target and content in template parameter
2863 !! options
2864 parsoid=html2wt,wt2wt
2865 !! wikitext
2866 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2867 !! html/php+tidy
2868 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2869 !! html/parsoid
2870 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2871 typeof="mw:Transclusion"
2872 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2873 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2874 !! end
2875
2876 !! test
2877 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2878 !! options
2879 parsoid
2880 !! wikitext
2881 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2882 !! html
2883 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2884 !! end
2885
2886 !! test
2887 Templates: Don't escape already nowiki-escaped text in template parameters
2888 !! options
2889 parsoid=html2wt,wt2wt
2890 !! wikitext
2891 {{echo|foo<nowiki>|</nowiki>bar}}
2892 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2893 {{echo|<nowiki></nowiki>}}
2894 !! html/php+tidy
2895 <p>foo|bar &lt;div&gt;</p>
2896 !! html/parsoid
2897 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2898 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2899 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2900 </p>
2901 !! end
2902
2903 ## Bug 52824
2904 !! test
2905 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2906 !! options
2907 parsoid=html2wt,wt2wt
2908 !! wikitext
2909 {{echo|{{echo|1=bar}}}}
2910 !! html/php+tidy
2911 <p>bar</p>
2912 !! html/parsoid
2913 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2914 !! end
2915
2916 ## Bug 56733
2917 !! test
2918 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2919 !! wikitext
2920 {{echo|a : b}}
2921 !! html/php+tidy
2922 <p>a&#160;: b</p>
2923 !! html/parsoid
2924 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2925 !! end
2926
2927 ## Bug T73412
2928 !! test
2929 Templates: Preserve blank parameter names
2930 !! wikitext
2931 {{echo|=foo}}
2932 !! html/php+tidy
2933 <p>{{{1}}}</p>
2934 !! html/parsoid
2935 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2936 !! end
2937
2938 !! test
2939 Templates: Preserve blank parameter names in other positions
2940 !! wikitext
2941 {{blank_param|bar|=foo}}
2942 !! html/php+tidy
2943 <p>bar foo</p>
2944 !! html/parsoid
2945 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2946 foo</p>
2947 !! end
2948
2949 ###
2950 ### Parsoid-centric tests for testing RT edge cases for pre
2951 ###
2952
2953 !!test
2954 1a. Indent-Pre and Comments
2955 !! wikitext
2956 a
2957 <!--a-->
2958 c
2959 !! html
2960 <pre>a
2961 </pre>
2962 <p>c
2963 </p>
2964 !!end
2965
2966 !!test
2967 1b. Indent-Pre and Comments
2968 !! wikitext
2969 a
2970 <!--a-->
2971 c
2972 !! html
2973 <pre>a
2974 </pre>
2975 <p>c
2976 </p>
2977 !!end
2978
2979 !!test
2980 1c. Indent-Pre and Comments
2981 !! wikitext
2982 <!--a--> a
2983
2984 <!--a--> a
2985 !! html
2986 <pre> a
2987 </pre>
2988 <pre> a
2989 </pre>
2990 !!end
2991
2992 !!test
2993 1d. Indent-Pre and Comments
2994 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2995 !! wikitext
2996 <!--a--> a
2997
2998 <!--b-->b
2999 !! html
3000 <pre>a
3001 </pre>
3002 <pre>b
3003 </pre>
3004 !!end
3005
3006 !!test
3007 2a. Indent-Pre and tables
3008 !! wikitext
3009 {|
3010 |-
3011 !h1!!h2
3012 |foo||bar
3013 |}
3014 !! html
3015 <table>
3016
3017 <tr>
3018 <th>h1</th>
3019 <th>h2
3020 </th>
3021 <td>foo</td>
3022 <td>bar
3023 </td></tr></table>
3024
3025 !!end
3026
3027 !!test
3028 2b. Indent-Pre and tables
3029 !! wikitext
3030 {|
3031 |-
3032 |foo
3033 |}
3034 !! html
3035 <table>
3036
3037 <tr>
3038 <td>foo
3039 </td></tr></table>
3040
3041 !!end
3042
3043 !!test
3044 2c. Indent-Pre and tables (bug 42252)
3045 !! wikitext
3046 {|
3047 |+ foo
3048 ! | bar
3049 |}
3050 !! html
3051 <table>
3052 <caption> foo
3053 </caption>
3054 <tr>
3055 <th> bar
3056 </th></tr></table>
3057
3058 !!end
3059
3060 !!test
3061 2d. Indent-Pre and tables
3062 !! wikitext
3063 a
3064 {|
3065 | b
3066 |}
3067 !! html/php
3068 <pre>a
3069 </pre>
3070 <table>
3071 <tr>
3072 <td> b
3073 </td></tr></table>
3074
3075 !! html/parsoid
3076 <pre>a</pre>
3077 <table>
3078 <tbody><tr><td> b</td></tr>
3079 </tbody></table>
3080 !!end
3081
3082 !!test
3083 2e. Indent-Pre and table-line syntax
3084 !! wikitext
3085 a
3086 | b
3087 | c
3088 !! html/php
3089 <pre>a
3090 | b
3091 | c
3092 </pre>
3093 !!end
3094
3095 !!test
3096 2f. Indent-pre started by table-line syntax
3097 !! wikitext
3098 a
3099 | b
3100 | c
3101 !! html/php
3102 <p>a
3103 </p>
3104 <pre>| b
3105 | c
3106 </pre>
3107 !! html/parsoid
3108 <p>a</p>
3109 <pre>
3110 | b
3111 | c</pre>
3112 !!end
3113
3114 !! test
3115 2g. Indented table markup mixed with indented pre content (proposed in bug 6200)
3116 !! wikitext
3117 <table>
3118 <tr>
3119 <td>
3120 Text that should be rendered preformatted
3121 </td>
3122 </tr>
3123 </table>
3124 !! html
3125 <table>
3126 <tr>
3127 <td>
3128 <pre>Text that should be rendered preformatted
3129 </pre>
3130 </td>
3131 </tr>
3132 </table>
3133
3134 !! end
3135
3136 !!test
3137 3a. Indent-Pre and block tags (single-line html)
3138 !! wikitext
3139 a <p> foo </p>
3140 b <div> foo </div>
3141 c <blockquote> foo </blockquote>
3142 <span> foo </span>
3143 !! html
3144 a <p> foo </p>
3145 b <div> foo </div>
3146 c <blockquote> foo </blockquote>
3147 <pre><span> foo </span>
3148 </pre>
3149 !! html/parsoid
3150 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3151 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3152 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3153 <pre><span> foo </span>
3154 </pre>
3155 !! html+tidy
3156 <p>a</p>
3157 <p>foo</p>
3158 <p>b</p>
3159 <div>foo</div>
3160 <p>c</p>
3161 <blockquote>
3162 <p>foo</p>
3163 </blockquote>
3164 <pre>
3165 <span> foo </span>
3166 </pre>
3167 !! end
3168
3169 !!test
3170 3b. Indent-Pre and block tags (multi-line html)
3171 !! wikitext
3172 a <span>foo</span>
3173 b <div> foo </div>
3174 !! html
3175 <pre>a <span>foo</span>
3176 </pre>
3177 b <div> foo </div>
3178
3179 !! html/parsoid
3180 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3181 b <div data-parsoid='{"stx":"html"}'> foo </div>
3182 !! html+tidy
3183 <pre>
3184 a <span>foo</span>
3185 </pre>
3186 <p>b</p>
3187 <div>foo</div>
3188 !!end
3189
3190 !!test
3191 3c. Indent-Pre and block tags (pre-content on separate line)
3192 !! wikitext
3193 <p>
3194 foo
3195 </p>
3196
3197 <div>
3198 foo
3199 </div>
3200
3201 <center>
3202 foo
3203 </center>
3204
3205 <blockquote>
3206 foo
3207 </blockquote>
3208
3209 <blockquote>
3210 <pre>
3211 foo
3212 </pre>
3213 </blockquote>
3214
3215 <table><tr><td>
3216 foo
3217 </td></tr></table>
3218
3219 <ul><li>
3220 foo
3221 </li></ul>
3222
3223 !! html
3224 <p>
3225 foo
3226 </p>
3227 <div>
3228 <pre>foo
3229 </pre>
3230 </div>
3231 <center>
3232 <pre>foo
3233 </pre>
3234 </center>
3235 <blockquote>
3236 <p> foo
3237 </p>
3238 </blockquote>
3239 <blockquote>
3240 <pre>
3241 foo
3242 </pre>
3243 </blockquote>
3244 <table><tr><td>
3245 <pre>foo
3246 </pre>
3247 </td></tr></table>
3248 <ul><li>
3249 foo
3250 </li></ul>
3251
3252 !!end
3253
3254 !! test
3255 4. Indent-Pre and extension tags
3256 !! wikitext
3257 a <tag />
3258 !! html/php
3259 a <pre>
3260 NULL
3261 array (
3262 )
3263 </pre>
3264
3265 !! html/parsoid
3266 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3267 !! end
3268
3269 !!test
3270 Render paragraphs when indent-pre is suppressed in blocklevels
3271 !! wikitext
3272 <blockquote>
3273 foo
3274
3275 bar
3276 </blockquote>
3277 !! html
3278 <blockquote>
3279 <p> foo
3280 </p><p> bar
3281 </p>
3282 </blockquote>
3283
3284 !!end
3285
3286 !!test
3287 4. Multiple spaces at start-of-line
3288 !! wikitext
3289 <p> foo </p>
3290 foo
3291 {|
3292 |foo
3293 |}
3294 !! html
3295 <p> foo </p>
3296 <pre> foo
3297 </pre>
3298 <table>
3299 <tr>
3300 <td>foo
3301 </td></tr></table>
3302
3303 !!end
3304
3305 ## NOTE: the leading white-space chars on empty line are significant
3306 !! test
3307 5a. White-space in indent-pre
3308 !! wikitext
3309 a<br />
3310
3311 b
3312 !! html
3313 <pre>a<br />
3314
3315 b
3316 </pre>
3317 !! end
3318
3319 ## NOTE: the leading white-space chars on empty line are significant
3320 !! test
3321 5b. White-space in indent-pre
3322 !! wikitext
3323 a
3324
3325 b
3326
3327
3328 c
3329 !! html
3330 <pre>a
3331
3332 b
3333
3334
3335 c
3336 </pre>
3337 !! end
3338
3339 !! test
3340 5c. White-space in indent-pre
3341 !! wikitext
3342 ''a''
3343 ''b''
3344 ''c''
3345 !! html
3346 <pre><i>a</i>
3347 <i>b</i>
3348 <i>c</i>
3349 </pre>
3350 !! end
3351
3352 !! test
3353 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3354 !! wikitext
3355 a
3356
3357 <!-- continue -->
3358 b
3359
3360 c
3361
3362 d
3363 !! html
3364 <pre>a
3365
3366 b
3367 </pre>
3368 <pre>c
3369
3370 </pre>
3371 <p>d
3372 </p>
3373 !! end
3374
3375 !! test
3376 7a. Indent-pre and category links
3377 !! options
3378 parsoid=wt2html,wt2wt
3379 !! wikitext
3380 [[Category:foo]] <!-- No pre-wrapping -->
3381 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3382 !! html/php+tidy
3383 !! html/parsoid
3384 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3385 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3386 !! end
3387
3388 ## We used to, but no longer wt2wt this test since the default serializer
3389 ## will normalize all categories to serialize on their own line.
3390 ## This wikitext usage is going to be fairly uncommon in production and
3391 ## selser will take care of preserving formatting in those scenarios.
3392 !! test
3393 7b. Indent-pre and category links
3394 !! options
3395 parsoid=wt2html
3396 !! wikitext
3397 [[Category:foo]] a
3398 [[Category:foo]] {{echo|b}}
3399 !! html/parsoid
3400 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3401 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3402 !! end
3403
3404 !! test
3405 Indent-Pre: Newlines in comments shouldn't affect sol state
3406 !! wikitext
3407 a <!--
3408 foo
3409 --> b
3410 !! html/php+tidy
3411 <p>a b</p>
3412 !! html/parsoid
3413 <p>a <!--
3414 foo
3415 --> b</p>
3416 !! end
3417
3418 ###
3419 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3420 ###
3421
3422 !!test
3423 HTML-pre: 1. embedded newlines
3424 !! wikitext
3425 <pre>foo</pre>
3426
3427 <pre>
3428 foo
3429 </pre>
3430
3431 <pre>
3432
3433 foo
3434 </pre>
3435
3436 <pre>
3437
3438
3439 foo
3440 </pre>
3441 !! html/php+tidy
3442 <pre>
3443 foo
3444 </pre>
3445 <pre>
3446 foo
3447 </pre>
3448 <pre>
3449
3450 foo
3451 </pre>
3452 <pre>
3453
3454
3455 foo
3456 </pre>
3457 !! html/parsoid
3458 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3459
3460 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3461 foo
3462 </pre>
3463
3464 <pre data-parsoid='{"stx":"html"}'>
3465
3466 foo
3467 </pre>
3468
3469 <pre data-parsoid='{"stx":"html"}'>
3470
3471
3472 foo
3473 </pre>
3474 !!end
3475
3476 !! test
3477 HTML-pre: big spaces
3478 !! wikitext
3479 <pre>
3480
3481
3482
3483
3484 haha
3485
3486
3487
3488
3489 haha
3490
3491
3492
3493
3494 </pre>
3495 !! html/php+tidy
3496 <pre>
3497
3498
3499
3500
3501 haha
3502
3503
3504
3505
3506 haha
3507
3508
3509
3510
3511 </pre>
3512 !! html/parsoid
3513 <pre data-parsoid='{"stx":"html"}'>
3514
3515
3516
3517
3518 haha
3519
3520
3521
3522
3523 haha
3524
3525
3526
3527
3528 </pre>
3529 !! end
3530
3531 !!test
3532 HTML-pre: 2: indented text
3533 !! wikitext
3534 <pre>
3535 foo
3536 </pre>
3537 !! html
3538 <pre>
3539 foo
3540 </pre>
3541
3542 !!end
3543
3544 !!test
3545 HTML-pre: 3: other wikitext
3546 !! wikitext
3547 <pre>
3548 * foo
3549 # bar
3550 = no-h =
3551 '' no-italic ''
3552 [[ NoLink ]]
3553 </pre>
3554 !! html/php
3555 <pre>
3556 * foo
3557 # bar
3558 = no-h =
3559 '' no-italic ''
3560 [[ NoLink ]]
3561 </pre>
3562
3563 !! html/parsoid
3564 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3565 # bar
3566 = no-h =
3567 '' no-italic ''
3568 [[ NoLink ]]
3569 </pre>
3570 !!end
3571
3572 ###
3573 ### Definition lists
3574 ###
3575 !! test
3576 Simple definition
3577 !! wikitext
3578 ; name : Definition
3579 !! html
3580 <dl><dt> name&#160;</dt>
3581 <dd> Definition</dd></dl>
3582
3583 !! end
3584
3585 !! test
3586 Definition list for indentation only
3587 !! wikitext
3588 : Indented text
3589 !! html
3590 <dl><dd> Indented text</dd></dl>
3591
3592 !! end
3593
3594 !! test
3595 Definition list with no space
3596 !! wikitext
3597 ;name:Definition
3598 !! html
3599 <dl><dt>name</dt>
3600 <dd>Definition</dd></dl>
3601
3602 !!end
3603
3604 !! test
3605 Definition list with URL link
3606 !! wikitext
3607 ; http://example.com/ : definition
3608 !! html
3609 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3610 <dd> definition</dd></dl>
3611
3612 !! end
3613
3614 !! test
3615 Definition list with bracketed URL link
3616 !! wikitext
3617 ;[http://www.example.com/ Example]:Something about it
3618 !! html
3619 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3620 <dd>Something about it</dd></dl>
3621
3622 !! end
3623
3624 !! test
3625 Definition list with wikilink containing colon
3626 !! wikitext
3627 ; [[Help:FAQ]]: The least-read page on Wikipedia
3628 !! html
3629 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3630 <dd> The least-read page on Wikipedia</dd></dl>
3631
3632 !! end
3633
3634 # At Brion's and JeLuF's insistence... :)
3635 !! test
3636 Definition list with news link containing colon
3637 !! wikitext
3638 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3639 !! html/php
3640 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3641 <dd> This isn't even a real newsgroup!</dd></dl>
3642
3643 !! html/parsoid
3644 <dl><dt> <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3645 !! end
3646
3647 !! test
3648 Malformed definition list with colon
3649 !! wikitext
3650 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3651 !! html
3652 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3653
3654 !! end
3655
3656 !! test
3657 Definition lists: colon in external link text
3658 !! wikitext
3659 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3660 !! html
3661 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3662 <dd> OK, I made that up</dd></dl>
3663
3664 !! end
3665
3666 !! test
3667 Definition lists: colon in HTML attribute
3668 !! wikitext
3669 ;<b style="display: inline">bold</b>
3670 !! html
3671 <dl><dt><b style="display: inline">bold</b></dt></dl>
3672
3673 !! end
3674
3675 !! test
3676 Definition lists: self-closed tag
3677 !! wikitext
3678 ;one<br/>two : two-line fun
3679 !! html
3680 <dl><dt>one<br />two&#160;</dt>
3681 <dd> two-line fun</dd></dl>
3682
3683 !! end
3684
3685 !! test
3686 Bug 11748: Literal closing tags
3687 !! wikitext
3688 <dl>
3689 <dt>test 1</dt>
3690 <dd>test test test test test</dd>
3691 <dt>test 2</dt>
3692 <dd>test test test test test</dd>
3693 </dl>
3694 !! html
3695 <dl>
3696 <dt>test 1</dt>
3697 <dd>test test test test test</dd>
3698 <dt>test 2</dt>
3699 <dd>test test test test test</dd>
3700 </dl>
3701
3702 !! end
3703
3704 !! test
3705 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3706 !! wikitext
3707 <ul><li>
3708 ; term : description
3709 * unordered
3710 </li></ul>
3711 !! html
3712 <ul><li>
3713 <dl><dt> term&#160;</dt>
3714 <dd> description</dd></dl>
3715 <ul><li> unordered</li></ul>
3716 </li></ul>
3717
3718 !! end
3719
3720 !! test
3721 Definition list with empty definition and following paragraph
3722 !! wikitext
3723 ; term:
3724 Paragraph text
3725 !! html
3726 <dl><dt> term</dt>
3727 <dd></dd></dl>
3728 <p>Paragraph text
3729 </p>
3730 !! end
3731
3732 !! test
3733 Nested definition lists using html syntax
3734 !! wikitext
3735 <dl><dt>x</dt>
3736 <dd>a</dd>
3737 <dd>b</dd></dl>
3738 !! html
3739 <dl><dt>x</dt>
3740 <dd>a</dd>
3741 <dd>b</dd></dl>
3742
3743 !! end
3744
3745 !! test
3746 Definition Lists: No nesting: Multiple dd's
3747 !! wikitext
3748 ;x
3749 :a
3750 :b
3751 !! html
3752 <dl><dt>x</dt>
3753 <dd>a</dd>
3754 <dd>b</dd></dl>
3755
3756 !! end
3757
3758 !! test
3759 Definition Lists: Indentation: Regular
3760 !! wikitext
3761 :i1
3762 ::i2
3763 :::i3
3764 !! html
3765 <dl><dd>i1
3766 <dl><dd>i2
3767 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3768
3769 !! end
3770
3771 !! test
3772 Definition Lists: Indentation: Missing 1st level
3773 !! wikitext
3774 ::i2
3775 :::i3
3776 !! html
3777 <dl><dd><dl><dd>i2
3778 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3779
3780 !! end
3781
3782 !! test
3783 Definition Lists: Indentation: Multi-level indent
3784 !! wikitext
3785 :::i3
3786 !! html
3787 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3788
3789 !! end
3790
3791 !! test
3792 Definition Lists: Hacky use to indent tables
3793 !! wikitext
3794 ::{|
3795 |foo
3796 |bar
3797 |}
3798 this text
3799 should be left alone
3800 !! html
3801 <dl><dd><dl><dd><table>
3802 <tr>
3803 <td>foo
3804 </td>
3805 <td>bar
3806 </td></tr></table></dd></dl></dd></dl>
3807 <p>this text
3808 should be left alone
3809 </p>
3810 !! end
3811
3812 !! test
3813 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3814 !! wikitext
3815 <!-- foo -->
3816 ::{|
3817 |foo
3818 |bar
3819 |}<!-- bar -->
3820 this text
3821 should be left alone
3822 !! html/parsoid
3823 <!-- foo -->
3824 <dl><dd><dl><dd><table><tr>
3825 <td>foo</td>
3826 <td>bar</td>
3827 </tr></table><!-- bar --></dd></dl></dd></dl>
3828 <p>this text
3829 should be left alone</p>
3830 !! end
3831
3832 !! test
3833 Definition Lists: Hacky use to indent tables, with comment before table
3834 !! wikitext
3835 ::<!-- foo -->{|
3836 |foo
3837 |}
3838 !! html/parsoid
3839 <dl><dd><dl><dd><!-- foo --><table><tr>
3840 <td>foo</td>
3841 </tr></table></dd></dl></dd></dl>
3842 !! end
3843
3844 # The trailing whitespace in this test is to catch a regression in
3845 # Parsoid after T54473.
3846 !! test
3847 Definition Lists: Hacky use to indent tables (WS-insensitive)
3848 !! wikitext
3849 : {|
3850 |a
3851 |}
3852 !! html/php
3853 <dl><dd><table>
3854 <tr>
3855 <td>a
3856 </td></tr></table></dd></dl>
3857
3858 !! html/parsoid
3859 <dl><dd> <table>
3860 <tbody><tr><td>a</td></tr>
3861 </tbody></table> </dd></dl>
3862 !! end
3863
3864 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3865 ## as an empty dt item. It also ignores all but the last ";" when followed
3866 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3867 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3868 ## ";"s.
3869 ##
3870 ## Ex: ";;t2 ::d2" is transformed into:
3871 ##
3872 ## <dl>
3873 ## <dt>t2 </dt>
3874 ## <dd>
3875 ## <dl>
3876 ## <dt></dt>
3877 ## <dd>d2</dd>
3878 ## </dl>
3879 ## </dd>
3880 ## </dl>
3881 ##
3882 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3883 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3884 ##
3885 ## <dl>
3886 ## <dt>
3887 ## <dl>
3888 ## <dt>t2 </dt>
3889 ## <dd>:d2</dd>
3890 ## </dl>
3891 ## </dt>
3892 ## </dl>
3893 ##
3894 ## All Parsoid only definition list tests have this difference.
3895 ##
3896 ## See also: https://phabricator.wikimedia.org/T8569
3897 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3898
3899 !! test
3900 Table / list interaction: indented table with lists in table contents
3901 !! wikitext
3902 :{|
3903 |-
3904 | a
3905 * b
3906 |-
3907 | c
3908 * d
3909 |}
3910 !! html
3911 <dl><dd><table>
3912
3913 <tr>
3914 <td> a
3915 <ul><li> b</li></ul>
3916 </td></tr>
3917 <tr>
3918 <td> c
3919 <ul><li> d</li></ul>
3920 </td></tr></table></dd></dl>
3921
3922 !! end
3923
3924 !!test
3925 Table / list interaction: lists nested in tables nested in indented lists
3926 !! wikitext
3927 :{|
3928 |
3929 :a
3930 :b
3931 |
3932 *c
3933 *d
3934 |}
3935
3936 *e
3937 *f
3938 !! html
3939 <dl><dd><table>
3940 <tr>
3941 <td>
3942 <dl><dd>a</dd>
3943 <dd>b</dd></dl>
3944 </td>
3945 <td>
3946 <ul><li>c</li>
3947 <li>d</li></ul>
3948 </td></tr></table></dd></dl>
3949 <ul><li>e</li>
3950 <li>f</li></ul>
3951
3952 !!end
3953
3954 !! test
3955 Definition Lists: Nesting: Multi-level (Parsoid only)
3956 !! options
3957 parsoid
3958 !! wikitext
3959 ;t1 :d1
3960 ;;t2 ::d2
3961 ;;;t3 :::d3
3962 !! html
3963 <dl>
3964 <dt>t1 </dt>
3965 <dd>d1</dd>
3966 <dt>
3967 <dl>
3968 <dt>t2 </dt>
3969 <dd>:d2</dd>
3970 <dt>
3971 <dl>
3972 <dt>t3 </dt>
3973 <dd>::d3</dd>
3974 </dl>
3975 </dt>
3976 </dl>
3977 </dt>
3978 </dl>
3979
3980
3981 !! end
3982
3983
3984 !! test
3985 Definition Lists: Nesting: Test 2 (Parsoid only)
3986 !! wikitext
3987 ;t1
3988 ::d2
3989 !! html/php+tidy
3990 <dl>
3991 <dt>t1</dt>
3992 <dd>
3993 <dl>
3994 <dd>d2</dd>
3995 </dl>
3996 </dd>
3997 </dl>
3998 !! html/parsoid
3999 <dl>
4000 <dt>t1</dt>
4001 <dd>
4002 <dl>
4003 <dd>d2</dd>
4004 </dl>
4005 </dd>
4006 </dl>
4007
4008 !! end
4009
4010
4011 !! test
4012 Definition Lists: Nesting: Test 3 (Parsoid only)
4013 !! wikitext
4014 :;t1
4015 ::::d2
4016 !! html/php+tidy
4017 <dl>
4018 <dd>
4019 <dl>
4020 <dt>t1</dt>
4021 <dd>
4022 <dl>
4023 <dd>
4024 <dl>
4025 <dd>d2</dd>
4026 </dl>
4027 </dd>
4028 </dl>
4029 </dd>
4030 </dl>
4031 </dd>
4032 </dl>
4033 !! html/parsoid
4034 <dl>
4035 <dd>
4036 <dl>
4037 <dt>t1</dt>
4038 <dd>
4039 <dl>
4040 <dd>
4041 <dl>
4042 <dd>d2</dd>
4043 </dl>
4044 </dd>
4045 </dl>
4046 </dd>
4047 </dl>
4048 </dd>
4049 </dl>
4050
4051 !! end
4052
4053
4054 !! test
4055 Definition Lists: Nesting: Test 4
4056 !! wikitext
4057 ::;t3
4058 :::d3
4059 !! html
4060 <dl><dd><dl><dd><dl><dt>t3</dt>
4061 <dd>d3</dd></dl></dd></dl></dd></dl>
4062
4063 !! end
4064
4065
4066 ## The Parsoid team believes the following three test exposes a
4067 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4068 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4069 ## It also exposes a "misfeature" in tidy, which doesn't like
4070 ## <dl> tags with a single <dt> child; it converts the <dt> into
4071 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4072 !! test
4073 Definition Lists: Mixed Lists: Test 1
4074 !! wikitext
4075 :;* foo
4076 ::* bar
4077 :; baz
4078 !! html/php
4079 <dl><dd><dl><dt><ul><li> foo</li>
4080 <li> bar</li></ul></dt></dl>
4081 <dl><dt> baz</dt></dl></dd></dl>
4082
4083 !! html/php+tidy
4084 <dl>
4085 <dd>
4086 <dl>
4087 <dd>
4088 <ul>
4089 <li>foo</li>
4090 <li>bar</li>
4091 </ul>
4092 </dd>
4093 </dl>
4094 <dl>
4095 <dt>baz</dt>
4096 </dl>
4097 </dd>
4098 </dl>
4099 !! html/parsoid
4100 <dl>
4101 <dd><dl>
4102 <dt><ul>
4103 <li> foo
4104 </li>
4105 </ul></dt>
4106 <dd><ul>
4107 <li> bar
4108 </li>
4109 </ul></dd>
4110 <dt> baz</dt>
4111 </dl></dd>
4112 </dl>
4113 !! end
4114
4115 !! test
4116 Definition Lists: Mixed Lists: Test 2
4117 !! wikitext
4118 *: d1
4119 *: d2
4120 !! html
4121 <ul><li><dl><dd> d1</dd>
4122 <dd> d2</dd></dl></li></ul>
4123
4124 !! end
4125
4126
4127 !! test
4128 Definition Lists: Mixed Lists: Test 3
4129 !! wikitext
4130 *::: d1
4131 *::: d2
4132 !! html
4133 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4134 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4135
4136 !! end
4137
4138
4139 !! test
4140 Definition Lists: Mixed Lists: Test 4
4141 !! wikitext
4142 *;d1 :d2
4143 *;d3 :d4
4144 !! html
4145 <ul><li><dl><dt>d1&#160;</dt>
4146 <dd>d2</dd>
4147 <dt>d3&#160;</dt>
4148 <dd>d4</dd></dl></li></ul>
4149
4150 !! end
4151
4152
4153 !! test
4154 Definition Lists: Mixed Lists: Test 5
4155 !! wikitext
4156 *:d1
4157 *:: d2
4158 !! html
4159 <ul><li><dl><dd>d1
4160 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4161
4162 !! end
4163
4164
4165 !! test
4166 Definition Lists: Mixed Lists: Test 6
4167 !! wikitext
4168 #*:d1
4169 #*::: d3
4170 !! html
4171 <ol><li><ul><li><dl><dd>d1
4172 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4173
4174 !! end
4175
4176
4177 !! test
4178 Definition Lists: Mixed Lists: Test 7
4179 !! wikitext
4180 :* d1
4181 :* d2
4182 !! html
4183 <dl><dd><ul><li> d1</li>
4184 <li> d2</li></ul></dd></dl>
4185
4186 !! end
4187
4188
4189 !! test
4190 Definition Lists: Mixed Lists: Test 8
4191 !! wikitext
4192 :* d1
4193 ::* d2
4194 !! html
4195 <dl><dd><ul><li> d1</li></ul>
4196 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4197
4198 !! end
4199
4200
4201 !! test
4202 Definition Lists: Mixed Lists: Test 9
4203 !! wikitext
4204 *;foo :bar
4205 !! html
4206 <ul><li><dl><dt>foo&#160;</dt>
4207 <dd>bar</dd></dl></li></ul>
4208
4209 !! end
4210
4211
4212 !! test
4213 Definition Lists: Mixed Lists: Test 10
4214 !! wikitext
4215 *#;foo :bar
4216 !! html
4217 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4218 <dd>bar</dd></dl></li></ol></li></ul>
4219
4220 !! end
4221
4222 # The Parsoid team disagrees with the PHP parser's seemingly-random
4223 # rules regarding dd/dt on the next two tests. Parsoid is more
4224 # consistent, and recognizes the shared nesting and keeps the
4225 # still-open tags around until the nesting is complete.
4226 # (And tidy again converts <dt> to <dd> before 'bar'.)
4227
4228 !! test
4229 Definition Lists: Mixed Lists: Test 11
4230 !! wikitext
4231 *#*#;*;;foo :bar
4232 *#*#;boo :baz
4233 !! html/php
4234 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4235 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4236 <dl><dt>boo&#160;</dt>
4237 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4238
4239 !! html/php+tidy
4240 <ul>
4241 <li>
4242 <ol>
4243 <li>
4244 <ul>
4245 <li>
4246 <ol>
4247 <li>
4248 <dl>
4249 <dt>foo&#160;</dt>
4250 <dd>
4251 <ul>
4252 <li>
4253 <dl>
4254 <dd>
4255 <dl>
4256 <dt>bar</dt>
4257 </dl>
4258 </dd>
4259 </dl>
4260 </li>
4261 </ul>
4262 </dd>
4263 </dl>
4264 <dl>
4265 <dt>boo&#160;</dt>
4266 <dd>baz</dd>
4267 </dl>
4268 </li>
4269 </ol>
4270 </li>
4271 </ul>
4272 </li>
4273 </ol>
4274 </li>
4275 </ul>
4276 !! html/parsoid
4277 <ul>
4278 <li>
4279 <ol>
4280 <li>
4281 <ul>
4282 <li>
4283 <ol>
4284 <li>
4285 <dl>
4286 <dt>
4287 <ul>
4288 <li>
4289 <dl>
4290 <dt>
4291 <dl>
4292 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4293 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4294 </dl></dt>
4295 </dl></li>
4296 </ul></dt>
4297 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4298 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4299 </dl></li>
4300 </ol></li>
4301 </ul></li>
4302 </ol></li>
4303 </ul>
4304 !! end
4305
4306
4307 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4308 # From whitelist:
4309 # * The test is wrong, there are two colons where there should be :;
4310 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4311 !! test
4312 Definition Lists: Weird Ones: Test 1
4313 !! wikitext
4314 *#;*::;; foo : bar (who uses this?)
4315 !! html/php
4316 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4317 <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>
4318
4319 !! html/php+tidy
4320 <ul>
4321 <li>
4322 <ol>
4323 <li>
4324 <dl>
4325 <dt>foo&#160;</dt>
4326 <dd>
4327 <ul>
4328 <li>
4329 <dl>
4330 <dd>
4331 <dl>
4332 <dd>
4333 <dl>
4334 <dd>
4335 <dl>
4336 <dt>bar (who uses this?)</dt>
4337 </dl>
4338 </dd>
4339 </dl>
4340 </dd>
4341 </dl>
4342 </dd>
4343 </dl>
4344 </li>
4345 </ul>
4346 </dd>
4347 </dl>
4348 </li>
4349 </ol>
4350 </li>
4351 </ul>
4352 !! html/parsoid
4353 <ul>
4354 <li>
4355 <ol>
4356 <li>
4357 <dl>
4358 <dt>
4359 <ul>
4360 <li>
4361 <dl>
4362 <dd>
4363 <dl>
4364 <dd>
4365 <dl>
4366 <dt>
4367 <dl>
4368 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4369 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4370 </dl></dt>
4371 </dl></dd>
4372 </dl></dd>
4373 </dl></li>
4374 </ul></dt>
4375 </dl></li>
4376 </ol></li>
4377 </ul>
4378 !! end
4379
4380 !! test
4381 Definition Lists: colons occurring in tags
4382 !! wikitext
4383 ;a:b
4384 ;'''a:b'''
4385 ;<i>a:b</i>
4386 ;<span>a:b</span>
4387 ;<div>a:b</div>
4388 ;<div>a
4389 :b</div>
4390 ;{{echo|a:b}}
4391 ;{{echo|''a:b''}}
4392 ;;;''a:b''
4393 !! html+tidy
4394 <dl>
4395 <dt>a</dt>
4396 <dd>b</dd>
4397 <dt><b>a:b</b></dt>
4398 <dt><i>a:b</i></dt>
4399 <dt><span>a:b</span></dt>
4400 <dd>
4401 <div>a:b</div>
4402 </dd>
4403 <dd>
4404 <div>a
4405 <dl>
4406 <dd>b</dd>
4407 </dl>
4408 </div>
4409 </dd>
4410 <dt>a</dt>
4411 <dd>b</dd>
4412 <dt><i>a:b</i></dt>
4413 </dl>
4414 <dl>
4415 <dd>
4416 <dl>
4417 <dd>
4418 <dl>
4419 <dt><i>a:b</i></dt>
4420 </dl>
4421 </dd>
4422 </dl>
4423 </dd>
4424 </dl>
4425 !! html/parsoid
4426 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4427 <dt><b>a:b</b></dt>
4428 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4429 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4430 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4431 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4432 <dd>b</dd>
4433 <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>
4434 <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>
4435 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4436 !! end
4437
4438 !! test
4439 Definition Lists: colons and tables 1
4440 !! wikitext
4441 :{|
4442 | x
4443 |}
4444 :{|
4445 | y
4446 |}
4447 !! html
4448 <dl><dd><table>
4449 <tr>
4450 <td> x
4451 </td></tr></table></dd></dl>
4452 <dl><dd><table>
4453 <tr>
4454 <td> y
4455 </td></tr></table></dd></dl>
4456
4457 !! end
4458
4459 # Parsoid's output (as documented below) differs from php's in this case.
4460 # This is probably a bug. If we fixup parsoid to match php's output, the
4461 # above test should pass and the below test case can be removed. It is
4462 # unclear which output is more desirable.
4463
4464 !! test
4465 Definition Lists: colons and tables 2
4466 !! wikitext
4467 :{|
4468 | x
4469 |}
4470 :{|
4471 | y
4472 |}
4473 !! html/parsoid
4474 <dl><dd><table>
4475 <tr>
4476 <td> x
4477 </td></tr></table></dd>
4478 <dd><table>
4479 <tr>
4480 <td> y
4481 </td></tr></table></dd></dl>
4482 !! end
4483
4484 !! test
4485 Definition Lists: template interaction
4486 !! wikitext
4487 ::{{definition_list}}
4488
4489 :one
4490 ::{{definition_list}}
4491 :::two
4492 :::three
4493 ::four
4494 !! html/parsoid
4495 <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">
4496 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4497
4498 <dl><dd data-parsoid='{}'>one
4499 <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">
4500 </span><dd about="#mwt2">two
4501 <dl><dd>two</dd>
4502 <dd>three</dd></dl></dd>
4503 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4504 !! end
4505
4506
4507 ###
4508 ### External links
4509 ###
4510 !! test
4511 External links: non-bracketed
4512 !! wikitext
4513 Non-bracketed: http://example.com
4514 !! html
4515 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4516 </p>
4517 !! end
4518
4519 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4520 !! test
4521 External links: numbered
4522 !! wikitext
4523 Numbered: [http://example.com]
4524 Numbered: [http://example.net]
4525 Numbered: [http://example.com]
4526 !! html/php
4527 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4528 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4529 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4530 </p>
4531 !! html/parsoid
4532 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4533 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4534 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4535 !!end
4536
4537 !! test
4538 External links: specified text
4539 !! wikitext
4540 Specified text: [http://example.com link]
4541 !! html
4542 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4543 </p>
4544 !!end
4545
4546 !! test
4547 External links: trail
4548 !! wikitext
4549 Linktrails should not work for external links: [http://example.com link]s
4550 !! html
4551 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4552 </p>
4553 !! end
4554
4555 !! test
4556 External links: dollar sign in URL
4557 !! wikitext
4558 http://example.com/1$2345
4559 !! html
4560 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4561 </p>
4562 !! end
4563
4564 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4565 !! test
4566 External links: dollar sign in URL (autonumber)
4567 !! wikitext
4568 [http://example.com/1$2345]
4569 !! html/php
4570 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4571 </p>
4572 !! html/parsoid
4573 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4574 !!end
4575
4576 !! test
4577 External links: open square bracket forbidden in URL (bug 4377)
4578 !! options
4579 parsoid=wt2html,wt2wt,html2html
4580 !! wikitext
4581 http://example.com/1[2345
4582 !! html/php
4583 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4584 </p>
4585 !! html/parsoid
4586 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4587 !! end
4588
4589 !! test
4590 External links: open square bracket forbidden in URL (named) (bug 4377)
4591 !! options
4592 parsoid=wt2html,html2html
4593 !! wikitext
4594 [http://example.com/1[2345]
4595 !! html/php
4596 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4597 </p>
4598 !! html/parsoid
4599 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4600 !!end
4601
4602 # parsoid adds a space before the link name
4603 !! test
4604 External links: open square bracket forbidden in URL (named) (bug 4377)
4605 Parsoid variant.
4606 !! wikitext
4607 [http://example.com/1 [2345]
4608 !! html
4609 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4610 </p>
4611 !!end
4612
4613 !! test
4614 External links: nowiki in URL link text (bug 6230)
4615 !! wikitext
4616 [http://example.com/ <nowiki>''example site''</nowiki>]
4617 !! html
4618 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4619 </p>
4620 !! end
4621
4622 !! test
4623 External links: newline forbidden in text (bug 6230 regression check)
4624 !! wikitext
4625 [http://example.com/ first
4626 second]
4627 !! html
4628 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4629 second]
4630 </p>
4631 !!end
4632
4633 !! test
4634 External links: Pipe char between url and text
4635 !! wikitext
4636 [http://example.com | link]
4637 !! html
4638 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4639 </p>
4640 !!end
4641
4642 !! test
4643 External links: protocol-relative URL in brackets
4644 !! wikitext
4645 [//example.com/ Test]
4646 !! html
4647 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4648 </p>
4649 !! end
4650
4651 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4652 !! test
4653 External links: protocol-relative URL in brackets without text
4654 !! wikitext
4655 [//example.com]
4656 !! html/php
4657 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4658 </p>
4659 !! html/parsoid
4660 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4661 !! end
4662
4663 !! test
4664 External links: protocol-relative URL in free text is left alone
4665 !! wikitext
4666 //example.com/Foo
4667 !! html
4668 <p>//example.com/Foo
4669 </p>
4670 !!end
4671
4672 !! test
4673 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4674 !! wikitext
4675 foo//example.com/Foo
4676 !! html
4677 <p>foo//example.com/Foo
4678 </p>
4679 !! end
4680
4681 !! test
4682 External links: with no contents
4683 !! wikitext
4684 [http://en.wikipedia.org/wiki/Foo]
4685
4686 [[wikipedia:Foo|Bar]]
4687
4688 [[wikipedia:Foo|<span>Bar</span>]]
4689 !! html/php
4690 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4691 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4692 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4693 </p>
4694 !! html/parsoid
4695 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4696 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4697 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4698 !! end
4699
4700 !! test
4701 External links: Free with trailing punctuation
4702 !! wikitext
4703 http://example.com,
4704 http://example.com;
4705 http://example.com\
4706 http://example.com.
4707 http://example.com:
4708 http://example.com!
4709 http://example.com?
4710 http://example.com)
4711 http://example.com/url_with_(brackets)
4712 (http://example.com/url_without_brackets)
4713 http://example.com/url_with_entity&amp;
4714 http://example.com/url_with_entity&#x26;
4715 http://example.com/url_with_entity&#038;
4716 http://example.com/url_with_entity&nbsp;
4717 http://example.com/url_with_entity&#xA0;
4718 http://example.com/url_with_entity&#160;
4719 http://example.com/url_with_entity&lt;
4720 http://example.com/url_with_entity&#x3C;
4721 http://example.com/url_with_entity&#60;
4722 !! html/php
4723 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4724 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4725 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4726 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4727 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4728 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4729 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4730 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4731 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4732 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4733 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4734 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4735 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4736 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4737 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4738 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4739 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4740 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4741 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4742 </p>
4743 !! html/parsoid
4744 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4745 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4746 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4747 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4748 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4749 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4750 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4751 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4752 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4753 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4754 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4755 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4756 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4757 <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>
4758 <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>
4759 <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>
4760 <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>
4761 <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>
4762 <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>
4763 !! end
4764
4765 !! test
4766 External links: tricky Parsoid html2html case
4767 !! options
4768 parsoid=wt2html,wt2wt,html2html
4769 !! wikitext
4770 http://example.com/url_with_entity&amp;amp;
4771 !! html/php
4772 <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>;
4773 </p>
4774 !! html/parsoid
4775 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4776 !! end
4777
4778 !! test
4779 External links: Free with trailing quotes (T113666)
4780 !! wikitext
4781 '''News:''' Stuff here
4782
4783 news:'a'b''c''d e
4784 !! html/php
4785 <p><b>News:</b> Stuff here
4786 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4787 </p>
4788 !! html/parsoid
4789 <p><b>News:</b> Stuff here</p>
4790 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4791 !! end
4792
4793 !! test
4794 External links: with entity
4795 !! wikitext
4796 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
4797 !! html/php
4798 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
4799 </p>
4800 !! html/parsoid
4801 <p><a rel="mw:ExtLink" href="http://+www.librarieswithoutborders.org" data-parsoid='{"a":{"href":"http://+www.librarieswithoutborders.org"},"sa":{"href":"http://&amp;#x20;www.librarieswithoutborders.org"}}'>Libraries without borders</a></p>
4802 !! end
4803
4804 !! test
4805 External links: Lone protocols are never linked (T105697)
4806 !! wikitext
4807 http://
4808 http://;
4809 (http://)
4810 bitcoin:
4811 bitcoin:;
4812 (bitcoin:)
4813 !! html
4814 <p>http://
4815 http://;
4816 (http://)
4817 bitcoin:
4818 bitcoin:;
4819 (bitcoin:)
4820 </p>
4821 !! end
4822
4823 !! test
4824 External links: No preceding word characters allowed (bug 65278)
4825 !! wikitext
4826 NOPEhttp://example.com
4827 N0http://example.com
4828 ok:http://example.com
4829 ok-http://example.com
4830 !! html
4831 <p>NOPEhttp://example.com
4832 N0http://example.com
4833 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4834 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4835 </p>
4836 !! end
4837
4838 !! test
4839 External links: nofollow domain exception
4840 !! wikitext
4841 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4842 !! html
4843 <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>.
4844 </p>
4845 !!end
4846
4847 !! test
4848 External image
4849 !! wikitext
4850 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4851 !! html
4852 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4853 </p>
4854 !! end
4855
4856 !! test
4857 External image from https
4858 !! wikitext
4859 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4860 !! html
4861 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4862 </p>
4863 !! end
4864
4865 !! test
4866 External image (when not allowed)
4867 !! options
4868 wgAllowExternalImages=0
4869 !! wikitext
4870 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4871 !! html
4872 <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>
4873 </p>
4874 !! end
4875
4876 !! test
4877 Link to non-http image, no img tag
4878 !! wikitext
4879 Link to non-http image, no img tag: ftp://example.com/test.jpg
4880 !! html
4881 <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>
4882 </p>
4883 !! end
4884
4885 !! test
4886 External links: terminating separator
4887 !! wikitext
4888 Terminating separator: http://example.com/thing,
4889 !! html
4890 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4891 </p>
4892 !! end
4893
4894 !! test
4895 External links: intervening separator
4896 !! wikitext
4897 Intervening separator: http://example.com/1,2,3
4898 !! html
4899 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4900 </p>
4901 !! end
4902
4903 !! test
4904 External links: old bug with URL in query
4905 !! wikitext
4906 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4907 !! html
4908 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4909 </p>
4910 !! end
4911
4912 !! test
4913 External links: old URL-in-URL bug, mixed protocols
4914 !! wikitext
4915 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4916 !! html
4917 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4918 </p>
4919 !!end
4920
4921 # Since Parsoid is starting to emit canonical wikitext for links,
4922 # [http://example.com http://example.com] will not RT back to that
4923 # form anymore.
4924 !! test
4925 External links: URL in text
4926 !! options
4927 parsoid=wt2html
4928 !! wikitext
4929 URL in text: [http://example.com http://example.com]
4930 !! html/php
4931 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4932 </p>
4933 !! html/parsoid
4934 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4935 !! end
4936
4937 !! test
4938 External links: Clickable images
4939 !! wikitext
4940 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4941 !! html/php
4942 <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>
4943 </p>
4944 !! html/parsoid
4945 <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>
4946 !! end
4947
4948 !! test
4949 External links: raw ampersand
4950 !! wikitext
4951 Old &amp; use: http://x&y
4952 !! html
4953 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4954 </p>
4955 !! end
4956
4957 !! test
4958 External links: encoded ampersand
4959 !! wikitext
4960 Old &amp; use: http://x&amp;y
4961 !! html/php
4962 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4963 </p>
4964 !! html/parsoid
4965 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4966 !! end
4967
4968 !! test
4969 External links: encoded equals (bug 6102)
4970 !! wikitext
4971 http://example.com/?foo&#61;bar
4972 !! html/php
4973 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4974 </p>
4975 !! html/parsoid
4976 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4977 !! end
4978
4979 ##
4980 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4981 ## does it number them. As discussed in bug 53505, we can identify
4982 ## autonumbered links via CSS.
4983 ##
4984
4985 !! test
4986 External links: [raw ampersand]
4987 !! wikitext
4988 Old &amp; use: [http://x&y]
4989 !! html/php
4990 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4991 </p>
4992 !! html/parsoid
4993 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4994 !! end
4995
4996 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4997 # mode will return the [raw ampersand] wikitext
4998 !! test
4999 External links: [encoded ampersand]
5000 !! options
5001 parsoid=wt2html,wt2wt,html2html
5002 !! wikitext
5003 Old &amp; use: [http://x&amp;y]
5004 !! html/php
5005 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5006 </p>
5007 !! html/parsoid
5008 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5009 !! end
5010
5011 !! test
5012 External links: [raw equals]
5013 !! wikitext
5014 [http://example.com/?foo=bar]
5015 !! html/php
5016 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5017 </p>
5018 !! html/parsoid
5019 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5020 !! end
5021
5022 # note that parsoid html is identical to [raw equals] case; so html2wt
5023 # mode will return the [raw equals] wikitext
5024 !! test
5025 External links: [encoded equals] (bug 6102)
5026 !! options
5027 parsoid=wt2html,wt2wt,html2html
5028 !! wikitext
5029 [http://example.com/?foo&#61;bar]
5030 !! html/php
5031 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5032 </p>
5033 !! html/parsoid
5034 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5035 !! end
5036
5037 # xxx parsoid strips the IDN character, so the round-trip tests will
5038 # obviously fail and are disabled. --cscott
5039 !! test
5040 External links: [IDN ignored character reference in hostname; strip it right off]
5041 !! options
5042 parsoid=wt2html,wt2wt,html2html
5043 !! wikitext
5044 [http://e&zwnj;xample.com/]
5045 !! html/php
5046 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5047 </p>
5048 !! html/parsoid
5049 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5050 !! end
5051
5052 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5053 # Where an external link could easily circumvent the sanitization of the text of
5054 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5055 # test demands a higher standard. That's a bit strange.
5056 #
5057 # Example:
5058 #
5059 # http://e‌xample.com -> [http://example.com|http://example.com]
5060 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5061 #
5062 # The first example is sanitized, but the second is not. Any security benefits
5063 # from this production are trivial to circumvent. Either remove this test and
5064 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5065 # the test accordingly.
5066 #
5067 # All our love,
5068 # The Parsoid team.
5069 # xxx parsoid strips the IDN character, so the round-trip tests will
5070 # obviously fail and are disabled. --cscott
5071 !! test
5072 External links: IDN ignored character reference in hostname; strip it right off
5073 !! options
5074 parsoid=wt2html,html2html
5075 !! wikitext
5076 http://e&zwnj;xample.com/
5077 !! html/php
5078 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5079 </p>
5080 !! html/parsoid
5081 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5082 !! end
5083
5084 !! test
5085 External links: www.jpeg.org (bug 554)
5086 !! wikitext
5087 http://www.jpeg.org
5088 !! html
5089 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5090 </p>
5091 !! end
5092
5093 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5094 !! test
5095 External links: URL within URL (original bug 2)
5096 !! wikitext
5097 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5098 !! html/php
5099 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5100 </p>
5101 !! html/parsoid
5102 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5103 !! end
5104
5105 !! test
5106 BUG 361: URL inside bracketed URL
5107 !! wikitext
5108 [http://www.example.com/foo http://www.example.com/bar]
5109 !! html
5110 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5111 </p>
5112 !! end
5113
5114 !! test
5115 BUG 361: URL within URL, not bracketed
5116 !! wikitext
5117 http://www.example.com/foo?=http://www.example.com/bar
5118 !! html
5119 <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>
5120 </p>
5121 !! end
5122
5123 !! test
5124 BUG 289: ">"-token in URL-tail
5125 !! wikitext
5126 http://www.example.com/<hello>
5127 !! html
5128 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5129 </p>
5130 !!end
5131
5132 !! test
5133 BUG 289: literal ">"-token in URL-tail
5134 !! wikitext
5135 http://www.example.com/<b>html</b>
5136 !! html/php
5137 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5138 </p>
5139 !! html/parsoid
5140 <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>
5141 !! end
5142
5143 !! test
5144 BUG 289: ">"-token in bracketed URL
5145 !! wikitext
5146 [http://www.example.com/<hello> stuff]
5147 !! html
5148 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5149 </p>
5150 !!end
5151
5152 !! test
5153 BUG 289: literal ">"-token in bracketed URL
5154 !! wikitext
5155 [http://www.example.com/<b>html</b> stuff]
5156 !! html
5157 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5158 </p>
5159 !!end
5160
5161 !! test
5162 BUG 289: literal double quote at end of URL
5163 !! wikitext
5164 http://www.example.com/"hello"
5165 !! html
5166 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5167 </p>
5168 !!end
5169
5170 !! test
5171 BUG 289: literal double quote in bracketed URL
5172 !! wikitext
5173 [http://www.example.com/"hello" stuff]
5174 !! html
5175 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5176 </p>
5177 !!end
5178
5179 !! test
5180 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5181 !! wikitext
5182 [http://www.example.com test]
5183 !! html
5184 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5185 </p>
5186 !! end
5187
5188 !! test
5189 External links: link text with spaces
5190 !! wikitext
5191 [http://www.example.com a b c]
5192 [http://www.example.com ''a'' ''b'']
5193 !! html
5194 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5195 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5196 </p>
5197 !! end
5198
5199 !! test
5200 External links: wiki links within external link (Bug 3695)
5201 !! options
5202 parsoid=wt2html,html2html
5203 !! wikitext
5204 [http://example.com [[wikilink]] embedded in ext link]
5205 !! html/php
5206 <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>
5207 </p>
5208 !! html/parsoid
5209 <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>
5210 !! end
5211
5212 !! test
5213 BUG 787: Links with one slash after the url protocol are invalid
5214 !! wikitext
5215 http:/example.com
5216
5217 [http:/example.com title]
5218 !! html
5219 <p>http:/example.com
5220 </p><p>[http:/example.com title]
5221 </p>
5222 !! end
5223
5224 !! test
5225 Bracketed external links with template-generated invalid target
5226 !! wikitext
5227 [{{echo|http:/example.com}} title]
5228 !! html
5229 <p>[http:/example.com title]
5230 </p>
5231 !! end
5232
5233 !! test
5234 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5235 !! wikitext
5236 ''[http://example.com text'']
5237 [http://example.com '''text]'''
5238 ''Something [http://example.com in italic'']
5239 ''Something [http://example.com mixed''''', even bold]'''
5240 '''''Now [http://example.com both''''']
5241 !! html
5242 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5243 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5244 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5245 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5246 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5247 </p>
5248 !! end
5249
5250
5251 !! test
5252 Bug 4781: %26 in URL
5253 !! wikitext
5254 http://www.example.com/?title=AT%26T
5255 !! html/php
5256 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5257 </p>
5258 !! html/parsoid
5259 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5260 !! end
5261
5262 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5263 # % is actually legal in HTML5. Any change in output would need testing though.
5264 !! test
5265 Bug 4781, 5267: %25 in URL
5266 !! wikitext
5267 http://www.example.com/?title=100%25_Bran
5268 !! html/php
5269 <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>
5270 </p>
5271 !! html/parsoid
5272 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5273 !! end
5274
5275 !! test
5276 Bug 4781, 5267: %28, %29 in URL
5277 !! wikitext
5278 http://www.example.com/?title=Ben-Hur_%281959_film%29
5279 !! html/php
5280 <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>
5281 </p>
5282 !! html/parsoid
5283 <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>
5284 !! end
5285
5286
5287 !! test
5288 Bug 4781: %26 in autonumber URL
5289 !! wikitext
5290 [http://www.example.com/?title=AT%26T]
5291 !! html/php
5292 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5293 </p>
5294 !! html/parsoid
5295 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5296 !! end
5297
5298 !! test
5299 Bug 4781, 5267: %26 in autonumber URL
5300 !! wikitext
5301 [http://www.example.com/?title=100%25_Bran]
5302 !! html/php
5303 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5304 </p>
5305 !! html/parsoid
5306 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5307 !! end
5308
5309 !! test
5310 Bug 4781, 5267: %28, %29 in autonumber URL
5311 !! wikitext
5312 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5313 !! html/php
5314 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5315 </p>
5316 !! html/parsoid
5317 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5318 !! end
5319
5320
5321 !! test
5322 Bug 4781: %26 in bracketed URL
5323 !! wikitext
5324 [http://www.example.com/?title=AT%26T link]
5325 !! html/php
5326 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5327 </p>
5328 !! html/parsoid
5329 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5330 !! end
5331
5332 !! test
5333 Bug 4781, 5267: %25 in bracketed URL
5334 !! wikitext
5335 [http://www.example.com/?title=100%25_Bran link]
5336 !! html
5337 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5338 </p>
5339 !! end
5340
5341 !! test
5342 Bug 4781, 5267: %28, %29 in bracketed URL
5343 !! wikitext
5344 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5345 !! html/php
5346 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5347 </p>
5348 !! html/parsoid
5349 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5350 !! end
5351
5352 !! test
5353 External link containing a period in the anchor. (bug 63947)
5354 !! wikitext
5355 [//foo.org/bar#baz. bang]
5356
5357 [//foo.org/bar. bang]
5358 !! html/php
5359 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5360 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5361 </p>
5362 !! html/parsoid
5363 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5364 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5365 !! end
5366
5367 !! test
5368 External link containing a single quote. (bug 63947)
5369 !! wikitext
5370 [//foo.org/bar'baz]
5371
5372 [//foo.org/bar'baz bang]
5373 !! html/php
5374 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5375 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5376 </p>
5377 !! html/parsoid
5378 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5379 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5380 !! end
5381
5382 !! test
5383 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5384 !! wikitext
5385 Some [http://example.com/ pretty ''italics'' and stuff]!
5386 !! html
5387 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5388 </p>
5389 !! end
5390
5391 !! test
5392 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5393 !! wikitext
5394 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5395 !! html
5396 <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>
5397 </p>
5398 !! end
5399
5400 !! test
5401 External link containing double-single-quotes with no space separating the url from text in italics
5402 !! wikitext
5403 [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]].]
5404 !! html/php
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 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>
5406 </p>
5407 !! html/php+tidy
5408 <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>
5409 !! html/parsoid
5410 <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>
5411 !! end
5412
5413 !! test
5414 External link with comments in link text
5415 !! wikitext
5416 [http://www.google.com Google <!-- comment -->]
5417 !! html/php
5418 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5419 </p>
5420 !! html/parsoid
5421 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5422 !! end
5423
5424 !! test
5425 External link to bare IPv4 address
5426 !! wikitext
5427 [http://192.168.0.1 Link]
5428 !! html/php
5429 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5430 </p>
5431 !! html/parsoid
5432 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5433 !! end
5434
5435 !! test
5436 URL-encoding in URL functions (single parameter)
5437 !! wikitext
5438 {{localurl:Some page|amp=&}}
5439 !! html
5440 <p>/index.php?title=Some_page&amp;amp=&amp;
5441 </p>
5442 !! end
5443
5444 !! test
5445 URL-encoding in URL functions (multiple parameters)
5446 !! wikitext
5447 {{localurl:Some page|q=?&amp=&}}
5448 !! html
5449 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5450 </p>
5451 !! end
5452
5453 !! test
5454 Brackets in urls
5455 !! wikitext
5456 http://example.com/index.php?foozoid%5B%5D=bar
5457
5458 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5459 !! html/php
5460 <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>
5461 </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>
5462 </p>
5463 !! html/parsoid
5464 <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>
5465
5466 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar" data-parsoid='{"stx":"url","a":{"href":"http://example.com/index.php?foozoid%5B%5D=bar"},"sa":{"href":"http://example.com/index.php?foozoid&amp;#x5B;&amp;#x5D;=bar"}}'>http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5467 !! end
5468
5469 !! test
5470 IPv6 urls, autolink format (T23261)
5471 !! wikitext
5472 http://[2404:130:0:1000::187:2]/index.php
5473
5474 Examples from RFC 2373, section 2.2:
5475 * http://[1080::8:800:200C:417A]/unicast
5476 * http://[FF01::101]/multicast
5477 * http://[::1]/loopback
5478 * http://[::]/unspecified
5479 * http://[::13.1.68.3]/ipv4compat
5480 * http://[::FFFF:129.144.52.38]/ipv4compat
5481
5482 Examples from RFC 2732, section 2:
5483 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5484 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5485 * http://[3ffe:2a00:100:7031::1]
5486 * http://[1080::8:800:200C:417A]/foo
5487 * http://[::192.9.5.5]/ipng
5488 * http://[::FFFF:129.144.52.38]:80/index.html
5489 * http://[2010:836B:4179::836B:4179]
5490
5491 !! html/php
5492 <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>
5493 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5494 </p>
5495 <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>
5496 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5497 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5498 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5499 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5500 <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>
5501 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5502 </p>
5503 <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>
5504 <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>
5505 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5506 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5507 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5508 <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>
5509 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5510
5511 !! html/parsoid
5512 <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>
5513
5514 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5515 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5516 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5517 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5518 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5519 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5520 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5521
5522 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5523 <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>
5524 <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>
5525 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5526 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5527 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5528 <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>
5529 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5530 !! end
5531
5532 !! test
5533 IPv6 urls, bracketed format (T23261)
5534 !! wikitext
5535 [http://[2404:130:0:1000::187:2]/index.php test]
5536
5537 Examples from RFC 2373, section 2.2:
5538 * [http://[1080::8:800:200C:417A] unicast]
5539 * [http://[FF01::101] multicast]
5540 * [http://[::1]/ loopback]
5541 * [http://[::] unspecified]
5542 * [http://[::13.1.68.3] ipv4compat]
5543 * [http://[::FFFF:129.144.52.38] ipv4compat]
5544
5545 Examples from RFC 2732, section 2:
5546 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5547 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5548 * [http://[3ffe:2a00:100:7031::1] 3]
5549 * [http://[1080::8:800:200C:417A]/foo 4]
5550 * [http://[::192.9.5.5]/ipng 5]
5551 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5552 * [http://[2010:836B:4179::836B:4179] 7]
5553
5554 !! html/php
5555 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5556 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5557 </p>
5558 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5559 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5560 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5561 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5562 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5563 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5564 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5565 </p>
5566 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5567 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5568 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5569 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5570 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5571 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5572 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5573
5574 !! html/parsoid
5575 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5576
5577 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5578 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5579 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5580 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5581 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5582 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5583 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5584
5585 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5586 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5587 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5588 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5589 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5590 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5591 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5592 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5593 !! end
5594
5595 !! test
5596 Non-extlinks in brackets
5597 !! wikitext
5598 [foo]
5599 [foo bar]
5600 [foo ''bar'']
5601 [fool's] errand
5602 [fool's errand]
5603 [{{echo|foo}}]
5604 [{{echo|foo}} bar]
5605 [{{echo|foo}} ''bar'']
5606 [{{echo|foo}}l's] errand
5607 [{{echo|foo}}l's errand]
5608 [url={{echo|foo}}]
5609 [url=http://example.com]
5610 [http:// bare protocols don't count]
5611 !! html/php
5612 <p>[foo]
5613 [foo bar]
5614 [foo <i>bar</i>]
5615 [fool's] errand
5616 [fool's errand]
5617 [foo]
5618 [foo bar]
5619 [foo <i>bar</i>]
5620 [fool's] errand
5621 [fool's errand]
5622 [url=foo]
5623 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5624 [http:// bare protocols don't count]
5625 </p>
5626 !! html/parsoid
5627 <p>[foo]
5628 [foo bar]
5629 [foo <i>bar</i>]
5630 [fool's] errand
5631 [fool's errand]
5632 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5633 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5634 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5635 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5636 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5637 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5638 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5639 [http:// bare protocols don't count]</p>
5640 !! end
5641
5642 !! test
5643 Percent encoding in external links
5644 !! wikitext
5645 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5646 !! html/php
5647 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5648 </p>
5649 !! html/parsoid
5650 <p><a rel="mw:ExtLink"
5651 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5652 !! end
5653
5654 !! test
5655 Use url link syntax for links where the content is equal the link target
5656 !! wikitext
5657 http://example.com
5658 !! html/php
5659 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5660 </p>
5661 !! html/parsoid
5662 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5663 !! end
5664
5665 !! test
5666 Parenthesis in external links, especially URL links
5667 !! wikitext
5668 http://example.com)
5669
5670 http://example.com/test)
5671
5672 http://example.com/(test)
5673
5674 http://example.com/((test)
5675
5676 (http://example.com/(test))
5677
5678 (http://example.com/(test)))))
5679
5680 http://example.com/a)b
5681
5682 [http://example.com) foo]
5683 !! html/php
5684 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</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/((test)">http://example.com/((test)</a>
5688 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5689 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5690 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5691 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5692 </p>
5693 !! html/parsoid
5694 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</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/((test)">http://example.com/((test)</a></p>
5698 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5699 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5700 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5701 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5702 !! end
5703
5704 !! test
5705 Parenthesis in external links, w/ transclusion or comment
5706 !! wikitext
5707 (http://example.com/{{echo|hi}})
5708
5709 (http://example.com<!-- hi -->)
5710 !! html/php
5711 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5712 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5713 </p>
5714 !! html/parsoid
5715 <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>
5716
5717 <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>
5718 !! end
5719
5720 !! test
5721 Serialize <a> tags with invalid link targets as plain text
5722 !! options
5723 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5724 !! html/parsoid
5725 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5726 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5727 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5728 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5729 !! wikitext
5730 text
5731 <nowiki>*</nowiki>text
5732 <nowiki>[[foo]]</nowiki>
5733 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5734 !! end
5735
5736 !! test
5737 mw:ExtLink -vs- mw:WikiLink (T94723)
5738 !! options
5739 parsoid=html2wt
5740 !! html/parsoid
5741 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5742 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5743 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5744 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5745 <p>
5746 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5747 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5748 </p>
5749 !! wikitext
5750 [[Foo|Bar]]
5751 [[Foo|Bar]]
5752 [[wikipedia:Foo|Bar]]
5753 [[wikipedia:Foo|Bar]]
5754
5755 [[wikipedia:European_Robin|European Robin]]
5756 [[wikipedia:European_Robin|European Robin]]
5757 !! end
5758
5759 !! test
5760 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5761 !! options
5762 parsoid=wt2wt
5763 !! wikitext
5764 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5765 !! html/parsoid
5766 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5767 !! end
5768
5769
5770 ###
5771 ### Quotes
5772 ###
5773
5774 !! test
5775 Quotes
5776 !! wikitext
5777 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5778
5779 Normal text. '''''Bold italic text.''''' Normal text.
5780 !! html
5781 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5782 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5783 </p>
5784 !! end
5785
5786
5787 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5788 # parser strips. The wikitext contains just the first half of the bold
5789 # quote pair.
5790 !! test
5791 Unclosed and unmatched quotes
5792 !! wikitext
5793 '''''Bold italic text '''with bold deactivated''' in between.'''''
5794
5795 '''''Bold italic text ''with italic deactivated'' in between.'''''
5796
5797 '''Bold text..
5798
5799 ..spanning two paragraphs (should not work).'''
5800
5801 '''Bold tag left open
5802
5803 ''Italic tag left open
5804
5805 Normal text.
5806
5807 <!-- Unmatching number of opening, closing tags: -->
5808 '''This year''''s election ''should'' beat '''last year''''s.
5809
5810 ''Tom'''s car is bigger than ''Susan'''s.
5811
5812 Plain ''italic'''s plain
5813 !! html/php
5814 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5815 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5816 </p><p><b>Bold text..</b>
5817 </p><p>..spanning two paragraphs (should not work).
5818 </p><p><b>Bold tag left open</b>
5819 </p><p><i>Italic tag left open</i>
5820 </p><p>Normal text.
5821 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5822 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5823 </p><p>Plain <i>italic'</i>s plain
5824 </p>
5825 !! html/parsoid
5826 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5827 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5828 </p><p><b>Bold text..</b>
5829 </p><p>..spanning two paragraphs (should not work).<b></b>
5830 </p><p><b>Bold tag left open</b>
5831 </p><p><i>Italic tag left open</i>
5832 </p><p>Normal text.
5833 </p>
5834 <!-- Unmatching number of opening, closing tags: -->
5835 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5836 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5837 </p><p>Plain <i>italic'</i>s plain
5838 </p>
5839 !! end
5840
5841 ###
5842 ### Tables
5843 ###
5844 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5845 ###
5846
5847 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5848 # is the bare minimum required by the spec, see:
5849 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5850 # Parsoid team replies: empty table tags are legal in HTML5
5851 !! test
5852 A table with no data.
5853 !! options
5854 parsoid=wt2html
5855 !! wikitext
5856 {||}
5857 !! html/php
5858
5859 !! html/parsoid
5860 <table></table>
5861
5862 !! end
5863
5864 !! test
5865 A table with stray table end tags on start tag line (wt2html)
5866 !! options
5867 parsoid=wt2html
5868 !! wikitext
5869 {|style="color: red;"|}
5870
5871 {|style="color: red;" |}
5872 |foo
5873 |}
5874
5875 {|style="color: red;"|} id="foo"
5876 |foo
5877 |}
5878
5879 {|style="color: red;" |} id="foo"
5880 |foo
5881 |}
5882 !! html
5883 <table style="color: red;"></table>
5884
5885 <table style="color: red;">
5886 <tbody><tr>
5887 <td>foo</td>
5888 </tr></tbody>
5889 </table>
5890
5891 <table style="color: red;" id="foo">
5892 <tbody><tr>
5893 <td>foo</td>
5894 </tr></tbody>
5895 </table>
5896
5897 <table style="color: red;" id="foo">
5898 <tbody><tr>
5899 <td>foo</td>
5900 </tr></tbody>
5901 </table>
5902
5903 !! end
5904
5905 !! test
5906 A table with no data (take 2)
5907 !! wikitext
5908 {|
5909 |}
5910 !! html/parsoid
5911 <table></table>
5912 !! end
5913
5914 # A table with nothing but a caption is invalid XHTML, we might want to render
5915 # this as <p>caption</p>
5916 # Parsoid team replies: table with only a caption is legal in HTML5
5917 !! test
5918 A table with nothing but a caption
5919 !! wikitext
5920 {|
5921 |+ caption
5922 |}
5923 !! html/php
5924 <table>
5925 <caption> caption
5926 </caption><tr><td></td></tr></table>
5927
5928 !! html/parsoid
5929 <table><caption> caption</caption></table>
5930 !! end
5931
5932 !! test
5933 A table with caption with default-spaced attributes and a table row
5934 !! wikitext
5935 {|
5936 |+ style="color: red;" | caption1
5937 |-
5938 | foo
5939 |}
5940 !! html
5941 <table>
5942 <caption style="color: red;"> caption1
5943 </caption>
5944 <tr>
5945 <td> foo
5946 </td></tr></table>
5947
5948 !! end
5949
5950 !! test
5951 A table with captions with non-default spaced attributes and a table row
5952 !! wikitext
5953 {|
5954 |+style="color: red;"|caption2
5955 |+ style="color: red;"| caption3
5956 |-
5957 | foo
5958 |}
5959 !! html
5960 <table>
5961 <caption style="color: red;">caption2
5962 </caption>
5963 <caption style="color: red;"> caption3
5964 </caption>
5965 <tr>
5966 <td> foo
5967 </td></tr></table>
5968
5969 !! end
5970
5971 !! test
5972 Table td-cell syntax variations
5973 !! wikitext
5974 {|
5975 | foo bar foo | baz
5976 | foo bar foo || baz
5977 | style='color:red;' | baz
5978 | style='color:red;' || baz
5979 |}
5980 !! html
5981 <table>
5982 <tr>
5983 <td> baz
5984 </td>
5985 <td> foo bar foo </td>
5986 <td> baz
5987 </td>
5988 <td style="color:red;"> baz
5989 </td>
5990 <td> style='color:red;' </td>
5991 <td> baz
5992 </td></tr></table>
5993
5994 !! end
5995
5996 !! test
5997 Simple table
5998 !! wikitext
5999 {|
6000 | 1 || 2
6001 |-
6002 | 3 || 4
6003 |}
6004 !! html
6005 <table>
6006 <tr>
6007 <td> 1 </td>
6008 <td> 2
6009 </td></tr>
6010 <tr>
6011 <td> 3 </td>
6012 <td> 4
6013 </td></tr></table>
6014
6015 !! end
6016
6017 !! test
6018 Simple table but with multiple dashes for row wikitext
6019 !! wikitext
6020 {|
6021 | foo
6022 |-----
6023 | bar
6024 |}
6025 !! html
6026 <table>
6027 <tr>
6028 <td> foo
6029 </td></tr>
6030 <tr>
6031 <td> bar
6032 </td></tr></table>
6033
6034 !! end
6035
6036 !! test
6037 Multiplication table
6038 !! wikitext
6039 {| border="1" cellpadding="2"
6040 |+Multiplication table
6041 |-
6042 ! &times; !! 1 !! 2 !! 3
6043 |-
6044 ! 1
6045 | 1 || 2 || 3
6046 |-
6047 ! 2
6048 | 2 || 4 || 6
6049 |-
6050 ! 3
6051 | 3 || 6 || 9
6052 |-
6053 ! 4
6054 | 4 || 8 || 12
6055 |-
6056 ! 5
6057 | 5 || 10 || 15
6058 |}
6059 !! html
6060 <table border="1" cellpadding="2">
6061 <caption>Multiplication table
6062 </caption>
6063 <tr>
6064 <th> &#215; </th>
6065 <th> 1 </th>
6066 <th> 2 </th>
6067 <th> 3
6068 </th></tr>
6069 <tr>
6070 <th> 1
6071 </th>
6072 <td> 1 </td>
6073 <td> 2 </td>
6074 <td> 3
6075 </td></tr>
6076 <tr>
6077 <th> 2
6078 </th>
6079 <td> 2 </td>
6080 <td> 4 </td>
6081 <td> 6
6082 </td></tr>
6083 <tr>
6084 <th> 3
6085 </th>
6086 <td> 3 </td>
6087 <td> 6 </td>
6088 <td> 9
6089 </td></tr>
6090 <tr>
6091 <th> 4
6092 </th>
6093 <td> 4 </td>
6094 <td> 8 </td>
6095 <td> 12
6096 </td></tr>
6097 <tr>
6098 <th> 5
6099 </th>
6100 <td> 5 </td>
6101 <td> 10 </td>
6102 <td> 15
6103 </td></tr></table>
6104
6105 !! end
6106
6107 !! test
6108 Accept "||" in table headings
6109 !! wikitext
6110 {|
6111 !h1 || h2
6112 |}
6113 !! html
6114 <table>
6115 <tr>
6116 <th>h1 </th>
6117 <th> h2
6118 </th></tr></table>
6119
6120 !! end
6121
6122 !! test
6123 Accept "!!" in table data
6124 !! wikitext
6125 {|
6126 | Foo!! ||
6127 |}
6128 !! html
6129 <table>
6130 <tr>
6131 <td> Foo!! </td>
6132 <td>
6133 </td></tr></table>
6134
6135 !! html/parsoid
6136 <table>
6137 <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>
6138 </tbody></table>
6139 !! end
6140
6141 !! test
6142 Accept "||" in indented table headings
6143 !! wikitext
6144 :{|
6145 !h1 || h2
6146 |}
6147 !! html
6148 <dl><dd><table>
6149 <tr>
6150 <th>h1 </th>
6151 <th> h2
6152 </th></tr></table></dd></dl>
6153
6154 !! end
6155
6156 !! test
6157 Accept "!!" in templates
6158 !! wikitext
6159 {|
6160 !a {{echo|b!!c}}
6161 |}
6162 !! html/php
6163 <table>
6164 <tr>
6165 <th>a b</th>
6166 <th>c
6167 </th></tr></table>
6168
6169 !! html/parsoid
6170 <table>
6171 <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>
6172 !! end
6173
6174 !! test
6175 Accept "!!" in table headings after newline
6176 !! wikitext
6177 {|
6178 !a
6179 b!!c
6180 |}
6181 !! html/php
6182 <table>
6183 <tr>
6184 <th>a
6185 <p>b!!c
6186 </p>
6187 </th></tr></table>
6188
6189 !! html/parsoid
6190 <table>
6191 <tbody><tr><th>a
6192 <p>b!!c</p></th></tr>
6193 </tbody></table>
6194 !! end
6195
6196 !! test
6197 Accept "!!" in table data of mixed wikitext / html syntax
6198 !! wikitext
6199 {|
6200 !a
6201 <tr><td>b!!c</td></tr>
6202 |}
6203 !! html+tidy
6204 <table>
6205 <tr>
6206 <th>a</th>
6207 </tr>
6208 <tr>
6209 <td>b!!c</td>
6210 </tr>
6211 </table>
6212 !! html/parsoid
6213 <table>
6214 <tbody><tr><th>a</th></tr>
6215 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6216 </tbody></table>
6217 !! end
6218
6219 !! test
6220 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6221 !! wikitext
6222 {|
6223 !| h1
6224 || a
6225 |}
6226 !! html
6227 <table>
6228 <tr>
6229 <th> h1
6230 </th>
6231 <td> a
6232 </td></tr></table>
6233
6234 !! end
6235
6236 !!test
6237 Accept "| !" at start of line in tables (ignore !-attribute)
6238 !! wikitext
6239 {|
6240 |-
6241 | !style="color:red" | bar
6242 |}
6243 !! html
6244 <table>
6245
6246 <tr>
6247 <td> bar
6248 </td></tr></table>
6249
6250 !!end
6251
6252 !!test
6253 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 +/-
6254 !! wikitext
6255 {|
6256 |-
6257 |style='color:red;'|+1
6258 |style='color:blue;'|-1
6259 |-
6260 | 1 || 2 || 3
6261 | 1 ||+2 ||-3
6262 |-
6263 | +1
6264 | -1
6265 |}
6266 !! html
6267 <table>
6268
6269 <tr>
6270 <td style="color:red;">+1
6271 </td>
6272 <td style="color:blue;">-1
6273 </td></tr>
6274 <tr>
6275 <td> 1 </td>
6276 <td> 2 </td>
6277 <td> 3
6278 </td>
6279 <td> 1 </td>
6280 <td>+2 </td>
6281 <td>-3
6282 </td></tr>
6283 <tr>
6284 <td> +1
6285 </td>
6286 <td> -1
6287 </td></tr></table>
6288
6289 !!end
6290
6291 !! test
6292 Table rowspan
6293 !! wikitext
6294 {| border=1
6295 | Cell 1, row 1
6296 |rowspan=2| Cell 2, row 1 (and 2)
6297 | Cell 3, row 1
6298 |-
6299 | Cell 1, row 2
6300 | Cell 3, row 2
6301 |}
6302 !! html
6303 <table border="1">
6304 <tr>
6305 <td> Cell 1, row 1
6306 </td>
6307 <td rowspan="2"> Cell 2, row 1 (and 2)
6308 </td>
6309 <td> Cell 3, row 1
6310 </td></tr>
6311 <tr>
6312 <td> Cell 1, row 2
6313 </td>
6314 <td> Cell 3, row 2
6315 </td></tr></table>
6316
6317 !! end
6318
6319 !! test
6320 Nested table
6321 !! wikitext
6322 {| border=1
6323 | &alpha;
6324 |
6325 {| bgcolor=#ABCDEF border=2
6326 |nested
6327 |-
6328 |table
6329 |}
6330 |the original table again
6331 |}
6332 !! html
6333 <table border="1">
6334 <tr>
6335 <td> &#945;
6336 </td>
6337 <td>
6338 <table bgcolor="#ABCDEF" border="2">
6339 <tr>
6340 <td>nested
6341 </td></tr>
6342 <tr>
6343 <td>table
6344 </td></tr></table>
6345 </td>
6346 <td>the original table again
6347 </td></tr></table>
6348
6349 !! end
6350
6351 !! test
6352 Invalid attributes in table cell (bug 1830)
6353 !! wikitext
6354 {|
6355 |Cell:|broken
6356 |}
6357 !! html
6358 <table>
6359 <tr>
6360 <td>broken
6361 </td></tr></table>
6362
6363 !! end
6364
6365 !! test
6366 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6367 !! wikitext
6368 {|
6369 | title="foo" |bar
6370 | title="foo<nowiki>|</nowiki>" |bar
6371 | title="foo<nowiki>|</nowiki>" bar
6372 |}
6373 !! html/php
6374 <table>
6375 <tr>
6376 <td title="foo">bar
6377 </td>
6378 <td title="foo&#124;">bar
6379 </td>
6380 <td> title="foo|" bar
6381 </td></tr></table>
6382
6383 !! html/parsoid
6384 <table>
6385 <tbody><tr><td title="foo">bar</td>
6386 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6387 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6388 </tbody></table>
6389 !! end
6390
6391 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6392 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6393 # *2wt modes will fail.
6394 !! test
6395 Table security: embedded pipes
6396 !! options
6397 parsoid=wt2html,html2html
6398 !! wikitext
6399 {|
6400 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6401 !! html/php
6402 <table>
6403 <tr>
6404 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6405 <td>]" onmouseover="alert(document.cookie)"&gt;test
6406 </td>
6407 </tr>
6408 </table>
6409
6410 !! html/parsoid
6411 <table><tbody>
6412 <tr>
6413 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'>[<a rel="mw:ExtLink" href="ftp://%7Cx" data-parsoid='{"stx":"url","a":{"href":"ftp://%7Cx"},"sa":{"href":"ftp://|x"}}'>ftp://%7Cx</a></td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'>]" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6414 !! end
6415
6416 !! test
6417 Element attributes with double ! should not be broken up by <th>
6418 !! wikitext
6419 {|
6420 ! hi <div class="!!">ha</div> ho
6421 |}
6422 !! html/php
6423 <table>
6424 <tr>
6425 <th> hi <div class="!!">ha</div> ho
6426 </th></tr></table>
6427
6428 !! html/parsoid
6429 <table>
6430 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6431 </tbody></table>
6432 !! end
6433
6434 !! test
6435 ! and || in element attributes should not be parsed as <th>/<td>
6436 !! wikitext
6437 {|
6438 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6439 |}
6440 !! html/php
6441 <table>
6442 <tr>
6443 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6444 </td></tr></table>
6445
6446 !! html/parsoid
6447 <table>
6448 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6449 </tbody></table>
6450 !! end
6451
6452 # FIXME: The output seems broken. Filed as T110268.
6453 !! test
6454 ! and || in td attributes should not be parsed as <th>/<td>
6455 !! options
6456 parsoid=wt2html
6457 !! wikitext
6458 {|
6459 | style="color: red !important;" data-contrived="put this here ||" | foo
6460 |}
6461 !! html/php
6462 <table>
6463 <tr>
6464 <td> style="color: red !important;" data-contrived="put this here </td>
6465 <td> foo
6466 </td></tr></table>
6467
6468 !! html/parsoid
6469 <table>
6470 <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>
6471 </tbody></table>
6472 !! end
6473
6474 !! test
6475 Break on | in element attribute in template
6476 !! options
6477 parsoid=wt2html,html2html
6478 !! wikitext
6479 {{echo|1=<div class="hi|ho">ha</div>}}
6480 !! html/php
6481 <p>ho"&gt;ha&lt;/div&gt;
6482 </p>
6483 !! html/parsoid
6484 <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>
6485 !! end
6486
6487 !! test
6488 Break on | in element attribute name in template
6489 !! wikitext
6490 {{echo|<div cla|ss="hiho">ha</div>}}
6491 !! html/parsoid
6492 <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>
6493 !! end
6494
6495 !! test
6496 Don't break on | in extension attribute in template
6497 !! wikitext
6498 {{echo|<ref name="hi|ho">ha</ref>}}
6499
6500 <references />
6501 !! html/parsoid
6502 <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>
6503
6504 <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>
6505 !! end
6506
6507 ## We don't support roundtripping of these attributes in Parsoid.
6508 ## Selective serialization takes care of preventing dirty diffs.
6509 ## But, on edits, we dirty-diff the invalid attribute text.
6510 !! test
6511 Invalid text in table attributes should be discarded
6512 !! options
6513 parsoid=wt2html
6514 !! wikitext
6515 {| <span>boo</span> style='border:1px solid black'
6516 | <span>boo</span> style='color:blue' | 1
6517 |<span>boo</span> style='color:blue'| 2
6518 |}
6519 !! html/php
6520 <table style="border:1px solid black">
6521 <tr>
6522 <td style="color:blue"> 1
6523 </td>
6524 <td style="color:blue"> 2
6525 </td></tr></table>
6526
6527 !! html/parsoid
6528 <table style="border:1px solid black">
6529 <tr>
6530 <td style="color:blue"> 1</td>
6531 <td style="color:blue"> 2</td>
6532 </tr>
6533 </table>
6534 !! end
6535
6536 !! test
6537 Invalid text in table attributes should be preserved by selective serializer
6538 !! options
6539 parsoid={
6540 "modes": ["selser"],
6541 "changes": [
6542 ["td:first-child", "text", "abc"],
6543 ["td + td", "text", "xyz"]
6544 ]
6545 }
6546 !! wikitext
6547 {| <span>boo</span> style='border:1px solid black'
6548 | <span>boo</span> style='color:blue' | 1
6549 |<span>boo</span> style='color:blue'| 2
6550 |}
6551 !! wikitext/edited
6552 {| <span>boo</span> style='border:1px solid black'
6553 | <span>boo</span> style='color:blue' |abc
6554 |<span>boo</span> style='color:blue'|xyz
6555 |}
6556 !! end
6557
6558 !! test
6559 1. Template-generated table cell attributes and cell content
6560 !! wikitext
6561 {|
6562 |{{table_attribs}}
6563 | {{table_attribs}}
6564 || {{table_attribs_5}}
6565 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6566 |align=center {{table_attribs}}
6567 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6568 |}
6569 !! html
6570 <table>
6571 <tr>
6572 <td style="color:red;">Foo
6573 </td>
6574 <td style="color:red;">Foo
6575 </td>
6576 <td> style="color:red;"</td>
6577 <td>Bar
6578 </td>
6579 <td style="color:red;">Foo
6580 </td>
6581 <td align="center" style="color:red;">Foo
6582 </td>
6583 <td align="center" style="color:red;">Foo
6584 </td></tr></table>
6585
6586 !! end
6587
6588 !! test
6589 2. Template-generated table cell attributes and cell content
6590 !! wikitext
6591 {|
6592 |{{table_attribs_2}}
6593 |}
6594 !! html/php
6595 <table>
6596 <tr>
6597 <td style="color:red;">Foo
6598 </td>
6599 <td>Bar</td>
6600 <td>Baz
6601 </td></tr></table>
6602
6603 !! html/parsoid
6604 <table>
6605 <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>
6606 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6607 </tbody></table>
6608 !! end
6609
6610 !! test
6611 3. Template-generated table cell attributes and cell content
6612 !! wikitext
6613 {|
6614 !align=center {{table_header_cells}}
6615 |-
6616 |align=center {{table_cells}}
6617 |}
6618 !! html/php
6619 <table>
6620 <tr>
6621 <th align="center" style="color:red;">Foo</th>
6622 <th style="color:red;"><i>Bar</i></th>
6623 <th style="color:brown;"><i>Foo</i> and Baz
6624 </th></tr>
6625 <tr>
6626 <td align="center" style="color:red;">Foo</td>
6627 <td style="color:red;"><i>Bar</i></td>
6628 <td style="color:brown;"><i>Foo</i> and Baz
6629 </td></tr></table>
6630
6631 !! html/parsoid
6632 <table>
6633 <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>
6634 <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>
6635 </tbody></table>
6636 !! end
6637
6638 !! test
6639 4. Template-generated table cell attributes and cell content inside a templated table
6640 !! wikitext
6641 {{tbl-start}}
6642 !align=center {{table_header_cells}}
6643 |-
6644 |align=center {{table_cells}}
6645 {{tbl-end}}
6646 !! html/php
6647 <table>
6648 <tr>
6649 <th align="center" style="color:red;">Foo</th>
6650 <th style="color:red;"><i>Bar</i></th>
6651 <th style="color:brown;"><i>Foo</i> and Baz
6652 </th></tr>
6653 <tr>
6654 <td align="center" style="color:red;">Foo</td>
6655 <td style="color:red;"><i>Bar</i></td>
6656 <td style="color:brown;"><i>Foo</i> and Baz
6657 </td></tr></table>
6658
6659 !! html/parsoid
6660 <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}}]}'>
6661 <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>
6662 <tr>
6663 <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>
6664 </tbody></table>
6665 !! end
6666
6667 ## Edge case fix to prevent future regressions
6668 !! test
6669 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6670 !! wikitext
6671 {|
6672 |{{table_attribs_7}}
6673 |}
6674 <references />
6675 !! html/parsoid
6676 <table>
6677 <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>
6678 </tbody></table>
6679 <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>
6680 !! end
6681
6682 !! test
6683 Table with row followed by newlines and table heading
6684 !! options
6685 parsoid=wt2html,html2html
6686 !! wikitext
6687 {|
6688 |-
6689
6690 ! foo
6691 |}
6692 !! html/*
6693 <table>
6694
6695
6696 <tr>
6697 <th> foo
6698 </th></tr></table>
6699
6700 !! end
6701
6702 !! test
6703 Table with empty line following the start tag
6704 !! options
6705 parsoid=wt2html,html2html
6706 !! wikitext
6707 {|
6708
6709 |-
6710 | foo
6711 |}
6712 !! html/*
6713 <table>
6714
6715
6716 <tr>
6717 <td> foo
6718 </td></tr></table>
6719
6720 !! end
6721
6722 !! test
6723 Table attributes with empty value
6724 !! options
6725 parsoid=wt2html,html2html
6726 !! wikitext
6727 {|
6728 | style=| hello
6729 |}
6730 !! html/php
6731 <table>
6732 <tr>
6733 <td style=""> hello
6734 </td></tr></table>
6735
6736 !! html/parsoid
6737 <table>
6738 <tbody><tr><td style=""> hello</td></tr>
6739 </tbody></table>
6740 !! end
6741
6742 !! test
6743 Wikitext table with a lot of comments
6744 !! wikitext
6745 {|
6746 <!-- c0 -->
6747 | foo
6748 <!-- c1 -->
6749 |-<!-- c2 -->
6750 <!-- c3 -->
6751 |<!-- c4 -->
6752 <!-- c5 -->
6753 |}
6754 !! html
6755 <table>
6756 <tr>
6757 <td> foo
6758 </td></tr>
6759 <tr>
6760 <td>
6761 </td></tr></table>
6762
6763 !! end
6764
6765 !! test
6766 Wikitext table comments represented in parsoid dom
6767 !! wikitext
6768 {|<!--c1--><!--c2-->
6769 |-<!--c3-->
6770 | x
6771 |}
6772 !! html/php+tidy
6773 <table>
6774 <tr>
6775 <td>x</td>
6776 </tr>
6777 </table>
6778 !! html/parsoid
6779 <table><!--c1--><!--c2-->
6780 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6781 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6782 </tbody></table>
6783 !! end
6784
6785 !! test
6786 Wikitext table with double-line table cell
6787 !! wikitext
6788 {|
6789 |a
6790 b
6791 |}
6792 !! html
6793 <table>
6794 <tr>
6795 <td>a
6796 <p>b
6797 </p>
6798 </td></tr></table>
6799
6800 !! end
6801
6802 !! test
6803 Table cell with a single comment
6804 !! wikitext
6805 {|
6806 | <!-- c1 -->
6807 | a
6808 |}
6809 !! html
6810 <table>
6811 <tr>
6812 <td>
6813 </td>
6814 <td> a
6815 </td></tr></table>
6816
6817 !! end
6818
6819 !! test
6820 Table-cell after a comment-only-empty-line
6821 !! wikitext
6822 {|
6823 |a
6824 <!--c1-->
6825 <!--c2-->| b
6826 |}
6827 !! html
6828 <table>
6829 <tr>
6830 <td>a
6831 </td>
6832 <td> b
6833 </td></tr></table>
6834
6835 !! html/parsoid
6836 <table>
6837 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6838 <!--c1-->
6839 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6840 </tbody></table>
6841
6842 !! end
6843
6844 !! test
6845 Build table with {{!}}
6846 !! wikitext
6847 {{{!}} class="wikitable"
6848 ! header
6849 ! second header
6850 {{!}}- style="color:red;"
6851 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6852 {{!}}}
6853 !! html
6854 <table class="wikitable">
6855 <tr>
6856 <th> header
6857 </th>
6858 <th> second header
6859 </th></tr>
6860 <tr style="color:red;">
6861 <td> data </td>
6862 <td style="color:red;"> second data
6863 </td></tr></table>
6864
6865 !! end
6866
6867 !! test
6868 Build table with pipe as data
6869 !! wikitext
6870 {| class="wikitable"
6871 ! header
6872 ! second header
6873 |- style="color:red;"
6874 | data || style="color:red;" | second data
6875 |-
6876 | style="color:red;" | data with | || style="color:red;" | second data with |
6877 |-
6878 || data with | ||| second data with |
6879 |}
6880 !! html
6881 <table class="wikitable">
6882 <tr>
6883 <th> header
6884 </th>
6885 <th> second header
6886 </th></tr>
6887 <tr style="color:red;">
6888 <td> data </td>
6889 <td style="color:red;"> second data
6890 </td></tr>
6891 <tr>
6892 <td style="color:red;"> data with | </td>
6893 <td style="color:red;"> second data with |
6894 </td></tr>
6895 <tr>
6896 <td> data with | </td>
6897 <td> second data with |
6898 </td></tr></table>
6899
6900 !! end
6901
6902 !! test
6903 Build table with wikilink
6904 !! wikitext
6905 {| class="wikitable"
6906 ! header || second header
6907 |- style="color:red;"
6908 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6909 |-
6910 | data || second data [[Main Page|link|text with pipe]]
6911 |}
6912 !! html
6913 <table class="wikitable">
6914 <tr>
6915 <th> header </th>
6916 <th> second header
6917 </th></tr>
6918 <tr style="color:red;">
6919 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6920 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6921 </td></tr>
6922 <tr>
6923 <td> data </td>
6924 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6925 </td></tr></table>
6926
6927 !! end
6928
6929 # The expected HTML structure in this test is debatable. The PHP parser does
6930 # not parse this kind of table at all. The main focus for Parsoid is on
6931 # round-tripping, so this output is ok for now. TODO: revisit!
6932 !! test
6933 Wikitext table with html-syntax row
6934 !! wikitext
6935 {|
6936 |-
6937 <td>foo</td>
6938 |}
6939 !! html/parsoid
6940 <table>
6941 <tbody>
6942 <tr>
6943 <td>foo</td></tr></tbody></table>
6944 !! end
6945
6946 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6947 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6948 ## PHP parser, which tidy then compounds by fostering the content
6949 ## entirely out of the table. Parsoid recognizes the table context
6950 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6951 ## depends on PHP's treatment of broken table markup!
6952 !! test
6953 Implicit <td> after a |-
6954 !! options
6955 parsoid=wt2html,html2html
6956 !! wikitext
6957 {|
6958 |-
6959 a
6960 |}
6961 !! html/php
6962 <table>
6963
6964 a
6965 </table>
6966
6967 !! html/php+tidy
6968 <p>a</p>
6969 !! html/parsoid
6970 <table>
6971 <tr><td>a</td></tr>
6972 </table>
6973 !! end
6974
6975 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6976 !! test
6977 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6978 !! options
6979 parsoid=wt2html,html2html
6980 !! wikitext
6981 {|
6982 |-
6983 |
6984 a
6985 |-
6986 b
6987 |}
6988 !! html/php
6989 <table>
6990
6991 <tr>
6992 <td>
6993 <pre>a
6994 </pre>
6995 </td></tr>
6996 b
6997 </table>
6998
6999 !! html/php+tidy
7000 <p>b</p>
7001 <table>
7002 <tr>
7003 <td>
7004 <pre>
7005 a
7006 </pre></td>
7007 </tr>
7008 </table>
7009 !! html/parsoid
7010 <table>
7011 <tbody>
7012 <tr><td><pre>a</pre></td></tr>
7013 <tr><td> b</td></tr>
7014 </tbody>
7015 </table>
7016 !! end
7017
7018 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
7019 # Parsoid generates the missing <td>, so wt2wt won't succeed.
7020 !! test
7021 Lists should be recognized in an implicit <td> context
7022 !! options
7023 parsoid=wt2html,html2html
7024 !! wikitext
7025 {|
7026 |-
7027 *a
7028 |}
7029 !! html/php
7030 <table>
7031
7032 <ul><li>a</li></ul>
7033 </table>
7034
7035 !! html/php+tidy
7036 <ul>
7037 <li>a</li>
7038 </ul>
7039 !! html/parsoid
7040 <table>
7041 <tr>
7042 <td><ul>
7043 <li>a</li>
7044 </ul></td>
7045 </tr>
7046 </table>
7047 !! end
7048
7049 !! test
7050 Table cells not properly parsed in an implicit-td context
7051 !! wikitext
7052 {|
7053 |-
7054 {{table_attribs_4}} || a || b
7055 |}
7056 !! html/php+tidy
7057 <table>
7058 <tr>
7059 <td style="background-color:#DC241f;" width="10px"></td>
7060 <td>a</td>
7061 <td>b</td>
7062 </tr>
7063 </table>
7064 !! html/parsoid
7065 <table>
7066 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7067 <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>
7068 </tbody></table>
7069 !! end
7070
7071 !! test
7072 Parsoid: Round-trip tables directly followed by content (bug 51219)
7073 !! options
7074 parsoid=wt2html,wt2wt
7075 !! wikitext
7076 {|
7077 |foo
7078 |} bar
7079
7080 {|
7081 |baz
7082 |}<b>quux</b>
7083 !! html+tidy
7084 <table>
7085 <tr>
7086 <td>foo</td>
7087 </tr>
7088 </table>
7089 <p>bar</p>
7090 <table>
7091 <tr>
7092 <td>baz</td>
7093 </tr>
7094 </table>
7095 <p><b>quux</b></p>
7096 !! end
7097
7098 !! test
7099 Parsoid: Default to a newline after tables in new content (bug 51219)
7100 !! options
7101 parsoid=html2wt
7102 !! html/parsoid
7103 <table><tbody>
7104 <tr><td>foo</td></tr></tbody></table> bar
7105 <table><tbody>
7106 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7107 !! wikitext
7108 {|
7109 |foo
7110 |}
7111 <nowiki> </nowiki>bar
7112 {|
7113 |baz
7114 |}
7115 '''quux'''
7116 !! end
7117
7118 !! test
7119 Parsoid: newline inducing block nodes don't suppress <nowiki>
7120 !! options
7121 parsoid=html2wt
7122 !! html/parsoid
7123 a<h1>foo</h1>
7124 !! wikitext
7125 <nowiki> </nowiki>a
7126
7127 = foo =
7128 !! end
7129
7130 !! test
7131 Parsoid: Row-syntax table headings followed by comment & table cells
7132 !! options
7133 parsoid=wt2html,wt2wt
7134 !! wikitext
7135 {|
7136 ! foo || bar
7137 <!-- foo --> || baz || quux
7138 |}
7139 !! html/php
7140 <table>
7141 <tr>
7142 <th> foo </th>
7143 <th> bar
7144 </th>
7145 <td> baz </td>
7146 <td> quux
7147 </td></tr></table>
7148
7149 !! html/parsoid
7150 <table>
7151 <tbody><tr><th> foo </th><th> bar
7152 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7153 </tbody></table>
7154 !! end
7155
7156 !!test
7157 Parsoid: Recover better from broken table attributes
7158 !!options
7159 parsoid=wt2html
7160 !!wikitext
7161 {| class="foo
7162 | class="bar" |
7163 foo
7164 |}
7165 !!html/php+tidy
7166 <table class="foo">
7167 <tr>
7168 <td class="bar">
7169 <p>foo</p>
7170 </td>
7171 </tr>
7172 </table>
7173 !!html/parsoid
7174 <table class="foo">
7175 <tr>
7176 <td class="bar">
7177 <p>foo</p></td></tr>
7178 </tbody></table>
7179 !!end
7180
7181 !! test
7182 Tables: Digest broken attributes on table and tr tag
7183 !! options
7184 parsoid=wt2html
7185 !! wikitext
7186 {| || |} ++
7187 |- || || ++ --
7188 |- > [
7189 |}
7190 !! html
7191 <table>
7192 <tbody>
7193 <tr></tr>
7194 <tr></tr>
7195 </tbody></table>
7196 !! end
7197
7198 # T137406: Whitespace in the HTML
7199 !! test
7200 1. Generate correct wikitext for tables with thead/tbody/tfoot
7201 !! options
7202 parsoid=html2wt
7203 !! html/parsoid
7204 <table>
7205 <caption>Test</caption>
7206 <thead>
7207 <tr>
7208 <th>Month</th>
7209 <th>Savings</th>
7210 </tr>
7211 </thead>
7212 <tbody>
7213 <tr>
7214 <td>January</td>
7215 <td>$100</td>
7216 </tr>
7217 <tr>
7218 <td>February</td>
7219 <td>$80</td>
7220 </tr>
7221 </tbody>
7222 <tfoot>
7223 <tr>
7224 <td>Sum</td>
7225 <td>$180</td>
7226 </tr>
7227 </tfoot>
7228 </table>
7229 !! wikitext
7230 {|
7231 |+Test
7232 !Month
7233 !Savings
7234 |-
7235 |January
7236 |$100
7237 |-
7238 |February
7239 |$80
7240 |-
7241 |Sum
7242 |$180
7243 |}
7244 !! html/php+tidy
7245 <table>
7246 <caption>Test</caption>
7247 <tr>
7248 <th>Month</th>
7249 <th>Savings</th>
7250 </tr>
7251 <tr>
7252 <td>January</td>
7253 <td>$100</td>
7254 </tr>
7255 <tr>
7256 <td>February</td>
7257 <td>$80</td>
7258 </tr>
7259 <tr>
7260 <td>Sum</td>
7261 <td>$180</td>
7262 </tr>
7263 </table>
7264 !! end
7265
7266 # T137406: No whitespace in the HTML
7267 !! test
7268 2. Generate correct wikitext for tables with thead/tbody/tfoot
7269 !! options
7270 parsoid=html2wt
7271 !! html/parsoid
7272 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7273 !! wikitext
7274 {|
7275 !heading
7276 |-
7277 |foo
7278 |}
7279 !! end
7280
7281 !! test
7282 Testing serialization after deletion in references
7283 !! options
7284 parsoid={
7285 "modes": ["wt2wt"],
7286 "changes": [
7287 ["#x", "remove"]
7288 ]
7289 }
7290 !! wikitext
7291 hi <ref><div id="x">ho</div></ref>
7292
7293 <references />
7294 !! wikitext/edited
7295 hi <ref></ref>
7296
7297 <references />
7298 !! end
7299
7300 !!test
7301 Testing serialization after deletion of table cells
7302 !!options
7303 parsoid={
7304 "modes": ["wt2wt", "selser"],
7305 "changes": [
7306 ["#x", "remove"]
7307 ]
7308 }
7309 !!wikitext
7310 {|
7311 !h1 !!h2 !!h3
7312 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7313 |}
7314 !! wikitext/edited
7315 {|
7316 !h1 !!h2 !!h3
7317 |c2 |||c3
7318 |}
7319 !!end
7320
7321 !! test
7322 Testing selser after addition of new row before first row (T125419)
7323 !! options
7324 parsoid={
7325 "modes": ["wt2wt", "selser"],
7326 "changes": [
7327 [ "tr", "before", "<tr><td>X</td></tr>" ]
7328 ]
7329 }
7330 !! wikitext
7331 {|
7332 |a
7333 |}
7334 !! wikitext/edited
7335 {|
7336 |X
7337 |-
7338 |a
7339 |}
7340 !! end
7341
7342 !! test
7343 Serialize new table rows in a HTML table using HTML tags
7344 !! options
7345 parsoid={
7346 "modes": ["wt2wt", "selser"],
7347 "changes": [
7348 [ "tr", "before", "<tr><td>X</td></tr>" ]
7349 ]
7350 }
7351 !! wikitext
7352 <table><tr><td>a</td></tr></table>
7353 !! wikitext/edited
7354 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7355 !! end
7356
7357 !! test
7358 Serialize new table cells in a HTML row using HTML tags
7359 !! options
7360 parsoid={
7361 "modes": ["wt2wt", "selser"],
7362 "changes": [
7363 [ "td", "before", "<td>X</td>" ]
7364 ]
7365 }
7366 !! wikitext
7367 <table><tr><td>a</td></tr></table>
7368 !! wikitext/edited
7369 <table><tr><td>X</td><td>a</td></tr></table>
7370 !! end
7371
7372 !! test
7373 Wikitext tables can be nested inside HTML tables
7374 !! options
7375 parsoid=html2wt
7376 !! html
7377 <table data-parsoid='{"stx":"html"}'>
7378 <tr><td>
7379 <table>
7380 <tr><td>foo</td></tr>
7381 </table>
7382 </td></tr>
7383 </table>
7384 !! wikitext
7385 <table>
7386 <tr><td>
7387 {|
7388 |foo
7389 |}
7390 </td></tr>
7391 </table>
7392 !! end
7393
7394 !! test
7395 Serialize wikitext list items as HTML list items when embedded in a HTML list
7396 !! options
7397 parsoid=html2wt
7398 !! html
7399 <ul data-parsoid='{"stx": "html"}'>
7400 <li data-parsoid='{}'>a</li>
7401 <li>b</li>
7402 </ul>
7403 !! wikitext
7404 <ul>
7405 <li>a</li>
7406 <li>b</li>
7407 </ul>
7408 !! end
7409
7410 # SSS FIXME: Is this actually a good thing given the
7411 # odd nested list output that is generated by MW?
7412 # <ul><li>foo<ul>..</ul></li></ul> instead of
7413 # <ul><li>foo</li><ul>..</ul></ul>
7414 !! test
7415 Wikitext lists can be nested inside HTML lists
7416 !! options
7417 parsoid=html2wt
7418 !! html
7419 <ul data-parsoid='{"stx": "html"}'>
7420 <li data-parsoid='{"stx": "html"}'>a
7421 <ul><li>b</li></ul>
7422 </li>
7423 </ul>
7424
7425 <ul data-parsoid='{"stx": "html"}'>
7426 <li>x
7427 <ul><li>y</li></ul>
7428 </li>
7429 </ul>
7430 !! wikitext
7431 <ul>
7432 <li>a
7433 * b
7434 </li>
7435 </ul>
7436
7437 <ul>
7438 <li>x
7439 * y
7440 </li>
7441 </ul>
7442 !! end
7443
7444 ###
7445 ### Internal links
7446 ###
7447 !! test
7448 Plain link, capitalized
7449 !! wikitext
7450 [[Main Page]]
7451 !! html
7452 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7453 </p>
7454 !! end
7455
7456 !! test
7457 Plain link, uncapitalized
7458 !! wikitext
7459 [[main Page]]
7460 !! html
7461 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7462 </p>
7463 !! end
7464
7465 !! test
7466 Piped link
7467 !! wikitext
7468 [[Main Page|The Main Page]]
7469 !! html
7470 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7471 </p>
7472 !! end
7473
7474 !! test
7475 Piped link with comment in link text
7476 !! wikitext
7477 [[Main Page|The Main<!--front--> Page]]
7478 !! html
7479 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7480 </p>
7481 !! end
7482
7483 !! test
7484 Piped link with multiple pipe characters in link text
7485 !! wikitext
7486 [[Main Page||The|Main|Page|]]
7487 !! html/php
7488 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7489 </p>
7490 !! html/parsoid
7491 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7492 !! end
7493
7494 !! test
7495 Piped link with no link text
7496 !! wikitext
7497 [[Thomas Bek (bishop of St David's)|]]
7498 !! html/php
7499 <p>[[Thomas Bek (bishop of St David's)|]]
7500 </p>
7501 !! html/parsoid
7502 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7503 !! end
7504
7505 !! test
7506 Piped link with empty link text
7507 !! wikitext
7508 [[Main Page|<nowiki />]] - empty nowiki
7509 [[Main Page| ]] - empty space
7510 [[Main Page|&nbsp;]] - empty non breaking space
7511 !! html/php
7512 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7513 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7514 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7515 </p>
7516 !! html/parsoid
7517 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki />"}'/></a> - empty nowiki
7518 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7519 <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>
7520 !! end
7521
7522 !! test
7523 Broken link
7524 !! wikitext
7525 [[Zigzagzogzagzig]]
7526 !! html
7527 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7528 </p>
7529 !! end
7530
7531 !! test
7532 Broken link with fragment
7533 !! wikitext
7534 [[Zigzagzogzagzig#zug]]
7535 !! html
7536 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7537 </p>
7538 !! end
7539
7540 !! test
7541 Special page link with fragment
7542 !! wikitext
7543 [[Special:Version#anchor]]
7544 !! html
7545 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7546 </p>
7547 !! end
7548
7549 !! test
7550 Nonexistent special page link with fragment
7551 !! wikitext
7552 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7553 !! html
7554 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7555 </p>
7556 !! end
7557
7558 !! test
7559 Link with prefix
7560 !! wikitext
7561 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7562 !! html
7563 <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>
7564 </p>
7565 !! end
7566
7567 !! test
7568 Link with suffix
7569 !! wikitext
7570 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7571 !! html
7572 <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>!!!
7573 </p>
7574 !! end
7575
7576 !! article
7577 prefixed article
7578 !! text
7579 Some text
7580 !! endarticle
7581
7582 !! test
7583 Bug 43661: Piped links with identical prefixes
7584 !! wikitext
7585 [[prefixed article|prefixed articles with spaces]]
7586
7587 [[prefixed article|prefixed articlesaoeu]]
7588
7589 [[Main Page|Main Page test]]
7590 !! html
7591 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7592 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7593 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7594 </p>
7595 !! end
7596
7597
7598 !! test
7599 Link with HTML entity in suffix / tail
7600 !! wikitext
7601 [[Main Page]]&quot;, [[Main Page]]&#97;
7602 !! html/php
7603 <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;
7604 </p>
7605 !! html/parsoid
7606 <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>
7607 !! end
7608
7609 !! test
7610 Link with 3 brackets
7611 !! wikitext
7612 [[[Main Page]]]
7613 Foo [[[Main Page]]]
7614 !! html
7615 <p>[[[Main Page]]]
7616 Foo [[[Main Page]]]
7617 </p>
7618 !! end
7619
7620 !! test
7621 Link with 4 brackets
7622 !! wikitext
7623 [[[[Main Page]]]]
7624 !! html
7625 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7626 </p>
7627 !! end
7628
7629 !! test
7630 Piped link with 3 brackets
7631 !! wikitext
7632 [[[main page|the main page]]]
7633 !! html
7634 <p>[[[main page|the main page]]]
7635 </p>
7636 !! end
7637
7638 !! test
7639 Piped link with extlink-like text
7640 !! wikitext
7641 [[Main Page|[bar]]]
7642 [[Main Page|This is a [bar]]]
7643 !! html/php
7644 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7645 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7646 </p>
7647 !! html/parsoid
7648 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7649 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7650 !! end
7651
7652 !! test
7653 Link with multiple pipes
7654 !! wikitext
7655 [[Main Page|The|Main|Page]]
7656 !! html
7657 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7658 </p>
7659 !! end
7660
7661 !! test
7662 Anchor containing a #. (bug 63430)
7663 !! wikitext
7664 [[Main Page#And#Link]]
7665 !! html/php
7666 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7667 </p>
7668 !! html/parsoid
7669 <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>
7670 !! end
7671
7672 !! test
7673 Link to namespaces
7674 !! wikitext
7675 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7676 !! html
7677 <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>
7678 </p>
7679 !! end
7680
7681 !! test
7682 Link with space in namespace
7683 !! wikitext
7684 [[User talk:Foo bar]]
7685 !! html
7686 <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>
7687 </p>
7688 !! end
7689
7690 !! article
7691 MemoryAlpha:AlphaTest
7692 !! text
7693 This is an article in the MemoryAlpha namespace
7694 (which shadows the memoryalpha interwiki link).
7695 !! endarticle
7696
7697 !! test
7698 Namespace takes precedence over interwiki link (bug 51680)
7699 !! wikitext
7700 [[MemoryAlpha:AlphaTest]]
7701 !! html
7702 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7703 </p>
7704 !! end
7705
7706 # The previous test doesn't work correctly in html2*, due to not recognizing the
7707 # link as an internal one. This one checks for the correct behavior.
7708 !! test
7709 Link to namespace preferred over interwiki with correct rel attribute
7710 !! options
7711 parsoid=html2wt,html2html
7712 !! html/parsoid
7713 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7714 !! wikitext
7715 [[MemoryAlpha:AlphaTest]]
7716 !! end
7717
7718 !! test
7719 Piped link to namespace
7720 !! wikitext
7721 [[Meta:Disclaimers|The disclaimers]]
7722 !! html
7723 <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>
7724 </p>
7725 !! end
7726
7727 !! test
7728 Link containing }
7729 !! wikitext
7730 [[Usually caused by a typo (oops}]]
7731 !! html
7732 <p>[[Usually caused by a typo (oops}]]
7733 </p>
7734 !! end
7735
7736 !! article
7737 7% Solution
7738 !! text
7739 Just a test of an article title containing a percent.
7740 !! endarticle
7741
7742 !! test
7743 Link containing % (not as a hex sequence)
7744 !! wikitext
7745 [[7% Solution]]
7746 [[7% Solution|7%25 Solution]]
7747 !! html/php
7748 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7749 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7750 </p>
7751 !! html/parsoid
7752 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7753 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7754 !! end
7755
7756 # note that the parsoid HTML is identical to the previous test output,
7757 # so the previous test ensures that the html2wt mode will generate the
7758 # "not as a hex sequence" wikitext.
7759 !! test
7760 Link containing % as a single hex sequence interpreted to char
7761 !! options
7762 parsoid=wt2wt,wt2html,html2html
7763 !! wikitext
7764 [[7%25 Solution]]
7765 [[7%25 Solution|7%25 Solution]]
7766 !! html/php
7767 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7768 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7769 </p>
7770 !! html/parsoid
7771 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7772 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7773 !!end
7774
7775 !! test
7776 Link containing % as a double hex sequence interpreted to hex sequence
7777 !! wikitext
7778 [[7%2525 Solution]]
7779 !! html
7780 <p>[[7%2525 Solution]]
7781 </p>
7782 !!end
7783
7784 ## Example for such a section: == < ==
7785 !! test
7786 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7787 !! wikitext
7788 [[%23%3c]][[%23%3e]]
7789 !! html/php
7790 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7791 </p>
7792 !! html/parsoid
7793 <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>
7794 !! end
7795
7796 !! test
7797 Link containing "<#" and ">#" as a hex sequences
7798 !! wikitext
7799 [[%3c%23]][[%3e%23]]
7800 !! html
7801 <p>[[%3c%23]][[%3e%23]]
7802 </p>
7803 !! end
7804
7805 !! test
7806 Link containing an equals sign
7807 !! wikitext
7808 [[Special:BookSources/isbn=4-00-026157-6]]
7809 !! html/php
7810 <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>
7811 </p>
7812 !! html/parsoid
7813 <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>
7814 !! end
7815
7816 !! article
7817 Foo~bar
7818 !! text
7819 Just a test of an article title containing a tilde.
7820 !! endarticle
7821
7822 # note that links containing signatures, like [[Foo~~~~]], are
7823 # massaged by the pre-save transform (PST) and so the tildes are never
7824 # seen by the parser.
7825 !! test
7826 Link containing a tilde
7827 !! wikitext
7828 [[Foo~bar]]
7829 !! html/php
7830 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7831 </p>
7832 !! html/parsoid
7833 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7834 !! end
7835
7836 !! test
7837 Link containing double-single-quotes '' (bug 4598)
7838 !! wikitext
7839 [[Lista d''e paise d''o munno]]
7840 !! html/php
7841 <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>
7842 </p>
7843 !! html/parsoid
7844 <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>
7845 !! end
7846
7847 !! test
7848 Link containing double quotes and spaces
7849 !! wikitext
7850 [[Cool "Gator"]]
7851 !! html/php
7852 <p><a href="/index.php?title=Cool_%22Gator%22&amp;action=edit&amp;redlink=1" class="new" title="Cool &quot;Gator&quot; (page does not exist)">Cool "Gator"</a>
7853 </p>
7854 !! html/parsoid
7855 <p><a rel="mw:WikiLink" href="./Cool_%22Gator%22" title='Cool "Gator"'>Cool "Gator"</a></p>
7856 !! end
7857
7858 !! test
7859 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7860 !! wikitext
7861 Some [[Link|pretty ''italics'' and stuff]]!
7862 !! html/php
7863 <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>!
7864 </p>
7865 !! html/parsoid
7866 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7867 !! end
7868
7869 !! test
7870 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7871 !! wikitext
7872 ''Some [[Link|pretty ''italics'' and stuff]]!''
7873 !! html
7874 <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>
7875 </p>
7876 !! end
7877
7878 !! test
7879 Link with double quotes in title part (literal) and alternate part (interpreted)
7880 !! wikitext
7881 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7882
7883 [[''Pentecoste'']]
7884
7885 [[''Pentecoste''|Pentecoste]]
7886
7887 [[''Pentecoste''|''Pentecoste'']]
7888 !! html/php
7889 <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>
7890 </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>
7891 </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>
7892 </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>
7893 </p>
7894 !! html/parsoid
7895 <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>
7896 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7897 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7898 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7899 !! end
7900
7901 !! test
7902 Broken image links with HTML captions (bug 39700)
7903 !! wikitext
7904 [[File:Nonexistent|<script></script>]]
7905 [[File:Nonexistent|100x100px|<script></script>]]
7906 [[File:Nonexistent|&lt;]]
7907 [[File:Nonexistent|a<i>b</i>c]]
7908 !! html/php
7909 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7910 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7911 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7912 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7913 </p>
7914 !! html/parsoid
7915 <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>
7916 <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>
7917 <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>
7918 <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>
7919 !! end
7920
7921 !! test
7922 Plain link to URL
7923 !! wikitext
7924 [[http://www.example.com]]
7925 !! html/php
7926 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7927 </p>
7928 !! html/parsoid
7929 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7930 !! end
7931
7932 !! test
7933 Plain link to URL with link text
7934 !! wikitext
7935 [[http://www.example.com Link text]]
7936 !! html
7937 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7938 </p>
7939 !! end
7940
7941 !! test
7942 Plain link to protocol-relative URL
7943 !! wikitext
7944 [[//www.example.com]]
7945 !! html/php
7946 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7947 </p>
7948 !! html/parsoid
7949 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7950 !! end
7951
7952 !! test
7953 Plain link to protocol-relative URL with link text
7954 !! wikitext
7955 [[//www.example.com Link text]]
7956 !! html
7957 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7958 </p>
7959 !! end
7960
7961 !! test
7962 Plain link to page with question mark in title
7963 !! wikitext
7964 [[A?b]]
7965
7966 [[A?b|Baz]]
7967 !! html
7968 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7969 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7970 </p>
7971 !! end
7972
7973
7974 # I'm fairly sure the expected result here is wrong.
7975 # We want these to be URL links, not pseudo-pages with URLs for titles....
7976 # However the current output is also pretty screwy.
7977 #
7978 # ----
7979 # I'm changing it to match the current output--it arguably makes more
7980 # sense in the light of the test above. Old expected result was:
7981 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7982 #</p>
7983 # But I think this test is bordering on "garbage in, garbage out" anyway.
7984 # -- wtm
7985 !! test
7986 Piped link to URL
7987 !! wikitext
7988 Piped link to URL: [[http://www.example.com|an example URL]]
7989 !! html/php
7990 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7991 </p>
7992 !! html/parsoid
7993 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com%7Can" data-parsoid='{"a":{"href":"http://www.example.com%7Can"},"sa":{"href":"http://www.example.com|an"}}'>example URL</a>]</p>
7994 !! end
7995
7996 !! test
7997 BUG 2: [[page|http://url/]] should link to page, not http://url/
7998 !! wikitext
7999 [[Main Page|http://url/]]
8000 !! html/php
8001 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8002 </p>
8003 !! html/parsoid
8004 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8005 !! end
8006
8007 # Parsoid does not mark self-links, by design.
8008 !! test
8009 BUG 337: Escaped self-links should be bold
8010 !! options
8011 title=[[Bug462]]
8012 !! wikitext
8013 [[Bu&#103;462]] [[Bug462]]
8014 !! html/php
8015 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
8016 </p>
8017 !! html/php+tidy
8018 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
8019 !! html/parsoid
8020 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8021 !! end
8022
8023 !! test
8024 Self-link to section should not be bold
8025 !! options
8026 title=[[Main Page]]
8027 !! wikitext
8028 [[Main Page#section]]
8029 !! html
8030 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8031 </p>
8032 !! end
8033
8034 !! article
8035 00
8036 !! text
8037 This is 00.
8038 !! endarticle
8039
8040 !!test
8041 Self-link to numeric title
8042 !!options
8043 title=[[0]]
8044 !! wikitext
8045 [[0]]
8046 !! html
8047 <p><strong class="selflink">0</strong>
8048 </p>
8049 !!end
8050
8051 !!test
8052 Link to numeric-equivalent title
8053 !!options
8054 title=[[0]]
8055 !! wikitext
8056 [[00]]
8057 !! html
8058 <p><a href="/wiki/00" title="00">00</a>
8059 </p>
8060 !!end
8061
8062 !! test
8063 <nowiki> inside a link
8064 !! wikitext
8065 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8066 !! html
8067 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8068 </p>
8069 !! end
8070
8071 !! test
8072 Non-breaking spaces in title
8073 !! wikitext
8074 [[&nbsp; Main &nbsp; Page &nbsp;]]
8075 !! html
8076 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8077 </p>
8078 !!end
8079
8080 !! test
8081 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
8082 !! options
8083 language=ca
8084 !! wikitext
8085 '''[[Main Page]]'''
8086 !! html
8087 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8088 </p>
8089 !! end
8090
8091 !! test
8092 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
8093 !! options
8094 language=ca
8095 !! wikitext
8096 ''[[Main Page]]''
8097 !! html
8098 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8099 </p>
8100 !! end
8101
8102 !! test
8103 Internal link with en linktrail: no apostrophes (bug 27473)
8104 !! options
8105 language=en
8106 !! wikitext
8107 [[Something]]'nice
8108 !! html
8109 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8110 </p>
8111 !! end
8112
8113 !! test
8114 Internal link with ca linktrail with apostrophes (bug 27473)
8115 !! options
8116 language=ca
8117 !! wikitext
8118 [[Something]]'nice
8119 !! html
8120 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8121 </p>
8122 !! end
8123
8124 !! test
8125 Internal link with kaa linktrail with apostrophes (bug 27473)
8126 !! options
8127 language=kaa
8128 !! wikitext
8129 [[Something]]'nice
8130 !! html
8131 <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>
8132 </p>
8133 !! end
8134
8135 !! test
8136 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
8137 !! wikitext
8138 [[User:Foo/Test/63636:Bar|Test]]
8139 !! html/php
8140 <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>
8141 </p>
8142 !! html/parsoid
8143 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8144 !! end
8145
8146 ## Mainly a sanity check for Parsoid
8147 !! test
8148 Handle title parsing for subpages
8149 !! options
8150 title=[[/123123]]
8151 !! wikitext
8152 123
8153 !! html/parsoid
8154 <p>123</p>
8155 !! end
8156
8157 ## FIXME: Add a working php section here
8158 !! test
8159 Link to a subpage from a namespace other than main
8160 !! options
8161 title=[[User:test]]
8162 !! wikitext
8163 [[/123]]
8164 !! html/parsoid
8165 <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>
8166 !! end
8167
8168 !! test
8169 Ensure that transclusion titles are not url-decoded
8170 !! options
8171 subpage title=[[Test]]
8172 parsoid=wt2html
8173 !! wikitext
8174 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8175 !! html/php
8176 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8177 </p>
8178 !! html/parsoid
8179 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8180 !! end
8181
8182 !! test
8183 Purely hash wikilink
8184 !! options
8185 title=[[User:test/123]]
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 !! wikitext
8198 {{echo|[[Foo]]}}l
8199 !! html/parsoid
8200 <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>
8201 !! end
8202
8203 !! test
8204 2. Interaction of linktrail and template encapsulation
8205 !! options
8206 parsoid
8207 !! wikitext
8208 {{echo|Some [[Fool]]}}s
8209 !! html
8210 <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>
8211 !! end
8212
8213 !! test
8214 3. Interaction of linktrail and template encapsulation
8215 !! options
8216 parsoid
8217 !! wikitext
8218 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8219 !! html
8220 <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>
8221 !! end
8222
8223 !! article
8224 Söfnuður
8225 !! text
8226 Test.
8227 !! endarticle
8228
8229 !! test
8230 Internal link with is link prefix
8231 !! options
8232 language=is
8233 !! wikitext
8234 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8235 !! html
8236 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8237 </p>
8238 !! end
8239
8240 !! article
8241 Mótmælendatrú
8242 !! text
8243 Test.
8244 !! endarticle
8245
8246 !! test
8247 Internal link with is link trail and link prefix
8248 !! options
8249 language=is
8250 !! wikitext
8251 [[mótmælendatrú|xxx]]ar
8252 [[mótmælendatrú]]ar
8253 mótmælenda[[söfnuður]]
8254 mótmælenda[[söfnuður|söfnuðir]]
8255 mótmælenda[[söfnuður|söfnuðir]]xxx
8256 !! html
8257 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8258 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8259 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8260 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8261 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8262 </p>
8263 !! end
8264
8265 !! test
8266 Parsoid link trail escaping
8267 !! options
8268 parsoid=html2wt,html2html
8269 !! html/parsoid
8270 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8271 !! wikitext
8272 [[apple]]<nowiki/>s
8273 !! end
8274
8275 !! test
8276 Parsoid link prefix escaping
8277 !! options
8278 language=is
8279 parsoid=html2wt,html2html
8280 !! html/parsoid
8281 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8282 !! wikitext
8283 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8284 !! end
8285
8286 !! test
8287 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8288 !! wikitext
8289 [[Foo| bar]]
8290
8291 [[Foo| ''bar'']]
8292
8293 [http://wp.org foo]
8294
8295 [http://wp.org ''foo'']
8296 !! html
8297 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8298 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8299 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8300 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8301 </p>
8302 !! end
8303
8304 !! test
8305 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8306 !! wikitext
8307 [[Foo|{{echo|a}} b {{echo|c}}]]
8308 !! html/parsoid
8309 <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>
8310 !! end
8311
8312 !! test
8313 Link with angle bracket after anchor
8314 !! wikitext
8315 [[Foo#<bar>]]
8316 !! html/php
8317 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8318 </p>
8319 !! html/parsoid
8320 <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>
8321 !! end
8322
8323 ###
8324 ### Interwiki links (see maintenance/interwiki.sql)
8325 ###
8326
8327 !! test
8328 Inline interwiki link
8329 !! options
8330 parsoid=wt2html,wt2wt,html2html
8331 !! wikitext
8332 [[MeatBall:SoftSecurity]]
8333 !! html/php
8334 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8335 </p>
8336 !! html/parsoid
8337 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8338 !! end
8339
8340 !! test
8341 Inline interwiki link with empty title (bug 2372)
8342 !! options
8343 parsoid=wt2html,wt2wt,html2html
8344 !! wikitext
8345 [[MeatBall:]]
8346 !! html/php
8347 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8348 </p>
8349 !! html/parsoid
8350 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8351 !! end
8352
8353 !! test
8354 Interwiki link encoding conversion (bug 1636)
8355 !! wikitext
8356 *[[Wikipedia:ro:Olteni&#0355;a]]
8357 *[[Wikipedia:ro:Olteni&#355;a]]
8358 !! html
8359 <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>
8360 <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>
8361
8362 !! html+tidy
8363 <ul>
8364 <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>
8365 <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>
8366 </ul>
8367 !! end
8368
8369 !! test
8370 Interwiki link with fragment (bug 2130)
8371 !! wikitext
8372 [[MeatBall:SoftSecurity#foo]]
8373 !! html
8374 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8375 </p>
8376 !! end
8377
8378 !! test
8379 Link scenarios with escaped fragments
8380 !! wikitext
8381 [[#Is this great?]]
8382 [[Foo#Is this great?]]
8383 [[meatball:Foo#Is this great?]]
8384 !! html/php
8385 <p><a href="#Is_this_great.3F">#Is this great?</a>
8386 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8387 <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>
8388 </p>
8389 !! html/parsoid
8390 <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>
8391 <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>
8392 <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>
8393 !! end
8394
8395 # Ideally the wikipedia: prefix here should be proto-relative too
8396 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8397 # define the 'en' prefix, and originally the test used 'wikipedia',
8398 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8399 # article.
8400 !! test
8401 Different interwiki prefixes mapping to the same URL
8402 !! wikitext
8403 [[:en:Foo]]
8404
8405 [[:en:Foo|Foo]]
8406
8407 [[wikipedia:Foo]]
8408
8409 [[:wikipedia:Foo|Foo]]
8410
8411 [[wikipedia:en:Foo]]
8412
8413 [[:wikipedia:en:Foo]]
8414
8415 [[ wikiPEdia :Foo]]
8416 !! html/parsoid
8417 <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>
8418
8419 <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>
8420
8421 <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>
8422
8423 <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>
8424
8425 <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>
8426
8427 <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>
8428
8429 <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>
8430 !! end
8431
8432 !! test
8433 Interwiki links that cannot be represented in wiki syntax
8434 !! wikitext
8435 [[meatball:ok]]
8436 [[meatball:ok#foo|ok with fragment]]
8437 [[meatball:ok_as_well?|ok ending with ? mark]]
8438 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8439 [http://de.wikipedia.org/wiki/#foo is just fragment]
8440
8441 !! html/php
8442 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8443 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8444 <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>
8445 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8446 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8447 </p>
8448 !! html/parsoid
8449 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8450 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8451 <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>
8452 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8453 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8454 !! end
8455
8456 !! test
8457 Interwiki links: trail
8458 !! wikitext
8459 [[wikipedia:Foo|Ba]]r
8460 !! html/php
8461 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8462 </p>
8463 !! html/parsoid
8464 <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>
8465 !! end
8466
8467 !! test
8468 Local interwiki link
8469 !! options
8470 parsoid=wt2html,wt2wt,html2html
8471 !! wikitext
8472 [[local:Template:Foo]]
8473 !! html/php
8474 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8475 </p>
8476 !! html/parsoid
8477 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8478 !! end
8479
8480 # Parsoid does not mark self-links, by design.
8481 !! test
8482 Local interwiki link: self-link to current page
8483 !! options
8484 title=[[Main Page]]
8485 parsoid=wt2html,wt2wt,html2html
8486 !! wikitext
8487 [[local:Main Page]]
8488 !! html/php
8489 <p><strong class="selflink">local:Main Page</strong>
8490 </p>
8491 !! html/parsoid
8492 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8493 !! end
8494
8495 !! test
8496 Local interwiki link: prefix only (bug 64167)
8497 !! options
8498 parsoid=wt2html,wt2wt,html2html
8499 !! wikitext
8500 [[local:]]
8501 !! html/php
8502 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8503 </p>
8504 !! html/parsoid
8505 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8506 !! end
8507
8508 !! test
8509 Local interwiki link: with additional interwiki prefix (bug 61357)
8510 !! options
8511 parsoid=wt2html,wt2wt,html2html
8512 !! wikitext
8513 [[local:meatball:Hello]]
8514 !! html/php
8515 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8516 </p>
8517 !! html/parsoid
8518 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8519 !! end
8520
8521 !! test
8522 Multiple local interwiki link prefixes
8523 !! wikitext
8524 [[local:local:local:local:mi:local:Foo]]
8525 !! options
8526 parsoid=wt2html,wt2wt,html2html
8527 !! html/php
8528 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8529 </p>
8530 !! html/parsoid
8531 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8532 !! end
8533
8534 ###
8535 ### Interlanguage links
8536 ### Language links (so that searching for '### language' matches..)
8537 ###
8538
8539 !! test
8540 Interlanguage link
8541 !! wikitext
8542 Blah blah blah
8543 [[zh:Chinese]]
8544 !! html/php
8545 <p>Blah blah blah
8546 </p>
8547 !! html/parsoid
8548 <p>Blah blah blah</p>
8549 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8550 !! end
8551
8552 ## parsoid html2wt will lose the space variations
8553 !! test
8554 Interlanguage link with spacing
8555 !! options
8556 parsoid=wt2html,wt2wt,html2html
8557 !! wikitext
8558 Blah blah blah
8559 [[ zh : Chinese ]]
8560 !! html/php
8561 <p>Blah blah blah
8562 </p>
8563 !! html/parsoid
8564 <p>Blah blah blah</p>
8565 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8566 !! end
8567
8568 !! test
8569 Double interlanguage link
8570 !! wikitext
8571 Blah blah blah
8572 [[es:Spanish]]
8573 [[zh:Chinese]]
8574 !! html/php
8575 <p>Blah blah blah
8576 </p>
8577 !! html/parsoid
8578 <p>Blah blah blah</p>
8579 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8580 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8581 !! end
8582
8583 ## parsoid html2wt will lose the space variations
8584 !! test
8585 Interlanguage link variations
8586 !! options
8587 parsoid=wt2html,wt2wt,html2html
8588 !! wikitext
8589 Blah blah blah
8590 [[ es :Spanish]]
8591 [[ ZH :Chinese]]
8592 [[es:Foo_bar]]
8593 !! html/php
8594 <p>Blah blah blah
8595 </p>
8596 !! html/parsoid
8597 <p>Blah blah blah</p>
8598 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8599 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8600 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8601 !! end
8602
8603 !! test
8604 Escaping of interlanguage links
8605 !! wikitext
8606 Blah blah blah
8607 [[:es:Spanish]]
8608 [[ : zh : Chinese ]]
8609 !! html/php
8610 <p>Blah blah blah
8611 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8612 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8613 </p>
8614 !! html/parsoid
8615 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8616 <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8617 !! end
8618
8619 ## parsoid html2wt will normalize the space to _
8620 !! test
8621 Space and question mark encoding in interlanguage links (T95473)
8622 !! options
8623 parsoid=wt2html,wt2wt,html2html
8624 !! wikitext
8625 Blah blah blah
8626 [[es:Foo bar?]]
8627 !! html/php
8628 <p>Blah blah blah
8629 </p>
8630 !! html/parsoid
8631 <p>Blah blah blah</p>
8632 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8633 !! end
8634
8635 !! test
8636 Interlanguage link, with prefix links
8637 !! options
8638 language=ln
8639 !! wikitext
8640 Blah blah blah
8641 [[zh:Chinese]]
8642 !! html/php
8643 <p>Blah blah blah
8644 </p>
8645 !! html/parsoid
8646 <p>Blah blah blah</p>
8647 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8648 !! end
8649
8650 !! test
8651 Double interlanguage link, with prefix links (bug 8897)
8652 !! options
8653 language=ln
8654 !! wikitext
8655 Blah blah blah
8656 [[es:Spanish]]
8657 [[zh:Chinese]]
8658 !! html/php
8659 <p>Blah blah blah
8660 </p>
8661 !! html/parsoid
8662 <p>Blah blah blah</p>
8663 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8664 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8665 !! end
8666
8667 !! test
8668 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8669 !! wikitext
8670 Blah blah blah
8671 [[mul:Article]]
8672 !! html/php
8673 <p>Blah blah blah
8674 </p>
8675 !! html/parsoid
8676 <p>Blah blah blah</p>
8677 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8678 !! end
8679
8680 ## PHP parser tests script needs an update
8681 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8682 !! test
8683 Language links render as inline links if $wgInterwikiMagic=false
8684 !! options
8685 wgInterwikiMagic=false
8686 parsoid=wt2html,wt2wt,html2html
8687 !! wikitext
8688 Blah blah blah
8689 [[zh:Chinese]]
8690 !! html/parsoid
8691 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8692 !! end
8693
8694 ## PHP parser tests script needs an update
8695 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8696 !! test
8697 Language links render as inline links in the Talk namespace
8698 !! options
8699 title=Talk:Foo
8700 parsoid=wt2html,wt2wt,html2html
8701 !! wikitext
8702 Blah blah blah
8703 [[zh:Chinese]]
8704 !! html/parsoid
8705 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8706 !! end
8707
8708 !! test
8709 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8710 !! options
8711 language=ln
8712 !! wikitext
8713 [[WW&nbsp;II]]
8714 !! html
8715 <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>
8716 </p>
8717 !! end
8718
8719 !! test
8720 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8721 !! options
8722 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8723 !! html/parsoid
8724 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8725 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8726 !! wikitext
8727 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8728
8729 He&amp;nbsp;llo He&amp;nbsp;llo
8730 !! html/php
8731 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8732 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8733 </p>
8734 !! end
8735
8736 # html2wt will fail because of title normalization without data-parsoid
8737 !! test
8738 Parsoid: handle constructor well
8739 !! options
8740 parsoid=wt2html,wt2wt
8741 !! wikitext
8742 [[constructor]]
8743
8744 [[constructor:foo]]
8745 !! html/php
8746 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8747 </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>
8748 </p>
8749 !! html/parsoid
8750 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8751
8752 <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>
8753 !! end
8754
8755 !! article
8756 ko:
8757 !! text
8758 Test.
8759 !! endarticle
8760
8761 # Note that `ko` isn't a known interlanguage prefix
8762 !! test
8763 Parsoid: recognize interlanguage links without a target page
8764 !! options
8765 ill
8766 !! wikitext
8767 [[es:]]
8768
8769 [[ko:]]
8770 !! html/php
8771 es:
8772 !! html/parsoid
8773 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8774
8775 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8776 !! end
8777
8778 # Note that `ko` isn't a known interwiki prefix
8779 !! test
8780 Parsoid: recognize interwiki links without a target page
8781 !! options
8782 parsoid=wt2html,wt2wt,html2html
8783 !! wikitext
8784 [[:es:]]
8785
8786 [[:ko:]]
8787 !! html/php
8788 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8789 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8790 </p>
8791 !! html/parsoid
8792 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8793 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8794 !! end
8795
8796 !! test
8797 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8798 !! wikitext
8799 [[mi:Foo]]
8800 !! html/php
8801 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8802 </p>
8803 !! html/parsoid
8804 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8805 !! end
8806
8807 !! test
8808 Interlanguage link with preceding local interwiki link (bug 68085)
8809 !! options
8810 parsoid=wt2html,wt2wt,html2html
8811 !! wikitext
8812 Blah blah blah
8813 [[local:es:Spanish]]
8814 !! html/php
8815 <p>Blah blah blah
8816 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8817 </p>
8818 !! html/parsoid
8819 <p>Blah blah blah
8820 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8821 !! end
8822
8823 !! test
8824 Looks like an interlanguage link, but is actually a local interwiki
8825 !! options
8826 parsoid=wt2html,wt2wt,html2html
8827 !! wikitext
8828 Blah blah blah
8829 [[mi:Template:Foo]]
8830 !! html/php
8831 <p>Blah blah blah
8832 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8833 </p>
8834 !! html/parsoid
8835 <p>Blah blah blah
8836 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8837 !! end
8838
8839 ###
8840 ### Redirects, Parsoid-only
8841 ###
8842
8843 !! test
8844 1. Simple redirect to page
8845 !! wikitext
8846 #REDIRECT [[Main Page]]
8847 !! html/parsoid
8848 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8849 !! end
8850
8851 !! test
8852 2. Other redirect variants
8853 !! wikitext
8854 #REDIRECT [[Main_Page]]
8855 !! html/parsoid
8856 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8857 !! end
8858
8859 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8860 # This tests the Parsoid bail-out code.
8861 !! test
8862 3. Other redirect variants
8863 !! wikitext
8864 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8865 !! html/parsoid
8866 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8867 !! end
8868
8869 !! test
8870 4. Redirect to a templated destination
8871 !! wikitext
8872 #REDIRECT [[{{echo|Foo}}bar]]
8873 !! html/parsoid
8874 <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"}]]}'/>
8875 !! end
8876
8877 !! test
8878 Empty redirect
8879 !! options
8880 parsoid=wt2html,wt2wt
8881 !! wikitext
8882 #REDIRECT [[]]
8883 !! html/parsoid
8884 <ol>
8885 <li>REDIRECT [[]]</li></ol>
8886 !! end
8887
8888 !! test
8889 Optional colon in #REDIRECT
8890 !! options
8891 # the colon is archaic syntax. we support it for wt2html, but we
8892 # don't care that it roundtrips back to the modern syntax.
8893 parsoid=wt2html,html2html
8894 !! wikitext
8895 #REDIRECT:[[Main Page]]
8896 !! html/parsoid
8897 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8898 !! end
8899
8900 !! test
8901 Whitespace in #REDIRECT with optional colon
8902 !! options
8903 # the colon and gratuitous whitespace is archaic syntax. we support
8904 # it for wt2html, but we don't care that it roundtrips back to the
8905 # modern syntax (without extra whitespace)
8906 parsoid=wt2html,html2html
8907 !! wikitext
8908
8909 #REDIRECT
8910 :
8911 [[Main Page]]
8912 !! html/parsoid
8913 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8914 !! end
8915
8916 !! test
8917 Piped link in #REDIRECT
8918 !! options
8919 # content after piped link is ignored. we support this syntax,
8920 # but don't care that the piped link is lost when we roundtrip this.
8921 parsoid=wt2html
8922 !! wikitext
8923 #REDIRECT [[Main Page|bar]]
8924 !! html/parsoid
8925 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8926 !! end
8927
8928 !! test
8929 Redirect to category (T104502)
8930 !! options
8931 parsoid=wt2html,wt2wt
8932 !! wikitext
8933 #REDIRECT [[Category:Foo]]
8934 !! html/parsoid
8935 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8936 !! end
8937
8938 !! test
8939 Redirect to category with URL encoding (T104502)
8940 !! options
8941 parsoid=wt2html
8942 !! wikitext
8943 #REDIRECT [[Category%3AFoo]]
8944 !! html/parsoid
8945 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8946 !! end
8947
8948 !! test
8949 Redirect to category page
8950 !! wikitext
8951 #REDIRECT [[:Category:Foo]]
8952 !! html/parsoid
8953 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8954 !! end
8955
8956 !! test
8957 Redirect to image page (1)
8958 !! wikitext
8959 #REDIRECT [[File:Wiki.png]]
8960 !! html/parsoid
8961 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8962 !! end
8963
8964 !! test
8965 Redirect to image page (2)
8966 !! wikitext
8967 #REDIRECT [[Image:Wiki.png]]
8968 !! html/parsoid
8969 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8970 !! end
8971
8972 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8973 # Next test confirms this.
8974 !! test
8975 Redirect to language (1) (T104918)
8976 !! options
8977 parsoid=wt2html,wt2wt,html2html
8978 !! wikitext
8979 #REDIRECT [[en:File:Wiki.png]]
8980 !! html/parsoid
8981 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8982 !! end
8983
8984 !! test
8985 Redirect to language (2) (T104918)
8986 !! wikitext
8987 #REDIRECT [[:en:File:Wiki.png]]
8988 !! html/parsoid
8989 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8990 !! end
8991
8992 !! test
8993 Redirect to interwiki (T104918)
8994 !! wikitext
8995 #REDIRECT [[meatball:File:Wiki.png]]
8996 !! html/parsoid
8997 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8998 !! end
8999
9000 !! test
9001 Non-English #REDIRECT
9002 !! options
9003 language=is
9004 !! wikitext
9005 #TILVÍSUN [[Main Page]]
9006 !! html/parsoid
9007 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9008 !! end
9009
9010 !! test
9011 Redirect syntax under text isn't considered a redirect
9012 !! wikitext
9013 some text
9014 #redirect [[Main Page]]
9015 !! html/parsoid
9016 <p>some text</p>
9017 <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>
9018 !! end
9019
9020 # FIXME: Should hoist the redirect to the top of the page and ensure there
9021 # is only one.
9022 !! test
9023 New redirect
9024 !! options
9025 parsoid=html2wt
9026 !! html/parsoid
9027 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9028 !! wikitext
9029 Foo
9030 #REDIRECT [[Foo]]
9031 !! end
9032
9033 ##
9034 ## XHTML tidiness
9035 ###
9036
9037 !! test
9038 <br> to <br />
9039 !! wikitext
9040 1<br>2<br />3
9041 !! html
9042 <p>1<br />2<br />3
9043 </p>
9044 !! end
9045
9046 !! test
9047 Broken br tag sanitization
9048 !! wikitext
9049 </br>
9050 !! html/php
9051 <p>&lt;/br&gt;
9052 </p>
9053 !! end
9054
9055 # TODO: Fix html2html mode (bug 51055)!
9056 !! test
9057 Parsoid: Broken br tag recognition
9058 !! options
9059 parsoid=wt2html
9060 !! wikitext
9061 </br>
9062
9063 <br/ >
9064 !! html+tidy
9065 <p><br /></p>
9066 <p><br /></p>
9067 !! end
9068
9069 !! test
9070 Incorrecly removing closing slashes from correctly formed XHTML
9071 !! wikitext
9072 <br style="clear:both;" />
9073 !! html
9074 <p><br style="clear:both;" />
9075 </p>
9076 !! end
9077
9078 !! test
9079 Failing to transform badly formed HTML into correct XHTML
9080 !! wikitext
9081 <br style="clear: left;">
9082 <br style="clear: right;">
9083 <br style="clear: both;">
9084 !! html
9085 <p><br style="clear: left;" />
9086 <br style="clear: right;" />
9087 <br style="clear: both;" />
9088 </p>
9089 !!end
9090
9091 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9092 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9093 !! test
9094 Handling html with a div self-closing tag
9095 !! wikitext
9096 <div title />
9097 <div title/>
9098 <div title/ >
9099 <div title=bar />
9100 <div title=bar/>
9101 <div title=bar/ >
9102 !! html/php
9103 <p>&lt;div title /&gt;
9104 &lt;div title/&gt;
9105 </p>
9106 <div>
9107 <p>&lt;div title=bar /&gt;
9108 &lt;div title=bar/&gt;
9109 </p>
9110 <div title="bar/"></div>
9111 </div>
9112
9113 !! html/parsoid
9114 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9115 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9116 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9117 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9118 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9119 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9120 !! end
9121
9122 !! test
9123 Handling html with a br self-closing tag
9124 !! wikitext
9125 <br title />
9126 <br title/>
9127 <br title/ >
9128 <br title=bar />
9129 <br title=bar/>
9130 <br title=bar/ >
9131 !! html/php
9132 <p><br title="" />
9133 <br title="" />
9134 <br />
9135 <br title="bar" />
9136 <br title="bar" />
9137 <br title="bar/" />
9138 </p>
9139 !! html/parsoid
9140 <p><br title="" />
9141 <br title="" />
9142 <br title="" />
9143 <br title="bar" />
9144 <br title="bar" />
9145 <br title="bar/" />
9146 </p>
9147 !! end
9148
9149 !! test
9150 Horizontal ruler (should it add that extra space?)
9151 !! wikitext
9152 <hr>
9153 <hr >
9154 foo <hr
9155 > bar
9156 !! html+tidy
9157 <hr />
9158 <hr />
9159 <p>foo</p>
9160 <hr />
9161 <p>bar</p>
9162 !! end
9163
9164 !! test
9165 Horizontal ruler -- 4+ dashes render hr
9166 !! wikitext
9167 ----
9168 !! html
9169 <hr />
9170
9171 !! end
9172
9173 !! test
9174 Horizontal ruler -- eats additional dashes on the same line
9175 !! wikitext
9176 ---------
9177 !! html
9178 <hr />
9179
9180 !! end
9181
9182 !! test
9183 Horizontal ruler -- does not collapse dashes on consecutive lines
9184 !! wikitext
9185 ----
9186 ----
9187 !! html
9188 <hr />
9189 <hr />
9190
9191 !! end
9192
9193 !! test
9194 Horizontal ruler -- <4 dashes render as plain text
9195 !! wikitext
9196 ---
9197 !! html
9198 <p>---
9199 </p>
9200 !! end
9201
9202 !! test
9203 Horizontal ruler -- Supports content following dashes on same line
9204 !! wikitext
9205 ---- Foo
9206 !! html
9207 <hr /> Foo
9208
9209 !! html+tidy
9210 <hr />
9211 <p>Foo</p>
9212 !! end
9213
9214 ###
9215 ### Block-level elements
9216 ###
9217 !! test
9218 Common list
9219 !! wikitext
9220 *Common list
9221 * item 2
9222 *item 3
9223 !! html
9224 <ul><li>Common list</li>
9225 <li> item 2</li>
9226 <li>item 3</li></ul>
9227
9228 !! end
9229
9230 !! test
9231 Numbered list
9232 !! wikitext
9233 #Numbered list
9234 #item 2
9235 # item 3
9236 !! html
9237 <ol><li>Numbered list</li>
9238 <li>item 2</li>
9239 <li> item 3</li></ol>
9240
9241 !! end
9242
9243 !! test
9244 Mixed list
9245 !! wikitext
9246 *Mixed list
9247 *# with numbers
9248 ** and bullets
9249 *# and numbers
9250 *bullets again
9251 **bullet level 2
9252 ***bullet level 3
9253 ***#Number on level 4
9254 **bullet level 2
9255 **#Number on level 3
9256 **#Number on level 3
9257 *#number level 2
9258 *Level 1
9259 *** Level 3
9260 #** Level 3, but ordered
9261 !! html
9262 <ul><li>Mixed list
9263 <ol><li> with numbers</li></ol>
9264 <ul><li> and bullets</li></ul>
9265 <ol><li> and numbers</li></ol></li>
9266 <li>bullets again
9267 <ul><li>bullet level 2
9268 <ul><li>bullet level 3
9269 <ol><li>Number on level 4</li></ol></li></ul></li>
9270 <li>bullet level 2
9271 <ol><li>Number on level 3</li>
9272 <li>Number on level 3</li></ol></li></ul>
9273 <ol><li>number level 2</li></ol></li>
9274 <li>Level 1
9275 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9276 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9277
9278 !! end
9279
9280 !! test
9281 1. Nested mixed wikitext and html list
9282 !! wikitext
9283 * hi
9284 * <ul><li>ho</li></ul>
9285 * hi
9286 ** ho
9287 !! html/php
9288 <ul><li> hi</li>
9289 <li> <ul><li>ho</li></ul></li>
9290 <li> hi
9291 <ul><li> ho</li></ul></li></ul>
9292
9293 !! html/parsoid
9294 <ul><li> hi</li>
9295 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9296 <li> hi
9297 <ul><li> ho</li></ul></li></ul>
9298 !! end
9299
9300 !! test
9301 2. Nested mixed wikitext and html list (incompatible)
9302 !! wikitext
9303 ; hi
9304 : {{echo|<li>ho</li>}}
9305 !! html/php
9306 <dl><dt> hi</dt>
9307 <dd> <li>ho</li></dd></dl>
9308
9309 !! html/parsoid
9310 <dl><dt> hi</dt>
9311 <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>
9312 !! end
9313
9314 !! test
9315 Nested lists 1
9316 !! wikitext
9317 *foo
9318 **bar
9319 !! html
9320 <ul><li>foo
9321 <ul><li>bar</li></ul></li></ul>
9322
9323 !! end
9324
9325 !! test
9326 Nested lists 2
9327 !! wikitext
9328 **foo
9329 *bar
9330 !! html
9331 <ul><li><ul><li>foo</li></ul></li>
9332 <li>bar</li></ul>
9333
9334 !! end
9335
9336 !! test
9337 Nested lists 3 (first element empty)
9338 !! wikitext
9339 *
9340 **bar
9341 !! html
9342 <ul><li>
9343 <ul><li>bar</li></ul></li></ul>
9344
9345 !! end
9346
9347 !! test
9348 Nested lists 4 (first element empty)
9349 !! wikitext
9350 **
9351 *bar
9352 !! html
9353 <ul><li><ul><li></li></ul></li>
9354 <li>bar</li></ul>
9355
9356 !! end
9357
9358 !! test
9359 Nested lists 5 (both elements empty)
9360 !! wikitext
9361 **
9362 *
9363 !! html
9364 <ul><li><ul><li></li></ul></li>
9365 <li></li></ul>
9366
9367 !! end
9368
9369 !! test
9370 Nested lists 6 (both elements empty)
9371 !! wikitext
9372 *
9373 **
9374 !! html
9375 <ul><li>
9376 <ul><li></li></ul></li></ul>
9377
9378 !! end
9379
9380 !! test
9381 Nested lists 7 (skip initial nesting levels)
9382 !! wikitext
9383 *** foo
9384 !! html
9385 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9386
9387 !! end
9388
9389 !! test
9390 Nested lists 8 (multiple nesting transitions)
9391 !! wikitext
9392 * foo
9393 *** bar
9394 ** baz
9395 * boo
9396 !! html
9397 <ul><li> foo
9398 <ul><li><ul><li> bar</li></ul></li>
9399 <li> baz</li></ul></li>
9400 <li> boo</li></ul>
9401
9402 !! end
9403
9404 !! test
9405 Nested lists 9 (extension interaction)
9406 !! options
9407 parsoid
9408 !! wikitext
9409 *<references />
9410 !! html/parsoid
9411 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9412 !! end
9413
9414 !! test
9415 1. Lists with start-of-line-transparent tokens before bullets: Comments
9416 !! wikitext
9417 *foo
9418 *<!--cmt-->bar
9419 <!--cmt-->*baz
9420 !! html
9421 <ul><li>foo</li>
9422 <li>bar</li>
9423 <li>baz</li></ul>
9424
9425 !! end
9426
9427 !! test
9428 2. Lists with start-of-line-transparent tokens before bullets: Template close
9429 !! wikitext
9430 *foo {{echo|bar
9431 }}*baz
9432 !! html
9433 <ul><li>foo bar</li>
9434 <li>baz</li></ul>
9435
9436 !! end
9437
9438 !! test
9439 List items are not parsed correctly following a <pre> block (bug 785)
9440 !! wikitext
9441 * <pre>foo</pre>
9442 * <pre>bar</pre>
9443 * zar
9444 !! html/php
9445 <ul><li> <pre>foo</pre></li>
9446 <li> <pre>bar</pre></li>
9447 <li> zar</li></ul>
9448
9449 !! html/parsoid
9450 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9451 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9452 <li> zar</li></ul>
9453 !! end
9454
9455 !! test
9456 List items from template
9457 !! wikitext
9458
9459 {{inner list}}
9460 * item 2
9461
9462 * item 0
9463 {{inner list}}
9464 * item 2
9465
9466 * item 0
9467 * notSOL{{inner list}}
9468 * item 2
9469 !! html
9470 <ul><li> item 1</li>
9471 <li> item 2</li></ul>
9472 <ul><li> item 0</li>
9473 <li> item 1</li>
9474 <li> item 2</li></ul>
9475 <ul><li> item 0</li>
9476 <li> notSOL</li>
9477 <li> item 1</li>
9478 <li> item 2</li></ul>
9479
9480 !! end
9481
9482 !! test
9483 List interrupted by empty line or heading
9484 !! wikitext
9485 * foo
9486
9487 ** bar
9488 == A heading ==
9489 * Another list item
9490 !! html
9491 <ul><li> foo</li></ul>
9492 <ul><li><ul><li> bar</li></ul></li></ul>
9493 <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>
9494 <ul><li> Another list item</li></ul>
9495
9496 !!end
9497
9498 !!test
9499 Multiple list tags generated by templates
9500 !! wikitext
9501 {{echo|<li>}}a
9502 {{echo|<li>}}b
9503 {{echo|<li>}}c
9504 !! html
9505 <li>a
9506 <li>b
9507 <li>c</li>
9508 </li>
9509 </li>
9510
9511 !! html+tidy
9512 <ul>
9513 <li>a</li>
9514 <li>b</li>
9515 <li>c</li>
9516 </ul>
9517 !!end
9518
9519 !!test
9520 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9521 !! wikitext
9522 *a
9523 <!--This line will NOT split the list-->
9524 *b
9525 <!--This line will NOT split the list either-->
9526 *c
9527 <!--foo--> <!----> <!--This line NOT split the list either-->
9528 *d
9529 !! html
9530 <ul><li>a</li>
9531 <li>b</li>
9532 <li>c</li>
9533 <li>d</li></ul>
9534
9535 !!end
9536
9537 !!test
9538 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9539 !! wikitext
9540 *a
9541 <!--This line will NOT split the list-->
9542 *b
9543 <!--This line will NOT split the list either-->
9544 *c
9545 <!--foo--> <!----> <!--This line NOT split the list
9546 either-->
9547 *d
9548 !! html
9549 <ul><li>a</li>
9550 <li>b</li>
9551 <li>c</li>
9552 <li>d</li></ul>
9553
9554 !!end
9555
9556 !!test
9557 Test the li-hack
9558 (The PHP parser relies on Tidy for the hack)
9559 !!options
9560 parsoid=wt2html,wt2wt
9561 !! wikitext
9562 * foo
9563 * <li>li-hack
9564 * {{echo|<li>templated li-hack}}
9565 * <!--foo--> <li> unsupported li-hack with preceding comments
9566
9567 <ul>
9568 <li><li>not a li-hack
9569 </li>
9570 </ul>
9571 !! html+tidy
9572 <ul>
9573 <li>foo</li>
9574 <li>li-hack</li>
9575 <li>templated li-hack</li>
9576 <li>unsupported li-hack with preceding comments</li>
9577 </ul>
9578 <ul>
9579 <li>not a li-hack</li>
9580 </ul>
9581 !!end
9582
9583 !! test
9584 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9585 !! options
9586 parsoid
9587 !! wikitext
9588 # foo
9589 ## bar
9590 * foo
9591 ** bar
9592 : foo
9593 :: bar
9594 !! html
9595 <ol>
9596 <li> foo<ol>
9597 <li> bar</li>
9598 </ol></li>
9599 </ol><ul>
9600 <li> foo<ul>
9601 <li> bar</li>
9602 </ul></li>
9603 </ul><dl>
9604 <dd> foo<dl>
9605 <dd> bar</dd>
9606 </dl></dd>
9607 </dl>
9608 !! end
9609
9610 !! test
9611 Parsoid: Test of whitespace serialization with Templated bullets
9612 !! options
9613 parsoid
9614 !! wikitext
9615 * {{bullet}}
9616 !! html
9617 <ul>
9618 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9619 </ul>
9620 !! end
9621
9622 # ------------------------------------------------------------------------
9623 # The next set of tests are about Parsoid's ability to handle badly nested
9624 # tags (parse, minimize scope of fixup, and roundtrip back)
9625 # ------------------------------------------------------------------------
9626
9627 !! test
9628 Unbalanced closing block tags break a list
9629 (php parser relies on Tidy to fix up)
9630 !! wikitext
9631 <div>
9632 *a</div><div>
9633 *b</div>
9634 !! html+tidy
9635 <div>
9636 <ul>
9637 <li>a</li>
9638 </ul>
9639 </div>
9640 <div>
9641 <ul>
9642 <li>b</li>
9643 </ul>
9644 </div>
9645 !! end
9646
9647 # Parsoid fails this test, but it might be tricky to support properly.
9648 # See bug 68395.
9649 !! test
9650 Unbalanced closing non-block tags don't break a list
9651 (php parser relies on Tidy to fix up)
9652 !! wikitext
9653 <span>
9654 *a</span><span>
9655 *b</span>
9656 !! html/php+tidy
9657 <ul>
9658 <li><span>a</span></li>
9659 <li><span>b</span></li>
9660 </ul>
9661 !! html/parsoid
9662 <span>
9663 <ul>
9664 <li>a<span></span>
9665 </li>
9666 <li>b
9667 </li>
9668 </ul>
9669 </span>
9670 !! end
9671
9672 !! test
9673 Unclosed formatting tags that straddle lists are closed and reopened
9674 (php parser relies on Tidy to fix up)
9675 !! options
9676 parsoid=wt2html,wt2wt,html2html
9677 !! wikitext
9678 # <s> a
9679 # b </s>
9680 !! html/php+tidy
9681 <ol>
9682 <li><s>a</s></li>
9683 <li><s>b</s></li>
9684 </ol>
9685 !! html/parsoid
9686 <ol><li> <s> a</s></li>
9687 <li><s> b </s></li></ol>
9688 !! end
9689
9690 # See bug 68395.
9691 !!test
9692 1. List embedded in a formatting tag
9693 !! wikitext
9694 <small>
9695 * foo
9696 </small>
9697 !! html/php+tidy
9698 <ul>
9699 <li><small>foo</small></li>
9700 </ul>
9701 !! html/parsoid
9702 <small>
9703 <ul>
9704 <li> foo</li>
9705 </ul>
9706 </small>
9707 !!end
9708
9709 ## Ugly Parsoid output here
9710 ## Not sure what the right output is.
9711 !!test
9712 2. List embedded in a formatting tag
9713 !! wikitext
9714 <small>
9715 *a
9716 *b</small>
9717 !! html/php+tidy
9718 <ul>
9719 <li><small>a</small></li>
9720 <li><small>b</small></li>
9721 </ul>
9722 !! html/parsoid
9723 <small></small>
9724 <ul><small>
9725 <li>a</li>
9726 </small>
9727 <li><small>b</small></li>
9728 </ul>
9729 !!end
9730
9731 # Ugly Parsoid and PHP parser output here
9732 # Not sure if we want to make this a test!
9733 #
9734 ## !!test
9735 ## 3. Unclosed formatting tags in list elements
9736 ## !! wikitext
9737 ## *<small>a
9738 ## *<small>b
9739 ## !! html/php+tidy
9740 ## <ul>
9741 ## <li><small>a</small></li>
9742 ## <li><small><small>b</small></small></li>
9743 ## </ul>
9744 ## !! html/parsoid
9745 ## <ul>
9746 ## <li><small>a</small></li>
9747 ## <small>
9748 ## <li><small>b</small></li>
9749 ## </small></ul>
9750 ## !!end
9751
9752 # This is a bug in the PHP parser + tidy combination.
9753 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9754 # and then fostered out of the table by tidy.)
9755 # We believe the Parsoid output to be correct.
9756 !! test
9757 Table with missing opening <tr> tag
9758 !! options
9759 parsoid=wt2html,wt2wt
9760 !! wikitext
9761 <table>
9762 <td>foo</td>
9763 </tr>
9764 </table>
9765 !! html+tidy
9766 <table>
9767 <tr>
9768 <td>foo</td>
9769 </tr>
9770 </table>
9771 !! end
9772
9773 ###
9774 ### Magic Words
9775 ###
9776
9777 # Note that the current date is hard-coded as
9778 # 1970-01-01T00:02:03Z (a Thursday)
9779 # when running parser tests. The timezone is also fixed to GMT, so
9780 # local date will be identical to current date.
9781
9782 !! test
9783 Magic Word: {{CURRENTDAY}}
9784 !! wikitext
9785 {{CURRENTDAY}}
9786 !! html
9787 <p>1
9788 </p>
9789 !! end
9790
9791 !! test
9792 Magic Word: {{CURRENTDAY2}}
9793 !! wikitext
9794 {{CURRENTDAY2}}
9795 !! html
9796 <p>01
9797 </p>
9798 !! end
9799
9800 !! test
9801 Magic Word: {{CURRENTDAYNAME}}
9802 !! wikitext
9803 {{CURRENTDAYNAME}}
9804 !! html
9805 <p>Thursday
9806 </p>
9807 !! end
9808
9809 !! test
9810 Magic Word: {{CURRENTDOW}}
9811 !! wikitext
9812 {{CURRENTDOW}}
9813 !! html
9814 <p>4
9815 </p>
9816 !! end
9817
9818 !! test
9819 Magic Word: {{CURRENTMONTH}}
9820 !! wikitext
9821 {{CURRENTMONTH}}
9822 !! html
9823 <p>01
9824 </p>
9825 !! end
9826
9827 !! test
9828 Magic Word: {{CURRENTMONTH1}}
9829 !! wikitext
9830 {{CURRENTMONTH1}}
9831 !! html
9832 <p>1
9833 </p>
9834 !! end
9835
9836 !! test
9837 Magic Word: {{CURRENTMONTHABBREV}}
9838 !! wikitext
9839 {{CURRENTMONTHABBREV}}
9840 !! html
9841 <p>Jan
9842 </p>
9843 !! end
9844
9845 !! test
9846 Magic Word: {{CURRENTMONTHNAME}}
9847 !! wikitext
9848 {{CURRENTMONTHNAME}}
9849 !! html
9850 <p>January
9851 </p>
9852 !! end
9853
9854 !! test
9855 Magic Word: {{CURRENTMONTHNAMEGEN}}
9856 !! wikitext
9857 {{CURRENTMONTHNAMEGEN}}
9858 !! html
9859 <p>January
9860 </p>
9861 !! end
9862
9863 !! test
9864 Magic Word: {{CURRENTTIME}}
9865 !! wikitext
9866 {{CURRENTTIME}}
9867 !! html
9868 <p>00:02
9869 </p>
9870 !! end
9871
9872 !! test
9873 Magic Word: {{CURRENTHOUR}}
9874 !! wikitext
9875 {{CURRENTHOUR}}
9876 !! html
9877 <p>00
9878 </p>
9879 !! end
9880
9881 !! test
9882 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9883 !! wikitext
9884 {{CURRENTWEEK}}
9885 !! html
9886 <p>1
9887 </p>
9888 !! end
9889
9890 !! test
9891 Magic Word: {{CURRENTYEAR}}
9892 !! wikitext
9893 {{CURRENTYEAR}}
9894 !! html
9895 <p>1970
9896 </p>
9897 !! end
9898
9899 !! test
9900 Magic Word: {{CURRENTTIMESTAMP}}
9901 !! wikitext
9902 {{CURRENTTIMESTAMP}}
9903 !! html
9904 <p>19700101000203
9905 </p>
9906 !! end
9907
9908 !! test
9909 Magic Words LOCAL (UTC)
9910 !! wikitext
9911 * {{LOCALMONTH}}
9912 * {{LOCALMONTH1}}
9913 * {{LOCALMONTHNAME}}
9914 * {{LOCALMONTHNAMEGEN}}
9915 * {{LOCALMONTHABBREV}}
9916 * {{LOCALDAY}}
9917 * {{LOCALDAY2}}
9918 * {{LOCALDAYNAME}}
9919 * {{LOCALYEAR}}
9920 * {{LOCALTIME}}
9921 * {{LOCALHOUR}}
9922 * {{LOCALWEEK}}
9923 * {{LOCALDOW}}
9924 * {{LOCALTIMESTAMP}}
9925 !! html
9926 <ul><li> 01</li>
9927 <li> 1</li>
9928 <li> January</li>
9929 <li> January</li>
9930 <li> Jan</li>
9931 <li> 1</li>
9932 <li> 01</li>
9933 <li> Thursday</li>
9934 <li> 1970</li>
9935 <li> 00:02</li>
9936 <li> 00</li>
9937 <li> 1</li>
9938 <li> 4</li>
9939 <li> 19700101000203</li></ul>
9940
9941 !! end
9942
9943 !! test
9944 Magic Word: {{FULLPAGENAME}}
9945 !! options
9946 title=[[User:Ævar Arnfjörð Bjarmason]]
9947 !! wikitext
9948 {{FULLPAGENAME}}
9949 !! html
9950 <p>User:Ævar Arnfjörð Bjarmason
9951 </p>
9952 !! end
9953
9954 !! test
9955 Magic Word: {{FULLPAGENAMEE}}
9956 !! options
9957 title=[[User:Ævar Arnfjörð Bjarmason]]
9958 !! wikitext
9959 {{FULLPAGENAMEE}}
9960 !! html
9961 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9962 </p>
9963 !! end
9964
9965 !! test
9966 Magic Word: {{TALKSPACE}}
9967 !! options
9968 title=[[User:Ævar Arnfjörð Bjarmason]]
9969 !! wikitext
9970 {{TALKSPACE}}
9971 !! html
9972 <p>User talk
9973 </p>
9974 !! end
9975
9976 !! test
9977 Magic Word: {{TALKSPACE}}, same namespace
9978 !! options
9979 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9980 !! wikitext
9981 {{TALKSPACE}}
9982 !! html
9983 <p>User talk
9984 </p>
9985 !! end
9986
9987 !! test
9988 Magic Word: {{TALKSPACE}}, main namespace
9989 !! options
9990 title=[[Parser Test]]
9991 !! wikitext
9992 {{TALKSPACE}}
9993 !! html
9994 <p>Talk
9995 </p>
9996 !! end
9997
9998 !! test
9999 Magic Word: {{TALKSPACEE}}
10000 !! options
10001 title=[[User:Ævar Arnfjörð Bjarmason]]
10002 !! wikitext
10003 {{TALKSPACEE}}
10004 !! html
10005 <p>User_talk
10006 </p>
10007 !! end
10008
10009 !! test
10010 Magic Word: {{SUBJECTSPACE}}
10011 !! options
10012 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10013 !! wikitext
10014 {{SUBJECTSPACE}}
10015 !! html
10016 <p>User
10017 </p>
10018 !! end
10019
10020 !! test
10021 Magic Word: {{SUBJECTSPACE}}, same namespace
10022 !! options
10023 title=[[User:Ævar Arnfjörð Bjarmason]]
10024 !! wikitext
10025 {{SUBJECTSPACE}}
10026 !! html
10027 <p>User
10028 </p>
10029 !! end
10030
10031 !! test
10032 Magic Word: {{SUBJECTSPACE}}, main namespace
10033 !! options
10034 title=[[Parser Test]]
10035 !! wikitext
10036 {{SUBJECTSPACE}}
10037 !! html
10038
10039 !! end
10040
10041 !! test
10042 Magic Word: {{SUBJECTSPACEE}}
10043 !! options
10044 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10045 !! wikitext
10046 {{SUBJECTSPACEE}}
10047 !! html
10048 <p>User
10049 </p>
10050 !! end
10051
10052 !! test
10053 Magic Word: {{NAMESPACE}}
10054 !! options
10055 title=[[User:Ævar Arnfjörð Bjarmason]]
10056 !! wikitext
10057 {{NAMESPACE}}
10058 !! html
10059 <p>User
10060 </p>
10061 !! end
10062
10063 !! test
10064 Magic Word: {{NAMESPACEE}}
10065 !! options
10066 title=[[User:Ævar Arnfjörð Bjarmason]]
10067 !! wikitext
10068 {{NAMESPACEE}}
10069 !! html
10070 <p>User
10071 </p>
10072 !! end
10073
10074 !! test
10075 Magic Word: {{NAMESPACENUMBER}}
10076 !! options
10077 title=[[User:Ævar Arnfjörð Bjarmason]]
10078 !! wikitext
10079 {{NAMESPACENUMBER}}
10080 !! html
10081 <p>2
10082 </p>
10083 !! end
10084
10085 !! test
10086 Magic Word: {{SUBPAGENAME}}
10087 !! options
10088 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10089 !! wikitext
10090 {{SUBPAGENAME}}
10091 !! html
10092 <p>sub ö
10093 </p>
10094 !! end
10095
10096 !! test
10097 Magic Word: {{SUBPAGENAMEE}}
10098 !! options
10099 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10100 !! wikitext
10101 {{SUBPAGENAMEE}}
10102 !! html
10103 <p>sub_%C3%B6
10104 </p>
10105 !! end
10106
10107 !! test
10108 Magic Word: {{ROOTPAGENAME}}
10109 !! options
10110 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10111 !! wikitext
10112 {{ROOTPAGENAME}}
10113 !! html
10114 <p>Ævar Arnfjörð Bjarmason
10115 </p>
10116 !! end
10117
10118 !! test
10119 Magic Word: {{ROOTPAGENAMEE}}
10120 !! options
10121 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10122 !! wikitext
10123 {{ROOTPAGENAMEE}}
10124 !! html
10125 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10126 </p>
10127 !! end
10128
10129 !! test
10130 Magic Word: {{BASEPAGENAME}}
10131 !! options
10132 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10133 !! wikitext
10134 {{BASEPAGENAME}}
10135 !! html
10136 <p>Ævar Arnfjörð Bjarmason
10137 </p>
10138 !! end
10139
10140 !! test
10141 Magic Word: {{BASEPAGENAMEE}}
10142 !! options
10143 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10144 !! wikitext
10145 {{BASEPAGENAMEE}}
10146 !! html
10147 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10148 </p>
10149 !! end
10150
10151 !! test
10152 Magic Word: {{TALKPAGENAME}}
10153 !! options
10154 title=[[User:Ævar Arnfjörð Bjarmason]]
10155 !! wikitext
10156 {{TALKPAGENAME}}
10157 !! html
10158 <p>User talk:Ævar Arnfjörð Bjarmason
10159 </p>
10160 !! end
10161
10162 !! test
10163 Magic Word: {{TALKPAGENAMEE}}
10164 !! options
10165 title=[[User:Ævar Arnfjörð Bjarmason]]
10166 !! wikitext
10167 {{TALKPAGENAMEE}}
10168 !! html
10169 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10170 </p>
10171 !! end
10172
10173 !! test
10174 Magic Word: {{SUBJECTPAGENAME}}
10175 !! options
10176 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10177 !! wikitext
10178 {{SUBJECTPAGENAME}}
10179 !! html
10180 <p>User:Ævar Arnfjörð Bjarmason
10181 </p>
10182 !! end
10183
10184 !! test
10185 Magic Word: {{SUBJECTPAGENAMEE}}
10186 !! options
10187 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10188 !! wikitext
10189 {{SUBJECTPAGENAMEE}}
10190 !! html
10191 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10192 </p>
10193 !! end
10194
10195 !! test
10196 Magic Word: {{NUMBEROFFILES}}
10197 !! wikitext
10198 {{NUMBEROFFILES}}
10199 !! html
10200 <p>7
10201 </p>
10202 !! end
10203
10204 !! test
10205 Magic Word: {{PAGENAME}}
10206 !! options
10207 title=[[User:Ævar Arnfjörð Bjarmason]]
10208 !! wikitext
10209 {{PAGENAME}}
10210 !! html
10211 <p>Ævar Arnfjörð Bjarmason
10212 </p>
10213 !! end
10214
10215 !! test
10216 Magic Word: {{PAGENAME}} with metacharacters
10217 !! options
10218 title=[['foo & bar = baz']]
10219 !! wikitext
10220 ''{{PAGENAME}}''
10221 !! html/php
10222 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10223 </p>
10224 !! html+tidy
10225 <p><i>'foo &amp; bar = baz'</i></p>
10226 !! end
10227
10228 !! test
10229 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
10230 !! options
10231 title=[[*RFC 1234 http://example.com/]]
10232 !! wikitext
10233 {{PAGENAME}}
10234 !! html/php
10235 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10236 </p>
10237 !! html+tidy
10238 <p>*RFC 1234 http://example.com/</p>
10239 !! end
10240
10241 !! test
10242 Magic Word: {{PAGENAMEE}}
10243 !! options
10244 title=[[User:Ævar Arnfjörð Bjarmason]]
10245 !! wikitext
10246 {{PAGENAMEE}}
10247 !! html
10248 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10249 </p>
10250 !! end
10251
10252 !! test
10253 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10254 !! options
10255 title=[[*RFC 1234 http://example.com/]]
10256 !! wikitext
10257 {{PAGENAMEE}}
10258 !! html/php
10259 <p>&#42;RFC_1234_http&#58;//example.com/
10260 </p>
10261 !! html+tidy
10262 <p>*RFC_1234_http://example.com/</p>
10263 !! end
10264
10265 !! test
10266 Magic Word: {{REVISIONID}}
10267 !! wikitext
10268 {{REVISIONID}}
10269 !! html
10270 <p>1337
10271 </p>
10272 !! end
10273
10274 !! test
10275 Magic Word: {{SCRIPTPATH}}
10276 !! wikitext
10277 {{SCRIPTPATH}}
10278 !! html
10279
10280 !! end
10281
10282 !! test
10283 Magic Word: {{STYLEPATH}}
10284 !! wikitext
10285 {{STYLEPATH}}
10286 !! html
10287 <p>/skins
10288 </p>
10289 !! end
10290
10291 !! test
10292 Magic Word: {{SERVER}}
10293 !! wikitext
10294 {{SERVER}}
10295 !! html
10296 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10297 </p>
10298 !! end
10299
10300 !! test
10301 Magic Word: {{SERVERNAME}}
10302 !! wikitext
10303 {{SERVERNAME}}
10304 !! html
10305 <p>example.org
10306 </p>
10307 !! end
10308
10309 !! test
10310 Magic Word: {{SITENAME}}
10311 !! wikitext
10312 {{SITENAME}}
10313 !! html
10314 <p>MediaWiki
10315 </p>
10316 !! end
10317
10318 !! test
10319 Magic Word: {{PAGELANGUAGE}}
10320 !! options
10321 language=fr
10322 !! wikitext
10323 {{PAGELANGUAGE}}
10324 !! html
10325 <p>fr
10326 </p>
10327 !! end
10328
10329 !! test
10330 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10331 !! wikitext
10332 {{PAGELANGUAGE}}
10333 !! html
10334 <p>en
10335 </p>
10336 !! end
10337
10338 !! test
10339 Case-sensitive magic words, when cased differently, should just be template transclusions
10340 !! wikitext
10341 {{CurrentMonth}}
10342 {{currentday}}
10343 {{cURreNTweEK}}
10344 {{currentHour}}
10345 !! html
10346 <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>
10347 <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>
10348 <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>
10349 <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>
10350 </p>
10351 !! end
10352
10353 !! test
10354 Case-insensitive magic words should still work with weird casing.
10355 !! wikitext
10356 {{sErVeRNaMe}}
10357 {{LCFirst:AOEU}}
10358 {{ucFIRST:aoeu}}
10359 {{SERver}}
10360 !! html
10361 <p>example.org
10362 aOEU
10363 Aoeu
10364 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10365 </p>
10366 !! end
10367
10368 # From plwiki:PLOS_ONE
10369 !! test
10370 Parsoid: Page property magic word with magic word contents
10371 !! wikitext
10372 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10373 !! html/parsoid
10374 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
10375 !! end
10376
10377 !! test
10378 Parsoid: Template-generated DISPLAYTITLE
10379 !! wikitext
10380 {{{{echo|DISPLAYTITLE}}:Foo}}
10381 !! html/parsoid
10382 <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}}]}'/>
10383 !! end
10384
10385 !! test
10386 Namespace 1 {{ns:1}}
10387 !! wikitext
10388 {{ns:1}}
10389 !! html
10390 <p>Talk
10391 </p>
10392 !! end
10393
10394 !! test
10395 Namespace 1 {{ns:01}}
10396 !! wikitext
10397 {{ns:01}}
10398 !! html
10399 <p>Talk
10400 </p>
10401 !! end
10402
10403 !! test
10404 Namespace 0 {{ns:0}} (bug 4783)
10405 !! wikitext
10406 {{ns:0}}
10407 !! html
10408
10409 !! end
10410
10411 !! test
10412 Namespace 0 {{ns:00}} (bug 4783)
10413 !! wikitext
10414 {{ns:00}}
10415 !! html
10416
10417 !! end
10418
10419 !! test
10420 Namespace -1 {{ns:-1}}
10421 !! wikitext
10422 {{ns:-1}}
10423 !! html
10424 <p>Special
10425 </p>
10426 !! end
10427
10428 !! test
10429 Namespace User {{ns:User}}
10430 !! wikitext
10431 {{ns:User}}
10432 !! html
10433 <p>User
10434 </p>
10435 !! end
10436
10437 !! test
10438 Namespace User talk {{ns:User_talk}}
10439 !! wikitext
10440 {{ns:User_talk}}
10441 !! html
10442 <p>User talk
10443 </p>
10444 !! end
10445
10446 !! test
10447 Namespace User talk {{ns:uSeR tAlK}}
10448 !! wikitext
10449 {{ns:uSeR tAlK}}
10450 !! html
10451 <p>User talk
10452 </p>
10453 !! end
10454
10455 !! test
10456 Namespace File {{ns:File}}
10457 !! wikitext
10458 {{ns:File}}
10459 !! html
10460 <p>File
10461 </p>
10462 !! end
10463
10464 !! test
10465 Namespace File {{ns:Image}}
10466 !! wikitext
10467 {{ns:Image}}
10468 !! html
10469 <p>File
10470 </p>
10471 !! end
10472
10473 !! test
10474 Namespace (lang=de) Benutzer {{ns:User}}
10475 !! options
10476 language=de
10477 !! wikitext
10478 {{ns:User}}
10479 !! html
10480 <p>Benutzer
10481 </p>
10482 !! end
10483
10484 !! test
10485 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10486 !! options
10487 language=de
10488 !! wikitext
10489 {{ns:3}}
10490 !! html
10491 <p>Benutzer Diskussion
10492 </p>
10493 !! end
10494
10495 !! test
10496 Urlencode
10497 !! wikitext
10498 {{urlencode:hi world?!}}
10499 {{urlencode:hi world?!|WIKI}}
10500 {{urlencode:hi world?!|PATH}}
10501 {{urlencode:hi world?!|QUERY}}
10502 !! html/php
10503 <p>hi+world%3F%21
10504 hi_world%3F!
10505 hi%20world%3F%21
10506 hi+world%3F%21
10507 </p>
10508 !! end
10509
10510 !! test
10511 Magic Word: prioritize type info over data-parsoid
10512 !! options
10513 parsoid=html2wt
10514 !! html/parsoid
10515 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10516 !! wikitext
10517 __FORCETOC__
10518 !! end
10519
10520 !! test
10521 Magic Word: serialize on separate line (parsoid)
10522 !! options
10523 parsoid=wt2wt,html2wt
10524 !! wikitext
10525 foo
10526 __NOTOC__
10527 bar
10528 !! html/parsoid
10529 foo<meta property="mw:PageProp/notoc"/>bar
10530 !! end
10531
10532 !! test
10533 Magic Word: rt non-english wikis
10534 !! options
10535 parsoid=wt2wt
10536 language=de
10537 !! wikitext
10538 __NOEDITSECTION__
10539 !! html/parsoid
10540 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10541 !! end
10542
10543 !!test
10544 __proto__ is treated as normal wikitext (T105997)
10545 !!wikitext
10546 __proto__
10547 !!html
10548 <p>__proto__
10549 </p>
10550 !!end
10551
10552 ###
10553 ### Magic links
10554 ###
10555 !! test
10556 Magic links: internal link to RFC (bug 479)
10557 !! wikitext
10558 [[RFC 123]]
10559 !! html/php
10560 <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>
10561 </p>
10562 !! html/parsoid
10563 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10564 !! end
10565
10566 !! test
10567 Magic links: RFC (bug 479)
10568 !! wikitext
10569 RFC 822
10570 !! html/php
10571 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10572 </p>
10573 !! html/parsoid
10574 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10575 !! end
10576
10577 !! test
10578 Magic links: RFC (bug 65278)
10579 !! wikitext
10580 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10581 !! html/php
10582 <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.
10583 </p>
10584 !! html/parsoid
10585 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10586 !! end
10587
10588 !! test
10589 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10590 !! wikitext
10591 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10592 RFC
10593 822
10594 !! html/php
10595 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10596 RFC
10597 822
10598 </p>
10599 !! html/parsoid
10600 <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>
10601 RFC
10602 822</p>
10603 !! end
10604
10605 !! test
10606 Magic links: ISBN (bug 1937)
10607 !! wikitext
10608 ISBN 0-306-40615-2
10609 !! html/php
10610 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10611 </p>
10612 !! html/parsoid
10613 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10614 !! end
10615
10616 !! test
10617 Magic links: ISBN (bug 65278)
10618 !! wikitext
10619 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10620 !! html/php
10621 <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.
10622 </p>
10623 !! html/parsoid
10624 <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>
10625 !! end
10626
10627 !! test
10628 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10629 !! wikitext
10630 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10631 ISBN
10632 9780316098113
10633 ISBN 978
10634 0316098113
10635 !! html/php
10636 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10637 ISBN
10638 9780316098113
10639 ISBN 978
10640 0316098113
10641 </p>
10642 !! html/parsoid
10643 <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>
10644 ISBN
10645 9780316098113
10646 ISBN 978
10647 0316098113</p>
10648 !! end
10649
10650 !! test
10651 Magic links: PMID incorrectly converts space to underscore
10652 !! wikitext
10653 PMID 1234
10654 !! html/php
10655 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10656 </p>
10657 !! html/parsoid
10658 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10659 !! end
10660
10661 !! test
10662 Magic links: PMID (bug 65278)
10663 !! wikitext
10664 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10665 !! html/php
10666 <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.
10667 </p>
10668 !! html/parsoid
10669 <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>
10670 !! end
10671
10672 !! test
10673 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10674 !! wikitext
10675 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10676 PMID
10677 1234
10678 !! html/php
10679 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10680 PMID
10681 1234
10682 </p>
10683 !! html/parsoid
10684 <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>
10685 PMID
10686 1234</p>
10687 !! end
10688
10689 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10690 # since these are ExtLinkText, not MagicLinkText
10691 !! test
10692 Magic links: use appropriate serialization for "almost" magic links.
10693 !! wikitext
10694 X[[Special:BookSources/0978739256|foo]]
10695
10696 X[//tools.ietf.org/html/rfc1234 foo]
10697 !! html/php
10698 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10699 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10700 </p>
10701 !! html/parsoid
10702 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10703 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10704 !! end
10705
10706 !! test
10707 Magic links: All disabled (T47942)
10708 !! options
10709 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10710 !! wikitext
10711 ISBN 0-306-40615-2
10712 PMID 1234
10713 RFC 4321
10714 !! html/php
10715 <p>ISBN 0-306-40615-2
10716 PMID 1234
10717 RFC 4321
10718 </p>
10719 !! end
10720
10721 ###
10722 ### Templates
10723 ####
10724
10725 !! test
10726 Nonexistent template
10727 !! wikitext
10728 {{thistemplatedoesnotexist}}
10729 !! html
10730 <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>
10731 </p>
10732 !! end
10733
10734 !! test
10735 Template with invalid target containing tags
10736 !! wikitext
10737 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10738 !! html
10739 <p>{{a<b>b</b>|foo|a=b|a = b}}
10740 </p>
10741 !! end
10742
10743 !! test
10744 Template with invalid target containing unclosed tag
10745 !! wikitext
10746 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10747 !! html
10748 <p>{{a<b>|foo|a=b|a = b}}</b>
10749 </p>
10750 !! end
10751
10752 !! test
10753 Template with invalid target containing wikilink
10754 !! wikitext
10755 {{[[Main Page]]}}
10756 !! html/php
10757 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10758 </p>
10759 !! html/parsoid
10760 <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>
10761 !! end
10762
10763 !! test
10764 Template with just whitespace in it, bug #68421
10765 !! wikitext
10766 {{echo|{{ }}}}
10767 !! html/parsoid
10768 <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>
10769 !! end
10770
10771 !! article
10772 Template:test
10773 !! text
10774 This is a test template
10775 !! endarticle
10776
10777 !! test
10778 Simple template
10779 !! wikitext
10780 {{test}}
10781 !! html
10782 <p>This is a test template
10783 </p>
10784 !! end
10785
10786 !! test
10787 Template with explicit namespace
10788 !! wikitext
10789 {{Template:test}}
10790 !! html
10791 <p>This is a test template
10792 </p>
10793 !! end
10794
10795
10796 !! article
10797 Template:paramtest
10798 !! text
10799 This is a test template with parameter {{{param}}}
10800 !! endarticle
10801
10802 !! test
10803 Template parameter
10804 !! wikitext
10805 {{paramtest|param=foo}}
10806 !! html
10807 <p>This is a test template with parameter foo
10808 </p>
10809 !! end
10810
10811 !! article
10812 Template:paramtestnum
10813 !! text
10814 [[{{{1}}}|{{{2}}}]]
10815 !! endarticle
10816
10817 !! test
10818 Template unnamed parameter
10819 !! wikitext
10820 {{paramtestnum|Main Page|the main page}}
10821 !! html
10822 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10823 </p>
10824 !! end
10825
10826 !! article
10827 Template:templatesimple
10828 !! text
10829 (test)
10830 !! endarticle
10831
10832 !! article
10833 Template:templateredirect
10834 !! text
10835 #redirect [[Template:templatesimple]]
10836 !! endarticle
10837
10838 !! article
10839 Template:templateasargtestnum
10840 !! text
10841 {{{{{1}}}}}
10842 !! endarticle
10843
10844 !! article
10845 Template:templateasargtest
10846 !! text
10847 {{template{{{templ}}}}}
10848 !! endarticle
10849
10850 !! article
10851 Template:templateasargtest2
10852 !! text
10853 {{{{{templ}}}}}
10854 !! endarticle
10855
10856 !! test
10857 Template with template name as unnamed argument
10858 !! wikitext
10859 {{templateasargtestnum|templatesimple}}
10860 !! html
10861 <p>(test)
10862 </p>
10863 !! end
10864
10865 !! test
10866 Template with template name as argument
10867 !! wikitext
10868 {{templateasargtest|templ=simple}}
10869 !! html
10870 <p>(test)
10871 </p>
10872 !! end
10873
10874 !! test
10875 Template with template name as argument (2)
10876 !! wikitext
10877 {{templateasargtest2|templ=templatesimple}}
10878 !! html
10879 <p>(test)
10880 </p>
10881 !! end
10882
10883 !! article
10884 Template:templateasargtestdefault
10885 !! text
10886 {{{{{templ|templatesimple}}}}}
10887 !! endarticle
10888
10889 !! article
10890 Template:templa
10891 !! text
10892 '''templ'''
10893 !! endarticle
10894
10895 !! test
10896 Template with default value
10897 !! wikitext
10898 {{templateasargtestdefault}}
10899 !! html
10900 <p>(test)
10901 </p>
10902 !! end
10903
10904 !! test
10905 Template with default value (value set)
10906 !! wikitext
10907 {{templateasargtestdefault|templ=templa}}
10908 !! html
10909 <p><b>templ</b>
10910 </p>
10911 !! end
10912
10913 !! test
10914 Template redirect
10915 !! wikitext
10916 {{templateredirect}}
10917 !! html/php
10918 <p>(test)
10919 </p>
10920 !! html/parsoid
10921 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10922 !! end
10923
10924 !! test
10925 Template with argument in separate line
10926 !! wikitext
10927 {{ templateasargtest |
10928 templ = simple }}
10929 !! html
10930 <p>(test)
10931 </p>
10932 !! end
10933
10934 !! test
10935 Template with complex template as argument
10936 !! wikitext
10937 {{paramtest|
10938 param ={{ templateasargtest |
10939 templ = simple }}}}
10940 !! html
10941 <p>This is a test template with parameter (test)
10942 </p>
10943 !! end
10944
10945 !! test
10946 Template with thumb image (with link in description)
10947 !! wikitext
10948 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10949 !! html/php
10950 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>
10951
10952 !! html+tidy
10953 <p>This is a test template with parameter</p>
10954 <div class="thumb tright">
10955 <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>
10956 <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>
10957 </div>
10958 </div>
10959 !! html/parsoid
10960 <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>
10961 !! end
10962
10963 !! article
10964 Template:complextemplate
10965 !! text
10966 {{{1}}} {{paramtest|
10967 param ={{{param}}}}}
10968 !! endarticle
10969
10970 !! test
10971 Template with complex arguments
10972 !! wikitext
10973 {{complextemplate|
10974 param ={{ templateasargtest |
10975 templ = simple }}|[[Template:complextemplate|link]]}}
10976 !! html
10977 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10978 </p>
10979 !! end
10980
10981 !! test
10982 BUG 553: link with two variables in a piped link
10983 !! wikitext
10984 {|
10985 |[[{{{1}}}|{{{2}}}]]
10986 |}
10987 !! html/php
10988 <table>
10989 <tr>
10990 <td>[[{{{1}}}|{{{2}}}]]
10991 </td></tr></table>
10992
10993 !! html/parsoid
10994 <table>
10995 <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>
10996 </tbody></table>
10997 !! end
10998
10999 # See: T2553
11000 !! test
11001 Abort table cell attribute parsing on wikilink
11002 !! wikitext
11003 {|
11004 | testing [[one|two]] | three || four
11005 | testing one two | three || four
11006 | testing="[[one|two]]" | three || four
11007 |}
11008 !! html/php
11009 <table>
11010 <tr>
11011 <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>
11012 <td> four
11013 </td>
11014 <td> three </td>
11015 <td> four
11016 </td>
11017 <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>
11018 <td> four
11019 </td></tr></table>
11020
11021 !! html/parsoid
11022 <table>
11023 <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>
11024 <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>
11025 <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>
11026 </tbody></table>
11027 !! end
11028
11029 !! test
11030 Don't abort table cell attribute parsing if wikilink is found in template arg
11031 !! wikitext
11032 {|
11033 | Test {{#tag:ref|One two "[[three]]" four}}
11034 |}
11035 !! html/parsoid
11036 <table>
11037 <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>
11038 </tbody></table>
11039 !! end
11040
11041 !! test
11042 Magic variable as template parameter
11043 !! wikitext
11044 {{paramtest|param={{SITENAME}}}}
11045 !! html
11046 <p>This is a test template with parameter MediaWiki
11047 </p>
11048 !! end
11049
11050 !! article
11051 Template:linktest
11052 !! text
11053 [[{{{param}}}|link]]
11054 !! endarticle
11055
11056 !! test
11057 Template parameter as link source
11058 !! wikitext
11059 {{linktest|param=Main Page}}
11060 !! html
11061 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11062 </p>
11063 !! end
11064
11065 !!article
11066 Template:paramtest2
11067 !! text
11068 including another template, {{paramtest|param={{{arg}}}}}
11069 !! endarticle
11070
11071 !! test
11072 Template passing argument to another template
11073 !! wikitext
11074 {{paramtest2|arg='hmm'}}
11075 !! html
11076 <p>including another template, This is a test template with parameter 'hmm'
11077 </p>
11078 !! end
11079
11080 !! article
11081 Template:Linktest2
11082 !! text
11083 Main Page
11084 !! endarticle
11085
11086 !! test
11087 Template as link source
11088 !! wikitext
11089 [[{{linktest2}}]]
11090
11091 [[{{linktest2}}|Main Page]]
11092
11093 [[{{linktest2}}]]Page
11094 !! html
11095 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11096 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11097 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11098 </p>
11099 !! end
11100
11101
11102 !! article
11103 Template:loop1
11104 !! text
11105 {{loop2}}
11106 !! endarticle
11107
11108 !! article
11109 Template:loop2
11110 !! text
11111 {{loop1}}
11112 !! endarticle
11113
11114 !! test
11115 Template infinite loop
11116 !! wikitext
11117 {{loop1}}
11118 !! html
11119 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11120 </p>
11121 !! end
11122
11123 !! test
11124 Template from main namespace
11125 !! wikitext
11126 {{:Main Page}}
11127 !! html
11128 <p>blah blah
11129 </p>
11130 !! end
11131
11132 !! article
11133 Template:table
11134 !! text
11135 {|
11136 | 1 || 2
11137 |-
11138 | 3 || 4
11139 |}
11140 !! endarticle
11141
11142 !! test
11143 BUG 529: Template with table, not included at beginning of line
11144 !! wikitext
11145 foo {{table}}
11146 !! html
11147 <p>foo
11148 </p>
11149 <table>
11150 <tr>
11151 <td> 1 </td>
11152 <td> 2
11153 </td></tr>
11154 <tr>
11155 <td> 3 </td>
11156 <td> 4
11157 </td></tr></table>
11158
11159 !! end
11160
11161 !! test
11162 BUG 523: Template shouldn't eat newline (or add an extra one before table)
11163 !! wikitext
11164 foo
11165 {{table}}
11166 !! html
11167 <p>foo
11168 </p>
11169 <table>
11170 <tr>
11171 <td> 1 </td>
11172 <td> 2
11173 </td></tr>
11174 <tr>
11175 <td> 3 </td>
11176 <td> 4
11177 </td></tr></table>
11178
11179 !! end
11180
11181 !! test
11182 BUG 41: Template parameters shown as broken links
11183 !! wikitext
11184 {{{parameter}}}
11185 !! html
11186 <p>{{{parameter}}}
11187 </p>
11188 !! end
11189
11190 !! test
11191 Template with targets containing wikilinks
11192 !! wikitext
11193 {{[[foo]]}}
11194
11195 {{[[{{echo|foo}}]]}}
11196
11197 {{{{echo|[[foo}}]]}}
11198 !! html
11199 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11200 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11201 </p><p>{{[[foo}}]]
11202 </p>
11203 !! end
11204
11205 !! article
11206 Template:''
11207 !! text
11208 bar
11209 !! endarticle
11210
11211 !! test
11212 Templates: Double quotes as template target
11213 !! wikitext
11214 foo {{''}} baz
11215 !! html/php
11216 <p>foo bar baz
11217 </p>
11218 !! html/parsoid
11219 <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
11220 </p>
11221 !! end
11222
11223 ## This test is about making sure Parsoid's data-mw is well formed in the
11224 ## face of multiple templates with intersecting and overlapping ranges. The
11225 ## wikitext itself is wretched.
11226 !! test
11227 Templates with intersecting and overlapping ranges
11228 !! wikitext
11229 {|{{echo|
11230 <p>ha</p>}}
11231 {|{{echo|
11232 <p>ho</p>}}
11233 {{echo|{{!}}hi}}
11234 |}
11235 !! html/php+tidy
11236 <p>ha</p>
11237 <p>ho</p>
11238 <table>
11239 <tr>
11240 <td></td>
11241 </tr>
11242 <tr>
11243 <td>hi</td>
11244 </tr>
11245 </table>
11246 <table>
11247 <tr>
11248 <td></td>
11249 </tr>
11250 </table>
11251 !! html/parsoid
11252 <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":""}]]}'>
11253
11254 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11255
11256 <tbody><tr><td>hi</td></tr>
11257 </tbody></table>
11258 !! end
11259
11260 !! article
11261 Template:MSGNW test
11262 !! text
11263 ''None'' of '''this''' should be
11264 * interpreted
11265 but rather passed unmodified
11266 {{test}}
11267 <gallery>
11268 File:Foobar.jpg
11269 </gallery>
11270 <!-- comment -->
11271 !! endarticle
11272
11273 # hmm, fix this or just deprecate msgnw and document its behavior?
11274 !! test
11275 msgnw keyword
11276 !! wikitext
11277 {{msgnw:MSGNW test}}
11278 !! html/php
11279 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11280 &#42; interpreted
11281 &#32;but rather passed unmodified
11282 &#123;&#123;test&#125;&#125;
11283 &#60;gallery&#62;
11284 File:Foobar.jpg
11285 &#60;/gallery&#62;
11286 &#60;!-- comment --&#62;
11287 </p>
11288 !! end
11289
11290 !! test
11291 int keyword
11292 !! wikitext
11293 {{int:youhavenewmessages|lots of money|not!}}
11294 !! html
11295 <p>You have lots of money (not!).
11296 </p>
11297 !! end
11298
11299 !! test
11300 int keyword - non-existing message
11301 !! wikitext
11302 {{int:var}}
11303 !! html
11304 <p>⧼var⧽
11305 </p>
11306 !! end
11307
11308 !! article
11309 Template:Includes
11310 !! text
11311 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11312 !! endarticle
11313
11314 !! test
11315 <includeonly> and <noinclude> being included
11316 !! wikitext
11317 {{Includes}}
11318 !! html
11319 <p>Foobar
11320 </p>
11321 !! end
11322
11323 !! article
11324 Template:Includes2
11325 !! text
11326 <onlyinclude>Foo</onlyinclude>bar
11327 !! endarticle
11328
11329 !! test
11330 <onlyinclude> being included
11331 !! wikitext
11332 {{Includes2}}
11333 !! html
11334 <p>Foo
11335 </p>
11336 !! end
11337
11338
11339 !! article
11340 Template:Includes3
11341 !! text
11342 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11343 !! endarticle
11344
11345 !! test
11346 <onlyinclude> and <includeonly> being included
11347 !! wikitext
11348 {{Includes3}}
11349 !! html
11350 <p>Foo
11351 </p>
11352 !! end
11353
11354 !! test
11355 <includeonly> and <noinclude> on a page
11356 !! wikitext
11357 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11358 !! html
11359 <p>Foozar
11360 </p>
11361 !! end
11362
11363 !! test
11364 Un-closed <noinclude>
11365 !! wikitext
11366 <noinclude>
11367 !! html
11368 !! end
11369
11370 !! test
11371 <onlyinclude> on a page
11372 !! wikitext
11373 <onlyinclude>Foo</onlyinclude>bar
11374 !! html
11375 <p>Foobar
11376 </p>
11377 !! end
11378
11379 !! test
11380 Un-closed <onlyinclude>
11381 !! wikitext
11382 <onlyinclude>
11383 !! html
11384 !! end
11385
11386 !!test
11387 Self-closed noinclude, includeonly, onlyinclude tags
11388 !! wikitext
11389 <noinclude />
11390 <includeonly />
11391 <onlyinclude />
11392 !! html
11393 <p><br />
11394 </p>
11395 !!end
11396
11397 !!test
11398 Unbalanced includeonly and noinclude tags
11399 !! wikitext
11400 {|
11401 |a</noinclude>
11402 |b</noinclude></noinclude>
11403 |c</noinclude></includeonly>
11404 |d</includeonly></includeonly>
11405 |}
11406 !! html
11407 <table>
11408 <tr>
11409 <td>a
11410 </td>
11411 <td>b
11412 </td>
11413 <td>c&lt;/includeonly&gt;
11414 </td>
11415 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11416 </td></tr></table>
11417
11418 !!end
11419
11420 !! article
11421 Template:Includeonly section
11422 !! text
11423 <includeonly>
11424 ==Includeonly section==
11425 </includeonly>
11426 ==Section T-1==
11427 !!endarticle
11428
11429 !! test
11430 Bug 6563: Edit link generation for section shown by <includeonly>
11431 !! wikitext
11432 {{includeonly section}}
11433 !! html
11434 <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>
11435 <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>
11436
11437 !! end
11438
11439 # Uses same input as the contents of [[Template:Includeonly section]]
11440 !! test
11441 Bug 6563: Section extraction for section shown by <includeonly>
11442 !! options
11443 section=T-2
11444 !! wikitext
11445 <includeonly>
11446 ==Includeonly section==
11447 </includeonly>
11448 ==Section T-2==
11449 !! html
11450 ==Section T-2==
11451 !! end
11452
11453 !! test
11454 Bug 6563: Edit link generation for section suppressed by <includeonly>
11455 !! wikitext
11456 <includeonly>
11457 ==Includeonly section==
11458 </includeonly>
11459 ==Section 1==
11460 !! html
11461 <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>
11462
11463 !! end
11464
11465 !! test
11466 Bug 6563: Section extraction for section suppressed by <includeonly>
11467 !! options
11468 section=1
11469 !! wikitext
11470 <includeonly>
11471 ==Includeonly section==
11472 </includeonly>
11473 ==Section 1==
11474 !! html
11475 ==Section 1==
11476 !! end
11477
11478 !! test
11479 Un-closed <includeonly>
11480 !! wikitext
11481 <includeonly>
11482 !! html/php
11483 !! html/parsoid
11484 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11485 !! end
11486
11487 ## We used to, but no longer wt2wt this test since the default serializer
11488 ## will normalize the include directives to serialize on their own line.
11489 ## Selser will take care of preserving formatting in scenarios where they
11490 ## intermingled with other wikitext.
11491 !! test
11492 Includes and comments at SOL
11493 !! options
11494 parsoid=wt2html,html2html
11495 !! wikitext
11496 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11497
11498 <noinclude>
11499 some
11500 </noinclude>* stuff
11501 * here
11502
11503 <includeonly>can have stuff</includeonly>=== here ===
11504
11505 !! html/php
11506 <h2><span class="mw-headline" id="hu">hu</span></h2>
11507 <p>some
11508 </p>
11509 <ul><li> stuff</li>
11510 <li> here</li></ul>
11511 <h3><span class="mw-headline" id="here">here</span></h3>
11512
11513 !! html/parsoid
11514 <!-- 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>
11515
11516 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11517 <p>some</p>
11518 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11519 <li> here</li></ul>
11520
11521 <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>
11522
11523 !! end
11524
11525 # TODO: test with DOM fragment reuse!
11526 !! test
11527 Parsoid: DOM fragment reuse
11528 !! options
11529 parsoid=wt2wt,wt2html
11530 !! wikitext
11531 a{{echo|b<table></table>c}}d
11532
11533 a{{echo|b
11534 <table></table>
11535 c}}d
11536
11537 {{echo|a
11538
11539 <table></table>
11540
11541 b}}
11542 !! html
11543 <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>
11544
11545 <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">
11546 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11547 </span><p about="#mwt2">cd</p>
11548
11549 <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">
11550
11551 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11552
11553 </span><p about="#mwt3">b</p>
11554 !! end
11555
11556 !! test
11557 Parsoid: Merge double tds (T52603)
11558 !! options
11559 parsoid
11560 !! wikitext
11561 {|
11562 |{{echo|{{!}} foo}}
11563 |}
11564 !! html
11565 <table><tbody>
11566 <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>
11567 </tbody></table>
11568 !! end
11569
11570 !! test
11571 Parsoid: Merge double tds in nested transclusion content (T52603)
11572 !! options
11573 parsoid
11574 !! wikitext
11575 {{echo|<div>}}
11576 {|
11577 |{{echo|{{!}} foo}}
11578 |}
11579 {{echo|</div>}}
11580 !! html
11581 <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}}]}'>
11582 <table><tbody>
11583 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11584 </tbody></table>
11585 </div>
11586 !! end
11587
11588 ###
11589 ### <includeonly> and <noinclude> in attributes
11590 ###
11591 !!test
11592 0. includeonly around the entire attribute
11593 !! wikitext
11594 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11595 !! html
11596 <p><span id="v2">bar</span>
11597 </p>
11598 !!end
11599
11600 !!test
11601 1. includeonly in html attr key
11602 !! wikitext
11603 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11604 !! html
11605 <p><span id="foo">bar</span>
11606 </p>
11607 !!end
11608
11609 !!test
11610 2. includeonly in html attr value
11611 !! wikitext
11612 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11613 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11614 !! html
11615 <p><span id="v1">bar</span>
11616 <span id="v1">bar</span>
11617 </p>
11618 !!end
11619
11620 !!test
11621 3. includeonly in part of an attr value
11622 !! wikitext
11623 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11624 !! html
11625 <p><span style="color:red;">bar</span>
11626 </p>
11627 !!end
11628
11629 !!test
11630 4. includeonly in table attributes
11631 !! wikitext
11632 {|
11633 |- <noinclude>
11634 |-
11635 |a
11636 </noinclude>
11637 |- <includeonly>
11638 |-
11639 |b
11640 </includeonly>
11641 |}
11642 !! html
11643 <table>
11644
11645
11646 <tr>
11647 <td>a
11648 </td></tr>
11649 </table>
11650
11651 !!end
11652
11653 ###
11654 ### Token Stream Patcher tests
11655 ###
11656 ### These tests won't always pass wt2wt and other modes because
11657 ### on serialization, the table will be output on a new line.
11658 ### For now, we are blacklisting them, and using this to test selser.
11659 ###
11660
11661 !!test
11662 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11663 !!options
11664 parsoid=wt2html,wt2wt
11665 !!wikitext
11666 {{echo|}}{| width = '100%'
11667 |foo
11668 |}
11669 !!html/parsoid
11670 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11671 <tbody><tr><td>foo</td></tr>
11672 </tbody></table>
11673 !!end
11674
11675 ## We used to, but no longer wt2wt this test since the default serializer
11676 ## will normalize the include directives to serialize on their own line.
11677 ## Selser will take care of preserving formatting in scenarios where they
11678 ## intermingled with other wikitext.
11679 !!test
11680 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11681 !!options
11682 parsoid=wt2html
11683 !!wikitext
11684 <includeonly>a</includeonly>{| {{{b}}}
11685 |c
11686 |}
11687 !!html/parsoid
11688 <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":""}]]}'>
11689 <tbody><tr><td>c</td></tr>
11690 </tbody></table>
11691 !!end
11692
11693 !! test
11694 Table wikitext syntax outside wiki-tables
11695 !! wikitext
11696 a
11697 |+ not a caption
11698 ! not a table heading
11699 |- not a table row
11700 | not a table cell
11701 | class="foo bar" | baz
11702 b
11703 |}
11704 |-
11705 c
11706 !! html
11707 <p>a
11708 |+ not a caption
11709 ! not a table heading
11710 |- not a table row
11711 | not a table cell
11712 | class="foo bar" | baz
11713 b
11714 |}
11715 |-
11716 c
11717 </p>
11718 !! end
11719
11720 ###
11721 ### Testing parsing of templates where a template arg
11722 ### has the same name as the template itself.
11723 ###
11724
11725 !! article
11726 Template:quote
11727 !! text
11728 {{{quote|{{{1}}}}}}
11729 !! endarticle
11730
11731 !!test
11732 Templates: Template Name/Arg clash: 1. Use of positional param
11733 !! wikitext
11734 {{quote|foo}}
11735 !! html
11736 <p>foo
11737 </p>
11738 !!end
11739
11740 !!test
11741 Templates: Template Name/Arg clash: 2. Use of named param
11742 !! wikitext
11743 {{quote|quote=foo}}
11744 !! html
11745 <p>foo
11746 </p>
11747 !!end
11748
11749 !!test
11750 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11751 !! wikitext
11752 {{quote|quote}}
11753 !! html
11754 <p>quote
11755 </p>
11756 !!end
11757
11758 ###
11759 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11760 ###
11761
11762 !!test
11763 Templates: 1. Simple use
11764 !! wikitext
11765 {{echo|Foo}}
11766 !! html
11767 <p>Foo
11768 </p>
11769 !!end
11770
11771 !!test
11772 Templates: 2. Inside a block tag
11773 !! wikitext
11774 <div>{{echo|Foo}}</div>
11775 <blockquote>{{echo|Foo}}</blockquote>
11776 !! html
11777 <div>Foo</div>
11778 <blockquote>Foo</blockquote>
11779
11780 !! html+tidy
11781 <div>Foo</div>
11782 <blockquote>
11783 <p>Foo</p>
11784 </blockquote>
11785 !!end
11786
11787 !!test
11788 Templates: P-wrapping: 1a. Templates on consecutive lines
11789 !! wikitext
11790 {{echo|Foo}}
11791 {{echo|bar}}
11792 !! html
11793 <p>Foo
11794 bar
11795 </p>
11796 !!end
11797
11798 !!test
11799 Templates: P-wrapping: 1b. Templates on consecutive lines
11800 !! wikitext
11801 Foo
11802
11803 {{echo|bar}}
11804 {{echo|baz}}
11805 !! html
11806 <p>Foo
11807 </p><p>bar
11808 baz
11809 </p>
11810 !!end
11811
11812 !!test
11813 Templates: P-wrapping: 1c. Templates on consecutive lines
11814 !! wikitext
11815 {{echo|Foo}}
11816 {{echo|bar}} <div>baz</div>
11817 !! html
11818 <p>Foo
11819 </p>
11820 bar <div>baz</div>
11821
11822 !! html+tidy
11823 <p>Foo</p>
11824 <p>bar</p>
11825 <div>baz</div>
11826 !! end
11827
11828 !!test
11829 Templates: P-wrapping: 1d. Template preceded by comment-only line
11830 !!options
11831 parsoid
11832 !! wikitext
11833 <!-- foo -->
11834 {{echo|Bar}}
11835 !! html
11836 <!-- foo -->
11837
11838 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11839 !!end
11840
11841 !!test
11842 Templates: Inline Text: 1. Multiple template uses
11843 !! wikitext
11844 {{echo|Foo}}bar{{echo|baz}}
11845 !! html
11846 <p>Foobarbaz
11847 </p>
11848 !!end
11849
11850 !!test
11851 Templates: Inline Text: 2. Back-to-back template uses
11852 !! wikitext
11853 {{echo|Foo}}{{echo|bar}}
11854 !! html
11855 <p>Foobar
11856 </p>
11857 !!end
11858
11859 !!test
11860 Templates: Block Tags: 1. Multiple template uses
11861 !! wikitext
11862 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11863 !! html
11864 <div>Foo</div><div>bar</div><div>baz</div>
11865
11866 !!end
11867
11868 !!test
11869 Templates: Block Tags: 2. Back-to-back template uses
11870 !! wikitext
11871 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11872 !! html
11873 <div>Foo</div><div>bar</div>
11874
11875 !!end
11876
11877 # This is an edge case relating to paragraph wrapping.
11878 !!test
11879 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11880 !! wikitext
11881 {{echo|a
11882 b</p>}}
11883 !! html/parsoid
11884 <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
11885 b</p>
11886 !!end
11887
11888 !!test
11889 Templates: Links: 1. Simple example
11890 !! wikitext
11891 {{echo|[[Foo|bar]]}}
11892 !! html
11893 <p><a href="/wiki/Foo" title="Foo">bar</a>
11894 </p>
11895 !!end
11896
11897 !!test
11898 Templates: Links: 2. Generation of link href
11899 !! wikitext
11900 [[{{echo|Foo}}|bar]]
11901 !! html
11902 <p><a href="/wiki/Foo" title="Foo">bar</a>
11903 </p>
11904 !!end
11905
11906 !!test
11907 Templates: Links: 3. Generation of part of a link href
11908 !! wikitext
11909 [[Fo{{echo|o}}|bar]]
11910
11911 [[Foo{{echo|bar}}]]
11912
11913 [[Foo{{echo|bar}}baz]]
11914
11915 [[Foo{{echo|bar}}|bar]]
11916
11917 [[:Foo{{echo|bar}}]]
11918
11919 [[:Foo{{echo|bar}}|bar]]
11920 !! html
11921 <p><a href="/wiki/Foo" title="Foo">bar</a>
11922 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11923 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11924 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11925 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11926 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11927 </p>
11928 !!end
11929
11930 !!test
11931 Templates: Links: 4. Multiple templates generating link href
11932 !! wikitext
11933 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11934 !! html
11935 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11936 </p>
11937 !!end
11938
11939 !!test
11940 Templates: Links: 5. Generation of link text
11941 !! wikitext
11942 [[Foo|{{echo|bar}}]]
11943 !! html
11944 <p><a href="/wiki/Foo" title="Foo">bar</a>
11945 </p>
11946 !!end
11947
11948 !!test
11949 Templates: Links: 5. Nested templates (only outermost template should be marked)
11950 !! wikitext
11951 {{echo|[[{{echo|Foo}}|bar]]}}
11952 !! html
11953 <p><a href="/wiki/Foo" title="Foo">bar</a>
11954 </p>
11955 !!end
11956
11957 !!test
11958 Templates: HTML Tag: 1. Generation of HTML attr. key
11959 !! wikitext
11960 <div {{echo|style}}="color:red;">foo</div>
11961 !! html
11962 <div style="color:red;">foo</div>
11963
11964 !!end
11965
11966 !!test
11967 Templates: HTML Tag: 2. Generation of HTML attr. value
11968 !! wikitext
11969 <div style={{echo|'color:red;'}}>foo</div>
11970 !! html
11971 <div style="color:red;">foo</div>
11972
11973 !!end
11974
11975 !!test
11976 Templates: HTML Tag: 3. Generation of HTML attr key and value
11977 !! wikitext
11978 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11979 !! html
11980 <div style="color:red;">foo</div>
11981
11982 !!end
11983
11984 !!test
11985 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11986 !! wikitext
11987 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11988 !! html
11989 <div title="This is a long title with just one piece templated">foo</div>
11990
11991 !!end
11992
11993 !!test
11994 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11995 !! wikitext
11996 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11997 !! html
11998 <div title="This is a long title with just one piece templated">foo</div>
11999
12000 !!end
12001
12002 !!test
12003 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12004 !! wikitext
12005 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12006 !! html
12007 <div title="This is a long title with just one piece templated">foo</div>
12008
12009 !!end
12010
12011 # SSS FIXME: While it is great we added support for all this,
12012 # do we want to make this part of the spec? Maybe we want to
12013 # deprecate this kind of usage in the future?
12014 !!test
12015 Templates: HTML Tag: 7. Generation of partial attribute key string
12016 !! wikitext
12017 <div st{{echo|yle}}="color:red;">foo</div>
12018 !! html
12019 <div style="color:red;">foo</div>
12020
12021 !!end
12022
12023 !! test
12024 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12025 !! wikitext
12026 <div {{echo|1=id="v1"}}>bar</div>
12027 !! html
12028 <div id="v1">bar</div>
12029
12030 !!end
12031
12032 !! test
12033 Templates: HTML Tag: 9. Multiple template-generated attributes
12034 !! wikitext
12035 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12036 !! html
12037 <div id="v1" title="foo">bar</div>
12038
12039 !!end
12040
12041 !! test
12042 Templates: Support for templates generating attributes and content
12043 !! wikitext
12044 {| {{mixed_attr_content_template}}
12045 |-
12046 |bar
12047 |}
12048 !! html/php
12049 <table style="color:red;" title="T48811">
12050
12051 <tr>
12052 <td>foo
12053 </td></tr>
12054 <tr>
12055 <td>bar
12056 </td></tr></table>
12057
12058 !! html/parsoid
12059 <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|}"]}'>
12060 <tbody><tr>
12061 <td>foo</td></tr>
12062 <tr>
12063 <td>bar</td></tr>
12064 </tbody></table>
12065 !!end
12066
12067 !! test
12068 1. Entities and nowikis inside templated attributes should be handled correctly
12069 !! wikitext
12070 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12071 !! html/php
12072 <div style="background:#f9f9f9;">foo</div>
12073
12074 !! html/parsoid
12075 <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>
12076 !! end
12077
12078 !! test
12079 2. Entities and nowikis inside templated attributes should be handled correctly
12080 !! wikitext
12081 {|
12082 |{{table_attribs_3}}
12083 |}
12084 !! html/php
12085 <table>
12086 <tr>
12087 <td style="background:#f9f9f9;">Foo
12088 </td></tr></table>
12089
12090 !! html/parsoid
12091 <table>
12092 <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>
12093 </tbody></table>
12094 !! end
12095
12096 !! test
12097 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12098 !! wikitext
12099 {{tbl-start}}
12100 |{{table_attribs_3}}
12101 {{tbl-end}}
12102 !! html/php
12103 <table>
12104 <tr>
12105 <td style="background:#f9f9f9;">Foo
12106 </td></tr></table>
12107
12108 !! html/parsoid
12109 <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}}]}'>
12110 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12111 </tbody></table>
12112 !! end
12113
12114 # T107622
12115 !! test
12116 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12117 !! wikitext
12118 {|
12119 | {{table_attribs_6}} hi
12120 |}
12121 !! html/php
12122 <table>
12123 <tr>
12124 <td style="background: red;"> hi
12125 </td></tr></table>
12126
12127 !! html/parsoid
12128 <table>
12129 <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>
12130 </tbody></table>
12131 !! end
12132
12133 !!test
12134 Templates: HTML Tables: 1. Generating start of a HTML table
12135 !! wikitext
12136 {{echo|<table><tr><td>foo</td>}}</tr></table>
12137 !! html
12138 <table><tr><td>foo</td></tr></table>
12139
12140 !!end
12141
12142 !!test
12143 Templates: HTML Tables: 2a. Generating middle of a HTML table
12144 !! wikitext
12145 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12146 !! html
12147 <table><tr><td>foo</td></tr></table>
12148
12149 !!end
12150
12151 !!test
12152 Templates: HTML Tables: 2b. Generating middle of a HTML table
12153 !! wikitext
12154 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12155 !! html
12156 <table><tr><td>foo</td></tr></table>
12157
12158 !!end
12159
12160 !!test
12161 Templates: HTML Tables: 3. Generating end of a HTML table
12162 !! wikitext
12163 <table><tr>{{echo|<td>foo</td></tr></table>}}
12164 !! html
12165 <table><tr><td>foo</td></tr></table>
12166
12167 !!end
12168
12169 !!test
12170 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12171 !! wikitext
12172 {{echo|<table>}}<tr><td>foo</td></tr></table>
12173 !! html
12174 <table><tr><td>foo</td></tr></table>
12175
12176 !!end
12177
12178 !!test
12179 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12180 !! wikitext
12181 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12182 !! html
12183 <table><tr><td>foo</td></tr></table>
12184
12185 !!end
12186
12187 !!test
12188 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12189 !! wikitext
12190 <table><tr>{{echo|<td>}}foo</td></tr></table>
12191 !! html
12192 <table><tr><td>foo</td></tr></table>
12193
12194 !!end
12195
12196 !!test
12197 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12198 !! wikitext
12199 <table><tr><td>foo{{echo|</td>}}</tr></table>
12200 !! html
12201 <table><tr><td>foo</td></tr></table>
12202
12203 !!end
12204
12205 !!test
12206 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12207 !! wikitext
12208 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12209 !! html
12210 <table><tr><td>foo</td></tr></table>
12211
12212 !!end
12213
12214 !!test
12215 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12216 !! wikitext
12217 <table><tr><td>foo</td></tr>{{echo|</table>}}
12218 !! html
12219 <table><tr><td>foo</td></tr></table>
12220
12221 !!end
12222
12223 !!test
12224 Templates: HTML Tables: 5. Proper fostering of categories from inside
12225 !!options
12226 parsoid=wt2html,wt2wt
12227 !! wikitext
12228 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12229 <!--Two categories (Bug 50330)-->
12230 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12231 !! html
12232 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12233 <!--Two categories (Bug 50330)-->
12234 <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>
12235 !!end
12236
12237 !!test
12238 Templates: Wiki Tables: 1a. Fostering of entire template content
12239 !! wikitext
12240 {|
12241 {{echo|a}}
12242 |}
12243 !! html
12244 <table>
12245 a
12246 <tr><td></td></tr></table>
12247
12248 !! html+tidy
12249 <p>a</p>
12250 <table>
12251 <tr>
12252 <td></td>
12253 </tr>
12254 </table>
12255 !! end
12256
12257 !!test
12258 Templates: Wiki Tables: 1b. Fostering of entire template content
12259 !! wikitext
12260 {|
12261 {{echo|<div>}}
12262 foo
12263 {{echo|</div>}}
12264 |}
12265 !! html
12266 <table>
12267 <div>
12268 <p>foo
12269 </p>
12270 </div>
12271 <tr><td></td></tr></table>
12272
12273 !! html+tidy
12274 <div>
12275 <p>foo</p>
12276 </div>
12277 <table>
12278 <tr>
12279 <td></td>
12280 </tr>
12281 </table>
12282 !! end
12283
12284 !!test
12285 Templates: Wiki Tables: 2. Fostering of partial template content
12286 !! wikitext
12287 {|
12288 {{echo|a
12289 <div>b</div>}}
12290 |}
12291 !! html
12292 <table>
12293 a
12294 <div>b</div>
12295 <tr><td></td></tr></table>
12296
12297 !! html+tidy
12298 <p>a</p>
12299 <div>b</div>
12300 <table>
12301 <tr>
12302 <td></td>
12303 </tr>
12304 </table>
12305 !! end
12306
12307 !!test
12308 Templates: Wiki Tables: 3. td-content via multiple templates
12309 !! wikitext
12310 {|
12311 {{echo|{{pipe}}a}}{{echo|b}}
12312 |}
12313 !! html
12314 <table>
12315 <tr>
12316 <td>ab
12317 </td></tr></table>
12318
12319 !!end
12320
12321 !!test
12322 Templates: Wiki Tables: 4. Templated tags, no content
12323 !! wikitext
12324 {{tbl-start}}
12325 {{tbl-end}}
12326 !! html
12327 <table>
12328 <tr><td></td></tr></table>
12329
12330 !!end
12331
12332 !!test
12333 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12334 !! wikitext
12335 {{tbl-start}}
12336 |foo
12337 {{tbl-end}}
12338 !! html
12339 <table>
12340 <tr>
12341 <td>foo
12342 </td></tr></table>
12343
12344 !!end
12345
12346 !!test
12347 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12348 !! wikitext
12349 {{tbl-start}}
12350 {{!}}foo
12351 {{tbl-end}}
12352 !! html
12353 <table>
12354 <tr>
12355 <td>foo
12356 </td></tr></table>
12357
12358 !!end
12359
12360 ## This test case is very specific to Parsoid's internals
12361 ## and is hence only tested for Parsoid's code. Parsoid uses
12362 ## a <meta> marker tag for <ref> tags and they are expanded
12363 ## much later. We are verifying that this <meta> tag usage
12364 ## doesn't prevent foster parenting.
12365 !!test
12366 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12367 !!wikitext
12368 {{PartialTable}}<ref>foo</ref>
12369 |}
12370
12371 <references />
12372 !!html/parsoid
12373 <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">
12374 <tbody>
12375 </tbody></table>
12376
12377 <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>
12378 !!end
12379
12380 !! test
12381 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12382 !! wikitext
12383 {{echo|
12384 {{{!}}
12385 {{!}}-}}
12386 <onlyinclude>
12387 |foo
12388 </onlyinclude>
12389 {{!}}}
12390 !! html/parsoid
12391 <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{{!}}}"]}'>
12392 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12393 <tbody><tr>
12394
12395 <td>foo
12396 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12397 </tbody></table>
12398 !! end
12399
12400 !!test
12401 Templates: Lists: Multi-line list-items via templates
12402 !! wikitext
12403 *{{echo|a {{nonexistent|
12404 unused}}}}
12405 *{{echo|b {{nonexistent|
12406 unused}}}}
12407 !! html
12408 <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>
12409 <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>
12410
12411 !!end
12412
12413 !!test
12414 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12415 !! wikitext
12416 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12417 !! html
12418 <p><i>ab</i>c<i>d</i>e
12419 </p>
12420 !!end
12421
12422 !!test
12423 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12424 (PHP parser generates misnested html)
12425 !! wikitext
12426 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12427 !! html/parsoid
12428 <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>
12429 !!end
12430
12431 !!test
12432 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12433 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12434 !! options
12435 parsoid=wt2html,wt2wt
12436 !! wikitext
12437 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12438 !! html
12439 <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>
12440 <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>
12441 <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>
12442 !!end
12443
12444 !!test
12445 Templates: Ugly nesting: 4. Divs opened/closed across templates
12446 !! wikitext
12447 a<div>b{{echo|c</div>d}}e
12448 !! html
12449 a<div>bc</div>de
12450
12451 !! html+tidy
12452 <p>a</p>
12453 <div>bc</div>
12454 <p>de</p>
12455 !! end
12456
12457 !!test
12458 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12459 (Parsoid-centric)
12460 !! options
12461 parsoid
12462 !! wikitext
12463 {|
12464 |{{echo|foo</table>}}
12465 |bar
12466 |}
12467 !! html
12468 <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|}"]}'>
12469
12470 <tbody>
12471 <tr>
12472 <td>foo</td></tr></tbody></table><span about="#mwt1">
12473 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12474 |}</span>
12475 !!end
12476
12477 !!test
12478 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12479 (Parsoid-centric)
12480 !! options
12481 parsoid
12482 !! wikitext
12483 <table>
12484 <tr>
12485 <td>
12486 <table>
12487 <tr>
12488 <td>1. {{echo|foo </table>}}</td>
12489 <td> bar </td>
12490 <td>2. {{echo|baz </table>}}</td>
12491 </tr>
12492 <tr>
12493 <td>abc</td>
12494 </tr>
12495 </table>
12496 </td>
12497 </tr>
12498 <tr>
12499 <td>xyz</td>
12500 </tr>
12501 </table>
12502 !! html
12503 <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>"]}'>
12504 <tbody><tr>
12505 <td>
12506 <table>
12507 <tbody><tr>
12508 <td>1. foo </td></tr></tbody></table></td>
12509 <td> bar </td>
12510 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12511 </span><span about="#mwt2">
12512 </span><span about="#mwt2">
12513 </span><span about="#mwt2">abc</span><span about="#mwt2">
12514 </span><span about="#mwt2">
12515 </span><span about="#mwt2">
12516 </span><span about="#mwt2">
12517 </span><span about="#mwt2">
12518 </span><span about="#mwt2">
12519 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12520 </span><span about="#mwt2">
12521 </span>
12522 !!end
12523
12524 !! test
12525 Templates: Ugly templates: 3. newline-only template parameter
12526 !! wikitext
12527 foo {{echo|
12528 }}
12529 !! html
12530 <p>foo
12531 </p>
12532 !! end
12533
12534 # This looks like a bug: a single newline triggers p/br for some reason.
12535 !! test
12536 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12537 !! wikitext
12538 {{echo|
12539 }}
12540 !! html
12541 <p><br />
12542 </p>
12543 !! end
12544
12545 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12546 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12547 !! test
12548 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12549 !! wikitext
12550 {{echo|<table>}}
12551 {{echo|<div>foo}}
12552 {{echo|</table>}}
12553 !! html/parsoid
12554 <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
12555 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12556 </table>
12557 !! end
12558
12559 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12560 # that are "identical" and generate nesting cycles in the algorithm
12561 !! test
12562 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12563 !! wikitext
12564 {{echo|<table><tr><td><table>}}
12565 {{echo|<div>}}
12566 {{echo|</div>}}
12567 !! html/parsoid
12568 <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"}'>
12569 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12570 </table></td></tr></tbody></table>
12571 !! end
12572
12573 !! test
12574 Templates: Parameters substituted at the top-level
12575 !! wikitext
12576 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12577
12578 {{{foo|bar|baz}}}
12579 !! html/php
12580 <p><i>who</i> me? <b>never!</b>
12581 </p><p>bar
12582 </p>
12583 !! html/parsoid
12584 <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>
12585
12586 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
12587 !! end
12588
12589 !!test
12590 Parser Functions: 1. Simple example
12591 !! wikitext
12592 {{uc:foo}}
12593 !! html
12594 <p>FOO
12595 </p>
12596 !!end
12597
12598 !!test
12599 Parser Functions: 2. Nested use (only outermost should be marked up)
12600 !! wikitext
12601 {{uc:{{lc:FOO}}}}
12602 !! html
12603 <p>FOO
12604 </p>
12605 !!end
12606
12607 ###
12608 ### Pre-save transform tests
12609 ###
12610 !! test
12611 pre-save transform: subst:
12612 !! options
12613 pst
12614 !! wikitext
12615 {{subst:test}}
12616 !! html/php
12617 This is a test template
12618 !! end
12619
12620 !! test
12621 pre-save transform: normal template
12622 !! options
12623 pst
12624 !! wikitext
12625 {{test}}
12626 !! html/php
12627 {{test}}
12628 !! end
12629
12630 !! test
12631 pre-save transform: nonexistent template
12632 !! options
12633 pst
12634 !! wikitext
12635 {{thistemplatedoesnotexist}}
12636 !! html/php
12637 {{thistemplatedoesnotexist}}
12638 !! end
12639
12640 !! test
12641 pre-save transform: subst magic variables
12642 !! options
12643 pst
12644 !! wikitext
12645 {{subst:SITENAME}}
12646 !! html/php
12647 MediaWiki
12648 !! end
12649
12650 # This is bug 89, which I fixed. -- wtm
12651 !! test
12652 pre-save transform: subst: templates with parameters
12653 !! options
12654 pst
12655 !! wikitext
12656 {{subst:paramtest|param="something else"}}
12657 !! html/php
12658 This is a test template with parameter "something else"
12659 !! end
12660
12661 !! article
12662 Template:nowikitest
12663 !! text
12664 <nowiki>'''not wiki'''</nowiki>
12665 !! endarticle
12666
12667 !! test
12668 pre-save transform: nowiki in subst (bug 1188)
12669 !! options
12670 pst
12671 !! wikitext
12672 {{subst:nowikitest}}
12673 !! html/php
12674 <nowiki>'''not wiki'''</nowiki>
12675 !! end
12676
12677 !! article
12678 Template:commenttest
12679 !! text
12680 This template has <!-- a comment --> in it.
12681 !! endarticle
12682
12683 !! test
12684 pre-save transform: comment in subst (bug 1936)
12685 !! options
12686 pst
12687 !! wikitext
12688 {{subst:commenttest}}
12689 !! html/php
12690 This template has <!-- a comment --> in it.
12691 !! end
12692
12693 !! test
12694 pre-save transform: unclosed tag
12695 !! options
12696 pst
12697 !! wikitext
12698 <nowiki>'''not wiki'''
12699 !! html/php
12700 <nowiki>'''not wiki'''
12701 !! end
12702
12703 !! test
12704 pre-save transform: mixed tag case
12705 !! options
12706 pst
12707 !! wikitext
12708 <NOwiki>'''not wiki'''</noWIKI>
12709 !! html/php
12710 <NOwiki>'''not wiki'''</noWIKI>
12711 !! end
12712
12713 !! test
12714 pre-save transform: unclosed comment in <nowiki>
12715 !! options
12716 pst
12717 !! wikitext
12718 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12719 !! html/php
12720 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12721 !!end
12722
12723 # Leading @ in this template definition works around a limitation
12724 # in parsoid's parserTests which otherwise strips the <span> from the
12725 # result (confusing it for a template wrapper)
12726 !! article
12727 Template:dangerous
12728 !!text
12729 @<span onmouseover="alert('crap')">Oh no</span>
12730 !!endarticle
12731
12732 !!test
12733 (confirming safety of fix for subst bug 1936)
12734 !! wikitext
12735 {{Template:dangerous}}
12736 !! html
12737 <p>@<span>Oh no</span>
12738 </p>
12739 !! end
12740
12741 !! test
12742 pre-save transform: comment containing gallery (bug 5024)
12743 !! options
12744 pst
12745 !! wikitext
12746 <!-- <gallery>data</gallery> -->
12747 !! html/php
12748 <!-- <gallery>data</gallery> -->
12749 !!end
12750
12751 !! test
12752 pre-save transform: comment containing extension
12753 !! options
12754 pst
12755 !! wikitext
12756 <!-- <tag>data</tag> -->
12757 !! html/php
12758 <!-- <tag>data</tag> -->
12759 !!end
12760
12761 !! test
12762 pre-save transform: comment containing nowiki
12763 !! options
12764 pst
12765 !! wikitext
12766 <!-- <nowiki>data</nowiki> -->
12767 !! html/php
12768 <!-- <nowiki>data</nowiki> -->
12769 !!end
12770
12771 !! test
12772 pre-save transform: <noinclude> in subst (bug 3298)
12773 !! options
12774 pst
12775 !! wikitext
12776 {{subst:Includes}}
12777 !! html/php
12778 Foobar
12779 !! end
12780
12781 !! test
12782 pre-save transform: <onlyinclude> in subst (bug 3298)
12783 !! options
12784 pst
12785 !! wikitext
12786 {{subst:Includes2}}
12787 !! html/php
12788 Foo
12789 !! end
12790
12791 !! article
12792 Template:SubstTest
12793 !!text
12794 {{<includeonly>subst:</includeonly>Includes}}
12795 !! endarticle
12796
12797 !! article
12798 Template:SafeSubstTest
12799 !! text
12800 {{<includeonly>safesubst:</includeonly>Includes}}
12801 !! endarticle
12802
12803 !! test
12804 bug 22297: safesubst: works during PST
12805 !! options
12806 pst
12807 !! wikitext
12808 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12809 !! html/php
12810 FoobarFoobar
12811 !! end
12812
12813 !! test
12814 bug 22297: safesubst: works during normal parse
12815 !! wikitext
12816 {{SafeSubstTest}}
12817 !! html
12818 <p>Foobar
12819 </p>
12820 !! end
12821
12822 !! test
12823 subst: does not work during normal parse
12824 !! wikitext
12825 {{SubstTest}}
12826 !! html
12827 <p>{{subst:Includes}}
12828 </p>
12829 !! end
12830
12831 !! test
12832 pre-save transform: context links ("pipe trick")
12833 !! options
12834 pst
12835 !! wikitext
12836 [[Article (context)|]]
12837 [[Bar:Article|]]
12838 [[:Bar:Article|]]
12839 [[Bar:Article (context)|]]
12840 [[:Bar:Article (context)|]]
12841 [[|Article]]
12842 [[|Article (context)]]
12843 [[Bar:X (Y) Z|]]
12844 [[:Bar:X (Y) Z|]]
12845 !! html/php
12846 [[Article (context)|Article]]
12847 [[Bar:Article|Article]]
12848 [[:Bar:Article|Article]]
12849 [[Bar:Article (context)|Article]]
12850 [[:Bar:Article (context)|Article]]
12851 [[Article]]
12852 [[Article (context)]]
12853 [[Bar:X (Y) Z|X (Y) Z]]
12854 [[:Bar:X (Y) Z|X (Y) Z]]
12855 !! end
12856
12857 !! test
12858 pre-save transform: context links ("pipe trick") with interwiki prefix
12859 !! options
12860 pst
12861 !! wikitext
12862 [[interwiki:Article|]]
12863 [[:interwiki:Article|]]
12864 [[interwiki:Bar:Article|]]
12865 [[:interwiki:Bar:Article|]]
12866 !! html/php
12867 [[interwiki:Article|Article]]
12868 [[:interwiki:Article|Article]]
12869 [[interwiki:Bar:Article|Bar:Article]]
12870 [[:interwiki:Bar:Article|Bar:Article]]
12871 !! end
12872
12873 !! test
12874 pre-save transform: context links ("pipe trick") with parens in title
12875 !! options
12876 pst title=[[Somearticle (context)]]
12877 !! wikitext
12878 [[|Article]]
12879 !! html/php
12880 [[Article (context)|Article]]
12881 !! end
12882
12883 !! test
12884 pre-save transform: context links ("pipe trick") with comma in title
12885 !! options
12886 pst title=[[Someplace, Somewhere]]
12887 !! wikitext
12888 [[|Otherplace]]
12889 [[Otherplace, Elsewhere|]]
12890 [[Otherplace, Elsewhere, Anywhere|]]
12891 !! html/php
12892 [[Otherplace, Somewhere|Otherplace]]
12893 [[Otherplace, Elsewhere|Otherplace]]
12894 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12895 !! end
12896
12897 !! test
12898 pre-save transform: context links ("pipe trick") with parens and comma
12899 !! options
12900 pst title=[[Someplace (IGNORED), Somewhere]]
12901 !! wikitext
12902 [[|Otherplace]]
12903 [[Otherplace (place), Elsewhere|]]
12904 !! html/php
12905 [[Otherplace, Somewhere|Otherplace]]
12906 [[Otherplace (place), Elsewhere|Otherplace]]
12907 !! end
12908
12909 !! test
12910 pre-save transform: context links ("pipe trick") with comma and parens
12911 !! options
12912 pst title=[[Who, me? (context)]]
12913 !! wikitext
12914 [[|Yes, you.]]
12915 [[Me, Myself, and I (1937 song)|]]
12916 !! html/php
12917 [[Yes, you. (context)|Yes, you.]]
12918 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12919 !! end
12920
12921 !! test
12922 pre-save transform: context links ("pipe trick") with namespace
12923 !! options
12924 pst title=[[Ns:Somearticle]]
12925 !! wikitext
12926 [[|Article]]
12927 !! html/php
12928 [[Ns:Article|Article]]
12929 !! end
12930
12931 !! test
12932 pre-save transform: context links ("pipe trick") with namespace and parens
12933 !! options
12934 pst title=[[Ns:Somearticle (context)]]
12935 !! wikitext
12936 [[|Article]]
12937 !! html/php
12938 [[Ns:Article (context)|Article]]
12939 !! end
12940
12941 !! test
12942 pre-save transform: context links ("pipe trick") with namespace and comma
12943 !! options
12944 pst title=[[Ns:Somearticle, Context, Whatever]]
12945 !! wikitext
12946 [[|Article]]
12947 !! html/php
12948 [[Ns:Article, Context, Whatever|Article]]
12949 !! end
12950
12951 !! test
12952 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12953 !! options
12954 pst title=[[Ns:Somearticle, Context (context)]]
12955 !! wikitext
12956 [[|Article]]
12957 !! html/php
12958 [[Ns:Article (context)|Article]]
12959 !! end
12960
12961 !! test
12962 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12963 !! options
12964 pst title=[[Ns:Somearticle (IGNORED), Context]]
12965 !! wikitext
12966 [[|Article]]
12967 !! html/php
12968 [[Ns:Article, Context|Article]]
12969 !! end
12970
12971 !! test
12972 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12973 !! options
12974 pst
12975 !! wikitext
12976 [[Article(context)|]]
12977 [[Bar:Article(context)|]]
12978 [[:Bar:Article(context)|]]
12979 [[|Article(context)]]
12980 [[Bar:X(Y)Z|]]
12981 [[:Bar:X(Y)Z|]]
12982 !! html/php
12983 [[Article(context)|Article]]
12984 [[Bar:Article(context)|Article]]
12985 [[:Bar:Article(context)|Article]]
12986 [[Article(context)]]
12987 [[Bar:X(Y)Z|X(Y)Z]]
12988 [[:Bar:X(Y)Z|X(Y)Z]]
12989 !! end
12990
12991 !! test
12992 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12993 !! options
12994 pst
12995 !! wikitext
12996 [[Article (context)|]]
12997 [[Bar:Article (context)|]]
12998 [[:Bar:Article (context)|]]
12999 [[|Article (context)]]
13000 [[Bar:X (Y) Z|]]
13001 [[:Bar:X (Y) Z|]]
13002 !! html/php
13003 [[Article (context)|Article]]
13004 [[Bar:Article (context)|Article]]
13005 [[:Bar:Article (context)|Article]]
13006 [[Article (context)]]
13007 [[Bar:X (Y) Z|X (Y) Z]]
13008 [[:Bar:X (Y) Z|X (Y) Z]]
13009 !! end
13010
13011 !! test
13012 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
13013 !! options
13014 pst
13015 !! wikitext
13016 [[Article(context)|]]
13017 [[Bar:Article(context)|]]
13018 [[:Bar:Article(context)|]]
13019 [[|Article(context)]]
13020 [[Bar:X(Y)Z|]]
13021 [[:Bar:X(Y)Z|]]
13022 !! html/php
13023 [[Article(context)|Article]]
13024 [[Bar:Article(context)|Article]]
13025 [[:Bar:Article(context)|Article]]
13026 [[Article(context)]]
13027 [[Bar:X(Y)Z|X(Y)Z]]
13028 [[:Bar:X(Y)Z|X(Y)Z]]
13029 !! end
13030
13031 !! test
13032 pre-save transform: context links ("pipe trick") with commas (bug 21660)
13033 !! options
13034 pst
13035 !! wikitext
13036 [[Article (context), context|]]
13037 [[Article (context),context|]]
13038 [[Bar:Article (context), context|]]
13039 [[Bar:Article (context),context|]]
13040 [[:Bar:Article (context), context|]]
13041 [[:Bar:Article (context),context|]]
13042 !! html/php
13043 [[Article (context), context|Article]]
13044 [[Article (context),context|Article]]
13045 [[Bar:Article (context), context|Article]]
13046 [[Bar:Article (context),context|Article]]
13047 [[:Bar:Article (context), context|Article]]
13048 [[:Bar:Article (context),context|Article]]
13049 !! end
13050
13051 !! test
13052 pre-save transform: trim trailing empty lines
13053 !! options
13054 pst
13055 !! wikitext
13056 Empty lines are trimmed
13057
13058
13059
13060
13061 !! html/php
13062 Empty lines are trimmed
13063 !! end
13064
13065 !! test
13066 pre-save transform: Signature expansion
13067 !! options
13068 pst
13069 !! wikitext
13070 * ~~~
13071 * <noinclude>~~~</noinclude>
13072 * <includeonly>~~~</includeonly>
13073 * <onlyinclude>~~~</onlyinclude>
13074 !! html/php
13075 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13076 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13077 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13078 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13079 !! end
13080
13081
13082 !! test
13083 pre-save transform: Signature expansion in nowiki tags (bug 93)
13084 !! options
13085 pst disabled
13086 !! wikitext
13087 Shall not expand:
13088
13089 <nowiki>~~~~</nowiki>
13090
13091 <includeonly><nowiki>~~~~</nowiki></includeonly>
13092
13093 <noinclude><nowiki>~~~~</nowiki></noinclude>
13094
13095 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13096
13097 {{subst:Foo}} shall be converted to FOO
13098
13099 As well as inside noinclude/onlyinclude
13100 <noinclude>{{subst:Foo}}</noinclude>
13101 <onlyinclude>{{subst:Foo}}</onlyinclude>
13102
13103 But not inside includeonly
13104 <includeonly>{{subst:Foo}}</includeonly>
13105 !! html/php
13106 Shall not expand:
13107
13108 <nowiki>~~~~</nowiki>
13109
13110 <includeonly><nowiki>~~~~</nowiki></includeonly>
13111
13112 <noinclude><nowiki>~~~~</nowiki></noinclude>
13113
13114 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13115
13116 FOO shall be converted to FOO
13117
13118 As well as inside noinclude/onlyinclude
13119 <noinclude>FOO</noinclude>
13120 <onlyinclude>FOO</onlyinclude>
13121
13122 But not inside includeonly
13123 <includeonly>{{subst:Foo}}</includeonly>
13124 !! end
13125
13126 !! test
13127 Parsoid: Recognize nowiki with trailing space in tags
13128 !! options
13129 parsoid=wt2html
13130 !! wikitext
13131 <nowiki ><div>[[foo]]</nowiki >
13132
13133 a<nowiki / >b
13134
13135 c<nowiki />d
13136
13137 e<nowiki/ >f
13138 !! html
13139 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13140 <p>ab</p>
13141 <p>cd</p>
13142 <p>ef</p>
13143 !! end
13144
13145 !! test
13146 Parsoid: Recognize nowiki with odd capitalization
13147 !! options
13148 parsoid=wt2html
13149 !! wikitext
13150 <noWikI ><div>[[foo]]</Nowiki >
13151 !! html
13152 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13153 !! end
13154
13155
13156 !! test
13157 Parsoid: Escape nowiki with trailing space in tags
13158 !! options
13159 parsoid=html2wt
13160 !! html/parsoid
13161 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13162 <p>a&lt;nowiki /&gt;b</p>
13163 <p>c&lt;nowiki/ &gt;d</p>
13164 !! wikitext
13165 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13166
13167 a&lt;nowiki /&gt;b
13168
13169 c&lt;nowiki/ &gt;d
13170 !! end
13171
13172 !! test
13173 Parsoid: Escape weird noWikI capitalizations
13174 !! options
13175 parsoid=html2wt
13176 !! html/parsoid
13177 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13178 !! wikitext
13179 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13180 !! end
13181
13182 ###
13183 ### Message transform tests
13184 ###
13185 !! test
13186 message transform: magic variables
13187 !! options
13188 msg
13189 !! wikitext
13190 {{SITENAME}}
13191 !! html
13192 MediaWiki
13193 !! end
13194
13195 !! test
13196 message transform: should not transform wiki markup
13197 !! options
13198 msg
13199 !! wikitext
13200 ''test''
13201 !! html
13202 ''test''
13203 !! end
13204
13205 !! test
13206 message transform: <noinclude> in transcluded template (bug 4926)
13207 !! options
13208 msg
13209 !! wikitext
13210 {{Includes}}
13211 !! html
13212 Foobar
13213 !! end
13214
13215 !! test
13216 message transform: <onlyinclude> in transcluded template (bug 4926)
13217 !! options
13218 msg
13219 !! wikitext
13220 {{Includes2}}
13221 !! html
13222 Foo
13223 !! end
13224
13225 !! test
13226 {{#special:}} page name, known
13227 !! options
13228 msg
13229 !! wikitext
13230 {{#special:Recentchanges}}
13231 !! html
13232 Special:RecentChanges
13233 !! end
13234
13235 !! test
13236 {{#special:}} page name with subpage, known
13237 !! options
13238 msg
13239 !! wikitext
13240 {{#special:Recentchanges/param}}
13241 !! html
13242 Special:RecentChanges/param
13243 !! end
13244
13245 !! test
13246 {{#special:}} page name, unknown
13247 !! options
13248 msg
13249 !! wikitext
13250 {{#special:foobar nonexistent}}
13251 !! html
13252 Special:Foobar nonexistent
13253 !! end
13254
13255 !! test
13256 {{#speciale:}} page name, known
13257 !! options
13258 msg
13259 !! wikitext
13260 {{#speciale:Recentchanges}}
13261 !! html
13262 Special:RecentChanges
13263 !! end
13264
13265 !! test
13266 {{#speciale:}} page name with subpage, known
13267 !! options
13268 msg
13269 !! wikitext
13270 {{#speciale:Recentchanges/param}}
13271 !! html
13272 Special:RecentChanges/param
13273 !! end
13274
13275 !! test
13276 {{#speciale:}} page name, unknown
13277 !! options
13278 msg
13279 !! wikitext
13280 {{#speciale:foobar nonexistent}}
13281 !! html
13282 Special:Foobar_nonexistent
13283 !! end
13284
13285 ###
13286 ### Images
13287 ###
13288 ### For Parsoid-specific tests, see
13289 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13290
13291 !! test
13292 Simple image
13293 !! options
13294 parsoid=wt2html,wt2wt,html2html
13295 !! wikitext
13296 [[Image:foobar.jpg]]
13297 !! html/php
13298 <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>
13299 </p>
13300 !! html/parsoid
13301 <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>
13302 !! end
13303
13304 !! test
13305 Simple image (using File: namespace, now canonical)
13306 !! wikitext
13307 [[File:Foobar.jpg]]
13308 !! html/php
13309 <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>
13310 </p>
13311 !! html/parsoid
13312 <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>
13313 !! end
13314
13315 !! test
13316 Right-aligned image
13317 !! wikitext
13318 [[File:Foobar.jpg|right]]
13319 !! html/php
13320 <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>
13321
13322 !! html/parsoid
13323 <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>
13324 !! end
13325
13326 !! test
13327 Image with caption
13328 !! wikitext
13329 [[File:Foobar.jpg|right|Caption text]]
13330 !! html/php
13331 <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>
13332
13333 !! html/parsoid
13334 <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>
13335 !! end
13336
13337 !! test
13338 Image with caption, bug 53312 #1
13339 !! wikitext
13340 [[File:Foobar.jpg|right|Caption page stuff]]
13341 !! html/php
13342 <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>
13343
13344 !! html/parsoid
13345 <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>
13346 !! end
13347
13348 !! test
13349 Image with caption, bug 53312 #2
13350 !! wikitext
13351 [[File:Foobar.jpg|right|Caption page=]]
13352 !! html/php
13353 <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>
13354
13355 !! html/parsoid
13356 <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>
13357 !! end
13358
13359 !! test
13360 Image with caption, bug 53312 #3
13361 !! wikitext
13362 [[File:Foobar.jpg|right|Caption page=stuff]]
13363 !! html/php
13364 <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>
13365
13366 !! html/parsoid
13367 <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>
13368 !! end
13369
13370 !! test
13371 Allow empty links in image captions (Bug 60753)
13372 !! options
13373 thumbsize=220
13374 !! wikitext
13375 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13376 [[]]
13377 [[Link2]]
13378 ]]
13379 !! html/php
13380 <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>
13381
13382 !! html/parsoid
13383 <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>
13384 [[]]
13385 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13386 </figcaption></figure>
13387 !! end
13388
13389 !! test
13390 Titles in unlinked images (T23454)
13391 !! wikitext
13392 [[File:Foobar.jpg|link=|stuff]]
13393 !! html/php
13394 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13395 </p>
13396 !! end
13397
13398 !! test
13399 Link with empty target
13400 !! wikitext
13401 [[]]
13402 !! html
13403 <p>[[]]
13404 </p>
13405 !! end
13406
13407 !! test
13408 Image with link trail
13409 !! wikitext
13410 Linktrails should not work for images: [[File:Foobar.jpg]]s
13411 !! html/php
13412 <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
13413 </p>
13414 !! html/parsoid
13415 <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>
13416 !! end
13417
13418 !! test
13419 Image with empty attribute
13420 !! options
13421 parsoid=wt2html,wt2wt,html2html
13422 !! wikitext
13423 [[File:Foobar.jpg|right||Caption text]]
13424 !! html/php
13425 <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>
13426
13427 !! html/parsoid
13428 <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>
13429 !! end
13430
13431 !! test
13432 1. Block image with individual attributes from templates
13433 !! wikitext
13434 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13435 !! html/php
13436 <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>
13437
13438 !! html/parsoid
13439 <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>
13440 !! end
13441
13442 !! test
13443 2. Block Image with individual attributes from templates
13444 !! wikitext
13445 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13446 !! html/php
13447 <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>
13448
13449 !! html/parsoid
13450 <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>
13451 !! end
13452
13453 !! test
13454 3. Inline image with individual attributes from templates
13455 !! wikitext
13456 [[File:Foobar.jpg|{{echo|50px}}]]
13457 !! html/php
13458 <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>
13459 </p>
13460 !! html/parsoid
13461 <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>
13462 !! end
13463
13464 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13465 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13466 !! test
13467 Image with multiple attributes from the same template
13468 !! wikitext
13469 [[File:Foobar.jpg|{{image_attribs}}]]
13470 !! html/php
13471 <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>
13472
13473 !! html/parsoid
13474 <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>
13475 !! end
13476
13477 !! test
13478 Image with link tails
13479 !! options
13480 thumbsize=220
13481 !! wikitext
13482 123[[File:Foobar.jpg]]456
13483 123[[File:Foobar.jpg|right]]456
13484 123[[File:Foobar.jpg|thumb]]456
13485 !! html/php
13486 <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
13487 </p>
13488 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
13489 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
13490
13491 !! html/php+tidy
13492 <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>
13493 <p>123</p>
13494 <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>
13495 <p>456 123</p>
13496 <div class="thumb tright">
13497 <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>
13498 <div class="thumbcaption">
13499 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13500 </div>
13501 </div>
13502 </div>
13503 <p>456</p>
13504 !! html/parsoid
13505 <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>
13506 <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>
13507 <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>
13508 !! end
13509
13510 !! test
13511 Image with multiple captions -- only last one is accepted
13512 !! wikitext
13513 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13514 !! html/php
13515 <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>
13516
13517 !! html/parsoid
13518 <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>
13519 !! end
13520
13521 !! test
13522 Image with multiple widths -- use last
13523 !! wikitext
13524 [[File:Foobar.jpg|200px|300px|caption]]
13525 !! html/php
13526 <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>
13527 </p>
13528 !! html/parsoid
13529 <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>
13530 !! end
13531
13532 !! test
13533 Image with multiple alignments -- use first (bug 48664)
13534 !! options
13535 thumbsize=220
13536 !! wikitext
13537 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13538
13539 [[File:Foobar.jpg|middle|text-top|caption]]
13540 !! html/php
13541 <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>
13542 <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>
13543 </p>
13544 !! html/parsoid
13545 <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>
13546 <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>
13547 !! end
13548
13549 !! test
13550 Image with width attribute at different positions
13551 !! wikitext
13552 [[File:Foobar.jpg|200px|right|Caption]]
13553 [[File:Foobar.jpg|right|200px|Caption]]
13554 [[File:Foobar.jpg|right|Caption|200px]]
13555 !! html/php
13556 <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>
13557 <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>
13558 <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>
13559
13560 !! html/parsoid
13561 <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>
13562 <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>
13563 <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>
13564 !! end
13565
13566 # a sad bit of backward-compatibility
13567 !! test
13568 Image with size specified with pxpx (bug 13500, 51628)
13569 !! options
13570 parsoid=wt2html,wt2wt,html2html
13571 !! wikitext
13572 [[File:Foobar.jpg|20pxpx]]
13573 [[File:Foobar.jpg|200x20pxpx]]
13574 !! html/php
13575 <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>
13576 <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>
13577 </p>
13578 !! html/parsoid
13579 <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>
13580 !! end
13581
13582 !! test
13583 Image with link parameter, wiki target
13584 !! wikitext
13585 [[File:Foobar.jpg|link=Main Page]]
13586 !! html/php
13587 <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>
13588 </p>
13589 !! html/parsoid
13590 <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>
13591 !! end
13592
13593 # parsoid bug 49293 (part 1)
13594 !! test
13595 Image with link parameter, URL target
13596 !! wikitext
13597 [[File:Foobar.jpg|link=http://example.com/]]
13598 !! html/php
13599 <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>
13600 </p>
13601 !! html/parsoid
13602 <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>
13603 !! end
13604
13605 # parsoid bug 49293 (part 2)
13606 !! test
13607 Image with link parameter, protocol-less URL target
13608 !! wikitext
13609 [[File:Foobar.jpg|link=//example.com/]]
13610 !! html/php
13611 <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>
13612 </p>
13613 !! html/parsoid
13614 <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>
13615 !! end
13616
13617 !! test
13618 Escaping non-block captions (T107435)
13619 !! options
13620 parsoid={
13621 "modes": ["wt2wt"],
13622 "changes": [
13623 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13624 ]
13625 }
13626 !! wikitext
13627 [[Image:Foobar.jpg|caption]]
13628 !! wikitext/edited
13629 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13630 !! end
13631
13632 # wgExternalLinkTarget not supported by Parsoid
13633 !! test
13634 Image with link parameter, wgExternalLinkTarget
13635 !! wikitext
13636 [[Image:foobar.jpg|link=http://example.com/]]
13637 !! config
13638 wgExternalLinkTarget='foobar'
13639 !! html/php
13640 <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>
13641 </p>
13642 !! end
13643
13644 !! test
13645 Image with link parameter, wgNoFollowLinks set to false
13646 !! wikitext
13647 [[Image:foobar.jpg|link=http://example.com/]]
13648 !! config
13649 wgNoFollowLinks=false
13650 !! html
13651 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13652 </p>
13653 !! end
13654
13655 !! test
13656 Image with link parameter, wgNoFollowDomainExceptions
13657 !! wikitext
13658 [[Image:foobar.jpg|link=http://example.com/]]
13659 !! config
13660 wgNoFollowDomainExceptions='example.com'
13661 !! html
13662 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13663 </p>
13664 !! end
13665
13666 # wgExternalLinkTarget not supported by Parsoid
13667 !! test
13668 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13669 !! wikitext
13670 [[Image:foobar.jpg|link=http://example.com/|Title]]
13671 !! config
13672 wgExternalLinkTarget='foobar'
13673 !! html/php
13674 <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>
13675 </p>
13676 !! end
13677
13678 !! test
13679 Image with empty link parameter
13680 !! wikitext
13681 [[File:Foobar.jpg|link=]]
13682 !! html/php
13683 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13684 </p>
13685 !! html/parsoid
13686 <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>
13687 !! end
13688
13689 !! test
13690 Image with link parameter (wiki target) and unnamed parameter
13691 !! wikitext
13692 [[File:Foobar.jpg|link=Main_Page|Title]]
13693 !! html/php
13694 <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>
13695 </p>
13696 !! html/parsoid
13697 <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>
13698 !! end
13699
13700 !! test
13701 Image with link parameter (URL target) and unnamed parameter
13702 !! wikitext
13703 [[File:Foobar.jpg|link=http://example.com/|Title]]
13704 !! html/php
13705 <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>
13706 </p>
13707 !! html/parsoid
13708 <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>
13709 !! end
13710
13711 !! test
13712 Thumbnail image with link parameter
13713 !! options
13714 thumbsize=220
13715 parsoid=wt2html,wt2wt,html2html
13716 !! wikitext
13717 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13718 !! html/php
13719 <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>
13720
13721 !! html/parsoid
13722 <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>
13723 !! end
13724
13725 !! test
13726 Manually-specified thumbnail image
13727 !! options
13728 thumbsize=220
13729 !! wikitext
13730 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13731 !! html/php
13732 <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>
13733
13734 !! html/parsoid
13735 <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>
13736 !! end
13737
13738 !! test
13739 Manually-specified thumbnail image with explicit link to wiki page
13740 !! options
13741 thumbsize=220
13742 parsoid=wt2html,wt2wt,html2html
13743 !! wikitext
13744 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13745 !! html/php
13746 <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>
13747
13748 !! html/parsoid
13749 <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>
13750 !! end
13751
13752 !! test
13753 Manually-specified thumbnail image with explicit link to url
13754 !! options
13755 thumbsize=220
13756 parsoid=wt2html,wt2wt,html2html
13757 !! wikitext
13758 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13759 !! html/php
13760 <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>
13761
13762 !! html/parsoid
13763 <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>
13764 !! end
13765
13766 !! test
13767 Manually-specified thumbnail image with explicit no link
13768 !! options
13769 thumbsize=220
13770 parsoid=wt2html,wt2wt,html2html
13771 !! wikitext
13772 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13773 !! html/php
13774 <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>
13775
13776 !! html/parsoid
13777 <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>
13778 !! end
13779
13780 !! test
13781 Manually-specified thumbnail image with explicit link and alt text
13782 !! options
13783 thumbsize=220
13784 parsoid=wt2html,wt2wt,html2html
13785 !! wikitext
13786 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13787 !! html/php
13788 <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>
13789
13790 !! html/parsoid
13791 <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>
13792 !! end
13793
13794 !! test
13795 Image with frame and link
13796 !! options
13797 parsoid=wt2html,wt2wt,html2html
13798 !! wikitext
13799 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13800 !! html/php
13801 <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>
13802
13803 !! html/parsoid
13804 <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>
13805 !! end
13806
13807 !! test
13808 Image with frame and link and explicit alt
13809 !! options
13810 parsoid=wt2html,wt2wt,html2html
13811 !! wikitext
13812 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13813 !! html/php
13814 <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>
13815
13816 !! html/parsoid
13817 <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>
13818 !! end
13819
13820 !! test
13821 Image with wiki markup in implicit alt
13822 !! wikitext
13823 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13824
13825 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13826 !! html/php
13827 <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>
13828 </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>
13829 </p>
13830 !! html/parsoid
13831 <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>
13832
13833 <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>
13834 !! end
13835
13836 !! test
13837 Alt image option should handle most kinds of wikitext without barfing
13838 !! wikitext
13839 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13840 !! html/php
13841 <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>
13842
13843 !! html/parsoid
13844 <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>
13845 !! end
13846
13847 ###################
13848 # Conflicting image format options.
13849 # First option specified should 'win'.
13850 # All three cases in each test should be identical.
13851
13852 !! test
13853 Image with 'frameless' first.
13854 !! options
13855 parsoid=wt2html,wt2wt,html2html
13856 !! wikitext
13857 [[File:Foobar.jpg|frameless|caption]]
13858
13859 [[File:Foobar.jpg|frameless|frame|caption]]
13860
13861 [[File:Foobar.jpg|frameless|thumb|caption]]
13862 !! html/php
13863 <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>
13864 </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>
13865 </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>
13866 </p>
13867 !! html/parsoid
13868 <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>
13869 <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>
13870 <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>
13871 !! end
13872
13873 !! test
13874 Image with 'frame' first.
13875 !! options
13876 parsoid=wt2html,wt2wt,html2html
13877 !! wikitext
13878 [[File:Foobar.jpg|frame|caption]]
13879 [[File:Foobar.jpg|frame|frameless|caption]]
13880 [[File:Foobar.jpg|frame|thumb|caption]]
13881 !! html/php
13882 <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>
13883 <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>
13884 <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>
13885
13886 !! html/parsoid
13887 <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>
13888 <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>
13889 <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>
13890 !! end
13891
13892 !! test
13893 Image with 'thumb' first.
13894 !! options
13895 parsoid=wt2html,wt2wt,html2html
13896 !! wikitext
13897 [[File:Foobar.jpg|thumb|caption]]
13898 [[File:Foobar.jpg|thumb|frameless|caption]]
13899 [[File:Foobar.jpg|thumb|frame|caption]]
13900 !! html/php
13901 <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>
13902 <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>
13903 <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>
13904
13905 !! html/parsoid
13906 <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>
13907 <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>
13908 <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>
13909 !! end
13910
13911 ###################
13912 # Image sizing.
13913 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13914 # and https://phabricator.wikimedia.org/T64258
13915 # Foobar has actual size of 1941x220
13916 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13917 # a scalable format.
13918 # 2. Framed images always ignore size options; always render at default size.
13919 # 3. "Unspecified format" and border are the only types which can be
13920 # enlarged.
13921
13922 !! test
13923 Image: "unspecified format" and border enlarge
13924 !! options
13925 parsoid=wt2html,wt2wt,html2html
13926 !! wikitext
13927 [[File:Foobar.jpg|2000px]]
13928
13929 [[File:Foobar.jpg|border|2000px]]
13930 !! html/php
13931 <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>
13932 </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>
13933 </p>
13934 !! html/parsoid
13935 <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>
13936 <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>
13937 !! end
13938
13939 !! test
13940 Image: "unspecified format" and border reduce
13941 !! options
13942 parsoid=wt2html,wt2wt,html2html
13943 !! wikitext
13944 [[File:Foobar.jpg|1000px]]
13945
13946 [[File:Foobar.jpg|border|1000px]]
13947 !! html/php
13948 <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>
13949 </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>
13950 </p>
13951 !! html/parsoid
13952 <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>
13953 <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>
13954 !! end
13955
13956 !! test
13957 Image: thumbs reduce
13958 !! options
13959 parsoid=wt2html,wt2wt,html2html
13960 !! wikitext
13961 [[File:Foobar.jpg|thumb|50px]]
13962 !! html/php
13963 <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>
13964
13965 !! html/parsoid
13966 <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>
13967 !! end
13968
13969 !! test
13970 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13971 !! options
13972 parsoid=wt2html,wt2wt,html2html
13973 !! wikitext
13974 [[File:Foobar.jpg|thumb|2000px]]
13975
13976 [[File:Foobar.svg|thumb|2000px]]
13977 !! html/php
13978 <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>
13979 <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>
13980
13981 !! html/parsoid
13982 <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>
13983 <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>
13984 !! end
13985
13986 !! test
13987 Image: frameless can reduce in size
13988 !! options
13989 parsoid=wt2html,wt2wt,html2html
13990 !! wikitext
13991 [[File:Foobar.jpg|frameless|50px]]
13992 !! html/php
13993 <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>
13994 </p>
13995 !! html/parsoid
13996 <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>
13997 !! end
13998
13999 !! test
14000 Image: bitmap frameless can't be enlarged past original size, but vector can
14001 !! options
14002 parsoid=wt2html,wt2wt,html2html
14003 !! wikitext
14004 [[File:Foobar.jpg|frameless|2000px]]
14005
14006 [[File:Foobar.svg|frameless|2000px]]
14007 !! html/php
14008 <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>
14009 </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>
14010 </p>
14011 !! html/parsoid
14012 <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>
14013 <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>
14014 !! end
14015
14016 !! test
14017 Image: framed images are always unscaled.
14018 !! options
14019 parsoid=wt2html,wt2wt,html2html
14020 !! wikitext
14021 [[File:Foobar.jpg|frame]]
14022
14023 [[File:Foobar.jpg|frame|50px]]
14024
14025 [[File:Foobar.jpg|frame|50x50px]]
14026
14027 [[File:Foobar.jpg|frame|2000px]]
14028 !! html/php
14029 <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>
14030 <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>
14031 <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>
14032 <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>
14033
14034 !! html/parsoid
14035 <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>
14036 <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>
14037 <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>
14038 <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>
14039 !! end
14040
14041 ###################
14042
14043 !! test
14044 Link to image page- image page normally doesn't exists, hence edit link
14045 Add test with existing image page
14046 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14047 !! wikitext
14048 [[:Image:test]]
14049 !! html
14050 <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>
14051 </p>
14052 !! end
14053
14054 !! test
14055 bug 18784 Link to non-existent image page with caption should use caption as link text
14056 !! wikitext
14057 [[:Image:test|caption]]
14058 !! html
14059 <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>
14060 </p>
14061 !! end
14062
14063 !! test
14064 Frameless image caption with a free URL
14065 !! wikitext
14066 [[File:Foobar.jpg|http://example.com]]
14067 !! html/php
14068 <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>
14069 </p>
14070 !! html/parsoid
14071 <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>
14072 !! end
14073
14074 !! test
14075 Thumbnail image caption with a free URL
14076 !! options
14077 thumbsize=220
14078 !! wikitext
14079 [[File:Foobar.jpg|thumb|http://example.com]]
14080 !! html/php
14081 <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>
14082
14083 !! html/parsoid
14084 <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>
14085 !! end
14086
14087 !! test
14088 Thumbnail image caption with a free URL and explicit alt
14089 !! options
14090 thumbsize=220
14091 parsoid=wt2html,wt2wt,html2html
14092 !! wikitext
14093 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14094 !! html/php
14095 <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>
14096
14097 !! html/parsoid
14098 <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>
14099 !! end
14100
14101 !! test
14102 SVG thumbnails with no language set
14103 !! options
14104 !! wikitext
14105 [[File:Foobar.svg|thumb|caption]]
14106 !! html/php
14107 <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>
14108
14109 !! html/parsoid
14110 <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>
14111 !! end
14112
14113 !! test
14114 SVG thumbnails with language de
14115 !! options
14116 parsoid=wt2html,wt2wt,html2html
14117 !! wikitext
14118 [[File:Foobar.svg|thumb|caption|lang=de]]
14119 !! html/php
14120 <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>
14121
14122 !! html/parsoid
14123 <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>
14124 !! end
14125
14126 !! test
14127 SVG thumbnails with invalid language code
14128 !! options
14129 parsoid=wt2html,wt2wt,html2html
14130 !! wikitext
14131 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14132 !! html/php
14133 <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>
14134
14135 !! html/parsoid
14136 <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>
14137 !! end
14138
14139 !! test
14140 BUG 1887: A ISBN with a thumbnail
14141 !! wikitext
14142 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14143 !! html/php
14144 <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>
14145
14146 !! html/parsoid
14147 <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>
14148 !! end
14149
14150 !! test
14151 BUG 1887: A RFC with a thumbnail
14152 !! wikitext
14153 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14154 !! html/php
14155 <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>
14156
14157 !! html/parsoid
14158 <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>
14159 !! end
14160
14161 !! test
14162 BUG 1887: A mailto link with a thumbnail
14163 !! wikitext
14164 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14165 !! html/php
14166 <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>
14167
14168 !! html/parsoid
14169 <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>
14170 !! end
14171
14172 # Pending resolution to bug 368
14173 !! test
14174 BUG 648: Frameless image caption with a link
14175 !! wikitext
14176 [[File:Foobar.jpg|text with a [[link]] in it]]
14177 !! html/php
14178 <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>
14179 </p>
14180 !! html/parsoid
14181 <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>
14182 !! end
14183
14184 !! test
14185 BUG 648: Frameless image caption with a link (suffix)
14186 !! wikitext
14187 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14188 !! html/php
14189 <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>
14190 </p>
14191 !! html/parsoid
14192 <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>
14193 !! end
14194
14195 !! test
14196 BUG 648: Frameless image caption with an interwiki link
14197 !! wikitext
14198 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14199 !! html/php
14200 <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>
14201 </p>
14202 !! html/parsoid
14203 <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>
14204 !! end
14205
14206 !! test
14207 BUG 648: Frameless image caption with a piped interwiki link
14208 !! wikitext
14209 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14210 !! html/php
14211 <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>
14212 </p>
14213 !! html/parsoid
14214 <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>
14215 !! end
14216
14217 !! test
14218 T107474: Frameless image caption with <nowiki>
14219 !! wikitext
14220 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14221 !! html/parsoid
14222 <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>
14223 !! end
14224
14225 !! test
14226 Escape HTML special chars in image alt text
14227 !! wikitext
14228 [[File:Foobar.jpg|& < > "]]
14229 !! html/php
14230 <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>
14231 </p>
14232 !! html/parsoid
14233 <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>
14234 !! end
14235
14236 !! test
14237 Escape HTML special chars in image alt text with LanguageConverter
14238 !! options
14239 language=zh
14240 !! wikitext
14241 [[File:Foobar.jpg|& < > "]]
14242 !! html/php
14243 <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>
14244 </p>
14245 !! html/parsoid
14246 <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>
14247 !! end
14248
14249 !! test
14250 Entities in file name and attributes
14251 !! wikitext
14252 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14253 !! html/php
14254 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14255 </p>
14256 !! html/parsoid
14257 <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>
14258 !! end
14259
14260 !! test
14261 BUG 499: Alt text should have &#1234;, not &amp;1234;
14262 !! wikitext
14263 [[File:Foobar.jpg|&#9792;]]
14264 !! html/php
14265 <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>
14266 </p>
14267 !! html/parsoid
14268 <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>
14269 !! end
14270
14271 !! test
14272 Broken image caption with link
14273 !! options
14274 parsoid=wt2html,wt2wt,html2html
14275 !! wikitext
14276 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14277 !! html/php
14278 <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.
14279 </p>
14280 !! html/parsoid
14281 <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>
14282 !! end
14283
14284 !! test
14285 Image caption containing another image
14286 !! wikitext
14287 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14288 !! html/php
14289 <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>
14290
14291 !! html/parsoid
14292 <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>
14293 !! end
14294
14295 !! test
14296 Image: caption containing a newline
14297 !! wikitext
14298 [[File:Foobar.jpg|This
14299 *is some text]]
14300 !! html/php
14301 <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>
14302 </p>
14303 !! html/parsoid
14304 <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>
14305 !!end
14306
14307 !!test
14308 Image: caption containing leading space
14309 (The leading space should not trigger nowiki escaping in wt2wt mode)
14310 !! wikitext
14311 [[File:Foobar.jpg|thumb| bar]]
14312 !! html/php
14313 <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>
14314
14315 !! html/parsoid
14316 <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>
14317 !!end
14318
14319 !! test
14320 Image: caption containing a table
14321 !! options
14322 parsoid=wt2html,wt2wt,html2html
14323 !! wikitext
14324 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14325 {|
14326 ! Foo !! Bar
14327 |-
14328 | Foo1 || Bar1
14329 |}
14330 and some more text.]]
14331 !! html/php
14332 <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>
14333
14334 !! html/parsoid
14335 <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
14336 <table>
14337 <tbody>
14338 <tr><th>Foo </th><th>Bar</th></tr>
14339 <tr>
14340 <td>Foo1 </td>
14341 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14342 !! end
14343
14344 !! test
14345 Bug 3090: External links other than http: in image captions
14346 !! wikitext
14347 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14348 !! html/php
14349 <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>
14350
14351 !! html/parsoid
14352 <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>
14353 !! end
14354
14355 !! test
14356 Custom class
14357 !! options
14358 parsoid=wt2html,wt2wt,html2html
14359 !! wikitext
14360 [[Image:foobar.jpg|a|class=b]]
14361 !! html/php
14362 <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>
14363 </p>
14364 !! html/parsoid
14365 <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>
14366 !! end
14367
14368 !! test
14369 Localized image handling (1).
14370 !! options
14371 parsoid=wt2html,wt2wt,html2html
14372 language=es
14373 !! wikitext
14374 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14375 !! html/php
14376 <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>
14377
14378 !! html/parsoid
14379 <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>
14380 !! end
14381
14382 !! test
14383 Localized image handling (2).
14384 !! options
14385 thumbsize=220
14386 parsoid=wt2html,wt2wt,html2html
14387 language=es
14388 !! wikitext
14389 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14390 !! html/php
14391 <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>
14392
14393 !! html/parsoid
14394 <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>
14395 !! end
14396
14397 !! test
14398 Localized image handling (3).
14399 !! options
14400 language=fa
14401 parsoid=html2wt
14402 !! html/parsoid
14403 <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>
14404 !! wikitext
14405 [[File:Foobar.jpg|بندانگشتی]]
14406 !! end
14407
14408 !! test
14409 "border", "frameless" and "class" attributes on an image.
14410 !! options
14411 thumbsize=220
14412 parsoid=wt2html,wt2wt,html2html
14413 !! wikitext
14414 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14415 !! html/php
14416 <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>
14417 </p>
14418 !! html/parsoid
14419 <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>
14420 !! end
14421
14422 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14423 !! test
14424 Invalid image attributes (bug 62500)
14425 !! options
14426 thumbsize=220
14427 parsoid=wt2html,wt2wt,html2html
14428 !! wikitext
14429 [[File:Foobar.jpg|thumb|float|left|caption]]
14430
14431 [[File:Foobar.jpg|thumb|righ|caption]]
14432
14433 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14434 !! html/php
14435 <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>
14436 <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>
14437 <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>
14438
14439 !! html/parsoid
14440 <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>
14441 <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>
14442 <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>
14443 !! end
14444
14445 !! article
14446 File:Barfoo.jpg
14447 !! text
14448 #REDIRECT [[File:Barfoo.jpg]]
14449 !! endarticle
14450
14451 # FIXME: Parsoid should run this test -- but we'd need to teach the
14452 # mockAPI about the redirected Barfoo.jpg image.
14453 !! test
14454 Redirected image
14455 !! wikitext
14456 [[Image:Barfoo.jpg]]
14457 !! html/php
14458 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14459 </p>
14460 !! end
14461
14462 !! test
14463 Missing image with uploads disabled
14464 !! options
14465 wgEnableUploads=0
14466 !! wikitext
14467 [[File:Foobaz.jpg]]
14468 !! html/php
14469 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14470 </p>
14471 !! html/parsoid
14472 <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>
14473 !! end
14474
14475 # Parsoid-specific testing for images
14476 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14477 # Currently imperfect due to a flaw in the Parsoid testrunner
14478 # Work in progress
14479 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14480 # image tests.
14481
14482 !! test
14483 Parsoid-specific image handling - simple image with size and middle alignment
14484 !! wikitext
14485 [[File:Foobar.jpg|middle|50px]]
14486 !! html/parsoid
14487 <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>
14488 !! end
14489
14490 !! test
14491 Parsoid-specific image handling - simple image with size, middle alignment,
14492 non-standard namespace alias
14493 !! options
14494 parsoid=wt2wt,wt2html,html2html
14495 !! wikitext
14496 [[Image:Foobar.jpg|middle|50px]]
14497 !! html/parsoid
14498 <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>
14499 !! end
14500
14501 !! test
14502 Parsoid-specific image handling - simple image with size and middle alignment
14503 (existing content)
14504 !! wikitext
14505 [[File:Foobar.jpg|50px|middle]]
14506 !! html/parsoid
14507 <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>
14508 !! end
14509
14510 !! test
14511 Parsoid-specific image handling - simple image with size and middle alignment
14512 and non-standard namespace name
14513 !! options
14514 parsoid=wt2html,wt2wt,html2html
14515 !! wikitext
14516 [[Image:Foobar.jpg|50px|middle]]
14517 !! html/parsoid
14518 <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>
14519 !! end
14520
14521 !! test
14522 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14523 !! wikitext
14524 [[File:Foobar.jpg|500x10px|baseline|caption]]
14525 !! html/parsoid
14526 <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>
14527 !! end
14528
14529 !! test
14530 Parsoid-specific image handling - simple image with border and size spec
14531 !! wikitext
14532 [[File:Foobar.jpg|50px|border|caption]]
14533 !! html/parsoid
14534 <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>
14535 !! end
14536
14537 !! test
14538 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14539 !! wikitext
14540 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14541 !! html/parsoid
14542 <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>
14543 !! end
14544
14545 !! test
14546 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14547 (existing content)
14548 !! wikitext
14549 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14550 !! html/parsoid
14551 <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>
14552 !! end
14553
14554 !! test
14555 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14556 !! wikitext
14557 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14558 !! html/parsoid
14559 <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>
14560 !! end
14561
14562 !! test
14563 Parsoid-specific image handling - thumbnail with specific size, halign,
14564 valign, and caption (existing content)
14565 !! wikitext
14566 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14567 !! html/parsoid
14568 <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>
14569 !! end
14570
14571 !! test
14572 Parsoid-specific image handling - framed image with specific size and caption
14573 (size is ignored)
14574 !! options
14575 parsoid=wt2html,wt2wt,html2html
14576 !! wikitext
14577 [[File:Foobar.jpg|frame|500x50px|caption]]
14578 !! html/parsoid
14579 <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>
14580 !! end
14581
14582 !! test
14583 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14584 (size is ignored)
14585 !! options
14586 parsoid=wt2html,wt2wt,html2html
14587 !! wikitext
14588 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14589 !! html/parsoid
14590 <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>
14591 !! end
14592
14593 !! test
14594 Parsoid-specific image handling - frameless image with specific size, border, and caption
14595 !! wikitext
14596 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14597 !! html/parsoid
14598 <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>
14599 !! end
14600
14601 !! test
14602 Parsoid-specific image handling - simple image with a formatted caption
14603 !! wikitext
14604 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14605 !! html/parsoid
14606 <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>
14607 !! end
14608
14609 !! test
14610 Parsoid-specific image handling - caption with a template in it
14611 !! wikitext
14612 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14613 !! html/parsoid
14614 <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>
14615 !! end
14616
14617 !! test
14618 Parsoid-specific image handling - caption with unbalanced tags in it
14619 !! options
14620 parsoid=wt2html,wt2wt,html2html
14621 !! wikitext
14622 foo
14623 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14624 bar
14625 !! html/parsoid
14626 <p>foo</p>
14627 <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>
14628 <p>bar</p>
14629 !! end
14630
14631 !! test
14632 Parsoid-specific image handling - empty caption (1)
14633 !! options
14634 parsoid=wt2html,wt2wt
14635 !! wikitext
14636 [[File:Foobar.jpg|thumb|]]
14637 !! html/parsoid
14638 <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>
14639 !! end
14640
14641 # empty captions don't get serialized unless we're in the "round trip" case
14642 !! test
14643 Parsoid-specific image handling - empty caption (2)
14644 !! options
14645 parsoid=html2wt
14646 !! html/parsoid
14647 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14648 <a href="./File:Foobar.jpg">
14649 <img resource="./File:Foobar.jpg"
14650 src="//example.com/images/3/3a/Foobar.jpg"
14651 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14652 height="25" width="220"/>
14653 </a>
14654 <figcaption></figcaption>
14655 </figure>
14656 !! wikitext
14657 [[File:Foobar.jpg|thumb]]
14658 !! end
14659
14660 !! test
14661 Parsoid-specific image handling - whitespace caption
14662 !! wikitext
14663 [[File:Foobar.jpg|thumb| ]]
14664 !! html/parsoid
14665 <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>
14666 !! end
14667
14668 !! test
14669 Parsoid-specific image handling - lang option
14670 !! wikitext
14671 foo
14672 [[File:Foobar.svg|lang=de|caption]]
14673 bar
14674 !! html/parsoid
14675 <p>foo
14676 <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>
14677 bar</p>
14678 !! end
14679
14680 ## Edge case bugs in Parsoid from T93580
14681 !! test
14682 T93580: 1. Templated <ref> inside block images
14683 !! wikitext
14684 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14685
14686 <references />
14687 !! html/parsoid
14688 <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>
14689
14690 <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>
14691 !! end
14692
14693 !! test
14694 T93580: 2. <ref> inside inline images
14695 !! wikitext
14696 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14697
14698 <references />
14699 !! html/parsoid
14700 <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>
14701
14702 <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>
14703 !! end
14704
14705 !! test
14706 T93580: 3. Templated <ref> inside inline images
14707 !! wikitext
14708 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14709
14710 <references />
14711 !! html/parsoid
14712 <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>
14713
14714 <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>
14715 !! end
14716
14717 ###
14718 ### Subpages
14719 ###
14720 !! article
14721 Subpage test/subpage
14722 !! text
14723 foo
14724 !! endarticle
14725
14726 !! test
14727 Subpage link
14728 !! options
14729 subpage title=[[Subpage test]]
14730 !! wikitext
14731 [[/subpage]]
14732 !! html
14733 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14734 </p>
14735 !! end
14736
14737 !! test
14738 Subpage noslash link
14739 !! options
14740 subpage title=[[Subpage test]]
14741 !! wikitext
14742 [[/subpage/]]
14743 !! html
14744 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14745 </p>
14746 !! end
14747
14748 !! article
14749 Subpage test/1/2/subpage
14750 !! text
14751 blah
14752 !! endarticle
14753
14754 !! test
14755 Relative subpage noslash link
14756 !! options
14757 parsoid=wt2wt,wt2html,html2html
14758 subpage title=[[Subpage test/1/2/3/4]]
14759 !! wikitext
14760 [[../../subpage/]]
14761
14762 [[../../subpage]]
14763 !! html/php
14764 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14765 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14766 </p>
14767 !! html/parsoid
14768 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14769 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14770 !! end
14771
14772 !! test
14773 Parsoid: dot-slash prefixed wikilinks
14774 !! wikitext
14775 [[./foo]]
14776
14777 [[././bar]]
14778
14779 [[././baz/]]
14780 !! html/php
14781 <p>[[./foo]]
14782 </p><p>[[././bar]]
14783 </p><p>[[././baz/]]
14784 </p>
14785 !! html/parsoid
14786 <p>[[./foo]]
14787 </p><p>[[././bar]]
14788 </p><p>[[././baz/]]
14789 </p>
14790 !! end
14791
14792 !! test
14793 Render invalid page names as plain text (bug 51090)
14794 !! wikitext
14795 [[./../foo|bar]]
14796 [[foo�|bar]]
14797 [[foo/.|bar]]
14798 [[foo/..|bar]]
14799 [[foo~~~bar]]
14800 [[foo>bar]]
14801 [[foo[bar]]
14802 [[.]]
14803 [[..]]
14804 [[foo././bar]]
14805
14806 [[{{echo|./../foo}}|bar]]
14807 [[{{echo|foo/.}}|bar]]
14808 [[{{echo|foo/..}}|bar]]
14809 [[{{echo|foo~~~~bar}}]]
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 !!html/php
14818 <p>[[./../foo|bar]]
14819 [[foo�|bar]]
14820 [[foo/.|bar]]
14821 [[foo/..|bar]]
14822 [[foo~~~bar]]
14823 [[foo&gt;bar]]
14824 [[foo[bar]]
14825 [[.]]
14826 [[..]]
14827 [[foo././bar]]
14828 </p><p>[[./../foo|bar]]
14829 [[foo/.|bar]]
14830 [[foo/..|bar]]
14831 [[foo~~~~bar]]
14832 [[foo&gt;bar]]
14833 [[foo././bar]]
14834 [[foo{bar]]
14835 [[foo}bar]]
14836 [[foo[bar]]
14837 [[foo]bar]]
14838 [[foo&lt;bar]]
14839 </p>
14840 !!html/parsoid
14841 <p>[[./../foo|bar]]
14842 [[foo�|bar]]
14843 [[foo/.|bar]]
14844 [[foo/..|bar]]
14845 [[foo~~~bar]]
14846 [[foo>bar]]
14847 [[foo[bar]]
14848 [[.]]
14849 [[..]]
14850 [[foo././bar]]</p>
14851
14852 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14853 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14854 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14855 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14856 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14857 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14858 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
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&lt;bar"}},"i":0}}]}'>foo&lt;bar</span>]]</p>
14863 !!end
14864
14865 !! test
14866 Disabled subpages
14867 !! wikitext
14868 [[/subpage]]
14869 !! html
14870 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14871 </p>
14872 !! end
14873
14874 !! test
14875 BUG 561: {{/Subpage}}
14876 !! options
14877 subpage title=[[Page]]
14878 !! wikitext
14879 {{/Subpage}}
14880 !! html
14881 <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>
14882 </p>
14883 !! end
14884
14885 ###
14886 ### Categories
14887 ###
14888 !! article
14889 Category:MediaWiki User's Guide
14890 !! text
14891 blah
14892 !! endarticle
14893
14894 !! test
14895 Link to category
14896 !! wikitext
14897 [[:Category:MediaWiki User's Guide]]
14898 !! html
14899 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14900 </p>
14901 !! end
14902
14903 !! test
14904 Simple category
14905 !! options
14906 cat
14907 !! wikitext
14908 [[Category:MediaWiki User's Guide]]
14909 !! html/php
14910 cat=MediaWiki_User's_Guide sort=
14911 !! html/parsoid
14912 <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"}}'/>
14913 !! end
14914
14915 !! test
14916 PAGESINCATEGORY invalid title fatal (r33546 fix)
14917 !! wikitext
14918 {{PAGESINCATEGORY:<bogus>}}
14919 !! html
14920 <p>0
14921 </p>
14922 !! end
14923
14924 !! test
14925 Category with different sort key
14926 !! options
14927 cat
14928 !! wikitext
14929 [[Category:MediaWiki User's Guide|Foo]]
14930 !! html/php
14931 cat=MediaWiki_User's_Guide sort=Foo
14932 !! html/parsoid
14933 <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"}}'/>
14934 !! end
14935
14936 !! test
14937 Category with identical sort key
14938 !! options
14939 cat
14940 !! wikitext
14941 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14942 !! html/php
14943 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
14944 !! html/parsoid
14945 <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"}}'/>
14946 !! end
14947
14948 !! test
14949 Category with empty sort key
14950 !! options
14951 cat
14952 pst
14953 !! wikitext
14954 [[Category:MediaWiki User's Guide|]]
14955 !! html/php
14956 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14957 !! end
14958
14959 !! test
14960 Category with empty sort key and parentheses
14961 !! options
14962 cat
14963 pst
14964 !! wikitext
14965 [[Category:Foo (bar)|]]
14966 !! html/php
14967 [[Category:Foo (bar)|Foo]]
14968 !! end
14969
14970 !! test
14971 Category with link tail
14972 !! options
14973 cat
14974 pst
14975 !! wikitext
14976 123[[Category:Foo]]456
14977 !! html/php
14978 123[[Category:Foo]]456
14979 !! end
14980
14981 !! test
14982 Category with template
14983 !! options
14984 cat
14985 pst
14986 !! wikitext
14987 [[Category:{{echo|Foo}}]]
14988 !! html/php
14989 [[Category:{{echo|Foo}}]]
14990 !! end
14991
14992 !! test
14993 Category with template in sort key
14994 !! options
14995 cat
14996 pst
14997 !! wikitext
14998 [[Category:Foo|{{echo|Bar}}]]
14999 !! html/php
15000 [[Category:Foo|{{echo|Bar}}]]
15001 !! end
15002
15003 !! test
15004 Category with template in sort key and title
15005 !! options
15006 cat
15007 pst
15008 !! wikitext
15009 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15010 !! html/php
15011 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15012 !! end
15013
15014 ## We used to, but no longer wt2wt this test since the default serializer
15015 ## will normalize all categories to serialize on their own line.
15016 ## This wikitext usage is going to be fairly uncommon in production and
15017 ## selser will take care of preserving formatting in those scenarios.
15018 !! test
15019 Category / paragraph interactions
15020 !! options
15021 parsoid=wt2html
15022 !! wikitext
15023 Foo [[Category:Baz]] Bar
15024
15025 Foo [[Category:Baz]]
15026 Bar
15027
15028 Foo
15029 [[Category:Baz]]
15030 Bar
15031
15032 Foo
15033 [[Category:Baz]] Bar
15034
15035 Foo
15036 [[Category:Baz]]
15037 [[Category:Baz]]
15038 [[Category:Baz]]
15039 Bar
15040
15041 [[Category:Baz]]
15042 [[Category:Baz]]
15043 [[Category:Baz]]
15044
15045 [[Category:Baz]]
15046 {{echo|[[Category:Baz]]}}
15047 [[Category:Baz]]
15048 !! html/php
15049 <p>Foo Bar
15050 </p><p>Foo
15051 Bar
15052 </p><p>Foo
15053 Bar
15054 </p><p>Foo Bar
15055 </p><p>Foo
15056 Bar
15057 </p>
15058 !! html/parsoid
15059 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15060 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15061 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15062 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15063 <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>
15064 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15065 !! end
15066
15067 ## We used to, but no longer wt2wt this test since the default serializer
15068 ## will normalize all categories to serialize on their own line.
15069 ## This wikitext usage is going to be fairly uncommon in production and
15070 ## selser will take care of preserving formatting in those scenarios.
15071 ##
15072 ## The whitespace on the empty line is part of the test. Please do not delete
15073 !! test
15074 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
15075 !! options
15076 parsoid=wt2html
15077 !! wikitext
15078 This
15079
15080 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15081
15082 {{echo|[[Category:Foo]] and so should this!}}
15083 !! html/php
15084 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15085 </p>
15086 !! html/parsoid
15087 <p>This
15088
15089 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15090
15091 <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>
15092 !! end
15093
15094 ## Parsoid will not try to wt2wt this while preserving newlines because
15095 ## it suppresses excess newlines within list items -- and we don't want to
15096 ## introduce a special case just for categories, which is, in reality somewhat
15097 ## odd behavior -- categories are unlikely to be used in list items like this
15098 ## in top-level pages and are only likely to show up in template-generated
15099 ## list items where this RT-ing is a non-issue.
15100 ##
15101 ## The whitespace on the empty line is part of the test. Please do not delete
15102 !! test
15103 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
15104 !! options
15105 parsoid=wt2html
15106 !! wikitext
15107 * This
15108
15109 [[Category:Foo]] and this should be part of the same list item
15110 * So should this
15111
15112 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15113 !! html
15114 <ul><li>This and this should be part of the same list item</li>
15115 <li>So should this and this should be part of the same list item</li></ul>
15116 !! html/parsoid
15117 <ul>
15118 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15119 <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>
15120 </ul>
15121 !! end
15122
15123 ## Newlines and categories that follow the last item of a list
15124 ## are treated differently because this (list followed by categories)
15125 ## is an extremely common pattern on wikis.
15126 !! test
15127 3. Categories and newlines: newline suppression for last list item should RT properly
15128 !! wikitext
15129 * a
15130 * b
15131
15132 [[Category:Foo]]
15133
15134 [[Category:Bar]]
15135 [[Category:Baz]]
15136 !! html/parsoid
15137 <ul><li> a</li>
15138 <li> b</li></ul>
15139
15140 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15141
15142 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15143 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15144 !! end
15145
15146 !! test
15147 4. Categories and newlines: newline suppression for last list item should RT properly
15148 !! wikitext
15149 * a
15150 **** b
15151
15152 [[Category:Foo]]
15153 !! html/parsoid
15154 <ul><li> a
15155 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15156
15157 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15158 !! end
15159
15160 ## only wt2html for this to make sure the algo only applies to the rightmost path
15161 !! test
15162 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15163 !! options
15164 parsoid=wt2html
15165 !! wikitext
15166 * a
15167 ** b
15168 [[Category:Foo]]
15169 * c
15170 ** d
15171 [[Category:Foo]]
15172 !! html/parsoid
15173 <ul><li> a
15174 <ul><li> b
15175 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15176 <li> c
15177 <ul><li> d</li></ul></li></ul>
15178 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15179 !! end
15180
15181 ## We used to, but no longer wt2wt this test since the default serializer
15182 ## will normalize all categories to serialize on their own line.
15183 ## This wikitext usage is going to be fairly uncommon in production and
15184 ## selser will take care of preserving formatting in those scenarios.
15185 !! test
15186 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15187 !! options
15188 parsoid=wt2html
15189 !! wikitext
15190 * a [[Category:Foo]]
15191 !! html/parsoid
15192 <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>
15193 !! end
15194
15195 # This test also demonstrates because of newline+category tunneling
15196 # through the list hander, template wrapping doesn't expand to the
15197 # containing list when the list item swallows the category.
15198 !! test
15199 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15200 !! wikitext
15201 * {{echo|a
15202 [[Category:Foo]]}}
15203 !! html/parsoid
15204 <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
15205 </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>
15206 !! end
15207
15208 !! test
15209 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15210 !! wikitext
15211 * a
15212
15213 {{echo|[[Category:Foo]]
15214 [[Category:Bar]]}}
15215 [[Category:Baz]]
15216 !! html/parsoid
15217 <ul><li> a</li></ul>
15218
15219 <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">
15220 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15221 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15222 !! end
15223
15224 !! test
15225 Category links with multiple namespaces
15226 !! wikitext
15227 [[Category:Project:Foo]]
15228 !! html/parsoid
15229 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15230 !! end
15231
15232 !! test
15233 Parsoid: Serialize link to category page with colon escape
15234 !! options
15235 parsoid
15236 !! wikitext
15237
15238 [[:Category:Foo]]
15239 [[:Category:Foo|Bar]]
15240 !! html
15241 <p>
15242 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15243 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15244 </p>
15245 !! end
15246
15247 # We used to, but no longer wt2wt this test since the default serializer
15248 # will normalize all categories to serialize on their own line.
15249 # This wikitext usage is going to be fairly uncommon in production and
15250 # selser will take care of preventing whitespace insertion if this
15251 # occurs in an article.
15252 #
15253 # html2html disabled for the same reason (whitespace insertion between
15254 # x and y).
15255 #
15256 # html2wt disabled because it localizes the "Category" namespace.
15257 !! test
15258 Link prefix/suffixes aren't applied to category links
15259 !! options
15260 parsoid=wt2html
15261 language=is
15262 !! wikitext
15263 x[[Category:Foo]]y
15264 !! html/php
15265 <p>xy
15266 </p>
15267 !! html/parsoid
15268 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15269 !! end
15270
15271 !! test
15272 Parsoid: Serialize link to file page with colon escape
15273 !! options
15274 parsoid
15275 !! wikitext
15276
15277 [[:File:Foo.png]]
15278 [[:File:Foo.png|Bar]]
15279 !! html
15280 <p>
15281 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15282 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15283 </p>
15284 !! end
15285
15286 !! test
15287 Parsoid: Serialize a genuine category link without colon escape
15288 !! options
15289 parsoid
15290 !! wikitext
15291 [[Category:Foo]]
15292 [[Category:Foo|Bar]]
15293 !! html
15294 <link rel="mw:PageProp/Category" href="./Category:Foo">
15295 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15296 !! end
15297
15298 !! test
15299 Normalize hrefs properly before testing for invalid link targets (bug 70894)
15300 !! options
15301 parsoid=html2wt
15302 !! html/parsoid
15303 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15304 !! wikitext
15305 [[Category:Toxine bactérienne]]
15306 !! end
15307
15308 !! test
15309 Parsoid: Defaultsort
15310 !! wikitext
15311 {{DEFAULTSORT:Foo}}
15312 !! html/parsoid
15313 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15314 !! end
15315
15316 !! test
15317 Parsoid: Defaultsort (template-generated)
15318 !! wikitext
15319 {{{{echo|DEFAULTSORT}}:Foo}}
15320 !! html/parsoid
15321 <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}}]}'/>
15322 !! end
15323
15324 ###
15325 ### Inter-language links
15326 ###
15327 !! test
15328 Interlanguage links
15329 !! options
15330 ill
15331 !! wikitext
15332 [[es:Alimento]]
15333 [[fr:Nourriture]]
15334 [[zh:食品]]
15335 !! html/php
15336 es:Alimento fr:Nourriture zh:食品
15337 !! html/parsoid
15338 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15339 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15340 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15341 !! end
15342
15343 !! test
15344 Duplicate interlanguage links (bug 24502)
15345 !! options
15346 ill
15347 !! wikitext
15348 [[es:1]]
15349 [[es:2]]
15350 [[fr:1]]
15351 [[fr:2]]
15352 !! html/php
15353 es:1 fr:1
15354 !! html/parsoid
15355 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15356 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15357 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15358 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15359 !! end
15360
15361 ###
15362 ### Sections
15363 ###
15364 !! test
15365 Basic section headings
15366 !! wikitext
15367 == Headline 1 ==
15368 Some text
15369
15370 ==Headline 2==
15371 More
15372 ===Smaller headline===
15373 Blah blah
15374 !! html
15375 <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>
15376 <p>Some text
15377 </p>
15378 <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>
15379 <p>More
15380 </p>
15381 <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>
15382 <p>Blah blah
15383 </p>
15384 !! end
15385
15386 !! test
15387 Section headings with TOC
15388 !! wikitext
15389 == Headline 1 ==
15390 === Subheadline 1 ===
15391 ===== Skipping a level =====
15392 ====== Skipping a level ======
15393
15394 == Headline 2 ==
15395 Some text
15396 ===Another headline===
15397 !! html
15398 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15399 <ul>
15400 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15401 <ul>
15402 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15403 <ul>
15404 <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>
15405 <ul>
15406 <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>
15407 </ul>
15408 </li>
15409 </ul>
15410 </li>
15411 </ul>
15412 </li>
15413 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15414 <ul>
15415 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15416 </ul>
15417 </li>
15418 </ul>
15419 </div>
15420
15421 <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>
15422 <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>
15423 <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>
15424 <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>
15425 <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>
15426 <p>Some text
15427 </p>
15428 <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>
15429
15430 !! end
15431
15432 !! test
15433 TOC anchors don't collide
15434 !! wikitext
15435 __FORCETOC__
15436 == Headline 2 ==
15437 == Headline ==
15438 == Headline 2 ==
15439 == Headline ==
15440 !! html/php
15441 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15442 <ul>
15443 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15444 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15445 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15446 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15447 </ul>
15448 </div>
15449
15450 <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>
15451 <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>
15452 <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>
15453 <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>
15454
15455 !! end
15456
15457 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15458 !! test
15459 Handling of sections up to level 6 and beyond
15460 !! wikitext
15461 = Level 1 Heading=
15462 == Level 2 Heading==
15463 === Level 3 Heading===
15464 ==== Level 4 Heading====
15465 ===== Level 5 Heading=====
15466 ====== Level 6 Heading======
15467 ======= Level 7 Heading=======
15468 ======== Level 8 Heading========
15469 ========= Level 9 Heading=========
15470 ========== Level 10 Heading==========
15471 !! html
15472 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15473 <ul>
15474 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15475 <ul>
15476 <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>
15477 <ul>
15478 <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>
15479 <ul>
15480 <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>
15481 <ul>
15482 <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>
15483 <ul>
15484 <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>
15485 <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>
15486 <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>
15487 <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>
15488 <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>
15489 </ul>
15490 </li>
15491 </ul>
15492 </li>
15493 </ul>
15494 </li>
15495 </ul>
15496 </li>
15497 </ul>
15498 </li>
15499 </ul>
15500 </div>
15501
15502 <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>
15503 <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>
15504 <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>
15505 <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>
15506 <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>
15507 <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>
15508 <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>
15509 <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>
15510 <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>
15511 <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>
15512
15513 !! end
15514
15515 !! test
15516 TOC regression (T11764)
15517 !! wikitext
15518 == title 1 ==
15519 === title 1.1 ===
15520 ==== title 1.1.1 ====
15521 === title 1.2 ===
15522 == title 2 ==
15523 === title 2.1 ===
15524 !! html
15525 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15526 <ul>
15527 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15528 <ul>
15529 <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>
15530 <ul>
15531 <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>
15532 </ul>
15533 </li>
15534 <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>
15535 </ul>
15536 </li>
15537 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15538 <ul>
15539 <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>
15540 </ul>
15541 </li>
15542 </ul>
15543 </div>
15544
15545 <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>
15546 <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>
15547 <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>
15548 <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>
15549 <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>
15550 <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>
15551
15552 !! end
15553
15554 !! test
15555 TOC for heading containing <span id="..."></span> (T96153)
15556 !! wikitext
15557 __FORCETOC__
15558 ==<span id="old-anchor"></span>New title==
15559 !! html/php
15560 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15561 <ul>
15562 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15563 </ul>
15564 </div>
15565
15566 <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>
15567
15568 !! end
15569
15570 !! test
15571 TOC with wgMaxTocLevel=3 (bug 6204)
15572 !! options
15573 wgMaxTocLevel=3
15574 !! wikitext
15575 == title 1 ==
15576 === title 1.1 ===
15577 ==== title 1.1.1 ====
15578 === title 1.2 ===
15579 == title 2 ==
15580 === title 2.1 ===
15581 !! html
15582 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15583 <ul>
15584 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15585 <ul>
15586 <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>
15587 <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>
15588 </ul>
15589 </li>
15590 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15591 <ul>
15592 <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>
15593 </ul>
15594 </li>
15595 </ul>
15596 </div>
15597
15598 <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>
15599 <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>
15600 <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>
15601 <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>
15602 <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>
15603 <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>
15604
15605 !! end
15606
15607 !! test
15608 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15609 !! options
15610 wgMaxTocLevel=3
15611 !! wikitext
15612 ==Section 1==
15613 ===Section 1.1===
15614 ====Section 1.1.1====
15615 ====Section 1.1.1.1====
15616 ==Section 2==
15617 !! html
15618 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15619 <ul>
15620 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15621 <ul>
15622 <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>
15623 </ul>
15624 </li>
15625 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15626 </ul>
15627 </div>
15628
15629 <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>
15630 <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>
15631 <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>
15632 <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>
15633 <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>
15634
15635 !! end
15636
15637
15638 !! test
15639 Resolving duplicate section names
15640 !! wikitext
15641 == Foo bar ==
15642 == Foo bar ==
15643 !! html
15644 <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>
15645 <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>
15646
15647 !! end
15648
15649 !! test
15650 Resolving duplicate section names with differing case (bug 10721)
15651 !! wikitext
15652 == Foo bar ==
15653 == Foo Bar ==
15654 !! html
15655 <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>
15656 <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>
15657
15658 !! end
15659
15660 !! article
15661 Template:sections
15662 !! text
15663 ===Section 1===
15664 ==Section 2==
15665 !! endarticle
15666
15667 !! test
15668 Template with sections, __NOTOC__
15669 !! wikitext
15670 __NOTOC__
15671 ==Section 0==
15672 {{sections}}
15673 ==Section 4==
15674 !! html
15675 <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>
15676 <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>
15677 <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>
15678 <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>
15679
15680 !! end
15681
15682 !! test
15683 __NOEDITSECTION__ keyword
15684 !! wikitext
15685 __NOEDITSECTION__
15686 ==Section 1==
15687 ==Section 2==
15688 !! html
15689 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15690 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15691
15692 !! end
15693
15694 !! test
15695 Link inside a section heading
15696 !! wikitext
15697 ==Section with a [[Main Page|link]] in it==
15698 !! html
15699 <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>
15700
15701 !! end
15702
15703 !! test
15704 TOC regression (T14077)
15705 !! wikitext
15706 __TOC__
15707 == title 1 ==
15708 === title 1.1 ===
15709 == title 2 ==
15710 !! html
15711 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15712 <ul>
15713 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15714 <ul>
15715 <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>
15716 </ul>
15717 </li>
15718 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15719 </ul>
15720 </div>
15721
15722 <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>
15723 <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>
15724 <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>
15725
15726 !! end
15727
15728 !! test
15729 BUG 1219 URL next to image (good)
15730 !! wikitext
15731 http://example.com [[File:Foobar.jpg]]
15732 !! html/php
15733 <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>
15734 </p>
15735 !! html/parsoid
15736 <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>
15737 !!end
15738
15739 !! test
15740 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15741 !! wikitext
15742 ===
15743 The line above must have a trailing space!
15744 === <!--
15745 --> <!-- -->
15746 But just in case it doesn't...
15747 !! html
15748 <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>
15749 <p>The line above must have a trailing space!
15750 </p>
15751 <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>
15752 <p>But just in case it doesn't...
15753 </p>
15754 !! end
15755
15756 !! test
15757 Header with special characters (bug 25462)
15758 !! wikitext
15759 The tooltips shall not show entities to the user (ie. be double escaped)
15760
15761 == text > text ==
15762 section 1
15763
15764 == text < text ==
15765 section 2
15766
15767 == text & text ==
15768 section 3
15769
15770 == text ' text ==
15771 section 4
15772
15773 == text " text ==
15774 section 5
15775 !! html
15776 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15777 </p>
15778 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15779 <ul>
15780 <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>
15781 <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>
15782 <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>
15783 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15784 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15785 </ul>
15786 </div>
15787
15788 <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>
15789 <p>section 1
15790 </p>
15791 <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>
15792 <p>section 2
15793 </p>
15794 <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>
15795 <p>section 3
15796 </p>
15797 <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>
15798 <p>section 4
15799 </p>
15800 <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>
15801 <p>section 5
15802 </p>
15803 !! end
15804
15805 !! test
15806 Header with space, plus and underscore as entity
15807 !! wikitext
15808 Id should not contain + for spaces
15809
15810 == Space between Text ==
15811 section 1
15812
15813 == Space-Entity&#32;between&#32;Text ==
15814 section 2
15815
15816 == Plus+between+Text ==
15817 section 3
15818
15819 == Plus-Entity&#43;between&#43;Text ==
15820 section 4
15821
15822 == Underscore_between_Text ==
15823 section 5
15824
15825 == Underscore-Entity&#95;between&#95;Text ==
15826 section 6
15827
15828 [[#Space between Text]]
15829 [[#Space-Entity&#32;between&#32;Text]]
15830 [[#Plus+between+Text]]
15831 [[#Plus-Entity&#43;between&#43;Text]]
15832 [[#Underscore_between_Text]]
15833 [[#Underscore-Entity&#95;between&#95;Text]]
15834 !! html
15835 <p>Id should not contain + for spaces
15836 </p>
15837 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15838 <ul>
15839 <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>
15840 <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>
15841 <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>
15842 <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>
15843 <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>
15844 <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>
15845 </ul>
15846 </div>
15847
15848 <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>
15849 <p>section 1
15850 </p>
15851 <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>
15852 <p>section 2
15853 </p>
15854 <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>
15855 <p>section 3
15856 </p>
15857 <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>
15858 <p>section 4
15859 </p>
15860 <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>
15861 <p>section 5
15862 </p>
15863 <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>
15864 <p>section 6
15865 </p><p><a href="#Space_between_Text">#Space between Text</a>
15866 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15867 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15868 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15869 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15870 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15871 </p>
15872 !! end
15873
15874 !! test
15875 Headers with excess '=' characters
15876 (Are similar tests necessary beyond the 1st level?)
15877 !! wikitext
15878 =foo==
15879 ==foo=
15880 =''italic'' heading==
15881 ==''italic'' heading=
15882 !! html
15883 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15884 <ul>
15885 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15886 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15887 <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>
15888 <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>
15889 </ul>
15890 </div>
15891
15892 <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>
15893 <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>
15894 <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>
15895 <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>
15896
15897 !! end
15898
15899 !! test
15900 HTML headers vs TOC (bug 23393)
15901 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15902 !! wikitext
15903 <h1>Header 1</h1>
15904 == Header 1.1 ==
15905 == Header 1.2 ==
15906
15907 <h1>Header 2
15908 </h1>
15909 == Header 2.1 ==
15910 == Header 2.2 ==
15911 __NOEDITSECTION__
15912 !! html
15913 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15914 <ul>
15915 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15916 <ul>
15917 <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>
15918 <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>
15919 </ul>
15920 </li>
15921 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15922 <ul>
15923 <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>
15924 <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>
15925 </ul>
15926 </li>
15927 </ul>
15928 </div>
15929
15930 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15931 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15932 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15933 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15934 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15935 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15936
15937 !! end
15938
15939 !! test
15940 Single-line or multiline-comments can follow headings
15941 !! options
15942 parsoid=wt2html,wt2wt
15943 !! wikitext
15944 ==foo==<!---->
15945 ==bar==<!--c1-->
15946 ==baz==<!--
15947 c2
15948 c3-->
15949 !! html
15950 <h2><span class="mw-headline" id="foo">foo</span></h2>
15951 <h2><span class="mw-headline" id="bar">bar</span></h2>
15952 <h2><span class="mw-headline" id="baz">baz</span></h2>
15953
15954 !! end
15955
15956 !! test
15957 BUG 1219 URL next to image (broken)
15958 !! wikitext
15959 http://example.com[[File:Foobar.jpg]]
15960 !! html/php
15961 <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>
15962 </p>
15963 !! html/parsoid
15964 <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>
15965 !!end
15966
15967 !! test
15968 Bug 1186 news: in the middle of text
15969 !! wikitext
15970 http://en.wikinews.org/wiki/Wikinews:Workplace
15971 !! html
15972 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15973 </p>
15974 !!end
15975
15976
15977 !! test
15978 Namespaced link must have a title
15979 !! wikitext
15980 [[Project:]]
15981 !! html
15982 <p>[[Project:]]
15983 </p>
15984 !!end
15985
15986 !! test
15987 Namespaced link must have a title (bad fragment version)
15988 !! wikitext
15989 [[Project:#fragment]]
15990 !! html
15991 <p>[[Project:#fragment]]
15992 </p>
15993 !!end
15994
15995
15996 ###
15997 ### HTML tags and HTML attributes
15998 ###
15999
16000 !! test
16001 div with no attributes
16002 !! wikitext
16003 <div>HTML rocks</div>
16004 !! html
16005 <div>HTML rocks</div>
16006
16007 !! end
16008
16009 !! test
16010 div with double-quoted attribute
16011 !! wikitext
16012 <div id="rock">HTML rocks</div>
16013 !! html
16014 <div id="rock">HTML rocks</div>
16015
16016 !! end
16017
16018 !! test
16019 div with single-quoted attribute
16020 !! wikitext
16021 <div id='rock'>HTML rocks</div>
16022 !! html
16023 <div id="rock">HTML rocks</div>
16024
16025 !! end
16026
16027 !! test
16028 div with unquoted attribute
16029 !! wikitext
16030 <div id=rock>HTML rocks</div>
16031 !! html
16032 <div id="rock">HTML rocks</div>
16033
16034 !! end
16035
16036 !! test
16037 div with illegal double attributes
16038 !! wikitext
16039 <div id="a" id="b">HTML rocks</div>
16040 !! html
16041 <div id="b">HTML rocks</div>
16042
16043 !!end
16044
16045 !! test
16046 div with empty attribute value, space before equals
16047 !! options
16048 parsoid=wt2html,html2html
16049 !! wikitext
16050 <div class =>HTML rocks</div>
16051 !! html/php
16052 <div class="">HTML rocks</div>
16053
16054 !! html/parsoid
16055 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16056 !! end
16057
16058 !! test
16059 div with multiple empty attribute values
16060 !! options
16061 parsoid=wt2html,html2html
16062 !! wikitext
16063 <div id= title=>HTML rocks</div>
16064 !! html/php
16065 <div id="title.3D">HTML rocks</div>
16066
16067 !! html/parsoid
16068 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16069 !! end
16070
16071 !! test
16072 table with multiple empty attribute values
16073 !! options
16074 parsoid=wt2html,html2html
16075 !! wikitext
16076 {| title= id=
16077 | hi
16078 |}
16079 !! html/php
16080 <table title="id=">
16081 <tr>
16082 <td> hi
16083 </td></tr></table>
16084
16085 !! html/parsoid
16086 <table title="id=">
16087 <tbody><tr><td> hi</td></tr>
16088 </tbody></table>
16089 !! end
16090
16091 !! test
16092 div with braces in attribute value
16093 !! wikitext
16094 <div title="{}">Foo</div>
16095 !! html/php
16096 <div title="&#123;}">Foo</div>
16097
16098 !! html/parsoid
16099 <div title="{}">Foo</div>
16100 !! end
16101
16102 !! test
16103 div with empty attribute value, no space before equals
16104 !! options
16105 parsoid=wt2html,html2html
16106 !! wikitext
16107 <div class=>HTML rocks</div>
16108 !! html/php
16109 <div class="">HTML rocks</div>
16110
16111 !! html/parsoid
16112 <div class="">HTML rocks</div>
16113 !! end
16114
16115 !! test
16116 HTML multiple attributes correction
16117 !! wikitext
16118 <p class="error" class="awesome">Awesome!</p>
16119 !! html
16120 <p class="awesome">Awesome!</p>
16121
16122 !!end
16123
16124 !! test
16125 Table multiple attributes correction
16126 !! wikitext
16127 {|
16128 !+ class="error" class="awesome"| status
16129 |}
16130 !! html
16131 <table>
16132 <tr>
16133 <th class="awesome"> status
16134 </th></tr></table>
16135
16136 !!end
16137
16138 !! test
16139 DIV IN UPPERCASE
16140 !! wikitext
16141 <DIV ID="x">HTML ROCKS</DIV>
16142 !! html
16143 <div id="x">HTML ROCKS</div>
16144
16145 !!end
16146
16147 !! test
16148 Non-ASCII pseudo-tags are rendered as text
16149 !! wikitext
16150 <khyô>
16151 !! html
16152 <p>&lt;khyô&gt;
16153 </p>
16154 !! end
16155
16156 !! test
16157 Pseudo-tag with URL 'name' renders as url link
16158 !! wikitext
16159 <http://example.com/>
16160 !! html
16161 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16162 </p>
16163 !! end
16164
16165 !! test
16166 text with amp in the middle of nowhere
16167 !! wikitext
16168 Remember AT&T?
16169 !! html
16170 <p>Remember AT&amp;T?
16171 </p>
16172 !! end
16173
16174 !! test
16175 text with character entity: eacute
16176 !! wikitext
16177 I always thought &eacute; was a cute letter.
16178 !! html
16179 <p>I always thought &#233; was a cute letter.
16180 </p>
16181 !! html+tidy
16182 <p>I always thought é was a cute letter.</p>
16183 !! end
16184
16185 !! test
16186 text with entity-escaped character entity-like string: eacute
16187 !! wikitext
16188 I always thought &amp;eacute; was a cute letter.
16189 !! html
16190 <p>I always thought &amp;eacute; was a cute letter.
16191 </p>
16192 !! end
16193
16194 !! test
16195 text with undefined character entity: xacute
16196 !! wikitext
16197 I always thought &xacute; was a cute letter.
16198 !! html
16199 <p>I always thought &amp;xacute; was a cute letter.
16200 </p>
16201 !! end
16202
16203 !! test
16204 HTML5 tags
16205 !! wikitext
16206 <data value="5">five</data>
16207 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16208 <mark>This highlighted text</mark>
16209 !! html
16210 <p><data value="5">five</data>
16211 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16212 <mark>This highlighted text</mark>
16213 </p>
16214 !! end
16215
16216 !! test
16217 HTML tag with leading space is parsed as text
16218 !! wikitext
16219 < div>foo< /div>
16220 !! html
16221 <p>&lt; div&gt;foo&lt; /div&gt;
16222 </p>
16223 !! end
16224
16225 ###
16226 ### Nesting tests (see bug 41545, 50604, 51081)
16227 ###
16228
16229 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
16230 # Note that html2wt is considerably more difficult if we use <b> in
16231 # the test case, instead of <big>
16232 !! test
16233 Ensure that HTML adoption agency algorithm is properly implemented.
16234 !! wikitext
16235 <big>X<big>Y</big>Z</big>
16236 !! html
16237 <p><big>X<big>Y</big>Z</big>
16238 </p>
16239 !! end
16240
16241 # This was bug 41545 in the PHP parser.
16242 # Note that tidy doesn't handle this correctly.
16243 !! test
16244 Nesting of <kbd>
16245 !! wikitext
16246 <kbd>X<kbd>Y</kbd>Z</kbd>
16247 !! html
16248 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16249 </p>
16250 !! end
16251
16252 # The following cases were bug 51081 in the PHP parser.
16253 # Note that there are some other nestable tags (b, i, etc) which are
16254 # not covered; see bug 51081 for discussion.
16255
16256 # Note that tidy doesn't handle this correctly.
16257 !! test
16258 Nesting of <em>
16259 !! wikitext
16260 <em>X<em>Y</em>Z</em>
16261 !! html
16262 <p><em>X<em>Y</em>Z</em>
16263 </p>
16264 !! end
16265
16266 # Note that tidy doesn't handle this correctly.
16267 !! test
16268 Nesting of <strong>
16269 !! wikitext
16270 <strong>X<strong>Y</strong>Z</strong>
16271 !! html
16272 <p><strong>X<strong>Y</strong>Z</strong>
16273 </p>
16274 !! end
16275
16276 !! test
16277 Nesting of <q>
16278 !! wikitext
16279 <q>X<q>Y</q>Z</q>
16280 !! html+tidy
16281 <p><q>X<q>Y</q>Z</q></p>
16282 !! end
16283
16284 # Note that tidy doesn't handle this correctly.
16285 !! test
16286 Nesting of <ruby>
16287 !! wikitext
16288 <ruby>X<ruby>Y</ruby>Z</ruby>
16289 !! html
16290 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16291 </p>
16292 !! end
16293
16294 # Note that tidy doesn't handle this correctly.
16295 !! test
16296 Nesting of <bdo>
16297 !! wikitext
16298 <bdo>X<bdo>Y</bdo>Z</bdo>
16299 !! html
16300 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16301 </p>
16302 !! end
16303
16304
16305 ###
16306 ### Media links
16307 ###
16308
16309 !! test
16310 Media link
16311 !! wikitext
16312 [[Media:Foobar.jpg]]
16313 !! html
16314 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16315 </p>
16316 !! end
16317
16318 !! test
16319 Media link with text
16320 !! wikitext
16321 [[Media:Foobar.jpg|A neat file to look at]]
16322 !! html
16323 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16324 </p>
16325 !! end
16326
16327 # FIXME: this is still bad HTML tag nesting
16328 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16329 !! test
16330 Media link with nasty text
16331 !! wikitext
16332 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16333 !! html
16334 <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>
16335
16336 !! html+tidy
16337 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16338 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16339 !! end
16340
16341 !! test
16342 Media link to nonexistent file (bug 1702)
16343 !! wikitext
16344 [[Media:No such.jpg]]
16345 !! html
16346 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16347 </p>
16348 !! end
16349
16350 !! test
16351 Image link to nonexistent file (bug 1850 - good)
16352 !! wikitext
16353 [[File:No_such.jpg]]
16354 !! html/php
16355 <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>
16356 </p>
16357 !! html/parsoid
16358 <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>
16359 !! end
16360
16361 !! test
16362 :Image link to nonexistent file (bug 1850 - bad)
16363 !! wikitext
16364 [[:Image:No such.jpg]]
16365 !! html/php
16366 <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>
16367 </p>
16368 !! html/parsoid
16369 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16370 !! end
16371
16372
16373
16374 !! test
16375 Character reference normalization in link text (bug 1938)
16376 !! wikitext
16377 [[Main Page|this&that]]
16378 !! html
16379 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16380 </p>
16381 !!end
16382
16383 !! article
16384 אַ
16385 !! text
16386 Test for unicode normalization
16387
16388 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16389 !! endarticle
16390
16391 !! test
16392 (bug 19451) Links should refer to the normalized form.
16393 !! wikitext
16394 [[&#xFB2E;]]
16395 [[&#x5d0;&#x5b7;]]
16396 [[&#x5d0;ַ]]
16397 [[א&#x5b7;]]
16398 [[אַ]]
16399 !! html
16400 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16401 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16402 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16403 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16404 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16405 </p>
16406 !! end
16407
16408 !! test
16409 Empty attribute crash test (bug 2067)
16410 !! wikitext
16411 <font color="">foo</font>
16412 !! html
16413 <p><font color="">foo</font>
16414 </p>
16415 !! end
16416
16417 !! test
16418 Empty attribute crash test single-quotes (bug 2067)
16419 !! wikitext
16420 <font color=''>foo</font>
16421 !! html
16422 <p><font color="">foo</font>
16423 </p>
16424 !! end
16425
16426 !! test
16427 Attribute test: equals, then nothing
16428 !! options
16429 parsoid=wt2html,html2html
16430 !! wikitext
16431 <font color=>foo</font>
16432 !! html/php
16433 <p><font color="">foo</font>
16434 </p>
16435 !! html/parsoid
16436 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16437 !! end
16438
16439 !! test
16440 Attribute test: unquoted value
16441 !! options
16442 parsoid=wt2html,html2html
16443 !! wikitext
16444 <font color=x>foo</font>
16445 !! html/php
16446 <p><font color="x">foo</font>
16447 </p>
16448 !! html/parsoid
16449 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16450 !! end
16451
16452 !! test
16453 Attribute test: unquoted but illegal value (hash)
16454 !! wikitext
16455 <font color=#x>foo</font>
16456 !! html
16457 <p><font color="#x">foo</font>
16458 </p>
16459 !! end
16460
16461 # Parsoid does not serialize to empty attribute syntax,
16462 # so wt2wt and html2wt cases are skipped
16463 !! test
16464 Attribute test: no value (T54330)
16465 !! options
16466 parsoid=wt2html,html2html
16467 !! wikitext
16468 <font color>foo</font>
16469 !! html/php
16470 <p><font color="">foo</font>
16471 </p>
16472 !! html/parsoid
16473 <p><font color="">foo</font></p>
16474 !! end
16475
16476 !! test
16477 Bug 2095: link with three closing brackets
16478 !! wikitext
16479 [[Main Page]]]
16480 !! html/php
16481 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16482 </p>
16483 !! html/parsoid
16484 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16485 !! end
16486
16487 !! test
16488 Bug 2095: link with pipe and three closing brackets
16489 !! wikitext
16490 [[Main Page|link]]]
16491 !! html/php
16492 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16493 </p>
16494 !! html/parsoid
16495 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16496 !! end
16497
16498 !! test
16499 Bug 2095: link with pipe and three closing brackets, version 2
16500 !! wikitext
16501 [[Main Page|[http://example.com/]]]
16502 !! html/php
16503 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16504 </p>
16505 !! html/parsoid
16506 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16507 !! end
16508
16509
16510 ###
16511 ### Safety
16512 ###
16513
16514 !! article
16515 Template:Dangerous attribute
16516 !! text
16517 " onmouseover="alert(document.cookie)
16518 !! endarticle
16519
16520 !! article
16521 Template:Dangerous style attribute
16522 !! text
16523 border-size: expression(alert(document.cookie))
16524 !! endarticle
16525
16526 !! article
16527 Template:Div style
16528 !! text
16529 <div style="float: right; {{{1}}}">Magic div</div>
16530 !! endarticle
16531
16532 !! test
16533 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16534 !! wikitext
16535 <div title="{{test}}"></div>
16536 !! html/php
16537 <div title="This is a test template"></div>
16538
16539 !! html/parsoid
16540 <div title="This is a test template" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"This is a test template"},"sa":{"title":"{{test}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,20,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"test\",\"href\":\"./Template:Test\"},\"params\":{},\"i\":0}}]}&#39;>This is a test template&lt;/span>"}]]}'></div>
16541 !! end
16542
16543 # Parsoid has enough context to handle this case
16544 !! test
16545 Bug 2304: HTML attribute safety (dangerous template; 2309)
16546 !! wikitext
16547 <div title="{{dangerous attribute}}"></div>
16548 !! html/php
16549 <div title=""></div>
16550
16551 !! html/parsoid
16552 <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>
16553 !! end
16554
16555 !! test
16556 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16557 !! wikitext
16558 <div style="{{dangerous style attribute}}"></div>
16559 !! html/php
16560 <div style="/* insecure input */"></div>
16561
16562 !! html/parsoid
16563 <div style="/* insecure input */" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"{{dangerous style attribute}}"}}' data-mw='{"attribs":[[{"txt":"style"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,41,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous style attribute\",\"href\":\"./Template:Dangerous_style_attribute\"},\"params\":{},\"i\":0}}]}&#39;>border-size: expression(alert(document.cookie))&lt;/span>"}]]}'></div>
16564 !! end
16565
16566 !! test
16567 Bug 2304: HTML attribute safety (safe parameter; 2309)
16568 !! wikitext
16569 {{div style|width: 200px}}
16570 !! html/php
16571 <div style="float: right; width: 200px">Magic div</div>
16572
16573 !! html/parsoid
16574 <div style="float: right; width: 200px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","a":{"style":"float: right; width: 200px"},"sa":{"style":"float: right; {{{1}}}"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"div style","href":"./Template:Div_style"},"params":{"1":{"wt":"width: 200px"}},"i":0}}]}'>Magic div</div>
16575 !! end
16576
16577 !! test
16578 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16579 !! wikitext
16580 {{div style|width: expression(alert(document.cookie))}}
16581 !! html/php
16582 <div style="/* insecure input */">Magic div</div>
16583
16584 !! html/parsoid
16585 <div style="/* insecure input */" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"float: right; {{{1}}}"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"div style","href":"./Template:Div_style"},"params":{"1":{"wt":"width: expression(alert(document.cookie))"}},"i":0}}]}'>Magic div</div>
16586 !! end
16587
16588 ## Parsoid output here differs; needs investigation.
16589 !! test
16590 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16591 !! wikitext
16592 {{div style|"><script>alert(document.cookie)</script>}}
16593 !! html
16594 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16595
16596 !! end
16597
16598 ## Parsoid output here differs; needs investigation.
16599 !! test
16600 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16601 !! wikitext
16602 {{div style|" ><script>alert(document.cookie)</script>}}
16603 !! html
16604 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16605
16606 !! end
16607
16608 !! test
16609 Bug 2304: HTML attribute safety (link)
16610 !! wikitext
16611 <div title="[[Main Page]]"></div>
16612 !! html
16613 <div title="&#91;&#91;Main Page]]"></div>
16614
16615 !! end
16616
16617 !! test
16618 Bug 2304: HTML attribute safety (italics)
16619 !! wikitext
16620 <div title="''foobar''"></div>
16621 !! html
16622 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16623
16624 !! end
16625
16626 !! test
16627 Bug 2304: HTML attribute safety (bold)
16628 !! wikitext
16629 <div title="'''foobar'''"></div>
16630 !! html
16631 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16632
16633 !! end
16634
16635 !! test
16636 Bug 2304: HTML attribute safety (ISBN)
16637 !! wikitext
16638 <div title="ISBN 1234567890"></div>
16639 !! html
16640 <div title="&#73;SBN 1234567890"></div>
16641
16642 !! end
16643
16644 !! test
16645 Bug 2304: HTML attribute safety (RFC)
16646 !! wikitext
16647 <div title="RFC 1234"></div>
16648 !! html
16649 <div title="&#82;FC 1234"></div>
16650
16651 !! end
16652
16653 !! test
16654 Bug 2304: HTML attribute safety (PMID)
16655 !! wikitext
16656 <div title="PMID 1234567890"></div>
16657 !! html
16658 <div title="&#80;MID 1234567890"></div>
16659
16660 !! end
16661
16662 !! test
16663 Bug 2304: HTML attribute safety (web link)
16664 !! wikitext
16665 <div title="http://example.com/"></div>
16666 !! html
16667 <div title="http&#58;//example.com/"></div>
16668
16669 !! end
16670
16671 !! test
16672 Bug 2304: HTML attribute safety (named web link)
16673 !! wikitext
16674 <div title="[http://example.com/ link]"></div>
16675 !! html
16676 <div title="&#91;http&#58;//example.com/ link]"></div>
16677
16678 !! end
16679
16680 !! test
16681 Bug 3244: HTML attribute safety (extension; safe)
16682 !! wikitext
16683 <div style="<nowiki>background:blue</nowiki>"></div>
16684 !! html/php
16685 <div style="background:blue"></div>
16686
16687 !! html/parsoid
16688 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
16689 !! end
16690
16691 !! test
16692 Bug 3244: HTML attribute safety (extension; unsafe)
16693 !! wikitext
16694 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16695 !! html/php
16696 <div style="/* insecure input */"></div>
16697
16698 !! html/parsoid
16699 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"&lt;nowiki>border-left:expression(alert(document.cookie))&lt;/nowiki>"}}'></div>
16700 !! end
16701
16702 # More MSIE fun discovered by Tom Gilder
16703
16704 !! test
16705 MSIE CSS safety test: spurious slash
16706 !! wikitext
16707 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16708 !! html/php
16709 <div style="/* insecure input */">evil</div>
16710
16711 !! html/parsoid
16712 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:u\\rl(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
16713 !! end
16714
16715 !! test
16716 MSIE CSS safety test: hex code
16717 !! wikitext
16718 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16719 !! html/php
16720 <div style="/* insecure input */">evil</div>
16721
16722 !! html/parsoid
16723 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:u\\72l(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
16724 !! end
16725
16726 !! test
16727 MSIE CSS safety test: comment in url
16728 !! wikitext
16729 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16730 !! html/php
16731 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16732
16733 !! html/parsoid
16734 <div style="background-image:u rl(javascript:alert('boo'))" data-parsoid='{"stx":"html","a":{"style":"background-image:u rl(javascript:alert(&#39;boo&#39;))"},"sa":{"style":"background-image:u/**/rl(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
16735 !! end
16736
16737 !! test
16738 MSIE CSS safety test: comment in expression
16739 !! wikitext
16740 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16741 !! html/php
16742 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16743
16744 !! html/parsoid
16745 <div style="background-image:expres sion(alert('boo4'))" data-parsoid='{"stx":"html","a":{"style":"background-image:expres sion(alert(&#39;boo4&#39;))"},"sa":{"style":"background-image:expres/**/sion(alert(&#39;boo4&#39;))"}}'>evil4</div>
16746 !! end
16747
16748 !! test
16749 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16750 !! wikitext
16751 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16752 !! html/php
16753 <p style="/* invalid control char */">A</p>
16754
16755 !! html/parsoid
16756 <p style="/* invalid control char */" data-parsoid='{"stx":"html","a":{"style":"/* invalid control char */"},"sa":{"style":"font-size: 100px; background-image:url\\b(https://www.google.com/images/srpr/logo6w.png)"}}'>A</p>
16757 !! end
16758
16759 !! test
16760 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16761 !! wikitext
16762 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16763 <div style="top:EXPRESSION(alert())">B</div>
16764 !! html/php
16765 <p style="/* insecure input */">A</p>
16766 <div style="/* insecure input */">B</div>
16767
16768 !! html/parsoid
16769 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expression((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>A</p>
16770 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
16771 !! end
16772
16773 !! test
16774 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16775 !! wikitext
16776 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16777 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16778 !! html/php
16779 <div style="/* insecure input */">A</div>
16780 <p style="/* insecure input */">B</p>
16781
16782 !! html/parsoid
16783 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
16784 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expʀessɪoɴ((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>B</p>
16785 !! end
16786
16787 !! test
16788 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16789 !! wikitext
16790 <div style="background-image:url⁽javascript:alert())">A</div>
16791 <div style="background-image:url₍javascript:alert())">B</div>
16792 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16793 !! html/php
16794 <div style="/* insecure input */">A</div>
16795 <div style="/* insecure input */">B</div>
16796 <p style="/* insecure input */">C</p>
16797
16798 !! html/parsoid
16799 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
16800 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
16801 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expressioⁿ((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>C</p>
16802 !! end
16803
16804 !! test
16805 Opera -o-link CSS
16806 !! options
16807 parsoid=wt2html,html2html
16808 !! wikitext
16809 <div
16810 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;"
16811 style="-o-link:attr(title);-o-link-source:current">X</div>
16812 !! html/php
16813 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16814
16815 !! html/parsoid
16816 <div title="data:text/html,&lt;img src=1 onerror=alert(1)>" style="/* insecure input */" data-parsoid='{"stx":"html","a":{"title":"data:text/html,&lt;img src=1 onerror=alert(1)>","style":"/* insecure input */"},"sa":{"title":"&amp;#100;&amp;#97;&amp;#116;&amp;#97;&amp;#58;&amp;#116;&amp;#101;&amp;#120;&amp;#116;&amp;#47;&amp;#104;&amp;#116;&amp;#109;&amp;#108;&amp;#44;&amp;#60;&amp;#105;&amp;#109;&amp;#103;&amp;#32;&amp;#115;&amp;#114;&amp;#99;&amp;#61;&amp;#49;&amp;#32;&amp;#111;&amp;#110;&amp;#101;&amp;#114;&amp;#114;&amp;#111;&amp;#114;&amp;#61;&amp;#97;&amp;#108;&amp;#101;&amp;#114;&amp;#116;&amp;#40;&amp;#49;&amp;#41;&amp;#62;","style":"-o-link:attr(title);-o-link-source:current"}}'>X</div>
16817 !! end
16818
16819 !! test
16820 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16821 !! wikitext
16822 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16823 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16824 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16825 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16826 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16827 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16828 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16829 !! html/php
16830 <p style="/* insecure input */">A</p>
16831 <p style="/* insecure input */">B</p>
16832 <p style="/* insecure input */">C</p>
16833 <p style="/* insecure input */">D</p>
16834 <p style="/* insecure input */">E</p>
16835 <p style="/* insecure input */">F</p>
16836 <p style="/* insecure input */">G</p>
16837
16838 !! html/parsoid
16839 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expres〱ion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>A</p>
16840 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresゝion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>B</p>
16841 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>C</p>
16842 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresヽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>D</p>
16843 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>E</p>
16844 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹼion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>F</p>
16845 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>G</p>
16846 !! end
16847
16848 !! test
16849 Table attribute legitimate extension
16850 !! wikitext
16851 {|
16852 !+ style="<nowiki>color:blue</nowiki>"| status
16853 |}
16854 !! html
16855 <table>
16856 <tr>
16857 <th style="color:blue"> status
16858 </th></tr></table>
16859
16860 !!end
16861
16862 !! test
16863 Table attribute safety
16864 !! wikitext
16865 {|
16866 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16867 |}
16868 !! html
16869 <table>
16870 <tr>
16871 <th style="/* insecure input */"> status
16872 </th></tr></table>
16873
16874 !! end
16875
16876 !! test
16877 CSS line continuation 1
16878 !! wikitext
16879 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16880 !! html
16881 <div style="/* insecure input */"></div>
16882
16883 !! end
16884
16885 !! test
16886 CSS line continuation 2
16887 !! wikitext
16888 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16889 !! html
16890 <div style="/* invalid control char */"></div>
16891
16892 !! end
16893
16894 !! article
16895 Template:Identity
16896 !! text
16897 {{{1}}}
16898 !! endarticle
16899
16900 !! test
16901 Expansion of multi-line templates in attribute values (bug 6255)
16902 !! wikitext
16903 <div style="background: {{identity|#00FF00}}">-</div>
16904 !! html
16905 <div style="background: #00FF00">-</div>
16906
16907 !! end
16908
16909 !! test
16910 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16911 !! wikitext
16912 <div style="background:
16913 #00FF00">-</div>
16914 !! html/php
16915 <div style="background: #00FF00">-</div>
16916
16917 !! html/parsoid
16918 <div style="background:
16919 #00FF00">-</div>
16920 !! end
16921
16922 !! test
16923 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16924 !! wikitext
16925 <div style="background: &#10;#00FF00">-</div>
16926 !! html
16927 <div style="background: &#10;#00FF00">-</div>
16928
16929 !! end
16930
16931 !! test
16932 Tags which are hidden from Tidy cannot pass through the Sanitizer
16933 !! wikitext
16934 <mw:toc><script>alert();</script></mw:toc>
16935 !! html+tidy
16936 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
16937 !! end
16938
16939 ###
16940 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16941 ###
16942
16943 !! test
16944 Parser hook: empty input
16945 !! wikitext
16946 <tag></tag>
16947 !! html/php
16948 <pre>
16949 ''
16950 array (
16951 )
16952 </pre>
16953
16954 !! html/parsoid
16955 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16956 !! end
16957
16958 ## Don't expect parsoid to rt this form.
16959 !! test
16960 Parser hook: empty input using terminated empty elements
16961 !! options
16962 parsoid=wt2html,html2html
16963 !! wikitext
16964 <tag/>
16965 !! html/php
16966 <pre>
16967 NULL
16968 array (
16969 )
16970 </pre>
16971
16972 !! html/parsoid
16973 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16974 !! end
16975
16976 !! test
16977 Parser hook: empty input using terminated empty elements (space before)
16978 !! wikitext
16979 <tag />
16980 !! html/php
16981 <pre>
16982 NULL
16983 array (
16984 )
16985 </pre>
16986
16987 !! html/parsoid
16988 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16989 !! end
16990
16991 !! test
16992 Parser hook: basic input
16993 !! wikitext
16994 <tag>input</tag>
16995 !! html/php
16996 <pre>
16997 'input'
16998 array (
16999 )
17000 </pre>
17001
17002 !! html/parsoid
17003 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17004 !! end
17005
17006 ## Don't expect parsoid to rt this form.
17007 !! test
17008 Parser hook: case insensitive
17009 !! options
17010 parsoid=wt2html,html2html
17011 !! wikitext
17012 <TAG>input</TAG>
17013 !! html/php
17014 <pre>
17015 'input'
17016 array (
17017 )
17018 </pre>
17019
17020 !! html/parsoid
17021 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17022 !! end
17023
17024 ## Don't expect parsoid to rt this form.
17025 !! test
17026 Parser hook: case insensitive, redux
17027 !! options
17028 parsoid=wt2html,html2html
17029 !! wikitext
17030 <TaG>input</TAg>
17031 !! html/php
17032 <pre>
17033 'input'
17034 array (
17035 )
17036 </pre>
17037
17038 !! html/parsoid
17039 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17040 !! end
17041
17042 !! test
17043 Parser hook: nested tags
17044 !! wikitext
17045 <tag><tag></tag></tag>
17046 !! html/php
17047 <pre>
17048 '<tag>'
17049 array (
17050 )
17051 </pre>&lt;/tag&gt;
17052
17053 !! html/parsoid
17054 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
17055 !! end
17056
17057 !! test
17058 Parser hook: basic arguments
17059 !! wikitext
17060 <tag width="200" height="100" depth="50" square=""></tag>
17061 !! html/php
17062 <pre>
17063 ''
17064 array (
17065 'width' => '200',
17066 'height' => '100',
17067 'depth' => '50',
17068 'square' => '',
17069 )
17070 </pre>
17071
17072 !! html/parsoid
17073 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17074 !! end
17075
17076 ## Don't expect parsoid to rt this form.
17077 !! test
17078 Parser hook: basic arguments, variations
17079 !! options
17080 parsoid=wt2html,html2html
17081 !! wikitext
17082 <tag width=200 height = "100" depth = '50' square></tag>
17083 !! html/php
17084 <pre>
17085 ''
17086 array (
17087 'width' => '200',
17088 'height' => '100',
17089 'depth' => '50',
17090 'square' => '',
17091 )
17092 </pre>
17093
17094 !! html/parsoid
17095 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17096 !! end
17097
17098 !! test
17099 Parser hook: argument containing a forward slash (bug 5344)
17100 !! wikitext
17101 <tag filename="/tmp/bla"></tag>
17102 !! html/php
17103 <pre>
17104 ''
17105 array (
17106 'filename' => '/tmp/bla',
17107 )
17108 </pre>
17109
17110 !! html/parsoid
17111 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17112 !! end
17113
17114 ## Don't expect parsoid to rt this form.
17115 !! test
17116 Parser hook: empty input using terminated empty elements (bug 2374)
17117 !! options
17118 parsoid=wt2html,html2html
17119 !! wikitext
17120 <tag foo=bar/>text
17121 !! html/php
17122 <pre>
17123 NULL
17124 array (
17125 'foo' => 'bar',
17126 )
17127 </pre>text
17128
17129 !! html/parsoid
17130 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
17131 !! end
17132
17133 ## </tag> should be output literally since there is no matching tag that begins it
17134 ## Don't expect parsoid to rt this form.
17135 !! test
17136 Parser hook: basic arguments using terminated empty elements (bug 2374)
17137 !! options
17138 parsoid=wt2html
17139 !! wikitext
17140 <tag width=200 height = "100" depth = '50' square/>
17141 other stuff
17142 </tag>
17143 !! html/php
17144 <pre>
17145 NULL
17146 array (
17147 'width' => '200',
17148 'height' => '100',
17149 'depth' => '50',
17150 'square' => '',
17151 )
17152 </pre>
17153 <p>other stuff
17154 &lt;/tag&gt;
17155 </p>
17156 !! html/parsoid
17157 <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
17158 &lt;/tag></p>
17159 !! end
17160
17161 ## Don't expect parsoid to rt this form.
17162 !! test
17163 Parser hook: Don't allow unclosed extension tags
17164 !! options
17165 parsoid=wt2html
17166 !! wikitext
17167 test <tag>123
17168
17169 this is a '''test'''
17170 !! html/php
17171 <p>test &lt;tag&gt;123
17172 </p><p>this is a <b>test</b>
17173 </p>
17174 !! html/parsoid
17175 <p>test &lt;tag>123</p>
17176
17177 <p>this is a <b>test</b></p>
17178 !! end
17179
17180 ###
17181 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17182 ###
17183
17184 !! test
17185 Parser hook: static parser hook not inside a comment
17186 !! wikitext
17187 <statictag>hello, world</statictag>
17188
17189 <statictag action="flush" />
17190 !! html/php
17191 <p><br />
17192 hello, world
17193 </p>
17194 !! html/parsoid
17195 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17196 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17197 !! end
17198
17199 !! test
17200 Parser hook: static parser hook inside a comment
17201 !! wikitext
17202 <!-- <statictag>hello, world</statictag> -->
17203 <statictag action="flush" />
17204 !! html/php
17205 <p><br />
17206 </p>
17207 !! html/parsoid
17208 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17209 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17210 !! end
17211
17212 # Nested template calls; this case was broken by Parser.php rev 1.506,
17213 # since reverted.
17214
17215 !! article
17216 Template:One-parameter
17217 !! text
17218 (My parameter is: {{{1}}})
17219 !! endarticle
17220
17221 !! article
17222 Template:Map-one-parameter
17223 !! text
17224 {{{{{1}}}|{{{2}}}}}
17225 !! endarticle
17226
17227 !! test
17228 Nested template calls
17229 !! wikitext
17230 {{Map-one-parameter|One-parameter|param}}
17231 !! html
17232 <p>(My parameter is: param)
17233 </p>
17234 !! end
17235
17236
17237 ###
17238 ### Sanitizer
17239 ###
17240
17241 # HTML+Tidy effectively strips out the empty tags completely
17242 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17243 # which Tidy would have done for the PHP parser had there been content inside it.
17244 !! test
17245 Sanitizer: Closing of open tags
17246 !! wikitext
17247 <s></s><table></table>
17248 !! html
17249 <s></s><table></table>
17250
17251 !! html/parsoid
17252 <p><s></s></p><table></table>
17253 !! end
17254
17255 !! test
17256 Sanitizer: Closing of open but not closed tags
17257 !! wikitext
17258 <s>foo
17259 !! html
17260 <p><s>foo</s>
17261 </p>
17262 !! end
17263
17264 !! test
17265 Sanitizer: Closing of closed but not open tags
17266 !! options
17267 parsoid=wt2html
17268 !! wikitext
17269 </s>
17270 !! html/php+tidy
17271 !! html/parsoid
17272 !! end
17273
17274 !! test
17275 Sanitizer: Closing of closed but not open table tags
17276 !! options
17277 parsoid=wt2html
17278 !! wikitext
17279 Table not started</td></tr></table>
17280 !! html/php+tidy
17281 <p>Table not started</p>
17282 !! html/parsoid
17283 <p>Table not started</p>
17284 !! end
17285
17286 !! test
17287 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17288 !! wikitext
17289 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17290 !! html/php
17291 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17292 </p>
17293 !! html/parsoid
17294 <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>
17295 !! end
17296
17297 # In HTML5, the restrictions are that id must contain at least one character,
17298 # and must not contain any space characters.
17299 !! test
17300 Sanitizer: Validating the contents of the id attribute (bug 4515)
17301 !! options
17302 disabled
17303 !! wikitext
17304 <br id="" /><br id="a space" />
17305 !! html
17306 Something ...
17307 !! end
17308
17309 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17310 !! test
17311 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
17312 !! options
17313 disabled
17314 !! wikitext
17315 <br id="foo" /><br id="foo" />
17316 !! html
17317 Something need to be done. foo-2 ?
17318 !! end
17319
17320 !! test
17321 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17322 !! wikitext
17323 <div itemscope>
17324 <meta itemprop="hello" content="world">
17325 <meta http-equiv="refresh" content="5">
17326 <meta itemprop="hello" http-equiv="refresh" content="5">
17327 <link itemprop="hello" href="{{SERVER}}">
17328 <link rel="stylesheet" href="{{SERVER}}">
17329 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17330 </div>
17331 !! html
17332 <div itemscope="">
17333 <p> <meta itemprop="hello" content="world" />
17334 &lt;meta http-equiv="refresh" content="5"&gt;
17335 <meta itemprop="hello" content="5" />
17336 </p>
17337 <link itemprop="hello" href="http&#58;//example.org" />
17338 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17339 <link itemprop="hello" href="http&#58;//example.org" />
17340 </div>
17341
17342 !! end
17343
17344 !! test
17345 Language converter: output gets cut off unexpectedly (bug 5757)
17346 !! options
17347 language=zh
17348 !! wikitext
17349 this bit is safe: }-
17350
17351 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17352
17353 then we get cut off here: }-
17354
17355 all additional text is vanished
17356 !! html
17357 <p>this bit is safe: }-
17358 </p><p>but if we add a conversion instance: xxx
17359 </p><p>then we get cut off here: }-
17360 </p><p>all additional text is vanished
17361 </p>
17362 !! end
17363
17364 !! test
17365 Self closed html pairs (bug 5487)
17366 !! options
17367 !! wikitext
17368 <center><font id="bug" />Centered text</center>
17369 <div><font id="bug2" />In div text</div>
17370 !! html
17371 <center>&lt;font id="bug" /&gt;Centered text</center>
17372 <div>&lt;font id="bug2" /&gt;In div text</div>
17373
17374 !! end
17375
17376 #
17377 #
17378 #
17379
17380 !! test
17381 Punctuation: nbsp before exclamation
17382 !! wikitext
17383 C'est grave !
17384 !! html
17385 <p>C'est grave&#160;!
17386 </p>
17387 !! end
17388
17389 !! test
17390 Punctuation: CSS !important (bug 11874)
17391 !! wikitext
17392 <div style="width:50% !important">important</div>
17393 !! html
17394 <div style="width:50% !important">important</div>
17395
17396 !!end
17397
17398 !! test
17399 Punctuation: CSS ! important (bug 11874; with space after)
17400 !! wikitext
17401 <div style="width:50% ! important">important</div>
17402 !! html
17403 <div style="width:50% ! important">important</div>
17404
17405 !!end
17406
17407 !! test
17408 HTML bullet list, closed tags (bug 5497)
17409 !! wikitext
17410 <ul>
17411 <li>One</li>
17412 <li>Two</li>
17413 </ul>
17414 !! html/php
17415 <ul>
17416 <li>One</li>
17417 <li>Two</li>
17418 </ul>
17419
17420 !! html/parsoid
17421 <ul data-parsoid='{"stx":"html"}'>
17422 <li data-parsoid='{"stx":"html"}'>One</li>
17423 <li data-parsoid='{"stx":"html"}'>Two</li>
17424 </ul>
17425
17426 !! end
17427
17428 !! test
17429 HTML bullet list, unclosed tags (bug 5497)
17430 !! wikitext
17431 <ul>
17432 <li>One
17433 <li>Two
17434 </ul>
17435 !! html/php+tidy
17436 <ul>
17437 <li>One</li>
17438 <li>Two</li>
17439 </ul>
17440 !! html/parsoid
17441 <ul data-parsoid='{"stx":"html"}'>
17442 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17443 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17444 </ul>
17445
17446 !! end
17447
17448 !! test
17449 HTML ordered list, closed tags (bug 5497)
17450 !! wikitext
17451 <ol>
17452 <li>One</li>
17453 <li>Two</li>
17454 </ol>
17455 !! html/php
17456 <ol>
17457 <li>One</li>
17458 <li>Two</li>
17459 </ol>
17460
17461 !! html/parsoid
17462 <ol data-parsoid='{"stx":"html"}'>
17463 <li data-parsoid='{"stx":"html"}'>One</li>
17464 <li data-parsoid='{"stx":"html"}'>Two</li>
17465 </ol>
17466
17467 !! end
17468
17469 !! test
17470 HTML ordered list, unclosed tags (bug 5497)
17471 !! options
17472 !! wikitext
17473 <ol>
17474 <li>One
17475 <li>Two
17476 </ol>
17477 !! html/php+tidy
17478 <ol>
17479 <li>One</li>
17480 <li>Two</li>
17481 </ol>
17482 !! html/parsoid
17483 <ol data-parsoid='{"stx":"html"}'>
17484 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17485 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17486 </ol>
17487
17488 !! end
17489
17490 !! test
17491 HTML nested bullet list, closed tags (bug 5497)
17492 !! wikitext
17493 <ul>
17494 <li>One</li>
17495 <li>Two:
17496 <ul>
17497 <li>Sub-one</li>
17498 <li>Sub-two</li>
17499 </ul>
17500 </li>
17501 </ul>
17502 !! html/php
17503 <ul>
17504 <li>One</li>
17505 <li>Two:
17506 <ul>
17507 <li>Sub-one</li>
17508 <li>Sub-two</li>
17509 </ul>
17510 </li>
17511 </ul>
17512
17513 !! html/parsoid
17514 <ul data-parsoid='{"stx":"html"}'>
17515 <li data-parsoid='{"stx":"html"}'>One</li>
17516 <li data-parsoid='{"stx":"html"}'>Two:
17517 <ul data-parsoid='{"stx":"html"}'>
17518 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17519 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17520 </ul>
17521 </li>
17522 </ul>
17523 !! end
17524
17525 !! test
17526 HTML nested bullet list, open tags (bug 5497)
17527 !! wikitext
17528 <ul>
17529 <li>One
17530 <li>Two:
17531 <ul>
17532 <li>Sub-one
17533 <li>Sub-two
17534 </ul>
17535 </ul>
17536 !! html/php+tidy
17537 <ul>
17538 <li>One</li>
17539 <li>Two:
17540 <ul>
17541 <li>Sub-one</li>
17542 <li>Sub-two</li>
17543 </ul>
17544 </li>
17545 </ul>
17546 !! html/parsoid
17547 <ul>
17548 <li>One
17549 </li>
17550 <li>Two:
17551 <ul>
17552 <li>Sub-one
17553 </li>
17554 <li>Sub-two
17555 </li>
17556 </ul>
17557 </li>
17558 </ul>
17559
17560 !! end
17561
17562 !! test
17563 HTML nested ordered list, closed tags (bug 5497)
17564 !! wikitext
17565 <ol>
17566 <li>One</li>
17567 <li>Two:
17568 <ol>
17569 <li>Sub-one</li>
17570 <li>Sub-two</li>
17571 </ol>
17572 </li>
17573 </ol>
17574 !! html
17575 <ol>
17576 <li>One</li>
17577 <li>Two:
17578 <ol>
17579 <li>Sub-one</li>
17580 <li>Sub-two</li>
17581 </ol>
17582 </li>
17583 </ol>
17584
17585 !! end
17586
17587 !! test
17588 HTML nested ordered list, open tags (bug 5497)
17589 !! wikitext
17590 <ol>
17591 <li>One
17592 <li>Two:
17593 <ol>
17594 <li>Sub-one
17595 <li>Sub-two
17596 </ol>
17597 </ol>
17598 !! html/php
17599 <ol>
17600 <li>One
17601 <li>Two:
17602 <ol>
17603 <li>Sub-one
17604 <li>Sub-two
17605 </ol>
17606 </ol>
17607
17608 !! html/parsoid
17609 <ol>
17610 <li>One
17611 </li>
17612 <li>Two:
17613 <ol>
17614 <li>Sub-one
17615 </li>
17616 <li>Sub-two
17617 </li>
17618 </ol>
17619 </li>
17620 </ol>
17621
17622 !! end
17623
17624 !! test
17625 HTML ordered list item with parameters oddity
17626 !! wikitext
17627 <ol><li id="fragment">One</li>
17628 </ol>
17629 !! html
17630 <ol><li id="fragment">One</li>
17631 </ol>
17632
17633 !! end
17634
17635 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17636 !!test
17637 bug 5918: autonumbering
17638 !! wikitext
17639 [http://first/] [http://second] [ftp://ftp]
17640
17641 ftp://inlineftp
17642
17643 [mailto:enclosed@mail.tld With target]
17644
17645 [mailto:enclosed@mail.tld]
17646
17647 mailto:inline@mail.tld
17648 !! html/php
17649 <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>
17650 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17651 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17652 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17653 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17654 </p>
17655 !! html/parsoid
17656 <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>
17657 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17658 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17659 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17660 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17661 !! end
17662
17663
17664 #
17665 # Security and HTML correctness
17666 # From Nick Jenkins' fuzz testing
17667 #
17668
17669 !! test
17670 Fuzz testing: Parser13
17671 !! wikitext
17672 {|
17673 | http://a|
17674 !! html
17675 <table>
17676 <tr>
17677 <td>
17678 </td>
17679 </tr>
17680 </table>
17681
17682 !! end
17683
17684 !! test
17685 Fuzz testing: Parser14
17686 !! wikitext
17687 == onmouseover= ==
17688 http://__TOC__
17689 !! html
17690 <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>
17691 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17692 <ul>
17693 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17694 </ul>
17695 </div>
17696
17697
17698 !! html+tidy
17699 <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>
17700 <p>http://</p>
17701 <div id="toc" class="toc">
17702 <div id="toctitle">
17703 <h2>Contents</h2>
17704 </div>
17705 <ul>
17706 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17707 </ul>
17708 </div>
17709 <p></p>
17710 !! end
17711
17712 !! test
17713 Fuzz testing: Parser14-table
17714 !! options
17715 parsoid=wt2html,html2html
17716 !! wikitext
17717 ==a==
17718 {| STYLE=__TOC__
17719 !! html
17720 <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>
17721 <table style="&#95;_TOC&#95;_">
17722 <tr><td></td></tr>
17723 </table>
17724
17725 !! html+tidy
17726 <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>
17727 <table style="__TOC__">
17728 <tr>
17729 <td></td>
17730 </tr>
17731 </table>
17732 !! html/parsoid
17733 <h2>a</h2>
17734 <table style="__TOC__"></table>
17735 !! end
17736
17737 # Known to produce bogus xml (extra </td>)
17738 !! test
17739 Fuzz testing: Parser16
17740 !! wikitext
17741 {|
17742 !https://||||||
17743 !! html
17744 <table>
17745 <tr>
17746 <th>https://</th>
17747 <th></th>
17748 <th></th>
17749 <th>
17750 </td>
17751 </tr>
17752 </table>
17753
17754 !! html+tidy
17755 <table>
17756 <tr>
17757 <th>https://</th>
17758 <th></th>
17759 <th></th>
17760 <th></th>
17761 </tr>
17762 </table>
17763 !! end
17764
17765 !! test
17766 Fuzz testing: Parser21
17767 !! wikitext
17768 {|
17769 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17770 |
17771 !! html
17772 <table>
17773 <tr>
17774 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17775 </th>
17776 <td>
17777 </td>
17778 </tr>
17779 </table>
17780
17781 !! end
17782
17783 !! test
17784 Fuzz testing: Parser22
17785 !! wikitext
17786 http://===r:::https://b
17787
17788 {|
17789 !! html
17790 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17791 </p>
17792 <table>
17793 <tr><td></td></tr>
17794 </table>
17795
17796 !! end
17797
17798 # Known to produce bad XML for now
17799 !! test
17800 Fuzz testing: Parser24
17801 !! options
17802 parsoid=wt2html
17803 !! wikitext
17804 {|
17805 {{{|
17806 <u CLASS=
17807 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17808 <br style="onmouseover='alert(document.cookie);' " />
17809
17810 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17811 |
17812 !! html/php
17813 <table>
17814 {{{|
17815 <u class="&#124;">}}}} &gt;
17816 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17817
17818 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17819 <tr>
17820 <td></u>
17821 </td>
17822 </tr>
17823 </table>
17824
17825 !! html/parsoid
17826 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
17827 <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":""}]]}'>
17828 <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}'>
17829
17830
17831
17832 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
17833 !! end
17834
17835 # Note: the current result listed for this is not what the original one was,
17836 # but the original bug was JavaScript injection, which is fixed in any case.
17837 # It's not clear that the original result listed was any more correct than the
17838 # current one. Original result:
17839 # <p>{{{|
17840 # </p>
17841 # <li class="&#124;&#124;">
17842 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17843 !!test
17844 Fuzz testing: Parser25 (bug 6055)
17845 !! wikitext
17846 {{{
17847 |
17848 <LI CLASS=||
17849 >
17850 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17851 !! html/php
17852 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17853 </p>
17854 !! html/parsoid
17855 <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"]}'>
17856 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
17857 !! end
17858
17859 !!test
17860 Fuzz testing: URL adjacent extension (with space, clean)
17861 !! wikitext
17862 http://example.com <nowiki>junk</nowiki>
17863 !! html/php
17864 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17865 </p>
17866 !! html/parsoid
17867 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17868 !! end
17869
17870 !!test
17871 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17872 !! wikitext
17873 http://example.com<nowiki>junk</nowiki>
17874 !! html/php
17875 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17876 </p>
17877 !! html/parsoid
17878 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17879 !! end
17880
17881 !!test
17882 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17883 !! wikitext
17884 http://example.com<pre>junk</pre>
17885 !! html/php
17886 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17887
17888 !! html/php+tidy
17889 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17890 <pre>
17891 junk
17892 </pre>
17893 !! html/parsoid
17894 <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>
17895 !!end
17896
17897 !!test
17898 Fuzz testing: image with bogus manual thumbnail
17899 !! wikitext
17900 [[Image:foobar.jpg|thumbnail= ]]
17901 !! html/php
17902 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17903
17904 !! html/parsoid
17905 <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>
17906 !!end
17907
17908 !! test
17909 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17910 !! wikitext
17911 <pre dir="&#10;"></pre>
17912 !! html
17913 <pre dir="&#10;"></pre>
17914
17915 !! end
17916
17917 !! test
17918 Parsing optional HTML elements (Bug 6171)
17919 !! options
17920 !! wikitext
17921 <table>
17922 <tr>
17923 <td> Some tabular data</td>
17924 <td> More tabular data ...
17925 <td> And yet som tabular data</td>
17926 </tr>
17927 </table>
17928 !! html
17929 <table>
17930 <tr>
17931 <td> Some tabular data</td>
17932 <td> More tabular data ...
17933 </td><td> And yet som tabular data</td>
17934 </tr>
17935 </table>
17936
17937 !! end
17938
17939 !! test
17940 Correct handling of <td>, <tr> (Bug 6171)
17941 !! options
17942 !! wikitext
17943 <table>
17944 <tr>
17945 <td> Some tabular data</td>
17946 <td> More tabular data ...</td>
17947 <td> And yet som tabular data</td>
17948 </tr>
17949 </table>
17950 !! html
17951 <table>
17952 <tr>
17953 <td> Some tabular data</td>
17954 <td> More tabular data ...</td>
17955 <td> And yet som tabular data</td>
17956 </tr>
17957 </table>
17958
17959 !! end
17960
17961
17962 !! test
17963 Parsing crashing regression (fr:JavaScript)
17964 !! wikitext
17965 </body></x>
17966 !! html
17967 <p>&lt;/body&gt;&lt;/x&gt;
17968 </p>
17969 !! end
17970
17971 !! test
17972 Inline wiki vs wiki block nesting
17973 !! wikitext
17974 '''Bold paragraph
17975
17976 New wiki paragraph
17977 !! html
17978 <p><b>Bold paragraph</b>
17979 </p><p>New wiki paragraph
17980 </p>
17981 !! end
17982
17983 # FIXME: The current php output is documented
17984 # and desired output is the parsoid target.
17985 !! test
17986 Inline HTML vs wiki block nesting
17987 !! wikitext
17988 <b>Bold paragraph
17989
17990 New wiki paragraph
17991 !! html/php
17992 <p><b>Bold paragraph
17993 </p><p>New wiki paragraph</b>
17994 </p>
17995 !! html/parsoid
17996 <p><b>Bold paragraph</b>
17997 </p><p>New wiki paragraph
17998 </p>
17999 !! end
18000
18001 # Original result was this:
18002 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
18003 # </p>
18004 # While that might be marginally more intuitive, maybe, the six-apostrophe
18005 # construct is clearly pathological and the result stated here (which is what
18006 # the parser actually does) is about as reasonable as anything.
18007 !!test
18008 Mixing markup for italics and bold
18009 !! options
18010 !! wikitext
18011 '''bold''''''bold''bolditalics'''''
18012 !! html
18013 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
18014 </p>
18015 !! end
18016
18017
18018 !! article
18019 Xyzzyx
18020 !! text
18021 Article for special page transclusion test
18022 !! endarticle
18023
18024 !! test
18025 Special page transclusion
18026 !! options
18027 !! wikitext
18028 {{Special:Prefixindex/Xyzzyx}}
18029 !! html
18030 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18031 </ul>
18032
18033 !! end
18034
18035 !! test
18036 Special page transclusion twice (bug 5021)
18037 !! options
18038 !! wikitext
18039 {{Special:Prefixindex/Xyzzyx}}
18040 {{Special:Prefixindex/Xyzzyx}}
18041 !! html
18042 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18043 </ul>
18044 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18045 </ul>
18046
18047 !! end
18048
18049 !! test
18050 Transclusion of default MediaWiki message
18051 !! wikitext
18052 {{MediaWiki:Mainpage}}
18053 !! html
18054 <p>Main Page
18055 </p>
18056 !! end
18057
18058 !! test
18059 Transclusion of nonexistent MediaWiki message
18060 !! wikitext
18061 {{MediaWiki:Mainpagexxx}}
18062 !! html
18063 <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>
18064 </p>
18065 !! end
18066
18067 !! test
18068 Transclusion of MediaWiki message with underscore
18069 !! wikitext
18070 {{MediaWiki:history_short}}
18071 !! html
18072 <p>History
18073 </p>
18074 !! end
18075
18076 !! test
18077 Transclusion of MediaWiki message with space
18078 !! wikitext
18079 {{MediaWiki:history short}}
18080 !! html
18081 <p>History
18082 </p>
18083 !! end
18084
18085 !! test
18086 Invalid header with following text
18087 !! wikitext
18088 = x = y
18089 !! html
18090 <p>= x = y
18091 </p>
18092 !! end
18093
18094
18095 !! test
18096 Section extraction test (section 0)
18097 !! options
18098 section=0
18099 !! wikitext
18100 start
18101 ==a==
18102 ===aa===
18103 ====aaa====
18104 ==b==
18105 ===ba===
18106 ===bb===
18107 ====bba====
18108 ===bc===
18109 ==c==
18110 ===ca===
18111 !! html/php
18112 start
18113 !! end
18114
18115 !! test
18116 Section extraction test (section 1)
18117 !! options
18118 section=1
18119 !! wikitext
18120 start
18121 ==a==
18122 ===aa===
18123 ====aaa====
18124 ==b==
18125 ===ba===
18126 ===bb===
18127 ====bba====
18128 ===bc===
18129 ==c==
18130 ===ca===
18131 !! html/php
18132 ==a==
18133 ===aa===
18134 ====aaa====
18135 !! end
18136
18137 !! test
18138 Section extraction test (section 2)
18139 !! options
18140 section=2
18141 !! wikitext
18142 start
18143 ==a==
18144 ===aa===
18145 ====aaa====
18146 ==b==
18147 ===ba===
18148 ===bb===
18149 ====bba====
18150 ===bc===
18151 ==c==
18152 ===ca===
18153 !! html/php
18154 ===aa===
18155 ====aaa====
18156 !! end
18157
18158 !! test
18159 Section extraction test (section 3)
18160 !! options
18161 section=3
18162 !! wikitext
18163 start
18164 ==a==
18165 ===aa===
18166 ====aaa====
18167 ==b==
18168 ===ba===
18169 ===bb===
18170 ====bba====
18171 ===bc===
18172 ==c==
18173 ===ca===
18174 !! html/php
18175 ====aaa====
18176 !! end
18177
18178 !! test
18179 Section extraction test (section 4)
18180 !! options
18181 section=4
18182 !! wikitext
18183 start
18184 ==a==
18185 ===aa===
18186 ====aaa====
18187 ==b==
18188 ===ba===
18189 ===bb===
18190 ====bba====
18191 ===bc===
18192 ==c==
18193 ===ca===
18194 !! html/php
18195 ==b==
18196 ===ba===
18197 ===bb===
18198 ====bba====
18199 ===bc===
18200 !! end
18201
18202 !! test
18203 Section extraction test (section 5)
18204 !! options
18205 section=5
18206 !! wikitext
18207 start
18208 ==a==
18209 ===aa===
18210 ====aaa====
18211 ==b==
18212 ===ba===
18213 ===bb===
18214 ====bba====
18215 ===bc===
18216 ==c==
18217 ===ca===
18218 !! html/php
18219 ===ba===
18220 !! end
18221
18222 !! test
18223 Section extraction test (section 6)
18224 !! options
18225 section=6
18226 !! wikitext
18227 start
18228 ==a==
18229 ===aa===
18230 ====aaa====
18231 ==b==
18232 ===ba===
18233 ===bb===
18234 ====bba====
18235 ===bc===
18236 ==c==
18237 ===ca===
18238 !! html/php
18239 ===bb===
18240 ====bba====
18241 !! end
18242
18243 !! test
18244 Section extraction test (section 7)
18245 !! options
18246 section=7
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 ====bba====
18261 !! end
18262
18263 !! test
18264 Section extraction test (section 8)
18265 !! options
18266 section=8
18267 !! wikitext
18268 start
18269 ==a==
18270 ===aa===
18271 ====aaa====
18272 ==b==
18273 ===ba===
18274 ===bb===
18275 ====bba====
18276 ===bc===
18277 ==c==
18278 ===ca===
18279 !! html/php
18280 ===bc===
18281 !! end
18282
18283 !! test
18284 Section extraction test (section 9)
18285 !! options
18286 section=9
18287 !! wikitext
18288 start
18289 ==a==
18290 ===aa===
18291 ====aaa====
18292 ==b==
18293 ===ba===
18294 ===bb===
18295 ====bba====
18296 ===bc===
18297 ==c==
18298 ===ca===
18299 !! html/php
18300 ==c==
18301 ===ca===
18302 !! end
18303
18304 !! test
18305 Section extraction test (section 10)
18306 !! options
18307 section=10
18308 !! wikitext
18309 start
18310 ==a==
18311 ===aa===
18312 ====aaa====
18313 ==b==
18314 ===ba===
18315 ===bb===
18316 ====bba====
18317 ===bc===
18318 ==c==
18319 ===ca===
18320 !! html/php
18321 ===ca===
18322 !! end
18323
18324 !! test
18325 Section extraction test (nonexistent section 11)
18326 !! options
18327 section=11
18328 !! wikitext
18329 start
18330 ==a==
18331 ===aa===
18332 ====aaa====
18333 ==b==
18334 ===ba===
18335 ===bb===
18336 ====bba====
18337 ===bc===
18338 ==c==
18339 ===ca===
18340 !! html/php
18341 !! end
18342
18343 !! test
18344 Section extraction test with bogus heading (section 1)
18345 !! options
18346 section=1
18347 !! wikitext
18348 ==a==
18349 ==bogus== not a legal section
18350 ==b==
18351 !! html/php
18352 ==a==
18353 ==bogus== not a legal section
18354 !! end
18355
18356 !! test
18357 Section extraction test with bogus heading (section 2)
18358 !! options
18359 section=2
18360 !! wikitext
18361 ==a==
18362 ==bogus== not a legal section
18363 ==b==
18364 !! html/php
18365 ==b==
18366 !! end
18367
18368 !! test
18369 Section extraction test with comment after heading (section 1)
18370 !! options
18371 section=1
18372 !! wikitext
18373 ==a==
18374 ==b== <!-- -->
18375 ==c==
18376 !! html/php
18377 ==a==
18378 !! end
18379
18380 !! test
18381 Section extraction test with comment after heading (section 2)
18382 !! options
18383 section=2
18384 !! wikitext
18385 ==a==
18386 ==b== <!-- -->
18387 ==c==
18388 !! html/php
18389 ==b== <!-- -->
18390 !! end
18391
18392 !! test
18393 Section extraction test with bogus <nowiki> heading (section 1)
18394 !! options
18395 section=1
18396 !! wikitext
18397 ==a==
18398 ==bogus== <nowiki>not a legal section</nowiki>
18399 ==b==
18400 !! html/php
18401 ==a==
18402 ==bogus== <nowiki>not a legal section</nowiki>
18403 !! end
18404
18405 !! test
18406 Section extraction test with bogus <nowiki> heading (section 2)
18407 !! options
18408 section=2
18409 !! wikitext
18410 ==a==
18411 ==bogus== <nowiki>not a legal section</nowiki>
18412 ==b==
18413 !! html/php
18414 ==b==
18415 !! end
18416
18417 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18418 # instead of respecting commented sections
18419 !! test
18420 Section extraction prefixed by comment (section 1)
18421 !! options
18422 section=1
18423 !! wikitext
18424 <!-- -->==sec1==
18425 ==sec2==
18426 !! html/php
18427 ==sec2==
18428 !!end
18429
18430 !! test
18431 Section extraction prefixed by comment (section 2)
18432 !! options
18433 section=2
18434 !! wikitext
18435 <!-- -->==sec1==
18436 ==sec2==
18437 !! html/php
18438
18439 !!end
18440
18441 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18442 # instead of respecting HTML-style headings
18443 !! test
18444 Section extraction, mixed wiki and html (section 1)
18445 !! options
18446 section=1
18447 !! wikitext
18448 <h2>unmarked</h2>
18449 unmarked
18450 ==1==
18451 one
18452 ==2==
18453 two
18454 !! html/php
18455 ==1==
18456 one
18457 !! end
18458
18459 !! test
18460 Section extraction, mixed wiki and html (section 2)
18461 !! options
18462 section=2
18463 !! wikitext
18464 <h2>unmarked</h2>
18465 unmarked
18466 ==1==
18467 one
18468 ==2==
18469 two
18470 !! html/php
18471 ==2==
18472 two
18473 !! end
18474
18475
18476 # Formerly testing for bug 3342
18477 !! test
18478 Section extraction, heading surrounded by <noinclude>
18479 !! options
18480 section=1
18481 !! wikitext
18482 <noinclude>==unmarked==</noinclude>
18483 ==marked==
18484 !! html/php
18485 ==marked==
18486 !!end
18487
18488 # Test behavior of bug 19910
18489 !! test
18490 Sectiion with all-equals
18491 !! options
18492 section=2
18493 !! wikitext
18494 ===
18495 The line above must have a trailing space
18496 === <!--
18497 --> <!-- -->
18498 But just in case it doesn't...
18499 !! html/php
18500 === <!--
18501 --> <!-- -->
18502 But just in case it doesn't...
18503 !! end
18504
18505 !! test
18506 Section replacement test (section 0)
18507 !! options
18508 replace=0,"xxx"
18509 !! wikitext
18510 start
18511 ==a==
18512 ===aa===
18513 ====aaa====
18514 ==b==
18515 ===ba===
18516 ===bb===
18517 ====bba====
18518 ===bc===
18519 ==c==
18520 ===ca===
18521 !! html/php
18522 xxx
18523
18524 ==a==
18525 ===aa===
18526 ====aaa====
18527 ==b==
18528 ===ba===
18529 ===bb===
18530 ====bba====
18531 ===bc===
18532 ==c==
18533 ===ca===
18534 !! end
18535
18536 !! test
18537 Section replacement test (section 1)
18538 !! options
18539 replace=1,"xxx"
18540 !! wikitext
18541 start
18542 ==a==
18543 ===aa===
18544 ====aaa====
18545 ==b==
18546 ===ba===
18547 ===bb===
18548 ====bba====
18549 ===bc===
18550 ==c==
18551 ===ca===
18552 !! html/php
18553 start
18554 xxx
18555
18556 ==b==
18557 ===ba===
18558 ===bb===
18559 ====bba====
18560 ===bc===
18561 ==c==
18562 ===ca===
18563 !! end
18564
18565 !! test
18566 Section replacement test (section 2)
18567 !! options
18568 replace=2,"xxx"
18569 !! wikitext
18570 start
18571 ==a==
18572 ===aa===
18573 ====aaa====
18574 ==b==
18575 ===ba===
18576 ===bb===
18577 ====bba====
18578 ===bc===
18579 ==c==
18580 ===ca===
18581 !! html/php
18582 start
18583 ==a==
18584 xxx
18585
18586 ==b==
18587 ===ba===
18588 ===bb===
18589 ====bba====
18590 ===bc===
18591 ==c==
18592 ===ca===
18593 !! end
18594
18595 !! test
18596 Section replacement test (section 3)
18597 !! options
18598 replace=3,"xxx"
18599 !! wikitext
18600 start
18601 ==a==
18602 ===aa===
18603 ====aaa====
18604 ==b==
18605 ===ba===
18606 ===bb===
18607 ====bba====
18608 ===bc===
18609 ==c==
18610 ===ca===
18611 !! html/php
18612 start
18613 ==a==
18614 ===aa===
18615 xxx
18616
18617 ==b==
18618 ===ba===
18619 ===bb===
18620 ====bba====
18621 ===bc===
18622 ==c==
18623 ===ca===
18624 !! end
18625
18626 !! test
18627 Section replacement test (section 4)
18628 !! options
18629 replace=4,"xxx"
18630 !! wikitext
18631 start
18632 ==a==
18633 ===aa===
18634 ====aaa====
18635 ==b==
18636 ===ba===
18637 ===bb===
18638 ====bba====
18639 ===bc===
18640 ==c==
18641 ===ca===
18642 !! html/php
18643 start
18644 ==a==
18645 ===aa===
18646 ====aaa====
18647 xxx
18648
18649 ==c==
18650 ===ca===
18651 !! end
18652
18653 !! test
18654 Section replacement test (section 5)
18655 !! options
18656 replace=5,"xxx"
18657 !! wikitext
18658 start
18659 ==a==
18660 ===aa===
18661 ====aaa====
18662 ==b==
18663 ===ba===
18664 ===bb===
18665 ====bba====
18666 ===bc===
18667 ==c==
18668 ===ca===
18669 !! html/php
18670 start
18671 ==a==
18672 ===aa===
18673 ====aaa====
18674 ==b==
18675 xxx
18676
18677 ===bb===
18678 ====bba====
18679 ===bc===
18680 ==c==
18681 ===ca===
18682 !! end
18683
18684 !! test
18685 Section replacement test (section 6)
18686 !! options
18687 replace=6,"xxx"
18688 !! wikitext
18689 start
18690 ==a==
18691 ===aa===
18692 ====aaa====
18693 ==b==
18694 ===ba===
18695 ===bb===
18696 ====bba====
18697 ===bc===
18698 ==c==
18699 ===ca===
18700 !! html/php
18701 start
18702 ==a==
18703 ===aa===
18704 ====aaa====
18705 ==b==
18706 ===ba===
18707 xxx
18708
18709 ===bc===
18710 ==c==
18711 ===ca===
18712 !! end
18713
18714 !! test
18715 Section replacement test (section 7)
18716 !! options
18717 replace=7,"xxx"
18718 !! wikitext
18719 start
18720 ==a==
18721 ===aa===
18722 ====aaa====
18723 ==b==
18724 ===ba===
18725 ===bb===
18726 ====bba====
18727 ===bc===
18728 ==c==
18729 ===ca===
18730 !! html/php
18731 start
18732 ==a==
18733 ===aa===
18734 ====aaa====
18735 ==b==
18736 ===ba===
18737 ===bb===
18738 xxx
18739
18740 ===bc===
18741 ==c==
18742 ===ca===
18743 !! end
18744
18745 !! test
18746 Section replacement test (section 8)
18747 !! options
18748 replace=8,"xxx"
18749 !! wikitext
18750 start
18751 ==a==
18752 ===aa===
18753 ====aaa====
18754 ==b==
18755 ===ba===
18756 ===bb===
18757 ====bba====
18758 ===bc===
18759 ==c==
18760 ===ca===
18761 !! html/php
18762 start
18763 ==a==
18764 ===aa===
18765 ====aaa====
18766 ==b==
18767 ===ba===
18768 ===bb===
18769 ====bba====
18770 xxx
18771
18772 ==c==
18773 ===ca===
18774 !!end
18775
18776 !! test
18777 Section replacement test (section 9)
18778 !! options
18779 replace=9,"xxx"
18780 !! wikitext
18781 start
18782 ==a==
18783 ===aa===
18784 ====aaa====
18785 ==b==
18786 ===ba===
18787 ===bb===
18788 ====bba====
18789 ===bc===
18790 ==c==
18791 ===ca===
18792 !! html/php
18793 start
18794 ==a==
18795 ===aa===
18796 ====aaa====
18797 ==b==
18798 ===ba===
18799 ===bb===
18800 ====bba====
18801 ===bc===
18802 xxx
18803 !! end
18804
18805 !! test
18806 Section replacement test (section 10)
18807 !! options
18808 replace=10,"xxx"
18809 !! wikitext
18810 start
18811 ==a==
18812 ===aa===
18813 ====aaa====
18814 ==b==
18815 ===ba===
18816 ===bb===
18817 ====bba====
18818 ===bc===
18819 ==c==
18820 ===ca===
18821 !! html/php
18822 start
18823 ==a==
18824 ===aa===
18825 ====aaa====
18826 ==b==
18827 ===ba===
18828 ===bb===
18829 ====bba====
18830 ===bc===
18831 ==c==
18832 xxx
18833 !! end
18834
18835 !! test
18836 Section replacement test with initial whitespace (bug 13728)
18837 !! options
18838 replace=2,"xxx"
18839 !! wikitext
18840 Preformatted initial line
18841 ==a==
18842 ===a===
18843 !! html/php
18844 Preformatted initial line
18845 ==a==
18846 xxx
18847 !! end
18848
18849
18850 !! test
18851 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18852 !! options
18853 section=1
18854 !! wikitext
18855 ==a==
18856 a
18857 !! html/php
18858 ==a==
18859 a
18860 !! end
18861
18862 !! test
18863 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18864 !! options
18865 section=1
18866 !! wikitext
18867 ==a==
18868 a
18869 !! html/php
18870 ==a==
18871 a
18872 !! end
18873
18874
18875 !! test
18876 Section extraction, <pre> around bogus header (bug 10309)
18877 !! options
18878 section=2
18879 !! wikitext
18880 == Section One ==
18881 <pre>
18882 =======
18883 </pre>
18884
18885 == Section Two ==
18886 stuff
18887 !! html/php
18888 == Section Two ==
18889 stuff
18890 !! end
18891
18892 !! test
18893 Section replacement, <pre> around bogus header (bug 10309)
18894 !! options
18895 replace=2,"xxx"
18896 !! wikitext
18897 == Section One ==
18898 <pre>
18899 =======
18900 </pre>
18901
18902 == Section Two ==
18903 stuff
18904 !! html/php
18905 == Section One ==
18906 <pre>
18907 =======
18908 </pre>
18909
18910 xxx
18911 !! end
18912
18913 !! test
18914 Handling of &#x0A; in URLs
18915 !! wikitext
18916 ** irc://&#x0A;a
18917 !! html/php
18918 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18919
18920 !! html/parsoid
18921 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa" data-parsoid='{"stx":"url","a":{"href":"irc://%0Aa"},"sa":{"href":"irc://&amp;#x0A;a"}}'>irc://%0Aa</a></li></ul></li></ul>
18922 !! end
18923
18924 !! test
18925 Handling of %0A in URLs
18926 !! wikitext
18927 ** irc://%0Aa
18928 !! html/php
18929 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18930
18931 !! html/parsoid
18932 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18933 !! end
18934
18935 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18936 !! test
18937 5 quotes, code coverage +1 line
18938 !! options
18939 parsoid=wt2html
18940 !! wikitext
18941 '''''
18942 !! html/php
18943 !! html/parsoid
18944 <p><b><i></i></b></p>
18945 !! end
18946
18947 # same html as previous, but wikitext adjusted to match parsoid html2wt
18948 # note that wt2html and html2html will put the <i> before the <b>
18949 !! test
18950 5 quotes, code coverage +1 line w/ nowiki (1)
18951 !! options
18952 parsoid=wt2wt,html2wt
18953 !! wikitext
18954 '''''<nowiki/>'''''
18955 !! html/php
18956 <p><i></i>
18957 </p>
18958 !! html/parsoid
18959 <p><b><i></i></b></p>
18960 !! end
18961
18962 # same as previous, just swapping the <i> and <b>
18963 !! test
18964 5 quotes, code coverage +1 line w/ nowiki (2)
18965 !! wikitext
18966 '''''<nowiki/>'''''
18967 !! html/php
18968 <p><i></i>
18969 </p>
18970 !! html/parsoid
18971 <p><i><b></b></i></p>
18972 !! end
18973
18974 !! test
18975 Special:Search page linking.
18976 !! wikitext
18977 {{Special:search}}
18978 !! html
18979 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18980 </p>
18981 !! end
18982
18983 !! test
18984 {{!}} is a magic word
18985 !! wikitext
18986 {{!}} is a magic word there and {{!}} is still a magic word here
18987 | is not a magic word here but {{!}} is still a magic word here
18988 !! html/php
18989 <p>| is a magic word there and | is still a magic word here
18990 | is not a magic word here but | is still a magic word here
18991 </p>
18992 !! html/parsoid
18993 <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
18994 | 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>
18995
18996 !! end
18997
18998 !! test
18999 Say the magic word
19000 !! options
19001 title=[[Parser test]]
19002 !! wikitext
19003 * {{PAGENAME}}
19004 * {{PAGENAMEE}}
19005 * {{FULLPAGENAME}}
19006 * {{FULLPAGENAMEE}}
19007 * {{BASEPAGENAME}}
19008 * {{BASEPAGENAMEE}}
19009 * {{SUBPAGENAME}}
19010 * {{SUBPAGENAMEE}}
19011 * {{ROOTPAGENAME}}
19012 * {{ROOTPAGENAMEE}}
19013 * {{TALKPAGENAME}}
19014 * {{TALKPAGENAMEE}}
19015 * {{SUBJECTPAGENAME}}
19016 * {{SUBJECTPAGENAMEE}}
19017 * {{NAMESPACEE}}
19018 * {{NAMESPACE}}
19019 * {{NAMESPACENUMBER}}
19020 * {{TALKSPACE}}
19021 * {{TALKSPACEE}}
19022 * {{SUBJECTSPACE}}
19023 * {{SUBJECTSPACEE}}
19024 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
19025 !! html
19026 <ul><li> Parser test</li>
19027 <li> Parser_test</li>
19028 <li> Parser test</li>
19029 <li> Parser_test</li>
19030 <li> Parser test</li>
19031 <li> Parser_test</li>
19032 <li> Parser test</li>
19033 <li> Parser_test</li>
19034 <li> Parser test</li>
19035 <li> Parser_test</li>
19036 <li> Talk:Parser test</li>
19037 <li> Talk:Parser_test</li>
19038 <li> Parser test</li>
19039 <li> Parser_test</li>
19040 <li> </li>
19041 <li> </li>
19042 <li> 0</li>
19043 <li> Talk</li>
19044 <li> Talk</li>
19045 <li> </li>
19046 <li> </li>
19047 <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>
19048
19049 !! end
19050 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
19051
19052 ## Parsoid thinks the "centre" here is a property, not a caption.
19053 !! test
19054 Gallery
19055 !! options
19056 parsoid={
19057 "modes": ["wt2html"],
19058 "nativeGallery": true
19059 }
19060 !! wikitext
19061 <gallery>
19062 image1.png |
19063 image2.gif|||||
19064
19065 image3|
19066 image4 |300px| centre
19067 image5.svg| http://///////
19068 [[x|xx]]]]
19069 * image6
19070 </gallery>
19071 !! html/php
19072 <ul class="gallery mw-gallery-traditional">
19073 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19074 <div class="thumb" style="height: 150px;">Image1.png</div>
19075 <div class="gallerytext">
19076 </div>
19077 </div></li>
19078 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19079 <div class="thumb" style="height: 150px;">Image2.gif</div>
19080 <div class="gallerytext">
19081 </div>
19082 </div></li>
19083 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19084 <div class="thumb" style="height: 150px;">Image3</div>
19085 <div class="gallerytext">
19086 </div>
19087 </div></li>
19088 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19089 <div class="thumb" style="height: 150px;">Image4</div>
19090 <div class="gallerytext">
19091 <pre>centre
19092 </pre>
19093 </div>
19094 </div></li>
19095 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19096 <div class="thumb" style="height: 150px;">Image5.svg</div>
19097 <div class="gallerytext">
19098 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
19099 </p>
19100 </div>
19101 </div></li>
19102 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19103 <div class="thumb" style="height: 150px;">* image6</div>
19104 <div class="gallerytext">
19105 </div>
19106 </div></li>
19107 </ul>
19108
19109 !! html/parsoid
19110 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19111 <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>
19112 <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>
19113 <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>
19114 <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>
19115 <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>
19116 <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>
19117 </ul>
19118 !! end
19119
19120 !! test
19121 Gallery (with options, html)
19122 !! options
19123 parsoid={
19124 "modes": ["wt2html", "html2html"],
19125 "nativeGallery": true
19126 }
19127 !! wikitext
19128 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19129 File:Nonexistent.jpg|caption
19130 File:Nonexistent.jpg
19131 image:foobar.jpg|some '''caption''' [[Main Page]]
19132 image:foobar.jpg
19133 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19134 </gallery>
19135 !! html/php
19136 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19137 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19138 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19139 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19140 <div class="gallerytext">
19141 <p>caption
19142 </p>
19143 </div>
19144 </div></li>
19145 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19146 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19147 <div class="gallerytext">
19148 </div>
19149 </div></li>
19150 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19151 <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>
19152 <div class="gallerytext">
19153 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19154 </p>
19155 </div>
19156 </div></li>
19157 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19158 <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>
19159 <div class="gallerytext">
19160 </div>
19161 </div></li>
19162 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19163 <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>
19164 <div class="gallerytext">
19165 <p>blabla.
19166 </p>
19167 </div>
19168 </div></li>
19169 </ul>
19170
19171 !! html/parsoid
19172 <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":{}}'>
19173 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19174 <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>
19175 <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>
19176 <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>
19177 <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>
19178 <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>
19179 </ul>
19180 !! end
19181
19182 !! test
19183 Gallery (with options, extsrc)
19184 !! options
19185 parsoid={
19186 "nativeGallery": false
19187 }
19188 !! wikitext
19189 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19190 File:Nonexistent.jpg|caption
19191 File:Nonexistent.jpg
19192 image:foobar.jpg|some '''caption''' [[Main Page]]
19193 image:foobar.jpg
19194 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19195 </gallery>
19196 !! html/php
19197 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19198 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19199 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19200 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19201 <div class="gallerytext">
19202 <p>caption
19203 </p>
19204 </div>
19205 </div></li>
19206 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19207 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19208 <div class="gallerytext">
19209 </div>
19210 </div></li>
19211 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19212 <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>
19213 <div class="gallerytext">
19214 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19215 </p>
19216 </div>
19217 </div></li>
19218 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19219 <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>
19220 <div class="gallerytext">
19221 </div>
19222 </div></li>
19223 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19224 <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>
19225 <div class="gallerytext">
19226 <p>blabla.
19227 </p>
19228 </div>
19229 </div></li>
19230 </ul>
19231
19232 !! html/parsoid
19233 <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"}}'>
19234 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19235 <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>
19236 <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>
19237 <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>
19238 <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>
19239 <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>
19240 </ul>
19241 !! end
19242
19243 !! test
19244 Gallery with link that has fragment
19245 !! options
19246 parsoid={
19247 "modes": ["wt2html", "html2html"],
19248 "nativeGallery": true
19249 }
19250 !! wikitext
19251 <gallery>
19252 image:foobar.jpg|link=Main_Page
19253 image:foobar.jpg|link=Main_Page#section
19254 image:foobar.jpg|link=Main Page#section|caption
19255 </gallery>
19256 !! html/php
19257 <ul class="gallery mw-gallery-traditional">
19258 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19259 <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>
19260 <div class="gallerytext">
19261 </div>
19262 </div></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/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>
19265 <div class="gallerytext">
19266 </div>
19267 </div></li>
19268 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19269 <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>
19270 <div class="gallerytext">
19271 <p>caption
19272 </p>
19273 </div>
19274 </div></li>
19275 </ul>
19276
19277 !! html/parsoid
19278 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19279 <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>
19280 <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>
19281 <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>
19282 </ul>
19283 !! end
19284
19285 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19286 !! test
19287 Gallery with template inside caption
19288 !! options
19289 parsoid={
19290 "nativeGallery": true
19291 }
19292 !! wikitext
19293 <gallery caption="{{echo|hi}}">
19294 File:Foobar.jpg|{{echo|ho}}
19295 </gallery>
19296 !! html/php
19297 <ul class="gallery mw-gallery-traditional">
19298 <li class='gallerycaption'>{{echo|hi}}</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="" 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>ho
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="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>
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 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>
19312 </ul>
19313 !! end
19314
19315 !! test
19316 Gallery with wikitext inside caption
19317 !! options
19318 parsoid={
19319 "nativeGallery": true
19320 }
19321 !! wikitext
19322 <gallery>
19323 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19324 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19325 </gallery>
19326 !! html/php
19327 <ul class="gallery mw-gallery-traditional">
19328 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19329 <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>
19330 <div class="gallerytext">
19331 <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>
19332 </p>
19333 </div>
19334 </div></li>
19335 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19336 <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>
19337 <div class="gallerytext">
19338 <p>This is a test template
19339 </p>
19340 </div>
19341 </div></li>
19342 </ul>
19343
19344 !! html/parsoid
19345 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19346 <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>
19347 <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>
19348 </ul>
19349 !! end
19350
19351 !! test
19352 Gallery (with showfilename option)
19353 !! options
19354 parsoid={
19355 "nativeGallery": true
19356 }
19357 !! wikitext
19358 <gallery showfilename="">
19359 File:Nonexistent.jpg|caption
19360 File:Nonexistent.jpg
19361 File:Foobar.jpg|some '''caption''' [[Main Page]]
19362 File:Foobar.jpg
19363 </gallery>
19364 !! html/php
19365 <ul class="gallery mw-gallery-traditional">
19366 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19367 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19368 <div class="gallerytext">
19369 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19370 caption
19371 </p>
19372 </div>
19373 </div></li>
19374 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19375 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19376 <div class="gallerytext">
19377 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19378 </p>
19379 </div>
19380 </div></li>
19381 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19382 <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>
19383 <div class="gallerytext">
19384 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19385 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19386 </p>
19387 </div>
19388 </div></li>
19389 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19390 <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>
19391 <div class="gallerytext">
19392 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19393 </p>
19394 </div>
19395 </div></li>
19396 </ul>
19397
19398 !! html/parsoid
19399 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
19400 <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>
19401 <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>
19402 <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>
19403 <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>
19404 </ul>
19405 !! end
19406
19407 ## Should Parsoid be preserving these variations?
19408 !! test
19409 Gallery (with namespace-less filenames)
19410 !! options
19411 parsoid={
19412 "modes": ["wt2html", "html2html"],
19413 "nativeGallery": true
19414 }
19415 !! wikitext
19416 <gallery>
19417 File:Nonexistent.jpg
19418 Nonexistent.jpg
19419 image:foobar.jpg
19420 foobar.jpg
19421 </gallery>
19422 !! html/php
19423 <ul class="gallery mw-gallery-traditional">
19424 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19425 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19426 <div class="gallerytext">
19427 </div>
19428 </div></li>
19429 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19430 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19431 <div class="gallerytext">
19432 </div>
19433 </div></li>
19434 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19435 <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>
19436 <div class="gallerytext">
19437 </div>
19438 </div></li>
19439 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19440 <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>
19441 <div class="gallerytext">
19442 </div>
19443 </div></li>
19444 </ul>
19445
19446 !! html/parsoid
19447 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19448 <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>
19449 <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>
19450 <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>
19451 <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>
19452 </ul>
19453 !! end
19454
19455 !! test
19456 Gallery override link with WikiLink (T36852)
19457 !! options
19458 parsoid={
19459 "nativeGallery": true
19460 }
19461 !! wikitext
19462 <gallery>
19463 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
19464 </gallery>
19465 !! html/php
19466 <ul class="gallery mw-gallery-traditional">
19467 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19468 <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>
19469 <div class="gallerytext">
19470 </div>
19471 </div></li>
19472 </ul>
19473
19474 !! html/parsoid
19475 <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":{}}'>
19476 <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>
19477 </ul>
19478 !! end
19479
19480 !! test
19481 Gallery override link with absolute external link (T36852)
19482 !! options
19483 parsoid={
19484 "nativeGallery": true
19485 }
19486 !! wikitext
19487 <gallery>
19488 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
19489 </gallery>
19490 !! html/php
19491 <ul class="gallery mw-gallery-traditional">
19492 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19493 <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>
19494 <div class="gallerytext">
19495 </div>
19496 </div></li>
19497 </ul>
19498
19499 !! html/parsoid
19500 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19501 <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>
19502 </ul>
19503 !! end
19504
19505 !! test
19506 Gallery override link with absolute external link with LanguageConverter
19507 !! options
19508 language=zh
19509 !! input
19510 <gallery>
19511 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19512 </gallery>
19513 !! result
19514 <ul class="gallery mw-gallery-traditional">
19515 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19516 <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>
19517 <div class="gallerytext">
19518 <p>caption
19519 </p>
19520 </div>
19521 </div></li>
19522 </ul>
19523
19524 !! end
19525
19526 !! test
19527 Gallery override link with malicious javascript (T36852)
19528 !! options
19529 parsoid={
19530 "modes": ["wt2html", "html2html"],
19531 "nativeGallery": true
19532 }
19533 !! wikitext
19534 <gallery>
19535 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19536 </gallery>
19537 !! html/php
19538 <ul class="gallery mw-gallery-traditional">
19539 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19540 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%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>
19541 <div class="gallerytext">
19542 </div>
19543 </div></li>
19544 </ul>
19545
19546 !! html/parsoid
19547 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19548 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./%22_onclick=%22alert('malicious_javascript_code!');"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"></div></li>
19549 </ul>
19550 !! end
19551
19552 !! test
19553 Gallery with invalid title as link (T45964)
19554 !! options
19555 parsoid={
19556 "modes": ["wt2html", "html2html"],
19557 "nativeGallery": true
19558 }
19559 !! wikitext
19560 <gallery>
19561 File:Foobar.jpg|link=<
19562 </gallery>
19563 !! html/php
19564 <ul class="gallery mw-gallery-traditional">
19565 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19566 <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>
19567 <div class="gallerytext">
19568 </div>
19569 </div></li>
19570 </ul>
19571
19572 !! html/parsoid
19573 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19574 <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>
19575 </ul>
19576 !! end
19577
19578 !! test
19579 Serialize gallery without attrs in data-mw
19580 !! options
19581 parsoid={
19582 "modes": ["html2wt"],
19583 "nativeGallery": true
19584 }
19585 !! html/parsoid
19586 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
19587 <li class="gallerycaption">123</li>
19588 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Test.png</span></div><div class="gallerytext"></div></li>
19589 </ul>
19590 !! wikitext
19591 <gallery caption="123">
19592 File:Test.png
19593 </gallery>
19594 !! end
19595
19596 !! test
19597 HTML Hex character encoding (spells the word "JavaScript")
19598 !! options
19599 parsoid=wt2html,wt2wt,html2html
19600 !! wikitext
19601 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19602 !! html/php
19603 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19604 </p>
19605 !! html/php+tidy
19606 <p>JavaScript</p>
19607 !! html/parsoid
19608 <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>
19609 !! end
19610
19611 !! test
19612 HTML Hex character encoding bogus encoding (bug 26437 regression check)
19613 !! wikitext
19614 &#xsee;&#XSEE;
19615 !! html/php
19616 <p>&amp;#xsee;&amp;#XSEE;
19617 </p>
19618 !! html/parsoid
19619 <p>&amp;#xsee;&amp;#XSEE;</p>
19620 !! end
19621
19622 !! test
19623 HTML Hex character encoding mixed case
19624 !! options
19625 parsoid=wt2html,wt2wt,html2html
19626 !! wikitext
19627 &#xEE;&#Xee;
19628 !! html/php
19629 <p>&#xee;&#xee;
19630 </p>
19631 !! html/php+tidy
19632 <p>îî</p>
19633 !! html/parsoid
19634 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19635 !! end
19636
19637 # See: https://www.w3.org/TR/html5/syntax.html#character-references
19638 # Note that U+000C (form feed) is not a valid XML character, so
19639 # it is banned even though allowed in HTML5.
19640 !! test
19641 Illegal character references (T106578)
19642 !! wikitext
19643 ; Null: &#00;
19644 ; FF: &#xC;
19645 ; CR: &#xD;
19646 ; Control (low): &#8;
19647 ; Control (high): &#x7F; &#x9F;
19648 ; Surrogate: &#xD83D;&#xDCA9;
19649 ; This is an okay astral character: &#x1F4A9;
19650 !! html+tidy
19651 <dl>
19652 <dt>Null</dt>
19653 <dd>&amp;#00;</dd>
19654 <dt>FF</dt>
19655 <dd>&amp;#xC;</dd>
19656 <dt>CR</dt>
19657 <dd>&amp;#xD;</dd>
19658 <dt>Control (low)</dt>
19659 <dd>&amp;#8;</dd>
19660 <dt>Control (high)</dt>
19661 <dd>&amp;#x7F; &amp;#x9F;</dd>
19662 <dt>Surrogate</dt>
19663 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19664 <dt>This is an okay astral character</dt>
19665 <dd>💩</dd>
19666 </dl>
19667 !! end
19668
19669 !! test
19670 __FORCETOC__ override
19671 !! wikitext
19672 __NEWSECTIONLINK__
19673 __FORCETOC__
19674 !! html/php
19675 <p><br />
19676 </p>
19677 !! end
19678
19679 !! test
19680 ISBN code coverage
19681 !! wikitext
19682 ISBN 978-0-1234-56&#x20;789
19683 !! html
19684 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19685 </p>
19686 !! html+tidy
19687 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19688 !! html/parsoid
19689 <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>
19690 !! end
19691
19692 !! test
19693 ISBN followed by 5 spaces
19694 !! wikitext
19695 ISBN
19696 !! html
19697 <p>ISBN
19698 </p>
19699 !! end
19700
19701 !! test
19702 Double ISBN
19703 !! wikitext
19704 ISBN ISBN 1234567890
19705 !! html/php
19706 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19707 </p>
19708 !! html/parsoid
19709 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19710 !! end
19711
19712 # Uppercase X and lowercase x as well
19713 !! test
19714 ISBN with an X
19715 !! wikitext
19716 ISBN 3-462-04561-X
19717 ISBN 3-462-04561-x
19718 ISBN 080442957X
19719 ISBN 080442957x
19720 ISBN 978080442957X
19721 ISBN 978080442957x
19722 !! html/php
19723 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19724 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19725 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19726 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19727 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19728 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19729 </p>
19730 !! html/parsoid
19731 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19732 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19733 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19734 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19735 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19736 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19737 !! end
19738
19739 !! test
19740 ISBN with empty prefix (parsoid test)
19741 !! wikitext
19742 ISBN 1234567890
19743 !! html/php
19744 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19745 </p>
19746 !! html/parsoid
19747 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19748 !! end
19749
19750 !! test
19751 Bug 22905: <abbr> followed by ISBN followed by </a>
19752 !! wikitext
19753 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19754 !! html/php
19755 <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>
19756 </p>
19757 !! html/parsoid
19758 <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>
19759 !! end
19760
19761 !! test
19762 Double RFC
19763 !! wikitext
19764 RFC RFC 1234
19765 !! html
19766 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19767 </p>
19768 !! end
19769
19770 !! test
19771 Double RFC with a wiki link
19772 !! wikitext
19773 RFC [[RFC 1234]]
19774 !! html
19775 <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>
19776 </p>
19777 !! end
19778
19779 !! test
19780 RFC code coverage
19781 !! wikitext
19782 RFC 983&#x20;987
19783 !! html
19784 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19785 </p>
19786 !! html+tidy
19787 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19788 !! end
19789
19790 !! test
19791 Centre-aligned image
19792 !! wikitext
19793 [[Image:foobar.jpg|centre]]
19794 !! html
19795 <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>
19796
19797 !!end
19798
19799 !! test
19800 None-aligned image
19801 !! wikitext
19802 [[Image:foobar.jpg|none]]
19803 !! html
19804 <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>
19805
19806 !!end
19807
19808 !! test
19809 Width + Height sized image (using px) (height is ignored)
19810 !! wikitext
19811 [[Image:foobar.jpg|640x480px]]
19812 !! html
19813 <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>
19814 </p>
19815 !!end
19816
19817 !! test
19818 Width-sized image (using px, no following whitespace)
19819 !! wikitext
19820 [[Image:foobar.jpg|640px]]
19821 !! html
19822 <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>
19823 </p>
19824 !!end
19825
19826 !! test
19827 Width-sized image (using px, with following whitespace - test regression from r39467)
19828 !! wikitext
19829 [[Image:foobar.jpg|640px ]]
19830 !! html
19831 <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>
19832 </p>
19833 !!end
19834
19835 !! test
19836 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19837 !! wikitext
19838 [[Image:foobar.jpg| 640px]]
19839 !! html
19840 <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>
19841 </p>
19842 !!end
19843
19844 !! test
19845 Image with page parameter
19846 !! options
19847 djvu
19848 !! wikitext
19849 [[File:LoremIpsum.djvu|page=2]]
19850 !! html/php
19851 <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>
19852 </p>
19853 !! html/parsoid
19854 <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>
19855 !! end
19856
19857 !! test
19858 Another italics / bold test
19859 !! wikitext
19860 ''' ''x'
19861 !! html
19862 <pre>'<i> </i>x'
19863 </pre>
19864 !!end
19865
19866 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19867 !! test
19868 dt/dd/dl test
19869 !! wikitext
19870 :;;;::
19871 !! html/php
19872 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19873
19874 !! html/parsoid
19875 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19876
19877 !!end
19878
19879 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19880 !! test
19881 Images with the "|" character in the comment
19882 !! wikitext
19883 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19884 !! html/php
19885 <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>
19886
19887 !! html/parsoid
19888 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>An <a rel="mw:ExtLink" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx" data-parsoid='{"a":{"href":"http://test/?param1=%7Cleft%7C&amp;param2=%7Cx"},"sa":{"href":"http://test/?param1=|left|&amp;param2=|x"}}'>external</a> URL</figcaption></figure>
19889 !! end
19890
19891 !! test
19892 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19893 !! wikitext
19894 <html><script>alert(1);</script></html>
19895 !! html
19896 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19897 </p>
19898 !! end
19899
19900 !! test
19901 HTML with raw HTML ($wgRawHtml==true)
19902 !! options
19903 wgRawHtml=1
19904 !! wikitext
19905 <html><script>alert(1);</script></html>
19906 !! html
19907 <p><script>alert(1);</script>
19908 </p>
19909 !! end
19910
19911 !! test
19912 Parents of subpages, one level up
19913 !! options
19914 subpage title=[[Subpage test/L1/L2/L3]]
19915 !! wikitext
19916 [[../|L2]]
19917 !! html
19918 <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>
19919 </p>
19920 !! end
19921
19922
19923 !! test
19924 Parents of subpages, one level up, not named
19925 !! options
19926 subpage title=[[Subpage test/L1/L2/L3]]
19927 !! wikitext
19928 [[../]]
19929 !! html
19930 <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>
19931 </p>
19932 !! end
19933
19934
19935
19936 !! test
19937 Parents of subpages, two levels up
19938 !! options
19939 subpage title=[[Subpage test/L1/L2/L3]]
19940 !! wikitext
19941 [[../../|L1]]2
19942
19943 [[../../|L1]]l
19944 !! html
19945 <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
19946 </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>
19947 </p>
19948 !! end
19949
19950 !! test
19951 Parents of subpages, two levels up, without trailing slash or name.
19952 !! options
19953 subpage title=[[Subpage test/L1/L2/L3]]
19954 !! wikitext
19955 [[../..]]
19956 !! html
19957 <p>[[../..]]
19958 </p>
19959 !! end
19960
19961 !! test
19962 Parents of subpages, two levels up, with lots of extra trailing slashes.
19963 !! options
19964 subpage title=[[Subpage test/L1/L2/L3]]
19965 !! wikitext
19966 [[../../////]]
19967 !! html
19968 <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>
19969 </p>
19970 !! end
19971
19972 !! article
19973 Subpage test/L1/L2/L3Sibling
19974 !! text
19975 Sibling article
19976 !! endarticle
19977
19978 !! test
19979 Transclusion of a sibling page (one level up)
19980 !! options
19981 subpage title=[[Subpage test/L1/L2/L3]]
19982 !! wikitext
19983 {{../L3Sibling}}
19984 !! html
19985 <p>Sibling article
19986 </p>
19987 !! end
19988
19989 !! test
19990 Transclusion of a child page
19991 !! options
19992 subpage title=[[Subpage test/L1/L2]]
19993 !! wikitext
19994 {{/L3Sibling}}
19995 !! html
19996 <p>Sibling article
19997 </p>
19998 !! end
19999
20000 # This is wt2html only in Parsoid because we add <nowiki>
20001 # because of {{..}} and we don't expect to fix that to
20002 # eliminate the nowikis selective for {{..}} markup.
20003 !! test
20004 Non-transclusion because of too many up levels
20005 !! options
20006 subpage title=[[Subpage test/L1/L2/L3]]
20007 parsoid=wt2html
20008 !! wikitext
20009 {{../../../../More than parent}}
20010 !! html/php
20011 <p>{{../../../../More than parent}}
20012 </p>
20013 !! html/parsoid
20014 <p>{{../../../../More than parent}}</p>
20015 !! end
20016
20017 !! test
20018 Definition list code coverage
20019 !! wikitext
20020 ; title : def
20021 ; title : def
20022 ;title: def
20023 !! html/php
20024 <dl><dt> title &#160;</dt>
20025 <dd> def</dd>
20026 <dt> title&#160;</dt>
20027 <dd> def</dd>
20028 <dt>title</dt>
20029 <dd> def</dd></dl>
20030
20031 !! html/parsoid
20032 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20033 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20034 <dt>title</dt><dd> def</dd></dl>
20035 !! end
20036
20037 !! test
20038 Don't fall for the self-closing div
20039 !! wikitext
20040 <div>hello world</div/>
20041 !! html
20042 <div>hello world</div>
20043
20044 !! end
20045
20046 !! test
20047 MSGNW magic word
20048 !! wikitext
20049 {{MSGNW:msg}}
20050 !! html/php
20051 <p>&#91;&#91;:Template:Msg&#93;&#93;
20052 </p>
20053 !! end
20054
20055 !! test
20056 RAW magic word
20057 !! wikitext
20058 {{RAW:QUERTY}}
20059 !! html
20060 <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>
20061 </p>
20062 !! end
20063
20064 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
20065 !! test
20066 Always escape literal '>' in output, not just after '<'
20067 !! wikitext
20068 ><>
20069 !! html
20070 <p>&gt;&lt;&gt;
20071 </p>
20072 !! end
20073
20074 !! test
20075 Template caching
20076 !! wikitext
20077 {{Test}}
20078 {{Test}}
20079 !! html
20080 <p>This is a test template
20081 This is a test template
20082 </p>
20083 !! end
20084
20085
20086 !! article
20087 MediaWiki:Fake
20088 !! text
20089 ==header==
20090 !! endarticle
20091
20092 !! test
20093 Inclusion of !userCanEdit() content
20094 !! wikitext
20095 {{MediaWiki:Fake}}
20096 !! html
20097 <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>
20098
20099 !! end
20100
20101
20102 !! test
20103 Out-of-order TOC heading levels
20104 !! wikitext
20105 ==2==
20106 ======6======
20107 ===3===
20108 =1=
20109 =====5=====
20110 ==2==
20111 !! html
20112 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20113 <ul>
20114 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
20115 <ul>
20116 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
20117 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
20118 </ul>
20119 </li>
20120 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
20121 <ul>
20122 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
20123 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
20124 </ul>
20125 </li>
20126 </ul>
20127 </div>
20128
20129 <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>
20130 <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>
20131 <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>
20132 <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>
20133 <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>
20134 <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>
20135
20136 !! end
20137
20138
20139 !! test
20140 ISBN with a dummy number
20141 !! wikitext
20142 ISBN ---
20143 !! html
20144 <p>ISBN ---
20145 </p>
20146 !! end
20147
20148
20149 !! test
20150 ISBN with space-delimited number
20151 !! wikitext
20152 ISBN 92 9017 032 8
20153 !! html
20154 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
20155 </p>
20156 !! end
20157
20158
20159 !! test
20160 ISBN with multiple spaces, no number
20161 !! wikitext
20162 ISBN foo
20163 !! html
20164 <p>ISBN foo
20165 </p>
20166 !! end
20167
20168
20169 !! test
20170 ISBN length
20171 !! wikitext
20172 ISBN 123456789
20173
20174 ISBN 1234567890
20175
20176 ISBN 12345678901
20177 !! html
20178 <p>ISBN 123456789
20179 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20180 </p><p>ISBN 12345678901
20181 </p>
20182 !! end
20183
20184
20185 !! test
20186 ISBN with trailing year (bug 8110)
20187 !! wikitext
20188 ISBN 1-234-56789-0 - 2006
20189
20190 ISBN 1 234 56789 0 - 2006
20191 !! html
20192 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
20193 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20194 </p>
20195 !! end
20196
20197
20198 !! test
20199 anchorencode
20200 !! wikitext
20201 {{anchorencode:foo bar©#%n}}
20202 !! html
20203 <p>foo_bar.C2.A9.23.25n
20204 </p>
20205 !! end
20206
20207 !! test
20208 anchorencode trims spaces
20209 !! wikitext
20210 {{anchorencode: __pretty__please__}}
20211 !! html
20212 <p>pretty_please
20213 </p>
20214 !! end
20215
20216 !! test
20217 anchorencode deals with links
20218 !! wikitext
20219 {{anchorencode: [[hello|world]] [[hi]]}}
20220 !! html
20221 <p>world_hi
20222 </p>
20223 !! end
20224
20225 !! test
20226 anchorencode deals with templates
20227 !! wikitext
20228 {{anchorencode: {{Foo}} }}
20229 !! html
20230 <p>FOO
20231 </p>
20232 !! end
20233
20234 !! test
20235 anchorencode encodes like the TOC generator: (bug 18431)
20236 !! wikitext
20237 === _ +:.3A%3A&&amp;]] ===
20238 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20239 __NOEDITSECTION__
20240 !! html
20241 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20242 <p>.2B:.3A.253A.26.26.5D.5D
20243 </p>
20244 !! end
20245
20246 !! test
20247 Bug 6200: blockquotes and paragraph formatting
20248 !! wikitext
20249 <blockquote>
20250 foo
20251 </blockquote>
20252
20253 bar
20254
20255 baz
20256 !! html
20257 <blockquote>
20258 <p>foo
20259 </p>
20260 </blockquote>
20261 <p>bar
20262 </p>
20263 <pre>baz
20264 </pre>
20265 !! end
20266
20267 !! test
20268 Bug 8293: Use of center tag ruins paragraph formatting
20269 !! wikitext
20270 <center>
20271 foo
20272 </center>
20273
20274 bar
20275
20276 baz
20277 !! html
20278 <center>
20279 <p>foo
20280 </p>
20281 </center>
20282 <p>bar
20283 </p>
20284 <pre>baz
20285 </pre>
20286 !! end
20287
20288 !!test
20289 Parsing of overlapping (improperly nested) inline html tags
20290 !! wikitext
20291 <span><s>x</span></s>
20292 !! html/php
20293 <p><span><s>x&lt;/span&gt;</s></span>
20294 </p>
20295 !! html/parsoid
20296 <p><span><s>x</s></span>
20297 </p>
20298 !!end
20299
20300 ###
20301 ### Language variants related tests
20302 ###
20303 !! test
20304 Self-link in language variants
20305 !! options
20306 title=[[Dunav]] language=sr
20307 !! wikitext
20308 Both [[Dunav]] and [[Дунав]] are names for this river.
20309 !! html
20310 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
20311 </p>
20312 !!end
20313
20314 !! article
20315 Дуна
20316 !! text
20317 content
20318 !! endarticle
20319
20320 !! test
20321 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
20322 !! options
20323 title=[[Duna]] language=sr
20324 !! wikitext
20325 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
20326 !! html
20327 <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.
20328 </p>
20329 !! end
20330
20331 !! test
20332 Link to a section of a variant of this title shouldn't be parsed as self-link
20333 !! options
20334 title=[[Duna]] language=sr
20335 !! wikitext
20336 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
20337 !! html
20338 <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.
20339 </p>
20340 !! end
20341
20342 !! test
20343 Link to pages in language variants
20344 !! options
20345 language=sr
20346 !! wikitext
20347 Main Page can be written as [[Маин Паге]]
20348 !! html
20349 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
20350 </p>
20351 !!end
20352
20353
20354 !! test
20355 Multiple links to pages in language variants
20356 !! options
20357 language=sr
20358 !! wikitext
20359 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
20360 !! html
20361 <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>.
20362 </p>
20363 !!end
20364
20365
20366 !! test
20367 Simple template in language variants
20368 !! options
20369 language=sr
20370 !! wikitext
20371 {{тест}}
20372 !! html
20373 <p>This is a test template
20374 </p>
20375 !! end
20376
20377
20378 !! test
20379 Template with explicit namespace in language variants
20380 !! options
20381 language=sr
20382 !! wikitext
20383 {{Template:тест}}
20384 !! html
20385 <p>This is a test template
20386 </p>
20387 !! end
20388
20389
20390 !! test
20391 Basic test for template parameter in language variants
20392 !! options
20393 language=sr
20394 !! wikitext
20395 {{парамтест|param=foo}}
20396 !! html
20397 <p>This is a test template with parameter foo
20398 </p>
20399 !! end
20400
20401 !! test
20402 Simple category in language variants
20403 !! options
20404 language=sr cat
20405 !! wikitext
20406 [[Category:МедиаWики Усер'с Гуиде]]
20407 !! html/php
20408 cat=МедиаWики_Усер'с_Гуиде sort=
20409 !! html/parsoid
20410 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
20411 !! end
20412
20413 !! article
20414 Category:分类
20415 !! text
20416 blah
20417 !! endarticle
20418
20419 !! article
20420 Category:分類
20421 !! text
20422 blah
20423 !! endarticle
20424
20425 ## We used to, but no longer wt2wt this test since the default serializer
20426 ## will normalize all categories to serialize on their own line.
20427 ## This wikitext usage is going to be fairly uncommon in production and
20428 ## selser will take care of preserving formatting in those scenarios.
20429 !! test
20430 Don't convert blue categorylinks to another variant (bug 33210)
20431 !! options
20432 cat
20433 language=zh
20434 parsoid=wt2html
20435 !! wikitext
20436 [[A]][[Category:分类]]
20437 !! html/php
20438 cat=分类 sort=
20439 !! html/parsoid
20440 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
20441 <link rel="mw:PageProp/Category" href="./Category:分类"/>
20442 !! end
20443
20444 !! test
20445 Stripping -{}- tags (language variants)
20446 !! options
20447 language=sr
20448 !! wikitext
20449 Latin proverb: -{Ne nuntium necare}-
20450 !! html
20451 <p>Latin proverb: Ne nuntium necare
20452 </p>
20453 !! end
20454
20455
20456 !! test
20457 Prevent conversion with -{}- tags (language variants)
20458 !! options
20459 language=sr variant=sr-ec
20460 !! wikitext
20461 Latinski: -{Ne nuntium necare}-
20462 !! html
20463 <p>Латински: Ne nuntium necare
20464 </p>
20465 !! end
20466
20467
20468 !! test
20469 Prevent conversion of text with -{}- tags (language variants)
20470 !! options
20471 language=sr variant=sr-ec
20472 !! wikitext
20473 Latinski: -{Ne nuntium necare}-
20474 !! html
20475 <p>Латински: Ne nuntium necare
20476 </p>
20477 !! end
20478
20479
20480 !! test
20481 Prevent conversion of links with -{}- tags (language variants)
20482 !! options
20483 language=sr variant=sr-ec
20484 !! wikitext
20485 -{[[Main Page]]}-
20486 !! html
20487 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20488 </p>
20489 !! end
20490
20491
20492 !! test
20493 -{}- tags within headlines (within html for parserConvert())
20494 !! options
20495 language=sr variant=sr-ec
20496 !! wikitext
20497 == -{Naslov}- ==
20498 !! html
20499 <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>
20500
20501 !! end
20502
20503
20504 !! test
20505 Explicit definition of language variant alternatives
20506 !! options
20507 language=zh variant=zh-tw
20508 !! wikitext
20509 -{zh:China;zh-tw:Taiwan}-, not China
20510 !! html
20511 <p>Taiwan, not China
20512 </p>
20513 !! end
20514
20515
20516 !! test
20517 Conversion around HTML tags
20518 !! options
20519 language=sr variant=sr-ec
20520 !! wikitext
20521 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
20522 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
20523 !! html
20524 <p>
20525 <span title="ЛаCтин">ски</span>
20526 </p>
20527 !! end
20528
20529
20530 !! test
20531 Explicit session-wise language variant mapping (A flag and - flag)
20532 !! options
20533 language=zh variant=zh-tw
20534 !! wikitext
20535 Taiwan is not China.
20536 But -{A|zh:China;zh-tw:Taiwan}- is China,
20537 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20538 and -{China}- is China.
20539 !! html
20540 <p>Taiwan is not China.
20541 But Taiwan is Taiwan,
20542 (This should be stripped!)
20543 and China is China.
20544 </p>
20545 !! end
20546
20547 !! test
20548 Explicit session-wise language variant mapping (H flag for hide)
20549 !! options
20550 language=zh variant=zh-tw
20551 !! wikitext
20552 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20553 Taiwan is China.
20554 !! html
20555 <p>(This should be stripped!)
20556 Taiwan is Taiwan.
20557 </p>
20558 !! end
20559
20560 !! test
20561 Adding explicit conversion rule for title (T flag)
20562 !! options
20563 language=zh variant=zh-tw showtitle
20564 !! wikitext
20565 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20566 !! html
20567 Taiwan
20568 <p>Should be stripped!
20569 </p>
20570 !! end
20571
20572 !! test
20573 Testing that changing the language variant here in the tests actually works
20574 !! options
20575 language=zh variant=zh showtitle
20576 !! wikitext
20577 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20578 !! html
20579 China
20580 <p>Should be stripped!
20581 </p>
20582 !! end
20583
20584 !! test
20585 Recursive conversion of alt and title attrs shouldn't clear converter state
20586 !! options
20587 language=zh variant=zh-cn showtitle
20588 !! wikitext
20589 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20590 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20591 !! html
20592 China
20593 <p>
20594 Should be stripped<span title="Exclamation">!</span>
20595 </p>
20596 !! end
20597
20598 !! test
20599 Bug 24072: more test on conversion rule for title
20600 !! options
20601 language=zh variant=zh-tw showtitle
20602 !! wikitext
20603 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20604 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20605 !! html
20606 Taiwan
20607 <p>This should be stripped!
20608 This won't take interferes with the title rule.
20609 </p>
20610 !! end
20611
20612 !! test
20613 Partly disable title conversion if variant == main language code
20614 !! options
20615 language=zh variant=zh title=[[ZH]] showtitle
20616 !! wikitext
20617 -{T|zh-cn:CN;zh-tw:TW}-
20618 !! html
20619 ZH
20620 <p>
20621 </p>
20622 !! end
20623
20624 !! test
20625 Partly disable title conversion if variant == main language code, more
20626 !! options
20627 language=zh variant=zh title=[[ZH]] showtitle
20628 !! wikitext
20629 -{T|TW}-
20630 !! html
20631 ZH
20632 <p>
20633 </p>
20634 !! end
20635
20636 !! test
20637 Raw output of variant escape tags (R flag)
20638 !! options
20639 language=zh variant=zh-tw
20640 !! wikitext
20641 Raw: -{R|zh:China;zh-tw:Taiwan}-
20642 !! html
20643 <p>Raw: zh:China;zh-tw:Taiwan
20644 </p>
20645 !! end
20646
20647 !! test
20648 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20649 !! options
20650 language=zh variant=zh-cn
20651 !! input
20652 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20653 !! result
20654 <p>0
20655 </p>
20656 !! end
20657
20658 !! test
20659 Conversion rules from [numeric-only string] to [something else] (T48634)
20660 !! options
20661 language=zh variant=zh-cn
20662 !! input
20663 -{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
20664 !! result
20665 <p>D12345EE12345
20666 </p>
20667 !! end
20668
20669 !! test
20670 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20671 !! options
20672 language=zh variant=zh-cn
20673 !! input
20674 -{H|zh-cn:foo;zh-tw:;}-foobar
20675 !! result
20676 <p>foobar
20677 </p>
20678 !! end
20679
20680 !! test
20681 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20682 !! options
20683 language=zh variant=zh-cn
20684 !! input
20685 -{H|=>zh-cn:foo;}-foobar
20686 !! result
20687 <p>foobar
20688 </p>
20689 !! end
20690
20691 !! test
20692 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20693 !! options
20694 language=zh variant=zh-cn
20695 !! input
20696 -{H|}-foobar
20697 !! result
20698 <p>foobar
20699 </p>
20700 !! end
20701
20702 !! test
20703 Nested using of manual convert syntax
20704 !! options
20705 language=zh variant=zh-hk
20706 !! wikitext
20707 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20708 !! html
20709 <p>Nested: Hello Hong Kong!
20710 </p>
20711 !! end
20712
20713 # Since Parsoid is starting to emit canonical wikitext for links,
20714 # [http://example.com http://example.com] will not RT back to that
20715 # form anymore.
20716 !! test
20717 Proper conversion of text in external links
20718 !! options
20719 language=sr variant=sr-ec
20720 parsoid=wt2html
20721 !! wikitext
20722 http://www.google.com
20723 gopher://www.google.com
20724 [http://www.google.com http://www.google.com]
20725 [gopher://www.google.com gopher://www.google.com]
20726 [https://www.google.com irc://www.google.com]
20727 [ftp://www.google.com www.google.com/ftp://dir]
20728 [//www.google.com www.google.com]
20729 !! html/php
20730 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20731 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20732 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20733 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20734 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20735 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20736 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20737 </p>
20738 !! html/parsoid
20739 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20740 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20741 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20742 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20743 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20744 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20745 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20746 !! end
20747
20748 !! test
20749 Do not convert roman numbers to language variants
20750 !! options
20751 language=sr variant=sr-ec
20752 !! wikitext
20753 Fridrih IV je car.
20754 !! html
20755 <p>Фридрих IV је цар.
20756 </p>
20757 !! end
20758
20759 !! test
20760 Unclosed language converter markup "-{"
20761 !! options
20762 language=sr
20763 !! wikitext
20764 -{T|hello
20765 !! html
20766 <p>-{T|hello
20767 </p>
20768 !! end
20769
20770 !! test
20771 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20772 !! options
20773 language=sr
20774 !! wikitext
20775 -{R|=&gt;}-
20776 !! html
20777 <p>=&gt;
20778 </p>
20779 !!end
20780
20781 !! test
20782 Don't break link parsing if language converter markup is in the caption.
20783 !! options
20784 language=sr variant=sr-ec
20785 !! wikitext
20786 [[Main Page|-{R|main page}-]]
20787 !! html
20788 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20789 </p>
20790 !! end
20791
20792 # FIXME: This test is currently broken in the PHP parser T153761
20793 !! test
20794 T146304: Don't break template parsing if language converter markup is in the parameter.
20795 !! options
20796 language=sr variant=sr-ec
20797 disabled
20798 !! wikitext
20799 {{echo|-{R|foo}-}}
20800 !! html/php
20801 <p>foo
20802 </p>
20803 !! end
20804
20805 !! test
20806 T146305: Don't break image parsing if language converter markup is in the caption.
20807 !! options
20808 language=sr
20809 !! wikitext
20810 [[File:Foobar.jpg|thumb|-{R|caption:}-]]
20811 !! html/php
20812 <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>
20813
20814 !! html/parsoid
20815 <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>
20816 !! end
20817
20818 !! test
20819 T146305: Don't break image parsing if nested language converter markup is in the caption.
20820 !! options
20821 language=zh variant=zh-cn
20822 !! wikitext
20823 [[File:Foobar.jpg|thumb|-{zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
20824 !! html/php
20825 <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>
20826
20827 !! html/parsoid
20828 <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>
20829 !! end
20830
20831 !! test
20832 Don't break gallery if language converter markup is inside.
20833 !! options
20834 language=zh
20835 !! wikitext
20836 <gallery>
20837 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
20838 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
20839 </gallery>
20840 !! html
20841 <ul class="gallery mw-gallery-traditional">
20842 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20843 <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>
20844 <div class="gallerytext">
20845 <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>
20846 </p>
20847 </div>
20848 </div></li>
20849 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20850 <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>
20851 <div class="gallerytext">
20852 <p>This is a test template
20853 </p>
20854 </div>
20855 </div></li>
20856 </ul>
20857
20858 !! end
20859
20860 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20861 !! test
20862 Don't break list handling if language converter markup is in the item.
20863 !! options
20864 language=zh variant=zh-cn
20865 !! wikitext
20866 ;-{zh-cn:AAA;zh-tw:BBB}-
20867 !! html/php
20868 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20869
20870 !! html/parsoid
20871 <dl><dt>AAA
20872 </dt></dl>
20873 !! end
20874
20875 !! test
20876 T153140: Don't break table handling if language converter markup is in the cell.
20877 !! options
20878 language=sr variant=sr-ec
20879 !! wikitext
20880 {|
20881 |-
20882 | -{R|B}-
20883 |}
20884 !! html/php
20885 <table>
20886
20887 <tr>
20888 <td> B
20889 </td></tr></table>
20890
20891 !! html/parsoid
20892 <table>
20893
20894 <tr>
20895 <td> B
20896 </td></tr></table>
20897
20898 !! end
20899
20900 !! test
20901 Bug 529: Uncovered bullet
20902 !! wikitext
20903 * Foo {{bullet}}
20904 !! html
20905 <ul><li> Foo </li>
20906 <li> Bar</li></ul>
20907
20908 !! end
20909
20910 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20911 # Templates in Wikipedia rely on this behavior, as tidy has always been
20912 # enabled there. These tests are normally run *without* tidy, so specify the
20913 # full output here.
20914 # To test realistic parsing behavior, apply a tidy-like transformation to both
20915 # the expected output and your parser's output.
20916 !! test
20917 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20918 !! wikitext
20919 ******* Foo {{bullet}}
20920 !! html
20921 <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>
20922 <li> Bar</li></ul>
20923
20924 !! end
20925
20926 !! test
20927 Bug 529: Uncovered table already at line-start
20928 !! wikitext
20929 x
20930
20931 {{table}}
20932 y
20933 !! html
20934 <p>x
20935 </p>
20936 <table>
20937 <tr>
20938 <td> 1 </td>
20939 <td> 2
20940 </td></tr>
20941 <tr>
20942 <td> 3 </td>
20943 <td> 4
20944 </td></tr></table>
20945 <p>y
20946 </p>
20947 !! end
20948
20949 !! test
20950 Bug 529: Uncovered bullet in parser function result
20951 !! wikitext
20952 * Foo {{lc:{{bullet}} }}
20953 !! html
20954 <ul><li> Foo </li>
20955 <li> bar</li></ul>
20956
20957 !! end
20958
20959 !! test
20960 Bug 5678: Double-parsed template argument
20961 !! wikitext
20962 {{lc:{{{1}}}|hello}}
20963 !! html
20964 <p>{{{1}}}
20965 </p>
20966 !! end
20967
20968 !! test
20969 Bug 5678: Double-parsed template invocation
20970 !! wikitext
20971 {{lc:{{paramtest {{!}} param = hello }} }}
20972 !! html
20973 <p>{{paramtest | param = hello }}
20974 </p>
20975 !! end
20976
20977 !! test
20978 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20979 !! options
20980 language=cs
20981 title=[[Main Page]]
20982 !! wikitext
20983 {{PRVNÍVELKÉ:ěščř}}
20984 {{prvnívelké:ěščř}}
20985 {{PRVNÍMALÉ:ěščř}}
20986 {{prvnímalé:ěščř}}
20987 {{MALÁ:ěščř}}
20988 {{malá:ěščř}}
20989 {{VELKÁ:ěščř}}
20990 {{velká:ěščř}}
20991 !! html
20992 <p>Ěščř
20993 Ěščř
20994 ěščř
20995 ěščř
20996 ěščř
20997 ěščř
20998 ĚŠČŘ
20999 ĚŠČŘ
21000 </p>
21001 !! end
21002
21003 !! test
21004 Morwen/13: Unclosed link followed by heading
21005 !! wikitext
21006 [[link
21007 ==heading==
21008 !! html
21009 <p>[[link
21010 </p>
21011 <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>
21012
21013 !! end
21014
21015 !! test
21016 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
21017 !! wikitext
21018 {{foo|
21019 =heading=
21020 !! html
21021 <p>{{foo|
21022 </p>
21023 <h1><span class="mw-headline" id="heading">heading</span></h1>
21024
21025 !! end
21026
21027 !! test
21028 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
21029 !! wikitext
21030 {{foo|
21031 ==heading==
21032 !! html
21033 <p>{{foo|
21034 </p>
21035 <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>
21036
21037 !! end
21038
21039 !! test
21040 Tildes in comments
21041 !! options
21042 pst
21043 !! wikitext
21044 <!-- ~~~~ -->
21045 !! html/php
21046 <!-- ~~~~ -->
21047 !! end
21048
21049 !! test
21050 Paragraphs inside divs (no extra line breaks)
21051 !! wikitext
21052 <div>Line one
21053
21054 Line two</div>
21055 !! html
21056 <div>Line one
21057 Line two</div>
21058
21059 !! end
21060
21061 !! test
21062 Paragraphs inside divs (extra line break on open)
21063 !! wikitext
21064 <div>
21065 Line one
21066
21067 Line two</div>
21068 !! html
21069 <div>
21070 <p>Line one
21071 </p>
21072 Line two</div>
21073
21074 !! end
21075
21076 !! test
21077 Paragraphs inside divs (extra line break on close)
21078 !! wikitext
21079 <div>Line one
21080
21081 Line two
21082 </div>
21083 !! html
21084 <div>Line one
21085 <p>Line two
21086 </p>
21087 </div>
21088
21089 !! end
21090
21091 !! test
21092 Paragraphs inside divs (extra line break on open and close)
21093 !! wikitext
21094 <div>
21095 Line one
21096
21097 Line two
21098 </div>
21099 !! html
21100 <div>
21101 <p>Line one
21102 </p><p>Line two
21103 </p>
21104 </div>
21105
21106 !! end
21107
21108 !! test
21109 Nesting tags, paragraphs on lines which begin with <div>
21110 !! wikitext
21111 <div></div><strong>A
21112 B</strong>
21113 !! html/php+tidy
21114 <p><strong>A</strong></p>
21115 <p><strong>B</strong></p>
21116 !! html/parsoid
21117 <div></div>
21118 <p><strong>A
21119 B</strong>
21120 </p>
21121 !! end
21122
21123 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
21124 !! test
21125 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
21126 !! wikitext
21127 <blockquote>Line one
21128
21129 Line two</blockquote>
21130 !! html
21131 <blockquote>Line one
21132 Line two</blockquote>
21133
21134 !! html+tidy
21135 <blockquote>
21136 <p>Line one Line two</p>
21137 </blockquote>
21138 !! end
21139
21140 !! test
21141 Bug 6200: paragraphs inside blockquotes (extra line break on open)
21142 !! wikitext
21143 <blockquote>
21144 Line one
21145
21146 Line two</blockquote>
21147 !! html
21148 <blockquote>
21149 <p>Line one
21150 </p>
21151 Line two</blockquote>
21152
21153 !! html+tidy
21154 <blockquote>
21155 <p>Line one</p>
21156 Line two</blockquote>
21157 !! end
21158
21159 !! test
21160 Bug 6200: paragraphs inside blockquotes (extra line break on close)
21161 !! wikitext
21162 <blockquote>Line one
21163
21164 Line two
21165 </blockquote>
21166 !! html
21167 <blockquote>Line one
21168 <p>Line two
21169 </p>
21170 </blockquote>
21171
21172 !! html+tidy
21173 <blockquote>
21174 <p>Line one</p>
21175 <p>Line two</p>
21176 </blockquote>
21177 !! end
21178
21179 !! test
21180 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
21181 !! wikitext
21182 <blockquote>
21183 Line one
21184
21185 Line two
21186 </blockquote>
21187 !! html
21188 <blockquote>
21189 <p>Line one
21190 </p><p>Line two
21191 </p>
21192 </blockquote>
21193
21194 !! html+tidy
21195 <blockquote>
21196 <p>Line one</p>
21197 <p>Line two</p>
21198 </blockquote>
21199 !! end
21200
21201 !! test
21202 Paragraphs inside blockquotes/divs (no extra line breaks)
21203 !! wikitext
21204 <blockquote><div>Line one
21205
21206 Line two</div></blockquote>
21207 !! html
21208 <blockquote><div>Line one
21209 Line two</div></blockquote>
21210
21211 !! end
21212
21213 !! test
21214 Paragraphs inside blockquotes/divs (extra line break on open)
21215 !! wikitext
21216 <blockquote><div>
21217 Line one
21218
21219 Line two</div></blockquote>
21220 !! html
21221 <blockquote><div>
21222 <p>Line one
21223 </p>
21224 Line two</div></blockquote>
21225
21226 !! end
21227
21228 !! test
21229 Paragraphs inside blockquotes/divs (extra line break on close)
21230 !! wikitext
21231 <blockquote><div>Line one
21232
21233 Line two
21234 </div></blockquote>
21235 !! html
21236 <blockquote><div>Line one
21237 <p>Line two
21238 </p>
21239 </div></blockquote>
21240
21241 !! end
21242
21243 !! test
21244 Paragraphs inside blockquotes/divs (extra line break on open and close)
21245 !! wikitext
21246 <blockquote><div>
21247 Line one
21248
21249 Line two
21250 </div></blockquote>
21251 !! html
21252 <blockquote><div>
21253 <p>Line one
21254 </p><p>Line two
21255 </p>
21256 </div></blockquote>
21257
21258 !! end
21259
21260 !! test
21261 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
21262 !! options
21263 wgLinkHolderBatchSize=0
21264 !! wikitext
21265 [[meatball:1]]
21266 [[meatball:2]]
21267 [[meatball:3]]
21268 !! html
21269 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
21270 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
21271 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
21272 </p>
21273 !! end
21274
21275 !! test
21276 Free external link invading image caption
21277 !! wikitext
21278 [[Image:Foobar.jpg|thumb|http://x|hello]]
21279 !! html
21280 <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>
21281
21282 !! end
21283
21284 !! test
21285 Bug 15196: localised external link numbers
21286 !! options
21287 language=fa
21288 !! wikitext
21289 [http://en.wikipedia.org/]
21290 !! html/php
21291 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
21292 </p>
21293 !! html/parsoid
21294 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
21295 !! end
21296
21297 !! test
21298 Multibyte character in padleft
21299 !! wikitext
21300 {{padleft:-Hello|7|Æ}}
21301 !! html
21302 <p>Æ-Hello
21303 </p>
21304 !! end
21305
21306 !! test
21307 Multibyte character in padright
21308 !! wikitext
21309 {{padright:Hello-|7|Æ}}
21310 !! html
21311 <p>Hello-Æ
21312 </p>
21313 !! end
21314
21315 !!test
21316 formatdate parser function
21317 !! wikitext
21318 {{#formatdate:2009-03-24}}
21319 !! html
21320 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
21321 </p>
21322 !! end
21323
21324 !!test
21325 formatdate parser function, with default format
21326 !! wikitext
21327 {{#formatdate:2009-03-24|mdy}}
21328 !! html
21329 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
21330 </p>
21331 !! end
21332
21333 !! test
21334 Spacing of numbers in formatted dates
21335 !! wikitext
21336 {{#formatdate:January 15}}
21337 !! html
21338 <p><span class="mw-formatted-date" title="01-15">January 15</span>
21339 </p>
21340 !! end
21341
21342 !! test
21343 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
21344 !! options
21345 language=nl title=[[MediaWiki:Common.css]]
21346 !! wikitext
21347 {{#formatdate:2009-03-24|dmy}}
21348 !! html
21349 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
21350 </p>
21351 !! end
21352
21353 #
21354 #
21355 #
21356
21357 #
21358 # Edit comments
21359 #
21360
21361 !! test
21362 Edit comment with link
21363 !! options
21364 comment
21365 !! wikitext
21366 I like the [[Main Page]] a lot
21367 !! html/php
21368 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
21369 !!end
21370
21371 !! test
21372 Edit comment with link and link text
21373 !! options
21374 comment
21375 !! wikitext
21376 I like the [[Main Page|best pages]] a lot
21377 !! html/php
21378 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21379 !!end
21380
21381 !! test
21382 Edit comment with link and link text with suffix
21383 !! options
21384 comment
21385 !! wikitext
21386 I like the [[Main Page|best page]]s a lot
21387 !! html/php
21388 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21389 !!end
21390
21391 !! test
21392 Edit comment with section link (non-local, eg in history list)
21393 !! options
21394 comment title=[[Main Page]]
21395 !! wikitext
21396 /* External links */ removed bogus entries
21397 !! html/php
21398 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21399 !!end
21400
21401 !! test
21402 Edit comment with section link and text before it (non-local, eg in history list)
21403 !! options
21404 comment title=[[Main Page]]
21405 !! wikitext
21406 pre-comment text /* External links */ removed bogus entries
21407 !! html/php
21408 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>
21409 !!end
21410
21411 !! test
21412 Edit comment with section link (local, eg in diff view)
21413 !! options
21414 comment local title=[[Main Page]]
21415 !! wikitext
21416 /* External links */ removed bogus entries
21417 !! html/php
21418 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21419 !!end
21420
21421 !! test
21422 Edit comment with subpage link (bug 14080)
21423 !! options
21424 comment
21425 subpage
21426 title=[[Subpage test]]
21427 !! wikitext
21428 Poked at a [[/subpage]] here...
21429 !! html/php
21430 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
21431 !!end
21432
21433 !! test
21434 Edit comment with subpage link and link text (bug 14080)
21435 !! options
21436 comment
21437 subpage
21438 title=[[Subpage test]]
21439 !! wikitext
21440 Poked at a [[/subpage|neat little page]] here...
21441 !! html/php
21442 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
21443 !!end
21444
21445 !! test
21446 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
21447 !! options
21448 comment
21449 title=[[Subpage test]]
21450 !! wikitext
21451 Poked at a [[/subpage]] here...
21452 !! html/php
21453 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...
21454 !!end
21455
21456 !! test
21457 Edit comment with bare anchor link (local, as on diff)
21458 !! options
21459 comment
21460 local
21461 title=[[Main Page]]
21462 !! wikitext
21463 [[#section]]
21464 !! html/php
21465 <a href="#section">#section</a>
21466 !! end
21467
21468 !! test
21469 Edit comment with bare anchor link (non-local, as on history)
21470 !! options
21471 comment
21472 title=[[Main Page]]
21473 !! wikitext
21474 [[#section]]
21475 !! html/php
21476 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
21477 !! end
21478
21479 !! test
21480 Anchor starting with underscore
21481 !! options
21482 title=[[Foo]]
21483 !! wikitext
21484 [[#_ref|One]]
21485 !! html/php
21486 <p><a href="#_ref">One</a>
21487 </p>
21488 !! html/parsoid
21489 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
21490 !! end
21491
21492 !! test
21493 Id starting with underscore
21494 !! wikitext
21495 <div id="_ref"></div>
21496 !! html/*
21497 <div id="_ref"></div>
21498
21499 !! end
21500
21501 !! test
21502 Edit comment with link with more than one pipe (T99346)
21503 !! options
21504 comment
21505 !! wikitext
21506 [[Main Page|Many|pipes]]
21507 !! html/php
21508 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
21509 !! end
21510
21511 !! test
21512 Complex edit comment with link with more than one pipe (T99346)
21513 !! options
21514 comment
21515 !! wikitext
21516 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
21517 !! html/php
21518 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;
21519 !! end
21520
21521 !! test
21522 Space normalisation on autocomment (bug 22784)
21523 !! options
21524 comment
21525 title=[[Main Page]]
21526 !! wikitext
21527 /* __hello__world__ */
21528 !! html/php
21529 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
21530 !! end
21531
21532 !! test
21533 percent-encoding and + signs in comments (Bug 26410)
21534 !! options
21535 comment
21536 !! wikitext
21537 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
21538 !! html/php
21539 <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>
21540 !! end
21541
21542 # Parsoid doesn't support this yet: see bug 73581
21543 # but it *should* omit the 'src' attribute if the image is bad.
21544 # PHP side of tests was disabled in
21545 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
21546 # because of issues in the PHP parserTests infrastructure
21547 # (but the output below is indeed what the PHP side emits)
21548 !! test
21549 Bad images - basic functionality
21550 !! wikitext
21551 [[File:Bad.jpg]]
21552 !! DISABLED/html/php
21553 !! html/parsoid
21554 <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>
21555 !! end
21556
21557 !! test
21558 Bad images - bug 16039: text after bad image disappears
21559 !! wikitext
21560 Foo bar
21561 [[File:Bad.jpg]]
21562 Bar foo
21563 !! DISABLED/html/php
21564 <p>Foo bar
21565 </p><p>Bar foo
21566 </p>
21567 !! html/parsoid
21568 <p>Foo bar
21569 <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>
21570 Bar foo</p>
21571 !! end
21572
21573 !! test
21574 Verify that displaytitle works (bug #22501) no displaytitle
21575 !! options
21576 showtitle
21577 !! config
21578 wgAllowDisplayTitle=true
21579 wgRestrictDisplayTitle=false
21580 !! wikitext
21581 this is not the the title
21582 !! html/php
21583 Parser test
21584 <p>this is not the the title
21585 </p>
21586 !! end
21587
21588 !! test
21589 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
21590 !! options
21591 showtitle
21592 title=[[Screen]]
21593 !! config
21594 wgAllowDisplayTitle=true
21595 wgRestrictDisplayTitle=false
21596 !! wikitext
21597 this is not the the title
21598 {{DISPLAYTITLE:whatever}}
21599 !! html/php
21600 whatever
21601 <p>this is not the the title
21602 </p>
21603 !! end
21604
21605 !! test
21606 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
21607 !! options
21608 showtitle
21609 title=[[Screen]]
21610 !! config
21611 wgAllowDisplayTitle=true
21612 wgRestrictDisplayTitle=true
21613 !! wikitext
21614 this is not the the title
21615 {{DISPLAYTITLE:whatever}}
21616 !! html/php
21617 Screen
21618 <p>this is not the the title
21619 </p>
21620 !! end
21621
21622 !! test
21623 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
21624 !! options
21625 showtitle
21626 title=[[Screen]]
21627 !! config
21628 wgAllowDisplayTitle=true
21629 wgRestrictDisplayTitle=true
21630 !! wikitext
21631 this is not the the title
21632 {{DISPLAYTITLE:screen}}
21633 !! html/php
21634 screen
21635 <p>this is not the the title
21636 </p>
21637 !! end
21638
21639 !! test
21640 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
21641 !! options
21642 showtitle
21643 title=[[Screen]]
21644 !! config
21645 wgAllowDisplayTitle=false
21646 !! wikitext
21647 this is not the the title
21648 {{DISPLAYTITLE:screen}}
21649 !! html/php
21650 Screen
21651 <p>this is not the the title
21652 <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>
21653 </p>
21654 !! end
21655
21656 !! test
21657 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
21658 !! options
21659 showtitle
21660 title=[[Screen]]
21661 !! config
21662 wgAllowDisplayTitle=false
21663 !! wikitext
21664 this is not the the title
21665 !! html/php
21666 Screen
21667 <p>this is not the the title
21668 </p>
21669 !! end
21670
21671 !! test
21672 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
21673 !! options
21674 showtitle
21675 title=[[Screen]]
21676 !! config
21677 wgAllowDisplayTitle=true
21678 wgRestrictDisplayTitle=true
21679 !! wikitext
21680 this is not the the title
21681 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21682 !! html/php
21683 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21684 <p>this is not the the title
21685 </p>
21686 !! end
21687
21688 !! test
21689 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
21690 !! options
21691 showtitle
21692 title=[[Screen]]
21693 !! config
21694 wgAllowDisplayTitle=true
21695 wgRestrictDisplayTitle=true
21696 !! wikitext
21697 this is not the the title
21698 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21699 !! html/php
21700 <span style="color: red;">s</span>creen
21701 <p>this is not the the title
21702 </p>
21703 !! end
21704
21705 !! test
21706 Page status indicators: Empty name is invalid
21707 !! options
21708 showindicators
21709 !! wikitext
21710 <indicator name=" "></indicator>
21711 <indicator></indicator>
21712 !! html
21713 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21714 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21715 </p>
21716 !! end
21717
21718 !! test
21719 Page status indicators: Weird syntaxes that are okay
21720 !! options
21721 showindicators
21722 !! wikitext
21723 <indicator name="empty" />
21724 <indicator name="name"></indicator>
21725 !! html
21726 empty=
21727 name=
21728 <p><br />
21729 </p>
21730 !! end
21731
21732 !! test
21733 Page status indicators: Torture test
21734 !! options
21735 showindicators
21736 !! wikitext
21737 <indicator name="01">hello world</indicator>
21738 <indicator name="02">[[Main Page]]</indicator>
21739 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21740 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21741 <indicator name="05">* foo
21742 * bar</indicator>
21743 <indicator name="06"><nowiki>foo</nowiki></indicator>
21744 <indicator name="07"> Preformatted</indicator>
21745 <indicator name="08"><div>Broken tag</indicator>
21746 <indicator name="09">{| class=wikitable
21747 | cell
21748 |}</indicator>
21749 <indicator name="10">Two
21750
21751 paragraphs</indicator>
21752 !! html
21753 01=hello world
21754 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21755 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" />
21756 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>
21757 05=<ul><li> foo</li>
21758 <li> bar</li></ul>
21759
21760 06=foo
21761 07=<pre>Preformatted
21762 </pre>
21763 08=<div>Broken tag</div>
21764
21765 09=<table class="wikitable">
21766 <tr>
21767 <td> cell
21768 </td></tr></table>
21769
21770 10=<p>Two
21771 </p><p>paragraphs
21772 </p>
21773 <p><br />
21774 </p><p><br />
21775 </p><p><br />
21776 </p><p><br />
21777 </p><p><br />
21778 </p>
21779 !! end
21780
21781 !! test
21782 preload: check <noinclude> and <includeonly>
21783 !! options
21784 preload
21785 !! wikitext
21786 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21787 !! html/php
21788 Hello kind world.
21789 !! end
21790
21791 !! test
21792 preload: check <onlyinclude>
21793 !! options
21794 preload
21795 !! wikitext
21796 Goodbye <onlyinclude>Hello world</onlyinclude>
21797 !! html/php
21798 Hello world
21799 !! end
21800
21801 !! test
21802 preload: can pass tags through if we want to
21803 !! options
21804 preload
21805 !! wikitext
21806 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21807 !! html/php
21808 <includeonly>Hello world</includeonly>
21809 !! end
21810
21811 !! test
21812 preload: check that it doesn't try to do tricks
21813 !! options
21814 preload
21815 !! wikitext
21816 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21817 !! html/php
21818 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21819 !! end
21820
21821 !! test
21822 Play a bit with r67090 and bug 3158
21823 !! wikitext
21824 <div style="width:50% !important">&nbsp;</div>
21825 <div style="width:50%&nbsp;!important">&nbsp;</div>
21826 <div style="width:50%&#160;!important">&nbsp;</div>
21827 <div style="border : solid;">&nbsp;</div>
21828 !! html/php
21829 <div style="width:50% !important">&#160;</div>
21830 <div style="width:50% !important">&#160;</div>
21831 <div style="width:50% !important">&#160;</div>
21832 <div style="border&#160;: solid;">&#160;</div>
21833
21834 !! html/parsoid
21835 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21836 <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>
21837 <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>
21838 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21839
21840 !! end
21841
21842 !! test
21843 HTML5 data attributes
21844 !! wikitext
21845 <span data-foo="bar">Baz</span>
21846 <p data-abc-def_hij="">Quuz</p>
21847 !! html/php
21848 <p><span data-foo="bar">Baz</span>
21849 </p>
21850 <p data-abc-def_hij="">Quuz</p>
21851
21852 !! html/parsoid
21853 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21854 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21855 !! end
21856
21857 !! test
21858 Strip reserved data attributes
21859 !! wikitext
21860 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21861 !! html/php
21862 <div data-ok="fred">d</div>
21863
21864 !! html/parsoid
21865 <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>
21866 !! end
21867
21868 !! test
21869 percent-encoding and + signs in internal links (Bug 26410)
21870 !! wikitext
21871 [[User:+%]] [[Page+title%]]
21872 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21873 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21874 [[%33%45]] [[%33%45+]]
21875 !! html/php
21876 <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>
21877 <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>
21878 <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>
21879 <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>
21880 </p>
21881 !! html/parsoid
21882 <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>
21883 <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>
21884 <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>
21885 <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>
21886 !! end
21887
21888 !! test
21889 Special characters in embedded file links (bug 27679)
21890 !! wikitext
21891 [[File:Contains & ampersand.jpg]]
21892 [[File:Does not exist.jpg|Title with & ampersand]]
21893 !! html/php
21894 <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>
21895 <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>
21896 </p>
21897 !! html/parsoid
21898 <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>
21899 <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>
21900 !! end
21901
21902 !! test
21903 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21904 !! wikitext
21905 Text&apos;s been normalized?
21906 !! html
21907 <p>Text&#39;s been normalized?
21908 </p>
21909 !! end
21910
21911 !! test
21912 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21913 !! wikitext
21914 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21915 !! html
21916 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21917 </p>
21918 !! end
21919
21920 !! test
21921 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21922 !! wikitext
21923 [http://www.example.org/ ideograms]
21924 !! html
21925 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21926 </p>
21927 !! end
21928
21929 !! test
21930 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21931 !! wikitext
21932 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21933 !! html
21934 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21935 </p>
21936 !! end
21937
21938 !! article
21939 Mediawiki:loop1
21940 !! text
21941 {{Identical|A}}
21942 !! endarticle
21943
21944 !! article
21945 Mediawiki:loop2
21946 !! text
21947 {{Identical|B}}
21948 !! endarticle
21949
21950 !! article
21951 Template:Identical
21952 !! text
21953 {{int:loop1}}
21954 {{int:loop2}}
21955 !! endarticle
21956
21957 !! test
21958 Bug 31098 Template which includes system messages which includes the template
21959 !! wikitext
21960 {{Identical}}
21961 !! html
21962 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21963 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21964 </p>
21965 !! end
21966
21967 !! test
21968 Bug31490 Turkish: ucfirst 'blah'
21969 !! options
21970 language=tr
21971 !! wikitext
21972 {{ucfirst:blah}}
21973 !! html
21974 <p>Blah
21975 </p>
21976 !! end
21977
21978 !! test
21979 Bug31490 Turkish: ucfirst 'ix'
21980 !! options
21981 language=tr
21982 !! wikitext
21983 {{ucfirst:ix}}
21984 !! html
21985 <p>İx
21986 </p>
21987 !! end
21988
21989 !! test
21990 Bug31490 Turkish: lcfirst 'BLAH'
21991 !! options
21992 language=tr
21993 !! wikitext
21994 {{lcfirst:BLAH}}
21995 !! html
21996 <p>bLAH
21997 </p>
21998 !! end
21999
22000 !! test
22001 Bug31490 Turkish: ucfırst (with a dotless i)
22002 !! options
22003 language=tr
22004 !! wikitext
22005 {{ucfırst:blah}}
22006 !! html
22007 <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>
22008 </p>
22009 !! end
22010
22011 !! test
22012 Bug31490 ucfırst (with a dotless i) with English language
22013 !! options
22014 language=en
22015 !! wikitext
22016 {{ucfırst:blah}}
22017 !! html
22018 <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>
22019 </p>
22020 !! end
22021
22022 !! test
22023 Bug 26375: TOC with italics
22024 !! options
22025 title=[[Main Page]]
22026 !! wikitext
22027 __TOC__
22028 == ''Lost'' episodes ==
22029 !! html
22030 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22031 <ul>
22032 <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>
22033 </ul>
22034 </div>
22035
22036 <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>
22037
22038 !! end
22039
22040 !! test
22041 Bug 26375: TOC with bold
22042 !! options
22043 title=[[Main Page]]
22044 !! wikitext
22045 __TOC__
22046 == '''should be bold''' then normal text ==
22047 !! html
22048 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22049 <ul>
22050 <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>
22051 </ul>
22052 </div>
22053
22054 <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>
22055
22056 !! end
22057
22058 !! test
22059 Bug 33845: Headings become cursive in TOC when they contain an image
22060 !! options
22061 title=[[Main Page]]
22062 !! wikitext
22063 __TOC__
22064 == Image [[Image:foobar.jpg]] ==
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="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
22069 </ul>
22070 </div>
22071
22072 <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>
22073
22074 !! end
22075
22076 !! test
22077 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
22078 !! options
22079 title=[[Main Page]]
22080 !! wikitext
22081 __TOC__
22082 == <blockquote>Quote</blockquote> ==
22083 !! html
22084 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22085 <ul>
22086 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22087 </ul>
22088 </div>
22089
22090 <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>
22091
22092 !! html+tidy
22093 <p></p>
22094 <div id="toc" class="toc">
22095 <div id="toctitle">
22096 <h2>Contents</h2>
22097 </div>
22098 <ul>
22099 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22100 </ul>
22101 </div>
22102 <p></p>
22103 <h2><span class="mw-headline" id="Quote"></span></h2>
22104 <blockquote>
22105 <p><span class="mw-headline" id="Quote">Quote</span></p>
22106 </blockquote>
22107 <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>
22108 !! end
22109
22110 !! test
22111 Unclosed tags in TOC
22112 !! options
22113 title=[[Main Page]]
22114 !! wikitext
22115 __TOC__
22116 == Proof: 2 < 3 ==
22117 <small>Hanc marginis exiguitas non caperet.</small>
22118 QED
22119 !! html
22120 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22121 <ul>
22122 <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>
22123 </ul>
22124 </div>
22125
22126 <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>
22127 <p><small>Hanc marginis exiguitas non caperet.</small>
22128 QED
22129 </p>
22130 !! end
22131
22132 !! test
22133 Multiple tags in TOC
22134 !! wikitext
22135 __TOC__
22136 == <i>Foo</i> <b>Bar</b> ==
22137
22138 == <i>Foo</i> <blockquote>Bar</blockquote> ==
22139 !! html
22140 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22141 <ul>
22142 <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>
22143 <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>
22144 </ul>
22145 </div>
22146
22147 <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>
22148 <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>
22149
22150 !! html+tidy
22151 <p></p>
22152 <div id="toc" class="toc">
22153 <div id="toctitle">
22154 <h2>Contents</h2>
22155 </div>
22156 <ul>
22157 <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>
22158 <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>
22159 </ul>
22160 </div>
22161 <p></p>
22162 <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>
22163 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
22164 <blockquote>
22165 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
22166 </blockquote>
22167 <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>
22168 !! end
22169
22170 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
22171 # html5 tag parsing.
22172 !! test
22173 Tags with parameters in TOC
22174 !! options
22175 parsoid=wt2html
22176 !! wikitext
22177 __TOC__
22178 == <sup class="in-h2">Hello</sup> ==
22179
22180 == <sup class="a > b">Evilbye</sup> ==
22181 !! html/php
22182 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22183 <ul>
22184 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
22185 <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>
22186 </ul>
22187 </div>
22188
22189 <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>
22190 <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>
22191
22192 !! html/parsoid
22193 <meta property="mw:PageProp/toc" />
22194 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
22195
22196 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
22197 !! end
22198
22199 !! test
22200 span tags with directionality in TOC
22201 !! wikitext
22202 __TOC__
22203 == <span dir="ltr">C++</span> ==
22204
22205 == <span dir="rtl">זבנג!</span> ==
22206
22207 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
22208
22209 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
22210
22211 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
22212 !! html
22213 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22214 <ul>
22215 <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>
22216 <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>
22217 <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>
22218 <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>
22219 <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>
22220 </ul>
22221 </div>
22222
22223 <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>
22224 <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>
22225 <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>
22226 <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>
22227 <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>
22228
22229 !! end
22230
22231 !! test
22232 Bug 72884: bdi element in ToC
22233 !! wikitext
22234 __TOC__
22235 == <bdi>test</bdi> ==
22236 !! html
22237 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22238 <ul>
22239 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
22240 </ul>
22241 </div>
22242
22243 <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>
22244
22245 !! end
22246
22247 !! test
22248 T35715: s/strike element in ToC
22249 !! wikitext
22250 __TOC__
22251 == <s>test</s> test <strike>test</strike> ==
22252 !! html
22253 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22254 <ul>
22255 <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>
22256 </ul>
22257 </div>
22258
22259 <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>
22260
22261 !! end
22262
22263 # Note that the html output does not have the <p></p>, but the
22264 # html+tidy output *does*. This is because the empty <p></p> is
22265 # removed by the sanitizer, but only when tidy is *not* enabled (!).
22266 !! test
22267 Empty <p> tag in TOC, removed by Sanitizer (T92892)
22268 !! wikitext
22269 __TOC__
22270 == x ==
22271 !! html
22272 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22273 <ul>
22274 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22275 </ul>
22276 </div>
22277
22278 <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>
22279
22280 !! html+tidy
22281 <p></p>
22282 <div id="toc" class="toc">
22283 <div id="toctitle">
22284 <h2>Contents</h2>
22285 </div>
22286 <ul>
22287 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22288 </ul>
22289 </div>
22290 <p></p>
22291 <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>
22292 !! end
22293
22294 !! article
22295 MediaWiki:Bug32057
22296 !! text
22297 == {{int:headline_sample}} ==
22298 !! endarticle
22299
22300 !! test
22301 Bug 32057: Title needed when expanding <h> nodes.
22302 !! options
22303 title=[[Main Page]]
22304 !! wikitext
22305 {{int:Bug32057}}
22306 !! html
22307 <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>
22308
22309 !! end
22310
22311 !! test
22312 Strip marker in urlencode
22313 !! wikitext
22314 {{urlencode:x<nowiki/>y}}
22315 {{urlencode:x<nowiki/>y|wiki}}
22316 {{urlencode:x<nowiki/>y|path}}
22317 {{urlencode:x<pre id="one">two</pre>y}}
22318 !! html/php
22319 <p>xy
22320 xy
22321 xy
22322 xy
22323 </p>
22324 !! end
22325
22326 !! test
22327 Strip marker in lc
22328 !! wikitext
22329 {{lc:x<nowiki/>y}}
22330 !! html
22331 <p>xy
22332 </p>
22333 !! end
22334
22335 !! test
22336 Strip marker in uc
22337 !! wikitext
22338 {{uc:x<nowiki/>y}}
22339 !! html
22340 <p>XY
22341 </p>
22342 !! end
22343
22344 !! test
22345 Strip marker in formatNum
22346 !! wikitext
22347 {{formatnum:1<nowiki/>2}}
22348 {{formatnum:1<nowiki/>2|R}}
22349 !! html
22350 <p>12
22351 12
22352 </p>
22353 !! end
22354
22355 !! test
22356 Check noCommafy in formatNum
22357 !! options
22358 language=be-tarask
22359 !! wikitext
22360 {{formatnum:123456.78}}
22361 {{formatnum:123456.78|NOSEP}}
22362 !! html
22363 <p>123 456,78
22364 123456.78
22365 </p>
22366 !! end
22367
22368 !! test
22369 Wrong option for formatNum (bug 56199)
22370 !! wikitext
22371 {{formatnum:1,234.56|Random}}
22372 {{formatnum:1,234.56|EVERYTHING}}
22373 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
22374 !! html
22375 <p>1,234.56
22376 1,234.56
22377 1,234.56
22378 </p>
22379 !! end
22380
22381 !! test
22382 Strip marker in grammar
22383 !! options
22384 language=fi
22385 !! wikitext
22386 {{grammar:elative|foo<nowiki/>bar}}
22387 !! html
22388 <p>foobarista
22389 </p>
22390 !! end
22391
22392 !! test
22393 Strip marker in padleft
22394 !! wikitext
22395 {{padleft:|2|x<nowiki/>y}}
22396 !! html
22397 <p>xy
22398 </p>
22399 !! end
22400
22401 !! test
22402 Strip marker in padright
22403 !! wikitext
22404 {{padright:|2|x<nowiki/>y}}
22405 !! html
22406 <p>xy
22407 </p>
22408 !! end
22409
22410 !! test
22411 Strip marker in anchorencode
22412 !! wikitext
22413 {{anchorencode:x<nowiki/>y}}
22414 !! html
22415 <p>xy
22416 </p>
22417 !! end
22418
22419 !! test
22420 nowiki inside link inside heading (bug 18295)
22421 !! wikitext
22422 ==[[foo|x<nowiki>y</nowiki>z]]==
22423 !! html
22424 <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>
22425
22426 !! end
22427
22428 !! test
22429 new support for bdi element (bug 31817)
22430 !! wikitext
22431 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22432 !! html
22433 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22434
22435 !!end
22436
22437 !! test
22438 Ignore pipe between table row attributes
22439 !! wikitext
22440 {|
22441 | quux
22442 |- id=foo | style='color: red'
22443 | bar
22444 |}
22445 !! html
22446 <table>
22447 <tr>
22448 <td> quux
22449 </td></tr>
22450 <tr id="foo" style="color: red">
22451 <td> bar
22452 </td></tr></table>
22453
22454 !! end
22455
22456 !!test
22457 Gallery override link with WikiLink (bug 34852)
22458 !! wikitext
22459 <gallery>
22460 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
22461 </gallery>
22462 !! html
22463 <ul class="gallery mw-gallery-traditional">
22464 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22465 <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>
22466 <div class="gallerytext">
22467 <p>caption
22468 </p>
22469 </div>
22470 </div></li>
22471 </ul>
22472
22473 !! end
22474
22475 !!test
22476 Language parser function
22477 !! wikitext
22478 {{#language:ar}}
22479 !! html
22480 <p>العربية
22481 </p>
22482 !! end
22483
22484 !!test
22485 Padleft and padright as substr
22486 !! wikitext
22487 {{padleft:|3|abcde}}
22488 {{padright:|3|abcde}}
22489 !! html
22490 <p>abc
22491 abc
22492 </p>
22493 !! end
22494
22495 !!test
22496 Special parser function
22497 !! wikitext
22498 {{#special:RandomPage}}
22499 {{#special:BaDtItLe}}
22500 {{#special:Foobar}}
22501 !! html
22502 <p>Special:Random
22503 Special:Badtitle
22504 Special:Foobar
22505 </p>
22506 !! end
22507
22508 !!test
22509 Bug 34939 - Case insensitive link parsing ([HttP://])
22510 !! wikitext
22511 [HttP://MediaWiki.Org/]
22512 !! html/php
22513 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
22514 </p>
22515 !! html/parsoid
22516 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
22517 !! end
22518
22519 !!test
22520 Bug 34939 - Case insensitive link parsing ([HttP:// title])
22521 !! wikitext
22522 [HttP://MediaWiki.Org/ MediaWiki]
22523 !! html
22524 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22525 </p>
22526 !! end
22527
22528 !!test
22529 Bug 34939 - Case insensitive link parsing (HttP://)
22530 !! wikitext
22531 HttP://MediaWiki.Org/
22532 !! html/php
22533 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22534 </p>
22535 !! html/parsoid
22536 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22537 !! end
22538
22539 !!test
22540 Disable TOC
22541 !! options
22542 notoc
22543 !! wikitext
22544 Lead
22545 == Section 1 ==
22546 == Section 2 ==
22547 == Section 3 ==
22548 == Section 4 ==
22549 == Section 5 ==
22550 !! html
22551 <p>Lead
22552 </p>
22553
22554 <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>
22555 <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>
22556 <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>
22557 <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>
22558 <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>
22559
22560 !! end
22561
22562
22563 ###
22564 ### Parsoid-specific tests
22565 ### Parsoid-PHP parser incompatibilities
22566 ###
22567 !!test
22568 1. SOL-sensitive wikitext tokens as template-args
22569 !!options
22570 parsoid=wt2html,wt2wt
22571 !! wikitext
22572 {{echo|*a}}
22573 {{echo|#a}}
22574 {{echo|:a}}
22575 !! html
22576 <span about="#mwt1" typeof="mw:Transclusion">
22577 </span><ul about="#mwt1"><li>a</li>
22578 </ul>
22579 <span about="#mwt2" typeof="mw:Transclusion">
22580 </span><ol about="#mwt2"><li>a</li>
22581 </ol>
22582 <span about="#mwt3" typeof="mw:Transclusion">
22583 </span><dl about="#mwt3"><dd>a</dd>
22584 </dl>
22585 !!end
22586
22587 #### -----------------------------------------------------------------
22588 #### Parsoid-specific functionality tests
22589 #### -----------------------------------------------------------------
22590
22591 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
22592 # We know wt2wt will fail, but we expect selser to pass.
22593 # Due to the nature of our testing, wt2wt and selser tests will enter the
22594 # blacklist and we'll catch selser regressions based on changes to the
22595 # blacklist entries for selser tests.
22596 !! test
22597 1. Bad treebuilder fixup of formatting elt is cleaned up
22598 !! options
22599 parsoid=wt2html,wt2wt
22600 !! wikitext
22601 {|
22602 |
22603 <small>
22604 [[Image:Foobar.jpg|right|Test]]
22605 </small>
22606 |}
22607 !! html/parsoid
22608 <table>
22609 <tbody><tr><td>
22610 <small>
22611 <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>
22612 </small>
22613 </td></tr>
22614 </tbody></table>
22615 !! end
22616
22617 !! test
22618 2. Bad treebuilder fixup of formatting elt is cleaned up
22619 !! options
22620 parsoid=wt2html,wt2wt
22621 !! wikitext
22622 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22623
22624 <small>[[Image:Foobar.jpg|right|300px]]</small>
22625 !! html/parsoid
22626
22627 <p><b>foo</b></p>
22628 <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>
22629 <p><b>bar</b></p>
22630 <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>
22631 !! end
22632
22633 !! test
22634 3. Bad treebuilder fixup of formatting elt is cleaned up
22635 !! options
22636 parsoid=wt2html,wt2wt
22637 !! wikitext
22638 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22639 !! html/parsoid
22640 <p><small><b>foo</b></small></p>
22641 <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>
22642 <p><small><b>bar</b></small></p>
22643 !! end
22644
22645 !! test
22646 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22647 !! options
22648 parsoid=wt2html,wt2wt
22649 !! wikitext
22650 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22651 !! html/parsoid
22652 <p><b><small></small></b></p>
22653 <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>
22654 <p></p>
22655 !! end
22656
22657 #### ----------------------------------------------------------------
22658 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22659 #### tags. Parsoid's output for these tags differs from that of the
22660 #### PHP parser.
22661 #### ----------------------------------------------------------------
22662
22663 !!test
22664 Ref: 1. ref-location should be replaced with an index span
22665 !! wikitext
22666 A <ref>foo</ref>
22667 B <ref name="x">foo</ref>
22668 C <ref name="y" />
22669 <references />
22670 !! html/parsoid
22671 <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>
22672 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>
22673 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>
22674 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22675 <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>
22676 <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>
22677 <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>
22678 </ol>
22679 !!end
22680
22681 !!test
22682 Ref: 2. ref-tags with identical names should all get the same index
22683 !! wikitext
22684 A <ref name="x">foo</ref>
22685 B <ref name="x" />
22686 <references />
22687 !! html/parsoid
22688 <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>
22689 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>
22690 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22691 <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>
22692 </ol>
22693 !!end
22694
22695 !!test
22696 Ref: 3. spaces in ref-names should be ignored
22697 !! wikitext
22698 A <ref name="x">foo</ref>
22699 B <ref name=" x " />
22700 C <ref name= x />
22701 <references />
22702 !! html/parsoid
22703 <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>
22704 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>
22705 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>
22706 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22707 <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>
22708 </ol>
22709 !!end
22710
22711 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22712 !!test
22713 Ref: 4. 'constructor' should be accepted as a valid ref-name
22714 !! wikitext
22715 A <ref name="constructor">foo</ref>
22716 <references />
22717 !! html/parsoid
22718 <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>
22719 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22720 <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>
22721 </ol>
22722 !!end
22723
22724 !!test
22725 Ref: 5. body should accept generic wikitext
22726 !! wikitext
22727 A <ref>
22728 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22729 </ref>
22730
22731 <references />
22732 !! html/parsoid
22733 <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>
22734
22735 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22736 <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>
22737 </span></li>
22738 </ol>
22739 !!end
22740
22741 !!test
22742 Ref: 6. indent-pres should not be output in ref-body
22743 !! wikitext
22744 A <ref>
22745 foo
22746 bar
22747 baz
22748 </ref>
22749
22750 <references />
22751 !! html/parsoid
22752 <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>
22753
22754 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22755 <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
22756 bar
22757 baz
22758 </span></li>
22759 </ol>
22760 !!end
22761
22762 !!test
22763 Ref: 7. No p-wrapping in ref-body
22764 !! wikitext
22765 A <ref>
22766 foo
22767
22768 bar
22769
22770
22771 baz
22772
22773
22774
22775 booz
22776 </ref>
22777
22778 <references />
22779 !! html/parsoid
22780 <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>
22781
22782 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22783 <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
22784
22785 bar
22786
22787
22788 baz
22789
22790
22791
22792 booz
22793 </span></li>
22794 </ol>
22795 !!end
22796
22797 !!test
22798 Ref: 8. transclusion wikitext has lower precedence
22799 !! wikitext
22800 A <ref> foo {{echo|</ref> B C}}
22801
22802 <references />
22803 !! html/parsoid
22804 <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>
22805 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22806 <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>
22807 </ol>
22808 !!end
22809
22810 !!test
22811 Ref: 9. unclosed comments should not leak out of ref-body
22812 !! wikitext
22813 A <ref> foo <!--</ref> B C
22814 <references />
22815 !! html/parsoid
22816 <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>
22817 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22818 <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>
22819 </ol>
22820 !!end
22821
22822 !!test
22823 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22824 !! wikitext
22825 A <ref> <b> foo </ref> B C
22826
22827 <references />
22828 !! html/parsoid
22829 <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>
22830
22831
22832 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22833 <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>
22834 </ol>
22835 !!end
22836
22837 !!test
22838 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22839 !! wikitext
22840 A <ref>foo</ref> B
22841 C <ref>bar</ref> D
22842 <references />
22843 !! html/parsoid
22844 <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
22845 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>
22846 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22847 <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>
22848 <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>
22849 </ol>
22850 !!end
22851
22852 !!test
22853 Ref: 12. ref-tags act as trailing newline migration barrier
22854 !! wikitext
22855 <!--the newline at the end of this line moves out of the p tag-->a
22856
22857 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22858 <ref />
22859
22860 c
22861 <references />
22862 !! html/parsoid
22863 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22864
22865
22866 <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>
22867 <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>
22868
22869 <p>c</p>
22870 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22871 <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>
22872 <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>
22873 !!end
22874
22875 !!test
22876 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22877 !! wikitext
22878 <ref>foo</ref> A
22879 <ref>bar
22880 </ref> B
22881 <references />
22882 !! html/parsoid
22883 <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
22884 <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>
22885 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22886 <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>
22887 <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
22888 </span></li>
22889 </ol>
22890 !!end
22891
22892 ## Roundtripping fails because of nowiki'ing
22893 !! test
22894 Ref: 14. A nested ref-tag should be emitted as plain text
22895 !! options
22896 parsoid=wt2html
22897 !! wikitext
22898 <ref>foo <ref>bar</ref> baz</ref>
22899
22900 <references />
22901 !! html/parsoid
22902 <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>
22903
22904 <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>
22905 !! end
22906
22907 !!test
22908 Ref: 15. ref-tags with identical names should get identical indexes
22909 !! wikitext
22910 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22911 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22912
22913 <references />
22914 !! html/parsoid
22915 <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>
22916 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>
22917
22918 <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>
22919 </ol>
22920 !!end
22921
22922 ## We don't bother wt2wt-ing non-standard whitespace
22923 !!test
22924 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22925 !!options
22926 parsoid=wt2html
22927 !! wikitext
22928 A <ref >foo</ref >
22929
22930 <references />
22931 !! html/parsoid
22932 <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>
22933 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22934 <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>
22935 !!end
22936
22937 !!test
22938 Ref: 17. Generate valid HTML5 id/about attributes
22939 !!wikitext
22940 <ref name="a b">foo</ref>
22941 <ref name=":0">ve-created name</ref>
22942
22943 <references />
22944 !!html/parsoid
22945 <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>
22946 <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>
22947
22948 <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>
22949
22950 !!end
22951
22952 !!test
22953 Ref: 18. T58916: Extension attributes should be parsed as plain text
22954 !!wikitext
22955 <ref name="{{echo|a}}">foo</ref>
22956
22957 <references />
22958 !!html/parsoid
22959 <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>
22960 </p>
22961
22962 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22963 <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>
22964 </ol>
22965 !!end
22966
22967 !!test
22968 Ref: 19. ref-tags with identical name encodings should get identical indexes
22969 !! wikitext
22970 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22971
22972 <references />
22973 !! html/parsoid
22974 <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>
22975 </p>
22976 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22977 <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>
22978 </ol>
22979 !!end
22980
22981 !!test
22982 Ref: 20. ref-tags with identical names but different content should keep it
22983 !! wikitext
22984 A <ref name="foo">Foo one</ref>
22985 B <ref name="foo">Foo two</ref>
22986 C <ref name="foo" />
22987
22988 <references />
22989 !! html/parsoid
22990 <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>
22991 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>
22992 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>
22993
22994 <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>
22995 </ol>
22996 !!end
22997
22998 !!test
22999 References: 1. references tag without any refs should be handled properly
23000 !! wikitext
23001 <references />
23002 !! html/parsoid
23003 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
23004 !!end
23005
23006 !!test
23007 References: 2. references tag with group only outputs references from that group
23008 !! wikitext
23009 A <ref group="a">foo</ref>
23010 B <ref group="b">bar</ref>
23011 C <ref>baz</ref>
23012
23013 <references group="a" />
23014 <references />
23015 <references group="b" />
23016 !! html/parsoid
23017 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="./Main_Page#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
23018 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>
23019 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>
23020
23021 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
23022 <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>
23023 </ol>
23024 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
23025 <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>
23026 </ol>
23027 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
23028 <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>
23029 </ol>
23030 !!end
23031
23032 !!test
23033 References: 3. ref list should be cleared after processing references
23034 !! wikitext
23035 A <ref>foo</ref>
23036
23037 <references />
23038
23039 B <ref>bar</ref>
23040
23041 <references />
23042 !! html/parsoid
23043 <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>
23044
23045 <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>
23046 </ol>
23047
23048 <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>
23049
23050 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
23051 <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>
23052 </ol>
23053 !!end
23054
23055 !!test
23056 References: 4. only referenced group should be cleared after processing references
23057 !! wikitext
23058 A <ref group="a">afoo</ref>
23059 B <ref>bfoo</ref>
23060
23061 <references group="a" />
23062
23063 C <ref>cfoo</ref>
23064
23065 <references />
23066 !! html/parsoid
23067 <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>
23068 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>
23069
23070 <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>
23071 </ol>
23072
23073 <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>
23074
23075 <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>
23076 </ol>
23077 !!end
23078
23079 ## Don't expect this to rt since we're dropping content
23080 !! test
23081 References: 5. ref tags in references should be processed while ignoring all other content
23082 !! options
23083 parsoid=wt2html,html2html
23084 !! wikitext
23085 A <ref name="a" />
23086 B <ref name="b">bar</ref>
23087
23088 <references>
23089 <ref name="a">foo</ref>
23090 This should just get lost.
23091 </references>
23092 !! html/parsoid
23093 <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>
23094 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>
23095
23096
23097 <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>
23098 </ol>
23099 !! end
23100
23101 !! test
23102 References: 6. <references /> from a transclusion
23103 !! wikitext
23104 <ref>Foo</ref> {{echo|<references />}}
23105 !! html/parsoid
23106 <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>
23107 </ol>
23108 !! end
23109
23110 !! test
23111 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
23112 !! wikitext
23113 A <ref>foo bar for a</ref>
23114 B <ref group="X" name="b" />
23115
23116 <references />
23117
23118 <references group="X">
23119 <ref name="b">foo</ref>
23120 </references>
23121 !! html/parsoid
23122 <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>
23123 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>
23124 </p>
23125
23126 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
23127 <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>
23128 </ol>
23129
23130 <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"}}'>
23131 <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>
23132 </ol>
23133 !! end
23134
23135 !! test
23136 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
23137 !! wikitext
23138 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
23139 <references />
23140 !! html/parsoid
23141 <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>
23142 <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>
23143 </ol>
23144 !!end
23145
23146 # This test only works in wt2html now as the <references /> are always generated
23147 # unless selser is active. Once T72722 is fixed, we should add a changes test
23148 # here to ensure that unrelated changes don't add the new <references />
23149 # when selser is active.
23150 !! test
23151 References: 9. Generate missing references list at the end
23152 !! wikitext
23153 A <ref>foo</ref>
23154 B <ref group="inexistent">bar</ref>
23155 !! html/parsoid
23156 <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>
23157 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
23158 <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>
23159 </ol>
23160 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
23161 <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>
23162 </ol>
23163 !! end
23164
23165 !! test
23166 References: 10. New <references/> shouldn't be added for unrelated edits.
23167 !! options
23168 parsoid={
23169 "modes": ["selser"],
23170 "changes": [["#x", "remove"]],
23171 "selser": "noauto"
23172 }
23173 !! wikitext
23174 Unrelated text<span id="x"> that's going to disappear</span>.
23175 A <ref>foo</ref>
23176 !! wikitext/edited
23177 Unrelated text.
23178 A <ref>foo</ref>
23179 !!end
23180
23181 !! test
23182 Entities in ref name
23183 !! wikitext
23184 <ref name="test &amp; me">hi</ref>
23185 <references />
23186 !! html/parsoid
23187 <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>
23188 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23189 <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>
23190 </ol>
23191 !! end
23192
23193 ## The output here may look funny, but it's what the php parser will do. The
23194 ## unclosed references tag becomes escaped text, and then a new references
23195 ## tag is auto-generated. The test is wt2html only because it roundtrips with
23196 ## nowiki tags, and the auto-generated references tag is only dropped in
23197 ## rtTestMode.
23198 !! test
23199 Generate references for unclosed references tag
23200 !! options
23201 parsoid=wt2html
23202 !! wikitext
23203 a<ref>foo</ref>
23204
23205 <references>
23206 !! html/parsoid
23207 <p>a<span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
23208
23209 <p>&lt;references></p>
23210 <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>
23211 !! end
23212
23213 !! test
23214 New reference serializes on its own line
23215 !! options
23216 parsoid=wt2wt,html2wt
23217 !! wikitext
23218 foo
23219 <references />
23220 !! html/parsoid
23221 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
23222 !! end
23223
23224 #### ----------------------------------------------------------------
23225 #### Parsoid-only testing of Parsoid's impl of LST
23226 #### Not implemented yet, see
23227 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
23228 #### ----------------------------------------------------------------
23229
23230 ## We still need to support serializing the older format while content is stored.
23231 !! test
23232 LST Sections: Backwards compatibility
23233 !! options
23234 parsoid={
23235 "suppressErrors": true,
23236 "modes": ["html2wt"]
23237 }
23238 !! wikitext
23239 <section begin="2011-05-16" />
23240 <section end="2014-04-10 (MW 1.23wmf22)" />
23241 !! html/parsoid
23242 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
23243 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
23244 !! end
23245
23246 ## The unconventional output is the result of `usePHPPreProcessor` being
23247 ## disabled in parserTests.js. This test is mainly just to show <section> is
23248 ## recognized as an extension tag w/o a native handler.
23249 !! test
23250 LST Sections: Newfangled approach
23251 !! options
23252 parsoid={ "suppressErrors": true }
23253 !! wikitext
23254 <section begin="2011-05-16" />
23255 <section end="2014-04-10 (MW 1.23wmf22)" />
23256 !! html/parsoid
23257 <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>
23258 <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>
23259 !! end
23260
23261 #--------- Test stripping of empty nodes in template content ----------
23262 !!test
23263 Empty LI and TR nodes should be stripped from template content
23264 !!wikitext
23265 {{EmptyLITest}}
23266 {{EmptyTRTest}}
23267 !!html/parsoid
23268 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
23269 <li>a</li>
23270 <li>b</li>
23271 </ul>
23272 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
23273 <tbody>
23274 <tr>
23275 <td>foo</td>
23276 </tr>
23277 <tr>
23278 <td>bar</td>
23279 </tr>
23280 </tbody>
23281 </table>
23282 !!end
23283
23284 !!test
23285 Empty LI and TR nodes should not be stripped from top-level content
23286 !!wikitext
23287 * a
23288 *
23289 * b
23290 {|
23291 |-
23292 |-
23293 |foo
23294 |}
23295 !!html/parsoid
23296 <ul>
23297 <li> a</li>
23298 <li></li>
23299 <li> b</li>
23300 </ul>
23301 <table>
23302 <tbody>
23303 <tr></tr>
23304 <tr>
23305 <td>foo</td>
23306 </tr>
23307 </tbody>
23308 </table>
23309 !!end
23310
23311 !!test
23312 Empty TR nodes should not be stripped if they have any attributes set
23313 !!wikitext
23314 {{EmptyTRWithHTMLAttrTest}}
23315 !!html/parsoid
23316 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
23317 <tr align="center"></tr>
23318 <tr><td>foo</td></tr>
23319 <tr align="center"></tr>
23320 <tr><td>bar</td></tr>
23321 </table>
23322 !!end
23323
23324 #### ----------------------------------------------------------------
23325 #### The following section of tests are primarily to test
23326 #### wikitext escaping capabilities of Parsoid. Given that
23327 #### escaping can be done any number of ways, the wikitext (input)
23328 #### is always adjusted to reflect how Parsoid adds nowiki
23329 #### escape tags.
23330 ####
23331 #### We are marking several tests as parsoid-only since the
23332 #### HTML in the result section is different from what the
23333 #### PHP parser generates for it.
23334 #### ----------------------------------------------------------------
23335
23336
23337 #### --------------- Headings ---------------
23338 #### 0. Unnested
23339 #### 1. Nested inside html <h1>=foo=</h1>
23340 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
23341 #### 3. Nested inside html with wikitext split by html tags
23342 #### 4. No escape needed
23343 #### 5. Empty headings <h1></h1>
23344 #### 6. Heading chars in SOL context
23345 #### ----------------------------------------
23346 !! test
23347 Headings: 0. Unnested
23348 !! options
23349 parsoid=html2wt
23350 !! html/parsoid
23351 <p>=foo=</p>
23352
23353 <p> =foo=
23354 <!--cmt-->
23355 =foo=</p>
23356
23357 <p>=foo<i>a</i>=</p>
23358 !! wikitext
23359 <nowiki>=foo=</nowiki>
23360
23361 <nowiki> </nowiki>=foo=
23362 <!--cmt-->
23363 <nowiki>=foo=</nowiki>
23364
23365 =foo''a''<nowiki>=</nowiki>
23366 !!end
23367
23368 # New headings and existing headings are handled differently
23369 !! test
23370 Headings: 1. Nested inside html
23371 !! options
23372 parsoid=html2wt
23373 !! html/parsoid
23374 <h1>=foo=</h1>
23375 <h2>=foo=</h2>
23376 <h3>=foo=</h3>
23377
23378 <h1 data-parsoid=''>=foo=</h1>
23379 <h2 data-parsoid=''>=foo=</h2>
23380 <h3 data-parsoid=''>=foo=</h3>
23381 <h4 data-parsoid=''>=foo=</h4>
23382 <h5 data-parsoid=''>=foo=</h5>
23383 <h6 data-parsoid=''>=foo=</h6>
23384 !! wikitext
23385 = =foo= =
23386
23387 == =foo= ==
23388
23389 === =foo= ===
23390
23391 =<nowiki>=foo=</nowiki>=
23392 ==<nowiki>=foo=</nowiki>==
23393 ===<nowiki>=foo=</nowiki>===
23394 ====<nowiki>=foo=</nowiki>====
23395 =====<nowiki>=foo=</nowiki>=====
23396 ======<nowiki>=foo=</nowiki>======
23397
23398 !!end
23399
23400 !! test
23401 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
23402 !! options
23403 parsoid=html2wt
23404 !! html/parsoid
23405 <h1>foo</h1>*bar
23406 <h1>foo</h1>=bar
23407 <h1>foo</h1>=bar=
23408 !! wikitext
23409 = foo =
23410 <nowiki>*</nowiki>bar
23411
23412 = foo =
23413 =bar
23414
23415 = foo =
23416 <nowiki>=bar=</nowiki>
23417 !!end
23418
23419 !! test
23420 Headings: 3. Nested inside html with wikitext split by html tags
23421 !! options
23422 parsoid=html2wt
23423 !! html/parsoid
23424 <h1>=<b>bold</b>foo=</h1>
23425 !! wikitext
23426 = ='''bold'''foo= =
23427 !!end
23428
23429 !! test
23430 Headings: 4a. No escaping needed (testing just h1 and h2)
23431 !! options
23432 parsoid=html2wt
23433 !! html/parsoid
23434 <h1>=foo</h1>
23435 <h1>foo=</h1>
23436 <h1> =foo= </h1>
23437 <h1>=foo= bar</h1>
23438 <h2>=foo</h2>
23439 <h2>foo=</h2>
23440 <h1>=</h1>
23441 <h1><i>=</i>foo=</h1>
23442 !! wikitext
23443 = =foo =
23444
23445 = foo= =
23446
23447 = =foo= =
23448
23449 = =foo= bar =
23450
23451 == =foo ==
23452
23453 == foo= ==
23454
23455 = = =
23456
23457 = ''=''foo= =
23458 !!end
23459
23460 !! test
23461 Headings: 4b. No escaping needed (inside p-tags)
23462 !! options
23463 parsoid=html2wt
23464 !! html/parsoid
23465 <p>===
23466 =foo= x
23467 =foo= <s></s>
23468 </p>
23469 !! wikitext
23470 ===
23471 =foo= x
23472 =foo= <s></s>
23473 !!end
23474
23475 !! test
23476 Headings: 5. Empty headings
23477 !! options
23478 parsoid=html2wt
23479 !! html/parsoid
23480 <h1 data-parsoid='{}'></h1>
23481
23482 <h2 data-parsoid='{}'></h2>
23483
23484 <h3 data-parsoid='{}'></h3>
23485
23486 <h4 data-parsoid='{}'></h4>
23487
23488 <h5 data-parsoid='{}'></h5>
23489
23490 <h6 data-parsoid='{}'></h6>
23491 !! wikitext
23492 =<nowiki/>=
23493
23494 ==<nowiki/>==
23495
23496 ===<nowiki/>===
23497
23498 ====<nowiki/>====
23499
23500 =====<nowiki/>=====
23501
23502 ======<nowiki/>======
23503 !!end
23504
23505 !! test
23506 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23507 !! options
23508 parsoid=html2wt
23509 !! html/parsoid
23510 <p>=a=</p>
23511
23512 <p>=a=</p>
23513
23514 <p>=a=</p>
23515 !! wikitext
23516 <nowiki>=a=</nowiki>
23517
23518 <nowiki>=a=</nowiki>
23519
23520 <nowiki>=a=</nowiki>
23521 !!end
23522
23523 !! test
23524 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23525 !! options
23526 parsoid=html2wt
23527 !! html/parsoid
23528 <p>=a=
23529 b</p>
23530
23531 <p>=a=
23532 b</p>
23533
23534 <p>=a=
23535 b</p>
23536 !! wikitext
23537 <nowiki>=a=</nowiki>
23538 b
23539
23540 <nowiki>=a=</nowiki>
23541 b
23542
23543 <nowiki>=a=</nowiki>
23544 b
23545 !!end
23546
23547 !! test
23548 Headings: 6c. Heading chars in SOL context (leading newline break)
23549 !! options
23550 parsoid=html2wt
23551 !! html/parsoid
23552 <p>a
23553 =b=</p>
23554 !! wikitext
23555 a
23556 <nowiki>=b=</nowiki>
23557 !!end
23558
23559 !! test
23560 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23561 !! options
23562 parsoid=html2wt
23563 !! html/parsoid
23564 <!--c0--><p>=a=</p>
23565
23566 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23567 !! wikitext
23568 <!--c0--><nowiki>=a=</nowiki>
23569
23570 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23571 !!end
23572
23573 !! test
23574 Headings: 6d. Heading chars in SOL context (No escaping needed)
23575 !! options
23576 parsoid=html2wt
23577 !! html/parsoid
23578 =a=<div>b</div>
23579 !! wikitext
23580 =a=<div>b</div>
23581 !!end
23582
23583 !! test
23584 Headings: 7. Insert a newline between new content and headings
23585 !! options
23586 parsoid=html2wt
23587 !! html/parsoid
23588 <h2>NEW</h2>
23589 <p>new</p>
23590 <h2 data-parsoid='{}'>A</h2>
23591 <p data-parsoid='{}'>a</p>
23592 !! wikitext
23593 == NEW ==
23594 new
23595
23596 ==A==
23597 a
23598
23599 !! end
23600
23601 #### --------------- Lists ---------------
23602 #### 0. Outside nests (*foo, etc.)
23603 #### 1. Nested inside html <ul><li>*foo</li></ul>
23604 #### 2. Inside definition lists
23605 #### 3. Only bullets at start should be escaped
23606 #### 4. No escapes needed
23607 #### 5. No unnecessary escapes
23608 #### 6. Escape bullets in SOL position
23609 #### 7. Escape bullets in a multi-line context
23610 #### ----------------------------------------
23611
23612 !! test
23613 Lists: 0. Outside nests
23614 !! options
23615 parsoid=html2wt
23616 !! html/parsoid
23617 <p>*foo</p>
23618
23619 <p>#foo</p>
23620
23621 <p>;Foo:bar</p>
23622 !! wikitext
23623 <nowiki>*</nowiki>foo
23624
23625 <nowiki>#</nowiki>foo
23626
23627 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23628 !!end
23629
23630 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23631 ## to test wikitext escaping, and insignificant whitespace diffs
23632 ## cause PHP parser tests to barf
23633 !! test
23634 Lists: 1. Nested inside html (No unnecessary escapes)
23635 !! options
23636 parsoid=html2wt
23637 !! html/parsoid
23638 <ul>
23639 <li>*foo</li>
23640 <li>#foo</li>
23641 <li>:foo</li>
23642 <li>;foo</li>
23643 <li data-parsoid='{}'>*foo</li>
23644 <li data-parsoid='{}'>#foo</li>
23645 <li data-parsoid='{}'>:foo</li>
23646 <li data-parsoid='{}'>;foo</li>
23647 </ul>
23648
23649 <ol>
23650 <li>*foo</li>
23651 <li>#foo</li>
23652 <li>:foo</li>
23653 <li>;foo</li>
23654 <li data-parsoid='{}'>*foo</li>
23655 <li data-parsoid='{}'>#foo</li>
23656 <li data-parsoid='{}'>:foo</li>
23657 <li data-parsoid='{}'>;foo</li>
23658 </ol>
23659 !! wikitext
23660 * *foo
23661 * #foo
23662 * :foo
23663 * ;foo
23664 *<nowiki>*foo</nowiki>
23665 *<nowiki>#foo</nowiki>
23666 *<nowiki>:foo</nowiki>
23667 *<nowiki>;foo</nowiki>
23668
23669 # *foo
23670 # #foo
23671 # :foo
23672 # ;foo
23673 #<nowiki>*foo</nowiki>
23674 #<nowiki>#foo</nowiki>
23675 #<nowiki>:foo</nowiki>
23676 #<nowiki>;foo</nowiki>
23677 !!end
23678
23679 !! test
23680 Lists: 2. Inside definition lists
23681 !! options
23682 parsoid=html2wt
23683 !! html/parsoid
23684 <dl><dt>;foo</dt></dl>
23685 <dl><dt>:foo</dt></dl>
23686 <dl><dt>:foo</dt>
23687 <dd>bar</dd></dl>
23688 <dl><dd>:foo</dd></dl>
23689 !! wikitext
23690 ; ;foo
23691
23692 ; <nowiki>:foo</nowiki>
23693
23694 ; <nowiki>:foo</nowiki>
23695 : bar
23696
23697 : :foo
23698 !!end
23699
23700 !! test
23701 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23702 !! options
23703 parsoid=html2wt
23704 !! html/parsoid
23705 <ul>
23706 <li>*foo*bar</li>
23707 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23708 </ul>
23709 !! wikitext
23710 * *foo*bar
23711 *<nowiki>*foo</nowiki>''it''*bar
23712 !!end
23713
23714 !! test
23715 Lists: 4. No escapes needed
23716 !! options
23717 parsoid=html2wt
23718 !! html/parsoid
23719 <ul>
23720 <li>foo*bar
23721 </li>
23722 </ul>
23723 <ul>
23724 <li><i>foo</i>*bar
23725 </li>
23726 </ul>
23727 <ul>
23728 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23729 </li>
23730 </ul>
23731 <ul>
23732 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23733 </li>
23734 </ul>
23735 !! wikitext
23736 *foo*bar
23737
23738 *''foo''*bar
23739
23740 *[[Foo]]: bar
23741
23742 *[[Foo]]*bar
23743 !!end
23744
23745 !! test
23746 Lists: 5. No unnecessary escapes
23747 !! options
23748 parsoid=html2wt
23749 !! html/parsoid
23750 <ul><li> bar <span>[[foo]]</span></li></ul>
23751 <ul><li> =bar <span>[[foo]]</span></li></ul>
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> <s></s>: a</li></ul>
23756 <ul><li> <i>* foo</i></li></ul>
23757
23758 !! wikitext
23759 * bar <span><nowiki>[[foo]]</nowiki></span>
23760
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>foo]]</span>=
23768
23769 * <s></s>: a
23770
23771 * ''* foo''
23772 !!end
23773
23774 !! test
23775 Lists: 6. Escape bullets in SOL position
23776 !! options
23777 parsoid=html2wt
23778 !! html/parsoid
23779 <p><!--cmt-->*foo</p>
23780 !! wikitext
23781 <!--cmt--><nowiki>*</nowiki>foo
23782 !!end
23783
23784 !! test
23785 Lists: 7. Escape bullets in a multi-line context
23786 !! options
23787 parsoid=html2wt
23788 !! html/parsoid
23789 <p>a
23790 *b
23791 </p>
23792 !! wikitext
23793 a
23794 <nowiki>*</nowiki>b
23795 !!end
23796
23797 !! test
23798 Lists: 8. Escape colons only if not present in tags
23799 !! options
23800 parsoid=html2wt
23801 !! html/parsoid
23802 <dl><dt>a:b<i>c:d</i></dt></dl>
23803 !! wikitext
23804 ; <nowiki>a:b</nowiki>''c:d''
23805 !! end
23806
23807 #### --------------- HRs ---------------
23808 #### 1. Single line
23809 #### -----------------------------------
23810
23811 !! test
23812 HRs: 1. Single line
23813 !! options
23814 parsoid=html2wt
23815 !! html/parsoid
23816 <hr />----
23817 <hr />=foo=
23818 <hr />*foo
23819 !! wikitext
23820 ----<nowiki>----</nowiki>
23821 ----=foo=
23822 ----*foo
23823 !! end
23824
23825 #### --------------- Tables ---------------
23826 #### 1a. Simple example
23827 #### 1b. No escaping needed (!foo)
23828 #### 1c. No escaping needed (|foo)
23829 #### 1d. No escaping needed (|}foo)
23830 ####
23831 #### 2a. Nested in td (<td>foo|bar</td>)
23832 #### 2b. Nested in td (<td>foo||bar</td>)
23833 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23834 ####
23835 #### 3a. Nested in th (<th>foo!bar</th>)
23836 #### 3b. Nested in th (<th>foo!!bar</th>)
23837 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23838 ####
23839 #### 4a. Escape -
23840 #### 4b. Escape +
23841 #### 4c. No escaping needed
23842 #### --------------------------------------
23843
23844 !! test
23845 Tables: 1a. Simple example
23846 !! options
23847 parsoid=html2wt
23848 !! html/parsoid
23849 <p>{|
23850 |}
23851 </p>
23852 !! wikitext
23853 <nowiki>{|</nowiki>
23854 |}
23855 !! end
23856
23857 !! test
23858 Tables: 1b. No escaping needed
23859 !! options
23860 parsoid=html2wt
23861 !! html/parsoid
23862 <p>!foo
23863 </p>
23864 !! wikitext
23865 !foo
23866 !! end
23867
23868 !! test
23869 Tables: 1c. No escaping needed
23870 !! options
23871 parsoid=html2wt
23872 !! html/parsoid
23873 <p>|foo
23874 </p>
23875 !! wikitext
23876 |foo
23877 !! end
23878
23879 !! test
23880 Tables: 1d. No escaping needed
23881 !! options
23882 parsoid=html2wt
23883 !! html/parsoid
23884 <p>|}foo
23885 </p>
23886 !! wikitext
23887 |}foo
23888 !! end
23889
23890 !! test
23891 Tables: 2a. Nested in td
23892 !! options
23893 parsoid=html2wt
23894 !! html/parsoid
23895 <table><tbody><tr>
23896 <td>foo|bar</td></tr>
23897 <tr><td>x<div>a|b</div></td>
23898 </tbody></table>
23899 !! wikitext
23900 {|
23901 |<nowiki>foo|bar</nowiki>
23902 |-
23903 |x<div><nowiki>a|b</nowiki></div>
23904 |}
23905 !! html/php+tidy
23906 <table>
23907 <tr>
23908 <td>foo|bar</td>
23909 </tr>
23910 <tr>
23911 <td>x
23912 <div>a|b</div>
23913 </td>
23914 </tr>
23915 </table>
23916 !! end
23917
23918 !! test
23919 Tables: 2b. Nested in td
23920 !! options
23921 parsoid=html2wt
23922 !! html/parsoid
23923 <table><tbody><tr>
23924 <td>foo||bar</td>
23925 <td>a<i>b||c</i></td>
23926 <td>a<i><div>b||c</div></i></td>
23927 </tr></tbody></table>
23928 !! wikitext
23929 {|
23930 |<nowiki>foo||bar</nowiki>
23931 |a''<nowiki>b||c</nowiki>''
23932 |a''<div><nowiki>b||c</nowiki></div>''
23933 |}
23934 !! html/php
23935 <table>
23936 <tr>
23937 <td>foo||bar
23938 </td>
23939 <td>a<i>b||c</i>
23940 </td>
23941 <td>a<i><div>b||c</div></i>
23942 </td></tr></table>
23943
23944 !! end
23945
23946 !! test
23947 Tables: 2c. Nested in td -- no escaping needed
23948 !! options
23949 parsoid=html2wt
23950 !! html/*
23951 <table>
23952 <tr>
23953 <td>foo!!bar
23954 </td></tr></table>
23955
23956 !! wikitext
23957 {|
23958 |foo!!bar
23959 |}
23960 !! end
23961
23962 !! test
23963 Tables: 3a. Nested in th
23964 !! options
23965 parsoid=html2wt
23966 !! html/*
23967 <table>
23968 <tr>
23969 <th>foo!bar
23970 </th></tr></table>
23971
23972 !! wikitext
23973 {|
23974 !foo!bar
23975 |}
23976 !! end
23977
23978 !! test
23979 Tables: 3b. Nested in th
23980 !! options
23981 parsoid=html2wt
23982 !! html/parsoid
23983 <table><tbody>
23984 <tr><th>foo!!bar</th>
23985 <th><i>foo|bar</i></th>
23986 <th><i>foo!!bar</i></th>
23987 <th><i><span>foo!!bar</span></i></th>
23988 </tr></tbody></table>
23989 !! wikitext
23990 {|
23991 !<nowiki>foo!!bar</nowiki>
23992 !''<nowiki>foo|bar</nowiki>''
23993 !''<nowiki>foo!!bar</nowiki>''
23994 !''<span><nowiki>foo!!bar</nowiki></span>''
23995 |}
23996 !! html/php
23997 <table>
23998 <tr>
23999 <th>foo!!bar
24000 </th>
24001 <th><i>foo|bar</i>
24002 </th>
24003 <th><i>foo!!bar</i>
24004 </th>
24005 <th><i><span>foo!!bar</span></i>
24006 </th></tr></table>
24007
24008 !! end
24009
24010 !! test
24011 Tables: 3c. Nested in th
24012 !! options
24013 parsoid=html2wt
24014 !! html/parsoid
24015 <table><tbody>
24016 <tr><th>foo||bar</th>
24017 <th><span typeof="mw:Nowiki">foo||bar</span></th>
24018 </tr></tbody></table>
24019 !! wikitext
24020 {|
24021 !<nowiki>foo||bar</nowiki>
24022 !<nowiki>foo||bar</nowiki>
24023 |}
24024 !! html/php
24025 <table>
24026 <tr>
24027 <th>foo||bar
24028 </th>
24029 <th>foo||bar
24030 </th></tr></table>
24031
24032 !! end
24033
24034 !! test
24035 Tables: 4a. Escape -
24036 !! options
24037 parsoid=html2wt
24038 !! html/*
24039 <table>
24040 <tr>
24041 <th>-bar
24042 </th></tr>
24043 <tr>
24044 <td>-bar
24045 </td></tr></table>
24046
24047 !! wikitext
24048 {|
24049 !-bar
24050 |-
24051 |<nowiki>-bar</nowiki>
24052 |}
24053 !! end
24054
24055 !! test
24056 Tables: 4b. Escape +
24057 !! options
24058 parsoid=html2wt
24059 !! html/*
24060 <table>
24061 <tr>
24062 <th>+bar
24063 </th></tr>
24064 <tr>
24065 <td>+bar
24066 </td></tr></table>
24067
24068 !! wikitext
24069 {|
24070 !+bar
24071 |-
24072 |<nowiki>+bar</nowiki>
24073 |}
24074 !! end
24075
24076 !! test
24077 Tables: 4c. No escaping needed
24078 !! options
24079 parsoid=html2wt
24080 !! html/parsoid
24081 <table><tbody>
24082 <tr><td>foo-bar</td><td>foo+bar</td></tr>
24083 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
24084 <tr><td>foo
24085 <p>bar|baz
24086 +bar
24087 -bar</p></td></tr>
24088 <tr><td>x
24089 <div>a|b</div></td>
24090 </tbody></table>
24091 !! wikitext
24092 {|
24093 |foo-bar
24094 |foo+bar
24095 |-
24096 |''foo''-bar
24097 |''foo''+bar
24098 |-
24099 |foo
24100 bar|baz
24101 +bar
24102 -bar
24103 |-
24104 |x
24105 <div>a|b</div>
24106 |}
24107 !! html/php
24108 <table>
24109 <tr>
24110 <td>foo-bar
24111 </td>
24112 <td>foo+bar
24113 </td></tr>
24114 <tr>
24115 <td><i>foo</i>-bar
24116 </td>
24117 <td><i>foo</i>+bar
24118 </td></tr>
24119 <tr>
24120 <td>foo
24121 <p>bar|baz
24122 +bar
24123 -bar
24124 </p>
24125 </td></tr>
24126 <tr>
24127 <td>x
24128 <div>a|b</div>
24129 </td></tr></table>
24130
24131 !! end
24132
24133 !! test
24134 Tables: 4d. No escaping needed
24135 !! options
24136 parsoid=html2wt
24137 !! html/parsoid
24138 <table>
24139 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
24140 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
24141 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
24142 </tbody></table>
24143 !! wikitext
24144 {|
24145 |[[Foo]]-bar
24146 ||+1
24147 ||-2
24148 |}
24149 !! html/php
24150 <table>
24151 <tr>
24152 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
24153 </td>
24154 <td>+1
24155 </td>
24156 <td>-2
24157 </td></tr></table>
24158
24159 !! end
24160
24161 !! test
24162 T97430: Don't emit empty nowiki pairs around marker meta tags
24163 !! options
24164 parsoid=html2wt
24165 !! html/parsoid
24166 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24167 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
24168 !! wikitext
24169 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24170 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
24171 !! end
24172
24173 !! test
24174 Unclosed xmlish element in table line shouldn't eat end delimiters
24175 !! options
24176 parsoid=html2wt
24177 !! html/parsoid
24178 <table>
24179 <tbody><tr><td> &lt;foo</td>
24180 <td> bar></td></tr>
24181 </tbody></table>
24182 !! wikitext
24183 {|
24184 | <foo
24185 | bar>
24186 |}
24187 !! html/php
24188 <table>
24189 <tr>
24190 <td> &lt;foo
24191 </td>
24192 <td> bar&gt;
24193 </td></tr></table>
24194
24195 !! end
24196
24197 #### --------------- Links ----------------
24198 #### 1. Quote marks in link text
24199 #### 2. Wikilinks: Escapes needed
24200 #### 3. Wikilinks: No escapes needed
24201 #### 4. Extlinks: Escapes needed
24202 #### 5. Extlinks: No escapes needed
24203 #### --------------------------------------
24204 !! test
24205 Links 1. WikiLinks: No escapes needed
24206 !! options
24207 parsoid=html2wt
24208 !! html/parsoid
24209 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
24210 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
24211 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
24212 !! wikitext
24213 [[Foo|Foo''boo'']]
24214 [[Foo|[Foobar]]]
24215 [[Foo|x [Foobar] x]]
24216 !! html/php
24217 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
24218 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
24219 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
24220 </p>
24221 !! end
24222
24223 !! test
24224 Links 2. WikiLinks: Escapes needed
24225 !! options
24226 parsoid=html2wt
24227 !! html/parsoid
24228 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
24229 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
24230 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
24231 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
24232 <a href="Foo" rel="mw:WikiLink">|Bar</a>
24233 <a href="Foo" rel="mw:WikiLink">]]bar</a>
24234 <a href="Foo" rel="mw:WikiLink">[[bar</a>
24235 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
24236 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
24237 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
24238 !! wikitext
24239 [[Foo|<nowiki>Foobar]</nowiki>]]
24240 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
24241 [[Foo|<nowiki>[[Bar]]</nowiki>]]
24242 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
24243 [[Foo|<nowiki>|Bar</nowiki>]]
24244 [[Foo|<nowiki>]]bar</nowiki>]]
24245 [[Foo|<nowiki>[[bar</nowiki>]]
24246 [[Foo|<nowiki>x [[ y</nowiki>]]
24247 [[Foo|<nowiki>x ]] y</nowiki>]]
24248 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
24249 !! html/php
24250 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
24251 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
24252 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
24253 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
24254 <a href="/wiki/Foo" title="Foo">|Bar</a>
24255 <a href="/wiki/Foo" title="Foo">]]bar</a>
24256 <a href="/wiki/Foo" title="Foo">[[bar</a>
24257 <a href="/wiki/Foo" title="Foo">x [[ y</a>
24258 <a href="/wiki/Foo" title="Foo">x ]] y</a>
24259 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
24260 </p>
24261 !! end
24262
24263 !! test
24264 Links 3. WikiLinks: No escapes needed
24265 !! options
24266 parsoid=html2wt
24267 !! html/parsoid
24268 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
24269 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
24270 !! wikitext
24271 [[Foo|[Foobar]]
24272 [[Foo|foo|bar]]
24273 !! html/php
24274 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
24275 <a href="/wiki/Foo" title="Foo">foo|bar</a>
24276 </p>
24277 !! end
24278
24279 !! test
24280 Links 4. ExtLinks: Escapes needed
24281 !! options
24282 parsoid=html2wt
24283 !! html/parsoid
24284 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
24285 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
24286 <p>[http://google.com]</p>
24287 <p>[http://google.com google]</p>
24288 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
24289 <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>
24290 !! wikitext
24291 [http://google.com <nowiki>[google]</nowiki>]
24292 [http://google.com <nowiki>google]</nowiki>]
24293
24294 <nowiki>[http://google.com]</nowiki>
24295
24296 <nowiki>[http://google.com google]</nowiki>
24297
24298 [http://google.com<nowiki>]</nowiki>
24299
24300 [{{echo|http://google.com}}<nowiki>]</nowiki>
24301 !! html/php
24302 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
24303 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
24304 </p><p>[http://google.com]
24305 </p><p>[http://google.com google]
24306 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24307 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24308 </p>
24309 !! end
24310
24311 !! test
24312 Links 5. ExtLinks: No escapes needed
24313 !! options
24314 parsoid=html2wt
24315 !! html/parsoid
24316 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
24317 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
24318 !! wikitext
24319 [http://google.com [google]
24320
24321 [[http://google.com]]
24322 !! html/php
24323 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
24324 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
24325 </p>
24326 !! end
24327
24328 !! test
24329 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
24330 !! options
24331 parsoid=html2wt
24332 !! html/parsoid
24333 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
24334 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
24335 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
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>,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(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
24346 </p>
24347 !! wikitext
24348 x<nowiki/>http://example.com<nowiki/>y
24349 http://example.com<nowiki/>?x
24350 http://example.com<nowiki/>&x
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(x<nowiki/>)
24361 !! end
24362
24363 !! test
24364 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24365 !! options
24366 parsoid=html2wt
24367 !! html/parsoid
24368 <p>x
24369 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
24370 y
24371 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
24372 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
24373 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
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 </p>
24377 !! wikitext
24378 x
24379 http://example.com
24380 y
24381 "http://example.com"
24382 (http://example.com)
24383 (http://example.com) foo
24384 http://example.com,
24385 http://example.com, foo
24386 !! html/php
24387 <p>x
24388 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
24389 y
24390 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
24391 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
24392 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
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 </p>
24396 !! end
24397
24398 !! test
24399 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24400 !! options
24401 parsoid=html2wt
24402 !! html/parsoid
24403 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
24404 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
24405 !! wikitext
24406 http://example.com.,;:!?\
24407 -http://example.com:
24408 !! html/php
24409 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
24410 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
24411 </p>
24412 !! end
24413
24414 !! test
24415 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
24416 !! options
24417 parsoid=html2wt
24418 !! html/parsoid
24419 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
24420 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
24421 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
24422 !! wikitext
24423 RFC 123<nowiki/>4
24424 RFC 123<nowiki/>y
24425 X<nowiki/>RFC 123<nowiki/>y
24426 !! end
24427
24428 !! test
24429 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
24430 !! options
24431 parsoid=html2wt
24432 !! html/parsoid
24433 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24434 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24435 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24436 </p>
24437 !! wikitext
24438 RFC 123?foo
24439 RFC 123&foo
24440 -RFC 123-
24441 !! html/php
24442 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24443 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24444 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24445 </p>
24446 !! end
24447
24448 !! test
24449 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
24450 !! options
24451 parsoid=html2wt
24452 !! html/parsoid
24453 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24454 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24455 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24456 !! wikitext
24457 PMID 123<nowiki/>4
24458 PMID 123<nowiki/>y
24459 X<nowiki/>PMID 123<nowiki/>y
24460 !! end
24461
24462 !! test
24463 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
24464 !! options
24465 parsoid=html2wt
24466 !! html/parsoid
24467 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24468 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24469 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24470 </p>
24471 !! wikitext
24472 PMID 123?foo
24473 PMID 123&foo
24474 -PMID 123-
24475 !! html/php
24476 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24477 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24478 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24479 </p>
24480 !! end
24481
24482 !! test
24483 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
24484 !! options
24485 parsoid=html2wt
24486 !! html/parsoid
24487 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24488 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24489 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24490 </p>
24491 !! wikitext
24492 ISBN 1234567890<nowiki/>1
24493 ISBN 1234567890<nowiki/>x
24494 a<nowiki/>ISBN 1234567890<nowiki/>b
24495 !! end
24496
24497 !! test
24498 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
24499 !! options
24500 parsoid=html2wt
24501 !! html/parsoid
24502 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24503 !! wikitext
24504 -ISBN 1234567890's
24505 !! html/php
24506 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24507 </p>
24508 !! end
24509
24510 !! test
24511 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24512 !! options
24513 parsoid=html2wt
24514 !! html/*
24515 <p>this is not a link: http://example.com
24516 </p>
24517 !! wikitext
24518 this is not a link: <nowiki>http://example.com</nowiki>
24519 !! end
24520
24521 !! test
24522 Links 15. Link trails can't become link prefixes.
24523 !! options
24524 language=is
24525 parsoid=html2wt
24526 !! html/parsoid
24527 <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>
24528 !! wikitext
24529 [[Söfnuður]]-[[00]]
24530 !! html/php
24531 <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>
24532 </p>
24533 !! end
24534
24535 #### --------------- Quotes ---------------
24536 #### 1. Quotes inside <b> and <i>
24537 #### 2. Link fragments separated by <i> and <b> tags
24538 #### 3. Link fragments inside <i> and <b>
24539 #### 4. No escaping needed
24540 #### --------------------------------------
24541 !! test
24542 1a. Quotes inside <b> and <i>
24543 !! options
24544 parsoid=html2wt
24545 !! html/*
24546 <p><i>'foo'</i>
24547 <i>''foo''</i>
24548 <i>'''foo'''</i>
24549 <i>foo</i>'s
24550 <b>'foo'</b>
24551 <b>''foo''</b>
24552 <b>'''foo'''</b>
24553 <b>foo'<i>bar'</i>baz</b>
24554 <b>foo</b>'s
24555 '<i>foo</i>
24556 <i>foo</i>'
24557 <i>foo'</i>'
24558 '<i>foo</i>'
24559 '<b>foo</b>
24560 <b>foo</b>'
24561 '<b>foo</b>'
24562 <i>fools'<span> errand</span></i>
24563 <i><span>fool</span>'s errand</i>
24564 '<i>foo</i> bar '<i>baz</i>
24565 a|!*#-:;+-~[]{}b'<i>x</i>
24566 </p>
24567 !! wikitext
24568 ''<nowiki/>'foo'''
24569 ''<nowiki>''foo''</nowiki>''
24570 ''<nowiki>'''foo'''</nowiki>''
24571 ''foo''<nowiki/>'s
24572 '''<nowiki/>'foo''''
24573 '''<nowiki>''foo''</nowiki>'''
24574 '''<nowiki>'''foo'''</nowiki>'''
24575 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24576 '''foo'''<nowiki/>'s
24577 '''foo''
24578 ''foo''<nowiki/>'
24579 ''foo'''<nowiki/>'
24580 '''foo''<nowiki/>'
24581 ''''foo'''
24582 '''foo'''<nowiki/>'
24583 ''''foo'''<nowiki/>'
24584 ''fools'<span> errand</span>''
24585 ''<span>fool</span>'s errand''
24586 '<nowiki/>''foo'' bar '''baz''
24587 a|!*#-:;+-~[]{}b'''x''
24588 !! end
24589
24590 !! test
24591 1b. Quotes inside <b> and <i> with other tags on same line
24592 !! options
24593 parsoid=html2wt
24594 !! html/parsoid
24595 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24596 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24597 <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>
24598 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24599 '<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>
24600 '<i>foo</i> <div title="name">test</div>
24601 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24602 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24603 <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>
24604 </ol>
24605 !! wikitext
24606 '''a'' foo ''[[bar]]''
24607 ''a''' foo ''[[bar]]''
24608 ''a''' foo '''{{echo|[[bar]]}}'''
24609 [[foo]] x'''[[bar]]''
24610 '''foo'' <ref>test</ref>
24611 '''foo'' <div title="name">test</div>
24612 '''foo'' and <br> bar
24613 <references />
24614 !! end
24615
24616 !! test
24617 2. Link fragments separated by <i> and <b> tags
24618 !! options
24619 parsoid=html2wt
24620 !! html/parsoid
24621 <p>[[<i>foo</i>hello]]</p>
24622 <p>[[<b>foo</b>hello]]</p>
24623 !! wikitext
24624 [[''foo''<nowiki>hello]]</nowiki>
24625
24626 [['''foo'''<nowiki>hello]]</nowiki>
24627 !! end
24628
24629 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24630 # this is one of the shortcomings of this format
24631 !! test
24632 3. Link fragments inside <i> and <b>
24633 !! options
24634 parsoid=html2wt
24635 !! html/parsoid
24636 <p><i>[[foo</i>]]</p>
24637 <p><b>[[foo</b>]]</p>
24638 !! wikitext
24639 ''[[foo''<nowiki>]]</nowiki>
24640
24641 '''[[foo'''<nowiki>]]</nowiki>
24642 !! end
24643
24644 !! test
24645 4. No escaping needed
24646 !! options
24647 options=html2wt
24648 !! html/parsoid
24649 <p>'<span><i>bar</i></span>'
24650 '<span><b>bar</b></span>'
24651 'a:b'foo
24652 </p>
24653 !! wikitext
24654 '<span>''bar''</span>'
24655 '<span>'''bar'''</span>'
24656 'a:b'foo
24657 !! end
24658
24659 #### ----------- Paragraphs ---------------
24660 #### 1. No unnecessary escapes
24661 #### --------------------------------------
24662
24663 !! test
24664 1. No unnecessary escapes
24665 !! options
24666 parsoid=html2wt
24667 !! html/parsoid
24668 <p>bar <span>[[foo]]</span>
24669 </p><p>=bar <span>[[foo]]</span>
24670 </p><p>[[bar <span>[[foo]]</span>
24671 </p><p>]]bar <span>[[foo]]</span>
24672 </p><p>=bar <span>foo]]</span>=
24673 </p>
24674 !! wikitext
24675 bar <span><nowiki>[[foo]]</nowiki></span>
24676
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>foo]]</span><nowiki>=</nowiki>
24684 !!end
24685
24686 #### ----------------------- PRE --------------------------
24687 #### 1. Leading whitespace in SOL context should be escaped
24688 #### ------------------------------------------------------
24689 !! test
24690 1. Leading whitespace in SOL context should be escaped
24691 !! options
24692 parsoid=html2wt
24693 !! html/parsoid
24694 <p> a</p>
24695
24696 <p> a</p>
24697
24698 <p> a(tab)</p>
24699
24700 <p> a
24701 <!--cmt-->
24702 a</p>
24703
24704 <p>a
24705 b</p>
24706
24707 <p>a
24708 b</p>
24709
24710 <p>a
24711 b</p>
24712 !! wikitext
24713 <nowiki> </nowiki>a
24714
24715 <nowiki> </nowiki> a
24716
24717 a(tab)
24718
24719 <nowiki> </nowiki> a
24720 <!--cmt-->
24721 <nowiki> </nowiki>a
24722
24723 a
24724 <nowiki> </nowiki>b
24725
24726 a
24727 b
24728
24729 a
24730 b
24731 !! html/php
24732 <p> a
24733 </p><p> a
24734 </p><p> a(tab)
24735 </p><p> a
24736 a
24737 </p><p>a
24738 b
24739 </p><p>a
24740 b
24741 </p><p>a
24742 b
24743 </p>
24744 !! end
24745
24746 !! test
24747 2. Leading whitespace in non-indent-pre contexts should not be escaped
24748 !! options
24749 parsoid=html2wt
24750 !! html/parsoid
24751 <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>
24752 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24753 <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>
24754 b</span></li>
24755 </ol>
24756 !! wikitext
24757 foo <ref>''a''
24758 b</ref>
24759 <references />
24760 !! end
24761
24762 !! test
24763 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24764 !! options
24765 parsoid=html2wt
24766 !! html/parsoid
24767 <blockquote>
24768 <p>
24769 a
24770 <span>b</span>
24771 c</p>
24772 </blockquote>
24773 !! wikitext
24774 <blockquote>
24775 a
24776 <span>b</span>
24777 c
24778 </blockquote>
24779 !! end
24780
24781 !! test
24782 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24783 !! options
24784 options=html2wt
24785 !! html/parsoid
24786 <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>
24787 !! wikitext
24788 [[File:Foobar.jpg|thumb|caption]]
24789 !! end
24790
24791 !! test
24792 5. Nowiki escaping should account for indent-pres
24793 !! options
24794 parsoid=html2wt
24795 !! html/parsoid
24796 <pre>==foo==</pre>
24797 !! wikitext
24798 ==foo==
24799 !! end
24800
24801 !!test
24802 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24803 !! options
24804 parsoid=html2wt
24805 !! html/parsoid
24806 <pre>
24807 * foo
24808 * bar
24809 </pre>
24810 !! wikitext
24811 * foo
24812 * bar
24813 !! end
24814
24815 #### --------------- Behavior Switches --------------------
24816
24817 !! test
24818 1. Valid behavior switches should be escaped
24819 !! options
24820 parsoid=html2wt
24821 !! html/parsoid
24822 __TOC__
24823 <i>__TOC__</i>
24824 !! wikitext
24825 <nowiki>__TOC__</nowiki>
24826 ''<nowiki>__TOC__</nowiki>''
24827 !! end
24828
24829 !! test
24830 2. Invalid behavior switches should not be escaped
24831 !! options
24832 parsoid=html2wt
24833 !! html/parsoid
24834 __TOO__
24835 __|__
24836 !! wikitext
24837 __TOO__
24838 __|__
24839 !! end
24840
24841 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24842 !! test
24843 Behavior switches should be SOL-transparent
24844 !! options
24845 parsoid=html2wt
24846 !! html/parsoid
24847 <meta property="mw:PageProp/toc" />
24848
24849 <!-- this one's bogus -->
24850 <pre>__TOO__</pre>
24851
24852 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24853
24854 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24855 !! wikitext
24856 __TOC__
24857
24858 <!-- this one's bogus -->
24859 __TOO__
24860
24861 __TOC__ foo
24862
24863 __TOC__
24864 bar
24865 !! end
24866
24867 #### --------------- HTML tags ---------------
24868 #### 1. a tags
24869 #### 2. other tags
24870 #### 3. multi-line html tag
24871 #### 4. extension tags
24872 #### -----------------------------------------
24873 !! test
24874 1. a tags
24875 !! options
24876 parsoid=html2wt
24877 !! html/parsoid
24878 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24879 !! wikitext
24880 <a href="http://google.com">google</a>
24881 !! end
24882
24883 !! test
24884 2. other tags
24885 !! options
24886 parsoid=html2wt
24887 !! html/parsoid
24888 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24889 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24890 <li> &lt;td&gt;</li></ul>
24891
24892 !! wikitext
24893 * <nowiki><div>foo</div></nowiki>
24894 * <nowiki><div style="color:red">foo</div></nowiki>
24895 * <nowiki><td></nowiki>
24896 !! end
24897
24898 !! test
24899 3. multi-line html tag
24900 !! options
24901 parsoid=html2wt
24902 !! html/parsoid
24903 <p>&lt;div
24904 &gt;foo&lt;/div
24905 &gt;
24906 </p>
24907 !! wikitext
24908 <nowiki><div
24909 >foo</div
24910 ></nowiki>
24911 !! end
24912
24913 !! test
24914 4. extension tags
24915 !! options
24916 parsoid=html2wt
24917 !! html/parsoid
24918 <p>&lt;ref&gt;foo&lt;/ref&gt;
24919 </p><p>&lt;ref&gt;bar
24920 </p><p>baz&lt;/ref&gt;
24921 </p>
24922 !! wikitext
24923 <nowiki><ref>foo</ref></nowiki>
24924
24925 <nowiki><ref>bar</nowiki>
24926
24927 baz<nowiki></ref></nowiki>
24928 !! end
24929
24930 #### --------------- Others ---------------
24931 !! test
24932 Escaping nowikis
24933 !! options
24934 parsoid=html2wt
24935 !! html/parsoid
24936 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24937 </p>
24938 !! wikitext
24939 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24940 !! end
24941
24942 ## The quote-char in the input is necessary for triggering the bug
24943 !! test
24944 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24945 !! options
24946 parsoid=html2wt
24947 !! html/parsoid
24948 <p>foo's bar :</p>
24949 !! wikitext
24950 foo's bar :
24951 !! end
24952
24953 #----------- End of wikitext escaping tests --------------
24954
24955 !! test
24956
24957 Tag-like HTML structures are passed through as text
24958 !! wikitext
24959 <x y>
24960
24961 <x.y>
24962
24963 <x-y>
24964
24965 1>2
24966
24967 x<y
24968
24969 a>b
24970
24971 1<d e>f
24972 !! html
24973 <p>&lt;x y&gt;
24974 </p><p>&lt;x.y&gt;
24975 </p><p>&lt;x-y&gt;
24976 </p><p>1&gt;2
24977 </p><p>x&lt;y
24978 </p><p>a&gt;b
24979 </p><p>1&lt;d e&gt;f
24980 </p>
24981 !! end
24982
24983 !! test
24984 HTML tag with necessary entities in attributes
24985 !! wikitext
24986 <span title="&amp;amp;">foo</span>
24987 !! html
24988 <p><span title="&amp;amp;">foo</span>
24989 </p>
24990 !! end
24991
24992 !! test
24993 HTML tag with 'unnecessary' entity encoding in attributes
24994 !! wikitext
24995 <span title="&amp;">foo</span>
24996 !! html
24997 <p><span title="&amp;">foo</span>
24998 </p>
24999 !! end
25000
25001 !! test
25002 HTML tag with broken attribute value quoting
25003 !! options
25004 parsoid=wt2html,html2html
25005 !! wikitext
25006 <span title="Hello world>Foo</span>
25007 !! html/php
25008 <p><span title="Hello world">Foo</span>
25009 </p>
25010 !! html/parsoid
25011 <p><span title="Hello world">Foo</span></p>
25012 !! end
25013
25014 !! test
25015 Self-closed tag with broken attribute value quoting
25016 !! options
25017 parsoid=wt2html,html2html
25018 !! wikitext
25019 <div title="Hello world />Foo
25020 !! html/php+tidy
25021 <div title="Hello world"></div>
25022 <p>Foo</p>
25023 !! html/parsoid
25024 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
25025 !! end
25026
25027 !! test
25028 Table with broken attribute value quoting
25029 !! options
25030 parsoid=wt2html,html2html
25031 !! wikitext
25032 {|
25033 | title="Hello world|Foo
25034 |}
25035 !! html/php
25036 <table>
25037 <tr>
25038 <td title="Hello world">Foo
25039 </td></tr></table>
25040
25041 !! html/parsoid
25042 <table>
25043 <tr>
25044 <td title="Hello world">Foo
25045 </td></tr></table>
25046
25047 !! end
25048
25049 !! test
25050 Table with broken attribute value quoting on consecutive lines
25051 !! options
25052 parsoid=wt2html,html2html
25053 !! wikitext
25054 {|
25055 | title="Hello world|Foo
25056 | style="color:red|Bar
25057 |}
25058 !! html/php
25059 <table>
25060 <tr>
25061 <td title="Hello world">Foo
25062 </td>
25063 <td style="color:red">Bar
25064 </td></tr></table>
25065
25066 !! html/parsoid
25067 <table><tbody>
25068 <tr>
25069 <td title="Hello world">Foo
25070 </td><td style="color: red">Bar
25071 </td></tr></tbody></table>
25072
25073 !! end
25074
25075 !!test
25076 Accept empty td cell attribute
25077 !! wikitext
25078 {|
25079 | align="center" | foo || |
25080 |}
25081 !! html
25082 <table>
25083 <tr>
25084 <td align="center"> foo </td>
25085 <td>
25086 </td></tr></table>
25087
25088 !!end
25089
25090 !!test
25091 Non-empty attributes in th-cells
25092 !! wikitext
25093 {|
25094 ! Foo !! style="color: red" | Bar
25095 |}
25096 !! html
25097 <table>
25098 <tr>
25099 <th> Foo </th>
25100 <th style="color: red"> Bar
25101 </th></tr></table>
25102
25103 !!end
25104
25105 !!test
25106 Accept empty attributes in th-cells
25107 !! wikitext
25108 {|
25109 !| foo !!| bar
25110 |}
25111 !! html
25112 <table>
25113 <tr>
25114 <th> foo </th>
25115 <th> bar
25116 </th></tr></table>
25117
25118 !!end
25119
25120 !!test
25121 Empty table rows go away
25122 !! wikitext
25123 {|
25124 | Hello
25125 | there
25126 |- class="foo"
25127 |-
25128 |}
25129 !! html
25130 <table>
25131 <tr>
25132 <td> Hello
25133 </td>
25134 <td> there
25135 </td></tr>
25136
25137 </table>
25138
25139 !! end
25140
25141 ###
25142 ### Parsoid-centric tests for testing RTing of inter-element separators
25143 ### Edge cases not tested by existing parser tests and specific to
25144 ### Parsoid-specific serialization strategies.
25145 ###
25146
25147 !!test
25148 RT-ed inter-element separators should be valid separators
25149 !! wikitext
25150 {|
25151 |- [[foo]]
25152 |}
25153 !! html/php
25154 <table>
25155
25156 </table>
25157
25158 !! html/parsoid
25159 <table>
25160 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
25161 </tbody></table>
25162 !!end
25163
25164 # Parsoid-only since PHP parser relies on Tidy for correct output
25165 !!test
25166 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
25167 !!options
25168 parsoid
25169 !! wikitext
25170 {|
25171 |<small>foo
25172 bar
25173 |}
25174
25175 {|
25176 |<small>foo<small>
25177 |}
25178 !! html
25179 <table>
25180 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
25181 <p>bar</p></small></td></tr>
25182 </tbody></table>
25183
25184 <table>
25185 <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>
25186 </tbody></table>
25187 !!end
25188
25189 # Note that the "style" attribute is really a template parameter here.
25190 # The = would have to be {{=}} if you wanted the literal.
25191 !!test
25192 Empty TD followed by TD with tpl-generated attribute
25193 !! wikitext
25194 {|
25195 |-
25196 |
25197 |{{echo|style='color:red'}}|foo
25198 |}
25199 !! html
25200 <table>
25201
25202 <tr>
25203 <td>
25204 </td>
25205 <td>foo
25206 </td></tr></table>
25207
25208 !!end
25209
25210 !!test
25211 Indented table with an empty td
25212 !! wikitext
25213 {|
25214 |-
25215 |
25216 |foo
25217 |}
25218 !! html
25219 <table>
25220
25221 <tr>
25222 <td>
25223 </td>
25224 <td>foo
25225 </td></tr></table>
25226
25227 !!end
25228
25229 ## We have some newline diffs RT-ing this edge case
25230 ## and it is not important enough -- we seem to be emitting
25231 ## at most 2 newlines after a </tr> and this is unrelated to
25232 ## the issue from T85627 that this is testing.
25233 !!test
25234 Indented table with blank lines in between (T85627)
25235 !! options
25236 parsoid=wt2html
25237 !! wikitext
25238 {|
25239 |foo
25240
25241
25242 |}
25243 !! html
25244 <table>
25245
25246 <tr>
25247 <td>foo
25248 </td></tr></table>
25249
25250 !!end
25251
25252 !!test
25253 Indented block & table
25254 !! wikitext
25255 <div>foo</div>
25256 {|
25257 |foo
25258 |}
25259 !! html/php
25260 <div>foo</div>
25261 <table>
25262 <tr>
25263 <td>foo
25264 </td></tr></table>
25265
25266 !! html/parsoid
25267 <div data-parsoid='{"stx":"html"}'>foo</div>
25268 <table><tbody>
25269 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
25270 </tbody></table>
25271 !!end
25272
25273 !! test
25274 Indent and comment before table row
25275 !! wikitext
25276 {|
25277 <!--hi-->|-
25278 | there
25279 |}
25280 !! html/php
25281 <table>
25282
25283 <tr>
25284 <td> there
25285 </td></tr></table>
25286
25287 !! html/parsoid
25288 <table>
25289 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
25290 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
25291 </tbody></table>
25292 !! end
25293
25294 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
25295 !!test
25296 Empty TR followed by a template-generated TR
25297 !!options
25298 parsoid
25299 !! wikitext
25300 {|
25301 |-
25302 {{echo|<tr><td>foo</td></tr>}}
25303 |}
25304 !! html
25305 <table>
25306 <tbody>
25307 <tr></tr>
25308 <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}}]}'>
25309 <td>foo</td></tr>
25310 </tbody></table>
25311 !!end
25312
25313 ## PHP and parsoid output differ for this, and since this is primarily
25314 ## for testing Parsoid's serializer, marking this Parsoid only
25315 !!test
25316 Empty TR followed by mixed-ws-comment line should RT correctly
25317 !!options
25318 parsoid
25319 !! wikitext
25320 {|
25321 |-
25322 <!--c-->
25323 |-
25324 <!--c--> <!--d-->
25325 |}
25326 !! html
25327 <table>
25328 <tbody>
25329 <tr></tr>
25330 <!--c-->
25331 <tr>
25332 <!--c--> </tr><!--d-->
25333 </tbody></table>
25334
25335 !!end
25336
25337 !!test
25338 Multi-line image caption generated by templates with/without trailing newlines
25339 !! wikitext
25340 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
25341 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
25342 !! html/parsoid
25343 <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>
25344 <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>
25345 !!end
25346
25347 !! test
25348 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
25349 !! options
25350 parsoid=html2wt
25351 !! html/parsoid
25352 <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>
25353
25354 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
25355 !! wikitext
25356 <includeonly>foo</includeonly>
25357 new para
25358
25359 [[Category:Foo]]
25360
25361 = new heading =
25362 !! end
25363
25364 ## PHP emits broken html for this, and since this is primarily
25365 ## a Parsoid serializer test, marking this Parsoid only
25366 !!test
25367 Improperly nested inline or quotes tags with whitespace in between
25368 !! wikitext
25369 <span> <s>x</span> </s>
25370 ''' ''x''' ''
25371 !! html/parsoid
25372 <p><span> <s>x</s></span><s> </s>
25373 <b> <i>x</i></b><i> </i>
25374 </p>
25375 !!end
25376
25377 !!test
25378 Encapsulate protected attributes from wt
25379 !! wikitext
25380 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
25381
25382 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
25383 | ok
25384 |}
25385 !! html/parsoid
25386 <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>
25387
25388 <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">
25389 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
25390 </tbody></table>
25391 !!end
25392
25393 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
25394 ## Having nested or stray pre tags results in the attempt to add duplicates,
25395 ## causing an assertion fail. This test tries to prevent that situation.
25396 !!test
25397 Ensure ParagraphWrapper can deal with stray closing pre tags
25398 !!options
25399 parsoid=wt2html
25400 !! wikitext
25401 plain text</pre>
25402 !! html/parsoid
25403 plain text
25404 !!end
25405
25406 !!test
25407 1. Ensure fostered text content is wrapped in element nodes
25408 !!options
25409 parsoid=wt2html
25410 !! wikitext
25411 <table>hi</table><table>ho</table>
25412 !! html/parsoid
25413 <p>hi</p>
25414 <table></table>
25415 <p>ho</p>
25416 <table></table>
25417 !!end
25418
25419 !!test
25420 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
25421 !!options
25422 parsoid=wt2html,wt2wt
25423 !! wikitext
25424 <table>
25425 <tr> || ||
25426 <td> a
25427 </table>
25428 !! html/parsoid
25429 <p> || ||
25430 </p><table>
25431 <tbody><tr><td> a</td></tr>
25432 </tbody></table>
25433 !!end
25434
25435 !!test
25436 Encapsulation properly handles null DSR information from foster box
25437 !!options
25438 parsoid=wt2html,wt2wt
25439 !! wikitext
25440 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25441 !! html/parsoid
25442 <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>
25443 !!end
25444
25445 !!test
25446 1. Encapsulate foster-parented transclusion content
25447 !!options
25448 parsoid=wt2wt,wt2html
25449 !! wikitext
25450 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25451 !! html/parsoid
25452 <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>
25453 <tbody>
25454 <tr>
25455 <td>bar</td>
25456 </tr>
25457 </tbody>
25458 </table>
25459 !!end
25460
25461 !!test
25462 2. Encapsulate foster-parented transclusion content
25463 !!options
25464 parsoid=wt2wt,wt2html
25465 !! wikitext
25466 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25467 !! html/parsoid
25468 <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>
25469 <table>
25470 <tbody>
25471 <tr>
25472 <td>bar</td>
25473 </tr>
25474 </tbody>
25475 </table>
25476 !!end
25477
25478 !!test
25479 3. Encapsulate foster-parented transclusion content
25480 !!options
25481 parsoid=wt2wt,wt2html
25482 !! wikitext
25483 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25484 !! html/parsoid
25485 <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;]}">
25486 <p>foo</p>
25487 </div>
25488 <table>
25489 <tbody>
25490 <tr>
25491 <td>bar</td>
25492 </tr>
25493 </tbody>
25494 </table>
25495 !!end
25496
25497 !!test
25498 4. Encapsulate foster-parented transclusion content
25499 !!options
25500 parsoid=wt2wt,wt2html
25501 !! wikitext
25502 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25503 !! html/parsoid
25504 <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;]}">
25505 <p>foo</p>
25506 </div>
25507 <table>
25508 <tbody>
25509 <tr>
25510 <td>bar</td>
25511 </tr>
25512 </tbody>
25513 </table>
25514 !!end
25515
25516 !!test
25517 5. Encapsulate foster-parented transclusion content
25518 !!options
25519 parsoid=wt2wt,wt2html
25520 !! wikitext
25521 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25522 !! html/parsoid
25523 <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>
25524 <table>
25525 <tbody>
25526 <tr>
25527 <td>
25528 <div>
25529 <p>foo</p>
25530 </div>
25531 </td>
25532 </tr>
25533 </tbody>
25534 </table>
25535 !!end
25536
25537 !!test
25538 6. Encapsulate foster-parented transclusion content
25539 !!options
25540 parsoid=wt2wt,wt2html
25541 !! wikitext
25542 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25543 !! html/parsoid
25544 <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>
25545 <table>
25546 <tbody>
25547 <tr>
25548 <td>
25549 <div>
25550 <p>foo</p>
25551 </div>
25552 </td>
25553 </tr>
25554 </tbody>
25555 </table>
25556 <p>ok</p>
25557 !!end
25558
25559 !!test
25560 7. Encapsulate foster-parented transclusion content
25561 !!options
25562 parsoid=wt2wt,wt2html
25563 !! wikitext
25564 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25565 !! html/parsoid
25566 <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>
25567 <table>
25568 <tbody>
25569 <tr>
25570 <td>bar</td>
25571 </tr>
25572 </tbody>
25573 </table>
25574 !!end
25575
25576 # Note that the wt is broken on purpose: the = should be {{=}} if you
25577 # don't want it to be a template parameter key.
25578 !!test
25579 8. Encapsulate foster-parented transclusion content
25580 !!options
25581 parsoid=wt2wt,wt2html
25582 !! wikitext
25583 {{echo|a
25584 }}{|{{echo|style='color:red'}}
25585 |-
25586 |b
25587 |}
25588 !! html/parsoid
25589 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25590 <span> </span>
25591 <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>
25592 <table>
25593 <tbody>
25594 <tr>
25595 <td>b</td>
25596 </tr>
25597 </tbody>
25598 </table>
25599 !!end
25600
25601 !!test
25602 9. Encapsulate foster-parented transclusion content
25603 !!options
25604 parsoid=wt2wt,wt2html
25605 !! wikitext
25606 <table>{{echo|hi</table>hello}}
25607 !! html/parsoid
25608 <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>
25609 !!end
25610
25611 !!test
25612 Table in fosterable position
25613 !!options
25614 parsoid=wt2html
25615 !! wikitext
25616 {{OpenTable}}
25617 <div>
25618 {|
25619 |}
25620 </div>
25621 |}
25622 !! html/parsoid
25623 <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">
25624 </span>
25625 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25626
25627 <table>
25628 </table>
25629 !!end
25630
25631 # Parsoid only for bug 64747
25632 !! test
25633 Properly encapsulate empty-content transclusions in fosterable positions
25634 !! wikitext
25635 <table>
25636 {{#if:|
25637 <td>foo</td>
25638 }}
25639 </table>
25640 !! html/parsoid
25641 <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"}]]}'>
25642
25643 </table>
25644 !! end
25645
25646 !! test
25647 Always encapsulate foster box when template range is expanded to table
25648 !! options
25649 parsoid=wt2wt
25650 !! wikitext
25651 {|
25652 hello
25653 {{OpenTable}}
25654 |}
25655 !! html/parsoid
25656
25657 !! end
25658
25659 !! test
25660 T115289: Unclosed table
25661 !! wikitext
25662 {{echo|<table>}}<!--c-->[[Category:Two]]
25663 !! html/parsoid
25664 <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>
25665 !! end
25666
25667 !! test
25668 T115289: Don't migrate newlines out of tables with fostered content
25669 !! wikitext
25670 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25671 !! html/parsoid
25672 <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>
25673 !! end
25674
25675 !! test
25676 T73074: More fostering fun
25677 !! wikitext
25678 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25679 !! html/parsoid
25680 <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>
25681 !! end
25682
25683 !!test
25684 Support <object> element with .data attribute
25685 !!options
25686 parsoid=html2wt
25687 !! html/parsoid
25688 <object data="test.swf"></object>
25689 !! wikitext
25690 <object data="test.swf"></object>
25691 !!end
25692
25693 !! test
25694 Don't block XML namespace declaration
25695 !! wikitext
25696 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25697 !! html/php
25698 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25699 </p>
25700 !! html/parsoid
25701 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25702 !! end
25703
25704 # -----------------------------------------------------------------
25705 # The following section of tests are primarily to spec requirements
25706 # around Parsoid's serialization (old, new, edited content)
25707 #
25708 # All these tests are marked Parsoid html2wt and html2html only
25709 # ----------------------------------------------------------------
25710
25711 !! test
25712 Ignore rel attribute in a-tags during serialization to url-links
25713 !! options
25714 parsoid=html2wt
25715 !! html/parsoid
25716 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25717 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25718 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25719 !! wikitext
25720 http://en.wikipedia.org/wiki/Foobar
25721 http://en.wikipedia.org/wiki/Foobar
25722 http://en.wikipedia.org/wiki/Foobar
25723 !! end
25724
25725 # 'mi' is a localinterwiki prefix as well as a language
25726 !! test
25727 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
25728 !! options
25729 parsoid=html2wt
25730 !! html/parsoid
25731 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25732 !! wikitext
25733 [[Foo]]
25734 !! end
25735
25736 # See T93839
25737 !! test
25738 New wikilinks should be serialized properly
25739 !! options
25740 parsoid=html2wt
25741 !! html/parsoid
25742 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25743 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25744 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25745 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25746 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25747 !! wikitext
25748 [[Foo]]
25749 [[Foo]]
25750 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25751 http://en.wikipedia.org/wiki/Foo
25752 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25753 !! end
25754
25755 !! test
25756 New wiki links (href variations)
25757 !! options
25758 parsoid=html2wt
25759 !! html/parsoid
25760 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25761 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25762 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25763 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25764 !! wikitext
25765 [[Foo_bar]]
25766 [[Foo_bar]]
25767 [[Foo_bar]]
25768 [[Toxine bactérienne]]
25769 !! end
25770
25771 !! test
25772 New wiki links (content string variations)
25773 !! options
25774 parsoid=html2wt
25775 !! html/parsoid
25776 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25777 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25778 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25779 !! wikitext
25780 [[Foo_bar]]
25781 [[Foo bar]]
25782 [[Foo_bar|./Foo_bar]]
25783 !! end
25784
25785 !! test
25786 New category links (href variations)
25787 !! options
25788 parsoid=html2wt
25789 !! html/parsoid
25790 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25791 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25792 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25793 !! wikitext
25794 [[Category:Toxine bactérienne]]
25795 [[Category:Toxine bactérienne]]
25796 [[Category:Toxine bactérienne]]
25797 !! end
25798
25799 !! test
25800 New sol transparent links don't need indent-pre nowiki protection
25801 !! options
25802 parsoid=html2wt
25803 language=de
25804 !! html/parsoid
25805 <link rel="mw:PageProp/redirect" href="./Main_Page">
25806 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25807 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25808 !! wikitext
25809 #WEITERLEITUNG [[Main Page]]
25810 <!-- this is good --> [[Category:Good]]
25811 <!-- this is great --> [[Kategorie:Great]]
25812 !! end
25813
25814 !! test
25815 New interlanguage links (href variations)
25816 !! options
25817 parsoid=html2wt
25818 !! html/parsoid
25819 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25820 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25821 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25822 !! wikitext
25823 [[es:Toxine bactérienne]]
25824 [[es:Toxine_bactérienne]]
25825 [[es:Toxine_bactérienne]]
25826 !! end
25827
25828 !! test
25829 Image: Modifying size of an image (1)
25830 !! options
25831 parsoid={
25832 "modes": ["wt2wt"],
25833 "changes": [
25834 ["img[height]", "attr", "height", "22"],
25835 ["img[width]", "attr", "width", "200"]
25836 ]
25837 }
25838 !! wikitext
25839 [[Image:Foobar.jpg|230x230px]]
25840 !! wikitext/edited
25841 [[Image:Foobar.jpg|200x200px]]
25842 !!end
25843
25844 !! test
25845 Image: Modifying size of an image (2)
25846 !! options
25847 parsoid={
25848 "modes": ["wt2wt"],
25849 "changes": [
25850 ["img[height]", "attr", "height", "100"],
25851 ["img[width]", "attr", "width", "500"]
25852 ]
25853 }
25854 !! wikitext
25855 [[Image:Foobar.jpg|230x230px]]
25856 !! wikitext/edited
25857 [[Image:Foobar.jpg|500x500px]]
25858 !!end
25859
25860 # Change in size is ignored so long as class='mw-default-size'
25861 !! test
25862 Image: Modifying size of an image (3)
25863 !! options
25864 parsoid={
25865 "modes": ["wt2wt"],
25866 "changes": [
25867 ["figure[class]", "removeClass", "mw-default-size"],
25868 ["figure img", "attr", "height", "19"],
25869 ["figure img", "attr", "width", "170"]
25870 ]
25871 }
25872 !! wikitext
25873 [[Image:Foobar.jpg|thumb]]
25874 !! wikitext/edited
25875 [[Image:Foobar.jpg|thumb|170x170px]]
25876 !!end
25877
25878 !! test
25879 Image: Modifying alignment of an image (bug 48665)
25880 !! options
25881 parsoid={
25882 "modes": ["wt2wt"],
25883 "changes": [
25884 ["figure[class]", "removeClass", "mw-halign-right"],
25885 ["figure[class]", "addClass", "mw-halign-left"]
25886 ]
25887 }
25888 !! wikitext
25889 [[Image:Foobar.jpg|thumb|caption|right]]
25890 !! wikitext/edited
25891 [[Image:Foobar.jpg|thumb|caption|left]]
25892 !! end
25893
25894 !! test
25895 Image: Modifying mw-default-size of an frameless image (bug 62805)
25896 !! options
25897 parsoid={
25898 "modes": ["wt2wt"],
25899 "changes": [
25900 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25901 ]
25902 }
25903 !! wikitext
25904 [[Image:Foobar.jpg|frameless|right]]
25905 !! wikitext/edited
25906 [[Image:Foobar.jpg|frameless|right|220x220px]]
25907 !! end
25908
25909 !! test
25910 Image: Modifying valign of an image (bug 49221)
25911 !! options
25912 parsoid={
25913 "modes": ["wt2wt"],
25914 "changes": [
25915 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25916 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25917 ]
25918 }
25919 !! wikitext
25920 [[File:Foobar.jpg|20px|middle]]
25921 !! wikitext/edited
25922 [[File:Foobar.jpg|20px|text-top]]
25923 !! end
25924
25925 !! test
25926 Image: Modifying alt attribute of an image (bug 56400)
25927 !! options
25928 parsoid={
25929 "modes": ["wt2wt"],
25930 "changes": [
25931 ["img[alt]", "attr", "alt", "some alternate edited text"]
25932 ]
25933 }
25934 !! wikitext
25935 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25936 !! wikitext/edited
25937 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25938 !!end
25939
25940 !! test
25941 Image: Modifying caption of an image
25942 !! options
25943 parsoid={
25944 "modes": ["wt2wt"],
25945 "changes": [
25946 ["figcaption", "text", "new caption"]
25947 ]
25948 }
25949 !! wikitext
25950 [[Image:Foobar.jpg|thumb|original caption]]
25951 !! wikitext/edited
25952 [[Image:Foobar.jpg|thumb|new caption]]
25953 !!end
25954
25955 !! test
25956 Image: empty alt attribute (bug 48924)
25957 !! options
25958 parsoid
25959 !! wikitext
25960 [[File:Foobar.jpg|thumb|alt=|bar]]
25961 !! html
25962 <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>
25963 !! end
25964
25965 !! test
25966 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25967 !! options
25968 parsoid=html2wt
25969 language=ar
25970 disabled
25971 !! html/parsoid
25972 <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>
25973 !! wikitext
25974 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25975 !! end
25976
25977 !! test
25978 Image: Block level image should have \n before and after
25979 !! wikitext
25980 123
25981 [[File:Foobar.jpg|right|thumb|150x150px]]
25982 456
25983 !! html/parsoid
25984 <p>123</p>
25985 <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>
25986 <p>456</p>
25987 !!end
25988
25989 !! test
25990 Image: New block level image should have \n before and after (existing content)
25991 !! wikitext
25992 123
25993 [[File:Foobar.jpg|right|thumb|150x150px]]
25994 456
25995 !! html/parsoid
25996 <p>123</p>
25997 <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>
25998 <p>456</p>
25999 !!end
26000
26001 !! test
26002 Image: upright option (parsoid)
26003 !! wikitext
26004 [[File:Foobar.jpg|thumb|upright|caption]]
26005 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
26006 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
26007 !! html/parsoid
26008 <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>
26009 <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>
26010 <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>
26011 !!end
26012
26013 !! test
26014 Image: upright option is ignored on inline and frame images (parsoid)
26015 !! wikitext
26016 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
26017 !! html/parsoid
26018 <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>
26019 !!end
26020
26021 !! test
26022 Image: from basic HTML (1)
26023 !! options
26024 parsoid=html2wt
26025 !! html/parsoid
26026 <span typeof="mw:Image">
26027 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
26028 </span>
26029 !! wikitext
26030 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
26031 !! end
26032
26033 !! test
26034 Image: from basic HTML (2)
26035 !! options
26036 parsoid=html2wt
26037 !! html/parsoid
26038 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
26039 !! wikitext
26040 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
26041 !! end
26042
26043 !! test
26044 Image: from basic HTML (3)
26045 !! options
26046 parsoid=html2wt
26047 !! html/parsoid
26048 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
26049 !! wikitext
26050 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
26051 !! end
26052
26053 !! test
26054 Image: from basic HTML (4)
26055 !! options
26056 parsoid=html2wt
26057 !! html/parsoid
26058 <img src="./File:Foobar.jpg">
26059 !! wikitext
26060 [[File:Foobar.jpg|link=]]
26061 !! end
26062
26063 !! test
26064 Image: Invalid title as link
26065 !! wikitext
26066 [[File:Foobar.jpg|link=<]]
26067 !! html/php
26068 <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>
26069 </p>
26070 !! html/parsoid
26071 <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>
26072 !! end
26073
26074 !! test
26075 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
26076 !! options
26077 parsoid=html2wt
26078 !! html/parsoid
26079 <ul>
26080 <li><p>foo</p></li>
26081 </ul>
26082 !! wikitext
26083 * foo
26084 !! end
26085
26086 !! test
26087 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
26088 !! options
26089 parsoid=html2wt
26090 !! html/parsoid
26091 <ul> <li>foo</li></ul>
26092 !! wikitext
26093 * foo
26094 !! end
26095
26096 !! test
26097 Don't strip leading whitespace when handling indent-pre suppressing tags
26098 !! options
26099 parsoid=html2wt
26100 !! html/parsoid
26101 <table>
26102 <tr><td> indented row</td></tr>
26103 </table>
26104 <blockquote><p>
26105 <b>This is very bold of you!</b>
26106 </p>
26107 <table><tr><td>
26108 indented cell (no pre-wrapping!)
26109 </td></tr></table>
26110 </blockquote>
26111 <p>foo</p>
26112 <div>bar</div>
26113 !! wikitext
26114 {|
26115 | indented row
26116 |}
26117 <blockquote>
26118 '''This is very bold of you!'''
26119
26120 {|
26121 |
26122 indented cell (no pre-wrapping!)
26123 |}
26124 </blockquote>
26125 foo
26126 <div>bar</div>
26127 !! end
26128
26129 !! test
26130 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
26131 !! options
26132 parsoid=html2wt
26133 !! html/parsoid
26134 <p>foo</p>
26135 <span>bar</span>
26136
26137 <span>foo2
26138 </span>bar2
26139
26140 <div>foo</div>
26141 <span>bar</span>
26142
26143 <div>
26144 <span>foo</span>
26145 </div>
26146 !! wikitext
26147 foo
26148
26149 <span>bar</span>
26150
26151 <span>foo2
26152 <nowiki> </nowiki></span>bar2
26153
26154 <div>foo</div>
26155 <nowiki> </nowiki><span>bar</span>
26156
26157 <div>
26158 <nowiki> </nowiki><span>foo</span>
26159 </div>
26160 !! end
26161
26162 !! test
26163 Lists: Dont insert newlines in a serialized list item.
26164 !! options
26165 parsoid=html2wt
26166 !! html/parsoid
26167 <ul><li>a<br>b</li><li>c</li></ul>
26168 !! wikitext
26169 * a<br>b
26170 * c
26171 !! end
26172
26173 !! test
26174 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
26175 !! options
26176 parsoid={
26177 "modes": ["html2wt"],
26178 "scrubWikitext": false
26179 }
26180 !! html/parsoid
26181 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26182 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26183
26184 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26185 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26186
26187 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
26188
26189 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26190 !! wikitext
26191 == hello there [[Category:A1]] ==
26192
26193 == [[Category:A2]] hi pal ==
26194
26195 == <!--foo--> [[Category:A3]] how goes it ==
26196
26197 == it goes well [[Category:A4]] <!--bar--> ==
26198
26199 ==howdy [[Category:A5]]==
26200
26201 == __TOC__ ok ==
26202 !! end
26203
26204 !! test
26205 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
26206 !! options
26207 parsoid={
26208 "modes": ["html2wt"],
26209 "scrubWikitext": true
26210 }
26211 !! html/parsoid
26212 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26213 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26214
26215 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26216 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26217
26218 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26219 !! wikitext
26220 == hello there ==
26221 [[Category:A1]]
26222 [[Category:A2]]
26223
26224 == hi pal ==
26225
26226 <!--foo--> [[Category:A3]]
26227
26228 == how goes it ==
26229
26230 == it goes well ==
26231 [[Category:A4]] <!--bar-->
26232
26233 __TOC__
26234
26235 == ok ==
26236 !! end
26237
26238 !! test
26239 Headings: Don't hoist metas that come from templates
26240 !! options
26241 parsoid={
26242 "modes": ["html2wt"],
26243 "scrubWikitext": true
26244 }
26245 !! html/parsoid
26246 <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>
26247 !! wikitext
26248 == {{echo|foo [[Category:Foo]]}} ==
26249 !! end
26250
26251 !! test
26252 Headings: Category in ref isn't hoisted
26253 !! options
26254 parsoid={
26255 "modes": ["html2wt"],
26256 "scrubWikitext": true
26257 }
26258 !! html/parsoid
26259 <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>
26260
26261 <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>
26262 !! wikitext
26263 == foo <ref>bar
26264 [[Category:Baz]] </ref> ==
26265
26266 <references />
26267 !! end
26268
26269 !! test
26270 Parsoid: Serialize positional parameters with = in them as named parameter
26271 !! options
26272 parsoid=html2wt
26273 !! html/parsoid
26274 <p about="#mwt1" typeof="mw:Transclusion"
26275 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
26276
26277 <p about="#mwt1" typeof="mw:Transclusion"
26278 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
26279
26280 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26281 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26282 <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>
26283 !! wikitext
26284 {{echo|1=f=oo}}
26285
26286 {{echo|1=f=oo|2=bar}}
26287
26288 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26289 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26290 {{echo|<nowiki>f=oo</nowiki>|bar}}
26291 !! end
26292
26293 !! test
26294 Parsoid: Serialize positional parameters with = in extlink as named parameter
26295 !! options
26296 parsoid=html2wt
26297 !! html/parsoid
26298 <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>
26299 !! wikitext
26300 {{echo|1=http://stuff?is=ok}}
26301 !! end
26302
26303 !! test
26304 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
26305 !! options
26306 parsoid=html2wt
26307 !! html/parsoid
26308 <div>a<p>b</p></div>
26309 <div>a
26310 <p>b</p></div>
26311 <div>
26312 a
26313 <p>b</p></div>
26314 !! wikitext
26315 <div>a
26316 b
26317 </div>
26318 <div>a
26319 b
26320 </div>
26321 <div>
26322 a
26323
26324 b
26325 </div>
26326 !! end
26327
26328 !! test
26329 Substrings resembling wikitext in hrefs should not get nowiki escapes
26330 !! options
26331 parsoid=html2wt
26332 !! html/parsoid
26333 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
26334 !! wikitext
26335 [[Foo''bar''baz]]
26336 !! end
26337
26338 !! test
26339 Enforce single-line context in the serializer
26340 !! options
26341 parsoid=html2wt
26342 !! html/parsoid
26343 <h2>testing
26344 123</h2>
26345
26346 <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">
26347 </span><span about="#mwt1">you</span> </h2>
26348
26349 <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>
26350
26351 <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
26352 there</span></li></ol>
26353
26354 <ul><li>asd
26355 sdf</li></ul>
26356
26357 <ul><li>foo
26358 bar
26359 baz</li>
26360 <li>foo <b>bar</b>
26361 baz</li></ul>
26362
26363 <dl><dt>hi
26364 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
26365 ho</dd></dl>
26366
26367 <dl><dd> <table>
26368 <tbody><tr><td> ha
26369 ha
26370 ha</td></tr>
26371 </tbody></table></dd></dl>
26372 !! wikitext
26373 == testing 123 ==
26374
26375 == hi {{bogus|there
26376 you}} ==
26377
26378 == foo <ref>hello
26379 there</ref> ==
26380
26381 <references />
26382
26383 * asd sdf
26384
26385 * foo bar baz
26386 * foo '''bar''' baz
26387
26388 ; hi ho : hi ho
26389
26390 : {|
26391 | ha
26392 ha
26393 ha
26394 |}
26395 !! end
26396
26397 !! test
26398 Serialize new placeholder space without spans
26399 !! options
26400 parsoid=html2wt
26401 !! html/parsoid
26402 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
26403
26404 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
26405
26406 <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>
26407 !! wikitext
26408 foo : bar
26409
26410 foo : bar
26411
26412 <ref>foo : bar</ref>ok
26413 !! end
26414
26415
26416 #-----------------------
26417 # Tag minimization tests
26418 #-----------------------
26419
26420 !! test
26421 1. I/B quote minimization: wikitext-only tags should be combined
26422 !! options
26423 parsoid=html2wt
26424 !! html/parsoid
26425 <p><i>A</i><i>B</i></p>
26426 <p><b>A</b><b>B</b></p>
26427 <p><i>A</i><b><i>B</i></b></p>
26428 <p><b>A</b><i><b>B</b></i></p>
26429 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
26430 <p><i><b>A</b></i><i><b>B</b></i></p>
26431 <p><i><b>A</b></i><b><i>B</i></b></p>
26432 <p><b><i>A</i></b><i><b>B</b></i></p>
26433 !! wikitext
26434 ''AB''
26435
26436 '''AB'''
26437
26438 ''A'''B'''''
26439
26440 '''A''B'''''
26441
26442 '''A''BC''D'''
26443
26444 '''''AB'''''
26445
26446 '''''AB'''''
26447
26448 '''''AB'''''
26449 !! end
26450
26451 !! test
26452 2. I/B quote minimization: wikitext and html tags should not be combined
26453 !! options
26454 parsoid=html2wt
26455 !! html/parsoid
26456 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26457 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26458 !! wikitext
26459 ''A''<i>B</i>
26460
26461 ''A''<nowiki/>'''<i>B</i>'''
26462 !! end
26463
26464 !! test
26465 3. I/B quote minimization: templated content stops minimization
26466 !! options
26467 parsoid=html2wt
26468 !! html/parsoid
26469 <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>
26470 <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>
26471 !! wikitext
26472 ''A''{{echo|''B''}}
26473
26474 ''A''{{echo|'''''B'''''}}
26475 !! end
26476
26477 !! test
26478 4. I/B quote minimization: new content should be mimimized with adjacent old content
26479 !! options
26480 parsoid=html2wt
26481 !! html/parsoid
26482 <p><i>A</i><i>B</i></p>
26483 <p><b>A</b><b>B</b></p>
26484 <p><i>A</i><b><i>B</i></b></p>
26485 !! wikitext
26486 ''AB''
26487
26488 '''AB'''
26489
26490 ''A'''B'''''
26491 !! end
26492
26493 !! test
26494 5a. Merge adjacent quote nodes if they've been edited
26495 !! options
26496 parsoid={
26497 "modes": ["wt2wt", "selser"],
26498 "changes": [
26499 ["p", "contents", "remove", ":contains('b')"]
26500 ]
26501 }
26502 !! wikitext
26503 ''a''b''c''
26504 !! wikitext/edited
26505 ''ac''
26506 !! end
26507
26508 !! test
26509 5b. Merge adjacent quote nodes if they've been edited
26510 !! options
26511 parsoid={
26512 "modes": ["wt2wt", "selser"],
26513 "changes": [
26514 ["#x", "remove"]
26515 ]
26516 }
26517 !! wikitext
26518 ''a''<span id="x">b</span>''c''
26519 !! wikitext/edited
26520 ''ac''
26521 !! end
26522
26523 !! test
26524 1. Merge adjacent link nodes as long as at least one element is new
26525 !! options
26526 parsoid={
26527 "modes": ["html2wt"],
26528 "scrubWikitext": true
26529 }
26530 !! html/parsoid
26531 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26532 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26533 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26534 !! wikitext
26535 [[Football]]
26536 [[Football]]
26537 [[Football|Foot]][[Football|ball]]
26538 !! end
26539
26540 !! test
26541 2. Merge adjacent link nodes and enable additional normalizations
26542 !! options
26543 parsoid={
26544 "modes": ["html2wt"],
26545 "scrubWikitext": true
26546 }
26547 !! html/parsoid
26548 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26549 !! wikitext
26550 [[Football|''Football'']]
26551 !! end
26552
26553 !! test
26554 3. Don't merge adjacent link nodes if scrubWikitext is false
26555 !! options
26556 parsoid={
26557 "modes": ["html2wt"],
26558 "scrubWikitext": false
26559 }
26560 !! html/parsoid
26561 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26562 !! wikitext
26563 [[Football|Foot]][[Football|ball]]
26564 !! end
26565
26566 #------------------------------
26567 # End of tag minimization tests
26568 #------------------------------
26569
26570 !!test
26571 Bug 54262: New entities
26572 !! options
26573 parsoid=html2wt
26574 !! html/parsoid
26575 <span typeof="mw:Entity">&nbsp;</span>
26576 !! wikitext
26577 &nbsp;
26578 !! end
26579
26580 ## Note that there is no wikitext output for 'unknownproperty' ##
26581 ## Unknown magic words are silently dropped ##
26582
26583 !! test
26584 Magic words
26585 !! options
26586 parsoid=html2wt
26587 !! html/parsoid
26588 <meta property='mw:PageProp/toc' />
26589 <meta property='mw:PageProp/notoc' />
26590 <meta property='mw:PageProp/forcetoc' />
26591 <meta property='mw:PageProp/index' />
26592 <meta property='mw:PageProp/noindex' />
26593 <meta property='mw:PageProp/nogallery' />
26594 <meta property='mw:PageProp/noeditsection' />
26595 <meta property='mw:PageProp/notitleconvert' />
26596 <meta property='mw:PageProp/nocontentconvert' />
26597 <meta property='mw:PageProp/unknownproperty' />
26598 !! wikitext
26599 __TOC__
26600 __NOTOC__
26601 __FORCETOC__
26602 __INDEX__
26603 __NOINDEX__
26604 __NOGALLERY__
26605 __NOEDITSECTION__
26606 __NOTITLECONVERT__
26607 __NOCONTENTCONVERT__
26608 !! end
26609
26610 !! test
26611 Consecutive <pre>s should not get merged
26612 !! options
26613 parsoid=html2wt,html2html
26614 !! html/parsoid
26615 <pre>a</pre><pre>b</pre>
26616
26617 <pre>c
26618 </pre><pre>
26619 d</pre>
26620
26621 <pre>e
26622
26623 </pre><pre>
26624
26625 f</pre>
26626 !! wikitext
26627 a
26628
26629 b
26630
26631 c
26632
26633 d
26634
26635 e
26636
26637
26638
26639 f
26640 !! end
26641
26642 !! test
26643 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26644 !! options
26645 parsoid=html2wt
26646 !! html/parsoid
26647 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26648 !! wikitext
26649 [[Special:BookSources/1234567890|ISBN 1234567895]]
26650 !! end
26651
26652 !! test
26653 Edited RFC links not serializable as RFC links should serialize as extlinks
26654 !! options
26655 parsoid=html2wt
26656 !! html/parsoid
26657 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26658 !! wikitext
26659 [//tools.ietf.org/html/rfc123 New RFC]
26660 !! end
26661
26662 !! test
26663 Edited PMID links not serializable as PMID links should serialize as extlinks
26664 !! options
26665 parsoid=html2wt
26666 !! html/parsoid
26667 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26668 !! wikitext
26669 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26670 !! end
26671
26672 !! test
26673 WTS of autolinks with trailing/surrounding context
26674 !! options
26675 parsoid=html2wt
26676 !! html/parsoid
26677 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26678 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26679 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26680 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26681 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26682 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26683 !! wikitext
26684 http://cscott.net'''foo'''
26685
26686 http://cscott.net<b>foo</b>
26687
26688 '''http://cscott.net'''
26689
26690 '''http://cscott.net '''
26691
26692 '''http://cscott.net<nowiki/>x'''
26693
26694 http://cscott.net<nowiki/>x
26695 !! end
26696
26697 !! test
26698 WTS of autolinks with nowikis (round-trip)
26699 !! wikitext
26700 x<nowiki/>http://cscott.net<nowiki/>x
26701 !! html/parsoid
26702 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26703 !! end
26704
26705 # this is the "easy" test because it leaves in place all the
26706 # data-parsoid information indicating this is an autolink
26707 !! test
26708 WTS of autolinks with escapes (editing)
26709 !! options
26710 parsoid={
26711 "modes": ["wt2wt"],
26712 "changes": [
26713 [ "meta", "remove" ]
26714 ]
26715 }
26716 !! wikitext
26717 x<nowiki/>http://cscott.net<nowiki/>x
26718 !! wikitext/edited
26719 x<nowiki/>http://cscott.net<nowiki/>x
26720 !! end
26721
26722 !! test
26723 WTS of edited autolink-like text (T103364)
26724 !! options
26725 parsoid={
26726 "modes": ["wt2wt"],
26727 "changes": [
26728 [ "span[typeof]", "removeAttr", "typeof" ]
26729 ]
26730 }
26731 !! wikitext
26732 Not a link: <nowiki>http://example.com</nowiki>.
26733 !! wikitext/edited
26734 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26735 !! end
26736
26737 !! test
26738 WTS of newly-authored autolink-like text (T103364)
26739 !! options
26740 parsoid=html2wt
26741 !! html/parsoid
26742 <p>http://example.com is not a link.</p>
26743 !! wikitext
26744 <nowiki>http://example.com</nowiki> is not a link.
26745 !! end
26746
26747 !! test
26748 WTS of autolink-like text after an autolink (T108563)
26749 !! options
26750 parsoid=html2wt
26751 !! html/parsoid
26752 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26753 !! wikitext
26754 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26755 !! end
26756
26757 !! test
26758 Magic links inside links (not autolinked)
26759 !! wikitext
26760 [[Foo|http://example.com]]
26761 [[Foo|RFC 1234]]
26762 [[Foo|PMID 1234]]
26763 [[Foo|ISBN 123456789x]]
26764
26765 [http://foo.com http://example.com]
26766 [http://foo.com RFC 1234]
26767 [http://foo.com PMID 1234]
26768 [http://foo.com ISBN 123456789x]
26769 !! html+tidy
26770 <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>
26771 <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>
26772 !! html/parsoid
26773 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26774 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26775 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26776 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26777
26778 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26779 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26780 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26781 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26782 !! end
26783
26784 !! test
26785 Magic links inside image captions (autolinked)
26786 !! wikitext
26787 [[File:Foobar.jpg|thumb|http://example.com]]
26788 [[File:Foobar.jpg|thumb|RFC 1234]]
26789 [[File:Foobar.jpg|thumb|PMID 1234]]
26790 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26791 !! html+tidy
26792 <div class="thumb tright">
26793 <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>
26794 <div class="thumbcaption">
26795 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26796 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26797 </div>
26798 </div>
26799 <div class="thumb tright">
26800 <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>
26801 <div class="thumbcaption">
26802 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26803 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26804 </div>
26805 </div>
26806 <div class="thumb tright">
26807 <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>
26808 <div class="thumbcaption">
26809 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26810 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26811 </div>
26812 </div>
26813 <div class="thumb tright">
26814 <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>
26815 <div class="thumbcaption">
26816 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26817 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26818 </div>
26819 </div>
26820 !! html/parsoid
26821 <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>
26822 <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>
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 href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</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="./Special:BookSources/123456789X" rel="mw:WikiLink">ISBN 123456789x</a></figcaption></figure>
26825 !! end
26826
26827 !! test
26828 WTS of magic word text (T109371)
26829 !! options
26830 parsoid=html2wt
26831 !! html/parsoid
26832 <p>RFC 1234</p>
26833 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26834 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26835 !! wikitext
26836 <nowiki>RFC 1234</nowiki>
26837
26838 [http://foo.com RFC 1234]
26839
26840 [[Foo|RFC 1234]]
26841 !! end
26842
26843 !! test
26844 Edited Redirect link should emit a non-piped wikitext link
26845 !! options
26846 parsoid=html2wt
26847 !! html/parsoid
26848 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26849 !! wikitext
26850 #REDIRECT [[Bar]]
26851 !! end
26852
26853 !! test
26854 T75121: Infer extension name from typeOf if data-mw is not present
26855 !! options
26856 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26857 !! html/parsoid
26858 <div typeOf="mw:Extension/foo"></div>
26859 !! wikitext
26860 <foo />
26861 !! end
26862
26863 # Note that the <p> wrapping isn't present in PHP parser output
26864 # The important thing for this test is that P-wrapping doesn't
26865 # interfere with the <nowiki> protection for leading - in <td>
26866 # (which isn't necessary for <th>).
26867 !! test
26868 T88318: p-wrapped dash in table.
26869 !! options
26870 parsoid=html2wt,wt2wt
26871 !! html/parsoid
26872 <table><tbody>
26873 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26874 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26875 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26876 </tbody></table>
26877 !! wikitext
26878 {|
26879 !-
26880 !-
26881 |-
26882 |<nowiki>-</nowiki>
26883 |<nowiki>- </nowiki>
26884 |-
26885 |<small>-</small>
26886 |<br>
26887 -
26888 |<br>
26889 -
26890 |}
26891 !! html/php+tidy
26892 <table>
26893 <tr>
26894 <th>-</th>
26895 <th>-</th>
26896 </tr>
26897 <tr>
26898 <td>-</td>
26899 <td>-</td>
26900 </tr>
26901 <tr>
26902 <td><small>-</small></td>
26903 <td><br />
26904 <p>-</p>
26905 </td>
26906 <td><br />
26907 <p>-</p>
26908 </td>
26909 </tr>
26910 </table>
26911 !! end
26912
26913 !! test
26914 T149209: WTS: Handle newlines in table cells properly
26915 !! options
26916 parsoid=html2wt
26917 !! html/parsoid
26918 <table>
26919 <tbody>
26920 <tr><td>a
26921 b
26922 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
26923 <tr><td><p>x</p>
26924 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
26925 </tbody></table>
26926 <table>
26927 <tbody>
26928 <tr><th>a
26929 b
26930 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
26931 <tr><th><p>x</h>
26932 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
26933 </tbody></table>
26934 !! wikitext
26935 {|
26936 |a
26937 b
26938 |c
26939 |-
26940 |x
26941 {{!}}y
26942 |}
26943 {|
26944 !a
26945 b
26946 !c
26947 |-
26948 !x
26949 !y
26950 |}
26951 !! end
26952
26953 !! test
26954 T149209: Selser: Handle newlines in table cells properly
26955 !! options
26956 parsoid={
26957 "modes": ["selser"],
26958 "changes": [
26959 [ "#h1", "html", "a\nb\n" ],
26960 [ "#h2", "html", "a\nb\n" ],
26961 [ "#c1", "html", "a\nb\n" ],
26962 [ "#c2", "html", "<p>a</p>" ],
26963 [ "#c3", "html", "<p>a</p>" ],
26964 [ "#c4", "html", "edit-me<p>a</p>" ]
26965 ]
26966 }
26967 !! wikitext
26968 {|
26969 ! id="h1" |edit-me!!1
26970 |-
26971 ! id="h2" |edit-me||2
26972 |-
26973 | id="c1" |edit-me||3
26974 |-
26975 | id="c2" |edit-me||4
26976 |-
26977 | id="c3" |edit-me||p||q||r
26978 |-
26979 | id="c4" |edit-me||p||q||r
26980 |}
26981 !! wikitext/edited
26982 {|
26983 ! id="h1" |a
26984 b
26985 !1
26986 |-
26987 ! id="h2" |a
26988 b
26989 !2
26990 |-
26991 | id="c1" |a
26992 b
26993 |3
26994 |-
26995 | id="c2" |a
26996 |4
26997 |-
26998 | id="c3" |a
26999 |p||q||r
27000 |-
27001 | id="c4" |edit-me
27002 a
27003 |p||q||r
27004 |}
27005 !! end
27006
27007 !! test
27008 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
27009 !! options
27010 parsoid=html2wt
27011 !! html/parsoid
27012 <table id='mwAb'>
27013 <td id='mwAc'>foo</td>
27014 <td id='serialize-this'>bar</td>
27015 </table>
27016 !! wikitext
27017 {|
27018 |foo
27019 | id="serialize-this" |bar
27020 |}
27021 !! end
27022
27023 !! test
27024 Parsoid-like element ids should not be serialized to wikitext unless shadowed
27025 !! options
27026 parsoid=html2wt
27027 !! html/parsoid
27028 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
27029 !! wikitext
27030 <div id="hello">ok</div>
27031 !! end
27032
27033 !! test
27034 WTS change modes
27035 !! options
27036 parsoid={
27037 "modes": ["wt2wt"],
27038 "changes": [
27039 [ "#xyz", "before", "<b>before</b> stuff " ],
27040 [ "#xyz", "after", " stuff <i>after</i>" ],
27041 [ "#xyz", "html", "x <b>y</b> z" ]
27042 ]
27043 }
27044 !! wikitext
27045 <span id="xyz">hello</span>
27046 !! wikitext/edited
27047 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
27048 !! end
27049
27050 !! test
27051 Never serialize a-tag as html, regardless of what data-parsoid has to say
27052 !! options
27053 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27054 !! html/parsoid
27055 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
27056 !! wikitext
27057 [[Foo]]
27058 !! end
27059
27060 ## SSS FIXME: This is broken output nevertheless.
27061 ## What might be a reasonable non-broken output for this?
27062 ## This is an edge case unlikely to be seen in production
27063 ## that I am not wasting more time on this right now.
27064 !! test
27065 Never serialize a-tag as html, no matter what attributes it has
27066 !! options
27067 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27068 !! html/parsoid
27069 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
27070 !! wikitext
27071 [http://boo.org http://boohoo.org]
27072 !! end
27073
27074 # Misnested is an indication that selser can reuse the source but these have
27075 # shown to sneak through on occasion. See T101768.
27076 # The original wikitext here is: [http://test.com [[one]] two three]
27077 !! test
27078 Strip span tags added to mark misnested links
27079 !! options
27080 parsoid=html2wt
27081 !! html/parsoid
27082 <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>
27083 !! wikitext
27084 [http://test.com][[one]] two three
27085 !! end
27086
27087 !! test
27088 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
27089 !! options
27090 parsoid=html2wt
27091 !! html/parsoid
27092 <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|}"]}'>
27093 <tbody><tr><td>d
27094 </td></tr>
27095 </tbody></table>
27096 !! wikitext
27097 {{echo|a}}
27098 {|{{echo|c
27099 {{!}}d
27100 }}
27101 |}
27102 !! end
27103
27104 ## This test verifies the presence and computation of this attribute indirectly
27105 ## by making an edit and ensuring that the serialization is correct (which it would be
27106 ## only if firstWikitextNode is properly set).
27107 !! test
27108 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
27109 !! options
27110 parsoid= {
27111 "modes": ["wt2wt"],
27112 "changes": [
27113 [ "div#x", "remove" ],
27114 [ "div", "before", "<div>new</div>" ]
27115 ]
27116 }
27117 !! wikitext
27118 <div id="x">foo</div>
27119 {|
27120 {{echo|<div>boo</div>
27121 {{!}}b}}
27122 |c
27123 |}
27124 !! wikitext/edited
27125
27126 <div>new</div>
27127 {|
27128 {{echo|<div>boo</div>
27129 {{!}}b}}
27130 |c
27131 |}
27132 !! end
27133
27134 # --------------------------------------------
27135 # Tests spec'ing wikitext serialization norms |
27136 # --------------------------------------------
27137
27138 !! test
27139 1. Categories should always be serialized on their own line
27140 !! options
27141 parsoid=html2wt
27142 !! html/parsoid
27143 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
27144 !! wikitext
27145 foo
27146 [[Category:Foo]]
27147 bar
27148 !! end
27149
27150 !! test
27151 2. Categories that are part of templates should not introduce a line break
27152 !! wikitext
27153 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
27154 !! html/parsoid
27155 <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>
27156 !! end
27157
27158 # Careful while editing these next 2 tests. There are \u200f characters
27159 # before and after the <link> tags in the HTML and following some
27160 # of the categories in wikitext
27161 # Do not remove these characters in edits.
27162 #
27163 # As part of the serialization, these bidi characters will get stripped.
27164 !! test
27165 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
27166 !! options
27167 parsoid={
27168 "modes": ["html2wt"],
27169 "scrubWikitext": true
27170 }
27171 !! html/parsoid
27172 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
27173 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
27174 !! wikitext
27175 [[קטגוריה:טקסים]]
27176 [[קטגוריה: שיטות משפט]]
27177 !! end
27178
27179 !! test
27180 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
27181 !! options
27182 parsoid={
27183 "modes": ["html2wt"],
27184 "scrubWikitext": true
27185 }
27186 !! html/parsoid
27187 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
27188 !! wikitext
27189 [[קטגוריה:טקסים]]
27190 ‏y
27191 !! end
27192
27193 !! test
27194 Lists: Add space after bullets
27195 !! options
27196 parsoid=html2wt
27197 !! html/parsoid
27198 <ul>
27199 <li>foo</li>
27200 <li> bar</li>
27201 <li><span> baz</span></li>
27202 </ul>
27203 !! wikitext
27204 * foo
27205 * bar
27206 * <span> baz</span>
27207 !! end
27208
27209 !! test
27210 1. Headings: Add space before/after == (T53744)
27211 !! options
27212 parsoid=html2wt
27213 !! html/parsoid
27214 <h2>foo</h2>
27215 <h2> bar</h2>
27216 <h2>baz </h2>
27217 <h2><span> baz</span></h2>
27218 !! wikitext
27219 == foo ==
27220
27221 == bar ==
27222
27223 == baz ==
27224
27225 == <span> baz</span> ==
27226 !! end
27227
27228 !! test
27229 2. Headings: Add space before/after == even after hoisted content
27230 !! options
27231 parsoid={
27232 "modes": ["html2wt"],
27233 "scrubWikitext": true
27234 }
27235 !! html/parsoid
27236 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
27237 !! wikitext
27238 [[Category:A2]]
27239
27240 == ok ==
27241 !! end
27242
27243 !! test
27244 1. Headings: suppress newly created empty headings
27245 !! options
27246 parsoid={
27247 "modes": ["html2wt"],
27248 "scrubWikitext": true
27249 }
27250 !! html/parsoid
27251 <h2></h2>
27252 !! wikitext
27253 !! end
27254
27255 !! test
27256 2. Headings: don't suppress empty headings if scrubWikitext is false
27257 !! options
27258 parsoid=html2wt
27259 !! html/parsoid
27260 <h2></h2>
27261 !! wikitext
27262 ==<nowiki/>==
27263 !! end
27264
27265 !! test
27266 3. Headings: suppress empty headings on edits
27267 !! options
27268 parsoid={
27269 "modes": ["selser"],
27270 "scrubWikitext": true,
27271 "changes": [
27272 [ "#x", "remove"]
27273 ]
27274 }
27275 !! wikitext
27276 ==<span id="x">foo</span>==
27277 !! wikitext/edited
27278 !! end
27279
27280 !! test
27281 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
27282 !! options
27283 parsoid={
27284 "modes": ["html2wt"],
27285 "scrubWikitext": true
27286 }
27287 !! html/parsoid
27288 <h2>foo<br/>bar</h2>
27289 <h2>foo <span><br/>bar</span> baz</h2>
27290 !! wikitext
27291 == foo bar ==
27292
27293 == foo <span> bar</span> baz ==
27294 !! end
27295
27296 !! test
27297 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
27298 !! options
27299 parsoid={
27300 "modes": ["html2wt"],
27301 "scrubWikitext": false
27302 }
27303 !! html/parsoid
27304 <h2>foo<br/>bar</h2>
27305 !! wikitext
27306 == foo<br> bar ==
27307 !! end
27308
27309 !! test
27310 1. WT Quote Tags: suppress newly created empty style tags
27311 !! options
27312 parsoid={
27313 "modes": ["html2wt"],
27314 "scrubWikitext": true
27315 }
27316 !! html/parsoid
27317 <i></i><b></b>
27318 !! wikitext
27319 !! end
27320
27321 !! test
27322 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
27323 !! options
27324 parsoid=html2wt
27325 !! html/parsoid
27326 <i></i><b></b>
27327 !! wikitext
27328 ''<nowiki/>'''''<nowiki/>'''
27329 !! end
27330
27331 !! test
27332 3. WT Quote Tags: suppress empty style tags on edits
27333 !! options
27334 parsoid={
27335 "modes": ["selser"],
27336 "scrubWikitext": true,
27337 "changes": [
27338 [ "#x", "remove"]
27339 ]
27340 }
27341 !! wikitext
27342 '''<span id="x">foo</span>'''
27343 !! wikitext/edited
27344 !! end
27345
27346 !! test
27347 1. Anchors: suppress newly created empty anchors
27348 !! options
27349 parsoid={
27350 "modes": ["html2wt"],
27351 "scrubWikitext": true
27352 }
27353 !! html/parsoid
27354 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27355 !! wikitext
27356 !! end
27357
27358 !! test
27359 2. Anchors: don't suppress empty anchors if scrubWikitext is false
27360 !! options
27361 parsoid={
27362 "modes": ["html2wt"],
27363 "scrubWikitext": false
27364 }
27365 !! html/parsoid
27366 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27367 !! wikitext
27368 [[Test|<nowiki/>]]
27369 !! end
27370
27371 !! test
27372 3. Anchors: suppress empty anchors on edits
27373 !! options
27374 parsoid={
27375 "modes": ["selser"],
27376 "scrubWikitext": true,
27377 "changes": [
27378 [ "#x", "remove"]
27379 ]
27380 }
27381 !! wikitext
27382 [[Test|<span id="x">foo</span>]]
27383 !! wikitext/edited
27384 !! end
27385
27386 !! test
27387 3a. Anchors: do not suppress numbered extlinks
27388 !! options
27389 parsoid={
27390 "modes": ["wt2wt"],
27391 "scrubWikitext": true
27392 }
27393 !! wikitext
27394 [http://foo.com]
27395 !! html/parsoid
27396 <a rel="mw:ExtLink" href="http://foo.com"></a>
27397 !! end
27398
27399 !! test
27400 3b. Anchors: do not suppress numbered extlinks
27401 !! options
27402 parsoid={
27403 "modes": ["wt2wt"],
27404 "scrubWikitext": true,
27405 "changes": [
27406 [ "#x", "remove"]
27407 ]
27408 }
27409 !! wikitext
27410 [http://foo.com <span id="x">foo</span>]
27411 !! wikitext/edited
27412 [http://foo.com]
27413 !! end
27414
27415 !!test
27416 Normalizations should be restricted to edited content
27417 !!options
27418 parsoid={
27419 "modes": ["selser"],
27420 "scrubWikitext": true,
27421 "changes": [
27422 [ "h1", "before", "<i></i>"]
27423 ]
27424 }
27425 !!wikitext
27426 a
27427 = =
27428 b
27429 !!wikitext/edited
27430 a
27431 = =
27432 b
27433 !!end
27434
27435 !! test
27436 1. Multiple normalizations (html2wt)
27437 !! options
27438 parsoid={
27439 "modes": ["html2wt"],
27440 "scrubWikitext": true
27441 }
27442 !! html
27443 <h2><i></i></h2>
27444 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27445 </a><b><i></i></b>x</p>
27446 !! wikitext
27447
27448 [[foo]]
27449 x
27450
27451 !! end
27452
27453 !! test
27454 2. Multiple normalizations (selser)
27455 !! options
27456 parsoid={
27457 "modes": ["selser"],
27458 "scrubWikitext": true,
27459 "changes": [
27460 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27461 ]
27462 }
27463 !! wikitext
27464 <span id="x">foo</span>
27465 !! wikitext/edited
27466 <span id="x">foo</span>
27467
27468 x
27469 !! end
27470
27471 !! test
27472 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27473 !! options
27474 parsoid={
27475 "modes": ["html2wt"],
27476 "scrubWikitext": true
27477 }
27478 !! html/parsoid
27479 <p> hi</p>
27480 <p> hello</p>
27481 !! wikitext
27482 hi
27483
27484 hello
27485 !! end
27486
27487 !! test
27488 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27489 !! options
27490 parsoid=html2wt
27491 !! html/parsoid
27492 <p> hi</p>
27493 <p> hello</p>
27494 !! wikitext
27495 <nowiki> </nowiki>hi
27496
27497 <nowiki> </nowiki> hello
27498 !! end
27499
27500 !! test
27501 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27502 !! options
27503 parsoid={
27504 "modes": ["html2wt"],
27505 "scrubWikitext": true
27506 }
27507 !! html/parsoid
27508 <p>Foo
27509 bar
27510 baz</p>
27511
27512 <table><tr><td>Foo
27513 bar
27514 baz bang</td></tr></table>
27515
27516 <p><!--boo--> foo
27517 bar</p>
27518
27519 <p> foo
27520 bar<span>boo</span></p>
27521 !! wikitext
27522 Foo
27523 bar
27524 baz
27525
27526 {|
27527 |Foo
27528 bar
27529 baz bang
27530 |}
27531
27532 <!--boo-->foo
27533 bar
27534
27535 foo
27536 bar<span>boo</span>
27537 !! end
27538
27539 !! test
27540 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27541 !! options
27542 parsoid={
27543 "modes": ["selser"],
27544 "scrubWikitext": true,
27545 "changes": [
27546 [ "p", "html", " a\n b" ]
27547 ]
27548 }
27549 !! wikitext
27550 xyz
27551 !! wikitext/edited
27552 a
27553 b
27554 !! end
27555
27556 !! test
27557 1. New links that end in spaces
27558 !! options
27559 parsoid={
27560 "modes": ["html2wt"],
27561 "scrubWikitext": false
27562 }
27563 !! html/parsoid
27564 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27565 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27566 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27567 !! wikitext
27568 [[Berlin ]]<nowiki/>is the capital of Germany.
27569
27570 [[Foo ]]'''bar'''
27571
27572 [[Boston ]] is a city.
27573 !! end
27574
27575 !! test
27576 2. New links that end in spaces
27577 !! options
27578 parsoid={
27579 "modes": ["html2wt"],
27580 "scrubWikitext": true
27581 }
27582 !! html/parsoid
27583 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27584 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27585 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27586 !! wikitext
27587 [[Berlin]] is the capital of Germany.
27588
27589 [[Foo]] '''bar'''
27590
27591 [[Boston]] is a city.
27592 !! end
27593
27594 !! test
27595 1. Table cells with escapable prefixes
27596 !! options
27597 parsoid={
27598 "modes": ["html2wt"],
27599 "scrubWikitext": false
27600 }
27601 !! html
27602 <table>
27603 <tr><td>a</td></tr>
27604 <tr><td>-</td></tr>
27605 <tr><td>+</td></tr>
27606 </table>
27607 !! wikitext
27608 {|
27609 |a
27610 |-
27611 |<nowiki>-</nowiki>
27612 |-
27613 |<nowiki>+</nowiki>
27614 |}
27615 !! end
27616
27617 !! test
27618 2. Table cells with escapable prefixes
27619 !! options
27620 parsoid={
27621 "modes": ["html2wt"],
27622 "scrubWikitext": true
27623 }
27624 !! html
27625 <table>
27626 <tr><td>a</td></tr>
27627 <tr><td>-</td></tr>
27628 <tr><td>+</td></tr>
27629 </table>
27630 !! wikitext
27631 {|
27632 |a
27633 |-
27634 | -
27635 |-
27636 | +
27637 |}
27638 !! end
27639
27640 !! test
27641 3a. Table cells with escapable prefixes after edits
27642 !! options
27643 parsoid={
27644 "modes": ["selser"],
27645 "scrubWikitext": true,
27646 "changes": [
27647 [ "table tbody tr:first-child td:first-child", "remove"]
27648 ]
27649 }
27650 !! wikitext
27651 {|
27652 |a||-
27653 |}
27654 !! wikitext/edited
27655 {|
27656 | -
27657 |}
27658 !! end
27659
27660 !! test
27661 3b. Table cells with escapable prefixes after edits
27662 !! options
27663 parsoid={
27664 "modes": ["selser"],
27665 "scrubWikitext": true,
27666 "changes": [
27667 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27668 [ "#x", "remove" ]
27669 ]
27670 }
27671 !! wikitext
27672 {|
27673 |pqr
27674 |<span id="x">foo</span>+
27675 |}
27676 !! wikitext/edited
27677 {|
27678 | -
27679 | +
27680 |}
27681 !! end
27682
27683 # FIXME: This test will fail because
27684 # normalization doesn't realize that the id attribute
27685 # will eliminate the escapable scenario
27686 !! test
27687 4a. Table cells without escapable prefixes after edits
27688 !! options
27689 parsoid={
27690 "modes": ["selser"],
27691 "scrubWikitext": true,
27692 "changes": [
27693 [ "#x", "html", "-" ]
27694 ]
27695 }
27696 !! wikitext
27697 {|
27698 | id="x" |abcd
27699 |}
27700 !! wikitext/edited
27701 {|
27702 | id="x" |-
27703 |}
27704 !! end
27705
27706 ## This tests normalizer's ability to discriminate between
27707 ## cells having identical content.
27708 !! test
27709 4b. Table cells without escapable prefixes after edits
27710 !! options
27711 parsoid={
27712 "modes": ["selser"],
27713 "scrubWikitext": true,
27714 "changes": [
27715 [ "td", "html", "-" ]
27716 ]
27717 }
27718 !! wikitext
27719 {|
27720 |a||b
27721 |}
27722 !! wikitext/edited
27723 {|
27724 | -||-
27725 |}
27726 !! end
27727
27728 ## This tests normalizer's ability to not be tripped by
27729 ## comments (and whitespace)
27730 !! test
27731 4c. Table cells without escapable prefixes after edits
27732 !! options
27733 parsoid={
27734 "modes": ["selser"],
27735 "scrubWikitext": true,
27736 "changes": [
27737 [ "table tbody tr td:first-child", "remove" ]
27738 ]
27739 }
27740 !! wikitext
27741 {|
27742 |-
27743 <!--foo--> |a||-
27744 |}
27745 !! wikitext/edited
27746 {|
27747 |-
27748 <!--foo--> | -
27749 |}
27750 !! end
27751
27752 ## This tests normalizer's ability to handle HTML cells
27753 !! test
27754 4d. Table cells without escapable prefixes after edits
27755 !! options
27756 parsoid={
27757 "modes": ["selser"],
27758 "scrubWikitext": true,
27759 "changes": [
27760 [ "td", "html", "-" ]
27761 ]
27762 }
27763 !! wikitext
27764 <table>
27765 <tr><td>a</td></tr>
27766 </table>
27767 !! wikitext/edited
27768 <table>
27769 <tr><td>-</td></tr>
27770 </table>
27771 !! end
27772
27773 ## T111151 Remove font elements without attributes
27774 !! test
27775 5a. font tags without attributes should be dropped in scrubWikitext mode
27776 !! options
27777 parsoid={
27778 "modes": ["html2wt"],
27779 "scrubWikitext": true
27780 }
27781 !! html
27782 <font>foo</font>
27783 <font><font>bar</font></font>
27784 <font class="x">boo</font>
27785 !! wikitext
27786 foo
27787 bar
27788 <font class="x">boo</font>
27789 !! end
27790
27791 !! test
27792 5b. font tags should not be dropped without scrubWikitext being enabled
27793 !! options
27794 parsoid={
27795 "modes": ["html2wt"],
27796 "scrubWikitext": false
27797 }
27798 !! html
27799 <font>foo</font>
27800 !! wikitext
27801 <font>foo</font>
27802 !! end
27803
27804 !! test
27805 Escape nowiki DOM elements
27806 !! options
27807 parsoid=html2wt
27808 !! html/parsoid
27809 <nowiki><i>foo</i></nowiki>
27810 !! wikitext
27811 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27812 !! end
27813
27814 # This is meant to be an interim fix while we go about figuring out
27815 # how to not introduce these trailing <nowiki/>s in the first place.
27816 !! test
27817 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27818 !! options
27819 parsoid=html2wt
27820 !! html/parsoid
27821 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27822 y</p>
27823 <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>
27824 <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>
27825 !! wikitext
27826 x
27827 y
27828
27829 {{echo|
27830 1 = <nowiki/>}}
27831
27832 {{echo|
27833 1 = <nowiki/>
27834 }}
27835 !! end
27836
27837 # ---------------------------------------------------
27838 # End of tests spec'ing wikitext serialization norms |
27839 # ---------------------------------------------------
27840
27841 # T104032
27842 !! test
27843 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27844 !! options
27845 parsoid=html2wt
27846 !! html/parsoid
27847 a<p>b</p>
27848 <b>c</b><p>d</p>
27849 <table><tr>
27850 <td>a<p>b</p></td>
27851 <td><b>c</b><p>d</p></td>
27852 </tr></table>
27853 !! wikitext
27854 a
27855
27856 b
27857
27858 '''c'''
27859
27860 d
27861 {|
27862 |a
27863 b
27864 |'''c'''
27865 d
27866 |}
27867 !! end
27868
27869 # -----------------------------------------------------------------
27870 # End of section for Parsoid-only html2wt tests for serialization
27871 # of new content
27872 # -----------------------------------------------------------------
27873
27874 # -----------------------------------------------------------------
27875 # The following section of tests are primarily to spec behavior of
27876 # the selective serializer. All these tests have manual selser
27877 # changes. The automated selser changes for all tests handle the
27878 # wide variation of changes, but these tests here capture specs
27879 # deterministically.
27880 # ----------------------------------------------------------------
27881
27882 ## T90517
27883 !! test
27884 Selser: New comments should not be lost
27885 !! options
27886 parsoid={
27887 "modes": ["selser"],
27888 "changes": [
27889 [ "#a", "after", "<!--c1-->" ],
27890 [ "#b", "before", "<!--c2-->" ]
27891 ]
27892 }
27893 !! wikitext
27894 <span id="a">a</span>
27895
27896 <span id="b">b</span>
27897 !! wikitext/edited
27898 <span id="a">a</span><!--c1-->
27899
27900 <!--c2--><span id="b">b</span>
27901 !! end
27902
27903 ## T89383
27904 !! test
27905 Selser: Check for validity of DSR before using it
27906 !! options
27907 parsoid={
27908 "modes": ["selser"],
27909 "changes": [
27910 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27911 ]
27912 }
27913 !! wikitext
27914 <span id="a">a</span>
27915 !! wikitext/edited
27916 {{DISPLAYTITLE:foo}}
27917 <span id="a">a</span>
27918 !! end
27919
27920 !! test
27921 1. DOMDiff: Changes to <ref> content should be looked up using id
27922 !! options
27923 parsoid={
27924 "modes": ["selser"],
27925 "changes": [
27926 ["#X", "after", "bar"],
27927 ["#Y", "after", "baz"]
27928 ]
27929 }
27930 !! wikitext
27931 X <ref><span id="X">foo</span></ref>
27932 Y <ref name="a" />
27933 <references>
27934 <ref name="a"><span id="Y">foo</span></ref>
27935 </references>
27936 !! wikitext/edited
27937 X <ref><span id="X">foo</span>bar</ref>
27938 Y <ref name="a" />
27939 <references>
27940 <ref name="a"><span id="Y">foo</span>baz</ref>
27941 </references>
27942 !! end
27943
27944 !! test
27945 2. DOMDiff: Changes to <ref> content should be looked up using id
27946 !! options
27947 parsoid={
27948 "modes": ["selser"],
27949 "changes": [
27950 ["#Z", "after", "bar"]
27951 ]
27952 }
27953 !! wikitext
27954 A <ref>foo bar for a</ref>
27955 B <ref group="X" name="b" />
27956
27957 <references />
27958
27959 <references group="X">
27960 <ref name="b"><span id="Z">foo</span></ref>
27961 </references>
27962 !! wikitext/edited
27963 A <ref>foo bar for a</ref>
27964 B <ref group="X" name="b" />
27965
27966 <references />
27967
27968 <references group="X">
27969 <ref name="b"><span id="Z">foo</span>bar</ref>
27970 </references>
27971 !! end
27972
27973 !! test
27974 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27975 !! options
27976 parsoid={
27977 "modes": ["selser"],
27978 "changes": [
27979 [ "div:first-child", "text", "bar" ]
27980 ]
27981 }
27982 !! wikitext
27983 <div style="{{1x|color:red;}}%">foo</div>
27984 !! wikitext/edited
27985 <div style="{{1x|color:red;}}%">bar</div>
27986 !! end
27987
27988 !! test
27989 Empty LI (T49673)
27990 !! wikitext
27991 * a
27992 *
27993 *
27994 * b
27995 !! html/php+tidy
27996 <ul>
27997 <li>a</li>
27998 <li class="mw-empty-elt"></li>
27999 <li class="mw-empty-elt"></li>
28000 <li>b</li>
28001 </ul>
28002 !! end
28003
28004 !! test
28005 Thumbnail output
28006 !! wikitext
28007 [[File:Thumb.png|thumb]]
28008 !! html/php+tidy
28009 <div class="thumb tright">
28010 <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>
28011 <div class="thumbcaption">
28012 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
28013 </div>
28014 </div>
28015 </div>
28016 !! end
28017
28018 !! test
28019 unclosed internal link XSS (T137264)
28020 !! wikitext
28021 [[#%3Cscript%3Ealert(1)%3C/script%3E|
28022 !! html/php
28023 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
28024 </p>
28025 !! html/parsoid
28026 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
28027 !! end