Merge "Add deleted archive titles search"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from https://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 #
36 # You can also set the following parser properties via test options:
37 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
38 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
39 # wgEnableMagicLinks
40 #
41 # For testing purposes, temporary articles can created:
42 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
43 # where '/' denotes a newline.
44
45 # This is the standard article assumed to exist.
46 !! article
47 Main Page
48 !! text
49 blah blah
50 !! endarticle
51
52 !!article
53 Foo
54 !!text
55 FOO
56 !!endarticle
57
58 !!article
59 Template:Foo
60 !!text
61 FOO
62 !!endarticle
63
64 !! article
65 Template:Blank
66 !! text
67 !! endarticle
68
69 !! article
70 Template:pipe
71 !! text
72 |
73 !! endarticle
74
75 !! article
76 Template:=
77 !! text
78 <nowiki>=</nowiki>
79 !! endarticle
80
81 !!article
82 MediaWiki:bad image list
83 !!text
84 * [[File:Bad.jpg]] except [[Nasty page]]
85 !!endarticle
86
87 !! article
88 Template:inner list
89 !! text
90 * item 1
91 !! endarticle
92
93 !! article
94 Template:tbl-start
95 !! text
96 {|
97 !! endarticle
98
99 !! article
100 Template:tbl-end
101 !! text
102 |}
103 !! endarticle
104
105 !! article
106 Template:echo
107 !! text
108 {{{1}}}
109 !! endarticle
110
111 !! article
112 Template:echo_with_span
113 !! text
114 <span>{{{1}}}</span>
115 !! endarticle
116
117 !! article
118 Template:echo_with_div
119 !! text
120 <div>{{{1}}}</div>
121 !! endarticle
122
123 !! article
124 Template:blank_param
125 !! text
126 {{{1}}}
127 {{{}}}
128 !! endarticle
129
130 !! article
131 Template:table_attribs
132 !! text
133 <noinclude>
134 |</noinclude>style="color:red;"|Foo
135 !! endarticle
136
137 !! article
138 Template:table_attribs_2
139 !! text
140 <noinclude>
141 |</noinclude>style="color:red;"|Foo
142 |Bar||Baz
143 !! endarticle
144
145 !! article
146 Template:table_attribs_3
147 !! text
148 <noinclude>
149 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
150 !! endarticle
151
152 !! article
153 Template:table_attribs_4
154 !! text
155 | style="background-color:#DC241f;" width="10px" |
156 !! endarticle
157
158 !! article
159 Template:table_attribs_5
160 !! text
161 <noinclude>
162 |</noinclude>style="color:red;"||Bar
163 !! endarticle
164
165 !! article
166 Template:table_attribs_6
167 !! text
168 style="background: <nowiki>
169
170
171 red;</nowiki>" |
172 !! endarticle
173
174 !! article
175 Template:table_attribs_7
176 !! text
177 <noinclude>
178 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
179 !! endarticle
180
181 !! article
182 Template:table_header_cells
183 !! text
184 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
185 !! endarticle
186
187 !! article
188 Template:table_cells
189 !! text
190 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
191 !! endarticle
192
193 !! article
194 Template:PartialTable
195 !! text
196 {|
197 |-
198 !! endarticle
199
200 !! article
201 Template:image_attribs
202 !! text
203 <noinclude>
204 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
205 !! endarticle
206
207 ## See T48811 for details
208 !! article
209 Template:mixed_attr_content_template
210 !! text
211 style="color:red;" title="T48811"
212 |-
213 |foo
214 !! endarticle
215
216 !! article
217 Template:definition_list
218 !! text
219 one
220 ::two
221 !! endarticle
222
223 !! article
224 A?b
225 !! text
226 Weirdo titles!
227 !! endarticle
228
229 !!article
230 Template:Bullet
231 !!text
232 * Bar
233 !!endarticle
234
235 !!article
236 Template:OpenTable
237 !!text
238 {|
239 !!endarticle
240
241 !!article
242 Template:EmptyLITest
243 !!text
244 *a
245 *
246 *
247 *b
248 !!endarticle
249
250 !!article
251 Template:EmptyTRTest
252 !!text
253 {|
254 |-
255 |-
256 |foo
257 |-
258 |-
259 |bar
260 |}
261 !!endarticle
262
263 !!article
264 Template:EmptyTRWithHTMLAttrTest
265 !!text
266 <table>
267 <tr align="center"></tr>
268 <tr><td>foo</td></tr>
269 <tr align="center"></tr>
270 <tr><td>bar</td></tr>
271 </table>
272 !!endarticle
273
274 !! article
275 Template:CircularRef
276 !! text
277 <ref>{{CircularRef}}</ref>
278 !! endarticle
279
280 ###
281 ### Basic tests
282 ###
283 !! test
284 Blank input
285 !! wikitext
286 !! html
287 !! end
288
289 !! test
290 CircularRef
291 !! wikitext
292 {{CircularRef}}
293 <references />
294 !! html/parsoid
295 <p><span about="#mwt1" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"CircularRef","href":"./Template:CircularRef"},"params":{},"i":0}}]}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
296 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">Error: Expansion loop detected at <a data-parsoid='{"a":{"href":null},"sa":{"href":"Template:CircularRef"}}'>Template:CircularRef</a></span></li></ol>
297 !! end
298
299 !! test
300 Simple paragraph
301 !! wikitext
302 This is a simple paragraph.
303 !! html
304 <p>This is a simple paragraph.
305 </p>
306 !! end
307
308 !! test
309 Paragraphs with extra newline spacing
310 !! wikitext
311 foo
312
313 bar
314
315
316 baz
317
318
319
320 booz
321 !! html
322 <p>foo
323 </p><p>bar
324 </p><p><br />
325 baz
326 </p><p><br />
327 </p><p>booz
328 </p>
329 !! end
330
331 !! test
332 Paragraphs with newline spacing with comment lines in between
333 !! wikitext
334 ----
335 a
336 <!--foo-->
337 b
338 ----
339 a
340 <!--foo--><!--More than 1 comment, still stripped-->
341 b
342 ----
343 a
344 <!--foo--> <!----> <!-- bar -->
345 b
346 ----
347 a
348 <!--foo-->
349
350 b
351 ----
352 a
353
354 <!--foo-->
355 b
356 ----
357 a
358 <!--foo-->
359
360
361 b
362 ----
363 a
364
365
366 <!--foo-->
367 b
368 ----
369 !! html
370 <hr />
371 <p>a
372 b
373 </p>
374 <hr />
375 <p>a
376 b
377 </p>
378 <hr />
379 <p>a
380 b
381 </p>
382 <hr />
383 <p>a
384 </p><p>b
385 </p>
386 <hr />
387 <p>a
388 </p><p>b
389 </p>
390 <hr />
391 <p>a
392 </p><p><br />
393 b
394 </p>
395 <hr />
396 <p>a
397 </p><p><br />
398 b
399 </p>
400 <hr />
401
402 !! end
403
404 !! test
405 Paragraphs with newline spacing with non-empty white-space lines in between
406 !! wikitext
407 ----
408 a
409
410 b
411 ----
412 a
413
414
415 b
416 ----
417 !! html
418 <hr />
419 <p>a
420 </p><p>b
421 </p>
422 <hr />
423 <p>a
424 </p><p><br />
425 b
426 </p>
427 <hr />
428
429 !! end
430
431 !! test
432 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
433 !! wikitext
434 ----
435 a
436 <!--foo-->
437 b
438 ----
439 a
440 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
441 b
442 ----
443 a
444
445 <!--foo-->
446 <!--bar-->
447 b
448 ----
449 a
450
451 <!--foo-->
452 <!--bar-->
453
454 b
455 ----
456 !! html
457 <hr />
458 <p>a
459 b
460 </p>
461 <hr />
462 <p>a
463 b
464 </p>
465 <hr />
466 <p>a
467 </p><p>b
468 </p>
469 <hr />
470 <p>a
471 </p><p><br />
472 b
473 </p>
474 <hr />
475
476 !! end
477
478 !! test
479 Extra newlines: More paragraphs with indented comment
480 !! wikitext
481 a
482
483 <!--boo-->
484
485 b
486 !! html
487 <p>a
488 </p><p><br />
489 b
490 </p>
491 !!end
492
493 !! test
494 Extra newlines followed by heading
495 !! wikitext
496 a
497
498
499
500 =b=
501 [[a]]
502
503
504 =b=
505 !! html
506 <p>a
507 </p><p><br />
508 </p>
509 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
510 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
511 </p><p><br />
512 </p>
513 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
514
515 !! end
516
517 !! test
518 Extra newlines between heading and content are swallowed
519 !! wikitext
520 =b=
521
522
523
524 [[a]]
525 !! html
526 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
527 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
528 </p>
529 !! end
530
531 !! test
532 Heading with line break in nowiki
533 !! options
534 parsoid=wt2html
535 !! wikitext
536 == A <nowiki>B
537 C</nowiki> ==
538 !! html
539 <h2><span class="mw-headline" id="A_B.0AC">A B
540 C</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A B&#10;C">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
541
542 !! html/parsoid
543 <h2 id="A_B.0AC">A <span typeof="mw:Nowiki">B
544 C</span> </h2>
545 !! end
546
547 !! test
548 Parsing an URL
549 !! wikitext
550 http://fr.wikipedia.org/wiki/🍺
551 <!-- EasterEgg we love beer, better be able be able to link to it -->
552 !! html
553 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
554 </p>
555 !! end
556
557 # Note that the html+tidy output removes the spaces after the <li>,
558 # which is a bug (https://sourceforge.net/p/tidy/bugs/945/, etc).
559 # This is an issue for all tests with lists. We intentionally do
560 # *not* add html+tidy clauses for these, as we don't want to
561 # document/test the broken behavior. (Parsoid matches the non-tidy
562 # output in these cases.)
563
564 !! test
565 Simple list
566 !! wikitext
567 * Item 1
568 * Item 2
569 !! html
570 <ul><li> Item 1</li>
571 <li> Item 2</li></ul>
572
573 !! end
574
575 !! test
576 Italics and bold
577 !! wikitext
578 * plain
579 * plain''italic''plain
580 * plain''italic''plain''italic''plain
581 * plain'''bold'''plain
582 * plain'''bold'''plain'''bold'''plain
583 * plain''italic''plain'''bold'''plain
584 * plain'''bold'''plain''italic''plain
585 * plain''italic'''bold-italic'''italic''plain
586 * plain'''bold''bold-italic''bold'''plain
587 * plain'''''bold-italic'''italic''plain
588 * plain'''''bold-italic''bold'''plain
589 * plain''italic'''bold-italic'''''plain
590 * plain'''bold''bold-italic'''''plain
591 * plain l'''italic''plain
592 * plain l''''bold''' plain
593 !! html
594 <ul><li> plain</li>
595 <li> plain<i>italic</i>plain</li>
596 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
597 <li> plain<b>bold</b>plain</li>
598 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
599 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
600 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
601 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
602 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
603 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
604 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
605 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
606 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
607 <li> plain l'<i>italic</i>plain</li>
608 <li> plain l'<b>bold</b> plain</li></ul>
609
610 !! end
611
612 # this example taken from the [[simple:Moon]] article (T49326)
613 !! test
614 Italics and possessives (1)
615 !! wikitext
616 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
617 !! html
618 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
619 </p>
620 !! end
621
622 # this example taken from [[en:Flaming Pie]] (T51926)
623 !! test
624 Italics and possessives (2)
625 !! wikitext
626 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
627 !! html
628 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
629 </p>
630 !! end
631
632 # this example taken from [[en:Dictionary]] (T51926)
633 !! test
634 Italics and possessives (3)
635 !! wikitext
636 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
637 !! html
638 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
639 </p>
640 !! end
641
642
643 ###
644 ### 2-quote opening sequence tests
645 ###
646 !! test
647 Italics and bold: 2-quote opening sequence: (2,2)
648 !! wikitext
649 ''foo''
650 !! html
651 <p><i>foo</i>
652 </p>
653 !!end
654
655 !! test
656 Italics and bold: 2-quote opening sequence: (2,3)
657 !! wikitext
658 ''foo'''
659 !! html/*
660 <p><i>foo'</i>
661 </p>
662 !!end
663
664 !! test
665 Italics and bold: 2-quote opening sequence: (2,4)
666 !! options
667 parsoid=wt2html
668 !! wikitext
669 ''foo''''
670 !! html/*
671 <p><i>foo''</i>
672 </p>
673 !!end
674
675 # same html as previous, but wikitext adjusted to match parsoid html2wt
676 !! test
677 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
678 !! wikitext
679 ''foo<nowiki>''</nowiki>''
680 !! html
681 <p><i>foo''</i>
682 </p>
683 !! end
684
685 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
686 !! test
687 Italics and bold: 2-quote opening sequence: (2,5)
688 !! options
689 parsoid=wt2html
690 !! wikitext
691 ''foo'''''
692 !! html/php
693 <p><i>foo</i>
694 </p>
695 !! html/parsoid
696 <p><i>foo</i><b></b>
697 </p>
698 !!end
699
700 # same html as previous, but wikitext adjusted to match parsoid html2wt
701 !! test
702 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
703 !! wikitext
704 ''foo'''''<nowiki/>'''
705 !! html/php
706 <p><i>foo</i>
707 </p>
708 !! html/parsoid
709 <p><i>foo</i><b></b>
710 </p>
711 !! end
712
713
714 ###
715 ### 3-quote opening sequence tests
716 ###
717
718 !! test
719 Italics and bold: 3-quote opening sequence: (3,2)
720 !! wikitext
721 '''foo''
722 !! html/*
723 <p>'<i>foo</i>
724 </p>
725 !!end
726
727 !! test
728 Italics and bold: 3-quote opening sequence: (3,3)
729 !! wikitext
730 '''foo'''
731 !! html
732 <p><b>foo</b>
733 </p>
734 !!end
735
736 !! test
737 Italics and bold: 3-quote opening sequence: (3,4)
738 !! wikitext
739 '''foo''''
740 !! html/*
741 <p><b>foo'</b>
742 </p>
743 !!end
744
745 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
746 !! test
747 Italics and bold: 3-quote opening sequence: (3,5)
748 !! options
749 parsoid=wt2html
750 !! wikitext
751 '''foo'''''
752 !! html/php
753 <p><b>foo</b>
754 </p>
755 !! html/parsoid
756 <p><b>foo</b><i></i>
757 </p>
758 !!end
759
760 # same html as previous, but wikitext adjusted to match parsoid html2wt
761 !! test
762 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
763 !! wikitext
764 '''foo'''''<nowiki/>''
765 !! html/php
766 <p><b>foo</b>
767 </p>
768 !! html/parsoid
769 <p><b>foo</b><i></i>
770 </p>
771 !! end
772
773
774 ###
775 ### 4-quote opening sequence tests
776 ###
777
778 !! test
779 Italics and bold: 4-quote opening sequence: (4,2)
780 !! options
781 parsoid=wt2html
782 !! wikitext
783 ''''foo''
784 !! html/*
785 <p>''<i>foo</i>
786 </p>
787 !!end
788
789 # same html as previous, but wikitext adjusted to match parsoid html2wt
790 !! test
791 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
792 !! wikitext
793 <nowiki>''</nowiki>''foo''
794 !! html
795 <p>''<i>foo</i>
796 </p>
797 !! end
798
799 !! test
800 Italics and bold: 4-quote opening sequence: (4,3)
801 !! wikitext
802 ''''foo'''
803 !! html/*
804 <p>'<b>foo</b>
805 </p>
806 !!end
807
808 !! test
809 Italics and bold: 4-quote opening sequence: (4,4)
810 !! options
811 parsoid=wt2html
812 !! wikitext
813 ''''foo''''
814 !! html/*
815 <p>'<b>foo'</b>
816 </p>
817 !!end
818
819 # same html as previous, but wikitext adjusted to match parsoid html2wt
820 !! test
821 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
822 !! wikitext
823 '<nowiki/>'''foo''''
824 !! html
825 <p>'<b>foo'</b>
826 </p>
827 !! end
828
829 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
830 !! test
831 Italics and bold: 4-quote opening sequence: (4,5)
832 !! options
833 parsoid=wt2html
834 !! wikitext
835 ''''foo'''''
836 !! html/php
837 <p>'<b>foo</b>
838 </p>
839 !! html/parsoid
840 <p>'<b>foo</b><i></i>
841 </p>
842 !!end
843
844 # same html as previous, but wikitext adjusted to match parsoid html2wt
845 !! test
846 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
847 !! wikitext
848 '<nowiki/>'''foo'''''<nowiki/>''
849 !! html/php
850 <p>'<b>foo</b>
851 </p>
852 !! html/parsoid
853 <p>'<b>foo</b><i></i>
854 </p>
855 !! end
856
857
858 ###
859 ### 5-quote opening sequence tests
860 ###
861
862 !! test
863 Italics and bold: 5-quote opening sequence: (5,2)
864 !! options
865 parsoid=wt2html
866 !! wikitext
867 '''''foo''
868 !! html/*
869 <p><b><i>foo</i></b>
870 </p>
871 !!end
872
873 # same html as previous, but wikitext adjusted to match parsoid html2wt
874 !! test
875 Italics and bold: 5-quote opening sequence: (5,2+3)
876 !! wikitext
877 '''''foo'''''
878 !! html/*
879 <p><i><b>foo</b></i>
880 </p>
881 !! end
882
883 !! test
884 Italics and bold: 5-quote opening sequence: (5,3)
885 !! options
886 parsoid=wt2html
887 !! wikitext
888 '''''foo'''
889 !! html/*
890 <p><i><b>foo</b></i>
891 </p>
892 !!end
893
894 # same html as previous, but wikitext adjusted to match parsoid html2wt
895 !! test
896 Italics and bold: 5-quote opening sequence: (5,3+2)
897 !! wikitext
898 '''''foo'''''
899 !! html
900 <p><i><b>foo</b></i>
901 </p>
902 !! end
903
904 !! test
905 Italics and bold: 5-quote opening sequence: (5,4)
906 !! options
907 parsoid=wt2html
908 !! wikitext
909 '''''foo''''
910 !! html/*
911 <p><i><b>foo'</b></i>
912 </p>
913 !!end
914
915 !! test
916 Italics and bold: 5-quote opening sequence: (5,5)
917 !! wikitext
918 '''''foo'''''
919 !! html
920 <p><i><b>foo</b></i>
921 </p>
922 !!end
923
924 !! test
925 Italics and bold: 5-quote opening sequence: (5,6)
926 !! wikitext
927 '''''foo''''''
928 !! html/*
929 <p><i><b>foo'</b></i>
930 </p>
931 !! end
932
933 ###
934 ### multiple quote sequences in a line
935 ###
936
937 !! test
938 Italics and bold: multiple quote sequences: (2,4,2)
939 !! options
940 parsoid=wt2html
941 !! wikitext
942 ''foo''''bar''
943 !! html/*
944 <p><i>foo'<b>bar</b></i>
945 </p>
946 !! end
947
948 # same html as previous, but wikitext adjusted to match parsoid html2wt
949 !! test
950 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
951 !! wikitext
952 ''foo'<nowiki/>'''bar'''''
953 !! html
954 <p><i>foo'<b>bar</b></i>
955 </p>
956 !! end
957
958 !! test
959 Italics and bold: multiple quote sequences: (2,4,3)
960 !! options
961 parsoid=wt2html
962 !! wikitext
963 ''foo''''bar'''
964 !! html/*
965 <p><i>foo'<b>bar</b></i>
966 </p>
967 !! end
968
969 # same html as previous, but wikitext adjusted to match parsoid html2wt
970 !! test
971 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
972 !! wikitext
973 ''foo'<nowiki/>'''bar'''''
974 !! html
975 <p><i>foo'<b>bar</b></i>
976 </p>
977 !! end
978
979 !! test
980 Italics and bold: multiple quote sequences: (2,4,4)
981 !! options
982 parsoid=wt2html
983 !! wikitext
984 ''foo''''bar''''
985 !! html/*
986 <p><i>foo'<b>bar'</b></i>
987 </p>
988 !! end
989
990 # same html as previous, but wikitext adjusted to match parsoid html2wt
991 !! test
992 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
993 !! wikitext
994 ''foo'<nowiki/>'''bar'<nowiki/>'''''
995 !! html
996 <p><i>foo'<b>bar'</b></i>
997 </p>
998 !! end
999
1000 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1001 !! test
1002 Italics and bold: multiple quote sequences: (3,4,2)
1003 !! options
1004 parsoid=wt2html
1005 !! wikitext
1006 '''foo''''bar''
1007 !! html/php
1008 <p><b>foo'</b>bar
1009 </p>
1010 !! html/parsoid
1011 <p><b>foo'</b>bar<i></i>
1012 </p>
1013 !! end
1014
1015 # same html as previous, but wikitext adjusted to match parsoid html2wt
1016 !! test
1017 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1018 !! wikitext
1019 '''foo''''bar''<nowiki/>''
1020 !! html/php
1021 <p><b>foo'</b>bar
1022 </p>
1023 !! html/parsoid
1024 <p><b>foo'</b>bar<i></i>
1025 </p>
1026 !! end
1027
1028 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1029 !! test
1030 Italics and bold: multiple quote sequences: (3,4,3)
1031 !! options
1032 parsoid=wt2html
1033 !! wikitext
1034 '''foo''''bar'''
1035 !! html/php
1036 <p><b>foo'</b>bar
1037 </p>
1038 !! html/parsoid
1039 <p><b>foo'</b>bar<b></b>
1040 </p>
1041 !! end
1042
1043 # same html as previous, but wikitext adjusted to match parsoid html2wt
1044 !! test
1045 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1046 !! wikitext
1047 '''foo''''bar'''<nowiki/>'''
1048 !! html/php
1049 <p><b>foo'</b>bar
1050 </p>
1051 !! html/parsoid
1052 <p><b>foo'</b>bar<b></b>
1053 </p>
1054 !! end
1055
1056 ###
1057 ### other quote tests
1058 ###
1059 !! test
1060 Italics and bold: other quote tests: (2,3,5)
1061 !! wikitext
1062 ''this is about '''foo's family'''''
1063 !! html
1064 <p><i>this is about <b>foo's family</b></i>
1065 </p>
1066 !!end
1067
1068
1069 !! test
1070 Italics and bold: other quote tests: (2,(3,3),2)
1071 !! wikitext
1072 ''this is about '''foo's''' family''
1073 !! html
1074 <p><i>this is about <b>foo's</b> family</i>
1075 </p>
1076 !!end
1077
1078
1079 !! test
1080 Italics and bold: other quote tests: (3,2,3,2)
1081 !! options
1082 parsoid=wt2html
1083 !! wikitext
1084 '''this is about ''foo'''s family''
1085 !! html/*
1086 <p><b>this is about <i>foo</i></b><i>s family</i>
1087 </p>
1088 !!end
1089
1090
1091 # same html as previous, but wikitext adjusted to match parsoid html2wt
1092 !! test
1093 Italics and bold: other quote tests: (3,2,3+2+2,2)
1094 !! wikitext
1095 '''this is about ''foo'''''<nowiki/>''s family''
1096 !! html
1097 <p><b>this is about <i>foo</i></b><i>s family</i>
1098 </p>
1099 !! end
1100
1101
1102 !! test
1103 Italics and bold: other quote tests: (3,2,3,3)
1104 !! wikitext
1105 '''this is about ''foo'''s family'''
1106 !! html/*
1107 <p>'<i>this is about </i>foo<b>s family</b>
1108 </p>
1109 !!end
1110
1111
1112 !! test
1113 Italics and bold: other quote tests: (3,(2,2),3)
1114 !! wikitext
1115 '''this is about ''foo's'' family'''
1116 !! html
1117 <p><b>this is about <i>foo's</i> family</b>
1118 </p>
1119 !!end
1120
1121
1122 !! test
1123 Italicized possessive
1124 !! wikitext
1125 The ''[[Main Page]]'''s talk page.
1126 !! html/php
1127 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1128 </p>
1129 !! html/parsoid
1130 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1131 !! end
1132
1133 !! test
1134 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1135 (Requires tidy for PHP parser output to be fixed up)
1136 !! options
1137 parsoid=wt2html,wt2wt
1138 !! wikitext
1139 {|
1140 !''a!!''b
1141 |''a||''b
1142 |}
1143 !! html/php+tidy
1144 <table>
1145 <tr>
1146 <th><i>a</i></th>
1147 <th><i>b</i></th>
1148 <td><i>a</i></td>
1149 <td><i>b</i></td>
1150 </tr>
1151 </table>
1152 !! html/parsoid
1153 <table>
1154 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1155 <td><i>a</i></td><td><i>b</i></td></tr>
1156 </tbody></table>
1157 !! end
1158
1159 ###
1160 ### Non-html5 tags
1161 ###
1162
1163 !! test
1164 Non-html5 tags should be accepted
1165 !! wikitext
1166 <center>''foo''</center>
1167 <big>''foo''</big>
1168 <font>''foo''</font>
1169 <strike>''foo''</strike>
1170 <tt>''foo''</tt>
1171 !! html
1172 <center><i>foo</i></center>
1173 <p><big><i>foo</i></big>
1174 <font><i>foo</i></font>
1175 <strike><i>foo</i></strike>
1176 <tt><i>foo</i></tt>
1177 </p>
1178 !! end
1179
1180 !! test
1181 <wbr> is valid wikitext (T54468)
1182 !! wikitext
1183 <wbr>
1184 !! html
1185 <p><wbr />
1186 </p>
1187 !! end
1188
1189 # <strike> is HTML4, <s> is HTML4/5.
1190 !! test
1191 <s> or <strike> for strikethrough
1192 !! wikitext
1193 <strike>strike</strike>
1194
1195 <s>s</s>
1196 !! html
1197 <p><strike>strike</strike>
1198 </p><p><s>s</s>
1199 </p>
1200 !! end
1201
1202 ## a not permitted
1203 ## i,b,br omitted
1204 !! test
1205 Text-level semantic html elements in wikitext
1206 !! wikitext
1207 <em>text</em>
1208 <strong>text</strong>
1209 <small>text</small>
1210 <s>text</s>
1211 <cite>text</cite>
1212 <q>text</q>
1213 <dfn>text</dfn>
1214 <abbr>text</abbr>
1215 <data>text</data>
1216 <time>text</time>
1217 <code>text</code>
1218 <var>text</var>
1219 <samp>text</samp>
1220 <kbd>text</kbd>
1221 <sub>text</sub>
1222 <u>text</u>
1223 <mark>text</mark>
1224 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1225 <bdi>text</bdi>
1226 <bdo>text</bdo>
1227 <span>text</span>
1228 <wbr />
1229 !! html
1230 <p><em>text</em>
1231 <strong>text</strong>
1232 <small>text</small>
1233 <s>text</s>
1234 <cite>text</cite>
1235 <q>text</q>
1236 <dfn>text</dfn>
1237 <abbr>text</abbr>
1238 <data>text</data>
1239 <time>text</time>
1240 <code>text</code>
1241 <var>text</var>
1242 <samp>text</samp>
1243 <kbd>text</kbd>
1244 <sub>text</sub>
1245 <u>text</u>
1246 <mark>text</mark>
1247 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1248 <bdi>text</bdi>
1249 <bdo>text</bdo>
1250 <span>text</span>
1251 <wbr />
1252 </p>
1253 !! end
1254
1255 # test cases taken from
1256 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1257 !! test
1258 Ruby markup (W3C-style)
1259 !! wikitext
1260 ; Mono-ruby for individual base characters
1261 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1262 ; Group ruby
1263 : <ruby>今日<rt>きょう</rt></ruby>
1264 ; Jukugo ruby
1265 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1266 ; Inline ruby
1267 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1268 ; Double-sided ruby
1269 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1270 <ruby>
1271 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1272 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1273 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1274 </ruby>
1275 !! html
1276 <dl><dt> Mono-ruby for individual base characters</dt>
1277 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1278 <dt> Group ruby</dt>
1279 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1280 <dt> Jukugo ruby</dt>
1281 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1282 <dt> Inline ruby</dt>
1283 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1284 <dt> Double-sided ruby</dt>
1285 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1286 <p><ruby>
1287 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1288 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1289 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1290 </ruby>
1291 </p>
1292 !! end
1293
1294 # The next two test different paths in the sanitizer.
1295 !! test
1296 Non-word characters don't terminate tag names (T19663, T42670, T54022)
1297 !! wikitext
1298 <blockquote|>a</blockquote>
1299
1300 <b→> doesn't terminate </b→>
1301
1302 <bä> doesn't terminate </bä>
1303
1304 <boo> doesn't terminate </boo>
1305
1306 <s.foo> doesn't terminate </s.foo>
1307
1308 <sub-ID#1>
1309 !! html
1310 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1311 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1312 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1313 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1314 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1315 </p><p>&lt;sub-ID#1&gt;
1316 </p>
1317 !! end
1318
1319 # There is a tidy bug here: https://sourceforge.net/p/tidy/bugs/946/
1320 # If the non-word-character tag made it through the sanitizer, tidy
1321 # would munge it up.
1322 !! test
1323 Non-word characters don't terminate tag names + tidy
1324 !! wikitext
1325 <blockquote|>a</blockquote>
1326
1327 <b→> doesn't terminate </b→>
1328
1329 <bä> doesn't terminate </bä>
1330
1331 <boo> doesn't terminate </boo>
1332
1333 <s.foo> doesn't terminate </s.foo>
1334
1335 <sub-ID#1>
1336 !! html+tidy
1337 <p>&lt;blockquote|&gt;a</p>
1338 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1339 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1340 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1341 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1342 <p>&lt;sub-ID#1&gt;</p>
1343 !! end
1344
1345 ###
1346 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1347 ### This checks that HTML5 tags (with non-word characters in the tag
1348 ### name) make it safely through the parser -- the Sanitizer will
1349 ### munge them later, as it should.
1350 ###
1351 !! test
1352 Non-word characters are valid in extension tags (T19663)
1353 !! wikitext
1354 <tåg>tåg</tåg>
1355 !! html/php
1356 <pre>
1357 'tåg'
1358 array (
1359 )
1360 </pre>
1361
1362 !! html/parsoid
1363 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1364 !! end
1365
1366 !! test
1367 Isolated close tags should be treated as literal text (T54760)
1368 !! options
1369 parsoid=wt2html
1370 !! wikitext
1371 </b>
1372
1373 <s.foo>s</s>
1374 !! html/php+tidy
1375 <p>&lt;s.foo&gt;s</p>
1376 !! html/parsoid
1377 <p>&lt;s.foo&gt;s</p>
1378 !! end
1379
1380 ###
1381 ### Special characters
1382 ###
1383
1384 !! test
1385 Bare pipe character (T54363)
1386 !! wikitext
1387 |
1388 !! html
1389 <p>|
1390 </p>
1391 !! end
1392
1393 !! test
1394 Bare pipe character from a template (T54363)
1395 !! wikitext
1396 {{pipe}}
1397 !! html
1398 <p>|
1399 </p>
1400 !! end
1401
1402 ###
1403 ### <nowiki> test cases
1404 ###
1405
1406 !! test
1407 <nowiki> unordered list
1408 !! wikitext
1409 <nowiki>* This is not an unordered list item.</nowiki>
1410 !! html/php
1411 <p>* This is not an unordered list item.
1412 </p>
1413 !! html/parsoid
1414 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1415 !! end
1416
1417 !! test
1418 <nowiki> spacing
1419 !! wikitext
1420 <nowiki>Lorem ipsum dolor
1421
1422 sed abit.
1423 sed nullum.
1424
1425 :and a colon
1426 </nowiki>
1427 !! html/php
1428 <p>Lorem ipsum dolor
1429
1430 sed abit.
1431 sed nullum.
1432
1433 :and a colon
1434
1435 </p>
1436 !! html/parsoid
1437 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1438
1439 sed abit.
1440 sed nullum.
1441
1442 :and a colon
1443 </span></p>
1444 !! end
1445
1446 !! test
1447 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1448 !! wikitext
1449 <nowiki><span class="error"></nowiki>
1450 !! html/php
1451 <p>&lt;span class="error"&gt;
1452 </p>
1453 !! html/parsoid
1454 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1455 !! end
1456
1457 !! test
1458 nowiki 3
1459 !! wikitext
1460 :There is not nowiki.
1461 :There is <nowiki>nowiki</nowiki>.
1462
1463 #There is not nowiki.
1464 #There is <nowiki>nowiki</nowiki>.
1465
1466 *There is not nowiki.
1467 *There is <nowiki>nowiki</nowiki>.
1468 !! html/php
1469 <dl><dd>There is not nowiki.</dd>
1470 <dd>There is nowiki.</dd></dl>
1471 <ol><li>There is not nowiki.</li>
1472 <li>There is nowiki.</li></ol>
1473 <ul><li>There is not nowiki.</li>
1474 <li>There is nowiki.</li></ul>
1475
1476 !! html/parsoid
1477 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1478 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1479
1480 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1481 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1482
1483 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1484 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1485 !! end
1486
1487 !! test
1488 Entities inside <nowiki>
1489 !! wikitext
1490 <nowiki>&lt;</nowiki>
1491 !! html/php
1492 <p>&lt;
1493 </p>
1494 !! html/parsoid
1495 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
1496 !! end
1497
1498 !! test
1499 Entities inside template parameters
1500 !! wikitext
1501 {{echo|&ndash;}}
1502 !! html/php+tidy
1503 <p>–</p>
1504 !! html/parsoid
1505 <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>
1506 !! end
1507
1508 !! test
1509 Properly escape nowiki when combined with other wiki markup
1510 !! options
1511 parsoid=html2wt
1512 !! html/parsoid
1513 <p>* &lt;/nowiki&gt; tag</p>
1514 !! wikitext
1515 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1516 !! end
1517
1518 !! test
1519 T93824: Put escaped HTML tags inside nowiki
1520 !! options
1521 parsoid=html2wt
1522 !! html/parsoid
1523 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1524 !! wikitext
1525 <nowiki><h2>foo</h2></nowiki>
1526 !! end
1527
1528 !! test
1529 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1530 !! options
1531 parsoid=html2wt
1532 !! html/parsoid
1533 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1534 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1535 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1536 !! wikitext
1537 This text: L'[[Foo]]
1538 This text: L<nowiki>''</nowiki>[[Foo]]
1539 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1540 !! end
1541
1542 # This test fails because wikitext whitespace is not normalized before comparing.
1543 !! test
1544 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1545 !! options
1546 parsoid=html2wt
1547 !! html/parsoid
1548 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1549 </p>
1550 !! wikitext
1551 This text : L<nowiki>''</nowiki>[[Foo]]
1552 !! end
1553
1554 # This test and the next one are html2wt only as they test that incorrect wikitext
1555 # passed in template arguments gets escaped or wrapped in nowikis where required.
1556 !! test
1557 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1558 !! options
1559 parsoid=html2wt
1560 !! html/parsoid
1561 <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>
1562 <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>
1563 !! wikitext
1564 {{echo|foo{{!}}bar}}
1565 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1566 !! end
1567
1568 !! test
1569 T53961: Output correct nowikis in template arguments
1570 !! options
1571 parsoid=html2wt
1572 !! html/parsoid
1573 <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>
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="#mwt2"></span>
1575 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></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="#mwt4"></span>
1577 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1578 !! wikitext
1579 {{echo|a [ b}}
1580 {{echo|<nowiki>a }} b</nowiki>}}
1581 {{echo|<nowiki>a [[ b</nowiki>}}
1582 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1583 {{echo|a <nowiki>}</nowiki>}}
1584 !! end
1585
1586 !! test
1587 Cases where "!!" needs nowiki protection
1588 !! options
1589 parsoid=html2wt
1590 !! html/parsoid
1591 <table>
1592 <tr><th>this needs protection !! here</th></tr>
1593 </table>
1594
1595 <table>
1596 <tr><th>this does not need
1597 protection !! here</th></tr>
1598 </table>
1599 !! wikitext
1600 {|
1601 !<nowiki>this needs protection !! here</nowiki>
1602 |}
1603
1604 {|
1605 !this does not need
1606 protection !! here
1607 |}
1608 !! end
1609
1610 ###
1611 ### Comments
1612 ###
1613 !! test
1614 Comments and Indent-Pre
1615 !! wikitext
1616 <!-- comment 1 --> asdf
1617
1618 <!-- comment 1 --> asdf
1619 <!-- comment 2 -->
1620
1621 <!-- comment 1 --> asdf
1622 <!-- comment 2 -->xyz
1623
1624 <!-- comment 1 --> asdf
1625 <!-- comment 2 --> xyz
1626 !! html
1627 <pre>asdf
1628 </pre>
1629 <pre>asdf
1630 </pre>
1631 <pre>asdf
1632 </pre>
1633 <p>xyz
1634 </p>
1635 <pre>asdf
1636 xyz
1637 </pre>
1638 !! end
1639
1640 !! test
1641 Comment test 2a
1642 !! wikitext
1643 asdf
1644 <!-- comment 1 -->
1645 jkl
1646 !! html
1647 <p>asdf
1648 jkl
1649 </p>
1650 !! end
1651
1652 !! test
1653 Comment test 2b
1654 !! wikitext
1655 asdf
1656 <!-- comment 1 -->
1657
1658 jkl
1659 !! html
1660 <p>asdf
1661 </p><p>jkl
1662 </p>
1663 !! end
1664
1665 !! test
1666 Comment test 3
1667 !! wikitext
1668 asdf
1669 <!-- comment 1 -->
1670 <!-- comment 2 -->
1671 jkl
1672 !! html
1673 <p>asdf
1674 jkl
1675 </p>
1676 !! end
1677
1678 !! test
1679 Comment test 4
1680 !! wikitext
1681 asdf<!-- comment 1 -->jkl
1682 !! html
1683 <p>asdfjkl
1684 </p>
1685 !! end
1686
1687 !! test
1688 Comment spacing
1689 !! wikitext
1690 a
1691 <!-- foo --> b <!-- bar -->
1692 c
1693 !! html
1694 <p>a
1695 </p>
1696 <pre> b
1697 </pre>
1698 <p>c
1699 </p>
1700 !! end
1701
1702 !! test
1703 Comment whitespace
1704 !! wikitext
1705 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1706 !! html
1707
1708 !! end
1709
1710 !! test
1711 Comment semantics and delimiters
1712 !! wikitext
1713 <!-- --><!----><!-----><!------>
1714 !! html/php
1715
1716 !! html/parsoid
1717 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1718 !! end
1719
1720 !! test
1721 Comment semantics and delimiters, redux
1722 !! wikitext
1723 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1724 -- foo -- funky huh? ... -->
1725 !! html/php
1726
1727 !! html/parsoid
1728 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1729 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1730 !! end
1731
1732 !! test
1733 Comment semantics and delimiters: directors cut
1734 !! wikitext
1735 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1736 everything starting with < followed by !-- until the first -- and > we see,
1737 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1738 -->-->
1739 !! html/php
1740 <p>--&gt;
1741 </p>
1742 !! html/parsoid
1743 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1744 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1745 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1746 --><p>--></p>
1747 !! end
1748
1749 !! test
1750 Comment semantics: nesting
1751 !! wikitext
1752 <!--<!-- no, we're not going to do anything fancy here -->-->
1753 !! html/php
1754 <p>--&gt;
1755 </p>
1756 !! html/parsoid
1757 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1758 !! end
1759
1760 # Parsoid closes the unclosed comment, even if it means a slight
1761 # round-trip diff.
1762 !! test
1763 Comment semantics: unclosed comment at end
1764 !! options
1765 parsoid=wt2html,html2html
1766 !! wikitext
1767 <!--This comment will run out to the end of the document
1768 !! html/php
1769
1770 !! html/parsoid
1771 <!--This comment will run out to the end of the document-->
1772 !! end
1773
1774 !! test
1775 Comment semantics: normalize comments to play nice with XML and browsers
1776 !! wikitext
1777 <!-- Browsers --!> think this is closed -->
1778 <!--> This would normally be text -->
1779 <!---> As would this -->
1780 <!-- XML doesn't like trailing dashes -------->
1781 <!-- Nor doubled hyphens -- anywhere in the data -->
1782 But this is not a comment.
1783 !! html/php
1784 <p>But this is not a comment.
1785 </p>
1786 !! html/parsoid
1787 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1788 <!--&#x3E; This would normally be text -->
1789 <!--&#x2D;&#x3E; As would this -->
1790 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1791 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1792 <p>But this is not a comment.</p>
1793 !! end
1794
1795 !! test
1796 Comment semantics: round-trip even text which contains encoded -->
1797 !! wikitext
1798 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1799 !! html/parsoid
1800 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1801 !! end
1802
1803 !! test
1804 Comment in template title
1805 !! wikitext
1806 {{f<!---->oo}}
1807 !! html
1808 <p>FOO
1809 </p>
1810 !! end
1811
1812 !! test
1813 Comment on its own line post-expand
1814 !! wikitext
1815 a
1816 {{blank}}<!---->
1817 b
1818 !! html
1819 <p>a
1820 </p><p>b
1821 </p>
1822 !! end
1823
1824 !! test
1825 Comment on its own line post-expand with non-significant whitespace
1826 !! wikitext
1827 a
1828 {{blank}} <!---->
1829 b
1830 !! html
1831 <p>a
1832 </p><p>b
1833 </p>
1834 !! end
1835
1836 !! test
1837 Multiple comments should still parse as SOL-transparent
1838 !! options
1839 parsoid=wt2html,wt2wt
1840 !! wikitext
1841 <!--c1-->*a
1842 <!--c2--><!--c3--><!--c4-->*b
1843 !! html/php
1844 <ul><li>a</li>
1845 <li>b</li></ul>
1846
1847 !! html/parsoid
1848 <!--c1--><ul>
1849 <li>a
1850 </li>
1851 <!--c2--><!--c3--><!--c4-->
1852 <li>b
1853 </li>
1854 </ul>
1855 !! end
1856
1857 ###
1858 ### paragraph wrapping tests
1859 ###
1860 !! test
1861 No block tags
1862 !! wikitext
1863 a
1864
1865 b
1866 !! html
1867 <p>a
1868 </p><p>b
1869 </p>
1870 !! end
1871
1872 !! test
1873 Block tag on one line (<div>)
1874 !! wikitext
1875 a <div>foo</div>
1876
1877 b
1878 !! html
1879 a <div>foo</div>
1880 <p>b
1881 </p>
1882 !! html+tidy
1883 <p>a</p>
1884 <div>foo</div>
1885 <p>b</p>
1886 !! end
1887
1888 !! test
1889 Block tag on one line (<blockquote>)
1890 !! wikitext
1891 a <blockquote>foo</blockquote>
1892
1893 b
1894 !! html
1895 a <blockquote>foo</blockquote>
1896 <p>b
1897 </p>
1898 !! html+tidy
1899 <p>a</p>
1900 <blockquote>
1901 <p>foo</p>
1902 </blockquote>
1903 <p>b</p>
1904 !! end
1905
1906 !! test
1907 Block tag on both lines (<div>)
1908 !! wikitext
1909 a <div>foo</div>
1910
1911 b <div>foo</div>
1912 !! html
1913 a <div>foo</div>
1914 b <div>foo</div>
1915
1916 !! html+tidy
1917 <p>a</p>
1918 <div>foo</div>
1919 <p>b</p>
1920 <div>foo</div>
1921 !! end
1922
1923 !! test
1924 Block tag on both lines (<blockquote>)
1925 !! wikitext
1926 a <blockquote>foo</blockquote>
1927
1928 b <blockquote>foo</blockquote>
1929 !! html
1930 a <blockquote>foo</blockquote>
1931 b <blockquote>foo</blockquote>
1932
1933 !! html+tidy
1934 <p>a</p>
1935 <blockquote>
1936 <p>foo</p>
1937 </blockquote>
1938 <p>b</p>
1939 <blockquote>
1940 <p>foo</p>
1941 </blockquote>
1942 !! end
1943
1944 !! test
1945 Multiple lines without block tags
1946 !! wikitext
1947 <div>foo</div> a
1948 b
1949 c
1950 d<!--foo--> e
1951 x <div>foo</div> z
1952 !! html
1953 <div>foo</div> a
1954 <p>b
1955 c
1956 d e
1957 </p>
1958 x <div>foo</div> z
1959
1960 !! html+tidy
1961 <div>foo</div>
1962 <p>a</p>
1963 <p>b c d e</p>
1964 <p>x</p>
1965 <div>foo</div>
1966 <p>z</p>
1967 !! end
1968
1969 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1970 # So, we have a separate section for Parsoid. We don't want
1971 # to mimic this stripping behavior in Parsoid. It affects
1972 # editing experience and also requires us to maintain additional
1973 # info for RT-ing.
1974 !! test
1975 Empty lines between lines with block tags
1976 !! wikitext
1977 <div></div>
1978
1979
1980 <div></div>a
1981
1982 b
1983 <div>a</div>b
1984
1985 <div>b</div>d
1986
1987
1988 <div>e</div>
1989 !! html
1990 <div></div>
1991 <p><br />
1992 </p>
1993 <div></div>a
1994 <p>b
1995 </p>
1996 <div>a</div>b
1997 <div>b</div>d
1998 <p><br />
1999 </p>
2000 <div>e</div>
2001
2002 !! html+tidy
2003 <p><br /></p>
2004 <p>a</p>
2005 <p>b</p>
2006 <div>a</div>
2007 <p>b</p>
2008 <div>b</div>
2009 <p>d</p>
2010 <p><br /></p>
2011 <div>e</div>
2012 !! html/parsoid
2013 <div data-parsoid='{"stx":"html"}'></div>
2014
2015 <p><br /></p>
2016 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2017
2018 <p>b</p>
2019 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2020
2021 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2022
2023 <p><br /></p>
2024 <div data-parsoid='{"stx":"html"}'>e</div>
2025 !! end
2026
2027 ## PHP parser emits output which is broken
2028 !! test
2029 Unclosed HTML p-tags should be handled properly
2030 !! wikitext
2031 <div><p>foo</div>
2032 a
2033
2034 b
2035 !! html/php+tidy
2036 <div>
2037 <p>foo</p>
2038 </div>
2039 <p>a</p>
2040 <p>b</p>
2041 !! html/parsoid
2042 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2043 <p>a</p>
2044 <p>b</p>
2045 !! end
2046
2047 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2048 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2049 ## them for now.
2050 !! test
2051 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2052 !! options
2053 parsoid=wt2html
2054 !! wikitext
2055 a [[Category:A1]] [[Category:A2]]
2056 [[Category:A3]]
2057 [[Category:A4]]
2058 !! html/parsoid
2059 <p>a</p>
2060 <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"/>
2061 !! end
2062
2063 !! test
2064 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2065 !! options
2066 parsoid=wt2html
2067 !! wikitext
2068 [[Category:A1]]a
2069 !! html/parsoid
2070 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2071 !! end
2072
2073 ###
2074 ### Preformatted text
2075 ###
2076 !! test
2077 Preformatted text
2078 !! wikitext
2079 This is some
2080 Preformatted text
2081 With ''italic''
2082 And '''bold'''
2083 And a [[Main Page|link]]
2084 !! html
2085 <pre>This is some
2086 Preformatted text
2087 With <i>italic</i>
2088 And <b>bold</b>
2089 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2090 </pre>
2091 !! end
2092
2093 !! test
2094 Tabs don't trigger preformatted text
2095 !! wikitext
2096 This is not
2097 preformatted text.
2098 This is preformatted text.
2099 So is this.
2100 !! html/php
2101 <p> This is not
2102 preformatted text.
2103 </p>
2104 <pre>This is preformatted text.
2105 So is this.
2106 </pre>
2107 !! html/parsoid
2108 <p> This is not
2109 preformatted text.</p>
2110 <pre>This is preformatted text.
2111 So is this.</pre>
2112 !! end
2113
2114 !! test
2115 Space before tab needs nowiki pre protection
2116 !! options
2117 parsoid=html2wt
2118 !! html/parsoid
2119 <p> a</p>
2120 !! wikitext
2121 <nowiki> </nowiki> a
2122 !! end
2123
2124 !! test
2125 Ident preformatting with inline content
2126 !! wikitext
2127 a
2128 ''b''
2129 !! html
2130 <pre>a
2131 <i>b</i>
2132 </pre>
2133 !! end
2134
2135 !! test
2136 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2137 !! wikitext
2138 <pre><nowiki>
2139 <b>
2140 <cite>
2141 <em>
2142 </nowiki></pre>
2143 !! html
2144 <pre>
2145 &lt;b&gt;
2146 &lt;cite&gt;
2147 &lt;em&gt;
2148 </pre>
2149
2150 !! end
2151
2152 !! test
2153 Regression with preformatted in <center>
2154 !! wikitext
2155 <center>
2156 Blah
2157 </center>
2158 !! html
2159 <center>
2160 <pre>Blah
2161 </pre>
2162 </center>
2163
2164 !! end
2165
2166 !! test
2167 T54763: Preformatted in <blockquote>
2168 !! wikitext
2169 <blockquote>
2170 Blah
2171 {|
2172 |
2173 indented cell (no pre-wrapping!)
2174 |}
2175 </blockquote>
2176 !! html
2177 <blockquote>
2178 <p> Blah
2179 </p>
2180 <table>
2181 <tr>
2182 <td>
2183 <p> indented cell (no pre-wrapping!)
2184 </p>
2185 </td></tr></table>
2186 </blockquote>
2187
2188 !! end
2189
2190 !! test
2191 T53086: Double newlines in blockquotes should be turned into paragraphs
2192 !! wikitext
2193 <blockquote>
2194 Foo
2195
2196 Bar
2197 </blockquote>
2198 !! html
2199 <blockquote>
2200 <p>Foo
2201 </p><p>Bar
2202 </p>
2203 </blockquote>
2204
2205 !! end
2206
2207 !! test
2208 T17491: <ins>/<del> in blockquote
2209 !! wikitext
2210 <blockquote>
2211 Foo <del>bar</del> <ins>baz</ins> quux
2212 </blockquote>
2213 !! html
2214 <blockquote>
2215 <p>Foo <del>bar</del> <ins>baz</ins> quux
2216 </p>
2217 </blockquote>
2218
2219 !! end
2220
2221 # Note that the p-wrapping is newline sensitive, which could be
2222 # considered a bug: tidy will wrap only the 'Foo' in the example
2223 # below in a <p> tag. (see comment 23-25 of T8200)
2224 !! test
2225 T17491: <ins>/<del> in blockquote (2)
2226 !! wikitext
2227 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2228 </blockquote>
2229 !! html
2230 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2231 </blockquote>
2232
2233 !! html+tidy
2234 <blockquote>
2235 <p>Foo</p>
2236 <del>bar</del> <ins>baz</ins> quux</blockquote>
2237 !! end
2238
2239 !! test
2240 <pre> with attributes (T5202)
2241 !! wikitext
2242 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2243 !! html
2244 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2245
2246 !! end
2247
2248 !! test
2249 <pre> with width attribute (T5202)
2250 !! wikitext
2251 <pre width="8">Narrow screen goodies</pre>
2252 !! html
2253 <pre width="8">Narrow screen goodies</pre>
2254
2255 !! end
2256
2257 !! test
2258 <pre> with forbidden attribute (T5202)
2259 !! wikitext
2260 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2261 !! html
2262 <pre width="8">Narrow screen goodies</pre>
2263
2264 !! end
2265
2266 !! test
2267 Entities inside <pre>
2268 !! wikitext
2269 <pre>&lt;</pre>
2270 !! html
2271 <pre>&lt;</pre>
2272
2273 !! end
2274
2275 !! test
2276 <pre> with forbidden attribute values (T5202)
2277 !! wikitext
2278 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2279 !! html
2280 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2281
2282 !! end
2283
2284 !! test
2285 <nowiki> inside <pre> (T15238)
2286 !! wikitext
2287 <pre>
2288 <nowiki>
2289 </pre>
2290 <pre>
2291 <nowiki></nowiki>
2292 </pre>
2293 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2294 !! html
2295 <pre>
2296 &lt;nowiki&gt;
2297 </pre>
2298 <pre>
2299
2300 </pre>
2301 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2302
2303 !! end
2304
2305 !! test
2306 <nowiki> inside of #tag:pre
2307 !! wikitext
2308 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2309 !! html/php
2310 <pre>Foo &#8594;bar</pre>
2311
2312 !! html/parsoid
2313 <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>
2314 !! end
2315
2316 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2317 ## aren't enclosed in nowikis.
2318 !! test
2319 <nowiki> and <pre> preference (first one wins)
2320 !! options
2321 parsoid=wt2html
2322 !! wikitext
2323 <pre>
2324 <nowiki>
2325 </pre>
2326 </nowiki>
2327 </pre>
2328
2329 <nowiki>
2330 <pre>
2331 <nowiki>
2332 </pre>
2333 </nowiki>
2334 </pre>
2335
2336 !! html/php
2337 <pre>
2338 &lt;nowiki&gt;
2339 </pre>
2340 <p>&lt;/nowiki&gt;
2341 &lt;/pre&gt;
2342 </p><p>
2343 &lt;pre&gt;
2344 &lt;nowiki&gt;
2345 &lt;/pre&gt;
2346
2347 &lt;/pre&gt;
2348 </p>
2349 !! html/parsoid
2350 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2351 </pre>
2352 <p>&lt;/nowiki></p>
2353
2354
2355 <p><span typeof="mw:Nowiki">
2356 &lt;pre>
2357 &lt;nowiki>
2358 &lt;/pre>
2359 </span></p>
2360 !! end
2361
2362 !! test
2363 </pre> inside nowiki
2364 !! wikitext
2365 <nowiki></pre></nowiki>
2366 !! html
2367 <p>&lt;/pre&gt;
2368 </p>
2369 !! end
2370
2371 # Parsoid doesn't strip empty tags, like Tidy does.
2372 !! test
2373 Empty pre; pre inside other HTML tags (T56946)
2374 !! wikitext
2375 a
2376
2377 <div><pre>
2378 foo
2379 </pre></div>
2380 <pre></pre>
2381 !! html/php
2382 <p>a
2383 </p>
2384 <div><pre>
2385 foo
2386 </pre></div>
2387 <pre></pre>
2388
2389 !! html/php+tidy
2390 <p>a</p>
2391 <div>
2392 <pre>
2393 foo
2394 </pre></div>
2395 !! html/parsoid
2396 <p>a</p>
2397
2398 <div data-parsoid='{"stx":"html"}'><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
2399 </pre></div>
2400 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2401 !! end
2402
2403 !! test
2404 HTML pre followed by indent-pre
2405 !! wikitext
2406 <pre>foo</pre>
2407 bar
2408 !! html
2409 <pre>foo</pre>
2410 <pre>bar
2411 </pre>
2412 !! end
2413
2414 # Note that tidy removes the empty <p> tags from the start and end.
2415 # Parsoid does not, by design.
2416 !! test
2417 Block tag pre
2418 !! wikitext
2419 <p><pre>foo</pre></p>
2420 !! html/php+tidy
2421 <pre>
2422 foo
2423 </pre>
2424 !! html/parsoid
2425 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2426 !! end
2427
2428 !!test
2429 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2430 !! wikitext
2431 {{echo|}}
2432 !! html
2433
2434 !!end
2435
2436 !!test
2437 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2438 !! wikitext
2439 {{echo|
2440 foo}}
2441 !! html
2442 <p>foo
2443 </p>
2444 !!end
2445
2446 !! test
2447 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2448 !! wikitext
2449 {{echo|a
2450 b}}
2451 !! html
2452 <pre>a
2453 </pre>
2454 <p>b
2455 </p>
2456 !!end
2457
2458 !! test
2459 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2460 !! wikitext
2461 {{echo|a
2462 b
2463 c
2464 d
2465 e
2466 }}
2467 !! html
2468 <pre>a
2469 </pre>
2470 <p>b
2471 c
2472 </p>
2473 <pre>d
2474 </pre>
2475 <p>e
2476 </p>
2477 !!end
2478
2479 !!test
2480 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2481 !! wikitext
2482 {{echo| foo}}
2483
2484 {{echo| foo}}{{echo| bar}}
2485
2486 {{echo| foo}}
2487 {{echo| bar}}
2488
2489 {{echo|<!--cmt--> foo}}
2490
2491 <!--cmt-->{{echo| foo}}
2492
2493 {{echo|{{echo| }}bar}}
2494 !! html
2495 <pre>foo
2496 </pre>
2497 <pre>foo bar
2498 </pre>
2499 <pre>foo
2500 bar
2501 </pre>
2502 <pre>foo
2503 </pre>
2504 <pre>foo
2505 </pre>
2506 <pre>bar
2507 </pre>
2508 !!end
2509
2510 !! test
2511 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2512 !! wikitext
2513 {{echo| }}a
2514
2515 {{echo|
2516 }}a
2517
2518 {{echo|
2519 b}}
2520
2521 {{echo|a
2522 }}b
2523
2524 {{echo|a
2525 }} b
2526 !! html
2527 <pre>a
2528 </pre>
2529 <p><br />
2530 </p>
2531 <pre>a
2532 </pre>
2533 <p><br />
2534 </p>
2535 <pre>b
2536 </pre>
2537 <p>a
2538 </p>
2539 <pre>b
2540 </pre>
2541 <p>a
2542 </p>
2543 <pre>b
2544 </pre>
2545 !!end
2546
2547 ## Hmm, should Parsoid rt this?
2548 !! test
2549 Pres with newline attributes
2550 !! options
2551 parsoid=wt2html,html2html
2552 !! wikitext
2553 <pre class="one
2554 two">hi</pre>
2555 !! html/php
2556 <pre class="one two">hi</pre>
2557
2558 !! html/parsoid
2559 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2560 !! end
2561
2562 !! test
2563 Things that look like <pre> tags aren't treated as such
2564 !! wikitext
2565 Barack Obama <President> of the United States
2566 <President></President>
2567 !! html
2568 <p>Barack Obama &lt;President&gt; of the United States
2569 &lt;President&gt;&lt;/President&gt;
2570 </p>
2571 !! end
2572
2573 !! test
2574 Handle broken pre-like tags (T66025)
2575 !! options
2576 parsoid=wt2html
2577 !! wikitext
2578 {{echo|<pre <pre>x</pre>}}
2579
2580 <table><pre </table>
2581 !! html/php
2582 <pre>x</pre>
2583 <table>&lt;pre </table>
2584
2585 !! html/php+tidy
2586 <pre>
2587 x
2588 </pre>
2589 <p>&lt;pre</p>
2590 !! html/parsoid
2591 <pre about="#mwt1" typeof="mw:Transclusion mw:Extension/pre" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2592
2593
2594 <p>&lt;pre </p>
2595
2596 <table></table>
2597 !! end
2598
2599 !! test
2600 Parsoid: handle pre with space after attribute
2601 !! options
2602 parsoid=wt2html
2603 !! wikitext
2604 <pre style="width:50%;" >{{echo|foo}}</pre>
2605 !! html/php
2606 <pre style="width:50%;">{{echo|foo}}</pre>
2607
2608 !! html/parsoid
2609 <pre typeof="mw:Extension/pre" about="#mwt2" style="width:50%;" data-mw='{"name":"pre","attrs":{"style":"width:50%;"},"body":{"extsrc":"{{echo|foo}}"}}'>{{echo|foo}}</pre>
2610 !! end
2611
2612 # TODO / maybe: fix wt2wt for this
2613 !! test
2614 Parsoid: Don't paragraph-wrap fosterable content
2615 !! options
2616 parsoid=wt2html
2617 !! wikitext
2618 {|
2619 <td></td>
2620 <td></td>
2621
2622
2623
2624 |}
2625 !! html
2626 <table>
2627
2628 <tbody>
2629 <tr>
2630 <td></td>
2631
2632 <td></td></tr>
2633
2634
2635
2636 </tbody></table>
2637 !! end
2638
2639 !! test
2640 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2641 !! options
2642 parsoid=wt2html
2643 !! wikitext
2644 {|
2645 <td>
2646 <td>
2647 </td>
2648
2649
2650
2651 |}
2652 !! html
2653 <table>
2654
2655 <tbody>
2656 <tr>
2657 <td></td>
2658
2659 <td>
2660 </td></tr>
2661
2662
2663
2664 </tbody></table>
2665 !! end
2666
2667
2668 #--------------------------------------------------------------------
2669 # Transclusion parameter whitespace stripping tests
2670 # Behavior is different for positional and named parameters
2671 #--------------------------------------------------------------------
2672 !! test
2673 Templates: Strip leading and trailing whitespace from named-param values
2674 !! wikitext
2675 {{echo|1= a }}
2676
2677 {{echo|1= {{echo|b}} }}
2678
2679 {{echo| 1 =
2680 c }}
2681
2682 {{echo| 1 =
2683 * d
2684 }}
2685 !! html
2686 <p>a
2687 </p><p>b
2688 </p><p>c
2689 </p>
2690 <ul><li> d</li></ul>
2691
2692 !! end
2693
2694 !! test
2695 Templates: Don't strip whitespace from positional-param values
2696 !! wikitext
2697 {{echo|a }}
2698
2699 {{echo|{{echo|b}} }}
2700
2701 {{echo| c
2702 }}
2703
2704 {{echo| {{echo|d}}
2705 }}
2706
2707 {{echo|
2708 e}}
2709
2710 {{echo|
2711 * f}}
2712
2713 {{echo|
2714 }}g
2715 !! html
2716 <p>a
2717 </p><p>b
2718 </p>
2719 <pre>c
2720 </pre>
2721 <p><br />
2722 </p>
2723 <pre>d
2724 </pre>
2725 <p><br />
2726 </p>
2727 <pre>e
2728 </pre>
2729 <p><br />
2730 </p>
2731 <ul><li> f</li></ul>
2732 <p><br />
2733 </p>
2734 <pre>g
2735 </pre>
2736 !! end
2737
2738 !! test
2739 Templates: Handle empty comment-and-ws-only lines correctly
2740 !! wikitext
2741 {{echo|foo
2742 <!--should be ignored-->
2743 <!--should be ignored as well-->
2744 bar}}
2745 !! html/php
2746 <p>foo
2747 bar
2748 </p>
2749 !! html/parsoid
2750 <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>
2751 !! end
2752
2753 !! test
2754 Templates: Handle comments in the target
2755 !! wikitext
2756 {{echo
2757 <!-- should be ignored -->
2758 |foo}}
2759
2760 {{echo
2761 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2762 |foo}}
2763
2764 {{echo<!-- should be ignored -->
2765 |foo}}
2766
2767 {{echo<!-- should be ignored -->|foo}}
2768
2769 {{<!-- should be ignored -->echo|foo}}
2770 !! html/php
2771 <p>foo
2772 </p><p>foo
2773 </p><p>foo
2774 </p><p>foo
2775 </p><p>foo
2776 </p>
2777 !! html/parsoid
2778 <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>
2779
2780 <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>
2781
2782 <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>
2783
2784 <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>
2785
2786 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2787 !!end
2788
2789 !! test
2790 Templates: Handle comments in parameter names (T69657)
2791 !! wikitext
2792 {{echo|1
2793 <!-- should be ignored -->
2794 =foo}}
2795
2796 {{echo|
2797 <!-- should be ignored -->
2798 1 = foo}}
2799
2800 {{echo|1<!-- should be ignored -->=foo}}
2801
2802 {{echo|<!-- should be ignored -->1=foo}}
2803 !! html/php
2804 <p>foo
2805 </p><p>foo
2806 </p><p>foo
2807 </p><p>foo
2808 </p>
2809 !! html/parsoid
2810 <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>
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 -->\n1"}}},"i":0}}]}'>foo</p>
2813
2814 <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>
2815
2816 <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>
2817 !!end
2818
2819 !! test
2820 Templates: Other wikitext in parameter names (T69657)
2821 !! wikitext
2822 {{echo|''1''=foo}}
2823 !! html/php
2824 <p>{{{1}}}
2825 </p>
2826 !! html/parsoid
2827 <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>
2828 !!end
2829
2830 #--------------------------------------------------------------------
2831 # Transclusion parameter escaping tests
2832 #--------------------------------------------------------------------
2833 !! test
2834 Templates: Parsoid parameter escaping test 1
2835 !! wikitext
2836 {{echo|[foo]|{{echo|[bar]}}}}
2837 !! html/php+tidy
2838 <p>[foo]</p>
2839 !! html/parsoid
2840 <p about="#mwt1" typeof="mw:Transclusion"
2841 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2842 !! end
2843
2844 !! test
2845 Parsoid: Pipes in external links in template parameter
2846 !! wikitext
2847 {{echo|[{{echo|http://example.com}} link]}}
2848 !! html/php+tidy
2849 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2850 !! html/parsoid
2851 <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>
2852 !! end
2853
2854 !! test
2855 Parsoid: pipe in transclusion parameter
2856 !! wikitext
2857 {{echo|http://foo.com/a&#124;b}}
2858 !! html/php+tidy
2859 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2860 !! html/parsoid
2861 <p><a rel="mw:ExtLink" href="http://foo.com/a%7Cb" about="#mwt1"
2862 typeof="mw:Transclusion"
2863 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a%7Cb</a></p>
2864 !! end
2865
2866 !! test
2867 Parsoid: Pipe in external link target and content in template parameter
2868 !! options
2869 parsoid=html2wt,wt2wt
2870 !! wikitext
2871 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2872 !! html/php+tidy
2873 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2874 !! html/parsoid
2875 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2876 typeof="mw:Transclusion"
2877 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2878 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2879 !! end
2880
2881 !! test
2882 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2883 !! options
2884 parsoid
2885 !! wikitext
2886 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2887 !! html
2888 <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>
2889 !! end
2890
2891 !! test
2892 Templates: Don't escape already nowiki-escaped text in template parameters
2893 !! options
2894 parsoid=html2wt,wt2wt
2895 !! wikitext
2896 {{echo|foo<nowiki>|</nowiki>bar}}
2897 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2898 {{echo|<nowiki></nowiki>}}
2899 !! html/php+tidy
2900 <p>foo|bar &lt;div&gt;</p>
2901 !! html/parsoid
2902 <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>
2903 <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>
2904 <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>
2905 </p>
2906 !! end
2907
2908 ## T54824
2909 !! test
2910 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2911 !! options
2912 parsoid=html2wt,wt2wt
2913 !! wikitext
2914 {{echo|{{echo|1=bar}}}}
2915 !! html/php+tidy
2916 <p>bar</p>
2917 !! html/parsoid
2918 <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>
2919 !! end
2920
2921 ## T58733
2922 !! test
2923 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2924 !! wikitext
2925 {{echo|a : b}}
2926 !! html/php+tidy
2927 <p>a&#160;: b</p>
2928 !! html/parsoid
2929 <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>
2930 !! end
2931
2932 ## T73412
2933 !! test
2934 Templates: Preserve blank parameter names
2935 !! wikitext
2936 {{echo|=foo}}
2937 !! html/php+tidy
2938 <p>{{{1}}}</p>
2939 !! html/parsoid
2940 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2941 !! end
2942
2943 !! test
2944 Templates: Preserve blank parameter names in other positions
2945 !! wikitext
2946 {{blank_param|bar|=foo}}
2947 !! html/php+tidy
2948 <p>bar foo</p>
2949 !! html/parsoid
2950 <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
2951 foo</p>
2952 !! end
2953
2954 ###
2955 ### Parsoid-centric tests for testing RT edge cases for pre
2956 ###
2957
2958 !!test
2959 1a. Indent-Pre and Comments
2960 !! wikitext
2961 a
2962 <!--a-->
2963 c
2964 !! html
2965 <pre>a
2966 </pre>
2967 <p>c
2968 </p>
2969 !!end
2970
2971 !!test
2972 1b. Indent-Pre and Comments
2973 !! wikitext
2974 a
2975 <!--a-->
2976 c
2977 !! html
2978 <pre>a
2979 </pre>
2980 <p>c
2981 </p>
2982 !!end
2983
2984 !!test
2985 1c. Indent-Pre and Comments
2986 !! wikitext
2987 <!--a--> a
2988
2989 <!--a--> a
2990 !! html
2991 <pre> a
2992 </pre>
2993 <pre> a
2994 </pre>
2995 !!end
2996
2997 !!test
2998 1d. Indent-Pre and Comments
2999 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3000 !! wikitext
3001 <!--a--> a
3002
3003 <!--b-->b
3004 !! html
3005 <pre>a
3006 </pre>
3007 <pre>b
3008 </pre>
3009 !!end
3010
3011 !!test
3012 2a. Indent-Pre and tables
3013 !! wikitext
3014 {|
3015 |-
3016 !h1!!h2
3017 |foo||bar
3018 |}
3019 !! html
3020 <table>
3021
3022 <tr>
3023 <th>h1</th>
3024 <th>h2
3025 </th>
3026 <td>foo</td>
3027 <td>bar
3028 </td></tr></table>
3029
3030 !!end
3031
3032 !!test
3033 2b. Indent-Pre and tables
3034 !! wikitext
3035 {|
3036 |-
3037 |foo
3038 |}
3039 !! html
3040 <table>
3041
3042 <tr>
3043 <td>foo
3044 </td></tr></table>
3045
3046 !!end
3047
3048 !!test
3049 2c. Indent-Pre and tables (T44252)
3050 !! wikitext
3051 {|
3052 |+ foo
3053 ! | bar
3054 |}
3055 !! html
3056 <table>
3057 <caption> foo
3058 </caption>
3059 <tr>
3060 <th> bar
3061 </th></tr></table>
3062
3063 !!end
3064
3065 !!test
3066 2d. Indent-Pre and tables
3067 !! wikitext
3068 a
3069 {|
3070 | b
3071 |}
3072 !! html/php
3073 <pre>a
3074 </pre>
3075 <table>
3076 <tr>
3077 <td> b
3078 </td></tr></table>
3079
3080 !! html/parsoid
3081 <pre>a</pre>
3082 <table>
3083 <tbody><tr><td> b</td></tr>
3084 </tbody></table>
3085 !!end
3086
3087 !!test
3088 2e. Indent-Pre and table-line syntax
3089 !! wikitext
3090 a
3091 | b
3092 | c
3093 !! html/php
3094 <pre>a
3095 | b
3096 | c
3097 </pre>
3098 !!end
3099
3100 !!test
3101 2f. Indent-pre started by table-line syntax
3102 !! wikitext
3103 a
3104 | b
3105 | c
3106 !! html/php
3107 <p>a
3108 </p>
3109 <pre>| b
3110 | c
3111 </pre>
3112 !! html/parsoid
3113 <p>a</p>
3114 <pre>
3115 | b
3116 | c</pre>
3117 !!end
3118
3119 !! test
3120 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3121 !! wikitext
3122 <table>
3123 <tr>
3124 <td>
3125 Text that should be rendered preformatted
3126 </td>
3127 </tr>
3128 </table>
3129 !! html
3130 <table>
3131 <tr>
3132 <td>
3133 <pre>Text that should be rendered preformatted
3134 </pre>
3135 </td>
3136 </tr>
3137 </table>
3138
3139 !! end
3140
3141 !!test
3142 3a. Indent-Pre and block tags (single-line html)
3143 !! wikitext
3144 a <p> foo </p>
3145 b <div> foo </div>
3146 c <blockquote> foo </blockquote>
3147 <span> foo </span>
3148 !! html
3149 a <p> foo </p>
3150 b <div> foo </div>
3151 c <blockquote> foo </blockquote>
3152 <pre><span> foo </span>
3153 </pre>
3154 !! html/parsoid
3155 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3156 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3157 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3158 <pre><span> foo </span>
3159 </pre>
3160 !! html+tidy
3161 <p>a</p>
3162 <p>foo</p>
3163 <p>b</p>
3164 <div>foo</div>
3165 <p>c</p>
3166 <blockquote>
3167 <p>foo</p>
3168 </blockquote>
3169 <pre>
3170 <span> foo </span>
3171 </pre>
3172 !! end
3173
3174 !!test
3175 3b. Indent-Pre and block tags (multi-line html)
3176 !! wikitext
3177 a <span>foo</span>
3178 b <div> foo </div>
3179 !! html
3180 <pre>a <span>foo</span>
3181 </pre>
3182 b <div> foo </div>
3183
3184 !! html/parsoid
3185 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3186 b <div data-parsoid='{"stx":"html"}'> foo </div>
3187 !! html+tidy
3188 <pre>
3189 a <span>foo</span>
3190 </pre>
3191 <p>b</p>
3192 <div>foo</div>
3193 !!end
3194
3195 !!test
3196 3c. Indent-Pre and block tags (pre-content on separate line)
3197 !! wikitext
3198 <p>
3199 foo
3200 </p>
3201
3202 <div>
3203 foo
3204 </div>
3205
3206 <center>
3207 foo
3208 </center>
3209
3210 <blockquote>
3211 foo
3212 </blockquote>
3213
3214 <blockquote>
3215 <pre>
3216 foo
3217 </pre>
3218 </blockquote>
3219
3220 <table><tr><td>
3221 foo
3222 </td></tr></table>
3223
3224 <ul><li>
3225 foo
3226 </li></ul>
3227
3228 !! html
3229 <p>
3230 foo
3231 </p>
3232 <div>
3233 <pre>foo
3234 </pre>
3235 </div>
3236 <center>
3237 <pre>foo
3238 </pre>
3239 </center>
3240 <blockquote>
3241 <p> foo
3242 </p>
3243 </blockquote>
3244 <blockquote>
3245 <pre>
3246 foo
3247 </pre>
3248 </blockquote>
3249 <table><tr><td>
3250 <pre>foo
3251 </pre>
3252 </td></tr></table>
3253 <ul><li>
3254 foo
3255 </li></ul>
3256
3257 !!end
3258
3259 !! test
3260 4. Indent-Pre and extension tags
3261 !! wikitext
3262 a <tag />
3263 !! html/php
3264 a <pre>
3265 NULL
3266 array (
3267 )
3268 </pre>
3269
3270 !! html/parsoid
3271 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3272 !! end
3273
3274 !! test
3275 5. Indent-Pre and html pre
3276 !! wikitext
3277 <pre class="123">hi</pre>
3278 !! html/php
3279 <pre class="123">hi</pre>
3280
3281 !! html/parsoid
3282 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3283 !! end
3284
3285 !!test
3286 Render paragraphs when indent-pre is suppressed in blocklevels
3287 !! wikitext
3288 <blockquote>
3289 foo
3290
3291 bar
3292 </blockquote>
3293 !! html
3294 <blockquote>
3295 <p> foo
3296 </p><p> bar
3297 </p>
3298 </blockquote>
3299
3300 !!end
3301
3302 !!test
3303 4. Multiple spaces at start-of-line
3304 !! wikitext
3305 <p> foo </p>
3306 foo
3307 {|
3308 |foo
3309 |}
3310 !! html
3311 <p> foo </p>
3312 <pre> foo
3313 </pre>
3314 <table>
3315 <tr>
3316 <td>foo
3317 </td></tr></table>
3318
3319 !!end
3320
3321 ## NOTE: the leading white-space chars on empty line are significant
3322 !! test
3323 5a. White-space in indent-pre
3324 !! wikitext
3325 a<br />
3326
3327 b
3328 !! html
3329 <pre>a<br />
3330
3331 b
3332 </pre>
3333 !! end
3334
3335 ## NOTE: the leading white-space chars on empty line are significant
3336 !! test
3337 5b. White-space in indent-pre
3338 !! wikitext
3339 a
3340
3341 b
3342
3343
3344 c
3345 !! html
3346 <pre>a
3347
3348 b
3349
3350
3351 c
3352 </pre>
3353 !! end
3354
3355 !! test
3356 5c. White-space in indent-pre
3357 !! wikitext
3358 ''a''
3359 ''b''
3360 ''c''
3361 !! html
3362 <pre><i>a</i>
3363 <i>b</i>
3364 <i>c</i>
3365 </pre>
3366 !! end
3367
3368 !! test
3369 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3370 !! wikitext
3371 a
3372
3373 <!-- continue -->
3374 b
3375
3376 c
3377
3378 d
3379 !! html
3380 <pre>a
3381
3382 b
3383 </pre>
3384 <pre>c
3385
3386 </pre>
3387 <p>d
3388 </p>
3389 !! end
3390
3391 !! test
3392 7a. Indent-pre and category links
3393 !! options
3394 parsoid=wt2html,wt2wt
3395 !! wikitext
3396 [[Category:foo]] <!-- No pre-wrapping -->
3397 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3398 !! html/php+tidy
3399 !! html/parsoid
3400 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3401 <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 -->
3402 !! end
3403
3404 ## We used to, but no longer wt2wt this test since the default serializer
3405 ## will normalize all categories to serialize on their own line.
3406 ## This wikitext usage is going to be fairly uncommon in production and
3407 ## selser will take care of preserving formatting in those scenarios.
3408 !! test
3409 7b. Indent-pre and category links
3410 !! options
3411 parsoid=wt2html
3412 !! wikitext
3413 [[Category:foo]] a
3414 [[Category:foo]] {{echo|b}}
3415 !! html/parsoid
3416 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3417 <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>
3418 !! end
3419
3420 !! test
3421 Indent-Pre: Newlines in comments shouldn't affect sol state
3422 !! wikitext
3423 a <!--
3424 foo
3425 --> b
3426 !! html/php+tidy
3427 <p>a b</p>
3428 !! html/parsoid
3429 <p>a <!--
3430 foo
3431 --> b</p>
3432 !! end
3433
3434 ###
3435 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3436 ###
3437
3438 !!test
3439 HTML-pre: 1. embedded newlines
3440 !! wikitext
3441 <pre>foo</pre>
3442
3443 <pre>
3444 foo
3445 </pre>
3446
3447 <pre>
3448
3449 foo
3450 </pre>
3451
3452 <pre>
3453
3454
3455 foo
3456 </pre>
3457 !! html/php+tidy
3458 <pre>
3459 foo
3460 </pre>
3461 <pre>
3462 foo
3463 </pre>
3464 <pre>
3465
3466 foo
3467 </pre>
3468 <pre>
3469
3470
3471 foo
3472 </pre>
3473 !! html/parsoid
3474 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3475
3476 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3477 </pre>
3478
3479 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3480
3481 foo
3482 </pre>
3483
3484 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3485
3486
3487 foo
3488 </pre>
3489 !!end
3490
3491 !! test
3492 HTML-pre: big spaces
3493 !! wikitext
3494 <pre>
3495
3496
3497
3498
3499 haha
3500
3501
3502
3503
3504 haha
3505
3506
3507
3508
3509 </pre>
3510 !! html/php+tidy
3511 <pre>
3512
3513
3514
3515
3516 haha
3517
3518
3519
3520
3521 haha
3522
3523
3524
3525
3526 </pre>
3527 !! html/parsoid
3528 <pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\n\n\nhaha\n\n\n\n\nhaha\n\n\n\n\n"}}'>
3529
3530
3531
3532
3533 haha
3534
3535
3536
3537
3538 haha
3539
3540
3541
3542
3543 </pre>
3544 !! end
3545
3546 !!test
3547 HTML-pre: 2: indented text
3548 !! wikitext
3549 <pre>
3550 foo
3551 </pre>
3552 !! html
3553 <pre>
3554 foo
3555 </pre>
3556
3557 !!end
3558
3559 !!test
3560 HTML-pre: 3: other wikitext
3561 !! wikitext
3562 <pre>
3563 * foo
3564 # bar
3565 = no-h =
3566 '' no-italic ''
3567 [[ NoLink ]]
3568 </pre>
3569 !! html/php
3570 <pre>
3571 * foo
3572 # bar
3573 = no-h =
3574 '' no-italic ''
3575 [[ NoLink ]]
3576 </pre>
3577
3578 !! html/parsoid
3579 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n* foo\n# bar\n= no-h =\n&#39;&#39; no-italic &#39;&#39;\n[[ NoLink ]]\n"}}'>* foo
3580 # bar
3581 = no-h =
3582 '' no-italic ''
3583 [[ NoLink ]]
3584 </pre>
3585 !!end
3586
3587 ###
3588 ### Definition lists
3589 ###
3590 !! test
3591 Simple definition
3592 !! wikitext
3593 ; name : Definition
3594 !! html
3595 <dl><dt> name&#160;</dt>
3596 <dd> Definition</dd></dl>
3597
3598 !! end
3599
3600 !! test
3601 Definition list for indentation only
3602 !! wikitext
3603 : Indented text
3604 !! html
3605 <dl><dd> Indented text</dd></dl>
3606
3607 !! end
3608
3609 !! test
3610 Definition list with no space
3611 !! wikitext
3612 ;name:Definition
3613 !! html
3614 <dl><dt>name</dt>
3615 <dd>Definition</dd></dl>
3616
3617 !!end
3618
3619 !! test
3620 Definition list with URL link
3621 !! wikitext
3622 ; http://example.com/ : definition
3623 !! html
3624 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3625 <dd> definition</dd></dl>
3626
3627 !! end
3628
3629 !! test
3630 Definition list with bracketed URL link
3631 !! wikitext
3632 ;[http://www.example.com/ Example]:Something about it
3633 !! html
3634 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3635 <dd>Something about it</dd></dl>
3636
3637 !! end
3638
3639 !! test
3640 Definition list with wikilink containing colon
3641 !! wikitext
3642 ; [[Help:FAQ]]: The least-read page on Wikipedia
3643 !! html
3644 <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>
3645 <dd> The least-read page on Wikipedia</dd></dl>
3646
3647 !! end
3648
3649 # At Brion's and JeLuF's insistence... :)
3650 !! test
3651 Definition list with news link containing colon
3652 !! wikitext
3653 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3654 !! html/php
3655 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3656 <dd> This isn't even a real newsgroup!</dd></dl>
3657
3658 !! html/parsoid
3659 <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>
3660 !! end
3661
3662 !! test
3663 Malformed definition list with colon
3664 !! wikitext
3665 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3666 !! html
3667 <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>
3668
3669 !! end
3670
3671 !! test
3672 Definition lists: colon in external link text
3673 !! wikitext
3674 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3675 !! html
3676 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3677 <dd> OK, I made that up</dd></dl>
3678
3679 !! end
3680
3681 !! test
3682 Definition lists: colon in HTML attribute
3683 !! wikitext
3684 ;<b style="display: inline">bold</b>
3685 !! html
3686 <dl><dt><b style="display: inline">bold</b></dt></dl>
3687
3688 !! end
3689
3690 !! test
3691 Definition lists: self-closed tag
3692 !! wikitext
3693 ;one<br/>two : two-line fun
3694 !! html
3695 <dl><dt>one<br />two&#160;</dt>
3696 <dd> two-line fun</dd></dl>
3697
3698 !! end
3699
3700 !! test
3701 Definition lists: ignore colons inside tags
3702 !! wikitext
3703 ;one <b>two : tag <i>fun:</i>:</b>: def
3704 !! html
3705 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
3706 <dd> def</dd></dl>
3707
3708 !! end
3709
3710 !! test
3711 Definition lists: excess closed tags
3712 !! wikitext
3713 ;one</b>two : bad tag fun
3714 !! html/php+tidy
3715 <dl>
3716 <dt>onetwo&#160;</dt>
3717 <dd>bad tag fun</dd>
3718 </dl>
3719 !! html/parsoid
3720 <dl>
3721 <dt>onetwo</dt>
3722 <dd>bad tag fun</dd>
3723 </dl>
3724 !! end
3725
3726 !! test
3727 T13748: Literal closing tags
3728 !! wikitext
3729 <dl>
3730 <dt>test 1</dt>
3731 <dd>test test test test test</dd>
3732 <dt>test 2</dt>
3733 <dd>test test test test test</dd>
3734 </dl>
3735 !! html
3736 <dl>
3737 <dt>test 1</dt>
3738 <dd>test test test test test</dd>
3739 <dt>test 2</dt>
3740 <dd>test test test test test</dd>
3741 </dl>
3742
3743 !! end
3744
3745 !! test
3746 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3747 !! wikitext
3748 <ul><li>
3749 ; term : description
3750 * unordered
3751 </li></ul>
3752 !! html
3753 <ul><li>
3754 <dl><dt> term&#160;</dt>
3755 <dd> description</dd></dl>
3756 <ul><li> unordered</li></ul>
3757 </li></ul>
3758
3759 !! end
3760
3761 !! test
3762 Definition list with empty definition and following paragraph
3763 !! wikitext
3764 ; term:
3765 Paragraph text
3766 !! html
3767 <dl><dt> term</dt>
3768 <dd></dd></dl>
3769 <p>Paragraph text
3770 </p>
3771 !! end
3772
3773 !! test
3774 Nested definition lists using html syntax
3775 !! wikitext
3776 <dl><dt>x</dt>
3777 <dd>a</dd>
3778 <dd>b</dd></dl>
3779 !! html
3780 <dl><dt>x</dt>
3781 <dd>a</dd>
3782 <dd>b</dd></dl>
3783
3784 !! end
3785
3786 !! test
3787 Definition Lists: No nesting: Multiple dd's
3788 !! wikitext
3789 ;x
3790 :a
3791 :b
3792 !! html
3793 <dl><dt>x</dt>
3794 <dd>a</dd>
3795 <dd>b</dd></dl>
3796
3797 !! end
3798
3799 !! test
3800 Definition Lists: Indentation: Regular
3801 !! wikitext
3802 :i1
3803 ::i2
3804 :::i3
3805 !! html
3806 <dl><dd>i1
3807 <dl><dd>i2
3808 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3809
3810 !! end
3811
3812 !! test
3813 Definition Lists: Indentation: Missing 1st level
3814 !! wikitext
3815 ::i2
3816 :::i3
3817 !! html
3818 <dl><dd><dl><dd>i2
3819 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3820
3821 !! end
3822
3823 !! test
3824 Definition Lists: Indentation: Multi-level indent
3825 !! wikitext
3826 :::i3
3827 !! html
3828 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3829
3830 !! end
3831
3832 !! test
3833 Definition Lists: Hacky use to indent tables
3834 !! wikitext
3835 ::{|
3836 |foo
3837 |bar
3838 |}
3839 this text
3840 should be left alone
3841 !! html
3842 <dl><dd><dl><dd><table>
3843 <tr>
3844 <td>foo
3845 </td>
3846 <td>bar
3847 </td></tr></table></dd></dl></dd></dl>
3848 <p>this text
3849 should be left alone
3850 </p>
3851 !! end
3852
3853 !! test
3854 Definition Lists: Hacky use to indent tables, with comments (T65979)
3855 !! wikitext
3856 <!-- foo -->
3857 ::{|
3858 |foo
3859 |bar
3860 |}<!-- bar -->
3861 this text
3862 should be left alone
3863 !! html/parsoid
3864 <!-- foo -->
3865 <dl><dd><dl><dd><table><tr>
3866 <td>foo</td>
3867 <td>bar</td>
3868 </tr></table><!-- bar --></dd></dl></dd></dl>
3869 <p>this text
3870 should be left alone</p>
3871 !! end
3872
3873 !! test
3874 Definition Lists: Hacky use to indent tables, with comment before table
3875 !! wikitext
3876 ::<!-- foo -->{|
3877 |foo
3878 |}
3879 !! html/parsoid
3880 <dl><dd><dl><dd><!-- foo --><table><tr>
3881 <td>foo</td>
3882 </tr></table></dd></dl></dd></dl>
3883 !! end
3884
3885 # The trailing whitespace in this test is to catch a regression in
3886 # Parsoid after T54473.
3887 !! test
3888 Definition Lists: Hacky use to indent tables (WS-insensitive)
3889 !! wikitext
3890 : {|
3891 |a
3892 |}
3893 !! html/php
3894 <dl><dd><table>
3895 <tr>
3896 <td>a
3897 </td></tr></table></dd></dl>
3898
3899 !! html/parsoid
3900 <dl><dd> <table>
3901 <tbody><tr><td>a</td></tr>
3902 </tbody></table> </dd></dl>
3903 !! end
3904
3905 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3906 ## as an empty dt item. It also ignores all but the last ";" when followed
3907 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3908 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3909 ## ";"s.
3910 ##
3911 ## Ex: ";;t2 ::d2" is transformed into:
3912 ##
3913 ## <dl>
3914 ## <dt>t2 </dt>
3915 ## <dd>
3916 ## <dl>
3917 ## <dt></dt>
3918 ## <dd>d2</dd>
3919 ## </dl>
3920 ## </dd>
3921 ## </dl>
3922 ##
3923 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3924 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3925 ##
3926 ## <dl>
3927 ## <dt>
3928 ## <dl>
3929 ## <dt>t2 </dt>
3930 ## <dd>:d2</dd>
3931 ## </dl>
3932 ## </dt>
3933 ## </dl>
3934 ##
3935 ## All Parsoid only definition list tests have this difference.
3936 ##
3937 ## See also: https://phabricator.wikimedia.org/T8569
3938 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3939
3940 !! test
3941 Table / list interaction: indented table with lists in table contents
3942 !! wikitext
3943 :{|
3944 |-
3945 | a
3946 * b
3947 |-
3948 | c
3949 * d
3950 |}
3951 !! html
3952 <dl><dd><table>
3953
3954 <tr>
3955 <td> a
3956 <ul><li> b</li></ul>
3957 </td></tr>
3958 <tr>
3959 <td> c
3960 <ul><li> d</li></ul>
3961 </td></tr></table></dd></dl>
3962
3963 !! end
3964
3965 !!test
3966 Table / list interaction: lists nested in tables nested in indented lists
3967 !! wikitext
3968 :{|
3969 |
3970 :a
3971 :b
3972 |
3973 *c
3974 *d
3975 |}
3976
3977 *e
3978 *f
3979 !! html
3980 <dl><dd><table>
3981 <tr>
3982 <td>
3983 <dl><dd>a</dd>
3984 <dd>b</dd></dl>
3985 </td>
3986 <td>
3987 <ul><li>c</li>
3988 <li>d</li></ul>
3989 </td></tr></table></dd></dl>
3990 <ul><li>e</li>
3991 <li>f</li></ul>
3992
3993 !!end
3994
3995 !! test
3996 Definition Lists: Nesting: Multi-level (Parsoid only)
3997 !! options
3998 parsoid
3999 !! wikitext
4000 ;t1 :d1
4001 ;;t2 ::d2
4002 ;;;t3 :::d3
4003 !! html
4004 <dl>
4005 <dt>t1 </dt>
4006 <dd>d1</dd>
4007 <dt>
4008 <dl>
4009 <dt>t2 </dt>
4010 <dd>:d2</dd>
4011 <dt>
4012 <dl>
4013 <dt>t3 </dt>
4014 <dd>::d3</dd>
4015 </dl>
4016 </dt>
4017 </dl>
4018 </dt>
4019 </dl>
4020
4021
4022 !! end
4023
4024
4025 !! test
4026 Definition Lists: Nesting: Test 2 (Parsoid only)
4027 !! wikitext
4028 ;t1
4029 ::d2
4030 !! html/php+tidy
4031 <dl>
4032 <dt>t1</dt>
4033 <dd>
4034 <dl>
4035 <dd>d2</dd>
4036 </dl>
4037 </dd>
4038 </dl>
4039 !! html/parsoid
4040 <dl>
4041 <dt>t1</dt>
4042 <dd>
4043 <dl>
4044 <dd>d2</dd>
4045 </dl>
4046 </dd>
4047 </dl>
4048
4049 !! end
4050
4051
4052 !! test
4053 Definition Lists: Nesting: Test 3 (Parsoid only)
4054 !! wikitext
4055 :;t1
4056 ::::d2
4057 !! html/php+tidy
4058 <dl>
4059 <dd>
4060 <dl>
4061 <dt>t1</dt>
4062 <dd>
4063 <dl>
4064 <dd>
4065 <dl>
4066 <dd>d2</dd>
4067 </dl>
4068 </dd>
4069 </dl>
4070 </dd>
4071 </dl>
4072 </dd>
4073 </dl>
4074 !! html/parsoid
4075 <dl>
4076 <dd>
4077 <dl>
4078 <dt>t1</dt>
4079 <dd>
4080 <dl>
4081 <dd>
4082 <dl>
4083 <dd>d2</dd>
4084 </dl>
4085 </dd>
4086 </dl>
4087 </dd>
4088 </dl>
4089 </dd>
4090 </dl>
4091
4092 !! end
4093
4094
4095 !! test
4096 Definition Lists: Nesting: Test 4
4097 !! wikitext
4098 ::;t3
4099 :::d3
4100 !! html
4101 <dl><dd><dl><dd><dl><dt>t3</dt>
4102 <dd>d3</dd></dl></dd></dl></dd></dl>
4103
4104 !! end
4105
4106
4107 ## The Parsoid team believes the following three test exposes a
4108 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4109 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4110 ## It also exposes a "misfeature" in tidy, which doesn't like
4111 ## <dl> tags with a single <dt> child; it converts the <dt> into
4112 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4113 !! test
4114 Definition Lists: Mixed Lists: Test 1
4115 !! wikitext
4116 :;* foo
4117 ::* bar
4118 :; baz
4119 !! html/php
4120 <dl><dd><dl><dt><ul><li> foo</li>
4121 <li> bar</li></ul></dt></dl>
4122 <dl><dt> baz</dt></dl></dd></dl>
4123
4124 !! html/php+tidy
4125 <dl>
4126 <dd>
4127 <dl>
4128 <dd>
4129 <ul>
4130 <li>foo</li>
4131 <li>bar</li>
4132 </ul>
4133 </dd>
4134 </dl>
4135 <dl>
4136 <dt>baz</dt>
4137 </dl>
4138 </dd>
4139 </dl>
4140 !! html/parsoid
4141 <dl>
4142 <dd><dl>
4143 <dt><ul>
4144 <li> foo
4145 </li>
4146 </ul></dt>
4147 <dd><ul>
4148 <li> bar
4149 </li>
4150 </ul></dd>
4151 <dt> baz</dt>
4152 </dl></dd>
4153 </dl>
4154 !! end
4155
4156 !! test
4157 Definition Lists: Mixed Lists: Test 2
4158 !! wikitext
4159 *: d1
4160 *: d2
4161 !! html
4162 <ul><li><dl><dd> d1</dd>
4163 <dd> d2</dd></dl></li></ul>
4164
4165 !! end
4166
4167
4168 !! test
4169 Definition Lists: Mixed Lists: Test 3
4170 !! wikitext
4171 *::: d1
4172 *::: d2
4173 !! html
4174 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4175 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4176
4177 !! end
4178
4179
4180 !! test
4181 Definition Lists: Mixed Lists: Test 4
4182 !! wikitext
4183 *;d1 :d2
4184 *;d3 :d4
4185 !! html
4186 <ul><li><dl><dt>d1&#160;</dt>
4187 <dd>d2</dd>
4188 <dt>d3&#160;</dt>
4189 <dd>d4</dd></dl></li></ul>
4190
4191 !! end
4192
4193
4194 !! test
4195 Definition Lists: Mixed Lists: Test 5
4196 !! wikitext
4197 *:d1
4198 *:: d2
4199 !! html
4200 <ul><li><dl><dd>d1
4201 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4202
4203 !! end
4204
4205
4206 !! test
4207 Definition Lists: Mixed Lists: Test 6
4208 !! wikitext
4209 #*:d1
4210 #*::: d3
4211 !! html
4212 <ol><li><ul><li><dl><dd>d1
4213 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4214
4215 !! end
4216
4217
4218 !! test
4219 Definition Lists: Mixed Lists: Test 7
4220 !! wikitext
4221 :* d1
4222 :* d2
4223 !! html
4224 <dl><dd><ul><li> d1</li>
4225 <li> d2</li></ul></dd></dl>
4226
4227 !! end
4228
4229
4230 !! test
4231 Definition Lists: Mixed Lists: Test 8
4232 !! wikitext
4233 :* d1
4234 ::* d2
4235 !! html
4236 <dl><dd><ul><li> d1</li></ul>
4237 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4238
4239 !! end
4240
4241
4242 !! test
4243 Definition Lists: Mixed Lists: Test 9
4244 !! wikitext
4245 *;foo :bar
4246 !! html
4247 <ul><li><dl><dt>foo&#160;</dt>
4248 <dd>bar</dd></dl></li></ul>
4249
4250 !! end
4251
4252
4253 !! test
4254 Definition Lists: Mixed Lists: Test 10
4255 !! wikitext
4256 *#;foo :bar
4257 !! html
4258 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4259 <dd>bar</dd></dl></li></ol></li></ul>
4260
4261 !! end
4262
4263 # The Parsoid team disagrees with the PHP parser's seemingly-random
4264 # rules regarding dd/dt on the next two tests. Parsoid is more
4265 # consistent, and recognizes the shared nesting and keeps the
4266 # still-open tags around until the nesting is complete.
4267 # (And tidy again converts <dt> to <dd> before 'bar'.)
4268
4269 !! test
4270 Definition Lists: Mixed Lists: Test 11
4271 !! wikitext
4272 *#*#;*;;foo :bar
4273 *#*#;boo :baz
4274 !! html/php
4275 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4276 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4277 <dl><dt>boo&#160;</dt>
4278 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4279
4280 !! html/php+tidy
4281 <ul>
4282 <li>
4283 <ol>
4284 <li>
4285 <ul>
4286 <li>
4287 <ol>
4288 <li>
4289 <dl>
4290 <dt>foo&#160;</dt>
4291 <dd>
4292 <ul>
4293 <li>
4294 <dl>
4295 <dd>
4296 <dl>
4297 <dt>bar</dt>
4298 </dl>
4299 </dd>
4300 </dl>
4301 </li>
4302 </ul>
4303 </dd>
4304 </dl>
4305 <dl>
4306 <dt>boo&#160;</dt>
4307 <dd>baz</dd>
4308 </dl>
4309 </li>
4310 </ol>
4311 </li>
4312 </ul>
4313 </li>
4314 </ol>
4315 </li>
4316 </ul>
4317 !! html/parsoid
4318 <ul>
4319 <li>
4320 <ol>
4321 <li>
4322 <ul>
4323 <li>
4324 <ol>
4325 <li>
4326 <dl>
4327 <dt>
4328 <ul>
4329 <li>
4330 <dl>
4331 <dt>
4332 <dl>
4333 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4334 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4335 </dl></dt>
4336 </dl></li>
4337 </ul></dt>
4338 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4339 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4340 </dl></li>
4341 </ol></li>
4342 </ul></li>
4343 </ol></li>
4344 </ul>
4345 !! end
4346
4347
4348 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4349 # From whitelist:
4350 # * The test is wrong, there are two colons where there should be :;
4351 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4352 !! test
4353 Definition Lists: Weird Ones: Test 1
4354 !! wikitext
4355 *#;*::;; foo : bar (who uses this?)
4356 !! html/php
4357 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4358 <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>
4359
4360 !! html/php+tidy
4361 <ul>
4362 <li>
4363 <ol>
4364 <li>
4365 <dl>
4366 <dt>foo&#160;</dt>
4367 <dd>
4368 <ul>
4369 <li>
4370 <dl>
4371 <dd>
4372 <dl>
4373 <dd>
4374 <dl>
4375 <dd>
4376 <dl>
4377 <dt>bar (who uses this?)</dt>
4378 </dl>
4379 </dd>
4380 </dl>
4381 </dd>
4382 </dl>
4383 </dd>
4384 </dl>
4385 </li>
4386 </ul>
4387 </dd>
4388 </dl>
4389 </li>
4390 </ol>
4391 </li>
4392 </ul>
4393 !! html/parsoid
4394 <ul>
4395 <li>
4396 <ol>
4397 <li>
4398 <dl>
4399 <dt>
4400 <ul>
4401 <li>
4402 <dl>
4403 <dd>
4404 <dl>
4405 <dd>
4406 <dl>
4407 <dt>
4408 <dl>
4409 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4410 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4411 </dl></dt>
4412 </dl></dd>
4413 </dl></dd>
4414 </dl></li>
4415 </ul></dt>
4416 </dl></li>
4417 </ol></li>
4418 </ul>
4419 !! end
4420
4421 !! test
4422 Definition Lists: colons occurring in tags
4423 !! wikitext
4424 ;a:b
4425 ;'''a:b'''
4426 ;<i>a:b</i>
4427 ;<span>a:b</span>
4428 ;<div>a:b</div>
4429 ;<div>a
4430 :b</div>
4431 ;{{echo|a:b}}
4432 ;{{echo|''a:b''}}
4433 ;;;''a:b''
4434 !! html+tidy
4435 <dl>
4436 <dt>a</dt>
4437 <dd>b</dd>
4438 <dt><b>a:b</b></dt>
4439 <dt><i>a:b</i></dt>
4440 <dt><span>a:b</span></dt>
4441 <dd>
4442 <div>a:b</div>
4443 </dd>
4444 <dd>
4445 <div>a
4446 <dl>
4447 <dd>b</dd>
4448 </dl>
4449 </div>
4450 </dd>
4451 <dt>a</dt>
4452 <dd>b</dd>
4453 <dt><i>a:b</i></dt>
4454 </dl>
4455 <dl>
4456 <dd>
4457 <dl>
4458 <dd>
4459 <dl>
4460 <dt><i>a:b</i></dt>
4461 </dl>
4462 </dd>
4463 </dl>
4464 </dd>
4465 </dl>
4466 !! html/parsoid
4467 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4468 <dt><b>a:b</b></dt>
4469 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4470 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4471 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4472 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4473 <dd>b</dd>
4474 <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>
4475 <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>
4476 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4477 !! end
4478
4479 !! test
4480 Definition Lists: colons and tables 1
4481 !! wikitext
4482 :{|
4483 | x
4484 |}
4485 :{|
4486 | y
4487 |}
4488 !! html
4489 <dl><dd><table>
4490 <tr>
4491 <td> x
4492 </td></tr></table></dd></dl>
4493 <dl><dd><table>
4494 <tr>
4495 <td> y
4496 </td></tr></table></dd></dl>
4497
4498 !! end
4499
4500 # Parsoid's output (as documented below) differs from php's in this case.
4501 # This is probably a bug. If we fixup parsoid to match php's output, the
4502 # above test should pass and the below test case can be removed. It is
4503 # unclear which output is more desirable.
4504
4505 !! test
4506 Definition Lists: colons and tables 2
4507 !! wikitext
4508 :{|
4509 | x
4510 |}
4511 :{|
4512 | y
4513 |}
4514 !! html/parsoid
4515 <dl><dd><table>
4516 <tr>
4517 <td> x
4518 </td></tr></table></dd>
4519 <dd><table>
4520 <tr>
4521 <td> y
4522 </td></tr></table></dd></dl>
4523 !! end
4524
4525 !! test
4526 Definition Lists: template interaction
4527 !! wikitext
4528 ::{{definition_list}}
4529
4530 :one
4531 ::{{definition_list}}
4532 :::two
4533 :::three
4534 ::four
4535 !! html/parsoid
4536 <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">
4537 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4538
4539 <dl><dd data-parsoid='{}'>one
4540 <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">
4541 </span><dd about="#mwt2">two
4542 <dl><dd>two</dd>
4543 <dd>three</dd></dl></dd>
4544 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4545 !! end
4546
4547
4548 ###
4549 ### External links
4550 ###
4551 !! test
4552 External links: non-bracketed
4553 !! wikitext
4554 Non-bracketed: http://example.com
4555 !! html
4556 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4557 </p>
4558 !! end
4559
4560 # parsoid doesn't explicitly mark autonumbered links, see T55505
4561 !! test
4562 External links: numbered
4563 !! wikitext
4564 Numbered: [http://example.com]
4565 Numbered: [http://example.net]
4566 Numbered: [http://example.com]
4567 !! html/php
4568 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4569 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4570 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4571 </p>
4572 !! html/parsoid
4573 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4574 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4575 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4576 !!end
4577
4578 !! test
4579 External links: specified text
4580 !! wikitext
4581 Specified text: [http://example.com link]
4582 !! html
4583 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4584 </p>
4585 !!end
4586
4587 !! test
4588 External links: trail
4589 !! wikitext
4590 Linktrails should not work for external links: [http://example.com link]s
4591 !! html
4592 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4593 </p>
4594 !! end
4595
4596 !! test
4597 External links: dollar sign in URL
4598 !! wikitext
4599 http://example.com/1$2345
4600 !! html
4601 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4602 </p>
4603 !! end
4604
4605 # parsoid doesn't explicitly mark autonumbered links, see T55505
4606 !! test
4607 External links: dollar sign in URL (autonumber)
4608 !! wikitext
4609 [http://example.com/1$2345]
4610 !! html/php
4611 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4612 </p>
4613 !! html/parsoid
4614 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4615 !!end
4616
4617 !! test
4618 External links: open square bracket forbidden in URL (T6377)
4619 !! options
4620 parsoid=wt2html,wt2wt,html2html
4621 !! wikitext
4622 http://example.com/1[2345
4623 !! html/php
4624 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4625 </p>
4626 !! html/parsoid
4627 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4628 !! end
4629
4630 !! test
4631 External links: open square bracket forbidden in URL (named) (T6377)
4632 !! options
4633 parsoid=wt2html,html2html
4634 !! wikitext
4635 [http://example.com/1[2345]
4636 !! html/php
4637 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4638 </p>
4639 !! html/parsoid
4640 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4641 !!end
4642
4643 # parsoid adds a space before the link name
4644 !! test
4645 External links: open square bracket forbidden in URL (named) (T6377)
4646 Parsoid variant.
4647 !! wikitext
4648 [http://example.com/1 [2345]
4649 !! html
4650 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4651 </p>
4652 !!end
4653
4654 !! test
4655 External links: nowiki in URL link text (T8230)
4656 !! wikitext
4657 [http://example.com/ <nowiki>''example site''</nowiki>]
4658 !! html
4659 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4660 </p>
4661 !! end
4662
4663 !! test
4664 External links: newline forbidden in text (T8230 regression check)
4665 !! wikitext
4666 [http://example.com/ first
4667 second]
4668 !! html
4669 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4670 second]
4671 </p>
4672 !!end
4673
4674 !! test
4675 External links: Pipe char between url and text
4676 !! wikitext
4677 [http://example.com | link]
4678 !! html
4679 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4680 </p>
4681 !!end
4682
4683 !! test
4684 External links: protocol-relative URL in brackets
4685 !! wikitext
4686 [//example.com/ Test]
4687 !! html
4688 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4689 </p>
4690 !! end
4691
4692 # parsoid doesn't explicitly mark autonumbered links, see T55505
4693 !! test
4694 External links: protocol-relative URL in brackets without text
4695 !! wikitext
4696 [//example.com]
4697 !! html/php
4698 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4699 </p>
4700 !! html/parsoid
4701 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4702 !! end
4703
4704 !! test
4705 External links: protocol-relative URL in free text is left alone
4706 !! wikitext
4707 //example.com/Foo
4708 !! html
4709 <p>//example.com/Foo
4710 </p>
4711 !!end
4712
4713 !! test
4714 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4715 !! wikitext
4716 foo//example.com/Foo
4717 !! html
4718 <p>foo//example.com/Foo
4719 </p>
4720 !! end
4721
4722 !! test
4723 External links: with no contents
4724 !! wikitext
4725 [http://en.wikipedia.org/wiki/Foo]
4726
4727 [[wikipedia:Foo|Bar]]
4728
4729 [[wikipedia:Foo|<span>Bar</span>]]
4730 !! html/php
4731 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4732 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4733 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4734 </p>
4735 !! html/parsoid
4736 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4737 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4738 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4739 !! end
4740
4741 !! test
4742 External links: Free with trailing punctuation
4743 !! wikitext
4744 http://example.com,
4745 http://example.com;
4746 http://example.com\
4747 http://example.com.
4748 http://example.com:
4749 http://example.com!
4750 http://example.com?
4751 http://example.com)
4752 http://example.com/url_with_(brackets)
4753 (http://example.com/url_without_brackets)
4754 http://example.com/url_with_entity&amp;
4755 http://example.com/url_with_entity&#x26;
4756 http://example.com/url_with_entity&#038;
4757 http://example.com/url_with_entity&nbsp;
4758 http://example.com/url_with_entity&#xA0;
4759 http://example.com/url_with_entity&#160;
4760 http://example.com/url_with_entity&lt;
4761 http://example.com/url_with_entity&#x3C;
4762 http://example.com/url_with_entity&#60;
4763 !! html/php
4764 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4765 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4766 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4767 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4768 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4769 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4770 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4771 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4772 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4773 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4774 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4775 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4776 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4777 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4778 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4779 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4780 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4781 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4782 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4783 </p>
4784 !! html/parsoid
4785 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4786 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4787 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4788 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4789 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4790 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4791 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4792 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4793 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4794 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4795 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4796 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4797 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4798 <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>
4799 <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>
4800 <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>
4801 <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>
4802 <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>
4803 <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>
4804 !! end
4805
4806 !! test
4807 External links: tricky Parsoid html2html case
4808 !! options
4809 parsoid=wt2html,wt2wt,html2html
4810 !! wikitext
4811 http://example.com/url_with_entity&amp;amp;
4812 !! html/php
4813 <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>;
4814 </p>
4815 !! html/parsoid
4816 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4817 !! end
4818
4819 !! test
4820 External links: Free with trailing quotes (T113666)
4821 !! wikitext
4822 '''News:''' Stuff here
4823
4824 news:'a'b''c''d e
4825 !! html/php
4826 <p><b>News:</b> Stuff here
4827 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4828 </p>
4829 !! html/parsoid
4830 <p><b>News:</b> Stuff here</p>
4831 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4832 !! end
4833
4834 !! test
4835 External links: with entity
4836 !! wikitext
4837 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
4838 !! html/php
4839 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
4840 </p>
4841 !! html/parsoid
4842 <p><a rel="mw:ExtLink" href="http://+www.librarieswithoutborders.org" data-parsoid='{"a":{"href":"http://+www.librarieswithoutborders.org"},"sa":{"href":"http://&amp;#x20;www.librarieswithoutborders.org"}}'>Libraries without borders</a></p>
4843 !! end
4844
4845 !! test
4846 External links: Lone protocols are never linked (T105697)
4847 !! wikitext
4848 http://
4849 http://;
4850 (http://)
4851 bitcoin:
4852 bitcoin:;
4853 (bitcoin:)
4854 !! html
4855 <p>http://
4856 http://;
4857 (http://)
4858 bitcoin:
4859 bitcoin:;
4860 (bitcoin:)
4861 </p>
4862 !! end
4863
4864 !! test
4865 External links: No preceding word characters allowed (T67278)
4866 !! wikitext
4867 NOPEhttp://example.com
4868 N0http://example.com
4869 ok:http://example.com
4870 ok-http://example.com
4871 !! html
4872 <p>NOPEhttp://example.com
4873 N0http://example.com
4874 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4875 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4876 </p>
4877 !! end
4878
4879 !! test
4880 External links: nofollow domain exception
4881 !! wikitext
4882 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4883 !! html
4884 <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>.
4885 </p>
4886 !!end
4887
4888 !! test
4889 External image
4890 !! wikitext
4891 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4892 !! html
4893 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4894 </p>
4895 !! end
4896
4897 !! test
4898 External image from https
4899 !! wikitext
4900 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4901 !! html
4902 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4903 </p>
4904 !! end
4905
4906 !! test
4907 External image (when not allowed)
4908 !! options
4909 wgAllowExternalImages=0
4910 !! wikitext
4911 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4912 !! html
4913 <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>
4914 </p>
4915 !! end
4916
4917 !! test
4918 Link to non-http image, no img tag
4919 !! wikitext
4920 Link to non-http image, no img tag: ftp://example.com/test.jpg
4921 !! html
4922 <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>
4923 </p>
4924 !! end
4925
4926 !! test
4927 External links: terminating separator
4928 !! wikitext
4929 Terminating separator: http://example.com/thing,
4930 !! html
4931 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4932 </p>
4933 !! end
4934
4935 !! test
4936 External links: intervening separator
4937 !! wikitext
4938 Intervening separator: http://example.com/1,2,3
4939 !! html
4940 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4941 </p>
4942 !! end
4943
4944 !! test
4945 External links: old bug with URL in query
4946 !! wikitext
4947 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4948 !! html
4949 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4950 </p>
4951 !! end
4952
4953 !! test
4954 External links: old URL-in-URL bug, mixed protocols
4955 !! wikitext
4956 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4957 !! html
4958 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4959 </p>
4960 !!end
4961
4962 # Since Parsoid is starting to emit canonical wikitext for links,
4963 # [http://example.com http://example.com] will not RT back to that
4964 # form anymore.
4965 !! test
4966 External links: URL in text
4967 !! options
4968 parsoid=wt2html
4969 !! wikitext
4970 URL in text: [http://example.com http://example.com]
4971 !! html/php
4972 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4973 </p>
4974 !! html/parsoid
4975 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4976 !! end
4977
4978 !! test
4979 External links: Clickable images
4980 !! wikitext
4981 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4982 !! html/php
4983 <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>
4984 </p>
4985 !! html/parsoid
4986 <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>
4987 !! end
4988
4989 !! test
4990 External links: raw ampersand
4991 !! wikitext
4992 Old &amp; use: http://x&y
4993 !! html
4994 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4995 </p>
4996 !! end
4997
4998 !! test
4999 External links: encoded ampersand
5000 !! wikitext
5001 Old &amp; use: http://x&amp;y
5002 !! html/php
5003 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5004 </p>
5005 !! html/parsoid
5006 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
5007 !! end
5008
5009 !! test
5010 External links: encoded equals (T8102)
5011 !! wikitext
5012 http://example.com/?foo&#61;bar
5013 !! html/php
5014 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5015 </p>
5016 !! html/parsoid
5017 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5018 !! end
5019
5020 ##
5021 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5022 ## does it number them. As discussed in T55505, we can identify
5023 ## autonumbered links via CSS.
5024 ##
5025
5026 !! test
5027 External links: [raw ampersand]
5028 !! wikitext
5029 Old &amp; use: [http://x&y]
5030 !! html/php
5031 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5032 </p>
5033 !! html/parsoid
5034 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5035 !! end
5036
5037 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5038 # mode will return the [raw ampersand] wikitext
5039 !! test
5040 External links: [encoded ampersand]
5041 !! options
5042 parsoid=wt2html,wt2wt,html2html
5043 !! wikitext
5044 Old &amp; use: [http://x&amp;y]
5045 !! html/php
5046 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5047 </p>
5048 !! html/parsoid
5049 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5050 !! end
5051
5052 !! test
5053 External links: [raw equals]
5054 !! wikitext
5055 [http://example.com/?foo=bar]
5056 !! html/php
5057 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5058 </p>
5059 !! html/parsoid
5060 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5061 !! end
5062
5063 # note that parsoid html is identical to [raw equals] case; so html2wt
5064 # mode will return the [raw equals] wikitext
5065 !! test
5066 External links: [encoded equals] (T8102)
5067 !! options
5068 parsoid=wt2html,wt2wt,html2html
5069 !! wikitext
5070 [http://example.com/?foo&#61;bar]
5071 !! html/php
5072 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5073 </p>
5074 !! html/parsoid
5075 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5076 !! end
5077
5078 # xxx parsoid strips the IDN character, so the round-trip tests will
5079 # obviously fail and are disabled. --cscott
5080 !! test
5081 External links: [IDN ignored character reference in hostname; strip it right off]
5082 !! options
5083 parsoid=wt2html,wt2wt,html2html
5084 !! wikitext
5085 [http://e&zwnj;xample.com/]
5086 !! html/php
5087 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5088 </p>
5089 !! html/parsoid
5090 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5091 !! end
5092
5093 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5094 # Where an external link could easily circumvent the sanitization of the text of
5095 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5096 # test demands a higher standard. That's a bit strange.
5097 #
5098 # Example:
5099 #
5100 # http://e‌xample.com -> [http://example.com|http://example.com]
5101 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5102 #
5103 # The first example is sanitized, but the second is not. Any security benefits
5104 # from this production are trivial to circumvent. Either remove this test and
5105 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5106 # the test accordingly.
5107 #
5108 # All our love,
5109 # The Parsoid team.
5110 # xxx parsoid strips the IDN character, so the round-trip tests will
5111 # obviously fail and are disabled. --cscott
5112 !! test
5113 External links: IDN ignored character reference in hostname; strip it right off
5114 !! options
5115 parsoid=wt2html,html2html
5116 !! wikitext
5117 http://e&zwnj;xample.com/
5118 !! html/php
5119 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5120 </p>
5121 !! html/parsoid
5122 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5123 !! end
5124
5125 !! test
5126 External links: www.jpeg.org (T2554)
5127 !! wikitext
5128 http://www.jpeg.org
5129 !! html
5130 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5131 </p>
5132 !! end
5133
5134 # parsoid doesn't explicitly mark autonumbered links, see T55505
5135 !! test
5136 External links: URL within URL (T2002)
5137 !! wikitext
5138 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5139 !! html/php
5140 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5141 </p>
5142 !! html/parsoid
5143 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5144 !! end
5145
5146 !! test
5147 T2361: URL inside bracketed URL
5148 !! wikitext
5149 [http://www.example.com/foo http://www.example.com/bar]
5150 !! html
5151 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5152 </p>
5153 !! end
5154
5155 !! test
5156 T2361: URL within URL, not bracketed
5157 !! wikitext
5158 http://www.example.com/foo?=http://www.example.com/bar
5159 !! html
5160 <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>
5161 </p>
5162 !! end
5163
5164 !! test
5165 T2289: ">"-token in URL-tail
5166 !! wikitext
5167 http://www.example.com/<hello>
5168 !! html
5169 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5170 </p>
5171 !!end
5172
5173 !! test
5174 T2289: literal ">"-token in URL-tail
5175 !! wikitext
5176 http://www.example.com/<b>html</b>
5177 !! html/php
5178 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5179 </p>
5180 !! html/parsoid
5181 <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>
5182 !! end
5183
5184 !! test
5185 T2289: ">"-token in bracketed URL
5186 !! wikitext
5187 [http://www.example.com/<hello> stuff]
5188 !! html
5189 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5190 </p>
5191 !!end
5192
5193 !! test
5194 T2289: literal ">"-token in bracketed URL
5195 !! wikitext
5196 [http://www.example.com/<b>html</b> stuff]
5197 !! html
5198 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5199 </p>
5200 !!end
5201
5202 !! test
5203 T2289: literal double quote at end of URL
5204 !! wikitext
5205 http://www.example.com/"hello"
5206 !! html
5207 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5208 </p>
5209 !!end
5210
5211 !! test
5212 T2289: literal double quote in bracketed URL
5213 !! wikitext
5214 [http://www.example.com/"hello" stuff]
5215 !! html
5216 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5217 </p>
5218 !!end
5219
5220 !! test
5221 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5222 !! wikitext
5223 [http://www.example.com test]
5224 !! html
5225 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5226 </p>
5227 !! end
5228
5229 !! test
5230 External links: link text with spaces
5231 !! wikitext
5232 [http://www.example.com a b c]
5233 [http://www.example.com ''a'' ''b'']
5234 !! html
5235 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5236 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5237 </p>
5238 !! end
5239
5240 !! test
5241 External links: wiki links within external link (T5695)
5242 !! options
5243 parsoid=wt2html,html2html
5244 !! wikitext
5245 [http://example.com [[wikilink]] embedded in ext link]
5246 !! html/php
5247 <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>
5248 </p>
5249 !! html/parsoid
5250 <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>
5251 !! end
5252
5253 !! test
5254 T2787: Links with one slash after the url protocol are invalid
5255 !! wikitext
5256 http:/example.com
5257
5258 [http:/example.com title]
5259 !! html
5260 <p>http:/example.com
5261 </p><p>[http:/example.com title]
5262 </p>
5263 !! end
5264
5265 !! test
5266 Bracketed external links with template-generated invalid target
5267 !! wikitext
5268 [{{echo|http:/example.com}} title]
5269 !! html
5270 <p>[http:/example.com title]
5271 </p>
5272 !! end
5273
5274 !! test
5275 T4702: Mismatched <i>, <b> and <a> tags are invalid
5276 !! wikitext
5277 ''[http://example.com text'']
5278 [http://example.com '''text]'''
5279 ''Something [http://example.com in italic'']
5280 ''Something [http://example.com mixed''''', even bold]'''
5281 '''''Now [http://example.com both''''']
5282 !! html
5283 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5284 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5285 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5286 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5287 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5288 </p>
5289 !! end
5290
5291
5292 !! test
5293 T6781: %26 in URL
5294 !! wikitext
5295 http://www.example.com/?title=AT%26T
5296 !! html/php
5297 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5298 </p>
5299 !! html/parsoid
5300 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5301 !! end
5302
5303 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5304 # % is actually legal in HTML5. Any change in output would need testing though.
5305 !! test
5306 T6781, T7267: %25 in URL
5307 !! wikitext
5308 http://www.example.com/?title=100%25_Bran
5309 !! html/php
5310 <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>
5311 </p>
5312 !! html/parsoid
5313 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5314 !! end
5315
5316 !! test
5317 T6781, T7267: %28, %29 in URL
5318 !! wikitext
5319 http://www.example.com/?title=Ben-Hur_%281959_film%29
5320 !! html/php
5321 <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>
5322 </p>
5323 !! html/parsoid
5324 <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>
5325 !! end
5326
5327
5328 !! test
5329 T6781: %26 in autonumber URL
5330 !! wikitext
5331 [http://www.example.com/?title=AT%26T]
5332 !! html/php
5333 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5334 </p>
5335 !! html/parsoid
5336 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5337 !! end
5338
5339 !! test
5340 T6781, T7267: %26 in autonumber URL
5341 !! wikitext
5342 [http://www.example.com/?title=100%25_Bran]
5343 !! html/php
5344 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5345 </p>
5346 !! html/parsoid
5347 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5348 !! end
5349
5350 !! test
5351 T6781, T7267: %28, %29 in autonumber URL
5352 !! wikitext
5353 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5354 !! html/php
5355 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5356 </p>
5357 !! html/parsoid
5358 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5359 !! end
5360
5361
5362 !! test
5363 T6781: %26 in bracketed URL
5364 !! wikitext
5365 [http://www.example.com/?title=AT%26T link]
5366 !! html/php
5367 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5368 </p>
5369 !! html/parsoid
5370 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5371 !! end
5372
5373 !! test
5374 T6781, T7267: %25 in bracketed URL
5375 !! wikitext
5376 [http://www.example.com/?title=100%25_Bran link]
5377 !! html
5378 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5379 </p>
5380 !! end
5381
5382 !! test
5383 T6781, T7267: %28, %29 in bracketed URL
5384 !! wikitext
5385 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5386 !! html/php
5387 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5388 </p>
5389 !! html/parsoid
5390 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5391 !! end
5392
5393 !! test
5394 External link containing a period in the anchor. (T65947)
5395 !! wikitext
5396 [//foo.org/bar#baz. bang]
5397
5398 [//foo.org/bar. bang]
5399 !! html/php
5400 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5401 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5402 </p>
5403 !! html/parsoid
5404 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5405 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5406 !! end
5407
5408 !! test
5409 External link containing a single quote. (T65947)
5410 !! wikitext
5411 [//foo.org/bar'baz]
5412
5413 [//foo.org/bar'baz bang]
5414 !! html/php
5415 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5416 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5417 </p>
5418 !! html/parsoid
5419 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5420 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5421 !! end
5422
5423 !! test
5424 External link containing double-single-quotes in text '' (T6598 sanity check)
5425 !! wikitext
5426 Some [http://example.com/ pretty ''italics'' and stuff]!
5427 !! html
5428 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5429 </p>
5430 !! end
5431
5432 !! test
5433 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5434 !! wikitext
5435 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5436 !! html
5437 <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>
5438 </p>
5439 !! end
5440
5441 !! test
5442 External link containing double-single-quotes with no space separating the url from text in italics
5443 !! wikitext
5444 [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]].]
5445 !! html/php
5446 <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>
5447 </p>
5448 !! html/php+tidy
5449 <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>
5450 !! html/parsoid
5451 <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>
5452 !! end
5453
5454 !! test
5455 External link with comments in link text
5456 !! wikitext
5457 [http://www.google.com Google <!-- comment -->]
5458 !! html/php
5459 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5460 </p>
5461 !! html/parsoid
5462 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5463 !! end
5464
5465 !! test
5466 External link to bare IPv4 address
5467 !! wikitext
5468 [http://192.168.0.1 Link]
5469 !! html/php
5470 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5471 </p>
5472 !! html/parsoid
5473 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5474 !! end
5475
5476 !! test
5477 URL-encoding in URL functions (single parameter)
5478 !! wikitext
5479 {{localurl:Some page|amp=&}}
5480 !! html
5481 <p>/index.php?title=Some_page&amp;amp=&amp;
5482 </p>
5483 !! end
5484
5485 !! test
5486 URL-encoding in URL functions (multiple parameters)
5487 !! wikitext
5488 {{localurl:Some page|q=?&amp=&}}
5489 !! html
5490 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5491 </p>
5492 !! end
5493
5494 !! test
5495 Brackets in urls
5496 !! wikitext
5497 http://example.com/index.php?foozoid%5B%5D=bar
5498
5499 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5500 !! html/php
5501 <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>
5502 </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>
5503 </p>
5504 !! html/parsoid
5505 <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>
5506
5507 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar" data-parsoid='{"stx":"url","a":{"href":"http://example.com/index.php?foozoid%5B%5D=bar"},"sa":{"href":"http://example.com/index.php?foozoid&amp;#x5B;&amp;#x5D;=bar"}}'>http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5508 !! end
5509
5510 !! test
5511 IPv6 urls, autolink format (T23261)
5512 !! wikitext
5513 http://[2404:130:0:1000::187:2]/index.php
5514
5515 Examples from RFC 2373, section 2.2:
5516 * http://[1080::8:800:200C:417A]/unicast
5517 * http://[FF01::101]/multicast
5518 * http://[::1]/loopback
5519 * http://[::]/unspecified
5520 * http://[::13.1.68.3]/ipv4compat
5521 * http://[::FFFF:129.144.52.38]/ipv4compat
5522
5523 Examples from RFC 2732, section 2:
5524 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5525 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5526 * http://[3ffe:2a00:100:7031::1]
5527 * http://[1080::8:800:200C:417A]/foo
5528 * http://[::192.9.5.5]/ipng
5529 * http://[::FFFF:129.144.52.38]:80/index.html
5530 * http://[2010:836B:4179::836B:4179]
5531
5532 !! html/php
5533 <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>
5534 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5535 </p>
5536 <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>
5537 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5538 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5539 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5540 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5541 <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>
5542 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5543 </p>
5544 <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>
5545 <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>
5546 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5547 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5548 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5549 <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>
5550 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5551
5552 !! html/parsoid
5553 <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>
5554
5555 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5556 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5557 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5558 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5559 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5560 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5561 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5562
5563 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5564 <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>
5565 <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>
5566 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5567 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5568 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5569 <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>
5570 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5571 !! end
5572
5573 !! test
5574 IPv6 urls, bracketed format (T23261)
5575 !! wikitext
5576 [http://[2404:130:0:1000::187:2]/index.php test]
5577
5578 Examples from RFC 2373, section 2.2:
5579 * [http://[1080::8:800:200C:417A] unicast]
5580 * [http://[FF01::101] multicast]
5581 * [http://[::1]/ loopback]
5582 * [http://[::] unspecified]
5583 * [http://[::13.1.68.3] ipv4compat]
5584 * [http://[::FFFF:129.144.52.38] ipv4compat]
5585
5586 Examples from RFC 2732, section 2:
5587 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5588 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5589 * [http://[3ffe:2a00:100:7031::1] 3]
5590 * [http://[1080::8:800:200C:417A]/foo 4]
5591 * [http://[::192.9.5.5]/ipng 5]
5592 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5593 * [http://[2010:836B:4179::836B:4179] 7]
5594
5595 !! html/php
5596 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5597 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5598 </p>
5599 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5600 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5601 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5602 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5603 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5604 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5605 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5606 </p>
5607 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5608 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5609 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5610 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5611 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5612 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5613 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5614
5615 !! html/parsoid
5616 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5617
5618 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5619 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5620 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5621 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5622 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5623 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5624 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5625
5626 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5627 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5628 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5629 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5630 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5631 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5632 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5633 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5634 !! end
5635
5636 !! test
5637 Non-extlinks in brackets
5638 !! wikitext
5639 [foo]
5640 [foo bar]
5641 [foo ''bar'']
5642 [fool's] errand
5643 [fool's errand]
5644 [{{echo|foo}}]
5645 [{{echo|foo}} bar]
5646 [{{echo|foo}} ''bar'']
5647 [{{echo|foo}}l's] errand
5648 [{{echo|foo}}l's errand]
5649 [url={{echo|foo}}]
5650 [url=http://example.com]
5651 [http:// bare protocols don't count]
5652 !! html/php
5653 <p>[foo]
5654 [foo bar]
5655 [foo <i>bar</i>]
5656 [fool's] errand
5657 [fool's errand]
5658 [foo]
5659 [foo bar]
5660 [foo <i>bar</i>]
5661 [fool's] errand
5662 [fool's errand]
5663 [url=foo]
5664 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5665 [http:// bare protocols don't count]
5666 </p>
5667 !! html/parsoid
5668 <p>[foo]
5669 [foo bar]
5670 [foo <i>bar</i>]
5671 [fool's] errand
5672 [fool's errand]
5673 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5674 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5675 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5676 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5677 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5678 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5679 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5680 [http:// bare protocols don't count]</p>
5681 !! end
5682
5683 !! test
5684 Percent encoding in external links
5685 !! wikitext
5686 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5687 !! html/php
5688 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5689 </p>
5690 !! html/parsoid
5691 <p><a rel="mw:ExtLink"
5692 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5693 !! end
5694
5695 !! test
5696 Use url link syntax for links where the content is equal the link target
5697 !! wikitext
5698 http://example.com
5699 !! html/php
5700 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5701 </p>
5702 !! html/parsoid
5703 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5704 !! end
5705
5706 !! test
5707 Parenthesis in external links, especially URL links
5708 !! wikitext
5709 http://example.com)
5710
5711 http://example.com/test)
5712
5713 http://example.com/(test)
5714
5715 http://example.com/((test)
5716
5717 (http://example.com/(test))
5718
5719 (http://example.com/(test)))))
5720
5721 http://example.com/a)b
5722
5723 [http://example.com) foo]
5724 !! html/php
5725 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5726 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5727 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5728 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5729 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5730 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5731 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5732 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5733 </p>
5734 !! html/parsoid
5735 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5736 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5737 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5738 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5739 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5740 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5741 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5742 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5743 !! end
5744
5745 !! test
5746 Parenthesis in external links, w/ transclusion or comment
5747 !! wikitext
5748 (http://example.com/{{echo|hi}})
5749
5750 (http://example.com<!-- hi -->)
5751 !! html/php
5752 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5753 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5754 </p>
5755 !! html/parsoid
5756 <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>
5757
5758 <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>
5759 !! end
5760
5761 !! test
5762 Serialize <a> tags with invalid link targets as plain text
5763 !! options
5764 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5765 !! html/parsoid
5766 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5767 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5768 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5769 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5770 !! wikitext
5771 text
5772 <nowiki>*</nowiki>text
5773 <nowiki>[[foo]]</nowiki>
5774 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5775 !! end
5776
5777 !! test
5778 mw:ExtLink -vs- mw:WikiLink (T94723)
5779 !! options
5780 parsoid=html2wt
5781 !! html/parsoid
5782 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5783 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5784 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5785 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5786 <p>
5787 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5788 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5789 </p>
5790 !! wikitext
5791 [[Foo|Bar]]
5792 [[Foo|Bar]]
5793 [[wikipedia:Foo|Bar]]
5794 [[wikipedia:Foo|Bar]]
5795
5796 [[wikipedia:European_Robin|European Robin]]
5797 [[wikipedia:European_Robin|European Robin]]
5798 !! end
5799
5800 !! test
5801 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5802 !! options
5803 parsoid=wt2wt
5804 !! wikitext
5805 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5806 !! html/parsoid
5807 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5808 !! end
5809
5810
5811 ###
5812 ### Quotes
5813 ###
5814
5815 !! test
5816 Quotes
5817 !! wikitext
5818 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5819
5820 Normal text. '''''Bold italic text.''''' Normal text.
5821 !! html
5822 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5823 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5824 </p>
5825 !! end
5826
5827
5828 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5829 # parser strips. The wikitext contains just the first half of the bold
5830 # quote pair.
5831 !! test
5832 Unclosed and unmatched quotes
5833 !! wikitext
5834 '''''Bold italic text '''with bold deactivated''' in between.'''''
5835
5836 '''''Bold italic text ''with italic deactivated'' in between.'''''
5837
5838 '''Bold text..
5839
5840 ..spanning two paragraphs (should not work).'''
5841
5842 '''Bold tag left open
5843
5844 ''Italic tag left open
5845
5846 Normal text.
5847
5848 <!-- Unmatching number of opening, closing tags: -->
5849 '''This year''''s election ''should'' beat '''last year''''s.
5850
5851 ''Tom'''s car is bigger than ''Susan'''s.
5852
5853 Plain ''italic'''s plain
5854 !! html/php
5855 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5856 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5857 </p><p><b>Bold text..</b>
5858 </p><p>..spanning two paragraphs (should not work).
5859 </p><p><b>Bold tag left open</b>
5860 </p><p><i>Italic tag left open</i>
5861 </p><p>Normal text.
5862 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5863 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5864 </p><p>Plain <i>italic'</i>s plain
5865 </p>
5866 !! html/parsoid
5867 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5868 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5869 </p><p><b>Bold text..</b>
5870 </p><p>..spanning two paragraphs (should not work).<b></b>
5871 </p><p><b>Bold tag left open</b>
5872 </p><p><i>Italic tag left open</i>
5873 </p><p>Normal text.
5874 </p>
5875 <!-- Unmatching number of opening, closing tags: -->
5876 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5877 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5878 </p><p>Plain <i>italic'</i>s plain
5879 </p>
5880 !! end
5881
5882 ###
5883 ### Tables
5884 ###
5885 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5886 ###
5887
5888 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5889 # is the bare minimum required by the spec, see:
5890 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5891 # Parsoid team replies: empty table tags are legal in HTML5
5892 !! test
5893 A table with no data.
5894 !! options
5895 parsoid=wt2html
5896 !! wikitext
5897 {||}
5898 !! html/php
5899
5900 !! html/parsoid
5901 <table></table>
5902
5903 !! end
5904
5905 !! test
5906 A table with stray table end tags on start tag line (wt2html)
5907 !! options
5908 parsoid=wt2html
5909 !! wikitext
5910 {|style="color: red;"|}
5911
5912 {|style="color: red;" |}
5913 |foo
5914 |}
5915
5916 {|style="color: red;"|} id="foo"
5917 |foo
5918 |}
5919
5920 {|style="color: red;" |} id="foo"
5921 |foo
5922 |}
5923 !! html
5924 <table style="color: red;"></table>
5925
5926 <table style="color: red;">
5927 <tbody><tr>
5928 <td>foo</td>
5929 </tr></tbody>
5930 </table>
5931
5932 <table style="color: red;" id="foo">
5933 <tbody><tr>
5934 <td>foo</td>
5935 </tr></tbody>
5936 </table>
5937
5938 <table style="color: red;" id="foo">
5939 <tbody><tr>
5940 <td>foo</td>
5941 </tr></tbody>
5942 </table>
5943
5944 !! end
5945
5946 !! test
5947 A table with no data (take 2)
5948 !! wikitext
5949 {|
5950 |}
5951 !! html/parsoid
5952 <table></table>
5953 !! end
5954
5955 # A table with nothing but a caption is invalid XHTML, we might want to render
5956 # this as <p>caption</p>
5957 # Parsoid team replies: table with only a caption is legal in HTML5
5958 !! test
5959 A table with nothing but a caption
5960 !! wikitext
5961 {|
5962 |+ caption
5963 |}
5964 !! html/php
5965 <table>
5966 <caption> caption
5967 </caption><tr><td></td></tr></table>
5968
5969 !! html/parsoid
5970 <table><caption> caption</caption></table>
5971 !! end
5972
5973 !! test
5974 A table with caption with default-spaced attributes and a table row
5975 !! wikitext
5976 {|
5977 |+ style="color: red;" | caption1
5978 |-
5979 | foo
5980 |}
5981 !! html
5982 <table>
5983 <caption style="color: red;"> caption1
5984 </caption>
5985 <tr>
5986 <td> foo
5987 </td></tr></table>
5988
5989 !! end
5990
5991 !! test
5992 A table with captions with non-default spaced attributes and a table row
5993 !! wikitext
5994 {|
5995 |+style="color: red;"|caption2
5996 |+ style="color: red;"| caption3
5997 |-
5998 | foo
5999 |}
6000 !! html
6001 <table>
6002 <caption style="color: red;">caption2
6003 </caption>
6004 <caption style="color: red;"> caption3
6005 </caption>
6006 <tr>
6007 <td> foo
6008 </td></tr></table>
6009
6010 !! end
6011
6012 !! test
6013 Table td-cell syntax variations
6014 !! wikitext
6015 {|
6016 | foo bar foo | baz
6017 | foo bar foo || baz
6018 | style='color:red;' | baz
6019 | style='color:red;' || baz
6020 |}
6021 !! html
6022 <table>
6023 <tr>
6024 <td> baz
6025 </td>
6026 <td> foo bar foo </td>
6027 <td> baz
6028 </td>
6029 <td style="color:red;"> baz
6030 </td>
6031 <td> style='color:red;' </td>
6032 <td> baz
6033 </td></tr></table>
6034
6035 !! end
6036
6037 !! test
6038 Simple table
6039 !! wikitext
6040 {|
6041 | 1 || 2
6042 |-
6043 | 3 || 4
6044 |}
6045 !! html
6046 <table>
6047 <tr>
6048 <td> 1 </td>
6049 <td> 2
6050 </td></tr>
6051 <tr>
6052 <td> 3 </td>
6053 <td> 4
6054 </td></tr></table>
6055
6056 !! end
6057
6058 !! test
6059 Simple table but with multiple dashes for row wikitext
6060 !! wikitext
6061 {|
6062 | foo
6063 |-----
6064 | bar
6065 |}
6066 !! html
6067 <table>
6068 <tr>
6069 <td> foo
6070 </td></tr>
6071 <tr>
6072 <td> bar
6073 </td></tr></table>
6074
6075 !! end
6076
6077 !! test
6078 Multiplication table
6079 !! wikitext
6080 {| border="1" cellpadding="2"
6081 |+Multiplication table
6082 |-
6083 ! &times; !! 1 !! 2 !! 3
6084 |-
6085 ! 1
6086 | 1 || 2 || 3
6087 |-
6088 ! 2
6089 | 2 || 4 || 6
6090 |-
6091 ! 3
6092 | 3 || 6 || 9
6093 |-
6094 ! 4
6095 | 4 || 8 || 12
6096 |-
6097 ! 5
6098 | 5 || 10 || 15
6099 |}
6100 !! html
6101 <table border="1" cellpadding="2">
6102 <caption>Multiplication table
6103 </caption>
6104 <tr>
6105 <th> &#215; </th>
6106 <th> 1 </th>
6107 <th> 2 </th>
6108 <th> 3
6109 </th></tr>
6110 <tr>
6111 <th> 1
6112 </th>
6113 <td> 1 </td>
6114 <td> 2 </td>
6115 <td> 3
6116 </td></tr>
6117 <tr>
6118 <th> 2
6119 </th>
6120 <td> 2 </td>
6121 <td> 4 </td>
6122 <td> 6
6123 </td></tr>
6124 <tr>
6125 <th> 3
6126 </th>
6127 <td> 3 </td>
6128 <td> 6 </td>
6129 <td> 9
6130 </td></tr>
6131 <tr>
6132 <th> 4
6133 </th>
6134 <td> 4 </td>
6135 <td> 8 </td>
6136 <td> 12
6137 </td></tr>
6138 <tr>
6139 <th> 5
6140 </th>
6141 <td> 5 </td>
6142 <td> 10 </td>
6143 <td> 15
6144 </td></tr></table>
6145
6146 !! end
6147
6148 !! test
6149 Accept "||" in table headings
6150 !! wikitext
6151 {|
6152 !h1 || h2
6153 |}
6154 !! html
6155 <table>
6156 <tr>
6157 <th>h1 </th>
6158 <th> h2
6159 </th></tr></table>
6160
6161 !! end
6162
6163 !! test
6164 Accept "!!" in table data
6165 !! wikitext
6166 {|
6167 | Foo!! ||
6168 |}
6169 !! html
6170 <table>
6171 <tr>
6172 <td> Foo!! </td>
6173 <td>
6174 </td></tr></table>
6175
6176 !! html/parsoid
6177 <table>
6178 <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>
6179 </tbody></table>
6180 !! end
6181
6182 !! test
6183 Accept "||" in indented table headings
6184 !! wikitext
6185 :{|
6186 !h1 || h2
6187 |}
6188 !! html
6189 <dl><dd><table>
6190 <tr>
6191 <th>h1 </th>
6192 <th> h2
6193 </th></tr></table></dd></dl>
6194
6195 !! end
6196
6197 !! test
6198 Accept "!!" in templates
6199 !! wikitext
6200 {|
6201 !a {{echo|b!!c}}
6202 |}
6203 !! html/php
6204 <table>
6205 <tr>
6206 <th>a b</th>
6207 <th>c
6208 </th></tr></table>
6209
6210 !! html/parsoid
6211 <table>
6212 <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>
6213 !! end
6214
6215 !! test
6216 Accept "!!" in table headings after newline
6217 !! wikitext
6218 {|
6219 !a
6220 b!!c
6221 |}
6222 !! html/php
6223 <table>
6224 <tr>
6225 <th>a
6226 <p>b!!c
6227 </p>
6228 </th></tr></table>
6229
6230 !! html/parsoid
6231 <table>
6232 <tbody><tr><th>a
6233 <p>b!!c</p></th></tr>
6234 </tbody></table>
6235 !! end
6236
6237 !! test
6238 Accept "!!" in table data of mixed wikitext / html syntax
6239 !! wikitext
6240 {|
6241 !a
6242 <tr><td>b!!c</td></tr>
6243 |}
6244 !! html+tidy
6245 <table>
6246 <tr>
6247 <th>a</th>
6248 </tr>
6249 <tr>
6250 <td>b!!c</td>
6251 </tr>
6252 </table>
6253 !! html/parsoid
6254 <table>
6255 <tbody><tr><th>a</th></tr>
6256 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6257 </tbody></table>
6258 !! end
6259
6260 !! test
6261 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6262 !! wikitext
6263 {|
6264 !| h1
6265 || a
6266 |}
6267 !! html
6268 <table>
6269 <tr>
6270 <th> h1
6271 </th>
6272 <td> a
6273 </td></tr></table>
6274
6275 !! end
6276
6277 !!test
6278 Accept "| !" at start of line in tables (ignore !-attribute)
6279 !! wikitext
6280 {|
6281 |-
6282 | !style="color:red" | bar
6283 |}
6284 !! html
6285 <table>
6286
6287 <tr>
6288 <td> bar
6289 </td></tr></table>
6290
6291 !!end
6292
6293 !!test
6294 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 +/-
6295 !! wikitext
6296 {|
6297 |-
6298 |style='color:red;'|+1
6299 |style='color:blue;'|-1
6300 |-
6301 | 1 || 2 || 3
6302 | 1 ||+2 ||-3
6303 |-
6304 | +1
6305 | -1
6306 |}
6307 !! html
6308 <table>
6309
6310 <tr>
6311 <td style="color:red;">+1
6312 </td>
6313 <td style="color:blue;">-1
6314 </td></tr>
6315 <tr>
6316 <td> 1 </td>
6317 <td> 2 </td>
6318 <td> 3
6319 </td>
6320 <td> 1 </td>
6321 <td>+2 </td>
6322 <td>-3
6323 </td></tr>
6324 <tr>
6325 <td> +1
6326 </td>
6327 <td> -1
6328 </td></tr></table>
6329
6330 !!end
6331
6332 !! test
6333 Table rowspan
6334 !! wikitext
6335 {| border=1
6336 | Cell 1, row 1
6337 |rowspan=2| Cell 2, row 1 (and 2)
6338 | Cell 3, row 1
6339 |-
6340 | Cell 1, row 2
6341 | Cell 3, row 2
6342 |}
6343 !! html
6344 <table border="1">
6345 <tr>
6346 <td> Cell 1, row 1
6347 </td>
6348 <td rowspan="2"> Cell 2, row 1 (and 2)
6349 </td>
6350 <td> Cell 3, row 1
6351 </td></tr>
6352 <tr>
6353 <td> Cell 1, row 2
6354 </td>
6355 <td> Cell 3, row 2
6356 </td></tr></table>
6357
6358 !! end
6359
6360 !! test
6361 Nested table
6362 !! wikitext
6363 {| border=1
6364 | &alpha;
6365 |
6366 {| bgcolor=#ABCDEF border=2
6367 |nested
6368 |-
6369 |table
6370 |}
6371 |the original table again
6372 |}
6373 !! html
6374 <table border="1">
6375 <tr>
6376 <td> &#945;
6377 </td>
6378 <td>
6379 <table bgcolor="#ABCDEF" border="2">
6380 <tr>
6381 <td>nested
6382 </td></tr>
6383 <tr>
6384 <td>table
6385 </td></tr></table>
6386 </td>
6387 <td>the original table again
6388 </td></tr></table>
6389
6390 !! end
6391
6392 !! test
6393 Invalid attributes in table cell (T3830)
6394 !! wikitext
6395 {|
6396 |Cell:|broken
6397 |}
6398 !! html
6399 <table>
6400 <tr>
6401 <td>broken
6402 </td></tr></table>
6403
6404 !! end
6405
6406 !! test
6407 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6408 !! wikitext
6409 {|
6410 | title="foo" |bar
6411 | title="foo<nowiki>|</nowiki>" |bar
6412 | title="foo<nowiki>|</nowiki>" bar
6413 |}
6414 !! html/php
6415 <table>
6416 <tr>
6417 <td title="foo">bar
6418 </td>
6419 <td title="foo&#124;">bar
6420 </td>
6421 <td> title="foo|" bar
6422 </td></tr></table>
6423
6424 !! html/parsoid
6425 <table>
6426 <tbody><tr><td title="foo">bar</td>
6427 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6428 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6429 </tbody></table>
6430 !! end
6431
6432 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6433 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6434 # *2wt modes will fail.
6435 !! test
6436 Table security: embedded pipes
6437 !! options
6438 parsoid=wt2html,html2html
6439 !! wikitext
6440 {|
6441 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6442 !! html/php
6443 <table>
6444 <tr>
6445 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6446 <td>]" onmouseover="alert(document.cookie)"&gt;test
6447 </td>
6448 </tr>
6449 </table>
6450
6451 !! html/parsoid
6452 <table><tbody>
6453 <tr>
6454 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'>[<a rel="mw:ExtLink" href="ftp://%7Cx" data-parsoid='{"stx":"url","a":{"href":"ftp://%7Cx"},"sa":{"href":"ftp://|x"}}'>ftp://%7Cx</a></td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'>]" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6455 !! end
6456
6457 !! test
6458 Element attributes with double ! should not be broken up by <th>
6459 !! wikitext
6460 {|
6461 ! hi <div class="!!">ha</div> ho
6462 |}
6463 !! html/php
6464 <table>
6465 <tr>
6466 <th> hi <div class="!!">ha</div> ho
6467 </th></tr></table>
6468
6469 !! html/parsoid
6470 <table>
6471 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6472 </tbody></table>
6473 !! end
6474
6475 !! test
6476 ! and || in element attributes should not be parsed as <th>/<td>
6477 !! wikitext
6478 {|
6479 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6480 |}
6481 !! html/php
6482 <table>
6483 <tr>
6484 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6485 </td></tr></table>
6486
6487 !! html/parsoid
6488 <table>
6489 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6490 </tbody></table>
6491 !! end
6492
6493 # FIXME: The output seems broken. Filed as T110268.
6494 !! test
6495 ! and || in td attributes should not be parsed as <th>/<td>
6496 !! options
6497 parsoid=wt2html
6498 !! wikitext
6499 {|
6500 | style="color: red !important;" data-contrived="put this here ||" | foo
6501 |}
6502 !! html/php
6503 <table>
6504 <tr>
6505 <td> style="color: red !important;" data-contrived="put this here </td>
6506 <td> foo
6507 </td></tr></table>
6508
6509 !! html/parsoid
6510 <table>
6511 <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>
6512 </tbody></table>
6513 !! end
6514
6515 !! test
6516 Break on | in element attribute in template
6517 !! options
6518 parsoid=wt2html,html2html
6519 !! wikitext
6520 {{echo|1=<div class="hi|ho">ha</div>}}
6521 !! html/php
6522 <p>ho"&gt;ha&lt;/div&gt;
6523 </p>
6524 !! html/parsoid
6525 <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>
6526 !! end
6527
6528 !! test
6529 Break on | in element attribute name in template
6530 !! wikitext
6531 {{echo|<div cla|ss="hiho">ha</div>}}
6532 !! html/parsoid
6533 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"ss","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div cla"},"ss":{"wt":"\"hiho\">ha&lt;/div>"}},"i":0}}]}'>&lt;div cla</p>
6534 !! end
6535
6536 !! test
6537 Don't break on | in extension attribute in template
6538 !! wikitext
6539 {{echo|<ref name="hi|ho">ha</ref>}}
6540
6541 <references />
6542 !! html/parsoid
6543 <p><span about="#mwt2" class="mw-ref" id="cite_ref-hi.7Cho_1-0" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref name=\"hi|ho\">ha&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-hi.7Cho-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
6544
6545 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-hi.7Cho-1" id="cite_note-hi.7Cho-1"><a href="./Main_Page#cite_ref-hi.7Cho_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-hi.7Cho-1" class="mw-reference-text">ha</span></li></ol>
6546 !! end
6547
6548 ## We don't support roundtripping of these attributes in Parsoid.
6549 ## Selective serialization takes care of preventing dirty diffs.
6550 ## But, on edits, we dirty-diff the invalid attribute text.
6551 !! test
6552 Invalid text in table attributes should be discarded
6553 !! options
6554 parsoid=wt2html
6555 !! wikitext
6556 {| <span>boo</span> style='border:1px solid black'
6557 | <span>boo</span> style='color:blue' | 1
6558 |<span>boo</span> style='color:blue'| 2
6559 |}
6560 !! html/php
6561 <table style="border:1px solid black">
6562 <tr>
6563 <td style="color:blue"> 1
6564 </td>
6565 <td style="color:blue"> 2
6566 </td></tr></table>
6567
6568 !! html/parsoid
6569 <table style="border:1px solid black">
6570 <tr>
6571 <td style="color:blue"> 1</td>
6572 <td style="color:blue"> 2</td>
6573 </tr>
6574 </table>
6575 !! end
6576
6577 !! test
6578 Invalid text in table attributes should be preserved by selective serializer
6579 !! options
6580 parsoid={
6581 "modes": ["selser"],
6582 "changes": [
6583 ["td:first-child", "text", "abc"],
6584 ["td + td", "text", "xyz"]
6585 ]
6586 }
6587 !! wikitext
6588 {| <span>boo</span> style='border:1px solid black'
6589 | <span>boo</span> style='color:blue' | 1
6590 |<span>boo</span> style='color:blue'| 2
6591 |}
6592 !! wikitext/edited
6593 {| <span>boo</span> style='border:1px solid black'
6594 | <span>boo</span> style='color:blue' |abc
6595 |<span>boo</span> style='color:blue'|xyz
6596 |}
6597 !! end
6598
6599 !! test
6600 1. Template-generated table cell attributes and cell content
6601 !! wikitext
6602 {|
6603 |{{table_attribs}}
6604 | {{table_attribs}}
6605 || {{table_attribs_5}}
6606 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6607 |align=center {{table_attribs}}
6608 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6609 |}
6610 !! html
6611 <table>
6612 <tr>
6613 <td style="color:red;">Foo
6614 </td>
6615 <td style="color:red;">Foo
6616 </td>
6617 <td> style="color:red;"</td>
6618 <td>Bar
6619 </td>
6620 <td style="color:red;">Foo
6621 </td>
6622 <td align="center" style="color:red;">Foo
6623 </td>
6624 <td align="center" style="color:red;">Foo
6625 </td></tr></table>
6626
6627 !! end
6628
6629 !! test
6630 2. Template-generated table cell attributes and cell content
6631 !! wikitext
6632 {|
6633 |{{table_attribs_2}}
6634 |}
6635 !! html/php
6636 <table>
6637 <tr>
6638 <td style="color:red;">Foo
6639 </td>
6640 <td>Bar</td>
6641 <td>Baz
6642 </td></tr></table>
6643
6644 !! html/parsoid
6645 <table>
6646 <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>
6647 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6648 </tbody></table>
6649 !! end
6650
6651 !! test
6652 3. Template-generated table cell attributes and cell content
6653 !! wikitext
6654 {|
6655 !align=center {{table_header_cells}}
6656 |-
6657 |align=center {{table_cells}}
6658 |}
6659 !! html/php
6660 <table>
6661 <tr>
6662 <th align="center" style="color:red;">Foo</th>
6663 <th style="color:red;"><i>Bar</i></th>
6664 <th style="color:brown;"><i>Foo</i> and Baz
6665 </th></tr>
6666 <tr>
6667 <td align="center" style="color:red;">Foo</td>
6668 <td style="color:red;"><i>Bar</i></td>
6669 <td style="color:brown;"><i>Foo</i> and Baz
6670 </td></tr></table>
6671
6672 !! html/parsoid
6673 <table>
6674 <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>
6675 <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>
6676 </tbody></table>
6677 !! end
6678
6679 !! test
6680 4. Template-generated table cell attributes and cell content inside a templated table
6681 !! wikitext
6682 {{tbl-start}}
6683 !align=center {{table_header_cells}}
6684 |-
6685 |align=center {{table_cells}}
6686 {{tbl-end}}
6687 !! html/php
6688 <table>
6689 <tr>
6690 <th align="center" style="color:red;">Foo</th>
6691 <th style="color:red;"><i>Bar</i></th>
6692 <th style="color:brown;"><i>Foo</i> and Baz
6693 </th></tr>
6694 <tr>
6695 <td align="center" style="color:red;">Foo</td>
6696 <td style="color:red;"><i>Bar</i></td>
6697 <td style="color:brown;"><i>Foo</i> and Baz
6698 </td></tr></table>
6699
6700 !! html/parsoid
6701 <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}}]}'>
6702 <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>
6703 <tr>
6704 <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>
6705 </tbody></table>
6706 !! end
6707
6708 ## Edge case fix to prevent future regressions
6709 !! test
6710 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6711 !! wikitext
6712 {|
6713 |{{table_attribs_7}}
6714 |}
6715 <references />
6716 !! html/parsoid
6717 <table>
6718 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<span class="mw-ref" id="cite_ref-1" rel="dc:references" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></td></tr>
6719 </tbody></table>
6720 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
6721 !! end
6722
6723 !! test
6724 Table with row followed by newlines and table heading
6725 !! options
6726 parsoid=wt2html,html2html
6727 !! wikitext
6728 {|
6729 |-
6730
6731 ! foo
6732 |}
6733 !! html/*
6734 <table>
6735
6736
6737 <tr>
6738 <th> foo
6739 </th></tr></table>
6740
6741 !! end
6742
6743 !! test
6744 Table with empty line following the start tag
6745 !! options
6746 parsoid=wt2html,html2html
6747 !! wikitext
6748 {|
6749
6750 |-
6751 | foo
6752 |}
6753 !! html/*
6754 <table>
6755
6756
6757 <tr>
6758 <td> foo
6759 </td></tr></table>
6760
6761 !! end
6762
6763 !! test
6764 Table attributes with empty value
6765 !! options
6766 parsoid=wt2html,html2html
6767 !! wikitext
6768 {|
6769 | style=| hello
6770 |}
6771 !! html/php
6772 <table>
6773 <tr>
6774 <td style=""> hello
6775 </td></tr></table>
6776
6777 !! html/parsoid
6778 <table>
6779 <tbody><tr><td style=""> hello</td></tr>
6780 </tbody></table>
6781 !! end
6782
6783 !! test
6784 Wikitext table with a lot of comments
6785 !! wikitext
6786 {|
6787 <!-- c0 -->
6788 | foo
6789 <!-- c1 -->
6790 |-<!-- c2 -->
6791 <!-- c3 -->
6792 |<!-- c4 -->
6793 <!-- c5 -->
6794 |}
6795 !! html
6796 <table>
6797 <tr>
6798 <td> foo
6799 </td></tr>
6800 <tr>
6801 <td>
6802 </td></tr></table>
6803
6804 !! end
6805
6806 !! test
6807 Wikitext table comments represented in parsoid dom
6808 !! wikitext
6809 {|<!--c1--><!--c2-->
6810 |-<!--c3-->
6811 | x
6812 |}
6813 !! html/php+tidy
6814 <table>
6815 <tr>
6816 <td>x</td>
6817 </tr>
6818 </table>
6819 !! html/parsoid
6820 <table><!--c1--><!--c2-->
6821 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6822 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6823 </tbody></table>
6824 !! end
6825
6826 !! test
6827 Wikitext table with double-line table cell
6828 !! wikitext
6829 {|
6830 |a
6831 b
6832 |}
6833 !! html
6834 <table>
6835 <tr>
6836 <td>a
6837 <p>b
6838 </p>
6839 </td></tr></table>
6840
6841 !! end
6842
6843 !! test
6844 Table cell with a single comment
6845 !! wikitext
6846 {|
6847 | <!-- c1 -->
6848 | a
6849 |}
6850 !! html
6851 <table>
6852 <tr>
6853 <td>
6854 </td>
6855 <td> a
6856 </td></tr></table>
6857
6858 !! end
6859
6860 !! test
6861 Table-cell after a comment-only-empty-line
6862 !! wikitext
6863 {|
6864 |a
6865 <!--c1-->
6866 <!--c2-->| b
6867 |}
6868 !! html
6869 <table>
6870 <tr>
6871 <td>a
6872 </td>
6873 <td> b
6874 </td></tr></table>
6875
6876 !! html/parsoid
6877 <table>
6878 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6879 <!--c1-->
6880 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6881 </tbody></table>
6882
6883 !! end
6884
6885 !! test
6886 Build table with {{!}}
6887 !! wikitext
6888 {{{!}} class="wikitable"
6889 ! header
6890 ! second header
6891 {{!}}- style="color:red;"
6892 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6893 {{!}}}
6894 !! html
6895 <table class="wikitable">
6896 <tr>
6897 <th> header
6898 </th>
6899 <th> second header
6900 </th></tr>
6901 <tr style="color:red;">
6902 <td> data </td>
6903 <td style="color:red;"> second data
6904 </td></tr></table>
6905
6906 !! end
6907
6908 !! test
6909 Build table with pipe as data
6910 !! wikitext
6911 {| class="wikitable"
6912 ! header
6913 ! second header
6914 |- style="color:red;"
6915 | data || style="color:red;" | second data
6916 |-
6917 | style="color:red;" | data with | || style="color:red;" | second data with |
6918 |-
6919 || data with | ||| second data with |
6920 |}
6921 !! html
6922 <table class="wikitable">
6923 <tr>
6924 <th> header
6925 </th>
6926 <th> second header
6927 </th></tr>
6928 <tr style="color:red;">
6929 <td> data </td>
6930 <td style="color:red;"> second data
6931 </td></tr>
6932 <tr>
6933 <td style="color:red;"> data with | </td>
6934 <td style="color:red;"> second data with |
6935 </td></tr>
6936 <tr>
6937 <td> data with | </td>
6938 <td> second data with |
6939 </td></tr></table>
6940
6941 !! end
6942
6943 !! test
6944 Build table with wikilink
6945 !! wikitext
6946 {| class="wikitable"
6947 ! header || second header
6948 |- style="color:red;"
6949 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6950 |-
6951 | data || second data [[Main Page|link|text with pipe]]
6952 |}
6953 !! html
6954 <table class="wikitable">
6955 <tr>
6956 <th> header </th>
6957 <th> second header
6958 </th></tr>
6959 <tr style="color:red;">
6960 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6961 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6962 </td></tr>
6963 <tr>
6964 <td> data </td>
6965 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6966 </td></tr></table>
6967
6968 !! end
6969
6970 # The expected HTML structure in this test is debatable. The PHP parser does
6971 # not parse this kind of table at all. The main focus for Parsoid is on
6972 # round-tripping, so this output is ok for now. TODO: revisit!
6973 !! test
6974 Wikitext table with html-syntax row
6975 !! wikitext
6976 {|
6977 |-
6978 <td>foo</td>
6979 |}
6980 !! html/parsoid
6981 <table>
6982 <tbody>
6983 <tr>
6984 <td>foo</td></tr></tbody></table>
6985 !! end
6986
6987 !! test
6988 Implicit <td> after a |-
6989 !! options
6990 parsoid=wt2html,html2html
6991 !! wikitext
6992 {|
6993 |-
6994 a
6995 |}
6996 !! html/php
6997 <table>
6998
6999 a
7000 </table>
7001
7002 !! html/php+tidy
7003 <p>a</p>
7004 !! html/parsoid
7005 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>a</p><table>
7006 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7007
7008 </tr></tbody></table>
7009 !! end
7010
7011 !! test
7012 Lists should be recognized in an implicit <td> context
7013 !! options
7014 parsoid=wt2html,html2html
7015 !! wikitext
7016 {|
7017 |-
7018 *a
7019 |}
7020 !! html/php
7021 <table>
7022
7023 <ul><li>a</li></ul>
7024 </table>
7025
7026 !! html/php+tidy
7027 <ul>
7028 <li>a</li>
7029 </ul>
7030 !! html/parsoid
7031 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7032 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7033
7034 </tr></tbody></table>
7035 !! end
7036
7037 !! test
7038 Table cells not properly parsed in an implicit-td context
7039 !! wikitext
7040 {|
7041 |-
7042 {{table_attribs_4}} || a || b
7043 |}
7044 !! html/php+tidy
7045 <table>
7046 <tr>
7047 <td style="background-color:#DC241f;" width="10px"></td>
7048 <td>a</td>
7049 <td>b</td>
7050 </tr>
7051 </table>
7052 !! html/parsoid
7053 <table>
7054 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7055 <td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," || a || b"]}'> </td><td about="#mwt1"> a </td><td about="#mwt1"> b</td></tr>
7056 !! end
7057
7058 !! test
7059 Parsoid: Round-trip tables directly followed by content (T53219)
7060 !! options
7061 parsoid=wt2html,wt2wt
7062 !! wikitext
7063 {|
7064 |foo
7065 |} bar
7066
7067 {|
7068 |baz
7069 |}<b>quux</b>
7070 !! html+tidy
7071 <table>
7072 <tr>
7073 <td>foo</td>
7074 </tr>
7075 </table>
7076 <p>bar</p>
7077 <table>
7078 <tr>
7079 <td>baz</td>
7080 </tr>
7081 </table>
7082 <p><b>quux</b></p>
7083 !! end
7084
7085 !! test
7086 Parsoid: Default to a newline after tables in new content (T53219)
7087 !! options
7088 parsoid=html2wt
7089 !! html/parsoid
7090 <table><tbody>
7091 <tr><td>foo</td></tr></tbody></table> bar
7092 <table><tbody>
7093 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7094 !! wikitext
7095 {|
7096 |foo
7097 |}
7098 <nowiki> </nowiki>bar
7099 {|
7100 |baz
7101 |}
7102 '''quux'''
7103 !! end
7104
7105 !! test
7106 Parsoid: newline inducing block nodes don't suppress <nowiki>
7107 !! options
7108 parsoid=html2wt
7109 !! html/parsoid
7110 a<h1>foo</h1>
7111 !! wikitext
7112 <nowiki> </nowiki>a
7113
7114 = foo =
7115 !! end
7116
7117 !! test
7118 Parsoid: Row-syntax table headings followed by comment & table cells
7119 !! options
7120 parsoid=wt2html,wt2wt
7121 !! wikitext
7122 {|
7123 ! foo || bar
7124 <!-- foo --> || baz || quux
7125 |}
7126 !! html/php
7127 <table>
7128 <tr>
7129 <th> foo </th>
7130 <th> bar
7131 </th>
7132 <td> baz </td>
7133 <td> quux
7134 </td></tr></table>
7135
7136 !! html/parsoid
7137 <table>
7138 <tbody><tr><th> foo </th><th> bar
7139 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7140 </tbody></table>
7141 !! end
7142
7143 !!test
7144 Parsoid: Recover better from broken table attributes
7145 !!options
7146 parsoid=wt2html
7147 !!wikitext
7148 {| class="foo
7149 | class="bar" |
7150 foo
7151 |}
7152 !!html/php+tidy
7153 <table class="foo">
7154 <tr>
7155 <td class="bar">
7156 <p>foo</p>
7157 </td>
7158 </tr>
7159 </table>
7160 !!html/parsoid
7161 <table class="foo">
7162 <tr>
7163 <td class="bar">
7164 <p>foo</p></td></tr>
7165 </tbody></table>
7166 !!end
7167
7168 !! test
7169 Tables: Digest broken attributes on table and tr tag
7170 !! options
7171 parsoid=wt2html
7172 !! wikitext
7173 {| || |} ++
7174 |- || || ++ --
7175 |- > [
7176 |}
7177 !! html
7178 <table>
7179 <tbody>
7180 <tr></tr>
7181 <tr></tr>
7182 </tbody></table>
7183 !! end
7184
7185 # T137406: Whitespace in the HTML
7186 !! test
7187 1. Generate correct wikitext for tables with thead/tbody/tfoot
7188 !! options
7189 parsoid=html2wt
7190 !! html/parsoid
7191 <table>
7192 <caption>Test</caption>
7193 <thead>
7194 <tr>
7195 <th>Month</th>
7196 <th>Savings</th>
7197 </tr>
7198 </thead>
7199 <tbody>
7200 <tr>
7201 <td>January</td>
7202 <td>$100</td>
7203 </tr>
7204 <tr>
7205 <td>February</td>
7206 <td>$80</td>
7207 </tr>
7208 </tbody>
7209 <tfoot>
7210 <tr>
7211 <td>Sum</td>
7212 <td>$180</td>
7213 </tr>
7214 </tfoot>
7215 </table>
7216 !! wikitext
7217 {|
7218 |+Test
7219 !Month
7220 !Savings
7221 |-
7222 |January
7223 |$100
7224 |-
7225 |February
7226 |$80
7227 |-
7228 |Sum
7229 |$180
7230 |}
7231 !! html/php+tidy
7232 <table>
7233 <caption>Test</caption>
7234 <tr>
7235 <th>Month</th>
7236 <th>Savings</th>
7237 </tr>
7238 <tr>
7239 <td>January</td>
7240 <td>$100</td>
7241 </tr>
7242 <tr>
7243 <td>February</td>
7244 <td>$80</td>
7245 </tr>
7246 <tr>
7247 <td>Sum</td>
7248 <td>$180</td>
7249 </tr>
7250 </table>
7251 !! end
7252
7253 # T137406: No whitespace in the HTML
7254 !! test
7255 2. Generate correct wikitext for tables with thead/tbody/tfoot
7256 !! options
7257 parsoid=html2wt
7258 !! html/parsoid
7259 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7260 !! wikitext
7261 {|
7262 !heading
7263 |-
7264 |foo
7265 |}
7266 !! end
7267
7268 !! test
7269 Testing serialization after deletion in references
7270 !! options
7271 parsoid={
7272 "modes": ["wt2wt"],
7273 "changes": [
7274 ["#x", "remove"]
7275 ]
7276 }
7277 !! wikitext
7278 hi <ref><div id="x">ho</div></ref>
7279
7280 <references />
7281 !! wikitext/edited
7282 hi <ref></ref>
7283
7284 <references />
7285 !! end
7286
7287 !!test
7288 Testing serialization after deletion of table cells
7289 !!options
7290 parsoid={
7291 "modes": ["wt2wt", "selser"],
7292 "changes": [
7293 ["#x", "remove"]
7294 ]
7295 }
7296 !!wikitext
7297 {|
7298 !h1 !!h2 !!h3
7299 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7300 |}
7301 !! wikitext/edited
7302 {|
7303 !h1 !!h2 !!h3
7304 |c2 |||c3
7305 |}
7306 !!end
7307
7308 !! test
7309 Testing selser after addition of new row before first row (T125419)
7310 !! options
7311 parsoid={
7312 "modes": ["wt2wt", "selser"],
7313 "changes": [
7314 [ "tr", "before", "<tr><td>X</td></tr>" ]
7315 ]
7316 }
7317 !! wikitext
7318 {|
7319 |a
7320 |}
7321 !! wikitext/edited
7322 {|
7323 |X
7324 |-
7325 |a
7326 |}
7327 !! end
7328
7329 !! test
7330 Serialize new table rows in a HTML table using HTML tags
7331 !! options
7332 parsoid={
7333 "modes": ["wt2wt", "selser"],
7334 "changes": [
7335 [ "tr", "before", "<tr><td>X</td></tr>" ]
7336 ]
7337 }
7338 !! wikitext
7339 <table><tr><td>a</td></tr></table>
7340 !! wikitext/edited
7341 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7342 !! end
7343
7344 !! test
7345 Serialize new table cells in a HTML row using HTML tags
7346 !! options
7347 parsoid={
7348 "modes": ["wt2wt", "selser"],
7349 "changes": [
7350 [ "td", "before", "<td>X</td>" ]
7351 ]
7352 }
7353 !! wikitext
7354 <table><tr><td>a</td></tr></table>
7355 !! wikitext/edited
7356 <table><tr><td>X</td><td>a</td></tr></table>
7357 !! end
7358
7359 !! test
7360 Wikitext tables can be nested inside HTML tables
7361 !! options
7362 parsoid=html2wt
7363 !! html
7364 <table data-parsoid='{"stx":"html"}'>
7365 <tr><td>
7366 <table>
7367 <tr><td>foo</td></tr>
7368 </table>
7369 </td></tr>
7370 </table>
7371 !! wikitext
7372 <table>
7373 <tr><td>
7374 {|
7375 |foo
7376 |}
7377 </td></tr>
7378 </table>
7379 !! end
7380
7381 !! test
7382 Serialize wikitext list items as HTML list items when embedded in a HTML list
7383 !! options
7384 parsoid=html2wt
7385 !! html
7386 <ul data-parsoid='{"stx": "html"}'>
7387 <li data-parsoid='{}'>a</li>
7388 <li>b</li>
7389 </ul>
7390 !! wikitext
7391 <ul>
7392 <li>a</li>
7393 <li>b</li>
7394 </ul>
7395 !! end
7396
7397 # SSS FIXME: Is this actually a good thing given the
7398 # odd nested list output that is generated by MW?
7399 # <ul><li>foo<ul>..</ul></li></ul> instead of
7400 # <ul><li>foo</li><ul>..</ul></ul>
7401 !! test
7402 Wikitext lists can be nested inside HTML lists
7403 !! options
7404 parsoid=html2wt
7405 !! html
7406 <ul data-parsoid='{"stx": "html"}'>
7407 <li data-parsoid='{"stx": "html"}'>a
7408 <ul><li>b</li></ul>
7409 </li>
7410 </ul>
7411
7412 <ul data-parsoid='{"stx": "html"}'>
7413 <li>x
7414 <ul><li>y</li></ul>
7415 </li>
7416 </ul>
7417 !! wikitext
7418 <ul>
7419 <li>a
7420 * b
7421 </li>
7422 </ul>
7423
7424 <ul>
7425 <li>x
7426 * y
7427 </li>
7428 </ul>
7429 !! end
7430
7431 ###
7432 ### Internal links
7433 ###
7434 !! test
7435 Plain link, capitalized
7436 !! wikitext
7437 [[Main Page]]
7438 !! html
7439 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7440 </p>
7441 !! end
7442
7443 !! test
7444 Plain link, uncapitalized
7445 !! wikitext
7446 [[main Page]]
7447 !! html
7448 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7449 </p>
7450 !! end
7451
7452 !! test
7453 Piped link
7454 !! wikitext
7455 [[Main Page|The Main Page]]
7456 !! html
7457 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7458 </p>
7459 !! end
7460
7461 !! test
7462 Piped link with comment in link text
7463 !! wikitext
7464 [[Main Page|The Main<!--front--> Page]]
7465 !! html
7466 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7467 </p>
7468 !! end
7469
7470 !! test
7471 Piped link with multiple pipe characters in link text
7472 !! wikitext
7473 [[Main Page||The|Main|Page|]]
7474 !! html/php
7475 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7476 </p>
7477 !! html/parsoid
7478 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7479 !! end
7480
7481 !! test
7482 Piped link with no link text
7483 !! wikitext
7484 [[Thomas Bek (bishop of St David's)|]]
7485 !! html/php
7486 <p>[[Thomas Bek (bishop of St David's)|]]
7487 </p>
7488 !! html/parsoid
7489 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7490 !! end
7491
7492 !! test
7493 Piped link with empty link text
7494 !! wikitext
7495 [[Main Page|<nowiki/>]] - empty nowiki
7496 [[Main Page| ]] - empty space
7497 [[Main Page|&nbsp;]] - empty non breaking space
7498 !! html/php
7499 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7500 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7501 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7502 </p>
7503 !! html/parsoid
7504 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7505 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7506 <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>
7507 !! end
7508
7509 !! test
7510 Broken link
7511 !! wikitext
7512 [[Zigzagzogzagzig]]
7513 !! html
7514 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7515 </p>
7516 !! end
7517
7518 !! test
7519 Broken link with fragment
7520 !! wikitext
7521 [[Zigzagzogzagzig#zug]]
7522 !! html
7523 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7524 </p>
7525 !! end
7526
7527 !! test
7528 Special page link with fragment
7529 !! wikitext
7530 [[Special:Version#anchor]]
7531 !! html
7532 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7533 </p>
7534 !! end
7535
7536 !! test
7537 Nonexistent special page link with fragment
7538 !! wikitext
7539 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7540 !! html
7541 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7542 </p>
7543 !! end
7544
7545 !! test
7546 Link with prefix
7547 !! wikitext
7548 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7549 !! html
7550 <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>
7551 </p>
7552 !! end
7553
7554 !! test
7555 Link with suffix
7556 !! wikitext
7557 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7558 !! html
7559 <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>!!!
7560 </p>
7561 !! end
7562
7563 !! article
7564 prefixed article
7565 !! text
7566 Some text
7567 !! endarticle
7568
7569 !! test
7570 T45661: Piped links with identical prefixes
7571 !! wikitext
7572 [[prefixed article|prefixed articles with spaces]]
7573
7574 [[prefixed article|prefixed articlesaoeu]]
7575
7576 [[Main Page|Main Page test]]
7577 !! html
7578 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7579 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7580 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7581 </p>
7582 !! end
7583
7584
7585 !! test
7586 Link with HTML entity in suffix / tail
7587 !! wikitext
7588 [[Main Page]]&quot;, [[Main Page]]&#97;
7589 !! html/php
7590 <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;
7591 </p>
7592 !! html/parsoid
7593 <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>
7594 !! end
7595
7596 !! test
7597 Link with 3 brackets
7598 !! wikitext
7599 [[[Main Page]]]
7600 Foo [[[Main Page]]]
7601 !! html
7602 <p>[[[Main Page]]]
7603 Foo [[[Main Page]]]
7604 </p>
7605 !! end
7606
7607 !! test
7608 Link with 4 brackets
7609 !! wikitext
7610 [[[[Main Page]]]]
7611 !! html
7612 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7613 </p>
7614 !! end
7615
7616 !! test
7617 Piped link with 3 brackets
7618 !! wikitext
7619 [[[main page|the main page]]]
7620 !! html
7621 <p>[[[main page|the main page]]]
7622 </p>
7623 !! end
7624
7625 !! test
7626 Piped link with extlink-like text
7627 !! wikitext
7628 [[Main Page|[bar]]]
7629 [[Main Page|This is a [bar]]]
7630 !! html/php
7631 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7632 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7633 </p>
7634 !! html/parsoid
7635 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7636 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7637 !! end
7638
7639 !! test
7640 Link with multiple pipes
7641 !! wikitext
7642 [[Main Page|The|Main|Page]]
7643 !! html
7644 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7645 </p>
7646 !! end
7647
7648 !! test
7649 Anchor containing a #. (T65430)
7650 !! wikitext
7651 [[Main Page#And#Link]]
7652 !! html/php
7653 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7654 </p>
7655 !! html/parsoid
7656 <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>
7657 !! end
7658
7659 !! test
7660 Link to namespaces
7661 !! wikitext
7662 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7663 !! html
7664 <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>
7665 </p>
7666 !! end
7667
7668 !! test
7669 Link with space in namespace
7670 !! wikitext
7671 [[User talk:Foo bar]]
7672 !! html
7673 <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>
7674 </p>
7675 !! end
7676
7677 !! article
7678 MemoryAlpha:AlphaTest
7679 !! text
7680 This is an article in the MemoryAlpha namespace
7681 (which shadows the memoryalpha interwiki link).
7682 !! endarticle
7683
7684 !! test
7685 Namespace takes precedence over interwiki link (T53680)
7686 !! wikitext
7687 [[MemoryAlpha:AlphaTest]]
7688 !! html
7689 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7690 </p>
7691 !! end
7692
7693 # The previous test doesn't work correctly in html2*, due to not recognizing the
7694 # link as an internal one. This one checks for the correct behavior.
7695 !! test
7696 Link to namespace preferred over interwiki with correct rel attribute
7697 !! options
7698 parsoid=html2wt,html2html
7699 !! html/parsoid
7700 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7701 !! wikitext
7702 [[MemoryAlpha:AlphaTest]]
7703 !! end
7704
7705 !! test
7706 Piped link to namespace
7707 !! wikitext
7708 [[Meta:Disclaimers|The disclaimers]]
7709 !! html
7710 <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>
7711 </p>
7712 !! end
7713
7714 !! test
7715 Link containing }
7716 !! wikitext
7717 [[Usually caused by a typo (oops}]]
7718 !! html
7719 <p>[[Usually caused by a typo (oops}]]
7720 </p>
7721 !! end
7722
7723 !! article
7724 7% Solution
7725 !! text
7726 Just a test of an article title containing a percent.
7727 !! endarticle
7728
7729 !! test
7730 Link containing % (not as a hex sequence)
7731 !! wikitext
7732 [[7% Solution]]
7733 [[7% Solution|7%25 Solution]]
7734 !! html/php
7735 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7736 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7737 </p>
7738 !! html/parsoid
7739 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7740 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7741 !! end
7742
7743 # note that the parsoid HTML is identical to the previous test output,
7744 # so the previous test ensures that the html2wt mode will generate the
7745 # "not as a hex sequence" wikitext.
7746 !! test
7747 Link containing % as a single hex sequence interpreted to char
7748 !! options
7749 parsoid=wt2wt,wt2html,html2html
7750 !! wikitext
7751 [[7%25 Solution]]
7752 [[7%25 Solution|7%25 Solution]]
7753 !! html/php
7754 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7755 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7756 </p>
7757 !! html/parsoid
7758 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7759 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7760 !!end
7761
7762 !! test
7763 Link containing % as a double hex sequence interpreted to hex sequence
7764 !! wikitext
7765 [[7%2525 Solution]]
7766 !! html
7767 <p>[[7%2525 Solution]]
7768 </p>
7769 !!end
7770
7771 ## Example for such a section: == < ==
7772 !! test
7773 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7774 !! wikitext
7775 [[%23%3c]][[%23%3e]]
7776 !! html/php
7777 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7778 </p>
7779 !! html/parsoid
7780 <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>
7781 !! end
7782
7783 !! test
7784 Link containing "<#" and ">#" as a hex sequences
7785 !! wikitext
7786 [[%3c%23]][[%3e%23]]
7787 !! html
7788 <p>[[%3c%23]][[%3e%23]]
7789 </p>
7790 !! end
7791
7792 !! test
7793 Link containing an equals sign
7794 !! wikitext
7795 [[Special:BookSources/isbn=4-00-026157-6]]
7796 !! html/php
7797 <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>
7798 </p>
7799 !! html/parsoid
7800 <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>
7801 !! end
7802
7803 !! article
7804 Foo~bar
7805 !! text
7806 Just a test of an article title containing a tilde.
7807 !! endarticle
7808
7809 # note that links containing signatures, like [[Foo~~~~]], are
7810 # massaged by the pre-save transform (PST) and so the tildes are never
7811 # seen by the parser.
7812 !! test
7813 Link containing a tilde
7814 !! wikitext
7815 [[Foo~bar]]
7816 !! html/php
7817 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7818 </p>
7819 !! html/parsoid
7820 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7821 !! end
7822
7823 !! test
7824 Link containing double-single-quotes '' (T6598)
7825 !! wikitext
7826 [[Lista d''e paise d''o munno]]
7827 !! html/php
7828 <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>
7829 </p>
7830 !! html/parsoid
7831 <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>
7832 !! end
7833
7834 !! test
7835 Link containing double quotes and spaces
7836 !! wikitext
7837 [[Cool "Gator"]]
7838 !! html/php
7839 <p><a href="/index.php?title=Cool_%22Gator%22&amp;action=edit&amp;redlink=1" class="new" title="Cool &quot;Gator&quot; (page does not exist)">Cool "Gator"</a>
7840 </p>
7841 !! html/parsoid
7842 <p><a rel="mw:WikiLink" href="./Cool_%22Gator%22" title='Cool "Gator"'>Cool "Gator"</a></p>
7843 !! end
7844
7845 !! test
7846 File containing double quotes and spaces
7847 !! wikitext
7848 [[File:Cool "Gator".png]]
7849 !! html/parsoid
7850 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Cool_%22Gator%22.png" data-parsoid='{"a":{"href":"./File:Cool_%22Gator%22.png"},"sa":{"href":"File:Cool \"Gator\".png"}}'><img resource='./File:Cool_"Gator".png' src="./Special:FilePath/Cool_%22Gator%22.png" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Cool_\"Gator\".png","height":"220","width":"220","src":"./Special:FilePath/Cool_%22Gator%22.png"},"sa":{"resource":"File:Cool \"Gator\".png","src":"./Special:FilePath/Cool_\"Gator\".png"}}'/></a></span></p>
7851 !! end
7852
7853 !! test
7854 Redirect containing double quotes and spaces
7855 !! wikitext
7856 #REDIRECT [[Cool "Gator"]]
7857 !! html/parsoid
7858 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
7859 !! end
7860
7861 !! test
7862 Link containing double-single-quotes '' in text (T6598 sanity check)
7863 !! wikitext
7864 Some [[Link|pretty ''italics'' and stuff]]!
7865 !! html/php
7866 <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>!
7867 </p>
7868 !! html/parsoid
7869 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7870 !! end
7871
7872 !! test
7873 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
7874 !! wikitext
7875 ''Some [[Link|pretty ''italics'' and stuff]]!''
7876 !! html
7877 <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>
7878 </p>
7879 !! end
7880
7881 !! test
7882 Link with double quotes in title part (literal) and alternate part (interpreted)
7883 !! wikitext
7884 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7885
7886 [[''Pentecoste'']]
7887
7888 [[''Pentecoste''|Pentecoste]]
7889
7890 [[''Pentecoste''|''Pentecoste'']]
7891 !! html/php
7892 <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>
7893 </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>
7894 </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>
7895 </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>
7896 </p>
7897 !! html/parsoid
7898 <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>
7899 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7900 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7901 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7902 !! end
7903
7904 !! test
7905 Broken image links with HTML captions (T41700)
7906 !! wikitext
7907 [[File:Nonexistent|<script></script>]]
7908 [[File:Nonexistent|100x100px|<script></script>]]
7909 [[File:Nonexistent|&lt;]]
7910 [[File:Nonexistent|a<i>b</i>c]]
7911 !! html/php
7912 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7913 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7914 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7915 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7916 </p>
7917 !! html/parsoid
7918 <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>
7919 <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>
7920 <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>
7921 <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>
7922 !! end
7923
7924 !! test
7925 Plain link to URL
7926 !! wikitext
7927 [[http://www.example.com]]
7928 !! html/php
7929 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7930 </p>
7931 !! html/parsoid
7932 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7933 !! end
7934
7935 !! test
7936 Plain link to URL with link text
7937 !! wikitext
7938 [[http://www.example.com Link text]]
7939 !! html
7940 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7941 </p>
7942 !! end
7943
7944 !! test
7945 Plain link to protocol-relative URL
7946 !! wikitext
7947 [[//www.example.com]]
7948 !! html/php
7949 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7950 </p>
7951 !! html/parsoid
7952 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7953 !! end
7954
7955 !! test
7956 Plain link to protocol-relative URL with link text
7957 !! wikitext
7958 [[//www.example.com Link text]]
7959 !! html
7960 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7961 </p>
7962 !! end
7963
7964 !! test
7965 Plain link to page with question mark in title
7966 !! wikitext
7967 [[A?b]]
7968
7969 [[A?b|Baz]]
7970 !! html
7971 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7972 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7973 </p>
7974 !! end
7975
7976
7977 # I'm fairly sure the expected result here is wrong.
7978 # We want these to be URL links, not pseudo-pages with URLs for titles....
7979 # However the current output is also pretty screwy.
7980 #
7981 # ----
7982 # I'm changing it to match the current output--it arguably makes more
7983 # sense in the light of the test above. Old expected result was:
7984 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7985 #</p>
7986 # But I think this test is bordering on "garbage in, garbage out" anyway.
7987 # -- wtm
7988 !! test
7989 Piped link to URL
7990 !! wikitext
7991 Piped link to URL: [[http://www.example.com|an example URL]]
7992 !! html/php
7993 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7994 </p>
7995 !! html/parsoid
7996 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com%7Can" data-parsoid='{"a":{"href":"http://www.example.com%7Can"},"sa":{"href":"http://www.example.com|an"}}'>example URL</a>]</p>
7997 !! end
7998
7999 !! test
8000 T2002: [[page|http://url/]] should link to page, not http://url/
8001 !! wikitext
8002 [[Main Page|http://url/]]
8003 !! html/php
8004 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8005 </p>
8006 !! html/parsoid
8007 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8008 !! end
8009
8010 # Parsoid does not mark self-links, by design.
8011 !! test
8012 T2337: Escaped self-links should be bold
8013 !! options
8014 title=[[Bug462]]
8015 !! wikitext
8016 [[Bu&#103;462]] [[Bug462]]
8017 !! html/php
8018 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8019 </p>
8020 !! html/php+tidy
8021 <p><a class="mw-selflink selflink">Bug462</a> <a class="mw-selflink selflink">Bug462</a></p>
8022 !! html/parsoid
8023 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8024 !! end
8025
8026 !! test
8027 Self-link to section should not be bold
8028 !! options
8029 title=[[Main Page]]
8030 !! wikitext
8031 [[Main Page#section]]
8032 !! html
8033 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8034 </p>
8035 !! end
8036
8037 !! article
8038 00
8039 !! text
8040 This is 00.
8041 !! endarticle
8042
8043 !!test
8044 Self-link to numeric title
8045 !!options
8046 title=[[0]]
8047 !! wikitext
8048 [[0]]
8049 !! html
8050 <p><a class="mw-selflink selflink">0</a>
8051 </p>
8052 !!end
8053
8054 !!test
8055 Link to numeric-equivalent title
8056 !!options
8057 title=[[0]]
8058 !! wikitext
8059 [[00]]
8060 !! html
8061 <p><a href="/wiki/00" title="00">00</a>
8062 </p>
8063 !!end
8064
8065 !! test
8066 <nowiki> inside a link
8067 !! wikitext
8068 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8069 !! html
8070 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8071 </p>
8072 !! end
8073
8074 !! test
8075 Non-breaking spaces in title
8076 !! wikitext
8077 [[&nbsp; Main &nbsp; Page &nbsp;]]
8078 !! html
8079 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8080 </p>
8081 !!end
8082
8083 !! test
8084 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8085 !! options
8086 language=ca
8087 !! wikitext
8088 '''[[Main Page]]'''
8089 !! html
8090 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8091 </p>
8092 !! end
8093
8094 !! test
8095 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8096 !! options
8097 language=ca
8098 !! wikitext
8099 ''[[Main Page]]''
8100 !! html
8101 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8102 </p>
8103 !! end
8104
8105 !! test
8106 Internal link with en linktrail: no apostrophes (T29473)
8107 !! options
8108 language=en
8109 !! wikitext
8110 [[Something]]'nice
8111 !! html
8112 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8113 </p>
8114 !! end
8115
8116 !! test
8117 Internal link with ca linktrail with apostrophes (T29473)
8118 !! options
8119 language=ca
8120 !! wikitext
8121 [[Something]]'nice
8122 !! html
8123 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8124 </p>
8125 !! end
8126
8127 !! test
8128 Internal link with kaa linktrail with apostrophes (T29473)
8129 !! options
8130 language=kaa
8131 !! wikitext
8132 [[Something]]'nice
8133 !! html
8134 <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>
8135 </p>
8136 !! end
8137
8138 !! test
8139 Link with multiple ":" in a subpage-supporting namespace (T65636)
8140 !! wikitext
8141 [[User:Foo/Test/63636:Bar|Test]]
8142 !! html/php
8143 <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>
8144 </p>
8145 !! html/parsoid
8146 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8147 !! end
8148
8149 ## Mainly a sanity check for Parsoid
8150 !! test
8151 Handle title parsing for subpages
8152 !! options
8153 title=[[/123123]]
8154 subpage
8155 !! wikitext
8156 123
8157 !! html/php
8158 <p>123
8159 </p>
8160 !! html/parsoid
8161 <p>123</p>
8162 !! end
8163
8164 !! article
8165 User:Test/123
8166 !! text
8167 test 123
8168 !! endarticle
8169
8170 !! test
8171 Link to a subpage from a namespace other than main
8172 !! options
8173 title=[[User:Test]]
8174 subpage
8175 !! wikitext
8176 [[/123]]
8177 !! html/php
8178 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8179 </p>
8180 !! html/parsoid
8181 <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>
8182 !! end
8183
8184 !! test
8185 Ensure that transclusion titles are not url-decoded
8186 !! options
8187 subpage title=[[Test]]
8188 parsoid=wt2html
8189 !! wikitext
8190 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8191 !! html/php
8192 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8193 </p>
8194 !! html/parsoid
8195 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8196 !! end
8197
8198 !! test
8199 Purely hash wikilink
8200 !! options
8201 title=[[User:Test/123]]
8202 subpage
8203 !! wikitext
8204 [[#a|b]]
8205 !! html/php
8206 <p><a href="#a">b</a>
8207 </p>
8208 !! html/parsoid
8209 <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>
8210 !! end
8211
8212 !! test
8213 1. Interaction of linktrail and template encapsulation
8214 !! wikitext
8215 {{echo|[[Foo]]}}l
8216 !! html/parsoid
8217 <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>
8218 !! end
8219
8220 !! test
8221 2. Interaction of linktrail and template encapsulation
8222 !! options
8223 parsoid
8224 !! wikitext
8225 {{echo|Some [[Fool]]}}s
8226 !! html
8227 <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>
8228 !! end
8229
8230 !! test
8231 3. Interaction of linktrail and template encapsulation
8232 !! options
8233 parsoid
8234 !! wikitext
8235 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8236 !! html
8237 <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>
8238 !! end
8239
8240 !! article
8241 Söfnuður
8242 !! text
8243 Test.
8244 !! endarticle
8245
8246 !! test
8247 Internal link with is link prefix
8248 !! options
8249 language=is
8250 !! wikitext
8251 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8252 !! html
8253 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8254 </p>
8255 !! end
8256
8257 !! article
8258 Mótmælendatrú
8259 !! text
8260 Test.
8261 !! endarticle
8262
8263 !! test
8264 Internal link with is link trail and link prefix
8265 !! options
8266 language=is
8267 !! wikitext
8268 [[mótmælendatrú|xxx]]ar
8269 [[mótmælendatrú]]ar
8270 mótmælenda[[söfnuður]]
8271 mótmælenda[[söfnuður|söfnuðir]]
8272 mótmælenda[[söfnuður|söfnuðir]]xxx
8273 !! html
8274 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8275 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8276 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8277 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8278 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8279 </p>
8280 !! end
8281
8282 !! test
8283 Parsoid link trail escaping
8284 !! options
8285 parsoid=html2wt,html2html
8286 !! html/parsoid
8287 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8288 !! wikitext
8289 [[apple]]<nowiki/>s
8290 !! end
8291
8292 !! test
8293 Parsoid link prefix escaping
8294 !! options
8295 language=is
8296 parsoid=html2wt,html2html
8297 !! html/parsoid
8298 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8299 !! wikitext
8300 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8301 !! end
8302
8303 !! test
8304 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8305 !! wikitext
8306 [[Foo| bar]]
8307
8308 [[Foo| ''bar'']]
8309
8310 [http://wp.org foo]
8311
8312 [http://wp.org ''foo'']
8313 !! html
8314 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8315 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8316 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8317 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8318 </p>
8319 !! end
8320
8321 !! test
8322 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8323 !! wikitext
8324 [[Foo|{{echo|a}} b {{echo|c}}]]
8325 !! html/parsoid
8326 <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>
8327 !! end
8328
8329 !! test
8330 Link with angle bracket after anchor
8331 !! wikitext
8332 [[Foo#<bar>]]
8333 !! html/php
8334 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8335 </p>
8336 !! html/parsoid
8337 <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>
8338 !! end
8339
8340 ###
8341 ### Interwiki links (see maintenance/interwiki.sql)
8342 ###
8343
8344 !! test
8345 Inline interwiki link
8346 !! options
8347 parsoid=wt2html,wt2wt,html2html
8348 !! wikitext
8349 [[MeatBall:SoftSecurity]]
8350 !! html/php
8351 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8352 </p>
8353 !! html/parsoid
8354 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8355 !! end
8356
8357 !! test
8358 Inline interwiki link with empty title (T4372)
8359 !! options
8360 parsoid=wt2html,wt2wt,html2html
8361 !! wikitext
8362 [[MeatBall:]]
8363 !! html/php
8364 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8365 </p>
8366 !! html/parsoid
8367 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8368 !! end
8369
8370 !! test
8371 Interwiki link encoding conversion (T3636)
8372 !! wikitext
8373 *[[Wikipedia:ro:Olteni&#0355;a]]
8374 *[[Wikipedia:ro:Olteni&#355;a]]
8375 !! html
8376 <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>
8377 <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>
8378
8379 !! html+tidy
8380 <ul>
8381 <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>
8382 <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>
8383 </ul>
8384 !! end
8385
8386 !! test
8387 Interwiki link with fragment (T4130)
8388 !! wikitext
8389 [[MeatBall:SoftSecurity#foo]]
8390 !! html
8391 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8392 </p>
8393 !! end
8394
8395 !! test
8396 Link scenarios with escaped fragments
8397 !! wikitext
8398 [[#Is this great?]]
8399 [[Foo#Is this great?]]
8400 [[meatball:Foo#Is this great?]]
8401 !! html/php
8402 <p><a href="#Is_this_great.3F">#Is this great?</a>
8403 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8404 <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>
8405 </p>
8406 !! html/parsoid
8407 <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>
8408 <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>
8409 <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>
8410 !! end
8411
8412 # Ideally the wikipedia: prefix here should be proto-relative too
8413 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8414 # define the 'en' prefix, and originally the test used 'wikipedia',
8415 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8416 # article.
8417 !! test
8418 Different interwiki prefixes mapping to the same URL
8419 !! wikitext
8420 [[:en:Foo]]
8421
8422 [[:en:Foo|Foo]]
8423
8424 [[wikipedia:Foo]]
8425
8426 [[:wikipedia:Foo|Foo]]
8427
8428 [[wikipedia:en:Foo]]
8429
8430 [[:wikipedia:en:Foo]]
8431
8432 [[ wikiPEdia :Foo]]
8433 !! html/parsoid
8434 <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>
8435
8436 <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>
8437
8438 <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>
8439
8440 <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>
8441
8442 <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>
8443
8444 <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>
8445
8446 <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>
8447 !! end
8448
8449 !! test
8450 Interwiki links that cannot be represented in wiki syntax
8451 !! wikitext
8452 [[meatball:ok]]
8453 [[meatball:ok#foo|ok with fragment]]
8454 [[meatball:ok_as_well?|ok ending with ? mark]]
8455 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8456 [http://de.wikipedia.org/wiki/#foo is just fragment]
8457
8458 !! html/php
8459 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8460 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8461 <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>
8462 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8463 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8464 </p>
8465 !! html/parsoid
8466 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8467 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8468 <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>
8469 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8470 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8471 !! end
8472
8473 !! test
8474 Interwiki links: trail
8475 !! wikitext
8476 [[wikipedia:Foo|Ba]]r
8477 !! html/php
8478 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8479 </p>
8480 !! html/parsoid
8481 <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>
8482 !! end
8483
8484 !! test
8485 Local interwiki link
8486 !! options
8487 parsoid=wt2html,wt2wt,html2html
8488 !! wikitext
8489 [[local:Template:Foo]]
8490 !! html/php
8491 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8492 </p>
8493 !! html/parsoid
8494 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8495 !! end
8496
8497 # Parsoid does not mark self-links, by design.
8498 !! test
8499 Local interwiki link: self-link to current page
8500 !! options
8501 title=[[Main Page]]
8502 parsoid=wt2html,wt2wt,html2html
8503 !! wikitext
8504 [[local:Main Page]]
8505 !! html/php
8506 <p><a class="mw-selflink selflink">local:Main Page</a>
8507 </p>
8508 !! html/parsoid
8509 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8510 !! end
8511
8512 !! test
8513 Local interwiki link: prefix only (T66167)
8514 !! options
8515 parsoid=wt2html,wt2wt,html2html
8516 !! wikitext
8517 [[local:]]
8518 !! html/php
8519 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8520 </p>
8521 !! html/parsoid
8522 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8523 !! end
8524
8525 !! test
8526 Local interwiki link: with additional interwiki prefix (T63357)
8527 !! options
8528 parsoid=wt2html,wt2wt,html2html
8529 !! wikitext
8530 [[local:meatball:Hello]]
8531 !! html/php
8532 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8533 </p>
8534 !! html/parsoid
8535 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8536 !! end
8537
8538 !! test
8539 Multiple local interwiki link prefixes
8540 !! wikitext
8541 [[local:local:local:local:mi:local:Foo]]
8542 !! options
8543 parsoid=wt2html,wt2wt,html2html
8544 !! html/php
8545 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8546 </p>
8547 !! html/parsoid
8548 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8549 !! end
8550
8551 ###
8552 ### Interlanguage links
8553 ### Language links (so that searching for '### language' matches..)
8554 ###
8555
8556 !! test
8557 Interlanguage link
8558 !! wikitext
8559 Blah blah blah
8560 [[zh:Chinese]]
8561 !! html/php
8562 <p>Blah blah blah
8563 </p>
8564 !! html/parsoid
8565 <p>Blah blah blah</p>
8566 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8567 !! end
8568
8569 ## parsoid html2wt will lose the space variations
8570 !! test
8571 Interlanguage link with spacing
8572 !! options
8573 parsoid=wt2html,wt2wt,html2html
8574 !! wikitext
8575 Blah blah blah
8576 [[ zh : Chinese ]]
8577 !! html/php
8578 <p>Blah blah blah
8579 </p>
8580 !! html/parsoid
8581 <p>Blah blah blah</p>
8582 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8583 !! end
8584
8585 !! test
8586 Double interlanguage link
8587 !! wikitext
8588 Blah blah blah
8589 [[es:Spanish]]
8590 [[zh:Chinese]]
8591 !! html/php
8592 <p>Blah blah blah
8593 </p>
8594 !! html/parsoid
8595 <p>Blah blah blah</p>
8596 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8597 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8598 !! end
8599
8600 ## parsoid html2wt will lose the space variations
8601 !! test
8602 Interlanguage link variations
8603 !! options
8604 parsoid=wt2html,wt2wt,html2html
8605 !! wikitext
8606 Blah blah blah
8607 [[ es :Spanish]]
8608 [[ ZH :Chinese]]
8609 [[es:Foo_bar]]
8610 !! html/php
8611 <p>Blah blah blah
8612 </p>
8613 !! html/parsoid
8614 <p>Blah blah blah</p>
8615 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8616 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8617 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8618 !! end
8619
8620 !! test
8621 Escaping of interlanguage links (T129218, T156308)
8622 !! wikitext
8623 Blah blah blah
8624 [[:es:Spanish]]
8625 [[ : zh : Chinese ]]
8626 !! html/php
8627 <p>Blah blah blah
8628 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8629 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8630 </p>
8631 !! html/parsoid
8632 <p>Blah blah blah
8633 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8634 <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8635 !! end
8636
8637 ## parsoid html2wt will normalize the space to _
8638 !! test
8639 Space and question mark encoding in interlanguage links (T95473)
8640 !! options
8641 parsoid=wt2html,wt2wt,html2html
8642 !! wikitext
8643 Blah blah blah
8644 [[es:Foo bar?]]
8645 !! html/php
8646 <p>Blah blah blah
8647 </p>
8648 !! html/parsoid
8649 <p>Blah blah blah</p>
8650 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8651 !! end
8652
8653 !! test
8654 Interlanguage link, with prefix links
8655 !! options
8656 language=ln
8657 !! wikitext
8658 Blah blah blah
8659 [[zh:Chinese]]
8660 !! html/php
8661 <p>Blah blah blah
8662 </p>
8663 !! html/parsoid
8664 <p>Blah blah blah</p>
8665 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8666 !! end
8667
8668 !! test
8669 Double interlanguage link, with prefix links (T10897)
8670 !! options
8671 language=ln
8672 !! wikitext
8673 Blah blah blah
8674 [[es:Spanish]]
8675 [[zh:Chinese]]
8676 !! html/php
8677 <p>Blah blah blah
8678 </p>
8679 !! html/parsoid
8680 <p>Blah blah blah</p>
8681 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8682 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8683 !! end
8684
8685 !! test
8686 "Extra" interlanguage links (T34189 / gerrit 111390)
8687 !! wikitext
8688 Blah blah blah
8689 [[mul:Article]]
8690 !! html/php
8691 <p>Blah blah blah
8692 </p>
8693 !! html/parsoid
8694 <p>Blah blah blah</p>
8695 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8696 !! end
8697
8698 ## PHP parser tests script needs an update
8699 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8700 !! test
8701 Language links render as inline links if $wgInterwikiMagic=false
8702 !! options
8703 wgInterwikiMagic=false
8704 parsoid=wt2html,wt2wt,html2html
8705 !! wikitext
8706 Blah blah blah
8707 [[zh:Chinese]]
8708 !! html/parsoid
8709 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8710 !! end
8711
8712 ## PHP parser tests script needs an update
8713 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8714 !! test
8715 Language links render as inline links in the Talk namespace
8716 !! options
8717 title=Talk:Foo
8718 parsoid=wt2html,wt2wt,html2html
8719 !! wikitext
8720 Blah blah blah
8721 [[zh:Chinese]]
8722 !! html/parsoid
8723 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8724 !! end
8725
8726 !! test
8727 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8728 !! options
8729 language=ln
8730 !! wikitext
8731 [[WW&nbsp;II]]
8732 !! html
8733 <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>
8734 </p>
8735 !! end
8736
8737 !! test
8738 Parsoid T55221: Wikilinks should be properly entity-escaped
8739 !! options
8740 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8741 !! html/parsoid
8742 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8743 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8744 !! wikitext
8745 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8746
8747 He&amp;nbsp;llo He&amp;nbsp;llo
8748 !! html/php
8749 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8750 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8751 </p>
8752 !! end
8753
8754 # html2wt will fail because of title normalization without data-parsoid
8755 !! test
8756 Parsoid: handle constructor well
8757 !! options
8758 parsoid=wt2html,wt2wt
8759 !! wikitext
8760 [[constructor]]
8761
8762 [[constructor:foo]]
8763 !! html/php
8764 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8765 </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>
8766 </p>
8767 !! html/parsoid
8768 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8769
8770 <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>
8771 !! end
8772
8773 !! article
8774 ko:
8775 !! text
8776 Test.
8777 !! endarticle
8778
8779 # Note that `ko` isn't a known interlanguage prefix
8780 !! test
8781 Parsoid: recognize interlanguage links without a target page
8782 !! options
8783 ill
8784 !! wikitext
8785 [[es:]]
8786
8787 [[ko:]]
8788 !! html/php
8789 es:
8790 !! html/parsoid
8791 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8792
8793 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8794 !! end
8795
8796 # Note that `ko` isn't a known interwiki prefix
8797 !! test
8798 Parsoid: recognize interwiki links without a target page
8799 !! options
8800 parsoid=wt2html,wt2wt,html2html
8801 !! wikitext
8802 [[:es:]]
8803
8804 [[:ko:]]
8805 !! html/php
8806 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8807 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8808 </p>
8809 !! html/parsoid
8810 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8811 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8812 !! end
8813
8814 !! test
8815 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
8816 !! wikitext
8817 [[mi:Foo]]
8818 !! html/php
8819 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8820 </p>
8821 !! html/parsoid
8822 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8823 !! end
8824
8825 !! test
8826 Interlanguage link with preceding local interwiki link (T70085)
8827 !! options
8828 parsoid=wt2html,wt2wt,html2html
8829 !! wikitext
8830 Blah blah blah
8831 [[local:es:Spanish]]
8832 !! html/php
8833 <p>Blah blah blah
8834 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8835 </p>
8836 !! html/parsoid
8837 <p>Blah blah blah
8838 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8839 !! end
8840
8841 !! test
8842 Looks like an interlanguage link, but is actually a local interwiki
8843 !! options
8844 parsoid=wt2html,wt2wt,html2html
8845 !! wikitext
8846 Blah blah blah
8847 [[mi:Template:Foo]]
8848 !! html/php
8849 <p>Blah blah blah
8850 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8851 </p>
8852 !! html/parsoid
8853 <p>Blah blah blah
8854 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8855 !! end
8856
8857 ###
8858 ### Redirects, Parsoid-only
8859 ###
8860
8861 !! test
8862 1. Simple redirect to page
8863 !! wikitext
8864 #REDIRECT [[Main Page]]
8865 !! html/parsoid
8866 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8867 !! end
8868
8869 !! test
8870 2. Other redirect variants
8871 !! wikitext
8872 #REDIRECT [[Main_Page]]
8873 !! html/parsoid
8874 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8875 !! end
8876
8877 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8878 # This tests the Parsoid bail-out code.
8879 !! test
8880 3. Other redirect variants
8881 !! wikitext
8882 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8883 !! html/parsoid
8884 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8885 !! end
8886
8887 !! test
8888 4. Redirect to a templated destination
8889 !! wikitext
8890 #REDIRECT [[{{echo|Foo}}bar]]
8891 !! html/parsoid
8892 <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"}]]}'/>
8893 !! end
8894
8895 !! test
8896 Empty redirect
8897 !! options
8898 parsoid=wt2html,wt2wt
8899 !! wikitext
8900 #REDIRECT [[]]
8901 !! html/parsoid
8902 <ol>
8903 <li>REDIRECT [[]]</li></ol>
8904 !! end
8905
8906 !! test
8907 Optional colon in #REDIRECT
8908 !! options
8909 # the colon is archaic syntax. we support it for wt2html, but we
8910 # don't care that it roundtrips back to the modern syntax.
8911 parsoid=wt2html,html2html
8912 !! wikitext
8913 #REDIRECT:[[Main Page]]
8914 !! html/parsoid
8915 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8916 !! end
8917
8918 !! test
8919 Whitespace in #REDIRECT with optional colon
8920 !! options
8921 # the colon and gratuitous whitespace is archaic syntax. we support
8922 # it for wt2html, but we don't care that it roundtrips back to the
8923 # modern syntax (without extra whitespace)
8924 parsoid=wt2html,html2html
8925 !! wikitext
8926
8927 #REDIRECT
8928 :
8929 [[Main Page]]
8930 !! html/parsoid
8931 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8932 !! end
8933
8934 !! test
8935 Piped link in #REDIRECT
8936 !! options
8937 # content after piped link is ignored. we support this syntax,
8938 # but don't care that the piped link is lost when we roundtrip this.
8939 parsoid=wt2html
8940 !! wikitext
8941 #REDIRECT [[Main Page|bar]]
8942 !! html/parsoid
8943 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8944 !! end
8945
8946 !! test
8947 Redirect to category (T104502)
8948 !! options
8949 parsoid=wt2html,wt2wt
8950 !! wikitext
8951 #REDIRECT [[Category:Foo]]
8952 !! html/parsoid
8953 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8954 !! end
8955
8956 !! test
8957 Redirect to category with URL encoding (T104502)
8958 !! options
8959 parsoid=wt2html
8960 !! wikitext
8961 #REDIRECT [[Category%3AFoo]]
8962 !! html/parsoid
8963 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8964 !! end
8965
8966 !! test
8967 Redirect to category page
8968 !! wikitext
8969 #REDIRECT [[:Category:Foo]]
8970 !! html/parsoid
8971 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8972 !! end
8973
8974 !! test
8975 Redirect to image page (1)
8976 !! wikitext
8977 #REDIRECT [[File:Wiki.png]]
8978 !! html/parsoid
8979 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8980 !! end
8981
8982 !! test
8983 Redirect to image page (2)
8984 !! wikitext
8985 #REDIRECT [[Image:Wiki.png]]
8986 !! html/parsoid
8987 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8988 !! end
8989
8990 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8991 # Next test confirms this.
8992 !! test
8993 Redirect to language (1) (T104918)
8994 !! options
8995 parsoid=wt2html,wt2wt,html2html
8996 !! wikitext
8997 #REDIRECT [[en:File:Wiki.png]]
8998 !! html/parsoid
8999 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9000 !! end
9001
9002 !! test
9003 Redirect to language (2) (T104918)
9004 !! wikitext
9005 #REDIRECT [[:en:File:Wiki.png]]
9006 !! html/parsoid
9007 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9008 !! end
9009
9010 !! test
9011 Redirect to interwiki (T104918)
9012 !! wikitext
9013 #REDIRECT [[meatball:File:Wiki.png]]
9014 !! html/parsoid
9015 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9016 !! end
9017
9018 !! test
9019 Non-English #REDIRECT
9020 !! options
9021 language=is
9022 !! wikitext
9023 #TILVÍSUN [[Main Page]]
9024 !! html/parsoid
9025 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9026 !! end
9027
9028 !! test
9029 Redirect syntax under text isn't considered a redirect
9030 !! wikitext
9031 some text
9032 #redirect [[Main Page]]
9033 !! html/parsoid
9034 <p>some text</p>
9035 <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>
9036 !! end
9037
9038 # FIXME: Should hoist the redirect to the top of the page and ensure there
9039 # is only one.
9040 !! test
9041 New redirect
9042 !! options
9043 parsoid=html2wt
9044 !! html/parsoid
9045 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9046 !! wikitext
9047 Foo
9048 #REDIRECT [[Foo]]
9049 !! end
9050
9051 ##
9052 ## XHTML tidiness
9053 ###
9054
9055 !! test
9056 <br> to <br />
9057 !! wikitext
9058 1<br>2<br />3
9059 !! html
9060 <p>1<br />2<br />3
9061 </p>
9062 !! end
9063
9064 !! test
9065 Broken br tag sanitization
9066 !! wikitext
9067 </br>
9068 !! html/php
9069 <p>&lt;/br&gt;
9070 </p>
9071 !! end
9072
9073 # TODO: Fix html2html mode (T53055)!
9074 !! test
9075 Parsoid: Broken br tag recognition
9076 !! options
9077 parsoid=wt2html
9078 !! wikitext
9079 </br>
9080
9081 <br/ >
9082 !! html+tidy
9083 <p><br /></p>
9084 <p><br /></p>
9085 !! end
9086
9087 !! test
9088 Incorrecly removing closing slashes from correctly formed XHTML
9089 !! wikitext
9090 <br style="clear:both;" />
9091 !! html
9092 <p><br style="clear:both;" />
9093 </p>
9094 !! end
9095
9096 !! test
9097 Failing to transform badly formed HTML into correct XHTML
9098 !! wikitext
9099 <br style="clear: left;">
9100 <br style="clear: right;">
9101 <br style="clear: both;">
9102 !! html
9103 <p><br style="clear: left;" />
9104 <br style="clear: right;" />
9105 <br style="clear: both;" />
9106 </p>
9107 !!end
9108
9109 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9110 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9111 !! test
9112 Handling html with a div self-closing tag
9113 !! wikitext
9114 <div title />
9115 <div title/>
9116 <div title/ >
9117 <div title=bar />
9118 <div title=bar/>
9119 <div title=bar/ >
9120 !! html/php
9121 <p>&lt;div title /&gt;
9122 &lt;div title/&gt;
9123 </p>
9124 <div>
9125 <p>&lt;div title=bar /&gt;
9126 &lt;div title=bar/&gt;
9127 </p>
9128 <div title="bar/"></div>
9129 </div>
9130
9131 !! html/parsoid
9132 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9133 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9134 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9135 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9136 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9137 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9138 !! end
9139
9140 !! test
9141 Handling html with a br self-closing tag
9142 !! wikitext
9143 <br title />
9144 <br title/>
9145 <br title/ >
9146 <br title=bar />
9147 <br title=bar/>
9148 <br title=bar/ >
9149 !! html/php
9150 <p><br title="" />
9151 <br title="" />
9152 <br />
9153 <br title="bar" />
9154 <br title="bar" />
9155 <br title="bar/" />
9156 </p>
9157 !! html/parsoid
9158 <p><br title="" />
9159 <br title="" />
9160 <br title="" />
9161 <br title="bar" />
9162 <br title="bar" />
9163 <br title="bar/" />
9164 </p>
9165 !! end
9166
9167 !! test
9168 Horizontal ruler (should it add that extra space?)
9169 !! wikitext
9170 <hr>
9171 <hr >
9172 foo <hr
9173 > bar
9174 !! html+tidy
9175 <hr />
9176 <hr />
9177 <p>foo</p>
9178 <hr />
9179 <p>bar</p>
9180 !! end
9181
9182 !! test
9183 Horizontal ruler -- 4+ dashes render hr
9184 !! wikitext
9185 ----
9186 !! html
9187 <hr />
9188
9189 !! end
9190
9191 !! test
9192 Horizontal ruler -- eats additional dashes on the same line
9193 !! wikitext
9194 ---------
9195 !! html
9196 <hr />
9197
9198 !! end
9199
9200 !! test
9201 Horizontal ruler -- does not collapse dashes on consecutive lines
9202 !! wikitext
9203 ----
9204 ----
9205 !! html
9206 <hr />
9207 <hr />
9208
9209 !! end
9210
9211 !! test
9212 Horizontal ruler -- <4 dashes render as plain text
9213 !! wikitext
9214 ---
9215 !! html
9216 <p>---
9217 </p>
9218 !! end
9219
9220 !! test
9221 Horizontal ruler -- Supports content following dashes on same line
9222 !! wikitext
9223 ---- Foo
9224 !! html
9225 <hr /> Foo
9226
9227 !! html+tidy
9228 <hr />
9229 <p>Foo</p>
9230 !! end
9231
9232 ###
9233 ### Block-level elements
9234 ###
9235 !! test
9236 Common list
9237 !! wikitext
9238 *Common list
9239 * item 2
9240 *item 3
9241 !! html
9242 <ul><li>Common list</li>
9243 <li> item 2</li>
9244 <li>item 3</li></ul>
9245
9246 !! end
9247
9248 !! test
9249 Numbered list
9250 !! wikitext
9251 #Numbered list
9252 #item 2
9253 # item 3
9254 !! html
9255 <ol><li>Numbered list</li>
9256 <li>item 2</li>
9257 <li> item 3</li></ol>
9258
9259 !! end
9260
9261 !! test
9262 Mixed list
9263 !! wikitext
9264 *Mixed list
9265 *# with numbers
9266 ** and bullets
9267 *# and numbers
9268 *bullets again
9269 **bullet level 2
9270 ***bullet level 3
9271 ***#Number on level 4
9272 **bullet level 2
9273 **#Number on level 3
9274 **#Number on level 3
9275 *#number level 2
9276 *Level 1
9277 *** Level 3
9278 #** Level 3, but ordered
9279 !! html
9280 <ul><li>Mixed list
9281 <ol><li> with numbers</li></ol>
9282 <ul><li> and bullets</li></ul>
9283 <ol><li> and numbers</li></ol></li>
9284 <li>bullets again
9285 <ul><li>bullet level 2
9286 <ul><li>bullet level 3
9287 <ol><li>Number on level 4</li></ol></li></ul></li>
9288 <li>bullet level 2
9289 <ol><li>Number on level 3</li>
9290 <li>Number on level 3</li></ol></li></ul>
9291 <ol><li>number level 2</li></ol></li>
9292 <li>Level 1
9293 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9294 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9295
9296 !! end
9297
9298 !! test
9299 1. Nested mixed wikitext and html list
9300 !! wikitext
9301 * hi
9302 * <ul><li>ho</li></ul>
9303 * hi
9304 ** ho
9305 !! html/php
9306 <ul><li> hi</li>
9307 <li> <ul><li>ho</li></ul></li>
9308 <li> hi
9309 <ul><li> ho</li></ul></li></ul>
9310
9311 !! html/parsoid
9312 <ul><li> hi</li>
9313 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9314 <li> hi
9315 <ul><li> ho</li></ul></li></ul>
9316 !! end
9317
9318 !! test
9319 2. Nested mixed wikitext and html list (incompatible)
9320 !! wikitext
9321 ; hi
9322 : {{echo|<li>ho</li>}}
9323 !! html/php
9324 <dl><dt> hi</dt>
9325 <dd> <li>ho</li></dd></dl>
9326
9327 !! html/parsoid
9328 <dl><dt> hi</dt>
9329 <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>
9330 !! end
9331
9332 !! test
9333 Nested lists 1
9334 !! wikitext
9335 *foo
9336 **bar
9337 !! html
9338 <ul><li>foo
9339 <ul><li>bar</li></ul></li></ul>
9340
9341 !! end
9342
9343 !! test
9344 Nested lists 2
9345 !! wikitext
9346 **foo
9347 *bar
9348 !! html
9349 <ul><li><ul><li>foo</li></ul></li>
9350 <li>bar</li></ul>
9351
9352 !! end
9353
9354 !! test
9355 Nested lists 3 (first element empty)
9356 !! wikitext
9357 *
9358 **bar
9359 !! html
9360 <ul><li>
9361 <ul><li>bar</li></ul></li></ul>
9362
9363 !! end
9364
9365 !! test
9366 Nested lists 4 (first element empty)
9367 !! wikitext
9368 **
9369 *bar
9370 !! html
9371 <ul><li><ul><li></li></ul></li>
9372 <li>bar</li></ul>
9373
9374 !! end
9375
9376 !! test
9377 Nested lists 5 (both elements empty)
9378 !! wikitext
9379 **
9380 *
9381 !! html
9382 <ul><li><ul><li></li></ul></li>
9383 <li></li></ul>
9384
9385 !! end
9386
9387 !! test
9388 Nested lists 6 (both elements empty)
9389 !! wikitext
9390 *
9391 **
9392 !! html
9393 <ul><li>
9394 <ul><li></li></ul></li></ul>
9395
9396 !! end
9397
9398 !! test
9399 Nested lists 7 (skip initial nesting levels)
9400 !! wikitext
9401 *** foo
9402 !! html
9403 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9404
9405 !! end
9406
9407 !! test
9408 Nested lists 8 (multiple nesting transitions)
9409 !! wikitext
9410 * foo
9411 *** bar
9412 ** baz
9413 * boo
9414 !! html
9415 <ul><li> foo
9416 <ul><li><ul><li> bar</li></ul></li>
9417 <li> baz</li></ul></li>
9418 <li> boo</li></ul>
9419
9420 !! end
9421
9422 !! test
9423 Nested lists 9 (extension interaction)
9424 !! options
9425 parsoid
9426 !! wikitext
9427 *<references />
9428 !! html/parsoid
9429 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9430 !! end
9431
9432 !! test
9433 1. Lists with start-of-line-transparent tokens before bullets: Comments
9434 !! wikitext
9435 *foo
9436 *<!--cmt-->bar
9437 <!--cmt-->*baz
9438 !! html
9439 <ul><li>foo</li>
9440 <li>bar</li>
9441 <li>baz</li></ul>
9442
9443 !! end
9444
9445 !! test
9446 2. Lists with start-of-line-transparent tokens before bullets: Template close
9447 !! wikitext
9448 *foo {{echo|bar
9449 }}*baz
9450 !! html
9451 <ul><li>foo bar</li>
9452 <li>baz</li></ul>
9453
9454 !! end
9455
9456 !! test
9457 List items are not parsed correctly following a <pre> block (T2785)
9458 !! wikitext
9459 * <pre>foo</pre>
9460 * <pre>bar</pre>
9461 * zar
9462 !! html/php
9463 <ul><li> <pre>foo</pre></li>
9464 <li> <pre>bar</pre></li>
9465 <li> zar</li></ul>
9466
9467 !! html/parsoid
9468 <ul><li> <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9469 <li> <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9470 <li> zar</li></ul>
9471 !! end
9472
9473 !! test
9474 List items from template
9475 !! wikitext
9476
9477 {{inner list}}
9478 * item 2
9479
9480 * item 0
9481 {{inner list}}
9482 * item 2
9483
9484 * item 0
9485 * notSOL{{inner list}}
9486 * item 2
9487 !! html
9488 <ul><li> item 1</li>
9489 <li> item 2</li></ul>
9490 <ul><li> item 0</li>
9491 <li> item 1</li>
9492 <li> item 2</li></ul>
9493 <ul><li> item 0</li>
9494 <li> notSOL</li>
9495 <li> item 1</li>
9496 <li> item 2</li></ul>
9497
9498 !! end
9499
9500 !! test
9501 List interrupted by empty line or heading
9502 !! wikitext
9503 * foo
9504
9505 ** bar
9506 == A heading ==
9507 * Another list item
9508 !! html
9509 <ul><li> foo</li></ul>
9510 <ul><li><ul><li> bar</li></ul></li></ul>
9511 <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>
9512 <ul><li> Another list item</li></ul>
9513
9514 !!end
9515
9516 !!test
9517 Multiple list tags generated by templates
9518 !! wikitext
9519 {{echo|<li>}}a
9520 {{echo|<li>}}b
9521 {{echo|<li>}}c
9522 !! html
9523 <li>a
9524 <li>b
9525 <li>c</li>
9526 </li>
9527 </li>
9528
9529 !! html+tidy
9530 <ul>
9531 <li>a</li>
9532 <li>b</li>
9533 <li>c</li>
9534 </ul>
9535 !!end
9536
9537 !!test
9538 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9539 !! wikitext
9540 *a
9541 <!--This line will NOT split the list-->
9542 *b
9543 <!--This line will NOT split the list either-->
9544 *c
9545 <!--foo--> <!----> <!--This line NOT split the list either-->
9546 *d
9547 !! html
9548 <ul><li>a</li>
9549 <li>b</li>
9550 <li>c</li>
9551 <li>d</li></ul>
9552
9553 !!end
9554
9555 !!test
9556 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9557 !! wikitext
9558 *a
9559 <!--This line will NOT split the list-->
9560 *b
9561 <!--This line will NOT split the list either-->
9562 *c
9563 <!--foo--> <!----> <!--This line NOT split the list
9564 either-->
9565 *d
9566 !! html
9567 <ul><li>a</li>
9568 <li>b</li>
9569 <li>c</li>
9570 <li>d</li></ul>
9571
9572 !!end
9573
9574 !!test
9575 Test the li-hack
9576 (The PHP parser relies on Tidy for the hack)
9577 !!options
9578 parsoid=wt2html,wt2wt
9579 !! wikitext
9580 * foo
9581 * <li>li-hack
9582 * {{echo|<li>templated li-hack}}
9583 * <!--foo--> <li> unsupported li-hack with preceding comments
9584
9585 <ul>
9586 <li><li>not a li-hack
9587 </li>
9588 </ul>
9589 !! html+tidy
9590 <ul>
9591 <li>foo</li>
9592 <li>li-hack</li>
9593 <li>templated li-hack</li>
9594 <li>unsupported li-hack with preceding comments</li>
9595 </ul>
9596 <ul>
9597 <li>not a li-hack</li>
9598 </ul>
9599 !!end
9600
9601 !! test
9602 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9603 !! options
9604 parsoid
9605 !! wikitext
9606 # foo
9607 ## bar
9608 * foo
9609 ** bar
9610 : foo
9611 :: bar
9612 !! html
9613 <ol>
9614 <li> foo<ol>
9615 <li> bar</li>
9616 </ol></li>
9617 </ol><ul>
9618 <li> foo<ul>
9619 <li> bar</li>
9620 </ul></li>
9621 </ul><dl>
9622 <dd> foo<dl>
9623 <dd> bar</dd>
9624 </dl></dd>
9625 </dl>
9626 !! end
9627
9628 !! test
9629 Parsoid: Test of whitespace serialization with Templated bullets
9630 !! options
9631 parsoid
9632 !! wikitext
9633 * {{bullet}}
9634 !! html
9635 <ul>
9636 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9637 </ul>
9638 !! end
9639
9640 # ------------------------------------------------------------------------
9641 # The next set of tests are about Parsoid's ability to handle badly nested
9642 # tags (parse, minimize scope of fixup, and roundtrip back)
9643 # ------------------------------------------------------------------------
9644
9645 !! test
9646 Unbalanced closing block tags break a list
9647 (php parser relies on Tidy to fix up)
9648 !! wikitext
9649 <div>
9650 *a</div><div>
9651 *b</div>
9652 !! html+tidy
9653 <div>
9654 <ul>
9655 <li>a</li>
9656 </ul>
9657 </div>
9658 <div>
9659 <ul>
9660 <li>b</li>
9661 </ul>
9662 </div>
9663 !! end
9664
9665 # Parsoid fails this test, but it might be tricky to support properly.
9666 # See T70395.
9667 !! test
9668 Unbalanced closing non-block tags don't break a list
9669 (php parser relies on Tidy to fix up)
9670 !! wikitext
9671 <span>
9672 *a</span><span>
9673 *b</span>
9674 !! html/php+tidy
9675 <ul>
9676 <li><span>a</span></li>
9677 <li><span>b</span></li>
9678 </ul>
9679 !! html/parsoid
9680 <span>
9681 <ul>
9682 <li>a<span></span>
9683 </li>
9684 <li>b
9685 </li>
9686 </ul>
9687 </span>
9688 !! end
9689
9690 !! test
9691 Unclosed formatting tags that straddle lists are closed and reopened
9692 (php parser relies on Tidy to fix up)
9693 !! options
9694 parsoid=wt2html,wt2wt,html2html
9695 !! wikitext
9696 # <s> a
9697 # b </s>
9698 !! html/php+tidy
9699 <ol>
9700 <li><s>a</s></li>
9701 <li><s>b</s></li>
9702 </ol>
9703 !! html/parsoid
9704 <ol><li> <s> a</s></li>
9705 <li><s> b </s></li></ol>
9706 !! end
9707
9708 # See T70395.
9709 !!test
9710 1. List embedded in a formatting tag
9711 !! wikitext
9712 <small>
9713 * foo
9714 </small>
9715 !! html/php+tidy
9716 <ul>
9717 <li><small>foo</small></li>
9718 </ul>
9719 !! html/parsoid
9720 <small>
9721 <ul>
9722 <li> foo</li>
9723 </ul>
9724 </small>
9725 !!end
9726
9727 ## Ugly Parsoid output here
9728 ## Not sure what the right output is.
9729 !!test
9730 2. List embedded in a formatting tag
9731 !! wikitext
9732 <small>
9733 *a
9734 *b</small>
9735 !! html/php+tidy
9736 <ul>
9737 <li><small>a</small></li>
9738 <li><small>b</small></li>
9739 </ul>
9740 !! html/parsoid
9741 <small></small>
9742 <ul><small>
9743 <li>a</li>
9744 </small>
9745 <li><small>b</small></li>
9746 </ul>
9747 !!end
9748
9749 # Ugly Parsoid and PHP parser output here
9750 # Not sure if we want to make this a test!
9751 #
9752 ## !!test
9753 ## 3. Unclosed formatting tags in list elements
9754 ## !! wikitext
9755 ## *<small>a
9756 ## *<small>b
9757 ## !! html/php+tidy
9758 ## <ul>
9759 ## <li><small>a</small></li>
9760 ## <li><small><small>b</small></small></li>
9761 ## </ul>
9762 ## !! html/parsoid
9763 ## <ul>
9764 ## <li><small>a</small></li>
9765 ## <small>
9766 ## <li><small>b</small></li>
9767 ## </small></ul>
9768 ## !!end
9769
9770 # This is a bug in the PHP parser + tidy combination.
9771 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9772 # and then fostered out of the table by tidy.)
9773 # We believe the Parsoid output to be correct.
9774 !! test
9775 Table with missing opening <tr> tag
9776 !! options
9777 parsoid=wt2html,wt2wt
9778 !! wikitext
9779 <table>
9780 <td>foo</td>
9781 </tr>
9782 </table>
9783 !! html+tidy
9784 <table>
9785 <tr>
9786 <td>foo</td>
9787 </tr>
9788 </table>
9789 !! end
9790
9791 ###
9792 ### Magic Words
9793 ###
9794
9795 # Note that the current date is hard-coded as
9796 # 1970-01-01T00:02:03Z (a Thursday)
9797 # when running parser tests. The timezone is also fixed to GMT, so
9798 # local date will be identical to current date.
9799
9800 !! test
9801 Magic Word: {{CURRENTDAY}}
9802 !! wikitext
9803 {{CURRENTDAY}}
9804 !! html
9805 <p>1
9806 </p>
9807 !! end
9808
9809 !! test
9810 Magic Word: {{CURRENTDAY2}}
9811 !! wikitext
9812 {{CURRENTDAY2}}
9813 !! html
9814 <p>01
9815 </p>
9816 !! end
9817
9818 !! test
9819 Magic Word: {{CURRENTDAYNAME}}
9820 !! wikitext
9821 {{CURRENTDAYNAME}}
9822 !! html
9823 <p>Thursday
9824 </p>
9825 !! end
9826
9827 !! test
9828 Magic Word: {{CURRENTDOW}}
9829 !! wikitext
9830 {{CURRENTDOW}}
9831 !! html
9832 <p>4
9833 </p>
9834 !! end
9835
9836 !! test
9837 Magic Word: {{CURRENTMONTH}}
9838 !! wikitext
9839 {{CURRENTMONTH}}
9840 !! html
9841 <p>01
9842 </p>
9843 !! end
9844
9845 !! test
9846 Magic Word: {{CURRENTMONTH1}}
9847 !! wikitext
9848 {{CURRENTMONTH1}}
9849 !! html
9850 <p>1
9851 </p>
9852 !! end
9853
9854 !! test
9855 Magic Word: {{CURRENTMONTHABBREV}}
9856 !! wikitext
9857 {{CURRENTMONTHABBREV}}
9858 !! html
9859 <p>Jan
9860 </p>
9861 !! end
9862
9863 !! test
9864 Magic Word: {{CURRENTMONTHNAME}}
9865 !! wikitext
9866 {{CURRENTMONTHNAME}}
9867 !! html
9868 <p>January
9869 </p>
9870 !! end
9871
9872 !! test
9873 Magic Word: {{CURRENTMONTHNAMEGEN}}
9874 !! wikitext
9875 {{CURRENTMONTHNAMEGEN}}
9876 !! html
9877 <p>January
9878 </p>
9879 !! end
9880
9881 !! test
9882 Magic Word: {{CURRENTTIME}}
9883 !! wikitext
9884 {{CURRENTTIME}}
9885 !! html
9886 <p>00:02
9887 </p>
9888 !! end
9889
9890 !! test
9891 Magic Word: {{CURRENTHOUR}}
9892 !! wikitext
9893 {{CURRENTHOUR}}
9894 !! html
9895 <p>00
9896 </p>
9897 !! end
9898
9899 !! test
9900 Magic Word: {{CURRENTWEEK}} (T6594)
9901 !! wikitext
9902 {{CURRENTWEEK}}
9903 !! html
9904 <p>1
9905 </p>
9906 !! end
9907
9908 !! test
9909 Magic Word: {{CURRENTYEAR}}
9910 !! wikitext
9911 {{CURRENTYEAR}}
9912 !! html
9913 <p>1970
9914 </p>
9915 !! end
9916
9917 !! test
9918 Magic Word: {{CURRENTTIMESTAMP}}
9919 !! wikitext
9920 {{CURRENTTIMESTAMP}}
9921 !! html
9922 <p>19700101000203
9923 </p>
9924 !! end
9925
9926 !! test
9927 Magic Words LOCAL (UTC)
9928 !! wikitext
9929 * {{LOCALMONTH}}
9930 * {{LOCALMONTH1}}
9931 * {{LOCALMONTHNAME}}
9932 * {{LOCALMONTHNAMEGEN}}
9933 * {{LOCALMONTHABBREV}}
9934 * {{LOCALDAY}}
9935 * {{LOCALDAY2}}
9936 * {{LOCALDAYNAME}}
9937 * {{LOCALYEAR}}
9938 * {{LOCALTIME}}
9939 * {{LOCALHOUR}}
9940 * {{LOCALWEEK}}
9941 * {{LOCALDOW}}
9942 * {{LOCALTIMESTAMP}}
9943 !! html
9944 <ul><li> 01</li>
9945 <li> 1</li>
9946 <li> January</li>
9947 <li> January</li>
9948 <li> Jan</li>
9949 <li> 1</li>
9950 <li> 01</li>
9951 <li> Thursday</li>
9952 <li> 1970</li>
9953 <li> 00:02</li>
9954 <li> 00</li>
9955 <li> 1</li>
9956 <li> 4</li>
9957 <li> 19700101000203</li></ul>
9958
9959 !! end
9960
9961 !! test
9962 Magic Word: {{FULLPAGENAME}}
9963 !! options
9964 title=[[User:Ævar Arnfjörð Bjarmason]]
9965 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
9966 !! wikitext
9967 {{FULLPAGENAME}}
9968 !! html/*
9969 <p>User:Ævar Arnfjörð Bjarmason
9970 </p>
9971 !! end
9972
9973 !! test
9974 Magic Word: {{FULLPAGENAMEE}}
9975 !! options
9976 title=[[User:Ævar Arnfjörð Bjarmason]]
9977 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
9978 !! wikitext
9979 {{FULLPAGENAMEE}}
9980 !! html/*
9981 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9982 </p>
9983 !! end
9984
9985 !! test
9986 Magic Word: {{TALKSPACE}}
9987 !! options
9988 title=[[User:Ævar Arnfjörð Bjarmason]]
9989 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
9990 !! wikitext
9991 {{TALKSPACE}}
9992 !! html/*
9993 <p>User talk
9994 </p>
9995 !! end
9996
9997 !! test
9998 Magic Word: {{TALKSPACE}}, same namespace
9999 !! options
10000 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10001 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10002 !! wikitext
10003 {{TALKSPACE}}
10004 !! html/*
10005 <p>User talk
10006 </p>
10007 !! end
10008
10009 !! test
10010 Magic Word: {{TALKSPACE}}, main namespace
10011 !! options
10012 title=[[Parser Test]]
10013 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10014 !! wikitext
10015 {{TALKSPACE}}
10016 !! html/*
10017 <p>Talk
10018 </p>
10019 !! end
10020
10021 !! test
10022 Magic Word: {{TALKSPACEE}}
10023 !! options
10024 title=[[User:Ævar Arnfjörð Bjarmason]]
10025 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10026 !! wikitext
10027 {{TALKSPACEE}}
10028 !! html/*
10029 <p>User_talk
10030 </p>
10031 !! end
10032
10033 !! test
10034 Magic Word: {{SUBJECTSPACE}}
10035 !! options
10036 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10037 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10038 !! wikitext
10039 {{SUBJECTSPACE}}
10040 !! html/*
10041 <p>User
10042 </p>
10043 !! end
10044
10045 !! test
10046 Magic Word: {{SUBJECTSPACE}}, same namespace
10047 !! options
10048 title=[[User:Ævar Arnfjörð Bjarmason]]
10049 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10050 !! wikitext
10051 {{SUBJECTSPACE}}
10052 !! html/*
10053 <p>User
10054 </p>
10055 !! end
10056
10057 !! test
10058 Magic Word: {{SUBJECTSPACE}}, main namespace
10059 !! options
10060 title=[[Parser Test]]
10061 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10062 !! wikitext
10063 {{SUBJECTSPACE}}
10064 !! html/*
10065
10066 !! end
10067
10068 !! test
10069 Magic Word: {{SUBJECTSPACEE}}
10070 !! options
10071 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10072 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10073 !! wikitext
10074 {{SUBJECTSPACEE}}
10075 !! html/*
10076 <p>User
10077 </p>
10078 !! end
10079
10080 !! test
10081 Magic Word: {{NAMESPACE}}
10082 !! options
10083 title=[[User:Ævar Arnfjörð Bjarmason]]
10084 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10085 !! wikitext
10086 {{NAMESPACE}}
10087 !! html/*
10088 <p>User
10089 </p>
10090 !! end
10091
10092 !! test
10093 Magic Word: {{NAMESPACEE}}
10094 !! options
10095 title=[[User:Ævar Arnfjörð Bjarmason]]
10096 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10097 !! wikitext
10098 {{NAMESPACEE}}
10099 !! html/*
10100 <p>User
10101 </p>
10102 !! end
10103
10104 !! test
10105 Magic Word: {{NAMESPACENUMBER}}
10106 !! options
10107 title=[[User:Ævar Arnfjörð Bjarmason]]
10108 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10109 !! wikitext
10110 {{NAMESPACENUMBER}}
10111 !! html/*
10112 <p>2
10113 </p>
10114 !! end
10115
10116 !! test
10117 Magic Word: {{SUBPAGENAME}}
10118 !! options
10119 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10120 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10121 !! wikitext
10122 {{SUBPAGENAME}}
10123 !! html/*
10124 <p>sub ö
10125 </p>
10126 !! end
10127
10128 !! test
10129 Magic Word: {{SUBPAGENAMEE}}
10130 !! options
10131 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10132 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10133 !! wikitext
10134 {{SUBPAGENAMEE}}
10135 !! html/*
10136 <p>sub_%C3%B6
10137 </p>
10138 !! end
10139
10140 !! test
10141 Magic Word: {{ROOTPAGENAME}}
10142 !! options
10143 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10144 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10145 !! wikitext
10146 {{ROOTPAGENAME}}
10147 !! html/*
10148 <p>Ævar Arnfjörð Bjarmason
10149 </p>
10150 !! end
10151
10152 !! test
10153 Magic Word: {{ROOTPAGENAMEE}}
10154 !! options
10155 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10156 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10157 !! wikitext
10158 {{ROOTPAGENAMEE}}
10159 !! html/*
10160 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10161 </p>
10162 !! end
10163
10164 !! test
10165 Magic Word: {{BASEPAGENAME}}
10166 !! options
10167 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10168 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10169 !! wikitext
10170 {{BASEPAGENAME}}
10171 !! html/*
10172 <p>Ævar Arnfjörð Bjarmason
10173 </p>
10174 !! end
10175
10176 !! test
10177 Magic Word: {{BASEPAGENAMEE}}
10178 !! options
10179 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10180 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10181 !! wikitext
10182 {{BASEPAGENAMEE}}
10183 !! html/*
10184 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10185 </p>
10186 !! end
10187
10188 !! test
10189 Magic Word: {{TALKPAGENAME}}
10190 !! options
10191 title=[[User:Ævar Arnfjörð Bjarmason]]
10192 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10193 !! wikitext
10194 {{TALKPAGENAME}}
10195 !! html/*
10196 <p>User talk:Ævar Arnfjörð Bjarmason
10197 </p>
10198 !! end
10199
10200 !! test
10201 Magic Word: {{TALKPAGENAMEE}}
10202 !! options
10203 title=[[User:Ævar Arnfjörð Bjarmason]]
10204 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10205 !! wikitext
10206 {{TALKPAGENAMEE}}
10207 !! html/*
10208 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10209 </p>
10210 !! end
10211
10212 !! test
10213 Magic Word: {{SUBJECTPAGENAME}}
10214 !! options
10215 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10216 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10217 !! wikitext
10218 {{SUBJECTPAGENAME}}
10219 !! html/*
10220 <p>User:Ævar Arnfjörð Bjarmason
10221 </p>
10222 !! end
10223
10224 !! test
10225 Magic Word: {{SUBJECTPAGENAMEE}}
10226 !! options
10227 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10228 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10229 !! wikitext
10230 {{SUBJECTPAGENAMEE}}
10231 !! html/*
10232 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10233 </p>
10234 !! end
10235
10236 !! test
10237 Magic Word: {{NUMBEROFFILES}}
10238 !! options
10239 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10240 !! wikitext
10241 {{NUMBEROFFILES}}
10242 !! html/*
10243 <p>7
10244 </p>
10245 !! end
10246
10247 !! test
10248 Magic Word: {{PAGENAME}}
10249 !! options
10250 title=[[User:Ævar Arnfjörð Bjarmason]]
10251 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10252 !! wikitext
10253 {{PAGENAME}}
10254 !! html/*
10255 <p>Ævar Arnfjörð Bjarmason
10256 </p>
10257 !! end
10258
10259 !! test
10260 Magic Word: {{PAGENAME}} with metacharacters
10261 !! options
10262 title=[['foo & bar = baz']]
10263 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10264 !! wikitext
10265 ''{{PAGENAME}}''
10266 !! html/php
10267 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10268 </p>
10269 !! html+tidy
10270 <p><i>'foo &amp; bar = baz'</i></p>
10271 !! end
10272
10273 !! test
10274 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10275 !! options
10276 title=[[*RFC 1234 http://example.com/]]
10277 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10278 !! wikitext
10279 {{PAGENAME}}
10280 !! html/php
10281 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10282 </p>
10283 !! html+tidy
10284 <p>*RFC 1234 http://example.com/</p>
10285 !! end
10286
10287 !! test
10288 Magic Word: {{PAGENAMEE}}
10289 !! options
10290 title=[[User:Ævar Arnfjörð Bjarmason]]
10291 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10292 !! wikitext
10293 {{PAGENAMEE}}
10294 !! html/*
10295 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10296 </p>
10297 !! end
10298
10299 !! test
10300 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10301 !! options
10302 title=[[*RFC 1234 http://example.com/]]
10303 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10304 !! wikitext
10305 {{PAGENAMEE}}
10306 !! html/php
10307 <p>&#42;RFC_1234_http&#58;//example.com/
10308 </p>
10309 !! html+tidy
10310 <p>*RFC_1234_http://example.com/</p>
10311 !! end
10312
10313 !! test
10314 Magic Word: {{REVISIONID}}
10315 !! options
10316 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10317 !! wikitext
10318 {{REVISIONID}}
10319 !! html/*
10320 <p>1337
10321 </p>
10322 !! end
10323
10324 !! test
10325 Magic Word: {{SCRIPTPATH}}
10326 !! options
10327 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10328 !! wikitext
10329 {{SCRIPTPATH}}
10330 !! html/*
10331
10332 !! end
10333
10334 !! test
10335 Magic Word: {{STYLEPATH}}
10336 !! options
10337 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10338 !! wikitext
10339 {{STYLEPATH}}
10340 !! html/*
10341 <p>/skins
10342 </p>
10343 !! end
10344
10345 !! test
10346 Magic Word: {{SERVER}}
10347 !! options
10348 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10349 !! wikitext
10350 {{SERVER}}
10351 !! html/*
10352 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10353 </p>
10354 !! end
10355
10356 !! test
10357 Magic Word: {{SERVERNAME}}
10358 !! options
10359 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10360 !! wikitext
10361 {{SERVERNAME}}
10362 !! html/*
10363 <p>example.org
10364 </p>
10365 !! end
10366
10367 !! test
10368 Magic Word: {{SITENAME}}
10369 !! options
10370 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10371 !! wikitext
10372 {{SITENAME}}
10373 !! html/*
10374 <p>MediaWiki
10375 </p>
10376 !! end
10377
10378 !! test
10379 Magic Word: {{PAGELANGUAGE}}
10380 !! options
10381 language=fr
10382 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10383 !! wikitext
10384 {{PAGELANGUAGE}}
10385 !! html/*
10386 <p>fr
10387 </p>
10388 !! end
10389
10390 !! test
10391 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10392 !! options
10393 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10394 !! wikitext
10395 {{PAGELANGUAGE}}
10396 !! html/*
10397 <p>en
10398 </p>
10399 !! end
10400
10401 !! test
10402 Case-sensitive magic words, when cased differently, should just be template transclusions
10403 !! wikitext
10404 {{CurrentMonth}}
10405 {{currentday}}
10406 {{cURreNTweEK}}
10407 {{currentHour}}
10408 !! html
10409 <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>
10410 <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>
10411 <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>
10412 <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>
10413 </p>
10414 !! end
10415
10416 !! test
10417 Case-insensitive magic words should still work with weird casing.
10418 !! wikitext
10419 {{sErVeRNaMe}}
10420 {{LCFirst:AOEU}}
10421 {{ucFIRST:aoeu}}
10422 {{SERver}}
10423 !! html
10424 <p>example.org
10425 aOEU
10426 Aoeu
10427 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10428 </p>
10429 !! end
10430
10431 # From plwiki:PLOS_ONE
10432 !! test
10433 Parsoid: Page property magic word with magic word contents
10434 !! wikitext
10435 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10436 !! html/parsoid
10437 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
10438 !! end
10439
10440 !! test
10441 Parsoid: Template-generated DISPLAYTITLE
10442 !! wikitext
10443 {{{{echo|DISPLAYTITLE}}:Foo}}
10444 !! html/parsoid
10445 <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}}]}'/>
10446 !! end
10447
10448 !! test
10449 Namespace 1 {{ns:1}}
10450 !! wikitext
10451 {{ns:1}}
10452 !! html
10453 <p>Talk
10454 </p>
10455 !! end
10456
10457 !! test
10458 Namespace 1 {{ns:01}}
10459 !! wikitext
10460 {{ns:01}}
10461 !! html
10462 <p>Talk
10463 </p>
10464 !! end
10465
10466 !! test
10467 Namespace 0 {{ns:0}} (T6783)
10468 !! wikitext
10469 {{ns:0}}
10470 !! html
10471
10472 !! end
10473
10474 !! test
10475 Namespace 0 {{ns:00}} (T6783)
10476 !! wikitext
10477 {{ns:00}}
10478 !! html
10479
10480 !! end
10481
10482 !! test
10483 Namespace -1 {{ns:-1}}
10484 !! wikitext
10485 {{ns:-1}}
10486 !! html
10487 <p>Special
10488 </p>
10489 !! end
10490
10491 !! test
10492 Namespace User {{ns:User}}
10493 !! wikitext
10494 {{ns:User}}
10495 !! html
10496 <p>User
10497 </p>
10498 !! end
10499
10500 !! test
10501 Namespace User talk {{ns:User_talk}}
10502 !! wikitext
10503 {{ns:User_talk}}
10504 !! html
10505 <p>User talk
10506 </p>
10507 !! end
10508
10509 !! test
10510 Namespace User talk {{ns:uSeR tAlK}}
10511 !! wikitext
10512 {{ns:uSeR tAlK}}
10513 !! html
10514 <p>User talk
10515 </p>
10516 !! end
10517
10518 !! test
10519 Namespace File {{ns:File}}
10520 !! wikitext
10521 {{ns:File}}
10522 !! html
10523 <p>File
10524 </p>
10525 !! end
10526
10527 !! test
10528 Namespace File {{ns:Image}}
10529 !! wikitext
10530 {{ns:Image}}
10531 !! html
10532 <p>File
10533 </p>
10534 !! end
10535
10536 !! test
10537 Namespace (lang=de) Benutzer {{ns:User}}
10538 !! options
10539 language=de
10540 !! wikitext
10541 {{ns:User}}
10542 !! html
10543 <p>Benutzer
10544 </p>
10545 !! end
10546
10547 !! test
10548 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10549 !! options
10550 language=de
10551 !! wikitext
10552 {{ns:3}}
10553 !! html
10554 <p>Benutzer Diskussion
10555 </p>
10556 !! end
10557
10558 !! test
10559 Urlencode
10560 !! wikitext
10561 {{urlencode:hi world?!}}
10562 {{urlencode:hi world?!|WIKI}}
10563 {{urlencode:hi world?!|PATH}}
10564 {{urlencode:hi world?!|QUERY}}
10565 !! html/php
10566 <p>hi+world%3F%21
10567 hi_world%3F!
10568 hi%20world%3F%21
10569 hi+world%3F%21
10570 </p>
10571 !! end
10572
10573 !! test
10574 Magic Word: prioritize type info over data-parsoid
10575 !! options
10576 parsoid=html2wt
10577 !! html/parsoid
10578 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10579 !! wikitext
10580 __FORCETOC__
10581 !! end
10582
10583 !! test
10584 Magic Word: serialize on separate line (parsoid)
10585 !! options
10586 parsoid=wt2wt,html2wt
10587 !! wikitext
10588 foo
10589 __NOTOC__
10590 bar
10591 !! html/parsoid
10592 foo<meta property="mw:PageProp/notoc"/>bar
10593 !! end
10594
10595 !! test
10596 Magic Word: rt non-english wikis
10597 !! options
10598 parsoid=wt2wt
10599 language=de
10600 !! wikitext
10601 __NOEDITSECTION__
10602 !! html/parsoid
10603 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10604 !! end
10605
10606 !!test
10607 __proto__ is treated as normal wikitext (T105997)
10608 !!wikitext
10609 __proto__
10610 !!html
10611 <p>__proto__
10612 </p>
10613 !!end
10614
10615 ###
10616 ### Magic links
10617 ###
10618 !! test
10619 Magic links: internal link to RFC (T2479)
10620 !! wikitext
10621 [[RFC 123]]
10622 !! html/php
10623 <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>
10624 </p>
10625 !! html/parsoid
10626 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10627 !! end
10628
10629 !! test
10630 Magic links: RFC (T2479)
10631 !! wikitext
10632 RFC 822
10633 !! html/php
10634 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10635 </p>
10636 !! html/parsoid
10637 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10638 !! end
10639
10640 !! test
10641 Magic links: RFC (T67278)
10642 !! wikitext
10643 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10644 !! html/php
10645 <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.
10646 </p>
10647 !! html/parsoid
10648 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10649 !! end
10650
10651 !! test
10652 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
10653 !! wikitext
10654 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10655 RFC
10656 822
10657 !! html/php
10658 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10659 RFC
10660 822
10661 </p>
10662 !! html/parsoid
10663 <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>
10664 RFC
10665 822</p>
10666 !! end
10667
10668 !! test
10669 Magic links: ISBN (T3937)
10670 !! wikitext
10671 ISBN 0-306-40615-2
10672 !! html/php
10673 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10674 </p>
10675 !! html/parsoid
10676 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10677 !! end
10678
10679 !! test
10680 Magic links: ISBN (T67278)
10681 !! wikitext
10682 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10683 !! html/php
10684 <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.
10685 </p>
10686 !! html/parsoid
10687 <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>
10688 !! end
10689
10690 !! test
10691 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
10692 !! wikitext
10693 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10694 ISBN
10695 9780316098113
10696 ISBN 978
10697 0316098113
10698 !! html/php
10699 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10700 ISBN
10701 9780316098113
10702 ISBN 978
10703 0316098113
10704 </p>
10705 !! html/parsoid
10706 <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>
10707 ISBN
10708 9780316098113
10709 ISBN 978
10710 0316098113</p>
10711 !! end
10712
10713 !! test
10714 Magic links: PMID incorrectly converts space to underscore
10715 !! wikitext
10716 PMID 1234
10717 !! html/php
10718 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10719 </p>
10720 !! html/parsoid
10721 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10722 !! end
10723
10724 !! test
10725 Magic links: PMID (T67278)
10726 !! wikitext
10727 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10728 !! html/php
10729 <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.
10730 </p>
10731 !! html/parsoid
10732 <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>
10733 !! end
10734
10735 !! test
10736 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
10737 !! wikitext
10738 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10739 PMID
10740 1234
10741 !! html/php
10742 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10743 PMID
10744 1234
10745 </p>
10746 !! html/parsoid
10747 <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>
10748 PMID
10749 1234</p>
10750 !! end
10751
10752 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10753 # since these are ExtLinkText, not MagicLinkText
10754 !! test
10755 Magic links: use appropriate serialization for "almost" magic links.
10756 !! wikitext
10757 X[[Special:BookSources/0978739256|foo]]
10758
10759 X[//tools.ietf.org/html/rfc1234 foo]
10760 !! html/php
10761 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10762 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10763 </p>
10764 !! html/parsoid
10765 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10766 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10767 !! end
10768
10769 !! test
10770 Magic links: All disabled (T47942)
10771 !! options
10772 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10773 !! wikitext
10774 ISBN 0-306-40615-2
10775 PMID 1234
10776 RFC 4321
10777 !! html/php
10778 <p>ISBN 0-306-40615-2
10779 PMID 1234
10780 RFC 4321
10781 </p>
10782 !! end
10783
10784 ###
10785 ### Templates
10786 ####
10787
10788 !! test
10789 Nonexistent template
10790 !! wikitext
10791 {{thistemplatedoesnotexist}}
10792 !! html
10793 <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>
10794 </p>
10795 !! end
10796
10797 !! test
10798 Template with invalid target containing tags
10799 !! wikitext
10800 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10801 !! html
10802 <p>{{a<b>b</b>|foo|a=b|a = b}}
10803 </p>
10804 !! end
10805
10806 !! test
10807 Template with invalid target containing unclosed tag
10808 !! wikitext
10809 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10810 !! html
10811 <p>{{a<b>|foo|a=b|a = b}}</b>
10812 </p>
10813 !! end
10814
10815 !! test
10816 Template with invalid target containing wikilink
10817 !! wikitext
10818 {{[[Main Page]]}}
10819 !! html/php
10820 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10821 </p>
10822 !! html/parsoid
10823 <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>
10824 !! end
10825
10826 !! test
10827 Template with just whitespace in it, T70421
10828 !! wikitext
10829 {{echo|{{ }}}}
10830 !! html/parsoid
10831 <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>
10832 !! end
10833
10834 !! article
10835 Template:test
10836 !! text
10837 This is a test template
10838 !! endarticle
10839
10840 !! test
10841 Simple template
10842 !! wikitext
10843 {{test}}
10844 !! html
10845 <p>This is a test template
10846 </p>
10847 !! end
10848
10849 !! test
10850 Template with explicit namespace
10851 !! wikitext
10852 {{Template:test}}
10853 !! html
10854 <p>This is a test template
10855 </p>
10856 !! end
10857
10858
10859 !! article
10860 Template:paramtest
10861 !! text
10862 This is a test template with parameter {{{param}}}
10863 !! endarticle
10864
10865 !! test
10866 Template parameter
10867 !! wikitext
10868 {{paramtest|param=foo}}
10869 !! html
10870 <p>This is a test template with parameter foo
10871 </p>
10872 !! end
10873
10874 !! article
10875 Template:paramtestnum
10876 !! text
10877 [[{{{1}}}|{{{2}}}]]
10878 !! endarticle
10879
10880 !! test
10881 Template unnamed parameter
10882 !! wikitext
10883 {{paramtestnum|Main Page|the main page}}
10884 !! html
10885 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10886 </p>
10887 !! end
10888
10889 !! article
10890 Template:templatesimple
10891 !! text
10892 (test)
10893 !! endarticle
10894
10895 !! article
10896 Template:templateredirect
10897 !! text
10898 #redirect [[Template:templatesimple]]
10899 !! endarticle
10900
10901 !! article
10902 Template:templateasargtestnum
10903 !! text
10904 {{{{{1}}}}}
10905 !! endarticle
10906
10907 !! article
10908 Template:templateasargtest
10909 !! text
10910 {{template{{{templ}}}}}
10911 !! endarticle
10912
10913 !! article
10914 Template:templateasargtest2
10915 !! text
10916 {{{{{templ}}}}}
10917 !! endarticle
10918
10919 !! test
10920 Template with template name as unnamed argument
10921 !! wikitext
10922 {{templateasargtestnum|templatesimple}}
10923 !! html
10924 <p>(test)
10925 </p>
10926 !! end
10927
10928 !! test
10929 Template with template name as argument
10930 !! wikitext
10931 {{templateasargtest|templ=simple}}
10932 !! html
10933 <p>(test)
10934 </p>
10935 !! end
10936
10937 !! test
10938 Template with template name as argument (2)
10939 !! wikitext
10940 {{templateasargtest2|templ=templatesimple}}
10941 !! html
10942 <p>(test)
10943 </p>
10944 !! end
10945
10946 !! article
10947 Template:templateasargtestdefault
10948 !! text
10949 {{{{{templ|templatesimple}}}}}
10950 !! endarticle
10951
10952 !! article
10953 Template:templa
10954 !! text
10955 '''templ'''
10956 !! endarticle
10957
10958 !! test
10959 Template with default value
10960 !! wikitext
10961 {{templateasargtestdefault}}
10962 !! html
10963 <p>(test)
10964 </p>
10965 !! end
10966
10967 !! test
10968 Template with default value (value set)
10969 !! wikitext
10970 {{templateasargtestdefault|templ=templa}}
10971 !! html
10972 <p><b>templ</b>
10973 </p>
10974 !! end
10975
10976 !! test
10977 Template redirect
10978 !! wikitext
10979 {{templateredirect}}
10980 !! html/php
10981 <p>(test)
10982 </p>
10983 !! html/parsoid
10984 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10985 !! end
10986
10987 !! test
10988 Template with argument in separate line
10989 !! wikitext
10990 {{ templateasargtest |
10991 templ = simple }}
10992 !! html
10993 <p>(test)
10994 </p>
10995 !! end
10996
10997 !! test
10998 Template with complex template as argument
10999 !! wikitext
11000 {{paramtest|
11001 param ={{ templateasargtest |
11002 templ = simple }}}}
11003 !! html
11004 <p>This is a test template with parameter (test)
11005 </p>
11006 !! end
11007
11008 !! test
11009 Template with thumb image (with link in description)
11010 !! wikitext
11011 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11012 !! html/php
11013 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>
11014
11015 !! html+tidy
11016 <p>This is a test template with parameter</p>
11017 <div class="thumb tright">
11018 <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>
11019 <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>
11020 </div>
11021 </div>
11022 !! html/parsoid
11023 <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>
11024 !! end
11025
11026 !! article
11027 Template:complextemplate
11028 !! text
11029 {{{1}}} {{paramtest|
11030 param ={{{param}}}}}
11031 !! endarticle
11032
11033 !! test
11034 Template with complex arguments
11035 !! wikitext
11036 {{complextemplate|
11037 param ={{ templateasargtest |
11038 templ = simple }}|[[Template:complextemplate|link]]}}
11039 !! html
11040 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11041 </p>
11042 !! end
11043
11044 !! test
11045 T2553: link with two variables in a piped link
11046 !! wikitext
11047 {|
11048 |[[{{{1}}}|{{{2}}}]]
11049 |}
11050 !! html/php
11051 <table>
11052 <tr>
11053 <td>[[{{{1}}}|{{{2}}}]]
11054 </td></tr></table>
11055
11056 !! html/parsoid
11057 <table>
11058 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{},"i":0}}]}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"2"},"params":{},"i":0}}]}'>{{{2}}}</span>]]</td></tr>
11059 </tbody></table>
11060 !! end
11061
11062 # See: T2553
11063 !! test
11064 Abort table cell attribute parsing on wikilink
11065 !! wikitext
11066 {|
11067 | testing [[one|two]] | three || four
11068 | testing one two | three || four
11069 | testing="[[one|two]]" | three || four
11070 |}
11071 !! html/php
11072 <table>
11073 <tr>
11074 <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>
11075 <td> four
11076 </td>
11077 <td> three </td>
11078 <td> four
11079 </td>
11080 <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>
11081 <td> four
11082 </td></tr></table>
11083
11084 !! html/parsoid
11085 <table>
11086 <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>
11087 <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>
11088 <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>
11089 </tbody></table>
11090 !! end
11091
11092 !! test
11093 Don't abort table cell attribute parsing if wikilink is found in template arg
11094 !! wikitext
11095 {|
11096 | Test {{#tag:ref|One two "[[three]]" four}}
11097 |}
11098 !! html/parsoid
11099 <table>
11100 <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>
11101 </tbody></table>
11102 !! end
11103
11104 !! test
11105 Magic variable as template parameter
11106 !! wikitext
11107 {{paramtest|param={{SITENAME}}}}
11108 !! html
11109 <p>This is a test template with parameter MediaWiki
11110 </p>
11111 !! end
11112
11113 !! article
11114 Template:linktest
11115 !! text
11116 [[{{{param}}}|link]]
11117 !! endarticle
11118
11119 !! test
11120 Template parameter as link source
11121 !! wikitext
11122 {{linktest|param=Main Page}}
11123 !! html
11124 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11125 </p>
11126 !! end
11127
11128 !!article
11129 Template:paramtest2
11130 !! text
11131 including another template, {{paramtest|param={{{arg}}}}}
11132 !! endarticle
11133
11134 !! test
11135 Template passing argument to another template
11136 !! wikitext
11137 {{paramtest2|arg='hmm'}}
11138 !! html
11139 <p>including another template, This is a test template with parameter 'hmm'
11140 </p>
11141 !! end
11142
11143 !! article
11144 Template:Linktest2
11145 !! text
11146 Main Page
11147 !! endarticle
11148
11149 !! test
11150 Template as link source
11151 !! wikitext
11152 [[{{linktest2}}]]
11153
11154 [[{{linktest2}}|Main Page]]
11155
11156 [[{{linktest2}}]]Page
11157 !! html
11158 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11159 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11160 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11161 </p>
11162 !! end
11163
11164
11165 !! article
11166 Template:loop1
11167 !! text
11168 {{loop2}}
11169 !! endarticle
11170
11171 !! article
11172 Template:loop2
11173 !! text
11174 {{loop1}}
11175 !! endarticle
11176
11177 !! test
11178 Template infinite loop
11179 !! wikitext
11180 {{loop1}}
11181 !! html
11182 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11183 </p>
11184 !! end
11185
11186 !! test
11187 Template from main namespace
11188 !! wikitext
11189 {{:Main Page}}
11190 !! html
11191 <p>blah blah
11192 </p>
11193 !! end
11194
11195 !! article
11196 Template:table
11197 !! text
11198 {|
11199 | 1 || 2
11200 |-
11201 | 3 || 4
11202 |}
11203 !! endarticle
11204
11205 !! test
11206 T2529: Template with table, not included at beginning of line
11207 !! wikitext
11208 foo {{table}}
11209 !! html
11210 <p>foo
11211 </p>
11212 <table>
11213 <tr>
11214 <td> 1 </td>
11215 <td> 2
11216 </td></tr>
11217 <tr>
11218 <td> 3 </td>
11219 <td> 4
11220 </td></tr></table>
11221
11222 !! end
11223
11224 !! test
11225 T2523: Template shouldn't eat newline (or add an extra one before table)
11226 !! wikitext
11227 foo
11228 {{table}}
11229 !! html
11230 <p>foo
11231 </p>
11232 <table>
11233 <tr>
11234 <td> 1 </td>
11235 <td> 2
11236 </td></tr>
11237 <tr>
11238 <td> 3 </td>
11239 <td> 4
11240 </td></tr></table>
11241
11242 !! end
11243
11244 !! test
11245 T2041: Template parameters shown as broken links
11246 !! wikitext
11247 {{{parameter}}}
11248 !! html
11249 <p>{{{parameter}}}
11250 </p>
11251 !! end
11252
11253 !! test
11254 Template with targets containing wikilinks
11255 !! wikitext
11256 {{[[foo]]}}
11257
11258 {{[[{{echo|foo}}]]}}
11259
11260 {{{{echo|[[foo}}]]}}
11261 !! html
11262 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11263 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11264 </p><p>{{[[foo}}]]
11265 </p>
11266 !! end
11267
11268 !! article
11269 Template:''
11270 !! text
11271 bar
11272 !! endarticle
11273
11274 !! test
11275 Templates: Double quotes as template target
11276 !! wikitext
11277 foo {{''}} baz
11278 !! html/php
11279 <p>foo bar baz
11280 </p>
11281 !! html/parsoid
11282 <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
11283 </p>
11284 !! end
11285
11286 ## This test is about making sure Parsoid's data-mw is well formed in the
11287 ## face of multiple templates with intersecting and overlapping ranges. The
11288 ## wikitext itself is wretched.
11289 !! test
11290 Templates with intersecting and overlapping ranges
11291 !! wikitext
11292 {|{{echo|
11293 <p>ha</p>}}
11294 {|{{echo|
11295 <p>ho</p>}}
11296 {{echo|{{!}}hi}}
11297 |}
11298 !! html/php+tidy
11299 <p>ha</p>
11300 <p>ho</p>
11301 <table>
11302 <tr>
11303 <td></td>
11304 </tr>
11305 <tr>
11306 <td>hi</td>
11307 </tr>
11308 </table>
11309 <table>
11310 <tr>
11311 <td></td>
11312 </tr>
11313 </table>
11314 !! html/parsoid
11315 <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":""}]]}'>
11316
11317 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11318
11319 <tbody><tr><td>hi</td></tr>
11320 </tbody></table>
11321 !! end
11322
11323 !! article
11324 Template:MSGNW test
11325 !! text
11326 ''None'' of '''this''' should be
11327 * interpreted
11328 but rather passed unmodified
11329 {{test}}
11330 <gallery>
11331 File:Foobar.jpg
11332 </gallery>
11333 <!-- comment -->
11334 !! endarticle
11335
11336 # hmm, fix this or just deprecate msgnw and document its behavior?
11337 !! test
11338 msgnw keyword
11339 !! wikitext
11340 {{msgnw:MSGNW test}}
11341 !! html/php
11342 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11343 &#42; interpreted
11344 &#32;but rather passed unmodified
11345 &#123;&#123;test&#125;&#125;
11346 &#60;gallery&#62;
11347 File:Foobar.jpg
11348 &#60;/gallery&#62;
11349 &#60;!-- comment --&#62;
11350 </p>
11351 !! end
11352
11353 !! test
11354 int keyword
11355 !! wikitext
11356 {{int:youhavenewmessages|lots of money|not!}}
11357 !! html
11358 <p>You have lots of money (not!).
11359 </p>
11360 !! end
11361
11362 !! test
11363 int keyword - non-existing message
11364 !! wikitext
11365 {{int:var}}
11366 !! html
11367 <p>⧼var⧽
11368 </p>
11369 !! end
11370
11371 !! article
11372 Template:Includes
11373 !! text
11374 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11375 !! endarticle
11376
11377 !! test
11378 <includeonly> and <noinclude> being included
11379 !! wikitext
11380 {{Includes}}
11381 !! html
11382 <p>Foobar
11383 </p>
11384 !! end
11385
11386 !! article
11387 Template:Includes2
11388 !! text
11389 <onlyinclude>Foo</onlyinclude>bar
11390 !! endarticle
11391
11392 !! test
11393 <onlyinclude> being included
11394 !! wikitext
11395 {{Includes2}}
11396 !! html
11397 <p>Foo
11398 </p>
11399 !! end
11400
11401
11402 !! article
11403 Template:Includes3
11404 !! text
11405 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11406 !! endarticle
11407
11408 !! test
11409 <onlyinclude> and <includeonly> being included
11410 !! wikitext
11411 {{Includes3}}
11412 !! html
11413 <p>Foo
11414 </p>
11415 !! end
11416
11417 !! test
11418 <includeonly> and <noinclude> on a page
11419 !! wikitext
11420 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11421 !! html
11422 <p>Foozar
11423 </p>
11424 !! end
11425
11426 !! test
11427 Un-closed <noinclude>
11428 !! wikitext
11429 <noinclude>
11430 !! html
11431 !! end
11432
11433 !! test
11434 <onlyinclude> on a page
11435 !! wikitext
11436 <onlyinclude>Foo</onlyinclude>bar
11437 !! html
11438 <p>Foobar
11439 </p>
11440 !! end
11441
11442 !! test
11443 Un-closed <onlyinclude>
11444 !! wikitext
11445 <onlyinclude>
11446 !! html
11447 !! end
11448
11449 !!test
11450 Self-closed noinclude, includeonly, onlyinclude tags
11451 !! wikitext
11452 <noinclude />
11453 <includeonly />
11454 <onlyinclude />
11455 !! html
11456 <p><br />
11457 </p>
11458 !!end
11459
11460 !!test
11461 Unbalanced includeonly and noinclude tags
11462 !! wikitext
11463 {|
11464 |a</noinclude>
11465 |b</noinclude></noinclude>
11466 |c</noinclude></includeonly>
11467 |d</includeonly></includeonly>
11468 |}
11469 !! html
11470 <table>
11471 <tr>
11472 <td>a
11473 </td>
11474 <td>b
11475 </td>
11476 <td>c&lt;/includeonly&gt;
11477 </td>
11478 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11479 </td></tr></table>
11480
11481 !!end
11482
11483 !! article
11484 Template:Includeonly section
11485 !! text
11486 <includeonly>
11487 ==Includeonly section==
11488 </includeonly>
11489 ==Section T-1==
11490 !!endarticle
11491
11492 !! test
11493 T8563: Edit link generation for section shown by <includeonly>
11494 !! wikitext
11495 {{includeonly section}}
11496 !! html
11497 <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>
11498 <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>
11499
11500 !! end
11501
11502 # Uses same input as the contents of [[Template:Includeonly section]]
11503 !! test
11504 T8563: Section extraction for section shown by <includeonly>
11505 !! options
11506 section=T-2
11507 !! wikitext
11508 <includeonly>
11509 ==Includeonly section==
11510 </includeonly>
11511 ==Section T-2==
11512 !! html
11513 ==Section T-2==
11514 !! end
11515
11516 !! test
11517 T8563: Edit link generation for section suppressed by <includeonly>
11518 !! wikitext
11519 <includeonly>
11520 ==Includeonly section==
11521 </includeonly>
11522 ==Section 1==
11523 !! html
11524 <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>
11525
11526 !! end
11527
11528 !! test
11529 T8563: Section extraction for section suppressed by <includeonly>
11530 !! options
11531 section=1
11532 !! wikitext
11533 <includeonly>
11534 ==Includeonly section==
11535 </includeonly>
11536 ==Section 1==
11537 !! html
11538 ==Section 1==
11539 !! end
11540
11541 !! test
11542 Un-closed <includeonly>
11543 !! wikitext
11544 <includeonly>
11545 !! html/php
11546 !! html/parsoid
11547 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11548 !! end
11549
11550 ## We used to, but no longer wt2wt this test since the default serializer
11551 ## will normalize the include directives to serialize on their own line.
11552 ## Selser will take care of preserving formatting in scenarios where they
11553 ## intermingled with other wikitext.
11554 !! test
11555 Includes and comments at SOL
11556 !! options
11557 parsoid=wt2html,html2html
11558 !! wikitext
11559 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11560
11561 <noinclude>
11562 some
11563 </noinclude>* stuff
11564 * here
11565
11566 <includeonly>can have stuff</includeonly>=== here ===
11567
11568 !! html/php
11569 <h2><span class="mw-headline" id="hu">hu</span></h2>
11570 <p>some
11571 </p>
11572 <ul><li> stuff</li>
11573 <li> here</li></ul>
11574 <h3><span class="mw-headline" id="here">here</span></h3>
11575
11576 !! html/parsoid
11577 <!-- 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>
11578
11579 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11580 <p>some</p>
11581 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11582 <li> here</li></ul>
11583
11584 <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>
11585
11586 !! end
11587
11588 # TODO: test with DOM fragment reuse!
11589 !! test
11590 Parsoid: DOM fragment reuse
11591 !! options
11592 parsoid=wt2wt,wt2html
11593 !! wikitext
11594 a{{echo|b<table></table>c}}d
11595
11596 a{{echo|b
11597 <table></table>
11598 c}}d
11599
11600 {{echo|a
11601
11602 <table></table>
11603
11604 b}}
11605 !! html
11606 <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>
11607
11608 <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">
11609 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11610 </span><p about="#mwt2">cd</p>
11611
11612 <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">
11613
11614 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11615
11616 </span><p about="#mwt3">b</p>
11617 !! end
11618
11619 !! test
11620 Parsoid: Merge double tds (T52603)
11621 !! options
11622 parsoid
11623 !! wikitext
11624 {|
11625 |{{echo|{{!}} foo}}
11626 |}
11627 !! html
11628 <table><tbody>
11629 <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>
11630 </tbody></table>
11631 !! end
11632
11633 !! test
11634 Parsoid: Merge double tds in nested transclusion content (T52603)
11635 !! options
11636 parsoid
11637 !! wikitext
11638 {{echo|<div>}}
11639 {|
11640 |{{echo|{{!}} foo}}
11641 |}
11642 {{echo|</div>}}
11643 !! html
11644 <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}}]}'>
11645 <table><tbody>
11646 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11647 </tbody></table>
11648 </div>
11649 !! end
11650
11651 ###
11652 ### <includeonly> and <noinclude> in attributes
11653 ###
11654 !!test
11655 0. includeonly around the entire attribute
11656 !! wikitext
11657 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11658 !! html
11659 <p><span id="v2">bar</span>
11660 </p>
11661 !!end
11662
11663 !!test
11664 1. includeonly in html attr key
11665 !! wikitext
11666 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11667 !! html
11668 <p><span id="foo">bar</span>
11669 </p>
11670 !!end
11671
11672 !!test
11673 2. includeonly in html attr value
11674 !! wikitext
11675 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11676 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11677 !! html
11678 <p><span id="v1">bar</span>
11679 <span id="v1">bar</span>
11680 </p>
11681 !!end
11682
11683 !!test
11684 3. includeonly in part of an attr value
11685 !! wikitext
11686 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11687 !! html
11688 <p><span style="color:red;">bar</span>
11689 </p>
11690 !!end
11691
11692 !!test
11693 4. includeonly in table attributes
11694 !! wikitext
11695 {|
11696 |- <noinclude>
11697 |-
11698 |a
11699 </noinclude>
11700 |- <includeonly>
11701 |-
11702 |b
11703 </includeonly>
11704 |}
11705 !! html
11706 <table>
11707
11708
11709 <tr>
11710 <td>a
11711 </td></tr>
11712 </table>
11713
11714 !!end
11715
11716 ###
11717 ### Token Stream Patcher tests
11718 ###
11719 ### These tests won't always pass wt2wt and other modes because
11720 ### on serialization, the table will be output on a new line.
11721 ### For now, we are blacklisting them, and using this to test selser.
11722 ###
11723
11724 !!test
11725 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11726 !!options
11727 parsoid=wt2html,wt2wt
11728 !!wikitext
11729 {{echo|}}{| width = '100%'
11730 |foo
11731 |}
11732 !!html/parsoid
11733 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11734 <tbody><tr><td>foo</td></tr>
11735 </tbody></table>
11736 !!end
11737
11738 ## We used to, but no longer wt2wt this test since the default serializer
11739 ## will normalize the include directives to serialize on their own line.
11740 ## Selser will take care of preserving formatting in scenarios where they
11741 ## intermingled with other wikitext.
11742 !!test
11743 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11744 !!options
11745 parsoid=wt2html
11746 !!wikitext
11747 <includeonly>a</includeonly>{| {{{b}}}
11748 |c
11749 |}
11750 !!html/parsoid
11751 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}' data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[31,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"b\"},\"params\":{},\"i\":0}}]}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
11752 <tbody><tr><td>c</td></tr>
11753 </tbody></table>
11754 !!end
11755
11756 !! test
11757 Table wikitext syntax outside wiki-tables
11758 !! wikitext
11759 a
11760 |+ not a caption
11761 ! not a table heading
11762 |- not a table row
11763 | not a table cell
11764 | class="foo bar" | baz
11765 b
11766 |}
11767 |-
11768 c
11769 !! html
11770 <p>a
11771 |+ not a caption
11772 ! not a table heading
11773 |- not a table row
11774 | not a table cell
11775 | class="foo bar" | baz
11776 b
11777 |}
11778 |-
11779 c
11780 </p>
11781 !! end
11782
11783 ###
11784 ### Testing parsing of templates where a template arg
11785 ### has the same name as the template itself.
11786 ###
11787
11788 !! article
11789 Template:quote
11790 !! text
11791 {{{quote|{{{1}}}}}}
11792 !! endarticle
11793
11794 !!test
11795 Templates: Template Name/Arg clash: 1. Use of positional param
11796 !! wikitext
11797 {{quote|foo}}
11798 !! html
11799 <p>foo
11800 </p>
11801 !!end
11802
11803 !!test
11804 Templates: Template Name/Arg clash: 2. Use of named param
11805 !! wikitext
11806 {{quote|quote=foo}}
11807 !! html
11808 <p>foo
11809 </p>
11810 !!end
11811
11812 !!test
11813 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11814 !! wikitext
11815 {{quote|quote}}
11816 !! html
11817 <p>quote
11818 </p>
11819 !!end
11820
11821 ###
11822 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11823 ###
11824
11825 !!test
11826 Templates: 1. Simple use
11827 !! wikitext
11828 {{echo|Foo}}
11829 !! html
11830 <p>Foo
11831 </p>
11832 !!end
11833
11834 !!test
11835 Templates: 2. Inside a block tag
11836 !! wikitext
11837 <div>{{echo|Foo}}</div>
11838 <blockquote>{{echo|Foo}}</blockquote>
11839 !! html
11840 <div>Foo</div>
11841 <blockquote>Foo</blockquote>
11842
11843 !! html+tidy
11844 <div>Foo</div>
11845 <blockquote>
11846 <p>Foo</p>
11847 </blockquote>
11848 !!end
11849
11850 !!test
11851 Templates: P-wrapping: 1a. Templates on consecutive lines
11852 !! wikitext
11853 {{echo|Foo}}
11854 {{echo|bar}}
11855 !! html
11856 <p>Foo
11857 bar
11858 </p>
11859 !!end
11860
11861 !!test
11862 Templates: P-wrapping: 1b. Templates on consecutive lines
11863 !! wikitext
11864 Foo
11865
11866 {{echo|bar}}
11867 {{echo|baz}}
11868 !! html
11869 <p>Foo
11870 </p><p>bar
11871 baz
11872 </p>
11873 !!end
11874
11875 !!test
11876 Templates: P-wrapping: 1c. Templates on consecutive lines
11877 !! wikitext
11878 {{echo|Foo}}
11879 {{echo|bar}} <div>baz</div>
11880 !! html
11881 <p>Foo
11882 </p>
11883 bar <div>baz</div>
11884
11885 !! html+tidy
11886 <p>Foo</p>
11887 <p>bar</p>
11888 <div>baz</div>
11889 !! end
11890
11891 !!test
11892 Templates: P-wrapping: 1d. Template preceded by comment-only line
11893 !!options
11894 parsoid
11895 !! wikitext
11896 <!-- foo -->
11897 {{echo|Bar}}
11898 !! html
11899 <!-- foo -->
11900
11901 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11902 !!end
11903
11904 !!test
11905 Templates: Inline Text: 1. Multiple template uses
11906 !! wikitext
11907 {{echo|Foo}}bar{{echo|baz}}
11908 !! html
11909 <p>Foobarbaz
11910 </p>
11911 !!end
11912
11913 !!test
11914 Templates: Inline Text: 2. Back-to-back template uses
11915 !! wikitext
11916 {{echo|Foo}}{{echo|bar}}
11917 !! html
11918 <p>Foobar
11919 </p>
11920 !!end
11921
11922 !!test
11923 Templates: Block Tags: 1. Multiple template uses
11924 !! wikitext
11925 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11926 !! html
11927 <div>Foo</div><div>bar</div><div>baz</div>
11928
11929 !!end
11930
11931 !!test
11932 Templates: Block Tags: 2. Back-to-back template uses
11933 !! wikitext
11934 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11935 !! html
11936 <div>Foo</div><div>bar</div>
11937
11938 !!end
11939
11940 # This is an edge case relating to paragraph wrapping.
11941 !!test
11942 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11943 !! wikitext
11944 {{echo|a
11945 b</p>}}
11946 !! html/parsoid
11947 <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
11948 b</p>
11949 !!end
11950
11951 !!test
11952 Templates: Links: 1. Simple example
11953 !! wikitext
11954 {{echo|[[Foo|bar]]}}
11955 !! html
11956 <p><a href="/wiki/Foo" title="Foo">bar</a>
11957 </p>
11958 !!end
11959
11960 !!test
11961 Templates: Links: 2. Generation of link href
11962 !! wikitext
11963 [[{{echo|Foo}}|bar]]
11964 !! html
11965 <p><a href="/wiki/Foo" title="Foo">bar</a>
11966 </p>
11967 !!end
11968
11969 !!test
11970 Templates: Links: 3. Generation of part of a link href
11971 !! wikitext
11972 [[Fo{{echo|o}}|bar]]
11973
11974 [[Foo{{echo|bar}}]]
11975
11976 [[Foo{{echo|bar}}baz]]
11977
11978 [[Foo{{echo|bar}}|bar]]
11979
11980 [[:Foo{{echo|bar}}]]
11981
11982 [[:Foo{{echo|bar}}|bar]]
11983 !! html
11984 <p><a href="/wiki/Foo" title="Foo">bar</a>
11985 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11986 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11987 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11988 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11989 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11990 </p>
11991 !!end
11992
11993 !!test
11994 Templates: Links: 4. Multiple templates generating link href
11995 !! wikitext
11996 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11997 !! html
11998 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11999 </p>
12000 !!end
12001
12002 !!test
12003 Templates: Links: 5. Generation of link text
12004 !! wikitext
12005 [[Foo|{{echo|bar}}]]
12006 !! html
12007 <p><a href="/wiki/Foo" title="Foo">bar</a>
12008 </p>
12009 !!end
12010
12011 !!test
12012 Templates: Links: 5. Nested templates (only outermost template should be marked)
12013 !! wikitext
12014 {{echo|[[{{echo|Foo}}|bar]]}}
12015 !! html
12016 <p><a href="/wiki/Foo" title="Foo">bar</a>
12017 </p>
12018 !!end
12019
12020 !!test
12021 Templates: HTML Tag: 1. Generation of HTML attr. key
12022 !! wikitext
12023 <div {{echo|style}}="color:red;">foo</div>
12024 !! html
12025 <div style="color:red;">foo</div>
12026
12027 !!end
12028
12029 !!test
12030 Templates: HTML Tag: 2. Generation of HTML attr. value
12031 !! wikitext
12032 <div style={{echo|'color:red;'}}>foo</div>
12033 !! html
12034 <div style="color:red;">foo</div>
12035
12036 !!end
12037
12038 !!test
12039 Templates: HTML Tag: 3. Generation of HTML attr key and value
12040 !! wikitext
12041 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12042 !! html
12043 <div style="color:red;">foo</div>
12044
12045 !!end
12046
12047 !!test
12048 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12049 !! wikitext
12050 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12051 !! html
12052 <div title="This is a long title with just one piece templated">foo</div>
12053
12054 !!end
12055
12056 !!test
12057 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12058 !! wikitext
12059 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12060 !! html
12061 <div title="This is a long title with just one piece templated">foo</div>
12062
12063 !!end
12064
12065 !!test
12066 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12067 !! wikitext
12068 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12069 !! html
12070 <div title="This is a long title with just one piece templated">foo</div>
12071
12072 !!end
12073
12074 # SSS FIXME: While it is great we added support for all this,
12075 # do we want to make this part of the spec? Maybe we want to
12076 # deprecate this kind of usage in the future?
12077 !!test
12078 Templates: HTML Tag: 7. Generation of partial attribute key string
12079 !! wikitext
12080 <div st{{echo|yle}}="color:red;">foo</div>
12081 !! html
12082 <div style="color:red;">foo</div>
12083
12084 !!end
12085
12086 !! test
12087 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12088 !! wikitext
12089 <div {{echo|1=id="v1"}}>bar</div>
12090 !! html
12091 <div id="v1">bar</div>
12092
12093 !!end
12094
12095 !! test
12096 Templates: HTML Tag: 9. Multiple template-generated attributes
12097 !! wikitext
12098 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12099 !! html
12100 <div id="v1" title="foo">bar</div>
12101
12102 !!end
12103
12104 !! test
12105 Templates: Support for templates generating attributes and content
12106 !! wikitext
12107 {| {{mixed_attr_content_template}}
12108 |-
12109 |bar
12110 |}
12111 !! html/php
12112 <table style="color:red;" title="T48811">
12113
12114 <tr>
12115 <td>foo
12116 </td></tr>
12117 <tr>
12118 <td>bar
12119 </td></tr></table>
12120
12121 !! html/parsoid
12122 <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|}"]}'>
12123 <tbody><tr>
12124 <td>foo</td></tr>
12125 <tr>
12126 <td>bar</td></tr>
12127 </tbody></table>
12128 !!end
12129
12130 !! test
12131 1. Entities and nowikis inside templated attributes should be handled correctly
12132 !! wikitext
12133 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12134 !! html/php
12135 <div style="background:#f9f9f9;">foo</div>
12136
12137 !! html/parsoid
12138 <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>
12139 !! end
12140
12141 !! test
12142 2. Entities and nowikis inside templated attributes should be handled correctly
12143 !! wikitext
12144 {|
12145 |{{table_attribs_3}}
12146 |}
12147 !! html/php
12148 <table>
12149 <tr>
12150 <td style="background:#f9f9f9;">Foo
12151 </td></tr></table>
12152
12153 !! html/parsoid
12154 <table>
12155 <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>
12156 </tbody></table>
12157 !! end
12158
12159 !! test
12160 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12161 !! wikitext
12162 {{tbl-start}}
12163 |{{table_attribs_3}}
12164 {{tbl-end}}
12165 !! html/php
12166 <table>
12167 <tr>
12168 <td style="background:#f9f9f9;">Foo
12169 </td></tr></table>
12170
12171 !! html/parsoid
12172 <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}}]}'>
12173 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12174 </tbody></table>
12175 !! end
12176
12177 # T107622
12178 !! test
12179 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12180 !! wikitext
12181 {|
12182 | {{table_attribs_6}} hi
12183 |}
12184 !! html/php
12185 <table>
12186 <tr>
12187 <td style="background: red;"> hi
12188 </td></tr></table>
12189
12190 !! html/parsoid
12191 <table>
12192 <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>
12193 </tbody></table>
12194 !! end
12195
12196 !!test
12197 Templates: HTML Tables: 1. Generating start of a HTML table
12198 !! wikitext
12199 {{echo|<table><tr><td>foo</td>}}</tr></table>
12200 !! html
12201 <table><tr><td>foo</td></tr></table>
12202
12203 !!end
12204
12205 !!test
12206 Templates: HTML Tables: 2a. Generating middle of a HTML table
12207 !! wikitext
12208 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12209 !! html
12210 <table><tr><td>foo</td></tr></table>
12211
12212 !!end
12213
12214 !!test
12215 Templates: HTML Tables: 2b. Generating middle of a HTML table
12216 !! wikitext
12217 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12218 !! html
12219 <table><tr><td>foo</td></tr></table>
12220
12221 !!end
12222
12223 !!test
12224 Templates: HTML Tables: 3. Generating end of a HTML table
12225 !! wikitext
12226 <table><tr>{{echo|<td>foo</td></tr></table>}}
12227 !! html
12228 <table><tr><td>foo</td></tr></table>
12229
12230 !!end
12231
12232 !!test
12233 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12234 !! wikitext
12235 {{echo|<table>}}<tr><td>foo</td></tr></table>
12236 !! html
12237 <table><tr><td>foo</td></tr></table>
12238
12239 !!end
12240
12241 !!test
12242 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12243 !! wikitext
12244 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12245 !! html
12246 <table><tr><td>foo</td></tr></table>
12247
12248 !!end
12249
12250 !!test
12251 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12252 !! wikitext
12253 <table><tr>{{echo|<td>}}foo</td></tr></table>
12254 !! html
12255 <table><tr><td>foo</td></tr></table>
12256
12257 !!end
12258
12259 !!test
12260 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12261 !! wikitext
12262 <table><tr><td>foo{{echo|</td>}}</tr></table>
12263 !! html
12264 <table><tr><td>foo</td></tr></table>
12265
12266 !!end
12267
12268 !!test
12269 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12270 !! wikitext
12271 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12272 !! html
12273 <table><tr><td>foo</td></tr></table>
12274
12275 !!end
12276
12277 !!test
12278 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12279 !! wikitext
12280 <table><tr><td>foo</td></tr>{{echo|</table>}}
12281 !! html
12282 <table><tr><td>foo</td></tr></table>
12283
12284 !!end
12285
12286 !!test
12287 Templates: HTML Tables: 5. Proper fostering of categories from inside
12288 !!options
12289 parsoid=wt2html,wt2wt
12290 !! wikitext
12291 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12292 <!--Two categories (T52330)-->
12293 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12294 !! html
12295 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12296 <!--Two categories (T52330)-->
12297 <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>
12298 !!end
12299
12300 !!test
12301 Templates: Wiki Tables: 1a. Fostering of entire template content
12302 !! wikitext
12303 {|
12304 {{echo|a}}
12305 |}
12306 !! html
12307 <table>
12308 a
12309 <tr><td></td></tr></table>
12310
12311 !! html+tidy
12312 <p>a</p>
12313 <table>
12314 <tr>
12315 <td></td>
12316 </tr>
12317 </table>
12318 !! end
12319
12320 !!test
12321 Templates: Wiki Tables: 1b. Fostering of entire template content
12322 !! wikitext
12323 {|
12324 {{echo|<div>}}
12325 foo
12326 {{echo|</div>}}
12327 |}
12328 !! html
12329 <table>
12330 <div>
12331 <p>foo
12332 </p>
12333 </div>
12334 <tr><td></td></tr></table>
12335
12336 !! html+tidy
12337 <div>
12338 <p>foo</p>
12339 </div>
12340 <table>
12341 <tr>
12342 <td></td>
12343 </tr>
12344 </table>
12345 !! end
12346
12347 !!test
12348 Templates: Wiki Tables: 2. Fostering of partial template content
12349 !! wikitext
12350 {|
12351 {{echo|a
12352 <div>b</div>}}
12353 |}
12354 !! html
12355 <table>
12356 a
12357 <div>b</div>
12358 <tr><td></td></tr></table>
12359
12360 !! html+tidy
12361 <p>a</p>
12362 <div>b</div>
12363 <table>
12364 <tr>
12365 <td></td>
12366 </tr>
12367 </table>
12368 !! end
12369
12370 !!test
12371 Templates: Wiki Tables: 3. td-content via multiple templates
12372 !! wikitext
12373 {|
12374 {{echo|{{pipe}}a}}{{echo|b}}
12375 |}
12376 !! html
12377 <table>
12378 <tr>
12379 <td>ab
12380 </td></tr></table>
12381
12382 !!end
12383
12384 !!test
12385 Templates: Wiki Tables: 4. Templated tags, no content
12386 !! wikitext
12387 {{tbl-start}}
12388 {{tbl-end}}
12389 !! html
12390 <table>
12391 <tr><td></td></tr></table>
12392
12393 !!end
12394
12395 !!test
12396 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12397 !! wikitext
12398 {{tbl-start}}
12399 |foo
12400 {{tbl-end}}
12401 !! html
12402 <table>
12403 <tr>
12404 <td>foo
12405 </td></tr></table>
12406
12407 !!end
12408
12409 !!test
12410 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12411 !! wikitext
12412 {{tbl-start}}
12413 {{!}}foo
12414 {{tbl-end}}
12415 !! html
12416 <table>
12417 <tr>
12418 <td>foo
12419 </td></tr></table>
12420
12421 !!end
12422
12423 ## This test case is very specific to Parsoid's internals
12424 ## and is hence only tested for Parsoid's code. Parsoid uses
12425 ## a <meta> marker tag for <ref> tags and they are expanded
12426 ## much later. We are verifying that this <meta> tag usage
12427 ## doesn't prevent foster parenting.
12428 !!test
12429 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12430 !!wikitext
12431 {{PartialTable}}<ref>foo</ref>
12432 |}
12433
12434 <references />
12435 !!html/parsoid
12436 <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"&lt;ref>foo&lt;/ref>\n|}"]}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span><table about="#mwt2">
12437 <tbody>
12438 </tbody></table>
12439
12440 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
12441 !!end
12442
12443 !! test
12444 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12445 !! wikitext
12446 {{echo|
12447 {{{!}}
12448 {{!}}-}}
12449 <onlyinclude>
12450 |foo
12451 </onlyinclude>
12452 {{!}}}
12453 !! html/parsoid
12454 <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{{!}}}"]}'>
12455 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12456 <tbody><tr>
12457
12458 <td>foo
12459 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12460 </tbody></table>
12461 !! end
12462
12463 !!test
12464 Templates: Lists: Multi-line list-items via templates
12465 !! wikitext
12466 *{{echo|a {{nonexistent|
12467 unused}}}}
12468 *{{echo|b {{nonexistent|
12469 unused}}}}
12470 !! html
12471 <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>
12472 <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>
12473
12474 !!end
12475
12476 !!test
12477 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12478 !! wikitext
12479 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12480 !! html
12481 <p><i>ab</i>c<i>d</i>e
12482 </p>
12483 !!end
12484
12485 !!test
12486 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12487 (PHP parser generates misnested html)
12488 !! wikitext
12489 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12490 !! html/parsoid
12491 <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>
12492 !!end
12493
12494 !!test
12495 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12496 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12497 !! options
12498 parsoid=wt2html,wt2wt
12499 !! wikitext
12500 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12501 !! html
12502 <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>
12503 <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>
12504 <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>
12505 !!end
12506
12507 !!test
12508 Templates: Ugly nesting: 4. Divs opened/closed across templates
12509 !! wikitext
12510 a<div>b{{echo|c</div>d}}e
12511 !! html
12512 a<div>bc</div>de
12513
12514 !! html+tidy
12515 <p>a</p>
12516 <div>bc</div>
12517 <p>de</p>
12518 !! end
12519
12520 !!test
12521 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12522 (Parsoid-centric)
12523 !! options
12524 parsoid
12525 !! wikitext
12526 {|
12527 |{{echo|foo</table>}}
12528 |bar
12529 |}
12530 !! html
12531 <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|}"]}'>
12532
12533 <tbody>
12534 <tr>
12535 <td>foo</td></tr></tbody></table><span about="#mwt1">
12536 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12537 |}</span>
12538 !!end
12539
12540 !!test
12541 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12542 (Parsoid-centric)
12543 !! options
12544 parsoid
12545 !! wikitext
12546 <table>
12547 <tr>
12548 <td>
12549 <table>
12550 <tr>
12551 <td>1. {{echo|foo </table>}}</td>
12552 <td> bar </td>
12553 <td>2. {{echo|baz </table>}}</td>
12554 </tr>
12555 <tr>
12556 <td>abc</td>
12557 </tr>
12558 </table>
12559 </td>
12560 </tr>
12561 <tr>
12562 <td>xyz</td>
12563 </tr>
12564 </table>
12565 !! html
12566 <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>"]}'>
12567 <tbody><tr>
12568 <td>
12569 <table>
12570 <tbody><tr>
12571 <td>1. foo </td></tr></tbody></table></td>
12572 <td> bar </td>
12573 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12574 </span><span about="#mwt2">
12575 </span><span about="#mwt2">
12576 </span><span about="#mwt2">abc</span><span about="#mwt2">
12577 </span><span about="#mwt2">
12578 </span><span about="#mwt2">
12579 </span><span about="#mwt2">
12580 </span><span about="#mwt2">
12581 </span><span about="#mwt2">
12582 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12583 </span><span about="#mwt2">
12584 </span>
12585 !!end
12586
12587 !! test
12588 Templates: Ugly templates: 3. newline-only template parameter
12589 !! wikitext
12590 foo {{echo|
12591 }}
12592 !! html
12593 <p>foo
12594 </p>
12595 !! end
12596
12597 # This looks like a bug: a single newline triggers p/br for some reason.
12598 !! test
12599 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12600 !! wikitext
12601 {{echo|
12602 }}
12603 !! html
12604 <p><br />
12605 </p>
12606 !! end
12607
12608 # T66017 -- ugly wikitext with fostered content generates two template ranges that
12609 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12610 !! test
12611 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12612 !! wikitext
12613 {{echo|<table>}}
12614 {{echo|<div>foo}}
12615 {{echo|</table>}}
12616 !! html/parsoid
12617 <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
12618 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12619 </table>
12620 !! end
12621
12622 # T66017 -- ugly wikitext with fostered content generates two template ranges
12623 # that are "identical" and generate nesting cycles in the algorithm
12624 !! test
12625 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12626 !! wikitext
12627 {{echo|<table><tr><td><table>}}
12628 {{echo|<div>}}
12629 {{echo|</div>}}
12630 !! html/parsoid
12631 <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"}'>
12632 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12633 </table></td></tr></tbody></table>
12634 !! end
12635
12636 !! test
12637 Templates: Parameters substituted at the top-level
12638 !! wikitext
12639 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12640
12641 {{{foo|bar|baz}}}
12642 !! html/php
12643 <p><i>who</i> me? <b>never!</b>
12644 </p><p>bar
12645 </p>
12646 !! html/parsoid
12647 <p about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"&#39;&#39;who&#39;&#39; {{echo|me}}? &#39;&#39;&#39;never!&#39;&#39;&#39;"}},"i":0}}]}'><i>who</i> me? <b>never!</b></p>
12648
12649 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
12650 !! end
12651
12652 !!test
12653 Parser Functions: 1. Simple example
12654 !! wikitext
12655 {{uc:foo}}
12656 !! html
12657 <p>FOO
12658 </p>
12659 !!end
12660
12661 !!test
12662 Parser Functions: 2. Nested use (only outermost should be marked up)
12663 !! wikitext
12664 {{uc:{{lc:FOO}}}}
12665 !! html
12666 <p>FOO
12667 </p>
12668 !!end
12669
12670 ###
12671 ### Pre-save transform tests
12672 ###
12673 !! test
12674 pre-save transform: subst:
12675 !! options
12676 pst
12677 !! wikitext
12678 {{subst:test}}
12679 !! html/php
12680 This is a test template
12681 !! end
12682
12683 !! test
12684 pre-save transform: normal template
12685 !! options
12686 pst
12687 !! wikitext
12688 {{test}}
12689 !! html/php
12690 {{test}}
12691 !! end
12692
12693 !! test
12694 pre-save transform: nonexistent template
12695 !! options
12696 pst
12697 !! wikitext
12698 {{thistemplatedoesnotexist}}
12699 !! html/php
12700 {{thistemplatedoesnotexist}}
12701 !! end
12702
12703 !! test
12704 pre-save transform: subst magic variables
12705 !! options
12706 pst
12707 !! wikitext
12708 {{subst:SITENAME}}
12709 !! html/php
12710 MediaWiki
12711 !! end
12712
12713 # This is T2089, which I fixed. -- wtm
12714 !! test
12715 pre-save transform: subst: templates with parameters
12716 !! options
12717 pst
12718 !! wikitext
12719 {{subst:paramtest|param="something else"}}
12720 !! html/php
12721 This is a test template with parameter "something else"
12722 !! end
12723
12724 !! article
12725 Template:nowikitest
12726 !! text
12727 <nowiki>'''not wiki'''</nowiki>
12728 !! endarticle
12729
12730 !! test
12731 pre-save transform: nowiki in subst (T3188)
12732 !! options
12733 pst
12734 !! wikitext
12735 {{subst:nowikitest}}
12736 !! html/php
12737 <nowiki>'''not wiki'''</nowiki>
12738 !! end
12739
12740 !! article
12741 Template:commenttest
12742 !! text
12743 This template has <!-- a comment --> in it.
12744 !! endarticle
12745
12746 !! test
12747 pre-save transform: comment in subst (T3936)
12748 !! options
12749 pst
12750 !! wikitext
12751 {{subst:commenttest}}
12752 !! html/php
12753 This template has <!-- a comment --> in it.
12754 !! end
12755
12756 !! test
12757 pre-save transform: unclosed tag
12758 !! options
12759 pst
12760 !! wikitext
12761 <nowiki>'''not wiki'''
12762 !! html/php
12763 <nowiki>'''not wiki'''
12764 !! end
12765
12766 !! test
12767 pre-save transform: mixed tag case
12768 !! options
12769 pst
12770 !! wikitext
12771 <NOwiki>'''not wiki'''</noWIKI>
12772 !! html/php
12773 <NOwiki>'''not wiki'''</noWIKI>
12774 !! end
12775
12776 !! test
12777 pre-save transform: unclosed comment in <nowiki>
12778 !! options
12779 pst
12780 !! wikitext
12781 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12782 !! html/php
12783 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12784 !!end
12785
12786 # Leading @ in this template definition works around a limitation
12787 # in parsoid's parserTests which otherwise strips the <span> from the
12788 # result (confusing it for a template wrapper)
12789 !! article
12790 Template:dangerous
12791 !!text
12792 @<span onmouseover="alert('crap')">Oh no</span>
12793 !!endarticle
12794
12795 !!test
12796 (confirming safety of fix for subst T3936)
12797 !! wikitext
12798 {{Template:dangerous}}
12799 !! html
12800 <p>@<span>Oh no</span>
12801 </p>
12802 !! end
12803
12804 !! test
12805 pre-save transform: comment containing gallery (T7024)
12806 !! options
12807 pst
12808 !! wikitext
12809 <!-- <gallery>data</gallery> -->
12810 !! html/php
12811 <!-- <gallery>data</gallery> -->
12812 !!end
12813
12814 !! test
12815 pre-save transform: comment containing extension
12816 !! options
12817 pst
12818 !! wikitext
12819 <!-- <tag>data</tag> -->
12820 !! html/php
12821 <!-- <tag>data</tag> -->
12822 !!end
12823
12824 !! test
12825 pre-save transform: comment containing nowiki
12826 !! options
12827 pst
12828 !! wikitext
12829 <!-- <nowiki>data</nowiki> -->
12830 !! html/php
12831 <!-- <nowiki>data</nowiki> -->
12832 !!end
12833
12834 !! test
12835 pre-save transform: <noinclude> in subst (T5298)
12836 !! options
12837 pst
12838 !! wikitext
12839 {{subst:Includes}}
12840 !! html/php
12841 Foobar
12842 !! end
12843
12844 !! test
12845 pre-save transform: <onlyinclude> in subst (T5298)
12846 !! options
12847 pst
12848 !! wikitext
12849 {{subst:Includes2}}
12850 !! html/php
12851 Foo
12852 !! end
12853
12854 !! article
12855 Template:SubstTest
12856 !!text
12857 {{<includeonly>subst:</includeonly>Includes}}
12858 !! endarticle
12859
12860 !! article
12861 Template:SafeSubstTest
12862 !! text
12863 {{<includeonly>safesubst:</includeonly>Includes}}
12864 !! endarticle
12865
12866 !! test
12867 T24297: safesubst: works during PST
12868 !! options
12869 pst
12870 !! wikitext
12871 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12872 !! html/php
12873 FoobarFoobar
12874 !! end
12875
12876 !! test
12877 T24297: safesubst: works during normal parse
12878 !! wikitext
12879 {{SafeSubstTest}}
12880 !! html
12881 <p>Foobar
12882 </p>
12883 !! end
12884
12885 !! test
12886 subst: does not work during normal parse
12887 !! wikitext
12888 {{SubstTest}}
12889 !! html
12890 <p>{{subst:Includes}}
12891 </p>
12892 !! end
12893
12894 !! test
12895 pre-save transform: context links ("pipe trick")
12896 !! options
12897 pst
12898 !! wikitext
12899 [[Article (context)|]]
12900 [[Bar:Article|]]
12901 [[:Bar:Article|]]
12902 [[Bar:Article (context)|]]
12903 [[:Bar:Article (context)|]]
12904 [[|Article]]
12905 [[|Article (context)]]
12906 [[Bar:X (Y) Z|]]
12907 [[:Bar:X (Y) Z|]]
12908 !! html/php
12909 [[Article (context)|Article]]
12910 [[Bar:Article|Article]]
12911 [[:Bar:Article|Article]]
12912 [[Bar:Article (context)|Article]]
12913 [[:Bar:Article (context)|Article]]
12914 [[Article]]
12915 [[Article (context)]]
12916 [[Bar:X (Y) Z|X (Y) Z]]
12917 [[:Bar:X (Y) Z|X (Y) Z]]
12918 !! end
12919
12920 !! test
12921 pre-save transform: context links ("pipe trick") with interwiki prefix
12922 !! options
12923 pst
12924 !! wikitext
12925 [[interwiki:Article|]]
12926 [[:interwiki:Article|]]
12927 [[interwiki:Bar:Article|]]
12928 [[:interwiki:Bar:Article|]]
12929 !! html/php
12930 [[interwiki:Article|Article]]
12931 [[:interwiki:Article|Article]]
12932 [[interwiki:Bar:Article|Bar:Article]]
12933 [[:interwiki:Bar:Article|Bar:Article]]
12934 !! end
12935
12936 !! test
12937 pre-save transform: context links ("pipe trick") with parens in title
12938 !! options
12939 pst title=[[Somearticle (context)]]
12940 !! wikitext
12941 [[|Article]]
12942 !! html/php
12943 [[Article (context)|Article]]
12944 !! end
12945
12946 !! test
12947 pre-save transform: context links ("pipe trick") with comma in title
12948 !! options
12949 pst title=[[Someplace, Somewhere]]
12950 !! wikitext
12951 [[|Otherplace]]
12952 [[Otherplace, Elsewhere|]]
12953 [[Otherplace, Elsewhere, Anywhere|]]
12954 !! html/php
12955 [[Otherplace, Somewhere|Otherplace]]
12956 [[Otherplace, Elsewhere|Otherplace]]
12957 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12958 !! end
12959
12960 !! test
12961 pre-save transform: context links ("pipe trick") with parens and comma
12962 !! options
12963 pst title=[[Someplace (IGNORED), Somewhere]]
12964 !! wikitext
12965 [[|Otherplace]]
12966 [[Otherplace (place), Elsewhere|]]
12967 !! html/php
12968 [[Otherplace, Somewhere|Otherplace]]
12969 [[Otherplace (place), Elsewhere|Otherplace]]
12970 !! end
12971
12972 !! test
12973 pre-save transform: context links ("pipe trick") with comma and parens
12974 !! options
12975 pst title=[[Who, me? (context)]]
12976 !! wikitext
12977 [[|Yes, you.]]
12978 [[Me, Myself, and I (1937 song)|]]
12979 !! html/php
12980 [[Yes, you. (context)|Yes, you.]]
12981 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12982 !! end
12983
12984 !! test
12985 pre-save transform: context links ("pipe trick") with namespace
12986 !! options
12987 pst title=[[Ns:Somearticle]]
12988 !! wikitext
12989 [[|Article]]
12990 !! html/php
12991 [[Ns:Article|Article]]
12992 !! end
12993
12994 !! test
12995 pre-save transform: context links ("pipe trick") with namespace and parens
12996 !! options
12997 pst title=[[Ns:Somearticle (context)]]
12998 !! wikitext
12999 [[|Article]]
13000 !! html/php
13001 [[Ns:Article (context)|Article]]
13002 !! end
13003
13004 !! test
13005 pre-save transform: context links ("pipe trick") with namespace and comma
13006 !! options
13007 pst title=[[Ns:Somearticle, Context, Whatever]]
13008 !! wikitext
13009 [[|Article]]
13010 !! html/php
13011 [[Ns:Article, Context, Whatever|Article]]
13012 !! end
13013
13014 !! test
13015 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13016 !! options
13017 pst title=[[Ns:Somearticle, Context (context)]]
13018 !! wikitext
13019 [[|Article]]
13020 !! html/php
13021 [[Ns:Article (context)|Article]]
13022 !! end
13023
13024 !! test
13025 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13026 !! options
13027 pst title=[[Ns:Somearticle (IGNORED), Context]]
13028 !! wikitext
13029 [[|Article]]
13030 !! html/php
13031 [[Ns:Article, Context|Article]]
13032 !! end
13033
13034 !! test
13035 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13036 !! options
13037 pst
13038 !! wikitext
13039 [[Article(context)|]]
13040 [[Bar:Article(context)|]]
13041 [[:Bar:Article(context)|]]
13042 [[|Article(context)]]
13043 [[Bar:X(Y)Z|]]
13044 [[:Bar:X(Y)Z|]]
13045 !! html/php
13046 [[Article(context)|Article]]
13047 [[Bar:Article(context)|Article]]
13048 [[:Bar:Article(context)|Article]]
13049 [[Article(context)]]
13050 [[Bar:X(Y)Z|X(Y)Z]]
13051 [[:Bar:X(Y)Z|X(Y)Z]]
13052 !! end
13053
13054 !! test
13055 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13056 !! options
13057 pst
13058 !! wikitext
13059 [[Article (context)|]]
13060 [[Bar:Article (context)|]]
13061 [[:Bar:Article (context)|]]
13062 [[|Article (context)]]
13063 [[Bar:X (Y) Z|]]
13064 [[:Bar:X (Y) Z|]]
13065 !! html/php
13066 [[Article (context)|Article]]
13067 [[Bar:Article (context)|Article]]
13068 [[:Bar:Article (context)|Article]]
13069 [[Article (context)]]
13070 [[Bar:X (Y) Z|X (Y) Z]]
13071 [[:Bar:X (Y) Z|X (Y) Z]]
13072 !! end
13073
13074 !! test
13075 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13076 !! options
13077 pst
13078 !! wikitext
13079 [[Article(context)|]]
13080 [[Bar:Article(context)|]]
13081 [[:Bar:Article(context)|]]
13082 [[|Article(context)]]
13083 [[Bar:X(Y)Z|]]
13084 [[:Bar:X(Y)Z|]]
13085 !! html/php
13086 [[Article(context)|Article]]
13087 [[Bar:Article(context)|Article]]
13088 [[:Bar:Article(context)|Article]]
13089 [[Article(context)]]
13090 [[Bar:X(Y)Z|X(Y)Z]]
13091 [[:Bar:X(Y)Z|X(Y)Z]]
13092 !! end
13093
13094 !! test
13095 pre-save transform: context links ("pipe trick") with commas (T23660)
13096 !! options
13097 pst
13098 !! wikitext
13099 [[Article (context), context|]]
13100 [[Article (context),context|]]
13101 [[Bar:Article (context), context|]]
13102 [[Bar:Article (context),context|]]
13103 [[:Bar:Article (context), context|]]
13104 [[:Bar:Article (context),context|]]
13105 !! html/php
13106 [[Article (context), context|Article]]
13107 [[Article (context),context|Article]]
13108 [[Bar:Article (context), context|Article]]
13109 [[Bar:Article (context),context|Article]]
13110 [[:Bar:Article (context), context|Article]]
13111 [[:Bar:Article (context),context|Article]]
13112 !! end
13113
13114 !! test
13115 pre-save transform: trim trailing empty lines
13116 !! options
13117 pst
13118 !! wikitext
13119 Empty lines are trimmed
13120
13121
13122
13123
13124 !! html/php
13125 Empty lines are trimmed
13126 !! end
13127
13128 !! test
13129 pre-save transform: Signature expansion
13130 !! options
13131 pst
13132 !! wikitext
13133 * ~~~
13134 * <noinclude>~~~</noinclude>
13135 * <includeonly>~~~</includeonly>
13136 * <onlyinclude>~~~</onlyinclude>
13137 !! html/php
13138 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13139 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13140 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13141 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13142 !! end
13143
13144
13145 !! test
13146 pre-save transform: Signature expansion in nowiki tags (T2093)
13147 !! options
13148 pst disabled
13149 !! wikitext
13150 Shall not expand:
13151
13152 <nowiki>~~~~</nowiki>
13153
13154 <includeonly><nowiki>~~~~</nowiki></includeonly>
13155
13156 <noinclude><nowiki>~~~~</nowiki></noinclude>
13157
13158 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13159
13160 {{subst:Foo}} shall be converted to FOO
13161
13162 As well as inside noinclude/onlyinclude
13163 <noinclude>{{subst:Foo}}</noinclude>
13164 <onlyinclude>{{subst:Foo}}</onlyinclude>
13165
13166 But not inside includeonly
13167 <includeonly>{{subst:Foo}}</includeonly>
13168 !! html/php
13169 Shall not expand:
13170
13171 <nowiki>~~~~</nowiki>
13172
13173 <includeonly><nowiki>~~~~</nowiki></includeonly>
13174
13175 <noinclude><nowiki>~~~~</nowiki></noinclude>
13176
13177 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13178
13179 FOO shall be converted to FOO
13180
13181 As well as inside noinclude/onlyinclude
13182 <noinclude>FOO</noinclude>
13183 <onlyinclude>FOO</onlyinclude>
13184
13185 But not inside includeonly
13186 <includeonly>{{subst:Foo}}</includeonly>
13187 !! end
13188
13189 !! test
13190 Parsoid: Recognize nowiki with trailing space in tags
13191 !! options
13192 parsoid=wt2html
13193 !! wikitext
13194 <nowiki ><div>[[foo]]</nowiki >
13195
13196 a<nowiki / >b
13197
13198 c<nowiki />d
13199
13200 e<nowiki/ >f
13201 !! html
13202 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13203 <p>ab</p>
13204 <p>cd</p>
13205 <p>ef</p>
13206 !! end
13207
13208 !! test
13209 Parsoid: Recognize nowiki with odd capitalization
13210 !! options
13211 parsoid=wt2html
13212 !! wikitext
13213 <noWikI ><div>[[foo]]</Nowiki >
13214 !! html
13215 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13216 !! end
13217
13218
13219 !! test
13220 Parsoid: Escape nowiki with trailing space in tags
13221 !! options
13222 parsoid=html2wt
13223 !! html/parsoid
13224 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13225 <p>a&lt;nowiki /&gt;b</p>
13226 <p>c&lt;nowiki/ &gt;d</p>
13227 !! wikitext
13228 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13229
13230 a&lt;nowiki /&gt;b
13231
13232 c&lt;nowiki/ &gt;d
13233 !! end
13234
13235 !! test
13236 Parsoid: Escape weird noWikI capitalizations
13237 !! options
13238 parsoid=html2wt
13239 !! html/parsoid
13240 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13241 !! wikitext
13242 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13243 !! end
13244
13245 ###
13246 ### Message transform tests
13247 ###
13248 !! test
13249 message transform: magic variables
13250 !! options
13251 msg
13252 !! wikitext
13253 {{SITENAME}}
13254 !! html
13255 MediaWiki
13256 !! end
13257
13258 !! test
13259 message transform: should not transform wiki markup
13260 !! options
13261 msg
13262 !! wikitext
13263 ''test''
13264 !! html
13265 ''test''
13266 !! end
13267
13268 !! test
13269 message transform: <noinclude> in transcluded template (T6926)
13270 !! options
13271 msg
13272 !! wikitext
13273 {{Includes}}
13274 !! html
13275 Foobar
13276 !! end
13277
13278 !! test
13279 message transform: <onlyinclude> in transcluded template (T6926)
13280 !! options
13281 msg
13282 !! wikitext
13283 {{Includes2}}
13284 !! html
13285 Foo
13286 !! end
13287
13288 !! test
13289 {{#special:}} page name, known
13290 !! options
13291 msg
13292 !! wikitext
13293 {{#special:Recentchanges}}
13294 !! html
13295 Special:RecentChanges
13296 !! end
13297
13298 !! test
13299 {{#special:}} page name with subpage, known
13300 !! options
13301 msg
13302 !! wikitext
13303 {{#special:Recentchanges/param}}
13304 !! html
13305 Special:RecentChanges/param
13306 !! end
13307
13308 !! test
13309 {{#special:}} page name, unknown
13310 !! options
13311 msg
13312 !! wikitext
13313 {{#special:foobar nonexistent}}
13314 !! html
13315 Special:Foobar nonexistent
13316 !! end
13317
13318 !! test
13319 {{#speciale:}} page name, known
13320 !! options
13321 msg
13322 !! wikitext
13323 {{#speciale:Recentchanges}}
13324 !! html
13325 Special:RecentChanges
13326 !! end
13327
13328 !! test
13329 {{#speciale:}} page name with subpage, known
13330 !! options
13331 msg
13332 !! wikitext
13333 {{#speciale:Recentchanges/param}}
13334 !! html
13335 Special:RecentChanges/param
13336 !! end
13337
13338 !! test
13339 {{#speciale:}} page name, unknown
13340 !! options
13341 msg
13342 !! wikitext
13343 {{#speciale:foobar nonexistent}}
13344 !! html
13345 Special:Foobar_nonexistent
13346 !! end
13347
13348 ###
13349 ### Images
13350 ###
13351 ### For Parsoid-specific tests, see
13352 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13353
13354 !! test
13355 Simple image
13356 !! options
13357 parsoid=wt2html,wt2wt,html2html
13358 !! wikitext
13359 [[Image:foobar.jpg]]
13360 !! html/php
13361 <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>
13362 </p>
13363 !! html/parsoid
13364 <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>
13365 !! end
13366
13367 !! test
13368 Simple image (using File: namespace, now canonical)
13369 !! wikitext
13370 [[File:Foobar.jpg]]
13371 !! html/php
13372 <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>
13373 </p>
13374 !! html/parsoid
13375 <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>
13376 !! end
13377
13378 !! test
13379 Right-aligned image
13380 !! wikitext
13381 [[File:Foobar.jpg|right]]
13382 !! html/php
13383 <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>
13384
13385 !! html/parsoid
13386 <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>
13387 !! end
13388
13389 !! test
13390 Image with caption
13391 !! wikitext
13392 [[File:Foobar.jpg|right|Caption text]]
13393 !! html/php
13394 <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>
13395
13396 !! html/parsoid
13397 <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>
13398 !! end
13399
13400 !! test
13401 Image with caption, T55312 #1
13402 !! wikitext
13403 [[File:Foobar.jpg|right|Caption page stuff]]
13404 !! html/php
13405 <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>
13406
13407 !! html/parsoid
13408 <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>
13409 !! end
13410
13411 !! test
13412 Image with caption, T55312 #2
13413 !! wikitext
13414 [[File:Foobar.jpg|right|Caption page=]]
13415 !! html/php
13416 <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>
13417
13418 !! html/parsoid
13419 <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>
13420 !! end
13421
13422 !! test
13423 Image with caption, T55312 #3
13424 !! wikitext
13425 [[File:Foobar.jpg|right|Caption page=stuff]]
13426 !! html/php
13427 <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>
13428
13429 !! html/parsoid
13430 <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>
13431 !! end
13432
13433 !! test
13434 Allow empty links in image captions (T62753)
13435 !! options
13436 thumbsize=220
13437 !! wikitext
13438 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13439 [[]]
13440 [[Link2]]
13441 ]]
13442 !! html/php
13443 <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>
13444
13445 !! html/parsoid
13446 <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>
13447 [[]]
13448 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13449 </figcaption></figure>
13450 !! end
13451
13452 !! test
13453 Titles in unlinked images (T23454)
13454 !! wikitext
13455 [[File:Foobar.jpg|link=|stuff]]
13456 !! html/php
13457 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13458 </p>
13459 !! end
13460
13461 !! test
13462 Link with empty target
13463 !! wikitext
13464 [[]]
13465 !! html
13466 <p>[[]]
13467 </p>
13468 !! end
13469
13470 !! test
13471 Image with link trail
13472 !! wikitext
13473 Linktrails should not work for images: [[File:Foobar.jpg]]s
13474 !! html/php
13475 <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
13476 </p>
13477 !! html/parsoid
13478 <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>
13479 !! end
13480
13481 !! test
13482 Image with empty attribute
13483 !! options
13484 parsoid=wt2html,wt2wt,html2html
13485 !! wikitext
13486 [[File:Foobar.jpg|right||Caption text]]
13487 !! html/php
13488 <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>
13489
13490 !! html/parsoid
13491 <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>
13492 !! end
13493
13494 !! test
13495 1. Block image with individual attributes from templates
13496 !! wikitext
13497 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13498 !! html/php
13499 <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>
13500
13501 !! html/parsoid
13502 <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>
13503 !! end
13504
13505 !! test
13506 2. Block Image with individual attributes from templates
13507 !! wikitext
13508 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13509 !! html/php
13510 <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>
13511
13512 !! html/parsoid
13513 <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>
13514 !! end
13515
13516 !! test
13517 3. Inline image with individual attributes from templates
13518 !! wikitext
13519 [[File:Foobar.jpg|{{echo|50px}}]]
13520 !! html/php
13521 <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>
13522 </p>
13523 !! html/parsoid
13524 <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>
13525 !! end
13526
13527 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13528 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13529 !! test
13530 Image with multiple attributes from the same template
13531 !! wikitext
13532 [[File:Foobar.jpg|{{image_attribs}}]]
13533 !! html/php
13534 <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>
13535
13536 !! html/parsoid
13537 <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>
13538 !! end
13539
13540 !! test
13541 Image with link tails
13542 !! options
13543 thumbsize=220
13544 !! wikitext
13545 123[[File:Foobar.jpg]]456
13546 123[[File:Foobar.jpg|right]]456
13547 123[[File:Foobar.jpg|thumb]]456
13548 !! html/php
13549 <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
13550 </p>
13551 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
13552 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
13553
13554 !! html/php+tidy
13555 <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>
13556 <p>123</p>
13557 <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>
13558 <p>456 123</p>
13559 <div class="thumb tright">
13560 <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>
13561 <div class="thumbcaption">
13562 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13563 </div>
13564 </div>
13565 </div>
13566 <p>456</p>
13567 !! html/parsoid
13568 <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>
13569 <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>
13570 <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>
13571 !! end
13572
13573 !! test
13574 Image with multiple captions -- only last one is accepted
13575 !! wikitext
13576 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13577 !! html/php
13578 <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>
13579
13580 !! html/parsoid
13581 <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>
13582 !! end
13583
13584 !! test
13585 Image with multiple widths -- use last
13586 !! wikitext
13587 [[File:Foobar.jpg|200px|300px|caption]]
13588 !! html/php
13589 <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>
13590 </p>
13591 !! html/parsoid
13592 <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>
13593 !! end
13594
13595 !! test
13596 Image with multiple alignments -- use first (T50664)
13597 !! options
13598 thumbsize=220
13599 !! wikitext
13600 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13601
13602 [[File:Foobar.jpg|middle|text-top|caption]]
13603 !! html/php
13604 <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>
13605 <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>
13606 </p>
13607 !! html/parsoid
13608 <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>
13609 <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>
13610 !! end
13611
13612 !! test
13613 Image with width attribute at different positions
13614 !! wikitext
13615 [[File:Foobar.jpg|200px|right|Caption]]
13616 [[File:Foobar.jpg|right|200px|Caption]]
13617 [[File:Foobar.jpg|right|Caption|200px]]
13618 !! html/php
13619 <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>
13620 <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>
13621 <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>
13622
13623 !! html/parsoid
13624 <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>
13625 <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>
13626 <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>
13627 !! end
13628
13629 # a sad bit of backward-compatibility
13630 !! test
13631 Image with size specified with pxpx (T15500, T53628)
13632 !! options
13633 parsoid=wt2html,wt2wt,html2html
13634 !! wikitext
13635 [[File:Foobar.jpg|20pxpx]]
13636 [[File:Foobar.jpg|200x20pxpx]]
13637 !! html/php
13638 <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>
13639 <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>
13640 </p>
13641 !! html/parsoid
13642 <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>
13643 !! end
13644
13645 !! test
13646 Image with link parameter, wiki target
13647 !! wikitext
13648 [[File:Foobar.jpg|link=Main Page]]
13649 !! html/php
13650 <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>
13651 </p>
13652 !! html/parsoid
13653 <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>
13654 !! end
13655
13656 # parsoid T51293 (part 1)
13657 !! test
13658 Image with link parameter, URL target
13659 !! wikitext
13660 [[File:Foobar.jpg|link=http://example.com/]]
13661 !! html/php
13662 <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>
13663 </p>
13664 !! html/parsoid
13665 <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>
13666 !! end
13667
13668 # parsoid T51293 (part 2)
13669 !! test
13670 Image with link parameter, protocol-less URL target
13671 !! wikitext
13672 [[File:Foobar.jpg|link=//example.com/]]
13673 !! html/php
13674 <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>
13675 </p>
13676 !! html/parsoid
13677 <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>
13678 !! end
13679
13680 !! test
13681 Escaping non-block captions (T107435)
13682 !! options
13683 parsoid={
13684 "modes": ["wt2wt"],
13685 "changes": [
13686 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13687 ]
13688 }
13689 !! wikitext
13690 [[Image:Foobar.jpg|caption]]
13691 !! wikitext/edited
13692 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13693 !! end
13694
13695 # wgExternalLinkTarget not supported by Parsoid
13696 !! test
13697 Image with link parameter, wgExternalLinkTarget
13698 !! wikitext
13699 [[Image:foobar.jpg|link=http://example.com/]]
13700 !! config
13701 wgExternalLinkTarget='foobar'
13702 !! html/php
13703 <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>
13704 </p>
13705 !! end
13706
13707 !! test
13708 Image with link parameter, wgNoFollowLinks set to false
13709 !! wikitext
13710 [[Image:foobar.jpg|link=http://example.com/]]
13711 !! config
13712 wgNoFollowLinks=false
13713 !! html
13714 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13715 </p>
13716 !! end
13717
13718 !! test
13719 Image with link parameter, wgNoFollowDomainExceptions
13720 !! wikitext
13721 [[Image:foobar.jpg|link=http://example.com/]]
13722 !! config
13723 wgNoFollowDomainExceptions='example.com'
13724 !! html
13725 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13726 </p>
13727 !! end
13728
13729 # wgExternalLinkTarget not supported by Parsoid
13730 !! test
13731 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13732 !! wikitext
13733 [[Image:foobar.jpg|link=http://example.com/|Title]]
13734 !! config
13735 wgExternalLinkTarget='foobar'
13736 !! html/php
13737 <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>
13738 </p>
13739 !! end
13740
13741 !! test
13742 Image with empty link parameter
13743 !! wikitext
13744 [[File:Foobar.jpg|link=]]
13745 !! html/php
13746 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13747 </p>
13748 !! html/parsoid
13749 <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>
13750 !! end
13751
13752 !! test
13753 Image with link parameter (wiki target) and unnamed parameter
13754 !! wikitext
13755 [[File:Foobar.jpg|link=Main_Page|Title]]
13756 !! html/php
13757 <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>
13758 </p>
13759 !! html/parsoid
13760 <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>
13761 !! end
13762
13763 !! test
13764 Image with link parameter (URL target) and unnamed parameter
13765 !! wikitext
13766 [[File:Foobar.jpg|link=http://example.com/|Title]]
13767 !! html/php
13768 <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>
13769 </p>
13770 !! html/parsoid
13771 <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>
13772 !! end
13773
13774 !! test
13775 Thumbnail image with link parameter
13776 !! options
13777 thumbsize=220
13778 parsoid=wt2html,wt2wt,html2html
13779 !! wikitext
13780 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13781 !! html/php
13782 <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>
13783
13784 !! html/parsoid
13785 <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>
13786 !! end
13787
13788 !! test
13789 Manually-specified thumbnail image
13790 !! options
13791 thumbsize=220
13792 !! wikitext
13793 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
13794 !! html/php
13795 <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>
13796
13797 !! html/parsoid
13798 <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>
13799 !! end
13800
13801 !! test
13802 Manually-specified thumbnail image with explicit link to wiki page
13803 !! options
13804 thumbsize=220
13805 parsoid=wt2html,wt2wt,html2html
13806 !! wikitext
13807 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13808 !! html/php
13809 <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>
13810
13811 !! html/parsoid
13812 <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>
13813 !! end
13814
13815 !! test
13816 Manually-specified thumbnail image with explicit link to url
13817 !! options
13818 thumbsize=220
13819 parsoid=wt2html,wt2wt,html2html
13820 !! wikitext
13821 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13822 !! html/php
13823 <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>
13824
13825 !! html/parsoid
13826 <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>
13827 !! end
13828
13829 !! test
13830 Manually-specified thumbnail image with explicit no link
13831 !! options
13832 thumbsize=220
13833 parsoid=wt2html,wt2wt,html2html
13834 !! wikitext
13835 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13836 !! html/php
13837 <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>
13838
13839 !! html/parsoid
13840 <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>
13841 !! end
13842
13843 !! test
13844 Manually-specified thumbnail image with explicit link and alt text
13845 !! options
13846 thumbsize=220
13847 parsoid=wt2html,wt2wt,html2html
13848 !! wikitext
13849 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13850 !! html/php
13851 <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>
13852
13853 !! html/parsoid
13854 <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>
13855 !! end
13856
13857 !! test
13858 Image with frame and link
13859 !! options
13860 parsoid=wt2html,wt2wt,html2html
13861 !! wikitext
13862 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13863 !! html/php
13864 <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>
13865
13866 !! html/parsoid
13867 <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>
13868 !! end
13869
13870 !! test
13871 Image with frame and link and explicit alt
13872 !! options
13873 parsoid=wt2html,wt2wt,html2html
13874 !! wikitext
13875 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13876 !! html/php
13877 <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>
13878
13879 !! html/parsoid
13880 <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>
13881 !! end
13882
13883 !! test
13884 Image with wiki markup in implicit alt
13885 !! wikitext
13886 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13887
13888 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13889 !! html/php
13890 <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>
13891 </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>
13892 </p>
13893 !! html/parsoid
13894 <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>
13895
13896 <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>
13897 !! end
13898
13899 !! test
13900 Alt image option should handle most kinds of wikitext without barfing
13901 !! wikitext
13902 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13903 !! html/php
13904 <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>
13905
13906 !! html/parsoid
13907 <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>
13908 !! end
13909
13910 ###################
13911 # Conflicting image format options.
13912 # First option specified should 'win'.
13913 # All three cases in each test should be identical.
13914
13915 !! test
13916 Image with 'frameless' first.
13917 !! options
13918 parsoid=wt2html,wt2wt,html2html
13919 !! wikitext
13920 [[File:Foobar.jpg|frameless|caption]]
13921
13922 [[File:Foobar.jpg|frameless|frame|caption]]
13923
13924 [[File:Foobar.jpg|frameless|thumb|caption]]
13925 !! html/php
13926 <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>
13927 </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>
13928 </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>
13929 </p>
13930 !! html/parsoid
13931 <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>
13932 <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>
13933 <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>
13934 !! end
13935
13936 !! test
13937 Image with 'frame' first.
13938 !! options
13939 parsoid=wt2html,wt2wt,html2html
13940 !! wikitext
13941 [[File:Foobar.jpg|frame|caption]]
13942 [[File:Foobar.jpg|frame|frameless|caption]]
13943 [[File:Foobar.jpg|frame|thumb|caption]]
13944 !! html/php
13945 <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>
13946 <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>
13947 <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>
13948
13949 !! html/parsoid
13950 <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>
13951 <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>
13952 <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>
13953 !! end
13954
13955 !! test
13956 Image with 'thumb' first.
13957 !! options
13958 parsoid=wt2html,wt2wt,html2html
13959 !! wikitext
13960 [[File:Foobar.jpg|thumb|caption]]
13961 [[File:Foobar.jpg|thumb|frameless|caption]]
13962 [[File:Foobar.jpg|thumb|frame|caption]]
13963 !! html/php
13964 <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>
13965 <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>
13966 <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>
13967
13968 !! html/parsoid
13969 <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>
13970 <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>
13971 <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>
13972 !! end
13973
13974 ###################
13975 # Image sizing.
13976 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13977 # and https://phabricator.wikimedia.org/T64258
13978 # Foobar has actual size of 1941x220
13979 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13980 # a scalable format.
13981 # 2. Framed images always ignore size options; always render at default size.
13982 # 3. "Unspecified format" and border are the only types which can be
13983 # enlarged.
13984
13985 !! test
13986 Image: "unspecified format" and border enlarge
13987 !! options
13988 parsoid=wt2html,wt2wt,html2html
13989 !! wikitext
13990 [[File:Foobar.jpg|2000px]]
13991
13992 [[File:Foobar.jpg|border|2000px]]
13993 !! html/php
13994 <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>
13995 </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>
13996 </p>
13997 !! html/parsoid
13998 <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>
13999 <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>
14000 !! end
14001
14002 !! test
14003 Image: "unspecified format" and border reduce
14004 !! options
14005 parsoid=wt2html,wt2wt,html2html
14006 !! wikitext
14007 [[File:Foobar.jpg|1000px]]
14008
14009 [[File:Foobar.jpg|border|1000px]]
14010 !! html/php
14011 <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>
14012 </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>
14013 </p>
14014 !! html/parsoid
14015 <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>
14016 <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>
14017 !! end
14018
14019 !! test
14020 Image: thumbs reduce
14021 !! options
14022 parsoid=wt2html,wt2wt,html2html
14023 !! wikitext
14024 [[File:Foobar.jpg|thumb|50px]]
14025 !! html/php
14026 <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>
14027
14028 !! html/parsoid
14029 <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>
14030 !! end
14031
14032 !! test
14033 Image: bitmap thumbs can't be enlarged past original size, but vector can.
14034 !! options
14035 parsoid=wt2html,wt2wt,html2html
14036 !! wikitext
14037 [[File:Foobar.jpg|thumb|2000px]]
14038
14039 [[File:Foobar.svg|thumb|2000px]]
14040 !! html/php
14041 <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>
14042 <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>
14043
14044 !! html/parsoid
14045 <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>
14046 <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>
14047 !! end
14048
14049 !! test
14050 Image: frameless can reduce in size
14051 !! options
14052 parsoid=wt2html,wt2wt,html2html
14053 !! wikitext
14054 [[File:Foobar.jpg|frameless|50px]]
14055 !! html/php
14056 <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>
14057 </p>
14058 !! html/parsoid
14059 <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>
14060 !! end
14061
14062 !! test
14063 Image: bitmap frameless can't be enlarged past original size, but vector can
14064 !! options
14065 parsoid=wt2html,wt2wt,html2html
14066 !! wikitext
14067 [[File:Foobar.jpg|frameless|2000px]]
14068
14069 [[File:Foobar.svg|frameless|2000px]]
14070 !! html/php
14071 <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>
14072 </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>
14073 </p>
14074 !! html/parsoid
14075 <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>
14076 <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>
14077 !! end
14078
14079 !! test
14080 Image: framed images are always unscaled.
14081 !! options
14082 parsoid=wt2html,wt2wt,html2html
14083 !! wikitext
14084 [[File:Foobar.jpg|frame]]
14085
14086 [[File:Foobar.jpg|frame|50px]]
14087
14088 [[File:Foobar.jpg|frame|50x50px]]
14089
14090 [[File:Foobar.jpg|frame|2000px]]
14091 !! html/php
14092 <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>
14093 <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>
14094 <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>
14095 <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>
14096
14097 !! html/parsoid
14098 <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>
14099 <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>
14100 <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>
14101 <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>
14102 !! end
14103
14104 ###################
14105
14106 !! test
14107 Link to image page- image page normally doesn't exists, hence edit link
14108 Add test with existing image page
14109 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14110 !! wikitext
14111 [[:Image:test]]
14112 !! html
14113 <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>
14114 </p>
14115 !! end
14116
14117 !! test
14118 T20784 Link to non-existent image page with caption should use caption as link text
14119 !! wikitext
14120 [[:Image:test|caption]]
14121 !! html
14122 <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>
14123 </p>
14124 !! end
14125
14126 !! test
14127 Frameless image caption with a free URL
14128 !! wikitext
14129 [[File:Foobar.jpg|http://example.com]]
14130 !! html/php
14131 <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>
14132 </p>
14133 !! html/parsoid
14134 <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>
14135 !! end
14136
14137 !! test
14138 Thumbnail image caption with a free URL
14139 !! options
14140 thumbsize=220
14141 !! wikitext
14142 [[File:Foobar.jpg|thumb|http://example.com]]
14143 !! html/php
14144 <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>
14145
14146 !! html/parsoid
14147 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
14148 !! end
14149
14150 !! test
14151 Thumbnail image caption with a free URL and explicit alt
14152 !! options
14153 thumbsize=220
14154 parsoid=wt2html,wt2wt,html2html
14155 !! wikitext
14156 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14157 !! html/php
14158 <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>
14159
14160 !! html/parsoid
14161 <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>
14162 !! end
14163
14164 !! test
14165 SVG thumbnails with no language set
14166 !! options
14167 !! wikitext
14168 [[File:Foobar.svg|thumb|caption]]
14169 !! html/php
14170 <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>
14171
14172 !! html/parsoid
14173 <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>
14174 !! end
14175
14176 !! test
14177 SVG thumbnails with language de
14178 !! options
14179 parsoid=wt2html,wt2wt,html2html
14180 !! wikitext
14181 [[File:Foobar.svg|thumb|caption|lang=de]]
14182 !! html/php
14183 <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>
14184
14185 !! html/parsoid
14186 <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>
14187 !! end
14188
14189 !! test
14190 SVG thumbnails with invalid language code
14191 !! options
14192 parsoid=wt2html,wt2wt,html2html
14193 !! wikitext
14194 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14195 !! html/php
14196 <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>
14197
14198 !! html/parsoid
14199 <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>
14200 !! end
14201
14202 !! test
14203 T3887: A ISBN with a thumbnail
14204 !! wikitext
14205 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14206 !! html/php
14207 <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>
14208
14209 !! html/parsoid
14210 <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>
14211 !! end
14212
14213 !! test
14214 T3887: A RFC with a thumbnail
14215 !! wikitext
14216 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14217 !! html/php
14218 <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>
14219
14220 !! html/parsoid
14221 <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>
14222 !! end
14223
14224 !! test
14225 T3887: A mailto link with a thumbnail
14226 !! wikitext
14227 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14228 !! html/php
14229 <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>
14230
14231 !! html/parsoid
14232 <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>
14233 !! end
14234
14235 # Pending resolution to T2368
14236 !! test
14237 T2648: Frameless image caption with a link
14238 !! wikitext
14239 [[File:Foobar.jpg|text with a [[link]] in it]]
14240 !! html/php
14241 <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>
14242 </p>
14243 !! html/parsoid
14244 <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>
14245 !! end
14246
14247 !! test
14248 T2648: Frameless image caption with a link (suffix)
14249 !! wikitext
14250 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14251 !! html/php
14252 <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>
14253 </p>
14254 !! html/parsoid
14255 <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>
14256 !! end
14257
14258 !! test
14259 T2648: Frameless image caption with an interwiki link
14260 !! wikitext
14261 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14262 !! html/php
14263 <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>
14264 </p>
14265 !! html/parsoid
14266 <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>
14267 !! end
14268
14269 !! test
14270 T2648: Frameless image caption with a piped interwiki link
14271 !! wikitext
14272 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14273 !! html/php
14274 <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>
14275 </p>
14276 !! html/parsoid
14277 <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>
14278 !! end
14279
14280 !! test
14281 T107474: Frameless image caption with <nowiki>
14282 !! wikitext
14283 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14284 !! html/parsoid
14285 <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>
14286 !! end
14287
14288 !! test
14289 Escape HTML special chars in image alt text
14290 !! wikitext
14291 [[File:Foobar.jpg|& < > "]]
14292 !! html/php
14293 <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>
14294 </p>
14295 !! html/parsoid
14296 <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>
14297 !! end
14298
14299 !! test
14300 Escape HTML special chars in image alt text with LanguageConverter
14301 !! options
14302 language=zh
14303 !! wikitext
14304 [[File:Foobar.jpg|& < > "]]
14305 !! html/php
14306 <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>
14307 </p>
14308 !! html/parsoid
14309 <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>
14310 !! end
14311
14312 !! test
14313 Entities in file name and attributes
14314 !! wikitext
14315 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14316 !! html/php
14317 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14318 </p>
14319 !! html/parsoid
14320 <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>
14321 !! end
14322
14323 !! test
14324 T2499: Alt text should have &#1234;, not &amp;1234;
14325 !! wikitext
14326 [[File:Foobar.jpg|&#9792;]]
14327 !! html/php
14328 <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>
14329 </p>
14330 !! html/parsoid
14331 <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>
14332 !! end
14333
14334 !! test
14335 Broken image caption with link
14336 !! options
14337 parsoid=wt2html,wt2wt,html2html
14338 !! wikitext
14339 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14340 !! html/php
14341 <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.
14342 </p>
14343 !! html/parsoid
14344 <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>
14345 !! end
14346
14347 !! test
14348 Image caption containing another image
14349 !! wikitext
14350 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14351 !! html/php
14352 <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>
14353
14354 !! html/parsoid
14355 <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>
14356 !! end
14357
14358 !! test
14359 Image: caption containing a newline
14360 !! wikitext
14361 [[File:Foobar.jpg|This
14362 *is some text]]
14363 !! html/php
14364 <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>
14365 </p>
14366 !! html/parsoid
14367 <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>
14368 !!end
14369
14370 !!test
14371 Image: caption containing leading space
14372 (The leading space should not trigger nowiki escaping in wt2wt mode)
14373 !! wikitext
14374 [[File:Foobar.jpg|thumb| bar]]
14375 !! html/php
14376 <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>
14377
14378 !! html/parsoid
14379 <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>
14380 !!end
14381
14382 !! test
14383 Image: caption containing a table
14384 !! options
14385 parsoid=wt2html,wt2wt,html2html
14386 !! wikitext
14387 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14388 {|
14389 ! Foo !! Bar
14390 |-
14391 | Foo1 || Bar1
14392 |}
14393 and some more text.]]
14394 !! html/php
14395 <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>
14396
14397 !! html/parsoid
14398 <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
14399 <table>
14400 <tbody>
14401 <tr><th>Foo </th><th>Bar</th></tr>
14402 <tr>
14403 <td>Foo1 </td>
14404 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14405 !! end
14406
14407 !! test
14408 T5090: External links other than http: in image captions
14409 !! wikitext
14410 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14411 !! html/php
14412 <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>
14413
14414 !! html/parsoid
14415 <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>
14416 !! end
14417
14418 !! test
14419 Custom class
14420 !! options
14421 parsoid=wt2html,wt2wt,html2html
14422 !! wikitext
14423 [[Image:foobar.jpg|a|class=b]]
14424 !! html/php
14425 <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>
14426 </p>
14427 !! html/parsoid
14428 <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>
14429 !! end
14430
14431 !! test
14432 Localized image handling (1).
14433 !! options
14434 parsoid=wt2html,wt2wt,html2html
14435 language=es
14436 !! wikitext
14437 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14438 !! html/php
14439 <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>
14440
14441 !! html/parsoid
14442 <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>
14443 !! end
14444
14445 !! test
14446 Localized image handling (2).
14447 !! options
14448 thumbsize=220
14449 parsoid=wt2html,wt2wt,html2html
14450 language=es
14451 !! wikitext
14452 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14453 !! html/php
14454 <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>
14455
14456 !! html/parsoid
14457 <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>
14458 !! end
14459
14460 !! test
14461 Localized image handling (3).
14462 !! options
14463 language=fa
14464 parsoid=html2wt
14465 !! html/parsoid
14466 <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>
14467 !! wikitext
14468 [[File:Foobar.jpg|بندانگشتی]]
14469 !! end
14470
14471 !! test
14472 "border", "frameless" and "class" attributes on an image.
14473 !! options
14474 thumbsize=220
14475 parsoid=wt2html,wt2wt,html2html
14476 !! wikitext
14477 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14478 !! html/php
14479 <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>
14480 </p>
14481 !! html/parsoid
14482 <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>
14483 !! end
14484
14485 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14486 !! test
14487 Invalid image attributes (T64500)
14488 !! options
14489 thumbsize=220
14490 parsoid=wt2html,wt2wt,html2html
14491 !! wikitext
14492 [[File:Foobar.jpg|thumb|float|left|caption]]
14493
14494 [[File:Foobar.jpg|thumb|righ|caption]]
14495
14496 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14497 !! html/php
14498 <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>
14499 <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>
14500 <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>
14501
14502 !! html/parsoid
14503 <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>
14504 <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>
14505 <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>
14506 !! end
14507
14508 !! article
14509 File:Barfoo.jpg
14510 !! text
14511 #REDIRECT [[File:Barfoo.jpg]]
14512 !! endarticle
14513
14514 # FIXME: Parsoid should run this test -- but we'd need to teach the
14515 # mockAPI about the redirected Barfoo.jpg image.
14516 !! test
14517 Redirected image
14518 !! wikitext
14519 [[Image:Barfoo.jpg]]
14520 !! html/php
14521 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14522 </p>
14523 !! end
14524
14525 !! test
14526 Missing image with uploads disabled
14527 !! options
14528 wgEnableUploads=0
14529 !! wikitext
14530 [[File:Foobaz.jpg]]
14531 !! html/php
14532 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14533 </p>
14534 !! html/parsoid
14535 <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>
14536 !! end
14537
14538 # Parsoid-specific testing for images
14539 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14540 # Currently imperfect due to a flaw in the Parsoid testrunner
14541 # Work in progress
14542 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14543 # image tests.
14544
14545 !! test
14546 Parsoid-specific image handling - simple image with size and middle alignment
14547 !! wikitext
14548 [[File:Foobar.jpg|middle|50px]]
14549 !! html/parsoid
14550 <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>
14551 !! end
14552
14553 !! test
14554 Parsoid-specific image handling - simple image with size, middle alignment,
14555 non-standard namespace alias
14556 !! options
14557 parsoid=wt2wt,wt2html,html2html
14558 !! wikitext
14559 [[Image:Foobar.jpg|middle|50px]]
14560 !! html/parsoid
14561 <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>
14562 !! end
14563
14564 !! test
14565 Parsoid-specific image handling - simple image with size and middle alignment
14566 (existing content)
14567 !! wikitext
14568 [[File:Foobar.jpg|50px|middle]]
14569 !! html/parsoid
14570 <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>
14571 !! end
14572
14573 !! test
14574 Parsoid-specific image handling - simple image with size and middle alignment
14575 and non-standard namespace name
14576 !! options
14577 parsoid=wt2html,wt2wt,html2html
14578 !! wikitext
14579 [[Image:Foobar.jpg|50px|middle]]
14580 !! html/parsoid
14581 <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>
14582 !! end
14583
14584 !! test
14585 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14586 !! wikitext
14587 [[File:Foobar.jpg|500x10px|baseline|caption]]
14588 !! html/parsoid
14589 <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>
14590 !! end
14591
14592 !! test
14593 Parsoid-specific image handling - simple image with border and size spec
14594 !! wikitext
14595 [[File:Foobar.jpg|50px|border|caption]]
14596 !! html/parsoid
14597 <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>
14598 !! end
14599
14600 !! test
14601 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14602 !! wikitext
14603 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14604 !! html/parsoid
14605 <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>
14606 !! end
14607
14608 !! test
14609 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14610 (existing content)
14611 !! wikitext
14612 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14613 !! html/parsoid
14614 <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>
14615 !! end
14616
14617 !! test
14618 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14619 !! wikitext
14620 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14621 !! html/parsoid
14622 <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>
14623 !! end
14624
14625 !! test
14626 Parsoid-specific image handling - thumbnail with specific size, halign,
14627 valign, and caption (existing content)
14628 !! wikitext
14629 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14630 !! html/parsoid
14631 <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>
14632 !! end
14633
14634 !! test
14635 Parsoid-specific image handling - framed image with specific size and caption
14636 (size is ignored)
14637 !! options
14638 parsoid=wt2html,wt2wt,html2html
14639 !! wikitext
14640 [[File:Foobar.jpg|frame|500x50px|caption]]
14641 !! html/parsoid
14642 <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>
14643 !! end
14644
14645 !! test
14646 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14647 (size is ignored)
14648 !! options
14649 parsoid=wt2html,wt2wt,html2html
14650 !! wikitext
14651 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14652 !! html/parsoid
14653 <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>
14654 !! end
14655
14656 !! test
14657 Parsoid-specific image handling - frameless image with specific size, border, and caption
14658 !! wikitext
14659 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14660 !! html/parsoid
14661 <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>
14662 !! end
14663
14664 !! test
14665 Parsoid-specific image handling - simple image with a formatted caption
14666 !! wikitext
14667 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14668 !! html/parsoid
14669 <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>
14670 !! end
14671
14672 !! test
14673 Parsoid-specific image handling - caption with a template in it
14674 !! wikitext
14675 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14676 !! html/parsoid
14677 <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>
14678 !! end
14679
14680 !! test
14681 Parsoid-specific image handling - caption with unbalanced tags in it
14682 !! options
14683 parsoid=wt2html,wt2wt,html2html
14684 !! wikitext
14685 foo
14686 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14687 bar
14688 !! html/parsoid
14689 <p>foo</p>
14690 <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>
14691 <p>bar</p>
14692 !! end
14693
14694 !! test
14695 Parsoid-specific image handling - empty caption (1)
14696 !! options
14697 parsoid=wt2html,wt2wt
14698 !! wikitext
14699 [[File:Foobar.jpg|thumb|]]
14700 !! html/parsoid
14701 <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>
14702 !! end
14703
14704 # empty captions don't get serialized unless we're in the "round trip" case
14705 !! test
14706 Parsoid-specific image handling - empty caption (2)
14707 !! options
14708 parsoid=html2wt
14709 !! html/parsoid
14710 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14711 <a href="./File:Foobar.jpg">
14712 <img resource="./File:Foobar.jpg"
14713 src="//example.com/images/3/3a/Foobar.jpg"
14714 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14715 height="25" width="220"/>
14716 </a>
14717 <figcaption></figcaption>
14718 </figure>
14719 !! wikitext
14720 [[File:Foobar.jpg|thumb]]
14721 !! end
14722
14723 !! test
14724 Parsoid-specific image handling - whitespace caption
14725 !! wikitext
14726 [[File:Foobar.jpg|thumb| ]]
14727 !! html/parsoid
14728 <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>
14729 !! end
14730
14731 !! test
14732 Parsoid-specific image handling - lang option
14733 !! wikitext
14734 foo
14735 [[File:Foobar.svg|lang=de|caption]]
14736 bar
14737 !! html/parsoid
14738 <p>foo
14739 <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>
14740 bar</p>
14741 !! end
14742
14743 ## Edge case bugs in Parsoid from T93580
14744 !! test
14745 T93580: 1. Templated <ref> inside block images
14746 !! wikitext
14747 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14748
14749 <references />
14750 !! html/parsoid
14751 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption with templated ref: {{echo|&lt;ref>foo&lt;/ref>}}"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption with templated ref: <span about="#mwt5" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></figcaption></figure>
14752
14753 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
14754 !! end
14755
14756 !! test
14757 T93580: 2. <ref> inside inline images
14758 !! wikitext
14759 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14760
14761 <references />
14762 !! html/parsoid
14763 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,78,5,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-1\"},\"attrs\":{}}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,78,5,6]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14764
14765 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
14766 !! end
14767
14768 !! test
14769 T93580: 3. Templated <ref> inside inline images
14770 !! wikitext
14771 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14772
14773 <references />
14774 !! html/parsoid
14775 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14776
14777 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
14778 !! end
14779
14780 ###
14781 ### Subpages
14782 ###
14783 !! article
14784 Subpage test/subpage
14785 !! text
14786 foo
14787 !! endarticle
14788
14789 !! test
14790 Subpage link
14791 !! options
14792 subpage title=[[Subpage test]]
14793 !! wikitext
14794 [[/subpage]]
14795 !! html
14796 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14797 </p>
14798 !! end
14799
14800 !! test
14801 Subpage noslash link
14802 !! options
14803 subpage title=[[Subpage test]]
14804 !! wikitext
14805 [[/subpage/]]
14806 !! html
14807 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14808 </p>
14809 !! end
14810
14811 !! article
14812 Subpage test/1/2/subpage
14813 !! text
14814 blah
14815 !! endarticle
14816
14817 !! test
14818 Relative subpage noslash link
14819 !! options
14820 parsoid=wt2wt,wt2html,html2html
14821 subpage title=[[Subpage test/1/2/3/4]]
14822 !! wikitext
14823 [[../../subpage/]]
14824
14825 [[../../subpage]]
14826 !! html/php
14827 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14828 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14829 </p>
14830 !! html/parsoid
14831 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14832 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14833 !! end
14834
14835 !! test
14836 Parsoid: dot-slash prefixed wikilinks
14837 !! wikitext
14838 [[./foo]]
14839
14840 [[././bar]]
14841
14842 [[././baz/]]
14843 !! html/php
14844 <p>[[./foo]]
14845 </p><p>[[././bar]]
14846 </p><p>[[././baz/]]
14847 </p>
14848 !! html/parsoid
14849 <p>[[./foo]]
14850 </p><p>[[././bar]]
14851 </p><p>[[././baz/]]
14852 </p>
14853 !! end
14854
14855 !! test
14856 Render invalid page names as plain text (T53090)
14857 !! wikitext
14858 [[./../foo|bar]]
14859 [[foo�|bar]]
14860 [[foo/.|bar]]
14861 [[foo/..|bar]]
14862 [[foo~~~bar]]
14863 [[foo>bar]]
14864 [[foo[bar]]
14865 [[.]]
14866 [[..]]
14867 [[foo././bar]]
14868
14869 [[{{echo|./../foo}}|bar]]
14870 [[{{echo|foo/.}}|bar]]
14871 [[{{echo|foo/..}}|bar]]
14872 [[{{echo|foo~~~~bar}}]]
14873 [[{{echo|foo>bar}}]]
14874 [[{{echo|foo././bar}}]]
14875 [[{{echo|foo{bar}}]]
14876 [[{{echo|foo}bar}}]]
14877 [[{{echo|foo[bar}}]]
14878 [[{{echo|foo]bar}}]]
14879 [[{{echo|foo<bar}}]]
14880 !!html/php
14881 <p>[[./../foo|bar]]
14882 [[foo�|bar]]
14883 [[foo/.|bar]]
14884 [[foo/..|bar]]
14885 [[foo~~~bar]]
14886 [[foo&gt;bar]]
14887 [[foo[bar]]
14888 [[.]]
14889 [[..]]
14890 [[foo././bar]]
14891 </p><p>[[./../foo|bar]]
14892 [[foo/.|bar]]
14893 [[foo/..|bar]]
14894 [[foo~~~~bar]]
14895 [[foo&gt;bar]]
14896 [[foo././bar]]
14897 [[foo{bar]]
14898 [[foo}bar]]
14899 [[foo[bar]]
14900 [[foo]bar]]
14901 [[foo&lt;bar]]
14902 </p>
14903 !!html/parsoid
14904 <p>[[./../foo|bar]]
14905 [[foo�|bar]]
14906 [[foo/.|bar]]
14907 [[foo/..|bar]]
14908 [[foo~~~bar]]
14909 [[foo>bar]]
14910 [[foo[bar]]
14911 [[.]]
14912 [[..]]
14913 [[foo././bar]]</p>
14914
14915 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14916 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14917 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14918 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14919 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14920 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14921 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14922 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14923 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14924 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14925 [[<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>
14926 !!end
14927
14928 !! test
14929 Disabled subpages
14930 !! wikitext
14931 [[/subpage]]
14932 !! html
14933 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14934 </p>
14935 !! end
14936
14937 !! test
14938 T2561: {{/Subpage}}
14939 !! options
14940 subpage title=[[Page]]
14941 !! wikitext
14942 {{/Subpage}}
14943 !! html
14944 <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>
14945 </p>
14946 !! end
14947
14948 ###
14949 ### Categories
14950 ###
14951 !! article
14952 Category:MediaWiki User's Guide
14953 !! text
14954 blah
14955 !! endarticle
14956
14957 !! test
14958 Link to category
14959 !! wikitext
14960 [[:Category:MediaWiki User's Guide]]
14961 !! html
14962 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14963 </p>
14964 !! end
14965
14966 !! test
14967 Simple category
14968 !! options
14969 cat
14970 !! wikitext
14971 [[Category:MediaWiki User's Guide]]
14972 !! html/php
14973 cat=MediaWiki_User's_Guide sort=
14974 !! html/parsoid
14975 <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"}}'/>
14976 !! end
14977
14978 !! test
14979 PAGESINCATEGORY invalid title fatal (r33546 fix)
14980 !! wikitext
14981 {{PAGESINCATEGORY:<bogus>}}
14982 !! html
14983 <p>0
14984 </p>
14985 !! end
14986
14987 !! test
14988 Category with different sort key
14989 !! options
14990 cat
14991 !! wikitext
14992 [[Category:MediaWiki User's Guide|Foo]]
14993 !! html/php
14994 cat=MediaWiki_User's_Guide sort=Foo
14995 !! html/parsoid
14996 <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"}}'/>
14997 !! end
14998
14999 !! test
15000 Category with identical sort key
15001 !! options
15002 cat
15003 !! wikitext
15004 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15005 !! html/php
15006 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
15007 !! html/parsoid
15008 <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"}}'/>
15009 !! end
15010
15011 !! test
15012 Category with empty sort key
15013 !! options
15014 cat
15015 pst
15016 !! wikitext
15017 [[Category:MediaWiki User's Guide|]]
15018 !! html/php
15019 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15020 !! end
15021
15022 !! test
15023 Category with empty sort key and parentheses
15024 !! options
15025 cat
15026 pst
15027 !! wikitext
15028 [[Category:Foo (bar)|]]
15029 !! html/php
15030 [[Category:Foo (bar)|Foo]]
15031 !! end
15032
15033 !! test
15034 Category with link tail
15035 !! options
15036 cat
15037 pst
15038 !! wikitext
15039 123[[Category:Foo]]456
15040 !! html/php
15041 123[[Category:Foo]]456
15042 !! end
15043
15044 !! test
15045 Category with template
15046 !! options
15047 cat
15048 pst
15049 !! wikitext
15050 [[Category:{{echo|Foo}}]]
15051 !! html/php
15052 [[Category:{{echo|Foo}}]]
15053 !! end
15054
15055 !! test
15056 Category with template in sort key
15057 !! options
15058 cat
15059 pst
15060 !! wikitext
15061 [[Category:Foo|{{echo|Bar}}]]
15062 !! html/php
15063 [[Category:Foo|{{echo|Bar}}]]
15064 !! end
15065
15066 !! test
15067 Category with template in sort key and title
15068 !! options
15069 cat
15070 pst
15071 !! wikitext
15072 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15073 !! html/php
15074 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15075 !! end
15076
15077 ## We used to, but no longer wt2wt this test since the default serializer
15078 ## will normalize all categories to serialize on their own line.
15079 ## This wikitext usage is going to be fairly uncommon in production and
15080 ## selser will take care of preserving formatting in those scenarios.
15081 !! test
15082 Category / paragraph interactions
15083 !! options
15084 parsoid=wt2html
15085 !! wikitext
15086 Foo [[Category:Baz]] Bar
15087
15088 Foo [[Category:Baz]]
15089 Bar
15090
15091 Foo
15092 [[Category:Baz]]
15093 Bar
15094
15095 Foo
15096 [[Category:Baz]] Bar
15097
15098 Foo
15099 [[Category:Baz]]
15100 [[Category:Baz]]
15101 [[Category:Baz]]
15102 Bar
15103
15104 [[Category:Baz]]
15105 [[Category:Baz]]
15106 [[Category:Baz]]
15107
15108 [[Category:Baz]]
15109 {{echo|[[Category:Baz]]}}
15110 [[Category:Baz]]
15111 !! html/php
15112 <p>Foo Bar
15113 </p><p>Foo
15114 Bar
15115 </p><p>Foo
15116 Bar
15117 </p><p>Foo Bar
15118 </p><p>Foo
15119 Bar
15120 </p>
15121 !! html/parsoid
15122 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15123 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15124 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15125 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15126 <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>
15127 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15128 !! end
15129
15130 ## We used to, but no longer wt2wt this test since the default serializer
15131 ## will normalize all categories to serialize on their own line.
15132 ## This wikitext usage is going to be fairly uncommon in production and
15133 ## selser will take care of preserving formatting in those scenarios.
15134 ##
15135 ## The whitespace on the empty line is part of the test. Please do not delete
15136 !! test
15137 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15138 !! options
15139 parsoid=wt2html
15140 !! wikitext
15141 This
15142
15143 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15144
15145 {{echo|[[Category:Foo]] and so should this!}}
15146 !! html/php
15147 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15148 </p>
15149 !! html/parsoid
15150 <p>This
15151
15152 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15153
15154 <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>
15155 !! end
15156
15157 ## Parsoid will not try to wt2wt this while preserving newlines because
15158 ## it suppresses excess newlines within list items -- and we don't want to
15159 ## introduce a special case just for categories, which is, in reality somewhat
15160 ## odd behavior -- categories are unlikely to be used in list items like this
15161 ## in top-level pages and are only likely to show up in template-generated
15162 ## list items where this RT-ing is a non-issue.
15163 ##
15164 ## The whitespace on the empty line is part of the test. Please do not delete
15165 !! test
15166 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15167 !! options
15168 parsoid=wt2html
15169 !! wikitext
15170 * This
15171
15172 [[Category:Foo]] and this should be part of the same list item
15173 * So should this
15174
15175 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15176 !! html
15177 <ul><li>This and this should be part of the same list item</li>
15178 <li>So should this and this should be part of the same list item</li></ul>
15179 !! html/parsoid
15180 <ul>
15181 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15182 <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>
15183 </ul>
15184 !! end
15185
15186 ## Newlines and categories that follow the last item of a list
15187 ## are treated differently because this (list followed by categories)
15188 ## is an extremely common pattern on wikis.
15189 !! test
15190 3. Categories and newlines: newline suppression for last list item should RT properly
15191 !! wikitext
15192 * a
15193 * b
15194
15195 [[Category:Foo]]
15196
15197 [[Category:Bar]]
15198 [[Category:Baz]]
15199 !! html/parsoid
15200 <ul><li> a</li>
15201 <li> b</li></ul>
15202
15203 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15204
15205 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15206 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15207 !! end
15208
15209 !! test
15210 4. Categories and newlines: newline suppression for last list item should RT properly
15211 !! wikitext
15212 * a
15213 **** b
15214
15215 [[Category:Foo]]
15216 !! html/parsoid
15217 <ul><li> a
15218 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15219
15220 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15221 !! end
15222
15223 ## only wt2html for this to make sure the algo only applies to the rightmost path
15224 !! test
15225 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15226 !! options
15227 parsoid=wt2html
15228 !! wikitext
15229 * a
15230 ** b
15231 [[Category:Foo]]
15232 * c
15233 ** d
15234 [[Category:Foo]]
15235 !! html/parsoid
15236 <ul><li> a
15237 <ul><li> b
15238 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15239 <li> c
15240 <ul><li> d</li></ul></li></ul>
15241 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15242 !! end
15243
15244 ## We used to, but no longer wt2wt this test since the default serializer
15245 ## will normalize all categories to serialize on their own line.
15246 ## This wikitext usage is going to be fairly uncommon in production and
15247 ## selser will take care of preserving formatting in those scenarios.
15248 !! test
15249 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15250 !! options
15251 parsoid=wt2html
15252 !! wikitext
15253 * a [[Category:Foo]]
15254 !! html/parsoid
15255 <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>
15256 !! end
15257
15258 # This test also demonstrates because of newline+category tunneling
15259 # through the list hander, template wrapping doesn't expand to the
15260 # containing list when the list item swallows the category.
15261 !! test
15262 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15263 !! wikitext
15264 * {{echo|a
15265 [[Category:Foo]]}}
15266 !! html/parsoid
15267 <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
15268 </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>
15269 !! end
15270
15271 !! test
15272 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15273 !! wikitext
15274 * a
15275
15276 {{echo|[[Category:Foo]]
15277 [[Category:Bar]]}}
15278 [[Category:Baz]]
15279 !! html/parsoid
15280 <ul><li> a</li></ul>
15281
15282 <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">
15283 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15284 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15285 !! end
15286
15287 !! test
15288 Category links with multiple namespaces
15289 !! wikitext
15290 [[Category:Project:Foo]]
15291 !! html/parsoid
15292 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15293 !! end
15294
15295 !! test
15296 Parsoid: Serialize link to category page with colon escape
15297 !! options
15298 parsoid
15299 !! wikitext
15300
15301 [[:Category:Foo]]
15302 [[:Category:Foo|Bar]]
15303 !! html
15304 <p>
15305 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15306 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15307 </p>
15308 !! end
15309
15310 # We used to, but no longer wt2wt this test since the default serializer
15311 # will normalize all categories to serialize on their own line.
15312 # This wikitext usage is going to be fairly uncommon in production and
15313 # selser will take care of preventing whitespace insertion if this
15314 # occurs in an article.
15315 #
15316 # html2html disabled for the same reason (whitespace insertion between
15317 # x and y).
15318 #
15319 # html2wt disabled because it localizes the "Category" namespace.
15320 !! test
15321 Link prefix/suffixes aren't applied to category links
15322 !! options
15323 parsoid=wt2html
15324 language=is
15325 !! wikitext
15326 x[[Category:Foo]]y
15327 !! html/php
15328 <p>xy
15329 </p>
15330 !! html/parsoid
15331 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15332 !! end
15333
15334 !! test
15335 Parsoid: Serialize link to file page with colon escape
15336 !! options
15337 parsoid
15338 !! wikitext
15339
15340 [[:File:Foo.png]]
15341 [[:File:Foo.png|Bar]]
15342 !! html
15343 <p>
15344 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15345 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15346 </p>
15347 !! end
15348
15349 !! test
15350 Parsoid: Serialize a genuine category link without colon escape
15351 !! options
15352 parsoid
15353 !! wikitext
15354 [[Category:Foo]]
15355 [[Category:Foo|Bar]]
15356 !! html
15357 <link rel="mw:PageProp/Category" href="./Category:Foo">
15358 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15359 !! end
15360
15361 !! test
15362 Normalize hrefs properly before testing for invalid link targets (T72894)
15363 !! options
15364 parsoid=html2wt
15365 !! html/parsoid
15366 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15367 !! wikitext
15368 [[Category:Toxine bactérienne]]
15369 !! end
15370
15371 !! test
15372 Parsoid: Defaultsort
15373 !! wikitext
15374 {{DEFAULTSORT:Foo}}
15375 !! html/parsoid
15376 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15377 !! end
15378
15379 !! test
15380 Parsoid: Defaultsort (template-generated)
15381 !! wikitext
15382 {{{{echo|DEFAULTSORT}}:Foo}}
15383 !! html/parsoid
15384 <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}}]}'/>
15385 !! end
15386
15387 ###
15388 ### Inter-language links
15389 ###
15390 !! test
15391 Interlanguage links
15392 !! options
15393 ill
15394 !! wikitext
15395 [[es:Alimento]]
15396 [[fr:Nourriture]]
15397 [[zh:食品]]
15398 !! html/php
15399 es:Alimento fr:Nourriture zh:食品
15400 !! html/parsoid
15401 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15402 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15403 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15404 !! end
15405
15406 !! test
15407 Duplicate interlanguage links (T26502)
15408 !! options
15409 ill
15410 !! wikitext
15411 [[es:1]]
15412 [[es:2]]
15413 [[fr:1]]
15414 [[fr:2]]
15415 !! html/php
15416 es:1 fr:1
15417 !! html/parsoid
15418 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15419 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15420 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15421 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15422 !! end
15423
15424 ###
15425 ### Sections
15426 ###
15427 !! test
15428 Basic section headings
15429 !! wikitext
15430 == Headline 1 ==
15431 Some text
15432
15433 ==Headline 2==
15434 More
15435 ===Smaller headline===
15436 Blah blah
15437 !! html
15438 <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>
15439 <p>Some text
15440 </p>
15441 <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>
15442 <p>More
15443 </p>
15444 <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>
15445 <p>Blah blah
15446 </p>
15447 !! end
15448
15449 !! test
15450 Section headings with TOC
15451 !! wikitext
15452 == Headline 1 ==
15453 === Subheadline 1 ===
15454 ===== Skipping a level =====
15455 ====== Skipping a level ======
15456
15457 == Headline 2 ==
15458 Some text
15459 ===Another headline===
15460 !! html
15461 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15462 <ul>
15463 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15464 <ul>
15465 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15466 <ul>
15467 <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>
15468 <ul>
15469 <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>
15470 </ul>
15471 </li>
15472 </ul>
15473 </li>
15474 </ul>
15475 </li>
15476 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15477 <ul>
15478 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15479 </ul>
15480 </li>
15481 </ul>
15482 </div>
15483
15484 <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>
15485 <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>
15486 <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>
15487 <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>
15488 <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>
15489 <p>Some text
15490 </p>
15491 <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>
15492
15493 !! end
15494
15495 !! test
15496 TOC anchors don't collide
15497 !! wikitext
15498 __FORCETOC__
15499 == Headline 2 ==
15500 == Headline ==
15501 == Headline 2 ==
15502 == Headline ==
15503 !! html/php
15504 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15505 <ul>
15506 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15507 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15508 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15509 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15510 </ul>
15511 </div>
15512
15513 <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>
15514 <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>
15515 <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>
15516 <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>
15517
15518 !! end
15519
15520 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15521 !! test
15522 Handling of sections up to level 6 and beyond
15523 !! wikitext
15524 = Level 1 Heading=
15525 == Level 2 Heading==
15526 === Level 3 Heading===
15527 ==== Level 4 Heading====
15528 ===== Level 5 Heading=====
15529 ====== Level 6 Heading======
15530 ======= Level 7 Heading=======
15531 ======== Level 8 Heading========
15532 ========= Level 9 Heading=========
15533 ========== Level 10 Heading==========
15534 !! html
15535 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15536 <ul>
15537 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15538 <ul>
15539 <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>
15540 <ul>
15541 <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>
15542 <ul>
15543 <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>
15544 <ul>
15545 <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>
15546 <ul>
15547 <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>
15548 <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>
15549 <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>
15550 <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>
15551 <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>
15552 </ul>
15553 </li>
15554 </ul>
15555 </li>
15556 </ul>
15557 </li>
15558 </ul>
15559 </li>
15560 </ul>
15561 </li>
15562 </ul>
15563 </div>
15564
15565 <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>
15566 <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>
15567 <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>
15568 <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>
15569 <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>
15570 <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>
15571 <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>
15572 <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>
15573 <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>
15574 <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>
15575
15576 !! end
15577
15578 !! test
15579 TOC regression (T11764)
15580 !! wikitext
15581 == title 1 ==
15582 === title 1.1 ===
15583 ==== title 1.1.1 ====
15584 === title 1.2 ===
15585 == title 2 ==
15586 === title 2.1 ===
15587 !! html
15588 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15589 <ul>
15590 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15591 <ul>
15592 <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>
15593 <ul>
15594 <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>
15595 </ul>
15596 </li>
15597 <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>
15598 </ul>
15599 </li>
15600 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15601 <ul>
15602 <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>
15603 </ul>
15604 </li>
15605 </ul>
15606 </div>
15607
15608 <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>
15609 <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>
15610 <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>
15611 <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>
15612 <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>
15613 <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>
15614
15615 !! end
15616
15617 !! test
15618 TOC for heading containing <span id="..."></span> (T96153)
15619 !! wikitext
15620 __FORCETOC__
15621 ==<span id="old-anchor"></span>New title==
15622 !! html/php
15623 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15624 <ul>
15625 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15626 </ul>
15627 </div>
15628
15629 <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>
15630
15631 !! end
15632
15633 !! test
15634 TOC with wgMaxTocLevel=3 (T8204)
15635 !! options
15636 wgMaxTocLevel=3
15637 !! wikitext
15638 == title 1 ==
15639 === title 1.1 ===
15640 ==== title 1.1.1 ====
15641 === title 1.2 ===
15642 == title 2 ==
15643 === title 2.1 ===
15644 !! html
15645 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15646 <ul>
15647 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15648 <ul>
15649 <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>
15650 <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>
15651 </ul>
15652 </li>
15653 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15654 <ul>
15655 <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>
15656 </ul>
15657 </li>
15658 </ul>
15659 </div>
15660
15661 <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>
15662 <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>
15663 <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>
15664 <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>
15665 <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>
15666 <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>
15667
15668 !! end
15669
15670 !! test
15671 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
15672 !! options
15673 wgMaxTocLevel=3
15674 !! wikitext
15675 ==Section 1==
15676 ===Section 1.1===
15677 ====Section 1.1.1====
15678 ====Section 1.1.1.1====
15679 ==Section 2==
15680 !! html
15681 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15682 <ul>
15683 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15684 <ul>
15685 <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>
15686 </ul>
15687 </li>
15688 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15689 </ul>
15690 </div>
15691
15692 <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>
15693 <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>
15694 <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>
15695 <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>
15696 <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>
15697
15698 !! end
15699
15700
15701 !! test
15702 Resolving duplicate section names
15703 !! wikitext
15704 == Foo bar ==
15705 == Foo bar ==
15706 !! html
15707 <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>
15708 <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>
15709
15710 !! end
15711
15712 !! test
15713 Resolving duplicate section names with differing case (T12721)
15714 !! wikitext
15715 == Foo bar ==
15716 == Foo Bar ==
15717 !! html
15718 <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>
15719 <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>
15720
15721 !! end
15722
15723 !! article
15724 Template:sections
15725 !! text
15726 ===Section 1===
15727 ==Section 2==
15728 !! endarticle
15729
15730 !! test
15731 Template with sections, __NOTOC__
15732 !! wikitext
15733 __NOTOC__
15734 ==Section 0==
15735 {{sections}}
15736 ==Section 4==
15737 !! html
15738 <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>
15739 <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>
15740 <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>
15741 <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>
15742
15743 !! end
15744
15745 !! test
15746 __NOEDITSECTION__ keyword
15747 !! wikitext
15748 __NOEDITSECTION__
15749 ==Section 1==
15750 ==Section 2==
15751 !! html
15752 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15753 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15754
15755 !! end
15756
15757 !! test
15758 Link inside a section heading
15759 !! wikitext
15760 ==Section with a [[Main Page|link]] in it==
15761 !! html
15762 <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>
15763
15764 !! end
15765
15766 !! test
15767 TOC regression (T14077)
15768 !! wikitext
15769 __TOC__
15770 == title 1 ==
15771 === title 1.1 ===
15772 == title 2 ==
15773 !! html
15774 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15775 <ul>
15776 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15777 <ul>
15778 <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>
15779 </ul>
15780 </li>
15781 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15782 </ul>
15783 </div>
15784
15785 <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>
15786 <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>
15787 <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>
15788
15789 !! end
15790
15791 !! test
15792 T3219 URL next to image (good)
15793 !! wikitext
15794 http://example.com [[File:Foobar.jpg]]
15795 !! html/php
15796 <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>
15797 </p>
15798 !! html/parsoid
15799 <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>
15800 !!end
15801
15802 !! test
15803 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
15804 !! wikitext
15805 ===
15806 The line above must have a trailing space!
15807 === <!--
15808 --> <!-- -->
15809 But just in case it doesn't...
15810 !! html
15811 <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>
15812 <p>The line above must have a trailing space!
15813 </p>
15814 <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>
15815 <p>But just in case it doesn't...
15816 </p>
15817 !! end
15818
15819 !! test
15820 Header with special characters (T27462)
15821 !! wikitext
15822 The tooltips shall not show entities to the user (ie. be double escaped)
15823
15824 == text > text ==
15825 section 1
15826
15827 == text < text ==
15828 section 2
15829
15830 == text & text ==
15831 section 3
15832
15833 == text ' text ==
15834 section 4
15835
15836 == text " text ==
15837 section 5
15838 !! html
15839 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15840 </p>
15841 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15842 <ul>
15843 <li class="toclevel-1 tocsection-1"><a href="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text &gt; text</span></a></li>
15844 <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>
15845 <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>
15846 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15847 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15848 </ul>
15849 </div>
15850
15851 <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>
15852 <p>section 1
15853 </p>
15854 <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>
15855 <p>section 2
15856 </p>
15857 <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>
15858 <p>section 3
15859 </p>
15860 <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>
15861 <p>section 4
15862 </p>
15863 <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>
15864 <p>section 5
15865 </p>
15866 !! end
15867
15868 !! test
15869 Header with space, plus and underscore as entity
15870 !! wikitext
15871 Id should not contain + for spaces
15872
15873 == Space between Text ==
15874 section 1
15875
15876 == Space-Entity&#32;between&#32;Text ==
15877 section 2
15878
15879 == Plus+between+Text ==
15880 section 3
15881
15882 == Plus-Entity&#43;between&#43;Text ==
15883 section 4
15884
15885 == Underscore_between_Text ==
15886 section 5
15887
15888 == Underscore-Entity&#95;between&#95;Text ==
15889 section 6
15890
15891 [[#Space between Text]]
15892 [[#Space-Entity&#32;between&#32;Text]]
15893 [[#Plus+between+Text]]
15894 [[#Plus-Entity&#43;between&#43;Text]]
15895 [[#Underscore_between_Text]]
15896 [[#Underscore-Entity&#95;between&#95;Text]]
15897 !! html
15898 <p>Id should not contain + for spaces
15899 </p>
15900 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15901 <ul>
15902 <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>
15903 <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>
15904 <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>
15905 <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>
15906 <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>
15907 <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>
15908 </ul>
15909 </div>
15910
15911 <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>
15912 <p>section 1
15913 </p>
15914 <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>
15915 <p>section 2
15916 </p>
15917 <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>
15918 <p>section 3
15919 </p>
15920 <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>
15921 <p>section 4
15922 </p>
15923 <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>
15924 <p>section 5
15925 </p>
15926 <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>
15927 <p>section 6
15928 </p><p><a href="#Space_between_Text">#Space between Text</a>
15929 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15930 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15931 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15932 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15933 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15934 </p>
15935 !! end
15936
15937 !! test
15938 Headers with excess '=' characters
15939 (Are similar tests necessary beyond the 1st level?)
15940 !! wikitext
15941 =foo==
15942 ==foo=
15943 =''italic'' heading==
15944 ==''italic'' heading=
15945 !! html
15946 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15947 <ul>
15948 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15949 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15950 <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>
15951 <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>
15952 </ul>
15953 </div>
15954
15955 <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>
15956 <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>
15957 <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>
15958 <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>
15959
15960 !! end
15961
15962 !! test
15963 HTML headers vs TOC (T25393)
15964 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15965 !! wikitext
15966 <h1>Header 1</h1>
15967 == Header 1.1 ==
15968 == Header 1.2 ==
15969
15970 <h1>Header 2
15971 </h1>
15972 == Header 2.1 ==
15973 == Header 2.2 ==
15974 __NOEDITSECTION__
15975 !! html
15976 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15977 <ul>
15978 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15979 <ul>
15980 <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>
15981 <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>
15982 </ul>
15983 </li>
15984 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15985 <ul>
15986 <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>
15987 <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>
15988 </ul>
15989 </li>
15990 </ul>
15991 </div>
15992
15993 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15994 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15995 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15996 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15997 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15998 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15999
16000 !! end
16001
16002 !! test
16003 Single-line or multiline-comments can follow headings
16004 !! options
16005 parsoid=wt2html,wt2wt
16006 !! wikitext
16007 ==foo==<!---->
16008 ==bar==<!--c1-->
16009 ==baz==<!--
16010 c2
16011 c3-->
16012 !! html
16013 <h2><span class="mw-headline" id="foo">foo</span></h2>
16014 <h2><span class="mw-headline" id="bar">bar</span></h2>
16015 <h2><span class="mw-headline" id="baz">baz</span></h2>
16016
16017 !! end
16018
16019 !! test
16020 T3219 URL next to image (broken)
16021 !! wikitext
16022 http://example.com[[File:Foobar.jpg]]
16023 !! html/php
16024 <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>
16025 </p>
16026 !! html/parsoid
16027 <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>
16028 !!end
16029
16030 !! test
16031 T3186 news: in the middle of text
16032 !! wikitext
16033 http://en.wikinews.org/wiki/Wikinews:Workplace
16034 !! html
16035 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
16036 </p>
16037 !!end
16038
16039
16040 !! test
16041 Namespaced link must have a title
16042 !! wikitext
16043 [[Project:]]
16044 !! html
16045 <p>[[Project:]]
16046 </p>
16047 !!end
16048
16049 !! test
16050 Namespaced link must have a title (bad fragment version)
16051 !! wikitext
16052 [[Project:#fragment]]
16053 !! html
16054 <p>[[Project:#fragment]]
16055 </p>
16056 !!end
16057
16058
16059 ###
16060 ### HTML tags and HTML attributes
16061 ###
16062
16063 !! test
16064 div with no attributes
16065 !! wikitext
16066 <div>HTML rocks</div>
16067 !! html
16068 <div>HTML rocks</div>
16069
16070 !! end
16071
16072 !! test
16073 div with double-quoted attribute
16074 !! wikitext
16075 <div id="rock">HTML rocks</div>
16076 !! html
16077 <div id="rock">HTML rocks</div>
16078
16079 !! end
16080
16081 !! test
16082 div with single-quoted attribute
16083 !! wikitext
16084 <div id='rock'>HTML rocks</div>
16085 !! html
16086 <div id="rock">HTML rocks</div>
16087
16088 !! end
16089
16090 !! test
16091 div with unquoted attribute
16092 !! wikitext
16093 <div id=rock>HTML rocks</div>
16094 !! html
16095 <div id="rock">HTML rocks</div>
16096
16097 !! end
16098
16099 !! test
16100 div with illegal double attributes
16101 !! wikitext
16102 <div id="a" id="b">HTML rocks</div>
16103 !! html
16104 <div id="b">HTML rocks</div>
16105
16106 !!end
16107
16108 !! test
16109 div with empty attribute value, space before equals
16110 !! options
16111 parsoid=wt2html,html2html
16112 !! wikitext
16113 <div class =>HTML rocks</div>
16114 !! html/php
16115 <div class="">HTML rocks</div>
16116
16117 !! html/parsoid
16118 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16119 !! end
16120
16121 !! test
16122 div with multiple empty attribute values
16123 !! options
16124 parsoid=wt2html,html2html
16125 !! wikitext
16126 <div id= title=>HTML rocks</div>
16127 !! html/php
16128 <div id="title.3D">HTML rocks</div>
16129
16130 !! html/parsoid
16131 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16132 !! end
16133
16134 !! test
16135 table with multiple empty attribute values
16136 !! options
16137 parsoid=wt2html,html2html
16138 !! wikitext
16139 {| title= id=
16140 | hi
16141 |}
16142 !! html/php
16143 <table title="id=">
16144 <tr>
16145 <td> hi
16146 </td></tr></table>
16147
16148 !! html/parsoid
16149 <table title="id=">
16150 <tbody><tr><td> hi</td></tr>
16151 </tbody></table>
16152 !! end
16153
16154 !! test
16155 div with braces in attribute value
16156 !! wikitext
16157 <div title="{}">Foo</div>
16158 !! html/php
16159 <div title="&#123;&#125;">Foo</div>
16160
16161 !! html/parsoid
16162 <div title="{}">Foo</div>
16163 !! end
16164
16165 !! test
16166 div with empty attribute value, no space before equals
16167 !! options
16168 parsoid=wt2html,html2html
16169 !! wikitext
16170 <div class=>HTML rocks</div>
16171 !! html/php
16172 <div class="">HTML rocks</div>
16173
16174 !! html/parsoid
16175 <div class="">HTML rocks</div>
16176 !! end
16177
16178 !! test
16179 HTML multiple attributes correction
16180 !! wikitext
16181 <p class="error" class="awesome">Awesome!</p>
16182 !! html
16183 <p class="awesome">Awesome!</p>
16184
16185 !!end
16186
16187 !! test
16188 Table multiple attributes correction
16189 !! wikitext
16190 {|
16191 !+ class="error" class="awesome"| status
16192 |}
16193 !! html
16194 <table>
16195 <tr>
16196 <th class="awesome"> status
16197 </th></tr></table>
16198
16199 !!end
16200
16201 !! test
16202 DIV IN UPPERCASE
16203 !! wikitext
16204 <DIV ID="x">HTML ROCKS</DIV>
16205 !! html
16206 <div id="x">HTML ROCKS</div>
16207
16208 !!end
16209
16210 !! test
16211 Non-ASCII pseudo-tags are rendered as text
16212 !! wikitext
16213 <khyô>
16214 !! html
16215 <p>&lt;khyô&gt;
16216 </p>
16217 !! end
16218
16219 !! test
16220 Pseudo-tag with URL 'name' renders as url link
16221 !! wikitext
16222 <http://example.com/>
16223 !! html
16224 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16225 </p>
16226 !! end
16227
16228 !! test
16229 text with amp in the middle of nowhere
16230 !! wikitext
16231 Remember AT&T?
16232 !! html
16233 <p>Remember AT&amp;T?
16234 </p>
16235 !! end
16236
16237 !! test
16238 text with character entity: eacute
16239 !! wikitext
16240 I always thought &eacute; was a cute letter.
16241 !! html
16242 <p>I always thought &#233; was a cute letter.
16243 </p>
16244 !! html+tidy
16245 <p>I always thought é was a cute letter.</p>
16246 !! end
16247
16248 !! test
16249 text with entity-escaped character entity-like string: eacute
16250 !! wikitext
16251 I always thought &amp;eacute; was a cute letter.
16252 !! html
16253 <p>I always thought &amp;eacute; was a cute letter.
16254 </p>
16255 !! end
16256
16257 !! test
16258 text with undefined character entity: xacute
16259 !! wikitext
16260 I always thought &xacute; was a cute letter.
16261 !! html
16262 <p>I always thought &amp;xacute; was a cute letter.
16263 </p>
16264 !! end
16265
16266 !! test
16267 HTML5 tags
16268 !! wikitext
16269 <data value="5">five</data>
16270 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16271 <mark>This highlighted text</mark>
16272 !! html
16273 <p><data value="5">five</data>
16274 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16275 <mark>This highlighted text</mark>
16276 </p>
16277 !! end
16278
16279 !! test
16280 HTML tag with leading space is parsed as text
16281 !! wikitext
16282 < div>foo< /div>
16283 !! html
16284 <p>&lt; div&gt;foo&lt; /div&gt;
16285 </p>
16286 !! end
16287
16288 ###
16289 ### Nesting tests (see T43545, T52604, T53081)
16290 ###
16291
16292 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
16293 # Note that html2wt is considerably more difficult if we use <b> in
16294 # the test case, instead of <small>
16295 !! test
16296 Ensure that HTML adoption agency algorithm is properly implemented.
16297 !! wikitext
16298 <small>X<small>Y</small>Z</small>
16299 !! html
16300 <p><small>X<small>Y</small>Z</small>
16301 </p>
16302 !! end
16303
16304 # This was T43545 in the PHP parser.
16305 # Note that tidy doesn't handle this correctly.
16306 !! test
16307 Nesting of <kbd>
16308 !! wikitext
16309 <kbd>X<kbd>Y</kbd>Z</kbd>
16310 !! html
16311 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16312 </p>
16313 !! end
16314
16315 # The following cases were T53081 in the PHP parser.
16316 # Note that there are some other nestable tags (b, i, etc) which are
16317 # not covered; see T53081 for discussion.
16318
16319 # Note that tidy doesn't handle this correctly.
16320 !! test
16321 Nesting of <em>
16322 !! wikitext
16323 <em>X<em>Y</em>Z</em>
16324 !! html
16325 <p><em>X<em>Y</em>Z</em>
16326 </p>
16327 !! end
16328
16329 # Note that tidy doesn't handle this correctly.
16330 !! test
16331 Nesting of <strong>
16332 !! wikitext
16333 <strong>X<strong>Y</strong>Z</strong>
16334 !! html
16335 <p><strong>X<strong>Y</strong>Z</strong>
16336 </p>
16337 !! end
16338
16339 !! test
16340 Nesting of <q>
16341 !! wikitext
16342 <q>X<q>Y</q>Z</q>
16343 !! html+tidy
16344 <p><q>X<q>Y</q>Z</q></p>
16345 !! end
16346
16347 # Note that tidy doesn't handle this correctly.
16348 !! test
16349 Nesting of <ruby>
16350 !! wikitext
16351 <ruby>X<ruby>Y</ruby>Z</ruby>
16352 !! html
16353 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16354 </p>
16355 !! end
16356
16357 # Note that tidy doesn't handle this correctly.
16358 !! test
16359 Nesting of <bdo>
16360 !! wikitext
16361 <bdo>X<bdo>Y</bdo>Z</bdo>
16362 !! html
16363 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16364 </p>
16365 !! end
16366
16367
16368 ###
16369 ### Media links
16370 ###
16371
16372 !! test
16373 Media link
16374 !! wikitext
16375 [[Media:Foobar.jpg]]
16376 !! html
16377 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16378 </p>
16379 !! end
16380
16381 !! test
16382 Media link with text
16383 !! wikitext
16384 [[Media:Foobar.jpg|A neat file to look at]]
16385 !! html
16386 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16387 </p>
16388 !! end
16389
16390 # FIXME: this is still bad HTML tag nesting
16391 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16392 !! test
16393 Media link with nasty text
16394 !! wikitext
16395 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16396 !! html
16397 <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>
16398
16399 !! html+tidy
16400 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16401 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16402 !! end
16403
16404 !! test
16405 Media link to nonexistent file (T3702)
16406 !! wikitext
16407 [[Media:No such.jpg]]
16408 !! html
16409 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16410 </p>
16411 !! end
16412
16413 !! test
16414 Image link to nonexistent file (T3850 - good)
16415 !! wikitext
16416 [[File:No_such.jpg]]
16417 !! html/php
16418 <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>
16419 </p>
16420 !! html/parsoid
16421 <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>
16422 !! end
16423
16424 !! test
16425 :Image link to nonexistent file (T3850 - bad)
16426 !! wikitext
16427 [[:Image:No such.jpg]]
16428 !! html/php
16429 <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>
16430 </p>
16431 !! html/parsoid
16432 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16433 !! end
16434
16435
16436
16437 !! test
16438 Character reference normalization in link text (T3938)
16439 !! wikitext
16440 [[Main Page|this&that]]
16441 !! html
16442 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16443 </p>
16444 !!end
16445
16446 !! article
16447 אַ
16448 !! text
16449 Test for unicode normalization
16450
16451 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16452 !! endarticle
16453
16454 !! test
16455 (T21451) Links should refer to the normalized form.
16456 !! wikitext
16457 [[&#xFB2E;]]
16458 [[&#x5d0;&#x5b7;]]
16459 [[&#x5d0;ַ]]
16460 [[א&#x5b7;]]
16461 [[אַ]]
16462 !! html
16463 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16464 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16465 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16466 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16467 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16468 </p>
16469 !! end
16470
16471 !! test
16472 Empty attribute crash test (T4067)
16473 !! wikitext
16474 <font color="">foo</font>
16475 !! html
16476 <p><font color="">foo</font>
16477 </p>
16478 !! end
16479
16480 !! test
16481 Empty attribute crash test single-quotes (T4067)
16482 !! wikitext
16483 <font color=''>foo</font>
16484 !! html
16485 <p><font color="">foo</font>
16486 </p>
16487 !! end
16488
16489 !! test
16490 Attribute test: equals, then nothing
16491 !! options
16492 parsoid=wt2html,html2html
16493 !! wikitext
16494 <font color=>foo</font>
16495 !! html/php
16496 <p><font color="">foo</font>
16497 </p>
16498 !! html/parsoid
16499 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16500 !! end
16501
16502 !! test
16503 Attribute test: unquoted value
16504 !! options
16505 parsoid=wt2html,html2html
16506 !! wikitext
16507 <font color=x>foo</font>
16508 !! html/php
16509 <p><font color="x">foo</font>
16510 </p>
16511 !! html/parsoid
16512 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16513 !! end
16514
16515 !! test
16516 Attribute test: unquoted but illegal value (hash)
16517 !! wikitext
16518 <font color=#x>foo</font>
16519 !! html
16520 <p><font color="#x">foo</font>
16521 </p>
16522 !! end
16523
16524 # Parsoid does not serialize to empty attribute syntax,
16525 # so wt2wt and html2wt cases are skipped
16526 !! test
16527 Attribute test: no value (T54330)
16528 !! options
16529 parsoid=wt2html,html2html
16530 !! wikitext
16531 <font color>foo</font>
16532 !! html/php
16533 <p><font color="">foo</font>
16534 </p>
16535 !! html/parsoid
16536 <p><font color="">foo</font></p>
16537 !! end
16538
16539 !! test
16540 T4095: link with three closing brackets
16541 !! wikitext
16542 [[Main Page]]]
16543 !! html/php
16544 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16545 </p>
16546 !! html/parsoid
16547 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16548 !! end
16549
16550 !! test
16551 T4095: link with pipe and three closing brackets
16552 !! wikitext
16553 [[Main Page|link]]]
16554 !! html/php
16555 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16556 </p>
16557 !! html/parsoid
16558 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16559 !! end
16560
16561 !! test
16562 T4095: link with pipe and three closing brackets, version 2
16563 !! wikitext
16564 [[Main Page|[http://example.com/]]]
16565 !! html/php
16566 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16567 </p>
16568 !! html/parsoid
16569 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16570 !! end
16571
16572
16573 ###
16574 ### Safety
16575 ###
16576
16577 !! article
16578 Template:Dangerous attribute
16579 !! text
16580 " onmouseover="alert(document.cookie)
16581 !! endarticle
16582
16583 !! article
16584 Template:Dangerous style attribute
16585 !! text
16586 border-size: expression(alert(document.cookie))
16587 !! endarticle
16588
16589 !! article
16590 Template:Div style
16591 !! text
16592 <div style="float: right; {{{1}}}">Magic div</div>
16593 !! endarticle
16594
16595 !! test
16596 T4304: HTML attribute safety (safe template; regression T4309)
16597 !! wikitext
16598 <div title="{{test}}"></div>
16599 !! html/php
16600 <div title="This is a test template"></div>
16601
16602 !! html/parsoid
16603 <div title="This is a test template" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"This is a test template"},"sa":{"title":"{{test}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,20,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"test\",\"href\":\"./Template:Test\"},\"params\":{},\"i\":0}}]}&#39;>This is a test template&lt;/span>"}]]}'></div>
16604 !! end
16605
16606 # Parsoid has enough context to handle this case
16607 !! test
16608 T4304: HTML attribute safety (dangerous template; 2309)
16609 !! wikitext
16610 <div title="{{dangerous attribute}}"></div>
16611 !! html/php
16612 <div title=""></div>
16613
16614 !! html/parsoid
16615 <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>
16616 !! end
16617
16618 !! test
16619 T4304: HTML attribute safety (dangerous style template; 2309)
16620 !! wikitext
16621 <div style="{{dangerous style attribute}}"></div>
16622 !! html/php
16623 <div style="/* insecure input */"></div>
16624
16625 !! html/parsoid
16626 <div style="/* insecure input */" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"{{dangerous style attribute}}"}}' data-mw='{"attribs":[[{"txt":"style"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,41,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous style attribute\",\"href\":\"./Template:Dangerous_style_attribute\"},\"params\":{},\"i\":0}}]}&#39;>border-size: expression(alert(document.cookie))&lt;/span>"}]]}'></div>
16627 !! end
16628
16629 !! test
16630 T4304: HTML attribute safety (safe parameter; 2309)
16631 !! wikitext
16632 {{div style|width: 200px}}
16633 !! html/php
16634 <div style="float: right; width: 200px">Magic div</div>
16635
16636 !! html/parsoid
16637 <div style="float: right; width: 200px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","a":{"style":"float: right; width: 200px"},"sa":{"style":"float: right; {{{1}}}"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"div style","href":"./Template:Div_style"},"params":{"1":{"wt":"width: 200px"}},"i":0}}]}'>Magic div</div>
16638 !! end
16639
16640 !! test
16641 T4304: HTML attribute safety (unsafe parameter; 2309)
16642 !! wikitext
16643 {{div style|width: expression(alert(document.cookie))}}
16644 !! html/php
16645 <div style="/* insecure input */">Magic div</div>
16646
16647 !! html/parsoid
16648 <div style="/* insecure input */" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"float: right; {{{1}}}"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"div style","href":"./Template:Div_style"},"params":{"1":{"wt":"width: expression(alert(document.cookie))"}},"i":0}}]}'>Magic div</div>
16649 !! end
16650
16651 ## Parsoid output here differs; needs investigation.
16652 !! test
16653 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
16654 !! wikitext
16655 {{div style|"><script>alert(document.cookie)</script>}}
16656 !! html
16657 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16658
16659 !! end
16660
16661 ## Parsoid output here differs; needs investigation.
16662 !! test
16663 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16664 !! wikitext
16665 {{div style|" ><script>alert(document.cookie)</script>}}
16666 !! html
16667 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16668
16669 !! end
16670
16671 !! test
16672 T4304: HTML attribute safety (link)
16673 !! wikitext
16674 <div title="[[Main Page]]"></div>
16675 !! html
16676 <div title="&#91;&#91;Main Page]]"></div>
16677
16678 !! end
16679
16680 !! test
16681 T4304: HTML attribute safety (italics)
16682 !! wikitext
16683 <div title="''foobar''"></div>
16684 !! html
16685 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16686
16687 !! end
16688
16689 !! test
16690 T4304: HTML attribute safety (bold)
16691 !! wikitext
16692 <div title="'''foobar'''"></div>
16693 !! html
16694 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16695
16696 !! end
16697
16698 !! test
16699 T4304: HTML attribute safety (ISBN)
16700 !! wikitext
16701 <div title="ISBN 1234567890"></div>
16702 !! html
16703 <div title="&#73;SBN 1234567890"></div>
16704
16705 !! end
16706
16707 !! test
16708 T4304: HTML attribute safety (RFC)
16709 !! wikitext
16710 <div title="RFC 1234"></div>
16711 !! html
16712 <div title="&#82;FC 1234"></div>
16713
16714 !! end
16715
16716 !! test
16717 T4304: HTML attribute safety (PMID)
16718 !! wikitext
16719 <div title="PMID 1234567890"></div>
16720 !! html
16721 <div title="&#80;MID 1234567890"></div>
16722
16723 !! end
16724
16725 !! test
16726 T4304: HTML attribute safety (web link)
16727 !! wikitext
16728 <div title="http://example.com/"></div>
16729 !! html
16730 <div title="http&#58;//example.com/"></div>
16731
16732 !! end
16733
16734 !! test
16735 T4304: HTML attribute safety (named web link)
16736 !! wikitext
16737 <div title="[http://example.com/ link]"></div>
16738 !! html
16739 <div title="&#91;http&#58;//example.com/ link]"></div>
16740
16741 !! end
16742
16743 !! test
16744 T5244: HTML attribute safety (extension; safe)
16745 !! wikitext
16746 <div style="<nowiki>background:blue</nowiki>"></div>
16747 !! html/php
16748 <div style="background:blue"></div>
16749
16750 !! html/parsoid
16751 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
16752 !! end
16753
16754 !! test
16755 T5244: HTML attribute safety (extension; unsafe)
16756 !! wikitext
16757 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16758 !! html/php
16759 <div style="/* insecure input */"></div>
16760
16761 !! html/parsoid
16762 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"&lt;nowiki>border-left:expression(alert(document.cookie))&lt;/nowiki>"}}'></div>
16763 !! end
16764
16765 # More MSIE fun discovered by Tom Gilder
16766
16767 !! test
16768 MSIE CSS safety test: spurious slash
16769 !! wikitext
16770 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16771 !! html/php
16772 <div style="/* insecure input */">evil</div>
16773
16774 !! html/parsoid
16775 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:u\\rl(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
16776 !! end
16777
16778 !! test
16779 MSIE CSS safety test: hex code
16780 !! wikitext
16781 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16782 !! html/php
16783 <div style="/* insecure input */">evil</div>
16784
16785 !! html/parsoid
16786 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:u\\72l(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
16787 !! end
16788
16789 !! test
16790 MSIE CSS safety test: comment in url
16791 !! wikitext
16792 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16793 !! html/php
16794 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16795
16796 !! html/parsoid
16797 <div style="background-image:u rl(javascript:alert('boo'))" data-parsoid='{"stx":"html","a":{"style":"background-image:u rl(javascript:alert(&#39;boo&#39;))"},"sa":{"style":"background-image:u/**/rl(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
16798 !! end
16799
16800 !! test
16801 MSIE CSS safety test: comment in expression
16802 !! wikitext
16803 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16804 !! html/php
16805 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16806
16807 !! html/parsoid
16808 <div style="background-image:expres sion(alert('boo4'))" data-parsoid='{"stx":"html","a":{"style":"background-image:expres sion(alert(&#39;boo4&#39;))"},"sa":{"style":"background-image:expres/**/sion(alert(&#39;boo4&#39;))"}}'>evil4</div>
16809 !! end
16810
16811 !! test
16812 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
16813 !! wikitext
16814 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16815 !! html/php
16816 <p style="/* invalid control char */">A</p>
16817
16818 !! html/parsoid
16819 <p style="/* invalid control char */" data-parsoid='{"stx":"html","a":{"style":"/* invalid control char */"},"sa":{"style":"font-size: 100px; background-image:url\\b(https://www.google.com/images/srpr/logo6w.png)"}}'>A</p>
16820 !! end
16821
16822 !! test
16823 MSIE 6 CSS safety test: Fullwidth (T57332)
16824 !! wikitext
16825 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16826 <div style="top:EXPRESSION(alert())">B</div>
16827 !! html/php
16828 <p style="/* insecure input */">A</p>
16829 <div style="/* insecure input */">B</div>
16830
16831 !! html/parsoid
16832 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expression((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>A</p>
16833 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
16834 !! end
16835
16836 !! test
16837 MSIE 6 CSS safety test: IPA extensions (T57332)
16838 !! wikitext
16839 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16840 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16841 !! html/php
16842 <div style="/* insecure input */">A</div>
16843 <p style="/* insecure input */">B</p>
16844
16845 !! html/parsoid
16846 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
16847 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expʀessɪoɴ((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>B</p>
16848 !! end
16849
16850 !! test
16851 MSIE 6 CSS safety test: sup/sub script (T57332)
16852 !! wikitext
16853 <div style="background-image:url⁽javascript:alert())">A</div>
16854 <div style="background-image:url₍javascript:alert())">B</div>
16855 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16856 !! html/php
16857 <div style="/* insecure input */">A</div>
16858 <div style="/* insecure input */">B</div>
16859 <p style="/* insecure input */">C</p>
16860
16861 !! html/parsoid
16862 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
16863 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
16864 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expressioⁿ((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>C</p>
16865 !! end
16866
16867 !! test
16868 Opera -o-link CSS
16869 !! options
16870 parsoid=wt2html,html2html
16871 !! wikitext
16872 <div
16873 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;"
16874 style="-o-link:attr(title);-o-link-source:current">X</div>
16875 !! html/php
16876 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16877
16878 !! html/parsoid
16879 <div title="data:text/html,&lt;img src=1 onerror=alert(1)>" style="/* insecure input */" data-parsoid='{"stx":"html","a":{"title":"data:text/html,&lt;img src=1 onerror=alert(1)>","style":"/* insecure input */"},"sa":{"title":"&amp;#100;&amp;#97;&amp;#116;&amp;#97;&amp;#58;&amp;#116;&amp;#101;&amp;#120;&amp;#116;&amp;#47;&amp;#104;&amp;#116;&amp;#109;&amp;#108;&amp;#44;&amp;#60;&amp;#105;&amp;#109;&amp;#103;&amp;#32;&amp;#115;&amp;#114;&amp;#99;&amp;#61;&amp;#49;&amp;#32;&amp;#111;&amp;#110;&amp;#101;&amp;#114;&amp;#114;&amp;#111;&amp;#114;&amp;#61;&amp;#97;&amp;#108;&amp;#101;&amp;#114;&amp;#116;&amp;#40;&amp;#49;&amp;#41;&amp;#62;","style":"-o-link:attr(title);-o-link-source:current"}}'>X</div>
16880 !! end
16881
16882 !! test
16883 MSIE 6 CSS safety test: Repetition markers (T57332)
16884 !! wikitext
16885 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16886 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16887 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16888 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16889 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16890 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16891 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16892 !! html/php
16893 <p style="/* insecure input */">A</p>
16894 <p style="/* insecure input */">B</p>
16895 <p style="/* insecure input */">C</p>
16896 <p style="/* insecure input */">D</p>
16897 <p style="/* insecure input */">E</p>
16898 <p style="/* insecure input */">F</p>
16899 <p style="/* insecure input */">G</p>
16900
16901 !! html/parsoid
16902 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expres〱ion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>A</p>
16903 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresゝion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>B</p>
16904 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>C</p>
16905 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresヽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>D</p>
16906 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>E</p>
16907 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹼion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>F</p>
16908 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>G</p>
16909 !! end
16910
16911 !! test
16912 Table attribute legitimate extension
16913 !! wikitext
16914 {|
16915 !+ style="<nowiki>color:blue</nowiki>"| status
16916 |}
16917 !! html
16918 <table>
16919 <tr>
16920 <th style="color:blue"> status
16921 </th></tr></table>
16922
16923 !!end
16924
16925 !! test
16926 Table attribute safety
16927 !! wikitext
16928 {|
16929 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16930 |}
16931 !! html
16932 <table>
16933 <tr>
16934 <th style="/* insecure input */"> status
16935 </th></tr></table>
16936
16937 !! end
16938
16939 !! test
16940 CSS line continuation 1
16941 !! wikitext
16942 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16943 !! html
16944 <div style="/* insecure input */"></div>
16945
16946 !! end
16947
16948 !! test
16949 CSS line continuation 2
16950 !! wikitext
16951 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16952 !! html
16953 <div style="/* invalid control char */"></div>
16954
16955 !! end
16956
16957 !! article
16958 Template:Identity
16959 !! text
16960 {{{1}}}
16961 !! endarticle
16962
16963 !! test
16964 Expansion of multi-line templates in attribute values (T8255)
16965 !! wikitext
16966 <div style="background: {{identity|#00FF00}}">-</div>
16967 !! html
16968 <div style="background: #00FF00">-</div>
16969
16970 !! end
16971
16972 !! test
16973 Expansion of multi-line templates in attribute values (T8255 sanity check)
16974 !! wikitext
16975 <div style="background:
16976 #00FF00">-</div>
16977 !! html/php
16978 <div style="background: #00FF00">-</div>
16979
16980 !! html/parsoid
16981 <div style="background:
16982 #00FF00">-</div>
16983 !! end
16984
16985 !! test
16986 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
16987 !! wikitext
16988 <div style="background: &#10;#00FF00">-</div>
16989 !! html
16990 <div style="background: &#10;#00FF00">-</div>
16991
16992 !! end
16993
16994 !! test
16995 Tags which are hidden from Tidy cannot pass through the Sanitizer
16996 !! wikitext
16997 <mw:toc><script>alert();</script></mw:toc>
16998 !! html+tidy
16999 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
17000 !! end
17001
17002 ###
17003 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
17004 ###
17005
17006 !! test
17007 Parser hook: empty input
17008 !! wikitext
17009 <tag></tag>
17010 !! html/php
17011 <pre>
17012 ''
17013 array (
17014 )
17015 </pre>
17016
17017 !! html/parsoid
17018 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17019 !! end
17020
17021 ## Don't expect parsoid to rt this form.
17022 !! test
17023 Parser hook: empty input using terminated empty elements
17024 !! options
17025 parsoid=wt2html,html2html
17026 !! wikitext
17027 <tag/>
17028 !! html/php
17029 <pre>
17030 NULL
17031 array (
17032 )
17033 </pre>
17034
17035 !! html/parsoid
17036 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17037 !! end
17038
17039 !! test
17040 Parser hook: empty input using terminated empty elements (space before)
17041 !! wikitext
17042 <tag />
17043 !! html/php
17044 <pre>
17045 NULL
17046 array (
17047 )
17048 </pre>
17049
17050 !! html/parsoid
17051 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17052 !! end
17053
17054 !! test
17055 Parser hook: basic input
17056 !! wikitext
17057 <tag>input</tag>
17058 !! html/php
17059 <pre>
17060 'input'
17061 array (
17062 )
17063 </pre>
17064
17065 !! html/parsoid
17066 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17067 !! end
17068
17069 ## Don't expect parsoid to rt this form.
17070 !! test
17071 Parser hook: case insensitive
17072 !! options
17073 parsoid=wt2html,html2html
17074 !! wikitext
17075 <TAG>input</TAG>
17076 !! html/php
17077 <pre>
17078 'input'
17079 array (
17080 )
17081 </pre>
17082
17083 !! html/parsoid
17084 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17085 !! end
17086
17087 ## Don't expect parsoid to rt this form.
17088 !! test
17089 Parser hook: case insensitive, redux
17090 !! options
17091 parsoid=wt2html,html2html
17092 !! wikitext
17093 <TaG>input</TAg>
17094 !! html/php
17095 <pre>
17096 'input'
17097 array (
17098 )
17099 </pre>
17100
17101 !! html/parsoid
17102 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17103 !! end
17104
17105 !! test
17106 Parser hook: nested tags
17107 !! wikitext
17108 <tag><tag></tag></tag>
17109 !! html/php
17110 <pre>
17111 '<tag>'
17112 array (
17113 )
17114 </pre>&lt;/tag&gt;
17115
17116 !! html/parsoid
17117 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
17118 !! end
17119
17120 !! test
17121 Parser hook: basic arguments
17122 !! wikitext
17123 <tag width="200" height="100" depth="50" square=""></tag>
17124 !! html/php
17125 <pre>
17126 ''
17127 array (
17128 'width' => '200',
17129 'height' => '100',
17130 'depth' => '50',
17131 'square' => '',
17132 )
17133 </pre>
17134
17135 !! html/parsoid
17136 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17137 !! end
17138
17139 ## Don't expect parsoid to rt this form.
17140 !! test
17141 Parser hook: basic arguments, variations
17142 !! options
17143 parsoid=wt2html,html2html
17144 !! wikitext
17145 <tag width=200 height = "100" depth = '50' square></tag>
17146 !! html/php
17147 <pre>
17148 ''
17149 array (
17150 'width' => '200',
17151 'height' => '100',
17152 'depth' => '50',
17153 'square' => '',
17154 )
17155 </pre>
17156
17157 !! html/parsoid
17158 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17159 !! end
17160
17161 !! test
17162 Parser hook: argument containing a forward slash (T7344)
17163 !! wikitext
17164 <tag filename="/tmp/bla"></tag>
17165 !! html/php
17166 <pre>
17167 ''
17168 array (
17169 'filename' => '/tmp/bla',
17170 )
17171 </pre>
17172
17173 !! html/parsoid
17174 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17175 !! end
17176
17177 ## Don't expect parsoid to rt this form.
17178 !! test
17179 Parser hook: empty input using terminated empty elements (T4374)
17180 !! options
17181 parsoid=wt2html,html2html
17182 !! wikitext
17183 <tag foo=bar/>text
17184 !! html/php
17185 <pre>
17186 NULL
17187 array (
17188 'foo' => 'bar',
17189 )
17190 </pre>text
17191
17192 !! html/parsoid
17193 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
17194 !! end
17195
17196 ## </tag> should be output literally since there is no matching tag that begins it
17197 ## Don't expect parsoid to rt this form.
17198 !! test
17199 Parser hook: basic arguments using terminated empty elements (T4374)
17200 !! options
17201 parsoid=wt2html
17202 !! wikitext
17203 <tag width=200 height = "100" depth = '50' square/>
17204 other stuff
17205 </tag>
17206 !! html/php
17207 <pre>
17208 NULL
17209 array (
17210 'width' => '200',
17211 'height' => '100',
17212 'depth' => '50',
17213 'square' => '',
17214 )
17215 </pre>
17216 <p>other stuff
17217 &lt;/tag&gt;
17218 </p>
17219 !! html/parsoid
17220 <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
17221 &lt;/tag></p>
17222 !! end
17223
17224 ## Don't expect parsoid to rt this form.
17225 !! test
17226 Parser hook: Don't allow unclosed extension tags
17227 !! options
17228 parsoid=wt2html
17229 !! wikitext
17230 test <tag>123
17231
17232 this is a '''test'''
17233 !! html/php
17234 <p>test &lt;tag&gt;123
17235 </p><p>this is a <b>test</b>
17236 </p>
17237 !! html/parsoid
17238 <p>test &lt;tag>123</p>
17239
17240 <p>this is a <b>test</b></p>
17241 !! end
17242
17243 ###
17244 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17245 ###
17246
17247 !! test
17248 Parser hook: static parser hook not inside a comment
17249 !! wikitext
17250 <statictag>hello, world</statictag>
17251
17252 <statictag action="flush" />
17253 !! html/php
17254 <p><br />
17255 hello, world
17256 </p>
17257 !! html/parsoid
17258 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17259 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17260 !! end
17261
17262 !! test
17263 Parser hook: static parser hook inside a comment
17264 !! wikitext
17265 <!-- <statictag>hello, world</statictag> -->
17266 <statictag action="flush" />
17267 !! html/php
17268 <p><br />
17269 </p>
17270 !! html/parsoid
17271 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17272 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17273 !! end
17274
17275 # Nested template calls; this case was broken by Parser.php rev 1.506,
17276 # since reverted.
17277
17278 !! article
17279 Template:One-parameter
17280 !! text
17281 (My parameter is: {{{1}}})
17282 !! endarticle
17283
17284 !! article
17285 Template:Map-one-parameter
17286 !! text
17287 {{{{{1}}}|{{{2}}}}}
17288 !! endarticle
17289
17290 !! test
17291 Nested template calls
17292 !! wikitext
17293 {{Map-one-parameter|One-parameter|param}}
17294 !! html
17295 <p>(My parameter is: param)
17296 </p>
17297 !! end
17298
17299
17300 ###
17301 ### Sanitizer
17302 ###
17303
17304 # HTML+Tidy effectively strips out the empty tags completely
17305 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17306 # which Tidy would have done for the PHP parser had there been content inside it.
17307 !! test
17308 Sanitizer: Closing of open tags
17309 !! wikitext
17310 <s></s><table></table>
17311 !! html
17312 <s></s><table></table>
17313
17314 !! html/parsoid
17315 <p><s></s></p><table></table>
17316 !! end
17317
17318 !! test
17319 Sanitizer: Closing of open but not closed tags
17320 !! wikitext
17321 <s>foo
17322 !! html
17323 <p><s>foo</s>
17324 </p>
17325 !! end
17326
17327 !! test
17328 Sanitizer: Closing of closed but not open tags
17329 !! options
17330 parsoid=wt2html
17331 !! wikitext
17332 </s>
17333 !! html/php+tidy
17334 !! html/parsoid
17335 !! end
17336
17337 !! test
17338 Sanitizer: Closing of closed but not open table tags
17339 !! options
17340 parsoid=wt2html
17341 !! wikitext
17342 Table not started</td></tr></table>
17343 !! html/php+tidy
17344 <p>Table not started</p>
17345 !! html/parsoid
17346 <p>Table not started</p>
17347 !! end
17348
17349 !! test
17350 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17351 !! wikitext
17352 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17353 !! html/php
17354 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17355 </p>
17356 !! html/parsoid
17357 <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>
17358 !! end
17359
17360 # In HTML5, the restrictions are that id must contain at least one character,
17361 # and must not contain any space characters.
17362 !! test
17363 Sanitizer: Validating the contents of the id attribute (T6515)
17364 !! options
17365 disabled
17366 !! wikitext
17367 <br id="" /><br id="a space" />
17368 !! html
17369 Something ...
17370 !! end
17371
17372 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17373 !! test
17374 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
17375 !! options
17376 disabled
17377 !! wikitext
17378 <br id="foo" /><br id="foo" />
17379 !! html
17380 Something need to be done. foo-2 ?
17381 !! end
17382
17383 !! test
17384 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17385 !! wikitext
17386 <div itemscope>
17387 <meta itemprop="hello" content="world">
17388 <meta http-equiv="refresh" content="5">
17389 <meta itemprop="hello" http-equiv="refresh" content="5">
17390 <link itemprop="hello" href="{{SERVER}}">
17391 <link rel="stylesheet" href="{{SERVER}}">
17392 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17393 </div>
17394 !! html
17395 <div itemscope="">
17396 <p> <meta itemprop="hello" content="world" />
17397 &lt;meta http-equiv="refresh" content="5"&gt;
17398 <meta itemprop="hello" content="5" />
17399 </p>
17400 <link itemprop="hello" href="http&#58;//example.org" />
17401 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17402 <link itemprop="hello" href="http&#58;//example.org" />
17403 </div>
17404
17405 !! end
17406
17407 !! test
17408 Language converter: output gets cut off unexpectedly (T7757)
17409 !! options
17410 language=zh
17411 !! wikitext
17412 this bit is safe: }-
17413
17414 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17415
17416 then we get cut off here: }-
17417
17418 all additional text is vanished
17419 !! html
17420 <p>this bit is safe: }-
17421 </p><p>but if we add a conversion instance: xxx
17422 </p><p>then we get cut off here: }-
17423 </p><p>all additional text is vanished
17424 </p>
17425 !! end
17426
17427 !! test
17428 Self closed html pairs (T7487)
17429 !! options
17430 !! wikitext
17431 <center><font id="bug" />Centered text</center>
17432 <div><font id="bug2" />In div text</div>
17433 !! html
17434 <center>&lt;font id="bug" /&gt;Centered text</center>
17435 <div>&lt;font id="bug2" /&gt;In div text</div>
17436
17437 !! end
17438
17439 #
17440 #
17441 #
17442
17443 !! test
17444 Punctuation: nbsp before exclamation
17445 !! wikitext
17446 C'est grave !
17447 !! html
17448 <p>C'est grave&#160;!
17449 </p>
17450 !! end
17451
17452 !! test
17453 Punctuation: CSS !important (T13874)
17454 !! wikitext
17455 <div style="width:50% !important">important</div>
17456 !! html
17457 <div style="width:50% !important">important</div>
17458
17459 !!end
17460
17461 !! test
17462 Punctuation: CSS ! important (T13874; with space after)
17463 !! wikitext
17464 <div style="width:50% ! important">important</div>
17465 !! html
17466 <div style="width:50% ! important">important</div>
17467
17468 !!end
17469
17470 !! test
17471 HTML bullet list, closed tags (T7497)
17472 !! wikitext
17473 <ul>
17474 <li>One</li>
17475 <li>Two</li>
17476 </ul>
17477 !! html/php
17478 <ul>
17479 <li>One</li>
17480 <li>Two</li>
17481 </ul>
17482
17483 !! html/parsoid
17484 <ul data-parsoid='{"stx":"html"}'>
17485 <li data-parsoid='{"stx":"html"}'>One</li>
17486 <li data-parsoid='{"stx":"html"}'>Two</li>
17487 </ul>
17488
17489 !! end
17490
17491 !! test
17492 HTML bullet list, unclosed tags (T7497)
17493 !! wikitext
17494 <ul>
17495 <li>One
17496 <li>Two
17497 </ul>
17498 !! html/php+tidy
17499 <ul>
17500 <li>One</li>
17501 <li>Two</li>
17502 </ul>
17503 !! html/parsoid
17504 <ul data-parsoid='{"stx":"html"}'>
17505 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17506 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17507 </ul>
17508
17509 !! end
17510
17511 !! test
17512 HTML ordered list, closed tags (T7497)
17513 !! wikitext
17514 <ol>
17515 <li>One</li>
17516 <li>Two</li>
17517 </ol>
17518 !! html/php
17519 <ol>
17520 <li>One</li>
17521 <li>Two</li>
17522 </ol>
17523
17524 !! html/parsoid
17525 <ol data-parsoid='{"stx":"html"}'>
17526 <li data-parsoid='{"stx":"html"}'>One</li>
17527 <li data-parsoid='{"stx":"html"}'>Two</li>
17528 </ol>
17529
17530 !! end
17531
17532 !! test
17533 HTML ordered list, unclosed tags (T7497)
17534 !! options
17535 !! wikitext
17536 <ol>
17537 <li>One
17538 <li>Two
17539 </ol>
17540 !! html/php+tidy
17541 <ol>
17542 <li>One</li>
17543 <li>Two</li>
17544 </ol>
17545 !! html/parsoid
17546 <ol data-parsoid='{"stx":"html"}'>
17547 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17548 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17549 </ol>
17550
17551 !! end
17552
17553 !! test
17554 HTML nested bullet list, closed tags (T7497)
17555 !! wikitext
17556 <ul>
17557 <li>One</li>
17558 <li>Two:
17559 <ul>
17560 <li>Sub-one</li>
17561 <li>Sub-two</li>
17562 </ul>
17563 </li>
17564 </ul>
17565 !! html/php
17566 <ul>
17567 <li>One</li>
17568 <li>Two:
17569 <ul>
17570 <li>Sub-one</li>
17571 <li>Sub-two</li>
17572 </ul>
17573 </li>
17574 </ul>
17575
17576 !! html/parsoid
17577 <ul data-parsoid='{"stx":"html"}'>
17578 <li data-parsoid='{"stx":"html"}'>One</li>
17579 <li data-parsoid='{"stx":"html"}'>Two:
17580 <ul data-parsoid='{"stx":"html"}'>
17581 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17582 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17583 </ul>
17584 </li>
17585 </ul>
17586 !! end
17587
17588 !! test
17589 HTML nested bullet list, open tags (T7497)
17590 !! wikitext
17591 <ul>
17592 <li>One
17593 <li>Two:
17594 <ul>
17595 <li>Sub-one
17596 <li>Sub-two
17597 </ul>
17598 </ul>
17599 !! html/php+tidy
17600 <ul>
17601 <li>One</li>
17602 <li>Two:
17603 <ul>
17604 <li>Sub-one</li>
17605 <li>Sub-two</li>
17606 </ul>
17607 </li>
17608 </ul>
17609 !! html/parsoid
17610 <ul>
17611 <li>One
17612 </li>
17613 <li>Two:
17614 <ul>
17615 <li>Sub-one
17616 </li>
17617 <li>Sub-two
17618 </li>
17619 </ul>
17620 </li>
17621 </ul>
17622
17623 !! end
17624
17625 !! test
17626 HTML nested ordered list, closed tags (T7497)
17627 !! wikitext
17628 <ol>
17629 <li>One</li>
17630 <li>Two:
17631 <ol>
17632 <li>Sub-one</li>
17633 <li>Sub-two</li>
17634 </ol>
17635 </li>
17636 </ol>
17637 !! html
17638 <ol>
17639 <li>One</li>
17640 <li>Two:
17641 <ol>
17642 <li>Sub-one</li>
17643 <li>Sub-two</li>
17644 </ol>
17645 </li>
17646 </ol>
17647
17648 !! end
17649
17650 !! test
17651 HTML nested ordered list, open tags (T7497)
17652 !! wikitext
17653 <ol>
17654 <li>One
17655 <li>Two:
17656 <ol>
17657 <li>Sub-one
17658 <li>Sub-two
17659 </ol>
17660 </ol>
17661 !! html/php
17662 <ol>
17663 <li>One
17664 <li>Two:
17665 <ol>
17666 <li>Sub-one
17667 <li>Sub-two
17668 </ol>
17669 </ol>
17670
17671 !! html/parsoid
17672 <ol>
17673 <li>One
17674 </li>
17675 <li>Two:
17676 <ol>
17677 <li>Sub-one
17678 </li>
17679 <li>Sub-two
17680 </li>
17681 </ol>
17682 </li>
17683 </ol>
17684
17685 !! end
17686
17687 !! test
17688 HTML ordered list item with parameters oddity
17689 !! wikitext
17690 <ol><li id="fragment">One</li>
17691 </ol>
17692 !! html
17693 <ol><li id="fragment">One</li>
17694 </ol>
17695
17696 !! end
17697
17698 # parsoid doesn't explicitly mark autonumbered links, see T55505
17699 !!test
17700 T7918: autonumbering
17701 !! wikitext
17702 [http://first/] [http://second] [ftp://ftp]
17703
17704 ftp://inlineftp
17705
17706 [mailto:enclosed@mail.tld With target]
17707
17708 [mailto:enclosed@mail.tld]
17709
17710 mailto:inline@mail.tld
17711 !! html/php
17712 <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>
17713 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17714 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17715 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17716 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17717 </p>
17718 !! html/parsoid
17719 <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>
17720 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17721 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17722 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17723 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17724 !! end
17725
17726
17727 #
17728 # Security and HTML correctness
17729 # From Nick Jenkins' fuzz testing
17730 #
17731
17732 !! test
17733 Fuzz testing: Parser13
17734 !! wikitext
17735 {|
17736 | http://a|
17737 !! html
17738 <table>
17739 <tr>
17740 <td>
17741 </td>
17742 </tr>
17743 </table>
17744
17745 !! end
17746
17747 !! test
17748 Fuzz testing: Parser14
17749 !! wikitext
17750 == onmouseover= ==
17751 http://__TOC__
17752 !! html
17753 <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>
17754 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17755 <ul>
17756 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17757 </ul>
17758 </div>
17759
17760
17761 !! html+tidy
17762 <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>
17763 <p>http://</p>
17764 <div id="toc" class="toc">
17765 <div id="toctitle">
17766 <h2>Contents</h2>
17767 </div>
17768 <ul>
17769 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17770 </ul>
17771 </div>
17772 <p></p>
17773 !! end
17774
17775 !! test
17776 Fuzz testing: Parser14-table
17777 !! options
17778 parsoid=wt2html,html2html
17779 !! wikitext
17780 ==a==
17781 {| STYLE=__TOC__
17782 !! html
17783 <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>
17784 <table style="&#95;_TOC&#95;_">
17785 <tr><td></td></tr>
17786 </table>
17787
17788 !! html+tidy
17789 <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>
17790 <table style="__TOC__">
17791 <tr>
17792 <td></td>
17793 </tr>
17794 </table>
17795 !! html/parsoid
17796 <h2>a</h2>
17797 <table style="__TOC__"></table>
17798 !! end
17799
17800 # Known to produce bogus xml (extra </td>)
17801 !! test
17802 Fuzz testing: Parser16
17803 !! wikitext
17804 {|
17805 !https://||||||
17806 !! html
17807 <table>
17808 <tr>
17809 <th>https://</th>
17810 <th></th>
17811 <th></th>
17812 <th>
17813 </td>
17814 </tr>
17815 </table>
17816
17817 !! html+tidy
17818 <table>
17819 <tr>
17820 <th>https://</th>
17821 <th></th>
17822 <th></th>
17823 <th></th>
17824 </tr>
17825 </table>
17826 !! end
17827
17828 !! test
17829 Fuzz testing: Parser21
17830 !! wikitext
17831 {|
17832 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17833 |
17834 !! html
17835 <table>
17836 <tr>
17837 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17838 </th>
17839 <td>
17840 </td>
17841 </tr>
17842 </table>
17843
17844 !! end
17845
17846 !! test
17847 Fuzz testing: Parser22
17848 !! wikitext
17849 http://===r:::https://b
17850
17851 {|
17852 !! html
17853 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17854 </p>
17855 <table>
17856 <tr><td></td></tr>
17857 </table>
17858
17859 !! end
17860
17861 # Known to produce bad XML for now
17862 !! test
17863 Fuzz testing: Parser24
17864 !! options
17865 parsoid=wt2html
17866 !! wikitext
17867 {|
17868 {{{|
17869 <u CLASS=
17870 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17871 <br style="onmouseover='alert(document.cookie);' " />
17872
17873 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17874 |
17875 !! html/php
17876 <table>
17877 {{{|
17878 <u class="&#124;">}}}} &gt;
17879 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17880
17881 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17882 <tr>
17883 <td></u>
17884 </td>
17885 </tr>
17886 </table>
17887
17888 !! html/parsoid
17889 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
17890 <u class="|" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":""},"autoInsertedEnd":true}' data-mw='{"attribs":[[{"txt":"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}","html":"{&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[21,79,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&amp;lt;noinclude>\"},\"params\":{},\"i\":0}}]}&#39;>{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}&lt;/span>}"},{"html":""}]]}'>
17891 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/></u></p><p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><u class="|" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":""},"autoInsertedEnd":true,"autoInsertedStart":true}' data-mw='{"attribs":[[{"txt":"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}","html":"{&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[21,79,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&amp;lt;noinclude>\"},\"params\":{},\"i\":0}}]}&#39;>{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}&lt;/span>}"},{"html":""}]]}'>MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p><table data-parsoid='{"autoInsertedEnd":true}'>
17892
17893
17894
17895 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
17896 !! end
17897
17898 # Note: the current result listed for this is not what the original one was,
17899 # but the original bug was JavaScript injection, which is fixed in any case.
17900 # It's not clear that the original result listed was any more correct than the
17901 # current one. Original result:
17902 # <p>{{{|
17903 # </p>
17904 # <li class="&#124;&#124;">
17905 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17906 !!test
17907 Fuzz testing: Parser25 (T8055)
17908 !! wikitext
17909 {{{
17910 |
17911 <LI CLASS=||
17912 >
17913 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17914 !! html/php
17915 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17916 </p>
17917 !! html/parsoid
17918 <span about="#mwt1" typeof="mw:Param" data-parsoid='{"pi":[[{"k":"1"},{"k":"2"},{"k":"3"}]]}' data-mw='{"parts":[{"templatearg":{"target":{"wt":"\n"},"params":{"1":{"wt":" \n&lt;LI CLASS="},"2":{"wt":""},"3":{"wt":"\n >\n"}},"i":0}},"blah\" onmouseover=\"alert(&#39;hello world&#39;);\" align=\"left\"&#39;&#39;&#39;MOVE MOUSE CURSOR OVER HERE"]}'>
17919 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
17920 !! end
17921
17922 !!test
17923 Fuzz testing: URL adjacent extension (with space, clean)
17924 !! wikitext
17925 http://example.com <nowiki>junk</nowiki>
17926 !! html/php
17927 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17928 </p>
17929 !! html/parsoid
17930 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17931 !! end
17932
17933 !!test
17934 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17935 !! wikitext
17936 http://example.com<nowiki>junk</nowiki>
17937 !! html/php
17938 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17939 </p>
17940 !! html/parsoid
17941 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17942 !! end
17943
17944 !! test
17945 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17946 !! wikitext
17947 http://example.com<pre>junk</pre>
17948 !! html/php
17949 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17950
17951 !! html/php+tidy
17952 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17953 <pre>
17954 junk
17955 </pre>
17956 !! html/parsoid
17957 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a></p><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"junk"}}'>junk</pre>
17958 !! end
17959
17960 !! test
17961 Fuzz testing: image with bogus manual thumbnail
17962 !! wikitext
17963 [[Image:foobar.jpg|thumbnail= ]]
17964 !! html/php
17965 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17966
17967 !! html/parsoid
17968 <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>
17969 !! end
17970
17971 !! test
17972 Fuzz testing: encoded newline in generated HTML replacements (T8577)
17973 !! wikitext
17974 <pre dir="&#10;"></pre>
17975 !! html/php
17976 <pre dir="&#10;"></pre>
17977
17978 !! html/parsoid
17979 <pre typeof="mw:Extension/pre" about="#mwt2" dir="&amp;#10;" data-mw='{"name":"pre","attrs":{"dir":"&amp;#10;"},"body":{"extsrc":""}}'></pre>
17980 !! end
17981
17982 !! test
17983 Parsing optional HTML elements (T8171)
17984 !! options
17985 !! wikitext
17986 <table>
17987 <tr>
17988 <td> Some tabular data</td>
17989 <td> More tabular data ...
17990 <td> And yet som tabular data</td>
17991 </tr>
17992 </table>
17993 !! html
17994 <table>
17995 <tr>
17996 <td> Some tabular data</td>
17997 <td> More tabular data ...
17998 </td><td> And yet som tabular data</td>
17999 </tr>
18000 </table>
18001
18002 !! end
18003
18004 !! test
18005 Correct handling of <td>, <tr> (T8171)
18006 !! options
18007 !! wikitext
18008 <table>
18009 <tr>
18010 <td> Some tabular data</td>
18011 <td> More tabular data ...</td>
18012 <td> And yet som tabular data</td>
18013 </tr>
18014 </table>
18015 !! html
18016 <table>
18017 <tr>
18018 <td> Some tabular data</td>
18019 <td> More tabular data ...</td>
18020 <td> And yet som tabular data</td>
18021 </tr>
18022 </table>
18023
18024 !! end
18025
18026
18027 !! test
18028 Parsing crashing regression (fr:JavaScript)
18029 !! wikitext
18030 </body></x>
18031 !! html
18032 <p>&lt;/body&gt;&lt;/x&gt;
18033 </p>
18034 !! end
18035
18036 !! test
18037 Inline wiki vs wiki block nesting
18038 !! wikitext
18039 '''Bold paragraph
18040
18041 New wiki paragraph
18042 !! html
18043 <p><b>Bold paragraph</b>
18044 </p><p>New wiki paragraph
18045 </p>
18046 !! end
18047
18048 # FIXME: The current php output is documented
18049 # and desired output is the parsoid target.
18050 !! test
18051 Inline HTML vs wiki block nesting
18052 !! wikitext
18053 <b>Bold paragraph
18054
18055 New wiki paragraph
18056 !! html/php
18057 <p><b>Bold paragraph
18058 </p><p>New wiki paragraph</b>
18059 </p>
18060 !! html/parsoid
18061 <p><b>Bold paragraph</b>
18062 </p><p>New wiki paragraph
18063 </p>
18064 !! end
18065
18066 # Original result was this:
18067 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
18068 # </p>
18069 # While that might be marginally more intuitive, maybe, the six-apostrophe
18070 # construct is clearly pathological and the result stated here (which is what
18071 # the parser actually does) is about as reasonable as anything.
18072 !!test
18073 Mixing markup for italics and bold
18074 !! options
18075 !! wikitext
18076 '''bold''''''bold''bolditalics'''''
18077 !! html
18078 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
18079 </p>
18080 !! end
18081
18082
18083 !! article
18084 Xyzzyx
18085 !! text
18086 Article for special page transclusion test
18087 !! endarticle
18088
18089 !! test
18090 Special page transclusion
18091 !! options
18092 !! wikitext
18093 {{Special:Prefixindex/Xyzzyx}}
18094 !! html
18095 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18096 </ul>
18097
18098 !! end
18099
18100 !! test
18101 Special page transclusion twice (T7021)
18102 !! options
18103 !! wikitext
18104 {{Special:Prefixindex/Xyzzyx}}
18105 {{Special:Prefixindex/Xyzzyx}}
18106 !! html
18107 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18108 </ul>
18109 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18110 </ul>
18111
18112 !! end
18113
18114 !! test
18115 Transclusion of default MediaWiki message
18116 !! wikitext
18117 {{MediaWiki:Mainpage}}
18118 !! html
18119 <p>Main Page
18120 </p>
18121 !! end
18122
18123 !! test
18124 Transclusion of nonexistent MediaWiki message
18125 !! wikitext
18126 {{MediaWiki:Mainpagexxx}}
18127 !! html
18128 <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>
18129 </p>
18130 !! end
18131
18132 !! test
18133 Transclusion of MediaWiki message with underscore
18134 !! wikitext
18135 {{MediaWiki:history_short}}
18136 !! html
18137 <p>History
18138 </p>
18139 !! end
18140
18141 !! test
18142 Transclusion of MediaWiki message with space
18143 !! wikitext
18144 {{MediaWiki:history short}}
18145 !! html
18146 <p>History
18147 </p>
18148 !! end
18149
18150 !! test
18151 Invalid header with following text
18152 !! wikitext
18153 = x = y
18154 !! html
18155 <p>= x = y
18156 </p>
18157 !! end
18158
18159
18160 !! test
18161 Section extraction test (section 0)
18162 !! options
18163 section=0
18164 !! wikitext
18165 start
18166 ==a==
18167 ===aa===
18168 ====aaa====
18169 ==b==
18170 ===ba===
18171 ===bb===
18172 ====bba====
18173 ===bc===
18174 ==c==
18175 ===ca===
18176 !! html/php
18177 start
18178 !! end
18179
18180 !! test
18181 Section extraction test (section 1)
18182 !! options
18183 section=1
18184 !! wikitext
18185 start
18186 ==a==
18187 ===aa===
18188 ====aaa====
18189 ==b==
18190 ===ba===
18191 ===bb===
18192 ====bba====
18193 ===bc===
18194 ==c==
18195 ===ca===
18196 !! html/php
18197 ==a==
18198 ===aa===
18199 ====aaa====
18200 !! end
18201
18202 !! test
18203 Section extraction test (section 2)
18204 !! options
18205 section=2
18206 !! wikitext
18207 start
18208 ==a==
18209 ===aa===
18210 ====aaa====
18211 ==b==
18212 ===ba===
18213 ===bb===
18214 ====bba====
18215 ===bc===
18216 ==c==
18217 ===ca===
18218 !! html/php
18219 ===aa===
18220 ====aaa====
18221 !! end
18222
18223 !! test
18224 Section extraction test (section 3)
18225 !! options
18226 section=3
18227 !! wikitext
18228 start
18229 ==a==
18230 ===aa===
18231 ====aaa====
18232 ==b==
18233 ===ba===
18234 ===bb===
18235 ====bba====
18236 ===bc===
18237 ==c==
18238 ===ca===
18239 !! html/php
18240 ====aaa====
18241 !! end
18242
18243 !! test
18244 Section extraction test (section 4)
18245 !! options
18246 section=4
18247 !! wikitext
18248 start
18249 ==a==
18250 ===aa===
18251 ====aaa====
18252 ==b==
18253 ===ba===
18254 ===bb===
18255 ====bba====
18256 ===bc===
18257 ==c==
18258 ===ca===
18259 !! html/php
18260 ==b==
18261 ===ba===
18262 ===bb===
18263 ====bba====
18264 ===bc===
18265 !! end
18266
18267 !! test
18268 Section extraction test (section 5)
18269 !! options
18270 section=5
18271 !! wikitext
18272 start
18273 ==a==
18274 ===aa===
18275 ====aaa====
18276 ==b==
18277 ===ba===
18278 ===bb===
18279 ====bba====
18280 ===bc===
18281 ==c==
18282 ===ca===
18283 !! html/php
18284 ===ba===
18285 !! end
18286
18287 !! test
18288 Section extraction test (section 6)
18289 !! options
18290 section=6
18291 !! wikitext
18292 start
18293 ==a==
18294 ===aa===
18295 ====aaa====
18296 ==b==
18297 ===ba===
18298 ===bb===
18299 ====bba====
18300 ===bc===
18301 ==c==
18302 ===ca===
18303 !! html/php
18304 ===bb===
18305 ====bba====
18306 !! end
18307
18308 !! test
18309 Section extraction test (section 7)
18310 !! options
18311 section=7
18312 !! wikitext
18313 start
18314 ==a==
18315 ===aa===
18316 ====aaa====
18317 ==b==
18318 ===ba===
18319 ===bb===
18320 ====bba====
18321 ===bc===
18322 ==c==
18323 ===ca===
18324 !! html/php
18325 ====bba====
18326 !! end
18327
18328 !! test
18329 Section extraction test (section 8)
18330 !! options
18331 section=8
18332 !! wikitext
18333 start
18334 ==a==
18335 ===aa===
18336 ====aaa====
18337 ==b==
18338 ===ba===
18339 ===bb===
18340 ====bba====
18341 ===bc===
18342 ==c==
18343 ===ca===
18344 !! html/php
18345 ===bc===
18346 !! end
18347
18348 !! test
18349 Section extraction test (section 9)
18350 !! options
18351 section=9
18352 !! wikitext
18353 start
18354 ==a==
18355 ===aa===
18356 ====aaa====
18357 ==b==
18358 ===ba===
18359 ===bb===
18360 ====bba====
18361 ===bc===
18362 ==c==
18363 ===ca===
18364 !! html/php
18365 ==c==
18366 ===ca===
18367 !! end
18368
18369 !! test
18370 Section extraction test (section 10)
18371 !! options
18372 section=10
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 ===ca===
18387 !! end
18388
18389 !! test
18390 Section extraction test (nonexistent section 11)
18391 !! options
18392 section=11
18393 !! wikitext
18394 start
18395 ==a==
18396 ===aa===
18397 ====aaa====
18398 ==b==
18399 ===ba===
18400 ===bb===
18401 ====bba====
18402 ===bc===
18403 ==c==
18404 ===ca===
18405 !! html/php
18406 !! end
18407
18408 !! test
18409 Section extraction test with bogus heading (section 1)
18410 !! options
18411 section=1
18412 !! wikitext
18413 ==a==
18414 ==bogus== not a legal section
18415 ==b==
18416 !! html/php
18417 ==a==
18418 ==bogus== not a legal section
18419 !! end
18420
18421 !! test
18422 Section extraction test with bogus heading (section 2)
18423 !! options
18424 section=2
18425 !! wikitext
18426 ==a==
18427 ==bogus== not a legal section
18428 ==b==
18429 !! html/php
18430 ==b==
18431 !! end
18432
18433 !! test
18434 Section extraction test with comment after heading (section 1)
18435 !! options
18436 section=1
18437 !! wikitext
18438 ==a==
18439 ==b== <!-- -->
18440 ==c==
18441 !! html/php
18442 ==a==
18443 !! end
18444
18445 !! test
18446 Section extraction test with comment after heading (section 2)
18447 !! options
18448 section=2
18449 !! wikitext
18450 ==a==
18451 ==b== <!-- -->
18452 ==c==
18453 !! html/php
18454 ==b== <!-- -->
18455 !! end
18456
18457 !! test
18458 Section extraction test with bogus <nowiki> heading (section 1)
18459 !! options
18460 section=1
18461 !! wikitext
18462 ==a==
18463 ==bogus== <nowiki>not a legal section</nowiki>
18464 ==b==
18465 !! html/php
18466 ==a==
18467 ==bogus== <nowiki>not a legal section</nowiki>
18468 !! end
18469
18470 !! test
18471 Section extraction test with bogus <nowiki> heading (section 2)
18472 !! options
18473 section=2
18474 !! wikitext
18475 ==a==
18476 ==bogus== <nowiki>not a legal section</nowiki>
18477 ==b==
18478 !! html/php
18479 ==b==
18480 !! end
18481
18482 # Formerly testing for T4587, now resolved by the use of unmarked sections
18483 # instead of respecting commented sections
18484 !! test
18485 Section extraction prefixed by comment (section 1)
18486 !! options
18487 section=1
18488 !! wikitext
18489 <!-- -->==sec1==
18490 ==sec2==
18491 !! html/php
18492 ==sec2==
18493 !!end
18494
18495 !! test
18496 Section extraction prefixed by comment (section 2)
18497 !! options
18498 section=2
18499 !! wikitext
18500 <!-- -->==sec1==
18501 ==sec2==
18502 !! html/php
18503
18504 !!end
18505
18506 # Formerly testing for T4607, now resolved by the use of unmarked sections
18507 # instead of respecting HTML-style headings
18508 !! test
18509 Section extraction, mixed wiki and html (section 1)
18510 !! options
18511 section=1
18512 !! wikitext
18513 <h2>unmarked</h2>
18514 unmarked
18515 ==1==
18516 one
18517 ==2==
18518 two
18519 !! html/php
18520 ==1==
18521 one
18522 !! end
18523
18524 !! test
18525 Section extraction, mixed wiki and html (section 2)
18526 !! options
18527 section=2
18528 !! wikitext
18529 <h2>unmarked</h2>
18530 unmarked
18531 ==1==
18532 one
18533 ==2==
18534 two
18535 !! html/php
18536 ==2==
18537 two
18538 !! end
18539
18540
18541 # Formerly testing for T5342
18542 !! test
18543 Section extraction, heading surrounded by <noinclude>
18544 !! options
18545 section=1
18546 !! wikitext
18547 <noinclude>==unmarked==</noinclude>
18548 ==marked==
18549 !! html/php
18550 ==marked==
18551 !!end
18552
18553 # Test behavior of T21910
18554 !! test
18555 Sectiion with all-equals
18556 !! options
18557 section=2
18558 !! wikitext
18559 ===
18560 The line above must have a trailing space
18561 === <!--
18562 --> <!-- -->
18563 But just in case it doesn't...
18564 !! html/php
18565 === <!--
18566 --> <!-- -->
18567 But just in case it doesn't...
18568 !! end
18569
18570 !! test
18571 Section replacement test (section 0)
18572 !! options
18573 replace=0,"xxx"
18574 !! wikitext
18575 start
18576 ==a==
18577 ===aa===
18578 ====aaa====
18579 ==b==
18580 ===ba===
18581 ===bb===
18582 ====bba====
18583 ===bc===
18584 ==c==
18585 ===ca===
18586 !! html/php
18587 xxx
18588
18589 ==a==
18590 ===aa===
18591 ====aaa====
18592 ==b==
18593 ===ba===
18594 ===bb===
18595 ====bba====
18596 ===bc===
18597 ==c==
18598 ===ca===
18599 !! end
18600
18601 !! test
18602 Section replacement test (section 1)
18603 !! options
18604 replace=1,"xxx"
18605 !! wikitext
18606 start
18607 ==a==
18608 ===aa===
18609 ====aaa====
18610 ==b==
18611 ===ba===
18612 ===bb===
18613 ====bba====
18614 ===bc===
18615 ==c==
18616 ===ca===
18617 !! html/php
18618 start
18619 xxx
18620
18621 ==b==
18622 ===ba===
18623 ===bb===
18624 ====bba====
18625 ===bc===
18626 ==c==
18627 ===ca===
18628 !! end
18629
18630 !! test
18631 Section replacement test (section 2)
18632 !! options
18633 replace=2,"xxx"
18634 !! wikitext
18635 start
18636 ==a==
18637 ===aa===
18638 ====aaa====
18639 ==b==
18640 ===ba===
18641 ===bb===
18642 ====bba====
18643 ===bc===
18644 ==c==
18645 ===ca===
18646 !! html/php
18647 start
18648 ==a==
18649 xxx
18650
18651 ==b==
18652 ===ba===
18653 ===bb===
18654 ====bba====
18655 ===bc===
18656 ==c==
18657 ===ca===
18658 !! end
18659
18660 !! test
18661 Section replacement test (section 3)
18662 !! options
18663 replace=3,"xxx"
18664 !! wikitext
18665 start
18666 ==a==
18667 ===aa===
18668 ====aaa====
18669 ==b==
18670 ===ba===
18671 ===bb===
18672 ====bba====
18673 ===bc===
18674 ==c==
18675 ===ca===
18676 !! html/php
18677 start
18678 ==a==
18679 ===aa===
18680 xxx
18681
18682 ==b==
18683 ===ba===
18684 ===bb===
18685 ====bba====
18686 ===bc===
18687 ==c==
18688 ===ca===
18689 !! end
18690
18691 !! test
18692 Section replacement test (section 4)
18693 !! options
18694 replace=4,"xxx"
18695 !! wikitext
18696 start
18697 ==a==
18698 ===aa===
18699 ====aaa====
18700 ==b==
18701 ===ba===
18702 ===bb===
18703 ====bba====
18704 ===bc===
18705 ==c==
18706 ===ca===
18707 !! html/php
18708 start
18709 ==a==
18710 ===aa===
18711 ====aaa====
18712 xxx
18713
18714 ==c==
18715 ===ca===
18716 !! end
18717
18718 !! test
18719 Section replacement test (section 5)
18720 !! options
18721 replace=5,"xxx"
18722 !! wikitext
18723 start
18724 ==a==
18725 ===aa===
18726 ====aaa====
18727 ==b==
18728 ===ba===
18729 ===bb===
18730 ====bba====
18731 ===bc===
18732 ==c==
18733 ===ca===
18734 !! html/php
18735 start
18736 ==a==
18737 ===aa===
18738 ====aaa====
18739 ==b==
18740 xxx
18741
18742 ===bb===
18743 ====bba====
18744 ===bc===
18745 ==c==
18746 ===ca===
18747 !! end
18748
18749 !! test
18750 Section replacement test (section 6)
18751 !! options
18752 replace=6,"xxx"
18753 !! wikitext
18754 start
18755 ==a==
18756 ===aa===
18757 ====aaa====
18758 ==b==
18759 ===ba===
18760 ===bb===
18761 ====bba====
18762 ===bc===
18763 ==c==
18764 ===ca===
18765 !! html/php
18766 start
18767 ==a==
18768 ===aa===
18769 ====aaa====
18770 ==b==
18771 ===ba===
18772 xxx
18773
18774 ===bc===
18775 ==c==
18776 ===ca===
18777 !! end
18778
18779 !! test
18780 Section replacement test (section 7)
18781 !! options
18782 replace=7,"xxx"
18783 !! wikitext
18784 start
18785 ==a==
18786 ===aa===
18787 ====aaa====
18788 ==b==
18789 ===ba===
18790 ===bb===
18791 ====bba====
18792 ===bc===
18793 ==c==
18794 ===ca===
18795 !! html/php
18796 start
18797 ==a==
18798 ===aa===
18799 ====aaa====
18800 ==b==
18801 ===ba===
18802 ===bb===
18803 xxx
18804
18805 ===bc===
18806 ==c==
18807 ===ca===
18808 !! end
18809
18810 !! test
18811 Section replacement test (section 8)
18812 !! options
18813 replace=8,"xxx"
18814 !! wikitext
18815 start
18816 ==a==
18817 ===aa===
18818 ====aaa====
18819 ==b==
18820 ===ba===
18821 ===bb===
18822 ====bba====
18823 ===bc===
18824 ==c==
18825 ===ca===
18826 !! html/php
18827 start
18828 ==a==
18829 ===aa===
18830 ====aaa====
18831 ==b==
18832 ===ba===
18833 ===bb===
18834 ====bba====
18835 xxx
18836
18837 ==c==
18838 ===ca===
18839 !!end
18840
18841 !! test
18842 Section replacement test (section 9)
18843 !! options
18844 replace=9,"xxx"
18845 !! wikitext
18846 start
18847 ==a==
18848 ===aa===
18849 ====aaa====
18850 ==b==
18851 ===ba===
18852 ===bb===
18853 ====bba====
18854 ===bc===
18855 ==c==
18856 ===ca===
18857 !! html/php
18858 start
18859 ==a==
18860 ===aa===
18861 ====aaa====
18862 ==b==
18863 ===ba===
18864 ===bb===
18865 ====bba====
18866 ===bc===
18867 xxx
18868 !! end
18869
18870 !! test
18871 Section replacement test (section 10)
18872 !! options
18873 replace=10,"xxx"
18874 !! wikitext
18875 start
18876 ==a==
18877 ===aa===
18878 ====aaa====
18879 ==b==
18880 ===ba===
18881 ===bb===
18882 ====bba====
18883 ===bc===
18884 ==c==
18885 ===ca===
18886 !! html/php
18887 start
18888 ==a==
18889 ===aa===
18890 ====aaa====
18891 ==b==
18892 ===ba===
18893 ===bb===
18894 ====bba====
18895 ===bc===
18896 ==c==
18897 xxx
18898 !! end
18899
18900 !! test
18901 Section replacement test with initial whitespace (T15728)
18902 !! options
18903 replace=2,"xxx"
18904 !! wikitext
18905 Preformatted initial line
18906 ==a==
18907 ===a===
18908 !! html/php
18909 Preformatted initial line
18910 ==a==
18911 xxx
18912 !! end
18913
18914
18915 !! test
18916 Section extraction, heading followed by pre with 20 spaces (T8398)
18917 !! options
18918 section=1
18919 !! wikitext
18920 ==a==
18921 a
18922 !! html/php
18923 ==a==
18924 a
18925 !! end
18926
18927 !! test
18928 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
18929 !! options
18930 section=1
18931 !! wikitext
18932 ==a==
18933 a
18934 !! html/php
18935 ==a==
18936 a
18937 !! end
18938
18939
18940 !! test
18941 Section extraction, <pre> around bogus header (T12309)
18942 !! options
18943 section=2
18944 !! wikitext
18945 == Section One ==
18946 <pre>
18947 =======
18948 </pre>
18949
18950 == Section Two ==
18951 stuff
18952 !! html/php
18953 == Section Two ==
18954 stuff
18955 !! end
18956
18957 !! test
18958 Section replacement, <pre> around bogus header (T12309)
18959 !! options
18960 replace=2,"xxx"
18961 !! wikitext
18962 == Section One ==
18963 <pre>
18964 =======
18965 </pre>
18966
18967 == Section Two ==
18968 stuff
18969 !! html/php
18970 == Section One ==
18971 <pre>
18972 =======
18973 </pre>
18974
18975 xxx
18976 !! end
18977
18978 !! test
18979 Handling of &#x0A; in URLs
18980 !! wikitext
18981 ** irc://&#x0A;a
18982 !! html/php
18983 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18984
18985 !! html/parsoid
18986 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa" data-parsoid='{"stx":"url","a":{"href":"irc://%0Aa"},"sa":{"href":"irc://&amp;#x0A;a"}}'>irc://%0Aa</a></li></ul></li></ul>
18987 !! end
18988
18989 !! test
18990 Handling of %0A in URLs
18991 !! wikitext
18992 ** irc://%0Aa
18993 !! html/php
18994 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18995
18996 !! html/parsoid
18997 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18998 !! end
18999
19000 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
19001 !! test
19002 5 quotes, code coverage +1 line
19003 !! options
19004 parsoid=wt2html
19005 !! wikitext
19006 '''''
19007 !! html/php
19008 !! html/parsoid
19009 <p><b><i></i></b></p>
19010 !! end
19011
19012 # same html as previous, but wikitext adjusted to match parsoid html2wt
19013 # note that wt2html and html2html will put the <i> before the <b>
19014 !! test
19015 5 quotes, code coverage +1 line w/ nowiki (1)
19016 !! options
19017 parsoid=wt2wt,html2wt
19018 !! wikitext
19019 '''''<nowiki/>'''''
19020 !! html/php
19021 <p><i></i>
19022 </p>
19023 !! html/parsoid
19024 <p><b><i></i></b></p>
19025 !! end
19026
19027 # same as previous, just swapping the <i> and <b>
19028 !! test
19029 5 quotes, code coverage +1 line w/ nowiki (2)
19030 !! wikitext
19031 '''''<nowiki/>'''''
19032 !! html/php
19033 <p><i></i>
19034 </p>
19035 !! html/parsoid
19036 <p><i><b></b></i></p>
19037 !! end
19038
19039 !! test
19040 Special:Search page linking.
19041 !! wikitext
19042 {{Special:search}}
19043 !! html
19044 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
19045 </p>
19046 !! end
19047
19048 !! test
19049 {{!}} is a magic word
19050 !! wikitext
19051 {{!}} is a magic word there and {{!}} is still a magic word here
19052 | is not a magic word here but {{!}} is still a magic word here
19053 !! html/php
19054 <p>| is a magic word there and | is still a magic word here
19055 | is not a magic word here but | is still a magic word here
19056 </p>
19057 !! html/parsoid
19058 <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
19059 | 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>
19060
19061 !! end
19062
19063 !! test
19064 Say the magic word
19065 !! options
19066 title=[[Parser test]]
19067 !! wikitext
19068 * {{PAGENAME}}
19069 * {{PAGENAMEE}}
19070 * {{FULLPAGENAME}}
19071 * {{FULLPAGENAMEE}}
19072 * {{BASEPAGENAME}}
19073 * {{BASEPAGENAMEE}}
19074 * {{SUBPAGENAME}}
19075 * {{SUBPAGENAMEE}}
19076 * {{ROOTPAGENAME}}
19077 * {{ROOTPAGENAMEE}}
19078 * {{TALKPAGENAME}}
19079 * {{TALKPAGENAMEE}}
19080 * {{SUBJECTPAGENAME}}
19081 * {{SUBJECTPAGENAMEE}}
19082 * {{NAMESPACEE}}
19083 * {{NAMESPACE}}
19084 * {{NAMESPACENUMBER}}
19085 * {{TALKSPACE}}
19086 * {{TALKSPACEE}}
19087 * {{SUBJECTSPACE}}
19088 * {{SUBJECTSPACEE}}
19089 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
19090 !! html
19091 <ul><li> Parser test</li>
19092 <li> Parser_test</li>
19093 <li> Parser test</li>
19094 <li> Parser_test</li>
19095 <li> Parser test</li>
19096 <li> Parser_test</li>
19097 <li> Parser test</li>
19098 <li> Parser_test</li>
19099 <li> Parser test</li>
19100 <li> Parser_test</li>
19101 <li> Talk:Parser test</li>
19102 <li> Talk:Parser_test</li>
19103 <li> Parser test</li>
19104 <li> Parser_test</li>
19105 <li> </li>
19106 <li> </li>
19107 <li> 0</li>
19108 <li> Talk</li>
19109 <li> Talk</li>
19110 <li> </li>
19111 <li> </li>
19112 <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>
19113
19114 !! end
19115 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
19116
19117 !! test
19118 Gallery with valid attributes
19119 !! wikitext
19120 <gallery type="123" summary="345">
19121 File:File:Foobar.jpg
19122 </gallery>
19123 !! html/php
19124 <ul class="gallery mw-gallery-traditional" type="123">
19125 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19126 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
19127 <div class="gallerytext">
19128 </div>
19129 </div></li>
19130 </ul>
19131
19132 !! end
19133
19134 ## Parsoid thinks the "centre" here is a property, not a caption.
19135 !! test
19136 Gallery
19137 !! options
19138 parsoid={
19139 "modes": ["wt2html"],
19140 "nativeGallery": true
19141 }
19142 !! wikitext
19143 <gallery>
19144 image1.png |
19145 image2.gif|||||
19146
19147 image3|
19148 image4 |300px| centre
19149 image5.svg| http://///////
19150 [[x|xx]]]]
19151 * image6
19152 </gallery>
19153 !! html/php
19154 <ul class="gallery mw-gallery-traditional">
19155 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19156 <div class="thumb" style="height: 150px;">Image1.png</div>
19157 <div class="gallerytext">
19158 </div>
19159 </div></li>
19160 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19161 <div class="thumb" style="height: 150px;">Image2.gif</div>
19162 <div class="gallerytext">
19163 </div>
19164 </div></li>
19165 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19166 <div class="thumb" style="height: 150px;">Image3</div>
19167 <div class="gallerytext">
19168 </div>
19169 </div></li>
19170 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19171 <div class="thumb" style="height: 150px;">Image4</div>
19172 <div class="gallerytext">
19173 <pre>centre
19174 </pre>
19175 </div>
19176 </div></li>
19177 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19178 <div class="thumb" style="height: 150px;">Image5.svg</div>
19179 <div class="gallerytext">
19180 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
19181 </p>
19182 </div>
19183 </div></li>
19184 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19185 <div class="thumb" style="height: 150px;">* image6</div>
19186 <div class="gallerytext">
19187 </div>
19188 </div></li>
19189 </ul>
19190
19191 !! html/parsoid
19192 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19193 <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>
19194 <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>
19195 <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>
19196 <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>
19197 <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>
19198 <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>
19199 </ul>
19200 !! end
19201
19202 !! test
19203 Gallery (with options, html)
19204 !! options
19205 parsoid={
19206 "modes": ["wt2html", "html2html"],
19207 "nativeGallery": true
19208 }
19209 !! wikitext
19210 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19211 File:Nonexistent.jpg|caption
19212 File:Nonexistent.jpg
19213 image:foobar.jpg|some '''caption''' [[Main Page]]
19214 image:foobar.jpg
19215 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19216 </gallery>
19217 !! html/php
19218 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19219 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19220 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19221 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19222 <div class="gallerytext">
19223 <p>caption
19224 </p>
19225 </div>
19226 </div></li>
19227 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19228 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19229 <div class="gallerytext">
19230 </div>
19231 </div></li>
19232 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19233 <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>
19234 <div class="gallerytext">
19235 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19236 </p>
19237 </div>
19238 </div></li>
19239 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19240 <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>
19241 <div class="gallerytext">
19242 </div>
19243 </div></li>
19244 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19245 <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>
19246 <div class="gallerytext">
19247 <p>blabla.
19248 </p>
19249 </div>
19250 </div></li>
19251 </ul>
19252
19253 !! html/parsoid
19254 <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":{}}'>
19255 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19256 <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>
19257 <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>
19258 <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>
19259 <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>
19260 <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>
19261 </ul>
19262 !! end
19263
19264 !! test
19265 Gallery (with options, extsrc)
19266 !! options
19267 parsoid={
19268 "nativeGallery": false
19269 }
19270 !! wikitext
19271 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19272 File:Nonexistent.jpg|caption
19273 File:Nonexistent.jpg
19274 image:foobar.jpg|some '''caption''' [[Main Page]]
19275 image:foobar.jpg
19276 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19277 </gallery>
19278 !! html/php
19279 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19280 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19281 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19282 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19283 <div class="gallerytext">
19284 <p>caption
19285 </p>
19286 </div>
19287 </div></li>
19288 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19289 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19290 <div class="gallerytext">
19291 </div>
19292 </div></li>
19293 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19294 <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>
19295 <div class="gallerytext">
19296 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19297 </p>
19298 </div>
19299 </div></li>
19300 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19301 <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>
19302 <div class="gallerytext">
19303 </div>
19304 </div></li>
19305 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19306 <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>
19307 <div class="gallerytext">
19308 <p>blabla.
19309 </p>
19310 </div>
19311 </div></li>
19312 </ul>
19313
19314 !! html/parsoid
19315 <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"}}'>
19316 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19317 <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>
19318 <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>
19319 <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>
19320 <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>
19321 <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>
19322 </ul>
19323 !! end
19324
19325 !! test
19326 Gallery with link that has fragment
19327 !! options
19328 parsoid={
19329 "modes": ["wt2html", "html2html"],
19330 "nativeGallery": true
19331 }
19332 !! wikitext
19333 <gallery>
19334 image:foobar.jpg|link=Main_Page
19335 image:foobar.jpg|link=Main_Page#section
19336 image:foobar.jpg|link=Main Page#section|caption
19337 </gallery>
19338 !! html/php
19339 <ul class="gallery mw-gallery-traditional">
19340 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19341 <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>
19342 <div class="gallerytext">
19343 </div>
19344 </div></li>
19345 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19346 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
19347 <div class="gallerytext">
19348 </div>
19349 </div></li>
19350 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19351 <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>
19352 <div class="gallerytext">
19353 <p>caption
19354 </p>
19355 </div>
19356 </div></li>
19357 </ul>
19358
19359 !! html/parsoid
19360 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19361 <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>
19362 <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>
19363 <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>
19364 </ul>
19365 !! end
19366
19367 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19368 !! test
19369 Gallery with template inside caption
19370 !! options
19371 parsoid={
19372 "nativeGallery": true
19373 }
19374 !! wikitext
19375 <gallery caption="{{echo|hi}}">
19376 File:Foobar.jpg|{{echo|ho}}
19377 </gallery>
19378 !! html/php
19379 <ul class="gallery mw-gallery-traditional">
19380 <li class='gallerycaption'>{{echo|hi}}</li>
19381 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19382 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
19383 <div class="gallerytext">
19384 <p>ho
19385 </p>
19386 </div>
19387 </div></li>
19388 </ul>
19389
19390 !! html/parsoid
19391 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19392 <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>
19393 <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>
19394 </ul>
19395 !! end
19396
19397 !! test
19398 Gallery with wikitext inside caption
19399 !! options
19400 parsoid={
19401 "nativeGallery": true
19402 }
19403 !! wikitext
19404 <gallery>
19405 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19406 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19407 </gallery>
19408 !! html/php
19409 <ul class="gallery mw-gallery-traditional">
19410 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19411 <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>
19412 <div class="gallerytext">
19413 <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>
19414 </p>
19415 </div>
19416 </div></li>
19417 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19418 <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>
19419 <div class="gallerytext">
19420 <p>This is a test template
19421 </p>
19422 </div>
19423 </div></li>
19424 </ul>
19425
19426 !! html/parsoid
19427 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19428 <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>
19429 <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>
19430 </ul>
19431 !! end
19432
19433 !! test
19434 Gallery (with showfilename option)
19435 !! options
19436 parsoid={
19437 "nativeGallery": true
19438 }
19439 !! wikitext
19440 <gallery showfilename="">
19441 File:Nonexistent.jpg|caption
19442 File:Nonexistent.jpg
19443 File:Foobar.jpg|some '''caption''' [[Main Page]]
19444 File:Foobar.jpg
19445 </gallery>
19446 !! html/php
19447 <ul class="gallery mw-gallery-traditional">
19448 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19449 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19450 <div class="gallerytext">
19451 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19452 caption
19453 </p>
19454 </div>
19455 </div></li>
19456 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19457 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19458 <div class="gallerytext">
19459 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19460 </p>
19461 </div>
19462 </div></li>
19463 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19464 <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>
19465 <div class="gallerytext">
19466 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19467 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19468 </p>
19469 </div>
19470 </div></li>
19471 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19472 <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>
19473 <div class="gallerytext">
19474 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19475 </p>
19476 </div>
19477 </div></li>
19478 </ul>
19479
19480 !! html/parsoid
19481 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
19482 <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>
19483 <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>
19484 <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>
19485 <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>
19486 </ul>
19487 !! end
19488
19489 ## Should Parsoid be preserving these variations?
19490 !! test
19491 Gallery (with namespace-less filenames)
19492 !! options
19493 parsoid={
19494 "modes": ["wt2html", "html2html"],
19495 "nativeGallery": true
19496 }
19497 !! wikitext
19498 <gallery>
19499 File:Nonexistent.jpg
19500 Nonexistent.jpg
19501 image:foobar.jpg
19502 foobar.jpg
19503 </gallery>
19504 !! html/php
19505 <ul class="gallery mw-gallery-traditional">
19506 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19507 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19508 <div class="gallerytext">
19509 </div>
19510 </div></li>
19511 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19512 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19513 <div class="gallerytext">
19514 </div>
19515 </div></li>
19516 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19517 <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>
19518 <div class="gallerytext">
19519 </div>
19520 </div></li>
19521 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19522 <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>
19523 <div class="gallerytext">
19524 </div>
19525 </div></li>
19526 </ul>
19527
19528 !! html/parsoid
19529 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19530 <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>
19531 <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>
19532 <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>
19533 <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>
19534 </ul>
19535 !! end
19536
19537 !! test
19538 Gallery override link with WikiLink (T36852)
19539 !! options
19540 parsoid={
19541 "nativeGallery": true
19542 }
19543 !! wikitext
19544 <gallery>
19545 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
19546 </gallery>
19547 !! html/php
19548 <ul class="gallery mw-gallery-traditional">
19549 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19550 <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>
19551 <div class="gallerytext">
19552 </div>
19553 </div></li>
19554 </ul>
19555
19556 !! html/parsoid
19557 <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":{}}'>
19558 <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>
19559 </ul>
19560 !! end
19561
19562 !! test
19563 Gallery override link with absolute external link (T36852)
19564 !! options
19565 parsoid={
19566 "nativeGallery": true
19567 }
19568 !! wikitext
19569 <gallery>
19570 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
19571 </gallery>
19572 !! html/php
19573 <ul class="gallery mw-gallery-traditional">
19574 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19575 <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>
19576 <div class="gallerytext">
19577 </div>
19578 </div></li>
19579 </ul>
19580
19581 !! html/parsoid
19582 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19583 <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>
19584 </ul>
19585 !! end
19586
19587 !! test
19588 Gallery override link with absolute external link with LanguageConverter
19589 !! options
19590 language=zh
19591 !! input
19592 <gallery>
19593 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19594 </gallery>
19595 !! result
19596 <ul class="gallery mw-gallery-traditional">
19597 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19598 <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>
19599 <div class="gallerytext">
19600 <p>caption
19601 </p>
19602 </div>
19603 </div></li>
19604 </ul>
19605
19606 !! end
19607
19608 !! test
19609 Gallery override link with malicious javascript (T36852)
19610 !! options
19611 parsoid={
19612 "modes": ["wt2html", "html2html"],
19613 "nativeGallery": true
19614 }
19615 !! wikitext
19616 <gallery>
19617 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19618 </gallery>
19619 !! html/php
19620 <ul class="gallery mw-gallery-traditional">
19621 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19622 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%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>
19623 <div class="gallerytext">
19624 </div>
19625 </div></li>
19626 </ul>
19627
19628 !! html/parsoid
19629 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19630 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./%22_onclick=%22alert('malicious_javascript_code!');"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"></div></li>
19631 </ul>
19632 !! end
19633
19634 !! test
19635 Gallery with invalid title as link (T45964)
19636 !! options
19637 parsoid={
19638 "modes": ["wt2html", "html2html"],
19639 "nativeGallery": true
19640 }
19641 !! wikitext
19642 <gallery>
19643 File:Foobar.jpg|link=<
19644 </gallery>
19645 !! html/php
19646 <ul class="gallery mw-gallery-traditional">
19647 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19648 <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>
19649 <div class="gallerytext">
19650 </div>
19651 </div></li>
19652 </ul>
19653
19654 !! html/parsoid
19655 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19656 <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>
19657 </ul>
19658 !! end
19659
19660 !! test
19661 Serialize gallery without attrs in data-mw
19662 !! options
19663 parsoid={
19664 "modes": ["html2wt"],
19665 "nativeGallery": true
19666 }
19667 !! html/parsoid
19668 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
19669 <li class="gallerycaption">123</li>
19670 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Test.png</span></div><div class="gallerytext"></div></li>
19671 </ul>
19672 !! wikitext
19673 <gallery caption="123">
19674 File:Test.png
19675 </gallery>
19676 !! end
19677
19678 !! test
19679 Gallery with class attribute
19680 !! options
19681 parsoid={
19682 "nativeGallery": true
19683 }
19684 !! wikitext
19685 <gallery class="center">
19686 File:Foobar.jpg
19687 </gallery>
19688 !! html/php
19689 <ul class="gallery mw-gallery-traditional center">
19690 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19691 <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>
19692 <div class="gallerytext">
19693 </div>
19694 </div></li>
19695 </ul>
19696
19697 !! html/parsoid
19698 <ul class="gallery mw-gallery-traditional center" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"class":"center"},"body":{}}'>
19699 <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>
19700 </ul>
19701 !! end
19702
19703 !! test
19704 HTML Hex character encoding (spells the word "JavaScript")
19705 !! options
19706 parsoid=wt2html,wt2wt,html2html
19707 !! wikitext
19708 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19709 !! html/php
19710 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19711 </p>
19712 !! html/php+tidy
19713 <p>JavaScript</p>
19714 !! html/parsoid
19715 <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>
19716 !! end
19717
19718 !! test
19719 HTML Hex character encoding bogus encoding (T28437 regression check)
19720 !! wikitext
19721 &#xsee;&#XSEE;
19722 !! html/php
19723 <p>&amp;#xsee;&amp;#XSEE;
19724 </p>
19725 !! html/parsoid
19726 <p>&amp;#xsee;&amp;#XSEE;</p>
19727 !! end
19728
19729 !! test
19730 HTML Hex character encoding mixed case
19731 !! options
19732 parsoid=wt2html,wt2wt,html2html
19733 !! wikitext
19734 &#xEE;&#Xee;
19735 !! html/php
19736 <p>&#xee;&#xee;
19737 </p>
19738 !! html/php+tidy
19739 <p>îî</p>
19740 !! html/parsoid
19741 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19742 !! end
19743
19744 # See: https://www.w3.org/TR/html5/syntax.html#character-references
19745 # Note that U+000C (form feed) is not a valid XML character, so
19746 # it is banned even though allowed in HTML5.
19747 !! test
19748 Illegal character references (T106578)
19749 !! wikitext
19750 ; Null: &#00;
19751 ; FF: &#xC;
19752 ; CR: &#xD;
19753 ; Control (low): &#8;
19754 ; Control (high): &#x7F; &#x9F;
19755 ; Surrogate: &#xD83D;&#xDCA9;
19756 ; This is an okay astral character: &#x1F4A9;
19757 !! html+tidy
19758 <dl>
19759 <dt>Null</dt>
19760 <dd>&amp;#00;</dd>
19761 <dt>FF</dt>
19762 <dd>&amp;#xC;</dd>
19763 <dt>CR</dt>
19764 <dd>&amp;#xD;</dd>
19765 <dt>Control (low)</dt>
19766 <dd>&amp;#8;</dd>
19767 <dt>Control (high)</dt>
19768 <dd>&amp;#x7F; &amp;#x9F;</dd>
19769 <dt>Surrogate</dt>
19770 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19771 <dt>This is an okay astral character</dt>
19772 <dd>💩</dd>
19773 </dl>
19774 !! end
19775
19776 !! test
19777 __FORCETOC__ override
19778 !! wikitext
19779 __NEWSECTIONLINK__
19780 __FORCETOC__
19781 !! html/php
19782 <p><br />
19783 </p>
19784 !! end
19785
19786 !! test
19787 ISBN code coverage
19788 !! wikitext
19789 ISBN 978-0-1234-56&#x20;789
19790 !! html
19791 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19792 </p>
19793 !! html+tidy
19794 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19795 !! html/parsoid
19796 <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>
19797 !! end
19798
19799 !! test
19800 ISBN followed by 5 spaces
19801 !! wikitext
19802 ISBN
19803 !! html
19804 <p>ISBN
19805 </p>
19806 !! end
19807
19808 !! test
19809 Double ISBN
19810 !! wikitext
19811 ISBN ISBN 1234567890
19812 !! html/php
19813 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19814 </p>
19815 !! html/parsoid
19816 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19817 !! end
19818
19819 # Uppercase X and lowercase x as well
19820 !! test
19821 ISBN with an X
19822 !! wikitext
19823 ISBN 3-462-04561-X
19824 ISBN 3-462-04561-x
19825 ISBN 080442957X
19826 ISBN 080442957x
19827 ISBN 978080442957X
19828 ISBN 978080442957x
19829 !! html/php
19830 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19831 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19832 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19833 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19834 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19835 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19836 </p>
19837 !! html/parsoid
19838 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19839 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19840 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19841 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19842 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19843 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19844 !! end
19845
19846 !! test
19847 ISBN with empty prefix (parsoid test)
19848 !! wikitext
19849 ISBN 1234567890
19850 !! html/php
19851 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19852 </p>
19853 !! html/parsoid
19854 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19855 !! end
19856
19857 !! test
19858 T24905: <abbr> followed by ISBN followed by </a>
19859 !! wikitext
19860 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19861 !! html/php
19862 <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>
19863 </p>
19864 !! html/parsoid
19865 <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>
19866 !! end
19867
19868 !! test
19869 Double RFC
19870 !! wikitext
19871 RFC RFC 1234
19872 !! html
19873 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19874 </p>
19875 !! end
19876
19877 !! test
19878 Double RFC with a wiki link
19879 !! wikitext
19880 RFC [[RFC 1234]]
19881 !! html
19882 <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>
19883 </p>
19884 !! end
19885
19886 !! test
19887 RFC code coverage
19888 !! wikitext
19889 RFC 983&#x20;987
19890 !! html
19891 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19892 </p>
19893 !! html+tidy
19894 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19895 !! end
19896
19897 !! test
19898 Centre-aligned image
19899 !! wikitext
19900 [[Image:foobar.jpg|centre]]
19901 !! html
19902 <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>
19903
19904 !!end
19905
19906 !! test
19907 None-aligned image
19908 !! wikitext
19909 [[Image:foobar.jpg|none]]
19910 !! html
19911 <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>
19912
19913 !!end
19914
19915 !! test
19916 Width + Height sized image (using px) (height is ignored)
19917 !! wikitext
19918 [[Image:foobar.jpg|640x480px]]
19919 !! html
19920 <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>
19921 </p>
19922 !!end
19923
19924 !! test
19925 Width-sized image (using px, no following whitespace)
19926 !! wikitext
19927 [[Image:foobar.jpg|640px]]
19928 !! html
19929 <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>
19930 </p>
19931 !!end
19932
19933 !! test
19934 Width-sized image (using px, with following whitespace - test regression from r39467)
19935 !! wikitext
19936 [[Image:foobar.jpg|640px ]]
19937 !! html
19938 <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>
19939 </p>
19940 !!end
19941
19942 !! test
19943 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19944 !! wikitext
19945 [[Image:foobar.jpg| 640px]]
19946 !! html
19947 <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>
19948 </p>
19949 !!end
19950
19951 !! test
19952 Image with page parameter
19953 !! options
19954 djvu
19955 !! wikitext
19956 [[File:LoremIpsum.djvu|page=2]]
19957 !! html/php
19958 <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>
19959 </p>
19960 !! html/parsoid
19961 <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>
19962 !! end
19963
19964 !! test
19965 Another italics / bold test
19966 !! wikitext
19967 ''' ''x'
19968 !! html
19969 <pre>'<i> </i>x'
19970 </pre>
19971 !!end
19972
19973 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19974 !! test
19975 dt/dd/dl test
19976 !! wikitext
19977 :;;;::
19978 !! html/php
19979 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19980
19981 !! html/parsoid
19982 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19983
19984 !!end
19985
19986 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19987 !! test
19988 Images with the "|" character in the comment
19989 !! wikitext
19990 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19991 !! html/php
19992 <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>
19993
19994 !! html/parsoid
19995 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>An <a rel="mw:ExtLink" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx" data-parsoid='{"a":{"href":"http://test/?param1=%7Cleft%7C&amp;param2=%7Cx"},"sa":{"href":"http://test/?param1=|left|&amp;param2=|x"}}'>external</a> URL</figcaption></figure>
19996 !! end
19997
19998 !! test
19999 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
20000 !! wikitext
20001 <html><script>alert(1);</script></html>
20002 !! html
20003 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
20004 </p>
20005 !! end
20006
20007 !! test
20008 HTML with raw HTML ($wgRawHtml==true)
20009 !! options
20010 wgRawHtml=1
20011 !! wikitext
20012 <html><script>alert(1);</script></html>
20013 !! html
20014 <p><script>alert(1);</script>
20015 </p>
20016 !! end
20017
20018 !! test
20019 Parents of subpages, one level up
20020 !! options
20021 subpage title=[[Subpage test/L1/L2/L3]]
20022 !! wikitext
20023 [[../|L2]]
20024 !! html
20025 <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>
20026 </p>
20027 !! end
20028
20029
20030 !! test
20031 Parents of subpages, one level up, not named
20032 !! options
20033 subpage title=[[Subpage test/L1/L2/L3]]
20034 !! wikitext
20035 [[../]]
20036 !! html
20037 <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>
20038 </p>
20039 !! end
20040
20041
20042
20043 !! test
20044 Parents of subpages, two levels up
20045 !! options
20046 subpage title=[[Subpage test/L1/L2/L3]]
20047 !! wikitext
20048 [[../../|L1]]2
20049
20050 [[../../|L1]]l
20051 !! html
20052 <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
20053 </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>
20054 </p>
20055 !! end
20056
20057 !! test
20058 Parents of subpages, two levels up, without trailing slash or name.
20059 !! options
20060 subpage title=[[Subpage test/L1/L2/L3]]
20061 !! wikitext
20062 [[../..]]
20063 !! html
20064 <p>[[../..]]
20065 </p>
20066 !! end
20067
20068 !! test
20069 Parents of subpages, two levels up, with lots of extra trailing slashes.
20070 !! options
20071 subpage title=[[Subpage test/L1/L2/L3]]
20072 !! wikitext
20073 [[../../////]]
20074 !! html
20075 <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>
20076 </p>
20077 !! end
20078
20079 !! article
20080 Subpage test/L1/L2/L3Sibling
20081 !! text
20082 Sibling article
20083 !! endarticle
20084
20085 !! test
20086 Transclusion of a sibling page (one level up)
20087 !! options
20088 subpage title=[[Subpage test/L1/L2/L3]]
20089 !! wikitext
20090 {{../L3Sibling}}
20091 !! html
20092 <p>Sibling article
20093 </p>
20094 !! end
20095
20096 !! test
20097 Transclusion of a child page
20098 !! options
20099 subpage title=[[Subpage test/L1/L2]]
20100 !! wikitext
20101 {{/L3Sibling}}
20102 !! html
20103 <p>Sibling article
20104 </p>
20105 !! end
20106
20107 # This is wt2html only in Parsoid because we add <nowiki>
20108 # because of {{..}} and we don't expect to fix that to
20109 # eliminate the nowikis selective for {{..}} markup.
20110 !! test
20111 Non-transclusion because of too many up levels
20112 !! options
20113 subpage title=[[Subpage test/L1/L2/L3]]
20114 parsoid=wt2html
20115 !! wikitext
20116 {{../../../../More than parent}}
20117 !! html/php
20118 <p>{{../../../../More than parent}}
20119 </p>
20120 !! html/parsoid
20121 <p>{{../../../../More than parent}}</p>
20122 !! end
20123
20124 !! test
20125 Definition list code coverage
20126 !! wikitext
20127 ; title : def
20128 ; title : def
20129 ;title: def
20130 !! html/php
20131 <dl><dt> title &#160;</dt>
20132 <dd> def</dd>
20133 <dt> title&#160;</dt>
20134 <dd> def</dd>
20135 <dt>title</dt>
20136 <dd> def</dd></dl>
20137
20138 !! html/parsoid
20139 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20140 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20141 <dt>title</dt><dd> def</dd></dl>
20142 !! end
20143
20144 !! test
20145 Don't fall for the self-closing div
20146 !! wikitext
20147 <div>hello world</div/>
20148 !! html
20149 <div>hello world</div>
20150
20151 !! end
20152
20153 !! test
20154 MSGNW magic word
20155 !! wikitext
20156 {{MSGNW:msg}}
20157 !! html/php
20158 <p>&#91;&#91;:Template:Msg&#93;&#93;
20159 </p>
20160 !! end
20161
20162 !! test
20163 RAW magic word
20164 !! wikitext
20165 {{RAW:QUERTY}}
20166 !! html
20167 <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>
20168 </p>
20169 !! end
20170
20171 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
20172 !! test
20173 Always escape literal '>' in output, not just after '<'
20174 !! wikitext
20175 ><>
20176 !! html
20177 <p>&gt;&lt;&gt;
20178 </p>
20179 !! end
20180
20181 !! test
20182 Template caching
20183 !! wikitext
20184 {{Test}}
20185 {{Test}}
20186 !! html
20187 <p>This is a test template
20188 This is a test template
20189 </p>
20190 !! end
20191
20192
20193 !! article
20194 MediaWiki:Fake
20195 !! text
20196 ==header==
20197 !! endarticle
20198
20199 !! test
20200 Inclusion of !userCanEdit() content
20201 !! wikitext
20202 {{MediaWiki:Fake}}
20203 !! html
20204 <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>
20205
20206 !! end
20207
20208
20209 !! test
20210 Out-of-order TOC heading levels
20211 !! wikitext
20212 ==2==
20213 ======6======
20214 ===3===
20215 =1=
20216 =====5=====
20217 ==2==
20218 !! html
20219 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20220 <ul>
20221 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
20222 <ul>
20223 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
20224 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
20225 </ul>
20226 </li>
20227 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
20228 <ul>
20229 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
20230 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
20231 </ul>
20232 </li>
20233 </ul>
20234 </div>
20235
20236 <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>
20237 <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>
20238 <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>
20239 <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>
20240 <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>
20241 <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>
20242
20243 !! end
20244
20245
20246 !! test
20247 ISBN with a dummy number
20248 !! wikitext
20249 ISBN ---
20250 !! html
20251 <p>ISBN ---
20252 </p>
20253 !! end
20254
20255
20256 !! test
20257 ISBN with space-delimited number
20258 !! wikitext
20259 ISBN 92 9017 032 8
20260 !! html
20261 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
20262 </p>
20263 !! end
20264
20265
20266 !! test
20267 ISBN with multiple spaces, no number
20268 !! wikitext
20269 ISBN foo
20270 !! html
20271 <p>ISBN foo
20272 </p>
20273 !! end
20274
20275
20276 !! test
20277 ISBN length
20278 !! wikitext
20279 ISBN 123456789
20280
20281 ISBN 1234567890
20282
20283 ISBN 12345678901
20284 !! html
20285 <p>ISBN 123456789
20286 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20287 </p><p>ISBN 12345678901
20288 </p>
20289 !! end
20290
20291
20292 !! test
20293 ISBN with trailing year (T9110)
20294 !! wikitext
20295 ISBN 1-234-56789-0 - 2006
20296
20297 ISBN 1 234 56789 0 - 2006
20298 !! html
20299 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
20300 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20301 </p>
20302 !! end
20303
20304
20305 !! test
20306 anchorencode
20307 !! wikitext
20308 {{anchorencode:foo bar©#%n}}
20309 !! html
20310 <p>foo_bar.C2.A9.23.25n
20311 </p>
20312 !! end
20313
20314 !! test
20315 anchorencode trims spaces
20316 !! wikitext
20317 {{anchorencode: __pretty__please__}}
20318 !! html
20319 <p>pretty_please
20320 </p>
20321 !! end
20322
20323 !! test
20324 anchorencode deals with links
20325 !! wikitext
20326 {{anchorencode: [[hello|world]] [[hi]]}}
20327 !! html
20328 <p>world_hi
20329 </p>
20330 !! end
20331
20332 !! test
20333 anchorencode deals with templates
20334 !! wikitext
20335 {{anchorencode: {{Foo}} }}
20336 !! html
20337 <p>FOO
20338 </p>
20339 !! end
20340
20341 !! test
20342 anchorencode encodes like the TOC generator: (T20431)
20343 !! wikitext
20344 === _ +:.3A%3A&&amp;]] ===
20345 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20346 __NOEDITSECTION__
20347 !! html
20348 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20349 <p>.2B:.3A.253A.26.26.5D.5D
20350 </p>
20351 !! end
20352
20353 !! test
20354 T8200: blockquotes and paragraph formatting
20355 !! wikitext
20356 <blockquote>
20357 foo
20358 </blockquote>
20359
20360 bar
20361
20362 baz
20363 !! html
20364 <blockquote>
20365 <p>foo
20366 </p>
20367 </blockquote>
20368 <p>bar
20369 </p>
20370 <pre>baz
20371 </pre>
20372 !! end
20373
20374 !! test
20375 T10293: Use of center tag ruins paragraph formatting
20376 !! wikitext
20377 <center>
20378 foo
20379 </center>
20380
20381 bar
20382
20383 baz
20384 !! html
20385 <center>
20386 <p>foo
20387 </p>
20388 </center>
20389 <p>bar
20390 </p>
20391 <pre>baz
20392 </pre>
20393 !! end
20394
20395 !!test
20396 Parsing of overlapping (improperly nested) inline html tags
20397 !! wikitext
20398 <span><s>x</span></s>
20399 !! html/php
20400 <p><span><s>x&lt;/span&gt;</s></span>
20401 </p>
20402 !! html/parsoid
20403 <p><span><s>x</s></span>
20404 </p>
20405 !!end
20406
20407 ###
20408 ### Language variants related tests
20409 ###
20410 !! test
20411 Self-link in language variants
20412 !! options
20413 title=[[Dunav]] language=sr
20414 !! wikitext
20415 Both [[Dunav]] and [[Дунав]] are names for this river.
20416 !! html
20417 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
20418 </p>
20419 !!end
20420
20421 !! article
20422 Дуна
20423 !! text
20424 content
20425 !! endarticle
20426
20427 !! test
20428 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
20429 !! options
20430 title=[[Duna]] language=sr
20431 !! wikitext
20432 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
20433 !! html
20434 <p><a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Дуна</a> is not a self-link while <a class="mw-selflink selflink">Duna</a> and <a class="mw-selflink selflink">Dуна</a> are still self-links.
20435 </p>
20436 !! end
20437
20438 !! test
20439 Link to a section of a variant of this title shouldn't be parsed as self-link
20440 !! options
20441 title=[[Duna]] language=sr
20442 !! wikitext
20443 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
20444 !! html
20445 <p><a class="mw-selflink selflink">Dуна</a> is a self-link while <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dunа#Foo</a> and <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dуна#Foo</a> are not self-links.
20446 </p>
20447 !! end
20448
20449 !! test
20450 Link to pages in language variants
20451 !! options
20452 language=sr
20453 !! wikitext
20454 Main Page can be written as [[Маин Паге]]
20455 !! html
20456 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
20457 </p>
20458 !!end
20459
20460
20461 !! test
20462 Multiple links to pages in language variants
20463 !! options
20464 language=sr
20465 !! wikitext
20466 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
20467 !! html
20468 <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>.
20469 </p>
20470 !!end
20471
20472
20473 !! test
20474 Simple template in language variants
20475 !! options
20476 language=sr
20477 !! wikitext
20478 {{тест}}
20479 !! html
20480 <p>This is a test template
20481 </p>
20482 !! end
20483
20484
20485 !! test
20486 Template with explicit namespace in language variants
20487 !! options
20488 language=sr
20489 !! wikitext
20490 {{Template:тест}}
20491 !! html
20492 <p>This is a test template
20493 </p>
20494 !! end
20495
20496
20497 !! test
20498 Basic test for template parameter in language variants
20499 !! options
20500 language=sr
20501 !! wikitext
20502 {{парамтест|param=foo}}
20503 !! html
20504 <p>This is a test template with parameter foo
20505 </p>
20506 !! end
20507
20508 !! test
20509 Simple category in language variants
20510 !! options
20511 language=sr cat
20512 !! wikitext
20513 [[Category:МедиаWики Усер'с Гуиде]]
20514 !! html/php
20515 cat=МедиаWики_Усер'с_Гуиде sort=
20516 !! html/parsoid
20517 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
20518 !! end
20519
20520 !! article
20521 Category:分类
20522 !! text
20523 blah
20524 !! endarticle
20525
20526 !! article
20527 Category:分類
20528 !! text
20529 blah
20530 !! endarticle
20531
20532 ## We used to, but no longer wt2wt this test since the default serializer
20533 ## will normalize all categories to serialize on their own line.
20534 ## This wikitext usage is going to be fairly uncommon in production and
20535 ## selser will take care of preserving formatting in those scenarios.
20536 !! test
20537 Don't convert blue categorylinks to another variant (T35210)
20538 !! options
20539 cat
20540 language=zh
20541 parsoid=wt2html
20542 !! wikitext
20543 [[A]][[Category:分类]]
20544 !! html/php
20545 cat=分类 sort=
20546 !! html/parsoid
20547 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
20548 <link rel="mw:PageProp/Category" href="./Category:分类"/>
20549 !! end
20550
20551 !! test
20552 Stripping -{}- tags (language variants)
20553 !! options
20554 language=sr
20555 !! wikitext
20556 Latin proverb: -{Ne nuntium necare}-
20557 !! html
20558 <p>Latin proverb: Ne nuntium necare
20559 </p>
20560 !! end
20561
20562
20563 !! test
20564 Prevent conversion with -{}- tags (language variants)
20565 !! options
20566 language=sr variant=sr-ec
20567 !! wikitext
20568 Latinski: -{Ne nuntium necare}-
20569 !! html
20570 <p>Латински: Ne nuntium necare
20571 </p>
20572 !! end
20573
20574
20575 !! test
20576 Prevent conversion of text with -{}- tags (language variants)
20577 !! options
20578 language=sr variant=sr-ec
20579 !! wikitext
20580 Latinski: -{Ne nuntium necare}-
20581 !! html
20582 <p>Латински: Ne nuntium necare
20583 </p>
20584 !! end
20585
20586
20587 !! test
20588 Prevent conversion of links with -{}- tags (language variants)
20589 !! options
20590 language=sr variant=sr-ec
20591 !! wikitext
20592 -{[[Main Page]]}-
20593 !! html
20594 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20595 </p>
20596 !! end
20597
20598
20599 !! test
20600 -{}- tags within headlines (within html for parserConvert())
20601 !! options
20602 language=sr variant=sr-ec
20603 !! wikitext
20604 == -{Naslov}- ==
20605 !! html
20606 <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>
20607
20608 !! end
20609
20610
20611 !! test
20612 Explicit definition of language variant alternatives
20613 !! options
20614 language=zh variant=zh-tw
20615 !! wikitext
20616 -{zh:China;zh-tw:Taiwan}-, not China
20617 !! html
20618 <p>Taiwan, not China
20619 </p>
20620 !! end
20621
20622
20623 !! test
20624 Conversion around HTML tags
20625 !! options
20626 language=sr variant=sr-ec
20627 !! wikitext
20628 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
20629 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
20630 !! html
20631 <p>
20632 <span title="ЛаCтин">ски</span>
20633 </p>
20634 !! end
20635
20636
20637 !! test
20638 Explicit session-wise language variant mapping (A flag and - flag)
20639 !! options
20640 language=zh variant=zh-tw
20641 !! wikitext
20642 Taiwan is not China.
20643 But -{A|zh:China;zh-tw:Taiwan}- is China,
20644 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20645 and -{China}- is China.
20646 !! html
20647 <p>Taiwan is not China.
20648 But Taiwan is Taiwan,
20649 (This should be stripped!)
20650 and China is China.
20651 </p>
20652 !! end
20653
20654 !! test
20655 Explicit session-wise language variant mapping (H flag for hide)
20656 !! options
20657 language=zh variant=zh-tw
20658 !! wikitext
20659 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20660 Taiwan is China.
20661 !! html
20662 <p>(This should be stripped!)
20663 Taiwan is Taiwan.
20664 </p>
20665 !! end
20666
20667 !! test
20668 Adding explicit conversion rule for title (T flag)
20669 !! options
20670 language=zh variant=zh-tw showtitle
20671 !! wikitext
20672 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20673 !! html
20674 Taiwan
20675 <p>Should be stripped!
20676 </p>
20677 !! end
20678
20679 !! test
20680 Testing that changing the language variant here in the tests actually works
20681 !! options
20682 language=zh variant=zh showtitle
20683 !! wikitext
20684 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20685 !! html
20686 China
20687 <p>Should be stripped!
20688 </p>
20689 !! end
20690
20691 !! test
20692 Recursive conversion of alt and title attrs shouldn't clear converter state
20693 !! options
20694 language=zh variant=zh-cn showtitle
20695 !! wikitext
20696 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20697 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20698 !! html
20699 China
20700 <p>
20701 Should be stripped<span title="Exclamation">!</span>
20702 </p>
20703 !! end
20704
20705 !! test
20706 T26072: more test on conversion rule for title
20707 !! options
20708 language=zh variant=zh-tw showtitle
20709 !! wikitext
20710 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20711 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20712 !! html
20713 Taiwan
20714 <p>This should be stripped!
20715 This won't take interferes with the title rule.
20716 </p>
20717 !! end
20718
20719 !! test
20720 Partly disable title conversion if variant == main language code
20721 !! options
20722 language=zh variant=zh title=[[ZH]] showtitle
20723 !! wikitext
20724 -{T|zh-cn:CN;zh-tw:TW}-
20725 !! html
20726 ZH
20727 <p>
20728 </p>
20729 !! end
20730
20731 !! test
20732 Partly disable title conversion if variant == main language code, more
20733 !! options
20734 language=zh variant=zh title=[[ZH]] showtitle
20735 !! wikitext
20736 -{T|TW}-
20737 !! html
20738 ZH
20739 <p>
20740 </p>
20741 !! end
20742
20743 !! test
20744 Raw output of variant escape tags (R flag)
20745 !! options
20746 language=zh variant=zh-tw
20747 !! wikitext
20748 Raw: -{R|zh:China;zh-tw:Taiwan}-
20749 !! html
20750 <p>Raw: zh:China;zh-tw:Taiwan
20751 </p>
20752 !! end
20753
20754 !! test
20755 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20756 !! options
20757 language=zh variant=zh-cn
20758 !! input
20759 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20760 !! result
20761 <p>0
20762 </p>
20763 !! end
20764
20765 !! test
20766 Conversion rules from [numeric-only string] to [something else] (T48634)
20767 !! options
20768 language=zh variant=zh-cn
20769 !! input
20770 -{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
20771 !! result
20772 <p>D12345EE12345
20773 </p>
20774 !! end
20775
20776 !! test
20777 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20778 !! options
20779 language=zh variant=zh-cn
20780 !! input
20781 -{H|zh-cn:foo;zh-tw:;}-foobar
20782 !! result
20783 <p>foobar
20784 </p>
20785 !! end
20786
20787 !! test
20788 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20789 !! options
20790 language=zh variant=zh-cn
20791 !! input
20792 -{H|=>zh-cn:foo;}-foobar
20793 !! result
20794 <p>foobar
20795 </p>
20796 !! end
20797
20798 !! test
20799 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20800 !! options
20801 language=zh variant=zh-cn
20802 !! input
20803 -{H|}-foobar
20804 !! result
20805 <p>foobar
20806 </p>
20807 !! end
20808
20809 !! test
20810 Nested using of manual convert syntax
20811 !! options
20812 language=zh variant=zh-hk
20813 !! wikitext
20814 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20815 !! html
20816 <p>Nested: Hello Hong Kong!
20817 </p>
20818 !! end
20819
20820 !! test
20821 HTML markups with conversion syntax in attribs, nested in other conversion blocks
20822 !! options
20823 language=zh variant=zh-cn
20824 !! wikitext
20825 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
20826 !! html
20827 <p><span title="X">A</span>
20828 </p>
20829 !! end
20830
20831 !! test
20832 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet)
20833 !! options
20834 language=zh variant=zh-cn disabled
20835 !! wikitext
20836 -{<span title="-{X}-">A</span>}-
20837 !! html
20838 <p><span title="X">A</span>
20839 </p>
20840 !! end
20841
20842 # Since Parsoid is starting to emit canonical wikitext for links,
20843 # [http://example.com http://example.com] will not RT back to that
20844 # form anymore.
20845 !! test
20846 Proper conversion of text in external links
20847 !! options
20848 language=sr variant=sr-ec
20849 parsoid=wt2html
20850 !! wikitext
20851 http://www.google.com
20852 gopher://www.google.com
20853 [http://www.google.com http://www.google.com]
20854 [gopher://www.google.com gopher://www.google.com]
20855 [https://www.google.com irc://www.google.com]
20856 [ftp://www.google.com www.google.com/ftp://dir]
20857 [//www.google.com www.google.com]
20858 !! html/php
20859 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20860 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20861 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20862 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20863 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20864 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20865 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20866 </p>
20867 !! html/parsoid
20868 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20869 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20870 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20871 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20872 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20873 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20874 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20875 !! end
20876
20877 !! test
20878 Do not convert roman numbers to language variants
20879 !! options
20880 language=sr variant=sr-ec
20881 !! wikitext
20882 Fridrih IV je car.
20883 !! html
20884 <p>Фридрих IV је цар.
20885 </p>
20886 !! end
20887
20888 !! test
20889 Unclosed language converter markup "-{"
20890 !! options
20891 language=sr
20892 !! wikitext
20893 -{T|hello
20894 !! html
20895 <p>-{T|hello
20896 </p>
20897 !! end
20898
20899 !! test
20900 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20901 !! options
20902 language=sr
20903 !! wikitext
20904 -{R|=&gt;}-
20905 !! html
20906 <p>=&gt;
20907 </p>
20908 !!end
20909
20910 !! test
20911 Don't break link parsing if language converter markup is in the caption.
20912 !! options
20913 language=sr variant=sr-ec
20914 !! wikitext
20915 [[Main Page|-{R|main page}-]]
20916 !! html
20917 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20918 </p>
20919 !! end
20920
20921 # FIXME: This test is currently broken in the PHP parser T153761
20922 !! test
20923 T146304: Don't break template parsing if language converter markup is in the parameter.
20924 !! options
20925 language=sr variant=sr-ec
20926 disabled
20927 !! wikitext
20928 {{echo|-{R|foo}-}}
20929 !! html/php
20930 <p>foo
20931 </p>
20932 !! end
20933
20934 !! test
20935 T146305: Don't break image parsing if language converter markup is in the caption.
20936 !! options
20937 language=sr
20938 !! wikitext
20939 [[File:Foobar.jpg|thumb|-{R|caption:}-]]
20940 !! html/php
20941 <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>
20942
20943 !! html/parsoid
20944 <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>
20945 !! end
20946
20947 !! test
20948 T146305: Don't break image parsing if nested language converter markup is in the caption.
20949 !! options
20950 language=zh variant=zh-cn
20951 !! wikitext
20952 [[File:Foobar.jpg|thumb|-{zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
20953 !! html/php
20954 <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>
20955
20956 !! html/parsoid
20957 <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>
20958 !! end
20959
20960 !! test
20961 Don't break gallery if language converter markup is inside.
20962 !! options
20963 language=zh
20964 !! wikitext
20965 <gallery>
20966 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
20967 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
20968 </gallery>
20969 !! html
20970 <ul class="gallery mw-gallery-traditional">
20971 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20972 <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>
20973 <div class="gallerytext">
20974 <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>
20975 </p>
20976 </div>
20977 </div></li>
20978 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20979 <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>
20980 <div class="gallerytext">
20981 <p>This is a test template
20982 </p>
20983 </div>
20984 </div></li>
20985 </ul>
20986
20987 !! end
20988
20989 !! test
20990 T153135: Don't break list handling if language converter markup is in the item.
20991 !! options
20992 language=zh variant=zh-cn
20993 !! wikitext
20994 ;-{zh-cn:AAA;zh-tw:BBB}-
20995 ;-{R|foo:bar}-
20996 !! html/php
20997 <dl><dt>AAA</dt>
20998 <dt>foo:bar</dt></dl>
20999
21000 !! html/parsoid
21001 <dl>
21002 <dt><span typeof="mw:LanguageVariant" data-mw='{"bidir":[{"l":"zh-cn","t":"AAA"},{"l":"zh-tw","t":"BBB"}],"show":true}'></span></dt>
21003 <dt><span typeof="mw:LanguageVariant" data-mw='{"disabled":true,"show":true,"text":"foo:bar"}'></span></dt>
21004 </dl>
21005 !! end
21006
21007 // Note that parsoid does not protect colons unless language converter
21008 // markup is properly nested, because it is a backtracking parser.
21009 !! test
21010 T153135: Unclosed markup in definition list (code coverage)
21011 !! options
21012 language=zh variant=zh-cn
21013 !! wikitext
21014 ;<b>foo:bar
21015 ;-{zh-cn:AAA
21016 !! html/php
21017 <dl><dt><b>foo:bar</dt>
21018 <dt>-{zh-cn:AAA</b></dt></dl>
21019
21020 !! html/parsoid
21021 <dl>
21022 <dt><b>foo:bar</b></dt>
21023 <b>
21024 <dt>-{zh-cn</dt>
21025 <dd>AAA</dd>
21026 </b></dl>
21027 !! end
21028
21029 !! test
21030 T153135: Nested language converter markup in definition list (code coverage)
21031 !! options
21032 language=zh variant=zh-cn
21033 !! wikitext
21034 ;-{zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
21035 !! html/php
21036 <dl><dt>AAA foo:bar bat:baz</dt>
21037 <dd>def</dd></dl>
21038
21039 !! html/parsoid
21040 <dl>
21041 <dt><span typeof="mw:LanguageVariant" data-mw='{"bidir":[{"l":"zh-cn","t":"AAA &lt;span typeof=\"mw:LanguageVariant\" data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[13,32,null,2]}&#39; data-mw=&#39;{\"filter\":[\"zh-hans\"],\"text\":\"bar\"}&#39;>&lt;/span> &lt;span typeof=\"mw:LanguageVariant\" data-parsoid=&#39;{\"fl\":[\"R\"],\"dsr\":[33,46,null,2]}&#39; data-mw=&#39;{\"disabled\":true,\"show\":true,\"text\":\"bat:baz\"}&#39;>&lt;/span>"}],"show":true}'></span></dt>
21042 <dd>def</dd>
21043 </dl>
21044 !! end
21045
21046 !! test
21047 T153140: Don't break table handling if language converter markup is in the cell.
21048 !! options
21049 language=sr variant=sr-ec
21050 !! wikitext
21051 {|
21052 |-
21053 | -{R|B}-
21054 |}
21055 !! html/php
21056 <table>
21057
21058 <tr>
21059 <td> B
21060 </td></tr></table>
21061
21062 !! html/parsoid
21063 <table>
21064
21065 <tr>
21066 <td> B
21067 </td></tr></table>
21068
21069 !! end
21070
21071 !! test
21072 T2529: Uncovered bullet
21073 !! wikitext
21074 * Foo {{bullet}}
21075 !! html
21076 <ul><li> Foo </li>
21077 <li> Bar</li></ul>
21078
21079 !! end
21080
21081 # Plain MediaWiki does not remove empty lists, but tidy actually does.
21082 # Templates in Wikipedia rely on this behavior, as tidy has always been
21083 # enabled there. These tests are normally run *without* tidy, so specify the
21084 # full output here.
21085 # To test realistic parsing behavior, apply a tidy-like transformation to both
21086 # the expected output and your parser's output.
21087 !! test
21088 T2529: Uncovered bullet leaving empty list, normally removed by tidy
21089 !! wikitext
21090 ******* Foo {{bullet}}
21091 !! html
21092 <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>
21093 <li> Bar</li></ul>
21094
21095 !! end
21096
21097 !! test
21098 T2529: Uncovered table already at line-start
21099 !! wikitext
21100 x
21101
21102 {{table}}
21103 y
21104 !! html
21105 <p>x
21106 </p>
21107 <table>
21108 <tr>
21109 <td> 1 </td>
21110 <td> 2
21111 </td></tr>
21112 <tr>
21113 <td> 3 </td>
21114 <td> 4
21115 </td></tr></table>
21116 <p>y
21117 </p>
21118 !! end
21119
21120 !! test
21121 T2529: Uncovered bullet in parser function result
21122 !! wikitext
21123 * Foo {{lc:{{bullet}} }}
21124 !! html
21125 <ul><li> Foo </li>
21126 <li> bar</li></ul>
21127
21128 !! end
21129
21130 !! test
21131 T7678: Double-parsed template argument
21132 !! wikitext
21133 {{lc:{{{1}}}|hello}}
21134 !! html
21135 <p>{{{1}}}
21136 </p>
21137 !! end
21138
21139 !! test
21140 T7678: Double-parsed template invocation
21141 !! wikitext
21142 {{lc:{{paramtest {{!}} param = hello }} }}
21143 !! html
21144 <p>{{paramtest | param = hello }}
21145 </p>
21146 !! end
21147
21148 !! test
21149 Case insensitivity of parser functions for non-ASCII characters (T10143)
21150 !! options
21151 language=cs
21152 title=[[Main Page]]
21153 !! wikitext
21154 {{PRVNÍVELKÉ:ěščř}}
21155 {{prvnívelké:ěščř}}
21156 {{PRVNÍMALÉ:ěščř}}
21157 {{prvnímalé:ěščř}}
21158 {{MALÁ:ěščř}}
21159 {{malá:ěščř}}
21160 {{VELKÁ:ěščř}}
21161 {{velká:ěščř}}
21162 !! html
21163 <p>Ěščř
21164 Ěščř
21165 ěščř
21166 ěščř
21167 ěščř
21168 ěščř
21169 ĚŠČŘ
21170 ĚŠČŘ
21171 </p>
21172 !! end
21173
21174 !! test
21175 Morwen/13: Unclosed link followed by heading
21176 !! wikitext
21177 [[link
21178 ==heading==
21179 !! html
21180 <p>[[link
21181 </p>
21182 <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>
21183
21184 !! end
21185
21186 !! test
21187 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
21188 !! wikitext
21189 {{foo|
21190 =heading=
21191 !! html
21192 <p>{{foo|
21193 </p>
21194 <h1><span class="mw-headline" id="heading">heading</span></h1>
21195
21196 !! end
21197
21198 !! test
21199 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
21200 !! wikitext
21201 {{foo|
21202 ==heading==
21203 !! html
21204 <p>{{foo|
21205 </p>
21206 <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>
21207
21208 !! end
21209
21210 !! test
21211 Tildes in comments
21212 !! options
21213 pst
21214 !! wikitext
21215 <!-- ~~~~ -->
21216 !! html/php
21217 <!-- ~~~~ -->
21218 !! end
21219
21220 !! test
21221 Paragraphs inside divs (no extra line breaks)
21222 !! wikitext
21223 <div>Line one
21224
21225 Line two</div>
21226 !! html
21227 <div>Line one
21228 Line two</div>
21229
21230 !! end
21231
21232 !! test
21233 Paragraphs inside divs (extra line break on open)
21234 !! wikitext
21235 <div>
21236 Line one
21237
21238 Line two</div>
21239 !! html
21240 <div>
21241 <p>Line one
21242 </p>
21243 Line two</div>
21244
21245 !! end
21246
21247 !! test
21248 Paragraphs inside divs (extra line break on close)
21249 !! wikitext
21250 <div>Line one
21251
21252 Line two
21253 </div>
21254 !! html
21255 <div>Line one
21256 <p>Line two
21257 </p>
21258 </div>
21259
21260 !! end
21261
21262 !! test
21263 Paragraphs inside divs (extra line break on open and close)
21264 !! wikitext
21265 <div>
21266 Line one
21267
21268 Line two
21269 </div>
21270 !! html
21271 <div>
21272 <p>Line one
21273 </p><p>Line two
21274 </p>
21275 </div>
21276
21277 !! end
21278
21279 !! test
21280 Nesting tags, paragraphs on lines which begin with <div>
21281 !! wikitext
21282 <div></div><strong>A
21283 B</strong>
21284 !! html/php+tidy
21285 <p><strong>A</strong></p>
21286 <p><strong>B</strong></p>
21287 !! html/parsoid
21288 <div></div>
21289 <p><strong>A
21290 B</strong>
21291 </p>
21292 !! end
21293
21294 # T8200: <blockquote> should behave like <div> with respect to line breaks
21295 !! test
21296 T8200: paragraphs inside blockquotes (no extra line breaks)
21297 !! wikitext
21298 <blockquote>Line one
21299
21300 Line two</blockquote>
21301 !! html
21302 <blockquote>Line one
21303 Line two</blockquote>
21304
21305 !! html+tidy
21306 <blockquote>
21307 <p>Line one Line two</p>
21308 </blockquote>
21309 !! end
21310
21311 !! test
21312 T8200: paragraphs inside blockquotes (extra line break on open)
21313 !! wikitext
21314 <blockquote>
21315 Line one
21316
21317 Line two</blockquote>
21318 !! html
21319 <blockquote>
21320 <p>Line one
21321 </p>
21322 Line two</blockquote>
21323
21324 !! html+tidy
21325 <blockquote>
21326 <p>Line one</p>
21327 Line two</blockquote>
21328 !! end
21329
21330 !! test
21331 T8200: paragraphs inside blockquotes (extra line break on close)
21332 !! wikitext
21333 <blockquote>Line one
21334
21335 Line two
21336 </blockquote>
21337 !! html
21338 <blockquote>Line one
21339 <p>Line two
21340 </p>
21341 </blockquote>
21342
21343 !! html+tidy
21344 <blockquote>
21345 <p>Line one</p>
21346 <p>Line two</p>
21347 </blockquote>
21348 !! end
21349
21350 !! test
21351 T8200: paragraphs inside blockquotes (extra line break on open and close)
21352 !! wikitext
21353 <blockquote>
21354 Line one
21355
21356 Line two
21357 </blockquote>
21358 !! html
21359 <blockquote>
21360 <p>Line one
21361 </p><p>Line two
21362 </p>
21363 </blockquote>
21364
21365 !! html+tidy
21366 <blockquote>
21367 <p>Line one</p>
21368 <p>Line two</p>
21369 </blockquote>
21370 !! end
21371
21372 !! test
21373 Paragraphs inside blockquotes/divs (no extra line breaks)
21374 !! wikitext
21375 <blockquote><div>Line one
21376
21377 Line two</div></blockquote>
21378 !! html
21379 <blockquote><div>Line one
21380 Line two</div></blockquote>
21381
21382 !! end
21383
21384 !! test
21385 Paragraphs inside blockquotes/divs (extra line break on open)
21386 !! wikitext
21387 <blockquote><div>
21388 Line one
21389
21390 Line two</div></blockquote>
21391 !! html
21392 <blockquote><div>
21393 <p>Line one
21394 </p>
21395 Line two</div></blockquote>
21396
21397 !! end
21398
21399 !! test
21400 Paragraphs inside blockquotes/divs (extra line break on close)
21401 !! wikitext
21402 <blockquote><div>Line one
21403
21404 Line two
21405 </div></blockquote>
21406 !! html
21407 <blockquote><div>Line one
21408 <p>Line two
21409 </p>
21410 </div></blockquote>
21411
21412 !! end
21413
21414 !! test
21415 Paragraphs inside blockquotes/divs (extra line break on open and close)
21416 !! wikitext
21417 <blockquote><div>
21418 Line one
21419
21420 Line two
21421 </div></blockquote>
21422 !! html
21423 <blockquote><div>
21424 <p>Line one
21425 </p><p>Line two
21426 </p>
21427 </div></blockquote>
21428
21429 !! end
21430
21431 !! test
21432 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
21433 !! options
21434 wgLinkHolderBatchSize=0
21435 !! wikitext
21436 [[meatball:1]]
21437 [[meatball:2]]
21438 [[meatball:3]]
21439 !! html
21440 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
21441 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
21442 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
21443 </p>
21444 !! end
21445
21446 !! test
21447 Free external link invading image caption
21448 !! wikitext
21449 [[Image:Foobar.jpg|thumb|http://x|hello]]
21450 !! html
21451 <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>
21452
21453 !! end
21454
21455 !! test
21456 T17196: localised external link numbers
21457 !! options
21458 language=fa
21459 !! wikitext
21460 [http://en.wikipedia.org/]
21461 !! html/php
21462 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
21463 </p>
21464 !! html/parsoid
21465 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
21466 !! end
21467
21468 !! test
21469 Multibyte character in padleft
21470 !! wikitext
21471 {{padleft:-Hello|7|Æ}}
21472 !! html
21473 <p>Æ-Hello
21474 </p>
21475 !! end
21476
21477 !! test
21478 Multibyte character in padright
21479 !! wikitext
21480 {{padright:Hello-|7|Æ}}
21481 !! html
21482 <p>Hello-Æ
21483 </p>
21484 !! end
21485
21486 !!test
21487 formatdate parser function
21488 !! wikitext
21489 {{#formatdate:2009-03-24}}
21490 !! html
21491 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
21492 </p>
21493 !! end
21494
21495 !!test
21496 formatdate parser function, with default format
21497 !! wikitext
21498 {{#formatdate:2009-03-24|mdy}}
21499 !! html
21500 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
21501 </p>
21502 !! end
21503
21504 !! test
21505 Spacing of numbers in formatted dates
21506 !! wikitext
21507 {{#formatdate:January 15}}
21508 !! html
21509 <p><span class="mw-formatted-date" title="01-15">January 15</span>
21510 </p>
21511 !! end
21512
21513 !! test
21514 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
21515 !! options
21516 language=nl title=[[MediaWiki:Common.css]]
21517 !! wikitext
21518 {{#formatdate:2009-03-24|dmy}}
21519 !! html
21520 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
21521 </p>
21522 !! end
21523
21524 #
21525 #
21526 #
21527
21528 #
21529 # Edit comments
21530 #
21531
21532 !! test
21533 Edit comment with link
21534 !! options
21535 comment
21536 !! wikitext
21537 I like the [[Main Page]] a lot
21538 !! html/php
21539 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
21540 !!end
21541
21542 !! test
21543 Edit comment with link and link text
21544 !! options
21545 comment
21546 !! wikitext
21547 I like the [[Main Page|best pages]] a lot
21548 !! html/php
21549 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21550 !!end
21551
21552 !! test
21553 Edit comment with link and link text with suffix
21554 !! options
21555 comment
21556 !! wikitext
21557 I like the [[Main Page|best page]]s a lot
21558 !! html/php
21559 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21560 !!end
21561
21562 !! test
21563 Edit comment with section link (non-local, eg in history list)
21564 !! options
21565 comment title=[[Main Page]]
21566 !! wikitext
21567 /* External links */ removed bogus entries
21568 !! html/php
21569 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21570 !!end
21571
21572 !! test
21573 Edit comment with section link and text before it (non-local, eg in history list)
21574 !! options
21575 comment title=[[Main Page]]
21576 !! wikitext
21577 pre-comment text /* External links */ removed bogus entries
21578 !! html/php
21579 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>
21580 !!end
21581
21582 !! test
21583 Edit comment with section link (local, eg in diff view)
21584 !! options
21585 comment local title=[[Main Page]]
21586 !! wikitext
21587 /* External links */ removed bogus entries
21588 !! html/php
21589 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21590 !!end
21591
21592 !! test
21593 Edit comment with subpage link (T16080)
21594 !! options
21595 comment
21596 subpage
21597 title=[[Subpage test]]
21598 !! wikitext
21599 Poked at a [[/subpage]] here...
21600 !! html/php
21601 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
21602 !!end
21603
21604 !! test
21605 Edit comment with subpage link and link text (T16080)
21606 !! options
21607 comment
21608 subpage
21609 title=[[Subpage test]]
21610 !! wikitext
21611 Poked at a [[/subpage|neat little page]] here...
21612 !! html/php
21613 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
21614 !!end
21615
21616 !! test
21617 Edit comment with bogus subpage link in non-subpage NS (T16080)
21618 !! options
21619 comment
21620 title=[[Subpage test]]
21621 !! wikitext
21622 Poked at a [[/subpage]] here...
21623 !! html/php
21624 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...
21625 !!end
21626
21627 !! test
21628 Edit comment with bare anchor link (local, as on diff)
21629 !! options
21630 comment
21631 local
21632 title=[[Main Page]]
21633 !! wikitext
21634 [[#section]]
21635 !! html/php
21636 <a href="#section">#section</a>
21637 !! end
21638
21639 !! test
21640 Edit comment with bare anchor link (non-local, as on history)
21641 !! options
21642 comment
21643 title=[[Main Page]]
21644 !! wikitext
21645 [[#section]]
21646 !! html/php
21647 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
21648 !! end
21649
21650 !! test
21651 Anchor starting with underscore
21652 !! options
21653 title=[[Foo]]
21654 !! wikitext
21655 [[#_ref|One]]
21656 !! html/php
21657 <p><a href="#_ref">One</a>
21658 </p>
21659 !! html/parsoid
21660 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
21661 !! end
21662
21663 !! test
21664 Id starting with underscore
21665 !! wikitext
21666 <div id="_ref"></div>
21667 !! html/*
21668 <div id="_ref"></div>
21669
21670 !! end
21671
21672 !! test
21673 Edit comment with link with more than one pipe (T99346)
21674 !! options
21675 comment
21676 !! wikitext
21677 [[Main Page|Many|pipes]]
21678 !! html/php
21679 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
21680 !! end
21681
21682 !! test
21683 Complex edit comment with link with more than one pipe (T99346)
21684 !! options
21685 comment
21686 !! wikitext
21687 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
21688 !! html/php
21689 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;
21690 !! end
21691
21692 !! test
21693 Space normalisation on autocomment (T24784)
21694 !! options
21695 comment
21696 title=[[Main Page]]
21697 !! wikitext
21698 /* __hello__world__ */
21699 !! html/php
21700 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
21701 !! end
21702
21703 !! test
21704 percent-encoding and + signs in comments (T28410)
21705 !! options
21706 comment
21707 !! wikitext
21708 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
21709 !! html/php
21710 <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>
21711 !! end
21712
21713 # Parsoid doesn't support this yet: see T75581
21714 # but it *should* omit the 'src' attribute if the image is bad.
21715 # PHP side of tests was disabled in
21716 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
21717 # because of issues in the PHP parserTests infrastructure
21718 # (but the output below is indeed what the PHP side emits)
21719 !! test
21720 Bad images - basic functionality
21721 !! wikitext
21722 [[File:Bad.jpg]]
21723 !! DISABLED/html/php
21724 !! html/parsoid
21725 <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>
21726 !! end
21727
21728 !! test
21729 Bad images - T18039: text after bad image disappears
21730 !! wikitext
21731 Foo bar
21732 [[File:Bad.jpg]]
21733 Bar foo
21734 !! DISABLED/html/php
21735 <p>Foo bar
21736 </p><p>Bar foo
21737 </p>
21738 !! html/parsoid
21739 <p>Foo bar
21740 <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>
21741 Bar foo</p>
21742 !! end
21743
21744 !! test
21745 Verify that displaytitle works (T24501) no displaytitle
21746 !! options
21747 showtitle
21748 !! config
21749 wgAllowDisplayTitle=true
21750 wgRestrictDisplayTitle=false
21751 !! wikitext
21752 this is not the the title
21753 !! html/php
21754 Parser test
21755 <p>this is not the the title
21756 </p>
21757 !! end
21758
21759 !! test
21760 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
21761 !! options
21762 showtitle
21763 title=[[Screen]]
21764 !! config
21765 wgAllowDisplayTitle=true
21766 wgRestrictDisplayTitle=false
21767 !! wikitext
21768 this is not the the title
21769 {{DISPLAYTITLE:whatever}}
21770 !! html/php
21771 whatever
21772 <p>this is not the the title
21773 </p>
21774 !! end
21775
21776 !! test
21777 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
21778 !! options
21779 showtitle
21780 title=[[Screen]]
21781 !! config
21782 wgAllowDisplayTitle=true
21783 wgRestrictDisplayTitle=true
21784 !! wikitext
21785 this is not the the title
21786 {{DISPLAYTITLE:whatever}}
21787 !! html/php
21788 Screen
21789 <p>this is not the the title
21790 </p>
21791 !! end
21792
21793 !! test
21794 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
21795 !! options
21796 showtitle
21797 title=[[Screen]]
21798 !! config
21799 wgAllowDisplayTitle=true
21800 wgRestrictDisplayTitle=true
21801 !! wikitext
21802 this is not the the title
21803 {{DISPLAYTITLE:screen}}
21804 !! html/php
21805 screen
21806 <p>this is not the the title
21807 </p>
21808 !! end
21809
21810 !! test
21811 Verify that displaytitle works (T24501) AllowDisplayTitle=false
21812 !! options
21813 showtitle
21814 title=[[Screen]]
21815 !! config
21816 wgAllowDisplayTitle=false
21817 !! wikitext
21818 this is not the the title
21819 {{DISPLAYTITLE:screen}}
21820 !! html/php
21821 Screen
21822 <p>this is not the the title
21823 <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>
21824 </p>
21825 !! end
21826
21827 !! test
21828 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
21829 !! options
21830 showtitle
21831 title=[[Screen]]
21832 !! config
21833 wgAllowDisplayTitle=false
21834 !! wikitext
21835 this is not the the title
21836 !! html/php
21837 Screen
21838 <p>this is not the the title
21839 </p>
21840 !! end
21841
21842 !! test
21843 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
21844 !! options
21845 showtitle
21846 title=[[Screen]]
21847 !! config
21848 wgAllowDisplayTitle=true
21849 wgRestrictDisplayTitle=true
21850 !! wikitext
21851 this is not the the title
21852 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21853 !! html/php
21854 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21855 <p>this is not the the title
21856 </p>
21857 !! end
21858
21859 !! test
21860 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
21861 !! options
21862 showtitle
21863 title=[[Screen]]
21864 !! config
21865 wgAllowDisplayTitle=true
21866 wgRestrictDisplayTitle=true
21867 !! wikitext
21868 this is not the the title
21869 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21870 !! html/php
21871 <span style="color: red;">s</span>creen
21872 <p>this is not the the title
21873 </p>
21874 !! end
21875
21876 !! test
21877 Page status indicators: Empty name is invalid
21878 !! options
21879 showindicators
21880 !! wikitext
21881 <indicator name=" "></indicator>
21882 <indicator></indicator>
21883 !! html/php
21884 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21885 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21886 </p>
21887 !! end
21888
21889 !! test
21890 Page status indicators: Weird syntaxes that are okay
21891 !! options
21892 showindicators
21893 !! wikitext
21894 <indicator name="empty" />
21895 <indicator name="name"></indicator>
21896 !! html/php
21897 empty=
21898 name=
21899 <p><br />
21900 </p>
21901 !! end
21902
21903 !! test
21904 Page status indicators: Torture test
21905 !! options
21906 showindicators
21907 !! wikitext
21908 <indicator name="01">hello world</indicator>
21909 <indicator name="02">[[Main Page]]</indicator>
21910 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21911 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21912 <indicator name="05">* foo
21913 * bar</indicator>
21914 <indicator name="06"><nowiki>foo</nowiki></indicator>
21915 <indicator name="07"> Preformatted</indicator>
21916 <indicator name="08"><div>Broken tag</indicator>
21917 <indicator name="09">{| class=wikitable
21918 | cell
21919 |}</indicator>
21920 <indicator name="10">Two
21921
21922 paragraphs</indicator>
21923 !! html/php
21924 01=hello world
21925 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21926 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" />
21927 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>
21928 05=<ul><li> foo</li>
21929 <li> bar</li></ul>
21930
21931 06=foo
21932 07=<pre>Preformatted
21933 </pre>
21934 08=<div>Broken tag</div>
21935
21936 09=<table class="wikitable">
21937 <tr>
21938 <td> cell
21939 </td></tr></table>
21940
21941 10=<p>Two
21942 </p><p>paragraphs
21943 </p>
21944 <p><br />
21945 </p><p><br />
21946 </p><p><br />
21947 </p><p><br />
21948 </p><p><br />
21949 </p>
21950 !! end
21951
21952 !! test
21953 preload: check <noinclude> and <includeonly>
21954 !! options
21955 preload
21956 !! wikitext
21957 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21958 !! html/php
21959 Hello kind world.
21960 !! end
21961
21962 !! test
21963 preload: check <onlyinclude>
21964 !! options
21965 preload
21966 !! wikitext
21967 Goodbye <onlyinclude>Hello world</onlyinclude>
21968 !! html/php
21969 Hello world
21970 !! end
21971
21972 !! test
21973 preload: can pass tags through if we want to
21974 !! options
21975 preload
21976 !! wikitext
21977 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21978 !! html/php
21979 <includeonly>Hello world</includeonly>
21980 !! end
21981
21982 !! test
21983 preload: check that it doesn't try to do tricks
21984 !! options
21985 preload
21986 !! wikitext
21987 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21988 !! html/php
21989 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21990 !! end
21991
21992 !! test
21993 Play a bit with r67090 and T5158
21994 !! wikitext
21995 <div style="width:50% !important">&nbsp;</div>
21996 <div style="width:50%&nbsp;!important">&nbsp;</div>
21997 <div style="width:50%&#160;!important">&nbsp;</div>
21998 <div style="border : solid;">&nbsp;</div>
21999 !! html/php
22000 <div style="width:50% !important">&#160;</div>
22001 <div style="width:50% !important">&#160;</div>
22002 <div style="width:50% !important">&#160;</div>
22003 <div style="border&#160;: solid;">&#160;</div>
22004
22005 !! html/parsoid
22006 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
22007 <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>
22008 <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>
22009 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
22010
22011 !! end
22012
22013 !! test
22014 HTML5 data attributes
22015 !! wikitext
22016 <span data-foo="bar">Baz</span>
22017 <p data-abc-def_hij="">Quuz</p>
22018 !! html/php
22019 <p><span data-foo="bar">Baz</span>
22020 </p>
22021 <p data-abc-def_hij="">Quuz</p>
22022
22023 !! html/parsoid
22024 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
22025 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
22026 !! end
22027
22028 !! test
22029 Strip reserved data attributes
22030 !! wikitext
22031 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
22032 !! html/php
22033 <div data-ok="fred">d</div>
22034
22035 !! html/parsoid
22036 <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>
22037 !! end
22038
22039 !! test
22040 percent-encoding and + signs in internal links (T28410)
22041 !! wikitext
22042 [[User:+%]] [[Page+title%]]
22043 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
22044 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
22045 [[%33%45]] [[%33%45+]]
22046 !! html/php
22047 <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>
22048 <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>
22049 <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>
22050 <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>
22051 </p>
22052 !! html/parsoid
22053 <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>
22054 <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>
22055 <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>
22056 <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>
22057 !! end
22058
22059 !! test
22060 Special characters in embedded file links (T29679)
22061 !! wikitext
22062 [[File:Contains & ampersand.jpg]]
22063 [[File:Does not exist.jpg|Title with & ampersand]]
22064 !! html/php
22065 <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>
22066 <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>
22067 </p>
22068 !! html/parsoid
22069 <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>
22070 <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>
22071 !! end
22072
22073 !! test
22074 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
22075 !! wikitext
22076 Text&apos;s been normalized?
22077 !! html
22078 <p>Text&#39;s been normalized?
22079 </p>
22080 !! end
22081
22082 !! test
22083 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
22084 !! wikitext
22085 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
22086 !! html
22087 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
22088 </p>
22089 !! end
22090
22091 !! test
22092 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
22093 !! wikitext
22094 [http://www.example.org/ ideograms]
22095 !! html
22096 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
22097 </p>
22098 !! end
22099
22100 !! test
22101 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
22102 !! wikitext
22103 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
22104 !! html
22105 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
22106 </p>
22107 !! end
22108
22109 !! article
22110 Mediawiki:loop1
22111 !! text
22112 {{Identical|A}}
22113 !! endarticle
22114
22115 !! article
22116 Mediawiki:loop2
22117 !! text
22118 {{Identical|B}}
22119 !! endarticle
22120
22121 !! article
22122 Template:Identical
22123 !! text
22124 {{int:loop1}}
22125 {{int:loop2}}
22126 !! endarticle
22127
22128 !! test
22129 T33098 Template which includes system messages which includes the template
22130 !! wikitext
22131 {{Identical}}
22132 !! html
22133 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22134 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22135 </p>
22136 !! end
22137
22138 !! test
22139 T33490 Turkish: ucfirst 'blah'
22140 !! options
22141 language=tr
22142 !! wikitext
22143 {{ucfirst:blah}}
22144 !! html
22145 <p>Blah
22146 </p>
22147 !! end
22148
22149 !! test
22150 T33490 Turkish: ucfirst 'ix'
22151 !! options
22152 language=tr
22153 !! wikitext
22154 {{ucfirst:ix}}
22155 !! html
22156 <p>İx
22157 </p>
22158 !! end
22159
22160 !! test
22161 T33490 Turkish: lcfirst 'BLAH'
22162 !! options
22163 language=tr
22164 !! wikitext
22165 {{lcfirst:BLAH}}
22166 !! html
22167 <p>bLAH
22168 </p>
22169 !! end
22170
22171 !! test
22172 T33490 Turkish: ucfırst (with a dotless i)
22173 !! options
22174 language=tr
22175 !! wikitext
22176 {{ucfırst:blah}}
22177 !! html
22178 <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>
22179 </p>
22180 !! end
22181
22182 !! test
22183 T33490 ucfırst (with a dotless i) with English language
22184 !! options
22185 language=en
22186 !! wikitext
22187 {{ucfırst:blah}}
22188 !! html
22189 <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>
22190 </p>
22191 !! end
22192
22193 !! test
22194 T28375: TOC with italics
22195 !! options
22196 title=[[Main Page]]
22197 !! wikitext
22198 __TOC__
22199 == ''Lost'' episodes ==
22200 !! html
22201 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22202 <ul>
22203 <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>
22204 </ul>
22205 </div>
22206
22207 <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>
22208
22209 !! end
22210
22211 !! test
22212 T28375: TOC with bold
22213 !! options
22214 title=[[Main Page]]
22215 !! wikitext
22216 __TOC__
22217 == '''should be bold''' then normal text ==
22218 !! html
22219 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22220 <ul>
22221 <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>
22222 </ul>
22223 </div>
22224
22225 <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>
22226
22227 !! end
22228
22229 !! test
22230 T35845: Headings become cursive in TOC when they contain an image
22231 !! options
22232 title=[[Main Page]]
22233 !! wikitext
22234 __TOC__
22235 == Image [[Image:foobar.jpg]] ==
22236 !! html
22237 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22238 <ul>
22239 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
22240 </ul>
22241 </div>
22242
22243 <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>
22244
22245 !! end
22246
22247 !! test
22248 T35845 (2): Headings become bold in TOC when they contain a blockquote
22249 !! options
22250 title=[[Main Page]]
22251 !! wikitext
22252 __TOC__
22253 == <blockquote>Quote</blockquote> ==
22254 !! html
22255 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22256 <ul>
22257 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22258 </ul>
22259 </div>
22260
22261 <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>
22262
22263 !! html+tidy
22264 <p></p>
22265 <div id="toc" class="toc">
22266 <div id="toctitle">
22267 <h2>Contents</h2>
22268 </div>
22269 <ul>
22270 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22271 </ul>
22272 </div>
22273 <p></p>
22274 <h2><span class="mw-headline" id="Quote"></span></h2>
22275 <blockquote>
22276 <p><span class="mw-headline" id="Quote">Quote</span></p>
22277 </blockquote>
22278 <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>
22279 !! end
22280
22281 !! test
22282 Unclosed tags in TOC
22283 !! options
22284 title=[[Main Page]]
22285 !! wikitext
22286 __TOC__
22287 == Proof: 2 < 3 ==
22288 <small>Hanc marginis exiguitas non caperet.</small>
22289 QED
22290 !! html
22291 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22292 <ul>
22293 <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>
22294 </ul>
22295 </div>
22296
22297 <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>
22298 <p><small>Hanc marginis exiguitas non caperet.</small>
22299 QED
22300 </p>
22301 !! end
22302
22303 !! test
22304 Multiple tags in TOC
22305 !! wikitext
22306 __TOC__
22307 == <i>Foo</i> <b>Bar</b> ==
22308
22309 == <i>Foo</i> <blockquote>Bar</blockquote> ==
22310 !! html
22311 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22312 <ul>
22313 <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>
22314 <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>
22315 </ul>
22316 </div>
22317
22318 <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>
22319 <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>
22320
22321 !! html+tidy
22322 <p></p>
22323 <div id="toc" class="toc">
22324 <div id="toctitle">
22325 <h2>Contents</h2>
22326 </div>
22327 <ul>
22328 <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>
22329 <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>
22330 </ul>
22331 </div>
22332 <p></p>
22333 <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>
22334 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
22335 <blockquote>
22336 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
22337 </blockquote>
22338 <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>
22339 !! end
22340
22341 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
22342 # html5 tag parsing.
22343 !! test
22344 Tags with parameters in TOC
22345 !! options
22346 parsoid=wt2html
22347 !! wikitext
22348 __TOC__
22349 == <sup class="in-h2">Hello</sup> ==
22350
22351 == <sup class="a > b">Evilbye</sup> ==
22352 !! html/php
22353 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22354 <ul>
22355 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
22356 <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>
22357 </ul>
22358 </div>
22359
22360 <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>
22361 <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>
22362
22363 !! html/parsoid
22364 <meta property="mw:PageProp/toc" />
22365 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
22366
22367 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
22368 !! end
22369
22370 !! test
22371 span tags with directionality in TOC
22372 !! wikitext
22373 __TOC__
22374 == <span dir="ltr">C++</span> ==
22375
22376 == <span dir="rtl">זבנג!</span> ==
22377
22378 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
22379
22380 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
22381
22382 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
22383 !! html
22384 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22385 <ul>
22386 <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>
22387 <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>
22388 <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>
22389 <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>
22390 <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>
22391 </ul>
22392 </div>
22393
22394 <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>
22395 <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>
22396 <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>
22397 <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>
22398 <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>
22399
22400 !! end
22401
22402 !! test
22403 T74884: bdi element in ToC
22404 !! wikitext
22405 __TOC__
22406 == <bdi>test</bdi> ==
22407 !! html
22408 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22409 <ul>
22410 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
22411 </ul>
22412 </div>
22413
22414 <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>
22415
22416 !! end
22417
22418 !! test
22419 T35715: s/strike element in ToC
22420 !! wikitext
22421 __TOC__
22422 == <s>test</s> test <strike>test</strike> ==
22423 !! html
22424 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22425 <ul>
22426 <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>
22427 </ul>
22428 </div>
22429
22430 <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>
22431
22432 !! end
22433
22434 # Note that the html output does not have the <p></p>, but the
22435 # html+tidy output *does*. This is because the empty <p></p> is
22436 # removed by the sanitizer, but only when tidy is *not* enabled (!).
22437 !! test
22438 Empty <p> tag in TOC, removed by Sanitizer (T92892)
22439 !! wikitext
22440 __TOC__
22441 == x ==
22442 !! html
22443 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22444 <ul>
22445 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22446 </ul>
22447 </div>
22448
22449 <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>
22450
22451 !! html+tidy
22452 <p></p>
22453 <div id="toc" class="toc">
22454 <div id="toctitle">
22455 <h2>Contents</h2>
22456 </div>
22457 <ul>
22458 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22459 </ul>
22460 </div>
22461 <p></p>
22462 <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>
22463 !! end
22464
22465 !! article
22466 MediaWiki:T34057
22467 !! text
22468 == {{int:headline_sample}} ==
22469 !! endarticle
22470
22471 !! test
22472 T34057: Title needed when expanding <h> nodes.
22473 !! options
22474 title=[[Main Page]]
22475 !! wikitext
22476 {{int:T34057}}
22477 !! html
22478 <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>
22479
22480 !! end
22481
22482 !! test
22483 Strip marker in urlencode
22484 !! wikitext
22485 {{urlencode:x<nowiki/>y}}
22486 {{urlencode:x<nowiki/>y|wiki}}
22487 {{urlencode:x<nowiki/>y|path}}
22488 {{urlencode:x<pre id="one">two</pre>y}}
22489 !! html/php
22490 <p>xy
22491 xy
22492 xy
22493 xy
22494 </p>
22495 !! end
22496
22497 !! test
22498 Strip marker in lc
22499 !! wikitext
22500 {{lc:x<nowiki/>y}}
22501 !! html
22502 <p>xy
22503 </p>
22504 !! end
22505
22506 !! test
22507 Strip marker in uc
22508 !! wikitext
22509 {{uc:x<nowiki/>y}}
22510 !! html
22511 <p>XY
22512 </p>
22513 !! end
22514
22515 !! test
22516 Strip marker in formatNum
22517 !! wikitext
22518 {{formatnum:1<nowiki/>2}}
22519 {{formatnum:1<nowiki/>2|R}}
22520 !! html
22521 <p>12
22522 12
22523 </p>
22524 !! end
22525
22526 !! test
22527 Check noCommafy in formatNum
22528 !! options
22529 language=be-tarask
22530 !! wikitext
22531 {{formatnum:123456.78}}
22532 {{formatnum:123456.78|NOSEP}}
22533 !! html
22534 <p>123 456,78
22535 123456.78
22536 </p>
22537 !! end
22538
22539 !! test
22540 Wrong option for formatNum (T58199)
22541 !! wikitext
22542 {{formatnum:1,234.56|Random}}
22543 {{formatnum:1,234.56|EVERYTHING}}
22544 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
22545 !! html
22546 <p>1,234.56
22547 1,234.56
22548 1,234.56
22549 </p>
22550 !! end
22551
22552 !! test
22553 Strip marker in grammar
22554 !! options
22555 language=fi
22556 !! wikitext
22557 {{grammar:elative|foo<nowiki/>bar}}
22558 !! html
22559 <p>foobarista
22560 </p>
22561 !! end
22562
22563 !! test
22564 Strip marker in padleft
22565 !! wikitext
22566 {{padleft:|2|x<nowiki/>y}}
22567 !! html
22568 <p>xy
22569 </p>
22570 !! end
22571
22572 !! test
22573 Strip marker in padright
22574 !! wikitext
22575 {{padright:|2|x<nowiki/>y}}
22576 !! html
22577 <p>xy
22578 </p>
22579 !! end
22580
22581 !! test
22582 Strip marker in anchorencode
22583 !! wikitext
22584 {{anchorencode:x<nowiki/>y}}
22585 !! html
22586 <p>xy
22587 </p>
22588 !! end
22589
22590 !! test
22591 nowiki inside link inside heading (T20295)
22592 !! wikitext
22593 ==[[foo|x<nowiki>y</nowiki>z]]==
22594 !! html
22595 <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>
22596
22597 !! end
22598
22599 !! test
22600 new support for bdi element (T33817)
22601 !! wikitext
22602 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22603 !! html
22604 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22605
22606 !!end
22607
22608 !! test
22609 Ignore pipe between table row attributes
22610 !! wikitext
22611 {|
22612 | quux
22613 |- id=foo | style='color: red'
22614 | bar
22615 |}
22616 !! html
22617 <table>
22618 <tr>
22619 <td> quux
22620 </td></tr>
22621 <tr id="foo" style="color: red">
22622 <td> bar
22623 </td></tr></table>
22624
22625 !! end
22626
22627 !!test
22628 Language parser function
22629 !! wikitext
22630 {{#language:ar}}
22631 !! html
22632 <p>العربية
22633 </p>
22634 !! end
22635
22636 !!test
22637 Padleft and padright as substr
22638 !! wikitext
22639 {{padleft:|3|abcde}}
22640 {{padright:|3|abcde}}
22641 !! html
22642 <p>abc
22643 abc
22644 </p>
22645 !! end
22646
22647 !!test
22648 Special parser function
22649 !! wikitext
22650 {{#special:RandomPage}}
22651 {{#special:BaDtItLe}}
22652 {{#special:Foobar}}
22653 !! html
22654 <p>Special:Random
22655 Special:Badtitle
22656 Special:Foobar
22657 </p>
22658 !! end
22659
22660 !!test
22661 T36939 - Case insensitive link parsing ([HttP://])
22662 !! wikitext
22663 [HttP://MediaWiki.Org/]
22664 !! html/php
22665 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
22666 </p>
22667 !! html/parsoid
22668 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
22669 !! end
22670
22671 !!test
22672 T36939 - Case insensitive link parsing ([HttP:// title])
22673 !! wikitext
22674 [HttP://MediaWiki.Org/ MediaWiki]
22675 !! html
22676 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22677 </p>
22678 !! end
22679
22680 !!test
22681 T36939 - Case insensitive link parsing (HttP://)
22682 !! wikitext
22683 HttP://MediaWiki.Org/
22684 !! html/php
22685 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22686 </p>
22687 !! html/parsoid
22688 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22689 !! end
22690
22691 !!test
22692 Disable TOC
22693 !! options
22694 notoc
22695 !! wikitext
22696 Lead
22697 == Section 1 ==
22698 == Section 2 ==
22699 == Section 3 ==
22700 == Section 4 ==
22701 == Section 5 ==
22702 !! html
22703 <p>Lead
22704 </p>
22705
22706 <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>
22707 <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>
22708 <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>
22709 <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>
22710 <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>
22711
22712 !! end
22713
22714
22715 ###
22716 ### Parsoid-specific tests
22717 ### Parsoid-PHP parser incompatibilities
22718 ###
22719 !!test
22720 1. SOL-sensitive wikitext tokens as template-args
22721 !!options
22722 parsoid=wt2html,wt2wt
22723 !! wikitext
22724 {{echo|*a}}
22725 {{echo|#a}}
22726 {{echo|:a}}
22727 !! html
22728 <span about="#mwt1" typeof="mw:Transclusion">
22729 </span><ul about="#mwt1"><li>a</li>
22730 </ul>
22731 <span about="#mwt2" typeof="mw:Transclusion">
22732 </span><ol about="#mwt2"><li>a</li>
22733 </ol>
22734 <span about="#mwt3" typeof="mw:Transclusion">
22735 </span><dl about="#mwt3"><dd>a</dd>
22736 </dl>
22737 !!end
22738
22739 #### -----------------------------------------------------------------
22740 #### Parsoid-specific functionality tests
22741 #### -----------------------------------------------------------------
22742
22743 # T65642/T68749: Formatting elt fixup around images is cleaned up.
22744 # We know wt2wt will fail, but we expect selser to pass.
22745 # Due to the nature of our testing, wt2wt and selser tests will enter the
22746 # blacklist and we'll catch selser regressions based on changes to the
22747 # blacklist entries for selser tests.
22748 !! test
22749 1. Bad treebuilder fixup of formatting elt is cleaned up
22750 !! options
22751 parsoid=wt2html,wt2wt
22752 !! wikitext
22753 {|
22754 |
22755 <small>
22756 [[Image:Foobar.jpg|right|Test]]
22757 </small>
22758 |}
22759 !! html/parsoid
22760 <table>
22761 <tbody><tr><td>
22762 <small>
22763 <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>
22764 </small>
22765 </td></tr>
22766 </tbody></table>
22767 !! end
22768
22769 !! test
22770 2. Bad treebuilder fixup of formatting elt is cleaned up
22771 !! options
22772 parsoid=wt2html,wt2wt
22773 !! wikitext
22774 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22775
22776 <small>[[Image:Foobar.jpg|right|300px]]</small>
22777 !! html/parsoid
22778
22779 <p><b>foo</b></p>
22780 <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>
22781 <p><b>bar</b></p>
22782 <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>
22783 !! end
22784
22785 !! test
22786 3. Bad treebuilder fixup of formatting elt is cleaned up
22787 !! options
22788 parsoid=wt2html,wt2wt
22789 !! wikitext
22790 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22791 !! html/parsoid
22792 <p><small><b>foo</b></small></p>
22793 <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>
22794 <p><small><b>bar</b></small></p>
22795 !! end
22796
22797 !! test
22798 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22799 !! options
22800 parsoid=wt2html,wt2wt
22801 !! wikitext
22802 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22803 !! html/parsoid
22804 <p><b><small></small></b></p>
22805 <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>
22806 <p></p>
22807 !! end
22808
22809 #### ----------------------------------------------------------------
22810 #### Parsoid-only testing of Parsoid's impl of LST
22811 #### Not implemented yet, see
22812 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22813 #### ----------------------------------------------------------------
22814
22815 ## We still need to support serializing the older format while content is stored.
22816 !! test
22817 LST Sections: Backwards compatibility
22818 !! options
22819 parsoid={
22820 "suppressErrors": true,
22821 "modes": ["html2wt"]
22822 }
22823 !! wikitext
22824 <section begin="2011-05-16" />
22825 <section end="2014-04-10 (MW 1.23wmf22)" />
22826 !! html/parsoid
22827 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22828 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22829 !! end
22830
22831 ## The unconventional output is the result of `usePHPPreProcessor` being
22832 ## disabled in parserTests.js. This test is mainly just to show <section> is
22833 ## recognized as an extension tag w/o a native handler.
22834 !! test
22835 LST Sections: Newfangled approach
22836 !! wikitext
22837 <section begin="2011-05-16" />
22838 <section end="2014-04-10 (MW 1.23wmf22)" />
22839 !! html/parsoid
22840 <p><span typeof="mw:Error mw:Extension/section" about="#mwt1" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null,"errors":[{"key":"mw-api-extexpand-error","message":"Could not expand extension source."}]}'>&lt;section begin="2011-05-16" /></span>
22841 <span typeof="mw:Error mw:Extension/section" about="#mwt2" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null,"errors":[{"key":"mw-api-extexpand-error","message":"Could not expand extension source."}]}'>&lt;section end="2014-04-10 (MW 1.23wmf22)" /></span></p>
22842 !! end
22843
22844 #--------- Test stripping of empty nodes in template content ----------
22845 !!test
22846 Empty LI and TR nodes should be stripped from template content
22847 !!wikitext
22848 {{EmptyLITest}}
22849 {{EmptyTRTest}}
22850 !!html/parsoid
22851 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22852 <li>a</li>
22853 <li>b</li>
22854 </ul>
22855 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22856 <tbody>
22857 <tr>
22858 <td>foo</td>
22859 </tr>
22860 <tr>
22861 <td>bar</td>
22862 </tr>
22863 </tbody>
22864 </table>
22865 !!end
22866
22867 !!test
22868 Empty LI and TR nodes should not be stripped from top-level content
22869 !!wikitext
22870 * a
22871 *
22872 * b
22873 {|
22874 |-
22875 |-
22876 |foo
22877 |}
22878 !!html/parsoid
22879 <ul>
22880 <li> a</li>
22881 <li></li>
22882 <li> b</li>
22883 </ul>
22884 <table>
22885 <tbody>
22886 <tr></tr>
22887 <tr>
22888 <td>foo</td>
22889 </tr>
22890 </tbody>
22891 </table>
22892 !!end
22893
22894 !!test
22895 Empty TR nodes should not be stripped if they have any attributes set
22896 !!wikitext
22897 {{EmptyTRWithHTMLAttrTest}}
22898 !!html/parsoid
22899 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22900 <tr align="center"></tr>
22901 <tr><td>foo</td></tr>
22902 <tr align="center"></tr>
22903 <tr><td>bar</td></tr>
22904 </table>
22905 !!end
22906
22907 #### ----------------------------------------------------------------
22908 #### The following section of tests are primarily to test
22909 #### wikitext escaping capabilities of Parsoid. Given that
22910 #### escaping can be done any number of ways, the wikitext (input)
22911 #### is always adjusted to reflect how Parsoid adds nowiki
22912 #### escape tags.
22913 ####
22914 #### We are marking several tests as parsoid-only since the
22915 #### HTML in the result section is different from what the
22916 #### PHP parser generates for it.
22917 #### ----------------------------------------------------------------
22918
22919
22920 #### --------------- Headings ---------------
22921 #### 0. Unnested
22922 #### 1. Nested inside html <h1>=foo=</h1>
22923 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22924 #### 3. Nested inside html with wikitext split by html tags
22925 #### 4. No escape needed
22926 #### 5. Empty headings <h1></h1>
22927 #### 6. Heading chars in SOL context
22928 #### ----------------------------------------
22929 !! test
22930 Headings: 0. Unnested
22931 !! options
22932 parsoid=html2wt
22933 !! html/parsoid
22934 <p>=foo=</p>
22935
22936 <p> =foo=
22937 <!--cmt-->
22938 =foo=</p>
22939
22940 <p>=foo<i>a</i>=</p>
22941 !! wikitext
22942 <nowiki>=foo=</nowiki>
22943
22944 <nowiki> </nowiki>=foo=
22945 <!--cmt-->
22946 <nowiki>=foo=</nowiki>
22947
22948 =foo''a''<nowiki>=</nowiki>
22949 !!end
22950
22951 # New headings and existing headings are handled differently
22952 !! test
22953 Headings: 1. Nested inside html
22954 !! options
22955 parsoid=html2wt
22956 !! html/parsoid
22957 <h1>=foo=</h1>
22958 <h2>=foo=</h2>
22959 <h3>=foo=</h3>
22960
22961 <h1 data-parsoid=''>=foo=</h1>
22962 <h2 data-parsoid=''>=foo=</h2>
22963 <h3 data-parsoid=''>=foo=</h3>
22964 <h4 data-parsoid=''>=foo=</h4>
22965 <h5 data-parsoid=''>=foo=</h5>
22966 <h6 data-parsoid=''>=foo=</h6>
22967 !! wikitext
22968 = =foo= =
22969
22970 == =foo= ==
22971
22972 === =foo= ===
22973
22974 =<nowiki>=foo=</nowiki>=
22975 ==<nowiki>=foo=</nowiki>==
22976 ===<nowiki>=foo=</nowiki>===
22977 ====<nowiki>=foo=</nowiki>====
22978 =====<nowiki>=foo=</nowiki>=====
22979 ======<nowiki>=foo=</nowiki>======
22980
22981 !!end
22982
22983 !! test
22984 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22985 !! options
22986 parsoid=html2wt
22987 !! html/parsoid
22988 <h1>foo</h1>*bar
22989 <h1>foo</h1>=bar
22990 <h1>foo</h1>=bar=
22991 !! wikitext
22992 = foo =
22993 <nowiki>*</nowiki>bar
22994
22995 = foo =
22996 =bar
22997
22998 = foo =
22999 <nowiki>=bar=</nowiki>
23000 !!end
23001
23002 !! test
23003 Headings: 3. Nested inside html with wikitext split by html tags
23004 !! options
23005 parsoid=html2wt
23006 !! html/parsoid
23007 <h1>=<b>bold</b>foo=</h1>
23008 !! wikitext
23009 = ='''bold'''foo= =
23010 !!end
23011
23012 !! test
23013 Headings: 4a. No escaping needed (testing just h1 and h2)
23014 !! options
23015 parsoid=html2wt
23016 !! html/parsoid
23017 <h1>=foo</h1>
23018 <h1>foo=</h1>
23019 <h1> =foo= </h1>
23020 <h1>=foo= bar</h1>
23021 <h2>=foo</h2>
23022 <h2>foo=</h2>
23023 <h1>=</h1>
23024 <h1><i>=</i>foo=</h1>
23025 !! wikitext
23026 = =foo =
23027
23028 = foo= =
23029
23030 = =foo= =
23031
23032 = =foo= bar =
23033
23034 == =foo ==
23035
23036 == foo= ==
23037
23038 = = =
23039
23040 = ''=''foo= =
23041 !!end
23042
23043 !! test
23044 Headings: 4b. No escaping needed (inside p-tags)
23045 !! options
23046 parsoid=html2wt
23047 !! html/parsoid
23048 <p>===
23049 =foo= x
23050 =foo= <s></s>
23051 </p>
23052 !! wikitext
23053 ===
23054 =foo= x
23055 =foo= <s></s>
23056 !!end
23057
23058 !! test
23059 Headings: 5. Empty headings
23060 !! options
23061 parsoid=html2wt
23062 !! html/parsoid
23063 <h1 data-parsoid='{}'></h1>
23064
23065 <h2 data-parsoid='{}'></h2>
23066
23067 <h3 data-parsoid='{}'></h3>
23068
23069 <h4 data-parsoid='{}'></h4>
23070
23071 <h5 data-parsoid='{}'></h5>
23072
23073 <h6 data-parsoid='{}'></h6>
23074 !! wikitext
23075 =<nowiki/>=
23076
23077 ==<nowiki/>==
23078
23079 ===<nowiki/>===
23080
23081 ====<nowiki/>====
23082
23083 =====<nowiki/>=====
23084
23085 ======<nowiki/>======
23086 !!end
23087
23088 !! test
23089 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23090 !! options
23091 parsoid=html2wt
23092 !! html/parsoid
23093 <p>=a=</p>
23094
23095 <p>=a=</p>
23096
23097 <p>=a=</p>
23098 !! wikitext
23099 <nowiki>=a=</nowiki>
23100
23101 <nowiki>=a=</nowiki>
23102
23103 <nowiki>=a=</nowiki>
23104 !!end
23105
23106 !! test
23107 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23108 !! options
23109 parsoid=html2wt
23110 !! html/parsoid
23111 <p>=a=
23112 b</p>
23113
23114 <p>=a=
23115 b</p>
23116
23117 <p>=a=
23118 b</p>
23119 !! wikitext
23120 <nowiki>=a=</nowiki>
23121 b
23122
23123 <nowiki>=a=</nowiki>
23124 b
23125
23126 <nowiki>=a=</nowiki>
23127 b
23128 !!end
23129
23130 !! test
23131 Headings: 6c. Heading chars in SOL context (leading newline break)
23132 !! options
23133 parsoid=html2wt
23134 !! html/parsoid
23135 <p>a
23136 =b=</p>
23137 !! wikitext
23138 a
23139 <nowiki>=b=</nowiki>
23140 !!end
23141
23142 !! test
23143 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23144 !! options
23145 parsoid=html2wt
23146 !! html/parsoid
23147 <!--c0--><p>=a=</p>
23148
23149 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23150 !! wikitext
23151 <!--c0--><nowiki>=a=</nowiki>
23152
23153 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23154 !!end
23155
23156 !! test
23157 Headings: 6d. Heading chars in SOL context (No escaping needed)
23158 !! options
23159 parsoid=html2wt
23160 !! html/parsoid
23161 =a=<div>b</div>
23162 !! wikitext
23163 =a=<div>b</div>
23164 !!end
23165
23166 !! test
23167 Headings: 7. Insert a newline between new content and headings
23168 !! options
23169 parsoid=html2wt
23170 !! html/parsoid
23171 <h2>NEW</h2>
23172 <p>new</p>
23173 <h2 data-parsoid='{}'>A</h2>
23174 <p data-parsoid='{}'>a</p>
23175 !! wikitext
23176 == NEW ==
23177 new
23178
23179 ==A==
23180 a
23181
23182 !! end
23183
23184 #### --------------- Lists ---------------
23185 #### 0. Outside nests (*foo, etc.)
23186 #### 1. Nested inside html <ul><li>*foo</li></ul>
23187 #### 2. Inside definition lists
23188 #### 3. Only bullets at start should be escaped
23189 #### 4. No escapes needed
23190 #### 5. No unnecessary escapes
23191 #### 6. Escape bullets in SOL position
23192 #### 7. Escape bullets in a multi-line context
23193 #### ----------------------------------------
23194
23195 !! test
23196 Lists: 0. Outside nests
23197 !! options
23198 parsoid=html2wt
23199 !! html/parsoid
23200 <p>*foo</p>
23201
23202 <p>#foo</p>
23203
23204 <p>;Foo:bar</p>
23205 !! wikitext
23206 <nowiki>*</nowiki>foo
23207
23208 <nowiki>#</nowiki>foo
23209
23210 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23211 !!end
23212
23213 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23214 ## to test wikitext escaping, and insignificant whitespace diffs
23215 ## cause PHP parser tests to barf
23216 !! test
23217 Lists: 1. Nested inside html (No unnecessary escapes)
23218 !! options
23219 parsoid=html2wt
23220 !! html/parsoid
23221 <ul>
23222 <li>*foo</li>
23223 <li>#foo</li>
23224 <li>:foo</li>
23225 <li>;foo</li>
23226 <li data-parsoid='{}'>*foo</li>
23227 <li data-parsoid='{}'>#foo</li>
23228 <li data-parsoid='{}'>:foo</li>
23229 <li data-parsoid='{}'>;foo</li>
23230 </ul>
23231
23232 <ol>
23233 <li>*foo</li>
23234 <li>#foo</li>
23235 <li>:foo</li>
23236 <li>;foo</li>
23237 <li data-parsoid='{}'>*foo</li>
23238 <li data-parsoid='{}'>#foo</li>
23239 <li data-parsoid='{}'>:foo</li>
23240 <li data-parsoid='{}'>;foo</li>
23241 </ol>
23242 !! wikitext
23243 * *foo
23244 * #foo
23245 * :foo
23246 * ;foo
23247 *<nowiki>*foo</nowiki>
23248 *<nowiki>#foo</nowiki>
23249 *<nowiki>:foo</nowiki>
23250 *<nowiki>;foo</nowiki>
23251
23252 # *foo
23253 # #foo
23254 # :foo
23255 # ;foo
23256 #<nowiki>*foo</nowiki>
23257 #<nowiki>#foo</nowiki>
23258 #<nowiki>:foo</nowiki>
23259 #<nowiki>;foo</nowiki>
23260 !!end
23261
23262 !! test
23263 Lists: 2. Inside definition lists
23264 !! options
23265 parsoid=html2wt
23266 !! html/parsoid
23267 <dl><dt>;foo</dt></dl>
23268 <dl><dt>:foo</dt></dl>
23269 <dl><dt>:foo</dt>
23270 <dd>bar</dd></dl>
23271 <dl><dd>:foo</dd></dl>
23272 !! wikitext
23273 ; ;foo
23274
23275 ; <nowiki>:foo</nowiki>
23276
23277 ; <nowiki>:foo</nowiki>
23278 : bar
23279
23280 : :foo
23281 !!end
23282
23283 !! test
23284 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23285 !! options
23286 parsoid=html2wt
23287 !! html/parsoid
23288 <ul>
23289 <li>*foo*bar</li>
23290 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23291 </ul>
23292 !! wikitext
23293 * *foo*bar
23294 *<nowiki>*foo</nowiki>''it''*bar
23295 !!end
23296
23297 !! test
23298 Lists: 4. No escapes needed
23299 !! options
23300 parsoid=html2wt
23301 !! html/parsoid
23302 <ul>
23303 <li>foo*bar
23304 </li>
23305 </ul>
23306 <ul>
23307 <li><i>foo</i>*bar
23308 </li>
23309 </ul>
23310 <ul>
23311 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23312 </li>
23313 </ul>
23314 <ul>
23315 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23316 </li>
23317 </ul>
23318 !! wikitext
23319 *foo*bar
23320
23321 *''foo''*bar
23322
23323 *[[Foo]]: bar
23324
23325 *[[Foo]]*bar
23326 !!end
23327
23328 !! test
23329 Lists: 5. No unnecessary escapes
23330 !! options
23331 parsoid=html2wt
23332 !! html/parsoid
23333 <ul><li> bar <span>[[foo]]</span></li></ul>
23334 <ul><li> =bar <span>[[foo]]</span></li></ul>
23335 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23336 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23337 <ul><li> =bar <span>foo]]</span>=</li></ul>
23338 <ul><li> <s></s>: a</li></ul>
23339 <ul><li> <i>* foo</i></li></ul>
23340
23341 !! wikitext
23342 * bar <span><nowiki>[[foo]]</nowiki></span>
23343
23344 * =bar <span><nowiki>[[foo]]</nowiki></span>
23345
23346 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23347
23348 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23349
23350 * =bar <span>foo]]</span>=
23351
23352 * <s></s>: a
23353
23354 * ''* foo''
23355 !!end
23356
23357 !! test
23358 Lists: 6. Escape bullets in SOL position
23359 !! options
23360 parsoid=html2wt
23361 !! html/parsoid
23362 <p><!--cmt-->*foo</p>
23363 !! wikitext
23364 <!--cmt--><nowiki>*</nowiki>foo
23365 !!end
23366
23367 !! test
23368 Lists: 7. Escape bullets in a multi-line context
23369 !! options
23370 parsoid=html2wt
23371 !! html/parsoid
23372 <p>a
23373 *b
23374 </p>
23375 !! wikitext
23376 a
23377 <nowiki>*</nowiki>b
23378 !!end
23379
23380 !! test
23381 Lists: 8. Escape colons only if not present in tags
23382 !! options
23383 parsoid=html2wt
23384 !! html/parsoid
23385 <dl><dt>a:b<i>c:d</i></dt></dl>
23386 !! wikitext
23387 ; <nowiki>a:b</nowiki>''c:d''
23388 !! end
23389
23390 #### --------------- HRs ---------------
23391 #### 1. Single line
23392 #### -----------------------------------
23393
23394 !! test
23395 HRs: 1. Single line
23396 !! options
23397 parsoid=html2wt
23398 !! html/parsoid
23399 <hr />----
23400 <hr />=foo=
23401 <hr />*foo
23402 !! wikitext
23403 ----<nowiki>----</nowiki>
23404 ----=foo=
23405 ----*foo
23406 !! end
23407
23408 #### --------------- Tables ---------------
23409 #### 1a. Simple example
23410 #### 1b. No escaping needed (!foo)
23411 #### 1c. No escaping needed (|foo)
23412 #### 1d. No escaping needed (|}foo)
23413 ####
23414 #### 2a. Nested in td (<td>foo|bar</td>)
23415 #### 2b. Nested in td (<td>foo||bar</td>)
23416 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23417 ####
23418 #### 3a. Nested in th (<th>foo!bar</th>)
23419 #### 3b. Nested in th (<th>foo!!bar</th>)
23420 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23421 ####
23422 #### 4a. Escape -
23423 #### 4b. Escape +
23424 #### 4c. No escaping needed
23425 #### --------------------------------------
23426
23427 !! test
23428 Tables: 1a. Simple example
23429 !! options
23430 parsoid=html2wt
23431 !! html/parsoid
23432 <p>{|
23433 |}
23434 </p>
23435 !! wikitext
23436 <nowiki>{|</nowiki>
23437 |}
23438 !! end
23439
23440 !! test
23441 Tables: 1b. No escaping needed
23442 !! options
23443 parsoid=html2wt
23444 !! html/parsoid
23445 <p>!foo
23446 </p>
23447 !! wikitext
23448 !foo
23449 !! end
23450
23451 !! test
23452 Tables: 1c. No escaping needed
23453 !! options
23454 parsoid=html2wt
23455 !! html/parsoid
23456 <p>|foo
23457 </p>
23458 !! wikitext
23459 |foo
23460 !! end
23461
23462 !! test
23463 Tables: 1d. No escaping needed
23464 !! options
23465 parsoid=html2wt
23466 !! html/parsoid
23467 <p>|}foo
23468 </p>
23469 !! wikitext
23470 |}foo
23471 !! end
23472
23473 !! test
23474 Tables: 2a. Nested in td
23475 !! options
23476 parsoid=html2wt
23477 !! html/parsoid
23478 <table><tbody><tr>
23479 <td>foo|bar</td></tr>
23480 <tr><td>x<div>a|b</div></td>
23481 </tbody></table>
23482 !! wikitext
23483 {|
23484 |<nowiki>foo|bar</nowiki>
23485 |-
23486 |x<div><nowiki>a|b</nowiki></div>
23487 |}
23488 !! html/php+tidy
23489 <table>
23490 <tr>
23491 <td>foo|bar</td>
23492 </tr>
23493 <tr>
23494 <td>x
23495 <div>a|b</div>
23496 </td>
23497 </tr>
23498 </table>
23499 !! end
23500
23501 !! test
23502 Tables: 2b. Nested in td
23503 !! options
23504 parsoid=html2wt
23505 !! html/parsoid
23506 <table><tbody><tr>
23507 <td>foo||bar</td>
23508 <td>a<i>b||c</i></td>
23509 <td>a<i><div>b||c</div></i></td>
23510 </tr></tbody></table>
23511 !! wikitext
23512 {|
23513 |<nowiki>foo||bar</nowiki>
23514 |a''<nowiki>b||c</nowiki>''
23515 |a''<div><nowiki>b||c</nowiki></div>''
23516 |}
23517 !! html/php
23518 <table>
23519 <tr>
23520 <td>foo||bar
23521 </td>
23522 <td>a<i>b||c</i>
23523 </td>
23524 <td>a<i><div>b||c</div></i>
23525 </td></tr></table>
23526
23527 !! end
23528
23529 !! test
23530 Tables: 2c. Nested in td -- no escaping needed
23531 !! options
23532 parsoid=html2wt
23533 !! html/*
23534 <table>
23535 <tr>
23536 <td>foo!!bar
23537 </td></tr></table>
23538
23539 !! wikitext
23540 {|
23541 |foo!!bar
23542 |}
23543 !! end
23544
23545 !! test
23546 Tables: 3a. Nested in th
23547 !! options
23548 parsoid=html2wt
23549 !! html/*
23550 <table>
23551 <tr>
23552 <th>foo!bar
23553 </th></tr></table>
23554
23555 !! wikitext
23556 {|
23557 !foo!bar
23558 |}
23559 !! end
23560
23561 !! test
23562 Tables: 3b. Nested in th
23563 !! options
23564 parsoid=html2wt
23565 !! html/parsoid
23566 <table><tbody>
23567 <tr><th>foo!!bar</th>
23568 <th><i>foo|bar</i></th>
23569 <th><i>foo!!bar</i></th>
23570 <th><i><span>foo!!bar</span></i></th>
23571 </tr></tbody></table>
23572 !! wikitext
23573 {|
23574 !<nowiki>foo!!bar</nowiki>
23575 !''<nowiki>foo|bar</nowiki>''
23576 !''<nowiki>foo!!bar</nowiki>''
23577 !''<span><nowiki>foo!!bar</nowiki></span>''
23578 |}
23579 !! html/php
23580 <table>
23581 <tr>
23582 <th>foo!!bar
23583 </th>
23584 <th><i>foo|bar</i>
23585 </th>
23586 <th><i>foo!!bar</i>
23587 </th>
23588 <th><i><span>foo!!bar</span></i>
23589 </th></tr></table>
23590
23591 !! end
23592
23593 !! test
23594 Tables: 3c. Nested in th
23595 !! options
23596 parsoid=html2wt
23597 !! html/parsoid
23598 <table><tbody>
23599 <tr><th>foo||bar</th>
23600 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23601 </tr></tbody></table>
23602 !! wikitext
23603 {|
23604 !<nowiki>foo||bar</nowiki>
23605 !<nowiki>foo||bar</nowiki>
23606 |}
23607 !! html/php
23608 <table>
23609 <tr>
23610 <th>foo||bar
23611 </th>
23612 <th>foo||bar
23613 </th></tr></table>
23614
23615 !! end
23616
23617 !! test
23618 Tables: 4a. Escape -
23619 !! options
23620 parsoid=html2wt
23621 !! html/*
23622 <table>
23623 <tr>
23624 <th>-bar
23625 </th></tr>
23626 <tr>
23627 <td>-bar
23628 </td></tr></table>
23629
23630 !! wikitext
23631 {|
23632 !-bar
23633 |-
23634 |<nowiki>-bar</nowiki>
23635 |}
23636 !! end
23637
23638 !! test
23639 Tables: 4b. Escape +
23640 !! options
23641 parsoid=html2wt
23642 !! html/*
23643 <table>
23644 <tr>
23645 <th>+bar
23646 </th></tr>
23647 <tr>
23648 <td>+bar
23649 </td></tr></table>
23650
23651 !! wikitext
23652 {|
23653 !+bar
23654 |-
23655 |<nowiki>+bar</nowiki>
23656 |}
23657 !! end
23658
23659 !! test
23660 Tables: 4c. No escaping needed
23661 !! options
23662 parsoid=html2wt
23663 !! html/parsoid
23664 <table><tbody>
23665 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23666 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23667 <tr><td>foo
23668 <p>bar|baz
23669 +bar
23670 -bar</p></td></tr>
23671 <tr><td>x
23672 <div>a|b</div></td>
23673 </tbody></table>
23674 !! wikitext
23675 {|
23676 |foo-bar
23677 |foo+bar
23678 |-
23679 |''foo''-bar
23680 |''foo''+bar
23681 |-
23682 |foo
23683 bar|baz
23684 +bar
23685 -bar
23686 |-
23687 |x
23688 <div>a|b</div>
23689 |}
23690 !! html/php
23691 <table>
23692 <tr>
23693 <td>foo-bar
23694 </td>
23695 <td>foo+bar
23696 </td></tr>
23697 <tr>
23698 <td><i>foo</i>-bar
23699 </td>
23700 <td><i>foo</i>+bar
23701 </td></tr>
23702 <tr>
23703 <td>foo
23704 <p>bar|baz
23705 +bar
23706 -bar
23707 </p>
23708 </td></tr>
23709 <tr>
23710 <td>x
23711 <div>a|b</div>
23712 </td></tr></table>
23713
23714 !! end
23715
23716 !! test
23717 Tables: 4d. No escaping needed
23718 !! options
23719 parsoid=html2wt
23720 !! html/parsoid
23721 <table>
23722 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23723 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23724 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23725 </tbody></table>
23726 !! wikitext
23727 {|
23728 |[[Foo]]-bar
23729 ||+1
23730 ||-2
23731 |}
23732 !! html/php
23733 <table>
23734 <tr>
23735 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23736 </td>
23737 <td>+1
23738 </td>
23739 <td>-2
23740 </td></tr></table>
23741
23742 !! end
23743
23744 !! test
23745 T97430: Don't emit empty nowiki pairs around marker meta tags
23746 !! options
23747 parsoid=html2wt
23748 !! html/parsoid
23749 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23750 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23751 !! wikitext
23752 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23753 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23754 !! end
23755
23756 !! test
23757 Unclosed xmlish element in table line shouldn't eat end delimiters
23758 !! options
23759 parsoid=html2wt
23760 !! html/parsoid
23761 <table>
23762 <tbody><tr><td> &lt;foo</td>
23763 <td> bar></td></tr>
23764 </tbody></table>
23765 !! wikitext
23766 {|
23767 | <foo
23768 | bar>
23769 |}
23770 !! html/php
23771 <table>
23772 <tr>
23773 <td> &lt;foo
23774 </td>
23775 <td> bar&gt;
23776 </td></tr></table>
23777
23778 !! end
23779
23780 #### --------------- Links ----------------
23781 #### 1. Quote marks in link text
23782 #### 2. Wikilinks: Escapes needed
23783 #### 3. Wikilinks: No escapes needed
23784 #### 4. Extlinks: Escapes needed
23785 #### 5. Extlinks: No escapes needed
23786 #### --------------------------------------
23787 !! test
23788 Links 1. WikiLinks: No escapes needed
23789 !! options
23790 parsoid=html2wt
23791 !! html/parsoid
23792 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23793 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23794 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23795 !! wikitext
23796 [[Foo|Foo''boo'']]
23797 [[Foo|[Foobar]]]
23798 [[Foo|x [Foobar] x]]
23799 !! html/php
23800 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23801 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23802 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23803 </p>
23804 !! end
23805
23806 !! test
23807 Links 2. WikiLinks: Escapes needed
23808 !! options
23809 parsoid=html2wt
23810 !! html/parsoid
23811 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23812 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23813 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23814 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23815 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23816 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23817 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23818 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23819 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23820 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23821 !! wikitext
23822 [[Foo|<nowiki>Foobar]</nowiki>]]
23823 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23824 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23825 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23826 [[Foo|<nowiki>|Bar</nowiki>]]
23827 [[Foo|<nowiki>]]bar</nowiki>]]
23828 [[Foo|<nowiki>[[bar</nowiki>]]
23829 [[Foo|<nowiki>x [[ y</nowiki>]]
23830 [[Foo|<nowiki>x ]] y</nowiki>]]
23831 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23832 !! html/php
23833 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23834 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23835 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23836 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23837 <a href="/wiki/Foo" title="Foo">|Bar</a>
23838 <a href="/wiki/Foo" title="Foo">]]bar</a>
23839 <a href="/wiki/Foo" title="Foo">[[bar</a>
23840 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23841 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23842 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23843 </p>
23844 !! end
23845
23846 !! test
23847 Links 3. WikiLinks: No escapes needed
23848 !! options
23849 parsoid=html2wt
23850 !! html/parsoid
23851 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23852 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23853 !! wikitext
23854 [[Foo|[Foobar]]
23855 [[Foo|foo|bar]]
23856 !! html/php
23857 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23858 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23859 </p>
23860 !! end
23861
23862 !! test
23863 Links 4. ExtLinks: Escapes needed
23864 !! options
23865 parsoid=html2wt
23866 !! html/parsoid
23867 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23868 <a rel="mw:ExtLink" href="http://google.com">google]</a>
23869 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
23870 <p>[http://google.com]</p>
23871 <p>[http://google.com google]</p>
23872 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23873 <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>
23874 !! wikitext
23875 [http://google.com <nowiki>[google]</nowiki>]
23876 [http://google.com <nowiki>google]</nowiki>]
23877 [http://google.com <nowiki>goog] le</nowiki>]
23878
23879 <nowiki>[http://google.com]</nowiki>
23880
23881 <nowiki>[http://google.com google]</nowiki>
23882
23883 [http://google.com<nowiki>]</nowiki>
23884
23885 [{{echo|http://google.com}}<nowiki>]</nowiki>
23886 !! html/php
23887 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23888 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23889 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
23890 </p><p>[http://google.com]
23891 </p><p>[http://google.com google]
23892 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23893 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23894 </p>
23895 !! end
23896
23897 !! test
23898 Links 5. ExtLinks: No escapes needed
23899 !! options
23900 parsoid=html2wt
23901 !! html/parsoid
23902 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23903 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23904 !! wikitext
23905 [http://google.com [google]
23906
23907 [[http://google.com]]
23908 !! html/php
23909 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23910 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23911 </p>
23912 !! end
23913
23914 !! test
23915 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
23916 !! options
23917 parsoid=html2wt
23918 !! html/parsoid
23919 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23920 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23921 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23922 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23923 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23924 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23925 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23926 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23927 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23928 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23929 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23930 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23931 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23932 </p>
23933 !! wikitext
23934 x<nowiki/>http://example.com<nowiki/>y
23935 http://example.com<nowiki/>?x
23936 http://example.com<nowiki/>&x
23937 http://example.com<nowiki/>'x
23938 http://example.com<nowiki/>,x
23939 http://example.com<nowiki/>.x
23940 http://example.com<nowiki/>;x
23941 http://example.com<nowiki/>:x
23942 http://example.com<nowiki/>;x
23943 http://example.com<nowiki/>!x
23944 http://example.com<nowiki/>=x
23945 http://example.com<nowiki/>(x)
23946 http://example.com(x<nowiki/>)
23947 !! end
23948
23949 !! test
23950 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
23951 !! options
23952 parsoid=html2wt
23953 !! html/parsoid
23954 <p>x
23955 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23956 y
23957 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23958 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23959 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23960 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23961 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23962 </p>
23963 !! wikitext
23964 x
23965 http://example.com
23966 y
23967 "http://example.com"
23968 (http://example.com)
23969 (http://example.com) foo
23970 http://example.com,
23971 http://example.com, foo
23972 !! html/php
23973 <p>x
23974 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23975 y
23976 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23977 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23978 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23979 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23980 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23981 </p>
23982 !! end
23983
23984 !! test
23985 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
23986 !! options
23987 parsoid=html2wt
23988 !! html/parsoid
23989 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23990 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23991 !! wikitext
23992 http://example.com.,;:!?\
23993 -http://example.com:
23994 !! html/php
23995 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23996 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23997 </p>
23998 !! end
23999
24000 !! test
24001 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
24002 !! options
24003 parsoid=html2wt
24004 !! html/parsoid
24005 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
24006 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
24007 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
24008 !! wikitext
24009 RFC 123<nowiki/>4
24010 RFC 123<nowiki/>y
24011 X<nowiki/>RFC 123<nowiki/>y
24012 !! end
24013
24014 !! test
24015 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
24016 !! options
24017 parsoid=html2wt
24018 !! html/parsoid
24019 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24020 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24021 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24022 </p>
24023 !! wikitext
24024 RFC 123?foo
24025 RFC 123&foo
24026 -RFC 123-
24027 !! html/php
24028 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24029 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24030 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24031 </p>
24032 !! end
24033
24034 !! test
24035 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
24036 !! options
24037 parsoid=html2wt
24038 !! html/parsoid
24039 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24040 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24041 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24042 !! wikitext
24043 PMID 123<nowiki/>4
24044 PMID 123<nowiki/>y
24045 X<nowiki/>PMID 123<nowiki/>y
24046 !! end
24047
24048 !! test
24049 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
24050 !! options
24051 parsoid=html2wt
24052 !! html/parsoid
24053 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24054 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24055 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24056 </p>
24057 !! wikitext
24058 PMID 123?foo
24059 PMID 123&foo
24060 -PMID 123-
24061 !! html/php
24062 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24063 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24064 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24065 </p>
24066 !! end
24067
24068 !! test
24069 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
24070 !! options
24071 parsoid=html2wt
24072 !! html/parsoid
24073 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24074 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24075 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24076 </p>
24077 !! wikitext
24078 ISBN 1234567890<nowiki/>1
24079 ISBN 1234567890<nowiki/>x
24080 a<nowiki/>ISBN 1234567890<nowiki/>b
24081 !! end
24082
24083 !! test
24084 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
24085 !! options
24086 parsoid=html2wt
24087 !! html/parsoid
24088 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24089 !! wikitext
24090 -ISBN 1234567890's
24091 !! html/php
24092 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24093 </p>
24094 !! end
24095
24096 !! test
24097 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24098 !! options
24099 parsoid=html2wt
24100 !! html/*
24101 <p>this is not a link: http://example.com
24102 </p>
24103 !! wikitext
24104 this is not a link: <nowiki>http://example.com</nowiki>
24105 !! end
24106
24107 !! test
24108 Links 15. Link trails can't become link prefixes.
24109 !! options
24110 language=is
24111 parsoid=html2wt
24112 !! html/parsoid
24113 <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>
24114 !! wikitext
24115 [[Söfnuður]]-[[00]]
24116 !! html/php
24117 <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>
24118 </p>
24119 !! end
24120
24121 #### --------------- Quotes ---------------
24122 #### 1. Quotes inside <b> and <i>
24123 #### 2. Link fragments separated by <i> and <b> tags
24124 #### 3. Link fragments inside <i> and <b>
24125 #### 4. No escaping needed
24126 #### --------------------------------------
24127 !! test
24128 1a. Quotes inside <b> and <i>
24129 !! options
24130 parsoid=html2wt
24131 !! html/*
24132 <p><i>'foo'</i>
24133 <i>''foo''</i>
24134 <i>'''foo'''</i>
24135 <i>foo</i>'s
24136 <b>'foo'</b>
24137 <b>''foo''</b>
24138 <b>'''foo'''</b>
24139 <b>foo'<i>bar'</i>baz</b>
24140 <b>foo</b>'s
24141 '<i>foo</i>
24142 <i>foo</i>'
24143 <i>foo'</i>'
24144 '<i>foo</i>'
24145 '<b>foo</b>
24146 <b>foo</b>'
24147 '<b>foo</b>'
24148 <i>fools'<span> errand</span></i>
24149 <i><span>fool</span>'s errand</i>
24150 '<i>foo</i> bar '<i>baz</i>
24151 a|!*#-:;+-~[]{}b'<i>x</i>
24152 </p>
24153 !! wikitext
24154 ''<nowiki/>'foo'''
24155 ''<nowiki>''foo''</nowiki>''
24156 ''<nowiki>'''foo'''</nowiki>''
24157 ''foo''<nowiki/>'s
24158 '''<nowiki/>'foo''''
24159 '''<nowiki>''foo''</nowiki>'''
24160 '''<nowiki>'''foo'''</nowiki>'''
24161 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24162 '''foo'''<nowiki/>'s
24163 '''foo''
24164 ''foo''<nowiki/>'
24165 ''foo'''<nowiki/>'
24166 '''foo''<nowiki/>'
24167 ''''foo'''
24168 '''foo'''<nowiki/>'
24169 ''''foo'''<nowiki/>'
24170 ''fools'<span> errand</span>''
24171 ''<span>fool</span>'s errand''
24172 '<nowiki/>''foo'' bar '''baz''
24173 a|!*#-:;+-~[]{}b'''x''
24174 !! end
24175
24176 !! test
24177 1b. Quotes inside <b> and <i> with other tags on same line
24178 !! options
24179 parsoid=html2wt
24180 !! html/parsoid
24181 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24182 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24183 <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>
24184 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24185 '<i>foo</i> <span class="mw-ref" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
24186 '<i>foo</i> <div title="name">test</div>
24187 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24188 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24189 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">test</span></li>
24190 </ol>
24191 !! wikitext
24192 '''a'' foo ''[[bar]]''
24193 ''a''' foo ''[[bar]]''
24194 ''a''' foo '''{{echo|[[bar]]}}'''
24195 [[foo]] x'''[[bar]]''
24196 '''foo'' <ref>test</ref>
24197 '''foo'' <div title="name">test</div>
24198 '''foo'' and <br> bar
24199 <references />
24200 !! end
24201
24202 !! test
24203 2. Link fragments separated by <i> and <b> tags
24204 !! options
24205 parsoid=html2wt
24206 !! html/parsoid
24207 <p>[[<i>foo</i>hello]]</p>
24208 <p>[[<b>foo</b>hello]]</p>
24209 !! wikitext
24210 [[''foo''<nowiki>hello]]</nowiki>
24211
24212 [['''foo'''<nowiki>hello]]</nowiki>
24213 !! end
24214
24215 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24216 # this is one of the shortcomings of this format
24217 !! test
24218 3. Link fragments inside <i> and <b>
24219 !! options
24220 parsoid=html2wt
24221 !! html/parsoid
24222 <p><i>[[foo</i>]]</p>
24223 <p><b>[[foo</b>]]</p>
24224 !! wikitext
24225 ''[[foo''<nowiki>]]</nowiki>
24226
24227 '''[[foo'''<nowiki>]]</nowiki>
24228 !! end
24229
24230 !! test
24231 4. No escaping needed
24232 !! options
24233 parsoid=html2wt
24234 !! html/parsoid
24235 <p>'<span><i>bar</i></span>'
24236 '<span><b>bar</b></span>'
24237 'a:b'foo
24238 </p>
24239 !! wikitext
24240 '<span>''bar''</span>'
24241 '<span>'''bar'''</span>'
24242 'a:b'foo
24243 !! end
24244
24245 #### ----------- Paragraphs ---------------
24246 #### 1. No unnecessary escapes
24247 #### --------------------------------------
24248
24249 !! test
24250 1. No unnecessary escapes
24251 !! options
24252 parsoid=html2wt
24253 !! html/parsoid
24254 <p>bar <span>[[foo]]</span>
24255 </p><p>=bar <span>[[foo]]</span>
24256 </p><p>[[bar <span>[[foo]]</span>
24257 </p><p>]]bar <span>[[foo]]</span>
24258 </p><p>=bar <span>foo]]</span>=
24259 </p>
24260 !! wikitext
24261 bar <span><nowiki>[[foo]]</nowiki></span>
24262
24263 =bar <span><nowiki>[[foo]]</nowiki></span>
24264
24265 [[bar <span><nowiki>[[foo]]</nowiki></span>
24266
24267 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24268
24269 =bar <span>foo]]</span><nowiki>=</nowiki>
24270 !!end
24271
24272 #### ----------------------- PRE --------------------------
24273 #### 1. Leading whitespace in SOL context should be escaped
24274 #### ------------------------------------------------------
24275 !! test
24276 1. Leading whitespace in SOL context should be escaped
24277 !! options
24278 parsoid=html2wt
24279 !! html/parsoid
24280 <p> a</p>
24281
24282 <p> a</p>
24283
24284 <p> a(tab)</p>
24285
24286 <p> a
24287 <!--cmt-->
24288 a</p>
24289
24290 <p>a
24291 b</p>
24292
24293 <p>a
24294 b</p>
24295
24296 <p>a
24297 b</p>
24298 !! wikitext
24299 <nowiki> </nowiki>a
24300
24301 <nowiki> </nowiki> a
24302
24303 a(tab)
24304
24305 <nowiki> </nowiki> a
24306 <!--cmt-->
24307 <nowiki> </nowiki>a
24308
24309 a
24310 <nowiki> </nowiki>b
24311
24312 a
24313 b
24314
24315 a
24316 b
24317 !! html/php
24318 <p> a
24319 </p><p> a
24320 </p><p> a(tab)
24321 </p><p> a
24322 a
24323 </p><p>a
24324 b
24325 </p><p>a
24326 b
24327 </p><p>a
24328 b
24329 </p>
24330 !! end
24331
24332 !! test
24333 2. Leading whitespace in non-indent-pre contexts should not be escaped
24334 !! options
24335 parsoid=html2wt
24336 !! html/parsoid
24337 <p>foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
24338 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24339 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><i>a</i>
24340 b</span></li>
24341 </ol>
24342 !! wikitext
24343 foo <ref>''a''
24344 b</ref>
24345 <references />
24346 !! end
24347
24348 !! test
24349 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24350 !! options
24351 parsoid=html2wt
24352 !! html/parsoid
24353 <blockquote>
24354 <p>
24355 a
24356 <span>b</span>
24357 c</p>
24358 </blockquote>
24359 !! wikitext
24360 <blockquote>
24361 a
24362 <span>b</span>
24363 c
24364 </blockquote>
24365 !! end
24366
24367 !! test
24368 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24369 !! options
24370 parsoid=html2wt
24371 !! html/parsoid
24372 <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>
24373 !! wikitext
24374 [[File:Foobar.jpg|thumb|caption]]
24375 !! end
24376
24377 !! test
24378 5. Nowiki escaping should account for indent-pres
24379 !! options
24380 parsoid=html2wt
24381 !! html/parsoid
24382 <pre>==foo==</pre>
24383 !! wikitext
24384 ==foo==
24385 !! end
24386
24387 !!test
24388 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24389 !! options
24390 parsoid=html2wt
24391 !! html/parsoid
24392 <pre>
24393 * foo
24394 * bar
24395 </pre>
24396 !! wikitext
24397 * foo
24398 * bar
24399 !! end
24400
24401 #### --------------- Behavior Switches --------------------
24402
24403 !! test
24404 1. Valid behavior switches should be escaped
24405 !! options
24406 parsoid=html2wt
24407 !! html/parsoid
24408 __TOC__
24409 <i>__TOC__</i>
24410 !! wikitext
24411 <nowiki>__TOC__</nowiki>
24412 ''<nowiki>__TOC__</nowiki>''
24413 !! end
24414
24415 !! test
24416 2. Invalid behavior switches should not be escaped
24417 !! options
24418 parsoid=html2wt
24419 !! html/parsoid
24420 __TOO__
24421 __|__
24422 !! wikitext
24423 __TOO__
24424 __|__
24425 !! end
24426
24427 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24428 !! test
24429 Behavior switches should be SOL-transparent
24430 !! options
24431 parsoid=html2wt
24432 !! html/parsoid
24433 <meta property="mw:PageProp/toc" />
24434
24435 <!-- this one's bogus -->
24436 <pre>__TOO__</pre>
24437
24438 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24439
24440 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24441 !! wikitext
24442 __TOC__
24443
24444 <!-- this one's bogus -->
24445 __TOO__
24446
24447 __TOC__ foo
24448
24449 __TOC__
24450 bar
24451 !! end
24452
24453 #### --------------- HTML tags ---------------
24454 #### 1. a tags
24455 #### 2. other tags
24456 #### 3. multi-line html tag
24457 #### 4. extension tags
24458 #### -----------------------------------------
24459 !! test
24460 1. a tags
24461 !! options
24462 parsoid=html2wt
24463 !! html/parsoid
24464 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24465 !! wikitext
24466 <a href="http://google.com">google</a>
24467 !! end
24468
24469 !! test
24470 2. other tags
24471 !! options
24472 parsoid=html2wt
24473 !! html/parsoid
24474 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24475 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24476 <li> &lt;td&gt;</li></ul>
24477
24478 !! wikitext
24479 * <nowiki><div>foo</div></nowiki>
24480 * <nowiki><div style="color:red">foo</div></nowiki>
24481 * <nowiki><td></nowiki>
24482 !! end
24483
24484 !! test
24485 3. multi-line html tag
24486 !! options
24487 parsoid=html2wt
24488 !! html/parsoid
24489 <p>&lt;div
24490 &gt;foo&lt;/div
24491 &gt;
24492 </p>
24493 !! wikitext
24494 <nowiki><div
24495 >foo</div
24496 ></nowiki>
24497 !! end
24498
24499 !! test
24500 4. extension tags
24501 !! options
24502 parsoid=html2wt
24503 !! html/parsoid
24504 <p>&lt;ref&gt;foo&lt;/ref&gt;
24505 </p><p>&lt;ref&gt;bar
24506 </p><p>baz&lt;/ref&gt;
24507 </p>
24508 !! wikitext
24509 <nowiki><ref>foo</ref></nowiki>
24510
24511 <nowiki><ref>bar</nowiki>
24512
24513 baz<nowiki></ref></nowiki>
24514 !! end
24515
24516 #### --------------- Others ---------------
24517 !! test
24518 Escaping nowikis
24519 !! options
24520 parsoid=html2wt
24521 !! html/parsoid
24522 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24523 </p>
24524 !! wikitext
24525 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24526 !! end
24527
24528 ## The quote-char in the input is necessary for triggering the bug
24529 !! test
24530 (T54035) Nowiki-escaping should not get tripped by " :" in text
24531 !! options
24532 parsoid=html2wt
24533 !! html/parsoid
24534 <p>foo's bar :</p>
24535 !! wikitext
24536 foo's bar :
24537 !! end
24538
24539 #----------- End of wikitext escaping tests --------------
24540
24541 !! test
24542
24543 Tag-like HTML structures are passed through as text
24544 !! wikitext
24545 <x y>
24546
24547 <x.y>
24548
24549 <x-y>
24550
24551 1>2
24552
24553 x<y
24554
24555 a>b
24556
24557 1<d e>f
24558 !! html
24559 <p>&lt;x y&gt;
24560 </p><p>&lt;x.y&gt;
24561 </p><p>&lt;x-y&gt;
24562 </p><p>1&gt;2
24563 </p><p>x&lt;y
24564 </p><p>a&gt;b
24565 </p><p>1&lt;d e&gt;f
24566 </p>
24567 !! end
24568
24569 !! test
24570 HTML tag with necessary entities in attributes
24571 !! wikitext
24572 <span title="&amp;amp;">foo</span>
24573 !! html
24574 <p><span title="&amp;amp;">foo</span>
24575 </p>
24576 !! end
24577
24578 !! test
24579 HTML tag with 'unnecessary' entity encoding in attributes
24580 !! wikitext
24581 <span title="&amp;">foo</span>
24582 !! html
24583 <p><span title="&amp;">foo</span>
24584 </p>
24585 !! end
24586
24587 !! test
24588 HTML tag with broken attribute value quoting
24589 !! options
24590 parsoid=wt2html,html2html
24591 !! wikitext
24592 <span title="Hello world>Foo</span>
24593 !! html/php
24594 <p><span title="Hello world">Foo</span>
24595 </p>
24596 !! html/parsoid
24597 <p><span title="Hello world">Foo</span></p>
24598 !! end
24599
24600 !! test
24601 Self-closed tag with broken attribute value quoting
24602 !! options
24603 parsoid=wt2html,html2html
24604 !! wikitext
24605 <div title="Hello world />Foo
24606 !! html/php+tidy
24607 <div title="Hello world"></div>
24608 <p>Foo</p>
24609 !! html/parsoid
24610 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24611 !! end
24612
24613 !! test
24614 Table with broken attribute value quoting
24615 !! options
24616 parsoid=wt2html,html2html
24617 !! wikitext
24618 {|
24619 | title="Hello world|Foo
24620 |}
24621 !! html/php
24622 <table>
24623 <tr>
24624 <td title="Hello world">Foo
24625 </td></tr></table>
24626
24627 !! html/parsoid
24628 <table>
24629 <tr>
24630 <td title="Hello world">Foo
24631 </td></tr></table>
24632
24633 !! end
24634
24635 !! test
24636 Table with broken attribute value quoting on consecutive lines
24637 !! options
24638 parsoid=wt2html,html2html
24639 !! wikitext
24640 {|
24641 | title="Hello world|Foo
24642 | style="color:red|Bar
24643 |}
24644 !! html/php
24645 <table>
24646 <tr>
24647 <td title="Hello world">Foo
24648 </td>
24649 <td style="color:red">Bar
24650 </td></tr></table>
24651
24652 !! html/parsoid
24653 <table><tbody>
24654 <tr>
24655 <td title="Hello world">Foo
24656 </td><td style="color: red">Bar
24657 </td></tr></tbody></table>
24658
24659 !! end
24660
24661 !!test
24662 Accept empty td cell attribute
24663 !! wikitext
24664 {|
24665 | align="center" | foo || |
24666 |}
24667 !! html
24668 <table>
24669 <tr>
24670 <td align="center"> foo </td>
24671 <td>
24672 </td></tr></table>
24673
24674 !!end
24675
24676 !!test
24677 Non-empty attributes in th-cells
24678 !! wikitext
24679 {|
24680 ! Foo !! style="color: red" | Bar
24681 |}
24682 !! html
24683 <table>
24684 <tr>
24685 <th> Foo </th>
24686 <th style="color: red"> Bar
24687 </th></tr></table>
24688
24689 !!end
24690
24691 !!test
24692 Accept empty attributes in th-cells
24693 !! wikitext
24694 {|
24695 !| foo !!| bar
24696 |}
24697 !! html
24698 <table>
24699 <tr>
24700 <th> foo </th>
24701 <th> bar
24702 </th></tr></table>
24703
24704 !!end
24705
24706 !!test
24707 Empty table rows go away
24708 !! wikitext
24709 {|
24710 | Hello
24711 | there
24712 |- class="foo"
24713 |-
24714 |}
24715 !! html
24716 <table>
24717 <tr>
24718 <td> Hello
24719 </td>
24720 <td> there
24721 </td></tr>
24722
24723 </table>
24724
24725 !! end
24726
24727 ###
24728 ### Parsoid-centric tests for testing RTing of inter-element separators
24729 ### Edge cases not tested by existing parser tests and specific to
24730 ### Parsoid-specific serialization strategies.
24731 ###
24732
24733 !!test
24734 RT-ed inter-element separators should be valid separators
24735 !! wikitext
24736 {|
24737 |- [[foo]]
24738 |}
24739 !! html/php
24740 <table>
24741
24742 </table>
24743
24744 !! html/parsoid
24745 <table>
24746 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24747 </tbody></table>
24748 !!end
24749
24750 # Parsoid-only since PHP parser relies on Tidy for correct output
24751 !!test
24752 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24753 !!options
24754 parsoid
24755 !! wikitext
24756 {|
24757 |<small>foo
24758 bar
24759 |}
24760
24761 {|
24762 |<small>foo<small>
24763 |}
24764 !! html
24765 <table>
24766 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24767 <p>bar</p></small></td></tr>
24768 </tbody></table>
24769
24770 <table>
24771 <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>
24772 </tbody></table>
24773 !!end
24774
24775 # Note that the "style" attribute is really a template parameter here.
24776 # The = would have to be {{=}} if you wanted the literal.
24777 !!test
24778 Empty TD followed by TD with tpl-generated attribute
24779 !! wikitext
24780 {|
24781 |-
24782 |
24783 |{{echo|style='color:red'}}|foo
24784 |}
24785 !! html
24786 <table>
24787
24788 <tr>
24789 <td>
24790 </td>
24791 <td>foo
24792 </td></tr></table>
24793
24794 !!end
24795
24796 !!test
24797 Indented table with an empty td
24798 !! wikitext
24799 {|
24800 |-
24801 |
24802 |foo
24803 |}
24804 !! html
24805 <table>
24806
24807 <tr>
24808 <td>
24809 </td>
24810 <td>foo
24811 </td></tr></table>
24812
24813 !!end
24814
24815 ## We have some newline diffs RT-ing this edge case
24816 ## and it is not important enough -- we seem to be emitting
24817 ## at most 2 newlines after a </tr> and this is unrelated to
24818 ## the issue from T85627 that this is testing.
24819 !!test
24820 Indented table with blank lines in between (T85627)
24821 !! options
24822 parsoid=wt2html
24823 !! wikitext
24824 {|
24825 |foo
24826
24827
24828 |}
24829 !! html
24830 <table>
24831
24832 <tr>
24833 <td>foo
24834 </td></tr></table>
24835
24836 !!end
24837
24838 !!test
24839 Indented block & table
24840 !! wikitext
24841 <div>foo</div>
24842 {|
24843 |foo
24844 |}
24845 !! html/php
24846 <div>foo</div>
24847 <table>
24848 <tr>
24849 <td>foo
24850 </td></tr></table>
24851
24852 !! html/parsoid
24853 <div data-parsoid='{"stx":"html"}'>foo</div>
24854 <table><tbody>
24855 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24856 </tbody></table>
24857 !!end
24858
24859 !! test
24860 Indent and comment before table row
24861 !! wikitext
24862 {|
24863 <!--hi-->|-
24864 | there
24865 |}
24866 !! html/php
24867 <table>
24868
24869 <tr>
24870 <td> there
24871 </td></tr></table>
24872
24873 !! html/parsoid
24874 <table>
24875 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24876 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24877 </tbody></table>
24878 !! end
24879
24880 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24881 !!test
24882 Empty TR followed by a template-generated TR
24883 !!options
24884 parsoid
24885 !! wikitext
24886 {|
24887 |-
24888 {{echo|<tr><td>foo</td></tr>}}
24889 |}
24890 !! html
24891 <table>
24892 <tbody>
24893 <tr></tr>
24894 <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}}]}'>
24895 <td>foo</td></tr>
24896 </tbody></table>
24897 !!end
24898
24899 ## PHP and parsoid output differ for this, and since this is primarily
24900 ## for testing Parsoid's serializer, marking this Parsoid only
24901 !!test
24902 Empty TR followed by mixed-ws-comment line should RT correctly
24903 !!options
24904 parsoid
24905 !! wikitext
24906 {|
24907 |-
24908 <!--c-->
24909 |-
24910 <!--c--> <!--d-->
24911 |}
24912 !! html
24913 <table>
24914 <tbody>
24915 <tr></tr>
24916 <!--c-->
24917 <tr>
24918 <!--c--> </tr><!--d-->
24919 </tbody></table>
24920
24921 !!end
24922
24923 !!test
24924 Multi-line image caption generated by templates with/without trailing newlines
24925 !! wikitext
24926 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24927 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24928 !! html/parsoid
24929 <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>
24930 <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>
24931 !!end
24932
24933 !! test
24934 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24935 !! options
24936 parsoid=html2wt
24937 !! html/parsoid
24938 <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>
24939
24940 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24941 !! wikitext
24942 <includeonly>foo</includeonly>
24943 new para
24944
24945 [[Category:Foo]]
24946
24947 = new heading =
24948 !! end
24949
24950 ## PHP emits broken html for this, and since this is primarily
24951 ## a Parsoid serializer test, marking this Parsoid only
24952 !!test
24953 Improperly nested inline or quotes tags with whitespace in between
24954 !! wikitext
24955 <span> <s>x</span> </s>
24956 ''' ''x''' ''
24957 !! html/parsoid
24958 <p><span> <s>x</s></span><s> </s>
24959 <b> <i>x</i></b><i> </i>
24960 </p>
24961 !!end
24962
24963 !!test
24964 Encapsulate protected attributes from wt
24965 !! wikitext
24966 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24967
24968 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
24969 | ok
24970 |}
24971 !! html/parsoid
24972 <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>
24973
24974 <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">
24975 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
24976 </tbody></table>
24977 !!end
24978
24979 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24980 ## Having nested or stray pre tags results in the attempt to add duplicates,
24981 ## causing an assertion fail. This test tries to prevent that situation.
24982 !!test
24983 Ensure ParagraphWrapper can deal with stray closing pre tags
24984 !!options
24985 parsoid=wt2html
24986 !! wikitext
24987 plain text</pre>
24988 !! html/parsoid
24989 plain text
24990 !!end
24991
24992 !!test
24993 1. Ensure fostered text content is wrapped in element nodes
24994 !!options
24995 parsoid=wt2html
24996 !! wikitext
24997 <table>hi</table><table>ho</table>
24998 !! html/parsoid
24999 <p>hi</p>
25000 <table></table>
25001 <p>ho</p>
25002 <table></table>
25003 !!end
25004
25005 !!test
25006 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
25007 !!options
25008 parsoid=wt2html,wt2wt
25009 !! wikitext
25010 <table>
25011 <tr> || ||
25012 <td> a
25013 </table>
25014 !! html/parsoid
25015 <p> || ||
25016 </p><table>
25017 <tbody><tr><td> a</td></tr>
25018 </tbody></table>
25019 !!end
25020
25021 !!test
25022 Encapsulation properly handles null DSR information from foster box
25023 !!options
25024 parsoid=wt2html,wt2wt
25025 !! wikitext
25026 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25027 !! html/parsoid
25028 <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>
25029 !!end
25030
25031 !!test
25032 1. Encapsulate foster-parented transclusion content
25033 !!options
25034 parsoid=wt2wt,wt2html
25035 !! wikitext
25036 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25037 !! html/parsoid
25038 <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>
25039 <tbody>
25040 <tr>
25041 <td>bar</td>
25042 </tr>
25043 </tbody>
25044 </table>
25045 !!end
25046
25047 !!test
25048 2. Encapsulate foster-parented transclusion content
25049 !!options
25050 parsoid=wt2wt,wt2html
25051 !! wikitext
25052 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25053 !! html/parsoid
25054 <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>
25055 <table>
25056 <tbody>
25057 <tr>
25058 <td>bar</td>
25059 </tr>
25060 </tbody>
25061 </table>
25062 !!end
25063
25064 !!test
25065 3. Encapsulate foster-parented transclusion content
25066 !!options
25067 parsoid=wt2wt,wt2html
25068 !! wikitext
25069 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25070 !! html/parsoid
25071 <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;]}">
25072 <p>foo</p>
25073 </div>
25074 <table>
25075 <tbody>
25076 <tr>
25077 <td>bar</td>
25078 </tr>
25079 </tbody>
25080 </table>
25081 !!end
25082
25083 !!test
25084 4. Encapsulate foster-parented transclusion content
25085 !!options
25086 parsoid=wt2wt,wt2html
25087 !! wikitext
25088 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25089 !! html/parsoid
25090 <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;]}">
25091 <p>foo</p>
25092 </div>
25093 <table>
25094 <tbody>
25095 <tr>
25096 <td>bar</td>
25097 </tr>
25098 </tbody>
25099 </table>
25100 !!end
25101
25102 !!test
25103 5. Encapsulate foster-parented transclusion content
25104 !!options
25105 parsoid=wt2wt,wt2html
25106 !! wikitext
25107 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25108 !! html/parsoid
25109 <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>
25110 <table>
25111 <tbody>
25112 <tr>
25113 <td>
25114 <div>
25115 <p>foo</p>
25116 </div>
25117 </td>
25118 </tr>
25119 </tbody>
25120 </table>
25121 !!end
25122
25123 !!test
25124 6. Encapsulate foster-parented transclusion content
25125 !!options
25126 parsoid=wt2wt,wt2html
25127 !! wikitext
25128 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25129 !! html/parsoid
25130 <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>
25131 <table>
25132 <tbody>
25133 <tr>
25134 <td>
25135 <div>
25136 <p>foo</p>
25137 </div>
25138 </td>
25139 </tr>
25140 </tbody>
25141 </table>
25142 <p>ok</p>
25143 !!end
25144
25145 !!test
25146 7. Encapsulate foster-parented transclusion content
25147 !!options
25148 parsoid=wt2wt,wt2html
25149 !! wikitext
25150 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25151 !! html/parsoid
25152 <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>
25153 <table>
25154 <tbody>
25155 <tr>
25156 <td>bar</td>
25157 </tr>
25158 </tbody>
25159 </table>
25160 !!end
25161
25162 # Note that the wt is broken on purpose: the = should be {{=}} if you
25163 # don't want it to be a template parameter key.
25164 !!test
25165 8. Encapsulate foster-parented transclusion content
25166 !!options
25167 parsoid=wt2wt,wt2html
25168 !! wikitext
25169 {{echo|a
25170 }}{|{{echo|style='color:red'}}
25171 |-
25172 |b
25173 |}
25174 !! html/parsoid
25175 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25176 <span> </span>
25177 <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>
25178 <table>
25179 <tbody>
25180 <tr>
25181 <td>b</td>
25182 </tr>
25183 </tbody>
25184 </table>
25185 !!end
25186
25187 !!test
25188 9. Encapsulate foster-parented transclusion content
25189 !!options
25190 parsoid=wt2wt,wt2html
25191 !! wikitext
25192 <table>{{echo|hi</table>hello}}
25193 !! html/parsoid
25194 <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>
25195 !!end
25196
25197 !!test
25198 Table in fosterable position
25199 !!options
25200 parsoid=wt2html
25201 !! wikitext
25202 {{OpenTable}}
25203 <div>
25204 {|
25205 |}
25206 </div>
25207 |}
25208 !! html/parsoid
25209 <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">
25210 </span>
25211 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25212
25213 <table>
25214 </table>
25215 !!end
25216
25217 # Parsoid only for T66747
25218 !! test
25219 Properly encapsulate empty-content transclusions in fosterable positions
25220 !! wikitext
25221 <table>
25222 {{#if:|
25223 <td>foo</td>
25224 }}
25225 </table>
25226 !! html/parsoid
25227 <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"}]]}'>
25228
25229 </table>
25230 !! end
25231
25232 !! test
25233 Always encapsulate foster box when template range is expanded to table
25234 !! options
25235 parsoid=wt2wt
25236 !! wikitext
25237 {|
25238 hello
25239 {{OpenTable}}
25240 |}
25241 !! html/parsoid
25242
25243 !! end
25244
25245 !! test
25246 T115289: Unclosed table
25247 !! wikitext
25248 {{echo|<table>}}<!--c-->[[Category:Two]]
25249 !! html/parsoid
25250 <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>
25251 !! end
25252
25253 !! test
25254 T115289: Don't migrate newlines out of tables with fostered content
25255 !! wikitext
25256 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25257 !! html/parsoid
25258 <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>
25259 !! end
25260
25261 !! test
25262 T73074: More fostering fun
25263 !! wikitext
25264 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25265 !! html/parsoid
25266 <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>
25267 !! end
25268
25269 !!test
25270 Support <object> element with .data attribute
25271 !!options
25272 parsoid=html2wt
25273 !! html/parsoid
25274 <object data="test.swf"></object>
25275 !! wikitext
25276 <object data="test.swf"></object>
25277 !!end
25278
25279 !! test
25280 Don't block XML namespace declaration
25281 !! wikitext
25282 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25283 !! html/php
25284 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25285 </p>
25286 !! html/parsoid
25287 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25288 !! end
25289
25290 # -----------------------------------------------------------------
25291 # The following section of tests are primarily to spec requirements
25292 # around Parsoid's serialization (old, new, edited content)
25293 #
25294 # All these tests are marked Parsoid html2wt and html2html only
25295 # ----------------------------------------------------------------
25296
25297 !! test
25298 Ignore rel attribute in a-tags during serialization to url-links
25299 !! options
25300 parsoid=html2wt
25301 !! html/parsoid
25302 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25303 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25304 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25305 !! wikitext
25306 http://en.wikipedia.org/wiki/Foobar
25307 http://en.wikipedia.org/wiki/Foobar
25308 http://en.wikipedia.org/wiki/Foobar
25309 !! end
25310
25311 # 'mi' is a localinterwiki prefix as well as a language
25312 !! test
25313 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
25314 !! options
25315 parsoid=html2wt
25316 !! html/parsoid
25317 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25318 !! wikitext
25319 [[Foo]]
25320 !! end
25321
25322 # See T93839
25323 !! test
25324 New wikilinks should be serialized properly
25325 !! options
25326 parsoid=html2wt
25327 !! html/parsoid
25328 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25329 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25330 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25331 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25332 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25333 !! wikitext
25334 [[Foo]]
25335 [[Foo]]
25336 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25337 http://en.wikipedia.org/wiki/Foo
25338 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25339 !! end
25340
25341 !! test
25342 New wiki links (href variations)
25343 !! options
25344 parsoid=html2wt
25345 !! html/parsoid
25346 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25347 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25348 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25349 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25350 !! wikitext
25351 [[Foo_bar]]
25352 [[Foo_bar]]
25353 [[Foo_bar]]
25354 [[Toxine bactérienne]]
25355 !! end
25356
25357 !! test
25358 New wiki links (content string variations)
25359 !! options
25360 parsoid=html2wt
25361 !! html/parsoid
25362 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25363 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25364 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25365 !! wikitext
25366 [[Foo_bar]]
25367 [[Foo bar]]
25368 [[Foo_bar|./Foo_bar]]
25369 !! end
25370
25371 !! test
25372 New category links (href variations)
25373 !! options
25374 parsoid=html2wt
25375 !! html/parsoid
25376 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25377 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25378 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25379 !! wikitext
25380 [[Category:Toxine bactérienne]]
25381 [[Category:Toxine bactérienne]]
25382 [[Category:Toxine bactérienne]]
25383 !! end
25384
25385 !! test
25386 New sol transparent links don't need indent-pre nowiki protection
25387 !! options
25388 parsoid=html2wt
25389 language=de
25390 !! html/parsoid
25391 <link rel="mw:PageProp/redirect" href="./Main_Page">
25392 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25393 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25394 !! wikitext
25395 #WEITERLEITUNG [[Main Page]]
25396 <!-- this is good --> [[Category:Good]]
25397 <!-- this is great --> [[Kategorie:Great]]
25398 !! end
25399
25400 !! test
25401 New interlanguage links (href variations)
25402 !! options
25403 parsoid=html2wt
25404 !! html/parsoid
25405 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25406 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25407 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25408 !! wikitext
25409 [[es:Toxine bactérienne]]
25410 [[es:Toxine_bactérienne]]
25411 [[es:Toxine_bactérienne]]
25412 !! end
25413
25414 !! test
25415 Image: Modifying size of an image (1)
25416 !! options
25417 parsoid={
25418 "modes": ["wt2wt"],
25419 "changes": [
25420 ["img[height]", "attr", "height", "22"],
25421 ["img[width]", "attr", "width", "200"]
25422 ]
25423 }
25424 !! wikitext
25425 [[Image:Foobar.jpg|230x230px]]
25426 !! wikitext/edited
25427 [[Image:Foobar.jpg|200x200px]]
25428 !!end
25429
25430 !! test
25431 Image: Modifying size of an image (2)
25432 !! options
25433 parsoid={
25434 "modes": ["wt2wt"],
25435 "changes": [
25436 ["img[height]", "attr", "height", "100"],
25437 ["img[width]", "attr", "width", "500"]
25438 ]
25439 }
25440 !! wikitext
25441 [[Image:Foobar.jpg|230x230px]]
25442 !! wikitext/edited
25443 [[Image:Foobar.jpg|500x500px]]
25444 !!end
25445
25446 # Change in size is ignored so long as class='mw-default-size'
25447 !! test
25448 Image: Modifying size of an image (3)
25449 !! options
25450 parsoid={
25451 "modes": ["wt2wt"],
25452 "changes": [
25453 ["figure[class]", "removeClass", "mw-default-size"],
25454 ["figure img", "attr", "height", "19"],
25455 ["figure img", "attr", "width", "170"]
25456 ]
25457 }
25458 !! wikitext
25459 [[Image:Foobar.jpg|thumb]]
25460 !! wikitext/edited
25461 [[Image:Foobar.jpg|thumb|170x170px]]
25462 !!end
25463
25464 !! test
25465 Image: Modifying alignment of an image (T50665)
25466 !! options
25467 parsoid={
25468 "modes": ["wt2wt"],
25469 "changes": [
25470 ["figure[class]", "removeClass", "mw-halign-right"],
25471 ["figure[class]", "addClass", "mw-halign-left"]
25472 ]
25473 }
25474 !! wikitext
25475 [[Image:Foobar.jpg|thumb|caption|right]]
25476 !! wikitext/edited
25477 [[Image:Foobar.jpg|thumb|caption|left]]
25478 !! end
25479
25480 !! test
25481 Image: Modifying mw-default-size of an frameless image (T64805)
25482 !! options
25483 parsoid={
25484 "modes": ["wt2wt"],
25485 "changes": [
25486 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25487 ]
25488 }
25489 !! wikitext
25490 [[Image:Foobar.jpg|frameless|right]]
25491 !! wikitext/edited
25492 [[Image:Foobar.jpg|frameless|right|220x220px]]
25493 !! end
25494
25495 !! test
25496 Image: Modifying valign of an image (T51221)
25497 !! options
25498 parsoid={
25499 "modes": ["wt2wt"],
25500 "changes": [
25501 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25502 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25503 ]
25504 }
25505 !! wikitext
25506 [[File:Foobar.jpg|20px|middle]]
25507 !! wikitext/edited
25508 [[File:Foobar.jpg|20px|text-top]]
25509 !! end
25510
25511 !! test
25512 Image: Modifying alt attribute of an image (T58400)
25513 !! options
25514 parsoid={
25515 "modes": ["wt2wt"],
25516 "changes": [
25517 ["img[alt]", "attr", "alt", "some alternate edited text"]
25518 ]
25519 }
25520 !! wikitext
25521 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25522 !! wikitext/edited
25523 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25524 !!end
25525
25526 !! test
25527 Image: Modifying caption of an image
25528 !! options
25529 parsoid={
25530 "modes": ["wt2wt"],
25531 "changes": [
25532 ["figcaption", "text", "new caption"]
25533 ]
25534 }
25535 !! wikitext
25536 [[Image:Foobar.jpg|thumb|original caption]]
25537 !! wikitext/edited
25538 [[Image:Foobar.jpg|thumb|new caption]]
25539 !!end
25540
25541 !! test
25542 Image: empty alt attribute (T50924)
25543 !! options
25544 parsoid
25545 !! wikitext
25546 [[File:Foobar.jpg|thumb|alt=|bar]]
25547 !! html
25548 <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>
25549 !! end
25550
25551 !! test
25552 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
25553 !! options
25554 parsoid=html2wt
25555 language=ar
25556 disabled
25557 !! html/parsoid
25558 <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>
25559 !! wikitext
25560 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25561 !! end
25562
25563 !! test
25564 Image: Block level image should have \n before and after
25565 !! wikitext
25566 123
25567 [[File:Foobar.jpg|right|thumb|150x150px]]
25568 456
25569 !! html/parsoid
25570 <p>123</p>
25571 <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>
25572 <p>456</p>
25573 !!end
25574
25575 !! test
25576 Image: New block level image should have \n before and after (existing content)
25577 !! wikitext
25578 123
25579 [[File:Foobar.jpg|right|thumb|150x150px]]
25580 456
25581 !! html/parsoid
25582 <p>123</p>
25583 <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>
25584 <p>456</p>
25585 !!end
25586
25587 !! test
25588 Image: upright option (parsoid)
25589 !! wikitext
25590 [[File:Foobar.jpg|thumb|upright|caption]]
25591 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25592 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25593 !! html/parsoid
25594 <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>
25595 <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>
25596 <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>
25597 !!end
25598
25599 !! test
25600 Image: upright option is ignored on inline and frame images (parsoid)
25601 !! wikitext
25602 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25603 !! html/parsoid
25604 <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>
25605 !!end
25606
25607 !! test
25608 Image: from basic HTML (1)
25609 !! options
25610 parsoid=html2wt
25611 !! html/parsoid
25612 <span typeof="mw:Image">
25613 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25614 </span>
25615 !! wikitext
25616 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25617 !! end
25618
25619 !! test
25620 Image: from basic HTML (2)
25621 !! options
25622 parsoid=html2wt
25623 !! html/parsoid
25624 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25625 !! wikitext
25626 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25627 !! end
25628
25629 !! test
25630 Image: from basic HTML (3)
25631 !! options
25632 parsoid=html2wt
25633 !! html/parsoid
25634 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25635 !! wikitext
25636 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25637 !! end
25638
25639 !! test
25640 Image: from basic HTML (4)
25641 !! options
25642 parsoid=html2wt
25643 !! html/parsoid
25644 <img src="./File:Foobar.jpg">
25645 !! wikitext
25646 [[File:Foobar.jpg|link=]]
25647 !! end
25648
25649 !! test
25650 Image: Invalid title as link
25651 !! wikitext
25652 [[File:Foobar.jpg|link=<]]
25653 !! html/php
25654 <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>
25655 </p>
25656 !! html/parsoid
25657 <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>
25658 !! end
25659
25660 !! test
25661 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25662 !! options
25663 parsoid=html2wt
25664 !! html/parsoid
25665 <ul>
25666 <li><p>foo</p></li>
25667 </ul>
25668 !! wikitext
25669 * foo
25670 !! end
25671
25672 !! test
25673 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25674 !! options
25675 parsoid=html2wt
25676 !! html/parsoid
25677 <ul> <li>foo</li></ul>
25678 !! wikitext
25679 * foo
25680 !! end
25681
25682 !! test
25683 Don't strip leading whitespace when handling indent-pre suppressing tags
25684 !! options
25685 parsoid=html2wt
25686 !! html/parsoid
25687 <table>
25688 <tr><td> indented row</td></tr>
25689 </table>
25690 <blockquote><p>
25691 <b>This is very bold of you!</b>
25692 </p>
25693 <table><tr><td>
25694 indented cell (no pre-wrapping!)
25695 </td></tr></table>
25696 </blockquote>
25697 <p>foo</p>
25698 <div>bar</div>
25699 !! wikitext
25700 {|
25701 | indented row
25702 |}
25703 <blockquote>
25704 '''This is very bold of you!'''
25705
25706 {|
25707 |
25708 indented cell (no pre-wrapping!)
25709 |}
25710 </blockquote>
25711 foo
25712 <div>bar</div>
25713 !! end
25714
25715 !! test
25716 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25717 !! options
25718 parsoid=html2wt
25719 !! html/parsoid
25720 <p>foo</p>
25721 <span>bar</span>
25722
25723 <span>foo2
25724 </span>bar2
25725
25726 <div>foo</div>
25727 <span>bar</span>
25728
25729 <div>
25730 <span>foo</span>
25731 </div>
25732 !! wikitext
25733 foo
25734
25735 <span>bar</span>
25736
25737 <span>foo2
25738 <nowiki> </nowiki></span>bar2
25739
25740 <div>foo</div>
25741 <nowiki> </nowiki><span>bar</span>
25742
25743 <div>
25744 <nowiki> </nowiki><span>foo</span>
25745 </div>
25746 !! end
25747
25748 !! test
25749 Lists: Dont insert newlines in a serialized list item.
25750 !! options
25751 parsoid=html2wt
25752 !! html/parsoid
25753 <ul><li>a<br>b</li><li>c</li></ul>
25754 !! wikitext
25755 * a<br>b
25756 * c
25757 !! end
25758
25759 !! test
25760 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25761 !! options
25762 parsoid={
25763 "modes": ["html2wt"],
25764 "scrubWikitext": false
25765 }
25766 !! html/parsoid
25767 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25768 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25769
25770 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25771 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25772
25773 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25774
25775 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25776 !! wikitext
25777 == hello there [[Category:A1]] ==
25778
25779 == [[Category:A2]] hi pal ==
25780
25781 == <!--foo--> [[Category:A3]] how goes it ==
25782
25783 == it goes well [[Category:A4]] <!--bar--> ==
25784
25785 ==howdy [[Category:A5]]==
25786
25787 == __TOC__ ok ==
25788 !! end
25789
25790 !! test
25791 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25792 !! options
25793 parsoid={
25794 "modes": ["html2wt"],
25795 "scrubWikitext": true
25796 }
25797 !! html/parsoid
25798 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25799 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25800
25801 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25802 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25803
25804 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25805 !! wikitext
25806 == hello there ==
25807 [[Category:A1]]
25808 [[Category:A2]]
25809
25810 == hi pal ==
25811
25812 <!--foo--> [[Category:A3]]
25813
25814 == how goes it ==
25815
25816 == it goes well ==
25817 [[Category:A4]] <!--bar-->
25818
25819 __TOC__
25820
25821 == ok ==
25822 !! end
25823
25824 !! test
25825 Headings: Don't hoist metas that come from templates
25826 !! options
25827 parsoid={
25828 "modes": ["html2wt"],
25829 "scrubWikitext": true
25830 }
25831 !! html/parsoid
25832 <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>
25833 !! wikitext
25834 == {{echo|foo [[Category:Foo]]}} ==
25835 !! end
25836
25837 !! test
25838 Headings: Category in ref isn't hoisted
25839 !! options
25840 parsoid={
25841 "modes": ["html2wt"],
25842 "scrubWikitext": true
25843 }
25844 !! html/parsoid
25845 <h2> foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
25846
25847 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">bar <link rel="mw:PageProp/Category" href="./Category:Baz" /> </span></li></ol>
25848 !! wikitext
25849 == foo <ref>bar
25850 [[Category:Baz]] </ref> ==
25851
25852 <references />
25853 !! end
25854
25855 !! test
25856 Parsoid: Serialize positional parameters with = in them as named parameter
25857 !! options
25858 parsoid=html2wt
25859 !! html/parsoid
25860 <p about="#mwt1" typeof="mw:Transclusion"
25861 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25862
25863 <p about="#mwt1" typeof="mw:Transclusion"
25864 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25865
25866 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25867 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25868 <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>
25869 !! wikitext
25870 {{echo|1=f=oo}}
25871
25872 {{echo|1=f=oo|2=bar}}
25873
25874 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25875 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25876 {{echo|<nowiki>f=oo</nowiki>|bar}}
25877 !! end
25878
25879 !! test
25880 Parsoid: Serialize positional parameters with = in extlink as named parameter
25881 !! options
25882 parsoid=html2wt
25883 !! html/parsoid
25884 <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>
25885 !! wikitext
25886 {{echo|1=http://stuff?is=ok}}
25887 !! end
25888
25889 !! test
25890 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25891 !! options
25892 parsoid=html2wt
25893 !! html/parsoid
25894 <div>a<p>b</p></div>
25895 <div>a
25896 <p>b</p></div>
25897 <div>
25898 a
25899 <p>b</p></div>
25900 !! wikitext
25901 <div>a
25902 b
25903 </div>
25904 <div>a
25905 b
25906 </div>
25907 <div>
25908 a
25909
25910 b
25911 </div>
25912 !! end
25913
25914 !! test
25915 Substrings resembling wikitext in hrefs should not get nowiki escapes
25916 !! options
25917 parsoid=html2wt
25918 !! html/parsoid
25919 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25920 !! wikitext
25921 [[Foo''bar''baz]]
25922 !! end
25923
25924 !! test
25925 Enforce single-line context in the serializer
25926 !! options
25927 parsoid=html2wt
25928 !! html/parsoid
25929 <h2>testing
25930 123</h2>
25931
25932 <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">
25933 </span><span about="#mwt1">you</span> </h2>
25934
25935 <h2> foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
25936
25937 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">hello
25938 there</span></li></ol>
25939
25940 <ul><li>asd
25941 sdf</li></ul>
25942
25943 <ul><li>foo
25944 bar
25945 baz</li>
25946 <li>foo <b>bar</b>
25947 baz</li></ul>
25948
25949 <dl><dt>hi
25950 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25951 ho</dd></dl>
25952
25953 <dl><dd> <table>
25954 <tbody><tr><td> ha
25955 ha
25956 ha</td></tr>
25957 </tbody></table></dd></dl>
25958 !! wikitext
25959 == testing 123 ==
25960
25961 == hi {{bogus|there
25962 you}} ==
25963
25964 == foo <ref>hello
25965 there</ref> ==
25966
25967 <references />
25968
25969 * asd sdf
25970
25971 * foo bar baz
25972 * foo '''bar''' baz
25973
25974 ; hi ho : hi ho
25975
25976 : {|
25977 | ha
25978 ha
25979 ha
25980 |}
25981 !! end
25982
25983 !! test
25984 Serialize new placeholder space without spans
25985 !! options
25986 parsoid=html2wt
25987 !! html/parsoid
25988 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25989
25990 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25991
25992 <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>
25993 !! wikitext
25994 foo : bar
25995
25996 foo : bar
25997
25998 <ref>foo : bar</ref>ok
25999 !! end
26000
26001
26002 #-----------------------
26003 # Tag minimization tests
26004 #-----------------------
26005
26006 !! test
26007 1. I/B quote minimization: wikitext-only tags should be combined
26008 !! options
26009 parsoid=html2wt
26010 !! html/parsoid
26011 <p><i>A</i><i>B</i></p>
26012 <p><b>A</b><b>B</b></p>
26013 <p><i>A</i><b><i>B</i></b></p>
26014 <p><b>A</b><i><b>B</b></i></p>
26015 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
26016 <p><i><b>A</b></i><i><b>B</b></i></p>
26017 <p><i><b>A</b></i><b><i>B</i></b></p>
26018 <p><b><i>A</i></b><i><b>B</b></i></p>
26019 !! wikitext
26020 ''AB''
26021
26022 '''AB'''
26023
26024 ''A'''B'''''
26025
26026 '''A''B'''''
26027
26028 '''A''BC''D'''
26029
26030 '''''AB'''''
26031
26032 '''''AB'''''
26033
26034 '''''AB'''''
26035 !! end
26036
26037 !! test
26038 2. I/B quote minimization: wikitext and html tags should not be combined
26039 !! options
26040 parsoid=html2wt
26041 !! html/parsoid
26042 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26043 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26044 !! wikitext
26045 ''A''<i>B</i>
26046
26047 ''A''<nowiki/>'''<i>B</i>'''
26048 !! end
26049
26050 !! test
26051 3. I/B quote minimization: templated content stops minimization
26052 !! options
26053 parsoid=html2wt
26054 !! html/parsoid
26055 <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>
26056 <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>
26057 !! wikitext
26058 ''A''{{echo|''B''}}
26059
26060 ''A''{{echo|'''''B'''''}}
26061 !! end
26062
26063 !! test
26064 4. I/B quote minimization: new content should be mimimized with adjacent old content
26065 !! options
26066 parsoid=html2wt
26067 !! html/parsoid
26068 <p><i>A</i><i>B</i></p>
26069 <p><b>A</b><b>B</b></p>
26070 <p><i>A</i><b><i>B</i></b></p>
26071 !! wikitext
26072 ''AB''
26073
26074 '''AB'''
26075
26076 ''A'''B'''''
26077 !! end
26078
26079 !! test
26080 5a. Merge adjacent quote nodes if they've been edited
26081 !! options
26082 parsoid={
26083 "modes": ["wt2wt", "selser"],
26084 "changes": [
26085 ["p", "contents", "remove", ":contains('b')"]
26086 ]
26087 }
26088 !! wikitext
26089 ''a''b''c''
26090 !! wikitext/edited
26091 ''ac''
26092 !! end
26093
26094 !! test
26095 5b. Merge adjacent quote nodes if they've been edited
26096 !! options
26097 parsoid={
26098 "modes": ["wt2wt", "selser"],
26099 "changes": [
26100 ["#x", "remove"]
26101 ]
26102 }
26103 !! wikitext
26104 ''a''<span id="x">b</span>''c''
26105 !! wikitext/edited
26106 ''ac''
26107 !! end
26108
26109 !! test
26110 1. Merge adjacent link nodes as long as at least one element is new
26111 !! options
26112 parsoid={
26113 "modes": ["html2wt"],
26114 "scrubWikitext": true
26115 }
26116 !! html/parsoid
26117 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26118 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26119 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26120 !! wikitext
26121 [[Football]]
26122 [[Football]]
26123 [[Football|Foot]][[Football|ball]]
26124 !! end
26125
26126 !! test
26127 2. Merge adjacent link nodes and enable additional normalizations
26128 !! options
26129 parsoid={
26130 "modes": ["html2wt"],
26131 "scrubWikitext": true
26132 }
26133 !! html/parsoid
26134 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26135 !! wikitext
26136 [[Football|''Football'']]
26137 !! end
26138
26139 !! test
26140 3. Don't merge adjacent link nodes if scrubWikitext is false
26141 !! options
26142 parsoid={
26143 "modes": ["html2wt"],
26144 "scrubWikitext": false
26145 }
26146 !! html/parsoid
26147 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26148 !! wikitext
26149 [[Football|Foot]][[Football|ball]]
26150 !! end
26151
26152 #------------------------------
26153 # End of tag minimization tests
26154 #------------------------------
26155
26156 !!test
26157 T56262: New entities
26158 !! options
26159 parsoid=html2wt
26160 !! html/parsoid
26161 <span typeof="mw:Entity">&nbsp;</span>
26162 !! wikitext
26163 &nbsp;
26164 !! end
26165
26166 ## Note that there is no wikitext output for 'unknownproperty' ##
26167 ## Unknown magic words are silently dropped ##
26168
26169 !! test
26170 Magic words
26171 !! options
26172 parsoid=html2wt
26173 !! html/parsoid
26174 <meta property='mw:PageProp/toc' />
26175 <meta property='mw:PageProp/notoc' />
26176 <meta property='mw:PageProp/forcetoc' />
26177 <meta property='mw:PageProp/index' />
26178 <meta property='mw:PageProp/noindex' />
26179 <meta property='mw:PageProp/nogallery' />
26180 <meta property='mw:PageProp/noeditsection' />
26181 <meta property='mw:PageProp/notitleconvert' />
26182 <meta property='mw:PageProp/nocontentconvert' />
26183 <meta property='mw:PageProp/unknownproperty' />
26184 !! wikitext
26185 __TOC__
26186 __NOTOC__
26187 __FORCETOC__
26188 __INDEX__
26189 __NOINDEX__
26190 __NOGALLERY__
26191 __NOEDITSECTION__
26192 __NOTITLECONVERT__
26193 __NOCONTENTCONVERT__
26194 !! end
26195
26196 !! test
26197 Consecutive <pre>s should not get merged
26198 !! options
26199 parsoid=html2wt,html2html
26200 !! html/parsoid
26201 <pre>a</pre><pre>b</pre>
26202
26203 <pre>c
26204 </pre><pre>
26205 d</pre>
26206
26207 <pre>e
26208
26209 </pre><pre>
26210
26211 f</pre>
26212 !! wikitext
26213 a
26214
26215 b
26216
26217 c
26218
26219 d
26220
26221 e
26222
26223
26224
26225 f
26226 !! end
26227
26228 !! test
26229 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26230 !! options
26231 parsoid=html2wt
26232 !! html/parsoid
26233 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26234 !! wikitext
26235 [[Special:BookSources/1234567890|ISBN 1234567895]]
26236 !! end
26237
26238 !! test
26239 Edited RFC links not serializable as RFC links should serialize as extlinks
26240 !! options
26241 parsoid=html2wt
26242 !! html/parsoid
26243 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26244 !! wikitext
26245 [//tools.ietf.org/html/rfc123 New RFC]
26246 !! end
26247
26248 !! test
26249 Edited PMID links not serializable as PMID links should serialize as extlinks
26250 !! options
26251 parsoid=html2wt
26252 !! html/parsoid
26253 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26254 !! wikitext
26255 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26256 !! end
26257
26258 !! test
26259 WTS of autolinks with trailing/surrounding context
26260 !! options
26261 parsoid=html2wt
26262 !! html/parsoid
26263 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26264 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26265 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26266 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26267 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26268 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26269 !! wikitext
26270 http://cscott.net'''foo'''
26271
26272 http://cscott.net<b>foo</b>
26273
26274 '''http://cscott.net'''
26275
26276 '''http://cscott.net '''
26277
26278 '''http://cscott.net<nowiki/>x'''
26279
26280 http://cscott.net<nowiki/>x
26281 !! end
26282
26283 !! test
26284 WTS of autolinks with nowikis (round-trip)
26285 !! wikitext
26286 x<nowiki/>http://cscott.net<nowiki/>x
26287 !! html/parsoid
26288 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26289 !! end
26290
26291 # this is the "easy" test because it leaves in place all the
26292 # data-parsoid information indicating this is an autolink
26293 !! test
26294 WTS of autolinks with escapes (editing)
26295 !! options
26296 parsoid={
26297 "modes": ["wt2wt"],
26298 "changes": [
26299 [ "span", "remove" ]
26300 ]
26301 }
26302 !! wikitext
26303 x<nowiki/>http://cscott.net<nowiki/>x
26304 !! wikitext/edited
26305 x<nowiki/>http://cscott.net<nowiki/>x
26306 !! end
26307
26308 !! test
26309 WTS of edited autolink-like text (T103364)
26310 !! options
26311 parsoid={
26312 "modes": ["wt2wt"],
26313 "changes": [
26314 [ "span[typeof]", "removeAttr", "typeof" ]
26315 ]
26316 }
26317 !! wikitext
26318 Not a link: <nowiki>http://example.com</nowiki>.
26319 !! wikitext/edited
26320 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26321 !! end
26322
26323 !! test
26324 WTS of newly-authored autolink-like text (T103364)
26325 !! options
26326 parsoid=html2wt
26327 !! html/parsoid
26328 <p>http://example.com is not a link.</p>
26329 !! wikitext
26330 <nowiki>http://example.com</nowiki> is not a link.
26331 !! end
26332
26333 !! test
26334 WTS of autolink-like text after an autolink (T108563)
26335 !! options
26336 parsoid=html2wt
26337 !! html/parsoid
26338 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26339 !! wikitext
26340 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26341 !! end
26342
26343 !! test
26344 Magic links inside links (not autolinked)
26345 !! wikitext
26346 [[Foo|http://example.com]]
26347 [[Foo|RFC 1234]]
26348 [[Foo|PMID 1234]]
26349 [[Foo|ISBN 123456789x]]
26350
26351 [http://foo.com http://example.com]
26352 [http://foo.com RFC 1234]
26353 [http://foo.com PMID 1234]
26354 [http://foo.com ISBN 123456789x]
26355 !! html+tidy
26356 <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>
26357 <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>
26358 !! html/parsoid
26359 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26360 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26361 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26362 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26363
26364 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26365 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26366 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26367 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26368 !! end
26369
26370 !! test
26371 Magic links inside image captions (autolinked)
26372 !! wikitext
26373 [[File:Foobar.jpg|thumb|http://example.com]]
26374 [[File:Foobar.jpg|thumb|RFC 1234]]
26375 [[File:Foobar.jpg|thumb|PMID 1234]]
26376 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26377 !! html+tidy
26378 <div class="thumb tright">
26379 <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>
26380 <div class="thumbcaption">
26381 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26382 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26383 </div>
26384 </div>
26385 <div class="thumb tright">
26386 <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>
26387 <div class="thumbcaption">
26388 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26389 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26390 </div>
26391 </div>
26392 <div class="thumb tright">
26393 <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>
26394 <div class="thumbcaption">
26395 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26396 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26397 </div>
26398 </div>
26399 <div class="thumb tright">
26400 <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>
26401 <div class="thumbcaption">
26402 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26403 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26404 </div>
26405 </div>
26406 !! html/parsoid
26407 <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>
26408 <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>
26409 <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>
26410 <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>
26411 !! end
26412
26413 !! test
26414 WTS of magic word text (T109371)
26415 !! options
26416 parsoid=html2wt
26417 !! html/parsoid
26418 <p>RFC 1234</p>
26419 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26420 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26421 !! wikitext
26422 <nowiki>RFC 1234</nowiki>
26423
26424 [http://foo.com RFC 1234]
26425
26426 [[Foo|RFC 1234]]
26427 !! end
26428
26429 !! test
26430 Edited Redirect link should emit a non-piped wikitext link
26431 !! options
26432 parsoid=html2wt
26433 !! html/parsoid
26434 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26435 !! wikitext
26436 #REDIRECT [[Bar]]
26437 !! end
26438
26439 !! test
26440 T75121: Infer extension name from typeOf if data-mw is not present
26441 !! options
26442 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26443 !! html/parsoid
26444 <div typeOf="mw:Extension/foo"></div>
26445 !! wikitext
26446 <foo />
26447 !! end
26448
26449 # Note that the <p> wrapping isn't present in PHP parser output
26450 # The important thing for this test is that P-wrapping doesn't
26451 # interfere with the <nowiki> protection for leading - in <td>
26452 # (which isn't necessary for <th>).
26453 !! test
26454 T88318: p-wrapped dash in table.
26455 !! options
26456 parsoid=html2wt,wt2wt
26457 !! html/parsoid
26458 <table><tbody>
26459 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26460 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26461 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26462 </tbody></table>
26463 !! wikitext
26464 {|
26465 !-
26466 !-
26467 |-
26468 |<nowiki>-</nowiki>
26469 |<nowiki>- </nowiki>
26470 |-
26471 |<small>-</small>
26472 |<br>
26473 -
26474 |<br>
26475 -
26476 |}
26477 !! html/php+tidy
26478 <table>
26479 <tr>
26480 <th>-</th>
26481 <th>-</th>
26482 </tr>
26483 <tr>
26484 <td>-</td>
26485 <td>-</td>
26486 </tr>
26487 <tr>
26488 <td><small>-</small></td>
26489 <td><br />
26490 <p>-</p>
26491 </td>
26492 <td><br />
26493 <p>-</p>
26494 </td>
26495 </tr>
26496 </table>
26497 !! end
26498
26499 !! test
26500 T149209: WTS: Handle newlines in table cells properly
26501 !! options
26502 parsoid=html2wt
26503 !! html/parsoid
26504 <table>
26505 <tbody>
26506 <tr><td>a
26507 b
26508 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
26509 <tr><td><p>x</p>
26510 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
26511 </tbody></table>
26512 <table>
26513 <tbody>
26514 <tr><th>a
26515 b
26516 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
26517 <tr><th><p>x</h>
26518 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
26519 </tbody></table>
26520 !! wikitext
26521 {|
26522 |a
26523 b
26524 |c
26525 |-
26526 |x
26527 {{!}}y
26528 |}
26529 {|
26530 !a
26531 b
26532 !c
26533 |-
26534 !x
26535 !y
26536 |}
26537 !! end
26538
26539 !! test
26540 T149209: Selser: Handle newlines in table cells properly
26541 !! options
26542 parsoid={
26543 "modes": ["selser"],
26544 "changes": [
26545 [ "#h1", "html", "a\nb\n" ],
26546 [ "#h2", "html", "a\nb\n" ],
26547 [ "#c1", "html", "a\nb\n" ],
26548 [ "#c2", "html", "<p>a</p>" ],
26549 [ "#c3", "html", "<p>a</p>" ],
26550 [ "#c4", "html", "edit-me<p>a</p>" ]
26551 ]
26552 }
26553 !! wikitext
26554 {|
26555 ! id="h1" |edit-me!!1
26556 |-
26557 ! id="h2" |edit-me||2
26558 |-
26559 | id="c1" |edit-me||3
26560 |-
26561 | id="c2" |edit-me||4
26562 |-
26563 | id="c3" |edit-me||p||q||r
26564 |-
26565 | id="c4" |edit-me||p||q||r
26566 |}
26567 !! wikitext/edited
26568 {|
26569 ! id="h1" |a
26570 b
26571 !1
26572 |-
26573 ! id="h2" |a
26574 b
26575 !2
26576 |-
26577 | id="c1" |a
26578 b
26579 |3
26580 |-
26581 | id="c2" |a
26582 |4
26583 |-
26584 | id="c3" |a
26585 |p||q||r
26586 |-
26587 | id="c4" |edit-me
26588 a
26589 |p||q||r
26590 |}
26591 !! end
26592
26593 !! test
26594 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26595 !! options
26596 parsoid=html2wt
26597 !! html/parsoid
26598 <table id='mwAb'>
26599 <td id='mwAc'>foo</td>
26600 <td id='serialize-this'>bar</td>
26601 </table>
26602 !! wikitext
26603 {|
26604 |foo
26605 | id="serialize-this" |bar
26606 |}
26607 !! end
26608
26609 !! test
26610 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26611 !! options
26612 parsoid=html2wt
26613 !! html/parsoid
26614 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26615 !! wikitext
26616 <div id="hello">ok</div>
26617 !! end
26618
26619 !! test
26620 WTS change modes
26621 !! options
26622 parsoid={
26623 "modes": ["wt2wt"],
26624 "changes": [
26625 [ "#xyz", "before", "<b>before</b> stuff " ],
26626 [ "#xyz", "after", " stuff <i>after</i>" ],
26627 [ "#xyz", "html", "x <b>y</b> z" ]
26628 ]
26629 }
26630 !! wikitext
26631 <span id="xyz">hello</span>
26632 !! wikitext/edited
26633 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26634 !! end
26635
26636 !! test
26637 Never serialize a-tag as html, regardless of what data-parsoid has to say
26638 !! options
26639 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26640 !! html/parsoid
26641 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26642 !! wikitext
26643 [[Foo]]
26644 !! end
26645
26646 ## SSS FIXME: This is broken output nevertheless.
26647 ## What might be a reasonable non-broken output for this?
26648 ## This is an edge case unlikely to be seen in production
26649 ## that I am not wasting more time on this right now.
26650 !! test
26651 Never serialize a-tag as html, no matter what attributes it has
26652 !! options
26653 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26654 !! html/parsoid
26655 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26656 !! wikitext
26657 [http://boo.org http://boohoo.org]
26658 !! end
26659
26660 # Misnested is an indication that selser can reuse the source but these have
26661 # shown to sneak through on occasion. See T101768.
26662 # The original wikitext here is: [http://test.com [[one]] two three]
26663 !! test
26664 Strip span tags added to mark misnested links
26665 !! options
26666 parsoid=html2wt
26667 !! html/parsoid
26668 <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>
26669 !! wikitext
26670 [http://test.com][[one]] two three
26671 !! end
26672
26673 !! test
26674 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26675 !! options
26676 parsoid=html2wt
26677 !! html/parsoid
26678 <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|}"]}'>
26679 <tbody><tr><td>d
26680 </td></tr>
26681 </tbody></table>
26682 !! wikitext
26683 {{echo|a}}
26684 {|{{echo|c
26685 {{!}}d
26686 }}
26687 |}
26688 !! end
26689
26690 ## This test verifies the presence and computation of this attribute indirectly
26691 ## by making an edit and ensuring that the serialization is correct (which it would be
26692 ## only if firstWikitextNode is properly set).
26693 !! test
26694 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26695 !! options
26696 parsoid= {
26697 "modes": ["wt2wt"],
26698 "changes": [
26699 [ "div#x", "remove" ],
26700 [ "div", "before", "<div>new</div>" ]
26701 ]
26702 }
26703 !! wikitext
26704 <div id="x">foo</div>
26705 {|
26706 {{echo|<div>boo</div>
26707 {{!}}b}}
26708 |c
26709 |}
26710 !! wikitext/edited
26711
26712 <div>new</div>
26713 {|
26714 {{echo|<div>boo</div>
26715 {{!}}b}}
26716 |c
26717 |}
26718 !! end
26719
26720 # --------------------------------------------
26721 # Tests spec'ing wikitext serialization norms |
26722 # --------------------------------------------
26723
26724 !! test
26725 Serialize multi-line indent-pre starting with wikitext syntax
26726 !! options
26727 parsoid=html2wt
26728 !! html/parsoid
26729 <pre>* 1
26730 ** 2
26731 * 3</pre>
26732 !! wikitext
26733 * 1
26734 ** 2
26735 * 3
26736 !! end
26737
26738 !! test
26739 1. Categories should always be serialized on their own line
26740 !! options
26741 parsoid=html2wt
26742 !! html/parsoid
26743 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26744 !! wikitext
26745 foo
26746 [[Category:Foo]]
26747 bar
26748 !! end
26749
26750 !! test
26751 2. Categories that are part of templates should not introduce a line break
26752 !! wikitext
26753 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26754 !! html/parsoid
26755 <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>
26756 !! end
26757
26758 # Careful while editing these next 2 tests. There are \u200f characters
26759 # before and after the <link> tags in the HTML and following some
26760 # of the categories in wikitext
26761 # Do not remove these characters in edits.
26762 #
26763 # As part of the serialization, these bidi characters will get stripped.
26764 !! test
26765 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26766 !! options
26767 parsoid={
26768 "modes": ["html2wt"],
26769 "scrubWikitext": true
26770 }
26771 !! html/parsoid
26772 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26773 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26774 !! wikitext
26775 [[קטגוריה:טקסים]]
26776 [[קטגוריה: שיטות משפט]]
26777 !! end
26778
26779 !! test
26780 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26781 !! options
26782 parsoid={
26783 "modes": ["html2wt"],
26784 "scrubWikitext": true
26785 }
26786 !! html/parsoid
26787 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26788 !! wikitext
26789 [[קטגוריה:טקסים]]
26790 ‏y
26791 !! end
26792
26793 !! test
26794 Lists: Add space after bullets
26795 !! options
26796 parsoid=html2wt
26797 !! html/parsoid
26798 <ul>
26799 <li>foo</li>
26800 <li> bar</li>
26801 <li><span> baz</span></li>
26802 </ul>
26803 !! wikitext
26804 * foo
26805 * bar
26806 * <span> baz</span>
26807 !! end
26808
26809 !! test
26810 1. Headings: Add space before/after == (T53744)
26811 !! options
26812 parsoid=html2wt
26813 !! html/parsoid
26814 <h2>foo</h2>
26815 <h2> bar</h2>
26816 <h2>baz </h2>
26817 <h2><span> baz</span></h2>
26818 !! wikitext
26819 == foo ==
26820
26821 == bar ==
26822
26823 == baz ==
26824
26825 == <span> baz</span> ==
26826 !! end
26827
26828 !! test
26829 2. Headings: Add space before/after == even after hoisted content
26830 !! options
26831 parsoid={
26832 "modes": ["html2wt"],
26833 "scrubWikitext": true
26834 }
26835 !! html/parsoid
26836 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26837 !! wikitext
26838 [[Category:A2]]
26839
26840 == ok ==
26841 !! end
26842
26843 !! test
26844 1. Headings: suppress newly created empty headings
26845 !! options
26846 parsoid={
26847 "modes": ["html2wt"],
26848 "scrubWikitext": true
26849 }
26850 !! html/parsoid
26851 <h2></h2>
26852 !! wikitext
26853 !! end
26854
26855 !! test
26856 2. Headings: don't suppress empty headings if scrubWikitext is false
26857 !! options
26858 parsoid=html2wt
26859 !! html/parsoid
26860 <h2></h2>
26861 !! wikitext
26862 ==<nowiki/>==
26863 !! end
26864
26865 !! test
26866 3. Headings: suppress empty headings on edits
26867 !! options
26868 parsoid={
26869 "modes": ["selser"],
26870 "scrubWikitext": true,
26871 "changes": [
26872 [ "#x", "remove"]
26873 ]
26874 }
26875 !! wikitext
26876 ==<span id="x">foo</span>==
26877 !! wikitext/edited
26878 !! end
26879
26880 !! test
26881 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26882 !! options
26883 parsoid={
26884 "modes": ["html2wt"],
26885 "scrubWikitext": true
26886 }
26887 !! html/parsoid
26888 <h2>foo<br/>bar</h2>
26889 <h2>foo <span><br/>bar</span> baz</h2>
26890 !! wikitext
26891 == foo bar ==
26892
26893 == foo <span> bar</span> baz ==
26894 !! end
26895
26896 !! test
26897 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26898 !! options
26899 parsoid={
26900 "modes": ["html2wt"],
26901 "scrubWikitext": false
26902 }
26903 !! html/parsoid
26904 <h2>foo<br/>bar</h2>
26905 !! wikitext
26906 == foo<br> bar ==
26907 !! end
26908
26909 !! test
26910 1. WT Quote Tags: suppress newly created empty style tags
26911 !! options
26912 parsoid={
26913 "modes": ["html2wt"],
26914 "scrubWikitext": true
26915 }
26916 !! html/parsoid
26917 <i></i><b></b>
26918 !! wikitext
26919 !! end
26920
26921 !! test
26922 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26923 !! options
26924 parsoid=html2wt
26925 !! html/parsoid
26926 <i></i><b></b>
26927 !! wikitext
26928 ''<nowiki/>'''''<nowiki/>'''
26929 !! end
26930
26931 !! test
26932 3. WT Quote Tags: suppress empty style tags on edits
26933 !! options
26934 parsoid={
26935 "modes": ["selser"],
26936 "scrubWikitext": true,
26937 "changes": [
26938 [ "#x", "remove"]
26939 ]
26940 }
26941 !! wikitext
26942 '''<span id="x">foo</span>'''
26943 !! wikitext/edited
26944 !! end
26945
26946 !! test
26947 1. Anchors: suppress newly created empty anchors
26948 !! options
26949 parsoid={
26950 "modes": ["html2wt"],
26951 "scrubWikitext": true
26952 }
26953 !! html/parsoid
26954 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26955 !! wikitext
26956 !! end
26957
26958 !! test
26959 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26960 !! options
26961 parsoid={
26962 "modes": ["html2wt"],
26963 "scrubWikitext": false
26964 }
26965 !! html/parsoid
26966 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26967 !! wikitext
26968 [[Test|<nowiki/>]]
26969 !! end
26970
26971 !! test
26972 3. Anchors: suppress empty anchors on edits
26973 !! options
26974 parsoid={
26975 "modes": ["selser"],
26976 "scrubWikitext": true,
26977 "changes": [
26978 [ "#x", "remove"]
26979 ]
26980 }
26981 !! wikitext
26982 [[Test|<span id="x">foo</span>]]
26983 !! wikitext/edited
26984 !! end
26985
26986 !! test
26987 3a. Anchors: do not suppress numbered extlinks
26988 !! options
26989 parsoid={
26990 "modes": ["wt2wt"],
26991 "scrubWikitext": true
26992 }
26993 !! wikitext
26994 [http://foo.com]
26995 !! html/parsoid
26996 <a rel="mw:ExtLink" href="http://foo.com"></a>
26997 !! end
26998
26999 !! test
27000 3b. Anchors: do not suppress numbered extlinks
27001 !! options
27002 parsoid={
27003 "modes": ["wt2wt"],
27004 "scrubWikitext": true,
27005 "changes": [
27006 [ "#x", "remove"]
27007 ]
27008 }
27009 !! wikitext
27010 [http://foo.com <span id="x">foo</span>]
27011 !! wikitext/edited
27012 [http://foo.com]
27013 !! end
27014
27015 !!test
27016 Normalizations should be restricted to edited content
27017 !!options
27018 parsoid={
27019 "modes": ["selser"],
27020 "scrubWikitext": true,
27021 "changes": [
27022 [ "h1", "before", "<i></i>"]
27023 ]
27024 }
27025 !!wikitext
27026 a
27027 = =
27028 b
27029 !!wikitext/edited
27030 a
27031 = =
27032 b
27033 !!end
27034
27035 !! test
27036 1. Multiple normalizations (html2wt)
27037 !! options
27038 parsoid={
27039 "modes": ["html2wt"],
27040 "scrubWikitext": true
27041 }
27042 !! html
27043 <h2><i></i></h2>
27044 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27045 </a><b><i></i></b>x</p>
27046 !! wikitext
27047
27048 [[foo]]
27049 x
27050
27051 !! end
27052
27053 !! test
27054 2. Multiple normalizations (selser)
27055 !! options
27056 parsoid={
27057 "modes": ["selser"],
27058 "scrubWikitext": true,
27059 "changes": [
27060 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27061 ]
27062 }
27063 !! wikitext
27064 <span id="x">foo</span>
27065 !! wikitext/edited
27066 <span id="x">foo</span>
27067
27068 x
27069 !! end
27070
27071 !! test
27072 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27073 !! options
27074 parsoid={
27075 "modes": ["html2wt"],
27076 "scrubWikitext": true
27077 }
27078 !! html/parsoid
27079 <p> hi</p>
27080 <p> hello</p>
27081 !! wikitext
27082 hi
27083
27084 hello
27085 !! end
27086
27087 !! test
27088 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27089 !! options
27090 parsoid=html2wt
27091 !! html/parsoid
27092 <p> hi</p>
27093 <p> hello</p>
27094 !! wikitext
27095 <nowiki> </nowiki>hi
27096
27097 <nowiki> </nowiki> hello
27098 !! end
27099
27100 !! test
27101 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27102 !! options
27103 parsoid={
27104 "modes": ["html2wt"],
27105 "scrubWikitext": true
27106 }
27107 !! html/parsoid
27108 <p>Foo
27109 bar
27110 baz</p>
27111
27112 <table><tr><td>Foo
27113 bar
27114 baz bang</td></tr></table>
27115
27116 <p><!--boo--> foo
27117 bar</p>
27118
27119 <p> foo
27120 bar<span>boo</span></p>
27121 !! wikitext
27122 Foo
27123 bar
27124 baz
27125
27126 {|
27127 |Foo
27128 bar
27129 baz bang
27130 |}
27131
27132 <!--boo-->foo
27133 bar
27134
27135 foo
27136 bar<span>boo</span>
27137 !! end
27138
27139 !! test
27140 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27141 !! options
27142 parsoid={
27143 "modes": ["selser"],
27144 "scrubWikitext": true,
27145 "changes": [
27146 [ "p", "html", " a\n b" ]
27147 ]
27148 }
27149 !! wikitext
27150 xyz
27151 !! wikitext/edited
27152 a
27153 b
27154 !! end
27155
27156 !! test
27157 1. New links that end in spaces
27158 !! options
27159 parsoid={
27160 "modes": ["html2wt"],
27161 "scrubWikitext": false
27162 }
27163 !! html/parsoid
27164 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27165 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27166 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27167 !! wikitext
27168 [[Berlin ]]<nowiki/>is the capital of Germany.
27169
27170 [[Foo ]]'''bar'''
27171
27172 [[Boston ]] is a city.
27173 !! end
27174
27175 !! test
27176 2. New links that end in spaces
27177 !! options
27178 parsoid={
27179 "modes": ["html2wt"],
27180 "scrubWikitext": true
27181 }
27182 !! html/parsoid
27183 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27184 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27185 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27186 !! wikitext
27187 [[Berlin]] is the capital of Germany.
27188
27189 [[Foo]] '''bar'''
27190
27191 [[Boston]] is a city.
27192 !! end
27193
27194 !! test
27195 1. Table cells with escapable prefixes
27196 !! options
27197 parsoid={
27198 "modes": ["html2wt"],
27199 "scrubWikitext": false
27200 }
27201 !! html
27202 <table>
27203 <tr><td>a</td></tr>
27204 <tr><td>-</td></tr>
27205 <tr><td>+</td></tr>
27206 </table>
27207 !! wikitext
27208 {|
27209 |a
27210 |-
27211 |<nowiki>-</nowiki>
27212 |-
27213 |<nowiki>+</nowiki>
27214 |}
27215 !! end
27216
27217 !! test
27218 2. Table cells with escapable prefixes
27219 !! options
27220 parsoid={
27221 "modes": ["html2wt"],
27222 "scrubWikitext": true
27223 }
27224 !! html
27225 <table>
27226 <tr><td>a</td></tr>
27227 <tr><td>-</td></tr>
27228 <tr><td>+</td></tr>
27229 </table>
27230 !! wikitext
27231 {|
27232 |a
27233 |-
27234 | -
27235 |-
27236 | +
27237 |}
27238 !! end
27239
27240 !! test
27241 3a. Table cells with escapable prefixes after edits
27242 !! options
27243 parsoid={
27244 "modes": ["selser"],
27245 "scrubWikitext": true,
27246 "changes": [
27247 [ "table tbody tr:first-child td:first-child", "remove"]
27248 ]
27249 }
27250 !! wikitext
27251 {|
27252 |a||-
27253 |}
27254 !! wikitext/edited
27255 {|
27256 | -
27257 |}
27258 !! end
27259
27260 !! test
27261 3b. Table cells with escapable prefixes after edits
27262 !! options
27263 parsoid={
27264 "modes": ["selser"],
27265 "scrubWikitext": true,
27266 "changes": [
27267 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27268 [ "#x", "remove" ]
27269 ]
27270 }
27271 !! wikitext
27272 {|
27273 |pqr
27274 |<span id="x">foo</span>+
27275 |}
27276 !! wikitext/edited
27277 {|
27278 | -
27279 | +
27280 |}
27281 !! end
27282
27283 # FIXME: This test will fail because
27284 # normalization doesn't realize that the id attribute
27285 # will eliminate the escapable scenario
27286 !! test
27287 4a. Table cells without escapable prefixes after edits
27288 !! options
27289 parsoid={
27290 "modes": ["selser"],
27291 "scrubWikitext": true,
27292 "changes": [
27293 [ "#x", "html", "-" ]
27294 ]
27295 }
27296 !! wikitext
27297 {|
27298 | id="x" |abcd
27299 |}
27300 !! wikitext/edited
27301 {|
27302 | id="x" |-
27303 |}
27304 !! end
27305
27306 ## This tests normalizer's ability to discriminate between
27307 ## cells having identical content.
27308 !! test
27309 4b. Table cells without escapable prefixes after edits
27310 !! options
27311 parsoid={
27312 "modes": ["selser"],
27313 "scrubWikitext": true,
27314 "changes": [
27315 [ "td", "html", "-" ]
27316 ]
27317 }
27318 !! wikitext
27319 {|
27320 |a||b
27321 |}
27322 !! wikitext/edited
27323 {|
27324 | -||-
27325 |}
27326 !! end
27327
27328 ## This tests normalizer's ability to not be tripped by
27329 ## comments (and whitespace)
27330 !! test
27331 4c. Table cells without escapable prefixes after edits
27332 !! options
27333 parsoid={
27334 "modes": ["selser"],
27335 "scrubWikitext": true,
27336 "changes": [
27337 [ "table tbody tr td:first-child", "remove" ]
27338 ]
27339 }
27340 !! wikitext
27341 {|
27342 |-
27343 <!--foo--> |a||-
27344 |}
27345 !! wikitext/edited
27346 {|
27347 |-
27348 <!--foo--> | -
27349 |}
27350 !! end
27351
27352 ## This tests normalizer's ability to handle HTML cells
27353 !! test
27354 4d. Table cells without escapable prefixes after edits
27355 !! options
27356 parsoid={
27357 "modes": ["selser"],
27358 "scrubWikitext": true,
27359 "changes": [
27360 [ "td", "html", "-" ]
27361 ]
27362 }
27363 !! wikitext
27364 <table>
27365 <tr><td>a</td></tr>
27366 </table>
27367 !! wikitext/edited
27368 <table>
27369 <tr><td>-</td></tr>
27370 </table>
27371 !! end
27372
27373 ## T111151 Remove font elements without attributes
27374 !! test
27375 5a. font tags without attributes should be dropped in scrubWikitext mode
27376 !! options
27377 parsoid={
27378 "modes": ["html2wt"],
27379 "scrubWikitext": true
27380 }
27381 !! html
27382 <font>foo</font>
27383 <font><font>bar</font></font>
27384 <font class="x">boo</font>
27385 !! wikitext
27386 foo
27387 bar
27388 <font class="x">boo</font>
27389 !! end
27390
27391 !! test
27392 5b. font tags should not be dropped without scrubWikitext being enabled
27393 !! options
27394 parsoid={
27395 "modes": ["html2wt"],
27396 "scrubWikitext": false
27397 }
27398 !! html
27399 <font>foo</font>
27400 !! wikitext
27401 <font>foo</font>
27402 !! end
27403
27404 !! test
27405 Escape nowiki DOM elements
27406 !! options
27407 parsoid=html2wt
27408 !! html/parsoid
27409 <nowiki><i>foo</i></nowiki>
27410 !! wikitext
27411 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27412 !! end
27413
27414 # This is meant to be an interim fix while we go about figuring out
27415 # how to not introduce these trailing <nowiki/>s in the first place.
27416 !! test
27417 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27418 !! options
27419 parsoid=html2wt
27420 !! html/parsoid
27421 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27422 y</p>
27423 <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>
27424 <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>
27425 !! wikitext
27426 x
27427 y
27428
27429 {{echo|
27430 1 = <nowiki/>}}
27431
27432 {{echo|
27433 1 = <nowiki/>
27434 }}
27435 !! end
27436
27437 # ---------------------------------------------------
27438 # End of tests spec'ing wikitext serialization norms |
27439 # ---------------------------------------------------
27440
27441 # T104032
27442 !! test
27443 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27444 !! options
27445 parsoid=html2wt
27446 !! html/parsoid
27447 a<p>b</p>
27448 <b>c</b><p>d</p>
27449 <table><tr>
27450 <td>a<p>b</p></td>
27451 <td><b>c</b><p>d</p></td>
27452 </tr></table>
27453 !! wikitext
27454 a
27455
27456 b
27457
27458 '''c'''
27459
27460 d
27461 {|
27462 |a
27463 b
27464 |'''c'''
27465 d
27466 |}
27467 !! end
27468
27469 # -----------------------------------------------------------------
27470 # End of section for Parsoid-only html2wt tests for serialization
27471 # of new content
27472 # -----------------------------------------------------------------
27473
27474 # -----------------------------------------------------------------
27475 # The following section of tests are primarily to spec behavior of
27476 # the selective serializer. All these tests have manual selser
27477 # changes. The automated selser changes for all tests handle the
27478 # wide variation of changes, but these tests here capture specs
27479 # deterministically.
27480 # ----------------------------------------------------------------
27481
27482 ## T90517
27483 !! test
27484 Selser: New comments should not be lost
27485 !! options
27486 parsoid={
27487 "modes": ["selser"],
27488 "changes": [
27489 [ "#a", "after", "<!--c1-->" ],
27490 [ "#b", "before", "<!--c2-->" ]
27491 ]
27492 }
27493 !! wikitext
27494 <span id="a">a</span>
27495
27496 <span id="b">b</span>
27497 !! wikitext/edited
27498 <span id="a">a</span><!--c1-->
27499
27500 <!--c2--><span id="b">b</span>
27501 !! end
27502
27503 ## T89383
27504 !! test
27505 Selser: Check for validity of DSR before using it
27506 !! options
27507 parsoid={
27508 "modes": ["selser"],
27509 "changes": [
27510 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27511 ]
27512 }
27513 !! wikitext
27514 <span id="a">a</span>
27515 !! wikitext/edited
27516 {{DISPLAYTITLE:foo}}
27517 <span id="a">a</span>
27518 !! end
27519
27520 !! test
27521 1. DOMDiff: Changes to <ref> content should be looked up using id
27522 !! options
27523 parsoid={
27524 "modes": ["selser"],
27525 "changes": [
27526 ["#X", "after", "bar"],
27527 ["#Y", "after", "baz"]
27528 ]
27529 }
27530 !! wikitext
27531 X <ref><span id="X">foo</span></ref>
27532 Y <ref name="a" />
27533 <references>
27534 <ref name="a"><span id="Y">foo</span></ref>
27535 </references>
27536 !! wikitext/edited
27537 X <ref><span id="X">foo</span>bar</ref>
27538 Y <ref name="a" />
27539 <references>
27540 <ref name="a"><span id="Y">foo</span>baz</ref>
27541 </references>
27542 !! end
27543
27544 !! test
27545 2. DOMDiff: Changes to <ref> content should be looked up using id
27546 !! options
27547 parsoid={
27548 "modes": ["selser"],
27549 "changes": [
27550 ["#Z", "after", "bar"]
27551 ]
27552 }
27553 !! wikitext
27554 A <ref>foo bar for a</ref>
27555 B <ref group="X" name="b" />
27556
27557 <references />
27558
27559 <references group="X">
27560 <ref name="b"><span id="Z">foo</span></ref>
27561 </references>
27562 !! wikitext/edited
27563 A <ref>foo bar for a</ref>
27564 B <ref group="X" name="b" />
27565
27566 <references />
27567
27568 <references group="X">
27569 <ref name="b"><span id="Z">foo</span>bar</ref>
27570 </references>
27571 !! end
27572
27573 !! test
27574 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27575 !! options
27576 parsoid={
27577 "modes": ["selser"],
27578 "changes": [
27579 [ "div:first-child", "text", "bar" ]
27580 ]
27581 }
27582 !! wikitext
27583 <div style="{{1x|color:red;}}%">foo</div>
27584 !! wikitext/edited
27585 <div style="{{1x|color:red;}}%">bar</div>
27586 !! end
27587
27588 !! test
27589 Empty LI (T49673)
27590 !! wikitext
27591 * a
27592 *
27593 *
27594 * b
27595 !! html/php+tidy
27596 <ul>
27597 <li>a</li>
27598 <li class="mw-empty-elt"></li>
27599 <li class="mw-empty-elt"></li>
27600 <li>b</li>
27601 </ul>
27602 !! end
27603
27604 !! test
27605 Thumbnail output
27606 !! wikitext
27607 [[File:Thumb.png|thumb]]
27608 !! html/php+tidy
27609 <div class="thumb tright">
27610 <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>
27611 <div class="thumbcaption">
27612 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27613 </div>
27614 </div>
27615 </div>
27616 !! end
27617
27618 !! test
27619 unclosed internal link XSS (T137264)
27620 !! wikitext
27621 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27622 !! html/php
27623 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27624 </p>
27625 !! html/parsoid
27626 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
27627 !! end