Don't parse language converter markup as a cell parameter in tables.
[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="#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="#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 !! wikitext
534 == A <nowiki>B
535 C</nowiki> ==
536 !! html
537 <h2><span class="mw-headline" id="A_B.0AC">A B
538 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>
539
540 !! end
541
542 !! test
543 Parsing an URL
544 !! wikitext
545 http://fr.wikipedia.org/wiki/🍺
546 <!-- EasterEgg we love beer, better be able be able to link to it -->
547 !! html
548 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
549 </p>
550 !! end
551
552 # Note that the html+tidy output removes the spaces after the <li>,
553 # which is a bug (https://sourceforge.net/p/tidy/bugs/945/, etc).
554 # This is an issue for all tests with lists. We intentionally do
555 # *not* add html+tidy clauses for these, as we don't want to
556 # document/test the broken behavior. (Parsoid matches the non-tidy
557 # output in these cases.)
558
559 !! test
560 Simple list
561 !! wikitext
562 * Item 1
563 * Item 2
564 !! html
565 <ul><li> Item 1</li>
566 <li> Item 2</li></ul>
567
568 !! end
569
570 !! test
571 Italics and bold
572 !! wikitext
573 * plain
574 * plain''italic''plain
575 * plain''italic''plain''italic''plain
576 * plain'''bold'''plain
577 * plain'''bold'''plain'''bold'''plain
578 * plain''italic''plain'''bold'''plain
579 * plain'''bold'''plain''italic''plain
580 * plain''italic'''bold-italic'''italic''plain
581 * plain'''bold''bold-italic''bold'''plain
582 * plain'''''bold-italic'''italic''plain
583 * plain'''''bold-italic''bold'''plain
584 * plain''italic'''bold-italic'''''plain
585 * plain'''bold''bold-italic'''''plain
586 * plain l'''italic''plain
587 * plain l''''bold''' plain
588 !! html
589 <ul><li> plain</li>
590 <li> plain<i>italic</i>plain</li>
591 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
592 <li> plain<b>bold</b>plain</li>
593 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
594 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
595 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
596 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
597 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
598 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
599 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
600 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
601 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
602 <li> plain l'<i>italic</i>plain</li>
603 <li> plain l'<b>bold</b> plain</li></ul>
604
605 !! end
606
607 # this example taken from the [[simple:Moon]] article (bug 47326)
608 !! test
609 Italics and possessives (1)
610 !! wikitext
611 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
612 !! html
613 <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
614 </p>
615 !! end
616
617 # this example taken from [[en:Flaming Pie]] (bug 49926)
618 !! test
619 Italics and possessives (2)
620 !! wikitext
621 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
622 !! html
623 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
624 </p>
625 !! end
626
627 # this example taken from [[en:Dictionary]] (bug 49926)
628 !! test
629 Italics and possessives (3)
630 !! wikitext
631 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''.
632 !! html
633 <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>.
634 </p>
635 !! end
636
637
638 ###
639 ### 2-quote opening sequence tests
640 ###
641 !! test
642 Italics and bold: 2-quote opening sequence: (2,2)
643 !! wikitext
644 ''foo''
645 !! html
646 <p><i>foo</i>
647 </p>
648 !!end
649
650 !! test
651 Italics and bold: 2-quote opening sequence: (2,3)
652 !! wikitext
653 ''foo'''
654 !! html/*
655 <p><i>foo'</i>
656 </p>
657 !!end
658
659 !! test
660 Italics and bold: 2-quote opening sequence: (2,4)
661 !! options
662 parsoid=wt2html
663 !! wikitext
664 ''foo''''
665 !! html/*
666 <p><i>foo''</i>
667 </p>
668 !!end
669
670 # same html as previous, but wikitext adjusted to match parsoid html2wt
671 !! test
672 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
673 !! wikitext
674 ''foo<nowiki>''</nowiki>''
675 !! html
676 <p><i>foo''</i>
677 </p>
678 !! end
679
680 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
681 !! test
682 Italics and bold: 2-quote opening sequence: (2,5)
683 !! options
684 parsoid=wt2html
685 !! wikitext
686 ''foo'''''
687 !! html/php
688 <p><i>foo</i>
689 </p>
690 !! html/parsoid
691 <p><i>foo</i><b></b>
692 </p>
693 !!end
694
695 # same html as previous, but wikitext adjusted to match parsoid html2wt
696 !! test
697 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
698 !! wikitext
699 ''foo'''''<nowiki/>'''
700 !! html/php
701 <p><i>foo</i>
702 </p>
703 !! html/parsoid
704 <p><i>foo</i><b></b>
705 </p>
706 !! end
707
708
709 ###
710 ### 3-quote opening sequence tests
711 ###
712
713 !! test
714 Italics and bold: 3-quote opening sequence: (3,2)
715 !! wikitext
716 '''foo''
717 !! html/*
718 <p>'<i>foo</i>
719 </p>
720 !!end
721
722 !! test
723 Italics and bold: 3-quote opening sequence: (3,3)
724 !! wikitext
725 '''foo'''
726 !! html
727 <p><b>foo</b>
728 </p>
729 !!end
730
731 !! test
732 Italics and bold: 3-quote opening sequence: (3,4)
733 !! wikitext
734 '''foo''''
735 !! html/*
736 <p><b>foo'</b>
737 </p>
738 !!end
739
740 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
741 !! test
742 Italics and bold: 3-quote opening sequence: (3,5)
743 !! options
744 parsoid=wt2html
745 !! wikitext
746 '''foo'''''
747 !! html/php
748 <p><b>foo</b>
749 </p>
750 !! html/parsoid
751 <p><b>foo</b><i></i>
752 </p>
753 !!end
754
755 # same html as previous, but wikitext adjusted to match parsoid html2wt
756 !! test
757 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
758 !! wikitext
759 '''foo'''''<nowiki/>''
760 !! html/php
761 <p><b>foo</b>
762 </p>
763 !! html/parsoid
764 <p><b>foo</b><i></i>
765 </p>
766 !! end
767
768
769 ###
770 ### 4-quote opening sequence tests
771 ###
772
773 !! test
774 Italics and bold: 4-quote opening sequence: (4,2)
775 !! options
776 parsoid=wt2html
777 !! wikitext
778 ''''foo''
779 !! html/*
780 <p>''<i>foo</i>
781 </p>
782 !!end
783
784 # same html as previous, but wikitext adjusted to match parsoid html2wt
785 !! test
786 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
787 !! wikitext
788 <nowiki>''</nowiki>''foo''
789 !! html
790 <p>''<i>foo</i>
791 </p>
792 !! end
793
794 !! test
795 Italics and bold: 4-quote opening sequence: (4,3)
796 !! wikitext
797 ''''foo'''
798 !! html/*
799 <p>'<b>foo</b>
800 </p>
801 !!end
802
803 !! test
804 Italics and bold: 4-quote opening sequence: (4,4)
805 !! options
806 parsoid=wt2html
807 !! wikitext
808 ''''foo''''
809 !! html/*
810 <p>'<b>foo'</b>
811 </p>
812 !!end
813
814 # same html as previous, but wikitext adjusted to match parsoid html2wt
815 !! test
816 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
817 !! wikitext
818 '<nowiki/>'''foo''''
819 !! html
820 <p>'<b>foo'</b>
821 </p>
822 !! end
823
824 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
825 !! test
826 Italics and bold: 4-quote opening sequence: (4,5)
827 !! options
828 parsoid=wt2html
829 !! wikitext
830 ''''foo'''''
831 !! html/php
832 <p>'<b>foo</b>
833 </p>
834 !! html/parsoid
835 <p>'<b>foo</b><i></i>
836 </p>
837 !!end
838
839 # same html as previous, but wikitext adjusted to match parsoid html2wt
840 !! test
841 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
842 !! wikitext
843 '<nowiki/>'''foo'''''<nowiki/>''
844 !! html/php
845 <p>'<b>foo</b>
846 </p>
847 !! html/parsoid
848 <p>'<b>foo</b><i></i>
849 </p>
850 !! end
851
852
853 ###
854 ### 5-quote opening sequence tests
855 ###
856
857 !! test
858 Italics and bold: 5-quote opening sequence: (5,2)
859 !! options
860 parsoid=wt2html
861 !! wikitext
862 '''''foo''
863 !! html/*
864 <p><b><i>foo</i></b>
865 </p>
866 !!end
867
868 # same html as previous, but wikitext adjusted to match parsoid html2wt
869 !! test
870 Italics and bold: 5-quote opening sequence: (5,2+3)
871 !! wikitext
872 '''''foo'''''
873 !! html/*
874 <p><i><b>foo</b></i>
875 </p>
876 !! end
877
878 !! test
879 Italics and bold: 5-quote opening sequence: (5,3)
880 !! options
881 parsoid=wt2html
882 !! wikitext
883 '''''foo'''
884 !! html/*
885 <p><i><b>foo</b></i>
886 </p>
887 !!end
888
889 # same html as previous, but wikitext adjusted to match parsoid html2wt
890 !! test
891 Italics and bold: 5-quote opening sequence: (5,3+2)
892 !! wikitext
893 '''''foo'''''
894 !! html
895 <p><i><b>foo</b></i>
896 </p>
897 !! end
898
899 !! test
900 Italics and bold: 5-quote opening sequence: (5,4)
901 !! options
902 parsoid=wt2html
903 !! wikitext
904 '''''foo''''
905 !! html/*
906 <p><i><b>foo'</b></i>
907 </p>
908 !!end
909
910 !! test
911 Italics and bold: 5-quote opening sequence: (5,5)
912 !! wikitext
913 '''''foo'''''
914 !! html
915 <p><i><b>foo</b></i>
916 </p>
917 !!end
918
919 !! test
920 Italics and bold: 5-quote opening sequence: (5,6)
921 !! wikitext
922 '''''foo''''''
923 !! html/*
924 <p><i><b>foo'</b></i>
925 </p>
926 !! end
927
928 ###
929 ### multiple quote sequences in a line
930 ###
931 !! test
932 Italics and bold: multiple quote sequences: (2,4,2)
933 !! options
934 parsoid=wt2html
935 !! wikitext
936 ''foo''''bar''
937 !! html/*
938 <p><i>foo'<b>bar</b></i>
939 </p>
940 !!end
941
942
943 # same html as previous, but wikitext adjusted to match parsoid html2wt
944 !! test
945 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
946 !! wikitext
947 ''foo'<nowiki/>'''bar'''''
948 !! html
949 <p><i>foo'<b>bar</b></i>
950 </p>
951 !! end
952
953
954 !! test
955 Italics and bold: multiple quote sequences: (2,4,3)
956 !! options
957 parsoid=wt2html
958 !! wikitext
959 ''foo''''bar'''
960 !! html/*
961 <p><i>foo'<b>bar</b></i>
962 </p>
963 !!end
964
965
966 # same html as previous, but wikitext adjusted to match parsoid html2wt
967 !! test
968 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
969 !! wikitext
970 ''foo'<nowiki/>'''bar'''''
971 !! html
972 <p><i>foo'<b>bar</b></i>
973 </p>
974 !! end
975
976
977 !! test
978 Italics and bold: multiple quote sequences: (2,4,4)
979 !! options
980 parsoid=wt2html
981 !! wikitext
982 ''foo''''bar''''
983 !! html/*
984 <p><i>foo'<b>bar'</b></i>
985 </p>
986 !!end
987
988
989 # same html as previous, but wikitext adjusted to match parsoid html2wt
990 !! test
991 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
992 !! wikitext
993 ''foo'<nowiki/>'''bar'<nowiki/>'''''
994 !! html
995 <p><i>foo'<b>bar'</b></i>
996 </p>
997 !! end
998
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 !! options
1019 parsoid
1020 !! wikitext
1021 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
1022 !! html/php
1023 <p><b>foo'</b>bar
1024 </p>
1025 !! html/parsoid
1026 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1027 </p>
1028 !! end
1029
1030
1031 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1032 !! test
1033 Italics and bold: multiple quote sequences: (3,4,3)
1034 !! options
1035 parsoid=wt2html
1036 !! wikitext
1037 '''foo''''bar'''
1038 !! html/php
1039 <p><b>foo'</b>bar
1040 </p>
1041 !! html/parsoid
1042 <p><b>foo'</b>bar<b></b>
1043 </p>
1044 !!end
1045
1046 # same html as previous, but wikitext adjusted to match parsoid html2wt
1047 !! test
1048 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1049 !! wikitext
1050 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1051 !! html/php
1052 <p><b>foo'</b>bar
1053 </p>
1054 !! html/parsoid
1055 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1056 </p>
1057 !! end
1058
1059 ###
1060 ### other quote tests
1061 ###
1062 !! test
1063 Italics and bold: other quote tests: (2,3,5)
1064 !! wikitext
1065 ''this is about '''foo's family'''''
1066 !! html
1067 <p><i>this is about <b>foo's family</b></i>
1068 </p>
1069 !!end
1070
1071
1072 !! test
1073 Italics and bold: other quote tests: (2,(3,3),2)
1074 !! wikitext
1075 ''this is about '''foo's''' family''
1076 !! html
1077 <p><i>this is about <b>foo's</b> family</i>
1078 </p>
1079 !!end
1080
1081
1082 !! test
1083 Italics and bold: other quote tests: (3,2,3,2)
1084 !! options
1085 parsoid=wt2html
1086 !! wikitext
1087 '''this is about ''foo'''s family''
1088 !! html/*
1089 <p><b>this is about <i>foo</i></b><i>s family</i>
1090 </p>
1091 !!end
1092
1093
1094 # same html as previous, but wikitext adjusted to match parsoid html2wt
1095 !! test
1096 Italics and bold: other quote tests: (3,2,3+2+2,2)
1097 !! wikitext
1098 '''this is about ''foo'''''<nowiki/>''s family''
1099 !! html
1100 <p><b>this is about <i>foo</i></b><i>s family</i>
1101 </p>
1102 !! end
1103
1104
1105 !! test
1106 Italics and bold: other quote tests: (3,2,3,3)
1107 !! wikitext
1108 '''this is about ''foo'''s family'''
1109 !! html/*
1110 <p>'<i>this is about </i>foo<b>s family</b>
1111 </p>
1112 !!end
1113
1114
1115 !! test
1116 Italics and bold: other quote tests: (3,(2,2),3)
1117 !! wikitext
1118 '''this is about ''foo's'' family'''
1119 !! html
1120 <p><b>this is about <i>foo's</i> family</b>
1121 </p>
1122 !!end
1123
1124
1125 !! test
1126 Italicized possessive
1127 !! wikitext
1128 The ''[[Main Page]]'''s talk page.
1129 !! html/php
1130 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1131 </p>
1132 !! html/parsoid
1133 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1134 !! end
1135
1136 !! test
1137 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1138 (Requires tidy for PHP parser output to be fixed up)
1139 !! options
1140 parsoid=wt2html,wt2wt
1141 !! wikitext
1142 {|
1143 !''a!!''b
1144 |''a||''b
1145 |}
1146 !! html/php+tidy
1147 <table>
1148 <tr>
1149 <th><i>a</i></th>
1150 <th><i>b</i></th>
1151 <td><i>a</i></td>
1152 <td><i>b</i></td>
1153 </tr>
1154 </table>
1155 !! html/parsoid
1156 <table>
1157 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1158 <td><i>a</i></td><td><i>b</i></td></tr>
1159 </tbody></table>
1160 !! end
1161
1162 ###
1163 ### Non-html5 tags
1164 ###
1165
1166 !! test
1167 Non-html5 tags should be accepted
1168 !! wikitext
1169 <center>''foo''</center>
1170 <big>''foo''</big>
1171 <font>''foo''</font>
1172 <strike>''foo''</strike>
1173 <tt>''foo''</tt>
1174 !! html
1175 <center><i>foo</i></center>
1176 <p><big><i>foo</i></big>
1177 <font><i>foo</i></font>
1178 <strike><i>foo</i></strike>
1179 <tt><i>foo</i></tt>
1180 </p>
1181 !! end
1182
1183 !! test
1184 <wbr> is valid wikitext (bug 52468)
1185 !! wikitext
1186 <wbr>
1187 !! html
1188 <p><wbr />
1189 </p>
1190 !! end
1191
1192 # <strike> is HTML4, <s> is HTML4/5.
1193 !! test
1194 <s> or <strike> for strikethrough
1195 !! wikitext
1196 <strike>strike</strike>
1197
1198 <s>s</s>
1199 !! html
1200 <p><strike>strike</strike>
1201 </p><p><s>s</s>
1202 </p>
1203 !! end
1204
1205 ## a not permitted
1206 ## i,b,br omitted
1207 !! test
1208 Text-level semantic html elements in wikitext
1209 !! wikitext
1210 <em>text</em>
1211 <strong>text</strong>
1212 <small>text</small>
1213 <s>text</s>
1214 <cite>text</cite>
1215 <q>text</q>
1216 <dfn>text</dfn>
1217 <abbr>text</abbr>
1218 <data>text</data>
1219 <time>text</time>
1220 <code>text</code>
1221 <var>text</var>
1222 <samp>text</samp>
1223 <kbd>text</kbd>
1224 <sub>text</sub>
1225 <u>text</u>
1226 <mark>text</mark>
1227 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1228 <bdi>text</bdi>
1229 <bdo>text</bdo>
1230 <span>text</span>
1231 <wbr />
1232 !! html
1233 <p><em>text</em>
1234 <strong>text</strong>
1235 <small>text</small>
1236 <s>text</s>
1237 <cite>text</cite>
1238 <q>text</q>
1239 <dfn>text</dfn>
1240 <abbr>text</abbr>
1241 <data>text</data>
1242 <time>text</time>
1243 <code>text</code>
1244 <var>text</var>
1245 <samp>text</samp>
1246 <kbd>text</kbd>
1247 <sub>text</sub>
1248 <u>text</u>
1249 <mark>text</mark>
1250 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1251 <bdi>text</bdi>
1252 <bdo>text</bdo>
1253 <span>text</span>
1254 <wbr />
1255 </p>
1256 !! end
1257
1258 # test cases taken from
1259 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1260 !! test
1261 Ruby markup (W3C-style)
1262 !! wikitext
1263 ; Mono-ruby for individual base characters
1264 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1265 ; Group ruby
1266 : <ruby>今日<rt>きょう</rt></ruby>
1267 ; Jukugo ruby
1268 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1269 ; Inline ruby
1270 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1271 ; Double-sided ruby
1272 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1273 <ruby>
1274 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1275 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1276 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1277 </ruby>
1278 !! html
1279 <dl><dt> Mono-ruby for individual base characters</dt>
1280 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1281 <dt> Group ruby</dt>
1282 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1283 <dt> Jukugo ruby</dt>
1284 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1285 <dt> Inline ruby</dt>
1286 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1287 <dt> Double-sided ruby</dt>
1288 <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>
1289 <p><ruby>
1290 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1291 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1292 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1293 </ruby>
1294 </p>
1295 !! end
1296
1297 # The next two test different paths in the sanitizer.
1298 !! test
1299 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1300 !! wikitext
1301 <blockquote|>a</blockquote>
1302
1303 <b→> doesn't terminate </b→>
1304
1305 <bä> doesn't terminate </bä>
1306
1307 <boo> doesn't terminate </boo>
1308
1309 <s.foo> doesn't terminate </s.foo>
1310
1311 <sub-ID#1>
1312 !! html
1313 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1314 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1315 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1316 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1317 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1318 </p><p>&lt;sub-ID#1&gt;
1319 </p>
1320 !! end
1321
1322 # There is a tidy bug here: https://sourceforge.net/p/tidy/bugs/946/
1323 # If the non-word-character tag made it through the sanitizer, tidy
1324 # would munge it up.
1325 !! test
1326 Non-word characters don't terminate tag names + tidy
1327 !! wikitext
1328 <blockquote|>a</blockquote>
1329
1330 <b→> doesn't terminate </b→>
1331
1332 <bä> doesn't terminate </bä>
1333
1334 <boo> doesn't terminate </boo>
1335
1336 <s.foo> doesn't terminate </s.foo>
1337
1338 <sub-ID#1>
1339 !! html+tidy
1340 <p>&lt;blockquote|&gt;a</p>
1341 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1342 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1343 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1344 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1345 <p>&lt;sub-ID#1&gt;</p>
1346 !! end
1347
1348 ###
1349 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1350 ### This checks that HTML5 tags (with non-word characters in the tag
1351 ### name) make it safely through the parser -- the Sanitizer will
1352 ### munge them later, as it should.
1353 ###
1354 !! test
1355 Non-word characters are valid in extension tags (T19663)
1356 !! wikitext
1357 <tåg>tåg</tåg>
1358 !! html/php
1359 <pre>
1360 'tåg'
1361 array (
1362 )
1363 </pre>
1364
1365 !! html/parsoid
1366 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1367 !! end
1368
1369 !! test
1370 Isolated close tags should be treated as literal text (bug 52760)
1371 !! options
1372 parsoid=wt2html
1373 !! wikitext
1374 </b>
1375
1376 <s.foo>s</s>
1377 !! html/php+tidy
1378 <p>&lt;s.foo&gt;s</p>
1379 !! html/parsoid
1380 <p>&lt;s.foo&gt;s</p>
1381 !! end
1382
1383 ###
1384 ### Special characters
1385 ###
1386
1387 !! test
1388 Bare pipe character (bug 52363)
1389 !! wikitext
1390 |
1391 !! html
1392 <p>|
1393 </p>
1394 !! end
1395
1396 !! test
1397 Bare pipe character from a template (bug 52363)
1398 !! wikitext
1399 {{pipe}}
1400 !! html
1401 <p>|
1402 </p>
1403 !! end
1404
1405 ###
1406 ### <nowiki> test cases
1407 ###
1408
1409 !! test
1410 <nowiki> unordered list
1411 !! wikitext
1412 <nowiki>* This is not an unordered list item.</nowiki>
1413 !! html/php
1414 <p>* This is not an unordered list item.
1415 </p>
1416 !! html/parsoid
1417 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1418 !! end
1419
1420 !! test
1421 <nowiki> spacing
1422 !! wikitext
1423 <nowiki>Lorem ipsum dolor
1424
1425 sed abit.
1426 sed nullum.
1427
1428 :and a colon
1429 </nowiki>
1430 !! html/php
1431 <p>Lorem ipsum dolor
1432
1433 sed abit.
1434 sed nullum.
1435
1436 :and a colon
1437
1438 </p>
1439 !! html/parsoid
1440 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1441
1442 sed abit.
1443 sed nullum.
1444
1445 :and a colon
1446 </span></p>
1447 !! end
1448
1449 !! test
1450 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1451 !! wikitext
1452 <nowiki><span class="error"></nowiki>
1453 !! html/php
1454 <p>&lt;span class="error"&gt;
1455 </p>
1456 !! end
1457
1458 !! test
1459 nowiki 3
1460 !! wikitext
1461 :There is not nowiki.
1462 :There is <nowiki>nowiki</nowiki>.
1463
1464 #There is not nowiki.
1465 #There is <nowiki>nowiki</nowiki>.
1466
1467 *There is not nowiki.
1468 *There is <nowiki>nowiki</nowiki>.
1469 !! html/php
1470 <dl><dd>There is not nowiki.</dd>
1471 <dd>There is nowiki.</dd></dl>
1472 <ol><li>There is not nowiki.</li>
1473 <li>There is nowiki.</li></ol>
1474 <ul><li>There is not nowiki.</li>
1475 <li>There is nowiki.</li></ul>
1476
1477 !! html/parsoid
1478 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1479 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1480
1481 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1482 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1483
1484 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1485 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1486 !! end
1487
1488 !! test
1489 Entities inside <nowiki>
1490 !! wikitext
1491 <nowiki>&lt;</nowiki>
1492 !! html
1493 <p>&lt;
1494 </p>
1495 !! end
1496
1497 !! test
1498 Entities inside template parameters
1499 !! wikitext
1500 {{echo|&ndash;}}
1501 !! html/php+tidy
1502 <p>–</p>
1503 !! html/parsoid
1504 <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>
1505 !! end
1506
1507 !! test
1508 Properly escape nowiki when combined with other wiki markup
1509 !! options
1510 parsoid=html2wt
1511 !! html/parsoid
1512 <p>* &lt;/nowiki&gt; tag</p>
1513 !! wikitext
1514 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1515 !! end
1516
1517 !! test
1518 T93824: Put escaped HTML tags inside nowiki
1519 !! options
1520 parsoid=html2wt
1521 !! html/parsoid
1522 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1523 !! wikitext
1524 <nowiki><h2>foo</h2></nowiki>
1525 !! end
1526
1527 !! test
1528 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1529 !! options
1530 parsoid=html2wt
1531 !! html/parsoid
1532 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1533 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1534 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1535 !! wikitext
1536 This text: L'[[Foo]]
1537 This text: L<nowiki>''</nowiki>[[Foo]]
1538 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1539 !! end
1540
1541 # This test fails because wikitext whitespace is not normalized before comparing.
1542 !! test
1543 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1544 !! options
1545 parsoid=html2wt
1546 !! html/parsoid
1547 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1548 </p>
1549 !! wikitext
1550 This text : L<nowiki>''</nowiki>[[Foo]]
1551 !! end
1552
1553 # This test and the next one are html2wt only as they test that incorrect wikitext
1554 # passed in template arguments gets escaped or wrapped in nowikis where required.
1555 !! test
1556 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1557 !! options
1558 parsoid=html2wt
1559 !! html/parsoid
1560 <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>
1561 <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>
1562 !! wikitext
1563 {{echo|foo{{!}}bar}}
1564 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1565 !! end
1566
1567 !! test
1568 T53961: Output correct nowikis in template arguments
1569 !! options
1570 parsoid=html2wt
1571 !! html/parsoid
1572 <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>
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="#mwt2"></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 [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></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="#mwt4"></span>
1576 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1577 !! wikitext
1578 {{echo|a [ b}}
1579 {{echo|<nowiki>a }} b</nowiki>}}
1580 {{echo|<nowiki>a [[ b</nowiki>}}
1581 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1582 {{echo|a <nowiki>}</nowiki>}}
1583 !! end
1584
1585 !! test
1586 Cases where "!!" needs nowiki protection
1587 !! options
1588 parsoid=html2wt
1589 !! html/parsoid
1590 <table>
1591 <tr><th>this needs protection !! here</th></tr>
1592 </table>
1593
1594 <table>
1595 <tr><th>this does not need
1596 protection !! here</th></tr>
1597 </table>
1598 !! wikitext
1599 {|
1600 !<nowiki>this needs protection !! here</nowiki>
1601 |}
1602
1603 {|
1604 !this does not need
1605 protection !! here
1606 |}
1607 !! end
1608
1609 ###
1610 ### Comments
1611 ###
1612 !! test
1613 Comments and Indent-Pre
1614 !! wikitext
1615 <!-- comment 1 --> asdf
1616
1617 <!-- comment 1 --> asdf
1618 <!-- comment 2 -->
1619
1620 <!-- comment 1 --> asdf
1621 <!-- comment 2 -->xyz
1622
1623 <!-- comment 1 --> asdf
1624 <!-- comment 2 --> xyz
1625 !! html
1626 <pre>asdf
1627 </pre>
1628 <pre>asdf
1629 </pre>
1630 <pre>asdf
1631 </pre>
1632 <p>xyz
1633 </p>
1634 <pre>asdf
1635 xyz
1636 </pre>
1637 !! end
1638
1639 !! test
1640 Comment test 2a
1641 !! wikitext
1642 asdf
1643 <!-- comment 1 -->
1644 jkl
1645 !! html
1646 <p>asdf
1647 jkl
1648 </p>
1649 !! end
1650
1651 !! test
1652 Comment test 2b
1653 !! wikitext
1654 asdf
1655 <!-- comment 1 -->
1656
1657 jkl
1658 !! html
1659 <p>asdf
1660 </p><p>jkl
1661 </p>
1662 !! end
1663
1664 !! test
1665 Comment test 3
1666 !! wikitext
1667 asdf
1668 <!-- comment 1 -->
1669 <!-- comment 2 -->
1670 jkl
1671 !! html
1672 <p>asdf
1673 jkl
1674 </p>
1675 !! end
1676
1677 !! test
1678 Comment test 4
1679 !! wikitext
1680 asdf<!-- comment 1 -->jkl
1681 !! html
1682 <p>asdfjkl
1683 </p>
1684 !! end
1685
1686 !! test
1687 Comment spacing
1688 !! wikitext
1689 a
1690 <!-- foo --> b <!-- bar -->
1691 c
1692 !! html
1693 <p>a
1694 </p>
1695 <pre> b
1696 </pre>
1697 <p>c
1698 </p>
1699 !! end
1700
1701 !! test
1702 Comment whitespace
1703 !! wikitext
1704 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1705 !! html
1706
1707 !! end
1708
1709 !! test
1710 Comment semantics and delimiters
1711 !! wikitext
1712 <!-- --><!----><!-----><!------>
1713 !! html/php
1714
1715 !! html/parsoid
1716 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1717 !! end
1718
1719 !! test
1720 Comment semantics and delimiters, redux
1721 !! wikitext
1722 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1723 -- foo -- funky huh? ... -->
1724 !! html/php
1725
1726 !! html/parsoid
1727 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1728 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1729 !! end
1730
1731 !! test
1732 Comment semantics and delimiters: directors cut
1733 !! wikitext
1734 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1735 everything starting with < followed by !-- until the first -- and > we see,
1736 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1737 -->-->
1738 !! html/php
1739 <p>--&gt;
1740 </p>
1741 !! html/parsoid
1742 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1743 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1744 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1745 --><p>--></p>
1746 !! end
1747
1748 !! test
1749 Comment semantics: nesting
1750 !! wikitext
1751 <!--<!-- no, we're not going to do anything fancy here -->-->
1752 !! html/php
1753 <p>--&gt;
1754 </p>
1755 !! html/parsoid
1756 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1757 !! end
1758
1759 # Parsoid closes the unclosed comment, even if it means a slight
1760 # round-trip diff.
1761 !! test
1762 Comment semantics: unclosed comment at end
1763 !! options
1764 parsoid=wt2html,html2html
1765 !! wikitext
1766 <!--This comment will run out to the end of the document
1767 !! html/php
1768
1769 !! html/parsoid
1770 <!--This comment will run out to the end of the document-->
1771 !! end
1772
1773 !! test
1774 Comment semantics: normalize comments to play nice with XML and browsers
1775 !! wikitext
1776 <!-- Browsers --!> think this is closed -->
1777 <!--> This would normally be text -->
1778 <!---> As would this -->
1779 <!-- XML doesn't like trailing dashes -------->
1780 <!-- Nor doubled hyphens -- anywhere in the data -->
1781 But this is not a comment.
1782 !! html/php
1783 <p>But this is not a comment.
1784 </p>
1785 !! html/parsoid
1786 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1787 <!--&#x3E; This would normally be text -->
1788 <!--&#x2D;&#x3E; As would this -->
1789 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1790 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1791 <p>But this is not a comment.</p>
1792 !! end
1793
1794 !! test
1795 Comment semantics: round-trip even text which contains encoded -->
1796 !! wikitext
1797 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1798 !! html/parsoid
1799 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1800 !! end
1801
1802 !! test
1803 Comment in template title
1804 !! wikitext
1805 {{f<!---->oo}}
1806 !! html
1807 <p>FOO
1808 </p>
1809 !! end
1810
1811 !! test
1812 Comment on its own line post-expand
1813 !! wikitext
1814 a
1815 {{blank}}<!---->
1816 b
1817 !! html
1818 <p>a
1819 </p><p>b
1820 </p>
1821 !! end
1822
1823 !! test
1824 Comment on its own line post-expand with non-significant whitespace
1825 !! wikitext
1826 a
1827 {{blank}} <!---->
1828 b
1829 !! html
1830 <p>a
1831 </p><p>b
1832 </p>
1833 !! end
1834
1835 !! test
1836 Multiple comments should still parse as SOL-transparent
1837 !! options
1838 parsoid=wt2html,wt2wt
1839 !! wikitext
1840 <!--c1-->*a
1841 <!--c2--><!--c3--><!--c4-->*b
1842 !! html/php
1843 <ul><li>a</li>
1844 <li>b</li></ul>
1845
1846 !! html/parsoid
1847 <!--c1--><ul>
1848 <li>a
1849 </li>
1850 <!--c2--><!--c3--><!--c4-->
1851 <li>b
1852 </li>
1853 </ul>
1854 !! end
1855
1856 ###
1857 ### paragraph wrapping tests
1858 ###
1859 !! test
1860 No block tags
1861 !! wikitext
1862 a
1863
1864 b
1865 !! html
1866 <p>a
1867 </p><p>b
1868 </p>
1869 !! end
1870
1871 !! test
1872 Block tag on one line (<div>)
1873 !! wikitext
1874 a <div>foo</div>
1875
1876 b
1877 !! html
1878 a <div>foo</div>
1879 <p>b
1880 </p>
1881 !! html+tidy
1882 <p>a</p>
1883 <div>foo</div>
1884 <p>b</p>
1885 !! end
1886
1887 !! test
1888 Block tag on one line (<blockquote>)
1889 !! wikitext
1890 a <blockquote>foo</blockquote>
1891
1892 b
1893 !! html
1894 a <blockquote>foo</blockquote>
1895 <p>b
1896 </p>
1897 !! html+tidy
1898 <p>a</p>
1899 <blockquote>
1900 <p>foo</p>
1901 </blockquote>
1902 <p>b</p>
1903 !! end
1904
1905 !! test
1906 Block tag on both lines (<div>)
1907 !! wikitext
1908 a <div>foo</div>
1909
1910 b <div>foo</div>
1911 !! html
1912 a <div>foo</div>
1913 b <div>foo</div>
1914
1915 !! html+tidy
1916 <p>a</p>
1917 <div>foo</div>
1918 <p>b</p>
1919 <div>foo</div>
1920 !! end
1921
1922 !! test
1923 Block tag on both lines (<blockquote>)
1924 !! wikitext
1925 a <blockquote>foo</blockquote>
1926
1927 b <blockquote>foo</blockquote>
1928 !! html
1929 a <blockquote>foo</blockquote>
1930 b <blockquote>foo</blockquote>
1931
1932 !! html+tidy
1933 <p>a</p>
1934 <blockquote>
1935 <p>foo</p>
1936 </blockquote>
1937 <p>b</p>
1938 <blockquote>
1939 <p>foo</p>
1940 </blockquote>
1941 !! end
1942
1943 !! test
1944 Multiple lines without block tags
1945 !! wikitext
1946 <div>foo</div> a
1947 b
1948 c
1949 d<!--foo--> e
1950 x <div>foo</div> z
1951 !! html
1952 <div>foo</div> a
1953 <p>b
1954 c
1955 d e
1956 </p>
1957 x <div>foo</div> z
1958
1959 !! html+tidy
1960 <div>foo</div>
1961 <p>a</p>
1962 <p>b c d e</p>
1963 <p>x</p>
1964 <div>foo</div>
1965 <p>z</p>
1966 !! end
1967
1968 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1969 # So, we have a separate section for Parsoid. We don't want
1970 # to mimic this stripping behavior in Parsoid. It affects
1971 # editing experience and also requires us to maintain additional
1972 # info for RT-ing.
1973 !! test
1974 Empty lines between lines with block tags
1975 !! wikitext
1976 <div></div>
1977
1978
1979 <div></div>a
1980
1981 b
1982 <div>a</div>b
1983
1984 <div>b</div>d
1985
1986
1987 <div>e</div>
1988 !! html
1989 <div></div>
1990 <p><br />
1991 </p>
1992 <div></div>a
1993 <p>b
1994 </p>
1995 <div>a</div>b
1996 <div>b</div>d
1997 <p><br />
1998 </p>
1999 <div>e</div>
2000
2001 !! html+tidy
2002 <p><br /></p>
2003 <p>a</p>
2004 <p>b</p>
2005 <div>a</div>
2006 <p>b</p>
2007 <div>b</div>
2008 <p>d</p>
2009 <p><br /></p>
2010 <div>e</div>
2011 !! html/parsoid
2012 <div data-parsoid='{"stx":"html"}'></div>
2013
2014 <p><br /></p>
2015 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2016
2017 <p>b</p>
2018 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2019
2020 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2021
2022 <p><br /></p>
2023 <div data-parsoid='{"stx":"html"}'>e</div>
2024 !! end
2025
2026 ## PHP parser emits output which is broken
2027 !! test
2028 Unclosed HTML p-tags should be handled properly
2029 !! wikitext
2030 <div><p>foo</div>
2031 a
2032
2033 b
2034 !! html/php+tidy
2035 <div>
2036 <p>foo</p>
2037 </div>
2038 <p>a</p>
2039 <p>b</p>
2040 !! html/parsoid
2041 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2042 <p>a</p>
2043 <p>b</p>
2044 !! end
2045
2046 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2047 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2048 ## them for now.
2049 !! test
2050 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2051 !! options
2052 parsoid=wt2html
2053 !! wikitext
2054 a [[Category:A1]] [[Category:A2]]
2055 [[Category:A3]]
2056 [[Category:A4]]
2057 !! html/parsoid
2058 <p>a</p>
2059 <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"/>
2060 !! end
2061
2062 !! test
2063 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2064 !! options
2065 parsoid=wt2html
2066 !! wikitext
2067 [[Category:A1]]a
2068 !! html/parsoid
2069 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2070 !! end
2071
2072 ###
2073 ### Preformatted text
2074 ###
2075 !! test
2076 Preformatted text
2077 !! wikitext
2078 This is some
2079 Preformatted text
2080 With ''italic''
2081 And '''bold'''
2082 And a [[Main Page|link]]
2083 !! html
2084 <pre>This is some
2085 Preformatted text
2086 With <i>italic</i>
2087 And <b>bold</b>
2088 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2089 </pre>
2090 !! end
2091
2092 !! test
2093 Tabs don't trigger preformatted text
2094 !! wikitext
2095 This is not
2096 preformatted text.
2097 This is preformatted text.
2098 So is this.
2099 !! html/php
2100 <p> This is not
2101 preformatted text.
2102 </p>
2103 <pre>This is preformatted text.
2104 So is this.
2105 </pre>
2106 !! html/parsoid
2107 <p> This is not
2108 preformatted text.</p>
2109 <pre>This is preformatted text.
2110 So is this.</pre>
2111 !! end
2112
2113 !! test
2114 Space before tab needs nowiki pre protection
2115 !! options
2116 parsoid=html2wt
2117 !! html/parsoid
2118 <p> a</p>
2119 !! wikitext
2120 <nowiki> </nowiki> a
2121 !! end
2122
2123 !! test
2124 Ident preformatting with inline content
2125 !! wikitext
2126 a
2127 ''b''
2128 !! html
2129 <pre>a
2130 <i>b</i>
2131 </pre>
2132 !! end
2133
2134 !! test
2135 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2136 !! wikitext
2137 <pre><nowiki>
2138 <b>
2139 <cite>
2140 <em>
2141 </nowiki></pre>
2142 !! html
2143 <pre>
2144 &lt;b&gt;
2145 &lt;cite&gt;
2146 &lt;em&gt;
2147 </pre>
2148
2149 !! end
2150
2151 !! test
2152 Regression with preformatted in <center>
2153 !! wikitext
2154 <center>
2155 Blah
2156 </center>
2157 !! html
2158 <center>
2159 <pre>Blah
2160 </pre>
2161 </center>
2162
2163 !! end
2164
2165 !! test
2166 Bug 52763: Preformatted in <blockquote>
2167 !! wikitext
2168 <blockquote>
2169 Blah
2170 {|
2171 |
2172 indented cell (no pre-wrapping!)
2173 |}
2174 </blockquote>
2175 !! html
2176 <blockquote>
2177 <p> Blah
2178 </p>
2179 <table>
2180 <tr>
2181 <td>
2182 <p> indented cell (no pre-wrapping!)
2183 </p>
2184 </td></tr></table>
2185 </blockquote>
2186
2187 !! end
2188
2189 !! test
2190 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2191 !! wikitext
2192 <blockquote>
2193 Foo
2194
2195 Bar
2196 </blockquote>
2197 !! html
2198 <blockquote>
2199 <p>Foo
2200 </p><p>Bar
2201 </p>
2202 </blockquote>
2203
2204 !! end
2205
2206 !! test
2207 Bug 15491: <ins>/<del> in blockquote
2208 !! wikitext
2209 <blockquote>
2210 Foo <del>bar</del> <ins>baz</ins> quux
2211 </blockquote>
2212 !! html
2213 <blockquote>
2214 <p>Foo <del>bar</del> <ins>baz</ins> quux
2215 </p>
2216 </blockquote>
2217
2218 !! end
2219
2220 # Note that the p-wrapping is newline sensitive, which could be
2221 # considered a bug: tidy will wrap only the 'Foo' in the example
2222 # below in a <p> tag. (see comment 23-25 of bug #6200)
2223 !! test
2224 Bug 15491: <ins>/<del> in blockquote (2)
2225 !! wikitext
2226 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2227 </blockquote>
2228 !! html
2229 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2230 </blockquote>
2231
2232 !! html+tidy
2233 <blockquote>
2234 <p>Foo</p>
2235 <del>bar</del> <ins>baz</ins> quux</blockquote>
2236 !! end
2237
2238 !! test
2239 <pre> with attributes (bug 3202)
2240 !! wikitext
2241 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2242 !! html
2243 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2244
2245 !! end
2246
2247 !! test
2248 <pre> with width attribute (bug 3202)
2249 !! wikitext
2250 <pre width="8">Narrow screen goodies</pre>
2251 !! html
2252 <pre width="8">Narrow screen goodies</pre>
2253
2254 !! end
2255
2256 !! test
2257 <pre> with forbidden attribute (bug 3202)
2258 !! wikitext
2259 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2260 !! html
2261 <pre width="8">Narrow screen goodies</pre>
2262
2263 !! end
2264
2265 !! test
2266 Entities inside <pre>
2267 !! wikitext
2268 <pre>&lt;</pre>
2269 !! html
2270 <pre>&lt;</pre>
2271
2272 !! end
2273
2274 !! test
2275 <pre> with forbidden attribute values (bug 3202)
2276 !! wikitext
2277 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2278 !! html
2279 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2280
2281 !! end
2282
2283 !! test
2284 <nowiki> inside <pre> (bug 13238)
2285 !! wikitext
2286 <pre>
2287 <nowiki>
2288 </pre>
2289 <pre>
2290 <nowiki></nowiki>
2291 </pre>
2292 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2293 !! html
2294 <pre>
2295 &lt;nowiki&gt;
2296 </pre>
2297 <pre>
2298
2299 </pre>
2300 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2301
2302 !! end
2303
2304 !! test
2305 <nowiki> inside of #tag:pre
2306 !! wikitext
2307 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2308 !! html/php
2309 <pre>Foo &#8594;bar</pre>
2310
2311 !! html/parsoid
2312 <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>
2313 !! end
2314
2315 !! test
2316 <nowiki> and <pre> preference (first one wins)
2317 !! wikitext
2318 <pre>
2319 <nowiki>
2320 </pre>
2321 </nowiki>
2322 </pre>
2323
2324 <nowiki>
2325 <pre>
2326 <nowiki>
2327 </pre>
2328 </nowiki>
2329 </pre>
2330
2331 !! html/php
2332 <pre>
2333 &lt;nowiki&gt;
2334 </pre>
2335 <p>&lt;/nowiki&gt;
2336 &lt;/pre&gt;
2337 </p><p>
2338 &lt;pre&gt;
2339 &lt;nowiki&gt;
2340 &lt;/pre&gt;
2341
2342 &lt;/pre&gt;
2343 </p>
2344 !! html/parsoid
2345 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2346 </pre>
2347 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2348 &lt;/pre></p>
2349
2350 <p><span typeof="mw:Nowiki">
2351 &lt;pre>
2352 &lt;nowiki>
2353 &lt;/pre>
2354 </span>
2355 &lt;/pre></p>
2356 !! end
2357
2358 !! test
2359 </pre> inside nowiki
2360 !! wikitext
2361 <nowiki></pre></nowiki>
2362 !! html
2363 <p>&lt;/pre&gt;
2364 </p>
2365 !! end
2366
2367 # Parsoid doesn't strip empty tags, like Tidy does.
2368 !! test
2369 Empty pre; pre inside other HTML tags (bug 54946)
2370 !! options
2371 parsoid=wt2html,wt2wt
2372 !! wikitext
2373 a
2374
2375 <div><pre>
2376 foo
2377 </pre></div>
2378 <pre></pre>
2379 !! html/php
2380 <p>a
2381 </p>
2382 <div><pre>
2383 foo
2384 </pre></div>
2385 <pre></pre>
2386
2387 !! html/php+tidy
2388 <p>a</p>
2389 <div>
2390 <pre>
2391 foo
2392 </pre></div>
2393 !! html/parsoid
2394 <p>a</p>
2395
2396 <div><pre>foo
2397 </pre></div>
2398 <pre></pre>
2399 !! end
2400
2401 !! test
2402 HTML pre followed by indent-pre
2403 !! wikitext
2404 <pre>foo</pre>
2405 bar
2406 !! html
2407 <pre>foo</pre>
2408 <pre>bar
2409 </pre>
2410 !! end
2411
2412 # Note that tidy removes the empty <p> tags from the start and end.
2413 # Parsoid does not, by design.
2414 !!test
2415 Block tag pre
2416 !! wikitext
2417 <p><pre>foo</pre></p>
2418 !! html/php+tidy
2419 <pre>
2420 foo
2421 </pre>
2422 !! html/parsoid
2423 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2424 !!end
2425
2426 !!test
2427 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2428 !! wikitext
2429 {{echo|}}
2430 !! html
2431
2432 !!end
2433
2434 !!test
2435 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2436 !! wikitext
2437 {{echo|
2438 foo}}
2439 !! html
2440 <p>foo
2441 </p>
2442 !!end
2443
2444 !! test
2445 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2446 !! wikitext
2447 {{echo|a
2448 b}}
2449 !! html
2450 <pre>a
2451 </pre>
2452 <p>b
2453 </p>
2454 !!end
2455
2456 !! test
2457 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2458 !! wikitext
2459 {{echo|a
2460 b
2461 c
2462 d
2463 e
2464 }}
2465 !! html
2466 <pre>a
2467 </pre>
2468 <p>b
2469 c
2470 </p>
2471 <pre>d
2472 </pre>
2473 <p>e
2474 </p>
2475 !!end
2476
2477 !!test
2478 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2479 !! wikitext
2480 {{echo| foo}}
2481
2482 {{echo| foo}}{{echo| bar}}
2483
2484 {{echo| foo}}
2485 {{echo| bar}}
2486
2487 {{echo|<!--cmt--> foo}}
2488
2489 <!--cmt-->{{echo| foo}}
2490
2491 {{echo|{{echo| }}bar}}
2492 !! html
2493 <pre>foo
2494 </pre>
2495 <pre>foo bar
2496 </pre>
2497 <pre>foo
2498 bar
2499 </pre>
2500 <pre>foo
2501 </pre>
2502 <pre>foo
2503 </pre>
2504 <pre>bar
2505 </pre>
2506 !!end
2507
2508 !! test
2509 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2510 !! wikitext
2511 {{echo| }}a
2512
2513 {{echo|
2514 }}a
2515
2516 {{echo|
2517 b}}
2518
2519 {{echo|a
2520 }}b
2521
2522 {{echo|a
2523 }} b
2524 !! html
2525 <pre>a
2526 </pre>
2527 <p><br />
2528 </p>
2529 <pre>a
2530 </pre>
2531 <p><br />
2532 </p>
2533 <pre>b
2534 </pre>
2535 <p>a
2536 </p>
2537 <pre>b
2538 </pre>
2539 <p>a
2540 </p>
2541 <pre>b
2542 </pre>
2543 !!end
2544
2545 !! test
2546 Pres with newline attributes
2547 !! wikitext
2548 <pre class="one
2549 two">hi</pre>
2550 !! html/php
2551 <pre class="one two">hi</pre>
2552
2553 !! html/parsoid
2554 <pre class="one
2555 two" data-parsoid='{"stx":"html"}'>hi</pre>
2556 !! end
2557
2558 !! test
2559 Things that look like <pre> tags aren't treated as such
2560 !! wikitext
2561 Barack Obama <President> of the United States
2562 <President></President>
2563 !! html
2564 <p>Barack Obama &lt;President&gt; of the United States
2565 &lt;President&gt;&lt;/President&gt;
2566 </p>
2567 !! end
2568
2569 !! test
2570 Handle broken pre-like tags (bug 64025)
2571 !! options
2572 parsoid=wt2html
2573 !! wikitext
2574 {{echo|<pre <pre>x</pre>}}
2575
2576 <table><pre </table>
2577 !! html/php
2578 <pre>x</pre>
2579 <table>&lt;pre </table>
2580
2581 !! html/php+tidy
2582 <pre>
2583 x
2584 </pre>
2585 <p>&lt;pre</p>
2586 !! html/parsoid
2587 <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>
2588
2589
2590 <p>&lt;pre </p>
2591
2592 <table></table>
2593 !! end
2594
2595 !! test
2596 Parsoid: handle pre with space after attribute
2597 !! options
2598 parsoid=wt2html
2599 !! wikitext
2600 <pre style="width:50%;" >{{echo|foo}}</pre>
2601 !! html/php
2602 <pre style="width:50%;">{{echo|foo}}</pre>
2603
2604 !! html/parsoid
2605 <pre style="width:50%;">{{echo|foo}}</pre>
2606 !! end
2607
2608 # TODO / maybe: fix wt2wt for this
2609 !! test
2610 Parsoid: Don't paragraph-wrap fosterable content
2611 !! options
2612 parsoid=wt2html
2613 !! wikitext
2614 {|
2615 <td></td>
2616 <td></td>
2617
2618
2619
2620 |}
2621 !! html
2622 <table>
2623
2624 <tbody>
2625 <tr>
2626 <td></td>
2627
2628 <td></td></tr>
2629
2630
2631
2632 </tbody></table>
2633 !! end
2634
2635 !! test
2636 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2637 !! options
2638 parsoid=wt2html
2639 !! wikitext
2640 {|
2641 <td>
2642 <td>
2643 </td>
2644
2645
2646
2647 |}
2648 !! html
2649 <table>
2650
2651 <tbody>
2652 <tr>
2653 <td></td>
2654
2655 <td>
2656 </td></tr>
2657
2658
2659
2660 </tbody></table>
2661 !! end
2662
2663
2664 #--------------------------------------------------------------------
2665 # Transclusion parameter whitespace stripping tests
2666 # Behavior is different for positional and named parameters
2667 #--------------------------------------------------------------------
2668 !! test
2669 Templates: Strip leading and trailing whitespace from named-param values
2670 !! wikitext
2671 {{echo|1= a }}
2672
2673 {{echo|1= {{echo|b}} }}
2674
2675 {{echo| 1 =
2676 c }}
2677
2678 {{echo| 1 =
2679 * d
2680 }}
2681 !! html
2682 <p>a
2683 </p><p>b
2684 </p><p>c
2685 </p>
2686 <ul><li> d</li></ul>
2687
2688 !! end
2689
2690 !! test
2691 Templates: Don't strip whitespace from positional-param values
2692 !! wikitext
2693 {{echo|a }}
2694
2695 {{echo|{{echo|b}} }}
2696
2697 {{echo| c
2698 }}
2699
2700 {{echo| {{echo|d}}
2701 }}
2702
2703 {{echo|
2704 e}}
2705
2706 {{echo|
2707 * f}}
2708
2709 {{echo|
2710 }}g
2711 !! html
2712 <p>a
2713 </p><p>b
2714 </p>
2715 <pre>c
2716 </pre>
2717 <p><br />
2718 </p>
2719 <pre>d
2720 </pre>
2721 <p><br />
2722 </p>
2723 <pre>e
2724 </pre>
2725 <p><br />
2726 </p>
2727 <ul><li> f</li></ul>
2728 <p><br />
2729 </p>
2730 <pre>g
2731 </pre>
2732 !! end
2733
2734 !! test
2735 Templates: Handle empty comment-and-ws-only lines correctly
2736 !! wikitext
2737 {{echo|foo
2738 <!--should be ignored-->
2739 <!--should be ignored as well-->
2740 bar}}
2741 !! html/php
2742 <p>foo
2743 bar
2744 </p>
2745 !! html/parsoid
2746 <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>
2747 !! end
2748
2749 !! test
2750 Templates: Handle comments in the target
2751 !! wikitext
2752 {{echo
2753 <!-- should be ignored -->
2754 |foo}}
2755
2756 {{echo
2757 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2758 |foo}}
2759
2760 {{echo<!-- should be ignored -->
2761 |foo}}
2762
2763 {{echo<!-- should be ignored -->|foo}}
2764
2765 {{<!-- should be ignored -->echo|foo}}
2766 !! html/php
2767 <p>foo
2768 </p><p>foo
2769 </p><p>foo
2770 </p><p>foo
2771 </p><p>foo
2772 </p>
2773 !! html/parsoid
2774 <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>
2775
2776 <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>
2777
2778 <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>
2779
2780 <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>
2781
2782 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2783 !!end
2784
2785 !! test
2786 Templates: Handle comments in parameter names (bug 67657)
2787 !! wikitext
2788 {{echo|1
2789 <!-- should be ignored -->
2790 =foo}}
2791
2792 {{echo|
2793 <!-- should be ignored -->
2794 1 = foo}}
2795
2796 {{echo|1<!-- should be ignored -->=foo}}
2797
2798 {{echo|<!-- should be ignored -->1=foo}}
2799 !! html/php
2800 <p>foo
2801 </p><p>foo
2802 </p><p>foo
2803 </p><p>foo
2804 </p>
2805 !! html/parsoid
2806 <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>
2807
2808 <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>
2809
2810 <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>
2811
2812 <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>
2813 !!end
2814
2815 !! test
2816 Templates: Other wikitext in parameter names (bug 67657)
2817 !! wikitext
2818 {{echo|''1''=foo}}
2819 !! html/php
2820 <p>{{{1}}}
2821 </p>
2822 !! html/parsoid
2823 <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>
2824 !!end
2825
2826 #--------------------------------------------------------------------
2827 # Transclusion parameter escaping tests
2828 #--------------------------------------------------------------------
2829 !! test
2830 Templates: Parsoid parameter escaping test 1
2831 !! wikitext
2832 {{echo|[foo]|{{echo|[bar]}}}}
2833 !! html/php+tidy
2834 <p>[foo]</p>
2835 !! html/parsoid
2836 <p about="#mwt1" typeof="mw:Transclusion"
2837 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2838 !! end
2839
2840 !! test
2841 Parsoid: Pipes in external links in template parameter
2842 !! wikitext
2843 {{echo|[{{echo|http://example.com}} link]}}
2844 !! html/php+tidy
2845 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2846 !! html/parsoid
2847 <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>
2848 !! end
2849
2850 !! test
2851 Parsoid: pipe in transclusion parameter
2852 !! wikitext
2853 {{echo|http://foo.com/a&#124;b}}
2854 !! html/php+tidy
2855 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2856 !! html/parsoid
2857 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2858 typeof="mw:Transclusion"
2859 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2860 !! end
2861
2862 !! test
2863 Parsoid: Pipe in external link target and content in template parameter
2864 !! options
2865 parsoid=html2wt,wt2wt
2866 !! wikitext
2867 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2868 !! html/php+tidy
2869 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2870 !! html/parsoid
2871 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2872 typeof="mw:Transclusion"
2873 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2874 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2875 !! end
2876
2877 !! test
2878 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2879 !! options
2880 parsoid
2881 !! wikitext
2882 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2883 !! html
2884 <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>
2885 !! end
2886
2887 !! test
2888 Templates: Don't escape already nowiki-escaped text in template parameters
2889 !! options
2890 parsoid=html2wt,wt2wt
2891 !! wikitext
2892 {{echo|foo<nowiki>|</nowiki>bar}}
2893 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2894 {{echo|<nowiki></nowiki>}}
2895 !! html/php+tidy
2896 <p>foo|bar &lt;div&gt;</p>
2897 !! html/parsoid
2898 <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>
2899 <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>
2900 <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>
2901 </p>
2902 !! end
2903
2904 ## Bug 52824
2905 !! test
2906 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2907 !! options
2908 parsoid=html2wt,wt2wt
2909 !! wikitext
2910 {{echo|{{echo|1=bar}}}}
2911 !! html/php+tidy
2912 <p>bar</p>
2913 !! html/parsoid
2914 <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>
2915 !! end
2916
2917 ## Bug 56733
2918 !! test
2919 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2920 !! wikitext
2921 {{echo|a : b}}
2922 !! html/php+tidy
2923 <p>a&#160;: b</p>
2924 !! html/parsoid
2925 <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>
2926 !! end
2927
2928 ## Bug T73412
2929 !! test
2930 Templates: Preserve blank parameter names
2931 !! wikitext
2932 {{echo|=foo}}
2933 !! html/php+tidy
2934 <p>{{{1}}}</p>
2935 !! html/parsoid
2936 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2937 !! end
2938
2939 !! test
2940 Templates: Preserve blank parameter names in other positions
2941 !! wikitext
2942 {{blank_param|bar|=foo}}
2943 !! html/php+tidy
2944 <p>bar foo</p>
2945 !! html/parsoid
2946 <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
2947 foo</p>
2948 !! end
2949
2950 ###
2951 ### Parsoid-centric tests for testing RT edge cases for pre
2952 ###
2953
2954 !!test
2955 1a. Indent-Pre and Comments
2956 !! wikitext
2957 a
2958 <!--a-->
2959 c
2960 !! html
2961 <pre>a
2962 </pre>
2963 <p>c
2964 </p>
2965 !!end
2966
2967 !!test
2968 1b. Indent-Pre and Comments
2969 !! wikitext
2970 a
2971 <!--a-->
2972 c
2973 !! html
2974 <pre>a
2975 </pre>
2976 <p>c
2977 </p>
2978 !!end
2979
2980 !!test
2981 1c. Indent-Pre and Comments
2982 !! wikitext
2983 <!--a--> a
2984
2985 <!--a--> a
2986 !! html
2987 <pre> a
2988 </pre>
2989 <pre> a
2990 </pre>
2991 !!end
2992
2993 !!test
2994 1d. Indent-Pre and Comments
2995 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2996 !! wikitext
2997 <!--a--> a
2998
2999 <!--b-->b
3000 !! html
3001 <pre>a
3002 </pre>
3003 <pre>b
3004 </pre>
3005 !!end
3006
3007 !!test
3008 2a. Indent-Pre and tables
3009 !! wikitext
3010 {|
3011 |-
3012 !h1!!h2
3013 |foo||bar
3014 |}
3015 !! html
3016 <table>
3017
3018 <tr>
3019 <th>h1</th>
3020 <th>h2
3021 </th>
3022 <td>foo</td>
3023 <td>bar
3024 </td></tr></table>
3025
3026 !!end
3027
3028 !!test
3029 2b. Indent-Pre and tables
3030 !! wikitext
3031 {|
3032 |-
3033 |foo
3034 |}
3035 !! html
3036 <table>
3037
3038 <tr>
3039 <td>foo
3040 </td></tr></table>
3041
3042 !!end
3043
3044 !!test
3045 2c. Indent-Pre and tables (bug 42252)
3046 !! wikitext
3047 {|
3048 |+ foo
3049 ! | bar
3050 |}
3051 !! html
3052 <table>
3053 <caption> foo
3054 </caption>
3055 <tr>
3056 <th> bar
3057 </th></tr></table>
3058
3059 !!end
3060
3061 !!test
3062 2d. Indent-Pre and tables
3063 !! wikitext
3064 a
3065 {|
3066 | b
3067 |}
3068 !! html/php
3069 <pre>a
3070 </pre>
3071 <table>
3072 <tr>
3073 <td> b
3074 </td></tr></table>
3075
3076 !! html/parsoid
3077 <pre>a</pre>
3078 <table>
3079 <tbody><tr><td> b</td></tr>
3080 </tbody></table>
3081 !!end
3082
3083 !!test
3084 2e. Indent-Pre and table-line syntax
3085 !! wikitext
3086 a
3087 | b
3088 | c
3089 !! html/php
3090 <pre>a
3091 | b
3092 | c
3093 </pre>
3094 !!end
3095
3096 !!test
3097 2f. Indent-pre started by table-line syntax
3098 !! wikitext
3099 a
3100 | b
3101 | c
3102 !! html/php
3103 <p>a
3104 </p>
3105 <pre>| b
3106 | c
3107 </pre>
3108 !! html/parsoid
3109 <p>a</p>
3110 <pre>
3111 | b
3112 | c</pre>
3113 !!end
3114
3115 !! test
3116 2g. Indented table markup mixed with indented pre content (proposed in bug 6200)
3117 !! wikitext
3118 <table>
3119 <tr>
3120 <td>
3121 Text that should be rendered preformatted
3122 </td>
3123 </tr>
3124 </table>
3125 !! html
3126 <table>
3127 <tr>
3128 <td>
3129 <pre>Text that should be rendered preformatted
3130 </pre>
3131 </td>
3132 </tr>
3133 </table>
3134
3135 !! end
3136
3137 !!test
3138 3a. Indent-Pre and block tags (single-line html)
3139 !! wikitext
3140 a <p> foo </p>
3141 b <div> foo </div>
3142 c <blockquote> foo </blockquote>
3143 <span> foo </span>
3144 !! html
3145 a <p> foo </p>
3146 b <div> foo </div>
3147 c <blockquote> foo </blockquote>
3148 <pre><span> foo </span>
3149 </pre>
3150 !! html/parsoid
3151 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3152 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3153 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3154 <pre><span> foo </span>
3155 </pre>
3156 !! html+tidy
3157 <p>a</p>
3158 <p>foo</p>
3159 <p>b</p>
3160 <div>foo</div>
3161 <p>c</p>
3162 <blockquote>
3163 <p>foo</p>
3164 </blockquote>
3165 <pre>
3166 <span> foo </span>
3167 </pre>
3168 !! end
3169
3170 !!test
3171 3b. Indent-Pre and block tags (multi-line html)
3172 !! wikitext
3173 a <span>foo</span>
3174 b <div> foo </div>
3175 !! html
3176 <pre>a <span>foo</span>
3177 </pre>
3178 b <div> foo </div>
3179
3180 !! html/parsoid
3181 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3182 b <div data-parsoid='{"stx":"html"}'> foo </div>
3183 !! html+tidy
3184 <pre>
3185 a <span>foo</span>
3186 </pre>
3187 <p>b</p>
3188 <div>foo</div>
3189 !!end
3190
3191 !!test
3192 3c. Indent-Pre and block tags (pre-content on separate line)
3193 !! wikitext
3194 <p>
3195 foo
3196 </p>
3197
3198 <div>
3199 foo
3200 </div>
3201
3202 <center>
3203 foo
3204 </center>
3205
3206 <blockquote>
3207 foo
3208 </blockquote>
3209
3210 <blockquote>
3211 <pre>
3212 foo
3213 </pre>
3214 </blockquote>
3215
3216 <table><tr><td>
3217 foo
3218 </td></tr></table>
3219
3220 <ul><li>
3221 foo
3222 </li></ul>
3223
3224 !! html
3225 <p>
3226 foo
3227 </p>
3228 <div>
3229 <pre>foo
3230 </pre>
3231 </div>
3232 <center>
3233 <pre>foo
3234 </pre>
3235 </center>
3236 <blockquote>
3237 <p> foo
3238 </p>
3239 </blockquote>
3240 <blockquote>
3241 <pre>
3242 foo
3243 </pre>
3244 </blockquote>
3245 <table><tr><td>
3246 <pre>foo
3247 </pre>
3248 </td></tr></table>
3249 <ul><li>
3250 foo
3251 </li></ul>
3252
3253 !!end
3254
3255 !! test
3256 4. Indent-Pre and extension tags
3257 !! wikitext
3258 a <tag />
3259 !! html/php
3260 a <pre>
3261 NULL
3262 array (
3263 )
3264 </pre>
3265
3266 !! html/parsoid
3267 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3268 !! end
3269
3270 !!test
3271 Render paragraphs when indent-pre is suppressed in blocklevels
3272 !! wikitext
3273 <blockquote>
3274 foo
3275
3276 bar
3277 </blockquote>
3278 !! html
3279 <blockquote>
3280 <p> foo
3281 </p><p> bar
3282 </p>
3283 </blockquote>
3284
3285 !!end
3286
3287 !!test
3288 4. Multiple spaces at start-of-line
3289 !! wikitext
3290 <p> foo </p>
3291 foo
3292 {|
3293 |foo
3294 |}
3295 !! html
3296 <p> foo </p>
3297 <pre> foo
3298 </pre>
3299 <table>
3300 <tr>
3301 <td>foo
3302 </td></tr></table>
3303
3304 !!end
3305
3306 ## NOTE: the leading white-space chars on empty line are significant
3307 !! test
3308 5a. White-space in indent-pre
3309 !! wikitext
3310 a<br />
3311
3312 b
3313 !! html
3314 <pre>a<br />
3315
3316 b
3317 </pre>
3318 !! end
3319
3320 ## NOTE: the leading white-space chars on empty line are significant
3321 !! test
3322 5b. White-space in indent-pre
3323 !! wikitext
3324 a
3325
3326 b
3327
3328
3329 c
3330 !! html
3331 <pre>a
3332
3333 b
3334
3335
3336 c
3337 </pre>
3338 !! end
3339
3340 !! test
3341 5c. White-space in indent-pre
3342 !! wikitext
3343 ''a''
3344 ''b''
3345 ''c''
3346 !! html
3347 <pre><i>a</i>
3348 <i>b</i>
3349 <i>c</i>
3350 </pre>
3351 !! end
3352
3353 !! test
3354 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3355 !! wikitext
3356 a
3357
3358 <!-- continue -->
3359 b
3360
3361 c
3362
3363 d
3364 !! html
3365 <pre>a
3366
3367 b
3368 </pre>
3369 <pre>c
3370
3371 </pre>
3372 <p>d
3373 </p>
3374 !! end
3375
3376 !! test
3377 7a. Indent-pre and category links
3378 !! options
3379 parsoid=wt2html,wt2wt
3380 !! wikitext
3381 [[Category:foo]] <!-- No pre-wrapping -->
3382 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3383 !! html/php+tidy
3384 !! html/parsoid
3385 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3386 <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 -->
3387 !! end
3388
3389 ## We used to, but no longer wt2wt this test since the default serializer
3390 ## will normalize all categories to serialize on their own line.
3391 ## This wikitext usage is going to be fairly uncommon in production and
3392 ## selser will take care of preserving formatting in those scenarios.
3393 !! test
3394 7b. Indent-pre and category links
3395 !! options
3396 parsoid=wt2html
3397 !! wikitext
3398 [[Category:foo]] a
3399 [[Category:foo]] {{echo|b}}
3400 !! html/parsoid
3401 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3402 <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>
3403 !! end
3404
3405 !! test
3406 Indent-Pre: Newlines in comments shouldn't affect sol state
3407 !! wikitext
3408 a <!--
3409 foo
3410 --> b
3411 !! html/php+tidy
3412 <p>a b</p>
3413 !! html/parsoid
3414 <p>a <!--
3415 foo
3416 --> b</p>
3417 !! end
3418
3419 ###
3420 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3421 ###
3422
3423 !!test
3424 HTML-pre: 1. embedded newlines
3425 !! wikitext
3426 <pre>foo</pre>
3427
3428 <pre>
3429 foo
3430 </pre>
3431
3432 <pre>
3433
3434 foo
3435 </pre>
3436
3437 <pre>
3438
3439
3440 foo
3441 </pre>
3442 !! html/php+tidy
3443 <pre>
3444 foo
3445 </pre>
3446 <pre>
3447 foo
3448 </pre>
3449 <pre>
3450
3451 foo
3452 </pre>
3453 <pre>
3454
3455
3456 foo
3457 </pre>
3458 !! html/parsoid
3459 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3460
3461 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3462 foo
3463 </pre>
3464
3465 <pre data-parsoid='{"stx":"html"}'>
3466
3467 foo
3468 </pre>
3469
3470 <pre data-parsoid='{"stx":"html"}'>
3471
3472
3473 foo
3474 </pre>
3475 !!end
3476
3477 !! test
3478 HTML-pre: big spaces
3479 !! wikitext
3480 <pre>
3481
3482
3483
3484
3485 haha
3486
3487
3488
3489
3490 haha
3491
3492
3493
3494
3495 </pre>
3496 !! html/php+tidy
3497 <pre>
3498
3499
3500
3501
3502 haha
3503
3504
3505
3506
3507 haha
3508
3509
3510
3511
3512 </pre>
3513 !! html/parsoid
3514 <pre data-parsoid='{"stx":"html"}'>
3515
3516
3517
3518
3519 haha
3520
3521
3522
3523
3524 haha
3525
3526
3527
3528
3529 </pre>
3530 !! end
3531
3532 !!test
3533 HTML-pre: 2: indented text
3534 !! wikitext
3535 <pre>
3536 foo
3537 </pre>
3538 !! html
3539 <pre>
3540 foo
3541 </pre>
3542
3543 !!end
3544
3545 !!test
3546 HTML-pre: 3: other wikitext
3547 !! wikitext
3548 <pre>
3549 * foo
3550 # bar
3551 = no-h =
3552 '' no-italic ''
3553 [[ NoLink ]]
3554 </pre>
3555 !! html/php
3556 <pre>
3557 * foo
3558 # bar
3559 = no-h =
3560 '' no-italic ''
3561 [[ NoLink ]]
3562 </pre>
3563
3564 !! html/parsoid
3565 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3566 # bar
3567 = no-h =
3568 '' no-italic ''
3569 [[ NoLink ]]
3570 </pre>
3571 !!end
3572
3573 ###
3574 ### Definition lists
3575 ###
3576 !! test
3577 Simple definition
3578 !! wikitext
3579 ; name : Definition
3580 !! html
3581 <dl><dt> name&#160;</dt>
3582 <dd> Definition</dd></dl>
3583
3584 !! end
3585
3586 !! test
3587 Definition list for indentation only
3588 !! wikitext
3589 : Indented text
3590 !! html
3591 <dl><dd> Indented text</dd></dl>
3592
3593 !! end
3594
3595 !! test
3596 Definition list with no space
3597 !! wikitext
3598 ;name:Definition
3599 !! html
3600 <dl><dt>name</dt>
3601 <dd>Definition</dd></dl>
3602
3603 !!end
3604
3605 !! test
3606 Definition list with URL link
3607 !! wikitext
3608 ; http://example.com/ : definition
3609 !! html
3610 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3611 <dd> definition</dd></dl>
3612
3613 !! end
3614
3615 !! test
3616 Definition list with bracketed URL link
3617 !! wikitext
3618 ;[http://www.example.com/ Example]:Something about it
3619 !! html
3620 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3621 <dd>Something about it</dd></dl>
3622
3623 !! end
3624
3625 !! test
3626 Definition list with wikilink containing colon
3627 !! wikitext
3628 ; [[Help:FAQ]]: The least-read page on Wikipedia
3629 !! html
3630 <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>
3631 <dd> The least-read page on Wikipedia</dd></dl>
3632
3633 !! end
3634
3635 # At Brion's and JeLuF's insistence... :)
3636 !! test
3637 Definition list with news link containing colon
3638 !! wikitext
3639 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3640 !! html/php
3641 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3642 <dd> This isn't even a real newsgroup!</dd></dl>
3643
3644 !! html/parsoid
3645 <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>
3646 !! end
3647
3648 !! test
3649 Malformed definition list with colon
3650 !! wikitext
3651 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3652 !! html
3653 <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>
3654
3655 !! end
3656
3657 !! test
3658 Definition lists: colon in external link text
3659 !! wikitext
3660 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3661 !! html
3662 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3663 <dd> OK, I made that up</dd></dl>
3664
3665 !! end
3666
3667 !! test
3668 Definition lists: colon in HTML attribute
3669 !! wikitext
3670 ;<b style="display: inline">bold</b>
3671 !! html
3672 <dl><dt><b style="display: inline">bold</b></dt></dl>
3673
3674 !! end
3675
3676 !! test
3677 Definition lists: self-closed tag
3678 !! wikitext
3679 ;one<br/>two : two-line fun
3680 !! html
3681 <dl><dt>one<br />two&#160;</dt>
3682 <dd> two-line fun</dd></dl>
3683
3684 !! end
3685
3686 !! test
3687 Bug 11748: Literal closing tags
3688 !! wikitext
3689 <dl>
3690 <dt>test 1</dt>
3691 <dd>test test test test test</dd>
3692 <dt>test 2</dt>
3693 <dd>test test test test test</dd>
3694 </dl>
3695 !! html
3696 <dl>
3697 <dt>test 1</dt>
3698 <dd>test test test test test</dd>
3699 <dt>test 2</dt>
3700 <dd>test test test test test</dd>
3701 </dl>
3702
3703 !! end
3704
3705 !! test
3706 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3707 !! wikitext
3708 <ul><li>
3709 ; term : description
3710 * unordered
3711 </li></ul>
3712 !! html
3713 <ul><li>
3714 <dl><dt> term&#160;</dt>
3715 <dd> description</dd></dl>
3716 <ul><li> unordered</li></ul>
3717 </li></ul>
3718
3719 !! end
3720
3721 !! test
3722 Definition list with empty definition and following paragraph
3723 !! wikitext
3724 ; term:
3725 Paragraph text
3726 !! html
3727 <dl><dt> term</dt>
3728 <dd></dd></dl>
3729 <p>Paragraph text
3730 </p>
3731 !! end
3732
3733 !! test
3734 Nested definition lists using html syntax
3735 !! wikitext
3736 <dl><dt>x</dt>
3737 <dd>a</dd>
3738 <dd>b</dd></dl>
3739 !! html
3740 <dl><dt>x</dt>
3741 <dd>a</dd>
3742 <dd>b</dd></dl>
3743
3744 !! end
3745
3746 !! test
3747 Definition Lists: No nesting: Multiple dd's
3748 !! wikitext
3749 ;x
3750 :a
3751 :b
3752 !! html
3753 <dl><dt>x</dt>
3754 <dd>a</dd>
3755 <dd>b</dd></dl>
3756
3757 !! end
3758
3759 !! test
3760 Definition Lists: Indentation: Regular
3761 !! wikitext
3762 :i1
3763 ::i2
3764 :::i3
3765 !! html
3766 <dl><dd>i1
3767 <dl><dd>i2
3768 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3769
3770 !! end
3771
3772 !! test
3773 Definition Lists: Indentation: Missing 1st level
3774 !! wikitext
3775 ::i2
3776 :::i3
3777 !! html
3778 <dl><dd><dl><dd>i2
3779 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3780
3781 !! end
3782
3783 !! test
3784 Definition Lists: Indentation: Multi-level indent
3785 !! wikitext
3786 :::i3
3787 !! html
3788 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3789
3790 !! end
3791
3792 !! test
3793 Definition Lists: Hacky use to indent tables
3794 !! wikitext
3795 ::{|
3796 |foo
3797 |bar
3798 |}
3799 this text
3800 should be left alone
3801 !! html
3802 <dl><dd><dl><dd><table>
3803 <tr>
3804 <td>foo
3805 </td>
3806 <td>bar
3807 </td></tr></table></dd></dl></dd></dl>
3808 <p>this text
3809 should be left alone
3810 </p>
3811 !! end
3812
3813 !! test
3814 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3815 !! wikitext
3816 <!-- foo -->
3817 ::{|
3818 |foo
3819 |bar
3820 |}<!-- bar -->
3821 this text
3822 should be left alone
3823 !! html/parsoid
3824 <!-- foo -->
3825 <dl><dd><dl><dd><table><tr>
3826 <td>foo</td>
3827 <td>bar</td>
3828 </tr></table><!-- bar --></dd></dl></dd></dl>
3829 <p>this text
3830 should be left alone</p>
3831 !! end
3832
3833 !! test
3834 Definition Lists: Hacky use to indent tables, with comment before table
3835 !! wikitext
3836 ::<!-- foo -->{|
3837 |foo
3838 |}
3839 !! html/parsoid
3840 <dl><dd><dl><dd><!-- foo --><table><tr>
3841 <td>foo</td>
3842 </tr></table></dd></dl></dd></dl>
3843 !! end
3844
3845 # The trailing whitespace in this test is to catch a regression in
3846 # Parsoid after T54473.
3847 !! test
3848 Definition Lists: Hacky use to indent tables (WS-insensitive)
3849 !! wikitext
3850 : {|
3851 |a
3852 |}
3853 !! html/php
3854 <dl><dd><table>
3855 <tr>
3856 <td>a
3857 </td></tr></table></dd></dl>
3858
3859 !! html/parsoid
3860 <dl><dd> <table>
3861 <tbody><tr><td>a</td></tr>
3862 </tbody></table> </dd></dl>
3863 !! end
3864
3865 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3866 ## as an empty dt item. It also ignores all but the last ";" when followed
3867 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3868 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3869 ## ";"s.
3870 ##
3871 ## Ex: ";;t2 ::d2" is transformed into:
3872 ##
3873 ## <dl>
3874 ## <dt>t2 </dt>
3875 ## <dd>
3876 ## <dl>
3877 ## <dt></dt>
3878 ## <dd>d2</dd>
3879 ## </dl>
3880 ## </dd>
3881 ## </dl>
3882 ##
3883 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3884 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3885 ##
3886 ## <dl>
3887 ## <dt>
3888 ## <dl>
3889 ## <dt>t2 </dt>
3890 ## <dd>:d2</dd>
3891 ## </dl>
3892 ## </dt>
3893 ## </dl>
3894 ##
3895 ## All Parsoid only definition list tests have this difference.
3896 ##
3897 ## See also: https://phabricator.wikimedia.org/T8569
3898 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3899
3900 !! test
3901 Table / list interaction: indented table with lists in table contents
3902 !! wikitext
3903 :{|
3904 |-
3905 | a
3906 * b
3907 |-
3908 | c
3909 * d
3910 |}
3911 !! html
3912 <dl><dd><table>
3913
3914 <tr>
3915 <td> a
3916 <ul><li> b</li></ul>
3917 </td></tr>
3918 <tr>
3919 <td> c
3920 <ul><li> d</li></ul>
3921 </td></tr></table></dd></dl>
3922
3923 !! end
3924
3925 !!test
3926 Table / list interaction: lists nested in tables nested in indented lists
3927 !! wikitext
3928 :{|
3929 |
3930 :a
3931 :b
3932 |
3933 *c
3934 *d
3935 |}
3936
3937 *e
3938 *f
3939 !! html
3940 <dl><dd><table>
3941 <tr>
3942 <td>
3943 <dl><dd>a</dd>
3944 <dd>b</dd></dl>
3945 </td>
3946 <td>
3947 <ul><li>c</li>
3948 <li>d</li></ul>
3949 </td></tr></table></dd></dl>
3950 <ul><li>e</li>
3951 <li>f</li></ul>
3952
3953 !!end
3954
3955 !! test
3956 Definition Lists: Nesting: Multi-level (Parsoid only)
3957 !! options
3958 parsoid
3959 !! wikitext
3960 ;t1 :d1
3961 ;;t2 ::d2
3962 ;;;t3 :::d3
3963 !! html
3964 <dl>
3965 <dt>t1 </dt>
3966 <dd>d1</dd>
3967 <dt>
3968 <dl>
3969 <dt>t2 </dt>
3970 <dd>:d2</dd>
3971 <dt>
3972 <dl>
3973 <dt>t3 </dt>
3974 <dd>::d3</dd>
3975 </dl>
3976 </dt>
3977 </dl>
3978 </dt>
3979 </dl>
3980
3981
3982 !! end
3983
3984
3985 !! test
3986 Definition Lists: Nesting: Test 2 (Parsoid only)
3987 !! wikitext
3988 ;t1
3989 ::d2
3990 !! html/php+tidy
3991 <dl>
3992 <dt>t1</dt>
3993 <dd>
3994 <dl>
3995 <dd>d2</dd>
3996 </dl>
3997 </dd>
3998 </dl>
3999 !! html/parsoid
4000 <dl>
4001 <dt>t1</dt>
4002 <dd>
4003 <dl>
4004 <dd>d2</dd>
4005 </dl>
4006 </dd>
4007 </dl>
4008
4009 !! end
4010
4011
4012 !! test
4013 Definition Lists: Nesting: Test 3 (Parsoid only)
4014 !! wikitext
4015 :;t1
4016 ::::d2
4017 !! html/php+tidy
4018 <dl>
4019 <dd>
4020 <dl>
4021 <dt>t1</dt>
4022 <dd>
4023 <dl>
4024 <dd>
4025 <dl>
4026 <dd>d2</dd>
4027 </dl>
4028 </dd>
4029 </dl>
4030 </dd>
4031 </dl>
4032 </dd>
4033 </dl>
4034 !! html/parsoid
4035 <dl>
4036 <dd>
4037 <dl>
4038 <dt>t1</dt>
4039 <dd>
4040 <dl>
4041 <dd>
4042 <dl>
4043 <dd>d2</dd>
4044 </dl>
4045 </dd>
4046 </dl>
4047 </dd>
4048 </dl>
4049 </dd>
4050 </dl>
4051
4052 !! end
4053
4054
4055 !! test
4056 Definition Lists: Nesting: Test 4
4057 !! wikitext
4058 ::;t3
4059 :::d3
4060 !! html
4061 <dl><dd><dl><dd><dl><dt>t3</dt>
4062 <dd>d3</dd></dl></dd></dl></dd></dl>
4063
4064 !! end
4065
4066
4067 ## The Parsoid team believes the following three test exposes a
4068 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4069 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4070 ## It also exposes a "misfeature" in tidy, which doesn't like
4071 ## <dl> tags with a single <dt> child; it converts the <dt> into
4072 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4073 !! test
4074 Definition Lists: Mixed Lists: Test 1
4075 !! wikitext
4076 :;* foo
4077 ::* bar
4078 :; baz
4079 !! html/php
4080 <dl><dd><dl><dt><ul><li> foo</li>
4081 <li> bar</li></ul></dt></dl>
4082 <dl><dt> baz</dt></dl></dd></dl>
4083
4084 !! html/php+tidy
4085 <dl>
4086 <dd>
4087 <dl>
4088 <dd>
4089 <ul>
4090 <li>foo</li>
4091 <li>bar</li>
4092 </ul>
4093 </dd>
4094 </dl>
4095 <dl>
4096 <dt>baz</dt>
4097 </dl>
4098 </dd>
4099 </dl>
4100 !! html/parsoid
4101 <dl>
4102 <dd><dl>
4103 <dt><ul>
4104 <li> foo
4105 </li>
4106 </ul></dt>
4107 <dd><ul>
4108 <li> bar
4109 </li>
4110 </ul></dd>
4111 <dt> baz</dt>
4112 </dl></dd>
4113 </dl>
4114 !! end
4115
4116 !! test
4117 Definition Lists: Mixed Lists: Test 2
4118 !! wikitext
4119 *: d1
4120 *: d2
4121 !! html
4122 <ul><li><dl><dd> d1</dd>
4123 <dd> d2</dd></dl></li></ul>
4124
4125 !! end
4126
4127
4128 !! test
4129 Definition Lists: Mixed Lists: Test 3
4130 !! wikitext
4131 *::: d1
4132 *::: d2
4133 !! html
4134 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4135 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4136
4137 !! end
4138
4139
4140 !! test
4141 Definition Lists: Mixed Lists: Test 4
4142 !! wikitext
4143 *;d1 :d2
4144 *;d3 :d4
4145 !! html
4146 <ul><li><dl><dt>d1&#160;</dt>
4147 <dd>d2</dd>
4148 <dt>d3&#160;</dt>
4149 <dd>d4</dd></dl></li></ul>
4150
4151 !! end
4152
4153
4154 !! test
4155 Definition Lists: Mixed Lists: Test 5
4156 !! wikitext
4157 *:d1
4158 *:: d2
4159 !! html
4160 <ul><li><dl><dd>d1
4161 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4162
4163 !! end
4164
4165
4166 !! test
4167 Definition Lists: Mixed Lists: Test 6
4168 !! wikitext
4169 #*:d1
4170 #*::: d3
4171 !! html
4172 <ol><li><ul><li><dl><dd>d1
4173 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4174
4175 !! end
4176
4177
4178 !! test
4179 Definition Lists: Mixed Lists: Test 7
4180 !! wikitext
4181 :* d1
4182 :* d2
4183 !! html
4184 <dl><dd><ul><li> d1</li>
4185 <li> d2</li></ul></dd></dl>
4186
4187 !! end
4188
4189
4190 !! test
4191 Definition Lists: Mixed Lists: Test 8
4192 !! wikitext
4193 :* d1
4194 ::* d2
4195 !! html
4196 <dl><dd><ul><li> d1</li></ul>
4197 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4198
4199 !! end
4200
4201
4202 !! test
4203 Definition Lists: Mixed Lists: Test 9
4204 !! wikitext
4205 *;foo :bar
4206 !! html
4207 <ul><li><dl><dt>foo&#160;</dt>
4208 <dd>bar</dd></dl></li></ul>
4209
4210 !! end
4211
4212
4213 !! test
4214 Definition Lists: Mixed Lists: Test 10
4215 !! wikitext
4216 *#;foo :bar
4217 !! html
4218 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4219 <dd>bar</dd></dl></li></ol></li></ul>
4220
4221 !! end
4222
4223 # The Parsoid team disagrees with the PHP parser's seemingly-random
4224 # rules regarding dd/dt on the next two tests. Parsoid is more
4225 # consistent, and recognizes the shared nesting and keeps the
4226 # still-open tags around until the nesting is complete.
4227 # (And tidy again converts <dt> to <dd> before 'bar'.)
4228
4229 !! test
4230 Definition Lists: Mixed Lists: Test 11
4231 !! wikitext
4232 *#*#;*;;foo :bar
4233 *#*#;boo :baz
4234 !! html/php
4235 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4236 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4237 <dl><dt>boo&#160;</dt>
4238 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4239
4240 !! html/php+tidy
4241 <ul>
4242 <li>
4243 <ol>
4244 <li>
4245 <ul>
4246 <li>
4247 <ol>
4248 <li>
4249 <dl>
4250 <dt>foo&#160;</dt>
4251 <dd>
4252 <ul>
4253 <li>
4254 <dl>
4255 <dd>
4256 <dl>
4257 <dt>bar</dt>
4258 </dl>
4259 </dd>
4260 </dl>
4261 </li>
4262 </ul>
4263 </dd>
4264 </dl>
4265 <dl>
4266 <dt>boo&#160;</dt>
4267 <dd>baz</dd>
4268 </dl>
4269 </li>
4270 </ol>
4271 </li>
4272 </ul>
4273 </li>
4274 </ol>
4275 </li>
4276 </ul>
4277 !! html/parsoid
4278 <ul>
4279 <li>
4280 <ol>
4281 <li>
4282 <ul>
4283 <li>
4284 <ol>
4285 <li>
4286 <dl>
4287 <dt>
4288 <ul>
4289 <li>
4290 <dl>
4291 <dt>
4292 <dl>
4293 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4294 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4295 </dl></dt>
4296 </dl></li>
4297 </ul></dt>
4298 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4299 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4300 </dl></li>
4301 </ol></li>
4302 </ul></li>
4303 </ol></li>
4304 </ul>
4305 !! end
4306
4307
4308 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4309 # From whitelist:
4310 # * The test is wrong, there are two colons where there should be :;
4311 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4312 !! test
4313 Definition Lists: Weird Ones: Test 1
4314 !! wikitext
4315 *#;*::;; foo : bar (who uses this?)
4316 !! html/php
4317 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4318 <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>
4319
4320 !! html/php+tidy
4321 <ul>
4322 <li>
4323 <ol>
4324 <li>
4325 <dl>
4326 <dt>foo&#160;</dt>
4327 <dd>
4328 <ul>
4329 <li>
4330 <dl>
4331 <dd>
4332 <dl>
4333 <dd>
4334 <dl>
4335 <dd>
4336 <dl>
4337 <dt>bar (who uses this?)</dt>
4338 </dl>
4339 </dd>
4340 </dl>
4341 </dd>
4342 </dl>
4343 </dd>
4344 </dl>
4345 </li>
4346 </ul>
4347 </dd>
4348 </dl>
4349 </li>
4350 </ol>
4351 </li>
4352 </ul>
4353 !! html/parsoid
4354 <ul>
4355 <li>
4356 <ol>
4357 <li>
4358 <dl>
4359 <dt>
4360 <ul>
4361 <li>
4362 <dl>
4363 <dd>
4364 <dl>
4365 <dd>
4366 <dl>
4367 <dt>
4368 <dl>
4369 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4370 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4371 </dl></dt>
4372 </dl></dd>
4373 </dl></dd>
4374 </dl></li>
4375 </ul></dt>
4376 </dl></li>
4377 </ol></li>
4378 </ul>
4379 !! end
4380
4381 !! test
4382 Definition Lists: colons occurring in tags
4383 !! wikitext
4384 ;a:b
4385 ;'''a:b'''
4386 ;<i>a:b</i>
4387 ;<span>a:b</span>
4388 ;<div>a:b</div>
4389 ;<div>a
4390 :b</div>
4391 ;{{echo|a:b}}
4392 ;{{echo|''a:b''}}
4393 ;;;''a:b''
4394 !! html+tidy
4395 <dl>
4396 <dt>a</dt>
4397 <dd>b</dd>
4398 <dt><b>a:b</b></dt>
4399 <dt><i>a:b</i></dt>
4400 <dt><span>a:b</span></dt>
4401 <dd>
4402 <div>a:b</div>
4403 </dd>
4404 <dd>
4405 <div>a
4406 <dl>
4407 <dd>b</dd>
4408 </dl>
4409 </div>
4410 </dd>
4411 <dt>a</dt>
4412 <dd>b</dd>
4413 <dt><i>a:b</i></dt>
4414 </dl>
4415 <dl>
4416 <dd>
4417 <dl>
4418 <dd>
4419 <dl>
4420 <dt><i>a:b</i></dt>
4421 </dl>
4422 </dd>
4423 </dl>
4424 </dd>
4425 </dl>
4426 !! html/parsoid
4427 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4428 <dt><b>a:b</b></dt>
4429 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4430 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4431 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4432 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4433 <dd>b</dd>
4434 <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>
4435 <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>
4436 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4437 !! end
4438
4439 !! test
4440 Definition Lists: colons and tables 1
4441 !! wikitext
4442 :{|
4443 | x
4444 |}
4445 :{|
4446 | y
4447 |}
4448 !! html
4449 <dl><dd><table>
4450 <tr>
4451 <td> x
4452 </td></tr></table></dd></dl>
4453 <dl><dd><table>
4454 <tr>
4455 <td> y
4456 </td></tr></table></dd></dl>
4457
4458 !! end
4459
4460 # Parsoid's output (as documented below) differs from php's in this case.
4461 # This is probably a bug. If we fixup parsoid to match php's output, the
4462 # above test should pass and the below test case can be removed. It is
4463 # unclear which output is more desirable.
4464
4465 !! test
4466 Definition Lists: colons and tables 2
4467 !! wikitext
4468 :{|
4469 | x
4470 |}
4471 :{|
4472 | y
4473 |}
4474 !! html/parsoid
4475 <dl><dd><table>
4476 <tr>
4477 <td> x
4478 </td></tr></table></dd>
4479 <dd><table>
4480 <tr>
4481 <td> y
4482 </td></tr></table></dd></dl>
4483 !! end
4484
4485 !! test
4486 Definition Lists: template interaction
4487 !! wikitext
4488 ::{{definition_list}}
4489
4490 :one
4491 ::{{definition_list}}
4492 :::two
4493 :::three
4494 ::four
4495 !! html/parsoid
4496 <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">
4497 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4498
4499 <dl><dd data-parsoid='{}'>one
4500 <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">
4501 </span><dd about="#mwt2">two
4502 <dl><dd>two</dd>
4503 <dd>three</dd></dl></dd>
4504 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4505 !! end
4506
4507
4508 ###
4509 ### External links
4510 ###
4511 !! test
4512 External links: non-bracketed
4513 !! wikitext
4514 Non-bracketed: http://example.com
4515 !! html
4516 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4517 </p>
4518 !! end
4519
4520 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4521 !! test
4522 External links: numbered
4523 !! wikitext
4524 Numbered: [http://example.com]
4525 Numbered: [http://example.net]
4526 Numbered: [http://example.com]
4527 !! html/php
4528 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4529 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4530 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4531 </p>
4532 !! html/parsoid
4533 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4534 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4535 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4536 !!end
4537
4538 !! test
4539 External links: specified text
4540 !! wikitext
4541 Specified text: [http://example.com link]
4542 !! html
4543 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4544 </p>
4545 !!end
4546
4547 !! test
4548 External links: trail
4549 !! wikitext
4550 Linktrails should not work for external links: [http://example.com link]s
4551 !! html
4552 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4553 </p>
4554 !! end
4555
4556 !! test
4557 External links: dollar sign in URL
4558 !! wikitext
4559 http://example.com/1$2345
4560 !! html
4561 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4562 </p>
4563 !! end
4564
4565 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4566 !! test
4567 External links: dollar sign in URL (autonumber)
4568 !! wikitext
4569 [http://example.com/1$2345]
4570 !! html/php
4571 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4572 </p>
4573 !! html/parsoid
4574 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4575 !!end
4576
4577 !! test
4578 External links: open square bracket forbidden in URL (bug 4377)
4579 !! options
4580 parsoid=wt2html,wt2wt,html2html
4581 !! wikitext
4582 http://example.com/1[2345
4583 !! html/php
4584 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4585 </p>
4586 !! html/parsoid
4587 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4588 !! end
4589
4590 !! test
4591 External links: open square bracket forbidden in URL (named) (bug 4377)
4592 !! options
4593 parsoid=wt2html,html2html
4594 !! wikitext
4595 [http://example.com/1[2345]
4596 !! html/php
4597 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4598 </p>
4599 !! html/parsoid
4600 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4601 !!end
4602
4603 # parsoid adds a space before the link name
4604 !! test
4605 External links: open square bracket forbidden in URL (named) (bug 4377)
4606 Parsoid variant.
4607 !! wikitext
4608 [http://example.com/1 [2345]
4609 !! html
4610 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4611 </p>
4612 !!end
4613
4614 !! test
4615 External links: nowiki in URL link text (bug 6230)
4616 !! wikitext
4617 [http://example.com/ <nowiki>''example site''</nowiki>]
4618 !! html
4619 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4620 </p>
4621 !! end
4622
4623 !! test
4624 External links: newline forbidden in text (bug 6230 regression check)
4625 !! wikitext
4626 [http://example.com/ first
4627 second]
4628 !! html
4629 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4630 second]
4631 </p>
4632 !!end
4633
4634 !! test
4635 External links: Pipe char between url and text
4636 !! wikitext
4637 [http://example.com | link]
4638 !! html
4639 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4640 </p>
4641 !!end
4642
4643 !! test
4644 External links: protocol-relative URL in brackets
4645 !! wikitext
4646 [//example.com/ Test]
4647 !! html
4648 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4649 </p>
4650 !! end
4651
4652 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4653 !! test
4654 External links: protocol-relative URL in brackets without text
4655 !! wikitext
4656 [//example.com]
4657 !! html/php
4658 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4659 </p>
4660 !! html/parsoid
4661 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4662 !! end
4663
4664 !! test
4665 External links: protocol-relative URL in free text is left alone
4666 !! wikitext
4667 //example.com/Foo
4668 !! html
4669 <p>//example.com/Foo
4670 </p>
4671 !!end
4672
4673 !! test
4674 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4675 !! wikitext
4676 foo//example.com/Foo
4677 !! html
4678 <p>foo//example.com/Foo
4679 </p>
4680 !! end
4681
4682 !! test
4683 External links: with no contents
4684 !! wikitext
4685 [http://en.wikipedia.org/wiki/Foo]
4686
4687 [[wikipedia:Foo|Bar]]
4688
4689 [[wikipedia:Foo|<span>Bar</span>]]
4690 !! html/php
4691 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4692 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4693 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4694 </p>
4695 !! html/parsoid
4696 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4697 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4698 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4699 !! end
4700
4701 !! test
4702 External links: Free with trailing punctuation
4703 !! wikitext
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)
4712 http://example.com/url_with_(brackets)
4713 (http://example.com/url_without_brackets)
4714 http://example.com/url_with_entity&amp;
4715 http://example.com/url_with_entity&#x26;
4716 http://example.com/url_with_entity&#038;
4717 http://example.com/url_with_entity&nbsp;
4718 http://example.com/url_with_entity&#xA0;
4719 http://example.com/url_with_entity&#160;
4720 http://example.com/url_with_entity&lt;
4721 http://example.com/url_with_entity&#x3C;
4722 http://example.com/url_with_entity&#60;
4723 !! html/php
4724 <p><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">http://example.com</a>)
4732 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4733 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</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&amp;">http://example.com/url_with_entity&amp;</a>
4737 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4738 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4739 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4740 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4741 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4742 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4743 </p>
4744 !! html/parsoid
4745 <p><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">http://example.com</a>)
4753 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4754 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</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&amp;">http://example.com/url_with_entity&amp;</a>
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;nbsp;","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;#xA0;","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;#160;","srcContent":" "}'> </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;lt;","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;#x3C;","srcContent":"&lt;"}'>&lt;</span>
4763 <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>
4764 !! end
4765
4766 !! test
4767 External links: tricky Parsoid html2html case
4768 !! options
4769 parsoid=wt2html,wt2wt,html2html
4770 !! wikitext
4771 http://example.com/url_with_entity&amp;amp;
4772 !! html/php
4773 <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>;
4774 </p>
4775 !! html/parsoid
4776 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4777 !! end
4778
4779 !! test
4780 External links: Free with trailing quotes (T113666)
4781 !! wikitext
4782 '''News:''' Stuff here
4783
4784 news:'a'b''c''d e
4785 !! html/php
4786 <p><b>News:</b> Stuff here
4787 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4788 </p>
4789 !! html/parsoid
4790 <p><b>News:</b> Stuff here</p>
4791 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4792 !! end
4793
4794 !! test
4795 External links: Lone protocols are never linked (T105697)
4796 !! wikitext
4797 http://
4798 http://;
4799 (http://)
4800 bitcoin:
4801 bitcoin:;
4802 (bitcoin:)
4803 !! html
4804 <p>http://
4805 http://;
4806 (http://)
4807 bitcoin:
4808 bitcoin:;
4809 (bitcoin:)
4810 </p>
4811 !! end
4812
4813 !! test
4814 External links: No preceding word characters allowed (bug 65278)
4815 !! wikitext
4816 NOPEhttp://example.com
4817 N0http://example.com
4818 ok:http://example.com
4819 ok-http://example.com
4820 !! html
4821 <p>NOPEhttp://example.com
4822 N0http://example.com
4823 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4824 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4825 </p>
4826 !! end
4827
4828 !! test
4829 External links: nofollow domain exception
4830 !! wikitext
4831 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4832 !! html
4833 <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>.
4834 </p>
4835 !!end
4836
4837 !! test
4838 External image
4839 !! wikitext
4840 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4841 !! html
4842 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4843 </p>
4844 !! end
4845
4846 !! test
4847 External image from https
4848 !! wikitext
4849 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4850 !! html
4851 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4852 </p>
4853 !! end
4854
4855 !! test
4856 External image (when not allowed)
4857 !! options
4858 wgAllowExternalImages=0
4859 !! wikitext
4860 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4861 !! html
4862 <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>
4863 </p>
4864 !! end
4865
4866 !! test
4867 Link to non-http image, no img tag
4868 !! wikitext
4869 Link to non-http image, no img tag: ftp://example.com/test.jpg
4870 !! html
4871 <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>
4872 </p>
4873 !! end
4874
4875 !! test
4876 External links: terminating separator
4877 !! wikitext
4878 Terminating separator: http://example.com/thing,
4879 !! html
4880 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4881 </p>
4882 !! end
4883
4884 !! test
4885 External links: intervening separator
4886 !! wikitext
4887 Intervening separator: http://example.com/1,2,3
4888 !! html
4889 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4890 </p>
4891 !! end
4892
4893 !! test
4894 External links: old bug with URL in query
4895 !! wikitext
4896 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4897 !! html
4898 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4899 </p>
4900 !! end
4901
4902 !! test
4903 External links: old URL-in-URL bug, mixed protocols
4904 !! wikitext
4905 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4906 !! html
4907 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4908 </p>
4909 !!end
4910
4911 # Since Parsoid is starting to emit canonical wikitext for links,
4912 # [http://example.com http://example.com] will not RT back to that
4913 # form anymore.
4914 !! test
4915 External links: URL in text
4916 !! options
4917 parsoid=wt2html
4918 !! wikitext
4919 URL in text: [http://example.com http://example.com]
4920 !! html/php
4921 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4922 </p>
4923 !! html/parsoid
4924 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4925 !! end
4926
4927 !! test
4928 External links: Clickable images
4929 !! wikitext
4930 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4931 !! html/php
4932 <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>
4933 </p>
4934 !! html/parsoid
4935 <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>
4936 !! end
4937
4938 !! test
4939 External links: raw ampersand
4940 !! wikitext
4941 Old &amp; use: http://x&y
4942 !! html
4943 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4944 </p>
4945 !! end
4946
4947 !! test
4948 External links: encoded ampersand
4949 !! wikitext
4950 Old &amp; use: http://x&amp;y
4951 !! html/php
4952 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4953 </p>
4954 !! html/parsoid
4955 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4956 !! end
4957
4958 !! test
4959 External links: encoded equals (bug 6102)
4960 !! wikitext
4961 http://example.com/?foo&#61;bar
4962 !! html/php
4963 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4964 </p>
4965 !! html/parsoid
4966 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4967 !! end
4968
4969 ##
4970 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4971 ## does it number them. As discussed in bug 53505, we can identify
4972 ## autonumbered links via CSS.
4973 ##
4974
4975 !! test
4976 External links: [raw ampersand]
4977 !! wikitext
4978 Old &amp; use: [http://x&y]
4979 !! html/php
4980 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4981 </p>
4982 !! html/parsoid
4983 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4984 !! end
4985
4986 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4987 # mode will return the [raw ampersand] wikitext
4988 !! test
4989 External links: [encoded ampersand]
4990 !! options
4991 parsoid=wt2html,wt2wt,html2html
4992 !! wikitext
4993 Old &amp; use: [http://x&amp;y]
4994 !! html/php
4995 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4996 </p>
4997 !! html/parsoid
4998 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4999 !! end
5000
5001 !! test
5002 External links: [raw equals]
5003 !! wikitext
5004 [http://example.com/?foo=bar]
5005 !! html/php
5006 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5007 </p>
5008 !! html/parsoid
5009 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5010 !! end
5011
5012 # note that parsoid html is identical to [raw equals] case; so html2wt
5013 # mode will return the [raw equals] wikitext
5014 !! test
5015 External links: [encoded equals] (bug 6102)
5016 !! options
5017 parsoid=wt2html,wt2wt,html2html
5018 !! wikitext
5019 [http://example.com/?foo&#61;bar]
5020 !! html/php
5021 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5022 </p>
5023 !! html/parsoid
5024 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5025 !! end
5026
5027 # xxx parsoid strips the IDN character, so the round-trip tests will
5028 # obviously fail and are disabled. --cscott
5029 !! test
5030 External links: [IDN ignored character reference in hostname; strip it right off]
5031 !! options
5032 parsoid=wt2html,wt2wt,html2html
5033 !! wikitext
5034 [http://e&zwnj;xample.com/]
5035 !! html/php
5036 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5037 </p>
5038 !! html/parsoid
5039 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5040 !! end
5041
5042 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5043 # Where an external link could easily circumvent the sanitization of the text of
5044 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5045 # test demands a higher standard. That's a bit strange.
5046 #
5047 # Example:
5048 #
5049 # http://e‌xample.com -> [http://example.com|http://example.com]
5050 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5051 #
5052 # The first example is sanitized, but the second is not. Any security benefits
5053 # from this production are trivial to circumvent. Either remove this test and
5054 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5055 # the test accordingly.
5056 #
5057 # All our love,
5058 # The Parsoid team.
5059 # xxx parsoid strips the IDN character, so the round-trip tests will
5060 # obviously fail and are disabled. --cscott
5061 !! test
5062 External links: IDN ignored character reference in hostname; strip it right off
5063 !! options
5064 parsoid=wt2html,html2html
5065 !! wikitext
5066 http://e&zwnj;xample.com/
5067 !! html/php
5068 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5069 </p>
5070 !! html/parsoid
5071 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5072 !! end
5073
5074 !! test
5075 External links: www.jpeg.org (bug 554)
5076 !! wikitext
5077 http://www.jpeg.org
5078 !! html
5079 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5080 </p>
5081 !! end
5082
5083 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5084 !! test
5085 External links: URL within URL (original bug 2)
5086 !! wikitext
5087 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5088 !! html/php
5089 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5090 </p>
5091 !! html/parsoid
5092 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5093 !! end
5094
5095 !! test
5096 BUG 361: URL inside bracketed URL
5097 !! wikitext
5098 [http://www.example.com/foo http://www.example.com/bar]
5099 !! html
5100 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5101 </p>
5102 !! end
5103
5104 !! test
5105 BUG 361: URL within URL, not bracketed
5106 !! wikitext
5107 http://www.example.com/foo?=http://www.example.com/bar
5108 !! html
5109 <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>
5110 </p>
5111 !! end
5112
5113 !! test
5114 BUG 289: ">"-token in URL-tail
5115 !! wikitext
5116 http://www.example.com/<hello>
5117 !! html
5118 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5119 </p>
5120 !!end
5121
5122 !! test
5123 BUG 289: literal ">"-token in URL-tail
5124 !! wikitext
5125 http://www.example.com/<b>html</b>
5126 !! html/php
5127 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5128 </p>
5129 !! html/parsoid
5130 <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>
5131 !! end
5132
5133 !! test
5134 BUG 289: ">"-token in bracketed URL
5135 !! wikitext
5136 [http://www.example.com/<hello> stuff]
5137 !! html
5138 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5139 </p>
5140 !!end
5141
5142 !! test
5143 BUG 289: literal ">"-token in bracketed URL
5144 !! wikitext
5145 [http://www.example.com/<b>html</b> stuff]
5146 !! html
5147 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5148 </p>
5149 !!end
5150
5151 !! test
5152 BUG 289: literal double quote at end of URL
5153 !! wikitext
5154 http://www.example.com/"hello"
5155 !! html
5156 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5157 </p>
5158 !!end
5159
5160 !! test
5161 BUG 289: literal double quote in bracketed URL
5162 !! wikitext
5163 [http://www.example.com/"hello" stuff]
5164 !! html
5165 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5166 </p>
5167 !!end
5168
5169 !! test
5170 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5171 !! wikitext
5172 [http://www.example.com test]
5173 !! html
5174 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5175 </p>
5176 !! end
5177
5178 !! test
5179 External links: link text with spaces
5180 !! wikitext
5181 [http://www.example.com a b c]
5182 [http://www.example.com ''a'' ''b'']
5183 !! html
5184 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5185 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5186 </p>
5187 !! end
5188
5189 !! test
5190 External links: wiki links within external link (Bug 3695)
5191 !! options
5192 parsoid=wt2html,html2html
5193 !! wikitext
5194 [http://example.com [[wikilink]] embedded in ext link]
5195 !! html/php
5196 <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>
5197 </p>
5198 !! html/parsoid
5199 <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>
5200 !! end
5201
5202 !! test
5203 BUG 787: Links with one slash after the url protocol are invalid
5204 !! wikitext
5205 http:/example.com
5206
5207 [http:/example.com title]
5208 !! html
5209 <p>http:/example.com
5210 </p><p>[http:/example.com title]
5211 </p>
5212 !! end
5213
5214 !! test
5215 Bracketed external links with template-generated invalid target
5216 !! wikitext
5217 [{{echo|http:/example.com}} title]
5218 !! html
5219 <p>[http:/example.com title]
5220 </p>
5221 !! end
5222
5223 !! test
5224 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5225 !! wikitext
5226 ''[http://example.com text'']
5227 [http://example.com '''text]'''
5228 ''Something [http://example.com in italic'']
5229 ''Something [http://example.com mixed''''', even bold]'''
5230 '''''Now [http://example.com both''''']
5231 !! html
5232 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5233 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5234 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5235 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5236 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5237 </p>
5238 !! end
5239
5240
5241 !! test
5242 Bug 4781: %26 in URL
5243 !! wikitext
5244 http://www.example.com/?title=AT%26T
5245 !! html/php
5246 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5247 </p>
5248 !! html/parsoid
5249 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5250 !! end
5251
5252 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5253 # % is actually legal in HTML5. Any change in output would need testing though.
5254 !! test
5255 Bug 4781, 5267: %25 in URL
5256 !! wikitext
5257 http://www.example.com/?title=100%25_Bran
5258 !! html/php
5259 <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>
5260 </p>
5261 !! html/parsoid
5262 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5263 !! end
5264
5265 !! test
5266 Bug 4781, 5267: %28, %29 in URL
5267 !! wikitext
5268 http://www.example.com/?title=Ben-Hur_%281959_film%29
5269 !! html/php
5270 <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>
5271 </p>
5272 !! html/parsoid
5273 <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>
5274 !! end
5275
5276
5277 !! test
5278 Bug 4781: %26 in autonumber URL
5279 !! wikitext
5280 [http://www.example.com/?title=AT%26T]
5281 !! html/php
5282 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5283 </p>
5284 !! html/parsoid
5285 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5286 !! end
5287
5288 !! test
5289 Bug 4781, 5267: %26 in autonumber URL
5290 !! wikitext
5291 [http://www.example.com/?title=100%25_Bran]
5292 !! html/php
5293 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5294 </p>
5295 !! html/parsoid
5296 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5297 !! end
5298
5299 !! test
5300 Bug 4781, 5267: %28, %29 in autonumber URL
5301 !! wikitext
5302 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5303 !! html/php
5304 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5305 </p>
5306 !! html/parsoid
5307 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5308 !! end
5309
5310
5311 !! test
5312 Bug 4781: %26 in bracketed URL
5313 !! wikitext
5314 [http://www.example.com/?title=AT%26T link]
5315 !! html/php
5316 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5317 </p>
5318 !! html/parsoid
5319 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5320 !! end
5321
5322 !! test
5323 Bug 4781, 5267: %25 in bracketed URL
5324 !! wikitext
5325 [http://www.example.com/?title=100%25_Bran link]
5326 !! html
5327 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5328 </p>
5329 !! end
5330
5331 !! test
5332 Bug 4781, 5267: %28, %29 in bracketed URL
5333 !! wikitext
5334 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5335 !! html/php
5336 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5337 </p>
5338 !! html/parsoid
5339 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5340 !! end
5341
5342 !! test
5343 External link containing a period in the anchor. (bug 63947)
5344 !! wikitext
5345 [//foo.org/bar#baz. bang]
5346
5347 [//foo.org/bar. bang]
5348 !! html/php
5349 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5350 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5351 </p>
5352 !! html/parsoid
5353 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5354 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5355 !! end
5356
5357 !! test
5358 External link containing a single quote. (bug 63947)
5359 !! wikitext
5360 [//foo.org/bar'baz]
5361
5362 [//foo.org/bar'baz bang]
5363 !! html/php
5364 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5365 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5366 </p>
5367 !! html/parsoid
5368 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5369 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5370 !! end
5371
5372 !! test
5373 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5374 !! wikitext
5375 Some [http://example.com/ pretty ''italics'' and stuff]!
5376 !! html
5377 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5378 </p>
5379 !! end
5380
5381 !! test
5382 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5383 !! wikitext
5384 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5385 !! html
5386 <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>
5387 </p>
5388 !! end
5389
5390 !! test
5391 External link containing double-single-quotes with no space separating the url from text in italics
5392 !! wikitext
5393 [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]].]
5394 !! html/php
5395 <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>
5396 </p>
5397 !! html/php+tidy
5398 <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>
5399 !! html/parsoid
5400 <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>
5401 !! end
5402
5403 !! test
5404 External link with comments in link text
5405 !! wikitext
5406 [http://www.google.com Google <!-- comment -->]
5407 !! html/php
5408 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5409 </p>
5410 !! html/parsoid
5411 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5412 !! end
5413
5414 !! test
5415 External link to bare IPv4 address
5416 !! wikitext
5417 [http://192.168.0.1 Link]
5418 !! html/php
5419 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5420 </p>
5421 !! html/parsoid
5422 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5423 !! end
5424
5425 !! test
5426 URL-encoding in URL functions (single parameter)
5427 !! wikitext
5428 {{localurl:Some page|amp=&}}
5429 !! html
5430 <p>/index.php?title=Some_page&amp;amp=&amp;
5431 </p>
5432 !! end
5433
5434 !! test
5435 URL-encoding in URL functions (multiple parameters)
5436 !! wikitext
5437 {{localurl:Some page|q=?&amp=&}}
5438 !! html
5439 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5440 </p>
5441 !! end
5442
5443 !! test
5444 Brackets in urls
5445 !! wikitext
5446 http://example.com/index.php?foozoid%5B%5D=bar
5447
5448 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5449 !! html/php
5450 <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>
5451 </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>
5452 </p>
5453 !! html/parsoid
5454 <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>
5455
5456 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5457 !! end
5458
5459 !! test
5460 IPv6 urls, autolink format (T23261)
5461 !! wikitext
5462 http://[2404:130:0:1000::187:2]/index.php
5463
5464 Examples from RFC 2373, section 2.2:
5465 * http://[1080::8:800:200C:417A]/unicast
5466 * http://[FF01::101]/multicast
5467 * http://[::1]/loopback
5468 * http://[::]/unspecified
5469 * http://[::13.1.68.3]/ipv4compat
5470 * http://[::FFFF:129.144.52.38]/ipv4compat
5471
5472 Examples from RFC 2732, section 2:
5473 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5474 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5475 * http://[3ffe:2a00:100:7031::1]
5476 * http://[1080::8:800:200C:417A]/foo
5477 * http://[::192.9.5.5]/ipng
5478 * http://[::FFFF:129.144.52.38]:80/index.html
5479 * http://[2010:836B:4179::836B:4179]
5480
5481 !! html/php
5482 <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>
5483 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5484 </p>
5485 <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>
5486 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5487 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5488 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5489 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5490 <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>
5491 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5492 </p>
5493 <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>
5494 <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>
5495 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5496 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5497 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5498 <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>
5499 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5500
5501 !! html/parsoid
5502 <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>
5503
5504 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5505 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5506 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5507 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5508 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5509 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5510 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5511
5512 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5513 <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>
5514 <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>
5515 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5516 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5517 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5518 <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>
5519 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5520 !! end
5521
5522 !! test
5523 IPv6 urls, bracketed format (T23261)
5524 !! wikitext
5525 [http://[2404:130:0:1000::187:2]/index.php test]
5526
5527 Examples from RFC 2373, section 2.2:
5528 * [http://[1080::8:800:200C:417A] unicast]
5529 * [http://[FF01::101] multicast]
5530 * [http://[::1]/ loopback]
5531 * [http://[::] unspecified]
5532 * [http://[::13.1.68.3] ipv4compat]
5533 * [http://[::FFFF:129.144.52.38] ipv4compat]
5534
5535 Examples from RFC 2732, section 2:
5536 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5537 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5538 * [http://[3ffe:2a00:100:7031::1] 3]
5539 * [http://[1080::8:800:200C:417A]/foo 4]
5540 * [http://[::192.9.5.5]/ipng 5]
5541 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5542 * [http://[2010:836B:4179::836B:4179] 7]
5543
5544 !! html/php
5545 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5546 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5547 </p>
5548 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5549 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5550 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5551 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5552 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5553 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5554 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5555 </p>
5556 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5557 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5558 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5559 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5560 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5561 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5562 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5563
5564 !! html/parsoid
5565 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5566
5567 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5568 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5569 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5570 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5571 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5572 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5573 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5574
5575 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5576 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5577 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5578 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5579 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5580 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5581 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5582 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5583 !! end
5584
5585 !! test
5586 Non-extlinks in brackets
5587 !! wikitext
5588 [foo]
5589 [foo bar]
5590 [foo ''bar'']
5591 [fool's] errand
5592 [fool's errand]
5593 [{{echo|foo}}]
5594 [{{echo|foo}} bar]
5595 [{{echo|foo}} ''bar'']
5596 [{{echo|foo}}l's] errand
5597 [{{echo|foo}}l's errand]
5598 [url={{echo|foo}}]
5599 [url=http://example.com]
5600 [http:// bare protocols don't count]
5601 !! html/php
5602 <p>[foo]
5603 [foo bar]
5604 [foo <i>bar</i>]
5605 [fool's] errand
5606 [fool's errand]
5607 [foo]
5608 [foo bar]
5609 [foo <i>bar</i>]
5610 [fool's] errand
5611 [fool's errand]
5612 [url=foo]
5613 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5614 [http:// bare protocols don't count]
5615 </p>
5616 !! html/parsoid
5617 <p>[foo]
5618 [foo bar]
5619 [foo <i>bar</i>]
5620 [fool's] errand
5621 [fool's errand]
5622 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5623 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5624 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5625 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5626 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5627 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5628 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5629 [http:// bare protocols don't count]</p>
5630 !! end
5631
5632 !! test
5633 Percent encoding in external links
5634 !! wikitext
5635 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5636 !! html/php
5637 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5638 </p>
5639 !! html/parsoid
5640 <p><a rel="mw:ExtLink"
5641 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5642 !! end
5643
5644 !! test
5645 Use url link syntax for links where the content is equal the link target
5646 !! wikitext
5647 http://example.com
5648 !! html/php
5649 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5650 </p>
5651 !! html/parsoid
5652 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5653 !! end
5654
5655 !! test
5656 Parenthesis in external links, especially URL links
5657 !! wikitext
5658 http://example.com)
5659
5660 http://example.com/test)
5661
5662 http://example.com/(test)
5663
5664 http://example.com/((test)
5665
5666 (http://example.com/(test))
5667
5668 (http://example.com/(test)))))
5669
5670 http://example.com/a)b
5671
5672 [http://example.com) foo]
5673 !! html/php
5674 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5675 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5676 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5677 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5678 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5679 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5680 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5681 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5682 </p>
5683 !! html/parsoid
5684 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5685 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5686 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5687 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5688 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5689 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5690 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5691 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5692 !! end
5693
5694 !! test
5695 Parenthesis in external links, w/ transclusion or comment
5696 !! wikitext
5697 (http://example.com/{{echo|hi}})
5698
5699 (http://example.com<!-- hi -->)
5700 !! html/php
5701 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5702 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5703 </p>
5704 !! html/parsoid
5705 <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>
5706
5707 <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>
5708 !! end
5709
5710 !! test
5711 Serialize <a> tags with invalid link targets as plain text
5712 !! options
5713 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5714 !! html/parsoid
5715 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5716 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5717 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5718 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5719 !! wikitext
5720 text
5721 <nowiki>*</nowiki>text
5722 <nowiki>[[foo]]</nowiki>
5723 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5724 !! end
5725
5726 !! test
5727 mw:ExtLink -vs- mw:WikiLink (T94723)
5728 !! options
5729 parsoid=html2wt
5730 !! html/parsoid
5731 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5732 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5733 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5734 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5735 <p>
5736 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5737 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5738 </p>
5739 !! wikitext
5740 [[Foo|Bar]]
5741 [[Foo|Bar]]
5742 [[wikipedia:Foo|Bar]]
5743 [[wikipedia:Foo|Bar]]
5744
5745 [[wikipedia:European_Robin|European Robin]]
5746 [[wikipedia:European_Robin|European Robin]]
5747 !! end
5748
5749 !! test
5750 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5751 !! options
5752 parsoid=wt2wt
5753 !! wikitext
5754 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5755 !! html/parsoid
5756 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5757 !! end
5758
5759
5760 ###
5761 ### Quotes
5762 ###
5763
5764 !! test
5765 Quotes
5766 !! wikitext
5767 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5768
5769 Normal text. '''''Bold italic text.''''' Normal text.
5770 !! html
5771 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5772 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5773 </p>
5774 !! end
5775
5776
5777 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5778 # parser strips. The wikitext contains just the first half of the bold
5779 # quote pair.
5780 !! test
5781 Unclosed and unmatched quotes
5782 !! wikitext
5783 '''''Bold italic text '''with bold deactivated''' in between.'''''
5784
5785 '''''Bold italic text ''with italic deactivated'' in between.'''''
5786
5787 '''Bold text..
5788
5789 ..spanning two paragraphs (should not work).'''
5790
5791 '''Bold tag left open
5792
5793 ''Italic tag left open
5794
5795 Normal text.
5796
5797 <!-- Unmatching number of opening, closing tags: -->
5798 '''This year''''s election ''should'' beat '''last year''''s.
5799
5800 ''Tom'''s car is bigger than ''Susan'''s.
5801
5802 Plain ''italic'''s plain
5803 !! html/php
5804 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5805 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5806 </p><p><b>Bold text..</b>
5807 </p><p>..spanning two paragraphs (should not work).
5808 </p><p><b>Bold tag left open</b>
5809 </p><p><i>Italic tag left open</i>
5810 </p><p>Normal text.
5811 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5812 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5813 </p><p>Plain <i>italic'</i>s plain
5814 </p>
5815 !! html/parsoid
5816 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5817 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5818 </p><p><b>Bold text..</b>
5819 </p><p>..spanning two paragraphs (should not work).<b></b>
5820 </p><p><b>Bold tag left open</b>
5821 </p><p><i>Italic tag left open</i>
5822 </p><p>Normal text.
5823 </p>
5824 <!-- Unmatching number of opening, closing tags: -->
5825 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5826 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5827 </p><p>Plain <i>italic'</i>s plain
5828 </p>
5829 !! end
5830
5831 ###
5832 ### Tables
5833 ###
5834 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5835 ###
5836
5837 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5838 # is the bare minimum required by the spec, see:
5839 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5840 # Parsoid team replies: empty table tags are legal in HTML5
5841 !! test
5842 A table with no data.
5843 !! options
5844 parsoid=wt2html
5845 !! wikitext
5846 {||}
5847 !! html/php
5848
5849 !! html/parsoid
5850 <table></table>
5851
5852 !! end
5853
5854 !! test
5855 A table with stray table end tags on start tag line (wt2html)
5856 !! options
5857 parsoid=wt2html
5858 !! wikitext
5859 {|style="color: red;"|}
5860
5861 {|style="color: red;" |}
5862 |foo
5863 |}
5864
5865 {|style="color: red;"|} id="foo"
5866 |foo
5867 |}
5868
5869 {|style="color: red;" |} id="foo"
5870 |foo
5871 |}
5872 !! html
5873 <table style="color: red;"></table>
5874
5875 <table style="color: red;">
5876 <tbody><tr>
5877 <td>foo</td>
5878 </tr></tbody>
5879 </table>
5880
5881 <table style="color: red;" id="foo">
5882 <tbody><tr>
5883 <td>foo</td>
5884 </tr></tbody>
5885 </table>
5886
5887 <table style="color: red;" id="foo">
5888 <tbody><tr>
5889 <td>foo</td>
5890 </tr></tbody>
5891 </table>
5892
5893 !! end
5894
5895 !! test
5896 A table with no data (take 2)
5897 !! wikitext
5898 {|
5899 |}
5900 !! html/parsoid
5901 <table></table>
5902 !! end
5903
5904 # A table with nothing but a caption is invalid XHTML, we might want to render
5905 # this as <p>caption</p>
5906 # Parsoid team replies: table with only a caption is legal in HTML5
5907 !! test
5908 A table with nothing but a caption
5909 !! wikitext
5910 {|
5911 |+ caption
5912 |}
5913 !! html/php
5914 <table>
5915 <caption> caption
5916 </caption><tr><td></td></tr></table>
5917
5918 !! html/parsoid
5919 <table><caption> caption</caption></table>
5920 !! end
5921
5922 !! test
5923 A table with caption with default-spaced attributes and a table row
5924 !! wikitext
5925 {|
5926 |+ style="color: red;" | caption1
5927 |-
5928 | foo
5929 |}
5930 !! html
5931 <table>
5932 <caption style="color: red;"> caption1
5933 </caption>
5934 <tr>
5935 <td> foo
5936 </td></tr></table>
5937
5938 !! end
5939
5940 !! test
5941 A table with captions with non-default spaced attributes and a table row
5942 !! wikitext
5943 {|
5944 |+style="color: red;"|caption2
5945 |+ style="color: red;"| caption3
5946 |-
5947 | foo
5948 |}
5949 !! html
5950 <table>
5951 <caption style="color: red;">caption2
5952 </caption>
5953 <caption style="color: red;"> caption3
5954 </caption>
5955 <tr>
5956 <td> foo
5957 </td></tr></table>
5958
5959 !! end
5960
5961 !! test
5962 Table td-cell syntax variations
5963 !! wikitext
5964 {|
5965 | foo bar foo | baz
5966 | foo bar foo || baz
5967 | style='color:red;' | baz
5968 | style='color:red;' || baz
5969 |}
5970 !! html
5971 <table>
5972 <tr>
5973 <td> baz
5974 </td>
5975 <td> foo bar foo </td>
5976 <td> baz
5977 </td>
5978 <td style="color:red;"> baz
5979 </td>
5980 <td> style='color:red;' </td>
5981 <td> baz
5982 </td></tr></table>
5983
5984 !! end
5985
5986 !! test
5987 Simple table
5988 !! wikitext
5989 {|
5990 | 1 || 2
5991 |-
5992 | 3 || 4
5993 |}
5994 !! html
5995 <table>
5996 <tr>
5997 <td> 1 </td>
5998 <td> 2
5999 </td></tr>
6000 <tr>
6001 <td> 3 </td>
6002 <td> 4
6003 </td></tr></table>
6004
6005 !! end
6006
6007 !! test
6008 Simple table but with multiple dashes for row wikitext
6009 !! wikitext
6010 {|
6011 | foo
6012 |-----
6013 | bar
6014 |}
6015 !! html
6016 <table>
6017 <tr>
6018 <td> foo
6019 </td></tr>
6020 <tr>
6021 <td> bar
6022 </td></tr></table>
6023
6024 !! end
6025
6026 !! test
6027 Multiplication table
6028 !! wikitext
6029 {| border="1" cellpadding="2"
6030 |+Multiplication table
6031 |-
6032 ! &times; !! 1 !! 2 !! 3
6033 |-
6034 ! 1
6035 | 1 || 2 || 3
6036 |-
6037 ! 2
6038 | 2 || 4 || 6
6039 |-
6040 ! 3
6041 | 3 || 6 || 9
6042 |-
6043 ! 4
6044 | 4 || 8 || 12
6045 |-
6046 ! 5
6047 | 5 || 10 || 15
6048 |}
6049 !! html
6050 <table border="1" cellpadding="2">
6051 <caption>Multiplication table
6052 </caption>
6053 <tr>
6054 <th> &#215; </th>
6055 <th> 1 </th>
6056 <th> 2 </th>
6057 <th> 3
6058 </th></tr>
6059 <tr>
6060 <th> 1
6061 </th>
6062 <td> 1 </td>
6063 <td> 2 </td>
6064 <td> 3
6065 </td></tr>
6066 <tr>
6067 <th> 2
6068 </th>
6069 <td> 2 </td>
6070 <td> 4 </td>
6071 <td> 6
6072 </td></tr>
6073 <tr>
6074 <th> 3
6075 </th>
6076 <td> 3 </td>
6077 <td> 6 </td>
6078 <td> 9
6079 </td></tr>
6080 <tr>
6081 <th> 4
6082 </th>
6083 <td> 4 </td>
6084 <td> 8 </td>
6085 <td> 12
6086 </td></tr>
6087 <tr>
6088 <th> 5
6089 </th>
6090 <td> 5 </td>
6091 <td> 10 </td>
6092 <td> 15
6093 </td></tr></table>
6094
6095 !! end
6096
6097 !! test
6098 Accept "||" in table headings
6099 !! wikitext
6100 {|
6101 !h1 || h2
6102 |}
6103 !! html
6104 <table>
6105 <tr>
6106 <th>h1 </th>
6107 <th> h2
6108 </th></tr></table>
6109
6110 !! end
6111
6112 !! test
6113 Accept "!!" in table data
6114 !! wikitext
6115 {|
6116 | Foo!! ||
6117 |}
6118 !! html
6119 <table>
6120 <tr>
6121 <td> Foo!! </td>
6122 <td>
6123 </td></tr></table>
6124
6125 !! html/parsoid
6126 <table>
6127 <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>
6128 </tbody></table>
6129 !! end
6130
6131 !! test
6132 Accept "||" in indented table headings
6133 !! wikitext
6134 :{|
6135 !h1 || h2
6136 |}
6137 !! html
6138 <dl><dd><table>
6139 <tr>
6140 <th>h1 </th>
6141 <th> h2
6142 </th></tr></table></dd></dl>
6143
6144 !! end
6145
6146 !! test
6147 Accept "!!" in templates
6148 !! wikitext
6149 {|
6150 !a {{echo|b!!c}}
6151 |}
6152 !! html/php
6153 <table>
6154 <tr>
6155 <th>a b</th>
6156 <th>c
6157 </th></tr></table>
6158
6159 !! html/parsoid
6160 <table>
6161 <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>
6162 !! end
6163
6164 !! test
6165 Accept "!!" in table headings after newline
6166 !! wikitext
6167 {|
6168 !a
6169 b!!c
6170 |}
6171 !! html/php
6172 <table>
6173 <tr>
6174 <th>a
6175 <p>b!!c
6176 </p>
6177 </th></tr></table>
6178
6179 !! html/parsoid
6180 <table>
6181 <tbody><tr><th>a
6182 <p>b!!c</p></th></tr>
6183 </tbody></table>
6184 !! end
6185
6186 !! test
6187 Accept "!!" in table data of mixed wikitext / html syntax
6188 !! wikitext
6189 {|
6190 !a
6191 <tr><td>b!!c</td></tr>
6192 |}
6193 !! html+tidy
6194 <table>
6195 <tr>
6196 <th>a</th>
6197 </tr>
6198 <tr>
6199 <td>b!!c</td>
6200 </tr>
6201 </table>
6202 !! html/parsoid
6203 <table>
6204 <tbody><tr><th>a</th></tr>
6205 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6206 </tbody></table>
6207 !! end
6208
6209 !! test
6210 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6211 !! wikitext
6212 {|
6213 !| h1
6214 || a
6215 |}
6216 !! html
6217 <table>
6218 <tr>
6219 <th> h1
6220 </th>
6221 <td> a
6222 </td></tr></table>
6223
6224 !! end
6225
6226 !!test
6227 Accept "| !" at start of line in tables (ignore !-attribute)
6228 !! wikitext
6229 {|
6230 |-
6231 | !style="color:red" | bar
6232 |}
6233 !! html
6234 <table>
6235
6236 <tr>
6237 <td> bar
6238 </td></tr></table>
6239
6240 !!end
6241
6242 !!test
6243 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 +/-
6244 !! wikitext
6245 {|
6246 |-
6247 |style='color:red;'|+1
6248 |style='color:blue;'|-1
6249 |-
6250 | 1 || 2 || 3
6251 | 1 ||+2 ||-3
6252 |-
6253 | +1
6254 | -1
6255 |}
6256 !! html
6257 <table>
6258
6259 <tr>
6260 <td style="color:red;">+1
6261 </td>
6262 <td style="color:blue;">-1
6263 </td></tr>
6264 <tr>
6265 <td> 1 </td>
6266 <td> 2 </td>
6267 <td> 3
6268 </td>
6269 <td> 1 </td>
6270 <td>+2 </td>
6271 <td>-3
6272 </td></tr>
6273 <tr>
6274 <td> +1
6275 </td>
6276 <td> -1
6277 </td></tr></table>
6278
6279 !!end
6280
6281 !! test
6282 Table rowspan
6283 !! wikitext
6284 {| border=1
6285 | Cell 1, row 1
6286 |rowspan=2| Cell 2, row 1 (and 2)
6287 | Cell 3, row 1
6288 |-
6289 | Cell 1, row 2
6290 | Cell 3, row 2
6291 |}
6292 !! html
6293 <table border="1">
6294 <tr>
6295 <td> Cell 1, row 1
6296 </td>
6297 <td rowspan="2"> Cell 2, row 1 (and 2)
6298 </td>
6299 <td> Cell 3, row 1
6300 </td></tr>
6301 <tr>
6302 <td> Cell 1, row 2
6303 </td>
6304 <td> Cell 3, row 2
6305 </td></tr></table>
6306
6307 !! end
6308
6309 !! test
6310 Nested table
6311 !! wikitext
6312 {| border=1
6313 | &alpha;
6314 |
6315 {| bgcolor=#ABCDEF border=2
6316 |nested
6317 |-
6318 |table
6319 |}
6320 |the original table again
6321 |}
6322 !! html
6323 <table border="1">
6324 <tr>
6325 <td> &#945;
6326 </td>
6327 <td>
6328 <table bgcolor="#ABCDEF" border="2">
6329 <tr>
6330 <td>nested
6331 </td></tr>
6332 <tr>
6333 <td>table
6334 </td></tr></table>
6335 </td>
6336 <td>the original table again
6337 </td></tr></table>
6338
6339 !! end
6340
6341 !! test
6342 Invalid attributes in table cell (bug 1830)
6343 !! wikitext
6344 {|
6345 |Cell:|broken
6346 |}
6347 !! html
6348 <table>
6349 <tr>
6350 <td>broken
6351 </td></tr></table>
6352
6353 !! end
6354
6355 !! test
6356 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6357 !! wikitext
6358 {|
6359 | title="foo" |bar
6360 | title="foo<nowiki>|</nowiki>" |bar
6361 | title="foo<nowiki>|</nowiki>" bar
6362 |}
6363 !! html/php
6364 <table>
6365 <tr>
6366 <td title="foo">bar
6367 </td>
6368 <td title="foo&#124;">bar
6369 </td>
6370 <td> title="foo|" bar
6371 </td></tr></table>
6372
6373 !! html/parsoid
6374 <table>
6375 <tbody><tr><td title="foo">bar</td>
6376 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6377 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6378 </tbody></table>
6379 !! end
6380
6381 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6382 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6383 # *2wt modes will fail.
6384 !! test
6385 Table security: embedded pipes
6386 !! options
6387 parsoid=wt2html,html2html
6388 !! wikitext
6389 {|
6390 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6391 !! html/php
6392 <table>
6393 <tr>
6394 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6395 <td>]" onmouseover="alert(document.cookie)"&gt;test
6396 </td>
6397 </tr>
6398 </table>
6399
6400 !! html/parsoid
6401 <table><tbody>
6402 <tr>
6403 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6404 !! end
6405
6406 !! test
6407 Element attributes with double ! should not be broken up by <th>
6408 !! wikitext
6409 {|
6410 ! hi <div class="!!">ha</div> ho
6411 |}
6412 !! html/php
6413 <table>
6414 <tr>
6415 <th> hi <div class="!!">ha</div> ho
6416 </th></tr></table>
6417
6418 !! html/parsoid
6419 <table>
6420 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6421 </tbody></table>
6422 !! end
6423
6424 !! test
6425 ! and || in element attributes should not be parsed as <th>/<td>
6426 !! wikitext
6427 {|
6428 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6429 |}
6430 !! html/php
6431 <table>
6432 <tr>
6433 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6434 </td></tr></table>
6435
6436 !! html/parsoid
6437 <table>
6438 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6439 </tbody></table>
6440 !! end
6441
6442 # FIXME: The output seems broken. Filed as T110268.
6443 !! test
6444 ! and || in td attributes should not be parsed as <th>/<td>
6445 !! options
6446 parsoid=wt2html
6447 !! wikitext
6448 {|
6449 | style="color: red !important;" data-contrived="put this here ||" | foo
6450 |}
6451 !! html/php
6452 <table>
6453 <tr>
6454 <td> style="color: red !important;" data-contrived="put this here </td>
6455 <td> foo
6456 </td></tr></table>
6457
6458 !! html/parsoid
6459 <table>
6460 <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>
6461 </tbody></table>
6462 !! end
6463
6464 !! test
6465 Break on | in element attribute in template
6466 !! options
6467 parsoid=wt2html,html2html
6468 !! wikitext
6469 {{echo|1=<div class="hi|ho">ha</div>}}
6470 !! html/php
6471 <p>ho"&gt;ha&lt;/div&gt;
6472 </p>
6473 !! html/parsoid
6474 <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>
6475 !! end
6476
6477 ## We don't support roundtripping of these attributes in Parsoid.
6478 ## Selective serialization takes care of preventing dirty diffs.
6479 ## But, on edits, we dirty-diff the invalid attribute text.
6480 !! test
6481 Invalid text in table attributes should be discarded
6482 !! options
6483 parsoid=wt2html
6484 !! wikitext
6485 {| <span>boo</span> style='border:1px solid black'
6486 | <span>boo</span> style='color:blue' | 1
6487 |<span>boo</span> style='color:blue'| 2
6488 |}
6489 !! html/php
6490 <table style="border:1px solid black">
6491 <tr>
6492 <td style="color:blue"> 1
6493 </td>
6494 <td style="color:blue"> 2
6495 </td></tr></table>
6496
6497 !! html/parsoid
6498 <table style="border:1px solid black">
6499 <tr>
6500 <td style="color:blue"> 1</td>
6501 <td style="color:blue"> 2</td>
6502 </tr>
6503 </table>
6504 !! end
6505
6506 !! test
6507 Invalid text in table attributes should be preserved by selective serializer
6508 !! options
6509 parsoid={
6510 "modes": ["selser"],
6511 "changes": [
6512 ["td:first-child", "text", "abc"],
6513 ["td + td", "text", "xyz"]
6514 ]
6515 }
6516 !! wikitext
6517 {| <span>boo</span> style='border:1px solid black'
6518 | <span>boo</span> style='color:blue' | 1
6519 |<span>boo</span> style='color:blue'| 2
6520 |}
6521 !! wikitext/edited
6522 {| <span>boo</span> style='border:1px solid black'
6523 | <span>boo</span> style='color:blue' |abc
6524 |<span>boo</span> style='color:blue'|xyz
6525 |}
6526 !! end
6527
6528 !! test
6529 1. Template-generated table cell attributes and cell content
6530 !! wikitext
6531 {|
6532 |{{table_attribs}}
6533 | {{table_attribs}}
6534 || {{table_attribs_5}}
6535 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6536 |align=center {{table_attribs}}
6537 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6538 |}
6539 !! html
6540 <table>
6541 <tr>
6542 <td style="color:red;">Foo
6543 </td>
6544 <td style="color:red;">Foo
6545 </td>
6546 <td> style="color:red;"</td>
6547 <td>Bar
6548 </td>
6549 <td style="color:red;">Foo
6550 </td>
6551 <td align="center" style="color:red;">Foo
6552 </td>
6553 <td align="center" style="color:red;">Foo
6554 </td></tr></table>
6555
6556 !! end
6557
6558 !! test
6559 2. Template-generated table cell attributes and cell content
6560 !! wikitext
6561 {|
6562 |{{table_attribs_2}}
6563 |}
6564 !! html/php
6565 <table>
6566 <tr>
6567 <td style="color:red;">Foo
6568 </td>
6569 <td>Bar</td>
6570 <td>Baz
6571 </td></tr></table>
6572
6573 !! html/parsoid
6574 <table>
6575 <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>
6576 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6577 </tbody></table>
6578 !! end
6579
6580 !! test
6581 3. Template-generated table cell attributes and cell content
6582 !! wikitext
6583 {|
6584 !align=center {{table_header_cells}}
6585 |-
6586 |align=center {{table_cells}}
6587 |}
6588 !! html/php
6589 <table>
6590 <tr>
6591 <th align="center" style="color:red;">Foo</th>
6592 <th style="color:red;"><i>Bar</i></th>
6593 <th style="color:brown;"><i>Foo</i> and Baz
6594 </th></tr>
6595 <tr>
6596 <td align="center" style="color:red;">Foo</td>
6597 <td style="color:red;"><i>Bar</i></td>
6598 <td style="color:brown;"><i>Foo</i> and Baz
6599 </td></tr></table>
6600
6601 !! html/parsoid
6602 <table>
6603 <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>
6604 <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>
6605 </tbody></table>
6606 !! end
6607
6608 !! test
6609 4. Template-generated table cell attributes and cell content inside a templated table
6610 !! wikitext
6611 {{tbl-start}}
6612 !align=center {{table_header_cells}}
6613 |-
6614 |align=center {{table_cells}}
6615 {{tbl-end}}
6616 !! html/php
6617 <table>
6618 <tr>
6619 <th align="center" style="color:red;">Foo</th>
6620 <th style="color:red;"><i>Bar</i></th>
6621 <th style="color:brown;"><i>Foo</i> and Baz
6622 </th></tr>
6623 <tr>
6624 <td align="center" style="color:red;">Foo</td>
6625 <td style="color:red;"><i>Bar</i></td>
6626 <td style="color:brown;"><i>Foo</i> and Baz
6627 </td></tr></table>
6628
6629 !! html/parsoid
6630 <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}}]}'>
6631 <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>
6632 <tr>
6633 <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>
6634 </tbody></table>
6635 !! end
6636
6637 ## Edge case fix to prevent future regressions
6638 !! test
6639 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6640 !! wikitext
6641 {|
6642 |{{table_attribs_7}}
6643 |}
6644 <references />
6645 !! html/parsoid
6646 <table>
6647 <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="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></td></tr>
6648 </tbody></table>
6649 <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="#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>
6650 !! end
6651
6652 !! test
6653 Table with row followed by newlines and table heading
6654 !! options
6655 parsoid=wt2html,html2html
6656 !! wikitext
6657 {|
6658 |-
6659
6660 ! foo
6661 |}
6662 !! html/*
6663 <table>
6664
6665
6666 <tr>
6667 <th> foo
6668 </th></tr></table>
6669
6670 !! end
6671
6672 !! test
6673 Table with empty line following the start tag
6674 !! options
6675 parsoid=wt2html,html2html
6676 !! wikitext
6677 {|
6678
6679 |-
6680 | foo
6681 |}
6682 !! html/*
6683 <table>
6684
6685
6686 <tr>
6687 <td> foo
6688 </td></tr></table>
6689
6690 !! end
6691
6692 !! test
6693 Table attributes with empty value
6694 !! options
6695 parsoid=wt2html,html2html
6696 !! wikitext
6697 {|
6698 | style=| hello
6699 |}
6700 !! html/php
6701 <table>
6702 <tr>
6703 <td style=""> hello
6704 </td></tr></table>
6705
6706 !! html/parsoid
6707 <table>
6708 <tbody><tr><td style=""> hello</td></tr>
6709 </tbody></table>
6710 !! end
6711
6712 !! test
6713 Wikitext table with a lot of comments
6714 !! wikitext
6715 {|
6716 <!-- c0 -->
6717 | foo
6718 <!-- c1 -->
6719 |-<!-- c2 -->
6720 <!-- c3 -->
6721 |<!-- c4 -->
6722 <!-- c5 -->
6723 |}
6724 !! html
6725 <table>
6726 <tr>
6727 <td> foo
6728 </td></tr>
6729 <tr>
6730 <td>
6731 </td></tr></table>
6732
6733 !! end
6734
6735 !! test
6736 Wikitext table comments represented in parsoid dom
6737 !! wikitext
6738 {|<!--c1--><!--c2-->
6739 |-<!--c3-->
6740 | x
6741 |}
6742 !! html/php+tidy
6743 <table>
6744 <tr>
6745 <td>x</td>
6746 </tr>
6747 </table>
6748 !! html/parsoid
6749 <table><!--c1--><!--c2-->
6750 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6751 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6752 </tbody></table>
6753 !! end
6754
6755 !! test
6756 Wikitext table with double-line table cell
6757 !! wikitext
6758 {|
6759 |a
6760 b
6761 |}
6762 !! html
6763 <table>
6764 <tr>
6765 <td>a
6766 <p>b
6767 </p>
6768 </td></tr></table>
6769
6770 !! end
6771
6772 !! test
6773 Table cell with a single comment
6774 !! wikitext
6775 {|
6776 | <!-- c1 -->
6777 | a
6778 |}
6779 !! html
6780 <table>
6781 <tr>
6782 <td>
6783 </td>
6784 <td> a
6785 </td></tr></table>
6786
6787 !! end
6788
6789 !! test
6790 Table-cell after a comment-only-empty-line
6791 !! wikitext
6792 {|
6793 |a
6794 <!--c1-->
6795 <!--c2-->| b
6796 |}
6797 !! html
6798 <table>
6799 <tr>
6800 <td>a
6801 </td>
6802 <td> b
6803 </td></tr></table>
6804
6805 !! html/parsoid
6806 <table>
6807 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6808 <!--c1-->
6809 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6810 </tbody></table>
6811
6812 !! end
6813
6814 !! test
6815 Build table with {{!}}
6816 !! wikitext
6817 {{{!}} class="wikitable"
6818 ! header
6819 ! second header
6820 {{!}}- style="color:red;"
6821 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6822 {{!}}}
6823 !! html
6824 <table class="wikitable">
6825 <tr>
6826 <th> header
6827 </th>
6828 <th> second header
6829 </th></tr>
6830 <tr style="color:red;">
6831 <td> data </td>
6832 <td style="color:red;"> second data
6833 </td></tr></table>
6834
6835 !! end
6836
6837 !! test
6838 Build table with pipe as data
6839 !! wikitext
6840 {| class="wikitable"
6841 ! header
6842 ! second header
6843 |- style="color:red;"
6844 | data || style="color:red;" | second data
6845 |-
6846 | style="color:red;" | data with | || style="color:red;" | second data with |
6847 |-
6848 || data with | ||| second data with |
6849 |}
6850 !! html
6851 <table class="wikitable">
6852 <tr>
6853 <th> header
6854 </th>
6855 <th> second header
6856 </th></tr>
6857 <tr style="color:red;">
6858 <td> data </td>
6859 <td style="color:red;"> second data
6860 </td></tr>
6861 <tr>
6862 <td style="color:red;"> data with | </td>
6863 <td style="color:red;"> second data with |
6864 </td></tr>
6865 <tr>
6866 <td> data with | </td>
6867 <td> second data with |
6868 </td></tr></table>
6869
6870 !! end
6871
6872 !! test
6873 Build table with wikilink
6874 !! wikitext
6875 {| class="wikitable"
6876 ! header || second header
6877 |- style="color:red;"
6878 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6879 |-
6880 | data || second data [[Main Page|link|text with pipe]]
6881 |}
6882 !! html
6883 <table class="wikitable">
6884 <tr>
6885 <th> header </th>
6886 <th> second header
6887 </th></tr>
6888 <tr style="color:red;">
6889 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6890 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6891 </td></tr>
6892 <tr>
6893 <td> data </td>
6894 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6895 </td></tr></table>
6896
6897 !! end
6898
6899 # The expected HTML structure in this test is debatable. The PHP parser does
6900 # not parse this kind of table at all. The main focus for Parsoid is on
6901 # round-tripping, so this output is ok for now. TODO: revisit!
6902 !! test
6903 Wikitext table with html-syntax row
6904 !! wikitext
6905 {|
6906 |-
6907 <td>foo</td>
6908 |}
6909 !! html/parsoid
6910 <table>
6911 <tbody>
6912 <tr>
6913 <td>foo</td></tr></tbody></table>
6914 !! end
6915
6916 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6917 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6918 ## PHP parser, which tidy then compounds by fostering the content
6919 ## entirely out of the table. Parsoid recognizes the table context
6920 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6921 ## depends on PHP's treatment of broken table markup!
6922 !! test
6923 Implicit <td> after a |-
6924 !! options
6925 parsoid=wt2html,html2html
6926 !! wikitext
6927 {|
6928 |-
6929 a
6930 |}
6931 !! html/php
6932 <table>
6933
6934 a
6935 </table>
6936
6937 !! html/php+tidy
6938 <p>a</p>
6939 !! html/parsoid
6940 <table>
6941 <tr><td>a</td></tr>
6942 </table>
6943 !! end
6944
6945 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6946 !! test
6947 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6948 !! options
6949 parsoid=wt2html,html2html
6950 !! wikitext
6951 {|
6952 |-
6953 |
6954 a
6955 |-
6956 b
6957 |}
6958 !! html/php
6959 <table>
6960
6961 <tr>
6962 <td>
6963 <pre>a
6964 </pre>
6965 </td></tr>
6966 b
6967 </table>
6968
6969 !! html/php+tidy
6970 <p>b</p>
6971 <table>
6972 <tr>
6973 <td>
6974 <pre>
6975 a
6976 </pre></td>
6977 </tr>
6978 </table>
6979 !! html/parsoid
6980 <table>
6981 <tbody>
6982 <tr><td><pre>a</pre></td></tr>
6983 <tr><td> b</td></tr>
6984 </tbody>
6985 </table>
6986 !! end
6987
6988 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6989 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6990 !! test
6991 Lists should be recognized in an implicit <td> context
6992 !! options
6993 parsoid=wt2html,html2html
6994 !! wikitext
6995 {|
6996 |-
6997 *a
6998 |}
6999 !! html/php
7000 <table>
7001
7002 <ul><li>a</li></ul>
7003 </table>
7004
7005 !! html/php+tidy
7006 <ul>
7007 <li>a</li>
7008 </ul>
7009 !! html/parsoid
7010 <table>
7011 <tr>
7012 <td><ul>
7013 <li>a</li>
7014 </ul></td>
7015 </tr>
7016 </table>
7017 !! end
7018
7019 !! test
7020 Table cells not properly parsed in an implicit-td context
7021 !! wikitext
7022 {|
7023 |-
7024 {{table_attribs_4}} || a || b
7025 |}
7026 !! html/php+tidy
7027 <table>
7028 <tr>
7029 <td style="background-color:#DC241f;" width="10px"></td>
7030 <td>a</td>
7031 <td>b</td>
7032 </tr>
7033 </table>
7034 !! html/parsoid
7035 <table>
7036 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7037 <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>
7038 </tbody></table>
7039 !! end
7040
7041 !! test
7042 Parsoid: Round-trip tables directly followed by content (bug 51219)
7043 !! options
7044 parsoid=wt2html,wt2wt
7045 !! wikitext
7046 {|
7047 |foo
7048 |} bar
7049
7050 {|
7051 |baz
7052 |}<b>quux</b>
7053 !! html+tidy
7054 <table>
7055 <tr>
7056 <td>foo</td>
7057 </tr>
7058 </table>
7059 <p>bar</p>
7060 <table>
7061 <tr>
7062 <td>baz</td>
7063 </tr>
7064 </table>
7065 <p><b>quux</b></p>
7066 !! end
7067
7068 !! test
7069 Parsoid: Default to a newline after tables in new content (bug 51219)
7070 !! options
7071 parsoid=html2wt
7072 !! html/parsoid
7073 <table><tbody>
7074 <tr><td>foo</td></tr></tbody></table> bar
7075 <table><tbody>
7076 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7077 !! wikitext
7078 {|
7079 |foo
7080 |}
7081 <nowiki> </nowiki>bar
7082 {|
7083 |baz
7084 |}
7085 '''quux'''
7086 !! end
7087
7088 !! test
7089 Parsoid: newline inducing block nodes don't suppress <nowiki>
7090 !! options
7091 parsoid=html2wt
7092 !! html/parsoid
7093 a<h1>foo</h1>
7094 !! wikitext
7095 <nowiki> </nowiki>a
7096
7097 = foo =
7098 !! end
7099
7100 !! test
7101 Parsoid: Row-syntax table headings followed by comment & table cells
7102 !! options
7103 parsoid=wt2html,wt2wt
7104 !! wikitext
7105 {|
7106 ! foo || bar
7107 <!-- foo --> || baz || quux
7108 |}
7109 !! html/php
7110 <table>
7111 <tr>
7112 <th> foo </th>
7113 <th> bar
7114 </th>
7115 <td> baz </td>
7116 <td> quux
7117 </td></tr></table>
7118
7119 !! html/parsoid
7120 <table>
7121 <tbody><tr><th> foo </th><th> bar
7122 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7123 </tbody></table>
7124 !! end
7125
7126 !!test
7127 Parsoid: Recover better from broken table attributes
7128 !!options
7129 parsoid=wt2html
7130 !!wikitext
7131 {| class="foo
7132 | class="bar" |
7133 foo
7134 |}
7135 !!html/php+tidy
7136 <table class="foo">
7137 <tr>
7138 <td class="bar">
7139 <p>foo</p>
7140 </td>
7141 </tr>
7142 </table>
7143 !!html/parsoid
7144 <table class="foo">
7145 <tr>
7146 <td class="bar">
7147 <p>foo</p></td></tr>
7148 </tbody></table>
7149 !!end
7150
7151 !! test
7152 Tables: Digest broken attributes on table and tr tag
7153 !! options
7154 parsoid=wt2html
7155 !! wikitext
7156 {| || |} ++
7157 |- || || ++ --
7158 |- > [
7159 |}
7160 !! html
7161 <table>
7162 <tbody>
7163 <tr></tr>
7164 <tr></tr>
7165 </tbody></table>
7166 !! end
7167
7168 # T137406: Whitespace in the HTML
7169 !! test
7170 1. Generate correct wikitext for tables with thead/tbody/tfoot
7171 !! options
7172 parsoid=html2wt
7173 !! html/parsoid
7174 <table>
7175 <caption>Test</caption>
7176 <thead>
7177 <tr>
7178 <th>Month</th>
7179 <th>Savings</th>
7180 </tr>
7181 </thead>
7182 <tbody>
7183 <tr>
7184 <td>January</td>
7185 <td>$100</td>
7186 </tr>
7187 <tr>
7188 <td>February</td>
7189 <td>$80</td>
7190 </tr>
7191 </tbody>
7192 <tfoot>
7193 <tr>
7194 <td>Sum</td>
7195 <td>$180</td>
7196 </tr>
7197 </tfoot>
7198 </table>
7199 !! wikitext
7200 {|
7201 |+Test
7202 !Month
7203 !Savings
7204 |-
7205 |January
7206 |$100
7207 |-
7208 |February
7209 |$80
7210 |-
7211 |Sum
7212 |$180
7213 |}
7214 !! html/php+tidy
7215 <table>
7216 <caption>Test</caption>
7217 <tr>
7218 <th>Month</th>
7219 <th>Savings</th>
7220 </tr>
7221 <tr>
7222 <td>January</td>
7223 <td>$100</td>
7224 </tr>
7225 <tr>
7226 <td>February</td>
7227 <td>$80</td>
7228 </tr>
7229 <tr>
7230 <td>Sum</td>
7231 <td>$180</td>
7232 </tr>
7233 </table>
7234 !! end
7235
7236 # T137406: No whitespace in the HTML
7237 !! test
7238 2. Generate correct wikitext for tables with thead/tbody/tfoot
7239 !! options
7240 parsoid=html2wt
7241 !! html/parsoid
7242 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7243 !! wikitext
7244 {|
7245 !heading
7246 |-
7247 |foo
7248 |}
7249 !! end
7250
7251 !! test
7252 Testing serialization after deletion in references
7253 !! options
7254 parsoid={
7255 "modes": ["wt2wt"],
7256 "changes": [
7257 ["#x", "remove"]
7258 ]
7259 }
7260 !! wikitext
7261 hi <ref><div id="x">ho</div></ref>
7262
7263 <references />
7264 !! wikitext/edited
7265 hi <ref></ref>
7266
7267 <references />
7268 !! end
7269
7270 !!test
7271 Testing serialization after deletion of table cells
7272 !!options
7273 parsoid={
7274 "modes": ["wt2wt", "selser"],
7275 "changes": [
7276 ["#x", "remove"]
7277 ]
7278 }
7279 !!wikitext
7280 {|
7281 !h1 !!h2 !!h3
7282 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7283 |}
7284 !! wikitext/edited
7285 {|
7286 !h1 !!h2 !!h3
7287 |c2 |||c3
7288 |}
7289 !!end
7290
7291 !! test
7292 Testing selser after addition of new row before first row (T125419)
7293 !! options
7294 parsoid={
7295 "modes": ["wt2wt", "selser"],
7296 "changes": [
7297 [ "tr", "before", "<tr><td>X</td></tr>" ]
7298 ]
7299 }
7300 !! wikitext
7301 {|
7302 |a
7303 |}
7304 !! wikitext/edited
7305 {|
7306 |X
7307 |-
7308 |a
7309 |}
7310 !! end
7311
7312 !! test
7313 Serialize new table rows in a HTML table using HTML tags
7314 !! options
7315 parsoid={
7316 "modes": ["wt2wt", "selser"],
7317 "changes": [
7318 [ "tr", "before", "<tr><td>X</td></tr>" ]
7319 ]
7320 }
7321 !! wikitext
7322 <table><tr><td>a</td></tr></table>
7323 !! wikitext/edited
7324 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7325 !! end
7326
7327 !! test
7328 Serialize new table cells in a HTML row using HTML tags
7329 !! options
7330 parsoid={
7331 "modes": ["wt2wt", "selser"],
7332 "changes": [
7333 [ "td", "before", "<td>X</td>" ]
7334 ]
7335 }
7336 !! wikitext
7337 <table><tr><td>a</td></tr></table>
7338 !! wikitext/edited
7339 <table><tr><td>X</td><td>a</td></tr></table>
7340 !! end
7341
7342 !! test
7343 Wikitext tables can be nested inside HTML tables
7344 !! options
7345 parsoid=html2wt
7346 !! html
7347 <table data-parsoid='{"stx":"html"}'>
7348 <tr><td>
7349 <table>
7350 <tr><td>foo</td></tr>
7351 </table>
7352 </td></tr>
7353 </table>
7354 !! wikitext
7355 <table>
7356 <tr><td>
7357 {|
7358 |foo
7359 |}
7360 </td></tr>
7361 </table>
7362 !! end
7363
7364 !! test
7365 Serialize wikitext list items as HTML list items when embedded in a HTML list
7366 !! options
7367 parsoid=html2wt
7368 !! html
7369 <ul data-parsoid='{"stx": "html"}'>
7370 <li data-parsoid='{}'>a</li>
7371 <li>b</li>
7372 </ul>
7373 !! wikitext
7374 <ul>
7375 <li>a</li>
7376 <li>b</li>
7377 </ul>
7378 !! end
7379
7380 # SSS FIXME: Is this actually a good thing given the
7381 # odd nested list output that is generated by MW?
7382 # <ul><li>foo<ul>..</ul></li></ul> instead of
7383 # <ul><li>foo</li><ul>..</ul></ul>
7384 !! test
7385 Wikitext lists can be nested inside HTML lists
7386 !! options
7387 parsoid=html2wt
7388 !! html
7389 <ul data-parsoid='{"stx": "html"}'>
7390 <li data-parsoid='{"stx": "html"}'>a
7391 <ul><li>b</li></ul>
7392 </li>
7393 </ul>
7394
7395 <ul data-parsoid='{"stx": "html"}'>
7396 <li>x
7397 <ul><li>y</li></ul>
7398 </li>
7399 </ul>
7400 !! wikitext
7401 <ul>
7402 <li>a
7403 * b
7404 </li>
7405 </ul>
7406
7407 <ul>
7408 <li>x
7409 * y
7410 </li>
7411 </ul>
7412 !! end
7413
7414 ###
7415 ### Internal links
7416 ###
7417 !! test
7418 Plain link, capitalized
7419 !! wikitext
7420 [[Main Page]]
7421 !! html
7422 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7423 </p>
7424 !! end
7425
7426 !! test
7427 Plain link, uncapitalized
7428 !! wikitext
7429 [[main Page]]
7430 !! html
7431 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7432 </p>
7433 !! end
7434
7435 !! test
7436 Piped link
7437 !! wikitext
7438 [[Main Page|The Main Page]]
7439 !! html
7440 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7441 </p>
7442 !! end
7443
7444 !! test
7445 Piped link with comment in link text
7446 !! wikitext
7447 [[Main Page|The Main<!--front--> Page]]
7448 !! html
7449 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7450 </p>
7451 !! end
7452
7453 !! test
7454 Piped link with multiple pipe characters in link text
7455 !! wikitext
7456 [[Main Page||The|Main|Page|]]
7457 !! html/php
7458 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7459 </p>
7460 !! html/parsoid
7461 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7462 !! end
7463
7464 !! test
7465 Piped link with no link text
7466 !! wikitext
7467 [[Thomas Bek (bishop of St David's)|]]
7468 !! html/php
7469 <p>[[Thomas Bek (bishop of St David's)|]]
7470 </p>
7471 !! html/parsoid
7472 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7473 !! end
7474
7475 !! test
7476 Piped link with empty link text
7477 !! wikitext
7478 [[Main Page|<nowiki />]] - empty nowiki
7479 [[Main Page| ]] - empty space
7480 [[Main Page|&nbsp;]] - empty non breaking space
7481 !! html/php
7482 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7483 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7484 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7485 </p>
7486 !! html/parsoid
7487 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki />"}'/></a> - empty nowiki
7488 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7489 <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>
7490 !! end
7491
7492 !! test
7493 Broken link
7494 !! wikitext
7495 [[Zigzagzogzagzig]]
7496 !! html
7497 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7498 </p>
7499 !! end
7500
7501 !! test
7502 Broken link with fragment
7503 !! wikitext
7504 [[Zigzagzogzagzig#zug]]
7505 !! html
7506 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7507 </p>
7508 !! end
7509
7510 !! test
7511 Special page link with fragment
7512 !! wikitext
7513 [[Special:Version#anchor]]
7514 !! html
7515 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7516 </p>
7517 !! end
7518
7519 !! test
7520 Nonexistent special page link with fragment
7521 !! wikitext
7522 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7523 !! html
7524 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7525 </p>
7526 !! end
7527
7528 !! test
7529 Link with prefix
7530 !! wikitext
7531 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7532 !! html
7533 <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>
7534 </p>
7535 !! end
7536
7537 !! test
7538 Link with suffix
7539 !! wikitext
7540 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7541 !! html
7542 <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>!!!
7543 </p>
7544 !! end
7545
7546 !! article
7547 prefixed article
7548 !! text
7549 Some text
7550 !! endarticle
7551
7552 !! test
7553 Bug 43661: Piped links with identical prefixes
7554 !! wikitext
7555 [[prefixed article|prefixed articles with spaces]]
7556
7557 [[prefixed article|prefixed articlesaoeu]]
7558
7559 [[Main Page|Main Page test]]
7560 !! html
7561 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7562 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7563 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7564 </p>
7565 !! end
7566
7567
7568 !! test
7569 Link with HTML entity in suffix / tail
7570 !! wikitext
7571 [[Main Page]]&quot;, [[Main Page]]&#97;
7572 !! html/php
7573 <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;
7574 </p>
7575 !! html/parsoid
7576 <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>
7577 !! end
7578
7579 !! test
7580 Link with 3 brackets
7581 !! wikitext
7582 [[[Main Page]]]
7583 Foo [[[Main Page]]]
7584 !! html
7585 <p>[[[Main Page]]]
7586 Foo [[[Main Page]]]
7587 </p>
7588 !! end
7589
7590 !! test
7591 Link with 4 brackets
7592 !! wikitext
7593 [[[[Main Page]]]]
7594 !! html
7595 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7596 </p>
7597 !! end
7598
7599 !! test
7600 Piped link with 3 brackets
7601 !! wikitext
7602 [[[main page|the main page]]]
7603 !! html
7604 <p>[[[main page|the main page]]]
7605 </p>
7606 !! end
7607
7608 !! test
7609 Piped link with extlink-like text
7610 !! wikitext
7611 [[Main Page|[bar]]]
7612 [[Main Page|This is a [bar]]]
7613 !! html/php
7614 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7615 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7616 </p>
7617 !! html/parsoid
7618 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7619 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7620 !! end
7621
7622 !! test
7623 Link with multiple pipes
7624 !! wikitext
7625 [[Main Page|The|Main|Page]]
7626 !! html
7627 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7628 </p>
7629 !! end
7630
7631 !! test
7632 Anchor containing a #. (bug 63430)
7633 !! wikitext
7634 [[Main Page#And#Link]]
7635 !! html/php
7636 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7637 </p>
7638 !! html/parsoid
7639 <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>
7640 !! end
7641
7642 !! test
7643 Link to namespaces
7644 !! wikitext
7645 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7646 !! html
7647 <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>
7648 </p>
7649 !! end
7650
7651 !! test
7652 Link with space in namespace
7653 !! wikitext
7654 [[User talk:Foo bar]]
7655 !! html
7656 <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>
7657 </p>
7658 !! end
7659
7660 !! article
7661 MemoryAlpha:AlphaTest
7662 !! text
7663 This is an article in the MemoryAlpha namespace
7664 (which shadows the memoryalpha interwiki link).
7665 !! endarticle
7666
7667 !! test
7668 Namespace takes precedence over interwiki link (bug 51680)
7669 !! wikitext
7670 [[MemoryAlpha:AlphaTest]]
7671 !! html
7672 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7673 </p>
7674 !! end
7675
7676 # The previous test doesn't work correctly in html2*, due to not recognizing the
7677 # link as an internal one. This one checks for the correct behavior.
7678 !! test
7679 Link to namespace preferred over interwiki with correct rel attribute
7680 !! options
7681 parsoid=html2wt,html2html
7682 !! html/parsoid
7683 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7684 !! wikitext
7685 [[MemoryAlpha:AlphaTest]]
7686 !! end
7687
7688 !! test
7689 Piped link to namespace
7690 !! wikitext
7691 [[Meta:Disclaimers|The disclaimers]]
7692 !! html
7693 <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>
7694 </p>
7695 !! end
7696
7697 !! test
7698 Link containing }
7699 !! wikitext
7700 [[Usually caused by a typo (oops}]]
7701 !! html
7702 <p>[[Usually caused by a typo (oops}]]
7703 </p>
7704 !! end
7705
7706 !! article
7707 7% Solution
7708 !! text
7709 Just a test of an article title containing a percent.
7710 !! endarticle
7711
7712 !! test
7713 Link containing % (not as a hex sequence)
7714 !! wikitext
7715 [[7% Solution]]
7716 [[7% Solution|7%25 Solution]]
7717 !! html/php
7718 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7719 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7720 </p>
7721 !! html/parsoid
7722 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7723 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7724 !! end
7725
7726 # note that the parsoid HTML is identical to the previous test output,
7727 # so the previous test ensures that the html2wt mode will generate the
7728 # "not as a hex sequence" wikitext.
7729 !! test
7730 Link containing % as a single hex sequence interpreted to char
7731 !! options
7732 parsoid=wt2wt,wt2html,html2html
7733 !! wikitext
7734 [[7%25 Solution]]
7735 [[7%25 Solution|7%25 Solution]]
7736 !! html/php
7737 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7738 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7739 </p>
7740 !! html/parsoid
7741 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7742 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7743 !!end
7744
7745 !! test
7746 Link containing % as a double hex sequence interpreted to hex sequence
7747 !! wikitext
7748 [[7%2525 Solution]]
7749 !! html
7750 <p>[[7%2525 Solution]]
7751 </p>
7752 !!end
7753
7754 ## Example for such a section: == < ==
7755 !! test
7756 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7757 !! wikitext
7758 [[%23%3c]][[%23%3e]]
7759 !! html/php
7760 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7761 </p>
7762 !! html/parsoid
7763 <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>
7764 !! end
7765
7766 !! test
7767 Link containing "<#" and ">#" as a hex sequences
7768 !! wikitext
7769 [[%3c%23]][[%3e%23]]
7770 !! html
7771 <p>[[%3c%23]][[%3e%23]]
7772 </p>
7773 !! end
7774
7775 !! test
7776 Link containing an equals sign
7777 !! wikitext
7778 [[Special:BookSources/isbn=4-00-026157-6]]
7779 !! html/php
7780 <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>
7781 </p>
7782 !! html/parsoid
7783 <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>
7784 !! end
7785
7786 !! article
7787 Foo~bar
7788 !! text
7789 Just a test of an article title containing a tilde.
7790 !! endarticle
7791
7792 # note that links containing signatures, like [[Foo~~~~]], are
7793 # massaged by the pre-save transform (PST) and so the tildes are never
7794 # seen by the parser.
7795 !! test
7796 Link containing a tilde
7797 !! wikitext
7798 [[Foo~bar]]
7799 !! html/php
7800 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7801 </p>
7802 !! html/parsoid
7803 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7804 !! end
7805
7806 !! test
7807 Link containing double-single-quotes '' (bug 4598)
7808 !! wikitext
7809 [[Lista d''e paise d''o munno]]
7810 !! html/php
7811 <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>
7812 </p>
7813 !! html/parsoid
7814 <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>
7815 !! end
7816
7817 !! test
7818 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7819 !! wikitext
7820 Some [[Link|pretty ''italics'' and stuff]]!
7821 !! html/php
7822 <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>!
7823 </p>
7824 !! html/parsoid
7825 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7826 !! end
7827
7828 !! test
7829 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7830 !! wikitext
7831 ''Some [[Link|pretty ''italics'' and stuff]]!''
7832 !! html
7833 <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>
7834 </p>
7835 !! end
7836
7837 !! test
7838 Link with double quotes in title part (literal) and alternate part (interpreted)
7839 !! wikitext
7840 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7841
7842 [[''Pentecoste'']]
7843
7844 [[''Pentecoste''|Pentecoste]]
7845
7846 [[''Pentecoste''|''Pentecoste'']]
7847 !! html/php
7848 <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>
7849 </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>
7850 </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>
7851 </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>
7852 </p>
7853 !! html/parsoid
7854 <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>
7855 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7856 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7857 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7858 !! end
7859
7860 !! test
7861 Broken image links with HTML captions (bug 39700)
7862 !! wikitext
7863 [[File:Nonexistent|<script></script>]]
7864 [[File:Nonexistent|100x100px|<script></script>]]
7865 [[File:Nonexistent|&lt;]]
7866 [[File:Nonexistent|a<i>b</i>c]]
7867 !! html/php
7868 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7869 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7870 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7871 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7872 </p>
7873 !! html/parsoid
7874 <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>
7875 <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>
7876 <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>
7877 <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>
7878 !! end
7879
7880 !! test
7881 Plain link to URL
7882 !! wikitext
7883 [[http://www.example.com]]
7884 !! html/php
7885 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7886 </p>
7887 !! html/parsoid
7888 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7889 !! end
7890
7891 !! test
7892 Plain link to URL with link text
7893 !! wikitext
7894 [[http://www.example.com Link text]]
7895 !! html
7896 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7897 </p>
7898 !! end
7899
7900 !! test
7901 Plain link to protocol-relative URL
7902 !! wikitext
7903 [[//www.example.com]]
7904 !! html/php
7905 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7906 </p>
7907 !! html/parsoid
7908 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7909 !! end
7910
7911 !! test
7912 Plain link to protocol-relative URL with link text
7913 !! wikitext
7914 [[//www.example.com Link text]]
7915 !! html
7916 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7917 </p>
7918 !! end
7919
7920 !! test
7921 Plain link to page with question mark in title
7922 !! wikitext
7923 [[A?b]]
7924
7925 [[A?b|Baz]]
7926 !! html
7927 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7928 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7929 </p>
7930 !! end
7931
7932
7933 # I'm fairly sure the expected result here is wrong.
7934 # We want these to be URL links, not pseudo-pages with URLs for titles....
7935 # However the current output is also pretty screwy.
7936 #
7937 # ----
7938 # I'm changing it to match the current output--it arguably makes more
7939 # sense in the light of the test above. Old expected result was:
7940 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7941 #</p>
7942 # But I think this test is bordering on "garbage in, garbage out" anyway.
7943 # -- wtm
7944 !! test
7945 Piped link to URL
7946 !! wikitext
7947 Piped link to URL: [[http://www.example.com|an example URL]]
7948 !! html/php
7949 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7950 </p>
7951 !! html/parsoid
7952 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7953 !! end
7954
7955 !! test
7956 BUG 2: [[page|http://url/]] should link to page, not http://url/
7957 !! wikitext
7958 [[Main Page|http://url/]]
7959 !! html/php
7960 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7961 </p>
7962 !! html/parsoid
7963 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7964 !! end
7965
7966 # Parsoid does not mark self-links, by design.
7967 !! test
7968 BUG 337: Escaped self-links should be bold
7969 !! options
7970 title=[[Bug462]]
7971 !! wikitext
7972 [[Bu&#103;462]] [[Bug462]]
7973 !! html/php
7974 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7975 </p>
7976 !! html/php+tidy
7977 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7978 !! html/parsoid
7979 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7980 !! end
7981
7982 !! test
7983 Self-link to section should not be bold
7984 !! options
7985 title=[[Main Page]]
7986 !! wikitext
7987 [[Main Page#section]]
7988 !! html
7989 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7990 </p>
7991 !! end
7992
7993 !! article
7994 00
7995 !! text
7996 This is 00.
7997 !! endarticle
7998
7999 !!test
8000 Self-link to numeric title
8001 !!options
8002 title=[[0]]
8003 !! wikitext
8004 [[0]]
8005 !! html
8006 <p><strong class="selflink">0</strong>
8007 </p>
8008 !!end
8009
8010 !!test
8011 Link to numeric-equivalent title
8012 !!options
8013 title=[[0]]
8014 !! wikitext
8015 [[00]]
8016 !! html
8017 <p><a href="/wiki/00" title="00">00</a>
8018 </p>
8019 !!end
8020
8021 !! test
8022 <nowiki> inside a link
8023 !! wikitext
8024 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8025 !! html
8026 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8027 </p>
8028 !! end
8029
8030 !! test
8031 Non-breaking spaces in title
8032 !! wikitext
8033 [[&nbsp; Main &nbsp; Page &nbsp;]]
8034 !! html
8035 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8036 </p>
8037 !!end
8038
8039 !! test
8040 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
8041 !! options
8042 language=ca
8043 !! wikitext
8044 '''[[Main Page]]'''
8045 !! html
8046 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8047 </p>
8048 !! end
8049
8050 !! test
8051 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
8052 !! options
8053 language=ca
8054 !! wikitext
8055 ''[[Main Page]]''
8056 !! html
8057 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8058 </p>
8059 !! end
8060
8061 !! test
8062 Internal link with en linktrail: no apostrophes (bug 27473)
8063 !! options
8064 language=en
8065 !! wikitext
8066 [[Something]]'nice
8067 !! html
8068 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8069 </p>
8070 !! end
8071
8072 !! test
8073 Internal link with ca linktrail with apostrophes (bug 27473)
8074 !! options
8075 language=ca
8076 !! wikitext
8077 [[Something]]'nice
8078 !! html
8079 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8080 </p>
8081 !! end
8082
8083 !! test
8084 Internal link with kaa linktrail with apostrophes (bug 27473)
8085 !! options
8086 language=kaa
8087 !! wikitext
8088 [[Something]]'nice
8089 !! html
8090 <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>
8091 </p>
8092 !! end
8093
8094 !! test
8095 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
8096 !! wikitext
8097 [[User:Foo/Test/63636:Bar|Test]]
8098 !! html/php
8099 <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>
8100 </p>
8101 !! html/parsoid
8102 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8103 !! end
8104
8105 ## Mainly a sanity check for Parsoid
8106 !! test
8107 Handle title parsing for subpages
8108 !! options
8109 title=[[/123123]]
8110 !! wikitext
8111 123
8112 !! html/parsoid
8113 <p>123</p>
8114 !! end
8115
8116 ## FIXME: Add a working php section here
8117 !! test
8118 Link to a subpage from a namespace other than main
8119 !! options
8120 title=[[User:test]]
8121 !! wikitext
8122 [[/123]]
8123 !! html/parsoid
8124 <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>
8125 !! end
8126
8127 !! test
8128 Ensure that transclusion titles are not url-decoded
8129 !! options
8130 subpage title=[[Test]]
8131 parsoid=wt2html
8132 !! wikitext
8133 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8134 !! html/php
8135 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8136 </p>
8137 !! html/parsoid
8138 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8139 !! end
8140
8141 !! test
8142 Purely hash wikilink
8143 !! options
8144 title=[[User:test/123]]
8145 !! wikitext
8146 [[#a|b]]
8147 !! html/php
8148 <p><a href="#a">b</a>
8149 </p>
8150 !! html/parsoid
8151 <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>
8152 !! end
8153
8154 !! test
8155 1. Interaction of linktrail and template encapsulation
8156 !! options
8157 parsoid
8158 !! wikitext
8159 {{echo|[[Foo]]}}l
8160 !! html
8161 <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>
8162 !! end
8163
8164 !! test
8165 2. Interaction of linktrail and template encapsulation
8166 !! options
8167 parsoid
8168 !! wikitext
8169 {{echo|Some [[Fool]]}}s
8170 !! html
8171 <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>
8172 !! end
8173
8174 !! test
8175 3. Interaction of linktrail and template encapsulation
8176 !! options
8177 parsoid
8178 !! wikitext
8179 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8180 !! html
8181 <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>
8182 !! end
8183
8184 !! article
8185 Söfnuður
8186 !! text
8187 Test.
8188 !! endarticle
8189
8190 !! test
8191 Internal link with is link prefix
8192 !! options
8193 language=is
8194 !! wikitext
8195 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8196 !! html
8197 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8198 </p>
8199 !! end
8200
8201 !! article
8202 Mótmælendatrú
8203 !! text
8204 Test.
8205 !! endarticle
8206
8207 !! test
8208 Internal link with is link trail and link prefix
8209 !! options
8210 language=is
8211 !! wikitext
8212 [[mótmælendatrú|xxx]]ar
8213 [[mótmælendatrú]]ar
8214 mótmælenda[[söfnuður]]
8215 mótmælenda[[söfnuður|söfnuðir]]
8216 mótmælenda[[söfnuður|söfnuðir]]xxx
8217 !! html
8218 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8219 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8220 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8221 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8222 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8223 </p>
8224 !! end
8225
8226 !! test
8227 Parsoid link trail escaping
8228 !! options
8229 parsoid=html2wt,html2html
8230 !! html/parsoid
8231 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
8232 !! wikitext
8233 [[apple]]<nowiki/>s
8234 !! end
8235
8236 !! test
8237 Parsoid link prefix escaping
8238 !! options
8239 language=is
8240 parsoid=html2wt,html2html
8241 !! html/parsoid
8242 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
8243 !! wikitext
8244 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8245 !! end
8246
8247 !! test
8248 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8249 !! wikitext
8250 [[Foo| bar]]
8251
8252 [[Foo| ''bar'']]
8253
8254 [http://wp.org foo]
8255
8256 [http://wp.org ''foo'']
8257 !! html
8258 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8259 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8260 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8261 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8262 </p>
8263 !! end
8264
8265 !! test
8266 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8267 !! options
8268 parsoid
8269 !! wikitext
8270 [[Foo|{{echo|a}} b {{echo|c}}]]
8271 !! html
8272 <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>
8273 !! end
8274
8275 !! test
8276 Link with angle bracket after anchor
8277 !! wikitext
8278 [[Foo#<bar>]]
8279 !! html/php
8280 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8281 </p>
8282 !! html/parsoid
8283 <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>
8284 !! end
8285
8286 ###
8287 ### Interwiki links (see maintenance/interwiki.sql)
8288 ###
8289
8290 !! test
8291 Inline interwiki link
8292 !! options
8293 parsoid=wt2html,wt2wt,html2html
8294 !! wikitext
8295 [[MeatBall:SoftSecurity]]
8296 !! html/php
8297 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8298 </p>
8299 !! html/parsoid
8300 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8301 !! end
8302
8303 !! test
8304 Inline interwiki link with empty title (bug 2372)
8305 !! options
8306 parsoid=wt2html,wt2wt,html2html
8307 !! wikitext
8308 [[MeatBall:]]
8309 !! html/php
8310 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8311 </p>
8312 !! html/parsoid
8313 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8314 !! end
8315
8316 !! test
8317 Interwiki link encoding conversion (bug 1636)
8318 !! wikitext
8319 *[[Wikipedia:ro:Olteni&#0355;a]]
8320 *[[Wikipedia:ro:Olteni&#355;a]]
8321 !! html
8322 <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>
8323 <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>
8324
8325 !! html+tidy
8326 <ul>
8327 <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>
8328 <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>
8329 </ul>
8330 !! end
8331
8332 !! test
8333 Interwiki link with fragment (bug 2130)
8334 !! wikitext
8335 [[MeatBall:SoftSecurity#foo]]
8336 !! html
8337 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8338 </p>
8339 !! end
8340
8341 !! test
8342 Link scenarios with escaped fragments
8343 !! wikitext
8344 [[#Is this great?]]
8345 [[Foo#Is this great?]]
8346 [[meatball:Foo#Is this great?]]
8347 !! html/php
8348 <p><a href="#Is_this_great.3F">#Is this great?</a>
8349 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8350 <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>
8351 </p>
8352 !! html/parsoid
8353 <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>
8354 <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>
8355 <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>
8356 !! end
8357
8358 # Ideally the wikipedia: prefix here should be proto-relative too
8359 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8360 # define the 'en' prefix, and originally the test used 'wikipedia',
8361 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8362 # article.
8363 !! test
8364 Different interwiki prefixes mapping to the same URL
8365 !! wikitext
8366 [[:en:Foo]]
8367
8368 [[:en:Foo|Foo]]
8369
8370 [[wikipedia:Foo]]
8371
8372 [[:wikipedia:Foo|Foo]]
8373
8374 [[wikipedia:en:Foo]]
8375
8376 [[:wikipedia:en:Foo]]
8377
8378 [[ wikiPEdia :Foo]]
8379 !! html/parsoid
8380 <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>
8381
8382 <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>
8383
8384 <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>
8385
8386 <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>
8387
8388 <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>
8389
8390 <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>
8391
8392 <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>
8393 !! end
8394
8395 !! test
8396 Interwiki links that cannot be represented in wiki syntax
8397 !! wikitext
8398 [[meatball:ok]]
8399 [[meatball:ok#foo|ok with fragment]]
8400 [[meatball:ok_as_well?|ok ending with ? mark]]
8401 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8402 [http://de.wikipedia.org/wiki/#foo is just fragment]
8403
8404 !! html/php
8405 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8406 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8407 <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>
8408 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8409 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8410 </p>
8411 !! html/parsoid
8412 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8413 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8414 <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>
8415 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8416 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8417 !! end
8418
8419 !! test
8420 Interwiki links: trail
8421 !! wikitext
8422 [[wikipedia:Foo|Ba]]r
8423 !! html/php
8424 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8425 </p>
8426 !! html/parsoid
8427 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}' title="wikipedia:Foo">Bar</a></p>
8428 !! end
8429
8430 !! test
8431 Local interwiki link
8432 !! options
8433 parsoid=wt2html,wt2wt,html2html
8434 !! wikitext
8435 [[local:Template:Foo]]
8436 !! html/php
8437 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8438 </p>
8439 !! html/parsoid
8440 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8441 !! end
8442
8443 # Parsoid does not mark self-links, by design.
8444 !! test
8445 Local interwiki link: self-link to current page
8446 !! options
8447 title=[[Main Page]]
8448 parsoid=wt2html,wt2wt,html2html
8449 !! wikitext
8450 [[local:Main Page]]
8451 !! html/php
8452 <p><strong class="selflink">local:Main Page</strong>
8453 </p>
8454 !! html/parsoid
8455 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8456 !! end
8457
8458 !! test
8459 Local interwiki link: prefix only (bug 64167)
8460 !! options
8461 parsoid=wt2html,wt2wt,html2html
8462 !! wikitext
8463 [[local:]]
8464 !! html/php
8465 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8466 </p>
8467 !! html/parsoid
8468 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8469 !! end
8470
8471 !! test
8472 Local interwiki link: with additional interwiki prefix (bug 61357)
8473 !! options
8474 parsoid=wt2html,wt2wt,html2html
8475 !! wikitext
8476 [[local:meatball:Hello]]
8477 !! html/php
8478 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8479 </p>
8480 !! html/parsoid
8481 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8482 !! end
8483
8484 !! test
8485 Multiple local interwiki link prefixes
8486 !! wikitext
8487 [[local:local:local:local:mi:local:Foo]]
8488 !! options
8489 parsoid=wt2html,wt2wt,html2html
8490 !! html/php
8491 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8492 </p>
8493 !! html/parsoid
8494 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8495 !! end
8496
8497 ###
8498 ### Interlanguage links
8499 ### Language links (so that searching for '### language' matches..)
8500 ###
8501
8502 !! test
8503 Interlanguage link
8504 !! wikitext
8505 Blah blah blah
8506 [[zh:Chinese]]
8507 !! html/php
8508 <p>Blah blah blah
8509 </p>
8510 !! html/parsoid
8511 <p>Blah blah blah</p>
8512 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8513 !! end
8514
8515 ## parsoid html2wt will lose the space variations
8516 !! test
8517 Interlanguage link with spacing
8518 !! options
8519 parsoid=wt2html,wt2wt,html2html
8520 !! wikitext
8521 Blah blah blah
8522 [[ zh : Chinese ]]
8523 !! html/php
8524 <p>Blah blah blah
8525 </p>
8526 !! html/parsoid
8527 <p>Blah blah blah</p>
8528 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8529 !! end
8530
8531 !! test
8532 Double interlanguage link
8533 !! wikitext
8534 Blah blah blah
8535 [[es:Spanish]]
8536 [[zh:Chinese]]
8537 !! html/php
8538 <p>Blah blah blah
8539 </p>
8540 !! html/parsoid
8541 <p>Blah blah blah</p>
8542 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8543 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8544 !! end
8545
8546 ## parsoid html2wt will lose the space variations
8547 !! test
8548 Interlanguage link variations
8549 !! options
8550 parsoid=wt2html,wt2wt,html2html
8551 !! wikitext
8552 Blah blah blah
8553 [[ es :Spanish]]
8554 [[ ZH :Chinese]]
8555 [[es:Foo_bar]]
8556 !! html/php
8557 <p>Blah blah blah
8558 </p>
8559 !! html/parsoid
8560 <p>Blah blah blah</p>
8561 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8562 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8563 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8564 !! end
8565
8566 ## parsoid html2wt will normalize the space to _
8567 !! test
8568 Space and question mark encoding in interlanguage links (T95473)
8569 !! options
8570 parsoid=wt2html,wt2wt,html2html
8571 !! wikitext
8572 Blah blah blah
8573 [[es:Foo bar?]]
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/Foo_bar%3F" />
8580 !! end
8581
8582 !! test
8583 Interlanguage link, with prefix links
8584 !! options
8585 language=ln
8586 !! wikitext
8587 Blah blah blah
8588 [[zh:Chinese]]
8589 !! html/php
8590 <p>Blah blah blah
8591 </p>
8592 !! html/parsoid
8593 <p>Blah blah blah</p>
8594 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8595 !! end
8596
8597 !! test
8598 Double interlanguage link, with prefix links (bug 8897)
8599 !! options
8600 language=ln
8601 !! wikitext
8602 Blah blah blah
8603 [[es:Spanish]]
8604 [[zh:Chinese]]
8605 !! html/php
8606 <p>Blah blah blah
8607 </p>
8608 !! html/parsoid
8609 <p>Blah blah blah</p>
8610 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8611 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8612 !! end
8613
8614 !! test
8615 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8616 !! wikitext
8617 Blah blah blah
8618 [[mul:Article]]
8619 !! html/php
8620 <p>Blah blah blah
8621 </p>
8622 !! html/parsoid
8623 <p>Blah blah blah</p>
8624 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8625 !! end
8626
8627 ## PHP parser tests script needs an update
8628 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8629 !! test
8630 Language links render as inline links if $wgInterwikiMagic=false
8631 !! options
8632 wgInterwikiMagic=false
8633 parsoid=wt2html,wt2wt,html2html
8634 !! wikitext
8635 Blah blah blah
8636 [[zh:Chinese]]
8637 !! html/parsoid
8638 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8639 !! end
8640
8641 ## PHP parser tests script needs an update
8642 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8643 !! test
8644 Language links render as inline links in the Talk namespace
8645 !! options
8646 title=Talk:Foo
8647 parsoid=wt2html,wt2wt,html2html
8648 !! wikitext
8649 Blah blah blah
8650 [[zh:Chinese]]
8651 !! html/parsoid
8652 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8653 !! end
8654
8655 !! test
8656 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8657 !! options
8658 language=ln
8659 !! wikitext
8660 [[WW&nbsp;II]]
8661 !! html
8662 <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>
8663 </p>
8664 !! end
8665
8666 !! test
8667 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8668 !! options
8669 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8670 !! html/parsoid
8671 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8672 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8673 !! wikitext
8674 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8675
8676 He&amp;nbsp;llo He&amp;nbsp;llo
8677 !! html/php
8678 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8679 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8680 </p>
8681 !! end
8682
8683 # html2wt will fail because of title normalization without data-parsoid
8684 !! test
8685 Parsoid: handle constructor well
8686 !! options
8687 parsoid=wt2html,wt2wt
8688 !! wikitext
8689 [[constructor]]
8690
8691 [[constructor:foo]]
8692 !! html/php
8693 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8694 </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>
8695 </p>
8696 !! html/parsoid
8697 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8698
8699 <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>
8700 !! end
8701
8702 !! article
8703 ko:
8704 !! text
8705 Test.
8706 !! endarticle
8707
8708 # Note that `ko` isn't a known interlanguage prefix
8709 !! test
8710 Parsoid: recognize interlanguage links without a target page
8711 !! options
8712 ill
8713 !! wikitext
8714 [[es:]]
8715
8716 [[ko:]]
8717 !! html/php
8718 es:
8719 !! html/parsoid
8720 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8721
8722 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8723 !! end
8724
8725 # Note that `ko` isn't a known interwiki prefix
8726 !! test
8727 Parsoid: recognize interwiki links without a target page
8728 !! options
8729 parsoid=wt2html,wt2wt,html2html
8730 !! wikitext
8731 [[:es:]]
8732
8733 [[:ko:]]
8734 !! html/php
8735 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8736 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8737 </p>
8738 !! html/parsoid
8739 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8740 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8741 !! end
8742
8743 !! test
8744 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8745 !! wikitext
8746 [[mi:Foo]]
8747 !! html/php
8748 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8749 </p>
8750 !! html/parsoid
8751 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8752 !! end
8753
8754 !! test
8755 Interlanguage link with preceding local interwiki link (bug 68085)
8756 !! options
8757 parsoid=wt2html,wt2wt,html2html
8758 !! wikitext
8759 Blah blah blah
8760 [[local:es:Spanish]]
8761 !! html/php
8762 <p>Blah blah blah
8763 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8764 </p>
8765 !! html/parsoid
8766 <p>Blah blah blah
8767 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8768 !! end
8769
8770 !! test
8771 Looks like an interlanguage link, but is actually a local interwiki
8772 !! options
8773 parsoid=wt2html,wt2wt,html2html
8774 !! wikitext
8775 Blah blah blah
8776 [[mi:Template:Foo]]
8777 !! html/php
8778 <p>Blah blah blah
8779 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8780 </p>
8781 !! html/parsoid
8782 <p>Blah blah blah
8783 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8784 !! end
8785
8786 ###
8787 ### Redirects, Parsoid-only
8788 ###
8789
8790 !! test
8791 1. Simple redirect to page
8792 !! wikitext
8793 #REDIRECT [[Main Page]]
8794 !! html/parsoid
8795 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8796 !! end
8797
8798 !! test
8799 2. Other redirect variants
8800 !! wikitext
8801 #REDIRECT [[Main_Page]]
8802 !! html/parsoid
8803 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8804 !! end
8805
8806 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8807 # This tests the Parsoid bail-out code.
8808 !! test
8809 3. Other redirect variants
8810 !! wikitext
8811 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8812 !! html/parsoid
8813 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8814 !! end
8815
8816 !! test
8817 4. Redirect to a templated destination
8818 !! wikitext
8819 #REDIRECT [[{{echo|Foo}}bar]]
8820 !! html/parsoid
8821 <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"}]]}'/>
8822 !! end
8823
8824 !! test
8825 Empty redirect
8826 !! options
8827 parsoid=wt2html,wt2wt
8828 !! wikitext
8829 #REDIRECT [[]]
8830 !! html/parsoid
8831 <ol>
8832 <li>REDIRECT [[]]</li></ol>
8833 !! end
8834
8835 !! test
8836 Optional colon in #REDIRECT
8837 !! options
8838 # the colon is archaic syntax. we support it for wt2html, but we
8839 # don't care that it roundtrips back to the modern syntax.
8840 parsoid=wt2html,html2html
8841 !! wikitext
8842 #REDIRECT:[[Main Page]]
8843 !! html/parsoid
8844 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8845 !! end
8846
8847 !! test
8848 Whitespace in #REDIRECT with optional colon
8849 !! options
8850 # the colon and gratuitous whitespace is archaic syntax. we support
8851 # it for wt2html, but we don't care that it roundtrips back to the
8852 # modern syntax (without extra whitespace)
8853 parsoid=wt2html,html2html
8854 !! wikitext
8855
8856 #REDIRECT
8857 :
8858 [[Main Page]]
8859 !! html/parsoid
8860 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8861 !! end
8862
8863 !! test
8864 Piped link in #REDIRECT
8865 !! options
8866 # content after piped link is ignored. we support this syntax,
8867 # but don't care that the piped link is lost when we roundtrip this.
8868 parsoid=wt2html
8869 !! wikitext
8870 #REDIRECT [[Main Page|bar]]
8871 !! html/parsoid
8872 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8873 !! end
8874
8875 !! test
8876 Redirect to category (T104502)
8877 !! options
8878 parsoid=wt2html,wt2wt
8879 !! wikitext
8880 #REDIRECT [[Category:Foo]]
8881 !! html/parsoid
8882 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8883 !! end
8884
8885 !! test
8886 Redirect to category with URL encoding (T104502)
8887 !! options
8888 parsoid=wt2html
8889 !! wikitext
8890 #REDIRECT [[Category%3AFoo]]
8891 !! html/parsoid
8892 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8893 !! end
8894
8895 !! test
8896 Redirect to category page
8897 !! wikitext
8898 #REDIRECT [[:Category:Foo]]
8899 !! html/parsoid
8900 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8901 !! end
8902
8903 !! test
8904 Redirect to image page (1)
8905 !! wikitext
8906 #REDIRECT [[File:Wiki.png]]
8907 !! html/parsoid
8908 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8909 !! end
8910
8911 !! test
8912 Redirect to image page (2)
8913 !! wikitext
8914 #REDIRECT [[Image:Wiki.png]]
8915 !! html/parsoid
8916 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8917 !! end
8918
8919 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8920 # Next test confirms this.
8921 !! test
8922 Redirect to language (1) (T104918)
8923 !! options
8924 parsoid=wt2html,wt2wt,html2html
8925 !! wikitext
8926 #REDIRECT [[en:File:Wiki.png]]
8927 !! html/parsoid
8928 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8929 !! end
8930
8931 !! test
8932 Redirect to language (2) (T104918)
8933 !! wikitext
8934 #REDIRECT [[:en:File:Wiki.png]]
8935 !! html/parsoid
8936 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8937 !! end
8938
8939 !! test
8940 Redirect to interwiki (T104918)
8941 !! wikitext
8942 #REDIRECT [[meatball:File:Wiki.png]]
8943 !! html/parsoid
8944 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8945 !! end
8946
8947 !! test
8948 Non-English #REDIRECT
8949 !! options
8950 language=is
8951 !! wikitext
8952 #TILVÍSUN [[Main Page]]
8953 !! html/parsoid
8954 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8955 !! end
8956
8957 !! test
8958 Redirect syntax under text isn't considered a redirect
8959 !! wikitext
8960 some text
8961 #redirect [[Main Page]]
8962 !! html/parsoid
8963 <p>some text</p>
8964 <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>
8965 !! end
8966
8967 # FIXME: Should hoist the redirect to the top of the page and ensure there
8968 # is only one.
8969 !! test
8970 New redirect
8971 !! options
8972 parsoid=html2wt
8973 !! html/parsoid
8974 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8975 !! wikitext
8976 Foo
8977 #REDIRECT [[Foo]]
8978 !! end
8979
8980 ##
8981 ## XHTML tidiness
8982 ###
8983
8984 !! test
8985 <br> to <br />
8986 !! wikitext
8987 1<br>2<br />3
8988 !! html
8989 <p>1<br />2<br />3
8990 </p>
8991 !! end
8992
8993 !! test
8994 Broken br tag sanitization
8995 !! wikitext
8996 </br>
8997 !! html/php
8998 <p>&lt;/br&gt;
8999 </p>
9000 !! end
9001
9002 # TODO: Fix html2html mode (bug 51055)!
9003 !! test
9004 Parsoid: Broken br tag recognition
9005 !! options
9006 parsoid=wt2html
9007 !! wikitext
9008 </br>
9009
9010 <br/ >
9011 !! html+tidy
9012 <p><br /></p>
9013 <p><br /></p>
9014 !! end
9015
9016 !! test
9017 Incorrecly removing closing slashes from correctly formed XHTML
9018 !! wikitext
9019 <br style="clear:both;" />
9020 !! html
9021 <p><br style="clear:both;" />
9022 </p>
9023 !! end
9024
9025 !! test
9026 Failing to transform badly formed HTML into correct XHTML
9027 !! wikitext
9028 <br style="clear: left;">
9029 <br style="clear: right;">
9030 <br style="clear: both;">
9031 !! html
9032 <p><br style="clear: left;" />
9033 <br style="clear: right;" />
9034 <br style="clear: both;" />
9035 </p>
9036 !!end
9037
9038 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9039 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9040 !! test
9041 Handling html with a div self-closing tag
9042 !! wikitext
9043 <div title />
9044 <div title/>
9045 <div title/ >
9046 <div title=bar />
9047 <div title=bar/>
9048 <div title=bar/ >
9049 !! html/php
9050 <p>&lt;div title /&gt;
9051 &lt;div title/&gt;
9052 </p>
9053 <div>
9054 <p>&lt;div title=bar /&gt;
9055 &lt;div title=bar/&gt;
9056 </p>
9057 <div title="bar/"></div>
9058 </div>
9059
9060 !! html/parsoid
9061 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9062 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9063 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9064 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9065 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9066 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9067 !! end
9068
9069 !! test
9070 Handling html with a br self-closing tag
9071 !! wikitext
9072 <br title />
9073 <br title/>
9074 <br title/ >
9075 <br title=bar />
9076 <br title=bar/>
9077 <br title=bar/ >
9078 !! html/php
9079 <p><br title="" />
9080 <br title="" />
9081 <br />
9082 <br title="bar" />
9083 <br title="bar" />
9084 <br title="bar/" />
9085 </p>
9086 !! html/parsoid
9087 <p><br title="" />
9088 <br title="" />
9089 <br title="" />
9090 <br title="bar" />
9091 <br title="bar" />
9092 <br title="bar/" />
9093 </p>
9094 !! end
9095
9096 !! test
9097 Horizontal ruler (should it add that extra space?)
9098 !! wikitext
9099 <hr>
9100 <hr >
9101 foo <hr
9102 > bar
9103 !! html+tidy
9104 <hr />
9105 <hr />
9106 <p>foo</p>
9107 <hr />
9108 <p>bar</p>
9109 !! end
9110
9111 !! test
9112 Horizontal ruler -- 4+ dashes render hr
9113 !! wikitext
9114 ----
9115 !! html
9116 <hr />
9117
9118 !! end
9119
9120 !! test
9121 Horizontal ruler -- eats additional dashes on the same line
9122 !! wikitext
9123 ---------
9124 !! html
9125 <hr />
9126
9127 !! end
9128
9129 !! test
9130 Horizontal ruler -- does not collapse dashes on consecutive lines
9131 !! wikitext
9132 ----
9133 ----
9134 !! html
9135 <hr />
9136 <hr />
9137
9138 !! end
9139
9140 !! test
9141 Horizontal ruler -- <4 dashes render as plain text
9142 !! wikitext
9143 ---
9144 !! html
9145 <p>---
9146 </p>
9147 !! end
9148
9149 !! test
9150 Horizontal ruler -- Supports content following dashes on same line
9151 !! wikitext
9152 ---- Foo
9153 !! html
9154 <hr /> Foo
9155
9156 !! html+tidy
9157 <hr />
9158 <p>Foo</p>
9159 !! end
9160
9161 ###
9162 ### Block-level elements
9163 ###
9164 !! test
9165 Common list
9166 !! wikitext
9167 *Common list
9168 * item 2
9169 *item 3
9170 !! html
9171 <ul><li>Common list</li>
9172 <li> item 2</li>
9173 <li>item 3</li></ul>
9174
9175 !! end
9176
9177 !! test
9178 Numbered list
9179 !! wikitext
9180 #Numbered list
9181 #item 2
9182 # item 3
9183 !! html
9184 <ol><li>Numbered list</li>
9185 <li>item 2</li>
9186 <li> item 3</li></ol>
9187
9188 !! end
9189
9190 !! test
9191 Mixed list
9192 !! wikitext
9193 *Mixed list
9194 *# with numbers
9195 ** and bullets
9196 *# and numbers
9197 *bullets again
9198 **bullet level 2
9199 ***bullet level 3
9200 ***#Number on level 4
9201 **bullet level 2
9202 **#Number on level 3
9203 **#Number on level 3
9204 *#number level 2
9205 *Level 1
9206 *** Level 3
9207 #** Level 3, but ordered
9208 !! html
9209 <ul><li>Mixed list
9210 <ol><li> with numbers</li></ol>
9211 <ul><li> and bullets</li></ul>
9212 <ol><li> and numbers</li></ol></li>
9213 <li>bullets again
9214 <ul><li>bullet level 2
9215 <ul><li>bullet level 3
9216 <ol><li>Number on level 4</li></ol></li></ul></li>
9217 <li>bullet level 2
9218 <ol><li>Number on level 3</li>
9219 <li>Number on level 3</li></ol></li></ul>
9220 <ol><li>number level 2</li></ol></li>
9221 <li>Level 1
9222 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9223 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9224
9225 !! end
9226
9227 !! test
9228 1. Nested mixed wikitext and html list
9229 !! wikitext
9230 * hi
9231 * <ul><li>ho</li></ul>
9232 * hi
9233 ** ho
9234 !! html/php
9235 <ul><li> hi</li>
9236 <li> <ul><li>ho</li></ul></li>
9237 <li> hi
9238 <ul><li> ho</li></ul></li></ul>
9239
9240 !! html/parsoid
9241 <ul><li> hi</li>
9242 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9243 <li> hi
9244 <ul><li> ho</li></ul></li></ul>
9245 !! end
9246
9247 !! test
9248 2. Nested mixed wikitext and html list (incompatible)
9249 !! wikitext
9250 ; hi
9251 : {{echo|<li>ho</li>}}
9252 !! html/php
9253 <dl><dt> hi</dt>
9254 <dd> <li>ho</li></dd></dl>
9255
9256 !! html/parsoid
9257 <dl><dt> hi</dt>
9258 <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>
9259 !! end
9260
9261 !! test
9262 Nested lists 1
9263 !! wikitext
9264 *foo
9265 **bar
9266 !! html
9267 <ul><li>foo
9268 <ul><li>bar</li></ul></li></ul>
9269
9270 !! end
9271
9272 !! test
9273 Nested lists 2
9274 !! wikitext
9275 **foo
9276 *bar
9277 !! html
9278 <ul><li><ul><li>foo</li></ul></li>
9279 <li>bar</li></ul>
9280
9281 !! end
9282
9283 !! test
9284 Nested lists 3 (first element empty)
9285 !! wikitext
9286 *
9287 **bar
9288 !! html
9289 <ul><li>
9290 <ul><li>bar</li></ul></li></ul>
9291
9292 !! end
9293
9294 !! test
9295 Nested lists 4 (first element empty)
9296 !! wikitext
9297 **
9298 *bar
9299 !! html
9300 <ul><li><ul><li></li></ul></li>
9301 <li>bar</li></ul>
9302
9303 !! end
9304
9305 !! test
9306 Nested lists 5 (both elements empty)
9307 !! wikitext
9308 **
9309 *
9310 !! html
9311 <ul><li><ul><li></li></ul></li>
9312 <li></li></ul>
9313
9314 !! end
9315
9316 !! test
9317 Nested lists 6 (both elements empty)
9318 !! wikitext
9319 *
9320 **
9321 !! html
9322 <ul><li>
9323 <ul><li></li></ul></li></ul>
9324
9325 !! end
9326
9327 !! test
9328 Nested lists 7 (skip initial nesting levels)
9329 !! wikitext
9330 *** foo
9331 !! html
9332 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9333
9334 !! end
9335
9336 !! test
9337 Nested lists 8 (multiple nesting transitions)
9338 !! wikitext
9339 * foo
9340 *** bar
9341 ** baz
9342 * boo
9343 !! html
9344 <ul><li> foo
9345 <ul><li><ul><li> bar</li></ul></li>
9346 <li> baz</li></ul></li>
9347 <li> boo</li></ul>
9348
9349 !! end
9350
9351 !! test
9352 Nested lists 9 (extension interaction)
9353 !! options
9354 parsoid
9355 !! wikitext
9356 *<references />
9357 !! html/parsoid
9358 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9359 !! end
9360
9361 !! test
9362 1. Lists with start-of-line-transparent tokens before bullets: Comments
9363 !! wikitext
9364 *foo
9365 *<!--cmt-->bar
9366 <!--cmt-->*baz
9367 !! html
9368 <ul><li>foo</li>
9369 <li>bar</li>
9370 <li>baz</li></ul>
9371
9372 !! end
9373
9374 !! test
9375 2. Lists with start-of-line-transparent tokens before bullets: Template close
9376 !! wikitext
9377 *foo {{echo|bar
9378 }}*baz
9379 !! html
9380 <ul><li>foo bar</li>
9381 <li>baz</li></ul>
9382
9383 !! end
9384
9385 !! test
9386 List items are not parsed correctly following a <pre> block (bug 785)
9387 !! wikitext
9388 * <pre>foo</pre>
9389 * <pre>bar</pre>
9390 * zar
9391 !! html/php
9392 <ul><li> <pre>foo</pre></li>
9393 <li> <pre>bar</pre></li>
9394 <li> zar</li></ul>
9395
9396 !! html/parsoid
9397 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9398 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9399 <li> zar</li></ul>
9400 !! end
9401
9402 !! test
9403 List items from template
9404 !! wikitext
9405
9406 {{inner list}}
9407 * item 2
9408
9409 * item 0
9410 {{inner list}}
9411 * item 2
9412
9413 * item 0
9414 * notSOL{{inner list}}
9415 * item 2
9416 !! html
9417 <ul><li> item 1</li>
9418 <li> item 2</li></ul>
9419 <ul><li> item 0</li>
9420 <li> item 1</li>
9421 <li> item 2</li></ul>
9422 <ul><li> item 0</li>
9423 <li> notSOL</li>
9424 <li> item 1</li>
9425 <li> item 2</li></ul>
9426
9427 !! end
9428
9429 !! test
9430 List interrupted by empty line or heading
9431 !! wikitext
9432 * foo
9433
9434 ** bar
9435 == A heading ==
9436 * Another list item
9437 !! html
9438 <ul><li> foo</li></ul>
9439 <ul><li><ul><li> bar</li></ul></li></ul>
9440 <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>
9441 <ul><li> Another list item</li></ul>
9442
9443 !!end
9444
9445 !!test
9446 Multiple list tags generated by templates
9447 !! wikitext
9448 {{echo|<li>}}a
9449 {{echo|<li>}}b
9450 {{echo|<li>}}c
9451 !! html
9452 <li>a
9453 <li>b
9454 <li>c</li>
9455 </li>
9456 </li>
9457
9458 !! html+tidy
9459 <ul>
9460 <li>a</li>
9461 <li>b</li>
9462 <li>c</li>
9463 </ul>
9464 !!end
9465
9466 !!test
9467 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9468 !! wikitext
9469 *a
9470 <!--This line will NOT split the list-->
9471 *b
9472 <!--This line will NOT split the list either-->
9473 *c
9474 <!--foo--> <!----> <!--This line NOT split the list either-->
9475 *d
9476 !! html
9477 <ul><li>a</li>
9478 <li>b</li>
9479 <li>c</li>
9480 <li>d</li></ul>
9481
9482 !!end
9483
9484 !!test
9485 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9486 !! wikitext
9487 *a
9488 <!--This line will NOT split the list-->
9489 *b
9490 <!--This line will NOT split the list either-->
9491 *c
9492 <!--foo--> <!----> <!--This line NOT split the list
9493 either-->
9494 *d
9495 !! html
9496 <ul><li>a</li>
9497 <li>b</li>
9498 <li>c</li>
9499 <li>d</li></ul>
9500
9501 !!end
9502
9503 !!test
9504 Test the li-hack
9505 (The PHP parser relies on Tidy for the hack)
9506 !!options
9507 parsoid=wt2html,wt2wt
9508 !! wikitext
9509 * foo
9510 * <li>li-hack
9511 * {{echo|<li>templated li-hack}}
9512 * <!--foo--> <li> unsupported li-hack with preceding comments
9513
9514 <ul>
9515 <li><li>not a li-hack
9516 </li>
9517 </ul>
9518 !! html+tidy
9519 <ul>
9520 <li>foo</li>
9521 <li>li-hack</li>
9522 <li>templated li-hack</li>
9523 <li>unsupported li-hack with preceding comments</li>
9524 </ul>
9525 <ul>
9526 <li>not a li-hack</li>
9527 </ul>
9528 !!end
9529
9530 !! test
9531 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9532 !! options
9533 parsoid
9534 !! wikitext
9535 # foo
9536 ## bar
9537 * foo
9538 ** bar
9539 : foo
9540 :: bar
9541 !! html
9542 <ol>
9543 <li> foo<ol>
9544 <li> bar</li>
9545 </ol></li>
9546 </ol><ul>
9547 <li> foo<ul>
9548 <li> bar</li>
9549 </ul></li>
9550 </ul><dl>
9551 <dd> foo<dl>
9552 <dd> bar</dd>
9553 </dl></dd>
9554 </dl>
9555 !! end
9556
9557 !! test
9558 Parsoid: Test of whitespace serialization with Templated bullets
9559 !! options
9560 parsoid
9561 !! wikitext
9562 * {{bullet}}
9563 !! html
9564 <ul>
9565 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9566 </ul>
9567 !! end
9568
9569 # ------------------------------------------------------------------------
9570 # The next set of tests are about Parsoid's ability to handle badly nested
9571 # tags (parse, minimize scope of fixup, and roundtrip back)
9572 # ------------------------------------------------------------------------
9573
9574 !! test
9575 Unbalanced closing block tags break a list
9576 (php parser relies on Tidy to fix up)
9577 !! wikitext
9578 <div>
9579 *a</div><div>
9580 *b</div>
9581 !! html+tidy
9582 <div>
9583 <ul>
9584 <li>a</li>
9585 </ul>
9586 </div>
9587 <div>
9588 <ul>
9589 <li>b</li>
9590 </ul>
9591 </div>
9592 !! end
9593
9594 # Parsoid fails this test, but it might be tricky to support properly.
9595 # See bug 68395.
9596 !! test
9597 Unbalanced closing non-block tags don't break a list
9598 (php parser relies on Tidy to fix up)
9599 !! wikitext
9600 <span>
9601 *a</span><span>
9602 *b</span>
9603 !! html/php+tidy
9604 <ul>
9605 <li><span>a</span></li>
9606 <li><span>b</span></li>
9607 </ul>
9608 !! html/parsoid
9609 <span>
9610 <ul>
9611 <li>a<span></span>
9612 </li>
9613 <li>b
9614 </li>
9615 </ul>
9616 </span>
9617 !! end
9618
9619 !! test
9620 Unclosed formatting tags that straddle lists are closed and reopened
9621 (php parser relies on Tidy to fix up)
9622 !! options
9623 parsoid=wt2html,wt2wt,html2html
9624 !! wikitext
9625 # <s> a
9626 # b </s>
9627 !! html/php+tidy
9628 <ol>
9629 <li><s>a</s></li>
9630 <li><s>b</s></li>
9631 </ol>
9632 !! html/parsoid
9633 <ol><li> <s> a</s></li>
9634 <li><s> b </s></li></ol>
9635 !! end
9636
9637 # See bug 68395.
9638 !!test
9639 1. List embedded in a formatting tag
9640 !! wikitext
9641 <small>
9642 * foo
9643 </small>
9644 !! html/php+tidy
9645 <ul>
9646 <li><small>foo</small></li>
9647 </ul>
9648 !! html/parsoid
9649 <small>
9650 <ul>
9651 <li> foo</li>
9652 </ul>
9653 </small>
9654 !!end
9655
9656 ## Ugly Parsoid output here
9657 ## Not sure what the right output is.
9658 !!test
9659 2. List embedded in a formatting tag
9660 !! wikitext
9661 <small>
9662 *a
9663 *b</small>
9664 !! html/php+tidy
9665 <ul>
9666 <li><small>a</small></li>
9667 <li><small>b</small></li>
9668 </ul>
9669 !! html/parsoid
9670 <small></small>
9671 <ul><small>
9672 <li>a</li>
9673 </small>
9674 <li><small>b</small></li>
9675 </ul>
9676 !!end
9677
9678 # Ugly Parsoid and PHP parser output here
9679 # Not sure if we want to make this a test!
9680 #
9681 ## !!test
9682 ## 3. Unclosed formatting tags in list elements
9683 ## !! wikitext
9684 ## *<small>a
9685 ## *<small>b
9686 ## !! html/php+tidy
9687 ## <ul>
9688 ## <li><small>a</small></li>
9689 ## <li><small><small>b</small></small></li>
9690 ## </ul>
9691 ## !! html/parsoid
9692 ## <ul>
9693 ## <li><small>a</small></li>
9694 ## <small>
9695 ## <li><small>b</small></li>
9696 ## </small></ul>
9697 ## !!end
9698
9699 # This is a bug in the PHP parser + tidy combination.
9700 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9701 # and then fostered out of the table by tidy.)
9702 # We believe the Parsoid output to be correct.
9703 !! test
9704 Table with missing opening <tr> tag
9705 !! options
9706 parsoid=wt2html,wt2wt
9707 !! wikitext
9708 <table>
9709 <td>foo</td>
9710 </tr>
9711 </table>
9712 !! html+tidy
9713 <table>
9714 <tr>
9715 <td>foo</td>
9716 </tr>
9717 </table>
9718 !! end
9719
9720 ###
9721 ### Magic Words
9722 ###
9723
9724 # Note that the current date is hard-coded as
9725 # 1970-01-01T00:02:03Z (a Thursday)
9726 # when running parser tests. The timezone is also fixed to GMT, so
9727 # local date will be identical to current date.
9728
9729 !! test
9730 Magic Word: {{CURRENTDAY}}
9731 !! wikitext
9732 {{CURRENTDAY}}
9733 !! html
9734 <p>1
9735 </p>
9736 !! end
9737
9738 !! test
9739 Magic Word: {{CURRENTDAY2}}
9740 !! wikitext
9741 {{CURRENTDAY2}}
9742 !! html
9743 <p>01
9744 </p>
9745 !! end
9746
9747 !! test
9748 Magic Word: {{CURRENTDAYNAME}}
9749 !! wikitext
9750 {{CURRENTDAYNAME}}
9751 !! html
9752 <p>Thursday
9753 </p>
9754 !! end
9755
9756 !! test
9757 Magic Word: {{CURRENTDOW}}
9758 !! wikitext
9759 {{CURRENTDOW}}
9760 !! html
9761 <p>4
9762 </p>
9763 !! end
9764
9765 !! test
9766 Magic Word: {{CURRENTMONTH}}
9767 !! wikitext
9768 {{CURRENTMONTH}}
9769 !! html
9770 <p>01
9771 </p>
9772 !! end
9773
9774 !! test
9775 Magic Word: {{CURRENTMONTH1}}
9776 !! wikitext
9777 {{CURRENTMONTH1}}
9778 !! html
9779 <p>1
9780 </p>
9781 !! end
9782
9783 !! test
9784 Magic Word: {{CURRENTMONTHABBREV}}
9785 !! wikitext
9786 {{CURRENTMONTHABBREV}}
9787 !! html
9788 <p>Jan
9789 </p>
9790 !! end
9791
9792 !! test
9793 Magic Word: {{CURRENTMONTHNAME}}
9794 !! wikitext
9795 {{CURRENTMONTHNAME}}
9796 !! html
9797 <p>January
9798 </p>
9799 !! end
9800
9801 !! test
9802 Magic Word: {{CURRENTMONTHNAMEGEN}}
9803 !! wikitext
9804 {{CURRENTMONTHNAMEGEN}}
9805 !! html
9806 <p>January
9807 </p>
9808 !! end
9809
9810 !! test
9811 Magic Word: {{CURRENTTIME}}
9812 !! wikitext
9813 {{CURRENTTIME}}
9814 !! html
9815 <p>00:02
9816 </p>
9817 !! end
9818
9819 !! test
9820 Magic Word: {{CURRENTHOUR}}
9821 !! wikitext
9822 {{CURRENTHOUR}}
9823 !! html
9824 <p>00
9825 </p>
9826 !! end
9827
9828 !! test
9829 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9830 !! wikitext
9831 {{CURRENTWEEK}}
9832 !! html
9833 <p>1
9834 </p>
9835 !! end
9836
9837 !! test
9838 Magic Word: {{CURRENTYEAR}}
9839 !! wikitext
9840 {{CURRENTYEAR}}
9841 !! html
9842 <p>1970
9843 </p>
9844 !! end
9845
9846 !! test
9847 Magic Word: {{CURRENTTIMESTAMP}}
9848 !! wikitext
9849 {{CURRENTTIMESTAMP}}
9850 !! html
9851 <p>19700101000203
9852 </p>
9853 !! end
9854
9855 !! test
9856 Magic Words LOCAL (UTC)
9857 !! wikitext
9858 * {{LOCALMONTH}}
9859 * {{LOCALMONTH1}}
9860 * {{LOCALMONTHNAME}}
9861 * {{LOCALMONTHNAMEGEN}}
9862 * {{LOCALMONTHABBREV}}
9863 * {{LOCALDAY}}
9864 * {{LOCALDAY2}}
9865 * {{LOCALDAYNAME}}
9866 * {{LOCALYEAR}}
9867 * {{LOCALTIME}}
9868 * {{LOCALHOUR}}
9869 * {{LOCALWEEK}}
9870 * {{LOCALDOW}}
9871 * {{LOCALTIMESTAMP}}
9872 !! html
9873 <ul><li> 01</li>
9874 <li> 1</li>
9875 <li> January</li>
9876 <li> January</li>
9877 <li> Jan</li>
9878 <li> 1</li>
9879 <li> 01</li>
9880 <li> Thursday</li>
9881 <li> 1970</li>
9882 <li> 00:02</li>
9883 <li> 00</li>
9884 <li> 1</li>
9885 <li> 4</li>
9886 <li> 19700101000203</li></ul>
9887
9888 !! end
9889
9890 !! test
9891 Magic Word: {{FULLPAGENAME}}
9892 !! options
9893 title=[[User:Ævar Arnfjörð Bjarmason]]
9894 !! wikitext
9895 {{FULLPAGENAME}}
9896 !! html
9897 <p>User:Ævar Arnfjörð Bjarmason
9898 </p>
9899 !! end
9900
9901 !! test
9902 Magic Word: {{FULLPAGENAMEE}}
9903 !! options
9904 title=[[User:Ævar Arnfjörð Bjarmason]]
9905 !! wikitext
9906 {{FULLPAGENAMEE}}
9907 !! html
9908 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9909 </p>
9910 !! end
9911
9912 !! test
9913 Magic Word: {{TALKSPACE}}
9914 !! options
9915 title=[[User:Ævar Arnfjörð Bjarmason]]
9916 !! wikitext
9917 {{TALKSPACE}}
9918 !! html
9919 <p>User talk
9920 </p>
9921 !! end
9922
9923 !! test
9924 Magic Word: {{TALKSPACE}}, same namespace
9925 !! options
9926 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9927 !! wikitext
9928 {{TALKSPACE}}
9929 !! html
9930 <p>User talk
9931 </p>
9932 !! end
9933
9934 !! test
9935 Magic Word: {{TALKSPACE}}, main namespace
9936 !! options
9937 title=[[Parser Test]]
9938 !! wikitext
9939 {{TALKSPACE}}
9940 !! html
9941 <p>Talk
9942 </p>
9943 !! end
9944
9945 !! test
9946 Magic Word: {{TALKSPACEE}}
9947 !! options
9948 title=[[User:Ævar Arnfjörð Bjarmason]]
9949 !! wikitext
9950 {{TALKSPACEE}}
9951 !! html
9952 <p>User_talk
9953 </p>
9954 !! end
9955
9956 !! test
9957 Magic Word: {{SUBJECTSPACE}}
9958 !! options
9959 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9960 !! wikitext
9961 {{SUBJECTSPACE}}
9962 !! html
9963 <p>User
9964 </p>
9965 !! end
9966
9967 !! test
9968 Magic Word: {{SUBJECTSPACE}}, same namespace
9969 !! options
9970 title=[[User:Ævar Arnfjörð Bjarmason]]
9971 !! wikitext
9972 {{SUBJECTSPACE}}
9973 !! html
9974 <p>User
9975 </p>
9976 !! end
9977
9978 !! test
9979 Magic Word: {{SUBJECTSPACE}}, main namespace
9980 !! options
9981 title=[[Parser Test]]
9982 !! wikitext
9983 {{SUBJECTSPACE}}
9984 !! html
9985
9986 !! end
9987
9988 !! test
9989 Magic Word: {{SUBJECTSPACEE}}
9990 !! options
9991 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9992 !! wikitext
9993 {{SUBJECTSPACEE}}
9994 !! html
9995 <p>User
9996 </p>
9997 !! end
9998
9999 !! test
10000 Magic Word: {{NAMESPACE}}
10001 !! options
10002 title=[[User:Ævar Arnfjörð Bjarmason]]
10003 !! wikitext
10004 {{NAMESPACE}}
10005 !! html
10006 <p>User
10007 </p>
10008 !! end
10009
10010 !! test
10011 Magic Word: {{NAMESPACEE}}
10012 !! options
10013 title=[[User:Ævar Arnfjörð Bjarmason]]
10014 !! wikitext
10015 {{NAMESPACEE}}
10016 !! html
10017 <p>User
10018 </p>
10019 !! end
10020
10021 !! test
10022 Magic Word: {{NAMESPACENUMBER}}
10023 !! options
10024 title=[[User:Ævar Arnfjörð Bjarmason]]
10025 !! wikitext
10026 {{NAMESPACENUMBER}}
10027 !! html
10028 <p>2
10029 </p>
10030 !! end
10031
10032 !! test
10033 Magic Word: {{SUBPAGENAME}}
10034 !! options
10035 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10036 !! wikitext
10037 {{SUBPAGENAME}}
10038 !! html
10039 <p>sub ö
10040 </p>
10041 !! end
10042
10043 !! test
10044 Magic Word: {{SUBPAGENAMEE}}
10045 !! options
10046 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10047 !! wikitext
10048 {{SUBPAGENAMEE}}
10049 !! html
10050 <p>sub_%C3%B6
10051 </p>
10052 !! end
10053
10054 !! test
10055 Magic Word: {{ROOTPAGENAME}}
10056 !! options
10057 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10058 !! wikitext
10059 {{ROOTPAGENAME}}
10060 !! html
10061 <p>Ævar Arnfjörð Bjarmason
10062 </p>
10063 !! end
10064
10065 !! test
10066 Magic Word: {{ROOTPAGENAMEE}}
10067 !! options
10068 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10069 !! wikitext
10070 {{ROOTPAGENAMEE}}
10071 !! html
10072 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10073 </p>
10074 !! end
10075
10076 !! test
10077 Magic Word: {{BASEPAGENAME}}
10078 !! options
10079 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10080 !! wikitext
10081 {{BASEPAGENAME}}
10082 !! html
10083 <p>Ævar Arnfjörð Bjarmason
10084 </p>
10085 !! end
10086
10087 !! test
10088 Magic Word: {{BASEPAGENAMEE}}
10089 !! options
10090 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10091 !! wikitext
10092 {{BASEPAGENAMEE}}
10093 !! html
10094 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10095 </p>
10096 !! end
10097
10098 !! test
10099 Magic Word: {{TALKPAGENAME}}
10100 !! options
10101 title=[[User:Ævar Arnfjörð Bjarmason]]
10102 !! wikitext
10103 {{TALKPAGENAME}}
10104 !! html
10105 <p>User talk:Ævar Arnfjörð Bjarmason
10106 </p>
10107 !! end
10108
10109 !! test
10110 Magic Word: {{TALKPAGENAMEE}}
10111 !! options
10112 title=[[User:Ævar Arnfjörð Bjarmason]]
10113 !! wikitext
10114 {{TALKPAGENAMEE}}
10115 !! html
10116 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10117 </p>
10118 !! end
10119
10120 !! test
10121 Magic Word: {{SUBJECTPAGENAME}}
10122 !! options
10123 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10124 !! wikitext
10125 {{SUBJECTPAGENAME}}
10126 !! html
10127 <p>User:Ævar Arnfjörð Bjarmason
10128 </p>
10129 !! end
10130
10131 !! test
10132 Magic Word: {{SUBJECTPAGENAMEE}}
10133 !! options
10134 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10135 !! wikitext
10136 {{SUBJECTPAGENAMEE}}
10137 !! html
10138 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10139 </p>
10140 !! end
10141
10142 !! test
10143 Magic Word: {{NUMBEROFFILES}}
10144 !! wikitext
10145 {{NUMBEROFFILES}}
10146 !! html
10147 <p>7
10148 </p>
10149 !! end
10150
10151 !! test
10152 Magic Word: {{PAGENAME}}
10153 !! options
10154 title=[[User:Ævar Arnfjörð Bjarmason]]
10155 !! wikitext
10156 {{PAGENAME}}
10157 !! html
10158 <p>Ævar Arnfjörð Bjarmason
10159 </p>
10160 !! end
10161
10162 !! test
10163 Magic Word: {{PAGENAME}} with metacharacters
10164 !! options
10165 title=[['foo & bar = baz']]
10166 !! wikitext
10167 ''{{PAGENAME}}''
10168 !! html/php
10169 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10170 </p>
10171 !! html+tidy
10172 <p><i>'foo &amp; bar = baz'</i></p>
10173 !! end
10174
10175 !! test
10176 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
10177 !! options
10178 title=[[*RFC 1234 http://example.com/]]
10179 !! wikitext
10180 {{PAGENAME}}
10181 !! html/php
10182 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10183 </p>
10184 !! html+tidy
10185 <p>*RFC 1234 http://example.com/</p>
10186 !! end
10187
10188 !! test
10189 Magic Word: {{PAGENAMEE}}
10190 !! options
10191 title=[[User:Ævar Arnfjörð Bjarmason]]
10192 !! wikitext
10193 {{PAGENAMEE}}
10194 !! html
10195 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10196 </p>
10197 !! end
10198
10199 !! test
10200 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10201 !! options
10202 title=[[*RFC 1234 http://example.com/]]
10203 !! wikitext
10204 {{PAGENAMEE}}
10205 !! html/php
10206 <p>&#42;RFC_1234_http&#58;//example.com/
10207 </p>
10208 !! html+tidy
10209 <p>*RFC_1234_http://example.com/</p>
10210 !! end
10211
10212 !! test
10213 Magic Word: {{REVISIONID}}
10214 !! wikitext
10215 {{REVISIONID}}
10216 !! html
10217 <p>1337
10218 </p>
10219 !! end
10220
10221 !! test
10222 Magic Word: {{SCRIPTPATH}}
10223 !! wikitext
10224 {{SCRIPTPATH}}
10225 !! html
10226
10227 !! end
10228
10229 !! test
10230 Magic Word: {{STYLEPATH}}
10231 !! wikitext
10232 {{STYLEPATH}}
10233 !! html
10234 <p>/skins
10235 </p>
10236 !! end
10237
10238 !! test
10239 Magic Word: {{SERVER}}
10240 !! wikitext
10241 {{SERVER}}
10242 !! html
10243 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10244 </p>
10245 !! end
10246
10247 !! test
10248 Magic Word: {{SERVERNAME}}
10249 !! wikitext
10250 {{SERVERNAME}}
10251 !! html
10252 <p>example.org
10253 </p>
10254 !! end
10255
10256 !! test
10257 Magic Word: {{SITENAME}}
10258 !! wikitext
10259 {{SITENAME}}
10260 !! html
10261 <p>MediaWiki
10262 </p>
10263 !! end
10264
10265 !! test
10266 Case-sensitive magic words, when cased differently, should just be template transclusions
10267 !! wikitext
10268 {{CurrentMonth}}
10269 {{currentday}}
10270 {{cURreNTweEK}}
10271 {{currentHour}}
10272 !! html
10273 <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>
10274 <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>
10275 <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>
10276 <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>
10277 </p>
10278 !! end
10279
10280 !! test
10281 Case-insensitive magic words should still work with weird casing.
10282 !! wikitext
10283 {{sErVeRNaMe}}
10284 {{LCFirst:AOEU}}
10285 {{ucFIRST:aoeu}}
10286 {{SERver}}
10287 !! html
10288 <p>example.org
10289 aOEU
10290 Aoeu
10291 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10292 </p>
10293 !! end
10294
10295 # From plwiki:PLOS_ONE
10296 !! test
10297 Parsoid: Page property magic word with magic word contents
10298 !! wikitext
10299 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10300 !! html/parsoid
10301 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
10302 !! end
10303
10304 !! test
10305 Parsoid: Template-generated DISPLAYTITLE
10306 !! wikitext
10307 {{{{echo|DISPLAYTITLE}}:Foo}}
10308 !! html/parsoid
10309 <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}}]}'/>
10310 !! end
10311
10312 !! test
10313 Namespace 1 {{ns:1}}
10314 !! wikitext
10315 {{ns:1}}
10316 !! html
10317 <p>Talk
10318 </p>
10319 !! end
10320
10321 !! test
10322 Namespace 1 {{ns:01}}
10323 !! wikitext
10324 {{ns:01}}
10325 !! html
10326 <p>Talk
10327 </p>
10328 !! end
10329
10330 !! test
10331 Namespace 0 {{ns:0}} (bug 4783)
10332 !! wikitext
10333 {{ns:0}}
10334 !! html
10335
10336 !! end
10337
10338 !! test
10339 Namespace 0 {{ns:00}} (bug 4783)
10340 !! wikitext
10341 {{ns:00}}
10342 !! html
10343
10344 !! end
10345
10346 !! test
10347 Namespace -1 {{ns:-1}}
10348 !! wikitext
10349 {{ns:-1}}
10350 !! html
10351 <p>Special
10352 </p>
10353 !! end
10354
10355 !! test
10356 Namespace User {{ns:User}}
10357 !! wikitext
10358 {{ns:User}}
10359 !! html
10360 <p>User
10361 </p>
10362 !! end
10363
10364 !! test
10365 Namespace User talk {{ns:User_talk}}
10366 !! wikitext
10367 {{ns:User_talk}}
10368 !! html
10369 <p>User talk
10370 </p>
10371 !! end
10372
10373 !! test
10374 Namespace User talk {{ns:uSeR tAlK}}
10375 !! wikitext
10376 {{ns:uSeR tAlK}}
10377 !! html
10378 <p>User talk
10379 </p>
10380 !! end
10381
10382 !! test
10383 Namespace File {{ns:File}}
10384 !! wikitext
10385 {{ns:File}}
10386 !! html
10387 <p>File
10388 </p>
10389 !! end
10390
10391 !! test
10392 Namespace File {{ns:Image}}
10393 !! wikitext
10394 {{ns:Image}}
10395 !! html
10396 <p>File
10397 </p>
10398 !! end
10399
10400 !! test
10401 Namespace (lang=de) Benutzer {{ns:User}}
10402 !! options
10403 language=de
10404 !! wikitext
10405 {{ns:User}}
10406 !! html
10407 <p>Benutzer
10408 </p>
10409 !! end
10410
10411 !! test
10412 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10413 !! options
10414 language=de
10415 !! wikitext
10416 {{ns:3}}
10417 !! html
10418 <p>Benutzer Diskussion
10419 </p>
10420 !! end
10421
10422 !! test
10423 Urlencode
10424 !! wikitext
10425 {{urlencode:hi world?!}}
10426 {{urlencode:hi world?!|WIKI}}
10427 {{urlencode:hi world?!|PATH}}
10428 {{urlencode:hi world?!|QUERY}}
10429 !! html/php
10430 <p>hi+world%3F%21
10431 hi_world%3F!
10432 hi%20world%3F%21
10433 hi+world%3F%21
10434 </p>
10435 !! end
10436
10437 !! test
10438 Magic Word: prioritize type info over data-parsoid
10439 !! options
10440 parsoid=html2wt
10441 !! html/parsoid
10442 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10443 !! wikitext
10444 __FORCETOC__
10445 !! end
10446
10447 !! test
10448 Magic Word: serialize on separate line (parsoid)
10449 !! options
10450 parsoid=wt2wt,html2wt
10451 !! wikitext
10452 foo
10453 __NOTOC__
10454 bar
10455 !! html/parsoid
10456 foo<meta property="mw:PageProp/notoc"/>bar
10457 !! end
10458
10459 !! test
10460 Magic Word: rt non-english wikis
10461 !! options
10462 parsoid=wt2wt
10463 language=de
10464 !! wikitext
10465 __NOEDITSECTION__
10466 !! html/parsoid
10467 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10468 !! end
10469
10470 !!test
10471 __proto__ is treated as normal wikitext (T105997)
10472 !!wikitext
10473 __proto__
10474 !!html
10475 <p>__proto__
10476 </p>
10477 !!end
10478
10479 ###
10480 ### Magic links
10481 ###
10482 !! test
10483 Magic links: internal link to RFC (bug 479)
10484 !! wikitext
10485 [[RFC 123]]
10486 !! html/php
10487 <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>
10488 </p>
10489 !! html/parsoid
10490 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10491 !! end
10492
10493 !! test
10494 Magic links: RFC (bug 479)
10495 !! wikitext
10496 RFC 822
10497 !! html/php
10498 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10499 </p>
10500 !! html/parsoid
10501 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10502 !! end
10503
10504 !! test
10505 Magic links: RFC (bug 65278)
10506 !! wikitext
10507 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10508 !! html/php
10509 <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.
10510 </p>
10511 !! html/parsoid
10512 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10513 !! end
10514
10515 !! test
10516 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10517 !! wikitext
10518 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10519 RFC
10520 822
10521 !! html/php
10522 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10523 RFC
10524 822
10525 </p>
10526 !! html/parsoid
10527 <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>
10528 RFC
10529 822</p>
10530 !! end
10531
10532 !! test
10533 Magic links: ISBN (bug 1937)
10534 !! wikitext
10535 ISBN 0-306-40615-2
10536 !! html/php
10537 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10538 </p>
10539 !! html/parsoid
10540 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10541 !! end
10542
10543 !! test
10544 Magic links: ISBN (bug 65278)
10545 !! wikitext
10546 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10547 !! html/php
10548 <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.
10549 </p>
10550 !! html/parsoid
10551 <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>
10552 !! end
10553
10554 !! test
10555 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10556 !! wikitext
10557 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10558 ISBN
10559 9780316098113
10560 ISBN 978
10561 0316098113
10562 !! html/php
10563 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10564 ISBN
10565 9780316098113
10566 ISBN 978
10567 0316098113
10568 </p>
10569 !! html/parsoid
10570 <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>
10571 ISBN
10572 9780316098113
10573 ISBN 978
10574 0316098113</p>
10575 !! end
10576
10577 !! test
10578 Magic links: PMID incorrectly converts space to underscore
10579 !! wikitext
10580 PMID 1234
10581 !! html/php
10582 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10583 </p>
10584 !! html/parsoid
10585 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10586 !! end
10587
10588 !! test
10589 Magic links: PMID (bug 65278)
10590 !! wikitext
10591 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10592 !! html/php
10593 <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.
10594 </p>
10595 !! html/parsoid
10596 <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>
10597 !! end
10598
10599 !! test
10600 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10601 !! wikitext
10602 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10603 PMID
10604 1234
10605 !! html/php
10606 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10607 PMID
10608 1234
10609 </p>
10610 !! html/parsoid
10611 <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>
10612 PMID
10613 1234</p>
10614 !! end
10615
10616 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10617 # since these are ExtLinkText, not MagicLinkText
10618 !! test
10619 Magic links: use appropriate serialization for "almost" magic links.
10620 !! wikitext
10621 X[[Special:BookSources/0978739256|foo]]
10622
10623 X[//tools.ietf.org/html/rfc1234 foo]
10624 !! html/php
10625 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10626 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10627 </p>
10628 !! html/parsoid
10629 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10630 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10631 !! end
10632
10633 !! test
10634 Magic links: All disabled (T47942)
10635 !! options
10636 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10637 !! wikitext
10638 ISBN 0-306-40615-2
10639 PMID 1234
10640 RFC 4321
10641 !! html/php
10642 <p>ISBN 0-306-40615-2
10643 PMID 1234
10644 RFC 4321
10645 </p>
10646 !! end
10647
10648 ###
10649 ### Templates
10650 ####
10651
10652 !! test
10653 Nonexistent template
10654 !! wikitext
10655 {{thistemplatedoesnotexist}}
10656 !! html
10657 <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>
10658 </p>
10659 !! end
10660
10661 !! test
10662 Template with invalid target containing tags
10663 !! wikitext
10664 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10665 !! html
10666 <p>{{a<b>b</b>|foo|a=b|a = b}}
10667 </p>
10668 !! end
10669
10670 !! test
10671 Template with invalid target containing unclosed tag
10672 !! wikitext
10673 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10674 !! html
10675 <p>{{a<b>|foo|a=b|a = b}}</b>
10676 </p>
10677 !! end
10678
10679 !! test
10680 Template with invalid target containing wikilink
10681 !! wikitext
10682 {{[[Main Page]]}}
10683 !! html/php
10684 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10685 </p>
10686 !! html/parsoid
10687 <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>
10688 !! end
10689
10690 !! test
10691 Template with just whitespace in it, bug #68421
10692 !! wikitext
10693 {{echo|{{ }}}}
10694 !! html/parsoid
10695 <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>
10696 !! end
10697
10698 !! article
10699 Template:test
10700 !! text
10701 This is a test template
10702 !! endarticle
10703
10704 !! test
10705 Simple template
10706 !! wikitext
10707 {{test}}
10708 !! html
10709 <p>This is a test template
10710 </p>
10711 !! end
10712
10713 !! test
10714 Template with explicit namespace
10715 !! wikitext
10716 {{Template:test}}
10717 !! html
10718 <p>This is a test template
10719 </p>
10720 !! end
10721
10722
10723 !! article
10724 Template:paramtest
10725 !! text
10726 This is a test template with parameter {{{param}}}
10727 !! endarticle
10728
10729 !! test
10730 Template parameter
10731 !! wikitext
10732 {{paramtest|param=foo}}
10733 !! html
10734 <p>This is a test template with parameter foo
10735 </p>
10736 !! end
10737
10738 !! article
10739 Template:paramtestnum
10740 !! text
10741 [[{{{1}}}|{{{2}}}]]
10742 !! endarticle
10743
10744 !! test
10745 Template unnamed parameter
10746 !! wikitext
10747 {{paramtestnum|Main Page|the main page}}
10748 !! html
10749 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10750 </p>
10751 !! end
10752
10753 !! article
10754 Template:templatesimple
10755 !! text
10756 (test)
10757 !! endarticle
10758
10759 !! article
10760 Template:templateredirect
10761 !! text
10762 #redirect [[Template:templatesimple]]
10763 !! endarticle
10764
10765 !! article
10766 Template:templateasargtestnum
10767 !! text
10768 {{{{{1}}}}}
10769 !! endarticle
10770
10771 !! article
10772 Template:templateasargtest
10773 !! text
10774 {{template{{{templ}}}}}
10775 !! endarticle
10776
10777 !! article
10778 Template:templateasargtest2
10779 !! text
10780 {{{{{templ}}}}}
10781 !! endarticle
10782
10783 !! test
10784 Template with template name as unnamed argument
10785 !! wikitext
10786 {{templateasargtestnum|templatesimple}}
10787 !! html
10788 <p>(test)
10789 </p>
10790 !! end
10791
10792 !! test
10793 Template with template name as argument
10794 !! wikitext
10795 {{templateasargtest|templ=simple}}
10796 !! html
10797 <p>(test)
10798 </p>
10799 !! end
10800
10801 !! test
10802 Template with template name as argument (2)
10803 !! wikitext
10804 {{templateasargtest2|templ=templatesimple}}
10805 !! html
10806 <p>(test)
10807 </p>
10808 !! end
10809
10810 !! article
10811 Template:templateasargtestdefault
10812 !! text
10813 {{{{{templ|templatesimple}}}}}
10814 !! endarticle
10815
10816 !! article
10817 Template:templa
10818 !! text
10819 '''templ'''
10820 !! endarticle
10821
10822 !! test
10823 Template with default value
10824 !! wikitext
10825 {{templateasargtestdefault}}
10826 !! html
10827 <p>(test)
10828 </p>
10829 !! end
10830
10831 !! test
10832 Template with default value (value set)
10833 !! wikitext
10834 {{templateasargtestdefault|templ=templa}}
10835 !! html
10836 <p><b>templ</b>
10837 </p>
10838 !! end
10839
10840 !! test
10841 Template redirect
10842 !! wikitext
10843 {{templateredirect}}
10844 !! html/php
10845 <p>(test)
10846 </p>
10847 !! html/parsoid
10848 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10849 !! end
10850
10851 !! test
10852 Template with argument in separate line
10853 !! wikitext
10854 {{ templateasargtest |
10855 templ = simple }}
10856 !! html
10857 <p>(test)
10858 </p>
10859 !! end
10860
10861 !! test
10862 Template with complex template as argument
10863 !! wikitext
10864 {{paramtest|
10865 param ={{ templateasargtest |
10866 templ = simple }}}}
10867 !! html
10868 <p>This is a test template with parameter (test)
10869 </p>
10870 !! end
10871
10872 !! test
10873 Template with thumb image (with link in description)
10874 !! wikitext
10875 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10876 !! html/php
10877 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>
10878
10879 !! html+tidy
10880 <p>This is a test template with parameter</p>
10881 <div class="thumb tright">
10882 <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>
10883 <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>
10884 </div>
10885 </div>
10886 !! html/parsoid
10887 <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>
10888 !! end
10889
10890 !! article
10891 Template:complextemplate
10892 !! text
10893 {{{1}}} {{paramtest|
10894 param ={{{param}}}}}
10895 !! endarticle
10896
10897 !! test
10898 Template with complex arguments
10899 !! wikitext
10900 {{complextemplate|
10901 param ={{ templateasargtest |
10902 templ = simple }}|[[Template:complextemplate|link]]}}
10903 !! html
10904 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10905 </p>
10906 !! end
10907
10908 !! test
10909 BUG 553: link with two variables in a piped link
10910 !! wikitext
10911 {|
10912 |[[{{{1}}}|{{{2}}}]]
10913 |}
10914 !! html/php
10915 <table>
10916 <tr>
10917 <td>[[{{{1}}}|{{{2}}}]]
10918 </td></tr></table>
10919
10920 !! html/parsoid
10921 <table>
10922 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-parsoid='{"src":"{{{1}}}"}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-parsoid='{"src":"{{{2}}}"}'>{{{2}}}</span>]]</td></tr>
10923 !! end
10924
10925 # See: T2553
10926 !! test
10927 Abort table cell attribute parsing on wikilink
10928 !! wikitext
10929 {|
10930 | testing [[one|two]] | three || four
10931 | testing one two | three || four
10932 | testing="[[one|two]]" | three || four
10933 |}
10934 !! html/php
10935 <table>
10936 <tr>
10937 <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>
10938 <td> four
10939 </td>
10940 <td> three </td>
10941 <td> four
10942 </td>
10943 <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>
10944 <td> four
10945 </td></tr></table>
10946
10947 !! html/parsoid
10948 <table>
10949 <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>
10950 <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>
10951 <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>
10952 </tbody></table>
10953 !! end
10954
10955 !! test
10956 Don't abort table cell attribute parsing if wikilink is found in template arg
10957 !! wikitext
10958 {|
10959 | Test {{#tag:ref|One two "[[three]]" four}}
10960 |}
10961 !! html/parsoid
10962 <table>
10963 <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>
10964 </tbody></table>
10965 !! end
10966
10967 !! test
10968 Magic variable as template parameter
10969 !! wikitext
10970 {{paramtest|param={{SITENAME}}}}
10971 !! html
10972 <p>This is a test template with parameter MediaWiki
10973 </p>
10974 !! end
10975
10976 !! article
10977 Template:linktest
10978 !! text
10979 [[{{{param}}}|link]]
10980 !! endarticle
10981
10982 !! test
10983 Template parameter as link source
10984 !! wikitext
10985 {{linktest|param=Main Page}}
10986 !! html
10987 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10988 </p>
10989 !! end
10990
10991 !!article
10992 Template:paramtest2
10993 !! text
10994 including another template, {{paramtest|param={{{arg}}}}}
10995 !! endarticle
10996
10997 !! test
10998 Template passing argument to another template
10999 !! wikitext
11000 {{paramtest2|arg='hmm'}}
11001 !! html
11002 <p>including another template, This is a test template with parameter 'hmm'
11003 </p>
11004 !! end
11005
11006 !! article
11007 Template:Linktest2
11008 !! text
11009 Main Page
11010 !! endarticle
11011
11012 !! test
11013 Template as link source
11014 !! wikitext
11015 [[{{linktest2}}]]
11016
11017 [[{{linktest2}}|Main Page]]
11018
11019 [[{{linktest2}}]]Page
11020 !! html
11021 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11022 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11023 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11024 </p>
11025 !! end
11026
11027
11028 !! article
11029 Template:loop1
11030 !! text
11031 {{loop2}}
11032 !! endarticle
11033
11034 !! article
11035 Template:loop2
11036 !! text
11037 {{loop1}}
11038 !! endarticle
11039
11040 !! test
11041 Template infinite loop
11042 !! wikitext
11043 {{loop1}}
11044 !! html
11045 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11046 </p>
11047 !! end
11048
11049 !! test
11050 Template from main namespace
11051 !! wikitext
11052 {{:Main Page}}
11053 !! html
11054 <p>blah blah
11055 </p>
11056 !! end
11057
11058 !! article
11059 Template:table
11060 !! text
11061 {|
11062 | 1 || 2
11063 |-
11064 | 3 || 4
11065 |}
11066 !! endarticle
11067
11068 !! test
11069 BUG 529: Template with table, not included at beginning of line
11070 !! wikitext
11071 foo {{table}}
11072 !! html
11073 <p>foo
11074 </p>
11075 <table>
11076 <tr>
11077 <td> 1 </td>
11078 <td> 2
11079 </td></tr>
11080 <tr>
11081 <td> 3 </td>
11082 <td> 4
11083 </td></tr></table>
11084
11085 !! end
11086
11087 !! test
11088 BUG 523: Template shouldn't eat newline (or add an extra one before table)
11089 !! wikitext
11090 foo
11091 {{table}}
11092 !! html
11093 <p>foo
11094 </p>
11095 <table>
11096 <tr>
11097 <td> 1 </td>
11098 <td> 2
11099 </td></tr>
11100 <tr>
11101 <td> 3 </td>
11102 <td> 4
11103 </td></tr></table>
11104
11105 !! end
11106
11107 !! test
11108 BUG 41: Template parameters shown as broken links
11109 !! wikitext
11110 {{{parameter}}}
11111 !! html
11112 <p>{{{parameter}}}
11113 </p>
11114 !! end
11115
11116 !! test
11117 Template with targets containing wikilinks
11118 !! wikitext
11119 {{[[foo]]}}
11120
11121 {{[[{{echo|foo}}]]}}
11122
11123 {{{{echo|[[foo}}]]}}
11124 !! html
11125 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11126 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11127 </p><p>{{[[foo}}]]
11128 </p>
11129 !! end
11130
11131 !! article
11132 Template:''
11133 !! text
11134 bar
11135 !! endarticle
11136
11137 !! test
11138 Templates: Double quotes as template target
11139 !! wikitext
11140 foo {{''}} baz
11141 !! html/php
11142 <p>foo bar baz
11143 </p>
11144 !! html/parsoid
11145 <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
11146 </p>
11147 !! end
11148
11149 ## This test is about making sure Parsoid's data-mw is well formed in the
11150 ## face of multiple templates with intersecting and overlapping ranges. The
11151 ## wikitext itself is wretched.
11152 !! test
11153 Templates with intersecting and overlapping ranges
11154 !! wikitext
11155 {|{{echo|
11156 <p>ha</p>}}
11157 {|{{echo|
11158 <p>ho</p>}}
11159 {{echo|{{!}}hi}}
11160 |}
11161 !! html/php+tidy
11162 <p>ha</p>
11163 <p>ho</p>
11164 <table>
11165 <tr>
11166 <td></td>
11167 </tr>
11168 <tr>
11169 <td>hi</td>
11170 </tr>
11171 </table>
11172 <table>
11173 <tr>
11174 <td></td>
11175 </tr>
11176 </table>
11177 !! html/parsoid
11178 <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":""}]]}'>
11179
11180 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11181
11182 <tbody><tr><td>hi</td></tr>
11183 </tbody></table>
11184 !! end
11185
11186 !! article
11187 Template:MSGNW test
11188 !! text
11189 ''None'' of '''this''' should be
11190 * interpreted
11191 but rather passed unmodified
11192 {{test}}
11193 <gallery>
11194 File:Foobar.jpg
11195 </gallery>
11196 <!-- comment -->
11197 !! endarticle
11198
11199 # hmm, fix this or just deprecate msgnw and document its behavior?
11200 !! test
11201 msgnw keyword
11202 !! wikitext
11203 {{msgnw:MSGNW test}}
11204 !! html/php
11205 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11206 &#42; interpreted
11207 &#32;but rather passed unmodified
11208 &#123;&#123;test&#125;&#125;
11209 &#60;gallery&#62;
11210 File:Foobar.jpg
11211 &#60;/gallery&#62;
11212 &#60;!-- comment --&#62;
11213 </p>
11214 !! end
11215
11216 !! test
11217 int keyword
11218 !! wikitext
11219 {{int:youhavenewmessages|lots of money|not!}}
11220 !! html
11221 <p>You have lots of money (not!).
11222 </p>
11223 !! end
11224
11225 !! test
11226 int keyword - non-existing message
11227 !! wikitext
11228 {{int:var}}
11229 !! html
11230 <p>⧼var⧽
11231 </p>
11232 !! end
11233
11234 !! article
11235 Template:Includes
11236 !! text
11237 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11238 !! endarticle
11239
11240 !! test
11241 <includeonly> and <noinclude> being included
11242 !! wikitext
11243 {{Includes}}
11244 !! html
11245 <p>Foobar
11246 </p>
11247 !! end
11248
11249 !! article
11250 Template:Includes2
11251 !! text
11252 <onlyinclude>Foo</onlyinclude>bar
11253 !! endarticle
11254
11255 !! test
11256 <onlyinclude> being included
11257 !! wikitext
11258 {{Includes2}}
11259 !! html
11260 <p>Foo
11261 </p>
11262 !! end
11263
11264
11265 !! article
11266 Template:Includes3
11267 !! text
11268 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11269 !! endarticle
11270
11271 !! test
11272 <onlyinclude> and <includeonly> being included
11273 !! wikitext
11274 {{Includes3}}
11275 !! html
11276 <p>Foo
11277 </p>
11278 !! end
11279
11280 !! test
11281 <includeonly> and <noinclude> on a page
11282 !! wikitext
11283 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11284 !! html
11285 <p>Foozar
11286 </p>
11287 !! end
11288
11289 !! test
11290 Un-closed <noinclude>
11291 !! wikitext
11292 <noinclude>
11293 !! html
11294 !! end
11295
11296 !! test
11297 <onlyinclude> on a page
11298 !! wikitext
11299 <onlyinclude>Foo</onlyinclude>bar
11300 !! html
11301 <p>Foobar
11302 </p>
11303 !! end
11304
11305 !! test
11306 Un-closed <onlyinclude>
11307 !! wikitext
11308 <onlyinclude>
11309 !! html
11310 !! end
11311
11312 !!test
11313 Self-closed noinclude, includeonly, onlyinclude tags
11314 !! wikitext
11315 <noinclude />
11316 <includeonly />
11317 <onlyinclude />
11318 !! html
11319 <p><br />
11320 </p>
11321 !!end
11322
11323 !!test
11324 Unbalanced includeonly and noinclude tags
11325 !! wikitext
11326 {|
11327 |a</noinclude>
11328 |b</noinclude></noinclude>
11329 |c</noinclude></includeonly>
11330 |d</includeonly></includeonly>
11331 |}
11332 !! html
11333 <table>
11334 <tr>
11335 <td>a
11336 </td>
11337 <td>b
11338 </td>
11339 <td>c&lt;/includeonly&gt;
11340 </td>
11341 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11342 </td></tr></table>
11343
11344 !!end
11345
11346 !! article
11347 Template:Includeonly section
11348 !! text
11349 <includeonly>
11350 ==Includeonly section==
11351 </includeonly>
11352 ==Section T-1==
11353 !!endarticle
11354
11355 !! test
11356 Bug 6563: Edit link generation for section shown by <includeonly>
11357 !! wikitext
11358 {{includeonly section}}
11359 !! html
11360 <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>
11361 <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>
11362
11363 !! end
11364
11365 # Uses same input as the contents of [[Template:Includeonly section]]
11366 !! test
11367 Bug 6563: Section extraction for section shown by <includeonly>
11368 !! options
11369 section=T-2
11370 !! wikitext
11371 <includeonly>
11372 ==Includeonly section==
11373 </includeonly>
11374 ==Section T-2==
11375 !! html
11376 ==Section T-2==
11377 !! end
11378
11379 !! test
11380 Bug 6563: Edit link generation for section suppressed by <includeonly>
11381 !! wikitext
11382 <includeonly>
11383 ==Includeonly section==
11384 </includeonly>
11385 ==Section 1==
11386 !! html
11387 <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>
11388
11389 !! end
11390
11391 !! test
11392 Bug 6563: Section extraction for section suppressed by <includeonly>
11393 !! options
11394 section=1
11395 !! wikitext
11396 <includeonly>
11397 ==Includeonly section==
11398 </includeonly>
11399 ==Section 1==
11400 !! html
11401 ==Section 1==
11402 !! end
11403
11404 !! test
11405 Un-closed <includeonly>
11406 !! wikitext
11407 <includeonly>
11408 !! html/php
11409 !! html/parsoid
11410 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11411 !! end
11412
11413 ## We used to, but no longer wt2wt this test since the default serializer
11414 ## will normalize the include directives to serialize on their own line.
11415 ## Selser will take care of preserving formatting in scenarios where they
11416 ## intermingled with other wikitext.
11417 !! test
11418 Includes and comments at SOL
11419 !! options
11420 parsoid=wt2html,html2html
11421 !! wikitext
11422 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11423
11424 <noinclude>
11425 some
11426 </noinclude>* stuff
11427 * here
11428
11429 <includeonly>can have stuff</includeonly>=== here ===
11430
11431 !! html/php
11432 <h2><span class="mw-headline" id="hu">hu</span></h2>
11433 <p>some
11434 </p>
11435 <ul><li> stuff</li>
11436 <li> here</li></ul>
11437 <h3><span class="mw-headline" id="here">here</span></h3>
11438
11439 !! html/parsoid
11440 <!-- 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>
11441
11442 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11443 <p>some</p>
11444 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11445 <li> here</li></ul>
11446
11447 <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>
11448
11449 !! end
11450
11451 # TODO: test with DOM fragment reuse!
11452 !! test
11453 Parsoid: DOM fragment reuse
11454 !! options
11455 parsoid=wt2wt,wt2html
11456 !! wikitext
11457 a{{echo|b<table></table>c}}d
11458
11459 a{{echo|b
11460 <table></table>
11461 c}}d
11462
11463 {{echo|a
11464
11465 <table></table>
11466
11467 b}}
11468 !! html
11469 <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>
11470
11471 <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">
11472 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11473 </span><p about="#mwt2">cd</p>
11474
11475 <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">
11476
11477 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11478
11479 </span><p about="#mwt3">b</p>
11480 !! end
11481
11482 !! test
11483 Parsoid: Merge double tds (T52603)
11484 !! options
11485 parsoid
11486 !! wikitext
11487 {|
11488 |{{echo|{{!}} foo}}
11489 |}
11490 !! html
11491 <table><tbody>
11492 <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>
11493 </tbody></table>
11494 !! end
11495
11496 !! test
11497 Parsoid: Merge double tds in nested transclusion content (T52603)
11498 !! options
11499 parsoid
11500 !! wikitext
11501 {{echo|<div>}}
11502 {|
11503 |{{echo|{{!}} foo}}
11504 |}
11505 {{echo|</div>}}
11506 !! html
11507 <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}}]}'>
11508 <table><tbody>
11509 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11510 </tbody></table>
11511 </div>
11512 !! end
11513
11514 ###
11515 ### <includeonly> and <noinclude> in attributes
11516 ###
11517 !!test
11518 0. includeonly around the entire attribute
11519 !! wikitext
11520 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11521 !! html
11522 <p><span id="v2">bar</span>
11523 </p>
11524 !!end
11525
11526 !!test
11527 1. includeonly in html attr key
11528 !! wikitext
11529 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11530 !! html
11531 <p><span id="foo">bar</span>
11532 </p>
11533 !!end
11534
11535 !!test
11536 2. includeonly in html attr value
11537 !! wikitext
11538 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11539 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11540 !! html
11541 <p><span id="v1">bar</span>
11542 <span id="v1">bar</span>
11543 </p>
11544 !!end
11545
11546 !!test
11547 3. includeonly in part of an attr value
11548 !! wikitext
11549 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11550 !! html
11551 <p><span style="color:red;">bar</span>
11552 </p>
11553 !!end
11554
11555 !!test
11556 4. includeonly in table attributes
11557 !! wikitext
11558 {|
11559 |- <noinclude>
11560 |-
11561 |a
11562 </noinclude>
11563 |- <includeonly>
11564 |-
11565 |b
11566 </includeonly>
11567 |}
11568 !! html
11569 <table>
11570
11571
11572 <tr>
11573 <td>a
11574 </td></tr>
11575 </table>
11576
11577 !!end
11578
11579 ###
11580 ### Token Stream Patcher tests
11581 ###
11582 ### These tests won't always pass wt2wt and other modes because
11583 ### on serialization, the table will be output on a new line.
11584 ### For now, we are blacklisting them, and using this to test selser.
11585 ###
11586
11587 !!test
11588 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11589 !!options
11590 parsoid=wt2html,wt2wt
11591 !!wikitext
11592 {{echo|}}{| width = '100%'
11593 |foo
11594 |}
11595 !!html/parsoid
11596 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11597 <tbody><tr><td>foo</td></tr>
11598 </tbody></table>
11599 !!end
11600
11601 ## We used to, but no longer wt2wt this test since the default serializer
11602 ## will normalize the include directives to serialize on their own line.
11603 ## Selser will take care of preserving formatting in scenarios where they
11604 ## intermingled with other wikitext.
11605 !!test
11606 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11607 !!options
11608 parsoid=wt2html
11609 !!wikitext
11610 <includeonly>a</includeonly>{| {{{b}}}
11611 |c
11612 |}
11613 !!html/parsoid
11614 <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;{\"dsr\":[31,38,null,null],\"src\":\"{{{b}}}\"}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
11615 <tbody><tr><td>c</td></tr>
11616 </tbody></table>
11617 !!end
11618
11619 !! test
11620 Table wikitext syntax outside wiki-tables
11621 !! wikitext
11622 a
11623 |+ not a caption
11624 ! not a table heading
11625 |- not a table row
11626 | not a table cell
11627 | class="foo bar" | baz
11628 b
11629 |}
11630 |-
11631 c
11632 !! html
11633 <p>a
11634 |+ not a caption
11635 ! not a table heading
11636 |- not a table row
11637 | not a table cell
11638 | class="foo bar" | baz
11639 b
11640 |}
11641 |-
11642 c
11643 </p>
11644 !! end
11645
11646 ###
11647 ### Testing parsing of templates where a template arg
11648 ### has the same name as the template itself.
11649 ###
11650
11651 !! article
11652 Template:quote
11653 !! text
11654 {{{quote|{{{1}}}}}}
11655 !! endarticle
11656
11657 !!test
11658 Templates: Template Name/Arg clash: 1. Use of positional param
11659 !! wikitext
11660 {{quote|foo}}
11661 !! html
11662 <p>foo
11663 </p>
11664 !!end
11665
11666 !!test
11667 Templates: Template Name/Arg clash: 2. Use of named param
11668 !! wikitext
11669 {{quote|quote=foo}}
11670 !! html
11671 <p>foo
11672 </p>
11673 !!end
11674
11675 !!test
11676 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11677 !! wikitext
11678 {{quote|quote}}
11679 !! html
11680 <p>quote
11681 </p>
11682 !!end
11683
11684 ###
11685 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11686 ###
11687
11688 !!test
11689 Templates: 1. Simple use
11690 !! wikitext
11691 {{echo|Foo}}
11692 !! html
11693 <p>Foo
11694 </p>
11695 !!end
11696
11697 !!test
11698 Templates: 2. Inside a block tag
11699 !! wikitext
11700 <div>{{echo|Foo}}</div>
11701 <blockquote>{{echo|Foo}}</blockquote>
11702 !! html
11703 <div>Foo</div>
11704 <blockquote>Foo</blockquote>
11705
11706 !! html+tidy
11707 <div>Foo</div>
11708 <blockquote>
11709 <p>Foo</p>
11710 </blockquote>
11711 !!end
11712
11713 !!test
11714 Templates: P-wrapping: 1a. Templates on consecutive lines
11715 !! wikitext
11716 {{echo|Foo}}
11717 {{echo|bar}}
11718 !! html
11719 <p>Foo
11720 bar
11721 </p>
11722 !!end
11723
11724 !!test
11725 Templates: P-wrapping: 1b. Templates on consecutive lines
11726 !! wikitext
11727 Foo
11728
11729 {{echo|bar}}
11730 {{echo|baz}}
11731 !! html
11732 <p>Foo
11733 </p><p>bar
11734 baz
11735 </p>
11736 !!end
11737
11738 !!test
11739 Templates: P-wrapping: 1c. Templates on consecutive lines
11740 !! wikitext
11741 {{echo|Foo}}
11742 {{echo|bar}} <div>baz</div>
11743 !! html
11744 <p>Foo
11745 </p>
11746 bar <div>baz</div>
11747
11748 !! html+tidy
11749 <p>Foo</p>
11750 <p>bar</p>
11751 <div>baz</div>
11752 !! end
11753
11754 !!test
11755 Templates: P-wrapping: 1d. Template preceded by comment-only line
11756 !!options
11757 parsoid
11758 !! wikitext
11759 <!-- foo -->
11760 {{echo|Bar}}
11761 !! html
11762 <!-- foo -->
11763
11764 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11765 !!end
11766
11767 !!test
11768 Templates: Inline Text: 1. Multiple template uses
11769 !! wikitext
11770 {{echo|Foo}}bar{{echo|baz}}
11771 !! html
11772 <p>Foobarbaz
11773 </p>
11774 !!end
11775
11776 !!test
11777 Templates: Inline Text: 2. Back-to-back template uses
11778 !! wikitext
11779 {{echo|Foo}}{{echo|bar}}
11780 !! html
11781 <p>Foobar
11782 </p>
11783 !!end
11784
11785 !!test
11786 Templates: Block Tags: 1. Multiple template uses
11787 !! wikitext
11788 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11789 !! html
11790 <div>Foo</div><div>bar</div><div>baz</div>
11791
11792 !!end
11793
11794 !!test
11795 Templates: Block Tags: 2. Back-to-back template uses
11796 !! wikitext
11797 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11798 !! html
11799 <div>Foo</div><div>bar</div>
11800
11801 !!end
11802
11803 # This is an edge case relating to paragraph wrapping.
11804 !!test
11805 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11806 !! wikitext
11807 {{echo|a
11808 b</p>}}
11809 !! html/parsoid
11810 <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
11811 b</p>
11812 !!end
11813
11814 !!test
11815 Templates: Links: 1. Simple example
11816 !! wikitext
11817 {{echo|[[Foo|bar]]}}
11818 !! html
11819 <p><a href="/wiki/Foo" title="Foo">bar</a>
11820 </p>
11821 !!end
11822
11823 !!test
11824 Templates: Links: 2. Generation of link href
11825 !! wikitext
11826 [[{{echo|Foo}}|bar]]
11827 !! html
11828 <p><a href="/wiki/Foo" title="Foo">bar</a>
11829 </p>
11830 !!end
11831
11832 !!test
11833 Templates: Links: 3. Generation of part of a link href
11834 !! wikitext
11835 [[Fo{{echo|o}}|bar]]
11836
11837 [[Foo{{echo|bar}}]]
11838
11839 [[Foo{{echo|bar}}baz]]
11840
11841 [[Foo{{echo|bar}}|bar]]
11842
11843 [[:Foo{{echo|bar}}]]
11844
11845 [[:Foo{{echo|bar}}|bar]]
11846 !! html
11847 <p><a href="/wiki/Foo" title="Foo">bar</a>
11848 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11849 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11850 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11851 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11852 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11853 </p>
11854 !!end
11855
11856 !!test
11857 Templates: Links: 4. Multiple templates generating link href
11858 !! wikitext
11859 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11860 !! html
11861 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11862 </p>
11863 !!end
11864
11865 !!test
11866 Templates: Links: 5. Generation of link text
11867 !! wikitext
11868 [[Foo|{{echo|bar}}]]
11869 !! html
11870 <p><a href="/wiki/Foo" title="Foo">bar</a>
11871 </p>
11872 !!end
11873
11874 !!test
11875 Templates: Links: 5. Nested templates (only outermost template should be marked)
11876 !! wikitext
11877 {{echo|[[{{echo|Foo}}|bar]]}}
11878 !! html
11879 <p><a href="/wiki/Foo" title="Foo">bar</a>
11880 </p>
11881 !!end
11882
11883 !!test
11884 Templates: HTML Tag: 1. Generation of HTML attr. key
11885 !! wikitext
11886 <div {{echo|style}}="color:red;">foo</div>
11887 !! html
11888 <div style="color:red;">foo</div>
11889
11890 !!end
11891
11892 !!test
11893 Templates: HTML Tag: 2. Generation of HTML attr. value
11894 !! wikitext
11895 <div style={{echo|'color:red;'}}>foo</div>
11896 !! html
11897 <div style="color:red;">foo</div>
11898
11899 !!end
11900
11901 !!test
11902 Templates: HTML Tag: 3. Generation of HTML attr key and value
11903 !! wikitext
11904 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11905 !! html
11906 <div style="color:red;">foo</div>
11907
11908 !!end
11909
11910 !!test
11911 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11912 !! wikitext
11913 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11914 !! html
11915 <div title="This is a long title with just one piece templated">foo</div>
11916
11917 !!end
11918
11919 !!test
11920 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11921 !! wikitext
11922 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11923 !! html
11924 <div title="This is a long title with just one piece templated">foo</div>
11925
11926 !!end
11927
11928 !!test
11929 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11930 !! wikitext
11931 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11932 !! html
11933 <div title="This is a long title with just one piece templated">foo</div>
11934
11935 !!end
11936
11937 # SSS FIXME: While it is great we added support for all this,
11938 # do we want to make this part of the spec? Maybe we want to
11939 # deprecate this kind of usage in the future?
11940 !!test
11941 Templates: HTML Tag: 7. Generation of partial attribute key string
11942 !! wikitext
11943 <div st{{echo|yle}}="color:red;">foo</div>
11944 !! html
11945 <div style="color:red;">foo</div>
11946
11947 !!end
11948
11949 !! test
11950 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11951 !! wikitext
11952 <div {{echo|1=id="v1"}}>bar</div>
11953 !! html
11954 <div id="v1">bar</div>
11955
11956 !!end
11957
11958 !! test
11959 Templates: HTML Tag: 9. Multiple template-generated attributes
11960 !! wikitext
11961 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11962 !! html
11963 <div id="v1" title="foo">bar</div>
11964
11965 !!end
11966
11967 !! test
11968 Templates: Support for templates generating attributes and content
11969 !! wikitext
11970 {| {{mixed_attr_content_template}}
11971 |-
11972 |bar
11973 |}
11974 !! html/php
11975 <table style="color:red;" title="T48811">
11976
11977 <tr>
11978 <td>foo
11979 </td></tr>
11980 <tr>
11981 <td>bar
11982 </td></tr></table>
11983
11984 !! html/parsoid
11985 <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|}"]}'>
11986 <tbody><tr>
11987 <td>foo</td></tr>
11988 <tr>
11989 <td>bar</td></tr>
11990 </tbody></table>
11991 !!end
11992
11993 !! test
11994 1. Entities and nowikis inside templated attributes should be handled correctly
11995 !! wikitext
11996 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11997 !! html/php
11998 <div style="background:#f9f9f9;">foo</div>
11999
12000 !! html/parsoid
12001 <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>
12002 !! end
12003
12004 !! test
12005 2. Entities and nowikis inside templated attributes should be handled correctly
12006 !! wikitext
12007 {|
12008 |{{table_attribs_3}}
12009 |}
12010 !! html/php
12011 <table>
12012 <tr>
12013 <td style="background:#f9f9f9;">Foo
12014 </td></tr></table>
12015
12016 !! html/parsoid
12017 <table>
12018 <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>
12019 </tbody></table>
12020 !! end
12021
12022 !! test
12023 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12024 !! wikitext
12025 {{tbl-start}}
12026 |{{table_attribs_3}}
12027 {{tbl-end}}
12028 !! html/php
12029 <table>
12030 <tr>
12031 <td style="background:#f9f9f9;">Foo
12032 </td></tr></table>
12033
12034 !! html/parsoid
12035 <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}}]}'>
12036 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12037 </tbody></table>
12038 !! end
12039
12040 # T107622
12041 !! test
12042 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12043 !! wikitext
12044 {|
12045 | {{table_attribs_6}} hi
12046 |}
12047 !! html/php
12048 <table>
12049 <tr>
12050 <td style="background: red;"> hi
12051 </td></tr></table>
12052
12053 !! html/parsoid
12054 <table>
12055 <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>
12056 </tbody></table>
12057 !! end
12058
12059 !!test
12060 Templates: HTML Tables: 1. Generating start of a HTML table
12061 !! wikitext
12062 {{echo|<table><tr><td>foo</td>}}</tr></table>
12063 !! html
12064 <table><tr><td>foo</td></tr></table>
12065
12066 !!end
12067
12068 !!test
12069 Templates: HTML Tables: 2a. Generating middle of a HTML table
12070 !! wikitext
12071 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12072 !! html
12073 <table><tr><td>foo</td></tr></table>
12074
12075 !!end
12076
12077 !!test
12078 Templates: HTML Tables: 2b. Generating middle of a HTML table
12079 !! wikitext
12080 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12081 !! html
12082 <table><tr><td>foo</td></tr></table>
12083
12084 !!end
12085
12086 !!test
12087 Templates: HTML Tables: 3. Generating end of a HTML table
12088 !! wikitext
12089 <table><tr>{{echo|<td>foo</td></tr></table>}}
12090 !! html
12091 <table><tr><td>foo</td></tr></table>
12092
12093 !!end
12094
12095 !!test
12096 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12097 !! wikitext
12098 {{echo|<table>}}<tr><td>foo</td></tr></table>
12099 !! html
12100 <table><tr><td>foo</td></tr></table>
12101
12102 !!end
12103
12104 !!test
12105 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12106 !! wikitext
12107 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12108 !! html
12109 <table><tr><td>foo</td></tr></table>
12110
12111 !!end
12112
12113 !!test
12114 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12115 !! wikitext
12116 <table><tr>{{echo|<td>}}foo</td></tr></table>
12117 !! html
12118 <table><tr><td>foo</td></tr></table>
12119
12120 !!end
12121
12122 !!test
12123 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12124 !! wikitext
12125 <table><tr><td>foo{{echo|</td>}}</tr></table>
12126 !! html
12127 <table><tr><td>foo</td></tr></table>
12128
12129 !!end
12130
12131 !!test
12132 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12133 !! wikitext
12134 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12135 !! html
12136 <table><tr><td>foo</td></tr></table>
12137
12138 !!end
12139
12140 !!test
12141 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12142 !! wikitext
12143 <table><tr><td>foo</td></tr>{{echo|</table>}}
12144 !! html
12145 <table><tr><td>foo</td></tr></table>
12146
12147 !!end
12148
12149 !!test
12150 Templates: HTML Tables: 5. Proper fostering of categories from inside
12151 !!options
12152 parsoid=wt2html,wt2wt
12153 !! wikitext
12154 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12155 <!--Two categories (Bug 50330)-->
12156 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12157 !! html
12158 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12159 <!--Two categories (Bug 50330)-->
12160 <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>
12161 !!end
12162
12163 !!test
12164 Templates: Wiki Tables: 1a. Fostering of entire template content
12165 !! wikitext
12166 {|
12167 {{echo|a}}
12168 |}
12169 !! html
12170 <table>
12171 a
12172 <tr><td></td></tr></table>
12173
12174 !! html+tidy
12175 <p>a</p>
12176 <table>
12177 <tr>
12178 <td></td>
12179 </tr>
12180 </table>
12181 !! end
12182
12183 !!test
12184 Templates: Wiki Tables: 1b. Fostering of entire template content
12185 !! wikitext
12186 {|
12187 {{echo|<div>}}
12188 foo
12189 {{echo|</div>}}
12190 |}
12191 !! html
12192 <table>
12193 <div>
12194 <p>foo
12195 </p>
12196 </div>
12197 <tr><td></td></tr></table>
12198
12199 !! html+tidy
12200 <div>
12201 <p>foo</p>
12202 </div>
12203 <table>
12204 <tr>
12205 <td></td>
12206 </tr>
12207 </table>
12208 !! end
12209
12210 !!test
12211 Templates: Wiki Tables: 2. Fostering of partial template content
12212 !! wikitext
12213 {|
12214 {{echo|a
12215 <div>b</div>}}
12216 |}
12217 !! html
12218 <table>
12219 a
12220 <div>b</div>
12221 <tr><td></td></tr></table>
12222
12223 !! html+tidy
12224 <p>a</p>
12225 <div>b</div>
12226 <table>
12227 <tr>
12228 <td></td>
12229 </tr>
12230 </table>
12231 !! end
12232
12233 !!test
12234 Templates: Wiki Tables: 3. td-content via multiple templates
12235 !! wikitext
12236 {|
12237 {{echo|{{pipe}}a}}{{echo|b}}
12238 |}
12239 !! html
12240 <table>
12241 <tr>
12242 <td>ab
12243 </td></tr></table>
12244
12245 !!end
12246
12247 !!test
12248 Templates: Wiki Tables: 4. Templated tags, no content
12249 !! wikitext
12250 {{tbl-start}}
12251 {{tbl-end}}
12252 !! html
12253 <table>
12254 <tr><td></td></tr></table>
12255
12256 !!end
12257
12258 !!test
12259 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12260 !! wikitext
12261 {{tbl-start}}
12262 |foo
12263 {{tbl-end}}
12264 !! html
12265 <table>
12266 <tr>
12267 <td>foo
12268 </td></tr></table>
12269
12270 !!end
12271
12272 !!test
12273 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12274 !! wikitext
12275 {{tbl-start}}
12276 {{!}}foo
12277 {{tbl-end}}
12278 !! html
12279 <table>
12280 <tr>
12281 <td>foo
12282 </td></tr></table>
12283
12284 !!end
12285
12286 ## This test case is very specific to Parsoid's internals
12287 ## and is hence only tested for Parsoid's code. Parsoid uses
12288 ## a <meta> marker tag for <ref> tags and they are expanded
12289 ## much later. We are verifying that this <meta> tag usage
12290 ## doesn't prevent foster parenting.
12291 !!test
12292 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12293 !!wikitext
12294 {{PartialTable}}<ref>foo</ref>
12295 |}
12296
12297 <references />
12298 !!html/parsoid
12299 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span><table about="#mwt2">
12300 <tbody>
12301 </tbody></table>
12302
12303 <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="#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>
12304 !!end
12305
12306 !! test
12307 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12308 !! wikitext
12309 {{echo|
12310 {{{!}}
12311 {{!}}-}}
12312 <onlyinclude>
12313 |foo
12314 </onlyinclude>
12315 {{!}}}
12316 !! html/parsoid
12317 <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{{!}}}"]}'>
12318 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12319 <tbody><tr>
12320
12321 <td>foo
12322 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12323 </tbody></table>
12324 !! end
12325
12326 !!test
12327 Templates: Lists: Multi-line list-items via templates
12328 !! wikitext
12329 *{{echo|a {{nonexistent|
12330 unused}}}}
12331 *{{echo|b {{nonexistent|
12332 unused}}}}
12333 !! html
12334 <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>
12335 <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>
12336
12337 !!end
12338
12339 !!test
12340 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12341 !! wikitext
12342 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12343 !! html
12344 <p><i>ab</i>c<i>d</i>e
12345 </p>
12346 !!end
12347
12348 !!test
12349 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12350 (PHP parser generates misnested html)
12351 !! wikitext
12352 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12353 !! html/parsoid
12354 <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>
12355 !!end
12356
12357 !!test
12358 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12359 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12360 !! options
12361 parsoid=wt2html,wt2wt
12362 !! wikitext
12363 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12364 !! html
12365 <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>
12366 <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>
12367 <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>
12368 !!end
12369
12370 !!test
12371 Templates: Ugly nesting: 4. Divs opened/closed across templates
12372 !! wikitext
12373 a<div>b{{echo|c</div>d}}e
12374 !! html
12375 a<div>bc</div>de
12376
12377 !! html+tidy
12378 <p>a</p>
12379 <div>bc</div>
12380 <p>de</p>
12381 !! end
12382
12383 !!test
12384 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12385 (Parsoid-centric)
12386 !! options
12387 parsoid
12388 !! wikitext
12389 {|
12390 |{{echo|foo</table>}}
12391 |bar
12392 |}
12393 !! html
12394 <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|}"]}'>
12395
12396 <tbody>
12397 <tr>
12398 <td>foo</td></tr></tbody></table><span about="#mwt1">
12399 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12400 |}</span>
12401 !!end
12402
12403 !!test
12404 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12405 (Parsoid-centric)
12406 !! options
12407 parsoid
12408 !! wikitext
12409 <table>
12410 <tr>
12411 <td>
12412 <table>
12413 <tr>
12414 <td>1. {{echo|foo </table>}}</td>
12415 <td> bar </td>
12416 <td>2. {{echo|baz </table>}}</td>
12417 </tr>
12418 <tr>
12419 <td>abc</td>
12420 </tr>
12421 </table>
12422 </td>
12423 </tr>
12424 <tr>
12425 <td>xyz</td>
12426 </tr>
12427 </table>
12428 !! html
12429 <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>"]}'>
12430 <tbody><tr>
12431 <td>
12432 <table>
12433 <tbody><tr>
12434 <td>1. foo </td></tr></tbody></table></td>
12435 <td> bar </td>
12436 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12437 </span><span about="#mwt2">
12438 </span><span about="#mwt2">
12439 </span><span about="#mwt2">abc</span><span about="#mwt2">
12440 </span><span about="#mwt2">
12441 </span><span about="#mwt2">
12442 </span><span about="#mwt2">
12443 </span><span about="#mwt2">
12444 </span><span about="#mwt2">
12445 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12446 </span><span about="#mwt2">
12447 </span>
12448 !!end
12449
12450 !! test
12451 Templates: Ugly templates: 3. newline-only template parameter
12452 !! wikitext
12453 foo {{echo|
12454 }}
12455 !! html
12456 <p>foo
12457 </p>
12458 !! end
12459
12460 # This looks like a bug: a single newline triggers p/br for some reason.
12461 !! test
12462 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12463 !! wikitext
12464 {{echo|
12465 }}
12466 !! html
12467 <p><br />
12468 </p>
12469 !! end
12470
12471 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12472 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12473 !! test
12474 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12475 !! wikitext
12476 {{echo|<table>}}
12477 {{echo|<div>foo}}
12478 {{echo|</table>}}
12479 !! html/parsoid
12480 <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
12481 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12482 </table>
12483 !! end
12484
12485 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12486 # that are "identical" and generate nesting cycles in the algorithm
12487 !! test
12488 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12489 !! wikitext
12490 {{echo|<table><tr><td><table>}}
12491 {{echo|<div>}}
12492 {{echo|</div>}}
12493 !! html/parsoid
12494 <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"}'>
12495 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12496 </table></td></tr></tbody></table>
12497 !! end
12498
12499 !! test
12500 Templates: Parameters substituted at the top-level
12501 !! wikitext
12502 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12503 !! html/php
12504 <p><i>who</i> me? <b>never!</b>
12505 </p>
12506 !! html/parsoid
12507 <p about="#mwt2" typeof="mw:Param" data-parsoid="{&quot;src&quot;:&quot;{{{foo|''who'' {{echo|me}}? '''never!'''}}}&quot;}"><i>who</i> me? <b>never!</b></p>
12508 !! end
12509
12510 !!test
12511 Parser Functions: 1. Simple example
12512 !! wikitext
12513 {{uc:foo}}
12514 !! html
12515 <p>FOO
12516 </p>
12517 !!end
12518
12519 !!test
12520 Parser Functions: 2. Nested use (only outermost should be marked up)
12521 !! wikitext
12522 {{uc:{{lc:FOO}}}}
12523 !! html
12524 <p>FOO
12525 </p>
12526 !!end
12527
12528 ###
12529 ### Pre-save transform tests
12530 ###
12531 !! test
12532 pre-save transform: subst:
12533 !! options
12534 pst
12535 !! wikitext
12536 {{subst:test}}
12537 !! html/php
12538 This is a test template
12539 !! end
12540
12541 !! test
12542 pre-save transform: normal template
12543 !! options
12544 pst
12545 !! wikitext
12546 {{test}}
12547 !! html/php
12548 {{test}}
12549 !! end
12550
12551 !! test
12552 pre-save transform: nonexistent template
12553 !! options
12554 pst
12555 !! wikitext
12556 {{thistemplatedoesnotexist}}
12557 !! html/php
12558 {{thistemplatedoesnotexist}}
12559 !! end
12560
12561 !! test
12562 pre-save transform: subst magic variables
12563 !! options
12564 pst
12565 !! wikitext
12566 {{subst:SITENAME}}
12567 !! html/php
12568 MediaWiki
12569 !! end
12570
12571 # This is bug 89, which I fixed. -- wtm
12572 !! test
12573 pre-save transform: subst: templates with parameters
12574 !! options
12575 pst
12576 !! wikitext
12577 {{subst:paramtest|param="something else"}}
12578 !! html/php
12579 This is a test template with parameter "something else"
12580 !! end
12581
12582 !! article
12583 Template:nowikitest
12584 !! text
12585 <nowiki>'''not wiki'''</nowiki>
12586 !! endarticle
12587
12588 !! test
12589 pre-save transform: nowiki in subst (bug 1188)
12590 !! options
12591 pst
12592 !! wikitext
12593 {{subst:nowikitest}}
12594 !! html/php
12595 <nowiki>'''not wiki'''</nowiki>
12596 !! end
12597
12598 !! article
12599 Template:commenttest
12600 !! text
12601 This template has <!-- a comment --> in it.
12602 !! endarticle
12603
12604 !! test
12605 pre-save transform: comment in subst (bug 1936)
12606 !! options
12607 pst
12608 !! wikitext
12609 {{subst:commenttest}}
12610 !! html/php
12611 This template has <!-- a comment --> in it.
12612 !! end
12613
12614 !! test
12615 pre-save transform: unclosed tag
12616 !! options
12617 pst
12618 !! wikitext
12619 <nowiki>'''not wiki'''
12620 !! html/php
12621 <nowiki>'''not wiki'''
12622 !! end
12623
12624 !! test
12625 pre-save transform: mixed tag case
12626 !! options
12627 pst
12628 !! wikitext
12629 <NOwiki>'''not wiki'''</noWIKI>
12630 !! html/php
12631 <NOwiki>'''not wiki'''</noWIKI>
12632 !! end
12633
12634 !! test
12635 pre-save transform: unclosed comment in <nowiki>
12636 !! options
12637 pst
12638 !! wikitext
12639 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12640 !! html/php
12641 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12642 !!end
12643
12644 # Leading @ in this template definition works around a limitation
12645 # in parsoid's parserTests which otherwise strips the <span> from the
12646 # result (confusing it for a template wrapper)
12647 !! article
12648 Template:dangerous
12649 !!text
12650 @<span onmouseover="alert('crap')">Oh no</span>
12651 !!endarticle
12652
12653 !!test
12654 (confirming safety of fix for subst bug 1936)
12655 !! wikitext
12656 {{Template:dangerous}}
12657 !! html
12658 <p>@<span>Oh no</span>
12659 </p>
12660 !! end
12661
12662 !! test
12663 pre-save transform: comment containing gallery (bug 5024)
12664 !! options
12665 pst
12666 !! wikitext
12667 <!-- <gallery>data</gallery> -->
12668 !! html/php
12669 <!-- <gallery>data</gallery> -->
12670 !!end
12671
12672 !! test
12673 pre-save transform: comment containing extension
12674 !! options
12675 pst
12676 !! wikitext
12677 <!-- <tag>data</tag> -->
12678 !! html/php
12679 <!-- <tag>data</tag> -->
12680 !!end
12681
12682 !! test
12683 pre-save transform: comment containing nowiki
12684 !! options
12685 pst
12686 !! wikitext
12687 <!-- <nowiki>data</nowiki> -->
12688 !! html/php
12689 <!-- <nowiki>data</nowiki> -->
12690 !!end
12691
12692 !! test
12693 pre-save transform: <noinclude> in subst (bug 3298)
12694 !! options
12695 pst
12696 !! wikitext
12697 {{subst:Includes}}
12698 !! html/php
12699 Foobar
12700 !! end
12701
12702 !! test
12703 pre-save transform: <onlyinclude> in subst (bug 3298)
12704 !! options
12705 pst
12706 !! wikitext
12707 {{subst:Includes2}}
12708 !! html/php
12709 Foo
12710 !! end
12711
12712 !! article
12713 Template:SubstTest
12714 !!text
12715 {{<includeonly>subst:</includeonly>Includes}}
12716 !! endarticle
12717
12718 !! article
12719 Template:SafeSubstTest
12720 !! text
12721 {{<includeonly>safesubst:</includeonly>Includes}}
12722 !! endarticle
12723
12724 !! test
12725 bug 22297: safesubst: works during PST
12726 !! options
12727 pst
12728 !! wikitext
12729 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12730 !! html/php
12731 FoobarFoobar
12732 !! end
12733
12734 !! test
12735 bug 22297: safesubst: works during normal parse
12736 !! wikitext
12737 {{SafeSubstTest}}
12738 !! html
12739 <p>Foobar
12740 </p>
12741 !! end
12742
12743 !! test
12744 subst: does not work during normal parse
12745 !! wikitext
12746 {{SubstTest}}
12747 !! html
12748 <p>{{subst:Includes}}
12749 </p>
12750 !! end
12751
12752 !! test
12753 pre-save transform: context links ("pipe trick")
12754 !! options
12755 pst
12756 !! wikitext
12757 [[Article (context)|]]
12758 [[Bar:Article|]]
12759 [[:Bar:Article|]]
12760 [[Bar:Article (context)|]]
12761 [[:Bar:Article (context)|]]
12762 [[|Article]]
12763 [[|Article (context)]]
12764 [[Bar:X (Y) Z|]]
12765 [[:Bar:X (Y) Z|]]
12766 !! html/php
12767 [[Article (context)|Article]]
12768 [[Bar:Article|Article]]
12769 [[:Bar:Article|Article]]
12770 [[Bar:Article (context)|Article]]
12771 [[:Bar:Article (context)|Article]]
12772 [[Article]]
12773 [[Article (context)]]
12774 [[Bar:X (Y) Z|X (Y) Z]]
12775 [[:Bar:X (Y) Z|X (Y) Z]]
12776 !! end
12777
12778 !! test
12779 pre-save transform: context links ("pipe trick") with interwiki prefix
12780 !! options
12781 pst
12782 !! wikitext
12783 [[interwiki:Article|]]
12784 [[:interwiki:Article|]]
12785 [[interwiki:Bar:Article|]]
12786 [[:interwiki:Bar:Article|]]
12787 !! html/php
12788 [[interwiki:Article|Article]]
12789 [[:interwiki:Article|Article]]
12790 [[interwiki:Bar:Article|Bar:Article]]
12791 [[:interwiki:Bar:Article|Bar:Article]]
12792 !! end
12793
12794 !! test
12795 pre-save transform: context links ("pipe trick") with parens in title
12796 !! options
12797 pst title=[[Somearticle (context)]]
12798 !! wikitext
12799 [[|Article]]
12800 !! html/php
12801 [[Article (context)|Article]]
12802 !! end
12803
12804 !! test
12805 pre-save transform: context links ("pipe trick") with comma in title
12806 !! options
12807 pst title=[[Someplace, Somewhere]]
12808 !! wikitext
12809 [[|Otherplace]]
12810 [[Otherplace, Elsewhere|]]
12811 [[Otherplace, Elsewhere, Anywhere|]]
12812 !! html/php
12813 [[Otherplace, Somewhere|Otherplace]]
12814 [[Otherplace, Elsewhere|Otherplace]]
12815 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12816 !! end
12817
12818 !! test
12819 pre-save transform: context links ("pipe trick") with parens and comma
12820 !! options
12821 pst title=[[Someplace (IGNORED), Somewhere]]
12822 !! wikitext
12823 [[|Otherplace]]
12824 [[Otherplace (place), Elsewhere|]]
12825 !! html/php
12826 [[Otherplace, Somewhere|Otherplace]]
12827 [[Otherplace (place), Elsewhere|Otherplace]]
12828 !! end
12829
12830 !! test
12831 pre-save transform: context links ("pipe trick") with comma and parens
12832 !! options
12833 pst title=[[Who, me? (context)]]
12834 !! wikitext
12835 [[|Yes, you.]]
12836 [[Me, Myself, and I (1937 song)|]]
12837 !! html/php
12838 [[Yes, you. (context)|Yes, you.]]
12839 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12840 !! end
12841
12842 !! test
12843 pre-save transform: context links ("pipe trick") with namespace
12844 !! options
12845 pst title=[[Ns:Somearticle]]
12846 !! wikitext
12847 [[|Article]]
12848 !! html/php
12849 [[Ns:Article|Article]]
12850 !! end
12851
12852 !! test
12853 pre-save transform: context links ("pipe trick") with namespace and parens
12854 !! options
12855 pst title=[[Ns:Somearticle (context)]]
12856 !! wikitext
12857 [[|Article]]
12858 !! html/php
12859 [[Ns:Article (context)|Article]]
12860 !! end
12861
12862 !! test
12863 pre-save transform: context links ("pipe trick") with namespace and comma
12864 !! options
12865 pst title=[[Ns:Somearticle, Context, Whatever]]
12866 !! wikitext
12867 [[|Article]]
12868 !! html/php
12869 [[Ns:Article, Context, Whatever|Article]]
12870 !! end
12871
12872 !! test
12873 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12874 !! options
12875 pst title=[[Ns:Somearticle, Context (context)]]
12876 !! wikitext
12877 [[|Article]]
12878 !! html/php
12879 [[Ns:Article (context)|Article]]
12880 !! end
12881
12882 !! test
12883 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12884 !! options
12885 pst title=[[Ns:Somearticle (IGNORED), Context]]
12886 !! wikitext
12887 [[|Article]]
12888 !! html/php
12889 [[Ns:Article, Context|Article]]
12890 !! end
12891
12892 !! test
12893 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12894 !! options
12895 pst
12896 !! wikitext
12897 [[Article(context)|]]
12898 [[Bar:Article(context)|]]
12899 [[:Bar:Article(context)|]]
12900 [[|Article(context)]]
12901 [[Bar:X(Y)Z|]]
12902 [[:Bar:X(Y)Z|]]
12903 !! html/php
12904 [[Article(context)|Article]]
12905 [[Bar:Article(context)|Article]]
12906 [[:Bar:Article(context)|Article]]
12907 [[Article(context)]]
12908 [[Bar:X(Y)Z|X(Y)Z]]
12909 [[:Bar:X(Y)Z|X(Y)Z]]
12910 !! end
12911
12912 !! test
12913 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12914 !! options
12915 pst
12916 !! wikitext
12917 [[Article (context)|]]
12918 [[Bar:Article (context)|]]
12919 [[:Bar:Article (context)|]]
12920 [[|Article (context)]]
12921 [[Bar:X (Y) Z|]]
12922 [[:Bar:X (Y) Z|]]
12923 !! html/php
12924 [[Article (context)|Article]]
12925 [[Bar:Article (context)|Article]]
12926 [[:Bar:Article (context)|Article]]
12927 [[Article (context)]]
12928 [[Bar:X (Y) Z|X (Y) Z]]
12929 [[:Bar:X (Y) Z|X (Y) Z]]
12930 !! end
12931
12932 !! test
12933 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12934 !! options
12935 pst
12936 !! wikitext
12937 [[Article(context)|]]
12938 [[Bar:Article(context)|]]
12939 [[:Bar:Article(context)|]]
12940 [[|Article(context)]]
12941 [[Bar:X(Y)Z|]]
12942 [[:Bar:X(Y)Z|]]
12943 !! html/php
12944 [[Article(context)|Article]]
12945 [[Bar:Article(context)|Article]]
12946 [[:Bar:Article(context)|Article]]
12947 [[Article(context)]]
12948 [[Bar:X(Y)Z|X(Y)Z]]
12949 [[:Bar:X(Y)Z|X(Y)Z]]
12950 !! end
12951
12952 !! test
12953 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12954 !! options
12955 pst
12956 !! wikitext
12957 [[Article (context), context|]]
12958 [[Article (context),context|]]
12959 [[Bar:Article (context), context|]]
12960 [[Bar:Article (context),context|]]
12961 [[:Bar:Article (context), context|]]
12962 [[:Bar:Article (context),context|]]
12963 !! html/php
12964 [[Article (context), context|Article]]
12965 [[Article (context),context|Article]]
12966 [[Bar:Article (context), context|Article]]
12967 [[Bar:Article (context),context|Article]]
12968 [[:Bar:Article (context), context|Article]]
12969 [[:Bar:Article (context),context|Article]]
12970 !! end
12971
12972 !! test
12973 pre-save transform: trim trailing empty lines
12974 !! options
12975 pst
12976 !! wikitext
12977 Empty lines are trimmed
12978
12979
12980
12981
12982 !! html/php
12983 Empty lines are trimmed
12984 !! end
12985
12986 !! test
12987 pre-save transform: Signature expansion
12988 !! options
12989 pst
12990 !! wikitext
12991 * ~~~
12992 * <noinclude>~~~</noinclude>
12993 * <includeonly>~~~</includeonly>
12994 * <onlyinclude>~~~</onlyinclude>
12995 !! html/php
12996 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12997 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12998 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12999 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13000 !! end
13001
13002
13003 !! test
13004 pre-save transform: Signature expansion in nowiki tags (bug 93)
13005 !! options
13006 pst disabled
13007 !! wikitext
13008 Shall not expand:
13009
13010 <nowiki>~~~~</nowiki>
13011
13012 <includeonly><nowiki>~~~~</nowiki></includeonly>
13013
13014 <noinclude><nowiki>~~~~</nowiki></noinclude>
13015
13016 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13017
13018 {{subst:Foo}} shall be converted to FOO
13019
13020 As well as inside noinclude/onlyinclude
13021 <noinclude>{{subst:Foo}}</noinclude>
13022 <onlyinclude>{{subst:Foo}}</onlyinclude>
13023
13024 But not inside includeonly
13025 <includeonly>{{subst:Foo}}</includeonly>
13026 !! html/php
13027 Shall not expand:
13028
13029 <nowiki>~~~~</nowiki>
13030
13031 <includeonly><nowiki>~~~~</nowiki></includeonly>
13032
13033 <noinclude><nowiki>~~~~</nowiki></noinclude>
13034
13035 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13036
13037 FOO shall be converted to FOO
13038
13039 As well as inside noinclude/onlyinclude
13040 <noinclude>FOO</noinclude>
13041 <onlyinclude>FOO</onlyinclude>
13042
13043 But not inside includeonly
13044 <includeonly>{{subst:Foo}}</includeonly>
13045 !! end
13046
13047 !! test
13048 Parsoid: Recognize nowiki with trailing space in tags
13049 !! options
13050 parsoid=wt2html
13051 !! wikitext
13052 <nowiki ><div>[[foo]]</nowiki >
13053
13054 a<nowiki / >b
13055
13056 c<nowiki />d
13057
13058 e<nowiki/ >f
13059 !! html
13060 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13061 <p>ab</p>
13062 <p>cd</p>
13063 <p>ef</p>
13064 !! end
13065
13066 !! test
13067 Parsoid: Recognize nowiki with odd capitalization
13068 !! options
13069 parsoid=wt2html
13070 !! wikitext
13071 <noWikI ><div>[[foo]]</Nowiki >
13072 !! html
13073 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13074 !! end
13075
13076
13077 !! test
13078 Parsoid: Escape nowiki with trailing space in tags
13079 !! options
13080 parsoid=html2wt
13081 !! html/parsoid
13082 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13083 <p>a&lt;nowiki /&gt;b</p>
13084 <p>c&lt;nowiki/ &gt;d</p>
13085 !! wikitext
13086 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13087
13088 a&lt;nowiki /&gt;b
13089
13090 c&lt;nowiki/ &gt;d
13091 !! end
13092
13093 !! test
13094 Parsoid: Escape weird noWikI capitalizations
13095 !! options
13096 parsoid=html2wt
13097 !! html/parsoid
13098 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13099 !! wikitext
13100 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13101 !! end
13102
13103 ###
13104 ### Message transform tests
13105 ###
13106 !! test
13107 message transform: magic variables
13108 !! options
13109 msg
13110 !! wikitext
13111 {{SITENAME}}
13112 !! html
13113 MediaWiki
13114 !! end
13115
13116 !! test
13117 message transform: should not transform wiki markup
13118 !! options
13119 msg
13120 !! wikitext
13121 ''test''
13122 !! html
13123 ''test''
13124 !! end
13125
13126 !! test
13127 message transform: <noinclude> in transcluded template (bug 4926)
13128 !! options
13129 msg
13130 !! wikitext
13131 {{Includes}}
13132 !! html
13133 Foobar
13134 !! end
13135
13136 !! test
13137 message transform: <onlyinclude> in transcluded template (bug 4926)
13138 !! options
13139 msg
13140 !! wikitext
13141 {{Includes2}}
13142 !! html
13143 Foo
13144 !! end
13145
13146 !! test
13147 {{#special:}} page name, known
13148 !! options
13149 msg
13150 !! wikitext
13151 {{#special:Recentchanges}}
13152 !! html
13153 Special:RecentChanges
13154 !! end
13155
13156 !! test
13157 {{#special:}} page name with subpage, known
13158 !! options
13159 msg
13160 !! wikitext
13161 {{#special:Recentchanges/param}}
13162 !! html
13163 Special:RecentChanges/param
13164 !! end
13165
13166 !! test
13167 {{#special:}} page name, unknown
13168 !! options
13169 msg
13170 !! wikitext
13171 {{#special:foobar nonexistent}}
13172 !! html
13173 Special:Foobar nonexistent
13174 !! end
13175
13176 !! test
13177 {{#speciale:}} page name, known
13178 !! options
13179 msg
13180 !! wikitext
13181 {{#speciale:Recentchanges}}
13182 !! html
13183 Special:RecentChanges
13184 !! end
13185
13186 !! test
13187 {{#speciale:}} page name with subpage, known
13188 !! options
13189 msg
13190 !! wikitext
13191 {{#speciale:Recentchanges/param}}
13192 !! html
13193 Special:RecentChanges/param
13194 !! end
13195
13196 !! test
13197 {{#speciale:}} page name, unknown
13198 !! options
13199 msg
13200 !! wikitext
13201 {{#speciale:foobar nonexistent}}
13202 !! html
13203 Special:Foobar_nonexistent
13204 !! end
13205
13206 ###
13207 ### Images
13208 ###
13209 ### For Parsoid-specific tests, see
13210 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13211
13212 !! test
13213 Simple image
13214 !! options
13215 parsoid=wt2html,wt2wt,html2html
13216 !! wikitext
13217 [[Image:foobar.jpg]]
13218 !! html/php
13219 <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>
13220 </p>
13221 !! html/parsoid
13222 <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>
13223 !! end
13224
13225 !! test
13226 Simple image (using File: namespace, now canonical)
13227 !! wikitext
13228 [[File:Foobar.jpg]]
13229 !! html/php
13230 <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>
13231 </p>
13232 !! html/parsoid
13233 <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>
13234 !! end
13235
13236 !! test
13237 Right-aligned image
13238 !! wikitext
13239 [[File:Foobar.jpg|right]]
13240 !! html/php
13241 <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>
13242
13243 !! html/parsoid
13244 <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>
13245 !! end
13246
13247 !! test
13248 Image with caption
13249 !! wikitext
13250 [[File:Foobar.jpg|right|Caption text]]
13251 !! html/php
13252 <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>
13253
13254 !! html/parsoid
13255 <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>
13256 !! end
13257
13258 !! test
13259 Image with caption, bug 53312 #1
13260 !! wikitext
13261 [[File:Foobar.jpg|right|Caption page stuff]]
13262 !! html/php
13263 <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>
13264
13265 !! html/parsoid
13266 <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>
13267 !! end
13268
13269 !! test
13270 Image with caption, bug 53312 #2
13271 !! wikitext
13272 [[File:Foobar.jpg|right|Caption page=]]
13273 !! html/php
13274 <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>
13275
13276 !! html/parsoid
13277 <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>
13278 !! end
13279
13280 !! test
13281 Image with caption, bug 53312 #3
13282 !! wikitext
13283 [[File:Foobar.jpg|right|Caption page=stuff]]
13284 !! html/php
13285 <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>
13286
13287 !! html/parsoid
13288 <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>
13289 !! end
13290
13291 !! test
13292 Allow empty links in image captions (Bug 60753)
13293 !! options
13294 thumbsize=220
13295 !! wikitext
13296 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13297 [[]]
13298 [[Link2]]
13299 ]]
13300 !! html/php
13301 <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>
13302
13303 !! html/parsoid
13304 <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>
13305 [[]]
13306 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13307 </figcaption></figure>
13308 !! end
13309
13310 !! test
13311 Titles in unlinked images (T23454)
13312 !! wikitext
13313 [[File:Foobar.jpg|link=|stuff]]
13314 !! html/php
13315 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13316 </p>
13317 !! end
13318
13319 !! test
13320 Link with empty target
13321 !! wikitext
13322 [[]]
13323 !! html
13324 <p>[[]]
13325 </p>
13326 !! end
13327
13328 !! test
13329 Image with link trail
13330 !! wikitext
13331 Linktrails should not work for images: [[File:Foobar.jpg]]s
13332 !! html/php
13333 <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
13334 </p>
13335 !! html/parsoid
13336 <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>
13337 !! end
13338
13339 !! test
13340 Image with empty attribute
13341 !! options
13342 parsoid=wt2html,wt2wt,html2html
13343 !! wikitext
13344 [[File:Foobar.jpg|right||Caption text]]
13345 !! html/php
13346 <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>
13347
13348 !! html/parsoid
13349 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
13350 !! end
13351
13352 !! test
13353 1. Block image with individual attributes from templates
13354 !! wikitext
13355 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13356 !! html/php
13357 <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>
13358
13359 !! html/parsoid
13360 <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>
13361 !! end
13362
13363 !! test
13364 2. Block Image with individual attributes from templates
13365 !! wikitext
13366 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13367 !! html/php
13368 <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>
13369
13370 !! html/parsoid
13371 <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>
13372 !! end
13373
13374 !! test
13375 3. Inline image with individual attributes from templates
13376 !! wikitext
13377 [[File:Foobar.jpg|{{echo|50px}}]]
13378 !! html/php
13379 <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>
13380 </p>
13381 !! html/parsoid
13382 <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>
13383 !! end
13384
13385 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13386 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13387 !! test
13388 Image with multiple attributes from the same template
13389 !! wikitext
13390 [[File:Foobar.jpg|{{image_attribs}}]]
13391 !! html/php
13392 <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>
13393
13394 !! html/parsoid
13395 <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>
13396 !! end
13397
13398 !! test
13399 Image with link tails
13400 !! options
13401 thumbsize=220
13402 !! wikitext
13403 123[[File:Foobar.jpg]]456
13404 123[[File:Foobar.jpg|right]]456
13405 123[[File:Foobar.jpg|thumb]]456
13406 !! html/php
13407 <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
13408 </p>
13409 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
13410 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
13411
13412 !! html/php+tidy
13413 <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>
13414 <p>123</p>
13415 <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>
13416 <p>456 123</p>
13417 <div class="thumb tright">
13418 <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>
13419 <div class="thumbcaption">
13420 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13421 </div>
13422 </div>
13423 </div>
13424 <p>456</p>
13425 !! html/parsoid
13426 <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>
13427 <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>
13428 <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>
13429 !! end
13430
13431 !! test
13432 Image with multiple captions -- only last one is accepted
13433 !! wikitext
13434 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13435 !! html/php
13436 <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>
13437
13438 !! html/parsoid
13439 <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>
13440 !! end
13441
13442 !! test
13443 Image with multiple widths -- use last
13444 !! wikitext
13445 [[File:Foobar.jpg|200px|300px|caption]]
13446 !! html/php
13447 <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>
13448 </p>
13449 !! html/parsoid
13450 <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>
13451 !! end
13452
13453 !! test
13454 Image with multiple alignments -- use first (bug 48664)
13455 !! options
13456 thumbsize=220
13457 !! wikitext
13458 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13459
13460 [[File:Foobar.jpg|middle|text-top|caption]]
13461 !! html/php
13462 <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>
13463 <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>
13464 </p>
13465 !! html/parsoid
13466 <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>
13467 <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>
13468 !! end
13469
13470 !! test
13471 Image with width attribute at different positions
13472 !! wikitext
13473 [[File:Foobar.jpg|200px|right|Caption]]
13474 [[File:Foobar.jpg|right|200px|Caption]]
13475 [[File:Foobar.jpg|right|Caption|200px]]
13476 !! html/php
13477 <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>
13478 <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>
13479 <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>
13480
13481 !! html/parsoid
13482 <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>
13483 <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>
13484 <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>
13485 !! end
13486
13487 # a sad bit of backward-compatibility
13488 !! test
13489 Image with size specified with pxpx (bug 13500, 51628)
13490 !! options
13491 parsoid=wt2html,wt2wt,html2html
13492 !! wikitext
13493 [[File:Foobar.jpg|20pxpx]]
13494 [[File:Foobar.jpg|200x20pxpx]]
13495 !! html/php
13496 <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>
13497 <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>
13498 </p>
13499 !! html/parsoid
13500 <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>
13501 !! end
13502
13503 !! test
13504 Image with link parameter, wiki target
13505 !! wikitext
13506 [[File:Foobar.jpg|link=Main Page]]
13507 !! html/php
13508 <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>
13509 </p>
13510 !! html/parsoid
13511 <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>
13512 !! end
13513
13514 # parsoid bug 49293 (part 1)
13515 !! test
13516 Image with link parameter, URL target
13517 !! wikitext
13518 [[File:Foobar.jpg|link=http://example.com/]]
13519 !! html/php
13520 <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>
13521 </p>
13522 !! html/parsoid
13523 <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>
13524 !! end
13525
13526 # parsoid bug 49293 (part 2)
13527 !! test
13528 Image with link parameter, protocol-less URL target
13529 !! wikitext
13530 [[File:Foobar.jpg|link=//example.com/]]
13531 !! html/php
13532 <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>
13533 </p>
13534 !! html/parsoid
13535 <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>
13536 !! end
13537
13538 !! test
13539 Escaping non-block captions (T107435)
13540 !! options
13541 parsoid={
13542 "modes": ["wt2wt"],
13543 "changes": [
13544 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13545 ]
13546 }
13547 !! wikitext
13548 [[Image:Foobar.jpg|caption]]
13549 !! wikitext/edited
13550 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13551 !! end
13552
13553 # wgExternalLinkTarget not supported by Parsoid
13554 !! test
13555 Image with link parameter, wgExternalLinkTarget
13556 !! wikitext
13557 [[Image:foobar.jpg|link=http://example.com/]]
13558 !! config
13559 wgExternalLinkTarget='foobar'
13560 !! html/php
13561 <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>
13562 </p>
13563 !! end
13564
13565 !! test
13566 Image with link parameter, wgNoFollowLinks set to false
13567 !! wikitext
13568 [[Image:foobar.jpg|link=http://example.com/]]
13569 !! config
13570 wgNoFollowLinks=false
13571 !! html
13572 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13573 </p>
13574 !! end
13575
13576 !! test
13577 Image with link parameter, wgNoFollowDomainExceptions
13578 !! wikitext
13579 [[Image:foobar.jpg|link=http://example.com/]]
13580 !! config
13581 wgNoFollowDomainExceptions='example.com'
13582 !! html
13583 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13584 </p>
13585 !! end
13586
13587 # wgExternalLinkTarget not supported by Parsoid
13588 !! test
13589 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13590 !! wikitext
13591 [[Image:foobar.jpg|link=http://example.com/|Title]]
13592 !! config
13593 wgExternalLinkTarget='foobar'
13594 !! html/php
13595 <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>
13596 </p>
13597 !! end
13598
13599 !! test
13600 Image with empty link parameter
13601 !! wikitext
13602 [[File:Foobar.jpg|link=]]
13603 !! html/php
13604 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13605 </p>
13606 !! html/parsoid
13607 <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>
13608 !! end
13609
13610 !! test
13611 Image with link parameter (wiki target) and unnamed parameter
13612 !! wikitext
13613 [[File:Foobar.jpg|link=Main_Page|Title]]
13614 !! html/php
13615 <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>
13616 </p>
13617 !! html/parsoid
13618 <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>
13619 !! end
13620
13621 !! test
13622 Image with link parameter (URL target) and unnamed parameter
13623 !! wikitext
13624 [[File:Foobar.jpg|link=http://example.com/|Title]]
13625 !! html/php
13626 <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>
13627 </p>
13628 !! html/parsoid
13629 <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>
13630 !! end
13631
13632 !! test
13633 Thumbnail image with link parameter
13634 !! options
13635 thumbsize=220
13636 parsoid=wt2html,wt2wt,html2html
13637 !! wikitext
13638 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13639 !! html/php
13640 <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>
13641
13642 !! html/parsoid
13643 <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>
13644 !! end
13645
13646 !! test
13647 Manually-specified thumbnail image
13648 !! options
13649 thumbsize=220
13650 !! wikitext
13651 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13652 !! html/php
13653 <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>
13654
13655 !! html/parsoid
13656 <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>
13657 !! end
13658
13659 !! test
13660 Manually-specified thumbnail image with explicit link to wiki page
13661 !! options
13662 thumbsize=220
13663 parsoid=wt2html,wt2wt,html2html
13664 !! wikitext
13665 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13666 !! html/php
13667 <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>
13668
13669 !! html/parsoid
13670 <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>
13671 !! end
13672
13673 !! test
13674 Manually-specified thumbnail image with explicit link to url
13675 !! options
13676 thumbsize=220
13677 parsoid=wt2html,wt2wt,html2html
13678 !! wikitext
13679 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13680 !! html/php
13681 <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>
13682
13683 !! html/parsoid
13684 <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>
13685 !! end
13686
13687 !! test
13688 Manually-specified thumbnail image with explicit no link
13689 !! options
13690 thumbsize=220
13691 parsoid=wt2html,wt2wt,html2html
13692 !! wikitext
13693 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13694 !! html/php
13695 <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>
13696
13697 !! html/parsoid
13698 <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>
13699 !! end
13700
13701 !! test
13702 Manually-specified thumbnail image with explicit link and alt text
13703 !! options
13704 thumbsize=220
13705 parsoid=wt2html,wt2wt,html2html
13706 !! wikitext
13707 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13708 !! html/php
13709 <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>
13710
13711 !! html/parsoid
13712 <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>
13713 !! end
13714
13715 !! test
13716 Image with frame and link
13717 !! options
13718 parsoid=wt2html,wt2wt,html2html
13719 !! wikitext
13720 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13721 !! html/php
13722 <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>
13723
13724 !! html/parsoid
13725 <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>
13726 !! end
13727
13728 !! test
13729 Image with frame and link and explicit alt
13730 !! options
13731 parsoid=wt2html,wt2wt,html2html
13732 !! wikitext
13733 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13734 !! html/php
13735 <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>
13736
13737 !! html/parsoid
13738 <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>
13739 !! end
13740
13741 !! test
13742 Image with wiki markup in implicit alt
13743 !! wikitext
13744 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13745
13746 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13747 !! html/php
13748 <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>
13749 </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>
13750 </p>
13751 !! html/parsoid
13752 <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>
13753
13754 <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>
13755 !! end
13756
13757 !! test
13758 Alt image option should handle most kinds of wikitext without barfing
13759 !! wikitext
13760 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13761 !! html/php
13762 <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>
13763
13764 !! html/parsoid
13765 <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>
13766 !! end
13767
13768 ###################
13769 # Conflicting image format options.
13770 # First option specified should 'win'.
13771 # All three cases in each test should be identical.
13772
13773 !! test
13774 Image with 'frameless' first.
13775 !! options
13776 parsoid=wt2html,wt2wt,html2html
13777 !! wikitext
13778 [[File:Foobar.jpg|frameless|caption]]
13779
13780 [[File:Foobar.jpg|frameless|frame|caption]]
13781
13782 [[File:Foobar.jpg|frameless|thumb|caption]]
13783 !! html/php
13784 <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>
13785 </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>
13786 </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>
13787 </p>
13788 !! html/parsoid
13789 <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>
13790 <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>
13791 <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>
13792 !! end
13793
13794 !! test
13795 Image with 'frame' first.
13796 !! options
13797 parsoid=wt2html,wt2wt,html2html
13798 !! wikitext
13799 [[File:Foobar.jpg|frame|caption]]
13800 [[File:Foobar.jpg|frame|frameless|caption]]
13801 [[File:Foobar.jpg|frame|thumb|caption]]
13802 !! html/php
13803 <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>
13804 <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>
13805 <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>
13806
13807 !! html/parsoid
13808 <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>
13809 <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>
13810 <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>
13811 !! end
13812
13813 !! test
13814 Image with 'thumb' first.
13815 !! options
13816 parsoid=wt2html,wt2wt,html2html
13817 !! wikitext
13818 [[File:Foobar.jpg|thumb|caption]]
13819 [[File:Foobar.jpg|thumb|frameless|caption]]
13820 [[File:Foobar.jpg|thumb|frame|caption]]
13821 !! html/php
13822 <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>
13823 <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>
13824 <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>
13825
13826 !! html/parsoid
13827 <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>
13828 <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>
13829 <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>
13830 !! end
13831
13832 ###################
13833 # Image sizing.
13834 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13835 # and https://phabricator.wikimedia.org/T64258
13836 # Foobar has actual size of 1941x220
13837 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13838 # a scalable format.
13839 # 2. Framed images always ignore size options; always render at default size.
13840 # 3. "Unspecified format" and border are the only types which can be
13841 # enlarged.
13842
13843 !! test
13844 Image: "unspecified format" and border enlarge
13845 !! options
13846 parsoid=wt2html,wt2wt,html2html
13847 !! wikitext
13848 [[File:Foobar.jpg|2000px]]
13849
13850 [[File:Foobar.jpg|border|2000px]]
13851 !! html/php
13852 <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>
13853 </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>
13854 </p>
13855 !! html/parsoid
13856 <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>
13857 <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>
13858 !! end
13859
13860 !! test
13861 Image: "unspecified format" and border reduce
13862 !! options
13863 parsoid=wt2html,wt2wt,html2html
13864 !! wikitext
13865 [[File:Foobar.jpg|1000px]]
13866
13867 [[File:Foobar.jpg|border|1000px]]
13868 !! html/php
13869 <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>
13870 </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>
13871 </p>
13872 !! html/parsoid
13873 <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>
13874 <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>
13875 !! end
13876
13877 !! test
13878 Image: thumbs reduce
13879 !! options
13880 parsoid=wt2html,wt2wt,html2html
13881 !! wikitext
13882 [[File:Foobar.jpg|thumb|50px]]
13883 !! html/php
13884 <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>
13885
13886 !! html/parsoid
13887 <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>
13888 !! end
13889
13890 !! test
13891 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13892 !! options
13893 parsoid=wt2html,wt2wt,html2html
13894 !! wikitext
13895 [[File:Foobar.jpg|thumb|2000px]]
13896
13897 [[File:Foobar.svg|thumb|2000px]]
13898 !! html/php
13899 <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>
13900 <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>
13901
13902 !! html/parsoid
13903 <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>
13904 <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>
13905 !! end
13906
13907 !! test
13908 Image: frameless can reduce in size
13909 !! options
13910 parsoid=wt2html,wt2wt,html2html
13911 !! wikitext
13912 [[File:Foobar.jpg|frameless|50px]]
13913 !! html/php
13914 <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>
13915 </p>
13916 !! html/parsoid
13917 <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>
13918 !! end
13919
13920 !! test
13921 Image: bitmap frameless can't be enlarged past original size, but vector can
13922 !! options
13923 parsoid=wt2html,wt2wt,html2html
13924 !! wikitext
13925 [[File:Foobar.jpg|frameless|2000px]]
13926
13927 [[File:Foobar.svg|frameless|2000px]]
13928 !! html/php
13929 <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>
13930 </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>
13931 </p>
13932 !! html/parsoid
13933 <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>
13934 <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>
13935 !! end
13936
13937 !! test
13938 Image: framed images are always unscaled.
13939 !! options
13940 parsoid=wt2html,wt2wt,html2html
13941 !! wikitext
13942 [[File:Foobar.jpg|frame]]
13943
13944 [[File:Foobar.jpg|frame|50px]]
13945
13946 [[File:Foobar.jpg|frame|50x50px]]
13947
13948 [[File:Foobar.jpg|frame|2000px]]
13949 !! html/php
13950 <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>
13951 <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>
13952 <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>
13953 <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>
13954
13955 !! html/parsoid
13956 <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>
13957 <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>
13958 <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>
13959 <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>
13960 !! end
13961
13962 ###################
13963
13964 !! test
13965 Link to image page- image page normally doesn't exists, hence edit link
13966 Add test with existing image page
13967 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13968 !! wikitext
13969 [[:Image:test]]
13970 !! html
13971 <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>
13972 </p>
13973 !! end
13974
13975 !! test
13976 bug 18784 Link to non-existent image page with caption should use caption as link text
13977 !! wikitext
13978 [[:Image:test|caption]]
13979 !! html
13980 <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>
13981 </p>
13982 !! end
13983
13984 !! test
13985 Frameless image caption with a free URL
13986 !! wikitext
13987 [[File:Foobar.jpg|http://example.com]]
13988 !! html/php
13989 <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>
13990 </p>
13991 !! html/parsoid
13992 <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>
13993 !! end
13994
13995 !! test
13996 Thumbnail image caption with a free URL
13997 !! options
13998 thumbsize=220
13999 !! wikitext
14000 [[File:Foobar.jpg|thumb|http://example.com]]
14001 !! html/php
14002 <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>
14003
14004 !! html/parsoid
14005 <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>
14006 !! end
14007
14008 !! test
14009 Thumbnail image caption with a free URL and explicit alt
14010 !! options
14011 thumbsize=220
14012 parsoid=wt2html,wt2wt,html2html
14013 !! wikitext
14014 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14015 !! html/php
14016 <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>
14017
14018 !! html/parsoid
14019 <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>
14020 !! end
14021
14022 !! test
14023 SVG thumbnails with no language set
14024 !! options
14025 !! wikitext
14026 [[File:Foobar.svg|thumb|caption]]
14027 !! html/php
14028 <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>
14029
14030 !! html/parsoid
14031 <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>
14032 !! end
14033
14034 !! test
14035 SVG thumbnails with language de
14036 !! options
14037 parsoid=wt2html,wt2wt,html2html
14038 !! wikitext
14039 [[File:Foobar.svg|thumb|caption|lang=de]]
14040 !! html/php
14041 <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>
14042
14043 !! html/parsoid
14044 <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>
14045 !! end
14046
14047 !! test
14048 SVG thumbnails with invalid language code
14049 !! options
14050 parsoid=wt2html,wt2wt,html2html
14051 !! wikitext
14052 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14053 !! html/php
14054 <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>
14055
14056 !! html/parsoid
14057 <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>
14058 !! end
14059
14060 !! test
14061 BUG 1887: A ISBN with a thumbnail
14062 !! wikitext
14063 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14064 !! html/php
14065 <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>
14066
14067 !! html/parsoid
14068 <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>
14069 !! end
14070
14071 !! test
14072 BUG 1887: A RFC with a thumbnail
14073 !! wikitext
14074 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14075 !! html/php
14076 <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>
14077
14078 !! html/parsoid
14079 <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>
14080 !! end
14081
14082 !! test
14083 BUG 1887: A mailto link with a thumbnail
14084 !! wikitext
14085 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14086 !! html/php
14087 <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>
14088
14089 !! html/parsoid
14090 <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>
14091 !! end
14092
14093 # Pending resolution to bug 368
14094 !! test
14095 BUG 648: Frameless image caption with a link
14096 !! wikitext
14097 [[File:Foobar.jpg|text with a [[link]] in it]]
14098 !! html/php
14099 <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>
14100 </p>
14101 !! html/parsoid
14102 <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>
14103 !! end
14104
14105 !! test
14106 BUG 648: Frameless image caption with a link (suffix)
14107 !! wikitext
14108 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14109 !! html/php
14110 <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>
14111 </p>
14112 !! html/parsoid
14113 <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>
14114 !! end
14115
14116 !! test
14117 BUG 648: Frameless image caption with an interwiki link
14118 !! wikitext
14119 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14120 !! html/php
14121 <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>
14122 </p>
14123 !! html/parsoid
14124 <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>
14125 !! end
14126
14127 !! test
14128 BUG 648: Frameless image caption with a piped interwiki link
14129 !! wikitext
14130 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14131 !! html/php
14132 <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>
14133 </p>
14134 !! html/parsoid
14135 <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>
14136 !! end
14137
14138 !! test
14139 T107474: Frameless image caption with <nowiki>
14140 !! wikitext
14141 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14142 !! html/parsoid
14143 <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>
14144 !! end
14145
14146 !! test
14147 Escape HTML special chars in image alt text
14148 !! wikitext
14149 [[File:Foobar.jpg|& < > "]]
14150 !! html/php
14151 <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>
14152 </p>
14153 !! html/parsoid
14154 <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>
14155 !! end
14156
14157 !! test
14158 Escape HTML special chars in image alt text with LanguageConverter
14159 !! options
14160 language=zh
14161 !! wikitext
14162 [[File:Foobar.jpg|& < > "]]
14163 !! html/php
14164 <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>
14165 </p>
14166 !! html/parsoid
14167 <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>
14168 !! end
14169
14170 !! test
14171 Entities in file name and attributes
14172 !! wikitext
14173 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14174 !! html/php
14175 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14176 </p>
14177 !! html/parsoid
14178 <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>
14179 !! end
14180
14181 !! test
14182 BUG 499: Alt text should have &#1234;, not &amp;1234;
14183 !! wikitext
14184 [[File:Foobar.jpg|&#9792;]]
14185 !! html/php
14186 <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>
14187 </p>
14188 !! html/parsoid
14189 <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>
14190 !! end
14191
14192 !! test
14193 Broken image caption with link
14194 !! options
14195 parsoid=wt2html,wt2wt,html2html
14196 !! wikitext
14197 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14198 !! html/php
14199 <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.
14200 </p>
14201 !! html/parsoid
14202 <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>
14203 !! end
14204
14205 !! test
14206 Image caption containing another image
14207 !! wikitext
14208 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14209 !! html/php
14210 <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>
14211
14212 !! html/parsoid
14213 <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>
14214 !! end
14215
14216 !! test
14217 Image: caption containing a newline
14218 !! wikitext
14219 [[File:Foobar.jpg|This
14220 *is some text]]
14221 !! html/php
14222 <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>
14223 </p>
14224 !! html/parsoid
14225 <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>
14226 !!end
14227
14228 !!test
14229 Image: caption containing leading space
14230 (The leading space should not trigger nowiki escaping in wt2wt mode)
14231 !! wikitext
14232 [[File:Foobar.jpg|thumb| bar]]
14233 !! html/php
14234 <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>
14235
14236 !! html/parsoid
14237 <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>
14238 !!end
14239
14240 !! test
14241 Image: caption containing a table
14242 !! options
14243 parsoid=wt2html,wt2wt,html2html
14244 !! wikitext
14245 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14246 {|
14247 ! Foo !! Bar
14248 |-
14249 | Foo1 || Bar1
14250 |}
14251 and some more text.]]
14252 !! html/php
14253 <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>
14254
14255 !! html/parsoid
14256 <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
14257 <table>
14258 <tbody>
14259 <tr><th>Foo </th><th>Bar</th></tr>
14260 <tr>
14261 <td>Foo1 </td>
14262 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14263 !! end
14264
14265 !! test
14266 Bug 3090: External links other than http: in image captions
14267 !! wikitext
14268 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14269 !! html/php
14270 <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>
14271
14272 !! html/parsoid
14273 <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>
14274 !! end
14275
14276 !! test
14277 Custom class
14278 !! options
14279 parsoid=wt2html,wt2wt,html2html
14280 !! wikitext
14281 [[Image:foobar.jpg|a|class=b]]
14282 !! html/php
14283 <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>
14284 </p>
14285 !! html/parsoid
14286 <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>
14287 !! end
14288
14289 !! test
14290 Localized image handling (1).
14291 !! options
14292 parsoid=wt2html,wt2wt,html2html
14293 language=es
14294 !! wikitext
14295 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14296 !! html/php
14297 <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>
14298
14299 !! html/parsoid
14300 <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>
14301 !! end
14302
14303 !! test
14304 Localized image handling (2).
14305 !! options
14306 thumbsize=220
14307 parsoid=wt2html,wt2wt,html2html
14308 language=es
14309 !! wikitext
14310 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14311 !! html/php
14312 <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>
14313
14314 !! html/parsoid
14315 <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>
14316 !! end
14317
14318 !! test
14319 Localized image handling (3).
14320 !! options
14321 language=fa
14322 parsoid=html2wt
14323 !! html/parsoid
14324 <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>
14325 !! wikitext
14326 [[File:Foobar.jpg|بندانگشتی]]
14327 !! end
14328
14329 !! test
14330 "border", "frameless" and "class" attributes on an image.
14331 !! options
14332 thumbsize=220
14333 parsoid=wt2html,wt2wt,html2html
14334 !! wikitext
14335 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14336 !! html/php
14337 <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>
14338 </p>
14339 !! html/parsoid
14340 <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>
14341 !! end
14342
14343 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14344 !! test
14345 Invalid image attributes (bug 62500)
14346 !! options
14347 thumbsize=220
14348 parsoid=wt2html,wt2wt,html2html
14349 !! wikitext
14350 [[File:Foobar.jpg|thumb|float|left|caption]]
14351
14352 [[File:Foobar.jpg|thumb|righ|caption]]
14353
14354 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14355 !! html/php
14356 <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>
14357 <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>
14358 <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>
14359
14360 !! html/parsoid
14361 <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>
14362 <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>
14363 <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>
14364 !! end
14365
14366 !! article
14367 File:Barfoo.jpg
14368 !! text
14369 #REDIRECT [[File:Barfoo.jpg]]
14370 !! endarticle
14371
14372 # FIXME: Parsoid should run this test -- but we'd need to teach the
14373 # mockAPI about the redirected Barfoo.jpg image.
14374 !! test
14375 Redirected image
14376 !! wikitext
14377 [[Image:Barfoo.jpg]]
14378 !! html/php
14379 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14380 </p>
14381 !! end
14382
14383 !! test
14384 Missing image with uploads disabled
14385 !! options
14386 wgEnableUploads=0
14387 !! wikitext
14388 [[File:Foobaz.jpg]]
14389 !! html/php
14390 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14391 </p>
14392 !! html/parsoid
14393 <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>
14394 !! end
14395
14396 # Parsoid-specific testing for images
14397 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14398 # Currently imperfect due to a flaw in the Parsoid testrunner
14399 # Work in progress
14400 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14401 # image tests.
14402
14403 !! test
14404 Parsoid-specific image handling - simple image with size and middle alignment
14405 !! wikitext
14406 [[File:Foobar.jpg|middle|50px]]
14407 !! html/parsoid
14408 <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>
14409 !! end
14410
14411 !! test
14412 Parsoid-specific image handling - simple image with size, middle alignment,
14413 non-standard namespace alias
14414 !! options
14415 parsoid=wt2wt,wt2html,html2html
14416 !! wikitext
14417 [[Image:Foobar.jpg|middle|50px]]
14418 !! html/parsoid
14419 <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>
14420 !! end
14421
14422 !! test
14423 Parsoid-specific image handling - simple image with size and middle alignment
14424 (existing content)
14425 !! wikitext
14426 [[File:Foobar.jpg|50px|middle]]
14427 !! html/parsoid
14428 <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>
14429 !! end
14430
14431 !! test
14432 Parsoid-specific image handling - simple image with size and middle alignment
14433 and non-standard namespace name
14434 !! options
14435 parsoid=wt2html,wt2wt,html2html
14436 !! wikitext
14437 [[Image:Foobar.jpg|50px|middle]]
14438 !! html/parsoid
14439 <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>
14440 !! end
14441
14442 !! test
14443 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14444 !! wikitext
14445 [[File:Foobar.jpg|500x10px|baseline|caption]]
14446 !! html/parsoid
14447 <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>
14448 !! end
14449
14450 !! test
14451 Parsoid-specific image handling - simple image with border and size spec
14452 !! wikitext
14453 [[File:Foobar.jpg|50px|border|caption]]
14454 !! html/parsoid
14455 <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>
14456 !! end
14457
14458 !! test
14459 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14460 !! wikitext
14461 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14462 !! html/parsoid
14463 <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>
14464 !! end
14465
14466 !! test
14467 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14468 (existing content)
14469 !! wikitext
14470 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14471 !! html/parsoid
14472 <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>
14473 !! end
14474
14475 !! test
14476 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14477 !! wikitext
14478 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14479 !! html/parsoid
14480 <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>
14481 !! end
14482
14483 !! test
14484 Parsoid-specific image handling - thumbnail with specific size, halign,
14485 valign, and caption (existing content)
14486 !! wikitext
14487 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14488 !! html/parsoid
14489 <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>
14490 !! end
14491
14492 !! test
14493 Parsoid-specific image handling - framed image with specific size and caption
14494 (size is ignored)
14495 !! options
14496 parsoid=wt2html,wt2wt,html2html
14497 !! wikitext
14498 [[File:Foobar.jpg|frame|500x50px|caption]]
14499 !! html/parsoid
14500 <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>
14501 !! end
14502
14503 !! test
14504 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14505 (size is ignored)
14506 !! options
14507 parsoid=wt2html,wt2wt,html2html
14508 !! wikitext
14509 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14510 !! html/parsoid
14511 <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>
14512 !! end
14513
14514 !! test
14515 Parsoid-specific image handling - frameless image with specific size, border, and caption
14516 !! wikitext
14517 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14518 !! html/parsoid
14519 <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>
14520 !! end
14521
14522 !! test
14523 Parsoid-specific image handling - simple image with a formatted caption
14524 !! wikitext
14525 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14526 !! html/parsoid
14527 <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>
14528 !! end
14529
14530 !! test
14531 Parsoid-specific image handling - caption with a template in it
14532 !! wikitext
14533 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14534 !! html/parsoid
14535 <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>
14536 !! end
14537
14538 !! test
14539 Parsoid-specific image handling - caption with unbalanced tags in it
14540 !! options
14541 parsoid=wt2html,wt2wt,html2html
14542 !! wikitext
14543 foo
14544 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14545 bar
14546 !! html/parsoid
14547 <p>foo</p>
14548 <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>
14549 <p>bar</p>
14550 !! end
14551
14552 !! test
14553 Parsoid-specific image handling - empty caption (1)
14554 !! options
14555 parsoid=wt2html,wt2wt
14556 !! wikitext
14557 [[File:Foobar.jpg|thumb|]]
14558 !! html/parsoid
14559 <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>
14560 !! end
14561
14562 # empty captions don't get serialized unless we're in the "round trip" case
14563 !! test
14564 Parsoid-specific image handling - empty caption (2)
14565 !! options
14566 parsoid=html2wt
14567 !! html/parsoid
14568 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14569 <a href="./File:Foobar.jpg">
14570 <img resource="./File:Foobar.jpg"
14571 src="//example.com/images/3/3a/Foobar.jpg"
14572 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14573 height="25" width="220"/>
14574 </a>
14575 <figcaption></figcaption>
14576 </figure>
14577 !! wikitext
14578 [[File:Foobar.jpg|thumb]]
14579 !! end
14580
14581 !! test
14582 Parsoid-specific image handling - whitespace caption
14583 !! wikitext
14584 [[File:Foobar.jpg|thumb| ]]
14585 !! html/parsoid
14586 <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>
14587 !! end
14588
14589 !! test
14590 Parsoid-specific image handling - lang option
14591 !! wikitext
14592 foo
14593 [[File:Foobar.svg|lang=de|caption]]
14594 bar
14595 !! html/parsoid
14596 <p>foo
14597 <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>
14598 bar</p>
14599 !! end
14600
14601 ## Edge case bugs in Parsoid from T93580
14602 !! test
14603 T93580: 1. Templated <ref> inside block images
14604 !! wikitext
14605 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14606
14607 <references />
14608 !! html/parsoid
14609 <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="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></figcaption></figure>
14610
14611 <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="#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>
14612 !! end
14613
14614 !! test
14615 T93580: 2. <ref> inside inline images
14616 !! wikitext
14617 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14618
14619 <references />
14620 !! html/parsoid
14621 <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=\"#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>
14622
14623 <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="#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>
14624 !! end
14625
14626 !! test
14627 T93580: 3. Templated <ref> inside inline images
14628 !! wikitext
14629 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14630
14631 <references />
14632 !! html/parsoid
14633 <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=\"#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>
14634
14635 <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="#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>
14636 !! end
14637
14638 ###
14639 ### Subpages
14640 ###
14641 !! article
14642 Subpage test/subpage
14643 !! text
14644 foo
14645 !! endarticle
14646
14647 !! test
14648 Subpage link
14649 !! options
14650 subpage title=[[Subpage test]]
14651 !! wikitext
14652 [[/subpage]]
14653 !! html
14654 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14655 </p>
14656 !! end
14657
14658 !! test
14659 Subpage noslash link
14660 !! options
14661 subpage title=[[Subpage test]]
14662 !! wikitext
14663 [[/subpage/]]
14664 !! html
14665 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14666 </p>
14667 !! end
14668
14669 !! article
14670 Subpage test/1/2/subpage
14671 !! text
14672 blah
14673 !! endarticle
14674
14675 !! test
14676 Relative subpage noslash link
14677 !! options
14678 parsoid=wt2wt,wt2html,html2html
14679 subpage title=[[Subpage test/1/2/3/4]]
14680 !! wikitext
14681 [[../../subpage/]]
14682
14683 [[../../subpage]]
14684 !! html/php
14685 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14686 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14687 </p>
14688 !! html/parsoid
14689 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14690 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14691 !! end
14692
14693 !! test
14694 Parsoid: dot-slash prefixed wikilinks
14695 !! wikitext
14696 [[./foo]]
14697
14698 [[././bar]]
14699
14700 [[././baz/]]
14701 !! html/php
14702 <p>[[./foo]]
14703 </p><p>[[././bar]]
14704 </p><p>[[././baz/]]
14705 </p>
14706 !! html/parsoid
14707 <p>[[./foo]]
14708 </p><p>[[././bar]]
14709 </p><p>[[././baz/]]
14710 </p>
14711 !! end
14712
14713 !! test
14714 Render invalid page names as plain text (bug 51090)
14715 !! wikitext
14716 [[./../foo|bar]]
14717 [[foo�|bar]]
14718 [[foo/.|bar]]
14719 [[foo/..|bar]]
14720 [[foo~~~bar]]
14721 [[foo>bar]]
14722 [[foo[bar]]
14723 [[.]]
14724 [[..]]
14725 [[foo././bar]]
14726
14727 [[{{echo|./../foo}}|bar]]
14728 [[{{echo|foo/.}}|bar]]
14729 [[{{echo|foo/..}}|bar]]
14730 [[{{echo|foo~~~~bar}}]]
14731 [[{{echo|foo>bar}}]]
14732 [[{{echo|foo././bar}}]]
14733 [[{{echo|foo{bar}}]]
14734 [[{{echo|foo}bar}}]]
14735 [[{{echo|foo[bar}}]]
14736 [[{{echo|foo]bar}}]]
14737 [[{{echo|foo<bar}}]]
14738 !!html/php
14739 <p>[[./../foo|bar]]
14740 [[foo�|bar]]
14741 [[foo/.|bar]]
14742 [[foo/..|bar]]
14743 [[foo~~~bar]]
14744 [[foo&gt;bar]]
14745 [[foo[bar]]
14746 [[.]]
14747 [[..]]
14748 [[foo././bar]]
14749 </p><p>[[./../foo|bar]]
14750 [[foo/.|bar]]
14751 [[foo/..|bar]]
14752 [[foo~~~~bar]]
14753 [[foo&gt;bar]]
14754 [[foo././bar]]
14755 [[foo{bar]]
14756 [[foo}bar]]
14757 [[foo[bar]]
14758 [[foo]bar]]
14759 [[foo&lt;bar]]
14760 </p>
14761 !!html/parsoid
14762 <p>[[./../foo|bar]]
14763 [[foo�|bar]]
14764 [[foo/.|bar]]
14765 [[foo/..|bar]]
14766 [[foo~~~bar]]
14767 [[foo>bar]]
14768 [[foo[bar]]
14769 [[.]]
14770 [[..]]
14771 [[foo././bar]]</p>
14772
14773 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14774 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14775 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14776 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14777 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14778 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14779 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14780 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14781 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14782 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14783 [[<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>
14784 !!end
14785
14786 !! test
14787 Disabled subpages
14788 !! wikitext
14789 [[/subpage]]
14790 !! html
14791 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14792 </p>
14793 !! end
14794
14795 !! test
14796 BUG 561: {{/Subpage}}
14797 !! options
14798 subpage title=[[Page]]
14799 !! wikitext
14800 {{/Subpage}}
14801 !! html
14802 <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>
14803 </p>
14804 !! end
14805
14806 ###
14807 ### Categories
14808 ###
14809 !! article
14810 Category:MediaWiki User's Guide
14811 !! text
14812 blah
14813 !! endarticle
14814
14815 !! test
14816 Link to category
14817 !! wikitext
14818 [[:Category:MediaWiki User's Guide]]
14819 !! html
14820 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14821 </p>
14822 !! end
14823
14824 !! test
14825 Simple category
14826 !! options
14827 cat
14828 !! wikitext
14829 [[Category:MediaWiki User's Guide]]
14830 !! html/php
14831 cat=MediaWiki_User's_Guide sort=
14832 !! html/parsoid
14833 <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"}}'/>
14834 !! end
14835
14836 !! test
14837 PAGESINCATEGORY invalid title fatal (r33546 fix)
14838 !! wikitext
14839 {{PAGESINCATEGORY:<bogus>}}
14840 !! html
14841 <p>0
14842 </p>
14843 !! end
14844
14845 !! test
14846 Category with different sort key
14847 !! options
14848 cat
14849 !! wikitext
14850 [[Category:MediaWiki User's Guide|Foo]]
14851 !! html/php
14852 cat=MediaWiki_User's_Guide sort=Foo
14853 !! html/parsoid
14854 <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"}}'/>
14855 !! end
14856
14857 !! test
14858 Category with identical sort key
14859 !! options
14860 cat
14861 !! wikitext
14862 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14863 !! html/php
14864 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
14865 !! html/parsoid
14866 <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"}}'/>
14867 !! end
14868
14869 !! test
14870 Category with empty sort key
14871 !! options
14872 cat
14873 pst
14874 !! wikitext
14875 [[Category:MediaWiki User's Guide|]]
14876 !! html/php
14877 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14878 !! end
14879
14880 !! test
14881 Category with empty sort key and parentheses
14882 !! options
14883 cat
14884 pst
14885 !! wikitext
14886 [[Category:Foo (bar)|]]
14887 !! html/php
14888 [[Category:Foo (bar)|Foo]]
14889 !! end
14890
14891 !! test
14892 Category with link tail
14893 !! options
14894 cat
14895 pst
14896 !! wikitext
14897 123[[Category:Foo]]456
14898 !! html/php
14899 123[[Category:Foo]]456
14900 !! end
14901
14902 !! test
14903 Category with template
14904 !! options
14905 cat
14906 pst
14907 !! wikitext
14908 [[Category:{{echo|Foo}}]]
14909 !! html/php
14910 [[Category:{{echo|Foo}}]]
14911 !! end
14912
14913 !! test
14914 Category with template in sort key
14915 !! options
14916 cat
14917 pst
14918 !! wikitext
14919 [[Category:Foo|{{echo|Bar}}]]
14920 !! html/php
14921 [[Category:Foo|{{echo|Bar}}]]
14922 !! end
14923
14924 !! test
14925 Category with template in sort key and title
14926 !! options
14927 cat
14928 pst
14929 !! wikitext
14930 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14931 !! html/php
14932 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14933 !! end
14934
14935 ## We used to, but no longer wt2wt this test since the default serializer
14936 ## will normalize all categories to serialize on their own line.
14937 ## This wikitext usage is going to be fairly uncommon in production and
14938 ## selser will take care of preserving formatting in those scenarios.
14939 !! test
14940 Category / paragraph interactions
14941 !! options
14942 parsoid=wt2html
14943 !! wikitext
14944 Foo [[Category:Baz]] Bar
14945
14946 Foo [[Category:Baz]]
14947 Bar
14948
14949 Foo
14950 [[Category:Baz]]
14951 Bar
14952
14953 Foo
14954 [[Category:Baz]] Bar
14955
14956 Foo
14957 [[Category:Baz]]
14958 [[Category:Baz]]
14959 [[Category:Baz]]
14960 Bar
14961
14962 [[Category:Baz]]
14963 [[Category:Baz]]
14964 [[Category:Baz]]
14965
14966 [[Category:Baz]]
14967 {{echo|[[Category:Baz]]}}
14968 [[Category:Baz]]
14969 !! html/php
14970 <p>Foo Bar
14971 </p><p>Foo
14972 Bar
14973 </p><p>Foo
14974 Bar
14975 </p><p>Foo Bar
14976 </p><p>Foo
14977 Bar
14978 </p>
14979 !! html/parsoid
14980 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14981 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14982 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14983 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14984 <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>
14985 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14986 !! end
14987
14988 ## We used to, but no longer wt2wt this test since the default serializer
14989 ## will normalize all categories to serialize on their own line.
14990 ## This wikitext usage is going to be fairly uncommon in production and
14991 ## selser will take care of preserving formatting in those scenarios.
14992 ##
14993 ## The whitespace on the empty line is part of the test. Please do not delete
14994 !! test
14995 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14996 !! options
14997 parsoid=wt2html
14998 !! wikitext
14999 This
15000
15001 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15002
15003 {{echo|[[Category:Foo]] and so should this!}}
15004 !! html/php
15005 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15006 </p>
15007 !! html/parsoid
15008 <p>This
15009
15010 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15011
15012 <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>
15013 !! end
15014
15015 ## Parsoid will not try to wt2wt this while preserving newlines because
15016 ## it suppresses excess newlines within list items -- and we don't want to
15017 ## introduce a special case just for categories, which is, in reality somewhat
15018 ## odd behavior -- categories are unlikely to be used in list items like this
15019 ## in top-level pages and are only likely to show up in template-generated
15020 ## list items where this RT-ing is a non-issue.
15021 ##
15022 ## The whitespace on the empty line is part of the test. Please do not delete
15023 !! test
15024 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
15025 !! options
15026 parsoid=wt2html
15027 !! wikitext
15028 * This
15029
15030 [[Category:Foo]] and this should be part of the same list item
15031 * So should this
15032
15033 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15034 !! html
15035 <ul><li>This and this should be part of the same list item</li>
15036 <li>So should this and this should be part of the same list item</li></ul>
15037 !! html/parsoid
15038 <ul>
15039 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15040 <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>
15041 </ul>
15042 !! end
15043
15044 ## Newlines and categories that follow the last item of a list
15045 ## are treated differently because this (list followed by categories)
15046 ## is an extremely common pattern on wikis.
15047 !! test
15048 3. Categories and newlines: newline suppression for last list item should RT properly
15049 !! wikitext
15050 * a
15051 * b
15052
15053 [[Category:Foo]]
15054
15055 [[Category:Bar]]
15056 [[Category:Baz]]
15057 !! html/parsoid
15058 <ul><li> a</li>
15059 <li> b</li></ul>
15060
15061 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15062
15063 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15064 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15065 !! end
15066
15067 !! test
15068 4. Categories and newlines: newline suppression for last list item should RT properly
15069 !! wikitext
15070 * a
15071 **** b
15072
15073 [[Category:Foo]]
15074 !! html/parsoid
15075 <ul><li> a
15076 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15077
15078 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15079 !! end
15080
15081 ## only wt2html for this to make sure the algo only applies to the rightmost path
15082 !! test
15083 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15084 !! options
15085 parsoid=wt2html
15086 !! wikitext
15087 * a
15088 ** b
15089 [[Category:Foo]]
15090 * c
15091 ** d
15092 [[Category:Foo]]
15093 !! html/parsoid
15094 <ul><li> a
15095 <ul><li> b
15096 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15097 <li> c
15098 <ul><li> d</li></ul></li></ul>
15099 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15100 !! end
15101
15102 ## We used to, but no longer wt2wt this test since the default serializer
15103 ## will normalize all categories to serialize on their own line.
15104 ## This wikitext usage is going to be fairly uncommon in production and
15105 ## selser will take care of preserving formatting in those scenarios.
15106 !! test
15107 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15108 !! options
15109 parsoid=wt2html
15110 !! wikitext
15111 * a [[Category:Foo]]
15112 !! html/parsoid
15113 <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>
15114 !! end
15115
15116 # This test also demonstrates because of newline+category tunneling
15117 # through the list hander, template wrapping doesn't expand to the
15118 # containing list when the list item swallows the category.
15119 !! test
15120 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15121 !! wikitext
15122 * {{echo|a
15123 [[Category:Foo]]}}
15124 !! html/parsoid
15125 <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
15126 </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>
15127 !! end
15128
15129 !! test
15130 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15131 !! wikitext
15132 * a
15133
15134 {{echo|[[Category:Foo]]
15135 [[Category:Bar]]}}
15136 [[Category:Baz]]
15137 !! html/parsoid
15138 <ul><li> a</li></ul>
15139
15140 <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">
15141 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15142 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15143 !! end
15144
15145 !! test
15146 Category links with multiple namespaces
15147 !! wikitext
15148 [[Category:Project:Foo]]
15149 !! html/parsoid
15150 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15151 !! end
15152
15153 !! test
15154 Parsoid: Serialize link to category page with colon escape
15155 !! options
15156 parsoid
15157 !! wikitext
15158
15159 [[:Category:Foo]]
15160 [[:Category:Foo|Bar]]
15161 !! html
15162 <p>
15163 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15164 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15165 </p>
15166 !! end
15167
15168 # We used to, but no longer wt2wt this test since the default serializer
15169 # will normalize all categories to serialize on their own line.
15170 # This wikitext usage is going to be fairly uncommon in production and
15171 # selser will take care of preventing whitespace insertion if this
15172 # occurs in an article.
15173 #
15174 # html2html disabled for the same reason (whitespace insertion between
15175 # x and y).
15176 #
15177 # html2wt disabled because it localizes the "Category" namespace.
15178 !! test
15179 Link prefix/suffixes aren't applied to category links
15180 !! options
15181 parsoid=wt2html
15182 language=is
15183 !! wikitext
15184 x[[Category:Foo]]y
15185 !! html/php
15186 <p>xy
15187 </p>
15188 !! html/parsoid
15189 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15190 !! end
15191
15192 !! test
15193 Parsoid: Serialize link to file page with colon escape
15194 !! options
15195 parsoid
15196 !! wikitext
15197
15198 [[:File:Foo.png]]
15199 [[:File:Foo.png|Bar]]
15200 !! html
15201 <p>
15202 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15203 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15204 </p>
15205 !! end
15206
15207 !! test
15208 Parsoid: Serialize a genuine category link without colon escape
15209 !! options
15210 parsoid
15211 !! wikitext
15212 [[Category:Foo]]
15213 [[Category:Foo|Bar]]
15214 !! html
15215 <link rel="mw:PageProp/Category" href="./Category:Foo">
15216 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15217 !! end
15218
15219 !! test
15220 Normalize hrefs properly before testing for invalid link targets (bug 70894)
15221 !! options
15222 parsoid=html2wt
15223 !! html/parsoid
15224 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15225 !! wikitext
15226 [[Category:Toxine bactérienne]]
15227 !! end
15228
15229 !! test
15230 Parsoid: Defaultsort
15231 !! wikitext
15232 {{DEFAULTSORT:Foo}}
15233 !! html/parsoid
15234 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15235 !! end
15236
15237 !! test
15238 Parsoid: Defaultsort (template-generated)
15239 !! wikitext
15240 {{{{echo|DEFAULTSORT}}:Foo}}
15241 !! html/parsoid
15242 <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}}]}'/>
15243 !! end
15244
15245 ###
15246 ### Inter-language links
15247 ###
15248 !! test
15249 Interlanguage links
15250 !! options
15251 ill
15252 !! wikitext
15253 [[es:Alimento]]
15254 [[fr:Nourriture]]
15255 [[zh:食品]]
15256 !! html/php
15257 es:Alimento fr:Nourriture zh:食品
15258 !! html/parsoid
15259 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15260 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15261 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15262 !! end
15263
15264 !! test
15265 Duplicate interlanguage links (bug 24502)
15266 !! options
15267 ill
15268 !! wikitext
15269 [[es:1]]
15270 [[es:2]]
15271 [[fr:1]]
15272 [[fr:2]]
15273 !! html/php
15274 es:1 fr:1
15275 !! html/parsoid
15276 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15277 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15278 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15279 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15280 !! end
15281
15282 ###
15283 ### Sections
15284 ###
15285 !! test
15286 Basic section headings
15287 !! wikitext
15288 == Headline 1 ==
15289 Some text
15290
15291 ==Headline 2==
15292 More
15293 ===Smaller headline===
15294 Blah blah
15295 !! html
15296 <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>
15297 <p>Some text
15298 </p>
15299 <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>
15300 <p>More
15301 </p>
15302 <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>
15303 <p>Blah blah
15304 </p>
15305 !! end
15306
15307 !! test
15308 Section headings with TOC
15309 !! wikitext
15310 == Headline 1 ==
15311 === Subheadline 1 ===
15312 ===== Skipping a level =====
15313 ====== Skipping a level ======
15314
15315 == Headline 2 ==
15316 Some text
15317 ===Another headline===
15318 !! html
15319 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15320 <ul>
15321 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15322 <ul>
15323 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15324 <ul>
15325 <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>
15326 <ul>
15327 <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>
15328 </ul>
15329 </li>
15330 </ul>
15331 </li>
15332 </ul>
15333 </li>
15334 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15335 <ul>
15336 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15337 </ul>
15338 </li>
15339 </ul>
15340 </div>
15341
15342 <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>
15343 <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>
15344 <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>
15345 <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>
15346 <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>
15347 <p>Some text
15348 </p>
15349 <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>
15350
15351 !! end
15352
15353 !! test
15354 TOC anchors don't collide
15355 !! wikitext
15356 __FORCETOC__
15357 == Headline 2 ==
15358 == Headline ==
15359 == Headline 2 ==
15360 == Headline ==
15361 !! html/php
15362 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15363 <ul>
15364 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15365 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15366 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15367 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15368 </ul>
15369 </div>
15370
15371 <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>
15372 <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>
15373 <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>
15374 <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>
15375
15376 !! end
15377
15378 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15379 !! test
15380 Handling of sections up to level 6 and beyond
15381 !! wikitext
15382 = Level 1 Heading=
15383 == Level 2 Heading==
15384 === Level 3 Heading===
15385 ==== Level 4 Heading====
15386 ===== Level 5 Heading=====
15387 ====== Level 6 Heading======
15388 ======= Level 7 Heading=======
15389 ======== Level 8 Heading========
15390 ========= Level 9 Heading=========
15391 ========== Level 10 Heading==========
15392 !! html
15393 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15394 <ul>
15395 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15396 <ul>
15397 <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>
15398 <ul>
15399 <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>
15400 <ul>
15401 <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>
15402 <ul>
15403 <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>
15404 <ul>
15405 <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>
15406 <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>
15407 <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>
15408 <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>
15409 <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>
15410 </ul>
15411 </li>
15412 </ul>
15413 </li>
15414 </ul>
15415 </li>
15416 </ul>
15417 </li>
15418 </ul>
15419 </li>
15420 </ul>
15421 </div>
15422
15423 <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>
15424 <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>
15425 <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>
15426 <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>
15427 <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>
15428 <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>
15429 <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>
15430 <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>
15431 <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>
15432 <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>
15433
15434 !! end
15435
15436 !! test
15437 TOC regression (T11764)
15438 !! wikitext
15439 == title 1 ==
15440 === title 1.1 ===
15441 ==== title 1.1.1 ====
15442 === title 1.2 ===
15443 == title 2 ==
15444 === title 2.1 ===
15445 !! html
15446 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15447 <ul>
15448 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15449 <ul>
15450 <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>
15451 <ul>
15452 <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>
15453 </ul>
15454 </li>
15455 <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>
15456 </ul>
15457 </li>
15458 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15459 <ul>
15460 <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>
15461 </ul>
15462 </li>
15463 </ul>
15464 </div>
15465
15466 <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>
15467 <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>
15468 <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>
15469 <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>
15470 <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>
15471 <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>
15472
15473 !! end
15474
15475 !! test
15476 TOC for heading containing <span id="..."></span> (T96153)
15477 !! wikitext
15478 __FORCETOC__
15479 ==<span id="old-anchor"></span>New title==
15480 !! html/php
15481 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15482 <ul>
15483 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15484 </ul>
15485 </div>
15486
15487 <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>
15488
15489 !! end
15490
15491 !! test
15492 TOC with wgMaxTocLevel=3 (bug 6204)
15493 !! options
15494 wgMaxTocLevel=3
15495 !! wikitext
15496 == title 1 ==
15497 === title 1.1 ===
15498 ==== title 1.1.1 ====
15499 === title 1.2 ===
15500 == title 2 ==
15501 === title 2.1 ===
15502 !! html
15503 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15504 <ul>
15505 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15506 <ul>
15507 <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>
15508 <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>
15509 </ul>
15510 </li>
15511 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15512 <ul>
15513 <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>
15514 </ul>
15515 </li>
15516 </ul>
15517 </div>
15518
15519 <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>
15520 <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>
15521 <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>
15522 <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>
15523 <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>
15524 <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>
15525
15526 !! end
15527
15528 !! test
15529 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15530 !! options
15531 wgMaxTocLevel=3
15532 !! wikitext
15533 ==Section 1==
15534 ===Section 1.1===
15535 ====Section 1.1.1====
15536 ====Section 1.1.1.1====
15537 ==Section 2==
15538 !! html
15539 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15540 <ul>
15541 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15542 <ul>
15543 <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>
15544 </ul>
15545 </li>
15546 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15547 </ul>
15548 </div>
15549
15550 <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>
15551 <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>
15552 <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>
15553 <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>
15554 <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>
15555
15556 !! end
15557
15558
15559 !! test
15560 Resolving duplicate section names
15561 !! wikitext
15562 == Foo bar ==
15563 == Foo bar ==
15564 !! html
15565 <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>
15566 <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>
15567
15568 !! end
15569
15570 !! test
15571 Resolving duplicate section names with differing case (bug 10721)
15572 !! wikitext
15573 == Foo bar ==
15574 == Foo Bar ==
15575 !! html
15576 <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>
15577 <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>
15578
15579 !! end
15580
15581 !! article
15582 Template:sections
15583 !! text
15584 ===Section 1===
15585 ==Section 2==
15586 !! endarticle
15587
15588 !! test
15589 Template with sections, __NOTOC__
15590 !! wikitext
15591 __NOTOC__
15592 ==Section 0==
15593 {{sections}}
15594 ==Section 4==
15595 !! html
15596 <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>
15597 <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>
15598 <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>
15599 <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>
15600
15601 !! end
15602
15603 !! test
15604 __NOEDITSECTION__ keyword
15605 !! wikitext
15606 __NOEDITSECTION__
15607 ==Section 1==
15608 ==Section 2==
15609 !! html
15610 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15611 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15612
15613 !! end
15614
15615 !! test
15616 Link inside a section heading
15617 !! wikitext
15618 ==Section with a [[Main Page|link]] in it==
15619 !! html
15620 <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>
15621
15622 !! end
15623
15624 !! test
15625 TOC regression (T14077)
15626 !! wikitext
15627 __TOC__
15628 == title 1 ==
15629 === title 1.1 ===
15630 == title 2 ==
15631 !! html
15632 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15633 <ul>
15634 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15635 <ul>
15636 <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>
15637 </ul>
15638 </li>
15639 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15640 </ul>
15641 </div>
15642
15643 <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>
15644 <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>
15645 <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>
15646
15647 !! end
15648
15649 !! test
15650 BUG 1219 URL next to image (good)
15651 !! wikitext
15652 http://example.com [[File:Foobar.jpg]]
15653 !! html/php
15654 <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>
15655 </p>
15656 !! html/parsoid
15657 <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>
15658 !!end
15659
15660 !! test
15661 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15662 !! wikitext
15663 ===
15664 The line above must have a trailing space!
15665 === <!--
15666 --> <!-- -->
15667 But just in case it doesn't...
15668 !! html
15669 <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>
15670 <p>The line above must have a trailing space!
15671 </p>
15672 <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>
15673 <p>But just in case it doesn't...
15674 </p>
15675 !! end
15676
15677 !! test
15678 Header with special characters (bug 25462)
15679 !! wikitext
15680 The tooltips shall not show entities to the user (ie. be double escaped)
15681
15682 == text > text ==
15683 section 1
15684
15685 == text < text ==
15686 section 2
15687
15688 == text & text ==
15689 section 3
15690
15691 == text ' text ==
15692 section 4
15693
15694 == text " text ==
15695 section 5
15696 !! html
15697 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15698 </p>
15699 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15700 <ul>
15701 <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>
15702 <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>
15703 <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>
15704 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15705 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15706 </ul>
15707 </div>
15708
15709 <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>
15710 <p>section 1
15711 </p>
15712 <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>
15713 <p>section 2
15714 </p>
15715 <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>
15716 <p>section 3
15717 </p>
15718 <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>
15719 <p>section 4
15720 </p>
15721 <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>
15722 <p>section 5
15723 </p>
15724 !! end
15725
15726 !! test
15727 Header with space, plus and underscore as entity
15728 !! wikitext
15729 Id should not contain + for spaces
15730
15731 == Space between Text ==
15732 section 1
15733
15734 == Space-Entity&#32;between&#32;Text ==
15735 section 2
15736
15737 == Plus+between+Text ==
15738 section 3
15739
15740 == Plus-Entity&#43;between&#43;Text ==
15741 section 4
15742
15743 == Underscore_between_Text ==
15744 section 5
15745
15746 == Underscore-Entity&#95;between&#95;Text ==
15747 section 6
15748
15749 [[#Space between Text]]
15750 [[#Space-Entity&#32;between&#32;Text]]
15751 [[#Plus+between+Text]]
15752 [[#Plus-Entity&#43;between&#43;Text]]
15753 [[#Underscore_between_Text]]
15754 [[#Underscore-Entity&#95;between&#95;Text]]
15755 !! html
15756 <p>Id should not contain + for spaces
15757 </p>
15758 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15759 <ul>
15760 <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>
15761 <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>
15762 <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>
15763 <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>
15764 <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>
15765 <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>
15766 </ul>
15767 </div>
15768
15769 <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>
15770 <p>section 1
15771 </p>
15772 <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>
15773 <p>section 2
15774 </p>
15775 <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>
15776 <p>section 3
15777 </p>
15778 <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>
15779 <p>section 4
15780 </p>
15781 <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>
15782 <p>section 5
15783 </p>
15784 <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>
15785 <p>section 6
15786 </p><p><a href="#Space_between_Text">#Space between Text</a>
15787 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15788 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15789 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15790 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15791 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15792 </p>
15793 !! end
15794
15795 !! test
15796 Headers with excess '=' characters
15797 (Are similar tests necessary beyond the 1st level?)
15798 !! wikitext
15799 =foo==
15800 ==foo=
15801 =''italic'' heading==
15802 ==''italic'' heading=
15803 !! html
15804 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15805 <ul>
15806 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15807 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15808 <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>
15809 <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>
15810 </ul>
15811 </div>
15812
15813 <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>
15814 <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>
15815 <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>
15816 <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>
15817
15818 !! end
15819
15820 !! test
15821 HTML headers vs TOC (bug 23393)
15822 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15823 !! wikitext
15824 <h1>Header 1</h1>
15825 == Header 1.1 ==
15826 == Header 1.2 ==
15827
15828 <h1>Header 2
15829 </h1>
15830 == Header 2.1 ==
15831 == Header 2.2 ==
15832 __NOEDITSECTION__
15833 !! html
15834 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15835 <ul>
15836 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15837 <ul>
15838 <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>
15839 <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>
15840 </ul>
15841 </li>
15842 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15843 <ul>
15844 <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>
15845 <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>
15846 </ul>
15847 </li>
15848 </ul>
15849 </div>
15850
15851 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15852 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15853 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15854 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15855 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15856 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15857
15858 !! end
15859
15860 !! test
15861 Single-line or multiline-comments can follow headings
15862 !! options
15863 parsoid=wt2html,wt2wt
15864 !! wikitext
15865 ==foo==<!---->
15866 ==bar==<!--c1-->
15867 ==baz==<!--
15868 c2
15869 c3-->
15870 !! html
15871 <h2><span class="mw-headline" id="foo">foo</span></h2>
15872 <h2><span class="mw-headline" id="bar">bar</span></h2>
15873 <h2><span class="mw-headline" id="baz">baz</span></h2>
15874
15875 !! end
15876
15877 !! test
15878 BUG 1219 URL next to image (broken)
15879 !! wikitext
15880 http://example.com[[File:Foobar.jpg]]
15881 !! html/php
15882 <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>
15883 </p>
15884 !! html/parsoid
15885 <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>
15886 !!end
15887
15888 !! test
15889 Bug 1186 news: in the middle of text
15890 !! wikitext
15891 http://en.wikinews.org/wiki/Wikinews:Workplace
15892 !! html
15893 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15894 </p>
15895 !!end
15896
15897
15898 !! test
15899 Namespaced link must have a title
15900 !! wikitext
15901 [[Project:]]
15902 !! html
15903 <p>[[Project:]]
15904 </p>
15905 !!end
15906
15907 !! test
15908 Namespaced link must have a title (bad fragment version)
15909 !! wikitext
15910 [[Project:#fragment]]
15911 !! html
15912 <p>[[Project:#fragment]]
15913 </p>
15914 !!end
15915
15916
15917 ###
15918 ### HTML tags and HTML attributes
15919 ###
15920
15921 !! test
15922 div with no attributes
15923 !! wikitext
15924 <div>HTML rocks</div>
15925 !! html
15926 <div>HTML rocks</div>
15927
15928 !! end
15929
15930 !! test
15931 div with double-quoted attribute
15932 !! wikitext
15933 <div id="rock">HTML rocks</div>
15934 !! html
15935 <div id="rock">HTML rocks</div>
15936
15937 !! end
15938
15939 !! test
15940 div with single-quoted attribute
15941 !! wikitext
15942 <div id='rock'>HTML rocks</div>
15943 !! html
15944 <div id="rock">HTML rocks</div>
15945
15946 !! end
15947
15948 !! test
15949 div with unquoted attribute
15950 !! wikitext
15951 <div id=rock>HTML rocks</div>
15952 !! html
15953 <div id="rock">HTML rocks</div>
15954
15955 !! end
15956
15957 !! test
15958 div with illegal double attributes
15959 !! wikitext
15960 <div id="a" id="b">HTML rocks</div>
15961 !! html
15962 <div id="b">HTML rocks</div>
15963
15964 !!end
15965
15966 !! test
15967 div with empty attribute value, space before equals
15968 !! options
15969 parsoid=wt2html,html2html
15970 !! wikitext
15971 <div class =>HTML rocks</div>
15972 !! html/php
15973 <div class="">HTML rocks</div>
15974
15975 !! html/parsoid
15976 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15977 !! end
15978
15979 !! test
15980 div with multiple empty attribute values
15981 !! options
15982 parsoid=wt2html,html2html
15983 !! wikitext
15984 <div id= title=>HTML rocks</div>
15985 !! html/php
15986 <div id="title.3D">HTML rocks</div>
15987
15988 !! html/parsoid
15989 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15990 !! end
15991
15992 !! test
15993 table with multiple empty attribute values
15994 !! options
15995 parsoid=wt2html,html2html
15996 !! wikitext
15997 {| title= id=
15998 | hi
15999 |}
16000 !! html/php
16001 <table title="id=">
16002 <tr>
16003 <td> hi
16004 </td></tr></table>
16005
16006 !! html/parsoid
16007 <table title="id=">
16008 <tbody><tr><td> hi</td></tr>
16009 </tbody></table>
16010 !! end
16011
16012 !! test
16013 div with braces in attribute value
16014 !! wikitext
16015 <div title="{}">Foo</div>
16016 !! html/php
16017 <div title="&#123;}">Foo</div>
16018
16019 !! html/parsoid
16020 <div title="{}">Foo</div>
16021 !! end
16022
16023 !! test
16024 div with empty attribute value, no space before equals
16025 !! options
16026 parsoid=wt2html,html2html
16027 !! wikitext
16028 <div class=>HTML rocks</div>
16029 !! html/php
16030 <div class="">HTML rocks</div>
16031
16032 !! html/parsoid
16033 <div class="">HTML rocks</div>
16034 !! end
16035
16036 !! test
16037 HTML multiple attributes correction
16038 !! wikitext
16039 <p class="error" class="awesome">Awesome!</p>
16040 !! html
16041 <p class="awesome">Awesome!</p>
16042
16043 !!end
16044
16045 !! test
16046 Table multiple attributes correction
16047 !! wikitext
16048 {|
16049 !+ class="error" class="awesome"| status
16050 |}
16051 !! html
16052 <table>
16053 <tr>
16054 <th class="awesome"> status
16055 </th></tr></table>
16056
16057 !!end
16058
16059 !! test
16060 DIV IN UPPERCASE
16061 !! wikitext
16062 <DIV ID="x">HTML ROCKS</DIV>
16063 !! html
16064 <div id="x">HTML ROCKS</div>
16065
16066 !!end
16067
16068 !! test
16069 Non-ASCII pseudo-tags are rendered as text
16070 !! wikitext
16071 <khyô>
16072 !! html
16073 <p>&lt;khyô&gt;
16074 </p>
16075 !! end
16076
16077 !! test
16078 Pseudo-tag with URL 'name' renders as url link
16079 !! wikitext
16080 <http://example.com/>
16081 !! html
16082 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16083 </p>
16084 !! end
16085
16086 !! test
16087 text with amp in the middle of nowhere
16088 !! wikitext
16089 Remember AT&T?
16090 !! html
16091 <p>Remember AT&amp;T?
16092 </p>
16093 !! end
16094
16095 !! test
16096 text with character entity: eacute
16097 !! wikitext
16098 I always thought &eacute; was a cute letter.
16099 !! html
16100 <p>I always thought &#233; was a cute letter.
16101 </p>
16102 !! html+tidy
16103 <p>I always thought é was a cute letter.</p>
16104 !! end
16105
16106 !! test
16107 text with entity-escaped character entity-like string: eacute
16108 !! wikitext
16109 I always thought &amp;eacute; was a cute letter.
16110 !! html
16111 <p>I always thought &amp;eacute; was a cute letter.
16112 </p>
16113 !! end
16114
16115 !! test
16116 text with undefined character entity: xacute
16117 !! wikitext
16118 I always thought &xacute; was a cute letter.
16119 !! html
16120 <p>I always thought &amp;xacute; was a cute letter.
16121 </p>
16122 !! end
16123
16124 !! test
16125 HTML5 tags
16126 !! wikitext
16127 <data value="5">five</data>
16128 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16129 <mark>This highlighted text</mark>
16130 !! html
16131 <p><data value="5">five</data>
16132 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16133 <mark>This highlighted text</mark>
16134 </p>
16135 !! end
16136
16137 !! test
16138 HTML tag with leading space is parsed as text
16139 !! wikitext
16140 < div>foo< /div>
16141 !! html
16142 <p>&lt; div&gt;foo&lt; /div&gt;
16143 </p>
16144 !! end
16145
16146 ###
16147 ### Nesting tests (see bug 41545, 50604, 51081)
16148 ###
16149
16150 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
16151 # Note that html2wt is considerably more difficult if we use <b> in
16152 # the test case, instead of <big>
16153 !! test
16154 Ensure that HTML adoption agency algorithm is properly implemented.
16155 !! wikitext
16156 <big>X<big>Y</big>Z</big>
16157 !! html
16158 <p><big>X<big>Y</big>Z</big>
16159 </p>
16160 !! end
16161
16162 # This was bug 41545 in the PHP parser.
16163 # Note that tidy doesn't handle this correctly.
16164 !! test
16165 Nesting of <kbd>
16166 !! wikitext
16167 <kbd>X<kbd>Y</kbd>Z</kbd>
16168 !! html
16169 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16170 </p>
16171 !! end
16172
16173 # The following cases were bug 51081 in the PHP parser.
16174 # Note that there are some other nestable tags (b, i, etc) which are
16175 # not covered; see bug 51081 for discussion.
16176
16177 # Note that tidy doesn't handle this correctly.
16178 !! test
16179 Nesting of <em>
16180 !! wikitext
16181 <em>X<em>Y</em>Z</em>
16182 !! html
16183 <p><em>X<em>Y</em>Z</em>
16184 </p>
16185 !! end
16186
16187 # Note that tidy doesn't handle this correctly.
16188 !! test
16189 Nesting of <strong>
16190 !! wikitext
16191 <strong>X<strong>Y</strong>Z</strong>
16192 !! html
16193 <p><strong>X<strong>Y</strong>Z</strong>
16194 </p>
16195 !! end
16196
16197 !! test
16198 Nesting of <q>
16199 !! wikitext
16200 <q>X<q>Y</q>Z</q>
16201 !! html+tidy
16202 <p><q>X<q>Y</q>Z</q></p>
16203 !! end
16204
16205 # Note that tidy doesn't handle this correctly.
16206 !! test
16207 Nesting of <ruby>
16208 !! wikitext
16209 <ruby>X<ruby>Y</ruby>Z</ruby>
16210 !! html
16211 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16212 </p>
16213 !! end
16214
16215 # Note that tidy doesn't handle this correctly.
16216 !! test
16217 Nesting of <bdo>
16218 !! wikitext
16219 <bdo>X<bdo>Y</bdo>Z</bdo>
16220 !! html
16221 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16222 </p>
16223 !! end
16224
16225
16226 ###
16227 ### Media links
16228 ###
16229
16230 !! test
16231 Media link
16232 !! wikitext
16233 [[Media:Foobar.jpg]]
16234 !! html
16235 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16236 </p>
16237 !! end
16238
16239 !! test
16240 Media link with text
16241 !! wikitext
16242 [[Media:Foobar.jpg|A neat file to look at]]
16243 !! html
16244 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16245 </p>
16246 !! end
16247
16248 # FIXME: this is still bad HTML tag nesting
16249 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16250 !! test
16251 Media link with nasty text
16252 !! wikitext
16253 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16254 !! html
16255 <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>
16256
16257 !! html+tidy
16258 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16259 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16260 !! end
16261
16262 !! test
16263 Media link to nonexistent file (bug 1702)
16264 !! wikitext
16265 [[Media:No such.jpg]]
16266 !! html
16267 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16268 </p>
16269 !! end
16270
16271 !! test
16272 Image link to nonexistent file (bug 1850 - good)
16273 !! wikitext
16274 [[File:No_such.jpg]]
16275 !! html/php
16276 <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>
16277 </p>
16278 !! html/parsoid
16279 <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>
16280 !! end
16281
16282 !! test
16283 :Image link to nonexistent file (bug 1850 - bad)
16284 !! wikitext
16285 [[:Image:No such.jpg]]
16286 !! html/php
16287 <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>
16288 </p>
16289 !! html/parsoid
16290 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16291 !! end
16292
16293
16294
16295 !! test
16296 Character reference normalization in link text (bug 1938)
16297 !! wikitext
16298 [[Main Page|this&that]]
16299 !! html
16300 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16301 </p>
16302 !!end
16303
16304 !! article
16305 אַ
16306 !! text
16307 Test for unicode normalization
16308
16309 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16310 !! endarticle
16311
16312 !! test
16313 (bug 19451) Links should refer to the normalized form.
16314 !! wikitext
16315 [[&#xFB2E;]]
16316 [[&#x5d0;&#x5b7;]]
16317 [[&#x5d0;ַ]]
16318 [[א&#x5b7;]]
16319 [[אַ]]
16320 !! html
16321 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16322 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16323 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16324 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16325 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16326 </p>
16327 !! end
16328
16329 !! test
16330 Empty attribute crash test (bug 2067)
16331 !! wikitext
16332 <font color="">foo</font>
16333 !! html
16334 <p><font color="">foo</font>
16335 </p>
16336 !! end
16337
16338 !! test
16339 Empty attribute crash test single-quotes (bug 2067)
16340 !! wikitext
16341 <font color=''>foo</font>
16342 !! html
16343 <p><font color="">foo</font>
16344 </p>
16345 !! end
16346
16347 !! test
16348 Attribute test: equals, then nothing
16349 !! options
16350 parsoid=wt2html,html2html
16351 !! wikitext
16352 <font color=>foo</font>
16353 !! html/php
16354 <p><font color="">foo</font>
16355 </p>
16356 !! html/parsoid
16357 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16358 !! end
16359
16360 !! test
16361 Attribute test: unquoted value
16362 !! options
16363 parsoid=wt2html,html2html
16364 !! wikitext
16365 <font color=x>foo</font>
16366 !! html/php
16367 <p><font color="x">foo</font>
16368 </p>
16369 !! html/parsoid
16370 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16371 !! end
16372
16373 !! test
16374 Attribute test: unquoted but illegal value (hash)
16375 !! wikitext
16376 <font color=#x>foo</font>
16377 !! html
16378 <p><font color="#x">foo</font>
16379 </p>
16380 !! end
16381
16382 # Parsoid does not serialize to empty attribute syntax,
16383 # so wt2wt and html2wt cases are skipped
16384 !! test
16385 Attribute test: no value (T54330)
16386 !! options
16387 parsoid=wt2html,html2html
16388 !! wikitext
16389 <font color>foo</font>
16390 !! html/php
16391 <p><font color="">foo</font>
16392 </p>
16393 !! html/parsoid
16394 <p><font color="">foo</font></p>
16395 !! end
16396
16397 !! test
16398 Bug 2095: link with three closing brackets
16399 !! wikitext
16400 [[Main Page]]]
16401 !! html/php
16402 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16403 </p>
16404 !! html/parsoid
16405 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16406 !! end
16407
16408 !! test
16409 Bug 2095: link with pipe and three closing brackets
16410 !! wikitext
16411 [[Main Page|link]]]
16412 !! html/php
16413 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16414 </p>
16415 !! html/parsoid
16416 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16417 !! end
16418
16419 !! test
16420 Bug 2095: link with pipe and three closing brackets, version 2
16421 !! wikitext
16422 [[Main Page|[http://example.com/]]]
16423 !! html/php
16424 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16425 </p>
16426 !! html/parsoid
16427 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16428 !! end
16429
16430
16431 ###
16432 ### Safety
16433 ###
16434
16435 !! article
16436 Template:Dangerous attribute
16437 !! text
16438 " onmouseover="alert(document.cookie)
16439 !! endarticle
16440
16441 !! article
16442 Template:Dangerous style attribute
16443 !! text
16444 border-size: expression(alert(document.cookie))
16445 !! endarticle
16446
16447 !! article
16448 Template:Div style
16449 !! text
16450 <div style="float: right; {{{1}}}">Magic div</div>
16451 !! endarticle
16452
16453 !! test
16454 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16455 !! wikitext
16456 <div title="{{test}}"></div>
16457 !! html
16458 <div title="This is a test template"></div>
16459
16460 !! end
16461
16462 # Parsoid has enough context to handle this case
16463 !! test
16464 Bug 2304: HTML attribute safety (dangerous template; 2309)
16465 !! wikitext
16466 <div title="{{dangerous attribute}}"></div>
16467 !! html/php
16468 <div title=""></div>
16469
16470 !! html/parsoid
16471 <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>
16472 !! end
16473
16474 !! test
16475 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16476 !! wikitext
16477 <div style="{{dangerous style attribute}}"></div>
16478 !! html
16479 <div style="/* insecure input */"></div>
16480
16481 !! end
16482
16483 !! test
16484 Bug 2304: HTML attribute safety (safe parameter; 2309)
16485 !! wikitext
16486 {{div style|width: 200px}}
16487 !! html
16488 <div style="float: right; width: 200px">Magic div</div>
16489
16490 !! end
16491
16492 !! test
16493 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16494 !! wikitext
16495 {{div style|width: expression(alert(document.cookie))}}
16496 !! html
16497 <div style="/* insecure input */">Magic div</div>
16498
16499 !! end
16500
16501 !! test
16502 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16503 !! wikitext
16504 {{div style|"><script>alert(document.cookie)</script>}}
16505 !! html
16506 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16507
16508 !! end
16509
16510 !! test
16511 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16512 !! wikitext
16513 {{div style|" ><script>alert(document.cookie)</script>}}
16514 !! html
16515 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16516
16517 !! end
16518
16519 !! test
16520 Bug 2304: HTML attribute safety (link)
16521 !! wikitext
16522 <div title="[[Main Page]]"></div>
16523 !! html
16524 <div title="&#91;&#91;Main Page]]"></div>
16525
16526 !! end
16527
16528 !! test
16529 Bug 2304: HTML attribute safety (italics)
16530 !! wikitext
16531 <div title="''foobar''"></div>
16532 !! html
16533 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16534
16535 !! end
16536
16537 !! test
16538 Bug 2304: HTML attribute safety (bold)
16539 !! wikitext
16540 <div title="'''foobar'''"></div>
16541 !! html
16542 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16543
16544 !! end
16545
16546
16547 !! test
16548 Bug 2304: HTML attribute safety (ISBN)
16549 !! wikitext
16550 <div title="ISBN 1234567890"></div>
16551 !! html
16552 <div title="&#73;SBN 1234567890"></div>
16553
16554 !! end
16555
16556 !! test
16557 Bug 2304: HTML attribute safety (RFC)
16558 !! wikitext
16559 <div title="RFC 1234"></div>
16560 !! html
16561 <div title="&#82;FC 1234"></div>
16562
16563 !! end
16564
16565 !! test
16566 Bug 2304: HTML attribute safety (PMID)
16567 !! wikitext
16568 <div title="PMID 1234567890"></div>
16569 !! html
16570 <div title="&#80;MID 1234567890"></div>
16571
16572 !! end
16573
16574 !! test
16575 Bug 2304: HTML attribute safety (web link)
16576 !! wikitext
16577 <div title="http://example.com/"></div>
16578 !! html
16579 <div title="http&#58;//example.com/"></div>
16580
16581 !! end
16582
16583 !! test
16584 Bug 2304: HTML attribute safety (named web link)
16585 !! wikitext
16586 <div title="[http://example.com/ link]"></div>
16587 !! html
16588 <div title="&#91;http&#58;//example.com/ link]"></div>
16589
16590 !! end
16591
16592 !! test
16593 Bug 3244: HTML attribute safety (extension; safe)
16594 !! wikitext
16595 <div style="<nowiki>background:blue</nowiki>"></div>
16596 !! html
16597 <div style="background:blue"></div>
16598
16599 !! end
16600
16601 !! test
16602 Bug 3244: HTML attribute safety (extension; unsafe)
16603 !! wikitext
16604 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16605 !! html
16606 <div style="/* insecure input */"></div>
16607
16608 !! end
16609
16610 # More MSIE fun discovered by Tom Gilder
16611
16612 !! test
16613 MSIE CSS safety test: spurious slash
16614 !! wikitext
16615 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16616 !! html
16617 <div style="/* insecure input */">evil</div>
16618
16619 !! end
16620
16621 !! test
16622 MSIE CSS safety test: hex code
16623 !! wikitext
16624 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16625 !! html
16626 <div style="/* insecure input */">evil</div>
16627
16628 !! end
16629
16630 !! test
16631 MSIE CSS safety test: comment in url
16632 !! wikitext
16633 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16634 !! html
16635 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16636
16637 !! end
16638
16639 !! test
16640 MSIE CSS safety test: comment in expression
16641 !! wikitext
16642 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16643 !! html
16644 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16645
16646 !! end
16647
16648 !! test
16649 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16650 !! wikitext
16651 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16652 !! html
16653 <p style="/* invalid control char */">A</p>
16654
16655 !! end
16656
16657 !! test
16658 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16659 !! wikitext
16660 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16661 <div style="top:EXPRESSION(alert())">B</div>
16662 !! html
16663 <p style="/* insecure input */">A</p>
16664 <div style="/* insecure input */">B</div>
16665
16666 !! end
16667
16668 !! test
16669 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16670 !! wikitext
16671 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16672 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16673 !! html
16674 <div style="/* insecure input */">A</div>
16675 <p style="/* insecure input */">B</p>
16676
16677 !! end
16678
16679 !! test
16680 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16681 !! wikitext
16682 <div style="background-image:url⁽javascript:alert())">A</div>
16683 <div style="background-image:url₍javascript:alert())">B</div>
16684 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16685 !! html
16686 <div style="/* insecure input */">A</div>
16687 <div style="/* insecure input */">B</div>
16688 <p style="/* insecure input */">C</p>
16689
16690 !! end
16691
16692 # FIXME: Parsoid fails to sanitize this! See T58846.
16693 !! test
16694 Opera -o-link CSS
16695 !! wikitext
16696 <div
16697 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;"
16698 style="-o-link:attr(title);-o-link-source:current">X</div>
16699 !! html
16700 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16701
16702 !! end
16703
16704 !! test
16705 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16706 !! wikitext
16707 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16708 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16709 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16710 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16711 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16712 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16713 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16714 !! html
16715 <p style="/* insecure input */">A</p>
16716 <p style="/* insecure input */">B</p>
16717 <p style="/* insecure input */">C</p>
16718 <p style="/* insecure input */">D</p>
16719 <p style="/* insecure input */">E</p>
16720 <p style="/* insecure input */">F</p>
16721 <p style="/* insecure input */">G</p>
16722
16723 !! end
16724
16725 !! test
16726 Table attribute legitimate extension
16727 !! wikitext
16728 {|
16729 !+ style="<nowiki>color:blue</nowiki>"| status
16730 |}
16731 !! html
16732 <table>
16733 <tr>
16734 <th style="color:blue"> status
16735 </th></tr></table>
16736
16737 !!end
16738
16739 !! test
16740 Table attribute safety
16741 !! wikitext
16742 {|
16743 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16744 |}
16745 !! html
16746 <table>
16747 <tr>
16748 <th style="/* insecure input */"> status
16749 </th></tr></table>
16750
16751 !! end
16752
16753 !! test
16754 CSS line continuation 1
16755 !! wikitext
16756 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16757 !! html
16758 <div style="/* insecure input */"></div>
16759
16760 !! end
16761
16762 !! test
16763 CSS line continuation 2
16764 !! wikitext
16765 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16766 !! html
16767 <div style="/* invalid control char */"></div>
16768
16769 !! end
16770
16771 !! article
16772 Template:Identity
16773 !! text
16774 {{{1}}}
16775 !! endarticle
16776
16777 !! test
16778 Expansion of multi-line templates in attribute values (bug 6255)
16779 !! wikitext
16780 <div style="background: {{identity|#00FF00}}">-</div>
16781 !! html
16782 <div style="background: #00FF00">-</div>
16783
16784 !! end
16785
16786
16787 !! test
16788 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16789 !! wikitext
16790 <div style="background:
16791 #00FF00">-</div>
16792 !! html/php
16793 <div style="background: #00FF00">-</div>
16794
16795 !! html/parsoid
16796 <div style="background:
16797 #00FF00">-</div>
16798 !! end
16799
16800 !! test
16801 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16802 !! wikitext
16803 <div style="background: &#10;#00FF00">-</div>
16804 !! html
16805 <div style="background: &#10;#00FF00">-</div>
16806
16807 !! end
16808
16809 !! test
16810 Tags which are hidden from Tidy cannot pass through the Sanitizer
16811 !! wikitext
16812 <mw:toc><script>alert();</script></mw:toc>
16813 !! html+tidy
16814 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
16815 !! end
16816
16817 ###
16818 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16819 ###
16820 !! test
16821 Parser hook: empty input
16822 !! wikitext
16823 <tag></tag>
16824 !! html/php
16825 <pre>
16826 ''
16827 array (
16828 )
16829 </pre>
16830
16831 !! html/parsoid
16832 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16833 !! end
16834
16835 ## Don't expect parsoid to rt this form.
16836 !! test
16837 Parser hook: empty input using terminated empty elements
16838 !! options
16839 parsoid=wt2html,html2html
16840 !! wikitext
16841 <tag/>
16842 !! html/php
16843 <pre>
16844 NULL
16845 array (
16846 )
16847 </pre>
16848
16849 !! html/parsoid
16850 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16851 !! end
16852
16853 !! test
16854 Parser hook: empty input using terminated empty elements (space before)
16855 !! wikitext
16856 <tag />
16857 !! html/php
16858 <pre>
16859 NULL
16860 array (
16861 )
16862 </pre>
16863
16864 !! html/parsoid
16865 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16866 !! end
16867
16868 !! test
16869 Parser hook: basic input
16870 !! wikitext
16871 <tag>input</tag>
16872 !! html/php
16873 <pre>
16874 'input'
16875 array (
16876 )
16877 </pre>
16878
16879 !! html/parsoid
16880 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16881 !! end
16882
16883 ## Don't expect parsoid to rt this form.
16884 !! test
16885 Parser hook: case insensitive
16886 !! options
16887 parsoid=wt2html,html2html
16888 !! wikitext
16889 <TAG>input</TAG>
16890 !! html/php
16891 <pre>
16892 'input'
16893 array (
16894 )
16895 </pre>
16896
16897 !! html/parsoid
16898 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16899 !! end
16900
16901 ## Don't expect parsoid to rt this form.
16902 !! test
16903 Parser hook: case insensitive, redux
16904 !! options
16905 parsoid=wt2html,html2html
16906 !! wikitext
16907 <TaG>input</TAg>
16908 !! html/php
16909 <pre>
16910 'input'
16911 array (
16912 )
16913 </pre>
16914
16915 !! html/parsoid
16916 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16917 !! end
16918
16919 !! test
16920 Parser hook: nested tags
16921 !! wikitext
16922 <tag><tag></tag></tag>
16923 !! html/php
16924 <pre>
16925 '<tag>'
16926 array (
16927 )
16928 </pre>&lt;/tag&gt;
16929
16930 !! html/parsoid
16931 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16932 !! end
16933
16934 !! test
16935 Parser hook: basic arguments
16936 !! wikitext
16937 <tag width="200" height="100" depth="50" square=""></tag>
16938 !! html/php
16939 <pre>
16940 ''
16941 array (
16942 'width' => '200',
16943 'height' => '100',
16944 'depth' => '50',
16945 'square' => '',
16946 )
16947 </pre>
16948
16949 !! html/parsoid
16950 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16951 !! end
16952
16953 ## Don't expect parsoid to rt this form.
16954 !! test
16955 Parser hook: basic arguments, variations
16956 !! options
16957 parsoid=wt2html,html2html
16958 !! wikitext
16959 <tag width=200 height = "100" depth = '50' square></tag>
16960 !! html/php
16961 <pre>
16962 ''
16963 array (
16964 'width' => '200',
16965 'height' => '100',
16966 'depth' => '50',
16967 'square' => '',
16968 )
16969 </pre>
16970
16971 !! html/parsoid
16972 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16973 !! end
16974
16975 !! test
16976 Parser hook: argument containing a forward slash (bug 5344)
16977 !! wikitext
16978 <tag filename="/tmp/bla"></tag>
16979 !! html/php
16980 <pre>
16981 ''
16982 array (
16983 'filename' => '/tmp/bla',
16984 )
16985 </pre>
16986
16987 !! html/parsoid
16988 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16989 !! end
16990
16991 ## Don't expect parsoid to rt this form.
16992 !! test
16993 Parser hook: empty input using terminated empty elements (bug 2374)
16994 !! options
16995 parsoid=wt2html,html2html
16996 !! wikitext
16997 <tag foo=bar/>text
16998 !! html/php
16999 <pre>
17000 NULL
17001 array (
17002 'foo' => 'bar',
17003 )
17004 </pre>text
17005
17006 !! html/parsoid
17007 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
17008 !! end
17009
17010 ## </tag> should be output literally since there is no matching tag that begins it
17011 ## Don't expect parsoid to rt this form.
17012 !! test
17013 Parser hook: basic arguments using terminated empty elements (bug 2374)
17014 !! options
17015 parsoid=wt2html
17016 !! wikitext
17017 <tag width=200 height = "100" depth = '50' square/>
17018 other stuff
17019 </tag>
17020 !! html/php
17021 <pre>
17022 NULL
17023 array (
17024 'width' => '200',
17025 'height' => '100',
17026 'depth' => '50',
17027 'square' => '',
17028 )
17029 </pre>
17030 <p>other stuff
17031 &lt;/tag&gt;
17032 </p>
17033 !! html/parsoid
17034 <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
17035 &lt;/tag></p>
17036 !! end
17037
17038 ## Don't expect parsoid to rt this form.
17039 !! test
17040 Parser hook: Don't allow unclosed extension tags
17041 !! options
17042 parsoid=wt2html
17043 !! wikitext
17044 test <tag>123
17045
17046 this is a '''test'''
17047 !! html/php
17048 <p>test &lt;tag&gt;123
17049 </p><p>this is a <b>test</b>
17050 </p>
17051 !! html/parsoid
17052 <p>test &lt;tag>123</p>
17053
17054 <p>this is a <b>test</b></p>
17055 !! end
17056
17057 ###
17058 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17059 ###
17060
17061 !! test
17062 Parser hook: static parser hook not inside a comment
17063 !! wikitext
17064 <statictag>hello, world</statictag>
17065
17066 <statictag action="flush" />
17067 !! html/php
17068 <p><br />
17069 hello, world
17070 </p>
17071 !! html/parsoid
17072 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17073 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17074 !! end
17075
17076 !! test
17077 Parser hook: static parser hook inside a comment
17078 !! wikitext
17079 <!-- <statictag>hello, world</statictag> -->
17080 <statictag action="flush" />
17081 !! html/php
17082 <p><br />
17083 </p>
17084 !! html/parsoid
17085 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17086 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17087 !! end
17088
17089 # Nested template calls; this case was broken by Parser.php rev 1.506,
17090 # since reverted.
17091
17092 !! article
17093 Template:One-parameter
17094 !! text
17095 (My parameter is: {{{1}}})
17096 !! endarticle
17097
17098 !! article
17099 Template:Map-one-parameter
17100 !! text
17101 {{{{{1}}}|{{{2}}}}}
17102 !! endarticle
17103
17104 !! test
17105 Nested template calls
17106 !! wikitext
17107 {{Map-one-parameter|One-parameter|param}}
17108 !! html
17109 <p>(My parameter is: param)
17110 </p>
17111 !! end
17112
17113
17114 ###
17115 ### Sanitizer
17116 ###
17117
17118 # HTML+Tidy effectively strips out the empty tags completely
17119 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17120 # which Tidy would have done for the PHP parser had there been content inside it.
17121 !! test
17122 Sanitizer: Closing of open tags
17123 !! wikitext
17124 <s></s><table></table>
17125 !! html
17126 <s></s><table></table>
17127
17128 !! html/parsoid
17129 <p><s></s></p><table></table>
17130 !! end
17131
17132 !! test
17133 Sanitizer: Closing of open but not closed tags
17134 !! wikitext
17135 <s>foo
17136 !! html
17137 <p><s>foo</s>
17138 </p>
17139 !! end
17140
17141 !! test
17142 Sanitizer: Closing of closed but not open tags
17143 !! options
17144 parsoid=wt2html
17145 !! wikitext
17146 </s>
17147 !! html/php+tidy
17148 !! html/parsoid
17149 !! end
17150
17151 !! test
17152 Sanitizer: Closing of closed but not open table tags
17153 !! options
17154 parsoid=wt2html
17155 !! wikitext
17156 Table not started</td></tr></table>
17157 !! html/php+tidy
17158 <p>Table not started</p>
17159 !! html/parsoid
17160 <p>Table not started</p>
17161 !! end
17162
17163 !! test
17164 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17165 !! wikitext
17166 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17167 !! html/php
17168 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17169 </p>
17170 !! html/parsoid
17171 <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>
17172 !! end
17173
17174 # In HTML5, the restrictions are that id must contain at least one character,
17175 # and must not contain any space characters.
17176 !! test
17177 Sanitizer: Validating the contents of the id attribute (bug 4515)
17178 !! options
17179 disabled
17180 !! wikitext
17181 <br id="" /><br id="a space" />
17182 !! html
17183 Something ...
17184 !! end
17185
17186 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17187 !! test
17188 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
17189 !! options
17190 disabled
17191 !! wikitext
17192 <br id="foo" /><br id="foo" />
17193 !! html
17194 Something need to be done. foo-2 ?
17195 !! end
17196
17197 !! test
17198 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17199 !! wikitext
17200 <div itemscope>
17201 <meta itemprop="hello" content="world">
17202 <meta http-equiv="refresh" content="5">
17203 <meta itemprop="hello" http-equiv="refresh" content="5">
17204 <link itemprop="hello" href="{{SERVER}}">
17205 <link rel="stylesheet" href="{{SERVER}}">
17206 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17207 </div>
17208 !! html
17209 <div itemscope="">
17210 <p> <meta itemprop="hello" content="world" />
17211 &lt;meta http-equiv="refresh" content="5"&gt;
17212 <meta itemprop="hello" content="5" />
17213 </p>
17214 <link itemprop="hello" href="http&#58;//example.org" />
17215 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17216 <link itemprop="hello" href="http&#58;//example.org" />
17217 </div>
17218
17219 !! end
17220
17221 !! test
17222 Language converter: output gets cut off unexpectedly (bug 5757)
17223 !! options
17224 language=zh
17225 !! wikitext
17226 this bit is safe: }-
17227
17228 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17229
17230 then we get cut off here: }-
17231
17232 all additional text is vanished
17233 !! html
17234 <p>this bit is safe: }-
17235 </p><p>but if we add a conversion instance: xxx
17236 </p><p>then we get cut off here: }-
17237 </p><p>all additional text is vanished
17238 </p>
17239 !! end
17240
17241 !! test
17242 Self closed html pairs (bug 5487)
17243 !! options
17244 !! wikitext
17245 <center><font id="bug" />Centered text</center>
17246 <div><font id="bug2" />In div text</div>
17247 !! html
17248 <center>&lt;font id="bug" /&gt;Centered text</center>
17249 <div>&lt;font id="bug2" /&gt;In div text</div>
17250
17251 !! end
17252
17253 #
17254 #
17255 #
17256
17257 !! test
17258 Punctuation: nbsp before exclamation
17259 !! wikitext
17260 C'est grave !
17261 !! html
17262 <p>C'est grave&#160;!
17263 </p>
17264 !! end
17265
17266 !! test
17267 Punctuation: CSS !important (bug 11874)
17268 !! wikitext
17269 <div style="width:50% !important">important</div>
17270 !! html
17271 <div style="width:50% !important">important</div>
17272
17273 !!end
17274
17275 !! test
17276 Punctuation: CSS ! important (bug 11874; with space after)
17277 !! wikitext
17278 <div style="width:50% ! important">important</div>
17279 !! html
17280 <div style="width:50% ! important">important</div>
17281
17282 !!end
17283
17284 !! test
17285 HTML bullet list, closed tags (bug 5497)
17286 !! wikitext
17287 <ul>
17288 <li>One</li>
17289 <li>Two</li>
17290 </ul>
17291 !! html/php
17292 <ul>
17293 <li>One</li>
17294 <li>Two</li>
17295 </ul>
17296
17297 !! html/parsoid
17298 <ul data-parsoid='{"stx":"html"}'>
17299 <li data-parsoid='{"stx":"html"}'>One</li>
17300 <li data-parsoid='{"stx":"html"}'>Two</li>
17301 </ul>
17302
17303 !! end
17304
17305 !! test
17306 HTML bullet list, unclosed tags (bug 5497)
17307 !! wikitext
17308 <ul>
17309 <li>One
17310 <li>Two
17311 </ul>
17312 !! html/php+tidy
17313 <ul>
17314 <li>One</li>
17315 <li>Two</li>
17316 </ul>
17317 !! html/parsoid
17318 <ul data-parsoid='{"stx":"html"}'>
17319 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17320 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17321 </ul>
17322
17323 !! end
17324
17325 !! test
17326 HTML ordered list, closed tags (bug 5497)
17327 !! wikitext
17328 <ol>
17329 <li>One</li>
17330 <li>Two</li>
17331 </ol>
17332 !! html/php
17333 <ol>
17334 <li>One</li>
17335 <li>Two</li>
17336 </ol>
17337
17338 !! html/parsoid
17339 <ol data-parsoid='{"stx":"html"}'>
17340 <li data-parsoid='{"stx":"html"}'>One</li>
17341 <li data-parsoid='{"stx":"html"}'>Two</li>
17342 </ol>
17343
17344 !! end
17345
17346 !! test
17347 HTML ordered list, unclosed tags (bug 5497)
17348 !! options
17349 !! wikitext
17350 <ol>
17351 <li>One
17352 <li>Two
17353 </ol>
17354 !! html/php+tidy
17355 <ol>
17356 <li>One</li>
17357 <li>Two</li>
17358 </ol>
17359 !! html/parsoid
17360 <ol data-parsoid='{"stx":"html"}'>
17361 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17362 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17363 </ol>
17364
17365 !! end
17366
17367 !! test
17368 HTML nested bullet list, closed tags (bug 5497)
17369 !! wikitext
17370 <ul>
17371 <li>One</li>
17372 <li>Two:
17373 <ul>
17374 <li>Sub-one</li>
17375 <li>Sub-two</li>
17376 </ul>
17377 </li>
17378 </ul>
17379 !! html/php
17380 <ul>
17381 <li>One</li>
17382 <li>Two:
17383 <ul>
17384 <li>Sub-one</li>
17385 <li>Sub-two</li>
17386 </ul>
17387 </li>
17388 </ul>
17389
17390 !! html/parsoid
17391 <ul data-parsoid='{"stx":"html"}'>
17392 <li data-parsoid='{"stx":"html"}'>One</li>
17393 <li data-parsoid='{"stx":"html"}'>Two:
17394 <ul data-parsoid='{"stx":"html"}'>
17395 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17396 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17397 </ul>
17398 </li>
17399 </ul>
17400 !! end
17401
17402 !! test
17403 HTML nested bullet list, open tags (bug 5497)
17404 !! wikitext
17405 <ul>
17406 <li>One
17407 <li>Two:
17408 <ul>
17409 <li>Sub-one
17410 <li>Sub-two
17411 </ul>
17412 </ul>
17413 !! html/php+tidy
17414 <ul>
17415 <li>One</li>
17416 <li>Two:
17417 <ul>
17418 <li>Sub-one</li>
17419 <li>Sub-two</li>
17420 </ul>
17421 </li>
17422 </ul>
17423 !! html/parsoid
17424 <ul>
17425 <li>One
17426 </li>
17427 <li>Two:
17428 <ul>
17429 <li>Sub-one
17430 </li>
17431 <li>Sub-two
17432 </li>
17433 </ul>
17434 </li>
17435 </ul>
17436
17437 !! end
17438
17439 !! test
17440 HTML nested ordered list, closed tags (bug 5497)
17441 !! wikitext
17442 <ol>
17443 <li>One</li>
17444 <li>Two:
17445 <ol>
17446 <li>Sub-one</li>
17447 <li>Sub-two</li>
17448 </ol>
17449 </li>
17450 </ol>
17451 !! html
17452 <ol>
17453 <li>One</li>
17454 <li>Two:
17455 <ol>
17456 <li>Sub-one</li>
17457 <li>Sub-two</li>
17458 </ol>
17459 </li>
17460 </ol>
17461
17462 !! end
17463
17464 !! test
17465 HTML nested ordered list, open tags (bug 5497)
17466 !! wikitext
17467 <ol>
17468 <li>One
17469 <li>Two:
17470 <ol>
17471 <li>Sub-one
17472 <li>Sub-two
17473 </ol>
17474 </ol>
17475 !! html/php
17476 <ol>
17477 <li>One
17478 <li>Two:
17479 <ol>
17480 <li>Sub-one
17481 <li>Sub-two
17482 </ol>
17483 </ol>
17484
17485 !! html/parsoid
17486 <ol>
17487 <li>One
17488 </li>
17489 <li>Two:
17490 <ol>
17491 <li>Sub-one
17492 </li>
17493 <li>Sub-two
17494 </li>
17495 </ol>
17496 </li>
17497 </ol>
17498
17499 !! end
17500
17501 !! test
17502 HTML ordered list item with parameters oddity
17503 !! wikitext
17504 <ol><li id="fragment">One</li>
17505 </ol>
17506 !! html
17507 <ol><li id="fragment">One</li>
17508 </ol>
17509
17510 !! end
17511
17512 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17513 !!test
17514 bug 5918: autonumbering
17515 !! wikitext
17516 [http://first/] [http://second] [ftp://ftp]
17517
17518 ftp://inlineftp
17519
17520 [mailto:enclosed@mail.tld With target]
17521
17522 [mailto:enclosed@mail.tld]
17523
17524 mailto:inline@mail.tld
17525 !! html/php
17526 <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>
17527 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17528 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17529 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17530 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17531 </p>
17532 !! html/parsoid
17533 <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>
17534 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17535 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17536 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17537 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17538 !! end
17539
17540
17541 #
17542 # Security and HTML correctness
17543 # From Nick Jenkins' fuzz testing
17544 #
17545
17546 !! test
17547 Fuzz testing: Parser13
17548 !! wikitext
17549 {|
17550 | http://a|
17551 !! html
17552 <table>
17553 <tr>
17554 <td>
17555 </td>
17556 </tr>
17557 </table>
17558
17559 !! end
17560
17561 !! test
17562 Fuzz testing: Parser14
17563 !! wikitext
17564 == onmouseover= ==
17565 http://__TOC__
17566 !! html
17567 <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>
17568 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17569 <ul>
17570 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17571 </ul>
17572 </div>
17573
17574
17575 !! html+tidy
17576 <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>
17577 <p>http://</p>
17578 <div id="toc" class="toc">
17579 <div id="toctitle">
17580 <h2>Contents</h2>
17581 </div>
17582 <ul>
17583 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17584 </ul>
17585 </div>
17586 <p></p>
17587 !! end
17588
17589 !! test
17590 Fuzz testing: Parser14-table
17591 !! options
17592 parsoid=wt2html,html2html
17593 !! wikitext
17594 ==a==
17595 {| STYLE=__TOC__
17596 !! html
17597 <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>
17598 <table style="&#95;_TOC&#95;_">
17599 <tr><td></td></tr>
17600 </table>
17601
17602 !! html+tidy
17603 <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>
17604 <table style="__TOC__">
17605 <tr>
17606 <td></td>
17607 </tr>
17608 </table>
17609 !! html/parsoid
17610 <h2>a</h2>
17611 <table style="__TOC__"></table>
17612 !! end
17613
17614 # Known to produce bogus xml (extra </td>)
17615 !! test
17616 Fuzz testing: Parser16
17617 !! wikitext
17618 {|
17619 !https://||||||
17620 !! html
17621 <table>
17622 <tr>
17623 <th>https://</th>
17624 <th></th>
17625 <th></th>
17626 <th>
17627 </td>
17628 </tr>
17629 </table>
17630
17631 !! html+tidy
17632 <table>
17633 <tr>
17634 <th>https://</th>
17635 <th></th>
17636 <th></th>
17637 <th></th>
17638 </tr>
17639 </table>
17640 !! end
17641
17642 !! test
17643 Fuzz testing: Parser21
17644 !! wikitext
17645 {|
17646 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17647 |
17648 !! html
17649 <table>
17650 <tr>
17651 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17652 </th>
17653 <td>
17654 </td>
17655 </tr>
17656 </table>
17657
17658 !! end
17659
17660 !! test
17661 Fuzz testing: Parser22
17662 !! wikitext
17663 http://===r:::https://b
17664
17665 {|
17666 !! html
17667 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17668 </p>
17669 <table>
17670 <tr><td></td></tr>
17671 </table>
17672
17673 !! end
17674
17675 # Known to produce bad XML for now
17676 !! test
17677 Fuzz testing: Parser24
17678 !! wikitext
17679 {|
17680 {{{|
17681 <u CLASS=
17682 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17683 <br style="onmouseover='alert(document.cookie);' " />
17684
17685 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17686 |
17687 !! html
17688 <table>
17689 {{{|
17690 <u class="&#124;">}}}} &gt;
17691 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17692
17693 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17694 <tr>
17695 <td></u>
17696 </td>
17697 </tr>
17698 </table>
17699
17700 !! end
17701
17702 # Note: the current result listed for this is not what the original one was,
17703 # but the original bug was JavaScript injection, which is fixed in any case.
17704 # It's not clear that the original result listed was any more correct than the
17705 # current one. Original result:
17706 # <p>{{{|
17707 # </p>
17708 # <li class="&#124;&#124;">
17709 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17710 !!test
17711 Fuzz testing: Parser25 (bug 6055)
17712 !! wikitext
17713 {{{
17714 |
17715 <LI CLASS=||
17716 >
17717 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17718 !! html
17719 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17720 </p>
17721 !! end
17722
17723 !!test
17724 Fuzz testing: URL adjacent extension (with space, clean)
17725 !! wikitext
17726 http://example.com <nowiki>junk</nowiki>
17727 !! html/php
17728 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17729 </p>
17730 !! html/parsoid
17731 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17732 !! end
17733
17734 !!test
17735 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17736 !! wikitext
17737 http://example.com<nowiki>junk</nowiki>
17738 !! html/php
17739 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17740 </p>
17741 !! html/parsoid
17742 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17743 !! end
17744
17745 !!test
17746 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17747 !! wikitext
17748 http://example.com<pre>junk</pre>
17749 !! html/php
17750 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17751
17752 !! html/php+tidy
17753 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17754 <pre>
17755 junk
17756 </pre>
17757 !! html/parsoid
17758 <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>
17759 !!end
17760
17761 !!test
17762 Fuzz testing: image with bogus manual thumbnail
17763 !! wikitext
17764 [[Image:foobar.jpg|thumbnail= ]]
17765 !! html/php
17766 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17767
17768 !! html/parsoid
17769 <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>
17770 !!end
17771
17772 !! test
17773 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17774 !! wikitext
17775 <pre dir="&#10;"></pre>
17776 !! html
17777 <pre dir="&#10;"></pre>
17778
17779 !! end
17780
17781 !! test
17782 Parsing optional HTML elements (Bug 6171)
17783 !! options
17784 !! wikitext
17785 <table>
17786 <tr>
17787 <td> Some tabular data</td>
17788 <td> More tabular data ...
17789 <td> And yet som tabular data</td>
17790 </tr>
17791 </table>
17792 !! html
17793 <table>
17794 <tr>
17795 <td> Some tabular data</td>
17796 <td> More tabular data ...
17797 </td><td> And yet som tabular data</td>
17798 </tr>
17799 </table>
17800
17801 !! end
17802
17803 !! test
17804 Correct handling of <td>, <tr> (Bug 6171)
17805 !! options
17806 !! wikitext
17807 <table>
17808 <tr>
17809 <td> Some tabular data</td>
17810 <td> More tabular data ...</td>
17811 <td> And yet som tabular data</td>
17812 </tr>
17813 </table>
17814 !! html
17815 <table>
17816 <tr>
17817 <td> Some tabular data</td>
17818 <td> More tabular data ...</td>
17819 <td> And yet som tabular data</td>
17820 </tr>
17821 </table>
17822
17823 !! end
17824
17825
17826 !! test
17827 Parsing crashing regression (fr:JavaScript)
17828 !! wikitext
17829 </body></x>
17830 !! html
17831 <p>&lt;/body&gt;&lt;/x&gt;
17832 </p>
17833 !! end
17834
17835 !! test
17836 Inline wiki vs wiki block nesting
17837 !! wikitext
17838 '''Bold paragraph
17839
17840 New wiki paragraph
17841 !! html
17842 <p><b>Bold paragraph</b>
17843 </p><p>New wiki paragraph
17844 </p>
17845 !! end
17846
17847 # FIXME: The current php output is documented
17848 # and desired output is the parsoid target.
17849 !! test
17850 Inline HTML vs wiki block nesting
17851 !! wikitext
17852 <b>Bold paragraph
17853
17854 New wiki paragraph
17855 !! html/php
17856 <p><b>Bold paragraph
17857 </p><p>New wiki paragraph</b>
17858 </p>
17859 !! html/parsoid
17860 <p><b>Bold paragraph</b>
17861 </p><p>New wiki paragraph
17862 </p>
17863 !! end
17864
17865 # Original result was this:
17866 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17867 # </p>
17868 # While that might be marginally more intuitive, maybe, the six-apostrophe
17869 # construct is clearly pathological and the result stated here (which is what
17870 # the parser actually does) is about as reasonable as anything.
17871 !!test
17872 Mixing markup for italics and bold
17873 !! options
17874 !! wikitext
17875 '''bold''''''bold''bolditalics'''''
17876 !! html
17877 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17878 </p>
17879 !! end
17880
17881
17882 !! article
17883 Xyzzyx
17884 !! text
17885 Article for special page transclusion test
17886 !! endarticle
17887
17888 !! test
17889 Special page transclusion
17890 !! options
17891 !! wikitext
17892 {{Special:Prefixindex/Xyzzyx}}
17893 !! html
17894 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17895 </ul>
17896
17897 !! end
17898
17899 !! test
17900 Special page transclusion twice (bug 5021)
17901 !! options
17902 !! wikitext
17903 {{Special:Prefixindex/Xyzzyx}}
17904 {{Special:Prefixindex/Xyzzyx}}
17905 !! html
17906 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17907 </ul>
17908 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17909 </ul>
17910
17911 !! end
17912
17913 !! test
17914 Transclusion of default MediaWiki message
17915 !! wikitext
17916 {{MediaWiki:Mainpage}}
17917 !! html
17918 <p>Main Page
17919 </p>
17920 !! end
17921
17922 !! test
17923 Transclusion of nonexistent MediaWiki message
17924 !! wikitext
17925 {{MediaWiki:Mainpagexxx}}
17926 !! html
17927 <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>
17928 </p>
17929 !! end
17930
17931 !! test
17932 Transclusion of MediaWiki message with underscore
17933 !! wikitext
17934 {{MediaWiki:history_short}}
17935 !! html
17936 <p>History
17937 </p>
17938 !! end
17939
17940 !! test
17941 Transclusion of MediaWiki message with space
17942 !! wikitext
17943 {{MediaWiki:history short}}
17944 !! html
17945 <p>History
17946 </p>
17947 !! end
17948
17949 !! test
17950 Invalid header with following text
17951 !! wikitext
17952 = x = y
17953 !! html
17954 <p>= x = y
17955 </p>
17956 !! end
17957
17958
17959 !! test
17960 Section extraction test (section 0)
17961 !! options
17962 section=0
17963 !! wikitext
17964 start
17965 ==a==
17966 ===aa===
17967 ====aaa====
17968 ==b==
17969 ===ba===
17970 ===bb===
17971 ====bba====
17972 ===bc===
17973 ==c==
17974 ===ca===
17975 !! html/php
17976 start
17977 !! end
17978
17979 !! test
17980 Section extraction test (section 1)
17981 !! options
17982 section=1
17983 !! wikitext
17984 start
17985 ==a==
17986 ===aa===
17987 ====aaa====
17988 ==b==
17989 ===ba===
17990 ===bb===
17991 ====bba====
17992 ===bc===
17993 ==c==
17994 ===ca===
17995 !! html/php
17996 ==a==
17997 ===aa===
17998 ====aaa====
17999 !! end
18000
18001 !! test
18002 Section extraction test (section 2)
18003 !! options
18004 section=2
18005 !! wikitext
18006 start
18007 ==a==
18008 ===aa===
18009 ====aaa====
18010 ==b==
18011 ===ba===
18012 ===bb===
18013 ====bba====
18014 ===bc===
18015 ==c==
18016 ===ca===
18017 !! html/php
18018 ===aa===
18019 ====aaa====
18020 !! end
18021
18022 !! test
18023 Section extraction test (section 3)
18024 !! options
18025 section=3
18026 !! wikitext
18027 start
18028 ==a==
18029 ===aa===
18030 ====aaa====
18031 ==b==
18032 ===ba===
18033 ===bb===
18034 ====bba====
18035 ===bc===
18036 ==c==
18037 ===ca===
18038 !! html/php
18039 ====aaa====
18040 !! end
18041
18042 !! test
18043 Section extraction test (section 4)
18044 !! options
18045 section=4
18046 !! wikitext
18047 start
18048 ==a==
18049 ===aa===
18050 ====aaa====
18051 ==b==
18052 ===ba===
18053 ===bb===
18054 ====bba====
18055 ===bc===
18056 ==c==
18057 ===ca===
18058 !! html/php
18059 ==b==
18060 ===ba===
18061 ===bb===
18062 ====bba====
18063 ===bc===
18064 !! end
18065
18066 !! test
18067 Section extraction test (section 5)
18068 !! options
18069 section=5
18070 !! wikitext
18071 start
18072 ==a==
18073 ===aa===
18074 ====aaa====
18075 ==b==
18076 ===ba===
18077 ===bb===
18078 ====bba====
18079 ===bc===
18080 ==c==
18081 ===ca===
18082 !! html/php
18083 ===ba===
18084 !! end
18085
18086 !! test
18087 Section extraction test (section 6)
18088 !! options
18089 section=6
18090 !! wikitext
18091 start
18092 ==a==
18093 ===aa===
18094 ====aaa====
18095 ==b==
18096 ===ba===
18097 ===bb===
18098 ====bba====
18099 ===bc===
18100 ==c==
18101 ===ca===
18102 !! html/php
18103 ===bb===
18104 ====bba====
18105 !! end
18106
18107 !! test
18108 Section extraction test (section 7)
18109 !! options
18110 section=7
18111 !! wikitext
18112 start
18113 ==a==
18114 ===aa===
18115 ====aaa====
18116 ==b==
18117 ===ba===
18118 ===bb===
18119 ====bba====
18120 ===bc===
18121 ==c==
18122 ===ca===
18123 !! html/php
18124 ====bba====
18125 !! end
18126
18127 !! test
18128 Section extraction test (section 8)
18129 !! options
18130 section=8
18131 !! wikitext
18132 start
18133 ==a==
18134 ===aa===
18135 ====aaa====
18136 ==b==
18137 ===ba===
18138 ===bb===
18139 ====bba====
18140 ===bc===
18141 ==c==
18142 ===ca===
18143 !! html/php
18144 ===bc===
18145 !! end
18146
18147 !! test
18148 Section extraction test (section 9)
18149 !! options
18150 section=9
18151 !! wikitext
18152 start
18153 ==a==
18154 ===aa===
18155 ====aaa====
18156 ==b==
18157 ===ba===
18158 ===bb===
18159 ====bba====
18160 ===bc===
18161 ==c==
18162 ===ca===
18163 !! html/php
18164 ==c==
18165 ===ca===
18166 !! end
18167
18168 !! test
18169 Section extraction test (section 10)
18170 !! options
18171 section=10
18172 !! wikitext
18173 start
18174 ==a==
18175 ===aa===
18176 ====aaa====
18177 ==b==
18178 ===ba===
18179 ===bb===
18180 ====bba====
18181 ===bc===
18182 ==c==
18183 ===ca===
18184 !! html/php
18185 ===ca===
18186 !! end
18187
18188 !! test
18189 Section extraction test (nonexistent section 11)
18190 !! options
18191 section=11
18192 !! wikitext
18193 start
18194 ==a==
18195 ===aa===
18196 ====aaa====
18197 ==b==
18198 ===ba===
18199 ===bb===
18200 ====bba====
18201 ===bc===
18202 ==c==
18203 ===ca===
18204 !! html/php
18205 !! end
18206
18207 !! test
18208 Section extraction test with bogus heading (section 1)
18209 !! options
18210 section=1
18211 !! wikitext
18212 ==a==
18213 ==bogus== not a legal section
18214 ==b==
18215 !! html/php
18216 ==a==
18217 ==bogus== not a legal section
18218 !! end
18219
18220 !! test
18221 Section extraction test with bogus heading (section 2)
18222 !! options
18223 section=2
18224 !! wikitext
18225 ==a==
18226 ==bogus== not a legal section
18227 ==b==
18228 !! html/php
18229 ==b==
18230 !! end
18231
18232 !! test
18233 Section extraction test with comment after heading (section 1)
18234 !! options
18235 section=1
18236 !! wikitext
18237 ==a==
18238 ==b== <!-- -->
18239 ==c==
18240 !! html/php
18241 ==a==
18242 !! end
18243
18244 !! test
18245 Section extraction test with comment after heading (section 2)
18246 !! options
18247 section=2
18248 !! wikitext
18249 ==a==
18250 ==b== <!-- -->
18251 ==c==
18252 !! html/php
18253 ==b== <!-- -->
18254 !! end
18255
18256 !! test
18257 Section extraction test with bogus <nowiki> heading (section 1)
18258 !! options
18259 section=1
18260 !! wikitext
18261 ==a==
18262 ==bogus== <nowiki>not a legal section</nowiki>
18263 ==b==
18264 !! html/php
18265 ==a==
18266 ==bogus== <nowiki>not a legal section</nowiki>
18267 !! end
18268
18269 !! test
18270 Section extraction test with bogus <nowiki> heading (section 2)
18271 !! options
18272 section=2
18273 !! wikitext
18274 ==a==
18275 ==bogus== <nowiki>not a legal section</nowiki>
18276 ==b==
18277 !! html/php
18278 ==b==
18279 !! end
18280
18281 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18282 # instead of respecting commented sections
18283 !! test
18284 Section extraction prefixed by comment (section 1)
18285 !! options
18286 section=1
18287 !! wikitext
18288 <!-- -->==sec1==
18289 ==sec2==
18290 !! html/php
18291 ==sec2==
18292 !!end
18293
18294 !! test
18295 Section extraction prefixed by comment (section 2)
18296 !! options
18297 section=2
18298 !! wikitext
18299 <!-- -->==sec1==
18300 ==sec2==
18301 !! html/php
18302
18303 !!end
18304
18305 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18306 # instead of respecting HTML-style headings
18307 !! test
18308 Section extraction, mixed wiki and html (section 1)
18309 !! options
18310 section=1
18311 !! wikitext
18312 <h2>unmarked</h2>
18313 unmarked
18314 ==1==
18315 one
18316 ==2==
18317 two
18318 !! html/php
18319 ==1==
18320 one
18321 !! end
18322
18323 !! test
18324 Section extraction, mixed wiki and html (section 2)
18325 !! options
18326 section=2
18327 !! wikitext
18328 <h2>unmarked</h2>
18329 unmarked
18330 ==1==
18331 one
18332 ==2==
18333 two
18334 !! html/php
18335 ==2==
18336 two
18337 !! end
18338
18339
18340 # Formerly testing for bug 3342
18341 !! test
18342 Section extraction, heading surrounded by <noinclude>
18343 !! options
18344 section=1
18345 !! wikitext
18346 <noinclude>==unmarked==</noinclude>
18347 ==marked==
18348 !! html/php
18349 ==marked==
18350 !!end
18351
18352 # Test behavior of bug 19910
18353 !! test
18354 Sectiion with all-equals
18355 !! options
18356 section=2
18357 !! wikitext
18358 ===
18359 The line above must have a trailing space
18360 === <!--
18361 --> <!-- -->
18362 But just in case it doesn't...
18363 !! html/php
18364 === <!--
18365 --> <!-- -->
18366 But just in case it doesn't...
18367 !! end
18368
18369 !! test
18370 Section replacement test (section 0)
18371 !! options
18372 replace=0,"xxx"
18373 !! wikitext
18374 start
18375 ==a==
18376 ===aa===
18377 ====aaa====
18378 ==b==
18379 ===ba===
18380 ===bb===
18381 ====bba====
18382 ===bc===
18383 ==c==
18384 ===ca===
18385 !! html/php
18386 xxx
18387
18388 ==a==
18389 ===aa===
18390 ====aaa====
18391 ==b==
18392 ===ba===
18393 ===bb===
18394 ====bba====
18395 ===bc===
18396 ==c==
18397 ===ca===
18398 !! end
18399
18400 !! test
18401 Section replacement test (section 1)
18402 !! options
18403 replace=1,"xxx"
18404 !! wikitext
18405 start
18406 ==a==
18407 ===aa===
18408 ====aaa====
18409 ==b==
18410 ===ba===
18411 ===bb===
18412 ====bba====
18413 ===bc===
18414 ==c==
18415 ===ca===
18416 !! html/php
18417 start
18418 xxx
18419
18420 ==b==
18421 ===ba===
18422 ===bb===
18423 ====bba====
18424 ===bc===
18425 ==c==
18426 ===ca===
18427 !! end
18428
18429 !! test
18430 Section replacement test (section 2)
18431 !! options
18432 replace=2,"xxx"
18433 !! wikitext
18434 start
18435 ==a==
18436 ===aa===
18437 ====aaa====
18438 ==b==
18439 ===ba===
18440 ===bb===
18441 ====bba====
18442 ===bc===
18443 ==c==
18444 ===ca===
18445 !! html/php
18446 start
18447 ==a==
18448 xxx
18449
18450 ==b==
18451 ===ba===
18452 ===bb===
18453 ====bba====
18454 ===bc===
18455 ==c==
18456 ===ca===
18457 !! end
18458
18459 !! test
18460 Section replacement test (section 3)
18461 !! options
18462 replace=3,"xxx"
18463 !! wikitext
18464 start
18465 ==a==
18466 ===aa===
18467 ====aaa====
18468 ==b==
18469 ===ba===
18470 ===bb===
18471 ====bba====
18472 ===bc===
18473 ==c==
18474 ===ca===
18475 !! html/php
18476 start
18477 ==a==
18478 ===aa===
18479 xxx
18480
18481 ==b==
18482 ===ba===
18483 ===bb===
18484 ====bba====
18485 ===bc===
18486 ==c==
18487 ===ca===
18488 !! end
18489
18490 !! test
18491 Section replacement test (section 4)
18492 !! options
18493 replace=4,"xxx"
18494 !! wikitext
18495 start
18496 ==a==
18497 ===aa===
18498 ====aaa====
18499 ==b==
18500 ===ba===
18501 ===bb===
18502 ====bba====
18503 ===bc===
18504 ==c==
18505 ===ca===
18506 !! html/php
18507 start
18508 ==a==
18509 ===aa===
18510 ====aaa====
18511 xxx
18512
18513 ==c==
18514 ===ca===
18515 !! end
18516
18517 !! test
18518 Section replacement test (section 5)
18519 !! options
18520 replace=5,"xxx"
18521 !! wikitext
18522 start
18523 ==a==
18524 ===aa===
18525 ====aaa====
18526 ==b==
18527 ===ba===
18528 ===bb===
18529 ====bba====
18530 ===bc===
18531 ==c==
18532 ===ca===
18533 !! html/php
18534 start
18535 ==a==
18536 ===aa===
18537 ====aaa====
18538 ==b==
18539 xxx
18540
18541 ===bb===
18542 ====bba====
18543 ===bc===
18544 ==c==
18545 ===ca===
18546 !! end
18547
18548 !! test
18549 Section replacement test (section 6)
18550 !! options
18551 replace=6,"xxx"
18552 !! wikitext
18553 start
18554 ==a==
18555 ===aa===
18556 ====aaa====
18557 ==b==
18558 ===ba===
18559 ===bb===
18560 ====bba====
18561 ===bc===
18562 ==c==
18563 ===ca===
18564 !! html/php
18565 start
18566 ==a==
18567 ===aa===
18568 ====aaa====
18569 ==b==
18570 ===ba===
18571 xxx
18572
18573 ===bc===
18574 ==c==
18575 ===ca===
18576 !! end
18577
18578 !! test
18579 Section replacement test (section 7)
18580 !! options
18581 replace=7,"xxx"
18582 !! wikitext
18583 start
18584 ==a==
18585 ===aa===
18586 ====aaa====
18587 ==b==
18588 ===ba===
18589 ===bb===
18590 ====bba====
18591 ===bc===
18592 ==c==
18593 ===ca===
18594 !! html/php
18595 start
18596 ==a==
18597 ===aa===
18598 ====aaa====
18599 ==b==
18600 ===ba===
18601 ===bb===
18602 xxx
18603
18604 ===bc===
18605 ==c==
18606 ===ca===
18607 !! end
18608
18609 !! test
18610 Section replacement test (section 8)
18611 !! options
18612 replace=8,"xxx"
18613 !! wikitext
18614 start
18615 ==a==
18616 ===aa===
18617 ====aaa====
18618 ==b==
18619 ===ba===
18620 ===bb===
18621 ====bba====
18622 ===bc===
18623 ==c==
18624 ===ca===
18625 !! html/php
18626 start
18627 ==a==
18628 ===aa===
18629 ====aaa====
18630 ==b==
18631 ===ba===
18632 ===bb===
18633 ====bba====
18634 xxx
18635
18636 ==c==
18637 ===ca===
18638 !!end
18639
18640 !! test
18641 Section replacement test (section 9)
18642 !! options
18643 replace=9,"xxx"
18644 !! wikitext
18645 start
18646 ==a==
18647 ===aa===
18648 ====aaa====
18649 ==b==
18650 ===ba===
18651 ===bb===
18652 ====bba====
18653 ===bc===
18654 ==c==
18655 ===ca===
18656 !! html/php
18657 start
18658 ==a==
18659 ===aa===
18660 ====aaa====
18661 ==b==
18662 ===ba===
18663 ===bb===
18664 ====bba====
18665 ===bc===
18666 xxx
18667 !! end
18668
18669 !! test
18670 Section replacement test (section 10)
18671 !! options
18672 replace=10,"xxx"
18673 !! wikitext
18674 start
18675 ==a==
18676 ===aa===
18677 ====aaa====
18678 ==b==
18679 ===ba===
18680 ===bb===
18681 ====bba====
18682 ===bc===
18683 ==c==
18684 ===ca===
18685 !! html/php
18686 start
18687 ==a==
18688 ===aa===
18689 ====aaa====
18690 ==b==
18691 ===ba===
18692 ===bb===
18693 ====bba====
18694 ===bc===
18695 ==c==
18696 xxx
18697 !! end
18698
18699 !! test
18700 Section replacement test with initial whitespace (bug 13728)
18701 !! options
18702 replace=2,"xxx"
18703 !! wikitext
18704 Preformatted initial line
18705 ==a==
18706 ===a===
18707 !! html/php
18708 Preformatted initial line
18709 ==a==
18710 xxx
18711 !! end
18712
18713
18714 !! test
18715 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18716 !! options
18717 section=1
18718 !! wikitext
18719 ==a==
18720 a
18721 !! html/php
18722 ==a==
18723 a
18724 !! end
18725
18726 !! test
18727 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18728 !! options
18729 section=1
18730 !! wikitext
18731 ==a==
18732 a
18733 !! html/php
18734 ==a==
18735 a
18736 !! end
18737
18738
18739 !! test
18740 Section extraction, <pre> around bogus header (bug 10309)
18741 !! options
18742 section=2
18743 !! wikitext
18744 == Section One ==
18745 <pre>
18746 =======
18747 </pre>
18748
18749 == Section Two ==
18750 stuff
18751 !! html/php
18752 == Section Two ==
18753 stuff
18754 !! end
18755
18756 !! test
18757 Section replacement, <pre> around bogus header (bug 10309)
18758 !! options
18759 replace=2,"xxx"
18760 !! wikitext
18761 == Section One ==
18762 <pre>
18763 =======
18764 </pre>
18765
18766 == Section Two ==
18767 stuff
18768 !! html/php
18769 == Section One ==
18770 <pre>
18771 =======
18772 </pre>
18773
18774 xxx
18775 !! end
18776
18777
18778 !! test
18779 Handling of &#x0A; in URLs
18780 !! wikitext
18781 ** irc://&#x0A;a
18782 !! html/php
18783 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18784
18785 !! html/parsoid
18786 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18787 a">irc://
18788 a</a></li></ul></li></ul>
18789 !! end
18790
18791 !! test
18792 Handling of %0A in URLs
18793 !! wikitext
18794 ** irc://%0Aa
18795 !! html/php
18796 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18797
18798 !! html/parsoid
18799 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18800 !! end
18801
18802
18803 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18804 !! test
18805 5 quotes, code coverage +1 line
18806 !! options
18807 parsoid=wt2html
18808 !! wikitext
18809 '''''
18810 !! html/php
18811 !! html/parsoid
18812 <p><b><i></i></b></p>
18813 !! end
18814
18815 # same html as previous, but wikitext adjusted to match parsoid html2wt
18816 # note that wt2html and html2html will put the <i> before the <b>
18817 !! test
18818 5 quotes, code coverage +1 line w/ nowiki (1)
18819 !! options
18820 parsoid=wt2wt,html2wt
18821 !! wikitext
18822 '''''<nowiki/>'''''
18823 !! html/php
18824 <p><i></i>
18825 </p>
18826 !! html/parsoid
18827 <p><b><i></i></b></p>
18828 !! end
18829
18830 # same as previous, just swapping the <i> and <b>
18831 !! test
18832 5 quotes, code coverage +1 line w/ nowiki (2)
18833 !! wikitext
18834 '''''<nowiki/>'''''
18835 !! html/php
18836 <p><i></i>
18837 </p>
18838 !! html/parsoid
18839 <p><i><b></b></i></p>
18840 !! end
18841
18842 !! test
18843 Special:Search page linking.
18844 !! wikitext
18845 {{Special:search}}
18846 !! html
18847 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18848 </p>
18849 !! end
18850
18851 !! test
18852 {{!}} is a magic word
18853 !! wikitext
18854 {{!}} is a magic word there and {{!}} is still a magic word here
18855 | is not a magic word here but {{!}} is still a magic word here
18856 !! html/php
18857 <p>| is a magic word there and | is still a magic word here
18858 | is not a magic word here but | is still a magic word here
18859 </p>
18860 !! html/parsoid
18861 <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
18862 | 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>
18863
18864 !! end
18865
18866 !! test
18867 Say the magic word
18868 !! options
18869 title=[[Parser test]]
18870 !! wikitext
18871 * {{PAGENAME}}
18872 * {{PAGENAMEE}}
18873 * {{FULLPAGENAME}}
18874 * {{FULLPAGENAMEE}}
18875 * {{BASEPAGENAME}}
18876 * {{BASEPAGENAMEE}}
18877 * {{SUBPAGENAME}}
18878 * {{SUBPAGENAMEE}}
18879 * {{ROOTPAGENAME}}
18880 * {{ROOTPAGENAMEE}}
18881 * {{TALKPAGENAME}}
18882 * {{TALKPAGENAMEE}}
18883 * {{SUBJECTPAGENAME}}
18884 * {{SUBJECTPAGENAMEE}}
18885 * {{NAMESPACEE}}
18886 * {{NAMESPACE}}
18887 * {{NAMESPACENUMBER}}
18888 * {{TALKSPACE}}
18889 * {{TALKSPACEE}}
18890 * {{SUBJECTSPACE}}
18891 * {{SUBJECTSPACEE}}
18892 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18893 !! html
18894 <ul><li> Parser test</li>
18895 <li> Parser_test</li>
18896 <li> Parser test</li>
18897 <li> Parser_test</li>
18898 <li> Parser test</li>
18899 <li> Parser_test</li>
18900 <li> Parser test</li>
18901 <li> Parser_test</li>
18902 <li> Parser test</li>
18903 <li> Parser_test</li>
18904 <li> Talk:Parser test</li>
18905 <li> Talk:Parser_test</li>
18906 <li> Parser test</li>
18907 <li> Parser_test</li>
18908 <li> </li>
18909 <li> </li>
18910 <li> 0</li>
18911 <li> Talk</li>
18912 <li> Talk</li>
18913 <li> </li>
18914 <li> </li>
18915 <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>
18916
18917 !! end
18918 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18919
18920 ## Parsoid thinks the "centre" here is a property, not a caption.
18921 !! test
18922 Gallery
18923 !! options
18924 parsoid={
18925 "modes": ["wt2html"],
18926 "nativeGallery": true
18927 }
18928 !! wikitext
18929 <gallery>
18930 image1.png |
18931 image2.gif|||||
18932
18933 image3|
18934 image4 |300px| centre
18935 image5.svg| http://///////
18936 [[x|xx]]]]
18937 * image6
18938 </gallery>
18939 !! html/php
18940 <ul class="gallery mw-gallery-traditional">
18941 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18942 <div class="thumb" style="height: 150px;">Image1.png</div>
18943 <div class="gallerytext">
18944 </div>
18945 </div></li>
18946 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18947 <div class="thumb" style="height: 150px;">Image2.gif</div>
18948 <div class="gallerytext">
18949 </div>
18950 </div></li>
18951 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18952 <div class="thumb" style="height: 150px;">Image3</div>
18953 <div class="gallerytext">
18954 </div>
18955 </div></li>
18956 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18957 <div class="thumb" style="height: 150px;">Image4</div>
18958 <div class="gallerytext">
18959 <pre>centre
18960 </pre>
18961 </div>
18962 </div></li>
18963 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18964 <div class="thumb" style="height: 150px;">Image5.svg</div>
18965 <div class="gallerytext">
18966 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18967 </p>
18968 </div>
18969 </div></li>
18970 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18971 <div class="thumb" style="height: 150px;">* image6</div>
18972 <div class="gallerytext">
18973 </div>
18974 </div></li>
18975 </ul>
18976
18977 !! html/parsoid
18978 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
18979 <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>
18980 <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>
18981 <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>
18982 <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>
18983 <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>
18984 <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>
18985 </ul>
18986 !! end
18987
18988 !! test
18989 Gallery (with options, html)
18990 !! options
18991 parsoid={
18992 "modes": ["wt2html", "html2html"],
18993 "nativeGallery": true
18994 }
18995 !! wikitext
18996 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
18997 File:Nonexistent.jpg|caption
18998 File:Nonexistent.jpg
18999 image:foobar.jpg|some '''caption''' [[Main Page]]
19000 image:foobar.jpg
19001 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19002 </gallery>
19003 !! html/php
19004 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19005 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19006 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19007 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19008 <div class="gallerytext">
19009 <p>caption
19010 </p>
19011 </div>
19012 </div></li>
19013 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19014 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19015 <div class="gallerytext">
19016 </div>
19017 </div></li>
19018 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19019 <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>
19020 <div class="gallerytext">
19021 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19022 </p>
19023 </div>
19024 </div></li>
19025 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19026 <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>
19027 <div class="gallerytext">
19028 </div>
19029 </div></li>
19030 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19031 <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>
19032 <div class="gallerytext">
19033 <p>blabla.
19034 </p>
19035 </div>
19036 </div></li>
19037 </ul>
19038
19039 !! html/parsoid
19040 <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":{}}'>
19041 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19042 <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>
19043 <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>
19044 <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>
19045 <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>
19046 <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>
19047 </ul>
19048 !! end
19049
19050 !! test
19051 Gallery (with options, extsrc)
19052 !! options
19053 parsoid={
19054 "nativeGallery": false
19055 }
19056 !! wikitext
19057 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19058 File:Nonexistent.jpg|caption
19059 File:Nonexistent.jpg
19060 image:foobar.jpg|some '''caption''' [[Main Page]]
19061 image:foobar.jpg
19062 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19063 </gallery>
19064 !! html/php
19065 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19066 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19067 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19068 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19069 <div class="gallerytext">
19070 <p>caption
19071 </p>
19072 </div>
19073 </div></li>
19074 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19075 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19076 <div class="gallerytext">
19077 </div>
19078 </div></li>
19079 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19080 <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>
19081 <div class="gallerytext">
19082 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19083 </p>
19084 </div>
19085 </div></li>
19086 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19087 <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>
19088 <div class="gallerytext">
19089 </div>
19090 </div></li>
19091 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19092 <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>
19093 <div class="gallerytext">
19094 <p>blabla.
19095 </p>
19096 </div>
19097 </div></li>
19098 </ul>
19099
19100 !! html/parsoid
19101 <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"}}'>
19102 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19103 <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>
19104 <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>
19105 <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>
19106 <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>
19107 <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>
19108 </ul>
19109 !! end
19110
19111 !! test
19112 Gallery with link that has fragment
19113 !! options
19114 parsoid={
19115 "modes": ["wt2html", "html2html"],
19116 "nativeGallery": true
19117 }
19118 !! wikitext
19119 <gallery>
19120 image:foobar.jpg|link=Main_Page
19121 image:foobar.jpg|link=Main_Page#section
19122 image:foobar.jpg|link=Main Page#section|caption
19123 </gallery>
19124 !! html/php
19125 <ul class="gallery mw-gallery-traditional">
19126 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19127 <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>
19128 <div class="gallerytext">
19129 </div>
19130 </div></li>
19131 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19132 <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>
19133 <div class="gallerytext">
19134 </div>
19135 </div></li>
19136 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19137 <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>
19138 <div class="gallerytext">
19139 <p>caption
19140 </p>
19141 </div>
19142 </div></li>
19143 </ul>
19144
19145 !! html/parsoid
19146 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19147 <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>
19148 <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>
19149 <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>
19150 </ul>
19151 !! end
19152
19153 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19154 !! test
19155 Gallery with template inside caption
19156 !! options
19157 parsoid={
19158 "nativeGallery": true
19159 }
19160 !! wikitext
19161 <gallery caption="{{echo|hi}}">
19162 File:Foobar.jpg|{{echo|ho}}
19163 </gallery>
19164 !! html/php
19165 <ul class="gallery mw-gallery-traditional">
19166 <li class='gallerycaption'>{{echo|hi}}</li>
19167 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19168 <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>
19169 <div class="gallerytext">
19170 <p>ho
19171 </p>
19172 </div>
19173 </div></li>
19174 </ul>
19175
19176 !! html/parsoid
19177 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19178 <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>
19179 <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>
19180 </ul>
19181 !! end
19182
19183 !! test
19184 Gallery with wikitext inside caption
19185 !! options
19186 parsoid={
19187 "nativeGallery": true
19188 }
19189 !! wikitext
19190 <gallery>
19191 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19192 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19193 </gallery>
19194 !! html/php
19195 <ul class="gallery mw-gallery-traditional">
19196 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19197 <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>
19198 <div class="gallerytext">
19199 <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>
19200 </p>
19201 </div>
19202 </div></li>
19203 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19204 <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>
19205 <div class="gallerytext">
19206 <p>This is a test template
19207 </p>
19208 </div>
19209 </div></li>
19210 </ul>
19211
19212 !! html/parsoid
19213 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19214 <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>
19215 <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>
19216 </ul>
19217 !! end
19218
19219 !! test
19220 Gallery (with showfilename option)
19221 !! options
19222 parsoid={
19223 "nativeGallery": true
19224 }
19225 !! wikitext
19226 <gallery showfilename="">
19227 File:Nonexistent.jpg|caption
19228 File:Nonexistent.jpg
19229 File:Foobar.jpg|some '''caption''' [[Main Page]]
19230 File:Foobar.jpg
19231 </gallery>
19232 !! html/php
19233 <ul class="gallery mw-gallery-traditional">
19234 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19235 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19236 <div class="gallerytext">
19237 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19238 caption
19239 </p>
19240 </div>
19241 </div></li>
19242 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19243 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19244 <div class="gallerytext">
19245 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19246 </p>
19247 </div>
19248 </div></li>
19249 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19250 <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>
19251 <div class="gallerytext">
19252 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19253 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19254 </p>
19255 </div>
19256 </div></li>
19257 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19258 <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>
19259 <div class="gallerytext">
19260 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19261 </p>
19262 </div>
19263 </div></li>
19264 </ul>
19265
19266 !! html/parsoid
19267 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
19268 <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>
19269 <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>
19270 <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>
19271 <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>
19272 </ul>
19273 !! end
19274
19275 ## Should Parsoid be preserving these variations?
19276 !! test
19277 Gallery (with namespace-less filenames)
19278 !! options
19279 parsoid={
19280 "modes": ["wt2html", "html2html"],
19281 "nativeGallery": true
19282 }
19283 !! wikitext
19284 <gallery>
19285 File:Nonexistent.jpg
19286 Nonexistent.jpg
19287 image:foobar.jpg
19288 foobar.jpg
19289 </gallery>
19290 !! html/php
19291 <ul class="gallery mw-gallery-traditional">
19292 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19293 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19294 <div class="gallerytext">
19295 </div>
19296 </div></li>
19297 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19298 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19299 <div class="gallerytext">
19300 </div>
19301 </div></li>
19302 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19303 <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>
19304 <div class="gallerytext">
19305 </div>
19306 </div></li>
19307 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19308 <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>
19309 <div class="gallerytext">
19310 </div>
19311 </div></li>
19312 </ul>
19313
19314 !! html/parsoid
19315 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19316 <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>
19317 <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>
19318 <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>
19319 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./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>
19320 </ul>
19321 !! end
19322
19323 !! test
19324 Gallery override link with WikiLink (T36852)
19325 !! options
19326 parsoid={
19327 "nativeGallery": true
19328 }
19329 !! wikitext
19330 <gallery>
19331 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
19332 </gallery>
19333 !! html/php
19334 <ul class="gallery mw-gallery-traditional">
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/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>
19337 <div class="gallerytext">
19338 </div>
19339 </div></li>
19340 </ul>
19341
19342 !! html/parsoid
19343 <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":{}}'>
19344 <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>
19345 </ul>
19346 !! end
19347
19348 !! test
19349 Gallery override link with absolute external link (T36852)
19350 !! options
19351 parsoid={
19352 "nativeGallery": true
19353 }
19354 !! wikitext
19355 <gallery>
19356 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
19357 </gallery>
19358 !! html/php
19359 <ul class="gallery mw-gallery-traditional">
19360 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19361 <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>
19362 <div class="gallerytext">
19363 </div>
19364 </div></li>
19365 </ul>
19366
19367 !! html/parsoid
19368 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19369 <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>
19370 </ul>
19371 !! end
19372
19373 !! test
19374 Gallery override link with malicious javascript (T36852)
19375 !! options
19376 parsoid={
19377 "modes": ["wt2html", "html2html"],
19378 "nativeGallery": true
19379 }
19380 !! wikitext
19381 <gallery>
19382 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19383 </gallery>
19384 !! html/php
19385 <ul class="gallery mw-gallery-traditional">
19386 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19387 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%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>
19388 <div class="gallerytext">
19389 </div>
19390 </div></li>
19391 </ul>
19392
19393 !! html/parsoid
19394 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19395 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./&quot;_onclick=&quot;alert('malicious_javascript_code!');"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"></div></li>
19396 </ul>
19397 !! end
19398
19399 !! test
19400 Gallery with invalid title as link (T45964)
19401 !! options
19402 parsoid={
19403 "modes": ["wt2html", "html2html"],
19404 "nativeGallery": true
19405 }
19406 !! wikitext
19407 <gallery>
19408 File:Foobar.jpg|link=<
19409 </gallery>
19410 !! html/php
19411 <ul class="gallery mw-gallery-traditional">
19412 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19413 <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>
19414 <div class="gallerytext">
19415 </div>
19416 </div></li>
19417 </ul>
19418
19419 !! html/parsoid
19420 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19421 <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>
19422 </ul>
19423 !! end
19424
19425 !! test
19426 HTML Hex character encoding (spells the word "JavaScript")
19427 !! options
19428 parsoid=wt2html,wt2wt,html2html
19429 !! wikitext
19430 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19431 !! html/php
19432 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19433 </p>
19434 !! html/php+tidy
19435 <p>JavaScript</p>
19436 !! html/parsoid
19437 <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>
19438 !! end
19439
19440 !! test
19441 HTML Hex character encoding bogus encoding (bug 26437 regression check)
19442 !! wikitext
19443 &#xsee;&#XSEE;
19444 !! html/php
19445 <p>&amp;#xsee;&amp;#XSEE;
19446 </p>
19447 !! html/parsoid
19448 <p>&amp;#xsee;&amp;#XSEE;</p>
19449 !! end
19450
19451 !! test
19452 HTML Hex character encoding mixed case
19453 !! options
19454 parsoid=wt2html,wt2wt,html2html
19455 !! wikitext
19456 &#xEE;&#Xee;
19457 !! html/php
19458 <p>&#xee;&#xee;
19459 </p>
19460 !! html/php+tidy
19461 <p>îî</p>
19462 !! html/parsoid
19463 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19464 !! end
19465
19466 # See: https://www.w3.org/TR/html5/syntax.html#character-references
19467 # Note that U+000C (form feed) is not a valid XML character, so
19468 # it is banned even though allowed in HTML5.
19469 !! test
19470 Illegal character references (T106578)
19471 !! wikitext
19472 ; Null: &#00;
19473 ; FF: &#xC;
19474 ; CR: &#xD;
19475 ; Control (low): &#8;
19476 ; Control (high): &#x7F; &#x9F;
19477 ; Surrogate: &#xD83D;&#xDCA9;
19478 ; This is an okay astral character: &#x1F4A9;
19479 !! html+tidy
19480 <dl>
19481 <dt>Null</dt>
19482 <dd>&amp;#00;</dd>
19483 <dt>FF</dt>
19484 <dd>&amp;#xC;</dd>
19485 <dt>CR</dt>
19486 <dd>&amp;#xD;</dd>
19487 <dt>Control (low)</dt>
19488 <dd>&amp;#8;</dd>
19489 <dt>Control (high)</dt>
19490 <dd>&amp;#x7F; &amp;#x9F;</dd>
19491 <dt>Surrogate</dt>
19492 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19493 <dt>This is an okay astral character</dt>
19494 <dd>💩</dd>
19495 </dl>
19496 !! end
19497
19498 !! test
19499 __FORCETOC__ override
19500 !! wikitext
19501 __NEWSECTIONLINK__
19502 __FORCETOC__
19503 !! html/php
19504 <p><br />
19505 </p>
19506 !! end
19507
19508 !! test
19509 ISBN code coverage
19510 !! wikitext
19511 ISBN 978-0-1234-56&#x20;789
19512 !! html
19513 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19514 </p>
19515 !! html+tidy
19516 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19517 !! html/parsoid
19518 <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>
19519 !! end
19520
19521 !! test
19522 ISBN followed by 5 spaces
19523 !! wikitext
19524 ISBN
19525 !! html
19526 <p>ISBN
19527 </p>
19528 !! end
19529
19530 !! test
19531 Double ISBN
19532 !! wikitext
19533 ISBN ISBN 1234567890
19534 !! html/php
19535 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19536 </p>
19537 !! html/parsoid
19538 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19539 !! end
19540
19541 # Uppercase X and lowercase x as well
19542 !! test
19543 ISBN with an X
19544 !! wikitext
19545 ISBN 3-462-04561-X
19546 ISBN 3-462-04561-x
19547 ISBN 080442957X
19548 ISBN 080442957x
19549 ISBN 978080442957X
19550 ISBN 978080442957x
19551 !! html/php
19552 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19553 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19554 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19555 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19556 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19557 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19558 </p>
19559 !! html/parsoid
19560 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19561 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19562 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19563 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19564 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19565 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19566 !! end
19567
19568 !! test
19569 ISBN with empty prefix (parsoid test)
19570 !! wikitext
19571 ISBN 1234567890
19572 !! html/php
19573 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19574 </p>
19575 !! html/parsoid
19576 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19577 !! end
19578
19579 !! test
19580 Bug 22905: <abbr> followed by ISBN followed by </a>
19581 !! wikitext
19582 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19583 !! html/php
19584 <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>
19585 </p>
19586 !! html/parsoid
19587 <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>
19588 !! end
19589
19590 !! test
19591 Double RFC
19592 !! wikitext
19593 RFC RFC 1234
19594 !! html
19595 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19596 </p>
19597 !! end
19598
19599 !! test
19600 Double RFC with a wiki link
19601 !! wikitext
19602 RFC [[RFC 1234]]
19603 !! html
19604 <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>
19605 </p>
19606 !! end
19607
19608 !! test
19609 RFC code coverage
19610 !! wikitext
19611 RFC 983&#x20;987
19612 !! html
19613 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19614 </p>
19615 !! html+tidy
19616 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19617 !! end
19618
19619 !! test
19620 Centre-aligned image
19621 !! wikitext
19622 [[Image:foobar.jpg|centre]]
19623 !! html
19624 <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>
19625
19626 !!end
19627
19628 !! test
19629 None-aligned image
19630 !! wikitext
19631 [[Image:foobar.jpg|none]]
19632 !! html
19633 <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>
19634
19635 !!end
19636
19637 !! test
19638 Width + Height sized image (using px) (height is ignored)
19639 !! wikitext
19640 [[Image:foobar.jpg|640x480px]]
19641 !! html
19642 <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>
19643 </p>
19644 !!end
19645
19646 !! test
19647 Width-sized image (using px, no following whitespace)
19648 !! wikitext
19649 [[Image:foobar.jpg|640px]]
19650 !! html
19651 <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>
19652 </p>
19653 !!end
19654
19655 !! test
19656 Width-sized image (using px, with following whitespace - test regression from r39467)
19657 !! wikitext
19658 [[Image:foobar.jpg|640px ]]
19659 !! html
19660 <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>
19661 </p>
19662 !!end
19663
19664 !! test
19665 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19666 !! wikitext
19667 [[Image:foobar.jpg| 640px]]
19668 !! html
19669 <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>
19670 </p>
19671 !!end
19672
19673 !! test
19674 Image with page parameter
19675 !! options
19676 djvu
19677 !! wikitext
19678 [[File:LoremIpsum.djvu|page=2]]
19679 !! html/php
19680 <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>
19681 </p>
19682 !! html/parsoid
19683 <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>
19684 !! end
19685
19686 !! test
19687 Another italics / bold test
19688 !! wikitext
19689 ''' ''x'
19690 !! html
19691 <pre>'<i> </i>x'
19692 </pre>
19693 !!end
19694
19695 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19696 !! test
19697 dt/dd/dl test
19698 !! wikitext
19699 :;;;::
19700 !! html/php
19701 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19702
19703 !! html/parsoid
19704 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19705
19706 !!end
19707
19708
19709 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19710 !! test
19711 Images with the "|" character in the comment
19712 !! wikitext
19713 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19714 !! html/php
19715 <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>
19716
19717 !! html/parsoid
19718 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>An <a rel="mw:ExtLink" href="http://test/?param1=|left|&amp;param2=|x">external</a> URL</figcaption></figure>
19719 !! end
19720
19721 !! test
19722 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19723 !! wikitext
19724 <html><script>alert(1);</script></html>
19725 !! html
19726 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19727 </p>
19728 !! end
19729
19730 !! test
19731 HTML with raw HTML ($wgRawHtml==true)
19732 !! options
19733 wgRawHtml=1
19734 !! wikitext
19735 <html><script>alert(1);</script></html>
19736 !! html
19737 <p><script>alert(1);</script>
19738 </p>
19739 !! end
19740
19741 !! test
19742 Parents of subpages, one level up
19743 !! options
19744 subpage title=[[Subpage test/L1/L2/L3]]
19745 !! wikitext
19746 [[../|L2]]
19747 !! html
19748 <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>
19749 </p>
19750 !! end
19751
19752
19753 !! test
19754 Parents of subpages, one level up, not named
19755 !! options
19756 subpage title=[[Subpage test/L1/L2/L3]]
19757 !! wikitext
19758 [[../]]
19759 !! html
19760 <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>
19761 </p>
19762 !! end
19763
19764
19765
19766 !! test
19767 Parents of subpages, two levels up
19768 !! options
19769 subpage title=[[Subpage test/L1/L2/L3]]
19770 !! wikitext
19771 [[../../|L1]]2
19772
19773 [[../../|L1]]l
19774 !! html
19775 <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
19776 </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>
19777 </p>
19778 !! end
19779
19780 !! test
19781 Parents of subpages, two levels up, without trailing slash or name.
19782 !! options
19783 subpage title=[[Subpage test/L1/L2/L3]]
19784 !! wikitext
19785 [[../..]]
19786 !! html
19787 <p>[[../..]]
19788 </p>
19789 !! end
19790
19791 !! test
19792 Parents of subpages, two levels up, with lots of extra trailing slashes.
19793 !! options
19794 subpage title=[[Subpage test/L1/L2/L3]]
19795 !! wikitext
19796 [[../../////]]
19797 !! html
19798 <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>
19799 </p>
19800 !! end
19801
19802 !! article
19803 Subpage test/L1/L2/L3Sibling
19804 !! text
19805 Sibling article
19806 !! endarticle
19807
19808 !! test
19809 Transclusion of a sibling page (one level up)
19810 !! options
19811 subpage title=[[Subpage test/L1/L2/L3]]
19812 !! wikitext
19813 {{../L3Sibling}}
19814 !! html
19815 <p>Sibling article
19816 </p>
19817 !! end
19818
19819 !! test
19820 Transclusion of a child page
19821 !! options
19822 subpage title=[[Subpage test/L1/L2]]
19823 !! wikitext
19824 {{/L3Sibling}}
19825 !! html
19826 <p>Sibling article
19827 </p>
19828 !! end
19829
19830 # This is wt2html only in Parsoid because we add <nowiki>
19831 # because of {{..}} and we don't expect to fix that to
19832 # eliminate the nowikis selective for {{..}} markup.
19833 !! test
19834 Non-transclusion because of too many up levels
19835 !! options
19836 subpage title=[[Subpage test/L1/L2/L3]]
19837 parsoid=wt2html
19838 !! wikitext
19839 {{../../../../More than parent}}
19840 !! html/php
19841 <p>{{../../../../More than parent}}
19842 </p>
19843 !! html/parsoid
19844 <p>{{../../../../More than parent}}</p>
19845 !! end
19846
19847 !! test
19848 Definition list code coverage
19849 !! wikitext
19850 ; title : def
19851 ; title : def
19852 ;title: def
19853 !! html/php
19854 <dl><dt> title &#160;</dt>
19855 <dd> def</dd>
19856 <dt> title&#160;</dt>
19857 <dd> def</dd>
19858 <dt>title</dt>
19859 <dd> def</dd></dl>
19860
19861 !! html/parsoid
19862 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19863 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19864 <dt>title</dt><dd> def</dd></dl>
19865 !! end
19866
19867 !! test
19868 Don't fall for the self-closing div
19869 !! wikitext
19870 <div>hello world</div/>
19871 !! html
19872 <div>hello world</div>
19873
19874 !! end
19875
19876 !! test
19877 MSGNW magic word
19878 !! wikitext
19879 {{MSGNW:msg}}
19880 !! html/php
19881 <p>&#91;&#91;:Template:Msg&#93;&#93;
19882 </p>
19883 !! end
19884
19885 !! test
19886 RAW magic word
19887 !! wikitext
19888 {{RAW:QUERTY}}
19889 !! html
19890 <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>
19891 </p>
19892 !! end
19893
19894 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19895 !! test
19896 Always escape literal '>' in output, not just after '<'
19897 !! wikitext
19898 ><>
19899 !! html
19900 <p>&gt;&lt;&gt;
19901 </p>
19902 !! end
19903
19904 !! test
19905 Template caching
19906 !! wikitext
19907 {{Test}}
19908 {{Test}}
19909 !! html
19910 <p>This is a test template
19911 This is a test template
19912 </p>
19913 !! end
19914
19915
19916 !! article
19917 MediaWiki:Fake
19918 !! text
19919 ==header==
19920 !! endarticle
19921
19922 !! test
19923 Inclusion of !userCanEdit() content
19924 !! wikitext
19925 {{MediaWiki:Fake}}
19926 !! html
19927 <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>
19928
19929 !! end
19930
19931
19932 !! test
19933 Out-of-order TOC heading levels
19934 !! wikitext
19935 ==2==
19936 ======6======
19937 ===3===
19938 =1=
19939 =====5=====
19940 ==2==
19941 !! html
19942 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19943 <ul>
19944 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19945 <ul>
19946 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19947 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19948 </ul>
19949 </li>
19950 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19951 <ul>
19952 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19953 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19954 </ul>
19955 </li>
19956 </ul>
19957 </div>
19958
19959 <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>
19960 <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>
19961 <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>
19962 <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>
19963 <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>
19964 <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>
19965
19966 !! end
19967
19968
19969 !! test
19970 ISBN with a dummy number
19971 !! wikitext
19972 ISBN ---
19973 !! html
19974 <p>ISBN ---
19975 </p>
19976 !! end
19977
19978
19979 !! test
19980 ISBN with space-delimited number
19981 !! wikitext
19982 ISBN 92 9017 032 8
19983 !! html
19984 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19985 </p>
19986 !! end
19987
19988
19989 !! test
19990 ISBN with multiple spaces, no number
19991 !! wikitext
19992 ISBN foo
19993 !! html
19994 <p>ISBN foo
19995 </p>
19996 !! end
19997
19998
19999 !! test
20000 ISBN length
20001 !! wikitext
20002 ISBN 123456789
20003
20004 ISBN 1234567890
20005
20006 ISBN 12345678901
20007 !! html
20008 <p>ISBN 123456789
20009 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20010 </p><p>ISBN 12345678901
20011 </p>
20012 !! end
20013
20014
20015 !! test
20016 ISBN with trailing year (bug 8110)
20017 !! wikitext
20018 ISBN 1-234-56789-0 - 2006
20019
20020 ISBN 1 234 56789 0 - 2006
20021 !! html
20022 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
20023 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20024 </p>
20025 !! end
20026
20027
20028 !! test
20029 anchorencode
20030 !! wikitext
20031 {{anchorencode:foo bar©#%n}}
20032 !! html
20033 <p>foo_bar.C2.A9.23.25n
20034 </p>
20035 !! end
20036
20037 !! test
20038 anchorencode trims spaces
20039 !! wikitext
20040 {{anchorencode: __pretty__please__}}
20041 !! html
20042 <p>pretty_please
20043 </p>
20044 !! end
20045
20046 !! test
20047 anchorencode deals with links
20048 !! wikitext
20049 {{anchorencode: [[hello|world]] [[hi]]}}
20050 !! html
20051 <p>world_hi
20052 </p>
20053 !! end
20054
20055 !! test
20056 anchorencode deals with templates
20057 !! wikitext
20058 {{anchorencode: {{Foo}} }}
20059 !! html
20060 <p>FOO
20061 </p>
20062 !! end
20063
20064 !! test
20065 anchorencode encodes like the TOC generator: (bug 18431)
20066 !! wikitext
20067 === _ +:.3A%3A&&amp;]] ===
20068 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20069 __NOEDITSECTION__
20070 !! html
20071 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20072 <p>.2B:.3A.253A.26.26.5D.5D
20073 </p>
20074 !! end
20075
20076 !! test
20077 Bug 6200: blockquotes and paragraph formatting
20078 !! wikitext
20079 <blockquote>
20080 foo
20081 </blockquote>
20082
20083 bar
20084
20085 baz
20086 !! html
20087 <blockquote>
20088 <p>foo
20089 </p>
20090 </blockquote>
20091 <p>bar
20092 </p>
20093 <pre>baz
20094 </pre>
20095 !! end
20096
20097 !! test
20098 Bug 8293: Use of center tag ruins paragraph formatting
20099 !! wikitext
20100 <center>
20101 foo
20102 </center>
20103
20104 bar
20105
20106 baz
20107 !! html
20108 <center>
20109 <p>foo
20110 </p>
20111 </center>
20112 <p>bar
20113 </p>
20114 <pre>baz
20115 </pre>
20116 !! end
20117
20118 !!test
20119 Parsing of overlapping (improperly nested) inline html tags
20120 !! wikitext
20121 <span><s>x</span></s>
20122 !! html/php
20123 <p><span><s>x&lt;/span&gt;</s></span>
20124 </p>
20125 !! html/parsoid
20126 <p><span><s>x</s></span>
20127 </p>
20128 !!end
20129
20130 ###
20131 ### Language variants related tests
20132 ###
20133 !! test
20134 Self-link in language variants
20135 !! options
20136 title=[[Dunav]] language=sr
20137 !! wikitext
20138 Both [[Dunav]] and [[Дунав]] are names for this river.
20139 !! html
20140 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
20141 </p>
20142 !!end
20143
20144 !! article
20145 Дуна
20146 !! text
20147 content
20148 !! endarticle
20149
20150 !! test
20151 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
20152 !! options
20153 title=[[Duna]] language=sr
20154 !! wikitext
20155 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
20156 !! html
20157 <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.
20158 </p>
20159 !! end
20160
20161 !! test
20162 Link to a section of a variant of this title shouldn't be parsed as self-link
20163 !! options
20164 title=[[Duna]] language=sr
20165 !! wikitext
20166 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
20167 !! html
20168 <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.
20169 </p>
20170 !! end
20171
20172 !! test
20173 Link to pages in language variants
20174 !! options
20175 language=sr
20176 !! wikitext
20177 Main Page can be written as [[Маин Паге]]
20178 !! html
20179 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
20180 </p>
20181 !!end
20182
20183
20184 !! test
20185 Multiple links to pages in language variants
20186 !! options
20187 language=sr
20188 !! wikitext
20189 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
20190 !! html
20191 <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>.
20192 </p>
20193 !!end
20194
20195
20196 !! test
20197 Simple template in language variants
20198 !! options
20199 language=sr
20200 !! wikitext
20201 {{тест}}
20202 !! html
20203 <p>This is a test template
20204 </p>
20205 !! end
20206
20207
20208 !! test
20209 Template with explicit namespace in language variants
20210 !! options
20211 language=sr
20212 !! wikitext
20213 {{Template:тест}}
20214 !! html
20215 <p>This is a test template
20216 </p>
20217 !! end
20218
20219
20220 !! test
20221 Basic test for template parameter in language variants
20222 !! options
20223 language=sr
20224 !! wikitext
20225 {{парамтест|param=foo}}
20226 !! html
20227 <p>This is a test template with parameter foo
20228 </p>
20229 !! end
20230
20231 !! test
20232 Simple category in language variants
20233 !! options
20234 language=sr cat
20235 !! wikitext
20236 [[Category:МедиаWики Усер'с Гуиде]]
20237 !! html/php
20238 cat=МедиаWики_Усер'с_Гуиде sort=
20239 !! html/parsoid
20240 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
20241 !! end
20242
20243 !! article
20244 Category:分类
20245 !! text
20246 blah
20247 !! endarticle
20248
20249 !! article
20250 Category:分類
20251 !! text
20252 blah
20253 !! endarticle
20254
20255 ## We used to, but no longer wt2wt this test since the default serializer
20256 ## will normalize all categories to serialize on their own line.
20257 ## This wikitext usage is going to be fairly uncommon in production and
20258 ## selser will take care of preserving formatting in those scenarios.
20259 !! test
20260 Don't convert blue categorylinks to another variant (bug 33210)
20261 !! options
20262 cat
20263 language=zh
20264 parsoid=wt2html
20265 !! wikitext
20266 [[A]][[Category:分类]]
20267 !! html/php
20268 cat=分类 sort=
20269 !! html/parsoid
20270 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
20271 <link rel="mw:PageProp/Category" href="Category:分类"/>
20272 !! end
20273
20274 !! test
20275 Stripping -{}- tags (language variants)
20276 !! options
20277 language=sr
20278 !! wikitext
20279 Latin proverb: -{Ne nuntium necare}-
20280 !! html
20281 <p>Latin proverb: Ne nuntium necare
20282 </p>
20283 !! end
20284
20285
20286 !! test
20287 Prevent conversion with -{}- tags (language variants)
20288 !! options
20289 language=sr variant=sr-ec
20290 !! wikitext
20291 Latinski: -{Ne nuntium necare}-
20292 !! html
20293 <p>Латински: Ne nuntium necare
20294 </p>
20295 !! end
20296
20297
20298 !! test
20299 Prevent conversion of text with -{}- tags (language variants)
20300 !! options
20301 language=sr variant=sr-ec
20302 !! wikitext
20303 Latinski: -{Ne nuntium necare}-
20304 !! html
20305 <p>Латински: Ne nuntium necare
20306 </p>
20307 !! end
20308
20309
20310 !! test
20311 Prevent conversion of links with -{}- tags (language variants)
20312 !! options
20313 language=sr variant=sr-ec
20314 !! wikitext
20315 -{[[Main Page]]}-
20316 !! html
20317 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20318 </p>
20319 !! end
20320
20321
20322 !! test
20323 -{}- tags within headlines (within html for parserConvert())
20324 !! options
20325 language=sr variant=sr-ec
20326 !! wikitext
20327 == -{Naslov}- ==
20328 !! html
20329 <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>
20330
20331 !! end
20332
20333
20334 !! test
20335 Explicit definition of language variant alternatives
20336 !! options
20337 language=zh variant=zh-tw
20338 !! wikitext
20339 -{zh:China;zh-tw:Taiwan}-, not China
20340 !! html
20341 <p>Taiwan, not China
20342 </p>
20343 !! end
20344
20345
20346 !! test
20347 Conversion around HTML tags
20348 !! options
20349 language=sr variant=sr-ec
20350 !! wikitext
20351 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
20352 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
20353 !! html
20354 <p>
20355 <span title="ЛаCтин">ски</span>
20356 </p>
20357 !! end
20358
20359
20360 !! test
20361 Explicit session-wise language variant mapping (A flag and - flag)
20362 !! options
20363 language=zh variant=zh-tw
20364 !! wikitext
20365 Taiwan is not China.
20366 But -{A|zh:China;zh-tw:Taiwan}- is China,
20367 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20368 and -{China}- is China.
20369 !! html
20370 <p>Taiwan is not China.
20371 But Taiwan is Taiwan,
20372 (This should be stripped!)
20373 and China is China.
20374 </p>
20375 !! end
20376
20377 !! test
20378 Explicit session-wise language variant mapping (H flag for hide)
20379 !! options
20380 language=zh variant=zh-tw
20381 !! wikitext
20382 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20383 Taiwan is China.
20384 !! html
20385 <p>(This should be stripped!)
20386 Taiwan is Taiwan.
20387 </p>
20388 !! end
20389
20390 !! test
20391 Adding explicit conversion rule for title (T flag)
20392 !! options
20393 language=zh variant=zh-tw showtitle
20394 !! wikitext
20395 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20396 !! html
20397 Taiwan
20398 <p>Should be stripped!
20399 </p>
20400 !! end
20401
20402 !! test
20403 Testing that changing the language variant here in the tests actually works
20404 !! options
20405 language=zh variant=zh showtitle
20406 !! wikitext
20407 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20408 !! html
20409 China
20410 <p>Should be stripped!
20411 </p>
20412 !! end
20413
20414 !! test
20415 Recursive conversion of alt and title attrs shouldn't clear converter state
20416 !! options
20417 language=zh variant=zh-cn showtitle
20418 !! wikitext
20419 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20420 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20421 !! html
20422 China
20423 <p>
20424 Should be stripped<span title="Exclamation">!</span>
20425 </p>
20426 !! end
20427
20428 !! test
20429 Bug 24072: more test on conversion rule for title
20430 !! options
20431 language=zh variant=zh-tw showtitle
20432 !! wikitext
20433 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20434 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20435 !! html
20436 Taiwan
20437 <p>This should be stripped!
20438 This won't take interferes with the title rule.
20439 </p>
20440 !! end
20441
20442 !! test
20443 Partly disable title conversion if variant == main language code
20444 !! options
20445 language=zh variant=zh title=[[ZH]] showtitle
20446 !! wikitext
20447 -{T|zh-cn:CN;zh-tw:TW}-
20448 !! html
20449 ZH
20450 <p>
20451 </p>
20452 !! end
20453
20454 !! test
20455 Partly disable title conversion if variant == main language code, more
20456 !! options
20457 language=zh variant=zh title=[[ZH]] showtitle
20458 !! wikitext
20459 -{T|TW}-
20460 !! html
20461 ZH
20462 <p>
20463 </p>
20464 !! end
20465
20466 !! test
20467 Raw output of variant escape tags (R flag)
20468 !! options
20469 language=zh variant=zh-tw
20470 !! wikitext
20471 Raw: -{R|zh:China;zh-tw:Taiwan}-
20472 !! html
20473 <p>Raw: zh:China;zh-tw:Taiwan
20474 </p>
20475 !! end
20476
20477 !! test
20478 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20479 !! options
20480 language=zh variant=zh-cn
20481 !! input
20482 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20483 !! result
20484 <p>0
20485 </p>
20486 !! end
20487
20488 !! test
20489 Conversion rules from [numeric-only string] to [something else] (T48634)
20490 !! options
20491 language=zh variant=zh-cn
20492 !! input
20493 -{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
20494 !! result
20495 <p>D12345EE12345
20496 </p>
20497 !! end
20498
20499 !! test
20500 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20501 !! options
20502 language=zh variant=zh-cn
20503 !! input
20504 -{H|zh-cn:foo;zh-tw:;}-foobar
20505 !! result
20506 <p>foobar
20507 </p>
20508 !! end
20509
20510 !! test
20511 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20512 !! options
20513 language=zh variant=zh-cn
20514 !! input
20515 -{H|=>zh-cn:foo;}-foobar
20516 !! result
20517 <p>foobar
20518 </p>
20519 !! end
20520
20521 !! test
20522 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20523 !! options
20524 language=zh variant=zh-cn
20525 !! input
20526 -{H|}-foobar
20527 !! result
20528 <p>foobar
20529 </p>
20530 !! end
20531
20532 !! test
20533 Nested using of manual convert syntax
20534 !! options
20535 language=zh variant=zh-hk
20536 !! wikitext
20537 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20538 !! html
20539 <p>Nested: Hello Hong Kong!
20540 </p>
20541 !! end
20542
20543 # Since Parsoid is starting to emit canonical wikitext for links,
20544 # [http://example.com http://example.com] will not RT back to that
20545 # form anymore.
20546 !! test
20547 Proper conversion of text in external links
20548 !! options
20549 language=sr variant=sr-ec
20550 parsoid=wt2html
20551 !! wikitext
20552 http://www.google.com
20553 gopher://www.google.com
20554 [http://www.google.com http://www.google.com]
20555 [gopher://www.google.com gopher://www.google.com]
20556 [https://www.google.com irc://www.google.com]
20557 [ftp://www.google.com www.google.com/ftp://dir]
20558 [//www.google.com www.google.com]
20559 !! html/php
20560 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20561 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20562 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20563 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20564 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20565 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20566 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20567 </p>
20568 !! html/parsoid
20569 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20570 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20571 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20572 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20573 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20574 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20575 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20576 !! end
20577
20578 !! test
20579 Do not convert roman numbers to language variants
20580 !! options
20581 language=sr variant=sr-ec
20582 !! wikitext
20583 Fridrih IV je car.
20584 !! html
20585 <p>Фридрих IV је цар.
20586 </p>
20587 !! end
20588
20589 !! test
20590 Unclosed language converter markup "-{"
20591 !! options
20592 language=sr
20593 !! wikitext
20594 -{T|hello
20595 !! html
20596 <p>-{T|hello
20597 </p>
20598 !! end
20599
20600 !! test
20601 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20602 !! options
20603 language=sr
20604 !! wikitext
20605 -{R|=&gt;}-
20606 !! html
20607 <p>=&gt;
20608 </p>
20609 !!end
20610
20611 !! test
20612 Don't break link parsing if language converter markup is in the caption.
20613 !! options
20614 language=sr variant=sr-ec
20615 !! wikitext
20616 [[Main Page|-{R|main page}-]]
20617 !! html
20618 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20619 </p>
20620 !! end
20621
20622 !! test
20623 T146304: Don't break template parsing if language converter markup is in the parameter.
20624 !! options
20625 language=sr variant=sr-ec
20626 !! wikitext
20627 {{echo|-{R|foo}-}}
20628 !! html/php
20629 <p>foo
20630 </p>
20631 !! end
20632
20633 !! test
20634 T146305: Don't break image parsing if language converter markup is in the caption.
20635 !! options
20636 language=sr
20637 !! wikitext
20638 [[File:Foobar.jpg|thumb|-{R|caption:}-]]
20639 !! html/php
20640 <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>
20641
20642 !! html/parsoid
20643 <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>
20644 !! end
20645
20646 !! test
20647 T146305: Don't break image parsing if nested language converter markup is in the caption.
20648 !! options
20649 language=zh variant=zh-cn
20650 !! wikitext
20651 [[File:Foobar.jpg|thumb|-{zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
20652 !! html/php
20653 <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>
20654
20655 !! html/parsoid
20656 <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>
20657 !! end
20658
20659 !! test
20660 Don't break gallery if language converter markup is inside.
20661 !! options
20662 language=zh
20663 !! wikitext
20664 <gallery>
20665 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
20666 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
20667 </gallery>
20668 !! html
20669 <ul class="gallery mw-gallery-traditional">
20670 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20671 <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>
20672 <div class="gallerytext">
20673 <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>
20674 </p>
20675 </div>
20676 </div></li>
20677 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20678 <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>
20679 <div class="gallerytext">
20680 <p>This is a test template
20681 </p>
20682 </div>
20683 </div></li>
20684 </ul>
20685
20686 !! end
20687
20688 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20689 !! test
20690 Don't break list handling if language converter markup is in the item.
20691 !! options
20692 language=zh variant=zh-cn
20693 !! wikitext
20694 ;-{zh-cn:AAA;zh-tw:BBB}-
20695 !! html/php
20696 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20697
20698 !! html/parsoid
20699 <dl><dt>AAA
20700 </dt></dl>
20701 !! end
20702
20703 !! test
20704 T153140: Don't break table handling if language converter markup is in the cell.
20705 !! options
20706 language=sr variant=sr-ec
20707 !! wikitext
20708 {|
20709 |-
20710 | -{R|B}-
20711 |}
20712 !! html/php
20713 <table>
20714
20715 <tr>
20716 <td> B
20717 </td></tr></table>
20718
20719 !! html/parsoid
20720 <table>
20721
20722 <tr>
20723 <td> B
20724 </td></tr></table>
20725
20726 !! end
20727
20728 !! test
20729 Bug 529: Uncovered bullet
20730 !! wikitext
20731 * Foo {{bullet}}
20732 !! html
20733 <ul><li> Foo </li>
20734 <li> Bar</li></ul>
20735
20736 !! end
20737
20738 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20739 # Templates in Wikipedia rely on this behavior, as tidy has always been
20740 # enabled there. These tests are normally run *without* tidy, so specify the
20741 # full output here.
20742 # To test realistic parsing behavior, apply a tidy-like transformation to both
20743 # the expected output and your parser's output.
20744 !! test
20745 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20746 !! wikitext
20747 ******* Foo {{bullet}}
20748 !! html
20749 <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>
20750 <li> Bar</li></ul>
20751
20752 !! end
20753
20754 !! test
20755 Bug 529: Uncovered table already at line-start
20756 !! wikitext
20757 x
20758
20759 {{table}}
20760 y
20761 !! html
20762 <p>x
20763 </p>
20764 <table>
20765 <tr>
20766 <td> 1 </td>
20767 <td> 2
20768 </td></tr>
20769 <tr>
20770 <td> 3 </td>
20771 <td> 4
20772 </td></tr></table>
20773 <p>y
20774 </p>
20775 !! end
20776
20777 !! test
20778 Bug 529: Uncovered bullet in parser function result
20779 !! wikitext
20780 * Foo {{lc:{{bullet}} }}
20781 !! html
20782 <ul><li> Foo </li>
20783 <li> bar</li></ul>
20784
20785 !! end
20786
20787 !! test
20788 Bug 5678: Double-parsed template argument
20789 !! wikitext
20790 {{lc:{{{1}}}|hello}}
20791 !! html
20792 <p>{{{1}}}
20793 </p>
20794 !! end
20795
20796 !! test
20797 Bug 5678: Double-parsed template invocation
20798 !! wikitext
20799 {{lc:{{paramtest {{!}} param = hello }} }}
20800 !! html
20801 <p>{{paramtest | param = hello }}
20802 </p>
20803 !! end
20804
20805 !! test
20806 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20807 !! options
20808 language=cs
20809 title=[[Main Page]]
20810 !! wikitext
20811 {{PRVNÍVELKÉ:ěščř}}
20812 {{prvnívelké:ěščř}}
20813 {{PRVNÍMALÉ:ěščř}}
20814 {{prvnímalé:ěščř}}
20815 {{MALÁ:ěščř}}
20816 {{malá:ěščř}}
20817 {{VELKÁ:ěščř}}
20818 {{velká:ěščř}}
20819 !! html
20820 <p>Ěščř
20821 Ěščř
20822 ěščř
20823 ěščř
20824 ěščř
20825 ěščř
20826 ĚŠČŘ
20827 ĚŠČŘ
20828 </p>
20829 !! end
20830
20831 !! test
20832 Morwen/13: Unclosed link followed by heading
20833 !! wikitext
20834 [[link
20835 ==heading==
20836 !! html
20837 <p>[[link
20838 </p>
20839 <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>
20840
20841 !! end
20842
20843 !! test
20844 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20845 !! wikitext
20846 {{foo|
20847 =heading=
20848 !! html
20849 <p>{{foo|
20850 </p>
20851 <h1><span class="mw-headline" id="heading">heading</span></h1>
20852
20853 !! end
20854
20855 !! test
20856 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20857 !! wikitext
20858 {{foo|
20859 ==heading==
20860 !! html
20861 <p>{{foo|
20862 </p>
20863 <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>
20864
20865 !! end
20866
20867 !! test
20868 Tildes in comments
20869 !! options
20870 pst
20871 !! wikitext
20872 <!-- ~~~~ -->
20873 !! html/php
20874 <!-- ~~~~ -->
20875 !! end
20876
20877 !! test
20878 Paragraphs inside divs (no extra line breaks)
20879 !! wikitext
20880 <div>Line one
20881
20882 Line two</div>
20883 !! html
20884 <div>Line one
20885 Line two</div>
20886
20887 !! end
20888
20889 !! test
20890 Paragraphs inside divs (extra line break on open)
20891 !! wikitext
20892 <div>
20893 Line one
20894
20895 Line two</div>
20896 !! html
20897 <div>
20898 <p>Line one
20899 </p>
20900 Line two</div>
20901
20902 !! end
20903
20904 !! test
20905 Paragraphs inside divs (extra line break on close)
20906 !! wikitext
20907 <div>Line one
20908
20909 Line two
20910 </div>
20911 !! html
20912 <div>Line one
20913 <p>Line two
20914 </p>
20915 </div>
20916
20917 !! end
20918
20919 !! test
20920 Paragraphs inside divs (extra line break on open and close)
20921 !! wikitext
20922 <div>
20923 Line one
20924
20925 Line two
20926 </div>
20927 !! html
20928 <div>
20929 <p>Line one
20930 </p><p>Line two
20931 </p>
20932 </div>
20933
20934 !! end
20935
20936 !! test
20937 Nesting tags, paragraphs on lines which begin with <div>
20938 !! wikitext
20939 <div></div><strong>A
20940 B</strong>
20941 !! html/php+tidy
20942 <p><strong>A</strong></p>
20943 <p><strong>B</strong></p>
20944 !! html/parsoid
20945 <div></div>
20946 <p><strong>A
20947 B</strong>
20948 </p>
20949 !! end
20950
20951 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20952 !! test
20953 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20954 !! wikitext
20955 <blockquote>Line one
20956
20957 Line two</blockquote>
20958 !! html
20959 <blockquote>Line one
20960 Line two</blockquote>
20961
20962 !! html+tidy
20963 <blockquote>
20964 <p>Line one Line two</p>
20965 </blockquote>
20966 !! end
20967
20968 !! test
20969 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20970 !! wikitext
20971 <blockquote>
20972 Line one
20973
20974 Line two</blockquote>
20975 !! html
20976 <blockquote>
20977 <p>Line one
20978 </p>
20979 Line two</blockquote>
20980
20981 !! html+tidy
20982 <blockquote>
20983 <p>Line one</p>
20984 Line two</blockquote>
20985 !! end
20986
20987 !! test
20988 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20989 !! wikitext
20990 <blockquote>Line one
20991
20992 Line two
20993 </blockquote>
20994 !! html
20995 <blockquote>Line one
20996 <p>Line two
20997 </p>
20998 </blockquote>
20999
21000 !! html+tidy
21001 <blockquote>
21002 <p>Line one</p>
21003 <p>Line two</p>
21004 </blockquote>
21005 !! end
21006
21007 !! test
21008 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
21009 !! wikitext
21010 <blockquote>
21011 Line one
21012
21013 Line two
21014 </blockquote>
21015 !! html
21016 <blockquote>
21017 <p>Line one
21018 </p><p>Line two
21019 </p>
21020 </blockquote>
21021
21022 !! html+tidy
21023 <blockquote>
21024 <p>Line one</p>
21025 <p>Line two</p>
21026 </blockquote>
21027 !! end
21028
21029 !! test
21030 Paragraphs inside blockquotes/divs (no extra line breaks)
21031 !! wikitext
21032 <blockquote><div>Line one
21033
21034 Line two</div></blockquote>
21035 !! html
21036 <blockquote><div>Line one
21037 Line two</div></blockquote>
21038
21039 !! end
21040
21041 !! test
21042 Paragraphs inside blockquotes/divs (extra line break on open)
21043 !! wikitext
21044 <blockquote><div>
21045 Line one
21046
21047 Line two</div></blockquote>
21048 !! html
21049 <blockquote><div>
21050 <p>Line one
21051 </p>
21052 Line two</div></blockquote>
21053
21054 !! end
21055
21056 !! test
21057 Paragraphs inside blockquotes/divs (extra line break on close)
21058 !! wikitext
21059 <blockquote><div>Line one
21060
21061 Line two
21062 </div></blockquote>
21063 !! html
21064 <blockquote><div>Line one
21065 <p>Line two
21066 </p>
21067 </div></blockquote>
21068
21069 !! end
21070
21071 !! test
21072 Paragraphs inside blockquotes/divs (extra line break on open and close)
21073 !! wikitext
21074 <blockquote><div>
21075 Line one
21076
21077 Line two
21078 </div></blockquote>
21079 !! html
21080 <blockquote><div>
21081 <p>Line one
21082 </p><p>Line two
21083 </p>
21084 </div></blockquote>
21085
21086 !! end
21087
21088 !! test
21089 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
21090 !! options
21091 wgLinkHolderBatchSize=0
21092 !! wikitext
21093 [[meatball:1]]
21094 [[meatball:2]]
21095 [[meatball:3]]
21096 !! html
21097 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
21098 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
21099 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
21100 </p>
21101 !! end
21102
21103 !! test
21104 Free external link invading image caption
21105 !! wikitext
21106 [[Image:Foobar.jpg|thumb|http://x|hello]]
21107 !! html
21108 <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>
21109
21110 !! end
21111
21112 !! test
21113 Bug 15196: localised external link numbers
21114 !! options
21115 language=fa
21116 !! wikitext
21117 [http://en.wikipedia.org/]
21118 !! html/php
21119 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
21120 </p>
21121 !! html/parsoid
21122 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
21123 !! end
21124
21125 !! test
21126 Multibyte character in padleft
21127 !! wikitext
21128 {{padleft:-Hello|7|Æ}}
21129 !! html
21130 <p>Æ-Hello
21131 </p>
21132 !! end
21133
21134 !! test
21135 Multibyte character in padright
21136 !! wikitext
21137 {{padright:Hello-|7|Æ}}
21138 !! html
21139 <p>Hello-Æ
21140 </p>
21141 !! end
21142
21143 !!test
21144 formatdate parser function
21145 !! wikitext
21146 {{#formatdate:2009-03-24}}
21147 !! html
21148 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
21149 </p>
21150 !! end
21151
21152 !!test
21153 formatdate parser function, with default format
21154 !! wikitext
21155 {{#formatdate:2009-03-24|mdy}}
21156 !! html
21157 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
21158 </p>
21159 !! end
21160
21161 !! test
21162 Spacing of numbers in formatted dates
21163 !! wikitext
21164 {{#formatdate:January 15}}
21165 !! html
21166 <p><span class="mw-formatted-date" title="01-15">January 15</span>
21167 </p>
21168 !! end
21169
21170 !! test
21171 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
21172 !! options
21173 language=nl title=[[MediaWiki:Common.css]]
21174 !! wikitext
21175 {{#formatdate:2009-03-24|dmy}}
21176 !! html
21177 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
21178 </p>
21179 !! end
21180
21181 #
21182 #
21183 #
21184
21185 #
21186 # Edit comments
21187 #
21188
21189 !! test
21190 Edit comment with link
21191 !! options
21192 comment
21193 !! wikitext
21194 I like the [[Main Page]] a lot
21195 !! html/php
21196 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
21197 !!end
21198
21199 !! test
21200 Edit comment with link and link text
21201 !! options
21202 comment
21203 !! wikitext
21204 I like the [[Main Page|best pages]] a lot
21205 !! html/php
21206 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21207 !!end
21208
21209 !! test
21210 Edit comment with link and link text with suffix
21211 !! options
21212 comment
21213 !! wikitext
21214 I like the [[Main Page|best page]]s a lot
21215 !! html/php
21216 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21217 !!end
21218
21219 !! test
21220 Edit comment with section link (non-local, eg in history list)
21221 !! options
21222 comment title=[[Main Page]]
21223 !! wikitext
21224 /* External links */ removed bogus entries
21225 !! html/php
21226 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21227 !!end
21228
21229 !! test
21230 Edit comment with section link and text before it (non-local, eg in history list)
21231 !! options
21232 comment title=[[Main Page]]
21233 !! wikitext
21234 pre-comment text /* External links */ removed bogus entries
21235 !! html/php
21236 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>
21237 !!end
21238
21239 !! test
21240 Edit comment with section link (local, eg in diff view)
21241 !! options
21242 comment local title=[[Main Page]]
21243 !! wikitext
21244 /* External links */ removed bogus entries
21245 !! html/php
21246 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21247 !!end
21248
21249 !! test
21250 Edit comment with subpage link (bug 14080)
21251 !! options
21252 comment
21253 subpage
21254 title=[[Subpage test]]
21255 !! wikitext
21256 Poked at a [[/subpage]] here...
21257 !! html/php
21258 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
21259 !!end
21260
21261 !! test
21262 Edit comment with subpage link and link text (bug 14080)
21263 !! options
21264 comment
21265 subpage
21266 title=[[Subpage test]]
21267 !! wikitext
21268 Poked at a [[/subpage|neat little page]] here...
21269 !! html/php
21270 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
21271 !!end
21272
21273 !! test
21274 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
21275 !! options
21276 comment
21277 title=[[Subpage test]]
21278 !! wikitext
21279 Poked at a [[/subpage]] here...
21280 !! html/php
21281 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...
21282 !!end
21283
21284 !! test
21285 Edit comment with bare anchor link (local, as on diff)
21286 !! options
21287 comment
21288 local
21289 title=[[Main Page]]
21290 !! wikitext
21291 [[#section]]
21292 !! html/php
21293 <a href="#section">#section</a>
21294 !! end
21295
21296 !! test
21297 Edit comment with bare anchor link (non-local, as on history)
21298 !! options
21299 comment
21300 title=[[Main Page]]
21301 !! wikitext
21302 [[#section]]
21303 !! html/php
21304 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
21305 !! end
21306
21307 !! test
21308 Anchor starting with underscore
21309 !! options
21310 title=[[Foo]]
21311 !! wikitext
21312 [[#_ref|One]]
21313 !! html/php
21314 <p><a href="#_ref">One</a>
21315 </p>
21316 !! html/parsoid
21317 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
21318 !! end
21319
21320 !! test
21321 Id starting with underscore
21322 !! wikitext
21323 <div id="_ref"></div>
21324 !! html/*
21325 <div id="_ref"></div>
21326
21327 !! end
21328
21329 !! test
21330 Edit comment with link with more than one pipe (T99346)
21331 !! options
21332 comment
21333 !! wikitext
21334 [[Main Page|Many|pipes]]
21335 !! html/php
21336 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
21337 !! end
21338
21339 !! test
21340 Complex edit comment with link with more than one pipe (T99346)
21341 !! options
21342 comment
21343 !! wikitext
21344 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
21345 !! html/php
21346 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;
21347 !! end
21348
21349 !! test
21350 Space normalisation on autocomment (bug 22784)
21351 !! options
21352 comment
21353 title=[[Main Page]]
21354 !! wikitext
21355 /* __hello__world__ */
21356 !! html/php
21357 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
21358 !! end
21359
21360 !! test
21361 percent-encoding and + signs in comments (Bug 26410)
21362 !! options
21363 comment
21364 !! wikitext
21365 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
21366 !! html/php
21367 <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>
21368 !! end
21369
21370 # Parsoid doesn't support this yet: see bug 73581
21371 # but it *should* omit the 'src' attribute if the image is bad.
21372 # PHP side of tests was disabled in
21373 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
21374 # because of issues in the PHP parserTests infrastructure
21375 # (but the output below is indeed what the PHP side emits)
21376 !! test
21377 Bad images - basic functionality
21378 !! wikitext
21379 [[File:Bad.jpg]]
21380 !! DISABLED/html/php
21381 !! html/parsoid
21382 <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>
21383 !! end
21384
21385 !! test
21386 Bad images - bug 16039: text after bad image disappears
21387 !! wikitext
21388 Foo bar
21389 [[File:Bad.jpg]]
21390 Bar foo
21391 !! DISABLED/html/php
21392 <p>Foo bar
21393 </p><p>Bar foo
21394 </p>
21395 !! html/parsoid
21396 <p>Foo bar
21397 <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>
21398 Bar foo</p>
21399 !! end
21400
21401 !! test
21402 Verify that displaytitle works (bug #22501) no displaytitle
21403 !! options
21404 showtitle
21405 !! config
21406 wgAllowDisplayTitle=true
21407 wgRestrictDisplayTitle=false
21408 !! wikitext
21409 this is not the the title
21410 !! html/php
21411 Parser test
21412 <p>this is not the the title
21413 </p>
21414 !! end
21415
21416 !! test
21417 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
21418 !! options
21419 showtitle
21420 title=[[Screen]]
21421 !! config
21422 wgAllowDisplayTitle=true
21423 wgRestrictDisplayTitle=false
21424 !! wikitext
21425 this is not the the title
21426 {{DISPLAYTITLE:whatever}}
21427 !! html/php
21428 whatever
21429 <p>this is not the the title
21430 </p>
21431 !! end
21432
21433 !! test
21434 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
21435 !! options
21436 showtitle
21437 title=[[Screen]]
21438 !! config
21439 wgAllowDisplayTitle=true
21440 wgRestrictDisplayTitle=true
21441 !! wikitext
21442 this is not the the title
21443 {{DISPLAYTITLE:whatever}}
21444 !! html/php
21445 Screen
21446 <p>this is not the the title
21447 </p>
21448 !! end
21449
21450 !! test
21451 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
21452 !! options
21453 showtitle
21454 title=[[Screen]]
21455 !! config
21456 wgAllowDisplayTitle=true
21457 wgRestrictDisplayTitle=true
21458 !! wikitext
21459 this is not the the title
21460 {{DISPLAYTITLE:screen}}
21461 !! html/php
21462 screen
21463 <p>this is not the the title
21464 </p>
21465 !! end
21466
21467 !! test
21468 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
21469 !! options
21470 showtitle
21471 title=[[Screen]]
21472 !! config
21473 wgAllowDisplayTitle=false
21474 !! wikitext
21475 this is not the the title
21476 {{DISPLAYTITLE:screen}}
21477 !! html/php
21478 Screen
21479 <p>this is not the the title
21480 <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>
21481 </p>
21482 !! end
21483
21484 !! test
21485 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
21486 !! options
21487 showtitle
21488 title=[[Screen]]
21489 !! config
21490 wgAllowDisplayTitle=false
21491 !! wikitext
21492 this is not the the title
21493 !! html/php
21494 Screen
21495 <p>this is not the the title
21496 </p>
21497 !! end
21498
21499 !! test
21500 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
21501 !! options
21502 showtitle
21503 title=[[Screen]]
21504 !! config
21505 wgAllowDisplayTitle=true
21506 wgRestrictDisplayTitle=true
21507 !! wikitext
21508 this is not the the title
21509 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21510 !! html/php
21511 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21512 <p>this is not the the title
21513 </p>
21514 !! end
21515
21516 !! test
21517 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
21518 !! options
21519 showtitle
21520 title=[[Screen]]
21521 !! config
21522 wgAllowDisplayTitle=true
21523 wgRestrictDisplayTitle=true
21524 !! wikitext
21525 this is not the the title
21526 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21527 !! html/php
21528 <span style="color: red;">s</span>creen
21529 <p>this is not the the title
21530 </p>
21531 !! end
21532
21533 !! test
21534 Page status indicators: Empty name is invalid
21535 !! options
21536 showindicators
21537 !! wikitext
21538 <indicator name=" "></indicator>
21539 <indicator></indicator>
21540 !! html
21541 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21542 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21543 </p>
21544 !! end
21545
21546 !! test
21547 Page status indicators: Weird syntaxes that are okay
21548 !! options
21549 showindicators
21550 !! wikitext
21551 <indicator name="empty" />
21552 <indicator name="name"></indicator>
21553 !! html
21554 empty=
21555 name=
21556 <p><br />
21557 </p>
21558 !! end
21559
21560 !! test
21561 Page status indicators: Torture test
21562 !! options
21563 showindicators
21564 !! wikitext
21565 <indicator name="01">hello world</indicator>
21566 <indicator name="02">[[Main Page]]</indicator>
21567 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21568 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21569 <indicator name="05">* foo
21570 * bar</indicator>
21571 <indicator name="06"><nowiki>foo</nowiki></indicator>
21572 <indicator name="07"> Preformatted</indicator>
21573 <indicator name="08"><div>Broken tag</indicator>
21574 <indicator name="09">{| class=wikitable
21575 | cell
21576 |}</indicator>
21577 <indicator name="10">Two
21578
21579 paragraphs</indicator>
21580 !! html
21581 01=hello world
21582 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21583 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" />
21584 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>
21585 05=<ul><li> foo</li>
21586 <li> bar</li></ul>
21587
21588 06=foo
21589 07=<pre>Preformatted
21590 </pre>
21591 08=<div>Broken tag</div>
21592
21593 09=<table class="wikitable">
21594 <tr>
21595 <td> cell
21596 </td></tr></table>
21597
21598 10=<p>Two
21599 </p><p>paragraphs
21600 </p>
21601 <p><br />
21602 </p><p><br />
21603 </p><p><br />
21604 </p><p><br />
21605 </p><p><br />
21606 </p>
21607 !! end
21608
21609 !! test
21610 preload: check <noinclude> and <includeonly>
21611 !! options
21612 preload
21613 !! wikitext
21614 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21615 !! html/php
21616 Hello kind world.
21617 !! end
21618
21619 !! test
21620 preload: check <onlyinclude>
21621 !! options
21622 preload
21623 !! wikitext
21624 Goodbye <onlyinclude>Hello world</onlyinclude>
21625 !! html/php
21626 Hello world
21627 !! end
21628
21629 !! test
21630 preload: can pass tags through if we want to
21631 !! options
21632 preload
21633 !! wikitext
21634 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21635 !! html/php
21636 <includeonly>Hello world</includeonly>
21637 !! end
21638
21639 !! test
21640 preload: check that it doesn't try to do tricks
21641 !! options
21642 preload
21643 !! wikitext
21644 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21645 !! html/php
21646 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21647 !! end
21648
21649 !! test
21650 Play a bit with r67090 and bug 3158
21651 !! wikitext
21652 <div style="width:50% !important">&nbsp;</div>
21653 <div style="width:50%&nbsp;!important">&nbsp;</div>
21654 <div style="width:50%&#160;!important">&nbsp;</div>
21655 <div style="border : solid;">&nbsp;</div>
21656 !! html/php
21657 <div style="width:50% !important">&#160;</div>
21658 <div style="width:50% !important">&#160;</div>
21659 <div style="width:50% !important">&#160;</div>
21660 <div style="border&#160;: solid;">&#160;</div>
21661
21662 !! html/parsoid
21663 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21664 <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>
21665 <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>
21666 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21667
21668 !! end
21669
21670 !! test
21671 HTML5 data attributes
21672 !! wikitext
21673 <span data-foo="bar">Baz</span>
21674 <p data-abc-def_hij="">Quuz</p>
21675 !! html/php
21676 <p><span data-foo="bar">Baz</span>
21677 </p>
21678 <p data-abc-def_hij="">Quuz</p>
21679
21680 !! html/parsoid
21681 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21682 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21683 !! end
21684
21685 !! test
21686 Strip reserved data attributes
21687 !! wikitext
21688 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21689 !! html/php
21690 <div data-ok="fred">d</div>
21691
21692 !! html/parsoid
21693 <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>
21694 !! end
21695
21696 !! test
21697 percent-encoding and + signs in internal links (Bug 26410)
21698 !! wikitext
21699 [[User:+%]] [[Page+title%]]
21700 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21701 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21702 [[%33%45]] [[%33%45+]]
21703 !! html/php
21704 <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>
21705 <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>
21706 <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>
21707 <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>
21708 </p>
21709 !! html/parsoid
21710 <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>
21711 <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>
21712 <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>
21713 <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>
21714 !! end
21715
21716 !! test
21717 Special characters in embedded file links (bug 27679)
21718 !! wikitext
21719 [[File:Contains & ampersand.jpg]]
21720 [[File:Does not exist.jpg|Title with & ampersand]]
21721 !! html/php
21722 <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>
21723 <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>
21724 </p>
21725 !! html/parsoid
21726 <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>
21727 <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>
21728 !! end
21729
21730 !! test
21731 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21732 !! wikitext
21733 Text&apos;s been normalized?
21734 !! html
21735 <p>Text&#39;s been normalized?
21736 </p>
21737 !! end
21738
21739 !! test
21740 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21741 !! wikitext
21742 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21743 !! html
21744 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21745 </p>
21746 !! end
21747
21748 !! test
21749 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21750 !! wikitext
21751 [http://www.example.org/ ideograms]
21752 !! html
21753 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21754 </p>
21755 !! end
21756
21757 !! test
21758 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21759 !! wikitext
21760 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21761 !! html
21762 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21763 </p>
21764 !! end
21765
21766 !! article
21767 Mediawiki:loop1
21768 !! text
21769 {{Identical|A}}
21770 !! endarticle
21771
21772 !! article
21773 Mediawiki:loop2
21774 !! text
21775 {{Identical|B}}
21776 !! endarticle
21777
21778 !! article
21779 Template:Identical
21780 !! text
21781 {{int:loop1}}
21782 {{int:loop2}}
21783 !! endarticle
21784
21785 !! test
21786 Bug 31098 Template which includes system messages which includes the template
21787 !! wikitext
21788 {{Identical}}
21789 !! html
21790 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21791 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21792 </p>
21793 !! end
21794
21795 !! test
21796 Bug31490 Turkish: ucfirst 'blah'
21797 !! options
21798 language=tr
21799 !! wikitext
21800 {{ucfirst:blah}}
21801 !! html
21802 <p>Blah
21803 </p>
21804 !! end
21805
21806 !! test
21807 Bug31490 Turkish: ucfirst 'ix'
21808 !! options
21809 language=tr
21810 !! wikitext
21811 {{ucfirst:ix}}
21812 !! html
21813 <p>İx
21814 </p>
21815 !! end
21816
21817 !! test
21818 Bug31490 Turkish: lcfirst 'BLAH'
21819 !! options
21820 language=tr
21821 !! wikitext
21822 {{lcfirst:BLAH}}
21823 !! html
21824 <p>bLAH
21825 </p>
21826 !! end
21827
21828 !! test
21829 Bug31490 Turkish: ucfırst (with a dotless i)
21830 !! options
21831 language=tr
21832 !! wikitext
21833 {{ucfırst:blah}}
21834 !! html
21835 <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>
21836 </p>
21837 !! end
21838
21839 !! test
21840 Bug31490 ucfırst (with a dotless i) with English language
21841 !! options
21842 language=en
21843 !! wikitext
21844 {{ucfırst:blah}}
21845 !! html
21846 <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>
21847 </p>
21848 !! end
21849
21850 !! test
21851 Bug 26375: TOC with italics
21852 !! options
21853 title=[[Main Page]]
21854 !! wikitext
21855 __TOC__
21856 == ''Lost'' episodes ==
21857 !! html
21858 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21859 <ul>
21860 <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>
21861 </ul>
21862 </div>
21863
21864 <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>
21865
21866 !! end
21867
21868 !! test
21869 Bug 26375: TOC with bold
21870 !! options
21871 title=[[Main Page]]
21872 !! wikitext
21873 __TOC__
21874 == '''should be bold''' then normal text ==
21875 !! html
21876 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21877 <ul>
21878 <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>
21879 </ul>
21880 </div>
21881
21882 <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>
21883
21884 !! end
21885
21886 !! test
21887 Bug 33845: Headings become cursive in TOC when they contain an image
21888 !! options
21889 title=[[Main Page]]
21890 !! wikitext
21891 __TOC__
21892 == Image [[Image:foobar.jpg]] ==
21893 !! html
21894 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21895 <ul>
21896 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21897 </ul>
21898 </div>
21899
21900 <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>
21901
21902 !! end
21903
21904 !! test
21905 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21906 !! options
21907 title=[[Main Page]]
21908 !! wikitext
21909 __TOC__
21910 == <blockquote>Quote</blockquote> ==
21911 !! html
21912 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21913 <ul>
21914 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21915 </ul>
21916 </div>
21917
21918 <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>
21919
21920 !! html+tidy
21921 <p></p>
21922 <div id="toc" class="toc">
21923 <div id="toctitle">
21924 <h2>Contents</h2>
21925 </div>
21926 <ul>
21927 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21928 </ul>
21929 </div>
21930 <p></p>
21931 <h2><span class="mw-headline" id="Quote"></span></h2>
21932 <blockquote>
21933 <p><span class="mw-headline" id="Quote">Quote</span></p>
21934 </blockquote>
21935 <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>
21936 !! end
21937
21938 !! test
21939 Unclosed tags in TOC
21940 !! options
21941 title=[[Main Page]]
21942 !! wikitext
21943 __TOC__
21944 == Proof: 2 < 3 ==
21945 <small>Hanc marginis exiguitas non caperet.</small>
21946 QED
21947 !! html
21948 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21949 <ul>
21950 <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>
21951 </ul>
21952 </div>
21953
21954 <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>
21955 <p><small>Hanc marginis exiguitas non caperet.</small>
21956 QED
21957 </p>
21958 !! end
21959
21960 !! test
21961 Multiple tags in TOC
21962 !! wikitext
21963 __TOC__
21964 == <i>Foo</i> <b>Bar</b> ==
21965
21966 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21967 !! html
21968 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21969 <ul>
21970 <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>
21971 <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>
21972 </ul>
21973 </div>
21974
21975 <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>
21976 <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>
21977
21978 !! html+tidy
21979 <p></p>
21980 <div id="toc" class="toc">
21981 <div id="toctitle">
21982 <h2>Contents</h2>
21983 </div>
21984 <ul>
21985 <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>
21986 <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>
21987 </ul>
21988 </div>
21989 <p></p>
21990 <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>
21991 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21992 <blockquote>
21993 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21994 </blockquote>
21995 <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>
21996 !! end
21997
21998 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21999 # html5 tag parsing.
22000 !! test
22001 Tags with parameters in TOC
22002 !! options
22003 parsoid=wt2html
22004 !! wikitext
22005 __TOC__
22006 == <sup class="in-h2">Hello</sup> ==
22007
22008 == <sup class="a > b">Evilbye</sup> ==
22009 !! html/php
22010 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22011 <ul>
22012 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
22013 <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>
22014 </ul>
22015 </div>
22016
22017 <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>
22018 <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>
22019
22020 !! html/parsoid
22021 <meta property="mw:PageProp/toc" />
22022 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
22023
22024 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
22025 !! end
22026
22027 !! test
22028 span tags with directionality in TOC
22029 !! wikitext
22030 __TOC__
22031 == <span dir="ltr">C++</span> ==
22032
22033 == <span dir="rtl">זבנג!</span> ==
22034
22035 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
22036
22037 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
22038
22039 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
22040 !! html
22041 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22042 <ul>
22043 <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>
22044 <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>
22045 <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>
22046 <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>
22047 <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>
22048 </ul>
22049 </div>
22050
22051 <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>
22052 <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>
22053 <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>
22054 <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>
22055 <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>
22056
22057 !! end
22058
22059 !! test
22060 Bug 72884: bdi element in ToC
22061 !! wikitext
22062 __TOC__
22063 == <bdi>test</bdi> ==
22064 !! html
22065 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22066 <ul>
22067 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
22068 </ul>
22069 </div>
22070
22071 <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>
22072
22073 !! end
22074
22075 !! test
22076 T35715: s/strike element in ToC
22077 !! wikitext
22078 __TOC__
22079 == <s>test</s> test <strike>test</strike> ==
22080 !! html
22081 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22082 <ul>
22083 <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>
22084 </ul>
22085 </div>
22086
22087 <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>
22088
22089 !! end
22090
22091 # Note that the html output does not have the <p></p>, but the
22092 # html+tidy output *does*. This is because the empty <p></p> is
22093 # removed by the sanitizer, but only when tidy is *not* enabled (!).
22094 !! test
22095 Empty <p> tag in TOC, removed by Sanitizer (T92892)
22096 !! wikitext
22097 __TOC__
22098 == x ==
22099 !! html
22100 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22101 <ul>
22102 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22103 </ul>
22104 </div>
22105
22106 <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>
22107
22108 !! html+tidy
22109 <p></p>
22110 <div id="toc" class="toc">
22111 <div id="toctitle">
22112 <h2>Contents</h2>
22113 </div>
22114 <ul>
22115 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22116 </ul>
22117 </div>
22118 <p></p>
22119 <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>
22120 !! end
22121
22122 !! article
22123 MediaWiki:Bug32057
22124 !! text
22125 == {{int:headline_sample}} ==
22126 !! endarticle
22127
22128 !! test
22129 Bug 32057: Title needed when expanding <h> nodes.
22130 !! options
22131 title=[[Main Page]]
22132 !! wikitext
22133 {{int:Bug32057}}
22134 !! html
22135 <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>
22136
22137 !! end
22138
22139 !! test
22140 Strip marker in urlencode
22141 !! wikitext
22142 {{urlencode:x<nowiki/>y}}
22143 {{urlencode:x<nowiki/>y|wiki}}
22144 {{urlencode:x<nowiki/>y|path}}
22145 {{urlencode:x<pre id="one">two</pre>y}}
22146 !! html/php
22147 <p>xy
22148 xy
22149 xy
22150 xy
22151 </p>
22152 !! end
22153
22154 !! test
22155 Strip marker in lc
22156 !! wikitext
22157 {{lc:x<nowiki/>y}}
22158 !! html
22159 <p>xy
22160 </p>
22161 !! end
22162
22163 !! test
22164 Strip marker in uc
22165 !! wikitext
22166 {{uc:x<nowiki/>y}}
22167 !! html
22168 <p>XY
22169 </p>
22170 !! end
22171
22172 !! test
22173 Strip marker in formatNum
22174 !! wikitext
22175 {{formatnum:1<nowiki/>2}}
22176 {{formatnum:1<nowiki/>2|R}}
22177 !! html
22178 <p>12
22179 12
22180 </p>
22181 !! end
22182
22183 !! test
22184 Check noCommafy in formatNum
22185 !! options
22186 language=be-tarask
22187 !! wikitext
22188 {{formatnum:123456.78}}
22189 {{formatnum:123456.78|NOSEP}}
22190 !! html
22191 <p>123 456,78
22192 123456.78
22193 </p>
22194 !! end
22195
22196 !! test
22197 Wrong option for formatNum (bug 56199)
22198 !! wikitext
22199 {{formatnum:1,234.56|Random}}
22200 {{formatnum:1,234.56|EVERYTHING}}
22201 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
22202 !! html
22203 <p>1,234.56
22204 1,234.56
22205 1,234.56
22206 </p>
22207 !! end
22208
22209 !! test
22210 Strip marker in grammar
22211 !! options
22212 language=fi
22213 !! wikitext
22214 {{grammar:elative|foo<nowiki/>bar}}
22215 !! html
22216 <p>foobarista
22217 </p>
22218 !! end
22219
22220 !! test
22221 Strip marker in padleft
22222 !! wikitext
22223 {{padleft:|2|x<nowiki/>y}}
22224 !! html
22225 <p>xy
22226 </p>
22227 !! end
22228
22229 !! test
22230 Strip marker in padright
22231 !! wikitext
22232 {{padright:|2|x<nowiki/>y}}
22233 !! html
22234 <p>xy
22235 </p>
22236 !! end
22237
22238 !! test
22239 Strip marker in anchorencode
22240 !! wikitext
22241 {{anchorencode:x<nowiki/>y}}
22242 !! html
22243 <p>xy
22244 </p>
22245 !! end
22246
22247 !! test
22248 nowiki inside link inside heading (bug 18295)
22249 !! wikitext
22250 ==[[foo|x<nowiki>y</nowiki>z]]==
22251 !! html
22252 <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>
22253
22254 !! end
22255
22256 !! test
22257 new support for bdi element (bug 31817)
22258 !! wikitext
22259 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22260 !! html
22261 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22262
22263 !!end
22264
22265 !! test
22266 Ignore pipe between table row attributes
22267 !! wikitext
22268 {|
22269 | quux
22270 |- id=foo | style='color: red'
22271 | bar
22272 |}
22273 !! html
22274 <table>
22275 <tr>
22276 <td> quux
22277 </td></tr>
22278 <tr id="foo" style="color: red">
22279 <td> bar
22280 </td></tr></table>
22281
22282 !! end
22283
22284 !!test
22285 Gallery override link with WikiLink (bug 34852)
22286 !! wikitext
22287 <gallery>
22288 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
22289 </gallery>
22290 !! html
22291 <ul class="gallery mw-gallery-traditional">
22292 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22293 <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>
22294 <div class="gallerytext">
22295 <p>caption
22296 </p>
22297 </div>
22298 </div></li>
22299 </ul>
22300
22301 !! end
22302
22303 !!test
22304 Gallery override link with absolute external link (bug 34852)
22305 !! wikitext
22306 <gallery>
22307 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
22308 </gallery>
22309 !! html
22310 <ul class="gallery mw-gallery-traditional">
22311 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22312 <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>
22313 <div class="gallerytext">
22314 <p>caption
22315 </p>
22316 </div>
22317 </div></li>
22318 </ul>
22319
22320 !! end
22321
22322 !! test
22323 Gallery override link with absolute external link with LanguageConverter
22324 !! options
22325 language=zh
22326 !! input
22327 <gallery>
22328 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
22329 </gallery>
22330 !! result
22331 <ul class="gallery mw-gallery-traditional">
22332 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22333 <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>
22334 <div class="gallerytext">
22335 <p>caption
22336 </p>
22337 </div>
22338 </div></li>
22339 </ul>
22340
22341 !! end
22342
22343 !!test
22344 Gallery override link with malicious javascript (bug 34852)
22345 !! wikitext
22346 <gallery>
22347 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
22348 </gallery>
22349 !! html
22350 <ul class="gallery mw-gallery-traditional">
22351 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22352 <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>
22353 <div class="gallerytext">
22354 <p>caption
22355 </p>
22356 </div>
22357 </div></li>
22358 </ul>
22359
22360 !! end
22361
22362 !!test
22363 Gallery with invalid title as link (bug 43964)
22364 !! wikitext
22365 <gallery>
22366 File:foobar.jpg|link=<
22367 </gallery>
22368 !! html
22369 <ul class="gallery mw-gallery-traditional">
22370 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22371 <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>
22372 <div class="gallerytext">
22373 </div>
22374 </div></li>
22375 </ul>
22376
22377 !! end
22378
22379 !!test
22380 Language parser function
22381 !! wikitext
22382 {{#language:ar}}
22383 !! html
22384 <p>العربية
22385 </p>
22386 !! end
22387
22388 !!test
22389 Padleft and padright as substr
22390 !! wikitext
22391 {{padleft:|3|abcde}}
22392 {{padright:|3|abcde}}
22393 !! html
22394 <p>abc
22395 abc
22396 </p>
22397 !! end
22398
22399 !!test
22400 Special parser function
22401 !! wikitext
22402 {{#special:RandomPage}}
22403 {{#special:BaDtItLe}}
22404 {{#special:Foobar}}
22405 !! html
22406 <p>Special:Random
22407 Special:Badtitle
22408 Special:Foobar
22409 </p>
22410 !! end
22411
22412 !!test
22413 Bug 34939 - Case insensitive link parsing ([HttP://])
22414 !! wikitext
22415 [HttP://MediaWiki.Org/]
22416 !! html/php
22417 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
22418 </p>
22419 !! html/parsoid
22420 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
22421 !! end
22422
22423 !!test
22424 Bug 34939 - Case insensitive link parsing ([HttP:// title])
22425 !! wikitext
22426 [HttP://MediaWiki.Org/ MediaWiki]
22427 !! html
22428 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22429 </p>
22430 !! end
22431
22432 !!test
22433 Bug 34939 - Case insensitive link parsing (HttP://)
22434 !! wikitext
22435 HttP://MediaWiki.Org/
22436 !! html/php
22437 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22438 </p>
22439 !! html/parsoid
22440 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22441 !! end
22442
22443 !!test
22444 Disable TOC
22445 !! options
22446 notoc
22447 !! wikitext
22448 Lead
22449 == Section 1 ==
22450 == Section 2 ==
22451 == Section 3 ==
22452 == Section 4 ==
22453 == Section 5 ==
22454 !! html
22455 <p>Lead
22456 </p>
22457
22458 <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>
22459 <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>
22460 <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>
22461 <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>
22462 <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>
22463
22464 !! end
22465
22466
22467 ###
22468 ### Parsoid-specific tests
22469 ### Parsoid-PHP parser incompatibilities
22470 ###
22471 !!test
22472 1. SOL-sensitive wikitext tokens as template-args
22473 !!options
22474 parsoid=wt2html,wt2wt
22475 !! wikitext
22476 {{echo|*a}}
22477 {{echo|#a}}
22478 {{echo|:a}}
22479 !! html
22480 <span about="#mwt1" typeof="mw:Transclusion">
22481 </span><ul about="#mwt1"><li>a</li>
22482 </ul>
22483 <span about="#mwt2" typeof="mw:Transclusion">
22484 </span><ol about="#mwt2"><li>a</li>
22485 </ol>
22486 <span about="#mwt3" typeof="mw:Transclusion">
22487 </span><dl about="#mwt3"><dd>a</dd>
22488 </dl>
22489 !!end
22490
22491 #### -----------------------------------------------------------------
22492 #### Parsoid-specific functionality tests
22493 #### -----------------------------------------------------------------
22494
22495 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
22496 # We know wt2wt will fail, but we expect selser to pass.
22497 # Due to the nature of our testing, wt2wt and selser tests will enter the
22498 # blacklist and we'll catch selser regressions based on changes to the
22499 # blacklist entries for selser tests.
22500 !! test
22501 1. Bad treebuilder fixup of formatting elt is cleaned up
22502 !! options
22503 parsoid=wt2html,wt2wt
22504 !! wikitext
22505 {|
22506 |
22507 <small>
22508 [[Image:Foobar.jpg|right|Test]]
22509 </small>
22510 |}
22511 !! html/parsoid
22512 <table>
22513 <tbody><tr><td>
22514 <small>
22515 <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>
22516 </small>
22517 </td></tr>
22518 </tbody></table>
22519 !! end
22520
22521 !! test
22522 2. Bad treebuilder fixup of formatting elt is cleaned up
22523 !! options
22524 parsoid=wt2html,wt2wt
22525 !! wikitext
22526 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22527
22528 <small>[[Image:Foobar.jpg|right|300px]]</small>
22529 !! html/parsoid
22530
22531 <p><b>foo</b></p>
22532 <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>
22533 <p><b>bar</b></p>
22534 <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>
22535 !! end
22536
22537 !! test
22538 3. Bad treebuilder fixup of formatting elt is cleaned up
22539 !! options
22540 parsoid=wt2html,wt2wt
22541 !! wikitext
22542 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22543 !! html/parsoid
22544 <p><small><b>foo</b></small></p>
22545 <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>
22546 <p><small><b>bar</b></small></p>
22547 !! end
22548
22549 !! test
22550 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22551 !! options
22552 parsoid=wt2html,wt2wt
22553 !! wikitext
22554 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22555 !! html/parsoid
22556 <p><b><small></small></b></p>
22557 <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>
22558 <p></p>
22559 !! end
22560
22561 #### ----------------------------------------------------------------
22562 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22563 #### tags. Parsoid's output for these tags differs from that of the
22564 #### PHP parser.
22565 #### ----------------------------------------------------------------
22566
22567 !!test
22568 Ref: 1. ref-location should be replaced with an index span
22569 !! wikitext
22570 A <ref>foo</ref>
22571 B <ref name="x">foo</ref>
22572 C <ref name="y" />
22573 <references />
22574 !! html/parsoid
22575 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
22576 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="#cite_note-x-2"><span class="mw-reflink-text">[2]</span></a></span>
22577 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="#cite_note-y-3"><span class="mw-reflink-text">[3]</span></a></span></p>
22578 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22579 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
22580 <li about="#cite_note-x-2" id="cite_note-x-2"><a href="#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>
22581 <li about="#cite_note-y-3" id="cite_note-y-3"><a href="#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>
22582 </ol>
22583 !!end
22584
22585 !!test
22586 Ref: 2. ref-tags with identical names should all get the same index
22587 !! wikitext
22588 A <ref name="x">foo</ref>
22589 B <ref name="x" />
22590 <references />
22591 !! html/parsoid
22592 <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="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
22593 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="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22594 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22595 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="#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>
22596 </ol>
22597 !!end
22598
22599 !!test
22600 Ref: 3. spaces in ref-names should be ignored
22601 !! wikitext
22602 A <ref name="x">foo</ref>
22603 B <ref name=" x " />
22604 C <ref name= x />
22605 <references />
22606 !! html/parsoid
22607 <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="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
22608 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="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
22609 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="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22610 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22611 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a><a href="#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>
22612 </ol>
22613 !!end
22614
22615 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22616 !!test
22617 Ref: 4. 'constructor' should be accepted as a valid ref-name
22618 !! wikitext
22619 A <ref name="constructor">foo</ref>
22620 <references />
22621 !! html/parsoid
22622 <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="#cite_note-constructor-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22623 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22624 <li about="#cite_note-constructor-1" id="cite_note-constructor-1"><a href="#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>
22625 </ol>
22626 !!end
22627
22628 !!test
22629 Ref: 5. body should accept generic wikitext
22630 !! wikitext
22631 A <ref>
22632 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22633 </ref>
22634
22635 <references />
22636 !! html/parsoid
22637 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22638
22639 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22640 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
22641 </span></li>
22642 </ol>
22643 !!end
22644
22645 !!test
22646 Ref: 6. indent-pres should not be output in ref-body
22647 !! wikitext
22648 A <ref>
22649 foo
22650 bar
22651 baz
22652 </ref>
22653
22654 <references />
22655 !! html/parsoid
22656 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22657
22658 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22659 <li about="#cite_note-1" id="cite_note-1"><a href="#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
22660 bar
22661 baz
22662 </span></li>
22663 </ol>
22664 !!end
22665
22666 !!test
22667 Ref: 7. No p-wrapping in ref-body
22668 !! wikitext
22669 A <ref>
22670 foo
22671
22672 bar
22673
22674
22675 baz
22676
22677
22678
22679 booz
22680 </ref>
22681
22682 <references />
22683 !! html/parsoid
22684 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22685
22686 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22687 <li about="#cite_note-1" id="cite_note-1"><a href="#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
22688
22689 bar
22690
22691
22692 baz
22693
22694
22695
22696 booz
22697 </span></li>
22698 </ol>
22699 !!end
22700
22701 !!test
22702 Ref: 8. transclusion wikitext has lower precedence
22703 !! wikitext
22704 A <ref> foo {{echo|</ref> B C}}
22705
22706 <references />
22707 !! html/parsoid
22708 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C}}</p>
22709 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22710 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
22711 </ol>
22712 !!end
22713
22714 !!test
22715 Ref: 9. unclosed comments should not leak out of ref-body
22716 !! wikitext
22717 A <ref> foo <!--</ref> B C
22718 <references />
22719 !! html/parsoid
22720 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
22721 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22722 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
22723 </ol>
22724 !!end
22725
22726 !!test
22727 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22728 !! wikitext
22729 A <ref> <b> foo </ref> B C
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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
22734
22735
22736 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22737 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
22738 </ol>
22739 !!end
22740
22741 !!test
22742 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22743 !! wikitext
22744 A <ref>foo</ref> B
22745 C <ref>bar</ref> D
22746 <references />
22747 !! html/parsoid
22748 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B
22749 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="#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> D</p>
22750 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22751 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
22752 <li about="#cite_note-2" id="cite_note-2"><a href="#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>
22753 </ol>
22754 !!end
22755
22756 !!test
22757 Ref: 12. ref-tags act as trailing newline migration barrier
22758 !! wikitext
22759 <!--the newline at the end of this line moves out of the p tag-->a
22760
22761 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22762 <ref />
22763
22764 c
22765 <references />
22766 !! html/parsoid
22767 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22768
22769
22770 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
22771 <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span></p>
22772
22773 <p>c</p>
22774 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22775 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
22776 <li about="#cite_note-2" id="cite_note-2"><a href="#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>
22777 !!end
22778
22779 !!test
22780 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22781 !! wikitext
22782 <ref>foo</ref> A
22783 <ref>bar
22784 </ref> B
22785 <references />
22786 !! html/parsoid
22787 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> A
22788 <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="#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> B</p>
22789 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22790 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
22791 <li about="#cite_note-2" id="cite_note-2"><a href="#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
22792 </span></li>
22793 </ol>
22794 !!end
22795
22796 ## Roundtripping fails because of nowiki'ing
22797 !! test
22798 Ref: 14. A nested ref-tag should be emitted as plain text
22799 !! options
22800 parsoid=wt2html
22801 !! wikitext
22802 <ref>foo <ref>bar</ref> baz</ref>
22803
22804 <references />
22805 !! html/parsoid
22806 <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="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span> baz&lt;/ref></p>
22807
22808 <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="#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>
22809 !! end
22810
22811 !!test
22812 Ref: 15. ref-tags with identical names should get identical indexes
22813 !! wikitext
22814 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22815 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22816
22817 <references />
22818 !! html/parsoid
22819 <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="#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="#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
22820 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="#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="#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
22821
22822 <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="#cite_ref-a_1-0"><span class="mw-linkback-text">1 </span></a><a href="#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="#cite_ref-b_2-0"><span class="mw-linkback-text">1 </span></a><a href="#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>
22823 </ol>
22824 !!end
22825
22826 ## We don't bother wt2wt-ing non-standard whitespace
22827 !!test
22828 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22829 !!options
22830 parsoid=wt2html
22831 !! wikitext
22832 A <ref >foo</ref >
22833
22834 <references />
22835 !! html/parsoid
22836 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22837 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22838 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
22839 !!end
22840
22841 !!test
22842 Ref: 17. Generate valid HTML5 id/about attributes
22843 !!wikitext
22844 <ref name="a b">foo</ref>
22845
22846 <references />
22847 !!html/parsoid
22848 <p><span 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="#cite_note-a_b-1"><span class="mw-reflink-text">[1]</span></a></span>
22849 </p>
22850
22851 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22852 <li about="#cite_note-a_b-1" id="cite_note-a_b-1"><a href="#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>
22853 </ol>
22854 !!end
22855
22856 !!test
22857 Ref: 18. T58916: Extension attributes should be parsed as plain text
22858 !!wikitext
22859 <ref name="{{echo|a}}">foo</ref>
22860
22861 <references />
22862 !!html/parsoid
22863 <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="#cite_note-.7B.7Becho.7Ca.7D.7D-1"><span class="mw-reflink-text">[1]</span></a></span>
22864 </p>
22865
22866 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22867 <li about="#cite_note-.7B.7Becho.7Ca.7D.7D-1" id="cite_note-.7B.7Becho.7Ca.7D.7D-1"><a href="#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>
22868 </ol>
22869 !!end
22870
22871 !!test
22872 Ref: 19. ref-tags with identical name encodings should get identical indexes
22873 !! wikitext
22874 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22875
22876 <references />
22877 !! html/parsoid
22878 <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="#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="#cite_note-a_.26_b-1"><span class="mw-reflink-text">[1]</span></a></span>
22879 </p>
22880 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22881 <li about="#cite_note-a_.26_b-1" id="cite_note-a_.26_b-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_.26_b_1-0"><span class="mw-linkback-text">1 </span></a><a href="#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>
22882 </ol>
22883 !!end
22884
22885 !!test
22886 Ref: 20. ref-tags with identical names but different content should keep it
22887 !! wikitext
22888 A <ref name="foo">Foo one</ref>
22889 B <ref name="foo">Foo two</ref>
22890 C <ref name="foo" />
22891
22892 <references />
22893 !! html/parsoid
22894 <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="#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
22895 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="#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
22896 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="#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22897
22898 <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="#cite_ref-foo_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-foo_1-1"><span class="mw-linkback-text">2 </span></a><a href="#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>
22899 </ol>
22900 !!end
22901
22902 !!test
22903 References: 1. references tag without any refs should be handled properly
22904 !! wikitext
22905 <references />
22906 !! html/parsoid
22907 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22908 !!end
22909
22910 !!test
22911 References: 2. references tag with group only outputs references from that group
22912 !! wikitext
22913 A <ref group="a">foo</ref>
22914 B <ref group="b">bar</ref>
22915 C <ref>baz</ref>
22916
22917 <references group="a" />
22918 <references />
22919 <references group="b" />
22920 !! html/parsoid
22921 <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="#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
22922 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="#cite_note-2" data-mw-group="b"><span class="mw-reflink-text">[b 1]</span></a></span>
22923 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="#cite_note-3"><span class="mw-reflink-text">[1]</span></a></span></p>
22924
22925 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22926 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
22927 </ol>
22928 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22929 <li about="#cite_note-3" id="cite_note-3"><a href="#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>
22930 </ol>
22931 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22932 <li about="#cite_note-2" id="cite_note-2"><a href="#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>
22933 </ol>
22934 !!end
22935
22936 !!test
22937 References: 3. ref list should be cleared after processing references
22938 !! wikitext
22939 A <ref>foo</ref>
22940
22941 <references />
22942
22943 B <ref>bar</ref>
22944
22945 <references />
22946 !! html/parsoid
22947 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22948
22949 <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="#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>
22950 </ol>
22951
22952 <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="#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
22953
22954 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22955 <li about="#cite_note-2" id="cite_note-2"><a href="#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>
22956 </ol>
22957 !!end
22958
22959 !!test
22960 References: 4. only referenced group should be cleared after processing references
22961 !! wikitext
22962 A <ref group="a">afoo</ref>
22963 B <ref>bfoo</ref>
22964
22965 <references group="a" />
22966
22967 C <ref>cfoo</ref>
22968
22969 <references />
22970 !! html/parsoid
22971 <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="#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
22972 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="#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
22973
22974 <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="#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>
22975 </ol>
22976
22977 <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="#cite_note-3"><span class="mw-reflink-text">[2]</span></a></span></p>
22978
22979 <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="#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="#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>
22980 </ol>
22981 !!end
22982
22983 ## Don't expect this to rt since we're dropping content
22984 !! test
22985 References: 5. ref tags in references should be processed while ignoring all other content
22986 !! options
22987 parsoid=wt2html,html2html
22988 !! wikitext
22989 A <ref name="a" />
22990 B <ref name="b">bar</ref>
22991
22992 <references>
22993 <ref name="a">foo</ref>
22994 This should just get lost.
22995 </references>
22996 !! html/parsoid
22997 <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="#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
22998 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="#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
22999
23000
23001 <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=\"#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="#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="#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>
23002 </ol>
23003 !! end
23004
23005 !! test
23006 References: 6. <references /> from a transclusion
23007 !! wikitext
23008 <ref>Foo</ref> {{echo|<references />}}
23009 !! html/parsoid
23010 <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="#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="#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>
23011 </ol>
23012 !! end
23013
23014 !! test
23015 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
23016 !! wikitext
23017 A <ref>foo bar for a</ref>
23018 B <ref group="X" name="b" />
23019
23020 <references />
23021
23022 <references group="X">
23023 <ref name="b">foo</ref>
23024 </references>
23025 !! html/parsoid
23026 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
23027 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="#cite_note-b-2" data-mw-group="X"><span class="mw-reflink-text">[X 1]</span></a></span>
23028 </p>
23029
23030 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
23031 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
23032 </ol>
23033
23034 <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=\"#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"}}'>
23035 <li about="#cite_note-b-2" id="cite_note-b-2"><a href="#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>
23036 </ol>
23037 !! end
23038
23039 !! test
23040 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
23041 !! wikitext
23042 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
23043 <references />
23044 !! html/parsoid
23045 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
23046 <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="#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>
23047 </ol>
23048 !!end
23049
23050 # This test only works in wt2html now as the <references /> are always generated
23051 # unless selser is active. Once T72722 is fixed, we should add a changes test
23052 # here to ensure that unrelated changes don't add the new <references />
23053 # when selser is active.
23054 !! test
23055 References: 9. Generate missing references list at the end
23056 !! wikitext
23057 A <ref>foo</ref>
23058 B <ref group="inexistent">bar</ref>
23059 !! html/parsoid
23060 <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="#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="#cite_note-2" data-mw-group="inexistent"><span class="mw-reflink-text">[inexistent 1]</span></a></span></p>
23061 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
23062 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
23063 </ol>
23064 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
23065 <li about="#cite_note-2" id="cite_note-2"><a href="#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>
23066 </ol>
23067 !! end
23068
23069 !! test
23070 References: 10. New <references/> shouldn't be added for unrelated edits.
23071 !! options
23072 parsoid={
23073 "modes": ["selser"],
23074 "changes": [["#x", "remove"]],
23075 "selser": "noauto"
23076 }
23077 !! wikitext
23078 Unrelated text<span id="x"> that's going to disappear</span>.
23079 A <ref>foo</ref>
23080 !! wikitext/edited
23081 Unrelated text.
23082 A <ref>foo</ref>
23083 !!end
23084
23085 !! test
23086 Entities in ref name
23087 !! wikitext
23088 <ref name="test &amp; me">hi</ref>
23089 <references />
23090 !! html/parsoid
23091 <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="#cite_note-test_.26_me-1"><span class="mw-reflink-text">[1]</span></a></span></p>
23092 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23093 <li about="#cite_note-test_.26_me-1" id="cite_note-test_.26_me-1"><a href="#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>
23094 </ol>
23095 !! end
23096
23097 ## The output here may look funny, but it's what the php parser will do. The
23098 ## unclosed references tag becomes escaped text, and then a new references
23099 ## tag is auto-generated. The test is wt2html only because it roundtrips with
23100 ## nowiki tags, and the auto-generated references tag is only dropped in
23101 ## rtTestMode.
23102 !! test
23103 Generate references for unclosed references tag
23104 !! options
23105 parsoid=wt2html
23106 !! wikitext
23107 a<ref>foo</ref>
23108
23109 <references>
23110 !! html/parsoid
23111 <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="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
23112
23113 <p>&lt;references></p>
23114 <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="#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>
23115 !! end
23116
23117 !! test
23118 New reference serializes on its own line
23119 !! options
23120 parsoid=wt2wt,html2wt
23121 !! wikitext
23122 foo
23123 <references />
23124 !! html/parsoid
23125 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
23126 !! end
23127
23128 #--------- Test stripping of empty nodes in template content ----------
23129 !!test
23130 Empty LI and TR nodes should be stripped from template content
23131 !!wikitext
23132 {{EmptyLITest}}
23133 {{EmptyTRTest}}
23134 !!html/parsoid
23135 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
23136 <li>a</li>
23137 <li>b</li>
23138 </ul>
23139 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
23140 <tbody>
23141 <tr>
23142 <td>foo</td>
23143 </tr>
23144 <tr>
23145 <td>bar</td>
23146 </tr>
23147 </tbody>
23148 </table>
23149 !!end
23150
23151 !!test
23152 Empty LI and TR nodes should not be stripped from top-level content
23153 !!wikitext
23154 * a
23155 *
23156 * b
23157 {|
23158 |-
23159 |-
23160 |foo
23161 |}
23162 !!html/parsoid
23163 <ul>
23164 <li> a</li>
23165 <li></li>
23166 <li> b</li>
23167 </ul>
23168 <table>
23169 <tbody>
23170 <tr></tr>
23171 <tr>
23172 <td>foo</td>
23173 </tr>
23174 </tbody>
23175 </table>
23176 !!end
23177
23178 !!test
23179 Empty TR nodes should not be stripped if they have any attributes set
23180 !!wikitext
23181 {{EmptyTRWithHTMLAttrTest}}
23182 !!html/parsoid
23183 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
23184 <tr align="center"></tr>
23185 <tr><td>foo</td></tr>
23186 <tr align="center"></tr>
23187 <tr><td>bar</td></tr>
23188 </table>
23189 !!end
23190
23191 #### ----------------------------------------------------------------
23192 #### The following section of tests are primarily to test
23193 #### wikitext escaping capabilities of Parsoid. Given that
23194 #### escaping can be done any number of ways, the wikitext (input)
23195 #### is always adjusted to reflect how Parsoid adds nowiki
23196 #### escape tags.
23197 ####
23198 #### We are marking several tests as parsoid-only since the
23199 #### HTML in the result section is different from what the
23200 #### PHP parser generates for it.
23201 #### ----------------------------------------------------------------
23202
23203
23204 #### --------------- Headings ---------------
23205 #### 0. Unnested
23206 #### 1. Nested inside html <h1>=foo=</h1>
23207 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
23208 #### 3. Nested inside html with wikitext split by html tags
23209 #### 4. No escape needed
23210 #### 5. Empty headings <h1></h1>
23211 #### 6. Heading chars in SOL context
23212 #### ----------------------------------------
23213 !! test
23214 Headings: 0. Unnested
23215 !! options
23216 parsoid=html2wt
23217 !! html/parsoid
23218 <p>=foo=</p>
23219
23220 <p> =foo=
23221 <!--cmt-->
23222 =foo=</p>
23223
23224 <p>=foo<i>a</i>=</p>
23225 !! wikitext
23226 <nowiki>=foo=</nowiki>
23227
23228 <nowiki> </nowiki>=foo=
23229 <!--cmt-->
23230 <nowiki>=foo=</nowiki>
23231
23232 =foo''a''<nowiki>=</nowiki>
23233 !!end
23234
23235 # New headings and existing headings are handled differently
23236 !! test
23237 Headings: 1. Nested inside html
23238 !! options
23239 parsoid=html2wt
23240 !! html/parsoid
23241 <h1>=foo=</h1>
23242 <h2>=foo=</h2>
23243 <h3>=foo=</h3>
23244
23245 <h1 data-parsoid=''>=foo=</h1>
23246 <h2 data-parsoid=''>=foo=</h2>
23247 <h3 data-parsoid=''>=foo=</h3>
23248 <h4 data-parsoid=''>=foo=</h4>
23249 <h5 data-parsoid=''>=foo=</h5>
23250 <h6 data-parsoid=''>=foo=</h6>
23251 !! wikitext
23252 = =foo= =
23253
23254 == =foo= ==
23255
23256 === =foo= ===
23257
23258 =<nowiki>=foo=</nowiki>=
23259 ==<nowiki>=foo=</nowiki>==
23260 ===<nowiki>=foo=</nowiki>===
23261 ====<nowiki>=foo=</nowiki>====
23262 =====<nowiki>=foo=</nowiki>=====
23263 ======<nowiki>=foo=</nowiki>======
23264
23265 !!end
23266
23267 !! test
23268 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
23269 !! options
23270 parsoid=html2wt
23271 !! html/parsoid
23272 <h1>foo</h1>*bar
23273 <h1>foo</h1>=bar
23274 <h1>foo</h1>=bar=
23275 !! wikitext
23276 = foo =
23277 <nowiki>*</nowiki>bar
23278
23279 = foo =
23280 =bar
23281
23282 = foo =
23283 <nowiki>=bar=</nowiki>
23284 !!end
23285
23286 !! test
23287 Headings: 3. Nested inside html with wikitext split by html tags
23288 !! options
23289 parsoid=html2wt
23290 !! html/parsoid
23291 <h1>=<b>bold</b>foo=</h1>
23292 !! wikitext
23293 = ='''bold'''foo= =
23294 !!end
23295
23296 !! test
23297 Headings: 4a. No escaping needed (testing just h1 and h2)
23298 !! options
23299 parsoid=html2wt
23300 !! html/parsoid
23301 <h1>=foo</h1>
23302 <h1>foo=</h1>
23303 <h1> =foo= </h1>
23304 <h1>=foo= bar</h1>
23305 <h2>=foo</h2>
23306 <h2>foo=</h2>
23307 <h1>=</h1>
23308 <h1><i>=</i>foo=</h1>
23309 !! wikitext
23310 = =foo =
23311
23312 = foo= =
23313
23314 = =foo= =
23315
23316 = =foo= bar =
23317
23318 == =foo ==
23319
23320 == foo= ==
23321
23322 = = =
23323
23324 = ''=''foo= =
23325 !!end
23326
23327 !! test
23328 Headings: 4b. No escaping needed (inside p-tags)
23329 !! options
23330 parsoid=html2wt
23331 !! html/parsoid
23332 <p>===
23333 =foo= x
23334 =foo= <s></s>
23335 </p>
23336 !! wikitext
23337 ===
23338 =foo= x
23339 =foo= <s></s>
23340 !!end
23341
23342 !! test
23343 Headings: 5. Empty headings
23344 !! options
23345 parsoid=html2wt
23346 !! html/parsoid
23347 <h1 data-parsoid='{}'></h1>
23348
23349 <h2 data-parsoid='{}'></h2>
23350
23351 <h3 data-parsoid='{}'></h3>
23352
23353 <h4 data-parsoid='{}'></h4>
23354
23355 <h5 data-parsoid='{}'></h5>
23356
23357 <h6 data-parsoid='{}'></h6>
23358 !! wikitext
23359 =<nowiki/>=
23360
23361 ==<nowiki/>==
23362
23363 ===<nowiki/>===
23364
23365 ====<nowiki/>====
23366
23367 =====<nowiki/>=====
23368
23369 ======<nowiki/>======
23370 !!end
23371
23372 !! test
23373 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23374 !! options
23375 parsoid=html2wt
23376 !! html/parsoid
23377 <p>=a=</p>
23378
23379 <p>=a=</p>
23380
23381 <p>=a=</p>
23382 !! wikitext
23383 <nowiki>=a=</nowiki>
23384
23385 <nowiki>=a=</nowiki>
23386
23387 <nowiki>=a=</nowiki>
23388 !!end
23389
23390 !! test
23391 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23392 !! options
23393 parsoid=html2wt
23394 !! html/parsoid
23395 <p>=a=
23396 b</p>
23397
23398 <p>=a=
23399 b</p>
23400
23401 <p>=a=
23402 b</p>
23403 !! wikitext
23404 <nowiki>=a=</nowiki>
23405 b
23406
23407 <nowiki>=a=</nowiki>
23408 b
23409
23410 <nowiki>=a=</nowiki>
23411 b
23412 !!end
23413
23414 !! test
23415 Headings: 6c. Heading chars in SOL context (leading newline break)
23416 !! options
23417 parsoid=html2wt
23418 !! html/parsoid
23419 <p>a
23420 =b=</p>
23421 !! wikitext
23422 a
23423 <nowiki>=b=</nowiki>
23424 !!end
23425
23426 !! test
23427 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23428 !! options
23429 parsoid=html2wt
23430 !! html/parsoid
23431 <!--c0--><p>=a=</p>
23432
23433 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23434 !! wikitext
23435 <!--c0--><nowiki>=a=</nowiki>
23436
23437 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23438 !!end
23439
23440 !! test
23441 Headings: 6d. Heading chars in SOL context (No escaping needed)
23442 !! options
23443 parsoid=html2wt
23444 !! html/parsoid
23445 =a=<div>b</div>
23446 !! wikitext
23447 =a=<div>b</div>
23448 !!end
23449
23450 !! test
23451 Headings: 7. Insert a newline between new content and headings
23452 !! options
23453 parsoid=html2wt
23454 !! html/parsoid
23455 <h2>NEW</h2>
23456 <p>new</p>
23457 <h2 data-parsoid='{}'>A</h2>
23458 <p data-parsoid='{}'>a</p>
23459 !! wikitext
23460 == NEW ==
23461 new
23462
23463 ==A==
23464 a
23465
23466 !! end
23467
23468 #### --------------- Lists ---------------
23469 #### 0. Outside nests (*foo, etc.)
23470 #### 1. Nested inside html <ul><li>*foo</li></ul>
23471 #### 2. Inside definition lists
23472 #### 3. Only bullets at start should be escaped
23473 #### 4. No escapes needed
23474 #### 5. No unnecessary escapes
23475 #### 6. Escape bullets in SOL position
23476 #### 7. Escape bullets in a multi-line context
23477 #### ----------------------------------------
23478
23479 !! test
23480 Lists: 0. Outside nests
23481 !! options
23482 parsoid=html2wt
23483 !! html/parsoid
23484 <p>*foo</p>
23485
23486 <p>#foo</p>
23487
23488 <p>;Foo:bar</p>
23489 !! wikitext
23490 <nowiki>*</nowiki>foo
23491
23492 <nowiki>#</nowiki>foo
23493
23494 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23495 !!end
23496
23497 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23498 ## to test wikitext escaping, and insignificant whitespace diffs
23499 ## cause PHP parser tests to barf
23500 !! test
23501 Lists: 1. Nested inside html (No unnecessary escapes)
23502 !! options
23503 parsoid=html2wt
23504 !! html/parsoid
23505 <ul>
23506 <li>*foo</li>
23507 <li>#foo</li>
23508 <li>:foo</li>
23509 <li>;foo</li>
23510 <li data-parsoid='{}'>*foo</li>
23511 <li data-parsoid='{}'>#foo</li>
23512 <li data-parsoid='{}'>:foo</li>
23513 <li data-parsoid='{}'>;foo</li>
23514 </ul>
23515
23516 <ol>
23517 <li>*foo</li>
23518 <li>#foo</li>
23519 <li>:foo</li>
23520 <li>;foo</li>
23521 <li data-parsoid='{}'>*foo</li>
23522 <li data-parsoid='{}'>#foo</li>
23523 <li data-parsoid='{}'>:foo</li>
23524 <li data-parsoid='{}'>;foo</li>
23525 </ol>
23526 !! wikitext
23527 * *foo
23528 * #foo
23529 * :foo
23530 * ;foo
23531 *<nowiki>*foo</nowiki>
23532 *<nowiki>#foo</nowiki>
23533 *<nowiki>:foo</nowiki>
23534 *<nowiki>;foo</nowiki>
23535
23536 # *foo
23537 # #foo
23538 # :foo
23539 # ;foo
23540 #<nowiki>*foo</nowiki>
23541 #<nowiki>#foo</nowiki>
23542 #<nowiki>:foo</nowiki>
23543 #<nowiki>;foo</nowiki>
23544 !!end
23545
23546 !! test
23547 Lists: 2. Inside definition lists
23548 !! options
23549 parsoid=html2wt
23550 !! html/parsoid
23551 <dl><dt>;foo</dt></dl>
23552 <dl><dt>:foo</dt></dl>
23553 <dl><dt>:foo</dt>
23554 <dd>bar</dd></dl>
23555 <dl><dd>:foo</dd></dl>
23556 !! wikitext
23557 ; ;foo
23558
23559 ; <nowiki>:foo</nowiki>
23560
23561 ; <nowiki>:foo</nowiki>
23562 : bar
23563
23564 : :foo
23565 !!end
23566
23567 !! test
23568 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23569 !! options
23570 parsoid=html2wt
23571 !! html/parsoid
23572 <ul>
23573 <li>*foo*bar</li>
23574 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23575 </ul>
23576 !! wikitext
23577 * *foo*bar
23578 *<nowiki>*foo</nowiki>''it''*bar
23579 !!end
23580
23581 !! test
23582 Lists: 4. No escapes needed
23583 !! options
23584 parsoid=html2wt
23585 !! html/parsoid
23586 <ul>
23587 <li>foo*bar
23588 </li>
23589 </ul>
23590 <ul>
23591 <li><i>foo</i>*bar
23592 </li>
23593 </ul>
23594 <ul>
23595 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23596 </li>
23597 </ul>
23598 <ul>
23599 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23600 </li>
23601 </ul>
23602 !! wikitext
23603 *foo*bar
23604
23605 *''foo''*bar
23606
23607 *[[Foo]]: bar
23608
23609 *[[Foo]]*bar
23610 !!end
23611
23612 !! test
23613 Lists: 5. No unnecessary escapes
23614 !! options
23615 parsoid=html2wt
23616 !! html/parsoid
23617 <ul><li> bar <span>[[foo]]</span></li></ul>
23618 <ul><li> =bar <span>[[foo]]</span></li></ul>
23619 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23620 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23621 <ul><li> =bar <span>foo]]</span>=</li></ul>
23622 <ul><li> <s></s>: a</li></ul>
23623 <ul><li> <i>* foo</i></li></ul>
23624
23625 !! wikitext
23626 * bar <span><nowiki>[[foo]]</nowiki></span>
23627
23628 * =bar <span><nowiki>[[foo]]</nowiki></span>
23629
23630 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23631
23632 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23633
23634 * =bar <span>foo]]</span>=
23635
23636 * <s></s>: a
23637
23638 * ''* foo''
23639 !!end
23640
23641 !! test
23642 Lists: 6. Escape bullets in SOL position
23643 !! options
23644 parsoid=html2wt
23645 !! html/parsoid
23646 <p><!--cmt-->*foo</p>
23647 !! wikitext
23648 <!--cmt--><nowiki>*</nowiki>foo
23649 !!end
23650
23651 !! test
23652 Lists: 7. Escape bullets in a multi-line context
23653 !! options
23654 parsoid=html2wt
23655 !! html/parsoid
23656 <p>a
23657 *b
23658 </p>
23659 !! wikitext
23660 a
23661 <nowiki>*</nowiki>b
23662 !!end
23663
23664 !! test
23665 Lists: 8. Escape colons only if not present in tags
23666 !! options
23667 parsoid=html2wt
23668 !! html/parsoid
23669 <dl><dt>a:b<i>c:d</i></dt></dl>
23670 !! wikitext
23671 ; <nowiki>a:b</nowiki>''c:d''
23672 !! end
23673
23674 #### --------------- HRs ---------------
23675 #### 1. Single line
23676 #### -----------------------------------
23677
23678 !! test
23679 HRs: 1. Single line
23680 !! options
23681 parsoid=html2wt
23682 !! html/parsoid
23683 <hr />----
23684 <hr />=foo=
23685 <hr />*foo
23686 !! wikitext
23687 ----<nowiki>----</nowiki>
23688 ----=foo=
23689 ----*foo
23690 !! end
23691
23692 #### --------------- Tables ---------------
23693 #### 1a. Simple example
23694 #### 1b. No escaping needed (!foo)
23695 #### 1c. No escaping needed (|foo)
23696 #### 1d. No escaping needed (|}foo)
23697 ####
23698 #### 2a. Nested in td (<td>foo|bar</td>)
23699 #### 2b. Nested in td (<td>foo||bar</td>)
23700 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23701 ####
23702 #### 3a. Nested in th (<th>foo!bar</th>)
23703 #### 3b. Nested in th (<th>foo!!bar</th>)
23704 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23705 ####
23706 #### 4a. Escape -
23707 #### 4b. Escape +
23708 #### 4c. No escaping needed
23709 #### --------------------------------------
23710
23711 !! test
23712 Tables: 1a. Simple example
23713 !! options
23714 parsoid=html2wt
23715 !! html/parsoid
23716 <p>{|
23717 |}
23718 </p>
23719 !! wikitext
23720 <nowiki>{|</nowiki>
23721 |}
23722 !! end
23723
23724 !! test
23725 Tables: 1b. No escaping needed
23726 !! options
23727 parsoid=html2wt
23728 !! html/parsoid
23729 <p>!foo
23730 </p>
23731 !! wikitext
23732 !foo
23733 !! end
23734
23735 !! test
23736 Tables: 1c. No escaping needed
23737 !! options
23738 parsoid=html2wt
23739 !! html/parsoid
23740 <p>|foo
23741 </p>
23742 !! wikitext
23743 |foo
23744 !! end
23745
23746 !! test
23747 Tables: 1d. No escaping needed
23748 !! options
23749 parsoid=html2wt
23750 !! html/parsoid
23751 <p>|}foo
23752 </p>
23753 !! wikitext
23754 |}foo
23755 !! end
23756
23757 !! test
23758 Tables: 2a. Nested in td
23759 !! options
23760 parsoid=html2wt
23761 !! html/parsoid
23762 <table><tbody><tr>
23763 <td>foo|bar</td></tr>
23764 <tr><td>x<div>a|b</div></td>
23765 </tbody></table>
23766 !! wikitext
23767 {|
23768 |<nowiki>foo|bar</nowiki>
23769 |-
23770 |x<div><nowiki>a|b</nowiki></div>
23771 |}
23772 !! html/php+tidy
23773 <table>
23774 <tr>
23775 <td>foo|bar</td>
23776 </tr>
23777 <tr>
23778 <td>x
23779 <div>a|b</div>
23780 </td>
23781 </tr>
23782 </table>
23783 !! end
23784
23785 !! test
23786 Tables: 2b. Nested in td
23787 !! options
23788 parsoid=html2wt
23789 !! html/parsoid
23790 <table><tbody><tr>
23791 <td>foo||bar</td>
23792 <td>a<i>b||c</i></td>
23793 <td>a<i><div>b||c</div></i></td>
23794 </tr></tbody></table>
23795 !! wikitext
23796 {|
23797 |<nowiki>foo||bar</nowiki>
23798 |a''<nowiki>b||c</nowiki>''
23799 |a''<div><nowiki>b||c</nowiki></div>''
23800 |}
23801 !! html/php
23802 <table>
23803 <tr>
23804 <td>foo||bar
23805 </td>
23806 <td>a<i>b||c</i>
23807 </td>
23808 <td>a<i><div>b||c</div></i>
23809 </td></tr></table>
23810
23811 !! end
23812
23813 !! test
23814 Tables: 2c. Nested in td -- no escaping needed
23815 !! options
23816 parsoid=html2wt
23817 !! html/*
23818 <table>
23819 <tr>
23820 <td>foo!!bar
23821 </td></tr></table>
23822
23823 !! wikitext
23824 {|
23825 |foo!!bar
23826 |}
23827 !! end
23828
23829 !! test
23830 Tables: 3a. Nested in th
23831 !! options
23832 parsoid=html2wt
23833 !! html/*
23834 <table>
23835 <tr>
23836 <th>foo!bar
23837 </th></tr></table>
23838
23839 !! wikitext
23840 {|
23841 !foo!bar
23842 |}
23843 !! end
23844
23845 !! test
23846 Tables: 3b. Nested in th
23847 !! options
23848 parsoid=html2wt
23849 !! html/parsoid
23850 <table><tbody>
23851 <tr><th>foo!!bar</th>
23852 <th><i>foo|bar</i></th>
23853 <th><i>foo!!bar</i></th>
23854 <th><i><span>foo!!bar</span></i></th>
23855 </tr></tbody></table>
23856 !! wikitext
23857 {|
23858 !<nowiki>foo!!bar</nowiki>
23859 !''<nowiki>foo|bar</nowiki>''
23860 !''<nowiki>foo!!bar</nowiki>''
23861 !''<span><nowiki>foo!!bar</nowiki></span>''
23862 |}
23863 !! html/php
23864 <table>
23865 <tr>
23866 <th>foo!!bar
23867 </th>
23868 <th><i>foo|bar</i>
23869 </th>
23870 <th><i>foo!!bar</i>
23871 </th>
23872 <th><i><span>foo!!bar</span></i>
23873 </th></tr></table>
23874
23875 !! end
23876
23877 !! test
23878 Tables: 3c. Nested in th
23879 !! options
23880 parsoid=html2wt
23881 !! html/parsoid
23882 <table><tbody>
23883 <tr><th>foo||bar</th>
23884 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23885 </tr></tbody></table>
23886 !! wikitext
23887 {|
23888 !<nowiki>foo||bar</nowiki>
23889 !<nowiki>foo||bar</nowiki>
23890 |}
23891 !! html/php
23892 <table>
23893 <tr>
23894 <th>foo||bar
23895 </th>
23896 <th>foo||bar
23897 </th></tr></table>
23898
23899 !! end
23900
23901 !! test
23902 Tables: 4a. Escape -
23903 !! options
23904 parsoid=html2wt
23905 !! html/*
23906 <table>
23907 <tr>
23908 <th>-bar
23909 </th></tr>
23910 <tr>
23911 <td>-bar
23912 </td></tr></table>
23913
23914 !! wikitext
23915 {|
23916 !-bar
23917 |-
23918 |<nowiki>-bar</nowiki>
23919 |}
23920 !! end
23921
23922 !! test
23923 Tables: 4b. Escape +
23924 !! options
23925 parsoid=html2wt
23926 !! html/*
23927 <table>
23928 <tr>
23929 <th>+bar
23930 </th></tr>
23931 <tr>
23932 <td>+bar
23933 </td></tr></table>
23934
23935 !! wikitext
23936 {|
23937 !+bar
23938 |-
23939 |<nowiki>+bar</nowiki>
23940 |}
23941 !! end
23942
23943 !! test
23944 Tables: 4c. No escaping needed
23945 !! options
23946 parsoid=html2wt
23947 !! html/parsoid
23948 <table><tbody>
23949 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23950 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23951 <tr><td>foo
23952 <p>bar|baz
23953 +bar
23954 -bar</p></td></tr>
23955 <tr><td>x
23956 <div>a|b</div></td>
23957 </tbody></table>
23958 !! wikitext
23959 {|
23960 |foo-bar
23961 |foo+bar
23962 |-
23963 |''foo''-bar
23964 |''foo''+bar
23965 |-
23966 |foo
23967 bar|baz
23968 +bar
23969 -bar
23970 |-
23971 |x
23972 <div>a|b</div>
23973 |}
23974 !! html/php
23975 <table>
23976 <tr>
23977 <td>foo-bar
23978 </td>
23979 <td>foo+bar
23980 </td></tr>
23981 <tr>
23982 <td><i>foo</i>-bar
23983 </td>
23984 <td><i>foo</i>+bar
23985 </td></tr>
23986 <tr>
23987 <td>foo
23988 <p>bar|baz
23989 +bar
23990 -bar
23991 </p>
23992 </td></tr>
23993 <tr>
23994 <td>x
23995 <div>a|b</div>
23996 </td></tr></table>
23997
23998 !! end
23999
24000 !! test
24001 Tables: 4d. No escaping needed
24002 !! options
24003 parsoid=html2wt
24004 !! html/parsoid
24005 <table>
24006 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
24007 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
24008 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
24009 </tbody></table>
24010 !! wikitext
24011 {|
24012 |[[Foo]]-bar
24013 ||+1
24014 ||-2
24015 |}
24016 !! html/php
24017 <table>
24018 <tr>
24019 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
24020 </td>
24021 <td>+1
24022 </td>
24023 <td>-2
24024 </td></tr></table>
24025
24026 !! end
24027
24028 !! test
24029 T97430: Don't emit empty nowiki pairs around marker meta tags
24030 !! options
24031 parsoid=html2wt
24032 !! html/parsoid
24033 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24034 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
24035 !! wikitext
24036 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24037 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
24038 !! end
24039
24040 !! test
24041 Unclosed xmlish element in table line shouldn't eat end delimiters
24042 !! options
24043 parsoid=html2wt
24044 !! html/parsoid
24045 <table>
24046 <tbody><tr><td> &lt;foo</td>
24047 <td> bar></td></tr>
24048 </tbody></table>
24049 !! wikitext
24050 {|
24051 | <foo
24052 | bar>
24053 |}
24054 !! html/php
24055 <table>
24056 <tr>
24057 <td> &lt;foo
24058 </td>
24059 <td> bar&gt;
24060 </td></tr></table>
24061
24062 !! end
24063
24064 #### --------------- Links ----------------
24065 #### 1. Quote marks in link text
24066 #### 2. Wikilinks: Escapes needed
24067 #### 3. Wikilinks: No escapes needed
24068 #### 4. Extlinks: Escapes needed
24069 #### 5. Extlinks: No escapes needed
24070 #### --------------------------------------
24071 !! test
24072 Links 1. WikiLinks: No escapes needed
24073 !! options
24074 parsoid=html2wt
24075 !! html/parsoid
24076 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
24077 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
24078 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
24079 !! wikitext
24080 [[Foo|Foo''boo'']]
24081 [[Foo|[Foobar]]]
24082 [[Foo|x [Foobar] x]]
24083 !! html/php
24084 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
24085 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
24086 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
24087 </p>
24088 !! end
24089
24090 !! test
24091 Links 2. WikiLinks: Escapes needed
24092 !! options
24093 parsoid=html2wt
24094 !! html/parsoid
24095 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
24096 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
24097 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
24098 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
24099 <a href="Foo" rel="mw:WikiLink">|Bar</a>
24100 <a href="Foo" rel="mw:WikiLink">]]bar</a>
24101 <a href="Foo" rel="mw:WikiLink">[[bar</a>
24102 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
24103 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
24104 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
24105 !! wikitext
24106 [[Foo|<nowiki>Foobar]</nowiki>]]
24107 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
24108 [[Foo|<nowiki>[[Bar]]</nowiki>]]
24109 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
24110 [[Foo|<nowiki>|Bar</nowiki>]]
24111 [[Foo|<nowiki>]]bar</nowiki>]]
24112 [[Foo|<nowiki>[[bar</nowiki>]]
24113 [[Foo|<nowiki>x [[ y</nowiki>]]
24114 [[Foo|<nowiki>x ]] y</nowiki>]]
24115 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
24116 !! html/php
24117 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
24118 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
24119 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
24120 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
24121 <a href="/wiki/Foo" title="Foo">|Bar</a>
24122 <a href="/wiki/Foo" title="Foo">]]bar</a>
24123 <a href="/wiki/Foo" title="Foo">[[bar</a>
24124 <a href="/wiki/Foo" title="Foo">x [[ y</a>
24125 <a href="/wiki/Foo" title="Foo">x ]] y</a>
24126 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
24127 </p>
24128 !! end
24129
24130 !! test
24131 Links 3. WikiLinks: No escapes needed
24132 !! options
24133 parsoid=html2wt
24134 !! html/parsoid
24135 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
24136 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
24137 !! wikitext
24138 [[Foo|[Foobar]]
24139 [[Foo|foo|bar]]
24140 !! html/php
24141 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
24142 <a href="/wiki/Foo" title="Foo">foo|bar</a>
24143 </p>
24144 !! end
24145
24146 !! test
24147 Links 4. ExtLinks: Escapes needed
24148 !! options
24149 parsoid=html2wt
24150 !! html/parsoid
24151 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
24152 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
24153 <p>[http://google.com]</p>
24154 <p>[http://google.com google]</p>
24155 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
24156 <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>
24157 !! wikitext
24158 [http://google.com <nowiki>[google]</nowiki>]
24159 [http://google.com <nowiki>google]</nowiki>]
24160
24161 <nowiki>[http://google.com]</nowiki>
24162
24163 <nowiki>[http://google.com google]</nowiki>
24164
24165 [http://google.com<nowiki>]</nowiki>
24166
24167 [{{echo|http://google.com}}<nowiki>]</nowiki>
24168 !! html/php
24169 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
24170 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
24171 </p><p>[http://google.com]
24172 </p><p>[http://google.com google]
24173 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24174 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24175 </p>
24176 !! end
24177
24178 !! test
24179 Links 5. ExtLinks: No escapes needed
24180 !! options
24181 parsoid=html2wt
24182 !! html/parsoid
24183 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
24184 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
24185 !! wikitext
24186 [http://google.com [google]
24187
24188 [[http://google.com]]
24189 !! html/php
24190 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
24191 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
24192 </p>
24193 !! end
24194
24195 !! test
24196 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
24197 !! options
24198 parsoid=html2wt
24199 !! html/parsoid
24200 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
24201 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
24202 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
24203 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
24204 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
24205 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
24206 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24207 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
24208 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24209 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
24210 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
24211 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
24212 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
24213 </p>
24214 !! wikitext
24215 x<nowiki/>http://example.com<nowiki/>y
24216 http://example.com<nowiki/>?x
24217 http://example.com<nowiki/>&x
24218 http://example.com<nowiki/>'x
24219 http://example.com<nowiki/>,x
24220 http://example.com<nowiki/>.x
24221 http://example.com<nowiki/>;x
24222 http://example.com<nowiki/>:x
24223 http://example.com<nowiki/>;x
24224 http://example.com<nowiki/>!x
24225 http://example.com<nowiki/>=x
24226 http://example.com<nowiki/>(x)
24227 http://example.com(x<nowiki/>)
24228 !! end
24229
24230 !! test
24231 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24232 !! options
24233 parsoid=html2wt
24234 !! html/parsoid
24235 <p>x
24236 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
24237 y
24238 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
24239 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
24240 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
24241 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
24242 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
24243 </p>
24244 !! wikitext
24245 x
24246 http://example.com
24247 y
24248 "http://example.com"
24249 (http://example.com)
24250 (http://example.com) foo
24251 http://example.com,
24252 http://example.com, foo
24253 !! html/php
24254 <p>x
24255 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
24256 y
24257 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
24258 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
24259 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
24260 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
24261 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
24262 </p>
24263 !! end
24264
24265 !! test
24266 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24267 !! options
24268 parsoid=html2wt
24269 !! html/parsoid
24270 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
24271 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
24272 !! wikitext
24273 http://example.com.,;:!?\
24274 -http://example.com:
24275 !! html/php
24276 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
24277 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
24278 </p>
24279 !! end
24280
24281 !! test
24282 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
24283 !! options
24284 parsoid=html2wt
24285 !! html/parsoid
24286 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
24287 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
24288 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
24289 !! wikitext
24290 RFC 123<nowiki/>4
24291 RFC 123<nowiki/>y
24292 X<nowiki/>RFC 123<nowiki/>y
24293 !! end
24294
24295 !! test
24296 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
24297 !! options
24298 parsoid=html2wt
24299 !! html/parsoid
24300 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24301 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24302 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24303 </p>
24304 !! wikitext
24305 RFC 123?foo
24306 RFC 123&foo
24307 -RFC 123-
24308 !! html/php
24309 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24310 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24311 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24312 </p>
24313 !! end
24314
24315 !! test
24316 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
24317 !! options
24318 parsoid=html2wt
24319 !! html/parsoid
24320 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24321 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24322 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24323 !! wikitext
24324 PMID 123<nowiki/>4
24325 PMID 123<nowiki/>y
24326 X<nowiki/>PMID 123<nowiki/>y
24327 !! end
24328
24329 !! test
24330 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
24331 !! options
24332 parsoid=html2wt
24333 !! html/parsoid
24334 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24335 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24336 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24337 </p>
24338 !! wikitext
24339 PMID 123?foo
24340 PMID 123&foo
24341 -PMID 123-
24342 !! html/php
24343 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24344 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24345 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24346 </p>
24347 !! end
24348
24349 !! test
24350 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
24351 !! options
24352 parsoid=html2wt
24353 !! html/parsoid
24354 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24355 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24356 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24357 </p>
24358 !! wikitext
24359 ISBN 1234567890<nowiki/>1
24360 ISBN 1234567890<nowiki/>x
24361 a<nowiki/>ISBN 1234567890<nowiki/>b
24362 !! end
24363
24364 !! test
24365 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
24366 !! options
24367 parsoid=html2wt
24368 !! html/parsoid
24369 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24370 !! wikitext
24371 -ISBN 1234567890's
24372 !! html/php
24373 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24374 </p>
24375 !! end
24376
24377 !! test
24378 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24379 !! options
24380 parsoid=html2wt
24381 !! html/*
24382 <p>this is not a link: http://example.com
24383 </p>
24384 !! wikitext
24385 this is not a link: <nowiki>http://example.com</nowiki>
24386 !! end
24387
24388 !! test
24389 Links 15. Link trails can't become link prefixes.
24390 !! options
24391 language=is
24392 parsoid=html2wt
24393 !! html/parsoid
24394 <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>
24395 !! wikitext
24396 [[Söfnuður]]-[[00]]
24397 !! html/php
24398 <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>
24399 </p>
24400 !! end
24401
24402 #### --------------- Quotes ---------------
24403 #### 1. Quotes inside <b> and <i>
24404 #### 2. Link fragments separated by <i> and <b> tags
24405 #### 3. Link fragments inside <i> and <b>
24406 #### 4. No escaping needed
24407 #### --------------------------------------
24408 !! test
24409 1a. Quotes inside <b> and <i>
24410 !! options
24411 parsoid=html2wt
24412 !! html/*
24413 <p><i>'foo'</i>
24414 <i>''foo''</i>
24415 <i>'''foo'''</i>
24416 <i>foo</i>'s
24417 <b>'foo'</b>
24418 <b>''foo''</b>
24419 <b>'''foo'''</b>
24420 <b>foo'<i>bar'</i>baz</b>
24421 <b>foo</b>'s
24422 '<i>foo</i>
24423 <i>foo</i>'
24424 <i>foo'</i>'
24425 '<i>foo</i>'
24426 '<b>foo</b>
24427 <b>foo</b>'
24428 '<b>foo</b>'
24429 <i>fools'<span> errand</span></i>
24430 <i><span>fool</span>'s errand</i>
24431 '<i>foo</i> bar '<i>baz</i>
24432 a|!*#-:;+-~[]{}b'<i>x</i>
24433 </p>
24434 !! wikitext
24435 ''<nowiki/>'foo'''
24436 ''<nowiki>''foo''</nowiki>''
24437 ''<nowiki>'''foo'''</nowiki>''
24438 ''foo''<nowiki/>'s
24439 '''<nowiki/>'foo''''
24440 '''<nowiki>''foo''</nowiki>'''
24441 '''<nowiki>'''foo'''</nowiki>'''
24442 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24443 '''foo'''<nowiki/>'s
24444 '''foo''
24445 ''foo''<nowiki/>'
24446 ''foo'''<nowiki/>'
24447 '''foo''<nowiki/>'
24448 ''''foo'''
24449 '''foo'''<nowiki/>'
24450 ''''foo'''<nowiki/>'
24451 ''fools'<span> errand</span>''
24452 ''<span>fool</span>'s errand''
24453 '<nowiki/>''foo'' bar '''baz''
24454 a|!*#-:;+-~[]{}b'''x''
24455 !! end
24456
24457 !! test
24458 1b. Quotes inside <b> and <i> with other tags on same line
24459 !! options
24460 parsoid=html2wt
24461 !! html/parsoid
24462 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24463 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24464 <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>
24465 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24466 '<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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
24467 '<i>foo</i> <div title="name">test</div>
24468 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24469 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24470 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">test</span></li>
24471 </ol>
24472 !! wikitext
24473 '''a'' foo ''[[bar]]''
24474 ''a''' foo ''[[bar]]''
24475 ''a''' foo '''{{echo|[[bar]]}}'''
24476 [[foo]] x'''[[bar]]''
24477 '''foo'' <ref>test</ref>
24478 '''foo'' <div title="name">test</div>
24479 '''foo'' and <br> bar
24480 <references />
24481 !! end
24482
24483 !! test
24484 2. Link fragments separated by <i> and <b> tags
24485 !! options
24486 parsoid=html2wt
24487 !! html/parsoid
24488 <p>[[<i>foo</i>hello]]</p>
24489 <p>[[<b>foo</b>hello]]</p>
24490 !! wikitext
24491 [[''foo''<nowiki>hello]]</nowiki>
24492
24493 [['''foo'''<nowiki>hello]]</nowiki>
24494 !! end
24495
24496 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24497 # this is one of the shortcomings of this format
24498 !! test
24499 3. Link fragments inside <i> and <b>
24500 !! options
24501 parsoid=html2wt
24502 !! html/parsoid
24503 <p><i>[[foo</i>]]</p>
24504 <p><b>[[foo</b>]]</p>
24505 !! wikitext
24506 ''[[foo''<nowiki>]]</nowiki>
24507
24508 '''[[foo'''<nowiki>]]</nowiki>
24509 !! end
24510
24511 !! test
24512 4. No escaping needed
24513 !! options
24514 options=html2wt
24515 !! html/parsoid
24516 <p>'<span><i>bar</i></span>'
24517 '<span><b>bar</b></span>'
24518 'a:b'foo
24519 </p>
24520 !! wikitext
24521 '<span>''bar''</span>'
24522 '<span>'''bar'''</span>'
24523 'a:b'foo
24524 !! end
24525
24526 #### ----------- Paragraphs ---------------
24527 #### 1. No unnecessary escapes
24528 #### --------------------------------------
24529
24530 !! test
24531 1. No unnecessary escapes
24532 !! options
24533 parsoid=html2wt
24534 !! html/parsoid
24535 <p>bar <span>[[foo]]</span>
24536 </p><p>=bar <span>[[foo]]</span>
24537 </p><p>[[bar <span>[[foo]]</span>
24538 </p><p>]]bar <span>[[foo]]</span>
24539 </p><p>=bar <span>foo]]</span>=
24540 </p>
24541 !! wikitext
24542 bar <span><nowiki>[[foo]]</nowiki></span>
24543
24544 =bar <span><nowiki>[[foo]]</nowiki></span>
24545
24546 [[bar <span><nowiki>[[foo]]</nowiki></span>
24547
24548 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24549
24550 =bar <span>foo]]</span><nowiki>=</nowiki>
24551 !!end
24552
24553 #### ----------------------- PRE --------------------------
24554 #### 1. Leading whitespace in SOL context should be escaped
24555 #### ------------------------------------------------------
24556 !! test
24557 1. Leading whitespace in SOL context should be escaped
24558 !! options
24559 parsoid=html2wt
24560 !! html/parsoid
24561 <p> a</p>
24562
24563 <p> a</p>
24564
24565 <p> a(tab)</p>
24566
24567 <p> a
24568 <!--cmt-->
24569 a</p>
24570
24571 <p>a
24572 b</p>
24573
24574 <p>a
24575 b</p>
24576
24577 <p>a
24578 b</p>
24579 !! wikitext
24580 <nowiki> </nowiki>a
24581
24582 <nowiki> </nowiki> a
24583
24584 a(tab)
24585
24586 <nowiki> </nowiki> a
24587 <!--cmt-->
24588 <nowiki> </nowiki>a
24589
24590 a
24591 <nowiki> </nowiki>b
24592
24593 a
24594 b
24595
24596 a
24597 b
24598 !! html/php
24599 <p> a
24600 </p><p> a
24601 </p><p> a(tab)
24602 </p><p> a
24603 a
24604 </p><p>a
24605 b
24606 </p><p>a
24607 b
24608 </p><p>a
24609 b
24610 </p>
24611 !! end
24612
24613 !! test
24614 2. Leading whitespace in non-indent-pre contexts should not be escaped
24615 !! options
24616 parsoid=html2wt
24617 !! html/parsoid
24618 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
24619 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24620 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
24621 b</span></li>
24622 </ol>
24623 !! wikitext
24624 foo <ref>''a''
24625 b</ref>
24626 <references />
24627 !! end
24628
24629 !! test
24630 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24631 !! options
24632 parsoid=html2wt
24633 !! html/parsoid
24634 <blockquote>
24635 <p>
24636 a
24637 <span>b</span>
24638 c</p>
24639 </blockquote>
24640 !! wikitext
24641 <blockquote>
24642 a
24643 <span>b</span>
24644 c
24645 </blockquote>
24646 !! end
24647
24648 !! test
24649 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24650 !! options
24651 options=html2wt
24652 !! html/parsoid
24653 <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>
24654 !! wikitext
24655 [[File:Foobar.jpg|thumb|caption]]
24656 !! end
24657
24658 !! test
24659 5. Nowiki escaping should account for indent-pres
24660 !! options
24661 parsoid=html2wt
24662 !! html/parsoid
24663 <pre>==foo==</pre>
24664 !! wikitext
24665 ==foo==
24666 !! end
24667
24668 !!test
24669 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24670 !! options
24671 parsoid=html2wt
24672 !! html/parsoid
24673 <pre>
24674 * foo
24675 * bar
24676 </pre>
24677 !! wikitext
24678 * foo
24679 * bar
24680 !! end
24681
24682 #### --------------- Behavior Switches --------------------
24683
24684 !! test
24685 1. Valid behavior switches should be escaped
24686 !! options
24687 parsoid=html2wt
24688 !! html/parsoid
24689 __TOC__
24690 <i>__TOC__</i>
24691 !! wikitext
24692 <nowiki>__TOC__</nowiki>
24693 ''<nowiki>__TOC__</nowiki>''
24694 !! end
24695
24696 !! test
24697 2. Invalid behavior switches should not be escaped
24698 !! options
24699 parsoid=html2wt
24700 !! html/parsoid
24701 __TOO__
24702 __|__
24703 !! wikitext
24704 __TOO__
24705 __|__
24706 !! end
24707
24708 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24709 !! test
24710 Behavior switches should be SOL-transparent
24711 !! options
24712 parsoid=html2wt
24713 !! html/parsoid
24714 <meta property="mw:PageProp/toc" />
24715
24716 <!-- this one's bogus -->
24717 <pre>__TOO__</pre>
24718
24719 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24720
24721 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24722 !! wikitext
24723 __TOC__
24724
24725 <!-- this one's bogus -->
24726 __TOO__
24727
24728 __TOC__ foo
24729
24730 __TOC__
24731 bar
24732 !! end
24733
24734 #### --------------- HTML tags ---------------
24735 #### 1. a tags
24736 #### 2. other tags
24737 #### 3. multi-line html tag
24738 #### 4. extension tags
24739 #### -----------------------------------------
24740 !! test
24741 1. a tags
24742 !! options
24743 parsoid=html2wt
24744 !! html/parsoid
24745 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24746 !! wikitext
24747 <a href="http://google.com">google</a>
24748 !! end
24749
24750 !! test
24751 2. other tags
24752 !! options
24753 parsoid=html2wt
24754 !! html/parsoid
24755 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24756 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24757 <li> &lt;td&gt;</li></ul>
24758
24759 !! wikitext
24760 * <nowiki><div>foo</div></nowiki>
24761 * <nowiki><div style="color:red">foo</div></nowiki>
24762 * <nowiki><td></nowiki>
24763 !! end
24764
24765 !! test
24766 3. multi-line html tag
24767 !! options
24768 parsoid=html2wt
24769 !! html/parsoid
24770 <p>&lt;div
24771 &gt;foo&lt;/div
24772 &gt;
24773 </p>
24774 !! wikitext
24775 <nowiki><div
24776 >foo</div
24777 ></nowiki>
24778 !! end
24779
24780 !! test
24781 4. extension tags
24782 !! options
24783 parsoid=html2wt
24784 !! html/parsoid
24785 <p>&lt;ref&gt;foo&lt;/ref&gt;
24786 </p><p>&lt;ref&gt;bar
24787 </p><p>baz&lt;/ref&gt;
24788 </p>
24789 !! wikitext
24790 <nowiki><ref>foo</ref></nowiki>
24791
24792 <nowiki><ref>bar</nowiki>
24793
24794 baz<nowiki></ref></nowiki>
24795 !! end
24796
24797 #### --------------- Others ---------------
24798 !! test
24799 Escaping nowikis
24800 !! options
24801 parsoid=html2wt
24802 !! html/parsoid
24803 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24804 </p>
24805 !! wikitext
24806 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24807 !! end
24808
24809 ## The quote-char in the input is necessary for triggering the bug
24810 !! test
24811 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24812 !! options
24813 parsoid=html2wt
24814 !! html/parsoid
24815 <p>foo's bar :</p>
24816 !! wikitext
24817 foo's bar :
24818 !! end
24819
24820 #----------- End of wikitext escaping tests --------------
24821
24822 !! test
24823
24824 Tag-like HTML structures are passed through as text
24825 !! wikitext
24826 <x y>
24827
24828 <x.y>
24829
24830 <x-y>
24831
24832 1>2
24833
24834 x<y
24835
24836 a>b
24837
24838 1<d e>f
24839 !! html
24840 <p>&lt;x y&gt;
24841 </p><p>&lt;x.y&gt;
24842 </p><p>&lt;x-y&gt;
24843 </p><p>1&gt;2
24844 </p><p>x&lt;y
24845 </p><p>a&gt;b
24846 </p><p>1&lt;d e&gt;f
24847 </p>
24848 !! end
24849
24850 !! test
24851 HTML tag with necessary entities in attributes
24852 !! wikitext
24853 <span title="&amp;amp;">foo</span>
24854 !! html
24855 <p><span title="&amp;amp;">foo</span>
24856 </p>
24857 !! end
24858
24859 !! test
24860 HTML tag with 'unnecessary' entity encoding in attributes
24861 !! wikitext
24862 <span title="&amp;">foo</span>
24863 !! html
24864 <p><span title="&amp;">foo</span>
24865 </p>
24866 !! end
24867
24868 !! test
24869 HTML tag with broken attribute value quoting
24870 !! options
24871 parsoid=wt2html,html2html
24872 !! wikitext
24873 <span title="Hello world>Foo</span>
24874 !! html/php
24875 <p><span title="Hello world">Foo</span>
24876 </p>
24877 !! html/parsoid
24878 <p><span title="Hello world">Foo</span></p>
24879 !! end
24880
24881 !! test
24882 Self-closed tag with broken attribute value quoting
24883 !! options
24884 parsoid=wt2html,html2html
24885 !! wikitext
24886 <div title="Hello world />Foo
24887 !! html/php+tidy
24888 <div title="Hello world"></div>
24889 <p>Foo</p>
24890 !! html/parsoid
24891 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24892 !! end
24893
24894 !! test
24895 Table with broken attribute value quoting
24896 !! options
24897 parsoid=wt2html,html2html
24898 !! wikitext
24899 {|
24900 | title="Hello world|Foo
24901 |}
24902 !! html/php
24903 <table>
24904 <tr>
24905 <td title="Hello world">Foo
24906 </td></tr></table>
24907
24908 !! html/parsoid
24909 <table>
24910 <tr>
24911 <td title="Hello world">Foo
24912 </td></tr></table>
24913
24914 !! end
24915
24916 !! test
24917 Table with broken attribute value quoting on consecutive lines
24918 !! options
24919 parsoid=wt2html,html2html
24920 !! wikitext
24921 {|
24922 | title="Hello world|Foo
24923 | style="color:red|Bar
24924 |}
24925 !! html/php
24926 <table>
24927 <tr>
24928 <td title="Hello world">Foo
24929 </td>
24930 <td style="color:red">Bar
24931 </td></tr></table>
24932
24933 !! html/parsoid
24934 <table><tbody>
24935 <tr>
24936 <td title="Hello world">Foo
24937 </td><td style="color: red">Bar
24938 </td></tr></tbody></table>
24939
24940 !! end
24941
24942 !!test
24943 Accept empty td cell attribute
24944 !! wikitext
24945 {|
24946 | align="center" | foo || |
24947 |}
24948 !! html
24949 <table>
24950 <tr>
24951 <td align="center"> foo </td>
24952 <td>
24953 </td></tr></table>
24954
24955 !!end
24956
24957 !!test
24958 Non-empty attributes in th-cells
24959 !! wikitext
24960 {|
24961 ! Foo !! style="color: red" | Bar
24962 |}
24963 !! html
24964 <table>
24965 <tr>
24966 <th> Foo </th>
24967 <th style="color: red"> Bar
24968 </th></tr></table>
24969
24970 !!end
24971
24972 !!test
24973 Accept empty attributes in th-cells
24974 !! wikitext
24975 {|
24976 !| foo !!| bar
24977 |}
24978 !! html
24979 <table>
24980 <tr>
24981 <th> foo </th>
24982 <th> bar
24983 </th></tr></table>
24984
24985 !!end
24986
24987 !!test
24988 Empty table rows go away
24989 !! wikitext
24990 {|
24991 | Hello
24992 | there
24993 |- class="foo"
24994 |-
24995 |}
24996 !! html
24997 <table>
24998 <tr>
24999 <td> Hello
25000 </td>
25001 <td> there
25002 </td></tr>
25003
25004 </table>
25005
25006 !! end
25007
25008 ###
25009 ### Parsoid-centric tests for testing RTing of inter-element separators
25010 ### Edge cases not tested by existing parser tests and specific to
25011 ### Parsoid-specific serialization strategies.
25012 ###
25013
25014 !!test
25015 RT-ed inter-element separators should be valid separators
25016 !! wikitext
25017 {|
25018 |- [[foo]]
25019 |}
25020 !! html/php
25021 <table>
25022
25023 </table>
25024
25025 !! html/parsoid
25026 <table>
25027 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
25028 </tbody></table>
25029 !!end
25030
25031 # Parsoid-only since PHP parser relies on Tidy for correct output
25032 !!test
25033 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
25034 !!options
25035 parsoid
25036 !! wikitext
25037 {|
25038 |<small>foo
25039 bar
25040 |}
25041
25042 {|
25043 |<small>foo<small>
25044 |}
25045 !! html
25046 <table>
25047 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
25048 <p>bar</p></small></td></tr>
25049 </tbody></table>
25050
25051 <table>
25052 <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>
25053 </tbody></table>
25054 !!end
25055
25056 # Note that the "style" attribute is really a template parameter here.
25057 # The = would have to be {{=}} if you wanted the literal.
25058 !!test
25059 Empty TD followed by TD with tpl-generated attribute
25060 !! wikitext
25061 {|
25062 |-
25063 |
25064 |{{echo|style='color:red'}}|foo
25065 |}
25066 !! html
25067 <table>
25068
25069 <tr>
25070 <td>
25071 </td>
25072 <td>foo
25073 </td></tr></table>
25074
25075 !!end
25076
25077 !!test
25078 Indented table with an empty td
25079 !! wikitext
25080 {|
25081 |-
25082 |
25083 |foo
25084 |}
25085 !! html
25086 <table>
25087
25088 <tr>
25089 <td>
25090 </td>
25091 <td>foo
25092 </td></tr></table>
25093
25094 !!end
25095
25096 ## We have some newline diffs RT-ing this edge case
25097 ## and it is not important enough -- we seem to be emitting
25098 ## at most 2 newlines after a </tr> and this is unrelated to
25099 ## the issue from T85627 that this is testing.
25100 !!test
25101 Indented table with blank lines in between (T85627)
25102 !! options
25103 parsoid=wt2html
25104 !! wikitext
25105 {|
25106 |foo
25107
25108
25109 |}
25110 !! html
25111 <table>
25112
25113 <tr>
25114 <td>foo
25115 </td></tr></table>
25116
25117 !!end
25118
25119 !!test
25120 Indented block & table
25121 !! wikitext
25122 <div>foo</div>
25123 {|
25124 |foo
25125 |}
25126 !! html/php
25127 <div>foo</div>
25128 <table>
25129 <tr>
25130 <td>foo
25131 </td></tr></table>
25132
25133 !! html/parsoid
25134 <div data-parsoid='{"stx":"html"}'>foo</div>
25135 <table><tbody>
25136 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
25137 </tbody></table>
25138 !!end
25139
25140 !! test
25141 Indent and comment before table row
25142 !! wikitext
25143 {|
25144 <!--hi-->|-
25145 | there
25146 |}
25147 !! html/php
25148 <table>
25149
25150 <tr>
25151 <td> there
25152 </td></tr></table>
25153
25154 !! html/parsoid
25155 <table>
25156 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
25157 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
25158 </tbody></table>
25159 !! end
25160
25161 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
25162 !!test
25163 Empty TR followed by a template-generated TR
25164 !!options
25165 parsoid
25166 !! wikitext
25167 {|
25168 |-
25169 {{echo|<tr><td>foo</td></tr>}}
25170 |}
25171 !! html
25172 <table>
25173 <tbody>
25174 <tr></tr>
25175 <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}}]}'>
25176 <td>foo</td></tr>
25177 </tbody></table>
25178 !!end
25179
25180 ## PHP and parsoid output differ for this, and since this is primarily
25181 ## for testing Parsoid's serializer, marking this Parsoid only
25182 !!test
25183 Empty TR followed by mixed-ws-comment line should RT correctly
25184 !!options
25185 parsoid
25186 !! wikitext
25187 {|
25188 |-
25189 <!--c-->
25190 |-
25191 <!--c--> <!--d-->
25192 |}
25193 !! html
25194 <table>
25195 <tbody>
25196 <tr></tr>
25197 <!--c-->
25198 <tr>
25199 <!--c--> </tr><!--d-->
25200 </tbody></table>
25201
25202 !!end
25203
25204 !!test
25205 Multi-line image caption generated by templates with/without trailing newlines
25206 !! wikitext
25207 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
25208 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
25209 !! html/parsoid
25210 <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>
25211 <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>
25212 !!end
25213
25214 !! test
25215 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
25216 !! options
25217 parsoid=html2wt
25218 !! html/parsoid
25219 <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>
25220
25221 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
25222 !! wikitext
25223 <includeonly>foo</includeonly>
25224 new para
25225
25226 [[Category:Foo]]
25227
25228 = new heading =
25229 !! end
25230
25231 ## PHP emits broken html for this, and since this is primarily
25232 ## a Parsoid serializer test, marking this Parsoid only
25233 !!test
25234 Improperly nested inline or quotes tags with whitespace in between
25235 !! wikitext
25236 <span> <s>x</span> </s>
25237 ''' ''x''' ''
25238 !! html/parsoid
25239 <p><span> <s>x</s></span><s> </s>
25240 <b> <i>x</i></b><i> </i>
25241 </p>
25242 !!end
25243
25244 !!test
25245 Encapsulate protected attributes from wt
25246 !! wikitext
25247 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
25248
25249 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
25250 | ok
25251 |}
25252 !! html/parsoid
25253 <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>
25254
25255 <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">
25256 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
25257 </tbody></table>
25258 !!end
25259
25260 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
25261 ## Having nested or stray pre tags results in the attempt to add duplicates,
25262 ## causing an assertion fail. This test tries to prevent that situation.
25263 !!test
25264 Ensure ParagraphWrapper can deal with stray closing pre tags
25265 !!options
25266 parsoid=wt2html
25267 !! wikitext
25268 plain text</pre>
25269 !! html/parsoid
25270 plain text
25271 !!end
25272
25273 !!test
25274 1. Ensure fostered text content is wrapped in element nodes
25275 !!options
25276 parsoid=wt2html
25277 !! wikitext
25278 <table>hi</table><table>ho</table>
25279 !! html/parsoid
25280 <p>hi</p>
25281 <table></table>
25282 <p>ho</p>
25283 <table></table>
25284 !!end
25285
25286 !!test
25287 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
25288 !!options
25289 parsoid=wt2html,wt2wt
25290 !! wikitext
25291 <table>
25292 <tr> || ||
25293 <td> a
25294 </table>
25295 !! html/parsoid
25296 <p> || ||
25297 </p><table>
25298 <tbody><tr><td> a</td></tr>
25299 </tbody></table>
25300 !!end
25301
25302 !!test
25303 Encapsulation properly handles null DSR information from foster box
25304 !!options
25305 parsoid=wt2html,wt2wt
25306 !! wikitext
25307 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25308 !! html/parsoid
25309 <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>
25310 !!end
25311
25312 !!test
25313 1. Encapsulate foster-parented transclusion content
25314 !!options
25315 parsoid=wt2wt,wt2html
25316 !! wikitext
25317 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25318 !! html/parsoid
25319 <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>
25320 <tbody>
25321 <tr>
25322 <td>bar</td>
25323 </tr>
25324 </tbody>
25325 </table>
25326 !!end
25327
25328 !!test
25329 2. Encapsulate foster-parented transclusion content
25330 !!options
25331 parsoid=wt2wt,wt2html
25332 !! wikitext
25333 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25334 !! html/parsoid
25335 <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>
25336 <table>
25337 <tbody>
25338 <tr>
25339 <td>bar</td>
25340 </tr>
25341 </tbody>
25342 </table>
25343 !!end
25344
25345 !!test
25346 3. Encapsulate foster-parented transclusion content
25347 !!options
25348 parsoid=wt2wt,wt2html
25349 !! wikitext
25350 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25351 !! html/parsoid
25352 <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;]}">
25353 <p>foo</p>
25354 </div>
25355 <table>
25356 <tbody>
25357 <tr>
25358 <td>bar</td>
25359 </tr>
25360 </tbody>
25361 </table>
25362 !!end
25363
25364 !!test
25365 4. Encapsulate foster-parented transclusion content
25366 !!options
25367 parsoid=wt2wt,wt2html
25368 !! wikitext
25369 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25370 !! html/parsoid
25371 <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;]}">
25372 <p>foo</p>
25373 </div>
25374 <table>
25375 <tbody>
25376 <tr>
25377 <td>bar</td>
25378 </tr>
25379 </tbody>
25380 </table>
25381 !!end
25382
25383 !!test
25384 5. Encapsulate foster-parented transclusion content
25385 !!options
25386 parsoid=wt2wt,wt2html
25387 !! wikitext
25388 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25389 !! html/parsoid
25390 <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>
25391 <table>
25392 <tbody>
25393 <tr>
25394 <td>
25395 <div>
25396 <p>foo</p>
25397 </div>
25398 </td>
25399 </tr>
25400 </tbody>
25401 </table>
25402 !!end
25403
25404 !!test
25405 6. Encapsulate foster-parented transclusion content
25406 !!options
25407 parsoid=wt2wt,wt2html
25408 !! wikitext
25409 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25410 !! html/parsoid
25411 <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>
25412 <table>
25413 <tbody>
25414 <tr>
25415 <td>
25416 <div>
25417 <p>foo</p>
25418 </div>
25419 </td>
25420 </tr>
25421 </tbody>
25422 </table>
25423 <p>ok</p>
25424 !!end
25425
25426 !!test
25427 7. Encapsulate foster-parented transclusion content
25428 !!options
25429 parsoid=wt2wt,wt2html
25430 !! wikitext
25431 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25432 !! html/parsoid
25433 <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>
25434 <table>
25435 <tbody>
25436 <tr>
25437 <td>bar</td>
25438 </tr>
25439 </tbody>
25440 </table>
25441 !!end
25442
25443 # Note that the wt is broken on purpose: the = should be {{=}} if you
25444 # don't want it to be a template parameter key.
25445 !!test
25446 8. Encapsulate foster-parented transclusion content
25447 !!options
25448 parsoid=wt2wt,wt2html
25449 !! wikitext
25450 {{echo|a
25451 }}{|{{echo|style='color:red'}}
25452 |-
25453 |b
25454 |}
25455 !! html/parsoid
25456 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25457 <span> </span>
25458 <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>
25459 <table>
25460 <tbody>
25461 <tr>
25462 <td>b</td>
25463 </tr>
25464 </tbody>
25465 </table>
25466 !!end
25467
25468 !!test
25469 9. Encapsulate foster-parented transclusion content
25470 !!options
25471 parsoid=wt2wt,wt2html
25472 !! wikitext
25473 <table>{{echo|hi</table>hello}}
25474 !! html/parsoid
25475 <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>
25476 !!end
25477
25478 !!test
25479 Table in fosterable position
25480 !!options
25481 parsoid=wt2html
25482 !! wikitext
25483 {{OpenTable}}
25484 <div>
25485 {|
25486 |}
25487 </div>
25488 |}
25489 !! html/parsoid
25490 <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">
25491 </span>
25492 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25493
25494 <table>
25495 </table>
25496 !!end
25497
25498 # Parsoid only for bug 64747
25499 !! test
25500 Properly encapsulate empty-content transclusions in fosterable positions
25501 !! wikitext
25502 <table>
25503 {{#if:|
25504 <td>foo</td>
25505 }}
25506 </table>
25507 !! html/parsoid
25508 <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"}]]}'>
25509
25510 </table>
25511 !! end
25512
25513 !! test
25514 Always encapsulate foster box when template range is expanded to table
25515 !! options
25516 parsoid=wt2wt
25517 !! wikitext
25518 {|
25519 hello
25520 {{OpenTable}}
25521 |}
25522 !! html/parsoid
25523
25524 !! end
25525
25526 !! test
25527 T115289: Unclosed table
25528 !! wikitext
25529 {{echo|<table>}}<!--c-->[[Category:Two]]
25530 !! html/parsoid
25531 <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>
25532 !! end
25533
25534 !! test
25535 T115289: Don't migrate newlines out of tables with fostered content
25536 !! wikitext
25537 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25538 !! html/parsoid
25539 <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>
25540 !! end
25541
25542 !! test
25543 T73074: More fostering fun
25544 !! wikitext
25545 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25546 !! html/parsoid
25547 <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>
25548 !! end
25549
25550 !!test
25551 Support <object> element with .data attribute
25552 !!options
25553 parsoid=html2wt
25554 !! html/parsoid
25555 <object data="test.swf"></object>
25556 !! wikitext
25557 <object data="test.swf"></object>
25558 !!end
25559
25560 !! test
25561 Don't block XML namespace declaration
25562 !! wikitext
25563 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25564 !! html/php
25565 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25566 </p>
25567 !! html/parsoid
25568 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25569 !! end
25570
25571 # -----------------------------------------------------------------
25572 # The following section of tests are primarily to spec requirements
25573 # around Parsoid's serialization (old, new, edited content)
25574 #
25575 # All these tests are marked Parsoid html2wt and html2html only
25576 # ----------------------------------------------------------------
25577
25578 !! test
25579 Ignore rel attribute in a-tags during serialization to url-links
25580 !! options
25581 parsoid=html2wt
25582 !! html/parsoid
25583 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25584 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25585 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25586 !! wikitext
25587 http://en.wikipedia.org/wiki/Foobar
25588 http://en.wikipedia.org/wiki/Foobar
25589 http://en.wikipedia.org/wiki/Foobar
25590 !! end
25591
25592 # 'mi' is a localinterwiki prefix as well as a language
25593 !! test
25594 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
25595 !! options
25596 parsoid=html2wt
25597 !! html/parsoid
25598 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25599 !! wikitext
25600 [[Foo]]
25601 !! end
25602
25603 # See T93839
25604 !! test
25605 New wikilinks should be serialized properly
25606 !! options
25607 parsoid=html2wt
25608 !! html/parsoid
25609 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25610 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25611 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25612 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25613 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25614 !! wikitext
25615 [[Foo]]
25616 [[Foo]]
25617 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25618 http://en.wikipedia.org/wiki/Foo
25619 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25620 !! end
25621
25622 !! test
25623 New wiki links (href variations)
25624 !! options
25625 parsoid=html2wt
25626 !! html/parsoid
25627 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25628 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25629 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25630 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25631 !! wikitext
25632 [[Foo_bar]]
25633 [[Foo_bar]]
25634 [[Foo_bar]]
25635 [[Toxine bactérienne]]
25636 !! end
25637
25638 !! test
25639 New wiki links (content string variations)
25640 !! options
25641 parsoid=html2wt
25642 !! html/parsoid
25643 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25644 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25645 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25646 !! wikitext
25647 [[Foo_bar]]
25648 [[Foo bar]]
25649 [[Foo_bar|./Foo_bar]]
25650 !! end
25651
25652 !! test
25653 New category links (href variations)
25654 !! options
25655 parsoid=html2wt
25656 !! html/parsoid
25657 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25658 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25659 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25660 !! wikitext
25661 [[Category:Toxine bactérienne]]
25662 [[Category:Toxine bactérienne]]
25663 [[Category:Toxine bactérienne]]
25664 !! end
25665
25666 !! test
25667 New sol transparent links don't need indent-pre nowiki protection
25668 !! options
25669 parsoid=html2wt
25670 language=de
25671 !! html/parsoid
25672 <link rel="mw:PageProp/redirect" href="./Main_Page">
25673 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25674 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25675 !! wikitext
25676 #WEITERLEITUNG [[Main Page]]
25677 <!-- this is good --> [[Category:Good]]
25678 <!-- this is great --> [[Kategorie:Great]]
25679 !! end
25680
25681 !! test
25682 New interlanguage links (href variations)
25683 !! options
25684 parsoid=html2wt
25685 !! html/parsoid
25686 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25687 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25688 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25689 !! wikitext
25690 [[es:Toxine bactérienne]]
25691 [[es:Toxine_bactérienne]]
25692 [[es:Toxine_bactérienne]]
25693 !! end
25694
25695 !! test
25696 Image: Modifying size of an image (1)
25697 !! options
25698 parsoid={
25699 "modes": ["wt2wt"],
25700 "changes": [
25701 ["img[height]", "attr", "height", "22"],
25702 ["img[width]", "attr", "width", "200"]
25703 ]
25704 }
25705 !! wikitext
25706 [[Image:Foobar.jpg|230x230px]]
25707 !! wikitext/edited
25708 [[Image:Foobar.jpg|200x200px]]
25709 !!end
25710
25711 !! test
25712 Image: Modifying size of an image (2)
25713 !! options
25714 parsoid={
25715 "modes": ["wt2wt"],
25716 "changes": [
25717 ["img[height]", "attr", "height", "100"],
25718 ["img[width]", "attr", "width", "500"]
25719 ]
25720 }
25721 !! wikitext
25722 [[Image:Foobar.jpg|230x230px]]
25723 !! wikitext/edited
25724 [[Image:Foobar.jpg|500x500px]]
25725 !!end
25726
25727 # Change in size is ignored so long as class='mw-default-size'
25728 !! test
25729 Image: Modifying size of an image (3)
25730 !! options
25731 parsoid={
25732 "modes": ["wt2wt"],
25733 "changes": [
25734 ["figure[class]", "removeClass", "mw-default-size"],
25735 ["figure img", "attr", "height", "19"],
25736 ["figure img", "attr", "width", "170"]
25737 ]
25738 }
25739 !! wikitext
25740 [[Image:Foobar.jpg|thumb]]
25741 !! wikitext/edited
25742 [[Image:Foobar.jpg|thumb|170x170px]]
25743 !!end
25744
25745 !! test
25746 Image: Modifying alignment of an image (bug 48665)
25747 !! options
25748 parsoid={
25749 "modes": ["wt2wt"],
25750 "changes": [
25751 ["figure[class]", "removeClass", "mw-halign-right"],
25752 ["figure[class]", "addClass", "mw-halign-left"]
25753 ]
25754 }
25755 !! wikitext
25756 [[Image:Foobar.jpg|thumb|caption|right]]
25757 !! wikitext/edited
25758 [[Image:Foobar.jpg|thumb|caption|left]]
25759 !! end
25760
25761 !! test
25762 Image: Modifying mw-default-size of an frameless image (bug 62805)
25763 !! options
25764 parsoid={
25765 "modes": ["wt2wt"],
25766 "changes": [
25767 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25768 ]
25769 }
25770 !! wikitext
25771 [[Image:Foobar.jpg|frameless|right]]
25772 !! wikitext/edited
25773 [[Image:Foobar.jpg|frameless|right|220x220px]]
25774 !! end
25775
25776 !! test
25777 Image: Modifying valign of an image (bug 49221)
25778 !! options
25779 parsoid={
25780 "modes": ["wt2wt"],
25781 "changes": [
25782 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25783 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25784 ]
25785 }
25786 !! wikitext
25787 [[File:Foobar.jpg|20px|middle]]
25788 !! wikitext/edited
25789 [[File:Foobar.jpg|20px|text-top]]
25790 !! end
25791
25792 !! test
25793 Image: Modifying alt attribute of an image (bug 56400)
25794 !! options
25795 parsoid={
25796 "modes": ["wt2wt"],
25797 "changes": [
25798 ["img[alt]", "attr", "alt", "some alternate edited text"]
25799 ]
25800 }
25801 !! wikitext
25802 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25803 !! wikitext/edited
25804 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25805 !!end
25806
25807 !! test
25808 Image: Modifying caption of an image
25809 !! options
25810 parsoid={
25811 "modes": ["wt2wt"],
25812 "changes": [
25813 ["figcaption", "text", "new caption"]
25814 ]
25815 }
25816 !! wikitext
25817 [[Image:Foobar.jpg|thumb|original caption]]
25818 !! wikitext/edited
25819 [[Image:Foobar.jpg|thumb|new caption]]
25820 !!end
25821
25822 !! test
25823 Image: empty alt attribute (bug 48924)
25824 !! options
25825 parsoid
25826 !! wikitext
25827 [[File:Foobar.jpg|thumb|alt=|bar]]
25828 !! html
25829 <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>
25830 !! end
25831
25832 !! test
25833 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25834 !! options
25835 parsoid=html2wt
25836 language=ar
25837 disabled
25838 !! html/parsoid
25839 <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>
25840 !! wikitext
25841 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25842 !! end
25843
25844 !! test
25845 Image: Block level image should have \n before and after
25846 !! wikitext
25847 123
25848 [[File:Foobar.jpg|right|thumb|150x150px]]
25849 456
25850 !! html/parsoid
25851 <p>123</p>
25852 <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>
25853 <p>456</p>
25854 !!end
25855
25856 !! test
25857 Image: New block level image should have \n before and after (existing content)
25858 !! wikitext
25859 123
25860 [[File:Foobar.jpg|right|thumb|150x150px]]
25861 456
25862 !! html/parsoid
25863 <p>123</p>
25864 <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>
25865 <p>456</p>
25866 !!end
25867
25868 !! test
25869 Image: upright option (parsoid)
25870 !! wikitext
25871 [[File:Foobar.jpg|thumb|upright|caption]]
25872 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25873 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25874 !! html/parsoid
25875 <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>
25876 <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>
25877 <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>
25878 !!end
25879
25880 !! test
25881 Image: upright option is ignored on inline and frame images (parsoid)
25882 !! wikitext
25883 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25884 !! html/parsoid
25885 <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>
25886 !!end
25887
25888 !! test
25889 Image: from basic HTML (1)
25890 !! options
25891 parsoid=html2wt
25892 !! html/parsoid
25893 <span typeof="mw:Image">
25894 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25895 </span>
25896 !! wikitext
25897 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25898 !! end
25899
25900 !! test
25901 Image: from basic HTML (2)
25902 !! options
25903 parsoid=html2wt
25904 !! html/parsoid
25905 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25906 !! wikitext
25907 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25908 !! end
25909
25910 !! test
25911 Image: from basic HTML (3)
25912 !! options
25913 parsoid=html2wt
25914 !! html/parsoid
25915 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25916 !! wikitext
25917 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25918 !! end
25919
25920 !! test
25921 Image: from basic HTML (4)
25922 !! options
25923 parsoid=html2wt
25924 !! html/parsoid
25925 <img src="./File:Foobar.jpg">
25926 !! wikitext
25927 [[File:Foobar.jpg|link=]]
25928 !! end
25929
25930 !! test
25931 Image: Invalid title as link
25932 !! wikitext
25933 [[File:Foobar.jpg|link=<]]
25934 !! html/php
25935 <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>
25936 </p>
25937 !! html/parsoid
25938 <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>
25939 !! end
25940
25941 !! test
25942 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25943 !! options
25944 parsoid=html2wt
25945 !! html/parsoid
25946 <ul>
25947 <li><p>foo</p></li>
25948 </ul>
25949 !! wikitext
25950 * foo
25951 !! end
25952
25953 !! test
25954 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25955 !! options
25956 parsoid=html2wt
25957 !! html/parsoid
25958 <ul> <li>foo</li></ul>
25959 !! wikitext
25960 * foo
25961 !! end
25962
25963 !! test
25964 Don't strip leading whitespace when handling indent-pre suppressing tags
25965 !! options
25966 parsoid=html2wt
25967 !! html/parsoid
25968 <table>
25969 <tr><td> indented row</td></tr>
25970 </table>
25971 <blockquote><p>
25972 <b>This is very bold of you!</b>
25973 </p>
25974 <table><tr><td>
25975 indented cell (no pre-wrapping!)
25976 </td></tr></table>
25977 </blockquote>
25978 <p>foo</p>
25979 <div>bar</div>
25980 !! wikitext
25981 {|
25982 | indented row
25983 |}
25984 <blockquote>
25985 '''This is very bold of you!'''
25986
25987 {|
25988 |
25989 indented cell (no pre-wrapping!)
25990 |}
25991 </blockquote>
25992 foo
25993 <div>bar</div>
25994 !! end
25995
25996 !! test
25997 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25998 !! options
25999 parsoid=html2wt
26000 !! html/parsoid
26001 <p>foo</p>
26002 <span>bar</span>
26003
26004 <span>foo2
26005 </span>bar2
26006
26007 <div>foo</div>
26008 <span>bar</span>
26009
26010 <div>
26011 <span>foo</span>
26012 </div>
26013 !! wikitext
26014 foo
26015
26016 <span>bar</span>
26017
26018 <span>foo2
26019 <nowiki> </nowiki></span>bar2
26020
26021 <div>foo</div>
26022 <nowiki> </nowiki><span>bar</span>
26023
26024 <div>
26025 <nowiki> </nowiki><span>foo</span>
26026 </div>
26027 !! end
26028
26029 !! test
26030 Lists: Dont insert newlines in a serialized list item.
26031 !! options
26032 parsoid=html2wt
26033 !! html/parsoid
26034 <ul><li>a<br>b</li><li>c</li></ul>
26035 !! wikitext
26036 * a<br>b
26037 * c
26038 !! end
26039
26040 !! test
26041 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
26042 !! options
26043 parsoid={
26044 "modes": ["html2wt"],
26045 "scrubWikitext": false
26046 }
26047 !! html/parsoid
26048 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26049 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26050
26051 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26052 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26053
26054 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
26055
26056 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26057 !! wikitext
26058 == hello there [[Category:A1]] ==
26059
26060 == [[Category:A2]] hi pal ==
26061
26062 == <!--foo--> [[Category:A3]] how goes it ==
26063
26064 == it goes well [[Category:A4]] <!--bar--> ==
26065
26066 ==howdy [[Category:A5]]==
26067
26068 == __TOC__ ok ==
26069 !! end
26070
26071 !! test
26072 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
26073 !! options
26074 parsoid={
26075 "modes": ["html2wt"],
26076 "scrubWikitext": true
26077 }
26078 !! html/parsoid
26079 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26080 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26081
26082 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26083 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26084
26085 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26086 !! wikitext
26087 == hello there ==
26088 [[Category:A1]]
26089 [[Category:A2]]
26090
26091 == hi pal ==
26092
26093 <!--foo--> [[Category:A3]]
26094
26095 == how goes it ==
26096
26097 == it goes well ==
26098 [[Category:A4]] <!--bar-->
26099
26100 __TOC__
26101
26102 == ok ==
26103 !! end
26104
26105 !! test
26106 Headings: Don't hoist metas that come from templates
26107 !! options
26108 parsoid={
26109 "modes": ["html2wt"],
26110 "scrubWikitext": true
26111 }
26112 !! html/parsoid
26113 <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>
26114 !! wikitext
26115 == {{echo|foo [[Category:Foo]]}} ==
26116 !! end
26117
26118 !! test
26119 Headings: Category in ref isn't hoisted
26120 !! options
26121 parsoid={
26122 "modes": ["html2wt"],
26123 "scrubWikitext": true
26124 }
26125 !! html/parsoid
26126 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
26127
26128 <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="#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>
26129 !! wikitext
26130 == foo <ref>bar
26131 [[Category:Baz]] </ref> ==
26132
26133 <references />
26134 !! end
26135
26136 !! test
26137 Parsoid: Serialize positional parameters with = in them as named parameter
26138 !! options
26139 parsoid=html2wt
26140 !! html/parsoid
26141 <p about="#mwt1" typeof="mw:Transclusion"
26142 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
26143
26144 <p about="#mwt1" typeof="mw:Transclusion"
26145 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
26146
26147 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26148 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26149 <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>
26150 !! wikitext
26151 {{echo|1=f=oo}}
26152
26153 {{echo|1=f=oo|2=bar}}
26154
26155 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26156 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26157 {{echo|<nowiki>f=oo</nowiki>|bar}}
26158 !! end
26159
26160 !! test
26161 Parsoid: Serialize positional parameters with = in extlink as named parameter
26162 !! options
26163 parsoid=html2wt
26164 !! html/parsoid
26165 <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>
26166 !! wikitext
26167 {{echo|1=http://stuff?is=ok}}
26168 !! end
26169
26170 !! test
26171 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
26172 !! options
26173 parsoid=html2wt
26174 !! html/parsoid
26175 <div>a<p>b</p></div>
26176 <div>a
26177 <p>b</p></div>
26178 <div>
26179 a
26180 <p>b</p></div>
26181 !! wikitext
26182 <div>a
26183 b
26184 </div>
26185 <div>a
26186 b
26187 </div>
26188 <div>
26189 a
26190
26191 b
26192 </div>
26193 !! end
26194
26195 !! test
26196 Substrings resembling wikitext in hrefs should not get nowiki escapes
26197 !! options
26198 parsoid=html2wt
26199 !! html/parsoid
26200 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
26201 !! wikitext
26202 [[Foo''bar''baz]]
26203 !! end
26204
26205 !! test
26206 Enforce single-line context in the serializer
26207 !! options
26208 parsoid=html2wt
26209 !! html/parsoid
26210 <h2>testing
26211 123</h2>
26212
26213 <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">
26214 </span><span about="#mwt1">you</span> </h2>
26215
26216 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
26217
26218 <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="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">hello
26219 there</span></li></ol>
26220
26221 <ul><li>asd
26222 sdf</li></ul>
26223
26224 <ul><li>foo
26225 bar
26226 baz</li>
26227 <li>foo <b>bar</b>
26228 baz</li></ul>
26229
26230 <dl><dt>hi
26231 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
26232 ho</dd></dl>
26233
26234 <dl><dd> <table>
26235 <tbody><tr><td> ha
26236 ha
26237 ha</td></tr>
26238 </tbody></table></dd></dl>
26239 !! wikitext
26240 == testing 123 ==
26241
26242 == hi {{bogus|there
26243 you}} ==
26244
26245 == foo <ref>hello
26246 there</ref> ==
26247
26248 <references />
26249
26250 * asd sdf
26251
26252 * foo bar baz
26253 * foo '''bar''' baz
26254
26255 ; hi ho : hi ho
26256
26257 : {|
26258 | ha
26259 ha
26260 ha
26261 |}
26262 !! end
26263
26264 !! test
26265 Serialize new placeholder space without spans
26266 !! options
26267 parsoid=html2wt
26268 !! html/parsoid
26269 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
26270
26271 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
26272
26273 <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>
26274 !! wikitext
26275 foo : bar
26276
26277 foo : bar
26278
26279 <ref>foo : bar</ref>ok
26280 !! end
26281
26282
26283 #-----------------------
26284 # Tag minimization tests
26285 #-----------------------
26286
26287 !! test
26288 1. I/B quote minimization: wikitext-only tags should be combined
26289 !! options
26290 parsoid=html2wt
26291 !! html/parsoid
26292 <p><i>A</i><i>B</i></p>
26293 <p><b>A</b><b>B</b></p>
26294 <p><i>A</i><b><i>B</i></b></p>
26295 <p><b>A</b><i><b>B</b></i></p>
26296 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
26297 <p><i><b>A</b></i><i><b>B</b></i></p>
26298 <p><i><b>A</b></i><b><i>B</i></b></p>
26299 <p><b><i>A</i></b><i><b>B</b></i></p>
26300 !! wikitext
26301 ''AB''
26302
26303 '''AB'''
26304
26305 ''A'''B'''''
26306
26307 '''A''B'''''
26308
26309 '''A''BC''D'''
26310
26311 '''''AB'''''
26312
26313 '''''AB'''''
26314
26315 '''''AB'''''
26316 !! end
26317
26318 !! test
26319 2. I/B quote minimization: wikitext and html tags should not be combined
26320 !! options
26321 parsoid=html2wt
26322 !! html/parsoid
26323 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26324 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26325 !! wikitext
26326 ''A''<i>B</i>
26327
26328 ''A''<nowiki/>'''<i>B</i>'''
26329 !! end
26330
26331 !! test
26332 3. I/B quote minimization: templated content stops minimization
26333 !! options
26334 parsoid=html2wt
26335 !! html/parsoid
26336 <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>
26337 <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>
26338 !! wikitext
26339 ''A''{{echo|''B''}}
26340
26341 ''A''{{echo|'''''B'''''}}
26342 !! end
26343
26344 !! test
26345 4. I/B quote minimization: new content should be mimimized with adjacent old content
26346 !! options
26347 parsoid=html2wt
26348 !! html/parsoid
26349 <p><i>A</i><i>B</i></p>
26350 <p><b>A</b><b>B</b></p>
26351 <p><i>A</i><b><i>B</i></b></p>
26352 !! wikitext
26353 ''AB''
26354
26355 '''AB'''
26356
26357 ''A'''B'''''
26358 !! end
26359
26360 !! test
26361 5a. Merge adjacent quote nodes if they've been edited
26362 !! options
26363 parsoid={
26364 "modes": ["wt2wt", "selser"],
26365 "changes": [
26366 ["p", "contents", "remove", ":contains('b')"]
26367 ]
26368 }
26369 !! wikitext
26370 ''a''b''c''
26371 !! wikitext/edited
26372 ''ac''
26373 !! end
26374
26375 !! test
26376 5b. Merge adjacent quote nodes if they've been edited
26377 !! options
26378 parsoid={
26379 "modes": ["wt2wt", "selser"],
26380 "changes": [
26381 ["#x", "remove"]
26382 ]
26383 }
26384 !! wikitext
26385 ''a''<span id="x">b</span>''c''
26386 !! wikitext/edited
26387 ''ac''
26388 !! end
26389
26390 !! test
26391 1. Merge adjacent link nodes as long as at least one element is new
26392 !! options
26393 parsoid={
26394 "modes": ["html2wt"],
26395 "scrubWikitext": true
26396 }
26397 !! html/parsoid
26398 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26399 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26400 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26401 !! wikitext
26402 [[Football]]
26403 [[Football]]
26404 [[Football|Foot]][[Football|ball]]
26405 !! end
26406
26407 !! test
26408 2. Merge adjacent link nodes and enable additional normalizations
26409 !! options
26410 parsoid={
26411 "modes": ["html2wt"],
26412 "scrubWikitext": true
26413 }
26414 !! html/parsoid
26415 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26416 !! wikitext
26417 [[Football|''Football'']]
26418 !! end
26419
26420 !! test
26421 3. Don't merge adjacent link nodes if scrubWikitext is false
26422 !! options
26423 parsoid={
26424 "modes": ["html2wt"],
26425 "scrubWikitext": false
26426 }
26427 !! html/parsoid
26428 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26429 !! wikitext
26430 [[Football|Foot]][[Football|ball]]
26431 !! end
26432
26433 #------------------------------
26434 # End of tag minimization tests
26435 #------------------------------
26436
26437 !!test
26438 Bug 54262: New entities
26439 !! options
26440 parsoid=html2wt
26441 !! html/parsoid
26442 <span typeof="mw:Entity">&nbsp;</span>
26443 !! wikitext
26444 &nbsp;
26445 !! end
26446
26447 ## Note that there is no wikitext output for 'unknownproperty' ##
26448 ## Unknown magic words are silently dropped ##
26449
26450 !! test
26451 Magic words
26452 !! options
26453 parsoid=html2wt
26454 !! html/parsoid
26455 <meta property='mw:PageProp/toc' />
26456 <meta property='mw:PageProp/notoc' />
26457 <meta property='mw:PageProp/forcetoc' />
26458 <meta property='mw:PageProp/index' />
26459 <meta property='mw:PageProp/noindex' />
26460 <meta property='mw:PageProp/nogallery' />
26461 <meta property='mw:PageProp/noeditsection' />
26462 <meta property='mw:PageProp/notitleconvert' />
26463 <meta property='mw:PageProp/nocontentconvert' />
26464 <meta property='mw:PageProp/unknownproperty' />
26465 !! wikitext
26466 __TOC__
26467 __NOTOC__
26468 __FORCETOC__
26469 __INDEX__
26470 __NOINDEX__
26471 __NOGALLERY__
26472 __NOEDITSECTION__
26473 __NOTITLECONVERT__
26474 __NOCONTENTCONVERT__
26475 !! end
26476
26477 !! test
26478 Consecutive <pre>s should not get merged
26479 !! options
26480 parsoid=html2wt,html2html
26481 !! html/parsoid
26482 <pre>a</pre><pre>b</pre>
26483
26484 <pre>c
26485 </pre><pre>
26486 d</pre>
26487
26488 <pre>e
26489
26490 </pre><pre>
26491
26492 f</pre>
26493 !! wikitext
26494 a
26495
26496 b
26497
26498 c
26499
26500 d
26501
26502 e
26503
26504
26505
26506 f
26507 !! end
26508
26509 !! test
26510 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26511 !! options
26512 parsoid=html2wt
26513 !! html/parsoid
26514 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26515 !! wikitext
26516 [[Special:BookSources/1234567890|ISBN 1234567895]]
26517 !! end
26518
26519 !! test
26520 Edited RFC links not serializable as RFC links should serialize as extlinks
26521 !! options
26522 parsoid=html2wt
26523 !! html/parsoid
26524 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26525 !! wikitext
26526 [//tools.ietf.org/html/rfc123 New RFC]
26527 !! end
26528
26529 !! test
26530 Edited PMID links not serializable as PMID links should serialize as extlinks
26531 !! options
26532 parsoid=html2wt
26533 !! html/parsoid
26534 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26535 !! wikitext
26536 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26537 !! end
26538
26539 !! test
26540 WTS of autolinks with trailing/surrounding context
26541 !! options
26542 parsoid=html2wt
26543 !! html/parsoid
26544 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26545 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26546 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26547 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26548 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26549 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26550 !! wikitext
26551 http://cscott.net'''foo'''
26552
26553 http://cscott.net<b>foo</b>
26554
26555 '''http://cscott.net'''
26556
26557 '''http://cscott.net '''
26558
26559 '''http://cscott.net<nowiki/>x'''
26560
26561 http://cscott.net<nowiki/>x
26562 !! end
26563
26564 !! test
26565 WTS of autolinks with nowikis (round-trip)
26566 !! wikitext
26567 x<nowiki/>http://cscott.net<nowiki/>x
26568 !! html/parsoid
26569 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26570 !! end
26571
26572 # this is the "easy" test because it leaves in place all the
26573 # data-parsoid information indicating this is an autolink
26574 !! test
26575 WTS of autolinks with escapes (editing)
26576 !! options
26577 parsoid={
26578 "modes": ["wt2wt"],
26579 "changes": [
26580 [ "meta", "remove" ]
26581 ]
26582 }
26583 !! wikitext
26584 x<nowiki/>http://cscott.net<nowiki/>x
26585 !! wikitext/edited
26586 x<nowiki/>http://cscott.net<nowiki/>x
26587 !! end
26588
26589 !! test
26590 WTS of edited autolink-like text (T103364)
26591 !! options
26592 parsoid={
26593 "modes": ["wt2wt"],
26594 "changes": [
26595 [ "span[typeof]", "removeAttr", "typeof" ]
26596 ]
26597 }
26598 !! wikitext
26599 Not a link: <nowiki>http://example.com</nowiki>.
26600 !! wikitext/edited
26601 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26602 !! end
26603
26604 !! test
26605 WTS of newly-authored autolink-like text (T103364)
26606 !! options
26607 parsoid=html2wt
26608 !! html/parsoid
26609 <p>http://example.com is not a link.</p>
26610 !! wikitext
26611 <nowiki>http://example.com</nowiki> is not a link.
26612 !! end
26613
26614 !! test
26615 WTS of autolink-like text after an autolink (T108563)
26616 !! options
26617 parsoid=html2wt
26618 !! html/parsoid
26619 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26620 !! wikitext
26621 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26622 !! end
26623
26624 !! test
26625 Magic links inside links (not autolinked)
26626 !! wikitext
26627 [[Foo|http://example.com]]
26628 [[Foo|RFC 1234]]
26629 [[Foo|PMID 1234]]
26630 [[Foo|ISBN 123456789x]]
26631
26632 [http://foo.com http://example.com]
26633 [http://foo.com RFC 1234]
26634 [http://foo.com PMID 1234]
26635 [http://foo.com ISBN 123456789x]
26636 !! html+tidy
26637 <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>
26638 <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>
26639 !! html/parsoid
26640 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26641 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26642 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26643 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26644
26645 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26646 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26647 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26648 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26649 !! end
26650
26651 !! test
26652 Magic links inside image captions (autolinked)
26653 !! wikitext
26654 [[File:Foobar.jpg|thumb|http://example.com]]
26655 [[File:Foobar.jpg|thumb|RFC 1234]]
26656 [[File:Foobar.jpg|thumb|PMID 1234]]
26657 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26658 !! html+tidy
26659 <div class="thumb tright">
26660 <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>
26661 <div class="thumbcaption">
26662 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26663 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26664 </div>
26665 </div>
26666 <div class="thumb tright">
26667 <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>
26668 <div class="thumbcaption">
26669 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26670 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26671 </div>
26672 </div>
26673 <div class="thumb tright">
26674 <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>
26675 <div class="thumbcaption">
26676 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26677 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26678 </div>
26679 </div>
26680 <div class="thumb tright">
26681 <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>
26682 <div class="thumbcaption">
26683 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26684 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26685 </div>
26686 </div>
26687 !! html/parsoid
26688 <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>
26689 <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>
26690 <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>
26691 <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>
26692 !! end
26693
26694 !! test
26695 WTS of magic word text (T109371)
26696 !! options
26697 parsoid=html2wt
26698 !! html/parsoid
26699 <p>RFC 1234</p>
26700 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26701 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26702 !! wikitext
26703 <nowiki>RFC 1234</nowiki>
26704
26705 [http://foo.com RFC 1234]
26706
26707 [[Foo|RFC 1234]]
26708 !! end
26709
26710 !! test
26711 Edited Redirect link should emit a non-piped wikitext link
26712 !! options
26713 parsoid=html2wt
26714 !! html/parsoid
26715 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26716 !! wikitext
26717 #REDIRECT [[Bar]]
26718 !! end
26719
26720 !! test
26721 T75121: Infer extension name from typeOf if data-mw is not present
26722 !! options
26723 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26724 !! html/parsoid
26725 <div typeOf="mw:Extension/foo"></div>
26726 !! wikitext
26727 <foo />
26728 !! end
26729
26730 # Note that the <p> wrapping isn't present in PHP parser output
26731 # The important thing for this test is that P-wrapping doesn't
26732 # interfere with the <nowiki> protection for leading - in <td>
26733 # (which isn't necessary for <th>).
26734 !! test
26735 T88318: p-wrapped dash in table.
26736 !! options
26737 parsoid=html2wt,wt2wt
26738 !! html/parsoid
26739 <table><tbody>
26740 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26741 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26742 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26743 </tbody></table>
26744 !! wikitext
26745 {|
26746 !-
26747 !-
26748 |-
26749 |<nowiki>-</nowiki>
26750 |<nowiki>- </nowiki>
26751 |-
26752 |<small>-</small>
26753 |<br>
26754 -
26755 |<br>
26756 -
26757 |}
26758 !! html/php+tidy
26759 <table>
26760 <tr>
26761 <th>-</th>
26762 <th>-</th>
26763 </tr>
26764 <tr>
26765 <td>-</td>
26766 <td>-</td>
26767 </tr>
26768 <tr>
26769 <td><small>-</small></td>
26770 <td><br />
26771 <p>-</p>
26772 </td>
26773 <td><br />
26774 <p>-</p>
26775 </td>
26776 </tr>
26777 </table>
26778 !! end
26779
26780 !! test
26781 T149209: WTS: Handle newlines in table cells properly
26782 !! options
26783 parsoid=html2wt
26784 !! html/parsoid
26785 <table>
26786 <tbody>
26787 <tr><td>a
26788 b
26789 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
26790 <tr><td><p>x</p>
26791 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
26792 </tbody></table>
26793 <table>
26794 <tbody>
26795 <tr><th>a
26796 b
26797 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
26798 <tr><th><p>x</h>
26799 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
26800 </tbody></table>
26801 !! wikitext
26802 {|
26803 |a
26804 b
26805 |c
26806 |-
26807 |x
26808 {{!}}y
26809 |}
26810 {|
26811 !a
26812 b
26813 !c
26814 |-
26815 !x
26816 !y
26817 |}
26818 !! end
26819
26820 !! test
26821 T149209: Selser: Handle newlines in table cells properly
26822 !! options
26823 parsoid={
26824 "modes": ["selser"],
26825 "changes": [
26826 [ "#h1", "html", "a\nb\n" ],
26827 [ "#h2", "html", "a\nb\n" ],
26828 [ "#c1", "html", "a\nb\n" ],
26829 [ "#c2", "html", "<p>a</p>" ],
26830 [ "#c3", "html", "<p>a</p>" ]
26831 ]
26832 }
26833 !! wikitext
26834 {|
26835 ! id="h1" |edit-me!!1
26836 |-
26837 ! id="h2" |edit-me||2
26838 |-
26839 | id="c1" |edit-me||3
26840 |-
26841 | id="c2" |edit-me||4
26842 |-
26843 | id="c3" |edit-me||p||q||r
26844 |}
26845 !! wikitext/edited
26846 {|
26847 ! id="h1" |a
26848 b
26849 !1
26850 |-
26851 ! id="h2" |a
26852 b
26853 !2
26854 |-
26855 | id="c1" |a
26856 b
26857 |3
26858 |-
26859 | id="c2" |a
26860 |4
26861 |-
26862 | id="c3" |a
26863 |p||q||r
26864 |}
26865 !! end
26866
26867 !! test
26868 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26869 !! options
26870 parsoid=html2wt
26871 !! html/parsoid
26872 <table id='mwAb'>
26873 <td id='mwAc'>foo</td>
26874 <td id='serialize-this'>bar</td>
26875 </table>
26876 !! wikitext
26877 {|
26878 |foo
26879 | id="serialize-this" |bar
26880 |}
26881 !! end
26882
26883 !! test
26884 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26885 !! options
26886 parsoid=html2wt
26887 !! html/parsoid
26888 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26889 !! wikitext
26890 <div id="hello">ok</div>
26891 !! end
26892
26893 !! test
26894 WTS change modes
26895 !! options
26896 parsoid={
26897 "modes": ["wt2wt"],
26898 "changes": [
26899 [ "#xyz", "before", "<b>before</b> stuff " ],
26900 [ "#xyz", "after", " stuff <i>after</i>" ],
26901 [ "#xyz", "html", "x <b>y</b> z" ]
26902 ]
26903 }
26904 !! wikitext
26905 <span id="xyz">hello</span>
26906 !! wikitext/edited
26907 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26908 !! end
26909
26910 !! test
26911 Never serialize a-tag as html, regardless of what data-parsoid has to say
26912 !! options
26913 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26914 !! html/parsoid
26915 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26916 !! wikitext
26917 [[Foo]]
26918 !! end
26919
26920 ## SSS FIXME: This is broken output nevertheless.
26921 ## What might be a reasonable non-broken output for this?
26922 ## This is an edge case unlikely to be seen in production
26923 ## that I am not wasting more time on this right now.
26924 !! test
26925 Never serialize a-tag as html, no matter what attributes it has
26926 !! options
26927 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26928 !! html/parsoid
26929 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26930 !! wikitext
26931 [http://boo.org http://boohoo.org]
26932 !! end
26933
26934 # Misnested is an indication that selser can reuse the source but these have
26935 # shown to sneak through on occasion. See T101768.
26936 # The original wikitext here is: [http://test.com [[one]] two three]
26937 !! test
26938 Strip span tags added to mark misnested links
26939 !! options
26940 parsoid=html2wt
26941 !! html/parsoid
26942 <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>
26943 !! wikitext
26944 [http://test.com][[one]] two three
26945 !! end
26946
26947 !! test
26948 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26949 !! options
26950 parsoid=html2wt
26951 !! html/parsoid
26952 <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|}"]}'>
26953 <tbody><tr><td>d
26954 </td></tr>
26955 </tbody></table>
26956 !! wikitext
26957 {{echo|a}}
26958 {|{{echo|c
26959 {{!}}d
26960 }}
26961 |}
26962 !! end
26963
26964 ## This test verifies the presence and computation of this attribute indirectly
26965 ## by making an edit and ensuring that the serialization is correct (which it would be
26966 ## only if firstWikitextNode is properly set).
26967 !! test
26968 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26969 !! options
26970 parsoid= {
26971 "modes": ["wt2wt"],
26972 "changes": [
26973 [ "div#x", "remove" ],
26974 [ "div", "before", "<div>new</div>" ]
26975 ]
26976 }
26977 !! wikitext
26978 <div id="x">foo</div>
26979 {|
26980 {{echo|<div>boo</div>
26981 {{!}}b}}
26982 |c
26983 |}
26984 !! wikitext/edited
26985
26986 <div>new</div>
26987 {|
26988 {{echo|<div>boo</div>
26989 {{!}}b}}
26990 |c
26991 |}
26992 !! end
26993
26994 # --------------------------------------------
26995 # Tests spec'ing wikitext serialization norms |
26996 # --------------------------------------------
26997
26998 !! test
26999 1. Categories should always be serialized on their own line
27000 !! options
27001 parsoid=html2wt
27002 !! html/parsoid
27003 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
27004 !! wikitext
27005 foo
27006 [[Category:Foo]]
27007 bar
27008 !! end
27009
27010 !! test
27011 2. Categories that are part of templates should not introduce a line break
27012 !! wikitext
27013 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
27014 !! html/parsoid
27015 <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>
27016 !! end
27017
27018 # Careful while editing these next 2 tests. There are \u200f characters
27019 # before and after the <link> tags in the HTML and following some
27020 # of the categories in wikitext
27021 # Do not remove these characters in edits.
27022 #
27023 # As part of the serialization, these bidi characters will get stripped.
27024 !! test
27025 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
27026 !! options
27027 parsoid={
27028 "modes": ["html2wt"],
27029 "scrubWikitext": true
27030 }
27031 !! html/parsoid
27032 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
27033 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
27034 !! wikitext
27035 [[קטגוריה:טקסים]]
27036 [[קטגוריה: שיטות משפט]]
27037 !! end
27038
27039 !! test
27040 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
27041 !! options
27042 parsoid={
27043 "modes": ["html2wt"],
27044 "scrubWikitext": true
27045 }
27046 !! html/parsoid
27047 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
27048 !! wikitext
27049 [[קטגוריה:טקסים]]
27050 ‏y
27051 !! end
27052
27053 !! test
27054 Lists: Add space after bullets
27055 !! options
27056 parsoid=html2wt
27057 !! html/parsoid
27058 <ul>
27059 <li>foo</li>
27060 <li> bar</li>
27061 <li><span> baz</span></li>
27062 </ul>
27063 !! wikitext
27064 * foo
27065 * bar
27066 * <span> baz</span>
27067 !! end
27068
27069 !! test
27070 1. Headings: Add space before/after == (T53744)
27071 !! options
27072 parsoid=html2wt
27073 !! html/parsoid
27074 <h2>foo</h2>
27075 <h2> bar</h2>
27076 <h2>baz </h2>
27077 <h2><span> baz</span></h2>
27078 !! wikitext
27079 == foo ==
27080
27081 == bar ==
27082
27083 == baz ==
27084
27085 == <span> baz</span> ==
27086 !! end
27087
27088 !! test
27089 2. Headings: Add space before/after == even after hoisted content
27090 !! options
27091 parsoid={
27092 "modes": ["html2wt"],
27093 "scrubWikitext": true
27094 }
27095 !! html/parsoid
27096 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
27097 !! wikitext
27098 [[Category:A2]]
27099
27100 == ok ==
27101 !! end
27102
27103 !! test
27104 1. Headings: suppress newly created empty headings
27105 !! options
27106 parsoid={
27107 "modes": ["html2wt"],
27108 "scrubWikitext": true
27109 }
27110 !! html/parsoid
27111 <h2></h2>
27112 !! wikitext
27113 !! end
27114
27115 !! test
27116 2. Headings: don't suppress empty headings if scrubWikitext is false
27117 !! options
27118 parsoid=html2wt
27119 !! html/parsoid
27120 <h2></h2>
27121 !! wikitext
27122 ==<nowiki/>==
27123 !! end
27124
27125 !! test
27126 3. Headings: suppress empty headings on edits
27127 !! options
27128 parsoid={
27129 "modes": ["selser"],
27130 "scrubWikitext": true,
27131 "changes": [
27132 [ "#x", "remove"]
27133 ]
27134 }
27135 !! wikitext
27136 ==<span id="x">foo</span>==
27137 !! wikitext/edited
27138 !! end
27139
27140 !! test
27141 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
27142 !! options
27143 parsoid={
27144 "modes": ["html2wt"],
27145 "scrubWikitext": true
27146 }
27147 !! html/parsoid
27148 <h2>foo<br/>bar</h2>
27149 <h2>foo <span><br/>bar</span> baz</h2>
27150 !! wikitext
27151 == foo bar ==
27152
27153 == foo <span> bar</span> baz ==
27154 !! end
27155
27156 !! test
27157 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
27158 !! options
27159 parsoid={
27160 "modes": ["html2wt"],
27161 "scrubWikitext": false
27162 }
27163 !! html/parsoid
27164 <h2>foo<br/>bar</h2>
27165 !! wikitext
27166 == foo<br> bar ==
27167 !! end
27168
27169 !! test
27170 1. WT Quote Tags: suppress newly created empty style tags
27171 !! options
27172 parsoid={
27173 "modes": ["html2wt"],
27174 "scrubWikitext": true
27175 }
27176 !! html/parsoid
27177 <i></i><b></b>
27178 !! wikitext
27179 !! end
27180
27181 !! test
27182 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
27183 !! options
27184 parsoid=html2wt
27185 !! html/parsoid
27186 <i></i><b></b>
27187 !! wikitext
27188 ''<nowiki/>'''''<nowiki/>'''
27189 !! end
27190
27191 !! test
27192 3. WT Quote Tags: suppress empty style tags on edits
27193 !! options
27194 parsoid={
27195 "modes": ["selser"],
27196 "scrubWikitext": true,
27197 "changes": [
27198 [ "#x", "remove"]
27199 ]
27200 }
27201 !! wikitext
27202 '''<span id="x">foo</span>'''
27203 !! wikitext/edited
27204 !! end
27205
27206 !! test
27207 1. Anchors: suppress newly created empty anchors
27208 !! options
27209 parsoid={
27210 "modes": ["html2wt"],
27211 "scrubWikitext": true
27212 }
27213 !! html/parsoid
27214 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27215 !! wikitext
27216 !! end
27217
27218 !! test
27219 2. Anchors: don't suppress empty anchors if scrubWikitext is false
27220 !! options
27221 parsoid={
27222 "modes": ["html2wt"],
27223 "scrubWikitext": false
27224 }
27225 !! html/parsoid
27226 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27227 !! wikitext
27228 [[Test|<nowiki/>]]
27229 !! end
27230
27231 !! test
27232 3. Anchors: suppress empty anchors on edits
27233 !! options
27234 parsoid={
27235 "modes": ["selser"],
27236 "scrubWikitext": true,
27237 "changes": [
27238 [ "#x", "remove"]
27239 ]
27240 }
27241 !! wikitext
27242 [[Test|<span id="x">foo</span>]]
27243 !! wikitext/edited
27244 !! end
27245
27246 !! test
27247 3a. Anchors: do not suppress numbered extlinks
27248 !! options
27249 parsoid={
27250 "modes": ["wt2wt"],
27251 "scrubWikitext": true
27252 }
27253 !! wikitext
27254 [http://foo.com]
27255 !! html/parsoid
27256 <a rel="mw:ExtLink" href="http://foo.com"></a>
27257 !! end
27258
27259 !! test
27260 3b. Anchors: do not suppress numbered extlinks
27261 !! options
27262 parsoid={
27263 "modes": ["wt2wt"],
27264 "scrubWikitext": true,
27265 "changes": [
27266 [ "#x", "remove"]
27267 ]
27268 }
27269 !! wikitext
27270 [http://foo.com <span id="x">foo</span>]
27271 !! wikitext/edited
27272 [http://foo.com]
27273 !! end
27274
27275 !!test
27276 Normalizations should be restricted to edited content
27277 !!options
27278 parsoid={
27279 "modes": ["selser"],
27280 "scrubWikitext": true,
27281 "changes": [
27282 [ "h1", "before", "<i></i>"]
27283 ]
27284 }
27285 !!wikitext
27286 a
27287 = =
27288 b
27289 !!wikitext/edited
27290 a
27291 = =
27292 b
27293 !!end
27294
27295 !! test
27296 1. Multiple normalizations (html2wt)
27297 !! options
27298 parsoid={
27299 "modes": ["html2wt"],
27300 "scrubWikitext": true
27301 }
27302 !! html
27303 <h2><i></i></h2>
27304 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27305 </a><b><i></i></b>x</p>
27306 !! wikitext
27307
27308 [[foo]]
27309 x
27310
27311 !! end
27312
27313 !! test
27314 2. Multiple normalizations (selser)
27315 !! options
27316 parsoid={
27317 "modes": ["selser"],
27318 "scrubWikitext": true,
27319 "changes": [
27320 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27321 ]
27322 }
27323 !! wikitext
27324 <span id="x">foo</span>
27325 !! wikitext/edited
27326 <span id="x">foo</span>
27327
27328 x
27329 !! end
27330
27331 !! test
27332 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27333 !! options
27334 parsoid={
27335 "modes": ["html2wt"],
27336 "scrubWikitext": true
27337 }
27338 !! html/parsoid
27339 <p> hi</p>
27340 <p> hello</p>
27341 !! wikitext
27342 hi
27343
27344 hello
27345 !! end
27346
27347 !! test
27348 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27349 !! options
27350 parsoid=html2wt
27351 !! html/parsoid
27352 <p> hi</p>
27353 <p> hello</p>
27354 !! wikitext
27355 <nowiki> </nowiki>hi
27356
27357 <nowiki> </nowiki> hello
27358 !! end
27359
27360 !! test
27361 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27362 !! options
27363 parsoid={
27364 "modes": ["html2wt"],
27365 "scrubWikitext": true
27366 }
27367 !! html/parsoid
27368 <p>Foo
27369 bar
27370 baz</p>
27371
27372 <table><tr><td>Foo
27373 bar
27374 baz bang</td></tr></table>
27375
27376 <p><!--boo--> foo
27377 bar</p>
27378
27379 <p> foo
27380 bar<span>boo</span></p>
27381 !! wikitext
27382 Foo
27383 bar
27384 baz
27385
27386 {|
27387 |Foo
27388 bar
27389 baz bang
27390 |}
27391
27392 <!--boo-->foo
27393 bar
27394
27395 foo
27396 bar<span>boo</span>
27397 !! end
27398
27399 !! test
27400 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27401 !! options
27402 parsoid={
27403 "modes": ["selser"],
27404 "scrubWikitext": true,
27405 "changes": [
27406 [ "p", "html", " a\n b" ]
27407 ]
27408 }
27409 !! wikitext
27410 xyz
27411 !! wikitext/edited
27412 a
27413 b
27414 !! end
27415
27416 !! test
27417 1. New links that end in spaces
27418 !! options
27419 parsoid={
27420 "modes": ["html2wt"],
27421 "scrubWikitext": false
27422 }
27423 !! html/parsoid
27424 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27425 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27426 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27427 !! wikitext
27428 [[Berlin ]]<nowiki/>is the capital of Germany.
27429
27430 [[Foo ]]'''bar'''
27431
27432 [[Boston ]] is a city.
27433 !! end
27434
27435 !! test
27436 2. New links that end in spaces
27437 !! options
27438 parsoid={
27439 "modes": ["html2wt"],
27440 "scrubWikitext": true
27441 }
27442 !! html/parsoid
27443 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27444 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27445 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27446 !! wikitext
27447 [[Berlin]] is the capital of Germany.
27448
27449 [[Foo]] '''bar'''
27450
27451 [[Boston]] is a city.
27452 !! end
27453
27454 !! test
27455 1. Table cells with escapable prefixes
27456 !! options
27457 parsoid={
27458 "modes": ["html2wt"],
27459 "scrubWikitext": false
27460 }
27461 !! html
27462 <table>
27463 <tr><td>a</td></tr>
27464 <tr><td>-</td></tr>
27465 <tr><td>+</td></tr>
27466 </table>
27467 !! wikitext
27468 {|
27469 |a
27470 |-
27471 |<nowiki>-</nowiki>
27472 |-
27473 |<nowiki>+</nowiki>
27474 |}
27475 !! end
27476
27477 !! test
27478 2. Table cells with escapable prefixes
27479 !! options
27480 parsoid={
27481 "modes": ["html2wt"],
27482 "scrubWikitext": true
27483 }
27484 !! html
27485 <table>
27486 <tr><td>a</td></tr>
27487 <tr><td>-</td></tr>
27488 <tr><td>+</td></tr>
27489 </table>
27490 !! wikitext
27491 {|
27492 |a
27493 |-
27494 | -
27495 |-
27496 | +
27497 |}
27498 !! end
27499
27500 !! test
27501 3a. Table cells with escapable prefixes after edits
27502 !! options
27503 parsoid={
27504 "modes": ["selser"],
27505 "scrubWikitext": true,
27506 "changes": [
27507 [ "table tbody tr:first-child td:first-child", "remove"]
27508 ]
27509 }
27510 !! wikitext
27511 {|
27512 |a||-
27513 |}
27514 !! wikitext/edited
27515 {|
27516 | -
27517 |}
27518 !! end
27519
27520 !! test
27521 3b. Table cells with escapable prefixes after edits
27522 !! options
27523 parsoid={
27524 "modes": ["selser"],
27525 "scrubWikitext": true,
27526 "changes": [
27527 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27528 [ "#x", "remove" ]
27529 ]
27530 }
27531 !! wikitext
27532 {|
27533 |pqr
27534 |<span id="x">foo</span>+
27535 |}
27536 !! wikitext/edited
27537 {|
27538 | -
27539 | +
27540 |}
27541 !! end
27542
27543 # FIXME: This test will fail because
27544 # normalization doesn't realize that the id attribute
27545 # will eliminate the escapable scenario
27546 !! test
27547 4a. Table cells without escapable prefixes after edits
27548 !! options
27549 parsoid={
27550 "modes": ["selser"],
27551 "scrubWikitext": true,
27552 "changes": [
27553 [ "#x", "html", "-" ]
27554 ]
27555 }
27556 !! wikitext
27557 {|
27558 | id="x" |abcd
27559 |}
27560 !! wikitext/edited
27561 {|
27562 | id="x" |-
27563 |}
27564 !! end
27565
27566 ## This tests normalizer's ability to discriminate between
27567 ## cells having identical content.
27568 !! test
27569 4b. Table cells without escapable prefixes after edits
27570 !! options
27571 parsoid={
27572 "modes": ["selser"],
27573 "scrubWikitext": true,
27574 "changes": [
27575 [ "td", "html", "-" ]
27576 ]
27577 }
27578 !! wikitext
27579 {|
27580 |a||b
27581 |}
27582 !! wikitext/edited
27583 {|
27584 | -||-
27585 |}
27586 !! end
27587
27588 ## This tests normalizer's ability to not be tripped by
27589 ## comments (and whitespace)
27590 !! test
27591 4c. Table cells without escapable prefixes after edits
27592 !! options
27593 parsoid={
27594 "modes": ["selser"],
27595 "scrubWikitext": true,
27596 "changes": [
27597 [ "table tbody tr td:first-child", "remove" ]
27598 ]
27599 }
27600 !! wikitext
27601 {|
27602 |-
27603 <!--foo--> |a||-
27604 |}
27605 !! wikitext/edited
27606 {|
27607 |-
27608 <!--foo--> | -
27609 |}
27610 !! end
27611
27612 ## This tests normalizer's ability to handle HTML cells
27613 !! test
27614 4d. Table cells without escapable prefixes after edits
27615 !! options
27616 parsoid={
27617 "modes": ["selser"],
27618 "scrubWikitext": true,
27619 "changes": [
27620 [ "td", "html", "-" ]
27621 ]
27622 }
27623 !! wikitext
27624 <table>
27625 <tr><td>a</td></tr>
27626 </table>
27627 !! wikitext/edited
27628 <table>
27629 <tr><td>-</td></tr>
27630 </table>
27631 !! end
27632
27633 ## T111151 Remove font elements without attributes
27634 !! test
27635 5a. font tags without attributes should be dropped in scrubWikitext mode
27636 !! options
27637 parsoid={
27638 "modes": ["html2wt"],
27639 "scrubWikitext": true
27640 }
27641 !! html
27642 <font>foo</font>
27643 <font><font>bar</font></font>
27644 <font class="x">boo</font>
27645 !! wikitext
27646 foo
27647 bar
27648 <font class="x">boo</font>
27649 !! end
27650
27651 !! test
27652 5b. font tags should not be dropped without scrubWikitext being enabled
27653 !! options
27654 parsoid={
27655 "modes": ["html2wt"],
27656 "scrubWikitext": false
27657 }
27658 !! html
27659 <font>foo</font>
27660 !! wikitext
27661 <font>foo</font>
27662 !! end
27663
27664 !! test
27665 Escape nowiki DOM elements
27666 !! options
27667 parsoid=html2wt
27668 !! html/parsoid
27669 <nowiki><i>foo</i></nowiki>
27670 !! wikitext
27671 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27672 !! end
27673
27674 # This is meant to be an interim fix while we go about figuring out
27675 # how to not introduce these trailing <nowiki/>s in the first place.
27676 !! test
27677 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27678 !! options
27679 parsoid=html2wt
27680 !! html/parsoid
27681 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27682 y</p>
27683 <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>
27684 <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>
27685 !! wikitext
27686 x
27687 y
27688
27689 {{echo|
27690 1 = <nowiki/>}}
27691
27692 {{echo|
27693 1 = <nowiki/>
27694 }}
27695 !! end
27696
27697 # ---------------------------------------------------
27698 # End of tests spec'ing wikitext serialization norms |
27699 # ---------------------------------------------------
27700
27701 # T104032
27702 !! test
27703 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27704 !! options
27705 parsoid=html2wt
27706 !! html/parsoid
27707 a<p>b</p>
27708 <b>c</b><p>d</p>
27709 <table><tr>
27710 <td>a<p>b</p></td>
27711 <td><b>c</b><p>d</p></td>
27712 </tr></table>
27713 !! wikitext
27714 a
27715
27716 b
27717
27718 '''c'''
27719
27720 d
27721 {|
27722 |a
27723 b
27724 |'''c'''
27725 d
27726 |}
27727 !! end
27728
27729 # -----------------------------------------------------------------
27730 # End of section for Parsoid-only html2wt tests for serialization
27731 # of new content
27732 # -----------------------------------------------------------------
27733
27734 # -----------------------------------------------------------------
27735 # The following section of tests are primarily to spec behavior of
27736 # the selective serializer. All these tests have manual selser
27737 # changes. The automated selser changes for all tests handle the
27738 # wide variation of changes, but these tests here capture specs
27739 # deterministically.
27740 # ----------------------------------------------------------------
27741
27742 ## T90517
27743 !! test
27744 Selser: New comments should not be lost
27745 !! options
27746 parsoid={
27747 "modes": ["selser"],
27748 "changes": [
27749 [ "#a", "after", "<!--c1-->" ],
27750 [ "#b", "before", "<!--c2-->" ]
27751 ]
27752 }
27753 !! wikitext
27754 <span id="a">a</span>
27755
27756 <span id="b">b</span>
27757 !! wikitext/edited
27758 <span id="a">a</span><!--c1-->
27759
27760 <!--c2--><span id="b">b</span>
27761 !! end
27762
27763 ## T89383
27764 !! test
27765 Selser: Check for validity of DSR before using it
27766 !! options
27767 parsoid={
27768 "modes": ["selser"],
27769 "changes": [
27770 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27771 ]
27772 }
27773 !! wikitext
27774 <span id="a">a</span>
27775 !! wikitext/edited
27776 {{DISPLAYTITLE:foo}}
27777 <span id="a">a</span>
27778 !! end
27779
27780 !! test
27781 1. DOMDiff: Changes to <ref> content should be looked up using id
27782 !! options
27783 parsoid={
27784 "modes": ["selser"],
27785 "changes": [
27786 ["#X", "after", "bar"],
27787 ["#Y", "after", "baz"]
27788 ]
27789 }
27790 !! wikitext
27791 X <ref><span id="X">foo</span></ref>
27792 Y <ref name="a" />
27793 <references>
27794 <ref name="a"><span id="Y">foo</span></ref>
27795 </references>
27796 !! wikitext/edited
27797 X <ref><span id="X">foo</span>bar</ref>
27798 Y <ref name="a" />
27799 <references>
27800 <ref name="a"><span id="Y">foo</span>baz</ref>
27801 </references>
27802 !! end
27803
27804 !! test
27805 2. DOMDiff: Changes to <ref> content should be looked up using id
27806 !! options
27807 parsoid={
27808 "modes": ["selser"],
27809 "changes": [
27810 ["#Z", "after", "bar"]
27811 ]
27812 }
27813 !! wikitext
27814 A <ref>foo bar for a</ref>
27815 B <ref group="X" name="b" />
27816
27817 <references />
27818
27819 <references group="X">
27820 <ref name="b"><span id="Z">foo</span></ref>
27821 </references>
27822 !! wikitext/edited
27823 A <ref>foo bar for a</ref>
27824 B <ref group="X" name="b" />
27825
27826 <references />
27827
27828 <references group="X">
27829 <ref name="b"><span id="Z">foo</span>bar</ref>
27830 </references>
27831 !! end
27832
27833 !! test
27834 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27835 !! options
27836 parsoid={
27837 "modes": ["selser"],
27838 "changes": [
27839 [ "div:first-child", "text", "bar" ]
27840 ]
27841 }
27842 !! wikitext
27843 <div style="{{1x|color:red;}}%">foo</div>
27844 !! wikitext/edited
27845 <div style="{{1x|color:red;}}%">bar</div>
27846 !! end
27847
27848 !! test
27849 Empty LI (T49673)
27850 !! wikitext
27851 * a
27852 *
27853 *
27854 * b
27855 !! html/php+tidy
27856 <ul>
27857 <li>a</li>
27858 <li class="mw-empty-elt"></li>
27859 <li class="mw-empty-elt"></li>
27860 <li>b</li>
27861 </ul>
27862 !! end
27863
27864 !! test
27865 Thumbnail output
27866 !! wikitext
27867 [[File:Thumb.png|thumb]]
27868 !! html/php+tidy
27869 <div class="thumb tright">
27870 <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>
27871 <div class="thumbcaption">
27872 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27873 </div>
27874 </div>
27875 </div>
27876 !! end
27877
27878 !! test
27879 unclosed internal link XSS (T137264)
27880 !! wikitext
27881 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27882 !! html/php
27883 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27884 </p>
27885 !! html/parsoid
27886 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
27887 !! end