Merge "objectcache: Never use CACHE_NONE for CACHE_ANYTHING"
[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 ## Parsoid thinks the "centre" here is a property, not a caption.
19118 !! test
19119 Gallery
19120 !! options
19121 parsoid={
19122 "modes": ["wt2html"],
19123 "nativeGallery": true
19124 }
19125 !! wikitext
19126 <gallery>
19127 image1.png |
19128 image2.gif|||||
19129
19130 image3|
19131 image4 |300px| centre
19132 image5.svg| http://///////
19133 [[x|xx]]]]
19134 * image6
19135 </gallery>
19136 !! html/php
19137 <ul class="gallery mw-gallery-traditional">
19138 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19139 <div class="thumb" style="height: 150px;">Image1.png</div>
19140 <div class="gallerytext">
19141 </div>
19142 </div></li>
19143 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19144 <div class="thumb" style="height: 150px;">Image2.gif</div>
19145 <div class="gallerytext">
19146 </div>
19147 </div></li>
19148 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19149 <div class="thumb" style="height: 150px;">Image3</div>
19150 <div class="gallerytext">
19151 </div>
19152 </div></li>
19153 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19154 <div class="thumb" style="height: 150px;">Image4</div>
19155 <div class="gallerytext">
19156 <pre>centre
19157 </pre>
19158 </div>
19159 </div></li>
19160 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19161 <div class="thumb" style="height: 150px;">Image5.svg</div>
19162 <div class="gallerytext">
19163 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
19164 </p>
19165 </div>
19166 </div></li>
19167 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19168 <div class="thumb" style="height: 150px;">* image6</div>
19169 <div class="gallerytext">
19170 </div>
19171 </div></li>
19172 </ul>
19173
19174 !! html/parsoid
19175 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19176 <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>
19177 <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>
19178 <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>
19179 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">image4 </span></div><div class="gallerytext"></div></li>
19180 <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>
19181 <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>
19182 </ul>
19183 !! end
19184
19185 !! test
19186 Gallery (with options, html)
19187 !! options
19188 parsoid={
19189 "modes": ["wt2html", "html2html"],
19190 "nativeGallery": true
19191 }
19192 !! wikitext
19193 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19194 File:Nonexistent.jpg|caption
19195 File:Nonexistent.jpg
19196 image:foobar.jpg|some '''caption''' [[Main Page]]
19197 image:foobar.jpg
19198 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19199 </gallery>
19200 !! html/php
19201 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19202 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19203 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19204 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19205 <div class="gallerytext">
19206 <p>caption
19207 </p>
19208 </div>
19209 </div></li>
19210 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19211 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19212 <div class="gallerytext">
19213 </div>
19214 </div></li>
19215 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19216 <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>
19217 <div class="gallerytext">
19218 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19219 </p>
19220 </div>
19221 </div></li>
19222 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19223 <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>
19224 <div class="gallerytext">
19225 </div>
19226 </div></li>
19227 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19228 <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>
19229 <div class="gallerytext">
19230 <p>blabla.
19231 </p>
19232 </div>
19233 </div></li>
19234 </ul>
19235
19236 !! html/parsoid
19237 <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":{}}'>
19238 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19239 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext">caption</div></li>
19240 <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>
19241 <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>
19242 <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>
19243 <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>
19244 </ul>
19245 !! end
19246
19247 !! test
19248 Gallery (with options, extsrc)
19249 !! options
19250 parsoid={
19251 "nativeGallery": false
19252 }
19253 !! wikitext
19254 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19255 File:Nonexistent.jpg|caption
19256 File:Nonexistent.jpg
19257 image:foobar.jpg|some '''caption''' [[Main Page]]
19258 image:foobar.jpg
19259 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19260 </gallery>
19261 !! html/php
19262 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19263 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19264 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19265 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19266 <div class="gallerytext">
19267 <p>caption
19268 </p>
19269 </div>
19270 </div></li>
19271 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19272 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19273 <div class="gallerytext">
19274 </div>
19275 </div></li>
19276 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19277 <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>
19278 <div class="gallerytext">
19279 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19280 </p>
19281 </div>
19282 </div></li>
19283 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19284 <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>
19285 <div class="gallerytext">
19286 </div>
19287 </div></li>
19288 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19289 <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>
19290 <div class="gallerytext">
19291 <p>blabla.
19292 </p>
19293 </div>
19294 </div></li>
19295 </ul>
19296
19297 !! html/parsoid
19298 <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"}}'>
19299 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19300 <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>
19301 <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>
19302 <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>
19303 <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>
19304 <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>
19305 </ul>
19306 !! end
19307
19308 !! test
19309 Gallery with link that has fragment
19310 !! options
19311 parsoid={
19312 "modes": ["wt2html", "html2html"],
19313 "nativeGallery": true
19314 }
19315 !! wikitext
19316 <gallery>
19317 image:foobar.jpg|link=Main_Page
19318 image:foobar.jpg|link=Main_Page#section
19319 image:foobar.jpg|link=Main Page#section|caption
19320 </gallery>
19321 !! html/php
19322 <ul class="gallery mw-gallery-traditional">
19323 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19324 <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>
19325 <div class="gallerytext">
19326 </div>
19327 </div></li>
19328 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19329 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
19330 <div class="gallerytext">
19331 </div>
19332 </div></li>
19333 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19334 <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>
19335 <div class="gallerytext">
19336 <p>caption
19337 </p>
19338 </div>
19339 </div></li>
19340 </ul>
19341
19342 !! html/parsoid
19343 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19344 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./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>
19345 <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>
19346 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./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>
19347 </ul>
19348 !! end
19349
19350 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19351 !! test
19352 Gallery with template inside caption
19353 !! options
19354 parsoid={
19355 "nativeGallery": true
19356 }
19357 !! wikitext
19358 <gallery caption="{{echo|hi}}">
19359 File:Foobar.jpg|{{echo|ho}}
19360 </gallery>
19361 !! html/php
19362 <ul class="gallery mw-gallery-traditional">
19363 <li class='gallerycaption'>{{echo|hi}}</li>
19364 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19365 <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>
19366 <div class="gallerytext">
19367 <p>ho
19368 </p>
19369 </div>
19370 </div></li>
19371 </ul>
19372
19373 !! html/parsoid
19374 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19375 <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>
19376 <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>
19377 </ul>
19378 !! end
19379
19380 !! test
19381 Gallery with wikitext inside caption
19382 !! options
19383 parsoid={
19384 "nativeGallery": true
19385 }
19386 !! wikitext
19387 <gallery>
19388 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19389 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19390 </gallery>
19391 !! html/php
19392 <ul class="gallery mw-gallery-traditional">
19393 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19394 <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>
19395 <div class="gallerytext">
19396 <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>
19397 </p>
19398 </div>
19399 </div></li>
19400 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19401 <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>
19402 <div class="gallerytext">
19403 <p>This is a test template
19404 </p>
19405 </div>
19406 </div></li>
19407 </ul>
19408
19409 !! html/parsoid
19410 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19411 <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>
19412 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span 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>
19413 </ul>
19414 !! end
19415
19416 !! test
19417 Gallery (with showfilename option)
19418 !! options
19419 parsoid={
19420 "nativeGallery": true
19421 }
19422 !! wikitext
19423 <gallery showfilename="">
19424 File:Nonexistent.jpg|caption
19425 File:Nonexistent.jpg
19426 File:Foobar.jpg|some '''caption''' [[Main Page]]
19427 File:Foobar.jpg
19428 </gallery>
19429 !! html/php
19430 <ul class="gallery mw-gallery-traditional">
19431 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19432 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19433 <div class="gallerytext">
19434 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19435 caption
19436 </p>
19437 </div>
19438 </div></li>
19439 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19440 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19441 <div class="gallerytext">
19442 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19443 </p>
19444 </div>
19445 </div></li>
19446 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19447 <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>
19448 <div class="gallerytext">
19449 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19450 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19451 </p>
19452 </div>
19453 </div></li>
19454 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19455 <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>
19456 <div class="gallerytext">
19457 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19458 </p>
19459 </div>
19460 </div></li>
19461 </ul>
19462
19463 !! html/parsoid
19464 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
19465 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span 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>
19466 <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>
19467 <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>
19468 <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>
19469 </ul>
19470 !! end
19471
19472 ## Should Parsoid be preserving these variations?
19473 !! test
19474 Gallery (with namespace-less filenames)
19475 !! options
19476 parsoid={
19477 "modes": ["wt2html", "html2html"],
19478 "nativeGallery": true
19479 }
19480 !! wikitext
19481 <gallery>
19482 File:Nonexistent.jpg
19483 Nonexistent.jpg
19484 image:foobar.jpg
19485 foobar.jpg
19486 </gallery>
19487 !! html/php
19488 <ul class="gallery mw-gallery-traditional">
19489 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19490 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19491 <div class="gallerytext">
19492 </div>
19493 </div></li>
19494 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19495 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19496 <div class="gallerytext">
19497 </div>
19498 </div></li>
19499 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19500 <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>
19501 <div class="gallerytext">
19502 </div>
19503 </div></li>
19504 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19505 <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>
19506 <div class="gallerytext">
19507 </div>
19508 </div></li>
19509 </ul>
19510
19511 !! html/parsoid
19512 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19513 <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>
19514 <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>
19515 <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>
19516 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./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>
19517 </ul>
19518 !! end
19519
19520 !! test
19521 Gallery override link with WikiLink (T36852)
19522 !! options
19523 parsoid={
19524 "nativeGallery": true
19525 }
19526 !! wikitext
19527 <gallery>
19528 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
19529 </gallery>
19530 !! html/php
19531 <ul class="gallery mw-gallery-traditional">
19532 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19533 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/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>
19534 <div class="gallerytext">
19535 </div>
19536 </div></li>
19537 </ul>
19538
19539 !! html/parsoid
19540 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-parsoid='{"dsr":[0,70,2,2]}' data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19541 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./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>
19542 </ul>
19543 !! end
19544
19545 !! test
19546 Gallery override link with absolute external link (T36852)
19547 !! options
19548 parsoid={
19549 "nativeGallery": true
19550 }
19551 !! wikitext
19552 <gallery>
19553 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
19554 </gallery>
19555 !! html/php
19556 <ul class="gallery mw-gallery-traditional">
19557 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19558 <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>
19559 <div class="gallerytext">
19560 </div>
19561 </div></li>
19562 </ul>
19563
19564 !! html/parsoid
19565 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19566 <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>
19567 </ul>
19568 !! end
19569
19570 !! test
19571 Gallery override link with absolute external link with LanguageConverter
19572 !! options
19573 language=zh
19574 !! input
19575 <gallery>
19576 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19577 </gallery>
19578 !! result
19579 <ul class="gallery mw-gallery-traditional">
19580 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19581 <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>
19582 <div class="gallerytext">
19583 <p>caption
19584 </p>
19585 </div>
19586 </div></li>
19587 </ul>
19588
19589 !! end
19590
19591 !! test
19592 Gallery override link with malicious javascript (T36852)
19593 !! options
19594 parsoid={
19595 "modes": ["wt2html", "html2html"],
19596 "nativeGallery": true
19597 }
19598 !! wikitext
19599 <gallery>
19600 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19601 </gallery>
19602 !! html/php
19603 <ul class="gallery mw-gallery-traditional">
19604 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19605 <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>
19606 <div class="gallerytext">
19607 </div>
19608 </div></li>
19609 </ul>
19610
19611 !! html/parsoid
19612 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19613 <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>
19614 </ul>
19615 !! end
19616
19617 !! test
19618 Gallery with invalid title as link (T45964)
19619 !! options
19620 parsoid={
19621 "modes": ["wt2html", "html2html"],
19622 "nativeGallery": true
19623 }
19624 !! wikitext
19625 <gallery>
19626 File:Foobar.jpg|link=<
19627 </gallery>
19628 !! html/php
19629 <ul class="gallery mw-gallery-traditional">
19630 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19631 <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>
19632 <div class="gallerytext">
19633 </div>
19634 </div></li>
19635 </ul>
19636
19637 !! html/parsoid
19638 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19639 <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>
19640 </ul>
19641 !! end
19642
19643 !! test
19644 Serialize gallery without attrs in data-mw
19645 !! options
19646 parsoid={
19647 "modes": ["html2wt"],
19648 "nativeGallery": true
19649 }
19650 !! html/parsoid
19651 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
19652 <li class="gallerycaption">123</li>
19653 <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>
19654 </ul>
19655 !! wikitext
19656 <gallery caption="123">
19657 File:Test.png
19658 </gallery>
19659 !! end
19660
19661 !! test
19662 Gallery with class attribute
19663 !! options
19664 parsoid={
19665 "nativeGallery": true
19666 }
19667 !! wikitext
19668 <gallery class="center">
19669 File:Foobar.jpg
19670 </gallery>
19671 !! html/php
19672 <ul class="gallery mw-gallery-traditional center">
19673 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19674 <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>
19675 <div class="gallerytext">
19676 </div>
19677 </div></li>
19678 </ul>
19679
19680 !! html/parsoid
19681 <ul class="gallery mw-gallery-traditional center" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"class":"center"},"body":{}}'>
19682 <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>
19683 </ul>
19684 !! end
19685
19686 !! test
19687 HTML Hex character encoding (spells the word "JavaScript")
19688 !! options
19689 parsoid=wt2html,wt2wt,html2html
19690 !! wikitext
19691 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19692 !! html/php
19693 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19694 </p>
19695 !! html/php+tidy
19696 <p>JavaScript</p>
19697 !! html/parsoid
19698 <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>
19699 !! end
19700
19701 !! test
19702 HTML Hex character encoding bogus encoding (T28437 regression check)
19703 !! wikitext
19704 &#xsee;&#XSEE;
19705 !! html/php
19706 <p>&amp;#xsee;&amp;#XSEE;
19707 </p>
19708 !! html/parsoid
19709 <p>&amp;#xsee;&amp;#XSEE;</p>
19710 !! end
19711
19712 !! test
19713 HTML Hex character encoding mixed case
19714 !! options
19715 parsoid=wt2html,wt2wt,html2html
19716 !! wikitext
19717 &#xEE;&#Xee;
19718 !! html/php
19719 <p>&#xee;&#xee;
19720 </p>
19721 !! html/php+tidy
19722 <p>îî</p>
19723 !! html/parsoid
19724 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19725 !! end
19726
19727 # See: https://www.w3.org/TR/html5/syntax.html#character-references
19728 # Note that U+000C (form feed) is not a valid XML character, so
19729 # it is banned even though allowed in HTML5.
19730 !! test
19731 Illegal character references (T106578)
19732 !! wikitext
19733 ; Null: &#00;
19734 ; FF: &#xC;
19735 ; CR: &#xD;
19736 ; Control (low): &#8;
19737 ; Control (high): &#x7F; &#x9F;
19738 ; Surrogate: &#xD83D;&#xDCA9;
19739 ; This is an okay astral character: &#x1F4A9;
19740 !! html+tidy
19741 <dl>
19742 <dt>Null</dt>
19743 <dd>&amp;#00;</dd>
19744 <dt>FF</dt>
19745 <dd>&amp;#xC;</dd>
19746 <dt>CR</dt>
19747 <dd>&amp;#xD;</dd>
19748 <dt>Control (low)</dt>
19749 <dd>&amp;#8;</dd>
19750 <dt>Control (high)</dt>
19751 <dd>&amp;#x7F; &amp;#x9F;</dd>
19752 <dt>Surrogate</dt>
19753 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19754 <dt>This is an okay astral character</dt>
19755 <dd>💩</dd>
19756 </dl>
19757 !! end
19758
19759 !! test
19760 __FORCETOC__ override
19761 !! wikitext
19762 __NEWSECTIONLINK__
19763 __FORCETOC__
19764 !! html/php
19765 <p><br />
19766 </p>
19767 !! end
19768
19769 !! test
19770 ISBN code coverage
19771 !! wikitext
19772 ISBN 978-0-1234-56&#x20;789
19773 !! html
19774 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19775 </p>
19776 !! html+tidy
19777 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19778 !! html/parsoid
19779 <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>
19780 !! end
19781
19782 !! test
19783 ISBN followed by 5 spaces
19784 !! wikitext
19785 ISBN
19786 !! html
19787 <p>ISBN
19788 </p>
19789 !! end
19790
19791 !! test
19792 Double ISBN
19793 !! wikitext
19794 ISBN ISBN 1234567890
19795 !! html/php
19796 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19797 </p>
19798 !! html/parsoid
19799 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19800 !! end
19801
19802 # Uppercase X and lowercase x as well
19803 !! test
19804 ISBN with an X
19805 !! wikitext
19806 ISBN 3-462-04561-X
19807 ISBN 3-462-04561-x
19808 ISBN 080442957X
19809 ISBN 080442957x
19810 ISBN 978080442957X
19811 ISBN 978080442957x
19812 !! html/php
19813 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19814 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19815 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19816 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19817 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19818 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19819 </p>
19820 !! html/parsoid
19821 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19822 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19823 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19824 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19825 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19826 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19827 !! end
19828
19829 !! test
19830 ISBN with empty prefix (parsoid test)
19831 !! wikitext
19832 ISBN 1234567890
19833 !! html/php
19834 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19835 </p>
19836 !! html/parsoid
19837 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19838 !! end
19839
19840 !! test
19841 T24905: <abbr> followed by ISBN followed by </a>
19842 !! wikitext
19843 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19844 !! html/php
19845 <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>
19846 </p>
19847 !! html/parsoid
19848 <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>
19849 !! end
19850
19851 !! test
19852 Double RFC
19853 !! wikitext
19854 RFC RFC 1234
19855 !! html
19856 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19857 </p>
19858 !! end
19859
19860 !! test
19861 Double RFC with a wiki link
19862 !! wikitext
19863 RFC [[RFC 1234]]
19864 !! html
19865 <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>
19866 </p>
19867 !! end
19868
19869 !! test
19870 RFC code coverage
19871 !! wikitext
19872 RFC 983&#x20;987
19873 !! html
19874 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19875 </p>
19876 !! html+tidy
19877 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19878 !! end
19879
19880 !! test
19881 Centre-aligned image
19882 !! wikitext
19883 [[Image:foobar.jpg|centre]]
19884 !! html
19885 <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>
19886
19887 !!end
19888
19889 !! test
19890 None-aligned image
19891 !! wikitext
19892 [[Image:foobar.jpg|none]]
19893 !! html
19894 <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>
19895
19896 !!end
19897
19898 !! test
19899 Width + Height sized image (using px) (height is ignored)
19900 !! wikitext
19901 [[Image:foobar.jpg|640x480px]]
19902 !! html
19903 <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>
19904 </p>
19905 !!end
19906
19907 !! test
19908 Width-sized image (using px, no following whitespace)
19909 !! wikitext
19910 [[Image:foobar.jpg|640px]]
19911 !! html
19912 <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>
19913 </p>
19914 !!end
19915
19916 !! test
19917 Width-sized image (using px, with following whitespace - test regression from r39467)
19918 !! wikitext
19919 [[Image:foobar.jpg|640px ]]
19920 !! html
19921 <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>
19922 </p>
19923 !!end
19924
19925 !! test
19926 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19927 !! wikitext
19928 [[Image:foobar.jpg| 640px]]
19929 !! html
19930 <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>
19931 </p>
19932 !!end
19933
19934 !! test
19935 Image with page parameter
19936 !! options
19937 djvu
19938 !! wikitext
19939 [[File:LoremIpsum.djvu|page=2]]
19940 !! html/php
19941 <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>
19942 </p>
19943 !! html/parsoid
19944 <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>
19945 !! end
19946
19947 !! test
19948 Another italics / bold test
19949 !! wikitext
19950 ''' ''x'
19951 !! html
19952 <pre>'<i> </i>x'
19953 </pre>
19954 !!end
19955
19956 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19957 !! test
19958 dt/dd/dl test
19959 !! wikitext
19960 :;;;::
19961 !! html/php
19962 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19963
19964 !! html/parsoid
19965 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19966
19967 !!end
19968
19969 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19970 !! test
19971 Images with the "|" character in the comment
19972 !! wikitext
19973 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19974 !! html/php
19975 <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>
19976
19977 !! html/parsoid
19978 <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>
19979 !! end
19980
19981 !! test
19982 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19983 !! wikitext
19984 <html><script>alert(1);</script></html>
19985 !! html
19986 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19987 </p>
19988 !! end
19989
19990 !! test
19991 HTML with raw HTML ($wgRawHtml==true)
19992 !! options
19993 wgRawHtml=1
19994 !! wikitext
19995 <html><script>alert(1);</script></html>
19996 !! html
19997 <p><script>alert(1);</script>
19998 </p>
19999 !! end
20000
20001 !! test
20002 Parents of subpages, one level up
20003 !! options
20004 subpage title=[[Subpage test/L1/L2/L3]]
20005 !! wikitext
20006 [[../|L2]]
20007 !! html
20008 <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>
20009 </p>
20010 !! end
20011
20012
20013 !! test
20014 Parents of subpages, one level up, not named
20015 !! options
20016 subpage title=[[Subpage test/L1/L2/L3]]
20017 !! wikitext
20018 [[../]]
20019 !! html
20020 <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>
20021 </p>
20022 !! end
20023
20024
20025
20026 !! test
20027 Parents of subpages, two levels up
20028 !! options
20029 subpage title=[[Subpage test/L1/L2/L3]]
20030 !! wikitext
20031 [[../../|L1]]2
20032
20033 [[../../|L1]]l
20034 !! html
20035 <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
20036 </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>
20037 </p>
20038 !! end
20039
20040 !! test
20041 Parents of subpages, two levels up, without trailing slash or name.
20042 !! options
20043 subpage title=[[Subpage test/L1/L2/L3]]
20044 !! wikitext
20045 [[../..]]
20046 !! html
20047 <p>[[../..]]
20048 </p>
20049 !! end
20050
20051 !! test
20052 Parents of subpages, two levels up, with lots of extra trailing slashes.
20053 !! options
20054 subpage title=[[Subpage test/L1/L2/L3]]
20055 !! wikitext
20056 [[../../////]]
20057 !! html
20058 <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>
20059 </p>
20060 !! end
20061
20062 !! article
20063 Subpage test/L1/L2/L3Sibling
20064 !! text
20065 Sibling article
20066 !! endarticle
20067
20068 !! test
20069 Transclusion of a sibling page (one level up)
20070 !! options
20071 subpage title=[[Subpage test/L1/L2/L3]]
20072 !! wikitext
20073 {{../L3Sibling}}
20074 !! html
20075 <p>Sibling article
20076 </p>
20077 !! end
20078
20079 !! test
20080 Transclusion of a child page
20081 !! options
20082 subpage title=[[Subpage test/L1/L2]]
20083 !! wikitext
20084 {{/L3Sibling}}
20085 !! html
20086 <p>Sibling article
20087 </p>
20088 !! end
20089
20090 # This is wt2html only in Parsoid because we add <nowiki>
20091 # because of {{..}} and we don't expect to fix that to
20092 # eliminate the nowikis selective for {{..}} markup.
20093 !! test
20094 Non-transclusion because of too many up levels
20095 !! options
20096 subpage title=[[Subpage test/L1/L2/L3]]
20097 parsoid=wt2html
20098 !! wikitext
20099 {{../../../../More than parent}}
20100 !! html/php
20101 <p>{{../../../../More than parent}}
20102 </p>
20103 !! html/parsoid
20104 <p>{{../../../../More than parent}}</p>
20105 !! end
20106
20107 !! test
20108 Definition list code coverage
20109 !! wikitext
20110 ; title : def
20111 ; title : def
20112 ;title: def
20113 !! html/php
20114 <dl><dt> title &#160;</dt>
20115 <dd> def</dd>
20116 <dt> title&#160;</dt>
20117 <dd> def</dd>
20118 <dt>title</dt>
20119 <dd> def</dd></dl>
20120
20121 !! html/parsoid
20122 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20123 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20124 <dt>title</dt><dd> def</dd></dl>
20125 !! end
20126
20127 !! test
20128 Don't fall for the self-closing div
20129 !! wikitext
20130 <div>hello world</div/>
20131 !! html
20132 <div>hello world</div>
20133
20134 !! end
20135
20136 !! test
20137 MSGNW magic word
20138 !! wikitext
20139 {{MSGNW:msg}}
20140 !! html/php
20141 <p>&#91;&#91;:Template:Msg&#93;&#93;
20142 </p>
20143 !! end
20144
20145 !! test
20146 RAW magic word
20147 !! wikitext
20148 {{RAW:QUERTY}}
20149 !! html
20150 <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>
20151 </p>
20152 !! end
20153
20154 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
20155 !! test
20156 Always escape literal '>' in output, not just after '<'
20157 !! wikitext
20158 ><>
20159 !! html
20160 <p>&gt;&lt;&gt;
20161 </p>
20162 !! end
20163
20164 !! test
20165 Template caching
20166 !! wikitext
20167 {{Test}}
20168 {{Test}}
20169 !! html
20170 <p>This is a test template
20171 This is a test template
20172 </p>
20173 !! end
20174
20175
20176 !! article
20177 MediaWiki:Fake
20178 !! text
20179 ==header==
20180 !! endarticle
20181
20182 !! test
20183 Inclusion of !userCanEdit() content
20184 !! wikitext
20185 {{MediaWiki:Fake}}
20186 !! html
20187 <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>
20188
20189 !! end
20190
20191
20192 !! test
20193 Out-of-order TOC heading levels
20194 !! wikitext
20195 ==2==
20196 ======6======
20197 ===3===
20198 =1=
20199 =====5=====
20200 ==2==
20201 !! html
20202 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20203 <ul>
20204 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
20205 <ul>
20206 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
20207 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
20208 </ul>
20209 </li>
20210 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
20211 <ul>
20212 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
20213 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
20214 </ul>
20215 </li>
20216 </ul>
20217 </div>
20218
20219 <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>
20220 <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>
20221 <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>
20222 <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>
20223 <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>
20224 <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>
20225
20226 !! end
20227
20228
20229 !! test
20230 ISBN with a dummy number
20231 !! wikitext
20232 ISBN ---
20233 !! html
20234 <p>ISBN ---
20235 </p>
20236 !! end
20237
20238
20239 !! test
20240 ISBN with space-delimited number
20241 !! wikitext
20242 ISBN 92 9017 032 8
20243 !! html
20244 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
20245 </p>
20246 !! end
20247
20248
20249 !! test
20250 ISBN with multiple spaces, no number
20251 !! wikitext
20252 ISBN foo
20253 !! html
20254 <p>ISBN foo
20255 </p>
20256 !! end
20257
20258
20259 !! test
20260 ISBN length
20261 !! wikitext
20262 ISBN 123456789
20263
20264 ISBN 1234567890
20265
20266 ISBN 12345678901
20267 !! html
20268 <p>ISBN 123456789
20269 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20270 </p><p>ISBN 12345678901
20271 </p>
20272 !! end
20273
20274
20275 !! test
20276 ISBN with trailing year (T9110)
20277 !! wikitext
20278 ISBN 1-234-56789-0 - 2006
20279
20280 ISBN 1 234 56789 0 - 2006
20281 !! html
20282 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
20283 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20284 </p>
20285 !! end
20286
20287
20288 !! test
20289 anchorencode
20290 !! wikitext
20291 {{anchorencode:foo bar©#%n}}
20292 !! html
20293 <p>foo_bar.C2.A9.23.25n
20294 </p>
20295 !! end
20296
20297 !! test
20298 anchorencode trims spaces
20299 !! wikitext
20300 {{anchorencode: __pretty__please__}}
20301 !! html
20302 <p>pretty_please
20303 </p>
20304 !! end
20305
20306 !! test
20307 anchorencode deals with links
20308 !! wikitext
20309 {{anchorencode: [[hello|world]] [[hi]]}}
20310 !! html
20311 <p>world_hi
20312 </p>
20313 !! end
20314
20315 !! test
20316 anchorencode deals with templates
20317 !! wikitext
20318 {{anchorencode: {{Foo}} }}
20319 !! html
20320 <p>FOO
20321 </p>
20322 !! end
20323
20324 !! test
20325 anchorencode encodes like the TOC generator: (T20431)
20326 !! wikitext
20327 === _ +:.3A%3A&&amp;]] ===
20328 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20329 __NOEDITSECTION__
20330 !! html
20331 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20332 <p>.2B:.3A.253A.26.26.5D.5D
20333 </p>
20334 !! end
20335
20336 !! test
20337 T8200: blockquotes and paragraph formatting
20338 !! wikitext
20339 <blockquote>
20340 foo
20341 </blockquote>
20342
20343 bar
20344
20345 baz
20346 !! html
20347 <blockquote>
20348 <p>foo
20349 </p>
20350 </blockquote>
20351 <p>bar
20352 </p>
20353 <pre>baz
20354 </pre>
20355 !! end
20356
20357 !! test
20358 T10293: Use of center tag ruins paragraph formatting
20359 !! wikitext
20360 <center>
20361 foo
20362 </center>
20363
20364 bar
20365
20366 baz
20367 !! html
20368 <center>
20369 <p>foo
20370 </p>
20371 </center>
20372 <p>bar
20373 </p>
20374 <pre>baz
20375 </pre>
20376 !! end
20377
20378 !!test
20379 Parsing of overlapping (improperly nested) inline html tags
20380 !! wikitext
20381 <span><s>x</span></s>
20382 !! html/php
20383 <p><span><s>x&lt;/span&gt;</s></span>
20384 </p>
20385 !! html/parsoid
20386 <p><span><s>x</s></span>
20387 </p>
20388 !!end
20389
20390 ###
20391 ### Language variants related tests
20392 ###
20393 !! test
20394 Self-link in language variants
20395 !! options
20396 title=[[Dunav]] language=sr
20397 !! wikitext
20398 Both [[Dunav]] and [[Дунав]] are names for this river.
20399 !! html
20400 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
20401 </p>
20402 !!end
20403
20404 !! article
20405 Дуна
20406 !! text
20407 content
20408 !! endarticle
20409
20410 !! test
20411 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
20412 !! options
20413 title=[[Duna]] language=sr
20414 !! wikitext
20415 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
20416 !! html
20417 <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.
20418 </p>
20419 !! end
20420
20421 !! test
20422 Link to a section of a variant of this title shouldn't be parsed as self-link
20423 !! options
20424 title=[[Duna]] language=sr
20425 !! wikitext
20426 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
20427 !! html
20428 <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.
20429 </p>
20430 !! end
20431
20432 !! test
20433 Link to pages in language variants
20434 !! options
20435 language=sr
20436 !! wikitext
20437 Main Page can be written as [[Маин Паге]]
20438 !! html
20439 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
20440 </p>
20441 !!end
20442
20443
20444 !! test
20445 Multiple links to pages in language variants
20446 !! options
20447 language=sr
20448 !! wikitext
20449 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
20450 !! html
20451 <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>.
20452 </p>
20453 !!end
20454
20455
20456 !! test
20457 Simple template in language variants
20458 !! options
20459 language=sr
20460 !! wikitext
20461 {{тест}}
20462 !! html
20463 <p>This is a test template
20464 </p>
20465 !! end
20466
20467
20468 !! test
20469 Template with explicit namespace in language variants
20470 !! options
20471 language=sr
20472 !! wikitext
20473 {{Template:тест}}
20474 !! html
20475 <p>This is a test template
20476 </p>
20477 !! end
20478
20479
20480 !! test
20481 Basic test for template parameter in language variants
20482 !! options
20483 language=sr
20484 !! wikitext
20485 {{парамтест|param=foo}}
20486 !! html
20487 <p>This is a test template with parameter foo
20488 </p>
20489 !! end
20490
20491 !! test
20492 Simple category in language variants
20493 !! options
20494 language=sr cat
20495 !! wikitext
20496 [[Category:МедиаWики Усер'с Гуиде]]
20497 !! html/php
20498 cat=МедиаWики_Усер'с_Гуиде sort=
20499 !! html/parsoid
20500 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
20501 !! end
20502
20503 !! article
20504 Category:分类
20505 !! text
20506 blah
20507 !! endarticle
20508
20509 !! article
20510 Category:分類
20511 !! text
20512 blah
20513 !! endarticle
20514
20515 ## We used to, but no longer wt2wt this test since the default serializer
20516 ## will normalize all categories to serialize on their own line.
20517 ## This wikitext usage is going to be fairly uncommon in production and
20518 ## selser will take care of preserving formatting in those scenarios.
20519 !! test
20520 Don't convert blue categorylinks to another variant (T35210)
20521 !! options
20522 cat
20523 language=zh
20524 parsoid=wt2html
20525 !! wikitext
20526 [[A]][[Category:分类]]
20527 !! html/php
20528 cat=分类 sort=
20529 !! html/parsoid
20530 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
20531 <link rel="mw:PageProp/Category" href="./Category:分类"/>
20532 !! end
20533
20534 !! test
20535 Stripping -{}- tags (language variants)
20536 !! options
20537 language=sr
20538 !! wikitext
20539 Latin proverb: -{Ne nuntium necare}-
20540 !! html
20541 <p>Latin proverb: Ne nuntium necare
20542 </p>
20543 !! end
20544
20545
20546 !! test
20547 Prevent conversion with -{}- tags (language variants)
20548 !! options
20549 language=sr variant=sr-ec
20550 !! wikitext
20551 Latinski: -{Ne nuntium necare}-
20552 !! html
20553 <p>Латински: Ne nuntium necare
20554 </p>
20555 !! end
20556
20557
20558 !! test
20559 Prevent conversion of text with -{}- tags (language variants)
20560 !! options
20561 language=sr variant=sr-ec
20562 !! wikitext
20563 Latinski: -{Ne nuntium necare}-
20564 !! html
20565 <p>Латински: Ne nuntium necare
20566 </p>
20567 !! end
20568
20569
20570 !! test
20571 Prevent conversion of links with -{}- tags (language variants)
20572 !! options
20573 language=sr variant=sr-ec
20574 !! wikitext
20575 -{[[Main Page]]}-
20576 !! html
20577 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20578 </p>
20579 !! end
20580
20581
20582 !! test
20583 -{}- tags within headlines (within html for parserConvert())
20584 !! options
20585 language=sr variant=sr-ec
20586 !! wikitext
20587 == -{Naslov}- ==
20588 !! html
20589 <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>
20590
20591 !! end
20592
20593
20594 !! test
20595 Explicit definition of language variant alternatives
20596 !! options
20597 language=zh variant=zh-tw
20598 !! wikitext
20599 -{zh:China;zh-tw:Taiwan}-, not China
20600 !! html
20601 <p>Taiwan, not China
20602 </p>
20603 !! end
20604
20605
20606 !! test
20607 Conversion around HTML tags
20608 !! options
20609 language=sr variant=sr-ec
20610 !! wikitext
20611 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
20612 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
20613 !! html
20614 <p>
20615 <span title="ЛаCтин">ски</span>
20616 </p>
20617 !! end
20618
20619
20620 !! test
20621 Explicit session-wise language variant mapping (A flag and - flag)
20622 !! options
20623 language=zh variant=zh-tw
20624 !! wikitext
20625 Taiwan is not China.
20626 But -{A|zh:China;zh-tw:Taiwan}- is China,
20627 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20628 and -{China}- is China.
20629 !! html
20630 <p>Taiwan is not China.
20631 But Taiwan is Taiwan,
20632 (This should be stripped!)
20633 and China is China.
20634 </p>
20635 !! end
20636
20637 !! test
20638 Explicit session-wise language variant mapping (H flag for hide)
20639 !! options
20640 language=zh variant=zh-tw
20641 !! wikitext
20642 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20643 Taiwan is China.
20644 !! html
20645 <p>(This should be stripped!)
20646 Taiwan is Taiwan.
20647 </p>
20648 !! end
20649
20650 !! test
20651 Adding explicit conversion rule for title (T flag)
20652 !! options
20653 language=zh variant=zh-tw showtitle
20654 !! wikitext
20655 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20656 !! html
20657 Taiwan
20658 <p>Should be stripped!
20659 </p>
20660 !! end
20661
20662 !! test
20663 Testing that changing the language variant here in the tests actually works
20664 !! options
20665 language=zh variant=zh showtitle
20666 !! wikitext
20667 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20668 !! html
20669 China
20670 <p>Should be stripped!
20671 </p>
20672 !! end
20673
20674 !! test
20675 Recursive conversion of alt and title attrs shouldn't clear converter state
20676 !! options
20677 language=zh variant=zh-cn showtitle
20678 !! wikitext
20679 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20680 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20681 !! html
20682 China
20683 <p>
20684 Should be stripped<span title="Exclamation">!</span>
20685 </p>
20686 !! end
20687
20688 !! test
20689 T26072: more test on conversion rule for title
20690 !! options
20691 language=zh variant=zh-tw showtitle
20692 !! wikitext
20693 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20694 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20695 !! html
20696 Taiwan
20697 <p>This should be stripped!
20698 This won't take interferes with the title rule.
20699 </p>
20700 !! end
20701
20702 !! test
20703 Partly disable title conversion if variant == main language code
20704 !! options
20705 language=zh variant=zh title=[[ZH]] showtitle
20706 !! wikitext
20707 -{T|zh-cn:CN;zh-tw:TW}-
20708 !! html
20709 ZH
20710 <p>
20711 </p>
20712 !! end
20713
20714 !! test
20715 Partly disable title conversion if variant == main language code, more
20716 !! options
20717 language=zh variant=zh title=[[ZH]] showtitle
20718 !! wikitext
20719 -{T|TW}-
20720 !! html
20721 ZH
20722 <p>
20723 </p>
20724 !! end
20725
20726 !! test
20727 Raw output of variant escape tags (R flag)
20728 !! options
20729 language=zh variant=zh-tw
20730 !! wikitext
20731 Raw: -{R|zh:China;zh-tw:Taiwan}-
20732 !! html
20733 <p>Raw: zh:China;zh-tw:Taiwan
20734 </p>
20735 !! end
20736
20737 !! test
20738 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20739 !! options
20740 language=zh variant=zh-cn
20741 !! input
20742 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20743 !! result
20744 <p>0
20745 </p>
20746 !! end
20747
20748 !! test
20749 Conversion rules from [numeric-only string] to [something else] (T48634)
20750 !! options
20751 language=zh variant=zh-cn
20752 !! input
20753 -{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
20754 !! result
20755 <p>D12345EE12345
20756 </p>
20757 !! end
20758
20759 !! test
20760 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20761 !! options
20762 language=zh variant=zh-cn
20763 !! input
20764 -{H|zh-cn:foo;zh-tw:;}-foobar
20765 !! result
20766 <p>foobar
20767 </p>
20768 !! end
20769
20770 !! test
20771 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20772 !! options
20773 language=zh variant=zh-cn
20774 !! input
20775 -{H|=>zh-cn:foo;}-foobar
20776 !! result
20777 <p>foobar
20778 </p>
20779 !! end
20780
20781 !! test
20782 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20783 !! options
20784 language=zh variant=zh-cn
20785 !! input
20786 -{H|}-foobar
20787 !! result
20788 <p>foobar
20789 </p>
20790 !! end
20791
20792 !! test
20793 Nested using of manual convert syntax
20794 !! options
20795 language=zh variant=zh-hk
20796 !! wikitext
20797 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20798 !! html
20799 <p>Nested: Hello Hong Kong!
20800 </p>
20801 !! end
20802
20803 !! test
20804 HTML markups with conversion syntax in attribs, nested in other conversion blocks
20805 !! options
20806 language=zh variant=zh-cn
20807 !! wikitext
20808 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
20809 !! html
20810 <p><span title="X">A</span>
20811 </p>
20812 !! end
20813
20814 !! test
20815 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet)
20816 !! options
20817 language=zh variant=zh-cn disabled
20818 !! wikitext
20819 -{<span title="-{X}-">A</span>}-
20820 !! html
20821 <p><span title="X">A</span>
20822 </p>
20823 !! end
20824
20825 # Since Parsoid is starting to emit canonical wikitext for links,
20826 # [http://example.com http://example.com] will not RT back to that
20827 # form anymore.
20828 !! test
20829 Proper conversion of text in external links
20830 !! options
20831 language=sr variant=sr-ec
20832 parsoid=wt2html
20833 !! wikitext
20834 http://www.google.com
20835 gopher://www.google.com
20836 [http://www.google.com http://www.google.com]
20837 [gopher://www.google.com gopher://www.google.com]
20838 [https://www.google.com irc://www.google.com]
20839 [ftp://www.google.com www.google.com/ftp://dir]
20840 [//www.google.com www.google.com]
20841 !! html/php
20842 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20843 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20844 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20845 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20846 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20847 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20848 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20849 </p>
20850 !! html/parsoid
20851 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20852 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20853 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20854 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20855 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20856 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20857 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20858 !! end
20859
20860 !! test
20861 Do not convert roman numbers to language variants
20862 !! options
20863 language=sr variant=sr-ec
20864 !! wikitext
20865 Fridrih IV je car.
20866 !! html
20867 <p>Фридрих IV је цар.
20868 </p>
20869 !! end
20870
20871 !! test
20872 Unclosed language converter markup "-{"
20873 !! options
20874 language=sr
20875 !! wikitext
20876 -{T|hello
20877 !! html
20878 <p>-{T|hello
20879 </p>
20880 !! end
20881
20882 !! test
20883 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20884 !! options
20885 language=sr
20886 !! wikitext
20887 -{R|=&gt;}-
20888 !! html
20889 <p>=&gt;
20890 </p>
20891 !!end
20892
20893 !! test
20894 Don't break link parsing if language converter markup is in the caption.
20895 !! options
20896 language=sr variant=sr-ec
20897 !! wikitext
20898 [[Main Page|-{R|main page}-]]
20899 !! html
20900 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20901 </p>
20902 !! end
20903
20904 # FIXME: This test is currently broken in the PHP parser T153761
20905 !! test
20906 T146304: Don't break template parsing if language converter markup is in the parameter.
20907 !! options
20908 language=sr variant=sr-ec
20909 disabled
20910 !! wikitext
20911 {{echo|-{R|foo}-}}
20912 !! html/php
20913 <p>foo
20914 </p>
20915 !! end
20916
20917 !! test
20918 T146305: Don't break image parsing if language converter markup is in the caption.
20919 !! options
20920 language=sr
20921 !! wikitext
20922 [[File:Foobar.jpg|thumb|-{R|caption:}-]]
20923 !! html/php
20924 <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>
20925
20926 !! html/parsoid
20927 <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>
20928 !! end
20929
20930 !! test
20931 T146305: Don't break image parsing if nested language converter markup is in the caption.
20932 !! options
20933 language=zh variant=zh-cn
20934 !! wikitext
20935 [[File:Foobar.jpg|thumb|-{zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
20936 !! html/php
20937 <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>
20938
20939 !! html/parsoid
20940 <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>
20941 !! end
20942
20943 !! test
20944 Don't break gallery if language converter markup is inside.
20945 !! options
20946 language=zh
20947 !! wikitext
20948 <gallery>
20949 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
20950 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
20951 </gallery>
20952 !! html
20953 <ul class="gallery mw-gallery-traditional">
20954 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20955 <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>
20956 <div class="gallerytext">
20957 <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>
20958 </p>
20959 </div>
20960 </div></li>
20961 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20962 <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>
20963 <div class="gallerytext">
20964 <p>This is a test template
20965 </p>
20966 </div>
20967 </div></li>
20968 </ul>
20969
20970 !! end
20971
20972 !! test
20973 T153135: Don't break list handling if language converter markup is in the item.
20974 !! options
20975 language=zh variant=zh-cn
20976 !! wikitext
20977 ;-{zh-cn:AAA;zh-tw:BBB}-
20978 ;-{R|foo:bar}-
20979 !! html/php
20980 <dl><dt>AAA</dt>
20981 <dt>foo:bar</dt></dl>
20982
20983 !! html/parsoid
20984 <dl>
20985 <dt><span typeof="mw:LanguageVariant" data-mw='{"bidir":[{"l":"zh-cn","t":"AAA"},{"l":"zh-tw","t":"BBB"}],"show":true}'></span></dt>
20986 <dt><span typeof="mw:LanguageVariant" data-mw='{"disabled":true,"show":true,"text":"foo:bar"}'></span></dt>
20987 </dl>
20988 !! end
20989
20990 // Note that parsoid does not protect colons unless language converter
20991 // markup is properly nested, because it is a backtracking parser.
20992 !! test
20993 T153135: Unclosed markup in definition list (code coverage)
20994 !! options
20995 language=zh variant=zh-cn
20996 !! wikitext
20997 ;<b>foo:bar
20998 ;-{zh-cn:AAA
20999 !! html/php
21000 <dl><dt><b>foo:bar</dt>
21001 <dt>-{zh-cn:AAA</b></dt></dl>
21002
21003 !! html/parsoid
21004 <dl>
21005 <dt><b>foo:bar</b></dt>
21006 <b>
21007 <dt>-{zh-cn</dt>
21008 <dd>AAA</dd>
21009 </b></dl>
21010 !! end
21011
21012 !! test
21013 T153135: Nested language converter markup in definition list (code coverage)
21014 !! options
21015 language=zh variant=zh-cn
21016 !! wikitext
21017 ;-{zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
21018 !! html/php
21019 <dl><dt>AAA foo:bar bat:baz</dt>
21020 <dd>def</dd></dl>
21021
21022 !! html/parsoid
21023 <dl>
21024 <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>
21025 <dd>def</dd>
21026 </dl>
21027 !! end
21028
21029 !! test
21030 T153140: Don't break table handling if language converter markup is in the cell.
21031 !! options
21032 language=sr variant=sr-ec
21033 !! wikitext
21034 {|
21035 |-
21036 | -{R|B}-
21037 |}
21038 !! html/php
21039 <table>
21040
21041 <tr>
21042 <td> B
21043 </td></tr></table>
21044
21045 !! html/parsoid
21046 <table>
21047
21048 <tr>
21049 <td> B
21050 </td></tr></table>
21051
21052 !! end
21053
21054 !! test
21055 T2529: Uncovered bullet
21056 !! wikitext
21057 * Foo {{bullet}}
21058 !! html
21059 <ul><li> Foo </li>
21060 <li> Bar</li></ul>
21061
21062 !! end
21063
21064 # Plain MediaWiki does not remove empty lists, but tidy actually does.
21065 # Templates in Wikipedia rely on this behavior, as tidy has always been
21066 # enabled there. These tests are normally run *without* tidy, so specify the
21067 # full output here.
21068 # To test realistic parsing behavior, apply a tidy-like transformation to both
21069 # the expected output and your parser's output.
21070 !! test
21071 T2529: Uncovered bullet leaving empty list, normally removed by tidy
21072 !! wikitext
21073 ******* Foo {{bullet}}
21074 !! html
21075 <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>
21076 <li> Bar</li></ul>
21077
21078 !! end
21079
21080 !! test
21081 T2529: Uncovered table already at line-start
21082 !! wikitext
21083 x
21084
21085 {{table}}
21086 y
21087 !! html
21088 <p>x
21089 </p>
21090 <table>
21091 <tr>
21092 <td> 1 </td>
21093 <td> 2
21094 </td></tr>
21095 <tr>
21096 <td> 3 </td>
21097 <td> 4
21098 </td></tr></table>
21099 <p>y
21100 </p>
21101 !! end
21102
21103 !! test
21104 T2529: Uncovered bullet in parser function result
21105 !! wikitext
21106 * Foo {{lc:{{bullet}} }}
21107 !! html
21108 <ul><li> Foo </li>
21109 <li> bar</li></ul>
21110
21111 !! end
21112
21113 !! test
21114 T7678: Double-parsed template argument
21115 !! wikitext
21116 {{lc:{{{1}}}|hello}}
21117 !! html
21118 <p>{{{1}}}
21119 </p>
21120 !! end
21121
21122 !! test
21123 T7678: Double-parsed template invocation
21124 !! wikitext
21125 {{lc:{{paramtest {{!}} param = hello }} }}
21126 !! html
21127 <p>{{paramtest | param = hello }}
21128 </p>
21129 !! end
21130
21131 !! test
21132 Case insensitivity of parser functions for non-ASCII characters (T10143)
21133 !! options
21134 language=cs
21135 title=[[Main Page]]
21136 !! wikitext
21137 {{PRVNÍVELKÉ:ěščř}}
21138 {{prvnívelké:ěščř}}
21139 {{PRVNÍMALÉ:ěščř}}
21140 {{prvnímalé:ěščř}}
21141 {{MALÁ:ěščř}}
21142 {{malá:ěščř}}
21143 {{VELKÁ:ěščř}}
21144 {{velká:ěščř}}
21145 !! html
21146 <p>Ěščř
21147 Ěščř
21148 ěščř
21149 ěščř
21150 ěščř
21151 ěščř
21152 ĚŠČŘ
21153 ĚŠČŘ
21154 </p>
21155 !! end
21156
21157 !! test
21158 Morwen/13: Unclosed link followed by heading
21159 !! wikitext
21160 [[link
21161 ==heading==
21162 !! html
21163 <p>[[link
21164 </p>
21165 <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>
21166
21167 !! end
21168
21169 !! test
21170 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
21171 !! wikitext
21172 {{foo|
21173 =heading=
21174 !! html
21175 <p>{{foo|
21176 </p>
21177 <h1><span class="mw-headline" id="heading">heading</span></h1>
21178
21179 !! end
21180
21181 !! test
21182 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
21183 !! wikitext
21184 {{foo|
21185 ==heading==
21186 !! html
21187 <p>{{foo|
21188 </p>
21189 <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>
21190
21191 !! end
21192
21193 !! test
21194 Tildes in comments
21195 !! options
21196 pst
21197 !! wikitext
21198 <!-- ~~~~ -->
21199 !! html/php
21200 <!-- ~~~~ -->
21201 !! end
21202
21203 !! test
21204 Paragraphs inside divs (no extra line breaks)
21205 !! wikitext
21206 <div>Line one
21207
21208 Line two</div>
21209 !! html
21210 <div>Line one
21211 Line two</div>
21212
21213 !! end
21214
21215 !! test
21216 Paragraphs inside divs (extra line break on open)
21217 !! wikitext
21218 <div>
21219 Line one
21220
21221 Line two</div>
21222 !! html
21223 <div>
21224 <p>Line one
21225 </p>
21226 Line two</div>
21227
21228 !! end
21229
21230 !! test
21231 Paragraphs inside divs (extra line break on close)
21232 !! wikitext
21233 <div>Line one
21234
21235 Line two
21236 </div>
21237 !! html
21238 <div>Line one
21239 <p>Line two
21240 </p>
21241 </div>
21242
21243 !! end
21244
21245 !! test
21246 Paragraphs inside divs (extra line break on open and close)
21247 !! wikitext
21248 <div>
21249 Line one
21250
21251 Line two
21252 </div>
21253 !! html
21254 <div>
21255 <p>Line one
21256 </p><p>Line two
21257 </p>
21258 </div>
21259
21260 !! end
21261
21262 !! test
21263 Nesting tags, paragraphs on lines which begin with <div>
21264 !! wikitext
21265 <div></div><strong>A
21266 B</strong>
21267 !! html/php+tidy
21268 <p><strong>A</strong></p>
21269 <p><strong>B</strong></p>
21270 !! html/parsoid
21271 <div></div>
21272 <p><strong>A
21273 B</strong>
21274 </p>
21275 !! end
21276
21277 # T8200: <blockquote> should behave like <div> with respect to line breaks
21278 !! test
21279 T8200: paragraphs inside blockquotes (no extra line breaks)
21280 !! wikitext
21281 <blockquote>Line one
21282
21283 Line two</blockquote>
21284 !! html
21285 <blockquote>Line one
21286 Line two</blockquote>
21287
21288 !! html+tidy
21289 <blockquote>
21290 <p>Line one Line two</p>
21291 </blockquote>
21292 !! end
21293
21294 !! test
21295 T8200: paragraphs inside blockquotes (extra line break on open)
21296 !! wikitext
21297 <blockquote>
21298 Line one
21299
21300 Line two</blockquote>
21301 !! html
21302 <blockquote>
21303 <p>Line one
21304 </p>
21305 Line two</blockquote>
21306
21307 !! html+tidy
21308 <blockquote>
21309 <p>Line one</p>
21310 Line two</blockquote>
21311 !! end
21312
21313 !! test
21314 T8200: paragraphs inside blockquotes (extra line break on close)
21315 !! wikitext
21316 <blockquote>Line one
21317
21318 Line two
21319 </blockquote>
21320 !! html
21321 <blockquote>Line one
21322 <p>Line two
21323 </p>
21324 </blockquote>
21325
21326 !! html+tidy
21327 <blockquote>
21328 <p>Line one</p>
21329 <p>Line two</p>
21330 </blockquote>
21331 !! end
21332
21333 !! test
21334 T8200: paragraphs inside blockquotes (extra line break on open and close)
21335 !! wikitext
21336 <blockquote>
21337 Line one
21338
21339 Line two
21340 </blockquote>
21341 !! html
21342 <blockquote>
21343 <p>Line one
21344 </p><p>Line two
21345 </p>
21346 </blockquote>
21347
21348 !! html+tidy
21349 <blockquote>
21350 <p>Line one</p>
21351 <p>Line two</p>
21352 </blockquote>
21353 !! end
21354
21355 !! test
21356 Paragraphs inside blockquotes/divs (no extra line breaks)
21357 !! wikitext
21358 <blockquote><div>Line one
21359
21360 Line two</div></blockquote>
21361 !! html
21362 <blockquote><div>Line one
21363 Line two</div></blockquote>
21364
21365 !! end
21366
21367 !! test
21368 Paragraphs inside blockquotes/divs (extra line break on open)
21369 !! wikitext
21370 <blockquote><div>
21371 Line one
21372
21373 Line two</div></blockquote>
21374 !! html
21375 <blockquote><div>
21376 <p>Line one
21377 </p>
21378 Line two</div></blockquote>
21379
21380 !! end
21381
21382 !! test
21383 Paragraphs inside blockquotes/divs (extra line break on close)
21384 !! wikitext
21385 <blockquote><div>Line one
21386
21387 Line two
21388 </div></blockquote>
21389 !! html
21390 <blockquote><div>Line one
21391 <p>Line two
21392 </p>
21393 </div></blockquote>
21394
21395 !! end
21396
21397 !! test
21398 Paragraphs inside blockquotes/divs (extra line break on open and close)
21399 !! wikitext
21400 <blockquote><div>
21401 Line one
21402
21403 Line two
21404 </div></blockquote>
21405 !! html
21406 <blockquote><div>
21407 <p>Line one
21408 </p><p>Line two
21409 </p>
21410 </div></blockquote>
21411
21412 !! end
21413
21414 !! test
21415 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
21416 !! options
21417 wgLinkHolderBatchSize=0
21418 !! wikitext
21419 [[meatball:1]]
21420 [[meatball:2]]
21421 [[meatball:3]]
21422 !! html
21423 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
21424 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
21425 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
21426 </p>
21427 !! end
21428
21429 !! test
21430 Free external link invading image caption
21431 !! wikitext
21432 [[Image:Foobar.jpg|thumb|http://x|hello]]
21433 !! html
21434 <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>
21435
21436 !! end
21437
21438 !! test
21439 T17196: localised external link numbers
21440 !! options
21441 language=fa
21442 !! wikitext
21443 [http://en.wikipedia.org/]
21444 !! html/php
21445 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
21446 </p>
21447 !! html/parsoid
21448 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
21449 !! end
21450
21451 !! test
21452 Multibyte character in padleft
21453 !! wikitext
21454 {{padleft:-Hello|7|Æ}}
21455 !! html
21456 <p>Æ-Hello
21457 </p>
21458 !! end
21459
21460 !! test
21461 Multibyte character in padright
21462 !! wikitext
21463 {{padright:Hello-|7|Æ}}
21464 !! html
21465 <p>Hello-Æ
21466 </p>
21467 !! end
21468
21469 !!test
21470 formatdate parser function
21471 !! wikitext
21472 {{#formatdate:2009-03-24}}
21473 !! html
21474 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
21475 </p>
21476 !! end
21477
21478 !!test
21479 formatdate parser function, with default format
21480 !! wikitext
21481 {{#formatdate:2009-03-24|mdy}}
21482 !! html
21483 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
21484 </p>
21485 !! end
21486
21487 !! test
21488 Spacing of numbers in formatted dates
21489 !! wikitext
21490 {{#formatdate:January 15}}
21491 !! html
21492 <p><span class="mw-formatted-date" title="01-15">January 15</span>
21493 </p>
21494 !! end
21495
21496 !! test
21497 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
21498 !! options
21499 language=nl title=[[MediaWiki:Common.css]]
21500 !! wikitext
21501 {{#formatdate:2009-03-24|dmy}}
21502 !! html
21503 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
21504 </p>
21505 !! end
21506
21507 #
21508 #
21509 #
21510
21511 #
21512 # Edit comments
21513 #
21514
21515 !! test
21516 Edit comment with link
21517 !! options
21518 comment
21519 !! wikitext
21520 I like the [[Main Page]] a lot
21521 !! html/php
21522 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
21523 !!end
21524
21525 !! test
21526 Edit comment with link and link text
21527 !! options
21528 comment
21529 !! wikitext
21530 I like the [[Main Page|best pages]] a lot
21531 !! html/php
21532 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21533 !!end
21534
21535 !! test
21536 Edit comment with link and link text with suffix
21537 !! options
21538 comment
21539 !! wikitext
21540 I like the [[Main Page|best page]]s a lot
21541 !! html/php
21542 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21543 !!end
21544
21545 !! test
21546 Edit comment with section link (non-local, eg in history list)
21547 !! options
21548 comment title=[[Main Page]]
21549 !! wikitext
21550 /* External links */ removed bogus entries
21551 !! html/php
21552 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21553 !!end
21554
21555 !! test
21556 Edit comment with section link and text before it (non-local, eg in history list)
21557 !! options
21558 comment title=[[Main Page]]
21559 !! wikitext
21560 pre-comment text /* External links */ removed bogus entries
21561 !! html/php
21562 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>
21563 !!end
21564
21565 !! test
21566 Edit comment with section link (local, eg in diff view)
21567 !! options
21568 comment local title=[[Main Page]]
21569 !! wikitext
21570 /* External links */ removed bogus entries
21571 !! html/php
21572 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21573 !!end
21574
21575 !! test
21576 Edit comment with subpage link (T16080)
21577 !! options
21578 comment
21579 subpage
21580 title=[[Subpage test]]
21581 !! wikitext
21582 Poked at a [[/subpage]] here...
21583 !! html/php
21584 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
21585 !!end
21586
21587 !! test
21588 Edit comment with subpage link and link text (T16080)
21589 !! options
21590 comment
21591 subpage
21592 title=[[Subpage test]]
21593 !! wikitext
21594 Poked at a [[/subpage|neat little page]] here...
21595 !! html/php
21596 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
21597 !!end
21598
21599 !! test
21600 Edit comment with bogus subpage link in non-subpage NS (T16080)
21601 !! options
21602 comment
21603 title=[[Subpage test]]
21604 !! wikitext
21605 Poked at a [[/subpage]] here...
21606 !! html/php
21607 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...
21608 !!end
21609
21610 !! test
21611 Edit comment with bare anchor link (local, as on diff)
21612 !! options
21613 comment
21614 local
21615 title=[[Main Page]]
21616 !! wikitext
21617 [[#section]]
21618 !! html/php
21619 <a href="#section">#section</a>
21620 !! end
21621
21622 !! test
21623 Edit comment with bare anchor link (non-local, as on history)
21624 !! options
21625 comment
21626 title=[[Main Page]]
21627 !! wikitext
21628 [[#section]]
21629 !! html/php
21630 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
21631 !! end
21632
21633 !! test
21634 Anchor starting with underscore
21635 !! options
21636 title=[[Foo]]
21637 !! wikitext
21638 [[#_ref|One]]
21639 !! html/php
21640 <p><a href="#_ref">One</a>
21641 </p>
21642 !! html/parsoid
21643 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
21644 !! end
21645
21646 !! test
21647 Id starting with underscore
21648 !! wikitext
21649 <div id="_ref"></div>
21650 !! html/*
21651 <div id="_ref"></div>
21652
21653 !! end
21654
21655 !! test
21656 Edit comment with link with more than one pipe (T99346)
21657 !! options
21658 comment
21659 !! wikitext
21660 [[Main Page|Many|pipes]]
21661 !! html/php
21662 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
21663 !! end
21664
21665 !! test
21666 Complex edit comment with link with more than one pipe (T99346)
21667 !! options
21668 comment
21669 !! wikitext
21670 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
21671 !! html/php
21672 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;
21673 !! end
21674
21675 !! test
21676 Space normalisation on autocomment (T24784)
21677 !! options
21678 comment
21679 title=[[Main Page]]
21680 !! wikitext
21681 /* __hello__world__ */
21682 !! html/php
21683 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
21684 !! end
21685
21686 !! test
21687 percent-encoding and + signs in comments (T28410)
21688 !! options
21689 comment
21690 !! wikitext
21691 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
21692 !! html/php
21693 <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>
21694 !! end
21695
21696 # Parsoid doesn't support this yet: see T75581
21697 # but it *should* omit the 'src' attribute if the image is bad.
21698 # PHP side of tests was disabled in
21699 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
21700 # because of issues in the PHP parserTests infrastructure
21701 # (but the output below is indeed what the PHP side emits)
21702 !! test
21703 Bad images - basic functionality
21704 !! wikitext
21705 [[File:Bad.jpg]]
21706 !! DISABLED/html/php
21707 !! html/parsoid
21708 <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>
21709 !! end
21710
21711 !! test
21712 Bad images - T18039: text after bad image disappears
21713 !! wikitext
21714 Foo bar
21715 [[File:Bad.jpg]]
21716 Bar foo
21717 !! DISABLED/html/php
21718 <p>Foo bar
21719 </p><p>Bar foo
21720 </p>
21721 !! html/parsoid
21722 <p>Foo bar
21723 <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>
21724 Bar foo</p>
21725 !! end
21726
21727 !! test
21728 Verify that displaytitle works (T24501) no displaytitle
21729 !! options
21730 showtitle
21731 !! config
21732 wgAllowDisplayTitle=true
21733 wgRestrictDisplayTitle=false
21734 !! wikitext
21735 this is not the the title
21736 !! html/php
21737 Parser test
21738 <p>this is not the the title
21739 </p>
21740 !! end
21741
21742 !! test
21743 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
21744 !! options
21745 showtitle
21746 title=[[Screen]]
21747 !! config
21748 wgAllowDisplayTitle=true
21749 wgRestrictDisplayTitle=false
21750 !! wikitext
21751 this is not the the title
21752 {{DISPLAYTITLE:whatever}}
21753 !! html/php
21754 whatever
21755 <p>this is not the the title
21756 </p>
21757 !! end
21758
21759 !! test
21760 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
21761 !! options
21762 showtitle
21763 title=[[Screen]]
21764 !! config
21765 wgAllowDisplayTitle=true
21766 wgRestrictDisplayTitle=true
21767 !! wikitext
21768 this is not the the title
21769 {{DISPLAYTITLE:whatever}}
21770 !! html/php
21771 Screen
21772 <p>this is not the the title
21773 </p>
21774 !! end
21775
21776 !! test
21777 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
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:screen}}
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) AllowDisplayTitle=false
21795 !! options
21796 showtitle
21797 title=[[Screen]]
21798 !! config
21799 wgAllowDisplayTitle=false
21800 !! wikitext
21801 this is not the the title
21802 {{DISPLAYTITLE:screen}}
21803 !! html/php
21804 Screen
21805 <p>this is not the the title
21806 <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>
21807 </p>
21808 !! end
21809
21810 !! test
21811 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
21812 !! options
21813 showtitle
21814 title=[[Screen]]
21815 !! config
21816 wgAllowDisplayTitle=false
21817 !! wikitext
21818 this is not the the title
21819 !! html/php
21820 Screen
21821 <p>this is not the the title
21822 </p>
21823 !! end
21824
21825 !! test
21826 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
21827 !! options
21828 showtitle
21829 title=[[Screen]]
21830 !! config
21831 wgAllowDisplayTitle=true
21832 wgRestrictDisplayTitle=true
21833 !! wikitext
21834 this is not the the title
21835 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21836 !! html/php
21837 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21838 <p>this is not the the title
21839 </p>
21840 !! end
21841
21842 !! test
21843 Verify that displaytitle handles inline CSS styles (T28547) - accepted 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="color: red;">s</span>creen}}
21853 !! html/php
21854 <span style="color: red;">s</span>creen
21855 <p>this is not the the title
21856 </p>
21857 !! end
21858
21859 !! test
21860 Page status indicators: Empty name is invalid
21861 !! options
21862 showindicators
21863 !! wikitext
21864 <indicator name=" "></indicator>
21865 <indicator></indicator>
21866 !! html/php
21867 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21868 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21869 </p>
21870 !! end
21871
21872 !! test
21873 Page status indicators: Weird syntaxes that are okay
21874 !! options
21875 showindicators
21876 !! wikitext
21877 <indicator name="empty" />
21878 <indicator name="name"></indicator>
21879 !! html/php
21880 empty=
21881 name=
21882 <p><br />
21883 </p>
21884 !! end
21885
21886 !! test
21887 Page status indicators: Torture test
21888 !! options
21889 showindicators
21890 !! wikitext
21891 <indicator name="01">hello world</indicator>
21892 <indicator name="02">[[Main Page]]</indicator>
21893 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21894 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21895 <indicator name="05">* foo
21896 * bar</indicator>
21897 <indicator name="06"><nowiki>foo</nowiki></indicator>
21898 <indicator name="07"> Preformatted</indicator>
21899 <indicator name="08"><div>Broken tag</indicator>
21900 <indicator name="09">{| class=wikitable
21901 | cell
21902 |}</indicator>
21903 <indicator name="10">Two
21904
21905 paragraphs</indicator>
21906 !! html/php
21907 01=hello world
21908 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21909 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" />
21910 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>
21911 05=<ul><li> foo</li>
21912 <li> bar</li></ul>
21913
21914 06=foo
21915 07=<pre>Preformatted
21916 </pre>
21917 08=<div>Broken tag</div>
21918
21919 09=<table class="wikitable">
21920 <tr>
21921 <td> cell
21922 </td></tr></table>
21923
21924 10=<p>Two
21925 </p><p>paragraphs
21926 </p>
21927 <p><br />
21928 </p><p><br />
21929 </p><p><br />
21930 </p><p><br />
21931 </p><p><br />
21932 </p>
21933 !! end
21934
21935 !! test
21936 preload: check <noinclude> and <includeonly>
21937 !! options
21938 preload
21939 !! wikitext
21940 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21941 !! html/php
21942 Hello kind world.
21943 !! end
21944
21945 !! test
21946 preload: check <onlyinclude>
21947 !! options
21948 preload
21949 !! wikitext
21950 Goodbye <onlyinclude>Hello world</onlyinclude>
21951 !! html/php
21952 Hello world
21953 !! end
21954
21955 !! test
21956 preload: can pass tags through if we want to
21957 !! options
21958 preload
21959 !! wikitext
21960 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21961 !! html/php
21962 <includeonly>Hello world</includeonly>
21963 !! end
21964
21965 !! test
21966 preload: check that it doesn't try to do tricks
21967 !! options
21968 preload
21969 !! wikitext
21970 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21971 !! html/php
21972 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21973 !! end
21974
21975 !! test
21976 Play a bit with r67090 and T5158
21977 !! wikitext
21978 <div style="width:50% !important">&nbsp;</div>
21979 <div style="width:50%&nbsp;!important">&nbsp;</div>
21980 <div style="width:50%&#160;!important">&nbsp;</div>
21981 <div style="border : solid;">&nbsp;</div>
21982 !! html/php
21983 <div style="width:50% !important">&#160;</div>
21984 <div style="width:50% !important">&#160;</div>
21985 <div style="width:50% !important">&#160;</div>
21986 <div style="border&#160;: solid;">&#160;</div>
21987
21988 !! html/parsoid
21989 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21990 <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>
21991 <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>
21992 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21993
21994 !! end
21995
21996 !! test
21997 HTML5 data attributes
21998 !! wikitext
21999 <span data-foo="bar">Baz</span>
22000 <p data-abc-def_hij="">Quuz</p>
22001 !! html/php
22002 <p><span data-foo="bar">Baz</span>
22003 </p>
22004 <p data-abc-def_hij="">Quuz</p>
22005
22006 !! html/parsoid
22007 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
22008 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
22009 !! end
22010
22011 !! test
22012 Strip reserved data attributes
22013 !! wikitext
22014 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
22015 !! html/php
22016 <div data-ok="fred">d</div>
22017
22018 !! html/parsoid
22019 <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>
22020 !! end
22021
22022 !! test
22023 percent-encoding and + signs in internal links (T28410)
22024 !! wikitext
22025 [[User:+%]] [[Page+title%]]
22026 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
22027 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
22028 [[%33%45]] [[%33%45+]]
22029 !! html/php
22030 <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>
22031 <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>
22032 <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>
22033 <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>
22034 </p>
22035 !! html/parsoid
22036 <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>
22037 <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>
22038 <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>
22039 <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>
22040 !! end
22041
22042 !! test
22043 Special characters in embedded file links (T29679)
22044 !! wikitext
22045 [[File:Contains & ampersand.jpg]]
22046 [[File:Does not exist.jpg|Title with & ampersand]]
22047 !! html/php
22048 <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>
22049 <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>
22050 </p>
22051 !! html/parsoid
22052 <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>
22053 <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>
22054 !! end
22055
22056 !! test
22057 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
22058 !! wikitext
22059 Text&apos;s been normalized?
22060 !! html
22061 <p>Text&#39;s been normalized?
22062 </p>
22063 !! end
22064
22065 !! test
22066 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
22067 !! wikitext
22068 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
22069 !! html
22070 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
22071 </p>
22072 !! end
22073
22074 !! test
22075 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
22076 !! wikitext
22077 [http://www.example.org/ ideograms]
22078 !! html
22079 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
22080 </p>
22081 !! end
22082
22083 !! test
22084 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
22085 !! wikitext
22086 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
22087 !! html
22088 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
22089 </p>
22090 !! end
22091
22092 !! article
22093 Mediawiki:loop1
22094 !! text
22095 {{Identical|A}}
22096 !! endarticle
22097
22098 !! article
22099 Mediawiki:loop2
22100 !! text
22101 {{Identical|B}}
22102 !! endarticle
22103
22104 !! article
22105 Template:Identical
22106 !! text
22107 {{int:loop1}}
22108 {{int:loop2}}
22109 !! endarticle
22110
22111 !! test
22112 T33098 Template which includes system messages which includes the template
22113 !! wikitext
22114 {{Identical}}
22115 !! html
22116 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22117 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22118 </p>
22119 !! end
22120
22121 !! test
22122 T33490 Turkish: ucfirst 'blah'
22123 !! options
22124 language=tr
22125 !! wikitext
22126 {{ucfirst:blah}}
22127 !! html
22128 <p>Blah
22129 </p>
22130 !! end
22131
22132 !! test
22133 T33490 Turkish: ucfirst 'ix'
22134 !! options
22135 language=tr
22136 !! wikitext
22137 {{ucfirst:ix}}
22138 !! html
22139 <p>İx
22140 </p>
22141 !! end
22142
22143 !! test
22144 T33490 Turkish: lcfirst 'BLAH'
22145 !! options
22146 language=tr
22147 !! wikitext
22148 {{lcfirst:BLAH}}
22149 !! html
22150 <p>bLAH
22151 </p>
22152 !! end
22153
22154 !! test
22155 T33490 Turkish: ucfırst (with a dotless i)
22156 !! options
22157 language=tr
22158 !! wikitext
22159 {{ucfırst:blah}}
22160 !! html
22161 <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>
22162 </p>
22163 !! end
22164
22165 !! test
22166 T33490 ucfırst (with a dotless i) with English language
22167 !! options
22168 language=en
22169 !! wikitext
22170 {{ucfırst:blah}}
22171 !! html
22172 <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>
22173 </p>
22174 !! end
22175
22176 !! test
22177 T28375: TOC with italics
22178 !! options
22179 title=[[Main Page]]
22180 !! wikitext
22181 __TOC__
22182 == ''Lost'' episodes ==
22183 !! html
22184 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22185 <ul>
22186 <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>
22187 </ul>
22188 </div>
22189
22190 <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>
22191
22192 !! end
22193
22194 !! test
22195 T28375: TOC with bold
22196 !! options
22197 title=[[Main Page]]
22198 !! wikitext
22199 __TOC__
22200 == '''should be bold''' then normal text ==
22201 !! html
22202 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22203 <ul>
22204 <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>
22205 </ul>
22206 </div>
22207
22208 <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>
22209
22210 !! end
22211
22212 !! test
22213 T35845: Headings become cursive in TOC when they contain an image
22214 !! options
22215 title=[[Main Page]]
22216 !! wikitext
22217 __TOC__
22218 == Image [[Image:foobar.jpg]] ==
22219 !! html
22220 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22221 <ul>
22222 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
22223 </ul>
22224 </div>
22225
22226 <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>
22227
22228 !! end
22229
22230 !! test
22231 T35845 (2): Headings become bold in TOC when they contain a blockquote
22232 !! options
22233 title=[[Main Page]]
22234 !! wikitext
22235 __TOC__
22236 == <blockquote>Quote</blockquote> ==
22237 !! html
22238 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22239 <ul>
22240 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22241 </ul>
22242 </div>
22243
22244 <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>
22245
22246 !! html+tidy
22247 <p></p>
22248 <div id="toc" class="toc">
22249 <div id="toctitle">
22250 <h2>Contents</h2>
22251 </div>
22252 <ul>
22253 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22254 </ul>
22255 </div>
22256 <p></p>
22257 <h2><span class="mw-headline" id="Quote"></span></h2>
22258 <blockquote>
22259 <p><span class="mw-headline" id="Quote">Quote</span></p>
22260 </blockquote>
22261 <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>
22262 !! end
22263
22264 !! test
22265 Unclosed tags in TOC
22266 !! options
22267 title=[[Main Page]]
22268 !! wikitext
22269 __TOC__
22270 == Proof: 2 < 3 ==
22271 <small>Hanc marginis exiguitas non caperet.</small>
22272 QED
22273 !! html
22274 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22275 <ul>
22276 <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>
22277 </ul>
22278 </div>
22279
22280 <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>
22281 <p><small>Hanc marginis exiguitas non caperet.</small>
22282 QED
22283 </p>
22284 !! end
22285
22286 !! test
22287 Multiple tags in TOC
22288 !! wikitext
22289 __TOC__
22290 == <i>Foo</i> <b>Bar</b> ==
22291
22292 == <i>Foo</i> <blockquote>Bar</blockquote> ==
22293 !! html
22294 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22295 <ul>
22296 <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>
22297 <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>
22298 </ul>
22299 </div>
22300
22301 <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>
22302 <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>
22303
22304 !! html+tidy
22305 <p></p>
22306 <div id="toc" class="toc">
22307 <div id="toctitle">
22308 <h2>Contents</h2>
22309 </div>
22310 <ul>
22311 <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>
22312 <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>
22313 </ul>
22314 </div>
22315 <p></p>
22316 <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>
22317 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
22318 <blockquote>
22319 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
22320 </blockquote>
22321 <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>
22322 !! end
22323
22324 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
22325 # html5 tag parsing.
22326 !! test
22327 Tags with parameters in TOC
22328 !! options
22329 parsoid=wt2html
22330 !! wikitext
22331 __TOC__
22332 == <sup class="in-h2">Hello</sup> ==
22333
22334 == <sup class="a > b">Evilbye</sup> ==
22335 !! html/php
22336 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22337 <ul>
22338 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
22339 <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>
22340 </ul>
22341 </div>
22342
22343 <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>
22344 <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>
22345
22346 !! html/parsoid
22347 <meta property="mw:PageProp/toc" />
22348 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
22349
22350 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
22351 !! end
22352
22353 !! test
22354 span tags with directionality in TOC
22355 !! wikitext
22356 __TOC__
22357 == <span dir="ltr">C++</span> ==
22358
22359 == <span dir="rtl">זבנג!</span> ==
22360
22361 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
22362
22363 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
22364
22365 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
22366 !! html
22367 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22368 <ul>
22369 <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>
22370 <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>
22371 <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>
22372 <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>
22373 <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>
22374 </ul>
22375 </div>
22376
22377 <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>
22378 <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>
22379 <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>
22380 <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>
22381 <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>
22382
22383 !! end
22384
22385 !! test
22386 T74884: bdi element in ToC
22387 !! wikitext
22388 __TOC__
22389 == <bdi>test</bdi> ==
22390 !! html
22391 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22392 <ul>
22393 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
22394 </ul>
22395 </div>
22396
22397 <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>
22398
22399 !! end
22400
22401 !! test
22402 T35715: s/strike element in ToC
22403 !! wikitext
22404 __TOC__
22405 == <s>test</s> test <strike>test</strike> ==
22406 !! html
22407 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22408 <ul>
22409 <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>
22410 </ul>
22411 </div>
22412
22413 <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>
22414
22415 !! end
22416
22417 # Note that the html output does not have the <p></p>, but the
22418 # html+tidy output *does*. This is because the empty <p></p> is
22419 # removed by the sanitizer, but only when tidy is *not* enabled (!).
22420 !! test
22421 Empty <p> tag in TOC, removed by Sanitizer (T92892)
22422 !! wikitext
22423 __TOC__
22424 == x ==
22425 !! html
22426 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22427 <ul>
22428 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22429 </ul>
22430 </div>
22431
22432 <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>
22433
22434 !! html+tidy
22435 <p></p>
22436 <div id="toc" class="toc">
22437 <div id="toctitle">
22438 <h2>Contents</h2>
22439 </div>
22440 <ul>
22441 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22442 </ul>
22443 </div>
22444 <p></p>
22445 <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>
22446 !! end
22447
22448 !! article
22449 MediaWiki:T34057
22450 !! text
22451 == {{int:headline_sample}} ==
22452 !! endarticle
22453
22454 !! test
22455 T34057: Title needed when expanding <h> nodes.
22456 !! options
22457 title=[[Main Page]]
22458 !! wikitext
22459 {{int:T34057}}
22460 !! html
22461 <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>
22462
22463 !! end
22464
22465 !! test
22466 Strip marker in urlencode
22467 !! wikitext
22468 {{urlencode:x<nowiki/>y}}
22469 {{urlencode:x<nowiki/>y|wiki}}
22470 {{urlencode:x<nowiki/>y|path}}
22471 {{urlencode:x<pre id="one">two</pre>y}}
22472 !! html/php
22473 <p>xy
22474 xy
22475 xy
22476 xy
22477 </p>
22478 !! end
22479
22480 !! test
22481 Strip marker in lc
22482 !! wikitext
22483 {{lc:x<nowiki/>y}}
22484 !! html
22485 <p>xy
22486 </p>
22487 !! end
22488
22489 !! test
22490 Strip marker in uc
22491 !! wikitext
22492 {{uc:x<nowiki/>y}}
22493 !! html
22494 <p>XY
22495 </p>
22496 !! end
22497
22498 !! test
22499 Strip marker in formatNum
22500 !! wikitext
22501 {{formatnum:1<nowiki/>2}}
22502 {{formatnum:1<nowiki/>2|R}}
22503 !! html
22504 <p>12
22505 12
22506 </p>
22507 !! end
22508
22509 !! test
22510 Check noCommafy in formatNum
22511 !! options
22512 language=be-tarask
22513 !! wikitext
22514 {{formatnum:123456.78}}
22515 {{formatnum:123456.78|NOSEP}}
22516 !! html
22517 <p>123 456,78
22518 123456.78
22519 </p>
22520 !! end
22521
22522 !! test
22523 Wrong option for formatNum (T58199)
22524 !! wikitext
22525 {{formatnum:1,234.56|Random}}
22526 {{formatnum:1,234.56|EVERYTHING}}
22527 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
22528 !! html
22529 <p>1,234.56
22530 1,234.56
22531 1,234.56
22532 </p>
22533 !! end
22534
22535 !! test
22536 Strip marker in grammar
22537 !! options
22538 language=fi
22539 !! wikitext
22540 {{grammar:elative|foo<nowiki/>bar}}
22541 !! html
22542 <p>foobarista
22543 </p>
22544 !! end
22545
22546 !! test
22547 Strip marker in padleft
22548 !! wikitext
22549 {{padleft:|2|x<nowiki/>y}}
22550 !! html
22551 <p>xy
22552 </p>
22553 !! end
22554
22555 !! test
22556 Strip marker in padright
22557 !! wikitext
22558 {{padright:|2|x<nowiki/>y}}
22559 !! html
22560 <p>xy
22561 </p>
22562 !! end
22563
22564 !! test
22565 Strip marker in anchorencode
22566 !! wikitext
22567 {{anchorencode:x<nowiki/>y}}
22568 !! html
22569 <p>xy
22570 </p>
22571 !! end
22572
22573 !! test
22574 nowiki inside link inside heading (T20295)
22575 !! wikitext
22576 ==[[foo|x<nowiki>y</nowiki>z]]==
22577 !! html
22578 <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>
22579
22580 !! end
22581
22582 !! test
22583 new support for bdi element (T33817)
22584 !! wikitext
22585 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22586 !! html
22587 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22588
22589 !!end
22590
22591 !! test
22592 Ignore pipe between table row attributes
22593 !! wikitext
22594 {|
22595 | quux
22596 |- id=foo | style='color: red'
22597 | bar
22598 |}
22599 !! html
22600 <table>
22601 <tr>
22602 <td> quux
22603 </td></tr>
22604 <tr id="foo" style="color: red">
22605 <td> bar
22606 </td></tr></table>
22607
22608 !! end
22609
22610 !!test
22611 Language parser function
22612 !! wikitext
22613 {{#language:ar}}
22614 !! html
22615 <p>العربية
22616 </p>
22617 !! end
22618
22619 !!test
22620 Padleft and padright as substr
22621 !! wikitext
22622 {{padleft:|3|abcde}}
22623 {{padright:|3|abcde}}
22624 !! html
22625 <p>abc
22626 abc
22627 </p>
22628 !! end
22629
22630 !!test
22631 Special parser function
22632 !! wikitext
22633 {{#special:RandomPage}}
22634 {{#special:BaDtItLe}}
22635 {{#special:Foobar}}
22636 !! html
22637 <p>Special:Random
22638 Special:Badtitle
22639 Special:Foobar
22640 </p>
22641 !! end
22642
22643 !!test
22644 T36939 - Case insensitive link parsing ([HttP://])
22645 !! wikitext
22646 [HttP://MediaWiki.Org/]
22647 !! html/php
22648 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
22649 </p>
22650 !! html/parsoid
22651 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
22652 !! end
22653
22654 !!test
22655 T36939 - Case insensitive link parsing ([HttP:// title])
22656 !! wikitext
22657 [HttP://MediaWiki.Org/ MediaWiki]
22658 !! html
22659 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22660 </p>
22661 !! end
22662
22663 !!test
22664 T36939 - Case insensitive link parsing (HttP://)
22665 !! wikitext
22666 HttP://MediaWiki.Org/
22667 !! html/php
22668 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22669 </p>
22670 !! html/parsoid
22671 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22672 !! end
22673
22674 !!test
22675 Disable TOC
22676 !! options
22677 notoc
22678 !! wikitext
22679 Lead
22680 == Section 1 ==
22681 == Section 2 ==
22682 == Section 3 ==
22683 == Section 4 ==
22684 == Section 5 ==
22685 !! html
22686 <p>Lead
22687 </p>
22688
22689 <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>
22690 <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>
22691 <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>
22692 <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>
22693 <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>
22694
22695 !! end
22696
22697
22698 ###
22699 ### Parsoid-specific tests
22700 ### Parsoid-PHP parser incompatibilities
22701 ###
22702 !!test
22703 1. SOL-sensitive wikitext tokens as template-args
22704 !!options
22705 parsoid=wt2html,wt2wt
22706 !! wikitext
22707 {{echo|*a}}
22708 {{echo|#a}}
22709 {{echo|:a}}
22710 !! html
22711 <span about="#mwt1" typeof="mw:Transclusion">
22712 </span><ul about="#mwt1"><li>a</li>
22713 </ul>
22714 <span about="#mwt2" typeof="mw:Transclusion">
22715 </span><ol about="#mwt2"><li>a</li>
22716 </ol>
22717 <span about="#mwt3" typeof="mw:Transclusion">
22718 </span><dl about="#mwt3"><dd>a</dd>
22719 </dl>
22720 !!end
22721
22722 #### -----------------------------------------------------------------
22723 #### Parsoid-specific functionality tests
22724 #### -----------------------------------------------------------------
22725
22726 # T65642/T68749: Formatting elt fixup around images is cleaned up.
22727 # We know wt2wt will fail, but we expect selser to pass.
22728 # Due to the nature of our testing, wt2wt and selser tests will enter the
22729 # blacklist and we'll catch selser regressions based on changes to the
22730 # blacklist entries for selser tests.
22731 !! test
22732 1. Bad treebuilder fixup of formatting elt is cleaned up
22733 !! options
22734 parsoid=wt2html,wt2wt
22735 !! wikitext
22736 {|
22737 |
22738 <small>
22739 [[Image:Foobar.jpg|right|Test]]
22740 </small>
22741 |}
22742 !! html/parsoid
22743 <table>
22744 <tbody><tr><td>
22745 <small>
22746 <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>
22747 </small>
22748 </td></tr>
22749 </tbody></table>
22750 !! end
22751
22752 !! test
22753 2. Bad treebuilder fixup of formatting elt is cleaned up
22754 !! options
22755 parsoid=wt2html,wt2wt
22756 !! wikitext
22757 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22758
22759 <small>[[Image:Foobar.jpg|right|300px]]</small>
22760 !! html/parsoid
22761
22762 <p><b>foo</b></p>
22763 <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>
22764 <p><b>bar</b></p>
22765 <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>
22766 !! end
22767
22768 !! test
22769 3. Bad treebuilder fixup of formatting elt is cleaned up
22770 !! options
22771 parsoid=wt2html,wt2wt
22772 !! wikitext
22773 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22774 !! html/parsoid
22775 <p><small><b>foo</b></small></p>
22776 <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>
22777 <p><small><b>bar</b></small></p>
22778 !! end
22779
22780 !! test
22781 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22782 !! options
22783 parsoid=wt2html,wt2wt
22784 !! wikitext
22785 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22786 !! html/parsoid
22787 <p><b><small></small></b></p>
22788 <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>
22789 <p></p>
22790 !! end
22791
22792 #### ----------------------------------------------------------------
22793 #### Parsoid-only testing of Parsoid's impl of LST
22794 #### Not implemented yet, see
22795 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22796 #### ----------------------------------------------------------------
22797
22798 ## We still need to support serializing the older format while content is stored.
22799 !! test
22800 LST Sections: Backwards compatibility
22801 !! options
22802 parsoid={
22803 "suppressErrors": true,
22804 "modes": ["html2wt"]
22805 }
22806 !! wikitext
22807 <section begin="2011-05-16" />
22808 <section end="2014-04-10 (MW 1.23wmf22)" />
22809 !! html/parsoid
22810 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22811 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22812 !! end
22813
22814 ## The unconventional output is the result of `usePHPPreProcessor` being
22815 ## disabled in parserTests.js. This test is mainly just to show <section> is
22816 ## recognized as an extension tag w/o a native handler.
22817 !! test
22818 LST Sections: Newfangled approach
22819 !! wikitext
22820 <section begin="2011-05-16" />
22821 <section end="2014-04-10 (MW 1.23wmf22)" />
22822 !! html/parsoid
22823 <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>
22824 <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>
22825 !! end
22826
22827 #--------- Test stripping of empty nodes in template content ----------
22828 !!test
22829 Empty LI and TR nodes should be stripped from template content
22830 !!wikitext
22831 {{EmptyLITest}}
22832 {{EmptyTRTest}}
22833 !!html/parsoid
22834 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22835 <li>a</li>
22836 <li>b</li>
22837 </ul>
22838 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22839 <tbody>
22840 <tr>
22841 <td>foo</td>
22842 </tr>
22843 <tr>
22844 <td>bar</td>
22845 </tr>
22846 </tbody>
22847 </table>
22848 !!end
22849
22850 !!test
22851 Empty LI and TR nodes should not be stripped from top-level content
22852 !!wikitext
22853 * a
22854 *
22855 * b
22856 {|
22857 |-
22858 |-
22859 |foo
22860 |}
22861 !!html/parsoid
22862 <ul>
22863 <li> a</li>
22864 <li></li>
22865 <li> b</li>
22866 </ul>
22867 <table>
22868 <tbody>
22869 <tr></tr>
22870 <tr>
22871 <td>foo</td>
22872 </tr>
22873 </tbody>
22874 </table>
22875 !!end
22876
22877 !!test
22878 Empty TR nodes should not be stripped if they have any attributes set
22879 !!wikitext
22880 {{EmptyTRWithHTMLAttrTest}}
22881 !!html/parsoid
22882 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22883 <tr align="center"></tr>
22884 <tr><td>foo</td></tr>
22885 <tr align="center"></tr>
22886 <tr><td>bar</td></tr>
22887 </table>
22888 !!end
22889
22890 #### ----------------------------------------------------------------
22891 #### The following section of tests are primarily to test
22892 #### wikitext escaping capabilities of Parsoid. Given that
22893 #### escaping can be done any number of ways, the wikitext (input)
22894 #### is always adjusted to reflect how Parsoid adds nowiki
22895 #### escape tags.
22896 ####
22897 #### We are marking several tests as parsoid-only since the
22898 #### HTML in the result section is different from what the
22899 #### PHP parser generates for it.
22900 #### ----------------------------------------------------------------
22901
22902
22903 #### --------------- Headings ---------------
22904 #### 0. Unnested
22905 #### 1. Nested inside html <h1>=foo=</h1>
22906 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22907 #### 3. Nested inside html with wikitext split by html tags
22908 #### 4. No escape needed
22909 #### 5. Empty headings <h1></h1>
22910 #### 6. Heading chars in SOL context
22911 #### ----------------------------------------
22912 !! test
22913 Headings: 0. Unnested
22914 !! options
22915 parsoid=html2wt
22916 !! html/parsoid
22917 <p>=foo=</p>
22918
22919 <p> =foo=
22920 <!--cmt-->
22921 =foo=</p>
22922
22923 <p>=foo<i>a</i>=</p>
22924 !! wikitext
22925 <nowiki>=foo=</nowiki>
22926
22927 <nowiki> </nowiki>=foo=
22928 <!--cmt-->
22929 <nowiki>=foo=</nowiki>
22930
22931 =foo''a''<nowiki>=</nowiki>
22932 !!end
22933
22934 # New headings and existing headings are handled differently
22935 !! test
22936 Headings: 1. Nested inside html
22937 !! options
22938 parsoid=html2wt
22939 !! html/parsoid
22940 <h1>=foo=</h1>
22941 <h2>=foo=</h2>
22942 <h3>=foo=</h3>
22943
22944 <h1 data-parsoid=''>=foo=</h1>
22945 <h2 data-parsoid=''>=foo=</h2>
22946 <h3 data-parsoid=''>=foo=</h3>
22947 <h4 data-parsoid=''>=foo=</h4>
22948 <h5 data-parsoid=''>=foo=</h5>
22949 <h6 data-parsoid=''>=foo=</h6>
22950 !! wikitext
22951 = =foo= =
22952
22953 == =foo= ==
22954
22955 === =foo= ===
22956
22957 =<nowiki>=foo=</nowiki>=
22958 ==<nowiki>=foo=</nowiki>==
22959 ===<nowiki>=foo=</nowiki>===
22960 ====<nowiki>=foo=</nowiki>====
22961 =====<nowiki>=foo=</nowiki>=====
22962 ======<nowiki>=foo=</nowiki>======
22963
22964 !!end
22965
22966 !! test
22967 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22968 !! options
22969 parsoid=html2wt
22970 !! html/parsoid
22971 <h1>foo</h1>*bar
22972 <h1>foo</h1>=bar
22973 <h1>foo</h1>=bar=
22974 !! wikitext
22975 = foo =
22976 <nowiki>*</nowiki>bar
22977
22978 = foo =
22979 =bar
22980
22981 = foo =
22982 <nowiki>=bar=</nowiki>
22983 !!end
22984
22985 !! test
22986 Headings: 3. Nested inside html with wikitext split by html tags
22987 !! options
22988 parsoid=html2wt
22989 !! html/parsoid
22990 <h1>=<b>bold</b>foo=</h1>
22991 !! wikitext
22992 = ='''bold'''foo= =
22993 !!end
22994
22995 !! test
22996 Headings: 4a. No escaping needed (testing just h1 and h2)
22997 !! options
22998 parsoid=html2wt
22999 !! html/parsoid
23000 <h1>=foo</h1>
23001 <h1>foo=</h1>
23002 <h1> =foo= </h1>
23003 <h1>=foo= bar</h1>
23004 <h2>=foo</h2>
23005 <h2>foo=</h2>
23006 <h1>=</h1>
23007 <h1><i>=</i>foo=</h1>
23008 !! wikitext
23009 = =foo =
23010
23011 = foo= =
23012
23013 = =foo= =
23014
23015 = =foo= bar =
23016
23017 == =foo ==
23018
23019 == foo= ==
23020
23021 = = =
23022
23023 = ''=''foo= =
23024 !!end
23025
23026 !! test
23027 Headings: 4b. No escaping needed (inside p-tags)
23028 !! options
23029 parsoid=html2wt
23030 !! html/parsoid
23031 <p>===
23032 =foo= x
23033 =foo= <s></s>
23034 </p>
23035 !! wikitext
23036 ===
23037 =foo= x
23038 =foo= <s></s>
23039 !!end
23040
23041 !! test
23042 Headings: 5. Empty headings
23043 !! options
23044 parsoid=html2wt
23045 !! html/parsoid
23046 <h1 data-parsoid='{}'></h1>
23047
23048 <h2 data-parsoid='{}'></h2>
23049
23050 <h3 data-parsoid='{}'></h3>
23051
23052 <h4 data-parsoid='{}'></h4>
23053
23054 <h5 data-parsoid='{}'></h5>
23055
23056 <h6 data-parsoid='{}'></h6>
23057 !! wikitext
23058 =<nowiki/>=
23059
23060 ==<nowiki/>==
23061
23062 ===<nowiki/>===
23063
23064 ====<nowiki/>====
23065
23066 =====<nowiki/>=====
23067
23068 ======<nowiki/>======
23069 !!end
23070
23071 !! test
23072 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23073 !! options
23074 parsoid=html2wt
23075 !! html/parsoid
23076 <p>=a=</p>
23077
23078 <p>=a=</p>
23079
23080 <p>=a=</p>
23081 !! wikitext
23082 <nowiki>=a=</nowiki>
23083
23084 <nowiki>=a=</nowiki>
23085
23086 <nowiki>=a=</nowiki>
23087 !!end
23088
23089 !! test
23090 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23091 !! options
23092 parsoid=html2wt
23093 !! html/parsoid
23094 <p>=a=
23095 b</p>
23096
23097 <p>=a=
23098 b</p>
23099
23100 <p>=a=
23101 b</p>
23102 !! wikitext
23103 <nowiki>=a=</nowiki>
23104 b
23105
23106 <nowiki>=a=</nowiki>
23107 b
23108
23109 <nowiki>=a=</nowiki>
23110 b
23111 !!end
23112
23113 !! test
23114 Headings: 6c. Heading chars in SOL context (leading newline break)
23115 !! options
23116 parsoid=html2wt
23117 !! html/parsoid
23118 <p>a
23119 =b=</p>
23120 !! wikitext
23121 a
23122 <nowiki>=b=</nowiki>
23123 !!end
23124
23125 !! test
23126 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23127 !! options
23128 parsoid=html2wt
23129 !! html/parsoid
23130 <!--c0--><p>=a=</p>
23131
23132 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23133 !! wikitext
23134 <!--c0--><nowiki>=a=</nowiki>
23135
23136 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23137 !!end
23138
23139 !! test
23140 Headings: 6d. Heading chars in SOL context (No escaping needed)
23141 !! options
23142 parsoid=html2wt
23143 !! html/parsoid
23144 =a=<div>b</div>
23145 !! wikitext
23146 =a=<div>b</div>
23147 !!end
23148
23149 !! test
23150 Headings: 7. Insert a newline between new content and headings
23151 !! options
23152 parsoid=html2wt
23153 !! html/parsoid
23154 <h2>NEW</h2>
23155 <p>new</p>
23156 <h2 data-parsoid='{}'>A</h2>
23157 <p data-parsoid='{}'>a</p>
23158 !! wikitext
23159 == NEW ==
23160 new
23161
23162 ==A==
23163 a
23164
23165 !! end
23166
23167 #### --------------- Lists ---------------
23168 #### 0. Outside nests (*foo, etc.)
23169 #### 1. Nested inside html <ul><li>*foo</li></ul>
23170 #### 2. Inside definition lists
23171 #### 3. Only bullets at start should be escaped
23172 #### 4. No escapes needed
23173 #### 5. No unnecessary escapes
23174 #### 6. Escape bullets in SOL position
23175 #### 7. Escape bullets in a multi-line context
23176 #### ----------------------------------------
23177
23178 !! test
23179 Lists: 0. Outside nests
23180 !! options
23181 parsoid=html2wt
23182 !! html/parsoid
23183 <p>*foo</p>
23184
23185 <p>#foo</p>
23186
23187 <p>;Foo:bar</p>
23188 !! wikitext
23189 <nowiki>*</nowiki>foo
23190
23191 <nowiki>#</nowiki>foo
23192
23193 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23194 !!end
23195
23196 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23197 ## to test wikitext escaping, and insignificant whitespace diffs
23198 ## cause PHP parser tests to barf
23199 !! test
23200 Lists: 1. Nested inside html (No unnecessary escapes)
23201 !! options
23202 parsoid=html2wt
23203 !! html/parsoid
23204 <ul>
23205 <li>*foo</li>
23206 <li>#foo</li>
23207 <li>:foo</li>
23208 <li>;foo</li>
23209 <li data-parsoid='{}'>*foo</li>
23210 <li data-parsoid='{}'>#foo</li>
23211 <li data-parsoid='{}'>:foo</li>
23212 <li data-parsoid='{}'>;foo</li>
23213 </ul>
23214
23215 <ol>
23216 <li>*foo</li>
23217 <li>#foo</li>
23218 <li>:foo</li>
23219 <li>;foo</li>
23220 <li data-parsoid='{}'>*foo</li>
23221 <li data-parsoid='{}'>#foo</li>
23222 <li data-parsoid='{}'>:foo</li>
23223 <li data-parsoid='{}'>;foo</li>
23224 </ol>
23225 !! wikitext
23226 * *foo
23227 * #foo
23228 * :foo
23229 * ;foo
23230 *<nowiki>*foo</nowiki>
23231 *<nowiki>#foo</nowiki>
23232 *<nowiki>:foo</nowiki>
23233 *<nowiki>;foo</nowiki>
23234
23235 # *foo
23236 # #foo
23237 # :foo
23238 # ;foo
23239 #<nowiki>*foo</nowiki>
23240 #<nowiki>#foo</nowiki>
23241 #<nowiki>:foo</nowiki>
23242 #<nowiki>;foo</nowiki>
23243 !!end
23244
23245 !! test
23246 Lists: 2. Inside definition lists
23247 !! options
23248 parsoid=html2wt
23249 !! html/parsoid
23250 <dl><dt>;foo</dt></dl>
23251 <dl><dt>:foo</dt></dl>
23252 <dl><dt>:foo</dt>
23253 <dd>bar</dd></dl>
23254 <dl><dd>:foo</dd></dl>
23255 !! wikitext
23256 ; ;foo
23257
23258 ; <nowiki>:foo</nowiki>
23259
23260 ; <nowiki>:foo</nowiki>
23261 : bar
23262
23263 : :foo
23264 !!end
23265
23266 !! test
23267 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23268 !! options
23269 parsoid=html2wt
23270 !! html/parsoid
23271 <ul>
23272 <li>*foo*bar</li>
23273 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23274 </ul>
23275 !! wikitext
23276 * *foo*bar
23277 *<nowiki>*foo</nowiki>''it''*bar
23278 !!end
23279
23280 !! test
23281 Lists: 4. No escapes needed
23282 !! options
23283 parsoid=html2wt
23284 !! html/parsoid
23285 <ul>
23286 <li>foo*bar
23287 </li>
23288 </ul>
23289 <ul>
23290 <li><i>foo</i>*bar
23291 </li>
23292 </ul>
23293 <ul>
23294 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23295 </li>
23296 </ul>
23297 <ul>
23298 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23299 </li>
23300 </ul>
23301 !! wikitext
23302 *foo*bar
23303
23304 *''foo''*bar
23305
23306 *[[Foo]]: bar
23307
23308 *[[Foo]]*bar
23309 !!end
23310
23311 !! test
23312 Lists: 5. No unnecessary escapes
23313 !! options
23314 parsoid=html2wt
23315 !! html/parsoid
23316 <ul><li> bar <span>[[foo]]</span></li></ul>
23317 <ul><li> =bar <span>[[foo]]</span></li></ul>
23318 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23319 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23320 <ul><li> =bar <span>foo]]</span>=</li></ul>
23321 <ul><li> <s></s>: a</li></ul>
23322 <ul><li> <i>* foo</i></li></ul>
23323
23324 !! wikitext
23325 * bar <span><nowiki>[[foo]]</nowiki></span>
23326
23327 * =bar <span><nowiki>[[foo]]</nowiki></span>
23328
23329 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23330
23331 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23332
23333 * =bar <span>foo]]</span>=
23334
23335 * <s></s>: a
23336
23337 * ''* foo''
23338 !!end
23339
23340 !! test
23341 Lists: 6. Escape bullets in SOL position
23342 !! options
23343 parsoid=html2wt
23344 !! html/parsoid
23345 <p><!--cmt-->*foo</p>
23346 !! wikitext
23347 <!--cmt--><nowiki>*</nowiki>foo
23348 !!end
23349
23350 !! test
23351 Lists: 7. Escape bullets in a multi-line context
23352 !! options
23353 parsoid=html2wt
23354 !! html/parsoid
23355 <p>a
23356 *b
23357 </p>
23358 !! wikitext
23359 a
23360 <nowiki>*</nowiki>b
23361 !!end
23362
23363 !! test
23364 Lists: 8. Escape colons only if not present in tags
23365 !! options
23366 parsoid=html2wt
23367 !! html/parsoid
23368 <dl><dt>a:b<i>c:d</i></dt></dl>
23369 !! wikitext
23370 ; <nowiki>a:b</nowiki>''c:d''
23371 !! end
23372
23373 #### --------------- HRs ---------------
23374 #### 1. Single line
23375 #### -----------------------------------
23376
23377 !! test
23378 HRs: 1. Single line
23379 !! options
23380 parsoid=html2wt
23381 !! html/parsoid
23382 <hr />----
23383 <hr />=foo=
23384 <hr />*foo
23385 !! wikitext
23386 ----<nowiki>----</nowiki>
23387 ----=foo=
23388 ----*foo
23389 !! end
23390
23391 #### --------------- Tables ---------------
23392 #### 1a. Simple example
23393 #### 1b. No escaping needed (!foo)
23394 #### 1c. No escaping needed (|foo)
23395 #### 1d. No escaping needed (|}foo)
23396 ####
23397 #### 2a. Nested in td (<td>foo|bar</td>)
23398 #### 2b. Nested in td (<td>foo||bar</td>)
23399 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23400 ####
23401 #### 3a. Nested in th (<th>foo!bar</th>)
23402 #### 3b. Nested in th (<th>foo!!bar</th>)
23403 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23404 ####
23405 #### 4a. Escape -
23406 #### 4b. Escape +
23407 #### 4c. No escaping needed
23408 #### --------------------------------------
23409
23410 !! test
23411 Tables: 1a. Simple example
23412 !! options
23413 parsoid=html2wt
23414 !! html/parsoid
23415 <p>{|
23416 |}
23417 </p>
23418 !! wikitext
23419 <nowiki>{|</nowiki>
23420 |}
23421 !! end
23422
23423 !! test
23424 Tables: 1b. No escaping needed
23425 !! options
23426 parsoid=html2wt
23427 !! html/parsoid
23428 <p>!foo
23429 </p>
23430 !! wikitext
23431 !foo
23432 !! end
23433
23434 !! test
23435 Tables: 1c. No escaping needed
23436 !! options
23437 parsoid=html2wt
23438 !! html/parsoid
23439 <p>|foo
23440 </p>
23441 !! wikitext
23442 |foo
23443 !! end
23444
23445 !! test
23446 Tables: 1d. No escaping needed
23447 !! options
23448 parsoid=html2wt
23449 !! html/parsoid
23450 <p>|}foo
23451 </p>
23452 !! wikitext
23453 |}foo
23454 !! end
23455
23456 !! test
23457 Tables: 2a. Nested in td
23458 !! options
23459 parsoid=html2wt
23460 !! html/parsoid
23461 <table><tbody><tr>
23462 <td>foo|bar</td></tr>
23463 <tr><td>x<div>a|b</div></td>
23464 </tbody></table>
23465 !! wikitext
23466 {|
23467 |<nowiki>foo|bar</nowiki>
23468 |-
23469 |x<div><nowiki>a|b</nowiki></div>
23470 |}
23471 !! html/php+tidy
23472 <table>
23473 <tr>
23474 <td>foo|bar</td>
23475 </tr>
23476 <tr>
23477 <td>x
23478 <div>a|b</div>
23479 </td>
23480 </tr>
23481 </table>
23482 !! end
23483
23484 !! test
23485 Tables: 2b. Nested in td
23486 !! options
23487 parsoid=html2wt
23488 !! html/parsoid
23489 <table><tbody><tr>
23490 <td>foo||bar</td>
23491 <td>a<i>b||c</i></td>
23492 <td>a<i><div>b||c</div></i></td>
23493 </tr></tbody></table>
23494 !! wikitext
23495 {|
23496 |<nowiki>foo||bar</nowiki>
23497 |a''<nowiki>b||c</nowiki>''
23498 |a''<div><nowiki>b||c</nowiki></div>''
23499 |}
23500 !! html/php
23501 <table>
23502 <tr>
23503 <td>foo||bar
23504 </td>
23505 <td>a<i>b||c</i>
23506 </td>
23507 <td>a<i><div>b||c</div></i>
23508 </td></tr></table>
23509
23510 !! end
23511
23512 !! test
23513 Tables: 2c. Nested in td -- no escaping needed
23514 !! options
23515 parsoid=html2wt
23516 !! html/*
23517 <table>
23518 <tr>
23519 <td>foo!!bar
23520 </td></tr></table>
23521
23522 !! wikitext
23523 {|
23524 |foo!!bar
23525 |}
23526 !! end
23527
23528 !! test
23529 Tables: 3a. Nested in th
23530 !! options
23531 parsoid=html2wt
23532 !! html/*
23533 <table>
23534 <tr>
23535 <th>foo!bar
23536 </th></tr></table>
23537
23538 !! wikitext
23539 {|
23540 !foo!bar
23541 |}
23542 !! end
23543
23544 !! test
23545 Tables: 3b. Nested in th
23546 !! options
23547 parsoid=html2wt
23548 !! html/parsoid
23549 <table><tbody>
23550 <tr><th>foo!!bar</th>
23551 <th><i>foo|bar</i></th>
23552 <th><i>foo!!bar</i></th>
23553 <th><i><span>foo!!bar</span></i></th>
23554 </tr></tbody></table>
23555 !! wikitext
23556 {|
23557 !<nowiki>foo!!bar</nowiki>
23558 !''<nowiki>foo|bar</nowiki>''
23559 !''<nowiki>foo!!bar</nowiki>''
23560 !''<span><nowiki>foo!!bar</nowiki></span>''
23561 |}
23562 !! html/php
23563 <table>
23564 <tr>
23565 <th>foo!!bar
23566 </th>
23567 <th><i>foo|bar</i>
23568 </th>
23569 <th><i>foo!!bar</i>
23570 </th>
23571 <th><i><span>foo!!bar</span></i>
23572 </th></tr></table>
23573
23574 !! end
23575
23576 !! test
23577 Tables: 3c. Nested in th
23578 !! options
23579 parsoid=html2wt
23580 !! html/parsoid
23581 <table><tbody>
23582 <tr><th>foo||bar</th>
23583 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23584 </tr></tbody></table>
23585 !! wikitext
23586 {|
23587 !<nowiki>foo||bar</nowiki>
23588 !<nowiki>foo||bar</nowiki>
23589 |}
23590 !! html/php
23591 <table>
23592 <tr>
23593 <th>foo||bar
23594 </th>
23595 <th>foo||bar
23596 </th></tr></table>
23597
23598 !! end
23599
23600 !! test
23601 Tables: 4a. Escape -
23602 !! options
23603 parsoid=html2wt
23604 !! html/*
23605 <table>
23606 <tr>
23607 <th>-bar
23608 </th></tr>
23609 <tr>
23610 <td>-bar
23611 </td></tr></table>
23612
23613 !! wikitext
23614 {|
23615 !-bar
23616 |-
23617 |<nowiki>-bar</nowiki>
23618 |}
23619 !! end
23620
23621 !! test
23622 Tables: 4b. Escape +
23623 !! options
23624 parsoid=html2wt
23625 !! html/*
23626 <table>
23627 <tr>
23628 <th>+bar
23629 </th></tr>
23630 <tr>
23631 <td>+bar
23632 </td></tr></table>
23633
23634 !! wikitext
23635 {|
23636 !+bar
23637 |-
23638 |<nowiki>+bar</nowiki>
23639 |}
23640 !! end
23641
23642 !! test
23643 Tables: 4c. No escaping needed
23644 !! options
23645 parsoid=html2wt
23646 !! html/parsoid
23647 <table><tbody>
23648 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23649 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23650 <tr><td>foo
23651 <p>bar|baz
23652 +bar
23653 -bar</p></td></tr>
23654 <tr><td>x
23655 <div>a|b</div></td>
23656 </tbody></table>
23657 !! wikitext
23658 {|
23659 |foo-bar
23660 |foo+bar
23661 |-
23662 |''foo''-bar
23663 |''foo''+bar
23664 |-
23665 |foo
23666 bar|baz
23667 +bar
23668 -bar
23669 |-
23670 |x
23671 <div>a|b</div>
23672 |}
23673 !! html/php
23674 <table>
23675 <tr>
23676 <td>foo-bar
23677 </td>
23678 <td>foo+bar
23679 </td></tr>
23680 <tr>
23681 <td><i>foo</i>-bar
23682 </td>
23683 <td><i>foo</i>+bar
23684 </td></tr>
23685 <tr>
23686 <td>foo
23687 <p>bar|baz
23688 +bar
23689 -bar
23690 </p>
23691 </td></tr>
23692 <tr>
23693 <td>x
23694 <div>a|b</div>
23695 </td></tr></table>
23696
23697 !! end
23698
23699 !! test
23700 Tables: 4d. No escaping needed
23701 !! options
23702 parsoid=html2wt
23703 !! html/parsoid
23704 <table>
23705 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23706 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23707 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23708 </tbody></table>
23709 !! wikitext
23710 {|
23711 |[[Foo]]-bar
23712 ||+1
23713 ||-2
23714 |}
23715 !! html/php
23716 <table>
23717 <tr>
23718 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23719 </td>
23720 <td>+1
23721 </td>
23722 <td>-2
23723 </td></tr></table>
23724
23725 !! end
23726
23727 !! test
23728 T97430: Don't emit empty nowiki pairs around marker meta tags
23729 !! options
23730 parsoid=html2wt
23731 !! html/parsoid
23732 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23733 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23734 !! wikitext
23735 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23736 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23737 !! end
23738
23739 !! test
23740 Unclosed xmlish element in table line shouldn't eat end delimiters
23741 !! options
23742 parsoid=html2wt
23743 !! html/parsoid
23744 <table>
23745 <tbody><tr><td> &lt;foo</td>
23746 <td> bar></td></tr>
23747 </tbody></table>
23748 !! wikitext
23749 {|
23750 | <foo
23751 | bar>
23752 |}
23753 !! html/php
23754 <table>
23755 <tr>
23756 <td> &lt;foo
23757 </td>
23758 <td> bar&gt;
23759 </td></tr></table>
23760
23761 !! end
23762
23763 #### --------------- Links ----------------
23764 #### 1. Quote marks in link text
23765 #### 2. Wikilinks: Escapes needed
23766 #### 3. Wikilinks: No escapes needed
23767 #### 4. Extlinks: Escapes needed
23768 #### 5. Extlinks: No escapes needed
23769 #### --------------------------------------
23770 !! test
23771 Links 1. WikiLinks: No escapes needed
23772 !! options
23773 parsoid=html2wt
23774 !! html/parsoid
23775 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23776 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23777 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23778 !! wikitext
23779 [[Foo|Foo''boo'']]
23780 [[Foo|[Foobar]]]
23781 [[Foo|x [Foobar] x]]
23782 !! html/php
23783 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23784 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23785 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23786 </p>
23787 !! end
23788
23789 !! test
23790 Links 2. WikiLinks: Escapes needed
23791 !! options
23792 parsoid=html2wt
23793 !! html/parsoid
23794 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23795 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23796 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23797 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23798 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23799 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23800 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23801 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23802 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23803 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23804 !! wikitext
23805 [[Foo|<nowiki>Foobar]</nowiki>]]
23806 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23807 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23808 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23809 [[Foo|<nowiki>|Bar</nowiki>]]
23810 [[Foo|<nowiki>]]bar</nowiki>]]
23811 [[Foo|<nowiki>[[bar</nowiki>]]
23812 [[Foo|<nowiki>x [[ y</nowiki>]]
23813 [[Foo|<nowiki>x ]] y</nowiki>]]
23814 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23815 !! html/php
23816 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23817 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23818 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23819 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23820 <a href="/wiki/Foo" title="Foo">|Bar</a>
23821 <a href="/wiki/Foo" title="Foo">]]bar</a>
23822 <a href="/wiki/Foo" title="Foo">[[bar</a>
23823 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23824 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23825 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23826 </p>
23827 !! end
23828
23829 !! test
23830 Links 3. WikiLinks: No escapes needed
23831 !! options
23832 parsoid=html2wt
23833 !! html/parsoid
23834 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23835 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23836 !! wikitext
23837 [[Foo|[Foobar]]
23838 [[Foo|foo|bar]]
23839 !! html/php
23840 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23841 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23842 </p>
23843 !! end
23844
23845 !! test
23846 Links 4. ExtLinks: Escapes needed
23847 !! options
23848 parsoid=html2wt
23849 !! html/parsoid
23850 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23851 <a rel="mw:ExtLink" href="http://google.com">google]</a>
23852 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
23853 <p>[http://google.com]</p>
23854 <p>[http://google.com google]</p>
23855 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23856 <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>
23857 !! wikitext
23858 [http://google.com <nowiki>[google]</nowiki>]
23859 [http://google.com <nowiki>google]</nowiki>]
23860 [http://google.com <nowiki>goog] le</nowiki>]
23861
23862 <nowiki>[http://google.com]</nowiki>
23863
23864 <nowiki>[http://google.com google]</nowiki>
23865
23866 [http://google.com<nowiki>]</nowiki>
23867
23868 [{{echo|http://google.com}}<nowiki>]</nowiki>
23869 !! html/php
23870 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23871 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23872 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
23873 </p><p>[http://google.com]
23874 </p><p>[http://google.com google]
23875 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23876 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23877 </p>
23878 !! end
23879
23880 !! test
23881 Links 5. ExtLinks: No escapes needed
23882 !! options
23883 parsoid=html2wt
23884 !! html/parsoid
23885 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23886 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23887 !! wikitext
23888 [http://google.com [google]
23889
23890 [[http://google.com]]
23891 !! html/php
23892 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23893 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23894 </p>
23895 !! end
23896
23897 !! test
23898 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
23899 !! options
23900 parsoid=html2wt
23901 !! html/parsoid
23902 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23903 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23904 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23905 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23906 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23907 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23908 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23909 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23910 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23911 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23912 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23913 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23914 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23915 </p>
23916 !! wikitext
23917 x<nowiki/>http://example.com<nowiki/>y
23918 http://example.com<nowiki/>?x
23919 http://example.com<nowiki/>&x
23920 http://example.com<nowiki/>'x
23921 http://example.com<nowiki/>,x
23922 http://example.com<nowiki/>.x
23923 http://example.com<nowiki/>;x
23924 http://example.com<nowiki/>:x
23925 http://example.com<nowiki/>;x
23926 http://example.com<nowiki/>!x
23927 http://example.com<nowiki/>=x
23928 http://example.com<nowiki/>(x)
23929 http://example.com(x<nowiki/>)
23930 !! end
23931
23932 !! test
23933 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
23934 !! options
23935 parsoid=html2wt
23936 !! html/parsoid
23937 <p>x
23938 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23939 y
23940 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23941 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23942 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23943 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23944 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23945 </p>
23946 !! wikitext
23947 x
23948 http://example.com
23949 y
23950 "http://example.com"
23951 (http://example.com)
23952 (http://example.com) foo
23953 http://example.com,
23954 http://example.com, foo
23955 !! html/php
23956 <p>x
23957 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23958 y
23959 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23960 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23961 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23962 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23963 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23964 </p>
23965 !! end
23966
23967 !! test
23968 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
23969 !! options
23970 parsoid=html2wt
23971 !! html/parsoid
23972 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23973 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23974 !! wikitext
23975 http://example.com.,;:!?\
23976 -http://example.com:
23977 !! html/php
23978 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23979 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23980 </p>
23981 !! end
23982
23983 !! test
23984 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
23985 !! options
23986 parsoid=html2wt
23987 !! html/parsoid
23988 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23989 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23990 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23991 !! wikitext
23992 RFC 123<nowiki/>4
23993 RFC 123<nowiki/>y
23994 X<nowiki/>RFC 123<nowiki/>y
23995 !! end
23996
23997 !! test
23998 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
23999 !! options
24000 parsoid=html2wt
24001 !! html/parsoid
24002 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24003 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24004 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24005 </p>
24006 !! wikitext
24007 RFC 123?foo
24008 RFC 123&foo
24009 -RFC 123-
24010 !! html/php
24011 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24012 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24013 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24014 </p>
24015 !! end
24016
24017 !! test
24018 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
24019 !! options
24020 parsoid=html2wt
24021 !! html/parsoid
24022 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24023 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24024 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24025 !! wikitext
24026 PMID 123<nowiki/>4
24027 PMID 123<nowiki/>y
24028 X<nowiki/>PMID 123<nowiki/>y
24029 !! end
24030
24031 !! test
24032 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
24033 !! options
24034 parsoid=html2wt
24035 !! html/parsoid
24036 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24037 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24038 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24039 </p>
24040 !! wikitext
24041 PMID 123?foo
24042 PMID 123&foo
24043 -PMID 123-
24044 !! html/php
24045 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24046 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24047 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24048 </p>
24049 !! end
24050
24051 !! test
24052 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
24053 !! options
24054 parsoid=html2wt
24055 !! html/parsoid
24056 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24057 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24058 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24059 </p>
24060 !! wikitext
24061 ISBN 1234567890<nowiki/>1
24062 ISBN 1234567890<nowiki/>x
24063 a<nowiki/>ISBN 1234567890<nowiki/>b
24064 !! end
24065
24066 !! test
24067 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
24068 !! options
24069 parsoid=html2wt
24070 !! html/parsoid
24071 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24072 !! wikitext
24073 -ISBN 1234567890's
24074 !! html/php
24075 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24076 </p>
24077 !! end
24078
24079 !! test
24080 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24081 !! options
24082 parsoid=html2wt
24083 !! html/*
24084 <p>this is not a link: http://example.com
24085 </p>
24086 !! wikitext
24087 this is not a link: <nowiki>http://example.com</nowiki>
24088 !! end
24089
24090 !! test
24091 Links 15. Link trails can't become link prefixes.
24092 !! options
24093 language=is
24094 parsoid=html2wt
24095 !! html/parsoid
24096 <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>
24097 !! wikitext
24098 [[Söfnuður]]-[[00]]
24099 !! html/php
24100 <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>
24101 </p>
24102 !! end
24103
24104 #### --------------- Quotes ---------------
24105 #### 1. Quotes inside <b> and <i>
24106 #### 2. Link fragments separated by <i> and <b> tags
24107 #### 3. Link fragments inside <i> and <b>
24108 #### 4. No escaping needed
24109 #### --------------------------------------
24110 !! test
24111 1a. Quotes inside <b> and <i>
24112 !! options
24113 parsoid=html2wt
24114 !! html/*
24115 <p><i>'foo'</i>
24116 <i>''foo''</i>
24117 <i>'''foo'''</i>
24118 <i>foo</i>'s
24119 <b>'foo'</b>
24120 <b>''foo''</b>
24121 <b>'''foo'''</b>
24122 <b>foo'<i>bar'</i>baz</b>
24123 <b>foo</b>'s
24124 '<i>foo</i>
24125 <i>foo</i>'
24126 <i>foo'</i>'
24127 '<i>foo</i>'
24128 '<b>foo</b>
24129 <b>foo</b>'
24130 '<b>foo</b>'
24131 <i>fools'<span> errand</span></i>
24132 <i><span>fool</span>'s errand</i>
24133 '<i>foo</i> bar '<i>baz</i>
24134 a|!*#-:;+-~[]{}b'<i>x</i>
24135 </p>
24136 !! wikitext
24137 ''<nowiki/>'foo'''
24138 ''<nowiki>''foo''</nowiki>''
24139 ''<nowiki>'''foo'''</nowiki>''
24140 ''foo''<nowiki/>'s
24141 '''<nowiki/>'foo''''
24142 '''<nowiki>''foo''</nowiki>'''
24143 '''<nowiki>'''foo'''</nowiki>'''
24144 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24145 '''foo'''<nowiki/>'s
24146 '''foo''
24147 ''foo''<nowiki/>'
24148 ''foo'''<nowiki/>'
24149 '''foo''<nowiki/>'
24150 ''''foo'''
24151 '''foo'''<nowiki/>'
24152 ''''foo'''<nowiki/>'
24153 ''fools'<span> errand</span>''
24154 ''<span>fool</span>'s errand''
24155 '<nowiki/>''foo'' bar '''baz''
24156 a|!*#-:;+-~[]{}b'''x''
24157 !! end
24158
24159 !! test
24160 1b. Quotes inside <b> and <i> with other tags on same line
24161 !! options
24162 parsoid=html2wt
24163 !! html/parsoid
24164 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24165 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24166 <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>
24167 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24168 '<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>
24169 '<i>foo</i> <div title="name">test</div>
24170 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24171 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24172 <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>
24173 </ol>
24174 !! wikitext
24175 '''a'' foo ''[[bar]]''
24176 ''a''' foo ''[[bar]]''
24177 ''a''' foo '''{{echo|[[bar]]}}'''
24178 [[foo]] x'''[[bar]]''
24179 '''foo'' <ref>test</ref>
24180 '''foo'' <div title="name">test</div>
24181 '''foo'' and <br> bar
24182 <references />
24183 !! end
24184
24185 !! test
24186 2. Link fragments separated by <i> and <b> tags
24187 !! options
24188 parsoid=html2wt
24189 !! html/parsoid
24190 <p>[[<i>foo</i>hello]]</p>
24191 <p>[[<b>foo</b>hello]]</p>
24192 !! wikitext
24193 [[''foo''<nowiki>hello]]</nowiki>
24194
24195 [['''foo'''<nowiki>hello]]</nowiki>
24196 !! end
24197
24198 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24199 # this is one of the shortcomings of this format
24200 !! test
24201 3. Link fragments inside <i> and <b>
24202 !! options
24203 parsoid=html2wt
24204 !! html/parsoid
24205 <p><i>[[foo</i>]]</p>
24206 <p><b>[[foo</b>]]</p>
24207 !! wikitext
24208 ''[[foo''<nowiki>]]</nowiki>
24209
24210 '''[[foo'''<nowiki>]]</nowiki>
24211 !! end
24212
24213 !! test
24214 4. No escaping needed
24215 !! options
24216 parsoid=html2wt
24217 !! html/parsoid
24218 <p>'<span><i>bar</i></span>'
24219 '<span><b>bar</b></span>'
24220 'a:b'foo
24221 </p>
24222 !! wikitext
24223 '<span>''bar''</span>'
24224 '<span>'''bar'''</span>'
24225 'a:b'foo
24226 !! end
24227
24228 #### ----------- Paragraphs ---------------
24229 #### 1. No unnecessary escapes
24230 #### --------------------------------------
24231
24232 !! test
24233 1. No unnecessary escapes
24234 !! options
24235 parsoid=html2wt
24236 !! html/parsoid
24237 <p>bar <span>[[foo]]</span>
24238 </p><p>=bar <span>[[foo]]</span>
24239 </p><p>[[bar <span>[[foo]]</span>
24240 </p><p>]]bar <span>[[foo]]</span>
24241 </p><p>=bar <span>foo]]</span>=
24242 </p>
24243 !! wikitext
24244 bar <span><nowiki>[[foo]]</nowiki></span>
24245
24246 =bar <span><nowiki>[[foo]]</nowiki></span>
24247
24248 [[bar <span><nowiki>[[foo]]</nowiki></span>
24249
24250 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24251
24252 =bar <span>foo]]</span><nowiki>=</nowiki>
24253 !!end
24254
24255 #### ----------------------- PRE --------------------------
24256 #### 1. Leading whitespace in SOL context should be escaped
24257 #### ------------------------------------------------------
24258 !! test
24259 1. Leading whitespace in SOL context should be escaped
24260 !! options
24261 parsoid=html2wt
24262 !! html/parsoid
24263 <p> a</p>
24264
24265 <p> a</p>
24266
24267 <p> a(tab)</p>
24268
24269 <p> a
24270 <!--cmt-->
24271 a</p>
24272
24273 <p>a
24274 b</p>
24275
24276 <p>a
24277 b</p>
24278
24279 <p>a
24280 b</p>
24281 !! wikitext
24282 <nowiki> </nowiki>a
24283
24284 <nowiki> </nowiki> a
24285
24286 a(tab)
24287
24288 <nowiki> </nowiki> a
24289 <!--cmt-->
24290 <nowiki> </nowiki>a
24291
24292 a
24293 <nowiki> </nowiki>b
24294
24295 a
24296 b
24297
24298 a
24299 b
24300 !! html/php
24301 <p> a
24302 </p><p> a
24303 </p><p> a(tab)
24304 </p><p> a
24305 a
24306 </p><p>a
24307 b
24308 </p><p>a
24309 b
24310 </p><p>a
24311 b
24312 </p>
24313 !! end
24314
24315 !! test
24316 2. Leading whitespace in non-indent-pre contexts should not be escaped
24317 !! options
24318 parsoid=html2wt
24319 !! html/parsoid
24320 <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>
24321 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24322 <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>
24323 b</span></li>
24324 </ol>
24325 !! wikitext
24326 foo <ref>''a''
24327 b</ref>
24328 <references />
24329 !! end
24330
24331 !! test
24332 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24333 !! options
24334 parsoid=html2wt
24335 !! html/parsoid
24336 <blockquote>
24337 <p>
24338 a
24339 <span>b</span>
24340 c</p>
24341 </blockquote>
24342 !! wikitext
24343 <blockquote>
24344 a
24345 <span>b</span>
24346 c
24347 </blockquote>
24348 !! end
24349
24350 !! test
24351 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24352 !! options
24353 parsoid=html2wt
24354 !! html/parsoid
24355 <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>
24356 !! wikitext
24357 [[File:Foobar.jpg|thumb|caption]]
24358 !! end
24359
24360 !! test
24361 5. Nowiki escaping should account for indent-pres
24362 !! options
24363 parsoid=html2wt
24364 !! html/parsoid
24365 <pre>==foo==</pre>
24366 !! wikitext
24367 ==foo==
24368 !! end
24369
24370 !!test
24371 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24372 !! options
24373 parsoid=html2wt
24374 !! html/parsoid
24375 <pre>
24376 * foo
24377 * bar
24378 </pre>
24379 !! wikitext
24380 * foo
24381 * bar
24382 !! end
24383
24384 #### --------------- Behavior Switches --------------------
24385
24386 !! test
24387 1. Valid behavior switches should be escaped
24388 !! options
24389 parsoid=html2wt
24390 !! html/parsoid
24391 __TOC__
24392 <i>__TOC__</i>
24393 !! wikitext
24394 <nowiki>__TOC__</nowiki>
24395 ''<nowiki>__TOC__</nowiki>''
24396 !! end
24397
24398 !! test
24399 2. Invalid behavior switches should not be escaped
24400 !! options
24401 parsoid=html2wt
24402 !! html/parsoid
24403 __TOO__
24404 __|__
24405 !! wikitext
24406 __TOO__
24407 __|__
24408 !! end
24409
24410 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24411 !! test
24412 Behavior switches should be SOL-transparent
24413 !! options
24414 parsoid=html2wt
24415 !! html/parsoid
24416 <meta property="mw:PageProp/toc" />
24417
24418 <!-- this one's bogus -->
24419 <pre>__TOO__</pre>
24420
24421 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24422
24423 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24424 !! wikitext
24425 __TOC__
24426
24427 <!-- this one's bogus -->
24428 __TOO__
24429
24430 __TOC__ foo
24431
24432 __TOC__
24433 bar
24434 !! end
24435
24436 #### --------------- HTML tags ---------------
24437 #### 1. a tags
24438 #### 2. other tags
24439 #### 3. multi-line html tag
24440 #### 4. extension tags
24441 #### -----------------------------------------
24442 !! test
24443 1. a tags
24444 !! options
24445 parsoid=html2wt
24446 !! html/parsoid
24447 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24448 !! wikitext
24449 <a href="http://google.com">google</a>
24450 !! end
24451
24452 !! test
24453 2. other tags
24454 !! options
24455 parsoid=html2wt
24456 !! html/parsoid
24457 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24458 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24459 <li> &lt;td&gt;</li></ul>
24460
24461 !! wikitext
24462 * <nowiki><div>foo</div></nowiki>
24463 * <nowiki><div style="color:red">foo</div></nowiki>
24464 * <nowiki><td></nowiki>
24465 !! end
24466
24467 !! test
24468 3. multi-line html tag
24469 !! options
24470 parsoid=html2wt
24471 !! html/parsoid
24472 <p>&lt;div
24473 &gt;foo&lt;/div
24474 &gt;
24475 </p>
24476 !! wikitext
24477 <nowiki><div
24478 >foo</div
24479 ></nowiki>
24480 !! end
24481
24482 !! test
24483 4. extension tags
24484 !! options
24485 parsoid=html2wt
24486 !! html/parsoid
24487 <p>&lt;ref&gt;foo&lt;/ref&gt;
24488 </p><p>&lt;ref&gt;bar
24489 </p><p>baz&lt;/ref&gt;
24490 </p>
24491 !! wikitext
24492 <nowiki><ref>foo</ref></nowiki>
24493
24494 <nowiki><ref>bar</nowiki>
24495
24496 baz<nowiki></ref></nowiki>
24497 !! end
24498
24499 #### --------------- Others ---------------
24500 !! test
24501 Escaping nowikis
24502 !! options
24503 parsoid=html2wt
24504 !! html/parsoid
24505 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24506 </p>
24507 !! wikitext
24508 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24509 !! end
24510
24511 ## The quote-char in the input is necessary for triggering the bug
24512 !! test
24513 (T54035) Nowiki-escaping should not get tripped by " :" in text
24514 !! options
24515 parsoid=html2wt
24516 !! html/parsoid
24517 <p>foo's bar :</p>
24518 !! wikitext
24519 foo's bar :
24520 !! end
24521
24522 #----------- End of wikitext escaping tests --------------
24523
24524 !! test
24525
24526 Tag-like HTML structures are passed through as text
24527 !! wikitext
24528 <x y>
24529
24530 <x.y>
24531
24532 <x-y>
24533
24534 1>2
24535
24536 x<y
24537
24538 a>b
24539
24540 1<d e>f
24541 !! html
24542 <p>&lt;x y&gt;
24543 </p><p>&lt;x.y&gt;
24544 </p><p>&lt;x-y&gt;
24545 </p><p>1&gt;2
24546 </p><p>x&lt;y
24547 </p><p>a&gt;b
24548 </p><p>1&lt;d e&gt;f
24549 </p>
24550 !! end
24551
24552 !! test
24553 HTML tag with necessary entities in attributes
24554 !! wikitext
24555 <span title="&amp;amp;">foo</span>
24556 !! html
24557 <p><span title="&amp;amp;">foo</span>
24558 </p>
24559 !! end
24560
24561 !! test
24562 HTML tag with 'unnecessary' entity encoding in attributes
24563 !! wikitext
24564 <span title="&amp;">foo</span>
24565 !! html
24566 <p><span title="&amp;">foo</span>
24567 </p>
24568 !! end
24569
24570 !! test
24571 HTML tag with broken attribute value quoting
24572 !! options
24573 parsoid=wt2html,html2html
24574 !! wikitext
24575 <span title="Hello world>Foo</span>
24576 !! html/php
24577 <p><span title="Hello world">Foo</span>
24578 </p>
24579 !! html/parsoid
24580 <p><span title="Hello world">Foo</span></p>
24581 !! end
24582
24583 !! test
24584 Self-closed tag with broken attribute value quoting
24585 !! options
24586 parsoid=wt2html,html2html
24587 !! wikitext
24588 <div title="Hello world />Foo
24589 !! html/php+tidy
24590 <div title="Hello world"></div>
24591 <p>Foo</p>
24592 !! html/parsoid
24593 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24594 !! end
24595
24596 !! test
24597 Table with broken attribute value quoting
24598 !! options
24599 parsoid=wt2html,html2html
24600 !! wikitext
24601 {|
24602 | title="Hello world|Foo
24603 |}
24604 !! html/php
24605 <table>
24606 <tr>
24607 <td title="Hello world">Foo
24608 </td></tr></table>
24609
24610 !! html/parsoid
24611 <table>
24612 <tr>
24613 <td title="Hello world">Foo
24614 </td></tr></table>
24615
24616 !! end
24617
24618 !! test
24619 Table with broken attribute value quoting on consecutive lines
24620 !! options
24621 parsoid=wt2html,html2html
24622 !! wikitext
24623 {|
24624 | title="Hello world|Foo
24625 | style="color:red|Bar
24626 |}
24627 !! html/php
24628 <table>
24629 <tr>
24630 <td title="Hello world">Foo
24631 </td>
24632 <td style="color:red">Bar
24633 </td></tr></table>
24634
24635 !! html/parsoid
24636 <table><tbody>
24637 <tr>
24638 <td title="Hello world">Foo
24639 </td><td style="color: red">Bar
24640 </td></tr></tbody></table>
24641
24642 !! end
24643
24644 !!test
24645 Accept empty td cell attribute
24646 !! wikitext
24647 {|
24648 | align="center" | foo || |
24649 |}
24650 !! html
24651 <table>
24652 <tr>
24653 <td align="center"> foo </td>
24654 <td>
24655 </td></tr></table>
24656
24657 !!end
24658
24659 !!test
24660 Non-empty attributes in th-cells
24661 !! wikitext
24662 {|
24663 ! Foo !! style="color: red" | Bar
24664 |}
24665 !! html
24666 <table>
24667 <tr>
24668 <th> Foo </th>
24669 <th style="color: red"> Bar
24670 </th></tr></table>
24671
24672 !!end
24673
24674 !!test
24675 Accept empty attributes in th-cells
24676 !! wikitext
24677 {|
24678 !| foo !!| bar
24679 |}
24680 !! html
24681 <table>
24682 <tr>
24683 <th> foo </th>
24684 <th> bar
24685 </th></tr></table>
24686
24687 !!end
24688
24689 !!test
24690 Empty table rows go away
24691 !! wikitext
24692 {|
24693 | Hello
24694 | there
24695 |- class="foo"
24696 |-
24697 |}
24698 !! html
24699 <table>
24700 <tr>
24701 <td> Hello
24702 </td>
24703 <td> there
24704 </td></tr>
24705
24706 </table>
24707
24708 !! end
24709
24710 ###
24711 ### Parsoid-centric tests for testing RTing of inter-element separators
24712 ### Edge cases not tested by existing parser tests and specific to
24713 ### Parsoid-specific serialization strategies.
24714 ###
24715
24716 !!test
24717 RT-ed inter-element separators should be valid separators
24718 !! wikitext
24719 {|
24720 |- [[foo]]
24721 |}
24722 !! html/php
24723 <table>
24724
24725 </table>
24726
24727 !! html/parsoid
24728 <table>
24729 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24730 </tbody></table>
24731 !!end
24732
24733 # Parsoid-only since PHP parser relies on Tidy for correct output
24734 !!test
24735 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24736 !!options
24737 parsoid
24738 !! wikitext
24739 {|
24740 |<small>foo
24741 bar
24742 |}
24743
24744 {|
24745 |<small>foo<small>
24746 |}
24747 !! html
24748 <table>
24749 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24750 <p>bar</p></small></td></tr>
24751 </tbody></table>
24752
24753 <table>
24754 <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>
24755 </tbody></table>
24756 !!end
24757
24758 # Note that the "style" attribute is really a template parameter here.
24759 # The = would have to be {{=}} if you wanted the literal.
24760 !!test
24761 Empty TD followed by TD with tpl-generated attribute
24762 !! wikitext
24763 {|
24764 |-
24765 |
24766 |{{echo|style='color:red'}}|foo
24767 |}
24768 !! html
24769 <table>
24770
24771 <tr>
24772 <td>
24773 </td>
24774 <td>foo
24775 </td></tr></table>
24776
24777 !!end
24778
24779 !!test
24780 Indented table with an empty td
24781 !! wikitext
24782 {|
24783 |-
24784 |
24785 |foo
24786 |}
24787 !! html
24788 <table>
24789
24790 <tr>
24791 <td>
24792 </td>
24793 <td>foo
24794 </td></tr></table>
24795
24796 !!end
24797
24798 ## We have some newline diffs RT-ing this edge case
24799 ## and it is not important enough -- we seem to be emitting
24800 ## at most 2 newlines after a </tr> and this is unrelated to
24801 ## the issue from T85627 that this is testing.
24802 !!test
24803 Indented table with blank lines in between (T85627)
24804 !! options
24805 parsoid=wt2html
24806 !! wikitext
24807 {|
24808 |foo
24809
24810
24811 |}
24812 !! html
24813 <table>
24814
24815 <tr>
24816 <td>foo
24817 </td></tr></table>
24818
24819 !!end
24820
24821 !!test
24822 Indented block & table
24823 !! wikitext
24824 <div>foo</div>
24825 {|
24826 |foo
24827 |}
24828 !! html/php
24829 <div>foo</div>
24830 <table>
24831 <tr>
24832 <td>foo
24833 </td></tr></table>
24834
24835 !! html/parsoid
24836 <div data-parsoid='{"stx":"html"}'>foo</div>
24837 <table><tbody>
24838 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24839 </tbody></table>
24840 !!end
24841
24842 !! test
24843 Indent and comment before table row
24844 !! wikitext
24845 {|
24846 <!--hi-->|-
24847 | there
24848 |}
24849 !! html/php
24850 <table>
24851
24852 <tr>
24853 <td> there
24854 </td></tr></table>
24855
24856 !! html/parsoid
24857 <table>
24858 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24859 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24860 </tbody></table>
24861 !! end
24862
24863 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24864 !!test
24865 Empty TR followed by a template-generated TR
24866 !!options
24867 parsoid
24868 !! wikitext
24869 {|
24870 |-
24871 {{echo|<tr><td>foo</td></tr>}}
24872 |}
24873 !! html
24874 <table>
24875 <tbody>
24876 <tr></tr>
24877 <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}}]}'>
24878 <td>foo</td></tr>
24879 </tbody></table>
24880 !!end
24881
24882 ## PHP and parsoid output differ for this, and since this is primarily
24883 ## for testing Parsoid's serializer, marking this Parsoid only
24884 !!test
24885 Empty TR followed by mixed-ws-comment line should RT correctly
24886 !!options
24887 parsoid
24888 !! wikitext
24889 {|
24890 |-
24891 <!--c-->
24892 |-
24893 <!--c--> <!--d-->
24894 |}
24895 !! html
24896 <table>
24897 <tbody>
24898 <tr></tr>
24899 <!--c-->
24900 <tr>
24901 <!--c--> </tr><!--d-->
24902 </tbody></table>
24903
24904 !!end
24905
24906 !!test
24907 Multi-line image caption generated by templates with/without trailing newlines
24908 !! wikitext
24909 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24910 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24911 !! html/parsoid
24912 <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>
24913 <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>
24914 !!end
24915
24916 !! test
24917 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24918 !! options
24919 parsoid=html2wt
24920 !! html/parsoid
24921 <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>
24922
24923 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24924 !! wikitext
24925 <includeonly>foo</includeonly>
24926 new para
24927
24928 [[Category:Foo]]
24929
24930 = new heading =
24931 !! end
24932
24933 ## PHP emits broken html for this, and since this is primarily
24934 ## a Parsoid serializer test, marking this Parsoid only
24935 !!test
24936 Improperly nested inline or quotes tags with whitespace in between
24937 !! wikitext
24938 <span> <s>x</span> </s>
24939 ''' ''x''' ''
24940 !! html/parsoid
24941 <p><span> <s>x</s></span><s> </s>
24942 <b> <i>x</i></b><i> </i>
24943 </p>
24944 !!end
24945
24946 !!test
24947 Encapsulate protected attributes from wt
24948 !! wikitext
24949 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24950
24951 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
24952 | ok
24953 |}
24954 !! html/parsoid
24955 <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>
24956
24957 <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">
24958 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
24959 </tbody></table>
24960 !!end
24961
24962 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24963 ## Having nested or stray pre tags results in the attempt to add duplicates,
24964 ## causing an assertion fail. This test tries to prevent that situation.
24965 !!test
24966 Ensure ParagraphWrapper can deal with stray closing pre tags
24967 !!options
24968 parsoid=wt2html
24969 !! wikitext
24970 plain text</pre>
24971 !! html/parsoid
24972 plain text
24973 !!end
24974
24975 !!test
24976 1. Ensure fostered text content is wrapped in element nodes
24977 !!options
24978 parsoid=wt2html
24979 !! wikitext
24980 <table>hi</table><table>ho</table>
24981 !! html/parsoid
24982 <p>hi</p>
24983 <table></table>
24984 <p>ho</p>
24985 <table></table>
24986 !!end
24987
24988 !!test
24989 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24990 !!options
24991 parsoid=wt2html,wt2wt
24992 !! wikitext
24993 <table>
24994 <tr> || ||
24995 <td> a
24996 </table>
24997 !! html/parsoid
24998 <p> || ||
24999 </p><table>
25000 <tbody><tr><td> a</td></tr>
25001 </tbody></table>
25002 !!end
25003
25004 !!test
25005 Encapsulation properly handles null DSR information from foster box
25006 !!options
25007 parsoid=wt2html,wt2wt
25008 !! wikitext
25009 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25010 !! html/parsoid
25011 <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>
25012 !!end
25013
25014 !!test
25015 1. Encapsulate foster-parented transclusion content
25016 !!options
25017 parsoid=wt2wt,wt2html
25018 !! wikitext
25019 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25020 !! html/parsoid
25021 <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>
25022 <tbody>
25023 <tr>
25024 <td>bar</td>
25025 </tr>
25026 </tbody>
25027 </table>
25028 !!end
25029
25030 !!test
25031 2. Encapsulate foster-parented transclusion content
25032 !!options
25033 parsoid=wt2wt,wt2html
25034 !! wikitext
25035 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25036 !! html/parsoid
25037 <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>
25038 <table>
25039 <tbody>
25040 <tr>
25041 <td>bar</td>
25042 </tr>
25043 </tbody>
25044 </table>
25045 !!end
25046
25047 !!test
25048 3. Encapsulate foster-parented transclusion content
25049 !!options
25050 parsoid=wt2wt,wt2html
25051 !! wikitext
25052 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25053 !! html/parsoid
25054 <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;]}">
25055 <p>foo</p>
25056 </div>
25057 <table>
25058 <tbody>
25059 <tr>
25060 <td>bar</td>
25061 </tr>
25062 </tbody>
25063 </table>
25064 !!end
25065
25066 !!test
25067 4. Encapsulate foster-parented transclusion content
25068 !!options
25069 parsoid=wt2wt,wt2html
25070 !! wikitext
25071 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25072 !! html/parsoid
25073 <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;]}">
25074 <p>foo</p>
25075 </div>
25076 <table>
25077 <tbody>
25078 <tr>
25079 <td>bar</td>
25080 </tr>
25081 </tbody>
25082 </table>
25083 !!end
25084
25085 !!test
25086 5. Encapsulate foster-parented transclusion content
25087 !!options
25088 parsoid=wt2wt,wt2html
25089 !! wikitext
25090 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25091 !! html/parsoid
25092 <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>
25093 <table>
25094 <tbody>
25095 <tr>
25096 <td>
25097 <div>
25098 <p>foo</p>
25099 </div>
25100 </td>
25101 </tr>
25102 </tbody>
25103 </table>
25104 !!end
25105
25106 !!test
25107 6. Encapsulate foster-parented transclusion content
25108 !!options
25109 parsoid=wt2wt,wt2html
25110 !! wikitext
25111 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25112 !! html/parsoid
25113 <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>
25114 <table>
25115 <tbody>
25116 <tr>
25117 <td>
25118 <div>
25119 <p>foo</p>
25120 </div>
25121 </td>
25122 </tr>
25123 </tbody>
25124 </table>
25125 <p>ok</p>
25126 !!end
25127
25128 !!test
25129 7. Encapsulate foster-parented transclusion content
25130 !!options
25131 parsoid=wt2wt,wt2html
25132 !! wikitext
25133 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25134 !! html/parsoid
25135 <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>
25136 <table>
25137 <tbody>
25138 <tr>
25139 <td>bar</td>
25140 </tr>
25141 </tbody>
25142 </table>
25143 !!end
25144
25145 # Note that the wt is broken on purpose: the = should be {{=}} if you
25146 # don't want it to be a template parameter key.
25147 !!test
25148 8. Encapsulate foster-parented transclusion content
25149 !!options
25150 parsoid=wt2wt,wt2html
25151 !! wikitext
25152 {{echo|a
25153 }}{|{{echo|style='color:red'}}
25154 |-
25155 |b
25156 |}
25157 !! html/parsoid
25158 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25159 <span> </span>
25160 <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>
25161 <table>
25162 <tbody>
25163 <tr>
25164 <td>b</td>
25165 </tr>
25166 </tbody>
25167 </table>
25168 !!end
25169
25170 !!test
25171 9. Encapsulate foster-parented transclusion content
25172 !!options
25173 parsoid=wt2wt,wt2html
25174 !! wikitext
25175 <table>{{echo|hi</table>hello}}
25176 !! html/parsoid
25177 <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>
25178 !!end
25179
25180 !!test
25181 Table in fosterable position
25182 !!options
25183 parsoid=wt2html
25184 !! wikitext
25185 {{OpenTable}}
25186 <div>
25187 {|
25188 |}
25189 </div>
25190 |}
25191 !! html/parsoid
25192 <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">
25193 </span>
25194 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25195
25196 <table>
25197 </table>
25198 !!end
25199
25200 # Parsoid only for T66747
25201 !! test
25202 Properly encapsulate empty-content transclusions in fosterable positions
25203 !! wikitext
25204 <table>
25205 {{#if:|
25206 <td>foo</td>
25207 }}
25208 </table>
25209 !! html/parsoid
25210 <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"}]]}'>
25211
25212 </table>
25213 !! end
25214
25215 !! test
25216 Always encapsulate foster box when template range is expanded to table
25217 !! options
25218 parsoid=wt2wt
25219 !! wikitext
25220 {|
25221 hello
25222 {{OpenTable}}
25223 |}
25224 !! html/parsoid
25225
25226 !! end
25227
25228 !! test
25229 T115289: Unclosed table
25230 !! wikitext
25231 {{echo|<table>}}<!--c-->[[Category:Two]]
25232 !! html/parsoid
25233 <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>
25234 !! end
25235
25236 !! test
25237 T115289: Don't migrate newlines out of tables with fostered content
25238 !! wikitext
25239 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25240 !! html/parsoid
25241 <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>
25242 !! end
25243
25244 !! test
25245 T73074: More fostering fun
25246 !! wikitext
25247 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25248 !! html/parsoid
25249 <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>
25250 !! end
25251
25252 !!test
25253 Support <object> element with .data attribute
25254 !!options
25255 parsoid=html2wt
25256 !! html/parsoid
25257 <object data="test.swf"></object>
25258 !! wikitext
25259 <object data="test.swf"></object>
25260 !!end
25261
25262 !! test
25263 Don't block XML namespace declaration
25264 !! wikitext
25265 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25266 !! html/php
25267 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25268 </p>
25269 !! html/parsoid
25270 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25271 !! end
25272
25273 # -----------------------------------------------------------------
25274 # The following section of tests are primarily to spec requirements
25275 # around Parsoid's serialization (old, new, edited content)
25276 #
25277 # All these tests are marked Parsoid html2wt and html2html only
25278 # ----------------------------------------------------------------
25279
25280 !! test
25281 Ignore rel attribute in a-tags during serialization to url-links
25282 !! options
25283 parsoid=html2wt
25284 !! html/parsoid
25285 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25286 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25287 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25288 !! wikitext
25289 http://en.wikipedia.org/wiki/Foobar
25290 http://en.wikipedia.org/wiki/Foobar
25291 http://en.wikipedia.org/wiki/Foobar
25292 !! end
25293
25294 # 'mi' is a localinterwiki prefix as well as a language
25295 !! test
25296 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
25297 !! options
25298 parsoid=html2wt
25299 !! html/parsoid
25300 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25301 !! wikitext
25302 [[Foo]]
25303 !! end
25304
25305 # See T93839
25306 !! test
25307 New wikilinks should be serialized properly
25308 !! options
25309 parsoid=html2wt
25310 !! html/parsoid
25311 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25312 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25313 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25314 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25315 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25316 !! wikitext
25317 [[Foo]]
25318 [[Foo]]
25319 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25320 http://en.wikipedia.org/wiki/Foo
25321 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25322 !! end
25323
25324 !! test
25325 New wiki links (href variations)
25326 !! options
25327 parsoid=html2wt
25328 !! html/parsoid
25329 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25330 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25331 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25332 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25333 !! wikitext
25334 [[Foo_bar]]
25335 [[Foo_bar]]
25336 [[Foo_bar]]
25337 [[Toxine bactérienne]]
25338 !! end
25339
25340 !! test
25341 New wiki links (content string variations)
25342 !! options
25343 parsoid=html2wt
25344 !! html/parsoid
25345 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25346 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25347 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25348 !! wikitext
25349 [[Foo_bar]]
25350 [[Foo bar]]
25351 [[Foo_bar|./Foo_bar]]
25352 !! end
25353
25354 !! test
25355 New category links (href variations)
25356 !! options
25357 parsoid=html2wt
25358 !! html/parsoid
25359 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25360 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25361 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25362 !! wikitext
25363 [[Category:Toxine bactérienne]]
25364 [[Category:Toxine bactérienne]]
25365 [[Category:Toxine bactérienne]]
25366 !! end
25367
25368 !! test
25369 New sol transparent links don't need indent-pre nowiki protection
25370 !! options
25371 parsoid=html2wt
25372 language=de
25373 !! html/parsoid
25374 <link rel="mw:PageProp/redirect" href="./Main_Page">
25375 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25376 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25377 !! wikitext
25378 #WEITERLEITUNG [[Main Page]]
25379 <!-- this is good --> [[Category:Good]]
25380 <!-- this is great --> [[Kategorie:Great]]
25381 !! end
25382
25383 !! test
25384 New interlanguage links (href variations)
25385 !! options
25386 parsoid=html2wt
25387 !! html/parsoid
25388 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25389 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25390 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25391 !! wikitext
25392 [[es:Toxine bactérienne]]
25393 [[es:Toxine_bactérienne]]
25394 [[es:Toxine_bactérienne]]
25395 !! end
25396
25397 !! test
25398 Image: Modifying size of an image (1)
25399 !! options
25400 parsoid={
25401 "modes": ["wt2wt"],
25402 "changes": [
25403 ["img[height]", "attr", "height", "22"],
25404 ["img[width]", "attr", "width", "200"]
25405 ]
25406 }
25407 !! wikitext
25408 [[Image:Foobar.jpg|230x230px]]
25409 !! wikitext/edited
25410 [[Image:Foobar.jpg|200x200px]]
25411 !!end
25412
25413 !! test
25414 Image: Modifying size of an image (2)
25415 !! options
25416 parsoid={
25417 "modes": ["wt2wt"],
25418 "changes": [
25419 ["img[height]", "attr", "height", "100"],
25420 ["img[width]", "attr", "width", "500"]
25421 ]
25422 }
25423 !! wikitext
25424 [[Image:Foobar.jpg|230x230px]]
25425 !! wikitext/edited
25426 [[Image:Foobar.jpg|500x500px]]
25427 !!end
25428
25429 # Change in size is ignored so long as class='mw-default-size'
25430 !! test
25431 Image: Modifying size of an image (3)
25432 !! options
25433 parsoid={
25434 "modes": ["wt2wt"],
25435 "changes": [
25436 ["figure[class]", "removeClass", "mw-default-size"],
25437 ["figure img", "attr", "height", "19"],
25438 ["figure img", "attr", "width", "170"]
25439 ]
25440 }
25441 !! wikitext
25442 [[Image:Foobar.jpg|thumb]]
25443 !! wikitext/edited
25444 [[Image:Foobar.jpg|thumb|170x170px]]
25445 !!end
25446
25447 !! test
25448 Image: Modifying alignment of an image (T50665)
25449 !! options
25450 parsoid={
25451 "modes": ["wt2wt"],
25452 "changes": [
25453 ["figure[class]", "removeClass", "mw-halign-right"],
25454 ["figure[class]", "addClass", "mw-halign-left"]
25455 ]
25456 }
25457 !! wikitext
25458 [[Image:Foobar.jpg|thumb|caption|right]]
25459 !! wikitext/edited
25460 [[Image:Foobar.jpg|thumb|caption|left]]
25461 !! end
25462
25463 !! test
25464 Image: Modifying mw-default-size of an frameless image (T64805)
25465 !! options
25466 parsoid={
25467 "modes": ["wt2wt"],
25468 "changes": [
25469 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25470 ]
25471 }
25472 !! wikitext
25473 [[Image:Foobar.jpg|frameless|right]]
25474 !! wikitext/edited
25475 [[Image:Foobar.jpg|frameless|right|220x220px]]
25476 !! end
25477
25478 !! test
25479 Image: Modifying valign of an image (T51221)
25480 !! options
25481 parsoid={
25482 "modes": ["wt2wt"],
25483 "changes": [
25484 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25485 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25486 ]
25487 }
25488 !! wikitext
25489 [[File:Foobar.jpg|20px|middle]]
25490 !! wikitext/edited
25491 [[File:Foobar.jpg|20px|text-top]]
25492 !! end
25493
25494 !! test
25495 Image: Modifying alt attribute of an image (T58400)
25496 !! options
25497 parsoid={
25498 "modes": ["wt2wt"],
25499 "changes": [
25500 ["img[alt]", "attr", "alt", "some alternate edited text"]
25501 ]
25502 }
25503 !! wikitext
25504 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25505 !! wikitext/edited
25506 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25507 !!end
25508
25509 !! test
25510 Image: Modifying caption of an image
25511 !! options
25512 parsoid={
25513 "modes": ["wt2wt"],
25514 "changes": [
25515 ["figcaption", "text", "new caption"]
25516 ]
25517 }
25518 !! wikitext
25519 [[Image:Foobar.jpg|thumb|original caption]]
25520 !! wikitext/edited
25521 [[Image:Foobar.jpg|thumb|new caption]]
25522 !!end
25523
25524 !! test
25525 Image: empty alt attribute (T50924)
25526 !! options
25527 parsoid
25528 !! wikitext
25529 [[File:Foobar.jpg|thumb|alt=|bar]]
25530 !! html
25531 <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>
25532 !! end
25533
25534 !! test
25535 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
25536 !! options
25537 parsoid=html2wt
25538 language=ar
25539 disabled
25540 !! html/parsoid
25541 <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>
25542 !! wikitext
25543 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25544 !! end
25545
25546 !! test
25547 Image: Block level image should have \n before and after
25548 !! wikitext
25549 123
25550 [[File:Foobar.jpg|right|thumb|150x150px]]
25551 456
25552 !! html/parsoid
25553 <p>123</p>
25554 <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>
25555 <p>456</p>
25556 !!end
25557
25558 !! test
25559 Image: New block level image should have \n before and after (existing content)
25560 !! wikitext
25561 123
25562 [[File:Foobar.jpg|right|thumb|150x150px]]
25563 456
25564 !! html/parsoid
25565 <p>123</p>
25566 <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>
25567 <p>456</p>
25568 !!end
25569
25570 !! test
25571 Image: upright option (parsoid)
25572 !! wikitext
25573 [[File:Foobar.jpg|thumb|upright|caption]]
25574 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25575 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25576 !! html/parsoid
25577 <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>
25578 <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>
25579 <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>
25580 !!end
25581
25582 !! test
25583 Image: upright option is ignored on inline and frame images (parsoid)
25584 !! wikitext
25585 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25586 !! html/parsoid
25587 <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>
25588 !!end
25589
25590 !! test
25591 Image: from basic HTML (1)
25592 !! options
25593 parsoid=html2wt
25594 !! html/parsoid
25595 <span typeof="mw:Image">
25596 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25597 </span>
25598 !! wikitext
25599 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25600 !! end
25601
25602 !! test
25603 Image: from basic HTML (2)
25604 !! options
25605 parsoid=html2wt
25606 !! html/parsoid
25607 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25608 !! wikitext
25609 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25610 !! end
25611
25612 !! test
25613 Image: from basic HTML (3)
25614 !! options
25615 parsoid=html2wt
25616 !! html/parsoid
25617 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25618 !! wikitext
25619 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25620 !! end
25621
25622 !! test
25623 Image: from basic HTML (4)
25624 !! options
25625 parsoid=html2wt
25626 !! html/parsoid
25627 <img src="./File:Foobar.jpg">
25628 !! wikitext
25629 [[File:Foobar.jpg|link=]]
25630 !! end
25631
25632 !! test
25633 Image: Invalid title as link
25634 !! wikitext
25635 [[File:Foobar.jpg|link=<]]
25636 !! html/php
25637 <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>
25638 </p>
25639 !! html/parsoid
25640 <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>
25641 !! end
25642
25643 !! test
25644 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25645 !! options
25646 parsoid=html2wt
25647 !! html/parsoid
25648 <ul>
25649 <li><p>foo</p></li>
25650 </ul>
25651 !! wikitext
25652 * foo
25653 !! end
25654
25655 !! test
25656 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25657 !! options
25658 parsoid=html2wt
25659 !! html/parsoid
25660 <ul> <li>foo</li></ul>
25661 !! wikitext
25662 * foo
25663 !! end
25664
25665 !! test
25666 Don't strip leading whitespace when handling indent-pre suppressing tags
25667 !! options
25668 parsoid=html2wt
25669 !! html/parsoid
25670 <table>
25671 <tr><td> indented row</td></tr>
25672 </table>
25673 <blockquote><p>
25674 <b>This is very bold of you!</b>
25675 </p>
25676 <table><tr><td>
25677 indented cell (no pre-wrapping!)
25678 </td></tr></table>
25679 </blockquote>
25680 <p>foo</p>
25681 <div>bar</div>
25682 !! wikitext
25683 {|
25684 | indented row
25685 |}
25686 <blockquote>
25687 '''This is very bold of you!'''
25688
25689 {|
25690 |
25691 indented cell (no pre-wrapping!)
25692 |}
25693 </blockquote>
25694 foo
25695 <div>bar</div>
25696 !! end
25697
25698 !! test
25699 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25700 !! options
25701 parsoid=html2wt
25702 !! html/parsoid
25703 <p>foo</p>
25704 <span>bar</span>
25705
25706 <span>foo2
25707 </span>bar2
25708
25709 <div>foo</div>
25710 <span>bar</span>
25711
25712 <div>
25713 <span>foo</span>
25714 </div>
25715 !! wikitext
25716 foo
25717
25718 <span>bar</span>
25719
25720 <span>foo2
25721 <nowiki> </nowiki></span>bar2
25722
25723 <div>foo</div>
25724 <nowiki> </nowiki><span>bar</span>
25725
25726 <div>
25727 <nowiki> </nowiki><span>foo</span>
25728 </div>
25729 !! end
25730
25731 !! test
25732 Lists: Dont insert newlines in a serialized list item.
25733 !! options
25734 parsoid=html2wt
25735 !! html/parsoid
25736 <ul><li>a<br>b</li><li>c</li></ul>
25737 !! wikitext
25738 * a<br>b
25739 * c
25740 !! end
25741
25742 !! test
25743 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25744 !! options
25745 parsoid={
25746 "modes": ["html2wt"],
25747 "scrubWikitext": false
25748 }
25749 !! html/parsoid
25750 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25751 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25752
25753 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25754 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25755
25756 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25757
25758 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25759 !! wikitext
25760 == hello there [[Category:A1]] ==
25761
25762 == [[Category:A2]] hi pal ==
25763
25764 == <!--foo--> [[Category:A3]] how goes it ==
25765
25766 == it goes well [[Category:A4]] <!--bar--> ==
25767
25768 ==howdy [[Category:A5]]==
25769
25770 == __TOC__ ok ==
25771 !! end
25772
25773 !! test
25774 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25775 !! options
25776 parsoid={
25777 "modes": ["html2wt"],
25778 "scrubWikitext": true
25779 }
25780 !! html/parsoid
25781 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25782 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25783
25784 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25785 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25786
25787 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25788 !! wikitext
25789 == hello there ==
25790 [[Category:A1]]
25791 [[Category:A2]]
25792
25793 == hi pal ==
25794
25795 <!--foo--> [[Category:A3]]
25796
25797 == how goes it ==
25798
25799 == it goes well ==
25800 [[Category:A4]] <!--bar-->
25801
25802 __TOC__
25803
25804 == ok ==
25805 !! end
25806
25807 !! test
25808 Headings: Don't hoist metas that come from templates
25809 !! options
25810 parsoid={
25811 "modes": ["html2wt"],
25812 "scrubWikitext": true
25813 }
25814 !! html/parsoid
25815 <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>
25816 !! wikitext
25817 == {{echo|foo [[Category:Foo]]}} ==
25818 !! end
25819
25820 !! test
25821 Headings: Category in ref isn't hoisted
25822 !! options
25823 parsoid={
25824 "modes": ["html2wt"],
25825 "scrubWikitext": true
25826 }
25827 !! html/parsoid
25828 <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>
25829
25830 <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>
25831 !! wikitext
25832 == foo <ref>bar
25833 [[Category:Baz]] </ref> ==
25834
25835 <references />
25836 !! end
25837
25838 !! test
25839 Parsoid: Serialize positional parameters with = in them as named parameter
25840 !! options
25841 parsoid=html2wt
25842 !! html/parsoid
25843 <p about="#mwt1" typeof="mw:Transclusion"
25844 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25845
25846 <p about="#mwt1" typeof="mw:Transclusion"
25847 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25848
25849 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25850 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25851 <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>
25852 !! wikitext
25853 {{echo|1=f=oo}}
25854
25855 {{echo|1=f=oo|2=bar}}
25856
25857 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25858 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25859 {{echo|<nowiki>f=oo</nowiki>|bar}}
25860 !! end
25861
25862 !! test
25863 Parsoid: Serialize positional parameters with = in extlink as named parameter
25864 !! options
25865 parsoid=html2wt
25866 !! html/parsoid
25867 <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>
25868 !! wikitext
25869 {{echo|1=http://stuff?is=ok}}
25870 !! end
25871
25872 !! test
25873 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25874 !! options
25875 parsoid=html2wt
25876 !! html/parsoid
25877 <div>a<p>b</p></div>
25878 <div>a
25879 <p>b</p></div>
25880 <div>
25881 a
25882 <p>b</p></div>
25883 !! wikitext
25884 <div>a
25885 b
25886 </div>
25887 <div>a
25888 b
25889 </div>
25890 <div>
25891 a
25892
25893 b
25894 </div>
25895 !! end
25896
25897 !! test
25898 Substrings resembling wikitext in hrefs should not get nowiki escapes
25899 !! options
25900 parsoid=html2wt
25901 !! html/parsoid
25902 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25903 !! wikitext
25904 [[Foo''bar''baz]]
25905 !! end
25906
25907 !! test
25908 Enforce single-line context in the serializer
25909 !! options
25910 parsoid=html2wt
25911 !! html/parsoid
25912 <h2>testing
25913 123</h2>
25914
25915 <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">
25916 </span><span about="#mwt1">you</span> </h2>
25917
25918 <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>
25919
25920 <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
25921 there</span></li></ol>
25922
25923 <ul><li>asd
25924 sdf</li></ul>
25925
25926 <ul><li>foo
25927 bar
25928 baz</li>
25929 <li>foo <b>bar</b>
25930 baz</li></ul>
25931
25932 <dl><dt>hi
25933 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25934 ho</dd></dl>
25935
25936 <dl><dd> <table>
25937 <tbody><tr><td> ha
25938 ha
25939 ha</td></tr>
25940 </tbody></table></dd></dl>
25941 !! wikitext
25942 == testing 123 ==
25943
25944 == hi {{bogus|there
25945 you}} ==
25946
25947 == foo <ref>hello
25948 there</ref> ==
25949
25950 <references />
25951
25952 * asd sdf
25953
25954 * foo bar baz
25955 * foo '''bar''' baz
25956
25957 ; hi ho : hi ho
25958
25959 : {|
25960 | ha
25961 ha
25962 ha
25963 |}
25964 !! end
25965
25966 !! test
25967 Serialize new placeholder space without spans
25968 !! options
25969 parsoid=html2wt
25970 !! html/parsoid
25971 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25972
25973 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25974
25975 <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>
25976 !! wikitext
25977 foo : bar
25978
25979 foo : bar
25980
25981 <ref>foo : bar</ref>ok
25982 !! end
25983
25984
25985 #-----------------------
25986 # Tag minimization tests
25987 #-----------------------
25988
25989 !! test
25990 1. I/B quote minimization: wikitext-only tags should be combined
25991 !! options
25992 parsoid=html2wt
25993 !! html/parsoid
25994 <p><i>A</i><i>B</i></p>
25995 <p><b>A</b><b>B</b></p>
25996 <p><i>A</i><b><i>B</i></b></p>
25997 <p><b>A</b><i><b>B</b></i></p>
25998 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25999 <p><i><b>A</b></i><i><b>B</b></i></p>
26000 <p><i><b>A</b></i><b><i>B</i></b></p>
26001 <p><b><i>A</i></b><i><b>B</b></i></p>
26002 !! wikitext
26003 ''AB''
26004
26005 '''AB'''
26006
26007 ''A'''B'''''
26008
26009 '''A''B'''''
26010
26011 '''A''BC''D'''
26012
26013 '''''AB'''''
26014
26015 '''''AB'''''
26016
26017 '''''AB'''''
26018 !! end
26019
26020 !! test
26021 2. I/B quote minimization: wikitext and html tags should not be combined
26022 !! options
26023 parsoid=html2wt
26024 !! html/parsoid
26025 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26026 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26027 !! wikitext
26028 ''A''<i>B</i>
26029
26030 ''A''<nowiki/>'''<i>B</i>'''
26031 !! end
26032
26033 !! test
26034 3. I/B quote minimization: templated content stops minimization
26035 !! options
26036 parsoid=html2wt
26037 !! html/parsoid
26038 <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>
26039 <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>
26040 !! wikitext
26041 ''A''{{echo|''B''}}
26042
26043 ''A''{{echo|'''''B'''''}}
26044 !! end
26045
26046 !! test
26047 4. I/B quote minimization: new content should be mimimized with adjacent old content
26048 !! options
26049 parsoid=html2wt
26050 !! html/parsoid
26051 <p><i>A</i><i>B</i></p>
26052 <p><b>A</b><b>B</b></p>
26053 <p><i>A</i><b><i>B</i></b></p>
26054 !! wikitext
26055 ''AB''
26056
26057 '''AB'''
26058
26059 ''A'''B'''''
26060 !! end
26061
26062 !! test
26063 5a. Merge adjacent quote nodes if they've been edited
26064 !! options
26065 parsoid={
26066 "modes": ["wt2wt", "selser"],
26067 "changes": [
26068 ["p", "contents", "remove", ":contains('b')"]
26069 ]
26070 }
26071 !! wikitext
26072 ''a''b''c''
26073 !! wikitext/edited
26074 ''ac''
26075 !! end
26076
26077 !! test
26078 5b. Merge adjacent quote nodes if they've been edited
26079 !! options
26080 parsoid={
26081 "modes": ["wt2wt", "selser"],
26082 "changes": [
26083 ["#x", "remove"]
26084 ]
26085 }
26086 !! wikitext
26087 ''a''<span id="x">b</span>''c''
26088 !! wikitext/edited
26089 ''ac''
26090 !! end
26091
26092 !! test
26093 1. Merge adjacent link nodes as long as at least one element is new
26094 !! options
26095 parsoid={
26096 "modes": ["html2wt"],
26097 "scrubWikitext": true
26098 }
26099 !! html/parsoid
26100 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26101 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26102 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26103 !! wikitext
26104 [[Football]]
26105 [[Football]]
26106 [[Football|Foot]][[Football|ball]]
26107 !! end
26108
26109 !! test
26110 2. Merge adjacent link nodes and enable additional normalizations
26111 !! options
26112 parsoid={
26113 "modes": ["html2wt"],
26114 "scrubWikitext": true
26115 }
26116 !! html/parsoid
26117 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26118 !! wikitext
26119 [[Football|''Football'']]
26120 !! end
26121
26122 !! test
26123 3. Don't merge adjacent link nodes if scrubWikitext is false
26124 !! options
26125 parsoid={
26126 "modes": ["html2wt"],
26127 "scrubWikitext": false
26128 }
26129 !! html/parsoid
26130 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26131 !! wikitext
26132 [[Football|Foot]][[Football|ball]]
26133 !! end
26134
26135 #------------------------------
26136 # End of tag minimization tests
26137 #------------------------------
26138
26139 !!test
26140 T56262: New entities
26141 !! options
26142 parsoid=html2wt
26143 !! html/parsoid
26144 <span typeof="mw:Entity">&nbsp;</span>
26145 !! wikitext
26146 &nbsp;
26147 !! end
26148
26149 ## Note that there is no wikitext output for 'unknownproperty' ##
26150 ## Unknown magic words are silently dropped ##
26151
26152 !! test
26153 Magic words
26154 !! options
26155 parsoid=html2wt
26156 !! html/parsoid
26157 <meta property='mw:PageProp/toc' />
26158 <meta property='mw:PageProp/notoc' />
26159 <meta property='mw:PageProp/forcetoc' />
26160 <meta property='mw:PageProp/index' />
26161 <meta property='mw:PageProp/noindex' />
26162 <meta property='mw:PageProp/nogallery' />
26163 <meta property='mw:PageProp/noeditsection' />
26164 <meta property='mw:PageProp/notitleconvert' />
26165 <meta property='mw:PageProp/nocontentconvert' />
26166 <meta property='mw:PageProp/unknownproperty' />
26167 !! wikitext
26168 __TOC__
26169 __NOTOC__
26170 __FORCETOC__
26171 __INDEX__
26172 __NOINDEX__
26173 __NOGALLERY__
26174 __NOEDITSECTION__
26175 __NOTITLECONVERT__
26176 __NOCONTENTCONVERT__
26177 !! end
26178
26179 !! test
26180 Consecutive <pre>s should not get merged
26181 !! options
26182 parsoid=html2wt,html2html
26183 !! html/parsoid
26184 <pre>a</pre><pre>b</pre>
26185
26186 <pre>c
26187 </pre><pre>
26188 d</pre>
26189
26190 <pre>e
26191
26192 </pre><pre>
26193
26194 f</pre>
26195 !! wikitext
26196 a
26197
26198 b
26199
26200 c
26201
26202 d
26203
26204 e
26205
26206
26207
26208 f
26209 !! end
26210
26211 !! test
26212 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26213 !! options
26214 parsoid=html2wt
26215 !! html/parsoid
26216 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26217 !! wikitext
26218 [[Special:BookSources/1234567890|ISBN 1234567895]]
26219 !! end
26220
26221 !! test
26222 Edited RFC links not serializable as RFC links should serialize as extlinks
26223 !! options
26224 parsoid=html2wt
26225 !! html/parsoid
26226 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26227 !! wikitext
26228 [//tools.ietf.org/html/rfc123 New RFC]
26229 !! end
26230
26231 !! test
26232 Edited PMID links not serializable as PMID links should serialize as extlinks
26233 !! options
26234 parsoid=html2wt
26235 !! html/parsoid
26236 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26237 !! wikitext
26238 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26239 !! end
26240
26241 !! test
26242 WTS of autolinks with trailing/surrounding context
26243 !! options
26244 parsoid=html2wt
26245 !! html/parsoid
26246 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26247 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26248 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26249 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26250 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26251 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26252 !! wikitext
26253 http://cscott.net'''foo'''
26254
26255 http://cscott.net<b>foo</b>
26256
26257 '''http://cscott.net'''
26258
26259 '''http://cscott.net '''
26260
26261 '''http://cscott.net<nowiki/>x'''
26262
26263 http://cscott.net<nowiki/>x
26264 !! end
26265
26266 !! test
26267 WTS of autolinks with nowikis (round-trip)
26268 !! wikitext
26269 x<nowiki/>http://cscott.net<nowiki/>x
26270 !! html/parsoid
26271 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26272 !! end
26273
26274 # this is the "easy" test because it leaves in place all the
26275 # data-parsoid information indicating this is an autolink
26276 !! test
26277 WTS of autolinks with escapes (editing)
26278 !! options
26279 parsoid={
26280 "modes": ["wt2wt"],
26281 "changes": [
26282 [ "span", "remove" ]
26283 ]
26284 }
26285 !! wikitext
26286 x<nowiki/>http://cscott.net<nowiki/>x
26287 !! wikitext/edited
26288 x<nowiki/>http://cscott.net<nowiki/>x
26289 !! end
26290
26291 !! test
26292 WTS of edited autolink-like text (T103364)
26293 !! options
26294 parsoid={
26295 "modes": ["wt2wt"],
26296 "changes": [
26297 [ "span[typeof]", "removeAttr", "typeof" ]
26298 ]
26299 }
26300 !! wikitext
26301 Not a link: <nowiki>http://example.com</nowiki>.
26302 !! wikitext/edited
26303 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26304 !! end
26305
26306 !! test
26307 WTS of newly-authored autolink-like text (T103364)
26308 !! options
26309 parsoid=html2wt
26310 !! html/parsoid
26311 <p>http://example.com is not a link.</p>
26312 !! wikitext
26313 <nowiki>http://example.com</nowiki> is not a link.
26314 !! end
26315
26316 !! test
26317 WTS of autolink-like text after an autolink (T108563)
26318 !! options
26319 parsoid=html2wt
26320 !! html/parsoid
26321 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26322 !! wikitext
26323 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26324 !! end
26325
26326 !! test
26327 Magic links inside links (not autolinked)
26328 !! wikitext
26329 [[Foo|http://example.com]]
26330 [[Foo|RFC 1234]]
26331 [[Foo|PMID 1234]]
26332 [[Foo|ISBN 123456789x]]
26333
26334 [http://foo.com http://example.com]
26335 [http://foo.com RFC 1234]
26336 [http://foo.com PMID 1234]
26337 [http://foo.com ISBN 123456789x]
26338 !! html+tidy
26339 <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>
26340 <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>
26341 !! html/parsoid
26342 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26343 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26344 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26345 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26346
26347 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26348 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26349 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26350 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26351 !! end
26352
26353 !! test
26354 Magic links inside image captions (autolinked)
26355 !! wikitext
26356 [[File:Foobar.jpg|thumb|http://example.com]]
26357 [[File:Foobar.jpg|thumb|RFC 1234]]
26358 [[File:Foobar.jpg|thumb|PMID 1234]]
26359 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26360 !! html+tidy
26361 <div class="thumb tright">
26362 <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>
26363 <div class="thumbcaption">
26364 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26365 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26366 </div>
26367 </div>
26368 <div class="thumb tright">
26369 <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>
26370 <div class="thumbcaption">
26371 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26372 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26373 </div>
26374 </div>
26375 <div class="thumb tright">
26376 <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>
26377 <div class="thumbcaption">
26378 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26379 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26380 </div>
26381 </div>
26382 <div class="thumb tright">
26383 <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>
26384 <div class="thumbcaption">
26385 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26386 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26387 </div>
26388 </div>
26389 !! html/parsoid
26390 <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>
26391 <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>
26392 <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>
26393 <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>
26394 !! end
26395
26396 !! test
26397 WTS of magic word text (T109371)
26398 !! options
26399 parsoid=html2wt
26400 !! html/parsoid
26401 <p>RFC 1234</p>
26402 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26403 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26404 !! wikitext
26405 <nowiki>RFC 1234</nowiki>
26406
26407 [http://foo.com RFC 1234]
26408
26409 [[Foo|RFC 1234]]
26410 !! end
26411
26412 !! test
26413 Edited Redirect link should emit a non-piped wikitext link
26414 !! options
26415 parsoid=html2wt
26416 !! html/parsoid
26417 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26418 !! wikitext
26419 #REDIRECT [[Bar]]
26420 !! end
26421
26422 !! test
26423 T75121: Infer extension name from typeOf if data-mw is not present
26424 !! options
26425 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26426 !! html/parsoid
26427 <div typeOf="mw:Extension/foo"></div>
26428 !! wikitext
26429 <foo />
26430 !! end
26431
26432 # Note that the <p> wrapping isn't present in PHP parser output
26433 # The important thing for this test is that P-wrapping doesn't
26434 # interfere with the <nowiki> protection for leading - in <td>
26435 # (which isn't necessary for <th>).
26436 !! test
26437 T88318: p-wrapped dash in table.
26438 !! options
26439 parsoid=html2wt,wt2wt
26440 !! html/parsoid
26441 <table><tbody>
26442 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26443 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26444 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26445 </tbody></table>
26446 !! wikitext
26447 {|
26448 !-
26449 !-
26450 |-
26451 |<nowiki>-</nowiki>
26452 |<nowiki>- </nowiki>
26453 |-
26454 |<small>-</small>
26455 |<br>
26456 -
26457 |<br>
26458 -
26459 |}
26460 !! html/php+tidy
26461 <table>
26462 <tr>
26463 <th>-</th>
26464 <th>-</th>
26465 </tr>
26466 <tr>
26467 <td>-</td>
26468 <td>-</td>
26469 </tr>
26470 <tr>
26471 <td><small>-</small></td>
26472 <td><br />
26473 <p>-</p>
26474 </td>
26475 <td><br />
26476 <p>-</p>
26477 </td>
26478 </tr>
26479 </table>
26480 !! end
26481
26482 !! test
26483 T149209: WTS: Handle newlines in table cells properly
26484 !! options
26485 parsoid=html2wt
26486 !! html/parsoid
26487 <table>
26488 <tbody>
26489 <tr><td>a
26490 b
26491 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
26492 <tr><td><p>x</p>
26493 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
26494 </tbody></table>
26495 <table>
26496 <tbody>
26497 <tr><th>a
26498 b
26499 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
26500 <tr><th><p>x</h>
26501 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
26502 </tbody></table>
26503 !! wikitext
26504 {|
26505 |a
26506 b
26507 |c
26508 |-
26509 |x
26510 {{!}}y
26511 |}
26512 {|
26513 !a
26514 b
26515 !c
26516 |-
26517 !x
26518 !y
26519 |}
26520 !! end
26521
26522 !! test
26523 T149209: Selser: Handle newlines in table cells properly
26524 !! options
26525 parsoid={
26526 "modes": ["selser"],
26527 "changes": [
26528 [ "#h1", "html", "a\nb\n" ],
26529 [ "#h2", "html", "a\nb\n" ],
26530 [ "#c1", "html", "a\nb\n" ],
26531 [ "#c2", "html", "<p>a</p>" ],
26532 [ "#c3", "html", "<p>a</p>" ],
26533 [ "#c4", "html", "edit-me<p>a</p>" ]
26534 ]
26535 }
26536 !! wikitext
26537 {|
26538 ! id="h1" |edit-me!!1
26539 |-
26540 ! id="h2" |edit-me||2
26541 |-
26542 | id="c1" |edit-me||3
26543 |-
26544 | id="c2" |edit-me||4
26545 |-
26546 | id="c3" |edit-me||p||q||r
26547 |-
26548 | id="c4" |edit-me||p||q||r
26549 |}
26550 !! wikitext/edited
26551 {|
26552 ! id="h1" |a
26553 b
26554 !1
26555 |-
26556 ! id="h2" |a
26557 b
26558 !2
26559 |-
26560 | id="c1" |a
26561 b
26562 |3
26563 |-
26564 | id="c2" |a
26565 |4
26566 |-
26567 | id="c3" |a
26568 |p||q||r
26569 |-
26570 | id="c4" |edit-me
26571 a
26572 |p||q||r
26573 |}
26574 !! end
26575
26576 !! test
26577 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26578 !! options
26579 parsoid=html2wt
26580 !! html/parsoid
26581 <table id='mwAb'>
26582 <td id='mwAc'>foo</td>
26583 <td id='serialize-this'>bar</td>
26584 </table>
26585 !! wikitext
26586 {|
26587 |foo
26588 | id="serialize-this" |bar
26589 |}
26590 !! end
26591
26592 !! test
26593 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26594 !! options
26595 parsoid=html2wt
26596 !! html/parsoid
26597 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26598 !! wikitext
26599 <div id="hello">ok</div>
26600 !! end
26601
26602 !! test
26603 WTS change modes
26604 !! options
26605 parsoid={
26606 "modes": ["wt2wt"],
26607 "changes": [
26608 [ "#xyz", "before", "<b>before</b> stuff " ],
26609 [ "#xyz", "after", " stuff <i>after</i>" ],
26610 [ "#xyz", "html", "x <b>y</b> z" ]
26611 ]
26612 }
26613 !! wikitext
26614 <span id="xyz">hello</span>
26615 !! wikitext/edited
26616 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26617 !! end
26618
26619 !! test
26620 Never serialize a-tag as html, regardless of what data-parsoid has to say
26621 !! options
26622 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26623 !! html/parsoid
26624 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26625 !! wikitext
26626 [[Foo]]
26627 !! end
26628
26629 ## SSS FIXME: This is broken output nevertheless.
26630 ## What might be a reasonable non-broken output for this?
26631 ## This is an edge case unlikely to be seen in production
26632 ## that I am not wasting more time on this right now.
26633 !! test
26634 Never serialize a-tag as html, no matter what attributes it has
26635 !! options
26636 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26637 !! html/parsoid
26638 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26639 !! wikitext
26640 [http://boo.org http://boohoo.org]
26641 !! end
26642
26643 # Misnested is an indication that selser can reuse the source but these have
26644 # shown to sneak through on occasion. See T101768.
26645 # The original wikitext here is: [http://test.com [[one]] two three]
26646 !! test
26647 Strip span tags added to mark misnested links
26648 !! options
26649 parsoid=html2wt
26650 !! html/parsoid
26651 <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>
26652 !! wikitext
26653 [http://test.com][[one]] two three
26654 !! end
26655
26656 !! test
26657 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26658 !! options
26659 parsoid=html2wt
26660 !! html/parsoid
26661 <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|}"]}'>
26662 <tbody><tr><td>d
26663 </td></tr>
26664 </tbody></table>
26665 !! wikitext
26666 {{echo|a}}
26667 {|{{echo|c
26668 {{!}}d
26669 }}
26670 |}
26671 !! end
26672
26673 ## This test verifies the presence and computation of this attribute indirectly
26674 ## by making an edit and ensuring that the serialization is correct (which it would be
26675 ## only if firstWikitextNode is properly set).
26676 !! test
26677 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26678 !! options
26679 parsoid= {
26680 "modes": ["wt2wt"],
26681 "changes": [
26682 [ "div#x", "remove" ],
26683 [ "div", "before", "<div>new</div>" ]
26684 ]
26685 }
26686 !! wikitext
26687 <div id="x">foo</div>
26688 {|
26689 {{echo|<div>boo</div>
26690 {{!}}b}}
26691 |c
26692 |}
26693 !! wikitext/edited
26694
26695 <div>new</div>
26696 {|
26697 {{echo|<div>boo</div>
26698 {{!}}b}}
26699 |c
26700 |}
26701 !! end
26702
26703 # --------------------------------------------
26704 # Tests spec'ing wikitext serialization norms |
26705 # --------------------------------------------
26706
26707 !! test
26708 Serialize multi-line indent-pre starting with wikitext syntax
26709 !! options
26710 parsoid=html2wt
26711 !! html/parsoid
26712 <pre>* 1
26713 ** 2
26714 * 3</pre>
26715 !! wikitext
26716 * 1
26717 ** 2
26718 * 3
26719 !! end
26720
26721 !! test
26722 1. Categories should always be serialized on their own line
26723 !! options
26724 parsoid=html2wt
26725 !! html/parsoid
26726 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26727 !! wikitext
26728 foo
26729 [[Category:Foo]]
26730 bar
26731 !! end
26732
26733 !! test
26734 2. Categories that are part of templates should not introduce a line break
26735 !! wikitext
26736 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26737 !! html/parsoid
26738 <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>
26739 !! end
26740
26741 # Careful while editing these next 2 tests. There are \u200f characters
26742 # before and after the <link> tags in the HTML and following some
26743 # of the categories in wikitext
26744 # Do not remove these characters in edits.
26745 #
26746 # As part of the serialization, these bidi characters will get stripped.
26747 !! test
26748 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26749 !! options
26750 parsoid={
26751 "modes": ["html2wt"],
26752 "scrubWikitext": true
26753 }
26754 !! html/parsoid
26755 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26756 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26757 !! wikitext
26758 [[קטגוריה:טקסים]]
26759 [[קטגוריה: שיטות משפט]]
26760 !! end
26761
26762 !! test
26763 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26764 !! options
26765 parsoid={
26766 "modes": ["html2wt"],
26767 "scrubWikitext": true
26768 }
26769 !! html/parsoid
26770 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26771 !! wikitext
26772 [[קטגוריה:טקסים]]
26773 ‏y
26774 !! end
26775
26776 !! test
26777 Lists: Add space after bullets
26778 !! options
26779 parsoid=html2wt
26780 !! html/parsoid
26781 <ul>
26782 <li>foo</li>
26783 <li> bar</li>
26784 <li><span> baz</span></li>
26785 </ul>
26786 !! wikitext
26787 * foo
26788 * bar
26789 * <span> baz</span>
26790 !! end
26791
26792 !! test
26793 1. Headings: Add space before/after == (T53744)
26794 !! options
26795 parsoid=html2wt
26796 !! html/parsoid
26797 <h2>foo</h2>
26798 <h2> bar</h2>
26799 <h2>baz </h2>
26800 <h2><span> baz</span></h2>
26801 !! wikitext
26802 == foo ==
26803
26804 == bar ==
26805
26806 == baz ==
26807
26808 == <span> baz</span> ==
26809 !! end
26810
26811 !! test
26812 2. Headings: Add space before/after == even after hoisted content
26813 !! options
26814 parsoid={
26815 "modes": ["html2wt"],
26816 "scrubWikitext": true
26817 }
26818 !! html/parsoid
26819 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26820 !! wikitext
26821 [[Category:A2]]
26822
26823 == ok ==
26824 !! end
26825
26826 !! test
26827 1. Headings: suppress newly created empty headings
26828 !! options
26829 parsoid={
26830 "modes": ["html2wt"],
26831 "scrubWikitext": true
26832 }
26833 !! html/parsoid
26834 <h2></h2>
26835 !! wikitext
26836 !! end
26837
26838 !! test
26839 2. Headings: don't suppress empty headings if scrubWikitext is false
26840 !! options
26841 parsoid=html2wt
26842 !! html/parsoid
26843 <h2></h2>
26844 !! wikitext
26845 ==<nowiki/>==
26846 !! end
26847
26848 !! test
26849 3. Headings: suppress empty headings on edits
26850 !! options
26851 parsoid={
26852 "modes": ["selser"],
26853 "scrubWikitext": true,
26854 "changes": [
26855 [ "#x", "remove"]
26856 ]
26857 }
26858 !! wikitext
26859 ==<span id="x">foo</span>==
26860 !! wikitext/edited
26861 !! end
26862
26863 !! test
26864 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26865 !! options
26866 parsoid={
26867 "modes": ["html2wt"],
26868 "scrubWikitext": true
26869 }
26870 !! html/parsoid
26871 <h2>foo<br/>bar</h2>
26872 <h2>foo <span><br/>bar</span> baz</h2>
26873 !! wikitext
26874 == foo bar ==
26875
26876 == foo <span> bar</span> baz ==
26877 !! end
26878
26879 !! test
26880 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26881 !! options
26882 parsoid={
26883 "modes": ["html2wt"],
26884 "scrubWikitext": false
26885 }
26886 !! html/parsoid
26887 <h2>foo<br/>bar</h2>
26888 !! wikitext
26889 == foo<br> bar ==
26890 !! end
26891
26892 !! test
26893 1. WT Quote Tags: suppress newly created empty style tags
26894 !! options
26895 parsoid={
26896 "modes": ["html2wt"],
26897 "scrubWikitext": true
26898 }
26899 !! html/parsoid
26900 <i></i><b></b>
26901 !! wikitext
26902 !! end
26903
26904 !! test
26905 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26906 !! options
26907 parsoid=html2wt
26908 !! html/parsoid
26909 <i></i><b></b>
26910 !! wikitext
26911 ''<nowiki/>'''''<nowiki/>'''
26912 !! end
26913
26914 !! test
26915 3. WT Quote Tags: suppress empty style tags on edits
26916 !! options
26917 parsoid={
26918 "modes": ["selser"],
26919 "scrubWikitext": true,
26920 "changes": [
26921 [ "#x", "remove"]
26922 ]
26923 }
26924 !! wikitext
26925 '''<span id="x">foo</span>'''
26926 !! wikitext/edited
26927 !! end
26928
26929 !! test
26930 1. Anchors: suppress newly created empty anchors
26931 !! options
26932 parsoid={
26933 "modes": ["html2wt"],
26934 "scrubWikitext": true
26935 }
26936 !! html/parsoid
26937 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26938 !! wikitext
26939 !! end
26940
26941 !! test
26942 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26943 !! options
26944 parsoid={
26945 "modes": ["html2wt"],
26946 "scrubWikitext": false
26947 }
26948 !! html/parsoid
26949 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26950 !! wikitext
26951 [[Test|<nowiki/>]]
26952 !! end
26953
26954 !! test
26955 3. Anchors: suppress empty anchors on edits
26956 !! options
26957 parsoid={
26958 "modes": ["selser"],
26959 "scrubWikitext": true,
26960 "changes": [
26961 [ "#x", "remove"]
26962 ]
26963 }
26964 !! wikitext
26965 [[Test|<span id="x">foo</span>]]
26966 !! wikitext/edited
26967 !! end
26968
26969 !! test
26970 3a. Anchors: do not suppress numbered extlinks
26971 !! options
26972 parsoid={
26973 "modes": ["wt2wt"],
26974 "scrubWikitext": true
26975 }
26976 !! wikitext
26977 [http://foo.com]
26978 !! html/parsoid
26979 <a rel="mw:ExtLink" href="http://foo.com"></a>
26980 !! end
26981
26982 !! test
26983 3b. Anchors: do not suppress numbered extlinks
26984 !! options
26985 parsoid={
26986 "modes": ["wt2wt"],
26987 "scrubWikitext": true,
26988 "changes": [
26989 [ "#x", "remove"]
26990 ]
26991 }
26992 !! wikitext
26993 [http://foo.com <span id="x">foo</span>]
26994 !! wikitext/edited
26995 [http://foo.com]
26996 !! end
26997
26998 !!test
26999 Normalizations should be restricted to edited content
27000 !!options
27001 parsoid={
27002 "modes": ["selser"],
27003 "scrubWikitext": true,
27004 "changes": [
27005 [ "h1", "before", "<i></i>"]
27006 ]
27007 }
27008 !!wikitext
27009 a
27010 = =
27011 b
27012 !!wikitext/edited
27013 a
27014 = =
27015 b
27016 !!end
27017
27018 !! test
27019 1. Multiple normalizations (html2wt)
27020 !! options
27021 parsoid={
27022 "modes": ["html2wt"],
27023 "scrubWikitext": true
27024 }
27025 !! html
27026 <h2><i></i></h2>
27027 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27028 </a><b><i></i></b>x</p>
27029 !! wikitext
27030
27031 [[foo]]
27032 x
27033
27034 !! end
27035
27036 !! test
27037 2. Multiple normalizations (selser)
27038 !! options
27039 parsoid={
27040 "modes": ["selser"],
27041 "scrubWikitext": true,
27042 "changes": [
27043 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27044 ]
27045 }
27046 !! wikitext
27047 <span id="x">foo</span>
27048 !! wikitext/edited
27049 <span id="x">foo</span>
27050
27051 x
27052 !! end
27053
27054 !! test
27055 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27056 !! options
27057 parsoid={
27058 "modes": ["html2wt"],
27059 "scrubWikitext": true
27060 }
27061 !! html/parsoid
27062 <p> hi</p>
27063 <p> hello</p>
27064 !! wikitext
27065 hi
27066
27067 hello
27068 !! end
27069
27070 !! test
27071 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27072 !! options
27073 parsoid=html2wt
27074 !! html/parsoid
27075 <p> hi</p>
27076 <p> hello</p>
27077 !! wikitext
27078 <nowiki> </nowiki>hi
27079
27080 <nowiki> </nowiki> hello
27081 !! end
27082
27083 !! test
27084 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27085 !! options
27086 parsoid={
27087 "modes": ["html2wt"],
27088 "scrubWikitext": true
27089 }
27090 !! html/parsoid
27091 <p>Foo
27092 bar
27093 baz</p>
27094
27095 <table><tr><td>Foo
27096 bar
27097 baz bang</td></tr></table>
27098
27099 <p><!--boo--> foo
27100 bar</p>
27101
27102 <p> foo
27103 bar<span>boo</span></p>
27104 !! wikitext
27105 Foo
27106 bar
27107 baz
27108
27109 {|
27110 |Foo
27111 bar
27112 baz bang
27113 |}
27114
27115 <!--boo-->foo
27116 bar
27117
27118 foo
27119 bar<span>boo</span>
27120 !! end
27121
27122 !! test
27123 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27124 !! options
27125 parsoid={
27126 "modes": ["selser"],
27127 "scrubWikitext": true,
27128 "changes": [
27129 [ "p", "html", " a\n b" ]
27130 ]
27131 }
27132 !! wikitext
27133 xyz
27134 !! wikitext/edited
27135 a
27136 b
27137 !! end
27138
27139 !! test
27140 1. New links that end in spaces
27141 !! options
27142 parsoid={
27143 "modes": ["html2wt"],
27144 "scrubWikitext": false
27145 }
27146 !! html/parsoid
27147 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27148 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27149 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27150 !! wikitext
27151 [[Berlin ]]<nowiki/>is the capital of Germany.
27152
27153 [[Foo ]]'''bar'''
27154
27155 [[Boston ]] is a city.
27156 !! end
27157
27158 !! test
27159 2. New links that end in spaces
27160 !! options
27161 parsoid={
27162 "modes": ["html2wt"],
27163 "scrubWikitext": true
27164 }
27165 !! html/parsoid
27166 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27167 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27168 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27169 !! wikitext
27170 [[Berlin]] is the capital of Germany.
27171
27172 [[Foo]] '''bar'''
27173
27174 [[Boston]] is a city.
27175 !! end
27176
27177 !! test
27178 1. Table cells with escapable prefixes
27179 !! options
27180 parsoid={
27181 "modes": ["html2wt"],
27182 "scrubWikitext": false
27183 }
27184 !! html
27185 <table>
27186 <tr><td>a</td></tr>
27187 <tr><td>-</td></tr>
27188 <tr><td>+</td></tr>
27189 </table>
27190 !! wikitext
27191 {|
27192 |a
27193 |-
27194 |<nowiki>-</nowiki>
27195 |-
27196 |<nowiki>+</nowiki>
27197 |}
27198 !! end
27199
27200 !! test
27201 2. Table cells with escapable prefixes
27202 !! options
27203 parsoid={
27204 "modes": ["html2wt"],
27205 "scrubWikitext": true
27206 }
27207 !! html
27208 <table>
27209 <tr><td>a</td></tr>
27210 <tr><td>-</td></tr>
27211 <tr><td>+</td></tr>
27212 </table>
27213 !! wikitext
27214 {|
27215 |a
27216 |-
27217 | -
27218 |-
27219 | +
27220 |}
27221 !! end
27222
27223 !! test
27224 3a. Table cells with escapable prefixes after edits
27225 !! options
27226 parsoid={
27227 "modes": ["selser"],
27228 "scrubWikitext": true,
27229 "changes": [
27230 [ "table tbody tr:first-child td:first-child", "remove"]
27231 ]
27232 }
27233 !! wikitext
27234 {|
27235 |a||-
27236 |}
27237 !! wikitext/edited
27238 {|
27239 | -
27240 |}
27241 !! end
27242
27243 !! test
27244 3b. Table cells with escapable prefixes after edits
27245 !! options
27246 parsoid={
27247 "modes": ["selser"],
27248 "scrubWikitext": true,
27249 "changes": [
27250 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27251 [ "#x", "remove" ]
27252 ]
27253 }
27254 !! wikitext
27255 {|
27256 |pqr
27257 |<span id="x">foo</span>+
27258 |}
27259 !! wikitext/edited
27260 {|
27261 | -
27262 | +
27263 |}
27264 !! end
27265
27266 # FIXME: This test will fail because
27267 # normalization doesn't realize that the id attribute
27268 # will eliminate the escapable scenario
27269 !! test
27270 4a. Table cells without escapable prefixes after edits
27271 !! options
27272 parsoid={
27273 "modes": ["selser"],
27274 "scrubWikitext": true,
27275 "changes": [
27276 [ "#x", "html", "-" ]
27277 ]
27278 }
27279 !! wikitext
27280 {|
27281 | id="x" |abcd
27282 |}
27283 !! wikitext/edited
27284 {|
27285 | id="x" |-
27286 |}
27287 !! end
27288
27289 ## This tests normalizer's ability to discriminate between
27290 ## cells having identical content.
27291 !! test
27292 4b. Table cells without escapable prefixes after edits
27293 !! options
27294 parsoid={
27295 "modes": ["selser"],
27296 "scrubWikitext": true,
27297 "changes": [
27298 [ "td", "html", "-" ]
27299 ]
27300 }
27301 !! wikitext
27302 {|
27303 |a||b
27304 |}
27305 !! wikitext/edited
27306 {|
27307 | -||-
27308 |}
27309 !! end
27310
27311 ## This tests normalizer's ability to not be tripped by
27312 ## comments (and whitespace)
27313 !! test
27314 4c. Table cells without escapable prefixes after edits
27315 !! options
27316 parsoid={
27317 "modes": ["selser"],
27318 "scrubWikitext": true,
27319 "changes": [
27320 [ "table tbody tr td:first-child", "remove" ]
27321 ]
27322 }
27323 !! wikitext
27324 {|
27325 |-
27326 <!--foo--> |a||-
27327 |}
27328 !! wikitext/edited
27329 {|
27330 |-
27331 <!--foo--> | -
27332 |}
27333 !! end
27334
27335 ## This tests normalizer's ability to handle HTML cells
27336 !! test
27337 4d. Table cells without escapable prefixes after edits
27338 !! options
27339 parsoid={
27340 "modes": ["selser"],
27341 "scrubWikitext": true,
27342 "changes": [
27343 [ "td", "html", "-" ]
27344 ]
27345 }
27346 !! wikitext
27347 <table>
27348 <tr><td>a</td></tr>
27349 </table>
27350 !! wikitext/edited
27351 <table>
27352 <tr><td>-</td></tr>
27353 </table>
27354 !! end
27355
27356 ## T111151 Remove font elements without attributes
27357 !! test
27358 5a. font tags without attributes should be dropped in scrubWikitext mode
27359 !! options
27360 parsoid={
27361 "modes": ["html2wt"],
27362 "scrubWikitext": true
27363 }
27364 !! html
27365 <font>foo</font>
27366 <font><font>bar</font></font>
27367 <font class="x">boo</font>
27368 !! wikitext
27369 foo
27370 bar
27371 <font class="x">boo</font>
27372 !! end
27373
27374 !! test
27375 5b. font tags should not be dropped without scrubWikitext being enabled
27376 !! options
27377 parsoid={
27378 "modes": ["html2wt"],
27379 "scrubWikitext": false
27380 }
27381 !! html
27382 <font>foo</font>
27383 !! wikitext
27384 <font>foo</font>
27385 !! end
27386
27387 !! test
27388 Escape nowiki DOM elements
27389 !! options
27390 parsoid=html2wt
27391 !! html/parsoid
27392 <nowiki><i>foo</i></nowiki>
27393 !! wikitext
27394 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27395 !! end
27396
27397 # This is meant to be an interim fix while we go about figuring out
27398 # how to not introduce these trailing <nowiki/>s in the first place.
27399 !! test
27400 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27401 !! options
27402 parsoid=html2wt
27403 !! html/parsoid
27404 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27405 y</p>
27406 <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>
27407 <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>
27408 !! wikitext
27409 x
27410 y
27411
27412 {{echo|
27413 1 = <nowiki/>}}
27414
27415 {{echo|
27416 1 = <nowiki/>
27417 }}
27418 !! end
27419
27420 # ---------------------------------------------------
27421 # End of tests spec'ing wikitext serialization norms |
27422 # ---------------------------------------------------
27423
27424 # T104032
27425 !! test
27426 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27427 !! options
27428 parsoid=html2wt
27429 !! html/parsoid
27430 a<p>b</p>
27431 <b>c</b><p>d</p>
27432 <table><tr>
27433 <td>a<p>b</p></td>
27434 <td><b>c</b><p>d</p></td>
27435 </tr></table>
27436 !! wikitext
27437 a
27438
27439 b
27440
27441 '''c'''
27442
27443 d
27444 {|
27445 |a
27446 b
27447 |'''c'''
27448 d
27449 |}
27450 !! end
27451
27452 # -----------------------------------------------------------------
27453 # End of section for Parsoid-only html2wt tests for serialization
27454 # of new content
27455 # -----------------------------------------------------------------
27456
27457 # -----------------------------------------------------------------
27458 # The following section of tests are primarily to spec behavior of
27459 # the selective serializer. All these tests have manual selser
27460 # changes. The automated selser changes for all tests handle the
27461 # wide variation of changes, but these tests here capture specs
27462 # deterministically.
27463 # ----------------------------------------------------------------
27464
27465 ## T90517
27466 !! test
27467 Selser: New comments should not be lost
27468 !! options
27469 parsoid={
27470 "modes": ["selser"],
27471 "changes": [
27472 [ "#a", "after", "<!--c1-->" ],
27473 [ "#b", "before", "<!--c2-->" ]
27474 ]
27475 }
27476 !! wikitext
27477 <span id="a">a</span>
27478
27479 <span id="b">b</span>
27480 !! wikitext/edited
27481 <span id="a">a</span><!--c1-->
27482
27483 <!--c2--><span id="b">b</span>
27484 !! end
27485
27486 ## T89383
27487 !! test
27488 Selser: Check for validity of DSR before using it
27489 !! options
27490 parsoid={
27491 "modes": ["selser"],
27492 "changes": [
27493 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27494 ]
27495 }
27496 !! wikitext
27497 <span id="a">a</span>
27498 !! wikitext/edited
27499 {{DISPLAYTITLE:foo}}
27500 <span id="a">a</span>
27501 !! end
27502
27503 !! test
27504 1. DOMDiff: Changes to <ref> content should be looked up using id
27505 !! options
27506 parsoid={
27507 "modes": ["selser"],
27508 "changes": [
27509 ["#X", "after", "bar"],
27510 ["#Y", "after", "baz"]
27511 ]
27512 }
27513 !! wikitext
27514 X <ref><span id="X">foo</span></ref>
27515 Y <ref name="a" />
27516 <references>
27517 <ref name="a"><span id="Y">foo</span></ref>
27518 </references>
27519 !! wikitext/edited
27520 X <ref><span id="X">foo</span>bar</ref>
27521 Y <ref name="a" />
27522 <references>
27523 <ref name="a"><span id="Y">foo</span>baz</ref>
27524 </references>
27525 !! end
27526
27527 !! test
27528 2. DOMDiff: Changes to <ref> content should be looked up using id
27529 !! options
27530 parsoid={
27531 "modes": ["selser"],
27532 "changes": [
27533 ["#Z", "after", "bar"]
27534 ]
27535 }
27536 !! wikitext
27537 A <ref>foo bar for a</ref>
27538 B <ref group="X" name="b" />
27539
27540 <references />
27541
27542 <references group="X">
27543 <ref name="b"><span id="Z">foo</span></ref>
27544 </references>
27545 !! wikitext/edited
27546 A <ref>foo bar for a</ref>
27547 B <ref group="X" name="b" />
27548
27549 <references />
27550
27551 <references group="X">
27552 <ref name="b"><span id="Z">foo</span>bar</ref>
27553 </references>
27554 !! end
27555
27556 !! test
27557 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27558 !! options
27559 parsoid={
27560 "modes": ["selser"],
27561 "changes": [
27562 [ "div:first-child", "text", "bar" ]
27563 ]
27564 }
27565 !! wikitext
27566 <div style="{{1x|color:red;}}%">foo</div>
27567 !! wikitext/edited
27568 <div style="{{1x|color:red;}}%">bar</div>
27569 !! end
27570
27571 !! test
27572 Empty LI (T49673)
27573 !! wikitext
27574 * a
27575 *
27576 *
27577 * b
27578 !! html/php+tidy
27579 <ul>
27580 <li>a</li>
27581 <li class="mw-empty-elt"></li>
27582 <li class="mw-empty-elt"></li>
27583 <li>b</li>
27584 </ul>
27585 !! end
27586
27587 !! test
27588 Thumbnail output
27589 !! wikitext
27590 [[File:Thumb.png|thumb]]
27591 !! html/php+tidy
27592 <div class="thumb tright">
27593 <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>
27594 <div class="thumbcaption">
27595 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27596 </div>
27597 </div>
27598 </div>
27599 !! end
27600
27601 !! test
27602 unclosed internal link XSS (T137264)
27603 !! wikitext
27604 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27605 !! html/php
27606 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27607 </p>
27608 !! html/parsoid
27609 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
27610 !! end