Merge "Revert "Temporary hax to hide cawiki's hacked in search sidebar""
[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><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
8019 </p>
8020 !! html/php+tidy
8021 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></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><strong class="selflink">0</strong>
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><strong class="selflink">local:Main Page</strong>
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 !! wikitext
9966 {{FULLPAGENAME}}
9967 !! html
9968 <p>User:Ævar Arnfjörð Bjarmason
9969 </p>
9970 !! end
9971
9972 !! test
9973 Magic Word: {{FULLPAGENAMEE}}
9974 !! options
9975 title=[[User:Ævar Arnfjörð Bjarmason]]
9976 !! wikitext
9977 {{FULLPAGENAMEE}}
9978 !! html
9979 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9980 </p>
9981 !! end
9982
9983 !! test
9984 Magic Word: {{TALKSPACE}}
9985 !! options
9986 title=[[User:Ævar Arnfjörð Bjarmason]]
9987 !! wikitext
9988 {{TALKSPACE}}
9989 !! html
9990 <p>User talk
9991 </p>
9992 !! end
9993
9994 !! test
9995 Magic Word: {{TALKSPACE}}, same namespace
9996 !! options
9997 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9998 !! wikitext
9999 {{TALKSPACE}}
10000 !! html
10001 <p>User talk
10002 </p>
10003 !! end
10004
10005 !! test
10006 Magic Word: {{TALKSPACE}}, main namespace
10007 !! options
10008 title=[[Parser Test]]
10009 !! wikitext
10010 {{TALKSPACE}}
10011 !! html
10012 <p>Talk
10013 </p>
10014 !! end
10015
10016 !! test
10017 Magic Word: {{TALKSPACEE}}
10018 !! options
10019 title=[[User:Ævar Arnfjörð Bjarmason]]
10020 !! wikitext
10021 {{TALKSPACEE}}
10022 !! html
10023 <p>User_talk
10024 </p>
10025 !! end
10026
10027 !! test
10028 Magic Word: {{SUBJECTSPACE}}
10029 !! options
10030 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10031 !! wikitext
10032 {{SUBJECTSPACE}}
10033 !! html
10034 <p>User
10035 </p>
10036 !! end
10037
10038 !! test
10039 Magic Word: {{SUBJECTSPACE}}, same namespace
10040 !! options
10041 title=[[User:Ævar Arnfjörð Bjarmason]]
10042 !! wikitext
10043 {{SUBJECTSPACE}}
10044 !! html
10045 <p>User
10046 </p>
10047 !! end
10048
10049 !! test
10050 Magic Word: {{SUBJECTSPACE}}, main namespace
10051 !! options
10052 title=[[Parser Test]]
10053 !! wikitext
10054 {{SUBJECTSPACE}}
10055 !! html
10056
10057 !! end
10058
10059 !! test
10060 Magic Word: {{SUBJECTSPACEE}}
10061 !! options
10062 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10063 !! wikitext
10064 {{SUBJECTSPACEE}}
10065 !! html
10066 <p>User
10067 </p>
10068 !! end
10069
10070 !! test
10071 Magic Word: {{NAMESPACE}}
10072 !! options
10073 title=[[User:Ævar Arnfjörð Bjarmason]]
10074 !! wikitext
10075 {{NAMESPACE}}
10076 !! html
10077 <p>User
10078 </p>
10079 !! end
10080
10081 !! test
10082 Magic Word: {{NAMESPACEE}}
10083 !! options
10084 title=[[User:Ævar Arnfjörð Bjarmason]]
10085 !! wikitext
10086 {{NAMESPACEE}}
10087 !! html
10088 <p>User
10089 </p>
10090 !! end
10091
10092 !! test
10093 Magic Word: {{NAMESPACENUMBER}}
10094 !! options
10095 title=[[User:Ævar Arnfjörð Bjarmason]]
10096 !! wikitext
10097 {{NAMESPACENUMBER}}
10098 !! html
10099 <p>2
10100 </p>
10101 !! end
10102
10103 !! test
10104 Magic Word: {{SUBPAGENAME}}
10105 !! options
10106 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10107 !! wikitext
10108 {{SUBPAGENAME}}
10109 !! html
10110 <p>sub ö
10111 </p>
10112 !! end
10113
10114 !! test
10115 Magic Word: {{SUBPAGENAMEE}}
10116 !! options
10117 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10118 !! wikitext
10119 {{SUBPAGENAMEE}}
10120 !! html
10121 <p>sub_%C3%B6
10122 </p>
10123 !! end
10124
10125 !! test
10126 Magic Word: {{ROOTPAGENAME}}
10127 !! options
10128 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10129 !! wikitext
10130 {{ROOTPAGENAME}}
10131 !! html
10132 <p>Ævar Arnfjörð Bjarmason
10133 </p>
10134 !! end
10135
10136 !! test
10137 Magic Word: {{ROOTPAGENAMEE}}
10138 !! options
10139 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10140 !! wikitext
10141 {{ROOTPAGENAMEE}}
10142 !! html
10143 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10144 </p>
10145 !! end
10146
10147 !! test
10148 Magic Word: {{BASEPAGENAME}}
10149 !! options
10150 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10151 !! wikitext
10152 {{BASEPAGENAME}}
10153 !! html
10154 <p>Ævar Arnfjörð Bjarmason
10155 </p>
10156 !! end
10157
10158 !! test
10159 Magic Word: {{BASEPAGENAMEE}}
10160 !! options
10161 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10162 !! wikitext
10163 {{BASEPAGENAMEE}}
10164 !! html
10165 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10166 </p>
10167 !! end
10168
10169 !! test
10170 Magic Word: {{TALKPAGENAME}}
10171 !! options
10172 title=[[User:Ævar Arnfjörð Bjarmason]]
10173 !! wikitext
10174 {{TALKPAGENAME}}
10175 !! html
10176 <p>User talk:Ævar Arnfjörð Bjarmason
10177 </p>
10178 !! end
10179
10180 !! test
10181 Magic Word: {{TALKPAGENAMEE}}
10182 !! options
10183 title=[[User:Ævar Arnfjörð Bjarmason]]
10184 !! wikitext
10185 {{TALKPAGENAMEE}}
10186 !! html
10187 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10188 </p>
10189 !! end
10190
10191 !! test
10192 Magic Word: {{SUBJECTPAGENAME}}
10193 !! options
10194 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10195 !! wikitext
10196 {{SUBJECTPAGENAME}}
10197 !! html
10198 <p>User:Ævar Arnfjörð Bjarmason
10199 </p>
10200 !! end
10201
10202 !! test
10203 Magic Word: {{SUBJECTPAGENAMEE}}
10204 !! options
10205 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10206 !! wikitext
10207 {{SUBJECTPAGENAMEE}}
10208 !! html
10209 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10210 </p>
10211 !! end
10212
10213 !! test
10214 Magic Word: {{NUMBEROFFILES}}
10215 !! wikitext
10216 {{NUMBEROFFILES}}
10217 !! html
10218 <p>7
10219 </p>
10220 !! end
10221
10222 !! test
10223 Magic Word: {{PAGENAME}}
10224 !! options
10225 title=[[User:Ævar Arnfjörð Bjarmason]]
10226 !! wikitext
10227 {{PAGENAME}}
10228 !! html
10229 <p>Ævar Arnfjörð Bjarmason
10230 </p>
10231 !! end
10232
10233 !! test
10234 Magic Word: {{PAGENAME}} with metacharacters
10235 !! options
10236 title=[['foo & bar = baz']]
10237 !! wikitext
10238 ''{{PAGENAME}}''
10239 !! html/php
10240 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10241 </p>
10242 !! html+tidy
10243 <p><i>'foo &amp; bar = baz'</i></p>
10244 !! end
10245
10246 !! test
10247 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10248 !! options
10249 title=[[*RFC 1234 http://example.com/]]
10250 !! wikitext
10251 {{PAGENAME}}
10252 !! html/php
10253 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10254 </p>
10255 !! html+tidy
10256 <p>*RFC 1234 http://example.com/</p>
10257 !! end
10258
10259 !! test
10260 Magic Word: {{PAGENAMEE}}
10261 !! options
10262 title=[[User:Ævar Arnfjörð Bjarmason]]
10263 !! wikitext
10264 {{PAGENAMEE}}
10265 !! html
10266 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10267 </p>
10268 !! end
10269
10270 !! test
10271 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10272 !! options
10273 title=[[*RFC 1234 http://example.com/]]
10274 !! wikitext
10275 {{PAGENAMEE}}
10276 !! html/php
10277 <p>&#42;RFC_1234_http&#58;//example.com/
10278 </p>
10279 !! html+tidy
10280 <p>*RFC_1234_http://example.com/</p>
10281 !! end
10282
10283 !! test
10284 Magic Word: {{REVISIONID}}
10285 !! wikitext
10286 {{REVISIONID}}
10287 !! html
10288 <p>1337
10289 </p>
10290 !! end
10291
10292 !! test
10293 Magic Word: {{SCRIPTPATH}}
10294 !! wikitext
10295 {{SCRIPTPATH}}
10296 !! html
10297
10298 !! end
10299
10300 !! test
10301 Magic Word: {{STYLEPATH}}
10302 !! wikitext
10303 {{STYLEPATH}}
10304 !! html
10305 <p>/skins
10306 </p>
10307 !! end
10308
10309 !! test
10310 Magic Word: {{SERVER}}
10311 !! wikitext
10312 {{SERVER}}
10313 !! html
10314 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10315 </p>
10316 !! end
10317
10318 !! test
10319 Magic Word: {{SERVERNAME}}
10320 !! wikitext
10321 {{SERVERNAME}}
10322 !! html
10323 <p>example.org
10324 </p>
10325 !! end
10326
10327 !! test
10328 Magic Word: {{SITENAME}}
10329 !! wikitext
10330 {{SITENAME}}
10331 !! html
10332 <p>MediaWiki
10333 </p>
10334 !! end
10335
10336 !! test
10337 Magic Word: {{PAGELANGUAGE}}
10338 !! options
10339 language=fr
10340 !! wikitext
10341 {{PAGELANGUAGE}}
10342 !! html
10343 <p>fr
10344 </p>
10345 !! end
10346
10347 !! test
10348 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10349 !! wikitext
10350 {{PAGELANGUAGE}}
10351 !! html
10352 <p>en
10353 </p>
10354 !! end
10355
10356 !! test
10357 Case-sensitive magic words, when cased differently, should just be template transclusions
10358 !! wikitext
10359 {{CurrentMonth}}
10360 {{currentday}}
10361 {{cURreNTweEK}}
10362 {{currentHour}}
10363 !! html
10364 <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>
10365 <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>
10366 <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>
10367 <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>
10368 </p>
10369 !! end
10370
10371 !! test
10372 Case-insensitive magic words should still work with weird casing.
10373 !! wikitext
10374 {{sErVeRNaMe}}
10375 {{LCFirst:AOEU}}
10376 {{ucFIRST:aoeu}}
10377 {{SERver}}
10378 !! html
10379 <p>example.org
10380 aOEU
10381 Aoeu
10382 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10383 </p>
10384 !! end
10385
10386 # From plwiki:PLOS_ONE
10387 !! test
10388 Parsoid: Page property magic word with magic word contents
10389 !! wikitext
10390 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10391 !! html/parsoid
10392 <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>"}]]}'/>
10393 !! end
10394
10395 !! test
10396 Parsoid: Template-generated DISPLAYTITLE
10397 !! wikitext
10398 {{{{echo|DISPLAYTITLE}}:Foo}}
10399 !! html/parsoid
10400 <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}}]}'/>
10401 !! end
10402
10403 !! test
10404 Namespace 1 {{ns:1}}
10405 !! wikitext
10406 {{ns:1}}
10407 !! html
10408 <p>Talk
10409 </p>
10410 !! end
10411
10412 !! test
10413 Namespace 1 {{ns:01}}
10414 !! wikitext
10415 {{ns:01}}
10416 !! html
10417 <p>Talk
10418 </p>
10419 !! end
10420
10421 !! test
10422 Namespace 0 {{ns:0}} (T6783)
10423 !! wikitext
10424 {{ns:0}}
10425 !! html
10426
10427 !! end
10428
10429 !! test
10430 Namespace 0 {{ns:00}} (T6783)
10431 !! wikitext
10432 {{ns:00}}
10433 !! html
10434
10435 !! end
10436
10437 !! test
10438 Namespace -1 {{ns:-1}}
10439 !! wikitext
10440 {{ns:-1}}
10441 !! html
10442 <p>Special
10443 </p>
10444 !! end
10445
10446 !! test
10447 Namespace User {{ns:User}}
10448 !! wikitext
10449 {{ns:User}}
10450 !! html
10451 <p>User
10452 </p>
10453 !! end
10454
10455 !! test
10456 Namespace User talk {{ns:User_talk}}
10457 !! wikitext
10458 {{ns:User_talk}}
10459 !! html
10460 <p>User talk
10461 </p>
10462 !! end
10463
10464 !! test
10465 Namespace User talk {{ns:uSeR tAlK}}
10466 !! wikitext
10467 {{ns:uSeR tAlK}}
10468 !! html
10469 <p>User talk
10470 </p>
10471 !! end
10472
10473 !! test
10474 Namespace File {{ns:File}}
10475 !! wikitext
10476 {{ns:File}}
10477 !! html
10478 <p>File
10479 </p>
10480 !! end
10481
10482 !! test
10483 Namespace File {{ns:Image}}
10484 !! wikitext
10485 {{ns:Image}}
10486 !! html
10487 <p>File
10488 </p>
10489 !! end
10490
10491 !! test
10492 Namespace (lang=de) Benutzer {{ns:User}}
10493 !! options
10494 language=de
10495 !! wikitext
10496 {{ns:User}}
10497 !! html
10498 <p>Benutzer
10499 </p>
10500 !! end
10501
10502 !! test
10503 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10504 !! options
10505 language=de
10506 !! wikitext
10507 {{ns:3}}
10508 !! html
10509 <p>Benutzer Diskussion
10510 </p>
10511 !! end
10512
10513 !! test
10514 Urlencode
10515 !! wikitext
10516 {{urlencode:hi world?!}}
10517 {{urlencode:hi world?!|WIKI}}
10518 {{urlencode:hi world?!|PATH}}
10519 {{urlencode:hi world?!|QUERY}}
10520 !! html/php
10521 <p>hi+world%3F%21
10522 hi_world%3F!
10523 hi%20world%3F%21
10524 hi+world%3F%21
10525 </p>
10526 !! end
10527
10528 !! test
10529 Magic Word: prioritize type info over data-parsoid
10530 !! options
10531 parsoid=html2wt
10532 !! html/parsoid
10533 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10534 !! wikitext
10535 __FORCETOC__
10536 !! end
10537
10538 !! test
10539 Magic Word: serialize on separate line (parsoid)
10540 !! options
10541 parsoid=wt2wt,html2wt
10542 !! wikitext
10543 foo
10544 __NOTOC__
10545 bar
10546 !! html/parsoid
10547 foo<meta property="mw:PageProp/notoc"/>bar
10548 !! end
10549
10550 !! test
10551 Magic Word: rt non-english wikis
10552 !! options
10553 parsoid=wt2wt
10554 language=de
10555 !! wikitext
10556 __NOEDITSECTION__
10557 !! html/parsoid
10558 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10559 !! end
10560
10561 !!test
10562 __proto__ is treated as normal wikitext (T105997)
10563 !!wikitext
10564 __proto__
10565 !!html
10566 <p>__proto__
10567 </p>
10568 !!end
10569
10570 ###
10571 ### Magic links
10572 ###
10573 !! test
10574 Magic links: internal link to RFC (T2479)
10575 !! wikitext
10576 [[RFC 123]]
10577 !! html/php
10578 <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>
10579 </p>
10580 !! html/parsoid
10581 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10582 !! end
10583
10584 !! test
10585 Magic links: RFC (T2479)
10586 !! wikitext
10587 RFC 822
10588 !! html/php
10589 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10590 </p>
10591 !! html/parsoid
10592 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10593 !! end
10594
10595 !! test
10596 Magic links: RFC (T67278)
10597 !! wikitext
10598 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10599 !! html/php
10600 <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.
10601 </p>
10602 !! html/parsoid
10603 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10604 !! end
10605
10606 !! test
10607 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
10608 !! wikitext
10609 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10610 RFC
10611 822
10612 !! html/php
10613 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10614 RFC
10615 822
10616 </p>
10617 !! html/parsoid
10618 <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>
10619 RFC
10620 822</p>
10621 !! end
10622
10623 !! test
10624 Magic links: ISBN (T3937)
10625 !! wikitext
10626 ISBN 0-306-40615-2
10627 !! html/php
10628 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10629 </p>
10630 !! html/parsoid
10631 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10632 !! end
10633
10634 !! test
10635 Magic links: ISBN (T67278)
10636 !! wikitext
10637 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10638 !! html/php
10639 <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.
10640 </p>
10641 !! html/parsoid
10642 <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>
10643 !! end
10644
10645 !! test
10646 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
10647 !! wikitext
10648 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10649 ISBN
10650 9780316098113
10651 ISBN 978
10652 0316098113
10653 !! html/php
10654 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10655 ISBN
10656 9780316098113
10657 ISBN 978
10658 0316098113
10659 </p>
10660 !! html/parsoid
10661 <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>
10662 ISBN
10663 9780316098113
10664 ISBN 978
10665 0316098113</p>
10666 !! end
10667
10668 !! test
10669 Magic links: PMID incorrectly converts space to underscore
10670 !! wikitext
10671 PMID 1234
10672 !! html/php
10673 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10674 </p>
10675 !! html/parsoid
10676 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10677 !! end
10678
10679 !! test
10680 Magic links: PMID (T67278)
10681 !! wikitext
10682 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10683 !! html/php
10684 <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.
10685 </p>
10686 !! html/parsoid
10687 <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>
10688 !! end
10689
10690 !! test
10691 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
10692 !! wikitext
10693 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10694 PMID
10695 1234
10696 !! html/php
10697 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10698 PMID
10699 1234
10700 </p>
10701 !! html/parsoid
10702 <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>
10703 PMID
10704 1234</p>
10705 !! end
10706
10707 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10708 # since these are ExtLinkText, not MagicLinkText
10709 !! test
10710 Magic links: use appropriate serialization for "almost" magic links.
10711 !! wikitext
10712 X[[Special:BookSources/0978739256|foo]]
10713
10714 X[//tools.ietf.org/html/rfc1234 foo]
10715 !! html/php
10716 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10717 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10718 </p>
10719 !! html/parsoid
10720 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10721 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10722 !! end
10723
10724 !! test
10725 Magic links: All disabled (T47942)
10726 !! options
10727 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10728 !! wikitext
10729 ISBN 0-306-40615-2
10730 PMID 1234
10731 RFC 4321
10732 !! html/php
10733 <p>ISBN 0-306-40615-2
10734 PMID 1234
10735 RFC 4321
10736 </p>
10737 !! end
10738
10739 ###
10740 ### Templates
10741 ####
10742
10743 !! test
10744 Nonexistent template
10745 !! wikitext
10746 {{thistemplatedoesnotexist}}
10747 !! html
10748 <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>
10749 </p>
10750 !! end
10751
10752 !! test
10753 Template with invalid target containing tags
10754 !! wikitext
10755 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10756 !! html
10757 <p>{{a<b>b</b>|foo|a=b|a = b}}
10758 </p>
10759 !! end
10760
10761 !! test
10762 Template with invalid target containing unclosed tag
10763 !! wikitext
10764 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10765 !! html
10766 <p>{{a<b>|foo|a=b|a = b}}</b>
10767 </p>
10768 !! end
10769
10770 !! test
10771 Template with invalid target containing wikilink
10772 !! wikitext
10773 {{[[Main Page]]}}
10774 !! html/php
10775 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10776 </p>
10777 !! html/parsoid
10778 <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>
10779 !! end
10780
10781 !! test
10782 Template with just whitespace in it, T70421
10783 !! wikitext
10784 {{echo|{{ }}}}
10785 !! html/parsoid
10786 <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>
10787 !! end
10788
10789 !! article
10790 Template:test
10791 !! text
10792 This is a test template
10793 !! endarticle
10794
10795 !! test
10796 Simple template
10797 !! wikitext
10798 {{test}}
10799 !! html
10800 <p>This is a test template
10801 </p>
10802 !! end
10803
10804 !! test
10805 Template with explicit namespace
10806 !! wikitext
10807 {{Template:test}}
10808 !! html
10809 <p>This is a test template
10810 </p>
10811 !! end
10812
10813
10814 !! article
10815 Template:paramtest
10816 !! text
10817 This is a test template with parameter {{{param}}}
10818 !! endarticle
10819
10820 !! test
10821 Template parameter
10822 !! wikitext
10823 {{paramtest|param=foo}}
10824 !! html
10825 <p>This is a test template with parameter foo
10826 </p>
10827 !! end
10828
10829 !! article
10830 Template:paramtestnum
10831 !! text
10832 [[{{{1}}}|{{{2}}}]]
10833 !! endarticle
10834
10835 !! test
10836 Template unnamed parameter
10837 !! wikitext
10838 {{paramtestnum|Main Page|the main page}}
10839 !! html
10840 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10841 </p>
10842 !! end
10843
10844 !! article
10845 Template:templatesimple
10846 !! text
10847 (test)
10848 !! endarticle
10849
10850 !! article
10851 Template:templateredirect
10852 !! text
10853 #redirect [[Template:templatesimple]]
10854 !! endarticle
10855
10856 !! article
10857 Template:templateasargtestnum
10858 !! text
10859 {{{{{1}}}}}
10860 !! endarticle
10861
10862 !! article
10863 Template:templateasargtest
10864 !! text
10865 {{template{{{templ}}}}}
10866 !! endarticle
10867
10868 !! article
10869 Template:templateasargtest2
10870 !! text
10871 {{{{{templ}}}}}
10872 !! endarticle
10873
10874 !! test
10875 Template with template name as unnamed argument
10876 !! wikitext
10877 {{templateasargtestnum|templatesimple}}
10878 !! html
10879 <p>(test)
10880 </p>
10881 !! end
10882
10883 !! test
10884 Template with template name as argument
10885 !! wikitext
10886 {{templateasargtest|templ=simple}}
10887 !! html
10888 <p>(test)
10889 </p>
10890 !! end
10891
10892 !! test
10893 Template with template name as argument (2)
10894 !! wikitext
10895 {{templateasargtest2|templ=templatesimple}}
10896 !! html
10897 <p>(test)
10898 </p>
10899 !! end
10900
10901 !! article
10902 Template:templateasargtestdefault
10903 !! text
10904 {{{{{templ|templatesimple}}}}}
10905 !! endarticle
10906
10907 !! article
10908 Template:templa
10909 !! text
10910 '''templ'''
10911 !! endarticle
10912
10913 !! test
10914 Template with default value
10915 !! wikitext
10916 {{templateasargtestdefault}}
10917 !! html
10918 <p>(test)
10919 </p>
10920 !! end
10921
10922 !! test
10923 Template with default value (value set)
10924 !! wikitext
10925 {{templateasargtestdefault|templ=templa}}
10926 !! html
10927 <p><b>templ</b>
10928 </p>
10929 !! end
10930
10931 !! test
10932 Template redirect
10933 !! wikitext
10934 {{templateredirect}}
10935 !! html/php
10936 <p>(test)
10937 </p>
10938 !! html/parsoid
10939 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10940 !! end
10941
10942 !! test
10943 Template with argument in separate line
10944 !! wikitext
10945 {{ templateasargtest |
10946 templ = simple }}
10947 !! html
10948 <p>(test)
10949 </p>
10950 !! end
10951
10952 !! test
10953 Template with complex template as argument
10954 !! wikitext
10955 {{paramtest|
10956 param ={{ templateasargtest |
10957 templ = simple }}}}
10958 !! html
10959 <p>This is a test template with parameter (test)
10960 </p>
10961 !! end
10962
10963 !! test
10964 Template with thumb image (with link in description)
10965 !! wikitext
10966 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10967 !! html/php
10968 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>
10969
10970 !! html+tidy
10971 <p>This is a test template with parameter</p>
10972 <div class="thumb tright">
10973 <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>
10974 <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>
10975 </div>
10976 </div>
10977 !! html/parsoid
10978 <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>
10979 !! end
10980
10981 !! article
10982 Template:complextemplate
10983 !! text
10984 {{{1}}} {{paramtest|
10985 param ={{{param}}}}}
10986 !! endarticle
10987
10988 !! test
10989 Template with complex arguments
10990 !! wikitext
10991 {{complextemplate|
10992 param ={{ templateasargtest |
10993 templ = simple }}|[[Template:complextemplate|link]]}}
10994 !! html
10995 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10996 </p>
10997 !! end
10998
10999 !! test
11000 T2553: link with two variables in a piped link
11001 !! wikitext
11002 {|
11003 |[[{{{1}}}|{{{2}}}]]
11004 |}
11005 !! html/php
11006 <table>
11007 <tr>
11008 <td>[[{{{1}}}|{{{2}}}]]
11009 </td></tr></table>
11010
11011 !! html/parsoid
11012 <table>
11013 <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>
11014 </tbody></table>
11015 !! end
11016
11017 # See: T2553
11018 !! test
11019 Abort table cell attribute parsing on wikilink
11020 !! wikitext
11021 {|
11022 | testing [[one|two]] | three || four
11023 | testing one two | three || four
11024 | testing="[[one|two]]" | three || four
11025 |}
11026 !! html/php
11027 <table>
11028 <tr>
11029 <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>
11030 <td> four
11031 </td>
11032 <td> three </td>
11033 <td> four
11034 </td>
11035 <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>
11036 <td> four
11037 </td></tr></table>
11038
11039 !! html/parsoid
11040 <table>
11041 <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>
11042 <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>
11043 <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>
11044 </tbody></table>
11045 !! end
11046
11047 !! test
11048 Don't abort table cell attribute parsing if wikilink is found in template arg
11049 !! wikitext
11050 {|
11051 | Test {{#tag:ref|One two "[[three]]" four}}
11052 |}
11053 !! html/parsoid
11054 <table>
11055 <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>
11056 </tbody></table>
11057 !! end
11058
11059 !! test
11060 Magic variable as template parameter
11061 !! wikitext
11062 {{paramtest|param={{SITENAME}}}}
11063 !! html
11064 <p>This is a test template with parameter MediaWiki
11065 </p>
11066 !! end
11067
11068 !! article
11069 Template:linktest
11070 !! text
11071 [[{{{param}}}|link]]
11072 !! endarticle
11073
11074 !! test
11075 Template parameter as link source
11076 !! wikitext
11077 {{linktest|param=Main Page}}
11078 !! html
11079 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11080 </p>
11081 !! end
11082
11083 !!article
11084 Template:paramtest2
11085 !! text
11086 including another template, {{paramtest|param={{{arg}}}}}
11087 !! endarticle
11088
11089 !! test
11090 Template passing argument to another template
11091 !! wikitext
11092 {{paramtest2|arg='hmm'}}
11093 !! html
11094 <p>including another template, This is a test template with parameter 'hmm'
11095 </p>
11096 !! end
11097
11098 !! article
11099 Template:Linktest2
11100 !! text
11101 Main Page
11102 !! endarticle
11103
11104 !! test
11105 Template as link source
11106 !! wikitext
11107 [[{{linktest2}}]]
11108
11109 [[{{linktest2}}|Main Page]]
11110
11111 [[{{linktest2}}]]Page
11112 !! html
11113 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11114 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11115 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11116 </p>
11117 !! end
11118
11119
11120 !! article
11121 Template:loop1
11122 !! text
11123 {{loop2}}
11124 !! endarticle
11125
11126 !! article
11127 Template:loop2
11128 !! text
11129 {{loop1}}
11130 !! endarticle
11131
11132 !! test
11133 Template infinite loop
11134 !! wikitext
11135 {{loop1}}
11136 !! html
11137 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11138 </p>
11139 !! end
11140
11141 !! test
11142 Template from main namespace
11143 !! wikitext
11144 {{:Main Page}}
11145 !! html
11146 <p>blah blah
11147 </p>
11148 !! end
11149
11150 !! article
11151 Template:table
11152 !! text
11153 {|
11154 | 1 || 2
11155 |-
11156 | 3 || 4
11157 |}
11158 !! endarticle
11159
11160 !! test
11161 T2529: Template with table, not included at beginning of line
11162 !! wikitext
11163 foo {{table}}
11164 !! html
11165 <p>foo
11166 </p>
11167 <table>
11168 <tr>
11169 <td> 1 </td>
11170 <td> 2
11171 </td></tr>
11172 <tr>
11173 <td> 3 </td>
11174 <td> 4
11175 </td></tr></table>
11176
11177 !! end
11178
11179 !! test
11180 T2523: Template shouldn't eat newline (or add an extra one before table)
11181 !! wikitext
11182 foo
11183 {{table}}
11184 !! html
11185 <p>foo
11186 </p>
11187 <table>
11188 <tr>
11189 <td> 1 </td>
11190 <td> 2
11191 </td></tr>
11192 <tr>
11193 <td> 3 </td>
11194 <td> 4
11195 </td></tr></table>
11196
11197 !! end
11198
11199 !! test
11200 T2041: Template parameters shown as broken links
11201 !! wikitext
11202 {{{parameter}}}
11203 !! html
11204 <p>{{{parameter}}}
11205 </p>
11206 !! end
11207
11208 !! test
11209 Template with targets containing wikilinks
11210 !! wikitext
11211 {{[[foo]]}}
11212
11213 {{[[{{echo|foo}}]]}}
11214
11215 {{{{echo|[[foo}}]]}}
11216 !! html
11217 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11218 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11219 </p><p>{{[[foo}}]]
11220 </p>
11221 !! end
11222
11223 !! article
11224 Template:''
11225 !! text
11226 bar
11227 !! endarticle
11228
11229 !! test
11230 Templates: Double quotes as template target
11231 !! wikitext
11232 foo {{''}} baz
11233 !! html/php
11234 <p>foo bar baz
11235 </p>
11236 !! html/parsoid
11237 <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
11238 </p>
11239 !! end
11240
11241 ## This test is about making sure Parsoid's data-mw is well formed in the
11242 ## face of multiple templates with intersecting and overlapping ranges. The
11243 ## wikitext itself is wretched.
11244 !! test
11245 Templates with intersecting and overlapping ranges
11246 !! wikitext
11247 {|{{echo|
11248 <p>ha</p>}}
11249 {|{{echo|
11250 <p>ho</p>}}
11251 {{echo|{{!}}hi}}
11252 |}
11253 !! html/php+tidy
11254 <p>ha</p>
11255 <p>ho</p>
11256 <table>
11257 <tr>
11258 <td></td>
11259 </tr>
11260 <tr>
11261 <td>hi</td>
11262 </tr>
11263 </table>
11264 <table>
11265 <tr>
11266 <td></td>
11267 </tr>
11268 </table>
11269 !! html/parsoid
11270 <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":""}]]}'>
11271
11272 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11273
11274 <tbody><tr><td>hi</td></tr>
11275 </tbody></table>
11276 !! end
11277
11278 !! article
11279 Template:MSGNW test
11280 !! text
11281 ''None'' of '''this''' should be
11282 * interpreted
11283 but rather passed unmodified
11284 {{test}}
11285 <gallery>
11286 File:Foobar.jpg
11287 </gallery>
11288 <!-- comment -->
11289 !! endarticle
11290
11291 # hmm, fix this or just deprecate msgnw and document its behavior?
11292 !! test
11293 msgnw keyword
11294 !! wikitext
11295 {{msgnw:MSGNW test}}
11296 !! html/php
11297 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11298 &#42; interpreted
11299 &#32;but rather passed unmodified
11300 &#123;&#123;test&#125;&#125;
11301 &#60;gallery&#62;
11302 File:Foobar.jpg
11303 &#60;/gallery&#62;
11304 &#60;!-- comment --&#62;
11305 </p>
11306 !! end
11307
11308 !! test
11309 int keyword
11310 !! wikitext
11311 {{int:youhavenewmessages|lots of money|not!}}
11312 !! html
11313 <p>You have lots of money (not!).
11314 </p>
11315 !! end
11316
11317 !! test
11318 int keyword - non-existing message
11319 !! wikitext
11320 {{int:var}}
11321 !! html
11322 <p>⧼var⧽
11323 </p>
11324 !! end
11325
11326 !! article
11327 Template:Includes
11328 !! text
11329 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11330 !! endarticle
11331
11332 !! test
11333 <includeonly> and <noinclude> being included
11334 !! wikitext
11335 {{Includes}}
11336 !! html
11337 <p>Foobar
11338 </p>
11339 !! end
11340
11341 !! article
11342 Template:Includes2
11343 !! text
11344 <onlyinclude>Foo</onlyinclude>bar
11345 !! endarticle
11346
11347 !! test
11348 <onlyinclude> being included
11349 !! wikitext
11350 {{Includes2}}
11351 !! html
11352 <p>Foo
11353 </p>
11354 !! end
11355
11356
11357 !! article
11358 Template:Includes3
11359 !! text
11360 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11361 !! endarticle
11362
11363 !! test
11364 <onlyinclude> and <includeonly> being included
11365 !! wikitext
11366 {{Includes3}}
11367 !! html
11368 <p>Foo
11369 </p>
11370 !! end
11371
11372 !! test
11373 <includeonly> and <noinclude> on a page
11374 !! wikitext
11375 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11376 !! html
11377 <p>Foozar
11378 </p>
11379 !! end
11380
11381 !! test
11382 Un-closed <noinclude>
11383 !! wikitext
11384 <noinclude>
11385 !! html
11386 !! end
11387
11388 !! test
11389 <onlyinclude> on a page
11390 !! wikitext
11391 <onlyinclude>Foo</onlyinclude>bar
11392 !! html
11393 <p>Foobar
11394 </p>
11395 !! end
11396
11397 !! test
11398 Un-closed <onlyinclude>
11399 !! wikitext
11400 <onlyinclude>
11401 !! html
11402 !! end
11403
11404 !!test
11405 Self-closed noinclude, includeonly, onlyinclude tags
11406 !! wikitext
11407 <noinclude />
11408 <includeonly />
11409 <onlyinclude />
11410 !! html
11411 <p><br />
11412 </p>
11413 !!end
11414
11415 !!test
11416 Unbalanced includeonly and noinclude tags
11417 !! wikitext
11418 {|
11419 |a</noinclude>
11420 |b</noinclude></noinclude>
11421 |c</noinclude></includeonly>
11422 |d</includeonly></includeonly>
11423 |}
11424 !! html
11425 <table>
11426 <tr>
11427 <td>a
11428 </td>
11429 <td>b
11430 </td>
11431 <td>c&lt;/includeonly&gt;
11432 </td>
11433 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11434 </td></tr></table>
11435
11436 !!end
11437
11438 !! article
11439 Template:Includeonly section
11440 !! text
11441 <includeonly>
11442 ==Includeonly section==
11443 </includeonly>
11444 ==Section T-1==
11445 !!endarticle
11446
11447 !! test
11448 T8563: Edit link generation for section shown by <includeonly>
11449 !! wikitext
11450 {{includeonly section}}
11451 !! html
11452 <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>
11453 <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>
11454
11455 !! end
11456
11457 # Uses same input as the contents of [[Template:Includeonly section]]
11458 !! test
11459 T8563: Section extraction for section shown by <includeonly>
11460 !! options
11461 section=T-2
11462 !! wikitext
11463 <includeonly>
11464 ==Includeonly section==
11465 </includeonly>
11466 ==Section T-2==
11467 !! html
11468 ==Section T-2==
11469 !! end
11470
11471 !! test
11472 T8563: Edit link generation for section suppressed by <includeonly>
11473 !! wikitext
11474 <includeonly>
11475 ==Includeonly section==
11476 </includeonly>
11477 ==Section 1==
11478 !! html
11479 <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>
11480
11481 !! end
11482
11483 !! test
11484 T8563: Section extraction for section suppressed by <includeonly>
11485 !! options
11486 section=1
11487 !! wikitext
11488 <includeonly>
11489 ==Includeonly section==
11490 </includeonly>
11491 ==Section 1==
11492 !! html
11493 ==Section 1==
11494 !! end
11495
11496 !! test
11497 Un-closed <includeonly>
11498 !! wikitext
11499 <includeonly>
11500 !! html/php
11501 !! html/parsoid
11502 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11503 !! end
11504
11505 ## We used to, but no longer wt2wt this test since the default serializer
11506 ## will normalize the include directives to serialize on their own line.
11507 ## Selser will take care of preserving formatting in scenarios where they
11508 ## intermingled with other wikitext.
11509 !! test
11510 Includes and comments at SOL
11511 !! options
11512 parsoid=wt2html,html2html
11513 !! wikitext
11514 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11515
11516 <noinclude>
11517 some
11518 </noinclude>* stuff
11519 * here
11520
11521 <includeonly>can have stuff</includeonly>=== here ===
11522
11523 !! html/php
11524 <h2><span class="mw-headline" id="hu">hu</span></h2>
11525 <p>some
11526 </p>
11527 <ul><li> stuff</li>
11528 <li> here</li></ul>
11529 <h3><span class="mw-headline" id="here">here</span></h3>
11530
11531 !! html/parsoid
11532 <!-- 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>
11533
11534 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11535 <p>some</p>
11536 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11537 <li> here</li></ul>
11538
11539 <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>
11540
11541 !! end
11542
11543 # TODO: test with DOM fragment reuse!
11544 !! test
11545 Parsoid: DOM fragment reuse
11546 !! options
11547 parsoid=wt2wt,wt2html
11548 !! wikitext
11549 a{{echo|b<table></table>c}}d
11550
11551 a{{echo|b
11552 <table></table>
11553 c}}d
11554
11555 {{echo|a
11556
11557 <table></table>
11558
11559 b}}
11560 !! html
11561 <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>
11562
11563 <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">
11564 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11565 </span><p about="#mwt2">cd</p>
11566
11567 <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">
11568
11569 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11570
11571 </span><p about="#mwt3">b</p>
11572 !! end
11573
11574 !! test
11575 Parsoid: Merge double tds (T52603)
11576 !! options
11577 parsoid
11578 !! wikitext
11579 {|
11580 |{{echo|{{!}} foo}}
11581 |}
11582 !! html
11583 <table><tbody>
11584 <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>
11585 </tbody></table>
11586 !! end
11587
11588 !! test
11589 Parsoid: Merge double tds in nested transclusion content (T52603)
11590 !! options
11591 parsoid
11592 !! wikitext
11593 {{echo|<div>}}
11594 {|
11595 |{{echo|{{!}} foo}}
11596 |}
11597 {{echo|</div>}}
11598 !! html
11599 <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}}]}'>
11600 <table><tbody>
11601 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11602 </tbody></table>
11603 </div>
11604 !! end
11605
11606 ###
11607 ### <includeonly> and <noinclude> in attributes
11608 ###
11609 !!test
11610 0. includeonly around the entire attribute
11611 !! wikitext
11612 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11613 !! html
11614 <p><span id="v2">bar</span>
11615 </p>
11616 !!end
11617
11618 !!test
11619 1. includeonly in html attr key
11620 !! wikitext
11621 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11622 !! html
11623 <p><span id="foo">bar</span>
11624 </p>
11625 !!end
11626
11627 !!test
11628 2. includeonly in html attr value
11629 !! wikitext
11630 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11631 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11632 !! html
11633 <p><span id="v1">bar</span>
11634 <span id="v1">bar</span>
11635 </p>
11636 !!end
11637
11638 !!test
11639 3. includeonly in part of an attr value
11640 !! wikitext
11641 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11642 !! html
11643 <p><span style="color:red;">bar</span>
11644 </p>
11645 !!end
11646
11647 !!test
11648 4. includeonly in table attributes
11649 !! wikitext
11650 {|
11651 |- <noinclude>
11652 |-
11653 |a
11654 </noinclude>
11655 |- <includeonly>
11656 |-
11657 |b
11658 </includeonly>
11659 |}
11660 !! html
11661 <table>
11662
11663
11664 <tr>
11665 <td>a
11666 </td></tr>
11667 </table>
11668
11669 !!end
11670
11671 ###
11672 ### Token Stream Patcher tests
11673 ###
11674 ### These tests won't always pass wt2wt and other modes because
11675 ### on serialization, the table will be output on a new line.
11676 ### For now, we are blacklisting them, and using this to test selser.
11677 ###
11678
11679 !!test
11680 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11681 !!options
11682 parsoid=wt2html,wt2wt
11683 !!wikitext
11684 {{echo|}}{| width = '100%'
11685 |foo
11686 |}
11687 !!html/parsoid
11688 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11689 <tbody><tr><td>foo</td></tr>
11690 </tbody></table>
11691 !!end
11692
11693 ## We used to, but no longer wt2wt this test since the default serializer
11694 ## will normalize the include directives to serialize on their own line.
11695 ## Selser will take care of preserving formatting in scenarios where they
11696 ## intermingled with other wikitext.
11697 !!test
11698 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11699 !!options
11700 parsoid=wt2html
11701 !!wikitext
11702 <includeonly>a</includeonly>{| {{{b}}}
11703 |c
11704 |}
11705 !!html/parsoid
11706 <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":""}]]}'>
11707 <tbody><tr><td>c</td></tr>
11708 </tbody></table>
11709 !!end
11710
11711 !! test
11712 Table wikitext syntax outside wiki-tables
11713 !! wikitext
11714 a
11715 |+ not a caption
11716 ! not a table heading
11717 |- not a table row
11718 | not a table cell
11719 | class="foo bar" | baz
11720 b
11721 |}
11722 |-
11723 c
11724 !! html
11725 <p>a
11726 |+ not a caption
11727 ! not a table heading
11728 |- not a table row
11729 | not a table cell
11730 | class="foo bar" | baz
11731 b
11732 |}
11733 |-
11734 c
11735 </p>
11736 !! end
11737
11738 ###
11739 ### Testing parsing of templates where a template arg
11740 ### has the same name as the template itself.
11741 ###
11742
11743 !! article
11744 Template:quote
11745 !! text
11746 {{{quote|{{{1}}}}}}
11747 !! endarticle
11748
11749 !!test
11750 Templates: Template Name/Arg clash: 1. Use of positional param
11751 !! wikitext
11752 {{quote|foo}}
11753 !! html
11754 <p>foo
11755 </p>
11756 !!end
11757
11758 !!test
11759 Templates: Template Name/Arg clash: 2. Use of named param
11760 !! wikitext
11761 {{quote|quote=foo}}
11762 !! html
11763 <p>foo
11764 </p>
11765 !!end
11766
11767 !!test
11768 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11769 !! wikitext
11770 {{quote|quote}}
11771 !! html
11772 <p>quote
11773 </p>
11774 !!end
11775
11776 ###
11777 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11778 ###
11779
11780 !!test
11781 Templates: 1. Simple use
11782 !! wikitext
11783 {{echo|Foo}}
11784 !! html
11785 <p>Foo
11786 </p>
11787 !!end
11788
11789 !!test
11790 Templates: 2. Inside a block tag
11791 !! wikitext
11792 <div>{{echo|Foo}}</div>
11793 <blockquote>{{echo|Foo}}</blockquote>
11794 !! html
11795 <div>Foo</div>
11796 <blockquote>Foo</blockquote>
11797
11798 !! html+tidy
11799 <div>Foo</div>
11800 <blockquote>
11801 <p>Foo</p>
11802 </blockquote>
11803 !!end
11804
11805 !!test
11806 Templates: P-wrapping: 1a. Templates on consecutive lines
11807 !! wikitext
11808 {{echo|Foo}}
11809 {{echo|bar}}
11810 !! html
11811 <p>Foo
11812 bar
11813 </p>
11814 !!end
11815
11816 !!test
11817 Templates: P-wrapping: 1b. Templates on consecutive lines
11818 !! wikitext
11819 Foo
11820
11821 {{echo|bar}}
11822 {{echo|baz}}
11823 !! html
11824 <p>Foo
11825 </p><p>bar
11826 baz
11827 </p>
11828 !!end
11829
11830 !!test
11831 Templates: P-wrapping: 1c. Templates on consecutive lines
11832 !! wikitext
11833 {{echo|Foo}}
11834 {{echo|bar}} <div>baz</div>
11835 !! html
11836 <p>Foo
11837 </p>
11838 bar <div>baz</div>
11839
11840 !! html+tidy
11841 <p>Foo</p>
11842 <p>bar</p>
11843 <div>baz</div>
11844 !! end
11845
11846 !!test
11847 Templates: P-wrapping: 1d. Template preceded by comment-only line
11848 !!options
11849 parsoid
11850 !! wikitext
11851 <!-- foo -->
11852 {{echo|Bar}}
11853 !! html
11854 <!-- foo -->
11855
11856 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11857 !!end
11858
11859 !!test
11860 Templates: Inline Text: 1. Multiple template uses
11861 !! wikitext
11862 {{echo|Foo}}bar{{echo|baz}}
11863 !! html
11864 <p>Foobarbaz
11865 </p>
11866 !!end
11867
11868 !!test
11869 Templates: Inline Text: 2. Back-to-back template uses
11870 !! wikitext
11871 {{echo|Foo}}{{echo|bar}}
11872 !! html
11873 <p>Foobar
11874 </p>
11875 !!end
11876
11877 !!test
11878 Templates: Block Tags: 1. Multiple template uses
11879 !! wikitext
11880 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11881 !! html
11882 <div>Foo</div><div>bar</div><div>baz</div>
11883
11884 !!end
11885
11886 !!test
11887 Templates: Block Tags: 2. Back-to-back template uses
11888 !! wikitext
11889 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11890 !! html
11891 <div>Foo</div><div>bar</div>
11892
11893 !!end
11894
11895 # This is an edge case relating to paragraph wrapping.
11896 !!test
11897 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11898 !! wikitext
11899 {{echo|a
11900 b</p>}}
11901 !! html/parsoid
11902 <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
11903 b</p>
11904 !!end
11905
11906 !!test
11907 Templates: Links: 1. Simple example
11908 !! wikitext
11909 {{echo|[[Foo|bar]]}}
11910 !! html
11911 <p><a href="/wiki/Foo" title="Foo">bar</a>
11912 </p>
11913 !!end
11914
11915 !!test
11916 Templates: Links: 2. Generation of link href
11917 !! wikitext
11918 [[{{echo|Foo}}|bar]]
11919 !! html
11920 <p><a href="/wiki/Foo" title="Foo">bar</a>
11921 </p>
11922 !!end
11923
11924 !!test
11925 Templates: Links: 3. Generation of part of a link href
11926 !! wikitext
11927 [[Fo{{echo|o}}|bar]]
11928
11929 [[Foo{{echo|bar}}]]
11930
11931 [[Foo{{echo|bar}}baz]]
11932
11933 [[Foo{{echo|bar}}|bar]]
11934
11935 [[:Foo{{echo|bar}}]]
11936
11937 [[:Foo{{echo|bar}}|bar]]
11938 !! html
11939 <p><a href="/wiki/Foo" title="Foo">bar</a>
11940 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11941 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11942 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11943 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11944 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11945 </p>
11946 !!end
11947
11948 !!test
11949 Templates: Links: 4. Multiple templates generating link href
11950 !! wikitext
11951 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11952 !! html
11953 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11954 </p>
11955 !!end
11956
11957 !!test
11958 Templates: Links: 5. Generation of link text
11959 !! wikitext
11960 [[Foo|{{echo|bar}}]]
11961 !! html
11962 <p><a href="/wiki/Foo" title="Foo">bar</a>
11963 </p>
11964 !!end
11965
11966 !!test
11967 Templates: Links: 5. Nested templates (only outermost template should be marked)
11968 !! wikitext
11969 {{echo|[[{{echo|Foo}}|bar]]}}
11970 !! html
11971 <p><a href="/wiki/Foo" title="Foo">bar</a>
11972 </p>
11973 !!end
11974
11975 !!test
11976 Templates: HTML Tag: 1. Generation of HTML attr. key
11977 !! wikitext
11978 <div {{echo|style}}="color:red;">foo</div>
11979 !! html
11980 <div style="color:red;">foo</div>
11981
11982 !!end
11983
11984 !!test
11985 Templates: HTML Tag: 2. Generation of HTML attr. value
11986 !! wikitext
11987 <div style={{echo|'color:red;'}}>foo</div>
11988 !! html
11989 <div style="color:red;">foo</div>
11990
11991 !!end
11992
11993 !!test
11994 Templates: HTML Tag: 3. Generation of HTML attr key and value
11995 !! wikitext
11996 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11997 !! html
11998 <div style="color:red;">foo</div>
11999
12000 !!end
12001
12002 !!test
12003 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12004 !! wikitext
12005 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12006 !! html
12007 <div title="This is a long title with just one piece templated">foo</div>
12008
12009 !!end
12010
12011 !!test
12012 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12013 !! wikitext
12014 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12015 !! html
12016 <div title="This is a long title with just one piece templated">foo</div>
12017
12018 !!end
12019
12020 !!test
12021 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12022 !! wikitext
12023 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12024 !! html
12025 <div title="This is a long title with just one piece templated">foo</div>
12026
12027 !!end
12028
12029 # SSS FIXME: While it is great we added support for all this,
12030 # do we want to make this part of the spec? Maybe we want to
12031 # deprecate this kind of usage in the future?
12032 !!test
12033 Templates: HTML Tag: 7. Generation of partial attribute key string
12034 !! wikitext
12035 <div st{{echo|yle}}="color:red;">foo</div>
12036 !! html
12037 <div style="color:red;">foo</div>
12038
12039 !!end
12040
12041 !! test
12042 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12043 !! wikitext
12044 <div {{echo|1=id="v1"}}>bar</div>
12045 !! html
12046 <div id="v1">bar</div>
12047
12048 !!end
12049
12050 !! test
12051 Templates: HTML Tag: 9. Multiple template-generated attributes
12052 !! wikitext
12053 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12054 !! html
12055 <div id="v1" title="foo">bar</div>
12056
12057 !!end
12058
12059 !! test
12060 Templates: Support for templates generating attributes and content
12061 !! wikitext
12062 {| {{mixed_attr_content_template}}
12063 |-
12064 |bar
12065 |}
12066 !! html/php
12067 <table style="color:red;" title="T48811">
12068
12069 <tr>
12070 <td>foo
12071 </td></tr>
12072 <tr>
12073 <td>bar
12074 </td></tr></table>
12075
12076 !! html/parsoid
12077 <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|}"]}'>
12078 <tbody><tr>
12079 <td>foo</td></tr>
12080 <tr>
12081 <td>bar</td></tr>
12082 </tbody></table>
12083 !!end
12084
12085 !! test
12086 1. Entities and nowikis inside templated attributes should be handled correctly
12087 !! wikitext
12088 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12089 !! html/php
12090 <div style="background:#f9f9f9;">foo</div>
12091
12092 !! html/parsoid
12093 <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>
12094 !! end
12095
12096 !! test
12097 2. Entities and nowikis inside templated attributes should be handled correctly
12098 !! wikitext
12099 {|
12100 |{{table_attribs_3}}
12101 |}
12102 !! html/php
12103 <table>
12104 <tr>
12105 <td style="background:#f9f9f9;">Foo
12106 </td></tr></table>
12107
12108 !! html/parsoid
12109 <table>
12110 <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>
12111 </tbody></table>
12112 !! end
12113
12114 !! test
12115 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12116 !! wikitext
12117 {{tbl-start}}
12118 |{{table_attribs_3}}
12119 {{tbl-end}}
12120 !! html/php
12121 <table>
12122 <tr>
12123 <td style="background:#f9f9f9;">Foo
12124 </td></tr></table>
12125
12126 !! html/parsoid
12127 <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}}]}'>
12128 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12129 </tbody></table>
12130 !! end
12131
12132 # T107622
12133 !! test
12134 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12135 !! wikitext
12136 {|
12137 | {{table_attribs_6}} hi
12138 |}
12139 !! html/php
12140 <table>
12141 <tr>
12142 <td style="background: red;"> hi
12143 </td></tr></table>
12144
12145 !! html/parsoid
12146 <table>
12147 <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>
12148 </tbody></table>
12149 !! end
12150
12151 !!test
12152 Templates: HTML Tables: 1. Generating start of a HTML table
12153 !! wikitext
12154 {{echo|<table><tr><td>foo</td>}}</tr></table>
12155 !! html
12156 <table><tr><td>foo</td></tr></table>
12157
12158 !!end
12159
12160 !!test
12161 Templates: HTML Tables: 2a. Generating middle of a HTML table
12162 !! wikitext
12163 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12164 !! html
12165 <table><tr><td>foo</td></tr></table>
12166
12167 !!end
12168
12169 !!test
12170 Templates: HTML Tables: 2b. Generating middle of a HTML table
12171 !! wikitext
12172 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12173 !! html
12174 <table><tr><td>foo</td></tr></table>
12175
12176 !!end
12177
12178 !!test
12179 Templates: HTML Tables: 3. Generating end of a HTML table
12180 !! wikitext
12181 <table><tr>{{echo|<td>foo</td></tr></table>}}
12182 !! html
12183 <table><tr><td>foo</td></tr></table>
12184
12185 !!end
12186
12187 !!test
12188 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12189 !! wikitext
12190 {{echo|<table>}}<tr><td>foo</td></tr></table>
12191 !! html
12192 <table><tr><td>foo</td></tr></table>
12193
12194 !!end
12195
12196 !!test
12197 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12198 !! wikitext
12199 <table>{{echo|<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: 4c. Generating a single tag 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: 4d. Generating a single tag of a HTML table
12216 !! wikitext
12217 <table><tr><td>foo{{echo|</td>}}</tr></table>
12218 !! html
12219 <table><tr><td>foo</td></tr></table>
12220
12221 !!end
12222
12223 !!test
12224 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12225 !! wikitext
12226 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12227 !! html
12228 <table><tr><td>foo</td></tr></table>
12229
12230 !!end
12231
12232 !!test
12233 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12234 !! wikitext
12235 <table><tr><td>foo</td></tr>{{echo|</table>}}
12236 !! html
12237 <table><tr><td>foo</td></tr></table>
12238
12239 !!end
12240
12241 !!test
12242 Templates: HTML Tables: 5. Proper fostering of categories from inside
12243 !!options
12244 parsoid=wt2html,wt2wt
12245 !! wikitext
12246 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12247 <!--Two categories (T52330)-->
12248 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12249 !! html
12250 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12251 <!--Two categories (T52330)-->
12252 <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>
12253 !!end
12254
12255 !!test
12256 Templates: Wiki Tables: 1a. Fostering of entire template content
12257 !! wikitext
12258 {|
12259 {{echo|a}}
12260 |}
12261 !! html
12262 <table>
12263 a
12264 <tr><td></td></tr></table>
12265
12266 !! html+tidy
12267 <p>a</p>
12268 <table>
12269 <tr>
12270 <td></td>
12271 </tr>
12272 </table>
12273 !! end
12274
12275 !!test
12276 Templates: Wiki Tables: 1b. Fostering of entire template content
12277 !! wikitext
12278 {|
12279 {{echo|<div>}}
12280 foo
12281 {{echo|</div>}}
12282 |}
12283 !! html
12284 <table>
12285 <div>
12286 <p>foo
12287 </p>
12288 </div>
12289 <tr><td></td></tr></table>
12290
12291 !! html+tidy
12292 <div>
12293 <p>foo</p>
12294 </div>
12295 <table>
12296 <tr>
12297 <td></td>
12298 </tr>
12299 </table>
12300 !! end
12301
12302 !!test
12303 Templates: Wiki Tables: 2. Fostering of partial template content
12304 !! wikitext
12305 {|
12306 {{echo|a
12307 <div>b</div>}}
12308 |}
12309 !! html
12310 <table>
12311 a
12312 <div>b</div>
12313 <tr><td></td></tr></table>
12314
12315 !! html+tidy
12316 <p>a</p>
12317 <div>b</div>
12318 <table>
12319 <tr>
12320 <td></td>
12321 </tr>
12322 </table>
12323 !! end
12324
12325 !!test
12326 Templates: Wiki Tables: 3. td-content via multiple templates
12327 !! wikitext
12328 {|
12329 {{echo|{{pipe}}a}}{{echo|b}}
12330 |}
12331 !! html
12332 <table>
12333 <tr>
12334 <td>ab
12335 </td></tr></table>
12336
12337 !!end
12338
12339 !!test
12340 Templates: Wiki Tables: 4. Templated tags, no content
12341 !! wikitext
12342 {{tbl-start}}
12343 {{tbl-end}}
12344 !! html
12345 <table>
12346 <tr><td></td></tr></table>
12347
12348 !!end
12349
12350 !!test
12351 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12352 !! wikitext
12353 {{tbl-start}}
12354 |foo
12355 {{tbl-end}}
12356 !! html
12357 <table>
12358 <tr>
12359 <td>foo
12360 </td></tr></table>
12361
12362 !!end
12363
12364 !!test
12365 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12366 !! wikitext
12367 {{tbl-start}}
12368 {{!}}foo
12369 {{tbl-end}}
12370 !! html
12371 <table>
12372 <tr>
12373 <td>foo
12374 </td></tr></table>
12375
12376 !!end
12377
12378 ## This test case is very specific to Parsoid's internals
12379 ## and is hence only tested for Parsoid's code. Parsoid uses
12380 ## a <meta> marker tag for <ref> tags and they are expanded
12381 ## much later. We are verifying that this <meta> tag usage
12382 ## doesn't prevent foster parenting.
12383 !!test
12384 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12385 !!wikitext
12386 {{PartialTable}}<ref>foo</ref>
12387 |}
12388
12389 <references />
12390 !!html/parsoid
12391 <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">
12392 <tbody>
12393 </tbody></table>
12394
12395 <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>
12396 !!end
12397
12398 !! test
12399 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12400 !! wikitext
12401 {{echo|
12402 {{{!}}
12403 {{!}}-}}
12404 <onlyinclude>
12405 |foo
12406 </onlyinclude>
12407 {{!}}}
12408 !! html/parsoid
12409 <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{{!}}}"]}'>
12410 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12411 <tbody><tr>
12412
12413 <td>foo
12414 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12415 </tbody></table>
12416 !! end
12417
12418 !!test
12419 Templates: Lists: Multi-line list-items via templates
12420 !! wikitext
12421 *{{echo|a {{nonexistent|
12422 unused}}}}
12423 *{{echo|b {{nonexistent|
12424 unused}}}}
12425 !! html
12426 <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>
12427 <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>
12428
12429 !!end
12430
12431 !!test
12432 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12433 !! wikitext
12434 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12435 !! html
12436 <p><i>ab</i>c<i>d</i>e
12437 </p>
12438 !!end
12439
12440 !!test
12441 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12442 (PHP parser generates misnested html)
12443 !! wikitext
12444 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12445 !! html/parsoid
12446 <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>
12447 !!end
12448
12449 !!test
12450 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12451 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12452 !! options
12453 parsoid=wt2html,wt2wt
12454 !! wikitext
12455 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12456 !! html
12457 <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>
12458 <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>
12459 <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>
12460 !!end
12461
12462 !!test
12463 Templates: Ugly nesting: 4. Divs opened/closed across templates
12464 !! wikitext
12465 a<div>b{{echo|c</div>d}}e
12466 !! html
12467 a<div>bc</div>de
12468
12469 !! html+tidy
12470 <p>a</p>
12471 <div>bc</div>
12472 <p>de</p>
12473 !! end
12474
12475 !!test
12476 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12477 (Parsoid-centric)
12478 !! options
12479 parsoid
12480 !! wikitext
12481 {|
12482 |{{echo|foo</table>}}
12483 |bar
12484 |}
12485 !! html
12486 <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|}"]}'>
12487
12488 <tbody>
12489 <tr>
12490 <td>foo</td></tr></tbody></table><span about="#mwt1">
12491 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12492 |}</span>
12493 !!end
12494
12495 !!test
12496 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12497 (Parsoid-centric)
12498 !! options
12499 parsoid
12500 !! wikitext
12501 <table>
12502 <tr>
12503 <td>
12504 <table>
12505 <tr>
12506 <td>1. {{echo|foo </table>}}</td>
12507 <td> bar </td>
12508 <td>2. {{echo|baz </table>}}</td>
12509 </tr>
12510 <tr>
12511 <td>abc</td>
12512 </tr>
12513 </table>
12514 </td>
12515 </tr>
12516 <tr>
12517 <td>xyz</td>
12518 </tr>
12519 </table>
12520 !! html
12521 <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>"]}'>
12522 <tbody><tr>
12523 <td>
12524 <table>
12525 <tbody><tr>
12526 <td>1. foo </td></tr></tbody></table></td>
12527 <td> bar </td>
12528 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12529 </span><span about="#mwt2">
12530 </span><span about="#mwt2">
12531 </span><span about="#mwt2">abc</span><span about="#mwt2">
12532 </span><span about="#mwt2">
12533 </span><span about="#mwt2">
12534 </span><span about="#mwt2">
12535 </span><span about="#mwt2">
12536 </span><span about="#mwt2">
12537 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12538 </span><span about="#mwt2">
12539 </span>
12540 !!end
12541
12542 !! test
12543 Templates: Ugly templates: 3. newline-only template parameter
12544 !! wikitext
12545 foo {{echo|
12546 }}
12547 !! html
12548 <p>foo
12549 </p>
12550 !! end
12551
12552 # This looks like a bug: a single newline triggers p/br for some reason.
12553 !! test
12554 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12555 !! wikitext
12556 {{echo|
12557 }}
12558 !! html
12559 <p><br />
12560 </p>
12561 !! end
12562
12563 # T66017 -- ugly wikitext with fostered content generates two template ranges that
12564 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12565 !! test
12566 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12567 !! wikitext
12568 {{echo|<table>}}
12569 {{echo|<div>foo}}
12570 {{echo|</table>}}
12571 !! html/parsoid
12572 <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
12573 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12574 </table>
12575 !! end
12576
12577 # T66017 -- ugly wikitext with fostered content generates two template ranges
12578 # that are "identical" and generate nesting cycles in the algorithm
12579 !! test
12580 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12581 !! wikitext
12582 {{echo|<table><tr><td><table>}}
12583 {{echo|<div>}}
12584 {{echo|</div>}}
12585 !! html/parsoid
12586 <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"}'>
12587 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12588 </table></td></tr></tbody></table>
12589 !! end
12590
12591 !! test
12592 Templates: Parameters substituted at the top-level
12593 !! wikitext
12594 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12595
12596 {{{foo|bar|baz}}}
12597 !! html/php
12598 <p><i>who</i> me? <b>never!</b>
12599 </p><p>bar
12600 </p>
12601 !! html/parsoid
12602 <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>
12603
12604 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
12605 !! end
12606
12607 !!test
12608 Parser Functions: 1. Simple example
12609 !! wikitext
12610 {{uc:foo}}
12611 !! html
12612 <p>FOO
12613 </p>
12614 !!end
12615
12616 !!test
12617 Parser Functions: 2. Nested use (only outermost should be marked up)
12618 !! wikitext
12619 {{uc:{{lc:FOO}}}}
12620 !! html
12621 <p>FOO
12622 </p>
12623 !!end
12624
12625 ###
12626 ### Pre-save transform tests
12627 ###
12628 !! test
12629 pre-save transform: subst:
12630 !! options
12631 pst
12632 !! wikitext
12633 {{subst:test}}
12634 !! html/php
12635 This is a test template
12636 !! end
12637
12638 !! test
12639 pre-save transform: normal template
12640 !! options
12641 pst
12642 !! wikitext
12643 {{test}}
12644 !! html/php
12645 {{test}}
12646 !! end
12647
12648 !! test
12649 pre-save transform: nonexistent template
12650 !! options
12651 pst
12652 !! wikitext
12653 {{thistemplatedoesnotexist}}
12654 !! html/php
12655 {{thistemplatedoesnotexist}}
12656 !! end
12657
12658 !! test
12659 pre-save transform: subst magic variables
12660 !! options
12661 pst
12662 !! wikitext
12663 {{subst:SITENAME}}
12664 !! html/php
12665 MediaWiki
12666 !! end
12667
12668 # This is T2089, which I fixed. -- wtm
12669 !! test
12670 pre-save transform: subst: templates with parameters
12671 !! options
12672 pst
12673 !! wikitext
12674 {{subst:paramtest|param="something else"}}
12675 !! html/php
12676 This is a test template with parameter "something else"
12677 !! end
12678
12679 !! article
12680 Template:nowikitest
12681 !! text
12682 <nowiki>'''not wiki'''</nowiki>
12683 !! endarticle
12684
12685 !! test
12686 pre-save transform: nowiki in subst (T3188)
12687 !! options
12688 pst
12689 !! wikitext
12690 {{subst:nowikitest}}
12691 !! html/php
12692 <nowiki>'''not wiki'''</nowiki>
12693 !! end
12694
12695 !! article
12696 Template:commenttest
12697 !! text
12698 This template has <!-- a comment --> in it.
12699 !! endarticle
12700
12701 !! test
12702 pre-save transform: comment in subst (T3936)
12703 !! options
12704 pst
12705 !! wikitext
12706 {{subst:commenttest}}
12707 !! html/php
12708 This template has <!-- a comment --> in it.
12709 !! end
12710
12711 !! test
12712 pre-save transform: unclosed tag
12713 !! options
12714 pst
12715 !! wikitext
12716 <nowiki>'''not wiki'''
12717 !! html/php
12718 <nowiki>'''not wiki'''
12719 !! end
12720
12721 !! test
12722 pre-save transform: mixed tag case
12723 !! options
12724 pst
12725 !! wikitext
12726 <NOwiki>'''not wiki'''</noWIKI>
12727 !! html/php
12728 <NOwiki>'''not wiki'''</noWIKI>
12729 !! end
12730
12731 !! test
12732 pre-save transform: unclosed comment in <nowiki>
12733 !! options
12734 pst
12735 !! wikitext
12736 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12737 !! html/php
12738 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12739 !!end
12740
12741 # Leading @ in this template definition works around a limitation
12742 # in parsoid's parserTests which otherwise strips the <span> from the
12743 # result (confusing it for a template wrapper)
12744 !! article
12745 Template:dangerous
12746 !!text
12747 @<span onmouseover="alert('crap')">Oh no</span>
12748 !!endarticle
12749
12750 !!test
12751 (confirming safety of fix for subst T3936)
12752 !! wikitext
12753 {{Template:dangerous}}
12754 !! html
12755 <p>@<span>Oh no</span>
12756 </p>
12757 !! end
12758
12759 !! test
12760 pre-save transform: comment containing gallery (T7024)
12761 !! options
12762 pst
12763 !! wikitext
12764 <!-- <gallery>data</gallery> -->
12765 !! html/php
12766 <!-- <gallery>data</gallery> -->
12767 !!end
12768
12769 !! test
12770 pre-save transform: comment containing extension
12771 !! options
12772 pst
12773 !! wikitext
12774 <!-- <tag>data</tag> -->
12775 !! html/php
12776 <!-- <tag>data</tag> -->
12777 !!end
12778
12779 !! test
12780 pre-save transform: comment containing nowiki
12781 !! options
12782 pst
12783 !! wikitext
12784 <!-- <nowiki>data</nowiki> -->
12785 !! html/php
12786 <!-- <nowiki>data</nowiki> -->
12787 !!end
12788
12789 !! test
12790 pre-save transform: <noinclude> in subst (T5298)
12791 !! options
12792 pst
12793 !! wikitext
12794 {{subst:Includes}}
12795 !! html/php
12796 Foobar
12797 !! end
12798
12799 !! test
12800 pre-save transform: <onlyinclude> in subst (T5298)
12801 !! options
12802 pst
12803 !! wikitext
12804 {{subst:Includes2}}
12805 !! html/php
12806 Foo
12807 !! end
12808
12809 !! article
12810 Template:SubstTest
12811 !!text
12812 {{<includeonly>subst:</includeonly>Includes}}
12813 !! endarticle
12814
12815 !! article
12816 Template:SafeSubstTest
12817 !! text
12818 {{<includeonly>safesubst:</includeonly>Includes}}
12819 !! endarticle
12820
12821 !! test
12822 T24297: safesubst: works during PST
12823 !! options
12824 pst
12825 !! wikitext
12826 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12827 !! html/php
12828 FoobarFoobar
12829 !! end
12830
12831 !! test
12832 T24297: safesubst: works during normal parse
12833 !! wikitext
12834 {{SafeSubstTest}}
12835 !! html
12836 <p>Foobar
12837 </p>
12838 !! end
12839
12840 !! test
12841 subst: does not work during normal parse
12842 !! wikitext
12843 {{SubstTest}}
12844 !! html
12845 <p>{{subst:Includes}}
12846 </p>
12847 !! end
12848
12849 !! test
12850 pre-save transform: context links ("pipe trick")
12851 !! options
12852 pst
12853 !! wikitext
12854 [[Article (context)|]]
12855 [[Bar:Article|]]
12856 [[:Bar:Article|]]
12857 [[Bar:Article (context)|]]
12858 [[:Bar:Article (context)|]]
12859 [[|Article]]
12860 [[|Article (context)]]
12861 [[Bar:X (Y) Z|]]
12862 [[:Bar:X (Y) Z|]]
12863 !! html/php
12864 [[Article (context)|Article]]
12865 [[Bar:Article|Article]]
12866 [[:Bar:Article|Article]]
12867 [[Bar:Article (context)|Article]]
12868 [[:Bar:Article (context)|Article]]
12869 [[Article]]
12870 [[Article (context)]]
12871 [[Bar:X (Y) Z|X (Y) Z]]
12872 [[:Bar:X (Y) Z|X (Y) Z]]
12873 !! end
12874
12875 !! test
12876 pre-save transform: context links ("pipe trick") with interwiki prefix
12877 !! options
12878 pst
12879 !! wikitext
12880 [[interwiki:Article|]]
12881 [[:interwiki:Article|]]
12882 [[interwiki:Bar:Article|]]
12883 [[:interwiki:Bar:Article|]]
12884 !! html/php
12885 [[interwiki:Article|Article]]
12886 [[:interwiki:Article|Article]]
12887 [[interwiki:Bar:Article|Bar:Article]]
12888 [[:interwiki:Bar:Article|Bar:Article]]
12889 !! end
12890
12891 !! test
12892 pre-save transform: context links ("pipe trick") with parens in title
12893 !! options
12894 pst title=[[Somearticle (context)]]
12895 !! wikitext
12896 [[|Article]]
12897 !! html/php
12898 [[Article (context)|Article]]
12899 !! end
12900
12901 !! test
12902 pre-save transform: context links ("pipe trick") with comma in title
12903 !! options
12904 pst title=[[Someplace, Somewhere]]
12905 !! wikitext
12906 [[|Otherplace]]
12907 [[Otherplace, Elsewhere|]]
12908 [[Otherplace, Elsewhere, Anywhere|]]
12909 !! html/php
12910 [[Otherplace, Somewhere|Otherplace]]
12911 [[Otherplace, Elsewhere|Otherplace]]
12912 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12913 !! end
12914
12915 !! test
12916 pre-save transform: context links ("pipe trick") with parens and comma
12917 !! options
12918 pst title=[[Someplace (IGNORED), Somewhere]]
12919 !! wikitext
12920 [[|Otherplace]]
12921 [[Otherplace (place), Elsewhere|]]
12922 !! html/php
12923 [[Otherplace, Somewhere|Otherplace]]
12924 [[Otherplace (place), Elsewhere|Otherplace]]
12925 !! end
12926
12927 !! test
12928 pre-save transform: context links ("pipe trick") with comma and parens
12929 !! options
12930 pst title=[[Who, me? (context)]]
12931 !! wikitext
12932 [[|Yes, you.]]
12933 [[Me, Myself, and I (1937 song)|]]
12934 !! html/php
12935 [[Yes, you. (context)|Yes, you.]]
12936 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12937 !! end
12938
12939 !! test
12940 pre-save transform: context links ("pipe trick") with namespace
12941 !! options
12942 pst title=[[Ns:Somearticle]]
12943 !! wikitext
12944 [[|Article]]
12945 !! html/php
12946 [[Ns:Article|Article]]
12947 !! end
12948
12949 !! test
12950 pre-save transform: context links ("pipe trick") with namespace and parens
12951 !! options
12952 pst title=[[Ns:Somearticle (context)]]
12953 !! wikitext
12954 [[|Article]]
12955 !! html/php
12956 [[Ns:Article (context)|Article]]
12957 !! end
12958
12959 !! test
12960 pre-save transform: context links ("pipe trick") with namespace and comma
12961 !! options
12962 pst title=[[Ns:Somearticle, Context, Whatever]]
12963 !! wikitext
12964 [[|Article]]
12965 !! html/php
12966 [[Ns:Article, Context, Whatever|Article]]
12967 !! end
12968
12969 !! test
12970 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12971 !! options
12972 pst title=[[Ns:Somearticle, Context (context)]]
12973 !! wikitext
12974 [[|Article]]
12975 !! html/php
12976 [[Ns:Article (context)|Article]]
12977 !! end
12978
12979 !! test
12980 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12981 !! options
12982 pst title=[[Ns:Somearticle (IGNORED), Context]]
12983 !! wikitext
12984 [[|Article]]
12985 !! html/php
12986 [[Ns:Article, Context|Article]]
12987 !! end
12988
12989 !! test
12990 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
12991 !! options
12992 pst
12993 !! wikitext
12994 [[Article(context)|]]
12995 [[Bar:Article(context)|]]
12996 [[:Bar:Article(context)|]]
12997 [[|Article(context)]]
12998 [[Bar:X(Y)Z|]]
12999 [[:Bar:X(Y)Z|]]
13000 !! html/php
13001 [[Article(context)|Article]]
13002 [[Bar:Article(context)|Article]]
13003 [[:Bar:Article(context)|Article]]
13004 [[Article(context)]]
13005 [[Bar:X(Y)Z|X(Y)Z]]
13006 [[:Bar:X(Y)Z|X(Y)Z]]
13007 !! end
13008
13009 !! test
13010 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13011 !! options
13012 pst
13013 !! wikitext
13014 [[Article (context)|]]
13015 [[Bar:Article (context)|]]
13016 [[:Bar:Article (context)|]]
13017 [[|Article (context)]]
13018 [[Bar:X (Y) Z|]]
13019 [[:Bar:X (Y) Z|]]
13020 !! html/php
13021 [[Article (context)|Article]]
13022 [[Bar:Article (context)|Article]]
13023 [[:Bar:Article (context)|Article]]
13024 [[Article (context)]]
13025 [[Bar:X (Y) Z|X (Y) Z]]
13026 [[:Bar:X (Y) Z|X (Y) Z]]
13027 !! end
13028
13029 !! test
13030 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13031 !! options
13032 pst
13033 !! wikitext
13034 [[Article(context)|]]
13035 [[Bar:Article(context)|]]
13036 [[:Bar:Article(context)|]]
13037 [[|Article(context)]]
13038 [[Bar:X(Y)Z|]]
13039 [[:Bar:X(Y)Z|]]
13040 !! html/php
13041 [[Article(context)|Article]]
13042 [[Bar:Article(context)|Article]]
13043 [[:Bar:Article(context)|Article]]
13044 [[Article(context)]]
13045 [[Bar:X(Y)Z|X(Y)Z]]
13046 [[:Bar:X(Y)Z|X(Y)Z]]
13047 !! end
13048
13049 !! test
13050 pre-save transform: context links ("pipe trick") with commas (T23660)
13051 !! options
13052 pst
13053 !! wikitext
13054 [[Article (context), context|]]
13055 [[Article (context),context|]]
13056 [[Bar:Article (context), context|]]
13057 [[Bar:Article (context),context|]]
13058 [[:Bar:Article (context), context|]]
13059 [[:Bar:Article (context),context|]]
13060 !! html/php
13061 [[Article (context), context|Article]]
13062 [[Article (context),context|Article]]
13063 [[Bar:Article (context), context|Article]]
13064 [[Bar:Article (context),context|Article]]
13065 [[:Bar:Article (context), context|Article]]
13066 [[:Bar:Article (context),context|Article]]
13067 !! end
13068
13069 !! test
13070 pre-save transform: trim trailing empty lines
13071 !! options
13072 pst
13073 !! wikitext
13074 Empty lines are trimmed
13075
13076
13077
13078
13079 !! html/php
13080 Empty lines are trimmed
13081 !! end
13082
13083 !! test
13084 pre-save transform: Signature expansion
13085 !! options
13086 pst
13087 !! wikitext
13088 * ~~~
13089 * <noinclude>~~~</noinclude>
13090 * <includeonly>~~~</includeonly>
13091 * <onlyinclude>~~~</onlyinclude>
13092 !! html/php
13093 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13094 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13095 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13096 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13097 !! end
13098
13099
13100 !! test
13101 pre-save transform: Signature expansion in nowiki tags (T2093)
13102 !! options
13103 pst disabled
13104 !! wikitext
13105 Shall not expand:
13106
13107 <nowiki>~~~~</nowiki>
13108
13109 <includeonly><nowiki>~~~~</nowiki></includeonly>
13110
13111 <noinclude><nowiki>~~~~</nowiki></noinclude>
13112
13113 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13114
13115 {{subst:Foo}} shall be converted to FOO
13116
13117 As well as inside noinclude/onlyinclude
13118 <noinclude>{{subst:Foo}}</noinclude>
13119 <onlyinclude>{{subst:Foo}}</onlyinclude>
13120
13121 But not inside includeonly
13122 <includeonly>{{subst:Foo}}</includeonly>
13123 !! html/php
13124 Shall not expand:
13125
13126 <nowiki>~~~~</nowiki>
13127
13128 <includeonly><nowiki>~~~~</nowiki></includeonly>
13129
13130 <noinclude><nowiki>~~~~</nowiki></noinclude>
13131
13132 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13133
13134 FOO shall be converted to FOO
13135
13136 As well as inside noinclude/onlyinclude
13137 <noinclude>FOO</noinclude>
13138 <onlyinclude>FOO</onlyinclude>
13139
13140 But not inside includeonly
13141 <includeonly>{{subst:Foo}}</includeonly>
13142 !! end
13143
13144 !! test
13145 Parsoid: Recognize nowiki with trailing space in tags
13146 !! options
13147 parsoid=wt2html
13148 !! wikitext
13149 <nowiki ><div>[[foo]]</nowiki >
13150
13151 a<nowiki / >b
13152
13153 c<nowiki />d
13154
13155 e<nowiki/ >f
13156 !! html
13157 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13158 <p>ab</p>
13159 <p>cd</p>
13160 <p>ef</p>
13161 !! end
13162
13163 !! test
13164 Parsoid: Recognize nowiki with odd capitalization
13165 !! options
13166 parsoid=wt2html
13167 !! wikitext
13168 <noWikI ><div>[[foo]]</Nowiki >
13169 !! html
13170 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13171 !! end
13172
13173
13174 !! test
13175 Parsoid: Escape nowiki with trailing space in tags
13176 !! options
13177 parsoid=html2wt
13178 !! html/parsoid
13179 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13180 <p>a&lt;nowiki /&gt;b</p>
13181 <p>c&lt;nowiki/ &gt;d</p>
13182 !! wikitext
13183 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13184
13185 a&lt;nowiki /&gt;b
13186
13187 c&lt;nowiki/ &gt;d
13188 !! end
13189
13190 !! test
13191 Parsoid: Escape weird noWikI capitalizations
13192 !! options
13193 parsoid=html2wt
13194 !! html/parsoid
13195 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13196 !! wikitext
13197 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13198 !! end
13199
13200 ###
13201 ### Message transform tests
13202 ###
13203 !! test
13204 message transform: magic variables
13205 !! options
13206 msg
13207 !! wikitext
13208 {{SITENAME}}
13209 !! html
13210 MediaWiki
13211 !! end
13212
13213 !! test
13214 message transform: should not transform wiki markup
13215 !! options
13216 msg
13217 !! wikitext
13218 ''test''
13219 !! html
13220 ''test''
13221 !! end
13222
13223 !! test
13224 message transform: <noinclude> in transcluded template (T6926)
13225 !! options
13226 msg
13227 !! wikitext
13228 {{Includes}}
13229 !! html
13230 Foobar
13231 !! end
13232
13233 !! test
13234 message transform: <onlyinclude> in transcluded template (T6926)
13235 !! options
13236 msg
13237 !! wikitext
13238 {{Includes2}}
13239 !! html
13240 Foo
13241 !! end
13242
13243 !! test
13244 {{#special:}} page name, known
13245 !! options
13246 msg
13247 !! wikitext
13248 {{#special:Recentchanges}}
13249 !! html
13250 Special:RecentChanges
13251 !! end
13252
13253 !! test
13254 {{#special:}} page name with subpage, known
13255 !! options
13256 msg
13257 !! wikitext
13258 {{#special:Recentchanges/param}}
13259 !! html
13260 Special:RecentChanges/param
13261 !! end
13262
13263 !! test
13264 {{#special:}} page name, unknown
13265 !! options
13266 msg
13267 !! wikitext
13268 {{#special:foobar nonexistent}}
13269 !! html
13270 Special:Foobar nonexistent
13271 !! end
13272
13273 !! test
13274 {{#speciale:}} page name, known
13275 !! options
13276 msg
13277 !! wikitext
13278 {{#speciale:Recentchanges}}
13279 !! html
13280 Special:RecentChanges
13281 !! end
13282
13283 !! test
13284 {{#speciale:}} page name with subpage, known
13285 !! options
13286 msg
13287 !! wikitext
13288 {{#speciale:Recentchanges/param}}
13289 !! html
13290 Special:RecentChanges/param
13291 !! end
13292
13293 !! test
13294 {{#speciale:}} page name, unknown
13295 !! options
13296 msg
13297 !! wikitext
13298 {{#speciale:foobar nonexistent}}
13299 !! html
13300 Special:Foobar_nonexistent
13301 !! end
13302
13303 ###
13304 ### Images
13305 ###
13306 ### For Parsoid-specific tests, see
13307 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13308
13309 !! test
13310 Simple image
13311 !! options
13312 parsoid=wt2html,wt2wt,html2html
13313 !! wikitext
13314 [[Image:foobar.jpg]]
13315 !! html/php
13316 <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>
13317 </p>
13318 !! html/parsoid
13319 <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>
13320 !! end
13321
13322 !! test
13323 Simple image (using File: namespace, now canonical)
13324 !! wikitext
13325 [[File:Foobar.jpg]]
13326 !! html/php
13327 <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>
13328 </p>
13329 !! html/parsoid
13330 <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>
13331 !! end
13332
13333 !! test
13334 Right-aligned image
13335 !! wikitext
13336 [[File:Foobar.jpg|right]]
13337 !! html/php
13338 <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>
13339
13340 !! html/parsoid
13341 <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>
13342 !! end
13343
13344 !! test
13345 Image with caption
13346 !! wikitext
13347 [[File:Foobar.jpg|right|Caption text]]
13348 !! html/php
13349 <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>
13350
13351 !! html/parsoid
13352 <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>
13353 !! end
13354
13355 !! test
13356 Image with caption, T55312 #1
13357 !! wikitext
13358 [[File:Foobar.jpg|right|Caption page stuff]]
13359 !! html/php
13360 <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>
13361
13362 !! html/parsoid
13363 <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>
13364 !! end
13365
13366 !! test
13367 Image with caption, T55312 #2
13368 !! wikitext
13369 [[File:Foobar.jpg|right|Caption page=]]
13370 !! html/php
13371 <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>
13372
13373 !! html/parsoid
13374 <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>
13375 !! end
13376
13377 !! test
13378 Image with caption, T55312 #3
13379 !! wikitext
13380 [[File:Foobar.jpg|right|Caption page=stuff]]
13381 !! html/php
13382 <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>
13383
13384 !! html/parsoid
13385 <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>
13386 !! end
13387
13388 !! test
13389 Allow empty links in image captions (T62753)
13390 !! options
13391 thumbsize=220
13392 !! wikitext
13393 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13394 [[]]
13395 [[Link2]]
13396 ]]
13397 !! html/php
13398 <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>
13399
13400 !! html/parsoid
13401 <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>
13402 [[]]
13403 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13404 </figcaption></figure>
13405 !! end
13406
13407 !! test
13408 Titles in unlinked images (T23454)
13409 !! wikitext
13410 [[File:Foobar.jpg|link=|stuff]]
13411 !! html/php
13412 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13413 </p>
13414 !! end
13415
13416 !! test
13417 Link with empty target
13418 !! wikitext
13419 [[]]
13420 !! html
13421 <p>[[]]
13422 </p>
13423 !! end
13424
13425 !! test
13426 Image with link trail
13427 !! wikitext
13428 Linktrails should not work for images: [[File:Foobar.jpg]]s
13429 !! html/php
13430 <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
13431 </p>
13432 !! html/parsoid
13433 <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>
13434 !! end
13435
13436 !! test
13437 Image with empty attribute
13438 !! options
13439 parsoid=wt2html,wt2wt,html2html
13440 !! wikitext
13441 [[File:Foobar.jpg|right||Caption text]]
13442 !! html/php
13443 <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>
13444
13445 !! html/parsoid
13446 <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>
13447 !! end
13448
13449 !! test
13450 1. Block image with individual attributes from templates
13451 !! wikitext
13452 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13453 !! html/php
13454 <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>
13455
13456 !! html/parsoid
13457 <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>
13458 !! end
13459
13460 !! test
13461 2. Block Image with individual attributes from templates
13462 !! wikitext
13463 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13464 !! html/php
13465 <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>
13466
13467 !! html/parsoid
13468 <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>
13469 !! end
13470
13471 !! test
13472 3. Inline image with individual attributes from templates
13473 !! wikitext
13474 [[File:Foobar.jpg|{{echo|50px}}]]
13475 !! html/php
13476 <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>
13477 </p>
13478 !! html/parsoid
13479 <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>
13480 !! end
13481
13482 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13483 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13484 !! test
13485 Image with multiple attributes from the same template
13486 !! wikitext
13487 [[File:Foobar.jpg|{{image_attribs}}]]
13488 !! html/php
13489 <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>
13490
13491 !! html/parsoid
13492 <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>
13493 !! end
13494
13495 !! test
13496 Image with link tails
13497 !! options
13498 thumbsize=220
13499 !! wikitext
13500 123[[File:Foobar.jpg]]456
13501 123[[File:Foobar.jpg|right]]456
13502 123[[File:Foobar.jpg|thumb]]456
13503 !! html/php
13504 <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
13505 </p>
13506 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
13507 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
13508
13509 !! html/php+tidy
13510 <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>
13511 <p>123</p>
13512 <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>
13513 <p>456 123</p>
13514 <div class="thumb tright">
13515 <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>
13516 <div class="thumbcaption">
13517 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13518 </div>
13519 </div>
13520 </div>
13521 <p>456</p>
13522 !! html/parsoid
13523 <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>
13524 <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>
13525 <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>
13526 !! end
13527
13528 !! test
13529 Image with multiple captions -- only last one is accepted
13530 !! wikitext
13531 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13532 !! html/php
13533 <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>
13534
13535 !! html/parsoid
13536 <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>
13537 !! end
13538
13539 !! test
13540 Image with multiple widths -- use last
13541 !! wikitext
13542 [[File:Foobar.jpg|200px|300px|caption]]
13543 !! html/php
13544 <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>
13545 </p>
13546 !! html/parsoid
13547 <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>
13548 !! end
13549
13550 !! test
13551 Image with multiple alignments -- use first (T50664)
13552 !! options
13553 thumbsize=220
13554 !! wikitext
13555 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13556
13557 [[File:Foobar.jpg|middle|text-top|caption]]
13558 !! html/php
13559 <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>
13560 <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>
13561 </p>
13562 !! html/parsoid
13563 <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>
13564 <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>
13565 !! end
13566
13567 !! test
13568 Image with width attribute at different positions
13569 !! wikitext
13570 [[File:Foobar.jpg|200px|right|Caption]]
13571 [[File:Foobar.jpg|right|200px|Caption]]
13572 [[File:Foobar.jpg|right|Caption|200px]]
13573 !! html/php
13574 <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>
13575 <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>
13576 <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>
13577
13578 !! html/parsoid
13579 <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>
13580 <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>
13581 <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>
13582 !! end
13583
13584 # a sad bit of backward-compatibility
13585 !! test
13586 Image with size specified with pxpx (T15500, T53628)
13587 !! options
13588 parsoid=wt2html,wt2wt,html2html
13589 !! wikitext
13590 [[File:Foobar.jpg|20pxpx]]
13591 [[File:Foobar.jpg|200x20pxpx]]
13592 !! html/php
13593 <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>
13594 <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>
13595 </p>
13596 !! html/parsoid
13597 <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>
13598 !! end
13599
13600 !! test
13601 Image with link parameter, wiki target
13602 !! wikitext
13603 [[File:Foobar.jpg|link=Main Page]]
13604 !! html/php
13605 <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>
13606 </p>
13607 !! html/parsoid
13608 <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>
13609 !! end
13610
13611 # parsoid T51293 (part 1)
13612 !! test
13613 Image with link parameter, URL target
13614 !! wikitext
13615 [[File:Foobar.jpg|link=http://example.com/]]
13616 !! html/php
13617 <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>
13618 </p>
13619 !! html/parsoid
13620 <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>
13621 !! end
13622
13623 # parsoid T51293 (part 2)
13624 !! test
13625 Image with link parameter, protocol-less URL target
13626 !! wikitext
13627 [[File:Foobar.jpg|link=//example.com/]]
13628 !! html/php
13629 <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>
13630 </p>
13631 !! html/parsoid
13632 <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>
13633 !! end
13634
13635 !! test
13636 Escaping non-block captions (T107435)
13637 !! options
13638 parsoid={
13639 "modes": ["wt2wt"],
13640 "changes": [
13641 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13642 ]
13643 }
13644 !! wikitext
13645 [[Image:Foobar.jpg|caption]]
13646 !! wikitext/edited
13647 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13648 !! end
13649
13650 # wgExternalLinkTarget not supported by Parsoid
13651 !! test
13652 Image with link parameter, wgExternalLinkTarget
13653 !! wikitext
13654 [[Image:foobar.jpg|link=http://example.com/]]
13655 !! config
13656 wgExternalLinkTarget='foobar'
13657 !! html/php
13658 <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>
13659 </p>
13660 !! end
13661
13662 !! test
13663 Image with link parameter, wgNoFollowLinks set to false
13664 !! wikitext
13665 [[Image:foobar.jpg|link=http://example.com/]]
13666 !! config
13667 wgNoFollowLinks=false
13668 !! html
13669 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13670 </p>
13671 !! end
13672
13673 !! test
13674 Image with link parameter, wgNoFollowDomainExceptions
13675 !! wikitext
13676 [[Image:foobar.jpg|link=http://example.com/]]
13677 !! config
13678 wgNoFollowDomainExceptions='example.com'
13679 !! html
13680 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13681 </p>
13682 !! end
13683
13684 # wgExternalLinkTarget not supported by Parsoid
13685 !! test
13686 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13687 !! wikitext
13688 [[Image:foobar.jpg|link=http://example.com/|Title]]
13689 !! config
13690 wgExternalLinkTarget='foobar'
13691 !! html/php
13692 <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>
13693 </p>
13694 !! end
13695
13696 !! test
13697 Image with empty link parameter
13698 !! wikitext
13699 [[File:Foobar.jpg|link=]]
13700 !! html/php
13701 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13702 </p>
13703 !! html/parsoid
13704 <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>
13705 !! end
13706
13707 !! test
13708 Image with link parameter (wiki target) and unnamed parameter
13709 !! wikitext
13710 [[File:Foobar.jpg|link=Main_Page|Title]]
13711 !! html/php
13712 <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>
13713 </p>
13714 !! html/parsoid
13715 <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>
13716 !! end
13717
13718 !! test
13719 Image with link parameter (URL target) and unnamed parameter
13720 !! wikitext
13721 [[File:Foobar.jpg|link=http://example.com/|Title]]
13722 !! html/php
13723 <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>
13724 </p>
13725 !! html/parsoid
13726 <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>
13727 !! end
13728
13729 !! test
13730 Thumbnail image with link parameter
13731 !! options
13732 thumbsize=220
13733 parsoid=wt2html,wt2wt,html2html
13734 !! wikitext
13735 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13736 !! html/php
13737 <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>
13738
13739 !! html/parsoid
13740 <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>
13741 !! end
13742
13743 !! test
13744 Manually-specified thumbnail image
13745 !! options
13746 thumbsize=220
13747 !! wikitext
13748 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13749 !! html/php
13750 <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>
13751
13752 !! html/parsoid
13753 <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>
13754 !! end
13755
13756 !! test
13757 Manually-specified thumbnail image with explicit link to wiki page
13758 !! options
13759 thumbsize=220
13760 parsoid=wt2html,wt2wt,html2html
13761 !! wikitext
13762 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13763 !! html/php
13764 <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>
13765
13766 !! html/parsoid
13767 <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>
13768 !! end
13769
13770 !! test
13771 Manually-specified thumbnail image with explicit link to url
13772 !! options
13773 thumbsize=220
13774 parsoid=wt2html,wt2wt,html2html
13775 !! wikitext
13776 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13777 !! html/php
13778 <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>
13779
13780 !! html/parsoid
13781 <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>
13782 !! end
13783
13784 !! test
13785 Manually-specified thumbnail image with explicit no link
13786 !! options
13787 thumbsize=220
13788 parsoid=wt2html,wt2wt,html2html
13789 !! wikitext
13790 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13791 !! html/php
13792 <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>
13793
13794 !! html/parsoid
13795 <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>
13796 !! end
13797
13798 !! test
13799 Manually-specified thumbnail image with explicit link and alt text
13800 !! options
13801 thumbsize=220
13802 parsoid=wt2html,wt2wt,html2html
13803 !! wikitext
13804 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13805 !! html/php
13806 <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>
13807
13808 !! html/parsoid
13809 <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>
13810 !! end
13811
13812 !! test
13813 Image with frame and link
13814 !! options
13815 parsoid=wt2html,wt2wt,html2html
13816 !! wikitext
13817 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13818 !! html/php
13819 <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>
13820
13821 !! html/parsoid
13822 <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>
13823 !! end
13824
13825 !! test
13826 Image with frame and link and explicit alt
13827 !! options
13828 parsoid=wt2html,wt2wt,html2html
13829 !! wikitext
13830 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13831 !! html/php
13832 <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>
13833
13834 !! html/parsoid
13835 <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>
13836 !! end
13837
13838 !! test
13839 Image with wiki markup in implicit alt
13840 !! wikitext
13841 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13842
13843 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13844 !! html/php
13845 <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>
13846 </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>
13847 </p>
13848 !! html/parsoid
13849 <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>
13850
13851 <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>
13852 !! end
13853
13854 !! test
13855 Alt image option should handle most kinds of wikitext without barfing
13856 !! wikitext
13857 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13858 !! html/php
13859 <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>
13860
13861 !! html/parsoid
13862 <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>
13863 !! end
13864
13865 ###################
13866 # Conflicting image format options.
13867 # First option specified should 'win'.
13868 # All three cases in each test should be identical.
13869
13870 !! test
13871 Image with 'frameless' first.
13872 !! options
13873 parsoid=wt2html,wt2wt,html2html
13874 !! wikitext
13875 [[File:Foobar.jpg|frameless|caption]]
13876
13877 [[File:Foobar.jpg|frameless|frame|caption]]
13878
13879 [[File:Foobar.jpg|frameless|thumb|caption]]
13880 !! html/php
13881 <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>
13882 </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>
13883 </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>
13884 </p>
13885 !! html/parsoid
13886 <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>
13887 <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>
13888 <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>
13889 !! end
13890
13891 !! test
13892 Image with 'frame' first.
13893 !! options
13894 parsoid=wt2html,wt2wt,html2html
13895 !! wikitext
13896 [[File:Foobar.jpg|frame|caption]]
13897 [[File:Foobar.jpg|frame|frameless|caption]]
13898 [[File:Foobar.jpg|frame|thumb|caption]]
13899 !! html/php
13900 <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>
13901 <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>
13902 <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>
13903
13904 !! html/parsoid
13905 <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>
13906 <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>
13907 <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>
13908 !! end
13909
13910 !! test
13911 Image with 'thumb' first.
13912 !! options
13913 parsoid=wt2html,wt2wt,html2html
13914 !! wikitext
13915 [[File:Foobar.jpg|thumb|caption]]
13916 [[File:Foobar.jpg|thumb|frameless|caption]]
13917 [[File:Foobar.jpg|thumb|frame|caption]]
13918 !! html/php
13919 <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>
13920 <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>
13921 <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>
13922
13923 !! html/parsoid
13924 <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>
13925 <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>
13926 <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>
13927 !! end
13928
13929 ###################
13930 # Image sizing.
13931 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13932 # and https://phabricator.wikimedia.org/T64258
13933 # Foobar has actual size of 1941x220
13934 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13935 # a scalable format.
13936 # 2. Framed images always ignore size options; always render at default size.
13937 # 3. "Unspecified format" and border are the only types which can be
13938 # enlarged.
13939
13940 !! test
13941 Image: "unspecified format" and border enlarge
13942 !! options
13943 parsoid=wt2html,wt2wt,html2html
13944 !! wikitext
13945 [[File:Foobar.jpg|2000px]]
13946
13947 [[File:Foobar.jpg|border|2000px]]
13948 !! html/php
13949 <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>
13950 </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>
13951 </p>
13952 !! html/parsoid
13953 <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>
13954 <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>
13955 !! end
13956
13957 !! test
13958 Image: "unspecified format" and border reduce
13959 !! options
13960 parsoid=wt2html,wt2wt,html2html
13961 !! wikitext
13962 [[File:Foobar.jpg|1000px]]
13963
13964 [[File:Foobar.jpg|border|1000px]]
13965 !! html/php
13966 <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>
13967 </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>
13968 </p>
13969 !! html/parsoid
13970 <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>
13971 <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>
13972 !! end
13973
13974 !! test
13975 Image: thumbs reduce
13976 !! options
13977 parsoid=wt2html,wt2wt,html2html
13978 !! wikitext
13979 [[File:Foobar.jpg|thumb|50px]]
13980 !! html/php
13981 <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>
13982
13983 !! html/parsoid
13984 <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>
13985 !! end
13986
13987 !! test
13988 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13989 !! options
13990 parsoid=wt2html,wt2wt,html2html
13991 !! wikitext
13992 [[File:Foobar.jpg|thumb|2000px]]
13993
13994 [[File:Foobar.svg|thumb|2000px]]
13995 !! html/php
13996 <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>
13997 <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>
13998
13999 !! html/parsoid
14000 <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>
14001 <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>
14002 !! end
14003
14004 !! test
14005 Image: frameless can reduce in size
14006 !! options
14007 parsoid=wt2html,wt2wt,html2html
14008 !! wikitext
14009 [[File:Foobar.jpg|frameless|50px]]
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/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>
14012 </p>
14013 !! html/parsoid
14014 <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>
14015 !! end
14016
14017 !! test
14018 Image: bitmap frameless can't be enlarged past original size, but vector can
14019 !! options
14020 parsoid=wt2html,wt2wt,html2html
14021 !! wikitext
14022 [[File:Foobar.jpg|frameless|2000px]]
14023
14024 [[File:Foobar.svg|frameless|2000px]]
14025 !! html/php
14026 <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>
14027 </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>
14028 </p>
14029 !! html/parsoid
14030 <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>
14031 <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>
14032 !! end
14033
14034 !! test
14035 Image: framed images are always unscaled.
14036 !! options
14037 parsoid=wt2html,wt2wt,html2html
14038 !! wikitext
14039 [[File:Foobar.jpg|frame]]
14040
14041 [[File:Foobar.jpg|frame|50px]]
14042
14043 [[File:Foobar.jpg|frame|50x50px]]
14044
14045 [[File:Foobar.jpg|frame|2000px]]
14046 !! html/php
14047 <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>
14048 <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>
14049 <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>
14050 <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>
14051
14052 !! html/parsoid
14053 <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>
14054 <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>
14055 <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>
14056 <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>
14057 !! end
14058
14059 ###################
14060
14061 !! test
14062 Link to image page- image page normally doesn't exists, hence edit link
14063 Add test with existing image page
14064 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14065 !! wikitext
14066 [[:Image:test]]
14067 !! html
14068 <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>
14069 </p>
14070 !! end
14071
14072 !! test
14073 T20784 Link to non-existent image page with caption should use caption as link text
14074 !! wikitext
14075 [[:Image:test|caption]]
14076 !! html
14077 <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>
14078 </p>
14079 !! end
14080
14081 !! test
14082 Frameless image caption with a free URL
14083 !! wikitext
14084 [[File:Foobar.jpg|http://example.com]]
14085 !! html/php
14086 <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>
14087 </p>
14088 !! html/parsoid
14089 <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>
14090 !! end
14091
14092 !! test
14093 Thumbnail image caption with a free URL
14094 !! options
14095 thumbsize=220
14096 !! wikitext
14097 [[File:Foobar.jpg|thumb|http://example.com]]
14098 !! html/php
14099 <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>
14100
14101 !! html/parsoid
14102 <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>
14103 !! end
14104
14105 !! test
14106 Thumbnail image caption with a free URL and explicit alt
14107 !! options
14108 thumbsize=220
14109 parsoid=wt2html,wt2wt,html2html
14110 !! wikitext
14111 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14112 !! html/php
14113 <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>
14114
14115 !! html/parsoid
14116 <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>
14117 !! end
14118
14119 !! test
14120 SVG thumbnails with no language set
14121 !! options
14122 !! wikitext
14123 [[File:Foobar.svg|thumb|caption]]
14124 !! html/php
14125 <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>
14126
14127 !! html/parsoid
14128 <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>
14129 !! end
14130
14131 !! test
14132 SVG thumbnails with language de
14133 !! options
14134 parsoid=wt2html,wt2wt,html2html
14135 !! wikitext
14136 [[File:Foobar.svg|thumb|caption|lang=de]]
14137 !! html/php
14138 <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>
14139
14140 !! html/parsoid
14141 <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>
14142 !! end
14143
14144 !! test
14145 SVG thumbnails with invalid language code
14146 !! options
14147 parsoid=wt2html,wt2wt,html2html
14148 !! wikitext
14149 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14150 !! html/php
14151 <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>
14152
14153 !! html/parsoid
14154 <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>
14155 !! end
14156
14157 !! test
14158 T3887: A ISBN with a thumbnail
14159 !! wikitext
14160 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14161 !! html/php
14162 <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>
14163
14164 !! html/parsoid
14165 <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>
14166 !! end
14167
14168 !! test
14169 T3887: A RFC with a thumbnail
14170 !! wikitext
14171 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14172 !! html/php
14173 <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>
14174
14175 !! html/parsoid
14176 <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>
14177 !! end
14178
14179 !! test
14180 T3887: A mailto link with a thumbnail
14181 !! wikitext
14182 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14183 !! html/php
14184 <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>
14185
14186 !! html/parsoid
14187 <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>
14188 !! end
14189
14190 # Pending resolution to T2368
14191 !! test
14192 T2648: Frameless image caption with a link
14193 !! wikitext
14194 [[File:Foobar.jpg|text with a [[link]] in it]]
14195 !! html/php
14196 <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>
14197 </p>
14198 !! html/parsoid
14199 <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>
14200 !! end
14201
14202 !! test
14203 T2648: Frameless image caption with a link (suffix)
14204 !! wikitext
14205 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14206 !! html/php
14207 <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>
14208 </p>
14209 !! html/parsoid
14210 <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>
14211 !! end
14212
14213 !! test
14214 T2648: Frameless image caption with an interwiki link
14215 !! wikitext
14216 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14217 !! html/php
14218 <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>
14219 </p>
14220 !! html/parsoid
14221 <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>
14222 !! end
14223
14224 !! test
14225 T2648: Frameless image caption with a piped interwiki link
14226 !! wikitext
14227 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14228 !! html/php
14229 <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>
14230 </p>
14231 !! html/parsoid
14232 <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>
14233 !! end
14234
14235 !! test
14236 T107474: Frameless image caption with <nowiki>
14237 !! wikitext
14238 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14239 !! html/parsoid
14240 <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>
14241 !! end
14242
14243 !! test
14244 Escape HTML special chars in image alt text
14245 !! wikitext
14246 [[File:Foobar.jpg|& < > "]]
14247 !! html/php
14248 <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>
14249 </p>
14250 !! html/parsoid
14251 <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>
14252 !! end
14253
14254 !! test
14255 Escape HTML special chars in image alt text with LanguageConverter
14256 !! options
14257 language=zh
14258 !! wikitext
14259 [[File:Foobar.jpg|& < > "]]
14260 !! html/php
14261 <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>
14262 </p>
14263 !! html/parsoid
14264 <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>
14265 !! end
14266
14267 !! test
14268 Entities in file name and attributes
14269 !! wikitext
14270 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14271 !! html/php
14272 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14273 </p>
14274 !! html/parsoid
14275 <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>
14276 !! end
14277
14278 !! test
14279 T2499: Alt text should have &#1234;, not &amp;1234;
14280 !! wikitext
14281 [[File:Foobar.jpg|&#9792;]]
14282 !! html/php
14283 <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>
14284 </p>
14285 !! html/parsoid
14286 <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>
14287 !! end
14288
14289 !! test
14290 Broken image caption with link
14291 !! options
14292 parsoid=wt2html,wt2wt,html2html
14293 !! wikitext
14294 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14295 !! html/php
14296 <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.
14297 </p>
14298 !! html/parsoid
14299 <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>
14300 !! end
14301
14302 !! test
14303 Image caption containing another image
14304 !! wikitext
14305 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14306 !! html/php
14307 <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>
14308
14309 !! html/parsoid
14310 <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>
14311 !! end
14312
14313 !! test
14314 Image: caption containing a newline
14315 !! wikitext
14316 [[File:Foobar.jpg|This
14317 *is some text]]
14318 !! html/php
14319 <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>
14320 </p>
14321 !! html/parsoid
14322 <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>
14323 !!end
14324
14325 !!test
14326 Image: caption containing leading space
14327 (The leading space should not trigger nowiki escaping in wt2wt mode)
14328 !! wikitext
14329 [[File:Foobar.jpg|thumb| bar]]
14330 !! html/php
14331 <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>
14332
14333 !! html/parsoid
14334 <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>
14335 !!end
14336
14337 !! test
14338 Image: caption containing a table
14339 !! options
14340 parsoid=wt2html,wt2wt,html2html
14341 !! wikitext
14342 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14343 {|
14344 ! Foo !! Bar
14345 |-
14346 | Foo1 || Bar1
14347 |}
14348 and some more text.]]
14349 !! html/php
14350 <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>
14351
14352 !! html/parsoid
14353 <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
14354 <table>
14355 <tbody>
14356 <tr><th>Foo </th><th>Bar</th></tr>
14357 <tr>
14358 <td>Foo1 </td>
14359 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14360 !! end
14361
14362 !! test
14363 T5090: External links other than http: in image captions
14364 !! wikitext
14365 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14366 !! html/php
14367 <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>
14368
14369 !! html/parsoid
14370 <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>
14371 !! end
14372
14373 !! test
14374 Custom class
14375 !! options
14376 parsoid=wt2html,wt2wt,html2html
14377 !! wikitext
14378 [[Image:foobar.jpg|a|class=b]]
14379 !! html/php
14380 <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>
14381 </p>
14382 !! html/parsoid
14383 <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>
14384 !! end
14385
14386 !! test
14387 Localized image handling (1).
14388 !! options
14389 parsoid=wt2html,wt2wt,html2html
14390 language=es
14391 !! wikitext
14392 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14393 !! html/php
14394 <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>
14395
14396 !! html/parsoid
14397 <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>
14398 !! end
14399
14400 !! test
14401 Localized image handling (2).
14402 !! options
14403 thumbsize=220
14404 parsoid=wt2html,wt2wt,html2html
14405 language=es
14406 !! wikitext
14407 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14408 !! html/php
14409 <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>
14410
14411 !! html/parsoid
14412 <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>
14413 !! end
14414
14415 !! test
14416 Localized image handling (3).
14417 !! options
14418 language=fa
14419 parsoid=html2wt
14420 !! html/parsoid
14421 <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>
14422 !! wikitext
14423 [[File:Foobar.jpg|بندانگشتی]]
14424 !! end
14425
14426 !! test
14427 "border", "frameless" and "class" attributes on an image.
14428 !! options
14429 thumbsize=220
14430 parsoid=wt2html,wt2wt,html2html
14431 !! wikitext
14432 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14433 !! html/php
14434 <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>
14435 </p>
14436 !! html/parsoid
14437 <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>
14438 !! end
14439
14440 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14441 !! test
14442 Invalid image attributes (T64500)
14443 !! options
14444 thumbsize=220
14445 parsoid=wt2html,wt2wt,html2html
14446 !! wikitext
14447 [[File:Foobar.jpg|thumb|float|left|caption]]
14448
14449 [[File:Foobar.jpg|thumb|righ|caption]]
14450
14451 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14452 !! html/php
14453 <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>
14454 <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>
14455 <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>
14456
14457 !! html/parsoid
14458 <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>
14459 <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>
14460 <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>
14461 !! end
14462
14463 !! article
14464 File:Barfoo.jpg
14465 !! text
14466 #REDIRECT [[File:Barfoo.jpg]]
14467 !! endarticle
14468
14469 # FIXME: Parsoid should run this test -- but we'd need to teach the
14470 # mockAPI about the redirected Barfoo.jpg image.
14471 !! test
14472 Redirected image
14473 !! wikitext
14474 [[Image:Barfoo.jpg]]
14475 !! html/php
14476 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14477 </p>
14478 !! end
14479
14480 !! test
14481 Missing image with uploads disabled
14482 !! options
14483 wgEnableUploads=0
14484 !! wikitext
14485 [[File:Foobaz.jpg]]
14486 !! html/php
14487 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14488 </p>
14489 !! html/parsoid
14490 <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>
14491 !! end
14492
14493 # Parsoid-specific testing for images
14494 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14495 # Currently imperfect due to a flaw in the Parsoid testrunner
14496 # Work in progress
14497 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14498 # image tests.
14499
14500 !! test
14501 Parsoid-specific image handling - simple image with size and middle alignment
14502 !! wikitext
14503 [[File:Foobar.jpg|middle|50px]]
14504 !! html/parsoid
14505 <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>
14506 !! end
14507
14508 !! test
14509 Parsoid-specific image handling - simple image with size, middle alignment,
14510 non-standard namespace alias
14511 !! options
14512 parsoid=wt2wt,wt2html,html2html
14513 !! wikitext
14514 [[Image:Foobar.jpg|middle|50px]]
14515 !! html/parsoid
14516 <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>
14517 !! end
14518
14519 !! test
14520 Parsoid-specific image handling - simple image with size and middle alignment
14521 (existing content)
14522 !! wikitext
14523 [[File:Foobar.jpg|50px|middle]]
14524 !! html/parsoid
14525 <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>
14526 !! end
14527
14528 !! test
14529 Parsoid-specific image handling - simple image with size and middle alignment
14530 and non-standard namespace name
14531 !! options
14532 parsoid=wt2html,wt2wt,html2html
14533 !! wikitext
14534 [[Image:Foobar.jpg|50px|middle]]
14535 !! html/parsoid
14536 <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>
14537 !! end
14538
14539 !! test
14540 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14541 !! wikitext
14542 [[File:Foobar.jpg|500x10px|baseline|caption]]
14543 !! html/parsoid
14544 <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>
14545 !! end
14546
14547 !! test
14548 Parsoid-specific image handling - simple image with border and size spec
14549 !! wikitext
14550 [[File:Foobar.jpg|50px|border|caption]]
14551 !! html/parsoid
14552 <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>
14553 !! end
14554
14555 !! test
14556 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14557 !! wikitext
14558 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14559 !! html/parsoid
14560 <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>
14561 !! end
14562
14563 !! test
14564 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14565 (existing content)
14566 !! wikitext
14567 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14568 !! html/parsoid
14569 <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>
14570 !! end
14571
14572 !! test
14573 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14574 !! wikitext
14575 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14576 !! html/parsoid
14577 <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>
14578 !! end
14579
14580 !! test
14581 Parsoid-specific image handling - thumbnail with specific size, halign,
14582 valign, and caption (existing content)
14583 !! wikitext
14584 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14585 !! html/parsoid
14586 <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>
14587 !! end
14588
14589 !! test
14590 Parsoid-specific image handling - framed image with specific size and caption
14591 (size is ignored)
14592 !! options
14593 parsoid=wt2html,wt2wt,html2html
14594 !! wikitext
14595 [[File:Foobar.jpg|frame|500x50px|caption]]
14596 !! html/parsoid
14597 <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>
14598 !! end
14599
14600 !! test
14601 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14602 (size is ignored)
14603 !! options
14604 parsoid=wt2html,wt2wt,html2html
14605 !! wikitext
14606 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14607 !! html/parsoid
14608 <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>
14609 !! end
14610
14611 !! test
14612 Parsoid-specific image handling - frameless image with specific size, border, and caption
14613 !! wikitext
14614 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14615 !! html/parsoid
14616 <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>
14617 !! end
14618
14619 !! test
14620 Parsoid-specific image handling - simple image with a formatted caption
14621 !! wikitext
14622 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14623 !! html/parsoid
14624 <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>
14625 !! end
14626
14627 !! test
14628 Parsoid-specific image handling - caption with a template in it
14629 !! wikitext
14630 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14631 !! html/parsoid
14632 <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>
14633 !! end
14634
14635 !! test
14636 Parsoid-specific image handling - caption with unbalanced tags in it
14637 !! options
14638 parsoid=wt2html,wt2wt,html2html
14639 !! wikitext
14640 foo
14641 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14642 bar
14643 !! html/parsoid
14644 <p>foo</p>
14645 <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>
14646 <p>bar</p>
14647 !! end
14648
14649 !! test
14650 Parsoid-specific image handling - empty caption (1)
14651 !! options
14652 parsoid=wt2html,wt2wt
14653 !! wikitext
14654 [[File:Foobar.jpg|thumb|]]
14655 !! html/parsoid
14656 <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>
14657 !! end
14658
14659 # empty captions don't get serialized unless we're in the "round trip" case
14660 !! test
14661 Parsoid-specific image handling - empty caption (2)
14662 !! options
14663 parsoid=html2wt
14664 !! html/parsoid
14665 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14666 <a href="./File:Foobar.jpg">
14667 <img resource="./File:Foobar.jpg"
14668 src="//example.com/images/3/3a/Foobar.jpg"
14669 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14670 height="25" width="220"/>
14671 </a>
14672 <figcaption></figcaption>
14673 </figure>
14674 !! wikitext
14675 [[File:Foobar.jpg|thumb]]
14676 !! end
14677
14678 !! test
14679 Parsoid-specific image handling - whitespace caption
14680 !! wikitext
14681 [[File:Foobar.jpg|thumb| ]]
14682 !! html/parsoid
14683 <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>
14684 !! end
14685
14686 !! test
14687 Parsoid-specific image handling - lang option
14688 !! wikitext
14689 foo
14690 [[File:Foobar.svg|lang=de|caption]]
14691 bar
14692 !! html/parsoid
14693 <p>foo
14694 <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>
14695 bar</p>
14696 !! end
14697
14698 ## Edge case bugs in Parsoid from T93580
14699 !! test
14700 T93580: 1. Templated <ref> inside block images
14701 !! wikitext
14702 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14703
14704 <references />
14705 !! html/parsoid
14706 <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>
14707
14708 <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>
14709 !! end
14710
14711 !! test
14712 T93580: 2. <ref> inside inline images
14713 !! wikitext
14714 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14715
14716 <references />
14717 !! html/parsoid
14718 <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>
14719
14720 <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>
14721 !! end
14722
14723 !! test
14724 T93580: 3. Templated <ref> inside inline images
14725 !! wikitext
14726 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14727
14728 <references />
14729 !! html/parsoid
14730 <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>
14731
14732 <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>
14733 !! end
14734
14735 ###
14736 ### Subpages
14737 ###
14738 !! article
14739 Subpage test/subpage
14740 !! text
14741 foo
14742 !! endarticle
14743
14744 !! test
14745 Subpage link
14746 !! options
14747 subpage title=[[Subpage test]]
14748 !! wikitext
14749 [[/subpage]]
14750 !! html
14751 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14752 </p>
14753 !! end
14754
14755 !! test
14756 Subpage noslash link
14757 !! options
14758 subpage title=[[Subpage test]]
14759 !! wikitext
14760 [[/subpage/]]
14761 !! html
14762 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14763 </p>
14764 !! end
14765
14766 !! article
14767 Subpage test/1/2/subpage
14768 !! text
14769 blah
14770 !! endarticle
14771
14772 !! test
14773 Relative subpage noslash link
14774 !! options
14775 parsoid=wt2wt,wt2html,html2html
14776 subpage title=[[Subpage test/1/2/3/4]]
14777 !! wikitext
14778 [[../../subpage/]]
14779
14780 [[../../subpage]]
14781 !! html/php
14782 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14783 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14784 </p>
14785 !! html/parsoid
14786 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14787 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14788 !! end
14789
14790 !! test
14791 Parsoid: dot-slash prefixed wikilinks
14792 !! wikitext
14793 [[./foo]]
14794
14795 [[././bar]]
14796
14797 [[././baz/]]
14798 !! html/php
14799 <p>[[./foo]]
14800 </p><p>[[././bar]]
14801 </p><p>[[././baz/]]
14802 </p>
14803 !! html/parsoid
14804 <p>[[./foo]]
14805 </p><p>[[././bar]]
14806 </p><p>[[././baz/]]
14807 </p>
14808 !! end
14809
14810 !! test
14811 Render invalid page names as plain text (T53090)
14812 !! wikitext
14813 [[./../foo|bar]]
14814 [[foo�|bar]]
14815 [[foo/.|bar]]
14816 [[foo/..|bar]]
14817 [[foo~~~bar]]
14818 [[foo>bar]]
14819 [[foo[bar]]
14820 [[.]]
14821 [[..]]
14822 [[foo././bar]]
14823
14824 [[{{echo|./../foo}}|bar]]
14825 [[{{echo|foo/.}}|bar]]
14826 [[{{echo|foo/..}}|bar]]
14827 [[{{echo|foo~~~~bar}}]]
14828 [[{{echo|foo>bar}}]]
14829 [[{{echo|foo././bar}}]]
14830 [[{{echo|foo{bar}}]]
14831 [[{{echo|foo}bar}}]]
14832 [[{{echo|foo[bar}}]]
14833 [[{{echo|foo]bar}}]]
14834 [[{{echo|foo<bar}}]]
14835 !!html/php
14836 <p>[[./../foo|bar]]
14837 [[foo�|bar]]
14838 [[foo/.|bar]]
14839 [[foo/..|bar]]
14840 [[foo~~~bar]]
14841 [[foo&gt;bar]]
14842 [[foo[bar]]
14843 [[.]]
14844 [[..]]
14845 [[foo././bar]]
14846 </p><p>[[./../foo|bar]]
14847 [[foo/.|bar]]
14848 [[foo/..|bar]]
14849 [[foo~~~~bar]]
14850 [[foo&gt;bar]]
14851 [[foo././bar]]
14852 [[foo{bar]]
14853 [[foo}bar]]
14854 [[foo[bar]]
14855 [[foo]bar]]
14856 [[foo&lt;bar]]
14857 </p>
14858 !!html/parsoid
14859 <p>[[./../foo|bar]]
14860 [[foo�|bar]]
14861 [[foo/.|bar]]
14862 [[foo/..|bar]]
14863 [[foo~~~bar]]
14864 [[foo>bar]]
14865 [[foo[bar]]
14866 [[.]]
14867 [[..]]
14868 [[foo././bar]]</p>
14869
14870 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14871 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14872 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14873 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14874 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14875 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14876 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14877 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14878 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14879 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14880 [[<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>
14881 !!end
14882
14883 !! test
14884 Disabled subpages
14885 !! wikitext
14886 [[/subpage]]
14887 !! html
14888 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14889 </p>
14890 !! end
14891
14892 !! test
14893 T2561: {{/Subpage}}
14894 !! options
14895 subpage title=[[Page]]
14896 !! wikitext
14897 {{/Subpage}}
14898 !! html
14899 <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>
14900 </p>
14901 !! end
14902
14903 ###
14904 ### Categories
14905 ###
14906 !! article
14907 Category:MediaWiki User's Guide
14908 !! text
14909 blah
14910 !! endarticle
14911
14912 !! test
14913 Link to category
14914 !! wikitext
14915 [[:Category:MediaWiki User's Guide]]
14916 !! html
14917 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14918 </p>
14919 !! end
14920
14921 !! test
14922 Simple category
14923 !! options
14924 cat
14925 !! wikitext
14926 [[Category:MediaWiki User's Guide]]
14927 !! html/php
14928 cat=MediaWiki_User's_Guide sort=
14929 !! html/parsoid
14930 <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"}}'/>
14931 !! end
14932
14933 !! test
14934 PAGESINCATEGORY invalid title fatal (r33546 fix)
14935 !! wikitext
14936 {{PAGESINCATEGORY:<bogus>}}
14937 !! html
14938 <p>0
14939 </p>
14940 !! end
14941
14942 !! test
14943 Category with different sort key
14944 !! options
14945 cat
14946 !! wikitext
14947 [[Category:MediaWiki User's Guide|Foo]]
14948 !! html/php
14949 cat=MediaWiki_User's_Guide sort=Foo
14950 !! html/parsoid
14951 <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"}}'/>
14952 !! end
14953
14954 !! test
14955 Category with identical sort key
14956 !! options
14957 cat
14958 !! wikitext
14959 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14960 !! html/php
14961 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
14962 !! html/parsoid
14963 <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"}}'/>
14964 !! end
14965
14966 !! test
14967 Category with empty sort key
14968 !! options
14969 cat
14970 pst
14971 !! wikitext
14972 [[Category:MediaWiki User's Guide|]]
14973 !! html/php
14974 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14975 !! end
14976
14977 !! test
14978 Category with empty sort key and parentheses
14979 !! options
14980 cat
14981 pst
14982 !! wikitext
14983 [[Category:Foo (bar)|]]
14984 !! html/php
14985 [[Category:Foo (bar)|Foo]]
14986 !! end
14987
14988 !! test
14989 Category with link tail
14990 !! options
14991 cat
14992 pst
14993 !! wikitext
14994 123[[Category:Foo]]456
14995 !! html/php
14996 123[[Category:Foo]]456
14997 !! end
14998
14999 !! test
15000 Category with template
15001 !! options
15002 cat
15003 pst
15004 !! wikitext
15005 [[Category:{{echo|Foo}}]]
15006 !! html/php
15007 [[Category:{{echo|Foo}}]]
15008 !! end
15009
15010 !! test
15011 Category with template in sort key
15012 !! options
15013 cat
15014 pst
15015 !! wikitext
15016 [[Category:Foo|{{echo|Bar}}]]
15017 !! html/php
15018 [[Category:Foo|{{echo|Bar}}]]
15019 !! end
15020
15021 !! test
15022 Category with template in sort key and title
15023 !! options
15024 cat
15025 pst
15026 !! wikitext
15027 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15028 !! html/php
15029 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15030 !! end
15031
15032 ## We used to, but no longer wt2wt this test since the default serializer
15033 ## will normalize all categories to serialize on their own line.
15034 ## This wikitext usage is going to be fairly uncommon in production and
15035 ## selser will take care of preserving formatting in those scenarios.
15036 !! test
15037 Category / paragraph interactions
15038 !! options
15039 parsoid=wt2html
15040 !! wikitext
15041 Foo [[Category:Baz]] Bar
15042
15043 Foo [[Category:Baz]]
15044 Bar
15045
15046 Foo
15047 [[Category:Baz]]
15048 Bar
15049
15050 Foo
15051 [[Category:Baz]] Bar
15052
15053 Foo
15054 [[Category:Baz]]
15055 [[Category:Baz]]
15056 [[Category:Baz]]
15057 Bar
15058
15059 [[Category:Baz]]
15060 [[Category:Baz]]
15061 [[Category:Baz]]
15062
15063 [[Category:Baz]]
15064 {{echo|[[Category:Baz]]}}
15065 [[Category:Baz]]
15066 !! html/php
15067 <p>Foo Bar
15068 </p><p>Foo
15069 Bar
15070 </p><p>Foo
15071 Bar
15072 </p><p>Foo Bar
15073 </p><p>Foo
15074 Bar
15075 </p>
15076 !! html/parsoid
15077 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15078 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15079 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15080 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15081 <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>
15082 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15083 !! end
15084
15085 ## We used to, but no longer wt2wt this test since the default serializer
15086 ## will normalize all categories to serialize on their own line.
15087 ## This wikitext usage is going to be fairly uncommon in production and
15088 ## selser will take care of preserving formatting in those scenarios.
15089 ##
15090 ## The whitespace on the empty line is part of the test. Please do not delete
15091 !! test
15092 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15093 !! options
15094 parsoid=wt2html
15095 !! wikitext
15096 This
15097
15098 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15099
15100 {{echo|[[Category:Foo]] and so should this!}}
15101 !! html/php
15102 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15103 </p>
15104 !! html/parsoid
15105 <p>This
15106
15107 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15108
15109 <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>
15110 !! end
15111
15112 ## Parsoid will not try to wt2wt this while preserving newlines because
15113 ## it suppresses excess newlines within list items -- and we don't want to
15114 ## introduce a special case just for categories, which is, in reality somewhat
15115 ## odd behavior -- categories are unlikely to be used in list items like this
15116 ## in top-level pages and are only likely to show up in template-generated
15117 ## list items where this RT-ing is a non-issue.
15118 ##
15119 ## The whitespace on the empty line is part of the test. Please do not delete
15120 !! test
15121 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15122 !! options
15123 parsoid=wt2html
15124 !! wikitext
15125 * This
15126
15127 [[Category:Foo]] and this should be part of the same list item
15128 * So should this
15129
15130 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15131 !! html
15132 <ul><li>This and this should be part of the same list item</li>
15133 <li>So should this and this should be part of the same list item</li></ul>
15134 !! html/parsoid
15135 <ul>
15136 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15137 <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>
15138 </ul>
15139 !! end
15140
15141 ## Newlines and categories that follow the last item of a list
15142 ## are treated differently because this (list followed by categories)
15143 ## is an extremely common pattern on wikis.
15144 !! test
15145 3. Categories and newlines: newline suppression for last list item should RT properly
15146 !! wikitext
15147 * a
15148 * b
15149
15150 [[Category:Foo]]
15151
15152 [[Category:Bar]]
15153 [[Category:Baz]]
15154 !! html/parsoid
15155 <ul><li> a</li>
15156 <li> b</li></ul>
15157
15158 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15159
15160 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15161 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15162 !! end
15163
15164 !! test
15165 4. Categories and newlines: newline suppression for last list item should RT properly
15166 !! wikitext
15167 * a
15168 **** b
15169
15170 [[Category:Foo]]
15171 !! html/parsoid
15172 <ul><li> a
15173 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15174
15175 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15176 !! end
15177
15178 ## only wt2html for this to make sure the algo only applies to the rightmost path
15179 !! test
15180 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15181 !! options
15182 parsoid=wt2html
15183 !! wikitext
15184 * a
15185 ** b
15186 [[Category:Foo]]
15187 * c
15188 ** d
15189 [[Category:Foo]]
15190 !! html/parsoid
15191 <ul><li> a
15192 <ul><li> b
15193 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15194 <li> c
15195 <ul><li> d</li></ul></li></ul>
15196 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15197 !! end
15198
15199 ## We used to, but no longer wt2wt this test since the default serializer
15200 ## will normalize all categories to serialize on their own line.
15201 ## This wikitext usage is going to be fairly uncommon in production and
15202 ## selser will take care of preserving formatting in those scenarios.
15203 !! test
15204 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15205 !! options
15206 parsoid=wt2html
15207 !! wikitext
15208 * a [[Category:Foo]]
15209 !! html/parsoid
15210 <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>
15211 !! end
15212
15213 # This test also demonstrates because of newline+category tunneling
15214 # through the list hander, template wrapping doesn't expand to the
15215 # containing list when the list item swallows the category.
15216 !! test
15217 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15218 !! wikitext
15219 * {{echo|a
15220 [[Category:Foo]]}}
15221 !! html/parsoid
15222 <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
15223 </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>
15224 !! end
15225
15226 !! test
15227 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15228 !! wikitext
15229 * a
15230
15231 {{echo|[[Category:Foo]]
15232 [[Category:Bar]]}}
15233 [[Category:Baz]]
15234 !! html/parsoid
15235 <ul><li> a</li></ul>
15236
15237 <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">
15238 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15239 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15240 !! end
15241
15242 !! test
15243 Category links with multiple namespaces
15244 !! wikitext
15245 [[Category:Project:Foo]]
15246 !! html/parsoid
15247 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15248 !! end
15249
15250 !! test
15251 Parsoid: Serialize link to category page with colon escape
15252 !! options
15253 parsoid
15254 !! wikitext
15255
15256 [[:Category:Foo]]
15257 [[:Category:Foo|Bar]]
15258 !! html
15259 <p>
15260 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15261 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15262 </p>
15263 !! end
15264
15265 # We used to, but no longer wt2wt this test since the default serializer
15266 # will normalize all categories to serialize on their own line.
15267 # This wikitext usage is going to be fairly uncommon in production and
15268 # selser will take care of preventing whitespace insertion if this
15269 # occurs in an article.
15270 #
15271 # html2html disabled for the same reason (whitespace insertion between
15272 # x and y).
15273 #
15274 # html2wt disabled because it localizes the "Category" namespace.
15275 !! test
15276 Link prefix/suffixes aren't applied to category links
15277 !! options
15278 parsoid=wt2html
15279 language=is
15280 !! wikitext
15281 x[[Category:Foo]]y
15282 !! html/php
15283 <p>xy
15284 </p>
15285 !! html/parsoid
15286 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15287 !! end
15288
15289 !! test
15290 Parsoid: Serialize link to file page with colon escape
15291 !! options
15292 parsoid
15293 !! wikitext
15294
15295 [[:File:Foo.png]]
15296 [[:File:Foo.png|Bar]]
15297 !! html
15298 <p>
15299 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15300 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15301 </p>
15302 !! end
15303
15304 !! test
15305 Parsoid: Serialize a genuine category link without colon escape
15306 !! options
15307 parsoid
15308 !! wikitext
15309 [[Category:Foo]]
15310 [[Category:Foo|Bar]]
15311 !! html
15312 <link rel="mw:PageProp/Category" href="./Category:Foo">
15313 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15314 !! end
15315
15316 !! test
15317 Normalize hrefs properly before testing for invalid link targets (T72894)
15318 !! options
15319 parsoid=html2wt
15320 !! html/parsoid
15321 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15322 !! wikitext
15323 [[Category:Toxine bactérienne]]
15324 !! end
15325
15326 !! test
15327 Parsoid: Defaultsort
15328 !! wikitext
15329 {{DEFAULTSORT:Foo}}
15330 !! html/parsoid
15331 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15332 !! end
15333
15334 !! test
15335 Parsoid: Defaultsort (template-generated)
15336 !! wikitext
15337 {{{{echo|DEFAULTSORT}}:Foo}}
15338 !! html/parsoid
15339 <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}}]}'/>
15340 !! end
15341
15342 ###
15343 ### Inter-language links
15344 ###
15345 !! test
15346 Interlanguage links
15347 !! options
15348 ill
15349 !! wikitext
15350 [[es:Alimento]]
15351 [[fr:Nourriture]]
15352 [[zh:食品]]
15353 !! html/php
15354 es:Alimento fr:Nourriture zh:食品
15355 !! html/parsoid
15356 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15357 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15358 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15359 !! end
15360
15361 !! test
15362 Duplicate interlanguage links (T26502)
15363 !! options
15364 ill
15365 !! wikitext
15366 [[es:1]]
15367 [[es:2]]
15368 [[fr:1]]
15369 [[fr:2]]
15370 !! html/php
15371 es:1 fr:1
15372 !! html/parsoid
15373 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15374 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15375 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15376 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15377 !! end
15378
15379 ###
15380 ### Sections
15381 ###
15382 !! test
15383 Basic section headings
15384 !! wikitext
15385 == Headline 1 ==
15386 Some text
15387
15388 ==Headline 2==
15389 More
15390 ===Smaller headline===
15391 Blah blah
15392 !! html
15393 <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>
15394 <p>Some text
15395 </p>
15396 <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>
15397 <p>More
15398 </p>
15399 <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>
15400 <p>Blah blah
15401 </p>
15402 !! end
15403
15404 !! test
15405 Section headings with TOC
15406 !! wikitext
15407 == Headline 1 ==
15408 === Subheadline 1 ===
15409 ===== Skipping a level =====
15410 ====== Skipping a level ======
15411
15412 == Headline 2 ==
15413 Some text
15414 ===Another headline===
15415 !! html
15416 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15417 <ul>
15418 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15419 <ul>
15420 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15421 <ul>
15422 <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>
15423 <ul>
15424 <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>
15425 </ul>
15426 </li>
15427 </ul>
15428 </li>
15429 </ul>
15430 </li>
15431 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15432 <ul>
15433 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15434 </ul>
15435 </li>
15436 </ul>
15437 </div>
15438
15439 <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>
15440 <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>
15441 <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>
15442 <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>
15443 <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>
15444 <p>Some text
15445 </p>
15446 <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>
15447
15448 !! end
15449
15450 !! test
15451 TOC anchors don't collide
15452 !! wikitext
15453 __FORCETOC__
15454 == Headline 2 ==
15455 == Headline ==
15456 == Headline 2 ==
15457 == Headline ==
15458 !! html/php
15459 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15460 <ul>
15461 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15462 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15463 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15464 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15465 </ul>
15466 </div>
15467
15468 <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>
15469 <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>
15470 <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>
15471 <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>
15472
15473 !! end
15474
15475 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15476 !! test
15477 Handling of sections up to level 6 and beyond
15478 !! wikitext
15479 = Level 1 Heading=
15480 == Level 2 Heading==
15481 === Level 3 Heading===
15482 ==== Level 4 Heading====
15483 ===== Level 5 Heading=====
15484 ====== Level 6 Heading======
15485 ======= Level 7 Heading=======
15486 ======== Level 8 Heading========
15487 ========= Level 9 Heading=========
15488 ========== Level 10 Heading==========
15489 !! html
15490 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15491 <ul>
15492 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15493 <ul>
15494 <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>
15495 <ul>
15496 <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>
15497 <ul>
15498 <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>
15499 <ul>
15500 <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>
15501 <ul>
15502 <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>
15503 <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>
15504 <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>
15505 <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>
15506 <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>
15507 </ul>
15508 </li>
15509 </ul>
15510 </li>
15511 </ul>
15512 </li>
15513 </ul>
15514 </li>
15515 </ul>
15516 </li>
15517 </ul>
15518 </div>
15519
15520 <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>
15521 <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>
15522 <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>
15523 <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>
15524 <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>
15525 <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>
15526 <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>
15527 <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>
15528 <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>
15529 <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>
15530
15531 !! end
15532
15533 !! test
15534 TOC regression (T11764)
15535 !! wikitext
15536 == title 1 ==
15537 === title 1.1 ===
15538 ==== title 1.1.1 ====
15539 === title 1.2 ===
15540 == title 2 ==
15541 === title 2.1 ===
15542 !! html
15543 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15544 <ul>
15545 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15546 <ul>
15547 <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>
15548 <ul>
15549 <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>
15550 </ul>
15551 </li>
15552 <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>
15553 </ul>
15554 </li>
15555 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15556 <ul>
15557 <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>
15558 </ul>
15559 </li>
15560 </ul>
15561 </div>
15562
15563 <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>
15564 <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>
15565 <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>
15566 <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>
15567 <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>
15568 <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>
15569
15570 !! end
15571
15572 !! test
15573 TOC for heading containing <span id="..."></span> (T96153)
15574 !! wikitext
15575 __FORCETOC__
15576 ==<span id="old-anchor"></span>New title==
15577 !! html/php
15578 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15579 <ul>
15580 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15581 </ul>
15582 </div>
15583
15584 <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>
15585
15586 !! end
15587
15588 !! test
15589 TOC with wgMaxTocLevel=3 (T8204)
15590 !! options
15591 wgMaxTocLevel=3
15592 !! wikitext
15593 == title 1 ==
15594 === title 1.1 ===
15595 ==== title 1.1.1 ====
15596 === title 1.2 ===
15597 == title 2 ==
15598 === title 2.1 ===
15599 !! html
15600 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15601 <ul>
15602 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15603 <ul>
15604 <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>
15605 <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>
15606 </ul>
15607 </li>
15608 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15609 <ul>
15610 <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>
15611 </ul>
15612 </li>
15613 </ul>
15614 </div>
15615
15616 <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>
15617 <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>
15618 <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>
15619 <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>
15620 <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>
15621 <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>
15622
15623 !! end
15624
15625 !! test
15626 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
15627 !! options
15628 wgMaxTocLevel=3
15629 !! wikitext
15630 ==Section 1==
15631 ===Section 1.1===
15632 ====Section 1.1.1====
15633 ====Section 1.1.1.1====
15634 ==Section 2==
15635 !! html
15636 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15637 <ul>
15638 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15639 <ul>
15640 <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>
15641 </ul>
15642 </li>
15643 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15644 </ul>
15645 </div>
15646
15647 <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>
15648 <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>
15649 <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>
15650 <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>
15651 <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>
15652
15653 !! end
15654
15655
15656 !! test
15657 Resolving duplicate section names
15658 !! wikitext
15659 == Foo bar ==
15660 == Foo bar ==
15661 !! html
15662 <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>
15663 <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>
15664
15665 !! end
15666
15667 !! test
15668 Resolving duplicate section names with differing case (T12721)
15669 !! wikitext
15670 == Foo bar ==
15671 == Foo Bar ==
15672 !! html
15673 <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>
15674 <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>
15675
15676 !! end
15677
15678 !! article
15679 Template:sections
15680 !! text
15681 ===Section 1===
15682 ==Section 2==
15683 !! endarticle
15684
15685 !! test
15686 Template with sections, __NOTOC__
15687 !! wikitext
15688 __NOTOC__
15689 ==Section 0==
15690 {{sections}}
15691 ==Section 4==
15692 !! html
15693 <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>
15694 <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>
15695 <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>
15696 <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>
15697
15698 !! end
15699
15700 !! test
15701 __NOEDITSECTION__ keyword
15702 !! wikitext
15703 __NOEDITSECTION__
15704 ==Section 1==
15705 ==Section 2==
15706 !! html
15707 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15708 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15709
15710 !! end
15711
15712 !! test
15713 Link inside a section heading
15714 !! wikitext
15715 ==Section with a [[Main Page|link]] in it==
15716 !! html
15717 <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>
15718
15719 !! end
15720
15721 !! test
15722 TOC regression (T14077)
15723 !! wikitext
15724 __TOC__
15725 == title 1 ==
15726 === title 1.1 ===
15727 == title 2 ==
15728 !! html
15729 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15730 <ul>
15731 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15732 <ul>
15733 <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>
15734 </ul>
15735 </li>
15736 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15737 </ul>
15738 </div>
15739
15740 <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>
15741 <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>
15742 <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>
15743
15744 !! end
15745
15746 !! test
15747 T3219 URL next to image (good)
15748 !! wikitext
15749 http://example.com [[File:Foobar.jpg]]
15750 !! html/php
15751 <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>
15752 </p>
15753 !! html/parsoid
15754 <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>
15755 !!end
15756
15757 !! test
15758 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
15759 !! wikitext
15760 ===
15761 The line above must have a trailing space!
15762 === <!--
15763 --> <!-- -->
15764 But just in case it doesn't...
15765 !! html
15766 <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>
15767 <p>The line above must have a trailing space!
15768 </p>
15769 <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>
15770 <p>But just in case it doesn't...
15771 </p>
15772 !! end
15773
15774 !! test
15775 Header with special characters (T27462)
15776 !! wikitext
15777 The tooltips shall not show entities to the user (ie. be double escaped)
15778
15779 == text > text ==
15780 section 1
15781
15782 == text < text ==
15783 section 2
15784
15785 == text & text ==
15786 section 3
15787
15788 == text ' text ==
15789 section 4
15790
15791 == text " text ==
15792 section 5
15793 !! html
15794 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15795 </p>
15796 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15797 <ul>
15798 <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>
15799 <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>
15800 <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>
15801 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15802 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15803 </ul>
15804 </div>
15805
15806 <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>
15807 <p>section 1
15808 </p>
15809 <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>
15810 <p>section 2
15811 </p>
15812 <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>
15813 <p>section 3
15814 </p>
15815 <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>
15816 <p>section 4
15817 </p>
15818 <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>
15819 <p>section 5
15820 </p>
15821 !! end
15822
15823 !! test
15824 Header with space, plus and underscore as entity
15825 !! wikitext
15826 Id should not contain + for spaces
15827
15828 == Space between Text ==
15829 section 1
15830
15831 == Space-Entity&#32;between&#32;Text ==
15832 section 2
15833
15834 == Plus+between+Text ==
15835 section 3
15836
15837 == Plus-Entity&#43;between&#43;Text ==
15838 section 4
15839
15840 == Underscore_between_Text ==
15841 section 5
15842
15843 == Underscore-Entity&#95;between&#95;Text ==
15844 section 6
15845
15846 [[#Space between Text]]
15847 [[#Space-Entity&#32;between&#32;Text]]
15848 [[#Plus+between+Text]]
15849 [[#Plus-Entity&#43;between&#43;Text]]
15850 [[#Underscore_between_Text]]
15851 [[#Underscore-Entity&#95;between&#95;Text]]
15852 !! html
15853 <p>Id should not contain + for spaces
15854 </p>
15855 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15856 <ul>
15857 <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>
15858 <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>
15859 <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>
15860 <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>
15861 <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>
15862 <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>
15863 </ul>
15864 </div>
15865
15866 <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>
15867 <p>section 1
15868 </p>
15869 <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>
15870 <p>section 2
15871 </p>
15872 <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>
15873 <p>section 3
15874 </p>
15875 <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>
15876 <p>section 4
15877 </p>
15878 <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>
15879 <p>section 5
15880 </p>
15881 <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>
15882 <p>section 6
15883 </p><p><a href="#Space_between_Text">#Space between Text</a>
15884 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15885 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15886 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15887 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15888 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15889 </p>
15890 !! end
15891
15892 !! test
15893 Headers with excess '=' characters
15894 (Are similar tests necessary beyond the 1st level?)
15895 !! wikitext
15896 =foo==
15897 ==foo=
15898 =''italic'' heading==
15899 ==''italic'' heading=
15900 !! html
15901 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15902 <ul>
15903 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15904 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15905 <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>
15906 <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>
15907 </ul>
15908 </div>
15909
15910 <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>
15911 <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>
15912 <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>
15913 <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>
15914
15915 !! end
15916
15917 !! test
15918 HTML headers vs TOC (T25393)
15919 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15920 !! wikitext
15921 <h1>Header 1</h1>
15922 == Header 1.1 ==
15923 == Header 1.2 ==
15924
15925 <h1>Header 2
15926 </h1>
15927 == Header 2.1 ==
15928 == Header 2.2 ==
15929 __NOEDITSECTION__
15930 !! html
15931 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15932 <ul>
15933 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15934 <ul>
15935 <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>
15936 <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>
15937 </ul>
15938 </li>
15939 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15940 <ul>
15941 <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>
15942 <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>
15943 </ul>
15944 </li>
15945 </ul>
15946 </div>
15947
15948 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15949 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15950 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15951 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15952 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15953 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15954
15955 !! end
15956
15957 !! test
15958 Single-line or multiline-comments can follow headings
15959 !! options
15960 parsoid=wt2html,wt2wt
15961 !! wikitext
15962 ==foo==<!---->
15963 ==bar==<!--c1-->
15964 ==baz==<!--
15965 c2
15966 c3-->
15967 !! html
15968 <h2><span class="mw-headline" id="foo">foo</span></h2>
15969 <h2><span class="mw-headline" id="bar">bar</span></h2>
15970 <h2><span class="mw-headline" id="baz">baz</span></h2>
15971
15972 !! end
15973
15974 !! test
15975 T3219 URL next to image (broken)
15976 !! wikitext
15977 http://example.com[[File:Foobar.jpg]]
15978 !! html/php
15979 <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>
15980 </p>
15981 !! html/parsoid
15982 <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>
15983 !!end
15984
15985 !! test
15986 T3186 news: in the middle of text
15987 !! wikitext
15988 http://en.wikinews.org/wiki/Wikinews:Workplace
15989 !! html
15990 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15991 </p>
15992 !!end
15993
15994
15995 !! test
15996 Namespaced link must have a title
15997 !! wikitext
15998 [[Project:]]
15999 !! html
16000 <p>[[Project:]]
16001 </p>
16002 !!end
16003
16004 !! test
16005 Namespaced link must have a title (bad fragment version)
16006 !! wikitext
16007 [[Project:#fragment]]
16008 !! html
16009 <p>[[Project:#fragment]]
16010 </p>
16011 !!end
16012
16013
16014 ###
16015 ### HTML tags and HTML attributes
16016 ###
16017
16018 !! test
16019 div with no attributes
16020 !! wikitext
16021 <div>HTML rocks</div>
16022 !! html
16023 <div>HTML rocks</div>
16024
16025 !! end
16026
16027 !! test
16028 div with double-quoted attribute
16029 !! wikitext
16030 <div id="rock">HTML rocks</div>
16031 !! html
16032 <div id="rock">HTML rocks</div>
16033
16034 !! end
16035
16036 !! test
16037 div with single-quoted attribute
16038 !! wikitext
16039 <div id='rock'>HTML rocks</div>
16040 !! html
16041 <div id="rock">HTML rocks</div>
16042
16043 !! end
16044
16045 !! test
16046 div with unquoted attribute
16047 !! wikitext
16048 <div id=rock>HTML rocks</div>
16049 !! html
16050 <div id="rock">HTML rocks</div>
16051
16052 !! end
16053
16054 !! test
16055 div with illegal double attributes
16056 !! wikitext
16057 <div id="a" id="b">HTML rocks</div>
16058 !! html
16059 <div id="b">HTML rocks</div>
16060
16061 !!end
16062
16063 !! test
16064 div with empty attribute value, space before equals
16065 !! options
16066 parsoid=wt2html,html2html
16067 !! wikitext
16068 <div class =>HTML rocks</div>
16069 !! html/php
16070 <div class="">HTML rocks</div>
16071
16072 !! html/parsoid
16073 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16074 !! end
16075
16076 !! test
16077 div with multiple empty attribute values
16078 !! options
16079 parsoid=wt2html,html2html
16080 !! wikitext
16081 <div id= title=>HTML rocks</div>
16082 !! html/php
16083 <div id="title.3D">HTML rocks</div>
16084
16085 !! html/parsoid
16086 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16087 !! end
16088
16089 !! test
16090 table with multiple empty attribute values
16091 !! options
16092 parsoid=wt2html,html2html
16093 !! wikitext
16094 {| title= id=
16095 | hi
16096 |}
16097 !! html/php
16098 <table title="id=">
16099 <tr>
16100 <td> hi
16101 </td></tr></table>
16102
16103 !! html/parsoid
16104 <table title="id=">
16105 <tbody><tr><td> hi</td></tr>
16106 </tbody></table>
16107 !! end
16108
16109 !! test
16110 div with braces in attribute value
16111 !! wikitext
16112 <div title="{}">Foo</div>
16113 !! html/php
16114 <div title="&#123;&#125;">Foo</div>
16115
16116 !! html/parsoid
16117 <div title="{}">Foo</div>
16118 !! end
16119
16120 !! test
16121 div with empty attribute value, no space before equals
16122 !! options
16123 parsoid=wt2html,html2html
16124 !! wikitext
16125 <div class=>HTML rocks</div>
16126 !! html/php
16127 <div class="">HTML rocks</div>
16128
16129 !! html/parsoid
16130 <div class="">HTML rocks</div>
16131 !! end
16132
16133 !! test
16134 HTML multiple attributes correction
16135 !! wikitext
16136 <p class="error" class="awesome">Awesome!</p>
16137 !! html
16138 <p class="awesome">Awesome!</p>
16139
16140 !!end
16141
16142 !! test
16143 Table multiple attributes correction
16144 !! wikitext
16145 {|
16146 !+ class="error" class="awesome"| status
16147 |}
16148 !! html
16149 <table>
16150 <tr>
16151 <th class="awesome"> status
16152 </th></tr></table>
16153
16154 !!end
16155
16156 !! test
16157 DIV IN UPPERCASE
16158 !! wikitext
16159 <DIV ID="x">HTML ROCKS</DIV>
16160 !! html
16161 <div id="x">HTML ROCKS</div>
16162
16163 !!end
16164
16165 !! test
16166 Non-ASCII pseudo-tags are rendered as text
16167 !! wikitext
16168 <khyô>
16169 !! html
16170 <p>&lt;khyô&gt;
16171 </p>
16172 !! end
16173
16174 !! test
16175 Pseudo-tag with URL 'name' renders as url link
16176 !! wikitext
16177 <http://example.com/>
16178 !! html
16179 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16180 </p>
16181 !! end
16182
16183 !! test
16184 text with amp in the middle of nowhere
16185 !! wikitext
16186 Remember AT&T?
16187 !! html
16188 <p>Remember AT&amp;T?
16189 </p>
16190 !! end
16191
16192 !! test
16193 text with character entity: eacute
16194 !! wikitext
16195 I always thought &eacute; was a cute letter.
16196 !! html
16197 <p>I always thought &#233; was a cute letter.
16198 </p>
16199 !! html+tidy
16200 <p>I always thought é was a cute letter.</p>
16201 !! end
16202
16203 !! test
16204 text with entity-escaped character entity-like string: eacute
16205 !! wikitext
16206 I always thought &amp;eacute; was a cute letter.
16207 !! html
16208 <p>I always thought &amp;eacute; was a cute letter.
16209 </p>
16210 !! end
16211
16212 !! test
16213 text with undefined character entity: xacute
16214 !! wikitext
16215 I always thought &xacute; was a cute letter.
16216 !! html
16217 <p>I always thought &amp;xacute; was a cute letter.
16218 </p>
16219 !! end
16220
16221 !! test
16222 HTML5 tags
16223 !! wikitext
16224 <data value="5">five</data>
16225 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16226 <mark>This highlighted text</mark>
16227 !! html
16228 <p><data value="5">five</data>
16229 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16230 <mark>This highlighted text</mark>
16231 </p>
16232 !! end
16233
16234 !! test
16235 HTML tag with leading space is parsed as text
16236 !! wikitext
16237 < div>foo< /div>
16238 !! html
16239 <p>&lt; div&gt;foo&lt; /div&gt;
16240 </p>
16241 !! end
16242
16243 ###
16244 ### Nesting tests (see T43545, T52604, T53081)
16245 ###
16246
16247 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
16248 # Note that html2wt is considerably more difficult if we use <b> in
16249 # the test case, instead of <small>
16250 !! test
16251 Ensure that HTML adoption agency algorithm is properly implemented.
16252 !! wikitext
16253 <small>X<small>Y</small>Z</small>
16254 !! html
16255 <p><small>X<small>Y</small>Z</small>
16256 </p>
16257 !! end
16258
16259 # This was T43545 in the PHP parser.
16260 # Note that tidy doesn't handle this correctly.
16261 !! test
16262 Nesting of <kbd>
16263 !! wikitext
16264 <kbd>X<kbd>Y</kbd>Z</kbd>
16265 !! html
16266 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16267 </p>
16268 !! end
16269
16270 # The following cases were T53081 in the PHP parser.
16271 # Note that there are some other nestable tags (b, i, etc) which are
16272 # not covered; see T53081 for discussion.
16273
16274 # Note that tidy doesn't handle this correctly.
16275 !! test
16276 Nesting of <em>
16277 !! wikitext
16278 <em>X<em>Y</em>Z</em>
16279 !! html
16280 <p><em>X<em>Y</em>Z</em>
16281 </p>
16282 !! end
16283
16284 # Note that tidy doesn't handle this correctly.
16285 !! test
16286 Nesting of <strong>
16287 !! wikitext
16288 <strong>X<strong>Y</strong>Z</strong>
16289 !! html
16290 <p><strong>X<strong>Y</strong>Z</strong>
16291 </p>
16292 !! end
16293
16294 !! test
16295 Nesting of <q>
16296 !! wikitext
16297 <q>X<q>Y</q>Z</q>
16298 !! html+tidy
16299 <p><q>X<q>Y</q>Z</q></p>
16300 !! end
16301
16302 # Note that tidy doesn't handle this correctly.
16303 !! test
16304 Nesting of <ruby>
16305 !! wikitext
16306 <ruby>X<ruby>Y</ruby>Z</ruby>
16307 !! html
16308 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16309 </p>
16310 !! end
16311
16312 # Note that tidy doesn't handle this correctly.
16313 !! test
16314 Nesting of <bdo>
16315 !! wikitext
16316 <bdo>X<bdo>Y</bdo>Z</bdo>
16317 !! html
16318 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16319 </p>
16320 !! end
16321
16322
16323 ###
16324 ### Media links
16325 ###
16326
16327 !! test
16328 Media link
16329 !! wikitext
16330 [[Media:Foobar.jpg]]
16331 !! html
16332 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16333 </p>
16334 !! end
16335
16336 !! test
16337 Media link with text
16338 !! wikitext
16339 [[Media:Foobar.jpg|A neat file to look at]]
16340 !! html
16341 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16342 </p>
16343 !! end
16344
16345 # FIXME: this is still bad HTML tag nesting
16346 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16347 !! test
16348 Media link with nasty text
16349 !! wikitext
16350 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16351 !! html
16352 <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>
16353
16354 !! html+tidy
16355 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16356 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16357 !! end
16358
16359 !! test
16360 Media link to nonexistent file (T3702)
16361 !! wikitext
16362 [[Media:No such.jpg]]
16363 !! html
16364 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16365 </p>
16366 !! end
16367
16368 !! test
16369 Image link to nonexistent file (T3850 - good)
16370 !! wikitext
16371 [[File:No_such.jpg]]
16372 !! html/php
16373 <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>
16374 </p>
16375 !! html/parsoid
16376 <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>
16377 !! end
16378
16379 !! test
16380 :Image link to nonexistent file (T3850 - bad)
16381 !! wikitext
16382 [[:Image:No such.jpg]]
16383 !! html/php
16384 <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>
16385 </p>
16386 !! html/parsoid
16387 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16388 !! end
16389
16390
16391
16392 !! test
16393 Character reference normalization in link text (T3938)
16394 !! wikitext
16395 [[Main Page|this&that]]
16396 !! html
16397 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16398 </p>
16399 !!end
16400
16401 !! article
16402 אַ
16403 !! text
16404 Test for unicode normalization
16405
16406 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16407 !! endarticle
16408
16409 !! test
16410 (T21451) Links should refer to the normalized form.
16411 !! wikitext
16412 [[&#xFB2E;]]
16413 [[&#x5d0;&#x5b7;]]
16414 [[&#x5d0;ַ]]
16415 [[א&#x5b7;]]
16416 [[אַ]]
16417 !! html
16418 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16419 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16420 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16421 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16422 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16423 </p>
16424 !! end
16425
16426 !! test
16427 Empty attribute crash test (T4067)
16428 !! wikitext
16429 <font color="">foo</font>
16430 !! html
16431 <p><font color="">foo</font>
16432 </p>
16433 !! end
16434
16435 !! test
16436 Empty attribute crash test single-quotes (T4067)
16437 !! wikitext
16438 <font color=''>foo</font>
16439 !! html
16440 <p><font color="">foo</font>
16441 </p>
16442 !! end
16443
16444 !! test
16445 Attribute test: equals, then nothing
16446 !! options
16447 parsoid=wt2html,html2html
16448 !! wikitext
16449 <font color=>foo</font>
16450 !! html/php
16451 <p><font color="">foo</font>
16452 </p>
16453 !! html/parsoid
16454 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16455 !! end
16456
16457 !! test
16458 Attribute test: unquoted value
16459 !! options
16460 parsoid=wt2html,html2html
16461 !! wikitext
16462 <font color=x>foo</font>
16463 !! html/php
16464 <p><font color="x">foo</font>
16465 </p>
16466 !! html/parsoid
16467 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16468 !! end
16469
16470 !! test
16471 Attribute test: unquoted but illegal value (hash)
16472 !! wikitext
16473 <font color=#x>foo</font>
16474 !! html
16475 <p><font color="#x">foo</font>
16476 </p>
16477 !! end
16478
16479 # Parsoid does not serialize to empty attribute syntax,
16480 # so wt2wt and html2wt cases are skipped
16481 !! test
16482 Attribute test: no value (T54330)
16483 !! options
16484 parsoid=wt2html,html2html
16485 !! wikitext
16486 <font color>foo</font>
16487 !! html/php
16488 <p><font color="">foo</font>
16489 </p>
16490 !! html/parsoid
16491 <p><font color="">foo</font></p>
16492 !! end
16493
16494 !! test
16495 T4095: link with three closing brackets
16496 !! wikitext
16497 [[Main Page]]]
16498 !! html/php
16499 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16500 </p>
16501 !! html/parsoid
16502 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16503 !! end
16504
16505 !! test
16506 T4095: link with pipe and three closing brackets
16507 !! wikitext
16508 [[Main Page|link]]]
16509 !! html/php
16510 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16511 </p>
16512 !! html/parsoid
16513 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16514 !! end
16515
16516 !! test
16517 T4095: link with pipe and three closing brackets, version 2
16518 !! wikitext
16519 [[Main Page|[http://example.com/]]]
16520 !! html/php
16521 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16522 </p>
16523 !! html/parsoid
16524 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16525 !! end
16526
16527
16528 ###
16529 ### Safety
16530 ###
16531
16532 !! article
16533 Template:Dangerous attribute
16534 !! text
16535 " onmouseover="alert(document.cookie)
16536 !! endarticle
16537
16538 !! article
16539 Template:Dangerous style attribute
16540 !! text
16541 border-size: expression(alert(document.cookie))
16542 !! endarticle
16543
16544 !! article
16545 Template:Div style
16546 !! text
16547 <div style="float: right; {{{1}}}">Magic div</div>
16548 !! endarticle
16549
16550 !! test
16551 T4304: HTML attribute safety (safe template; regression T4309)
16552 !! wikitext
16553 <div title="{{test}}"></div>
16554 !! html/php
16555 <div title="This is a test template"></div>
16556
16557 !! html/parsoid
16558 <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>
16559 !! end
16560
16561 # Parsoid has enough context to handle this case
16562 !! test
16563 T4304: HTML attribute safety (dangerous template; 2309)
16564 !! wikitext
16565 <div title="{{dangerous attribute}}"></div>
16566 !! html/php
16567 <div title=""></div>
16568
16569 !! html/parsoid
16570 <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>
16571 !! end
16572
16573 !! test
16574 T4304: HTML attribute safety (dangerous style template; 2309)
16575 !! wikitext
16576 <div style="{{dangerous style attribute}}"></div>
16577 !! html/php
16578 <div style="/* insecure input */"></div>
16579
16580 !! html/parsoid
16581 <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>
16582 !! end
16583
16584 !! test
16585 T4304: HTML attribute safety (safe parameter; 2309)
16586 !! wikitext
16587 {{div style|width: 200px}}
16588 !! html/php
16589 <div style="float: right; width: 200px">Magic div</div>
16590
16591 !! html/parsoid
16592 <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>
16593 !! end
16594
16595 !! test
16596 T4304: HTML attribute safety (unsafe parameter; 2309)
16597 !! wikitext
16598 {{div style|width: expression(alert(document.cookie))}}
16599 !! html/php
16600 <div style="/* insecure input */">Magic div</div>
16601
16602 !! html/parsoid
16603 <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>
16604 !! end
16605
16606 ## Parsoid output here differs; needs investigation.
16607 !! test
16608 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
16609 !! wikitext
16610 {{div style|"><script>alert(document.cookie)</script>}}
16611 !! html
16612 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16613
16614 !! end
16615
16616 ## Parsoid output here differs; needs investigation.
16617 !! test
16618 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16619 !! wikitext
16620 {{div style|" ><script>alert(document.cookie)</script>}}
16621 !! html
16622 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16623
16624 !! end
16625
16626 !! test
16627 T4304: HTML attribute safety (link)
16628 !! wikitext
16629 <div title="[[Main Page]]"></div>
16630 !! html
16631 <div title="&#91;&#91;Main Page]]"></div>
16632
16633 !! end
16634
16635 !! test
16636 T4304: HTML attribute safety (italics)
16637 !! wikitext
16638 <div title="''foobar''"></div>
16639 !! html
16640 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16641
16642 !! end
16643
16644 !! test
16645 T4304: HTML attribute safety (bold)
16646 !! wikitext
16647 <div title="'''foobar'''"></div>
16648 !! html
16649 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16650
16651 !! end
16652
16653 !! test
16654 T4304: HTML attribute safety (ISBN)
16655 !! wikitext
16656 <div title="ISBN 1234567890"></div>
16657 !! html
16658 <div title="&#73;SBN 1234567890"></div>
16659
16660 !! end
16661
16662 !! test
16663 T4304: HTML attribute safety (RFC)
16664 !! wikitext
16665 <div title="RFC 1234"></div>
16666 !! html
16667 <div title="&#82;FC 1234"></div>
16668
16669 !! end
16670
16671 !! test
16672 T4304: HTML attribute safety (PMID)
16673 !! wikitext
16674 <div title="PMID 1234567890"></div>
16675 !! html
16676 <div title="&#80;MID 1234567890"></div>
16677
16678 !! end
16679
16680 !! test
16681 T4304: HTML attribute safety (web link)
16682 !! wikitext
16683 <div title="http://example.com/"></div>
16684 !! html
16685 <div title="http&#58;//example.com/"></div>
16686
16687 !! end
16688
16689 !! test
16690 T4304: HTML attribute safety (named web link)
16691 !! wikitext
16692 <div title="[http://example.com/ link]"></div>
16693 !! html
16694 <div title="&#91;http&#58;//example.com/ link]"></div>
16695
16696 !! end
16697
16698 !! test
16699 T5244: HTML attribute safety (extension; safe)
16700 !! wikitext
16701 <div style="<nowiki>background:blue</nowiki>"></div>
16702 !! html/php
16703 <div style="background:blue"></div>
16704
16705 !! html/parsoid
16706 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
16707 !! end
16708
16709 !! test
16710 T5244: HTML attribute safety (extension; unsafe)
16711 !! wikitext
16712 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16713 !! html/php
16714 <div style="/* insecure input */"></div>
16715
16716 !! html/parsoid
16717 <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>
16718 !! end
16719
16720 # More MSIE fun discovered by Tom Gilder
16721
16722 !! test
16723 MSIE CSS safety test: spurious slash
16724 !! wikitext
16725 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16726 !! html/php
16727 <div style="/* insecure input */">evil</div>
16728
16729 !! html/parsoid
16730 <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>
16731 !! end
16732
16733 !! test
16734 MSIE CSS safety test: hex code
16735 !! wikitext
16736 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16737 !! html/php
16738 <div style="/* insecure input */">evil</div>
16739
16740 !! html/parsoid
16741 <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>
16742 !! end
16743
16744 !! test
16745 MSIE CSS safety test: comment in url
16746 !! wikitext
16747 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16748 !! html/php
16749 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16750
16751 !! html/parsoid
16752 <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>
16753 !! end
16754
16755 !! test
16756 MSIE CSS safety test: comment in expression
16757 !! wikitext
16758 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16759 !! html/php
16760 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16761
16762 !! html/parsoid
16763 <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>
16764 !! end
16765
16766 !! test
16767 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
16768 !! wikitext
16769 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16770 !! html/php
16771 <p style="/* invalid control char */">A</p>
16772
16773 !! html/parsoid
16774 <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>
16775 !! end
16776
16777 !! test
16778 MSIE 6 CSS safety test: Fullwidth (T57332)
16779 !! wikitext
16780 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16781 <div style="top:EXPRESSION(alert())">B</div>
16782 !! html/php
16783 <p style="/* insecure input */">A</p>
16784 <div style="/* insecure input */">B</div>
16785
16786 !! html/parsoid
16787 <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>
16788 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
16789 !! end
16790
16791 !! test
16792 MSIE 6 CSS safety test: IPA extensions (T57332)
16793 !! wikitext
16794 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16795 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16796 !! html/php
16797 <div style="/* insecure input */">A</div>
16798 <p style="/* insecure input */">B</p>
16799
16800 !! html/parsoid
16801 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
16802 <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>
16803 !! end
16804
16805 !! test
16806 MSIE 6 CSS safety test: sup/sub script (T57332)
16807 !! wikitext
16808 <div style="background-image:url⁽javascript:alert())">A</div>
16809 <div style="background-image:url₍javascript:alert())">B</div>
16810 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16811 !! html/php
16812 <div style="/* insecure input */">A</div>
16813 <div style="/* insecure input */">B</div>
16814 <p style="/* insecure input */">C</p>
16815
16816 !! html/parsoid
16817 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
16818 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
16819 <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>
16820 !! end
16821
16822 !! test
16823 Opera -o-link CSS
16824 !! options
16825 parsoid=wt2html,html2html
16826 !! wikitext
16827 <div
16828 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;"
16829 style="-o-link:attr(title);-o-link-source:current">X</div>
16830 !! html/php
16831 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16832
16833 !! html/parsoid
16834 <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>
16835 !! end
16836
16837 !! test
16838 MSIE 6 CSS safety test: Repetition markers (T57332)
16839 !! wikitext
16840 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16841 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16842 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16843 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16844 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16845 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16846 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16847 !! html/php
16848 <p style="/* insecure input */">A</p>
16849 <p style="/* insecure input */">B</p>
16850 <p style="/* insecure input */">C</p>
16851 <p style="/* insecure input */">D</p>
16852 <p style="/* insecure input */">E</p>
16853 <p style="/* insecure input */">F</p>
16854 <p style="/* insecure input */">G</p>
16855
16856 !! html/parsoid
16857 <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>
16858 <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>
16859 <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>
16860 <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>
16861 <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>
16862 <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>
16863 <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>
16864 !! end
16865
16866 !! test
16867 Table attribute legitimate extension
16868 !! wikitext
16869 {|
16870 !+ style="<nowiki>color:blue</nowiki>"| status
16871 |}
16872 !! html
16873 <table>
16874 <tr>
16875 <th style="color:blue"> status
16876 </th></tr></table>
16877
16878 !!end
16879
16880 !! test
16881 Table attribute safety
16882 !! wikitext
16883 {|
16884 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16885 |}
16886 !! html
16887 <table>
16888 <tr>
16889 <th style="/* insecure input */"> status
16890 </th></tr></table>
16891
16892 !! end
16893
16894 !! test
16895 CSS line continuation 1
16896 !! wikitext
16897 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16898 !! html
16899 <div style="/* insecure input */"></div>
16900
16901 !! end
16902
16903 !! test
16904 CSS line continuation 2
16905 !! wikitext
16906 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16907 !! html
16908 <div style="/* invalid control char */"></div>
16909
16910 !! end
16911
16912 !! article
16913 Template:Identity
16914 !! text
16915 {{{1}}}
16916 !! endarticle
16917
16918 !! test
16919 Expansion of multi-line templates in attribute values (T8255)
16920 !! wikitext
16921 <div style="background: {{identity|#00FF00}}">-</div>
16922 !! html
16923 <div style="background: #00FF00">-</div>
16924
16925 !! end
16926
16927 !! test
16928 Expansion of multi-line templates in attribute values (T8255 sanity check)
16929 !! wikitext
16930 <div style="background:
16931 #00FF00">-</div>
16932 !! html/php
16933 <div style="background: #00FF00">-</div>
16934
16935 !! html/parsoid
16936 <div style="background:
16937 #00FF00">-</div>
16938 !! end
16939
16940 !! test
16941 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
16942 !! wikitext
16943 <div style="background: &#10;#00FF00">-</div>
16944 !! html
16945 <div style="background: &#10;#00FF00">-</div>
16946
16947 !! end
16948
16949 !! test
16950 Tags which are hidden from Tidy cannot pass through the Sanitizer
16951 !! wikitext
16952 <mw:toc><script>alert();</script></mw:toc>
16953 !! html+tidy
16954 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
16955 !! end
16956
16957 ###
16958 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16959 ###
16960
16961 !! test
16962 Parser hook: empty input
16963 !! wikitext
16964 <tag></tag>
16965 !! html/php
16966 <pre>
16967 ''
16968 array (
16969 )
16970 </pre>
16971
16972 !! html/parsoid
16973 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16974 !! end
16975
16976 ## Don't expect parsoid to rt this form.
16977 !! test
16978 Parser hook: empty input using terminated empty elements
16979 !! options
16980 parsoid=wt2html,html2html
16981 !! wikitext
16982 <tag/>
16983 !! html/php
16984 <pre>
16985 NULL
16986 array (
16987 )
16988 </pre>
16989
16990 !! html/parsoid
16991 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16992 !! end
16993
16994 !! test
16995 Parser hook: empty input using terminated empty elements (space before)
16996 !! wikitext
16997 <tag />
16998 !! html/php
16999 <pre>
17000 NULL
17001 array (
17002 )
17003 </pre>
17004
17005 !! html/parsoid
17006 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17007 !! end
17008
17009 !! test
17010 Parser hook: basic input
17011 !! wikitext
17012 <tag>input</tag>
17013 !! html/php
17014 <pre>
17015 'input'
17016 array (
17017 )
17018 </pre>
17019
17020 !! html/parsoid
17021 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17022 !! end
17023
17024 ## Don't expect parsoid to rt this form.
17025 !! test
17026 Parser hook: case insensitive
17027 !! options
17028 parsoid=wt2html,html2html
17029 !! wikitext
17030 <TAG>input</TAG>
17031 !! html/php
17032 <pre>
17033 'input'
17034 array (
17035 )
17036 </pre>
17037
17038 !! html/parsoid
17039 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17040 !! end
17041
17042 ## Don't expect parsoid to rt this form.
17043 !! test
17044 Parser hook: case insensitive, redux
17045 !! options
17046 parsoid=wt2html,html2html
17047 !! wikitext
17048 <TaG>input</TAg>
17049 !! html/php
17050 <pre>
17051 'input'
17052 array (
17053 )
17054 </pre>
17055
17056 !! html/parsoid
17057 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17058 !! end
17059
17060 !! test
17061 Parser hook: nested tags
17062 !! wikitext
17063 <tag><tag></tag></tag>
17064 !! html/php
17065 <pre>
17066 '<tag>'
17067 array (
17068 )
17069 </pre>&lt;/tag&gt;
17070
17071 !! html/parsoid
17072 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
17073 !! end
17074
17075 !! test
17076 Parser hook: basic arguments
17077 !! wikitext
17078 <tag width="200" height="100" depth="50" square=""></tag>
17079 !! html/php
17080 <pre>
17081 ''
17082 array (
17083 'width' => '200',
17084 'height' => '100',
17085 'depth' => '50',
17086 'square' => '',
17087 )
17088 </pre>
17089
17090 !! html/parsoid
17091 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17092 !! end
17093
17094 ## Don't expect parsoid to rt this form.
17095 !! test
17096 Parser hook: basic arguments, variations
17097 !! options
17098 parsoid=wt2html,html2html
17099 !! wikitext
17100 <tag width=200 height = "100" depth = '50' square></tag>
17101 !! html/php
17102 <pre>
17103 ''
17104 array (
17105 'width' => '200',
17106 'height' => '100',
17107 'depth' => '50',
17108 'square' => '',
17109 )
17110 </pre>
17111
17112 !! html/parsoid
17113 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17114 !! end
17115
17116 !! test
17117 Parser hook: argument containing a forward slash (T7344)
17118 !! wikitext
17119 <tag filename="/tmp/bla"></tag>
17120 !! html/php
17121 <pre>
17122 ''
17123 array (
17124 'filename' => '/tmp/bla',
17125 )
17126 </pre>
17127
17128 !! html/parsoid
17129 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17130 !! end
17131
17132 ## Don't expect parsoid to rt this form.
17133 !! test
17134 Parser hook: empty input using terminated empty elements (T4374)
17135 !! options
17136 parsoid=wt2html,html2html
17137 !! wikitext
17138 <tag foo=bar/>text
17139 !! html/php
17140 <pre>
17141 NULL
17142 array (
17143 'foo' => 'bar',
17144 )
17145 </pre>text
17146
17147 !! html/parsoid
17148 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
17149 !! end
17150
17151 ## </tag> should be output literally since there is no matching tag that begins it
17152 ## Don't expect parsoid to rt this form.
17153 !! test
17154 Parser hook: basic arguments using terminated empty elements (T4374)
17155 !! options
17156 parsoid=wt2html
17157 !! wikitext
17158 <tag width=200 height = "100" depth = '50' square/>
17159 other stuff
17160 </tag>
17161 !! html/php
17162 <pre>
17163 NULL
17164 array (
17165 'width' => '200',
17166 'height' => '100',
17167 'depth' => '50',
17168 'square' => '',
17169 )
17170 </pre>
17171 <p>other stuff
17172 &lt;/tag&gt;
17173 </p>
17174 !! html/parsoid
17175 <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
17176 &lt;/tag></p>
17177 !! end
17178
17179 ## Don't expect parsoid to rt this form.
17180 !! test
17181 Parser hook: Don't allow unclosed extension tags
17182 !! options
17183 parsoid=wt2html
17184 !! wikitext
17185 test <tag>123
17186
17187 this is a '''test'''
17188 !! html/php
17189 <p>test &lt;tag&gt;123
17190 </p><p>this is a <b>test</b>
17191 </p>
17192 !! html/parsoid
17193 <p>test &lt;tag>123</p>
17194
17195 <p>this is a <b>test</b></p>
17196 !! end
17197
17198 ###
17199 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17200 ###
17201
17202 !! test
17203 Parser hook: static parser hook not inside a comment
17204 !! wikitext
17205 <statictag>hello, world</statictag>
17206
17207 <statictag action="flush" />
17208 !! html/php
17209 <p><br />
17210 hello, world
17211 </p>
17212 !! html/parsoid
17213 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17214 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17215 !! end
17216
17217 !! test
17218 Parser hook: static parser hook inside a comment
17219 !! wikitext
17220 <!-- <statictag>hello, world</statictag> -->
17221 <statictag action="flush" />
17222 !! html/php
17223 <p><br />
17224 </p>
17225 !! html/parsoid
17226 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17227 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17228 !! end
17229
17230 # Nested template calls; this case was broken by Parser.php rev 1.506,
17231 # since reverted.
17232
17233 !! article
17234 Template:One-parameter
17235 !! text
17236 (My parameter is: {{{1}}})
17237 !! endarticle
17238
17239 !! article
17240 Template:Map-one-parameter
17241 !! text
17242 {{{{{1}}}|{{{2}}}}}
17243 !! endarticle
17244
17245 !! test
17246 Nested template calls
17247 !! wikitext
17248 {{Map-one-parameter|One-parameter|param}}
17249 !! html
17250 <p>(My parameter is: param)
17251 </p>
17252 !! end
17253
17254
17255 ###
17256 ### Sanitizer
17257 ###
17258
17259 # HTML+Tidy effectively strips out the empty tags completely
17260 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17261 # which Tidy would have done for the PHP parser had there been content inside it.
17262 !! test
17263 Sanitizer: Closing of open tags
17264 !! wikitext
17265 <s></s><table></table>
17266 !! html
17267 <s></s><table></table>
17268
17269 !! html/parsoid
17270 <p><s></s></p><table></table>
17271 !! end
17272
17273 !! test
17274 Sanitizer: Closing of open but not closed tags
17275 !! wikitext
17276 <s>foo
17277 !! html
17278 <p><s>foo</s>
17279 </p>
17280 !! end
17281
17282 !! test
17283 Sanitizer: Closing of closed but not open tags
17284 !! options
17285 parsoid=wt2html
17286 !! wikitext
17287 </s>
17288 !! html/php+tidy
17289 !! html/parsoid
17290 !! end
17291
17292 !! test
17293 Sanitizer: Closing of closed but not open table tags
17294 !! options
17295 parsoid=wt2html
17296 !! wikitext
17297 Table not started</td></tr></table>
17298 !! html/php+tidy
17299 <p>Table not started</p>
17300 !! html/parsoid
17301 <p>Table not started</p>
17302 !! end
17303
17304 !! test
17305 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17306 !! wikitext
17307 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17308 !! html/php
17309 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17310 </p>
17311 !! html/parsoid
17312 <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>
17313 !! end
17314
17315 # In HTML5, the restrictions are that id must contain at least one character,
17316 # and must not contain any space characters.
17317 !! test
17318 Sanitizer: Validating the contents of the id attribute (T6515)
17319 !! options
17320 disabled
17321 !! wikitext
17322 <br id="" /><br id="a space" />
17323 !! html
17324 Something ...
17325 !! end
17326
17327 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17328 !! test
17329 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
17330 !! options
17331 disabled
17332 !! wikitext
17333 <br id="foo" /><br id="foo" />
17334 !! html
17335 Something need to be done. foo-2 ?
17336 !! end
17337
17338 !! test
17339 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17340 !! wikitext
17341 <div itemscope>
17342 <meta itemprop="hello" content="world">
17343 <meta http-equiv="refresh" content="5">
17344 <meta itemprop="hello" http-equiv="refresh" content="5">
17345 <link itemprop="hello" href="{{SERVER}}">
17346 <link rel="stylesheet" href="{{SERVER}}">
17347 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17348 </div>
17349 !! html
17350 <div itemscope="">
17351 <p> <meta itemprop="hello" content="world" />
17352 &lt;meta http-equiv="refresh" content="5"&gt;
17353 <meta itemprop="hello" content="5" />
17354 </p>
17355 <link itemprop="hello" href="http&#58;//example.org" />
17356 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17357 <link itemprop="hello" href="http&#58;//example.org" />
17358 </div>
17359
17360 !! end
17361
17362 !! test
17363 Language converter: output gets cut off unexpectedly (T7757)
17364 !! options
17365 language=zh
17366 !! wikitext
17367 this bit is safe: }-
17368
17369 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17370
17371 then we get cut off here: }-
17372
17373 all additional text is vanished
17374 !! html
17375 <p>this bit is safe: }-
17376 </p><p>but if we add a conversion instance: xxx
17377 </p><p>then we get cut off here: }-
17378 </p><p>all additional text is vanished
17379 </p>
17380 !! end
17381
17382 !! test
17383 Self closed html pairs (T7487)
17384 !! options
17385 !! wikitext
17386 <center><font id="bug" />Centered text</center>
17387 <div><font id="bug2" />In div text</div>
17388 !! html
17389 <center>&lt;font id="bug" /&gt;Centered text</center>
17390 <div>&lt;font id="bug2" /&gt;In div text</div>
17391
17392 !! end
17393
17394 #
17395 #
17396 #
17397
17398 !! test
17399 Punctuation: nbsp before exclamation
17400 !! wikitext
17401 C'est grave !
17402 !! html
17403 <p>C'est grave&#160;!
17404 </p>
17405 !! end
17406
17407 !! test
17408 Punctuation: CSS !important (T13874)
17409 !! wikitext
17410 <div style="width:50% !important">important</div>
17411 !! html
17412 <div style="width:50% !important">important</div>
17413
17414 !!end
17415
17416 !! test
17417 Punctuation: CSS ! important (T13874; with space after)
17418 !! wikitext
17419 <div style="width:50% ! important">important</div>
17420 !! html
17421 <div style="width:50% ! important">important</div>
17422
17423 !!end
17424
17425 !! test
17426 HTML bullet list, closed tags (T7497)
17427 !! wikitext
17428 <ul>
17429 <li>One</li>
17430 <li>Two</li>
17431 </ul>
17432 !! html/php
17433 <ul>
17434 <li>One</li>
17435 <li>Two</li>
17436 </ul>
17437
17438 !! html/parsoid
17439 <ul data-parsoid='{"stx":"html"}'>
17440 <li data-parsoid='{"stx":"html"}'>One</li>
17441 <li data-parsoid='{"stx":"html"}'>Two</li>
17442 </ul>
17443
17444 !! end
17445
17446 !! test
17447 HTML bullet list, unclosed tags (T7497)
17448 !! wikitext
17449 <ul>
17450 <li>One
17451 <li>Two
17452 </ul>
17453 !! html/php+tidy
17454 <ul>
17455 <li>One</li>
17456 <li>Two</li>
17457 </ul>
17458 !! html/parsoid
17459 <ul data-parsoid='{"stx":"html"}'>
17460 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17461 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17462 </ul>
17463
17464 !! end
17465
17466 !! test
17467 HTML ordered list, closed tags (T7497)
17468 !! wikitext
17469 <ol>
17470 <li>One</li>
17471 <li>Two</li>
17472 </ol>
17473 !! html/php
17474 <ol>
17475 <li>One</li>
17476 <li>Two</li>
17477 </ol>
17478
17479 !! html/parsoid
17480 <ol data-parsoid='{"stx":"html"}'>
17481 <li data-parsoid='{"stx":"html"}'>One</li>
17482 <li data-parsoid='{"stx":"html"}'>Two</li>
17483 </ol>
17484
17485 !! end
17486
17487 !! test
17488 HTML ordered list, unclosed tags (T7497)
17489 !! options
17490 !! wikitext
17491 <ol>
17492 <li>One
17493 <li>Two
17494 </ol>
17495 !! html/php+tidy
17496 <ol>
17497 <li>One</li>
17498 <li>Two</li>
17499 </ol>
17500 !! html/parsoid
17501 <ol data-parsoid='{"stx":"html"}'>
17502 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17503 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17504 </ol>
17505
17506 !! end
17507
17508 !! test
17509 HTML nested bullet list, closed tags (T7497)
17510 !! wikitext
17511 <ul>
17512 <li>One</li>
17513 <li>Two:
17514 <ul>
17515 <li>Sub-one</li>
17516 <li>Sub-two</li>
17517 </ul>
17518 </li>
17519 </ul>
17520 !! html/php
17521 <ul>
17522 <li>One</li>
17523 <li>Two:
17524 <ul>
17525 <li>Sub-one</li>
17526 <li>Sub-two</li>
17527 </ul>
17528 </li>
17529 </ul>
17530
17531 !! html/parsoid
17532 <ul data-parsoid='{"stx":"html"}'>
17533 <li data-parsoid='{"stx":"html"}'>One</li>
17534 <li data-parsoid='{"stx":"html"}'>Two:
17535 <ul data-parsoid='{"stx":"html"}'>
17536 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17537 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17538 </ul>
17539 </li>
17540 </ul>
17541 !! end
17542
17543 !! test
17544 HTML nested bullet list, open tags (T7497)
17545 !! wikitext
17546 <ul>
17547 <li>One
17548 <li>Two:
17549 <ul>
17550 <li>Sub-one
17551 <li>Sub-two
17552 </ul>
17553 </ul>
17554 !! html/php+tidy
17555 <ul>
17556 <li>One</li>
17557 <li>Two:
17558 <ul>
17559 <li>Sub-one</li>
17560 <li>Sub-two</li>
17561 </ul>
17562 </li>
17563 </ul>
17564 !! html/parsoid
17565 <ul>
17566 <li>One
17567 </li>
17568 <li>Two:
17569 <ul>
17570 <li>Sub-one
17571 </li>
17572 <li>Sub-two
17573 </li>
17574 </ul>
17575 </li>
17576 </ul>
17577
17578 !! end
17579
17580 !! test
17581 HTML nested ordered list, closed tags (T7497)
17582 !! wikitext
17583 <ol>
17584 <li>One</li>
17585 <li>Two:
17586 <ol>
17587 <li>Sub-one</li>
17588 <li>Sub-two</li>
17589 </ol>
17590 </li>
17591 </ol>
17592 !! html
17593 <ol>
17594 <li>One</li>
17595 <li>Two:
17596 <ol>
17597 <li>Sub-one</li>
17598 <li>Sub-two</li>
17599 </ol>
17600 </li>
17601 </ol>
17602
17603 !! end
17604
17605 !! test
17606 HTML nested ordered list, open tags (T7497)
17607 !! wikitext
17608 <ol>
17609 <li>One
17610 <li>Two:
17611 <ol>
17612 <li>Sub-one
17613 <li>Sub-two
17614 </ol>
17615 </ol>
17616 !! html/php
17617 <ol>
17618 <li>One
17619 <li>Two:
17620 <ol>
17621 <li>Sub-one
17622 <li>Sub-two
17623 </ol>
17624 </ol>
17625
17626 !! html/parsoid
17627 <ol>
17628 <li>One
17629 </li>
17630 <li>Two:
17631 <ol>
17632 <li>Sub-one
17633 </li>
17634 <li>Sub-two
17635 </li>
17636 </ol>
17637 </li>
17638 </ol>
17639
17640 !! end
17641
17642 !! test
17643 HTML ordered list item with parameters oddity
17644 !! wikitext
17645 <ol><li id="fragment">One</li>
17646 </ol>
17647 !! html
17648 <ol><li id="fragment">One</li>
17649 </ol>
17650
17651 !! end
17652
17653 # parsoid doesn't explicitly mark autonumbered links, see T55505
17654 !!test
17655 T7918: autonumbering
17656 !! wikitext
17657 [http://first/] [http://second] [ftp://ftp]
17658
17659 ftp://inlineftp
17660
17661 [mailto:enclosed@mail.tld With target]
17662
17663 [mailto:enclosed@mail.tld]
17664
17665 mailto:inline@mail.tld
17666 !! html/php
17667 <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>
17668 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17669 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17670 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17671 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17672 </p>
17673 !! html/parsoid
17674 <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>
17675 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17676 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17677 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17678 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17679 !! end
17680
17681
17682 #
17683 # Security and HTML correctness
17684 # From Nick Jenkins' fuzz testing
17685 #
17686
17687 !! test
17688 Fuzz testing: Parser13
17689 !! wikitext
17690 {|
17691 | http://a|
17692 !! html
17693 <table>
17694 <tr>
17695 <td>
17696 </td>
17697 </tr>
17698 </table>
17699
17700 !! end
17701
17702 !! test
17703 Fuzz testing: Parser14
17704 !! wikitext
17705 == onmouseover= ==
17706 http://__TOC__
17707 !! html
17708 <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>
17709 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17710 <ul>
17711 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17712 </ul>
17713 </div>
17714
17715
17716 !! html+tidy
17717 <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>
17718 <p>http://</p>
17719 <div id="toc" class="toc">
17720 <div id="toctitle">
17721 <h2>Contents</h2>
17722 </div>
17723 <ul>
17724 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17725 </ul>
17726 </div>
17727 <p></p>
17728 !! end
17729
17730 !! test
17731 Fuzz testing: Parser14-table
17732 !! options
17733 parsoid=wt2html,html2html
17734 !! wikitext
17735 ==a==
17736 {| STYLE=__TOC__
17737 !! html
17738 <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>
17739 <table style="&#95;_TOC&#95;_">
17740 <tr><td></td></tr>
17741 </table>
17742
17743 !! html+tidy
17744 <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>
17745 <table style="__TOC__">
17746 <tr>
17747 <td></td>
17748 </tr>
17749 </table>
17750 !! html/parsoid
17751 <h2>a</h2>
17752 <table style="__TOC__"></table>
17753 !! end
17754
17755 # Known to produce bogus xml (extra </td>)
17756 !! test
17757 Fuzz testing: Parser16
17758 !! wikitext
17759 {|
17760 !https://||||||
17761 !! html
17762 <table>
17763 <tr>
17764 <th>https://</th>
17765 <th></th>
17766 <th></th>
17767 <th>
17768 </td>
17769 </tr>
17770 </table>
17771
17772 !! html+tidy
17773 <table>
17774 <tr>
17775 <th>https://</th>
17776 <th></th>
17777 <th></th>
17778 <th></th>
17779 </tr>
17780 </table>
17781 !! end
17782
17783 !! test
17784 Fuzz testing: Parser21
17785 !! wikitext
17786 {|
17787 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17788 |
17789 !! html
17790 <table>
17791 <tr>
17792 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17793 </th>
17794 <td>
17795 </td>
17796 </tr>
17797 </table>
17798
17799 !! end
17800
17801 !! test
17802 Fuzz testing: Parser22
17803 !! wikitext
17804 http://===r:::https://b
17805
17806 {|
17807 !! html
17808 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17809 </p>
17810 <table>
17811 <tr><td></td></tr>
17812 </table>
17813
17814 !! end
17815
17816 # Known to produce bad XML for now
17817 !! test
17818 Fuzz testing: Parser24
17819 !! options
17820 parsoid=wt2html
17821 !! wikitext
17822 {|
17823 {{{|
17824 <u CLASS=
17825 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17826 <br style="onmouseover='alert(document.cookie);' " />
17827
17828 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17829 |
17830 !! html/php
17831 <table>
17832 {{{|
17833 <u class="&#124;">}}}} &gt;
17834 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17835
17836 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17837 <tr>
17838 <td></u>
17839 </td>
17840 </tr>
17841 </table>
17842
17843 !! html/parsoid
17844 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
17845 <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":""}]]}'>
17846 <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}'>
17847
17848
17849
17850 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
17851 !! end
17852
17853 # Note: the current result listed for this is not what the original one was,
17854 # but the original bug was JavaScript injection, which is fixed in any case.
17855 # It's not clear that the original result listed was any more correct than the
17856 # current one. Original result:
17857 # <p>{{{|
17858 # </p>
17859 # <li class="&#124;&#124;">
17860 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17861 !!test
17862 Fuzz testing: Parser25 (T8055)
17863 !! wikitext
17864 {{{
17865 |
17866 <LI CLASS=||
17867 >
17868 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17869 !! html/php
17870 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17871 </p>
17872 !! html/parsoid
17873 <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"]}'>
17874 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
17875 !! end
17876
17877 !!test
17878 Fuzz testing: URL adjacent extension (with space, clean)
17879 !! wikitext
17880 http://example.com <nowiki>junk</nowiki>
17881 !! html/php
17882 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17883 </p>
17884 !! html/parsoid
17885 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17886 !! end
17887
17888 !!test
17889 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17890 !! wikitext
17891 http://example.com<nowiki>junk</nowiki>
17892 !! html/php
17893 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17894 </p>
17895 !! html/parsoid
17896 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17897 !! end
17898
17899 !! test
17900 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17901 !! wikitext
17902 http://example.com<pre>junk</pre>
17903 !! html/php
17904 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17905
17906 !! html/php+tidy
17907 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17908 <pre>
17909 junk
17910 </pre>
17911 !! html/parsoid
17912 <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>
17913 !! end
17914
17915 !! test
17916 Fuzz testing: image with bogus manual thumbnail
17917 !! wikitext
17918 [[Image:foobar.jpg|thumbnail= ]]
17919 !! html/php
17920 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17921
17922 !! html/parsoid
17923 <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>
17924 !! end
17925
17926 !! test
17927 Fuzz testing: encoded newline in generated HTML replacements (T8577)
17928 !! wikitext
17929 <pre dir="&#10;"></pre>
17930 !! html/php
17931 <pre dir="&#10;"></pre>
17932
17933 !! html/parsoid
17934 <pre typeof="mw:Extension/pre" about="#mwt2" dir="&amp;#10;" data-mw='{"name":"pre","attrs":{"dir":"&amp;#10;"},"body":{"extsrc":""}}'></pre>
17935 !! end
17936
17937 !! test
17938 Parsing optional HTML elements (T8171)
17939 !! options
17940 !! wikitext
17941 <table>
17942 <tr>
17943 <td> Some tabular data</td>
17944 <td> More tabular data ...
17945 <td> And yet som tabular data</td>
17946 </tr>
17947 </table>
17948 !! html
17949 <table>
17950 <tr>
17951 <td> Some tabular data</td>
17952 <td> More tabular data ...
17953 </td><td> And yet som tabular data</td>
17954 </tr>
17955 </table>
17956
17957 !! end
17958
17959 !! test
17960 Correct handling of <td>, <tr> (T8171)
17961 !! options
17962 !! wikitext
17963 <table>
17964 <tr>
17965 <td> Some tabular data</td>
17966 <td> More tabular data ...</td>
17967 <td> And yet som tabular data</td>
17968 </tr>
17969 </table>
17970 !! html
17971 <table>
17972 <tr>
17973 <td> Some tabular data</td>
17974 <td> More tabular data ...</td>
17975 <td> And yet som tabular data</td>
17976 </tr>
17977 </table>
17978
17979 !! end
17980
17981
17982 !! test
17983 Parsing crashing regression (fr:JavaScript)
17984 !! wikitext
17985 </body></x>
17986 !! html
17987 <p>&lt;/body&gt;&lt;/x&gt;
17988 </p>
17989 !! end
17990
17991 !! test
17992 Inline wiki vs wiki block nesting
17993 !! wikitext
17994 '''Bold paragraph
17995
17996 New wiki paragraph
17997 !! html
17998 <p><b>Bold paragraph</b>
17999 </p><p>New wiki paragraph
18000 </p>
18001 !! end
18002
18003 # FIXME: The current php output is documented
18004 # and desired output is the parsoid target.
18005 !! test
18006 Inline HTML vs wiki block nesting
18007 !! wikitext
18008 <b>Bold paragraph
18009
18010 New wiki paragraph
18011 !! html/php
18012 <p><b>Bold paragraph
18013 </p><p>New wiki paragraph</b>
18014 </p>
18015 !! html/parsoid
18016 <p><b>Bold paragraph</b>
18017 </p><p>New wiki paragraph
18018 </p>
18019 !! end
18020
18021 # Original result was this:
18022 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
18023 # </p>
18024 # While that might be marginally more intuitive, maybe, the six-apostrophe
18025 # construct is clearly pathological and the result stated here (which is what
18026 # the parser actually does) is about as reasonable as anything.
18027 !!test
18028 Mixing markup for italics and bold
18029 !! options
18030 !! wikitext
18031 '''bold''''''bold''bolditalics'''''
18032 !! html
18033 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
18034 </p>
18035 !! end
18036
18037
18038 !! article
18039 Xyzzyx
18040 !! text
18041 Article for special page transclusion test
18042 !! endarticle
18043
18044 !! test
18045 Special page transclusion
18046 !! options
18047 !! wikitext
18048 {{Special:Prefixindex/Xyzzyx}}
18049 !! html
18050 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18051 </ul>
18052
18053 !! end
18054
18055 !! test
18056 Special page transclusion twice (T7021)
18057 !! options
18058 !! wikitext
18059 {{Special:Prefixindex/Xyzzyx}}
18060 {{Special:Prefixindex/Xyzzyx}}
18061 !! html
18062 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18063 </ul>
18064 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18065 </ul>
18066
18067 !! end
18068
18069 !! test
18070 Transclusion of default MediaWiki message
18071 !! wikitext
18072 {{MediaWiki:Mainpage}}
18073 !! html
18074 <p>Main Page
18075 </p>
18076 !! end
18077
18078 !! test
18079 Transclusion of nonexistent MediaWiki message
18080 !! wikitext
18081 {{MediaWiki:Mainpagexxx}}
18082 !! html
18083 <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>
18084 </p>
18085 !! end
18086
18087 !! test
18088 Transclusion of MediaWiki message with underscore
18089 !! wikitext
18090 {{MediaWiki:history_short}}
18091 !! html
18092 <p>History
18093 </p>
18094 !! end
18095
18096 !! test
18097 Transclusion of MediaWiki message with space
18098 !! wikitext
18099 {{MediaWiki:history short}}
18100 !! html
18101 <p>History
18102 </p>
18103 !! end
18104
18105 !! test
18106 Invalid header with following text
18107 !! wikitext
18108 = x = y
18109 !! html
18110 <p>= x = y
18111 </p>
18112 !! end
18113
18114
18115 !! test
18116 Section extraction test (section 0)
18117 !! options
18118 section=0
18119 !! wikitext
18120 start
18121 ==a==
18122 ===aa===
18123 ====aaa====
18124 ==b==
18125 ===ba===
18126 ===bb===
18127 ====bba====
18128 ===bc===
18129 ==c==
18130 ===ca===
18131 !! html/php
18132 start
18133 !! end
18134
18135 !! test
18136 Section extraction test (section 1)
18137 !! options
18138 section=1
18139 !! wikitext
18140 start
18141 ==a==
18142 ===aa===
18143 ====aaa====
18144 ==b==
18145 ===ba===
18146 ===bb===
18147 ====bba====
18148 ===bc===
18149 ==c==
18150 ===ca===
18151 !! html/php
18152 ==a==
18153 ===aa===
18154 ====aaa====
18155 !! end
18156
18157 !! test
18158 Section extraction test (section 2)
18159 !! options
18160 section=2
18161 !! wikitext
18162 start
18163 ==a==
18164 ===aa===
18165 ====aaa====
18166 ==b==
18167 ===ba===
18168 ===bb===
18169 ====bba====
18170 ===bc===
18171 ==c==
18172 ===ca===
18173 !! html/php
18174 ===aa===
18175 ====aaa====
18176 !! end
18177
18178 !! test
18179 Section extraction test (section 3)
18180 !! options
18181 section=3
18182 !! wikitext
18183 start
18184 ==a==
18185 ===aa===
18186 ====aaa====
18187 ==b==
18188 ===ba===
18189 ===bb===
18190 ====bba====
18191 ===bc===
18192 ==c==
18193 ===ca===
18194 !! html/php
18195 ====aaa====
18196 !! end
18197
18198 !! test
18199 Section extraction test (section 4)
18200 !! options
18201 section=4
18202 !! wikitext
18203 start
18204 ==a==
18205 ===aa===
18206 ====aaa====
18207 ==b==
18208 ===ba===
18209 ===bb===
18210 ====bba====
18211 ===bc===
18212 ==c==
18213 ===ca===
18214 !! html/php
18215 ==b==
18216 ===ba===
18217 ===bb===
18218 ====bba====
18219 ===bc===
18220 !! end
18221
18222 !! test
18223 Section extraction test (section 5)
18224 !! options
18225 section=5
18226 !! wikitext
18227 start
18228 ==a==
18229 ===aa===
18230 ====aaa====
18231 ==b==
18232 ===ba===
18233 ===bb===
18234 ====bba====
18235 ===bc===
18236 ==c==
18237 ===ca===
18238 !! html/php
18239 ===ba===
18240 !! end
18241
18242 !! test
18243 Section extraction test (section 6)
18244 !! options
18245 section=6
18246 !! wikitext
18247 start
18248 ==a==
18249 ===aa===
18250 ====aaa====
18251 ==b==
18252 ===ba===
18253 ===bb===
18254 ====bba====
18255 ===bc===
18256 ==c==
18257 ===ca===
18258 !! html/php
18259 ===bb===
18260 ====bba====
18261 !! end
18262
18263 !! test
18264 Section extraction test (section 7)
18265 !! options
18266 section=7
18267 !! wikitext
18268 start
18269 ==a==
18270 ===aa===
18271 ====aaa====
18272 ==b==
18273 ===ba===
18274 ===bb===
18275 ====bba====
18276 ===bc===
18277 ==c==
18278 ===ca===
18279 !! html/php
18280 ====bba====
18281 !! end
18282
18283 !! test
18284 Section extraction test (section 8)
18285 !! options
18286 section=8
18287 !! wikitext
18288 start
18289 ==a==
18290 ===aa===
18291 ====aaa====
18292 ==b==
18293 ===ba===
18294 ===bb===
18295 ====bba====
18296 ===bc===
18297 ==c==
18298 ===ca===
18299 !! html/php
18300 ===bc===
18301 !! end
18302
18303 !! test
18304 Section extraction test (section 9)
18305 !! options
18306 section=9
18307 !! wikitext
18308 start
18309 ==a==
18310 ===aa===
18311 ====aaa====
18312 ==b==
18313 ===ba===
18314 ===bb===
18315 ====bba====
18316 ===bc===
18317 ==c==
18318 ===ca===
18319 !! html/php
18320 ==c==
18321 ===ca===
18322 !! end
18323
18324 !! test
18325 Section extraction test (section 10)
18326 !! options
18327 section=10
18328 !! wikitext
18329 start
18330 ==a==
18331 ===aa===
18332 ====aaa====
18333 ==b==
18334 ===ba===
18335 ===bb===
18336 ====bba====
18337 ===bc===
18338 ==c==
18339 ===ca===
18340 !! html/php
18341 ===ca===
18342 !! end
18343
18344 !! test
18345 Section extraction test (nonexistent section 11)
18346 !! options
18347 section=11
18348 !! wikitext
18349 start
18350 ==a==
18351 ===aa===
18352 ====aaa====
18353 ==b==
18354 ===ba===
18355 ===bb===
18356 ====bba====
18357 ===bc===
18358 ==c==
18359 ===ca===
18360 !! html/php
18361 !! end
18362
18363 !! test
18364 Section extraction test with bogus heading (section 1)
18365 !! options
18366 section=1
18367 !! wikitext
18368 ==a==
18369 ==bogus== not a legal section
18370 ==b==
18371 !! html/php
18372 ==a==
18373 ==bogus== not a legal section
18374 !! end
18375
18376 !! test
18377 Section extraction test with bogus heading (section 2)
18378 !! options
18379 section=2
18380 !! wikitext
18381 ==a==
18382 ==bogus== not a legal section
18383 ==b==
18384 !! html/php
18385 ==b==
18386 !! end
18387
18388 !! test
18389 Section extraction test with comment after heading (section 1)
18390 !! options
18391 section=1
18392 !! wikitext
18393 ==a==
18394 ==b== <!-- -->
18395 ==c==
18396 !! html/php
18397 ==a==
18398 !! end
18399
18400 !! test
18401 Section extraction test with comment after heading (section 2)
18402 !! options
18403 section=2
18404 !! wikitext
18405 ==a==
18406 ==b== <!-- -->
18407 ==c==
18408 !! html/php
18409 ==b== <!-- -->
18410 !! end
18411
18412 !! test
18413 Section extraction test with bogus <nowiki> heading (section 1)
18414 !! options
18415 section=1
18416 !! wikitext
18417 ==a==
18418 ==bogus== <nowiki>not a legal section</nowiki>
18419 ==b==
18420 !! html/php
18421 ==a==
18422 ==bogus== <nowiki>not a legal section</nowiki>
18423 !! end
18424
18425 !! test
18426 Section extraction test with bogus <nowiki> heading (section 2)
18427 !! options
18428 section=2
18429 !! wikitext
18430 ==a==
18431 ==bogus== <nowiki>not a legal section</nowiki>
18432 ==b==
18433 !! html/php
18434 ==b==
18435 !! end
18436
18437 # Formerly testing for T4587, now resolved by the use of unmarked sections
18438 # instead of respecting commented sections
18439 !! test
18440 Section extraction prefixed by comment (section 1)
18441 !! options
18442 section=1
18443 !! wikitext
18444 <!-- -->==sec1==
18445 ==sec2==
18446 !! html/php
18447 ==sec2==
18448 !!end
18449
18450 !! test
18451 Section extraction prefixed by comment (section 2)
18452 !! options
18453 section=2
18454 !! wikitext
18455 <!-- -->==sec1==
18456 ==sec2==
18457 !! html/php
18458
18459 !!end
18460
18461 # Formerly testing for T4607, now resolved by the use of unmarked sections
18462 # instead of respecting HTML-style headings
18463 !! test
18464 Section extraction, mixed wiki and html (section 1)
18465 !! options
18466 section=1
18467 !! wikitext
18468 <h2>unmarked</h2>
18469 unmarked
18470 ==1==
18471 one
18472 ==2==
18473 two
18474 !! html/php
18475 ==1==
18476 one
18477 !! end
18478
18479 !! test
18480 Section extraction, mixed wiki and html (section 2)
18481 !! options
18482 section=2
18483 !! wikitext
18484 <h2>unmarked</h2>
18485 unmarked
18486 ==1==
18487 one
18488 ==2==
18489 two
18490 !! html/php
18491 ==2==
18492 two
18493 !! end
18494
18495
18496 # Formerly testing for T5342
18497 !! test
18498 Section extraction, heading surrounded by <noinclude>
18499 !! options
18500 section=1
18501 !! wikitext
18502 <noinclude>==unmarked==</noinclude>
18503 ==marked==
18504 !! html/php
18505 ==marked==
18506 !!end
18507
18508 # Test behavior of T21910
18509 !! test
18510 Sectiion with all-equals
18511 !! options
18512 section=2
18513 !! wikitext
18514 ===
18515 The line above must have a trailing space
18516 === <!--
18517 --> <!-- -->
18518 But just in case it doesn't...
18519 !! html/php
18520 === <!--
18521 --> <!-- -->
18522 But just in case it doesn't...
18523 !! end
18524
18525 !! test
18526 Section replacement test (section 0)
18527 !! options
18528 replace=0,"xxx"
18529 !! wikitext
18530 start
18531 ==a==
18532 ===aa===
18533 ====aaa====
18534 ==b==
18535 ===ba===
18536 ===bb===
18537 ====bba====
18538 ===bc===
18539 ==c==
18540 ===ca===
18541 !! html/php
18542 xxx
18543
18544 ==a==
18545 ===aa===
18546 ====aaa====
18547 ==b==
18548 ===ba===
18549 ===bb===
18550 ====bba====
18551 ===bc===
18552 ==c==
18553 ===ca===
18554 !! end
18555
18556 !! test
18557 Section replacement test (section 1)
18558 !! options
18559 replace=1,"xxx"
18560 !! wikitext
18561 start
18562 ==a==
18563 ===aa===
18564 ====aaa====
18565 ==b==
18566 ===ba===
18567 ===bb===
18568 ====bba====
18569 ===bc===
18570 ==c==
18571 ===ca===
18572 !! html/php
18573 start
18574 xxx
18575
18576 ==b==
18577 ===ba===
18578 ===bb===
18579 ====bba====
18580 ===bc===
18581 ==c==
18582 ===ca===
18583 !! end
18584
18585 !! test
18586 Section replacement test (section 2)
18587 !! options
18588 replace=2,"xxx"
18589 !! wikitext
18590 start
18591 ==a==
18592 ===aa===
18593 ====aaa====
18594 ==b==
18595 ===ba===
18596 ===bb===
18597 ====bba====
18598 ===bc===
18599 ==c==
18600 ===ca===
18601 !! html/php
18602 start
18603 ==a==
18604 xxx
18605
18606 ==b==
18607 ===ba===
18608 ===bb===
18609 ====bba====
18610 ===bc===
18611 ==c==
18612 ===ca===
18613 !! end
18614
18615 !! test
18616 Section replacement test (section 3)
18617 !! options
18618 replace=3,"xxx"
18619 !! wikitext
18620 start
18621 ==a==
18622 ===aa===
18623 ====aaa====
18624 ==b==
18625 ===ba===
18626 ===bb===
18627 ====bba====
18628 ===bc===
18629 ==c==
18630 ===ca===
18631 !! html/php
18632 start
18633 ==a==
18634 ===aa===
18635 xxx
18636
18637 ==b==
18638 ===ba===
18639 ===bb===
18640 ====bba====
18641 ===bc===
18642 ==c==
18643 ===ca===
18644 !! end
18645
18646 !! test
18647 Section replacement test (section 4)
18648 !! options
18649 replace=4,"xxx"
18650 !! wikitext
18651 start
18652 ==a==
18653 ===aa===
18654 ====aaa====
18655 ==b==
18656 ===ba===
18657 ===bb===
18658 ====bba====
18659 ===bc===
18660 ==c==
18661 ===ca===
18662 !! html/php
18663 start
18664 ==a==
18665 ===aa===
18666 ====aaa====
18667 xxx
18668
18669 ==c==
18670 ===ca===
18671 !! end
18672
18673 !! test
18674 Section replacement test (section 5)
18675 !! options
18676 replace=5,"xxx"
18677 !! wikitext
18678 start
18679 ==a==
18680 ===aa===
18681 ====aaa====
18682 ==b==
18683 ===ba===
18684 ===bb===
18685 ====bba====
18686 ===bc===
18687 ==c==
18688 ===ca===
18689 !! html/php
18690 start
18691 ==a==
18692 ===aa===
18693 ====aaa====
18694 ==b==
18695 xxx
18696
18697 ===bb===
18698 ====bba====
18699 ===bc===
18700 ==c==
18701 ===ca===
18702 !! end
18703
18704 !! test
18705 Section replacement test (section 6)
18706 !! options
18707 replace=6,"xxx"
18708 !! wikitext
18709 start
18710 ==a==
18711 ===aa===
18712 ====aaa====
18713 ==b==
18714 ===ba===
18715 ===bb===
18716 ====bba====
18717 ===bc===
18718 ==c==
18719 ===ca===
18720 !! html/php
18721 start
18722 ==a==
18723 ===aa===
18724 ====aaa====
18725 ==b==
18726 ===ba===
18727 xxx
18728
18729 ===bc===
18730 ==c==
18731 ===ca===
18732 !! end
18733
18734 !! test
18735 Section replacement test (section 7)
18736 !! options
18737 replace=7,"xxx"
18738 !! wikitext
18739 start
18740 ==a==
18741 ===aa===
18742 ====aaa====
18743 ==b==
18744 ===ba===
18745 ===bb===
18746 ====bba====
18747 ===bc===
18748 ==c==
18749 ===ca===
18750 !! html/php
18751 start
18752 ==a==
18753 ===aa===
18754 ====aaa====
18755 ==b==
18756 ===ba===
18757 ===bb===
18758 xxx
18759
18760 ===bc===
18761 ==c==
18762 ===ca===
18763 !! end
18764
18765 !! test
18766 Section replacement test (section 8)
18767 !! options
18768 replace=8,"xxx"
18769 !! wikitext
18770 start
18771 ==a==
18772 ===aa===
18773 ====aaa====
18774 ==b==
18775 ===ba===
18776 ===bb===
18777 ====bba====
18778 ===bc===
18779 ==c==
18780 ===ca===
18781 !! html/php
18782 start
18783 ==a==
18784 ===aa===
18785 ====aaa====
18786 ==b==
18787 ===ba===
18788 ===bb===
18789 ====bba====
18790 xxx
18791
18792 ==c==
18793 ===ca===
18794 !!end
18795
18796 !! test
18797 Section replacement test (section 9)
18798 !! options
18799 replace=9,"xxx"
18800 !! wikitext
18801 start
18802 ==a==
18803 ===aa===
18804 ====aaa====
18805 ==b==
18806 ===ba===
18807 ===bb===
18808 ====bba====
18809 ===bc===
18810 ==c==
18811 ===ca===
18812 !! html/php
18813 start
18814 ==a==
18815 ===aa===
18816 ====aaa====
18817 ==b==
18818 ===ba===
18819 ===bb===
18820 ====bba====
18821 ===bc===
18822 xxx
18823 !! end
18824
18825 !! test
18826 Section replacement test (section 10)
18827 !! options
18828 replace=10,"xxx"
18829 !! wikitext
18830 start
18831 ==a==
18832 ===aa===
18833 ====aaa====
18834 ==b==
18835 ===ba===
18836 ===bb===
18837 ====bba====
18838 ===bc===
18839 ==c==
18840 ===ca===
18841 !! html/php
18842 start
18843 ==a==
18844 ===aa===
18845 ====aaa====
18846 ==b==
18847 ===ba===
18848 ===bb===
18849 ====bba====
18850 ===bc===
18851 ==c==
18852 xxx
18853 !! end
18854
18855 !! test
18856 Section replacement test with initial whitespace (T15728)
18857 !! options
18858 replace=2,"xxx"
18859 !! wikitext
18860 Preformatted initial line
18861 ==a==
18862 ===a===
18863 !! html/php
18864 Preformatted initial line
18865 ==a==
18866 xxx
18867 !! end
18868
18869
18870 !! test
18871 Section extraction, heading followed by pre with 20 spaces (T8398)
18872 !! options
18873 section=1
18874 !! wikitext
18875 ==a==
18876 a
18877 !! html/php
18878 ==a==
18879 a
18880 !! end
18881
18882 !! test
18883 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
18884 !! options
18885 section=1
18886 !! wikitext
18887 ==a==
18888 a
18889 !! html/php
18890 ==a==
18891 a
18892 !! end
18893
18894
18895 !! test
18896 Section extraction, <pre> around bogus header (T12309)
18897 !! options
18898 section=2
18899 !! wikitext
18900 == Section One ==
18901 <pre>
18902 =======
18903 </pre>
18904
18905 == Section Two ==
18906 stuff
18907 !! html/php
18908 == Section Two ==
18909 stuff
18910 !! end
18911
18912 !! test
18913 Section replacement, <pre> around bogus header (T12309)
18914 !! options
18915 replace=2,"xxx"
18916 !! wikitext
18917 == Section One ==
18918 <pre>
18919 =======
18920 </pre>
18921
18922 == Section Two ==
18923 stuff
18924 !! html/php
18925 == Section One ==
18926 <pre>
18927 =======
18928 </pre>
18929
18930 xxx
18931 !! end
18932
18933 !! test
18934 Handling of &#x0A; in URLs
18935 !! wikitext
18936 ** irc://&#x0A;a
18937 !! html/php
18938 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18939
18940 !! html/parsoid
18941 <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>
18942 !! end
18943
18944 !! test
18945 Handling of %0A in URLs
18946 !! wikitext
18947 ** irc://%0Aa
18948 !! html/php
18949 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18950
18951 !! html/parsoid
18952 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18953 !! end
18954
18955 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18956 !! test
18957 5 quotes, code coverage +1 line
18958 !! options
18959 parsoid=wt2html
18960 !! wikitext
18961 '''''
18962 !! html/php
18963 !! html/parsoid
18964 <p><b><i></i></b></p>
18965 !! end
18966
18967 # same html as previous, but wikitext adjusted to match parsoid html2wt
18968 # note that wt2html and html2html will put the <i> before the <b>
18969 !! test
18970 5 quotes, code coverage +1 line w/ nowiki (1)
18971 !! options
18972 parsoid=wt2wt,html2wt
18973 !! wikitext
18974 '''''<nowiki/>'''''
18975 !! html/php
18976 <p><i></i>
18977 </p>
18978 !! html/parsoid
18979 <p><b><i></i></b></p>
18980 !! end
18981
18982 # same as previous, just swapping the <i> and <b>
18983 !! test
18984 5 quotes, code coverage +1 line w/ nowiki (2)
18985 !! wikitext
18986 '''''<nowiki/>'''''
18987 !! html/php
18988 <p><i></i>
18989 </p>
18990 !! html/parsoid
18991 <p><i><b></b></i></p>
18992 !! end
18993
18994 !! test
18995 Special:Search page linking.
18996 !! wikitext
18997 {{Special:search}}
18998 !! html
18999 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
19000 </p>
19001 !! end
19002
19003 !! test
19004 {{!}} is a magic word
19005 !! wikitext
19006 {{!}} is a magic word there and {{!}} is still a magic word here
19007 | is not a magic word here but {{!}} is still a magic word here
19008 !! html/php
19009 <p>| is a magic word there and | is still a magic word here
19010 | is not a magic word here but | is still a magic word here
19011 </p>
19012 !! html/parsoid
19013 <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
19014 | 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>
19015
19016 !! end
19017
19018 !! test
19019 Say the magic word
19020 !! options
19021 title=[[Parser test]]
19022 !! wikitext
19023 * {{PAGENAME}}
19024 * {{PAGENAMEE}}
19025 * {{FULLPAGENAME}}
19026 * {{FULLPAGENAMEE}}
19027 * {{BASEPAGENAME}}
19028 * {{BASEPAGENAMEE}}
19029 * {{SUBPAGENAME}}
19030 * {{SUBPAGENAMEE}}
19031 * {{ROOTPAGENAME}}
19032 * {{ROOTPAGENAMEE}}
19033 * {{TALKPAGENAME}}
19034 * {{TALKPAGENAMEE}}
19035 * {{SUBJECTPAGENAME}}
19036 * {{SUBJECTPAGENAMEE}}
19037 * {{NAMESPACEE}}
19038 * {{NAMESPACE}}
19039 * {{NAMESPACENUMBER}}
19040 * {{TALKSPACE}}
19041 * {{TALKSPACEE}}
19042 * {{SUBJECTSPACE}}
19043 * {{SUBJECTSPACEE}}
19044 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
19045 !! html
19046 <ul><li> Parser test</li>
19047 <li> Parser_test</li>
19048 <li> Parser test</li>
19049 <li> Parser_test</li>
19050 <li> Parser test</li>
19051 <li> Parser_test</li>
19052 <li> Parser test</li>
19053 <li> Parser_test</li>
19054 <li> Parser test</li>
19055 <li> Parser_test</li>
19056 <li> Talk:Parser test</li>
19057 <li> Talk:Parser_test</li>
19058 <li> Parser test</li>
19059 <li> Parser_test</li>
19060 <li> </li>
19061 <li> </li>
19062 <li> 0</li>
19063 <li> Talk</li>
19064 <li> Talk</li>
19065 <li> </li>
19066 <li> </li>
19067 <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>
19068
19069 !! end
19070 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
19071
19072 ## Parsoid thinks the "centre" here is a property, not a caption.
19073 !! test
19074 Gallery
19075 !! options
19076 parsoid={
19077 "modes": ["wt2html"],
19078 "nativeGallery": true
19079 }
19080 !! wikitext
19081 <gallery>
19082 image1.png |
19083 image2.gif|||||
19084
19085 image3|
19086 image4 |300px| centre
19087 image5.svg| http://///////
19088 [[x|xx]]]]
19089 * image6
19090 </gallery>
19091 !! html/php
19092 <ul class="gallery mw-gallery-traditional">
19093 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19094 <div class="thumb" style="height: 150px;">Image1.png</div>
19095 <div class="gallerytext">
19096 </div>
19097 </div></li>
19098 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19099 <div class="thumb" style="height: 150px;">Image2.gif</div>
19100 <div class="gallerytext">
19101 </div>
19102 </div></li>
19103 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19104 <div class="thumb" style="height: 150px;">Image3</div>
19105 <div class="gallerytext">
19106 </div>
19107 </div></li>
19108 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19109 <div class="thumb" style="height: 150px;">Image4</div>
19110 <div class="gallerytext">
19111 <pre>centre
19112 </pre>
19113 </div>
19114 </div></li>
19115 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19116 <div class="thumb" style="height: 150px;">Image5.svg</div>
19117 <div class="gallerytext">
19118 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
19119 </p>
19120 </div>
19121 </div></li>
19122 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19123 <div class="thumb" style="height: 150px;">* image6</div>
19124 <div class="gallerytext">
19125 </div>
19126 </div></li>
19127 </ul>
19128
19129 !! html/parsoid
19130 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19131 <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>
19132 <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>
19133 <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>
19134 <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>
19135 <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>
19136 <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>
19137 </ul>
19138 !! end
19139
19140 !! test
19141 Gallery (with options, html)
19142 !! options
19143 parsoid={
19144 "modes": ["wt2html", "html2html"],
19145 "nativeGallery": true
19146 }
19147 !! wikitext
19148 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19149 File:Nonexistent.jpg|caption
19150 File:Nonexistent.jpg
19151 image:foobar.jpg|some '''caption''' [[Main Page]]
19152 image:foobar.jpg
19153 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19154 </gallery>
19155 !! html/php
19156 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19157 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19158 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19159 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19160 <div class="gallerytext">
19161 <p>caption
19162 </p>
19163 </div>
19164 </div></li>
19165 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19166 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19167 <div class="gallerytext">
19168 </div>
19169 </div></li>
19170 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19171 <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>
19172 <div class="gallerytext">
19173 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19174 </p>
19175 </div>
19176 </div></li>
19177 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19178 <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>
19179 <div class="gallerytext">
19180 </div>
19181 </div></li>
19182 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19183 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="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>
19184 <div class="gallerytext">
19185 <p>blabla.
19186 </p>
19187 </div>
19188 </div></li>
19189 </ul>
19190
19191 !! html/parsoid
19192 <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":{}}'>
19193 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19194 <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>
19195 <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>
19196 <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>
19197 <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>
19198 <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>
19199 </ul>
19200 !! end
19201
19202 !! test
19203 Gallery (with options, extsrc)
19204 !! options
19205 parsoid={
19206 "nativeGallery": false
19207 }
19208 !! wikitext
19209 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19210 File:Nonexistent.jpg|caption
19211 File:Nonexistent.jpg
19212 image:foobar.jpg|some '''caption''' [[Main Page]]
19213 image:foobar.jpg
19214 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19215 </gallery>
19216 !! html/php
19217 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19218 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19219 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19220 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19221 <div class="gallerytext">
19222 <p>caption
19223 </p>
19224 </div>
19225 </div></li>
19226 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19227 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19228 <div class="gallerytext">
19229 </div>
19230 </div></li>
19231 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19232 <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>
19233 <div class="gallerytext">
19234 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19235 </p>
19236 </div>
19237 </div></li>
19238 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19239 <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>
19240 <div class="gallerytext">
19241 </div>
19242 </div></li>
19243 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19244 <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>
19245 <div class="gallerytext">
19246 <p>blabla.
19247 </p>
19248 </div>
19249 </div></li>
19250 </ul>
19251
19252 !! html/parsoid
19253 <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"}}'>
19254 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19255 <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>
19256 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext"></div></li>
19257 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span 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>
19258 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></span></div><div class="gallerytext"></div></li>
19259 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img 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>
19260 </ul>
19261 !! end
19262
19263 !! test
19264 Gallery with link that has fragment
19265 !! options
19266 parsoid={
19267 "modes": ["wt2html", "html2html"],
19268 "nativeGallery": true
19269 }
19270 !! wikitext
19271 <gallery>
19272 image:foobar.jpg|link=Main_Page
19273 image:foobar.jpg|link=Main_Page#section
19274 image:foobar.jpg|link=Main Page#section|caption
19275 </gallery>
19276 !! html/php
19277 <ul class="gallery mw-gallery-traditional">
19278 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19279 <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>
19280 <div class="gallerytext">
19281 </div>
19282 </div></li>
19283 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19284 <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>
19285 <div class="gallerytext">
19286 </div>
19287 </div></li>
19288 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19289 <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>
19290 <div class="gallerytext">
19291 <p>caption
19292 </p>
19293 </div>
19294 </div></li>
19295 </ul>
19296
19297 !! html/parsoid
19298 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19299 <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>
19300 <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>
19301 <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>
19302 </ul>
19303 !! end
19304
19305 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19306 !! test
19307 Gallery with template inside caption
19308 !! options
19309 parsoid={
19310 "nativeGallery": true
19311 }
19312 !! wikitext
19313 <gallery caption="{{echo|hi}}">
19314 File:Foobar.jpg|{{echo|ho}}
19315 </gallery>
19316 !! html/php
19317 <ul class="gallery mw-gallery-traditional">
19318 <li class='gallerycaption'>{{echo|hi}}</li>
19319 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19320 <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>
19321 <div class="gallerytext">
19322 <p>ho
19323 </p>
19324 </div>
19325 </div></li>
19326 </ul>
19327
19328 !! html/parsoid
19329 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19330 <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>
19331 <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>
19332 </ul>
19333 !! end
19334
19335 !! test
19336 Gallery with wikitext inside caption
19337 !! options
19338 parsoid={
19339 "nativeGallery": true
19340 }
19341 !! wikitext
19342 <gallery>
19343 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19344 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19345 </gallery>
19346 !! html/php
19347 <ul class="gallery mw-gallery-traditional">
19348 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19349 <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>
19350 <div class="gallerytext">
19351 <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>
19352 </p>
19353 </div>
19354 </div></li>
19355 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19356 <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>
19357 <div class="gallerytext">
19358 <p>This is a test template
19359 </p>
19360 </div>
19361 </div></li>
19362 </ul>
19363
19364 !! html/parsoid
19365 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19366 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img 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>
19367 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img 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>
19368 </ul>
19369 !! end
19370
19371 !! test
19372 Gallery (with showfilename option)
19373 !! options
19374 parsoid={
19375 "nativeGallery": true
19376 }
19377 !! wikitext
19378 <gallery showfilename="">
19379 File:Nonexistent.jpg|caption
19380 File:Nonexistent.jpg
19381 File:Foobar.jpg|some '''caption''' [[Main Page]]
19382 File:Foobar.jpg
19383 </gallery>
19384 !! html/php
19385 <ul class="gallery mw-gallery-traditional">
19386 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19387 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19388 <div class="gallerytext">
19389 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19390 caption
19391 </p>
19392 </div>
19393 </div></li>
19394 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19395 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19396 <div class="gallerytext">
19397 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19398 </p>
19399 </div>
19400 </div></li>
19401 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19402 <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>
19403 <div class="gallerytext">
19404 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19405 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19406 </p>
19407 </div>
19408 </div></li>
19409 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19410 <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>
19411 <div class="gallerytext">
19412 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19413 </p>
19414 </div>
19415 </div></li>
19416 </ul>
19417
19418 !! html/parsoid
19419 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
19420 <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>
19421 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span 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>
19422 <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>
19423 <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>
19424 </ul>
19425 !! end
19426
19427 ## Should Parsoid be preserving these variations?
19428 !! test
19429 Gallery (with namespace-less filenames)
19430 !! options
19431 parsoid={
19432 "modes": ["wt2html", "html2html"],
19433 "nativeGallery": true
19434 }
19435 !! wikitext
19436 <gallery>
19437 File:Nonexistent.jpg
19438 Nonexistent.jpg
19439 image:foobar.jpg
19440 foobar.jpg
19441 </gallery>
19442 !! html/php
19443 <ul class="gallery mw-gallery-traditional">
19444 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19445 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19446 <div class="gallerytext">
19447 </div>
19448 </div></li>
19449 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19450 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19451 <div class="gallerytext">
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 </div>
19458 </div></li>
19459 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19460 <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>
19461 <div class="gallerytext">
19462 </div>
19463 </div></li>
19464 </ul>
19465
19466 !! html/parsoid
19467 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
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 style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext"></div></li>
19469 <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>
19470 <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>
19471 <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>
19472 </ul>
19473 !! end
19474
19475 !! test
19476 Gallery override link with WikiLink (T36852)
19477 !! options
19478 parsoid={
19479 "nativeGallery": true
19480 }
19481 !! wikitext
19482 <gallery>
19483 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
19484 </gallery>
19485 !! html/php
19486 <ul class="gallery mw-gallery-traditional">
19487 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19488 <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>
19489 <div class="gallerytext">
19490 </div>
19491 </div></li>
19492 </ul>
19493
19494 !! html/parsoid
19495 <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":{}}'>
19496 <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>
19497 </ul>
19498 !! end
19499
19500 !! test
19501 Gallery override link with absolute external link (T36852)
19502 !! options
19503 parsoid={
19504 "nativeGallery": true
19505 }
19506 !! wikitext
19507 <gallery>
19508 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
19509 </gallery>
19510 !! html/php
19511 <ul class="gallery mw-gallery-traditional">
19512 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19513 <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>
19514 <div class="gallerytext">
19515 </div>
19516 </div></li>
19517 </ul>
19518
19519 !! html/parsoid
19520 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19521 <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>
19522 </ul>
19523 !! end
19524
19525 !! test
19526 Gallery override link with absolute external link with LanguageConverter
19527 !! options
19528 language=zh
19529 !! input
19530 <gallery>
19531 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19532 </gallery>
19533 !! result
19534 <ul class="gallery mw-gallery-traditional">
19535 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19536 <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>
19537 <div class="gallerytext">
19538 <p>caption
19539 </p>
19540 </div>
19541 </div></li>
19542 </ul>
19543
19544 !! end
19545
19546 !! test
19547 Gallery override link with malicious javascript (T36852)
19548 !! options
19549 parsoid={
19550 "modes": ["wt2html", "html2html"],
19551 "nativeGallery": true
19552 }
19553 !! wikitext
19554 <gallery>
19555 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19556 </gallery>
19557 !! html/php
19558 <ul class="gallery mw-gallery-traditional">
19559 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19560 <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>
19561 <div class="gallerytext">
19562 </div>
19563 </div></li>
19564 </ul>
19565
19566 !! html/parsoid
19567 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19568 <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>
19569 </ul>
19570 !! end
19571
19572 !! test
19573 Gallery with invalid title as link (T45964)
19574 !! options
19575 parsoid={
19576 "modes": ["wt2html", "html2html"],
19577 "nativeGallery": true
19578 }
19579 !! wikitext
19580 <gallery>
19581 File:Foobar.jpg|link=<
19582 </gallery>
19583 !! html/php
19584 <ul class="gallery mw-gallery-traditional">
19585 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19586 <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>
19587 <div class="gallerytext">
19588 </div>
19589 </div></li>
19590 </ul>
19591
19592 !! html/parsoid
19593 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19594 <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>
19595 </ul>
19596 !! end
19597
19598 !! test
19599 Serialize gallery without attrs in data-mw
19600 !! options
19601 parsoid={
19602 "modes": ["html2wt"],
19603 "nativeGallery": true
19604 }
19605 !! html/parsoid
19606 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
19607 <li class="gallerycaption">123</li>
19608 <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>
19609 </ul>
19610 !! wikitext
19611 <gallery caption="123">
19612 File:Test.png
19613 </gallery>
19614 !! end
19615
19616 !! test
19617 HTML Hex character encoding (spells the word "JavaScript")
19618 !! options
19619 parsoid=wt2html,wt2wt,html2html
19620 !! wikitext
19621 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19622 !! html/php
19623 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19624 </p>
19625 !! html/php+tidy
19626 <p>JavaScript</p>
19627 !! html/parsoid
19628 <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>
19629 !! end
19630
19631 !! test
19632 HTML Hex character encoding bogus encoding (T28437 regression check)
19633 !! wikitext
19634 &#xsee;&#XSEE;
19635 !! html/php
19636 <p>&amp;#xsee;&amp;#XSEE;
19637 </p>
19638 !! html/parsoid
19639 <p>&amp;#xsee;&amp;#XSEE;</p>
19640 !! end
19641
19642 !! test
19643 HTML Hex character encoding mixed case
19644 !! options
19645 parsoid=wt2html,wt2wt,html2html
19646 !! wikitext
19647 &#xEE;&#Xee;
19648 !! html/php
19649 <p>&#xee;&#xee;
19650 </p>
19651 !! html/php+tidy
19652 <p>îî</p>
19653 !! html/parsoid
19654 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19655 !! end
19656
19657 # See: https://www.w3.org/TR/html5/syntax.html#character-references
19658 # Note that U+000C (form feed) is not a valid XML character, so
19659 # it is banned even though allowed in HTML5.
19660 !! test
19661 Illegal character references (T106578)
19662 !! wikitext
19663 ; Null: &#00;
19664 ; FF: &#xC;
19665 ; CR: &#xD;
19666 ; Control (low): &#8;
19667 ; Control (high): &#x7F; &#x9F;
19668 ; Surrogate: &#xD83D;&#xDCA9;
19669 ; This is an okay astral character: &#x1F4A9;
19670 !! html+tidy
19671 <dl>
19672 <dt>Null</dt>
19673 <dd>&amp;#00;</dd>
19674 <dt>FF</dt>
19675 <dd>&amp;#xC;</dd>
19676 <dt>CR</dt>
19677 <dd>&amp;#xD;</dd>
19678 <dt>Control (low)</dt>
19679 <dd>&amp;#8;</dd>
19680 <dt>Control (high)</dt>
19681 <dd>&amp;#x7F; &amp;#x9F;</dd>
19682 <dt>Surrogate</dt>
19683 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19684 <dt>This is an okay astral character</dt>
19685 <dd>💩</dd>
19686 </dl>
19687 !! end
19688
19689 !! test
19690 __FORCETOC__ override
19691 !! wikitext
19692 __NEWSECTIONLINK__
19693 __FORCETOC__
19694 !! html/php
19695 <p><br />
19696 </p>
19697 !! end
19698
19699 !! test
19700 ISBN code coverage
19701 !! wikitext
19702 ISBN 978-0-1234-56&#x20;789
19703 !! html
19704 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19705 </p>
19706 !! html+tidy
19707 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19708 !! html/parsoid
19709 <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>
19710 !! end
19711
19712 !! test
19713 ISBN followed by 5 spaces
19714 !! wikitext
19715 ISBN
19716 !! html
19717 <p>ISBN
19718 </p>
19719 !! end
19720
19721 !! test
19722 Double ISBN
19723 !! wikitext
19724 ISBN ISBN 1234567890
19725 !! html/php
19726 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19727 </p>
19728 !! html/parsoid
19729 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19730 !! end
19731
19732 # Uppercase X and lowercase x as well
19733 !! test
19734 ISBN with an X
19735 !! wikitext
19736 ISBN 3-462-04561-X
19737 ISBN 3-462-04561-x
19738 ISBN 080442957X
19739 ISBN 080442957x
19740 ISBN 978080442957X
19741 ISBN 978080442957x
19742 !! html/php
19743 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19744 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19745 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19746 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19747 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19748 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19749 </p>
19750 !! html/parsoid
19751 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19752 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19753 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19754 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19755 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19756 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19757 !! end
19758
19759 !! test
19760 ISBN with empty prefix (parsoid test)
19761 !! wikitext
19762 ISBN 1234567890
19763 !! html/php
19764 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19765 </p>
19766 !! html/parsoid
19767 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19768 !! end
19769
19770 !! test
19771 T24905: <abbr> followed by ISBN followed by </a>
19772 !! wikitext
19773 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19774 !! html/php
19775 <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>
19776 </p>
19777 !! html/parsoid
19778 <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>
19779 !! end
19780
19781 !! test
19782 Double RFC
19783 !! wikitext
19784 RFC RFC 1234
19785 !! html
19786 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19787 </p>
19788 !! end
19789
19790 !! test
19791 Double RFC with a wiki link
19792 !! wikitext
19793 RFC [[RFC 1234]]
19794 !! html
19795 <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>
19796 </p>
19797 !! end
19798
19799 !! test
19800 RFC code coverage
19801 !! wikitext
19802 RFC 983&#x20;987
19803 !! html
19804 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19805 </p>
19806 !! html+tidy
19807 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19808 !! end
19809
19810 !! test
19811 Centre-aligned image
19812 !! wikitext
19813 [[Image:foobar.jpg|centre]]
19814 !! html
19815 <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>
19816
19817 !!end
19818
19819 !! test
19820 None-aligned image
19821 !! wikitext
19822 [[Image:foobar.jpg|none]]
19823 !! html
19824 <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>
19825
19826 !!end
19827
19828 !! test
19829 Width + Height sized image (using px) (height is ignored)
19830 !! wikitext
19831 [[Image:foobar.jpg|640x480px]]
19832 !! html
19833 <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>
19834 </p>
19835 !!end
19836
19837 !! test
19838 Width-sized image (using px, no following whitespace)
19839 !! wikitext
19840 [[Image:foobar.jpg|640px]]
19841 !! html
19842 <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>
19843 </p>
19844 !!end
19845
19846 !! test
19847 Width-sized image (using px, with following whitespace - test regression from r39467)
19848 !! wikitext
19849 [[Image:foobar.jpg|640px ]]
19850 !! html
19851 <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>
19852 </p>
19853 !!end
19854
19855 !! test
19856 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19857 !! wikitext
19858 [[Image:foobar.jpg| 640px]]
19859 !! html
19860 <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>
19861 </p>
19862 !!end
19863
19864 !! test
19865 Image with page parameter
19866 !! options
19867 djvu
19868 !! wikitext
19869 [[File:LoremIpsum.djvu|page=2]]
19870 !! html/php
19871 <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>
19872 </p>
19873 !! html/parsoid
19874 <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>
19875 !! end
19876
19877 !! test
19878 Another italics / bold test
19879 !! wikitext
19880 ''' ''x'
19881 !! html
19882 <pre>'<i> </i>x'
19883 </pre>
19884 !!end
19885
19886 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19887 !! test
19888 dt/dd/dl test
19889 !! wikitext
19890 :;;;::
19891 !! html/php
19892 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19893
19894 !! html/parsoid
19895 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19896
19897 !!end
19898
19899 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19900 !! test
19901 Images with the "|" character in the comment
19902 !! wikitext
19903 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19904 !! html/php
19905 <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>
19906
19907 !! html/parsoid
19908 <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>
19909 !! end
19910
19911 !! test
19912 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19913 !! wikitext
19914 <html><script>alert(1);</script></html>
19915 !! html
19916 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19917 </p>
19918 !! end
19919
19920 !! test
19921 HTML with raw HTML ($wgRawHtml==true)
19922 !! options
19923 wgRawHtml=1
19924 !! wikitext
19925 <html><script>alert(1);</script></html>
19926 !! html
19927 <p><script>alert(1);</script>
19928 </p>
19929 !! end
19930
19931 !! test
19932 Parents of subpages, one level up
19933 !! options
19934 subpage title=[[Subpage test/L1/L2/L3]]
19935 !! wikitext
19936 [[../|L2]]
19937 !! html
19938 <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>
19939 </p>
19940 !! end
19941
19942
19943 !! test
19944 Parents of subpages, one level up, not named
19945 !! options
19946 subpage title=[[Subpage test/L1/L2/L3]]
19947 !! wikitext
19948 [[../]]
19949 !! html
19950 <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>
19951 </p>
19952 !! end
19953
19954
19955
19956 !! test
19957 Parents of subpages, two levels up
19958 !! options
19959 subpage title=[[Subpage test/L1/L2/L3]]
19960 !! wikitext
19961 [[../../|L1]]2
19962
19963 [[../../|L1]]l
19964 !! html
19965 <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
19966 </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>
19967 </p>
19968 !! end
19969
19970 !! test
19971 Parents of subpages, two levels up, without trailing slash or name.
19972 !! options
19973 subpage title=[[Subpage test/L1/L2/L3]]
19974 !! wikitext
19975 [[../..]]
19976 !! html
19977 <p>[[../..]]
19978 </p>
19979 !! end
19980
19981 !! test
19982 Parents of subpages, two levels up, with lots of extra trailing slashes.
19983 !! options
19984 subpage title=[[Subpage test/L1/L2/L3]]
19985 !! wikitext
19986 [[../../////]]
19987 !! html
19988 <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>
19989 </p>
19990 !! end
19991
19992 !! article
19993 Subpage test/L1/L2/L3Sibling
19994 !! text
19995 Sibling article
19996 !! endarticle
19997
19998 !! test
19999 Transclusion of a sibling page (one level up)
20000 !! options
20001 subpage title=[[Subpage test/L1/L2/L3]]
20002 !! wikitext
20003 {{../L3Sibling}}
20004 !! html
20005 <p>Sibling article
20006 </p>
20007 !! end
20008
20009 !! test
20010 Transclusion of a child page
20011 !! options
20012 subpage title=[[Subpage test/L1/L2]]
20013 !! wikitext
20014 {{/L3Sibling}}
20015 !! html
20016 <p>Sibling article
20017 </p>
20018 !! end
20019
20020 # This is wt2html only in Parsoid because we add <nowiki>
20021 # because of {{..}} and we don't expect to fix that to
20022 # eliminate the nowikis selective for {{..}} markup.
20023 !! test
20024 Non-transclusion because of too many up levels
20025 !! options
20026 subpage title=[[Subpage test/L1/L2/L3]]
20027 parsoid=wt2html
20028 !! wikitext
20029 {{../../../../More than parent}}
20030 !! html/php
20031 <p>{{../../../../More than parent}}
20032 </p>
20033 !! html/parsoid
20034 <p>{{../../../../More than parent}}</p>
20035 !! end
20036
20037 !! test
20038 Definition list code coverage
20039 !! wikitext
20040 ; title : def
20041 ; title : def
20042 ;title: def
20043 !! html/php
20044 <dl><dt> title &#160;</dt>
20045 <dd> def</dd>
20046 <dt> title&#160;</dt>
20047 <dd> def</dd>
20048 <dt>title</dt>
20049 <dd> def</dd></dl>
20050
20051 !! html/parsoid
20052 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20053 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20054 <dt>title</dt><dd> def</dd></dl>
20055 !! end
20056
20057 !! test
20058 Don't fall for the self-closing div
20059 !! wikitext
20060 <div>hello world</div/>
20061 !! html
20062 <div>hello world</div>
20063
20064 !! end
20065
20066 !! test
20067 MSGNW magic word
20068 !! wikitext
20069 {{MSGNW:msg}}
20070 !! html/php
20071 <p>&#91;&#91;:Template:Msg&#93;&#93;
20072 </p>
20073 !! end
20074
20075 !! test
20076 RAW magic word
20077 !! wikitext
20078 {{RAW:QUERTY}}
20079 !! html
20080 <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>
20081 </p>
20082 !! end
20083
20084 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
20085 !! test
20086 Always escape literal '>' in output, not just after '<'
20087 !! wikitext
20088 ><>
20089 !! html
20090 <p>&gt;&lt;&gt;
20091 </p>
20092 !! end
20093
20094 !! test
20095 Template caching
20096 !! wikitext
20097 {{Test}}
20098 {{Test}}
20099 !! html
20100 <p>This is a test template
20101 This is a test template
20102 </p>
20103 !! end
20104
20105
20106 !! article
20107 MediaWiki:Fake
20108 !! text
20109 ==header==
20110 !! endarticle
20111
20112 !! test
20113 Inclusion of !userCanEdit() content
20114 !! wikitext
20115 {{MediaWiki:Fake}}
20116 !! html
20117 <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>
20118
20119 !! end
20120
20121
20122 !! test
20123 Out-of-order TOC heading levels
20124 !! wikitext
20125 ==2==
20126 ======6======
20127 ===3===
20128 =1=
20129 =====5=====
20130 ==2==
20131 !! html
20132 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20133 <ul>
20134 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
20135 <ul>
20136 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
20137 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
20138 </ul>
20139 </li>
20140 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
20141 <ul>
20142 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
20143 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
20144 </ul>
20145 </li>
20146 </ul>
20147 </div>
20148
20149 <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>
20150 <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>
20151 <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>
20152 <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>
20153 <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>
20154 <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>
20155
20156 !! end
20157
20158
20159 !! test
20160 ISBN with a dummy number
20161 !! wikitext
20162 ISBN ---
20163 !! html
20164 <p>ISBN ---
20165 </p>
20166 !! end
20167
20168
20169 !! test
20170 ISBN with space-delimited number
20171 !! wikitext
20172 ISBN 92 9017 032 8
20173 !! html
20174 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
20175 </p>
20176 !! end
20177
20178
20179 !! test
20180 ISBN with multiple spaces, no number
20181 !! wikitext
20182 ISBN foo
20183 !! html
20184 <p>ISBN foo
20185 </p>
20186 !! end
20187
20188
20189 !! test
20190 ISBN length
20191 !! wikitext
20192 ISBN 123456789
20193
20194 ISBN 1234567890
20195
20196 ISBN 12345678901
20197 !! html
20198 <p>ISBN 123456789
20199 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20200 </p><p>ISBN 12345678901
20201 </p>
20202 !! end
20203
20204
20205 !! test
20206 ISBN with trailing year (T9110)
20207 !! wikitext
20208 ISBN 1-234-56789-0 - 2006
20209
20210 ISBN 1 234 56789 0 - 2006
20211 !! html
20212 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
20213 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20214 </p>
20215 !! end
20216
20217
20218 !! test
20219 anchorencode
20220 !! wikitext
20221 {{anchorencode:foo bar©#%n}}
20222 !! html
20223 <p>foo_bar.C2.A9.23.25n
20224 </p>
20225 !! end
20226
20227 !! test
20228 anchorencode trims spaces
20229 !! wikitext
20230 {{anchorencode: __pretty__please__}}
20231 !! html
20232 <p>pretty_please
20233 </p>
20234 !! end
20235
20236 !! test
20237 anchorencode deals with links
20238 !! wikitext
20239 {{anchorencode: [[hello|world]] [[hi]]}}
20240 !! html
20241 <p>world_hi
20242 </p>
20243 !! end
20244
20245 !! test
20246 anchorencode deals with templates
20247 !! wikitext
20248 {{anchorencode: {{Foo}} }}
20249 !! html
20250 <p>FOO
20251 </p>
20252 !! end
20253
20254 !! test
20255 anchorencode encodes like the TOC generator: (T20431)
20256 !! wikitext
20257 === _ +:.3A%3A&&amp;]] ===
20258 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20259 __NOEDITSECTION__
20260 !! html
20261 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20262 <p>.2B:.3A.253A.26.26.5D.5D
20263 </p>
20264 !! end
20265
20266 !! test
20267 T8200: blockquotes and paragraph formatting
20268 !! wikitext
20269 <blockquote>
20270 foo
20271 </blockquote>
20272
20273 bar
20274
20275 baz
20276 !! html
20277 <blockquote>
20278 <p>foo
20279 </p>
20280 </blockquote>
20281 <p>bar
20282 </p>
20283 <pre>baz
20284 </pre>
20285 !! end
20286
20287 !! test
20288 T10293: Use of center tag ruins paragraph formatting
20289 !! wikitext
20290 <center>
20291 foo
20292 </center>
20293
20294 bar
20295
20296 baz
20297 !! html
20298 <center>
20299 <p>foo
20300 </p>
20301 </center>
20302 <p>bar
20303 </p>
20304 <pre>baz
20305 </pre>
20306 !! end
20307
20308 !!test
20309 Parsing of overlapping (improperly nested) inline html tags
20310 !! wikitext
20311 <span><s>x</span></s>
20312 !! html/php
20313 <p><span><s>x&lt;/span&gt;</s></span>
20314 </p>
20315 !! html/parsoid
20316 <p><span><s>x</s></span>
20317 </p>
20318 !!end
20319
20320 ###
20321 ### Language variants related tests
20322 ###
20323 !! test
20324 Self-link in language variants
20325 !! options
20326 title=[[Dunav]] language=sr
20327 !! wikitext
20328 Both [[Dunav]] and [[Дунав]] are names for this river.
20329 !! html
20330 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
20331 </p>
20332 !!end
20333
20334 !! article
20335 Дуна
20336 !! text
20337 content
20338 !! endarticle
20339
20340 !! test
20341 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
20342 !! options
20343 title=[[Duna]] language=sr
20344 !! wikitext
20345 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
20346 !! html
20347 <p><a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Дуна</a> is not a self-link while <strong class="selflink">Duna</strong> and <strong class="selflink">Dуна</strong> are still self-links.
20348 </p>
20349 !! end
20350
20351 !! test
20352 Link to a section of a variant of this title shouldn't be parsed as self-link
20353 !! options
20354 title=[[Duna]] language=sr
20355 !! wikitext
20356 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
20357 !! html
20358 <p><strong class="selflink">Dуна</strong> is a self-link while <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dunа#Foo</a> and <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dуна#Foo</a> are not self-links.
20359 </p>
20360 !! end
20361
20362 !! test
20363 Link to pages in language variants
20364 !! options
20365 language=sr
20366 !! wikitext
20367 Main Page can be written as [[Маин Паге]]
20368 !! html
20369 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
20370 </p>
20371 !!end
20372
20373
20374 !! test
20375 Multiple links to pages in language variants
20376 !! options
20377 language=sr
20378 !! wikitext
20379 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
20380 !! html
20381 <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>.
20382 </p>
20383 !!end
20384
20385
20386 !! test
20387 Simple template in language variants
20388 !! options
20389 language=sr
20390 !! wikitext
20391 {{тест}}
20392 !! html
20393 <p>This is a test template
20394 </p>
20395 !! end
20396
20397
20398 !! test
20399 Template with explicit namespace in language variants
20400 !! options
20401 language=sr
20402 !! wikitext
20403 {{Template:тест}}
20404 !! html
20405 <p>This is a test template
20406 </p>
20407 !! end
20408
20409
20410 !! test
20411 Basic test for template parameter in language variants
20412 !! options
20413 language=sr
20414 !! wikitext
20415 {{парамтест|param=foo}}
20416 !! html
20417 <p>This is a test template with parameter foo
20418 </p>
20419 !! end
20420
20421 !! test
20422 Simple category in language variants
20423 !! options
20424 language=sr cat
20425 !! wikitext
20426 [[Category:МедиаWики Усер'с Гуиде]]
20427 !! html/php
20428 cat=МедиаWики_Усер'с_Гуиде sort=
20429 !! html/parsoid
20430 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
20431 !! end
20432
20433 !! article
20434 Category:分类
20435 !! text
20436 blah
20437 !! endarticle
20438
20439 !! article
20440 Category:分類
20441 !! text
20442 blah
20443 !! endarticle
20444
20445 ## We used to, but no longer wt2wt this test since the default serializer
20446 ## will normalize all categories to serialize on their own line.
20447 ## This wikitext usage is going to be fairly uncommon in production and
20448 ## selser will take care of preserving formatting in those scenarios.
20449 !! test
20450 Don't convert blue categorylinks to another variant (T35210)
20451 !! options
20452 cat
20453 language=zh
20454 parsoid=wt2html
20455 !! wikitext
20456 [[A]][[Category:分类]]
20457 !! html/php
20458 cat=分类 sort=
20459 !! html/parsoid
20460 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
20461 <link rel="mw:PageProp/Category" href="./Category:分类"/>
20462 !! end
20463
20464 !! test
20465 Stripping -{}- tags (language variants)
20466 !! options
20467 language=sr
20468 !! wikitext
20469 Latin proverb: -{Ne nuntium necare}-
20470 !! html
20471 <p>Latin proverb: Ne nuntium necare
20472 </p>
20473 !! end
20474
20475
20476 !! test
20477 Prevent conversion with -{}- tags (language variants)
20478 !! options
20479 language=sr variant=sr-ec
20480 !! wikitext
20481 Latinski: -{Ne nuntium necare}-
20482 !! html
20483 <p>Латински: Ne nuntium necare
20484 </p>
20485 !! end
20486
20487
20488 !! test
20489 Prevent conversion of text with -{}- tags (language variants)
20490 !! options
20491 language=sr variant=sr-ec
20492 !! wikitext
20493 Latinski: -{Ne nuntium necare}-
20494 !! html
20495 <p>Латински: Ne nuntium necare
20496 </p>
20497 !! end
20498
20499
20500 !! test
20501 Prevent conversion of links with -{}- tags (language variants)
20502 !! options
20503 language=sr variant=sr-ec
20504 !! wikitext
20505 -{[[Main Page]]}-
20506 !! html
20507 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20508 </p>
20509 !! end
20510
20511
20512 !! test
20513 -{}- tags within headlines (within html for parserConvert())
20514 !! options
20515 language=sr variant=sr-ec
20516 !! wikitext
20517 == -{Naslov}- ==
20518 !! html
20519 <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>
20520
20521 !! end
20522
20523
20524 !! test
20525 Explicit definition of language variant alternatives
20526 !! options
20527 language=zh variant=zh-tw
20528 !! wikitext
20529 -{zh:China;zh-tw:Taiwan}-, not China
20530 !! html
20531 <p>Taiwan, not China
20532 </p>
20533 !! end
20534
20535
20536 !! test
20537 Conversion around HTML tags
20538 !! options
20539 language=sr variant=sr-ec
20540 !! wikitext
20541 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
20542 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
20543 !! html
20544 <p>
20545 <span title="ЛаCтин">ски</span>
20546 </p>
20547 !! end
20548
20549
20550 !! test
20551 Explicit session-wise language variant mapping (A flag and - flag)
20552 !! options
20553 language=zh variant=zh-tw
20554 !! wikitext
20555 Taiwan is not China.
20556 But -{A|zh:China;zh-tw:Taiwan}- is China,
20557 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20558 and -{China}- is China.
20559 !! html
20560 <p>Taiwan is not China.
20561 But Taiwan is Taiwan,
20562 (This should be stripped!)
20563 and China is China.
20564 </p>
20565 !! end
20566
20567 !! test
20568 Explicit session-wise language variant mapping (H flag for hide)
20569 !! options
20570 language=zh variant=zh-tw
20571 !! wikitext
20572 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20573 Taiwan is China.
20574 !! html
20575 <p>(This should be stripped!)
20576 Taiwan is Taiwan.
20577 </p>
20578 !! end
20579
20580 !! test
20581 Adding explicit conversion rule for title (T flag)
20582 !! options
20583 language=zh variant=zh-tw showtitle
20584 !! wikitext
20585 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20586 !! html
20587 Taiwan
20588 <p>Should be stripped!
20589 </p>
20590 !! end
20591
20592 !! test
20593 Testing that changing the language variant here in the tests actually works
20594 !! options
20595 language=zh variant=zh showtitle
20596 !! wikitext
20597 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20598 !! html
20599 China
20600 <p>Should be stripped!
20601 </p>
20602 !! end
20603
20604 !! test
20605 Recursive conversion of alt and title attrs shouldn't clear converter state
20606 !! options
20607 language=zh variant=zh-cn showtitle
20608 !! wikitext
20609 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20610 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20611 !! html
20612 China
20613 <p>
20614 Should be stripped<span title="Exclamation">!</span>
20615 </p>
20616 !! end
20617
20618 !! test
20619 T26072: more test on conversion rule for title
20620 !! options
20621 language=zh variant=zh-tw showtitle
20622 !! wikitext
20623 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20624 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20625 !! html
20626 Taiwan
20627 <p>This should be stripped!
20628 This won't take interferes with the title rule.
20629 </p>
20630 !! end
20631
20632 !! test
20633 Partly disable title conversion if variant == main language code
20634 !! options
20635 language=zh variant=zh title=[[ZH]] showtitle
20636 !! wikitext
20637 -{T|zh-cn:CN;zh-tw:TW}-
20638 !! html
20639 ZH
20640 <p>
20641 </p>
20642 !! end
20643
20644 !! test
20645 Partly disable title conversion if variant == main language code, more
20646 !! options
20647 language=zh variant=zh title=[[ZH]] showtitle
20648 !! wikitext
20649 -{T|TW}-
20650 !! html
20651 ZH
20652 <p>
20653 </p>
20654 !! end
20655
20656 !! test
20657 Raw output of variant escape tags (R flag)
20658 !! options
20659 language=zh variant=zh-tw
20660 !! wikitext
20661 Raw: -{R|zh:China;zh-tw:Taiwan}-
20662 !! html
20663 <p>Raw: zh:China;zh-tw:Taiwan
20664 </p>
20665 !! end
20666
20667 !! test
20668 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20669 !! options
20670 language=zh variant=zh-cn
20671 !! input
20672 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20673 !! result
20674 <p>0
20675 </p>
20676 !! end
20677
20678 !! test
20679 Conversion rules from [numeric-only string] to [something else] (T48634)
20680 !! options
20681 language=zh variant=zh-cn
20682 !! input
20683 -{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
20684 !! result
20685 <p>D12345EE12345
20686 </p>
20687 !! end
20688
20689 !! test
20690 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20691 !! options
20692 language=zh variant=zh-cn
20693 !! input
20694 -{H|zh-cn:foo;zh-tw:;}-foobar
20695 !! result
20696 <p>foobar
20697 </p>
20698 !! end
20699
20700 !! test
20701 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20702 !! options
20703 language=zh variant=zh-cn
20704 !! input
20705 -{H|=>zh-cn:foo;}-foobar
20706 !! result
20707 <p>foobar
20708 </p>
20709 !! end
20710
20711 !! test
20712 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20713 !! options
20714 language=zh variant=zh-cn
20715 !! input
20716 -{H|}-foobar
20717 !! result
20718 <p>foobar
20719 </p>
20720 !! end
20721
20722 !! test
20723 Nested using of manual convert syntax
20724 !! options
20725 language=zh variant=zh-hk
20726 !! wikitext
20727 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20728 !! html
20729 <p>Nested: Hello Hong Kong!
20730 </p>
20731 !! end
20732
20733 !! test
20734 HTML markups with conversion syntax in attribs, nested in other conversion blocks
20735 !! options
20736 language=zh variant=zh-cn
20737 !! wikitext
20738 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
20739 !! html
20740 <p><span title="X">A</span>
20741 </p>
20742 !! end
20743
20744 !! test
20745 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet)
20746 !! options
20747 language=zh variant=zh-cn disabled
20748 !! wikitext
20749 -{<span title="-{X}-">A</span>}-
20750 !! html
20751 <p><span title="X">A</span>
20752 </p>
20753 !! end
20754
20755 # Since Parsoid is starting to emit canonical wikitext for links,
20756 # [http://example.com http://example.com] will not RT back to that
20757 # form anymore.
20758 !! test
20759 Proper conversion of text in external links
20760 !! options
20761 language=sr variant=sr-ec
20762 parsoid=wt2html
20763 !! wikitext
20764 http://www.google.com
20765 gopher://www.google.com
20766 [http://www.google.com http://www.google.com]
20767 [gopher://www.google.com gopher://www.google.com]
20768 [https://www.google.com irc://www.google.com]
20769 [ftp://www.google.com www.google.com/ftp://dir]
20770 [//www.google.com www.google.com]
20771 !! html/php
20772 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20773 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20774 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20775 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20776 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20777 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20778 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20779 </p>
20780 !! html/parsoid
20781 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20782 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20783 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20784 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20785 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20786 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20787 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20788 !! end
20789
20790 !! test
20791 Do not convert roman numbers to language variants
20792 !! options
20793 language=sr variant=sr-ec
20794 !! wikitext
20795 Fridrih IV je car.
20796 !! html
20797 <p>Фридрих IV је цар.
20798 </p>
20799 !! end
20800
20801 !! test
20802 Unclosed language converter markup "-{"
20803 !! options
20804 language=sr
20805 !! wikitext
20806 -{T|hello
20807 !! html
20808 <p>-{T|hello
20809 </p>
20810 !! end
20811
20812 !! test
20813 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20814 !! options
20815 language=sr
20816 !! wikitext
20817 -{R|=&gt;}-
20818 !! html
20819 <p>=&gt;
20820 </p>
20821 !!end
20822
20823 !! test
20824 Don't break link parsing if language converter markup is in the caption.
20825 !! options
20826 language=sr variant=sr-ec
20827 !! wikitext
20828 [[Main Page|-{R|main page}-]]
20829 !! html
20830 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20831 </p>
20832 !! end
20833
20834 # FIXME: This test is currently broken in the PHP parser T153761
20835 !! test
20836 T146304: Don't break template parsing if language converter markup is in the parameter.
20837 !! options
20838 language=sr variant=sr-ec
20839 disabled
20840 !! wikitext
20841 {{echo|-{R|foo}-}}
20842 !! html/php
20843 <p>foo
20844 </p>
20845 !! end
20846
20847 !! test
20848 T146305: Don't break image parsing if language converter markup is in the caption.
20849 !! options
20850 language=sr
20851 !! wikitext
20852 [[File:Foobar.jpg|thumb|-{R|caption:}-]]
20853 !! html/php
20854 <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>
20855
20856 !! html/parsoid
20857 <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>
20858 !! end
20859
20860 !! test
20861 T146305: Don't break image parsing if nested language converter markup is in the caption.
20862 !! options
20863 language=zh variant=zh-cn
20864 !! wikitext
20865 [[File:Foobar.jpg|thumb|-{zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
20866 !! html/php
20867 <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>
20868
20869 !! html/parsoid
20870 <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>
20871 !! end
20872
20873 !! test
20874 Don't break gallery if language converter markup is inside.
20875 !! options
20876 language=zh
20877 !! wikitext
20878 <gallery>
20879 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
20880 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
20881 </gallery>
20882 !! html
20883 <ul class="gallery mw-gallery-traditional">
20884 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20885 <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>
20886 <div class="gallerytext">
20887 <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>
20888 </p>
20889 </div>
20890 </div></li>
20891 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20892 <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>
20893 <div class="gallerytext">
20894 <p>This is a test template
20895 </p>
20896 </div>
20897 </div></li>
20898 </ul>
20899
20900 !! end
20901
20902 !! test
20903 T153135: Don't break list handling if language converter markup is in the item.
20904 !! options
20905 language=zh variant=zh-cn
20906 !! wikitext
20907 ;-{zh-cn:AAA;zh-tw:BBB}-
20908 ;-{R|foo:bar}-
20909 !! html/php
20910 <dl><dt>AAA</dt>
20911 <dt>foo:bar</dt></dl>
20912
20913 !! html/parsoid
20914 <dl>
20915 <dt><span typeof="mw:LanguageVariant" data-mw='{"bidir":[{"l":"zh-cn","t":"AAA"},{"l":"zh-tw","t":"BBB"}],"show":true}'></span></dt>
20916 <dt><span typeof="mw:LanguageVariant" data-mw='{"disabled":true,"show":true,"text":"foo:bar"}'></span></dt>
20917 </dl>
20918 !! end
20919
20920 // Note that parsoid does not protect colons unless language converter
20921 // markup is properly nested, because it is a backtracking parser.
20922 !! test
20923 T153135: Unclosed markup in definition list (code coverage)
20924 !! options
20925 language=zh variant=zh-cn
20926 !! wikitext
20927 ;<b>foo:bar
20928 ;-{zh-cn:AAA
20929 !! html/php
20930 <dl><dt><b>foo:bar</dt>
20931 <dt>-{zh-cn:AAA</b></dt></dl>
20932
20933 !! html/parsoid
20934 <dl>
20935 <dt><b>foo:bar</b></dt>
20936 <b>
20937 <dt>-{zh-cn</dt>
20938 <dd>AAA</dd>
20939 </b></dl>
20940 !! end
20941
20942 !! test
20943 T153135: Nested language converter markup in definition list (code coverage)
20944 !! options
20945 language=zh variant=zh-cn
20946 !! wikitext
20947 ;-{zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
20948 !! html/php
20949 <dl><dt>AAA foo:bar bat:baz</dt>
20950 <dd>def</dd></dl>
20951
20952 !! html/parsoid
20953 <dl>
20954 <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>
20955 <dd>def</dd>
20956 </dl>
20957 !! end
20958
20959 !! test
20960 T153140: Don't break table handling if language converter markup is in the cell.
20961 !! options
20962 language=sr variant=sr-ec
20963 !! wikitext
20964 {|
20965 |-
20966 | -{R|B}-
20967 |}
20968 !! html/php
20969 <table>
20970
20971 <tr>
20972 <td> B
20973 </td></tr></table>
20974
20975 !! html/parsoid
20976 <table>
20977
20978 <tr>
20979 <td> B
20980 </td></tr></table>
20981
20982 !! end
20983
20984 !! test
20985 T2529: Uncovered bullet
20986 !! wikitext
20987 * Foo {{bullet}}
20988 !! html
20989 <ul><li> Foo </li>
20990 <li> Bar</li></ul>
20991
20992 !! end
20993
20994 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20995 # Templates in Wikipedia rely on this behavior, as tidy has always been
20996 # enabled there. These tests are normally run *without* tidy, so specify the
20997 # full output here.
20998 # To test realistic parsing behavior, apply a tidy-like transformation to both
20999 # the expected output and your parser's output.
21000 !! test
21001 T2529: Uncovered bullet leaving empty list, normally removed by tidy
21002 !! wikitext
21003 ******* Foo {{bullet}}
21004 !! html
21005 <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>
21006 <li> Bar</li></ul>
21007
21008 !! end
21009
21010 !! test
21011 T2529: Uncovered table already at line-start
21012 !! wikitext
21013 x
21014
21015 {{table}}
21016 y
21017 !! html
21018 <p>x
21019 </p>
21020 <table>
21021 <tr>
21022 <td> 1 </td>
21023 <td> 2
21024 </td></tr>
21025 <tr>
21026 <td> 3 </td>
21027 <td> 4
21028 </td></tr></table>
21029 <p>y
21030 </p>
21031 !! end
21032
21033 !! test
21034 T2529: Uncovered bullet in parser function result
21035 !! wikitext
21036 * Foo {{lc:{{bullet}} }}
21037 !! html
21038 <ul><li> Foo </li>
21039 <li> bar</li></ul>
21040
21041 !! end
21042
21043 !! test
21044 T7678: Double-parsed template argument
21045 !! wikitext
21046 {{lc:{{{1}}}|hello}}
21047 !! html
21048 <p>{{{1}}}
21049 </p>
21050 !! end
21051
21052 !! test
21053 T7678: Double-parsed template invocation
21054 !! wikitext
21055 {{lc:{{paramtest {{!}} param = hello }} }}
21056 !! html
21057 <p>{{paramtest | param = hello }}
21058 </p>
21059 !! end
21060
21061 !! test
21062 Case insensitivity of parser functions for non-ASCII characters (T10143)
21063 !! options
21064 language=cs
21065 title=[[Main Page]]
21066 !! wikitext
21067 {{PRVNÍVELKÉ:ěščř}}
21068 {{prvnívelké:ěščř}}
21069 {{PRVNÍMALÉ:ěščř}}
21070 {{prvnímalé:ěščř}}
21071 {{MALÁ:ěščř}}
21072 {{malá:ěščř}}
21073 {{VELKÁ:ěščř}}
21074 {{velká:ěščř}}
21075 !! html
21076 <p>Ěščř
21077 Ěščř
21078 ěščř
21079 ěščř
21080 ěščř
21081 ěščř
21082 ĚŠČŘ
21083 ĚŠČŘ
21084 </p>
21085 !! end
21086
21087 !! test
21088 Morwen/13: Unclosed link followed by heading
21089 !! wikitext
21090 [[link
21091 ==heading==
21092 !! html
21093 <p>[[link
21094 </p>
21095 <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>
21096
21097 !! end
21098
21099 !! test
21100 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
21101 !! wikitext
21102 {{foo|
21103 =heading=
21104 !! html
21105 <p>{{foo|
21106 </p>
21107 <h1><span class="mw-headline" id="heading">heading</span></h1>
21108
21109 !! end
21110
21111 !! test
21112 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
21113 !! wikitext
21114 {{foo|
21115 ==heading==
21116 !! html
21117 <p>{{foo|
21118 </p>
21119 <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>
21120
21121 !! end
21122
21123 !! test
21124 Tildes in comments
21125 !! options
21126 pst
21127 !! wikitext
21128 <!-- ~~~~ -->
21129 !! html/php
21130 <!-- ~~~~ -->
21131 !! end
21132
21133 !! test
21134 Paragraphs inside divs (no extra line breaks)
21135 !! wikitext
21136 <div>Line one
21137
21138 Line two</div>
21139 !! html
21140 <div>Line one
21141 Line two</div>
21142
21143 !! end
21144
21145 !! test
21146 Paragraphs inside divs (extra line break on open)
21147 !! wikitext
21148 <div>
21149 Line one
21150
21151 Line two</div>
21152 !! html
21153 <div>
21154 <p>Line one
21155 </p>
21156 Line two</div>
21157
21158 !! end
21159
21160 !! test
21161 Paragraphs inside divs (extra line break on close)
21162 !! wikitext
21163 <div>Line one
21164
21165 Line two
21166 </div>
21167 !! html
21168 <div>Line one
21169 <p>Line two
21170 </p>
21171 </div>
21172
21173 !! end
21174
21175 !! test
21176 Paragraphs inside divs (extra line break on open and close)
21177 !! wikitext
21178 <div>
21179 Line one
21180
21181 Line two
21182 </div>
21183 !! html
21184 <div>
21185 <p>Line one
21186 </p><p>Line two
21187 </p>
21188 </div>
21189
21190 !! end
21191
21192 !! test
21193 Nesting tags, paragraphs on lines which begin with <div>
21194 !! wikitext
21195 <div></div><strong>A
21196 B</strong>
21197 !! html/php+tidy
21198 <p><strong>A</strong></p>
21199 <p><strong>B</strong></p>
21200 !! html/parsoid
21201 <div></div>
21202 <p><strong>A
21203 B</strong>
21204 </p>
21205 !! end
21206
21207 # T8200: <blockquote> should behave like <div> with respect to line breaks
21208 !! test
21209 T8200: paragraphs inside blockquotes (no extra line breaks)
21210 !! wikitext
21211 <blockquote>Line one
21212
21213 Line two</blockquote>
21214 !! html
21215 <blockquote>Line one
21216 Line two</blockquote>
21217
21218 !! html+tidy
21219 <blockquote>
21220 <p>Line one Line two</p>
21221 </blockquote>
21222 !! end
21223
21224 !! test
21225 T8200: paragraphs inside blockquotes (extra line break on open)
21226 !! wikitext
21227 <blockquote>
21228 Line one
21229
21230 Line two</blockquote>
21231 !! html
21232 <blockquote>
21233 <p>Line one
21234 </p>
21235 Line two</blockquote>
21236
21237 !! html+tidy
21238 <blockquote>
21239 <p>Line one</p>
21240 Line two</blockquote>
21241 !! end
21242
21243 !! test
21244 T8200: paragraphs inside blockquotes (extra line break on close)
21245 !! wikitext
21246 <blockquote>Line one
21247
21248 Line two
21249 </blockquote>
21250 !! html
21251 <blockquote>Line one
21252 <p>Line two
21253 </p>
21254 </blockquote>
21255
21256 !! html+tidy
21257 <blockquote>
21258 <p>Line one</p>
21259 <p>Line two</p>
21260 </blockquote>
21261 !! end
21262
21263 !! test
21264 T8200: paragraphs inside blockquotes (extra line break on open and close)
21265 !! wikitext
21266 <blockquote>
21267 Line one
21268
21269 Line two
21270 </blockquote>
21271 !! html
21272 <blockquote>
21273 <p>Line one
21274 </p><p>Line two
21275 </p>
21276 </blockquote>
21277
21278 !! html+tidy
21279 <blockquote>
21280 <p>Line one</p>
21281 <p>Line two</p>
21282 </blockquote>
21283 !! end
21284
21285 !! test
21286 Paragraphs inside blockquotes/divs (no extra line breaks)
21287 !! wikitext
21288 <blockquote><div>Line one
21289
21290 Line two</div></blockquote>
21291 !! html
21292 <blockquote><div>Line one
21293 Line two</div></blockquote>
21294
21295 !! end
21296
21297 !! test
21298 Paragraphs inside blockquotes/divs (extra line break on open)
21299 !! wikitext
21300 <blockquote><div>
21301 Line one
21302
21303 Line two</div></blockquote>
21304 !! html
21305 <blockquote><div>
21306 <p>Line one
21307 </p>
21308 Line two</div></blockquote>
21309
21310 !! end
21311
21312 !! test
21313 Paragraphs inside blockquotes/divs (extra line break on close)
21314 !! wikitext
21315 <blockquote><div>Line one
21316
21317 Line two
21318 </div></blockquote>
21319 !! html
21320 <blockquote><div>Line one
21321 <p>Line two
21322 </p>
21323 </div></blockquote>
21324
21325 !! end
21326
21327 !! test
21328 Paragraphs inside blockquotes/divs (extra line break on open and close)
21329 !! wikitext
21330 <blockquote><div>
21331 Line one
21332
21333 Line two
21334 </div></blockquote>
21335 !! html
21336 <blockquote><div>
21337 <p>Line one
21338 </p><p>Line two
21339 </p>
21340 </div></blockquote>
21341
21342 !! end
21343
21344 !! test
21345 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
21346 !! options
21347 wgLinkHolderBatchSize=0
21348 !! wikitext
21349 [[meatball:1]]
21350 [[meatball:2]]
21351 [[meatball:3]]
21352 !! html
21353 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
21354 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
21355 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
21356 </p>
21357 !! end
21358
21359 !! test
21360 Free external link invading image caption
21361 !! wikitext
21362 [[Image:Foobar.jpg|thumb|http://x|hello]]
21363 !! html
21364 <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>
21365
21366 !! end
21367
21368 !! test
21369 T17196: localised external link numbers
21370 !! options
21371 language=fa
21372 !! wikitext
21373 [http://en.wikipedia.org/]
21374 !! html/php
21375 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
21376 </p>
21377 !! html/parsoid
21378 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
21379 !! end
21380
21381 !! test
21382 Multibyte character in padleft
21383 !! wikitext
21384 {{padleft:-Hello|7|Æ}}
21385 !! html
21386 <p>Æ-Hello
21387 </p>
21388 !! end
21389
21390 !! test
21391 Multibyte character in padright
21392 !! wikitext
21393 {{padright:Hello-|7|Æ}}
21394 !! html
21395 <p>Hello-Æ
21396 </p>
21397 !! end
21398
21399 !!test
21400 formatdate parser function
21401 !! wikitext
21402 {{#formatdate:2009-03-24}}
21403 !! html
21404 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
21405 </p>
21406 !! end
21407
21408 !!test
21409 formatdate parser function, with default format
21410 !! wikitext
21411 {{#formatdate:2009-03-24|mdy}}
21412 !! html
21413 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
21414 </p>
21415 !! end
21416
21417 !! test
21418 Spacing of numbers in formatted dates
21419 !! wikitext
21420 {{#formatdate:January 15}}
21421 !! html
21422 <p><span class="mw-formatted-date" title="01-15">January 15</span>
21423 </p>
21424 !! end
21425
21426 !! test
21427 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
21428 !! options
21429 language=nl title=[[MediaWiki:Common.css]]
21430 !! wikitext
21431 {{#formatdate:2009-03-24|dmy}}
21432 !! html
21433 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
21434 </p>
21435 !! end
21436
21437 #
21438 #
21439 #
21440
21441 #
21442 # Edit comments
21443 #
21444
21445 !! test
21446 Edit comment with link
21447 !! options
21448 comment
21449 !! wikitext
21450 I like the [[Main Page]] a lot
21451 !! html/php
21452 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
21453 !!end
21454
21455 !! test
21456 Edit comment with link and link text
21457 !! options
21458 comment
21459 !! wikitext
21460 I like the [[Main Page|best pages]] a lot
21461 !! html/php
21462 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21463 !!end
21464
21465 !! test
21466 Edit comment with link and link text with suffix
21467 !! options
21468 comment
21469 !! wikitext
21470 I like the [[Main Page|best page]]s a lot
21471 !! html/php
21472 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21473 !!end
21474
21475 !! test
21476 Edit comment with section link (non-local, eg in history list)
21477 !! options
21478 comment title=[[Main Page]]
21479 !! wikitext
21480 /* External links */ removed bogus entries
21481 !! html/php
21482 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21483 !!end
21484
21485 !! test
21486 Edit comment with section link and text before it (non-local, eg in history list)
21487 !! options
21488 comment title=[[Main Page]]
21489 !! wikitext
21490 pre-comment text /* External links */ removed bogus entries
21491 !! html/php
21492 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>
21493 !!end
21494
21495 !! test
21496 Edit comment with section link (local, eg in diff view)
21497 !! options
21498 comment local title=[[Main Page]]
21499 !! wikitext
21500 /* External links */ removed bogus entries
21501 !! html/php
21502 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21503 !!end
21504
21505 !! test
21506 Edit comment with subpage link (T16080)
21507 !! options
21508 comment
21509 subpage
21510 title=[[Subpage test]]
21511 !! wikitext
21512 Poked at a [[/subpage]] here...
21513 !! html/php
21514 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
21515 !!end
21516
21517 !! test
21518 Edit comment with subpage link and link text (T16080)
21519 !! options
21520 comment
21521 subpage
21522 title=[[Subpage test]]
21523 !! wikitext
21524 Poked at a [[/subpage|neat little page]] here...
21525 !! html/php
21526 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
21527 !!end
21528
21529 !! test
21530 Edit comment with bogus subpage link in non-subpage NS (T16080)
21531 !! options
21532 comment
21533 title=[[Subpage test]]
21534 !! wikitext
21535 Poked at a [[/subpage]] here...
21536 !! html/php
21537 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...
21538 !!end
21539
21540 !! test
21541 Edit comment with bare anchor link (local, as on diff)
21542 !! options
21543 comment
21544 local
21545 title=[[Main Page]]
21546 !! wikitext
21547 [[#section]]
21548 !! html/php
21549 <a href="#section">#section</a>
21550 !! end
21551
21552 !! test
21553 Edit comment with bare anchor link (non-local, as on history)
21554 !! options
21555 comment
21556 title=[[Main Page]]
21557 !! wikitext
21558 [[#section]]
21559 !! html/php
21560 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
21561 !! end
21562
21563 !! test
21564 Anchor starting with underscore
21565 !! options
21566 title=[[Foo]]
21567 !! wikitext
21568 [[#_ref|One]]
21569 !! html/php
21570 <p><a href="#_ref">One</a>
21571 </p>
21572 !! html/parsoid
21573 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
21574 !! end
21575
21576 !! test
21577 Id starting with underscore
21578 !! wikitext
21579 <div id="_ref"></div>
21580 !! html/*
21581 <div id="_ref"></div>
21582
21583 !! end
21584
21585 !! test
21586 Edit comment with link with more than one pipe (T99346)
21587 !! options
21588 comment
21589 !! wikitext
21590 [[Main Page|Many|pipes]]
21591 !! html/php
21592 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
21593 !! end
21594
21595 !! test
21596 Complex edit comment with link with more than one pipe (T99346)
21597 !! options
21598 comment
21599 !! wikitext
21600 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
21601 !! html/php
21602 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;
21603 !! end
21604
21605 !! test
21606 Space normalisation on autocomment (T24784)
21607 !! options
21608 comment
21609 title=[[Main Page]]
21610 !! wikitext
21611 /* __hello__world__ */
21612 !! html/php
21613 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
21614 !! end
21615
21616 !! test
21617 percent-encoding and + signs in comments (T28410)
21618 !! options
21619 comment
21620 !! wikitext
21621 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
21622 !! html/php
21623 <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>
21624 !! end
21625
21626 # Parsoid doesn't support this yet: see T75581
21627 # but it *should* omit the 'src' attribute if the image is bad.
21628 # PHP side of tests was disabled in
21629 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
21630 # because of issues in the PHP parserTests infrastructure
21631 # (but the output below is indeed what the PHP side emits)
21632 !! test
21633 Bad images - basic functionality
21634 !! wikitext
21635 [[File:Bad.jpg]]
21636 !! DISABLED/html/php
21637 !! html/parsoid
21638 <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>
21639 !! end
21640
21641 !! test
21642 Bad images - T18039: text after bad image disappears
21643 !! wikitext
21644 Foo bar
21645 [[File:Bad.jpg]]
21646 Bar foo
21647 !! DISABLED/html/php
21648 <p>Foo bar
21649 </p><p>Bar foo
21650 </p>
21651 !! html/parsoid
21652 <p>Foo bar
21653 <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>
21654 Bar foo</p>
21655 !! end
21656
21657 !! test
21658 Verify that displaytitle works (T24501) no displaytitle
21659 !! options
21660 showtitle
21661 !! config
21662 wgAllowDisplayTitle=true
21663 wgRestrictDisplayTitle=false
21664 !! wikitext
21665 this is not the the title
21666 !! html/php
21667 Parser test
21668 <p>this is not the the title
21669 </p>
21670 !! end
21671
21672 !! test
21673 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
21674 !! options
21675 showtitle
21676 title=[[Screen]]
21677 !! config
21678 wgAllowDisplayTitle=true
21679 wgRestrictDisplayTitle=false
21680 !! wikitext
21681 this is not the the title
21682 {{DISPLAYTITLE:whatever}}
21683 !! html/php
21684 whatever
21685 <p>this is not the the title
21686 </p>
21687 !! end
21688
21689 !! test
21690 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
21691 !! options
21692 showtitle
21693 title=[[Screen]]
21694 !! config
21695 wgAllowDisplayTitle=true
21696 wgRestrictDisplayTitle=true
21697 !! wikitext
21698 this is not the the title
21699 {{DISPLAYTITLE:whatever}}
21700 !! html/php
21701 Screen
21702 <p>this is not the the title
21703 </p>
21704 !! end
21705
21706 !! test
21707 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
21708 !! options
21709 showtitle
21710 title=[[Screen]]
21711 !! config
21712 wgAllowDisplayTitle=true
21713 wgRestrictDisplayTitle=true
21714 !! wikitext
21715 this is not the the title
21716 {{DISPLAYTITLE:screen}}
21717 !! html/php
21718 screen
21719 <p>this is not the the title
21720 </p>
21721 !! end
21722
21723 !! test
21724 Verify that displaytitle works (T24501) AllowDisplayTitle=false
21725 !! options
21726 showtitle
21727 title=[[Screen]]
21728 !! config
21729 wgAllowDisplayTitle=false
21730 !! wikitext
21731 this is not the the title
21732 {{DISPLAYTITLE:screen}}
21733 !! html/php
21734 Screen
21735 <p>this is not the the title
21736 <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>
21737 </p>
21738 !! end
21739
21740 !! test
21741 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
21742 !! options
21743 showtitle
21744 title=[[Screen]]
21745 !! config
21746 wgAllowDisplayTitle=false
21747 !! wikitext
21748 this is not the the title
21749 !! html/php
21750 Screen
21751 <p>this is not the the title
21752 </p>
21753 !! end
21754
21755 !! test
21756 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
21757 !! options
21758 showtitle
21759 title=[[Screen]]
21760 !! config
21761 wgAllowDisplayTitle=true
21762 wgRestrictDisplayTitle=true
21763 !! wikitext
21764 this is not the the title
21765 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21766 !! html/php
21767 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21768 <p>this is not the the title
21769 </p>
21770 !! end
21771
21772 !! test
21773 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
21774 !! options
21775 showtitle
21776 title=[[Screen]]
21777 !! config
21778 wgAllowDisplayTitle=true
21779 wgRestrictDisplayTitle=true
21780 !! wikitext
21781 this is not the the title
21782 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21783 !! html/php
21784 <span style="color: red;">s</span>creen
21785 <p>this is not the the title
21786 </p>
21787 !! end
21788
21789 !! test
21790 Page status indicators: Empty name is invalid
21791 !! options
21792 showindicators
21793 !! wikitext
21794 <indicator name=" "></indicator>
21795 <indicator></indicator>
21796 !! html
21797 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21798 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21799 </p>
21800 !! end
21801
21802 !! test
21803 Page status indicators: Weird syntaxes that are okay
21804 !! options
21805 showindicators
21806 !! wikitext
21807 <indicator name="empty" />
21808 <indicator name="name"></indicator>
21809 !! html
21810 empty=
21811 name=
21812 <p><br />
21813 </p>
21814 !! end
21815
21816 !! test
21817 Page status indicators: Torture test
21818 !! options
21819 showindicators
21820 !! wikitext
21821 <indicator name="01">hello world</indicator>
21822 <indicator name="02">[[Main Page]]</indicator>
21823 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21824 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21825 <indicator name="05">* foo
21826 * bar</indicator>
21827 <indicator name="06"><nowiki>foo</nowiki></indicator>
21828 <indicator name="07"> Preformatted</indicator>
21829 <indicator name="08"><div>Broken tag</indicator>
21830 <indicator name="09">{| class=wikitable
21831 | cell
21832 |}</indicator>
21833 <indicator name="10">Two
21834
21835 paragraphs</indicator>
21836 !! html
21837 01=hello world
21838 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21839 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" />
21840 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>
21841 05=<ul><li> foo</li>
21842 <li> bar</li></ul>
21843
21844 06=foo
21845 07=<pre>Preformatted
21846 </pre>
21847 08=<div>Broken tag</div>
21848
21849 09=<table class="wikitable">
21850 <tr>
21851 <td> cell
21852 </td></tr></table>
21853
21854 10=<p>Two
21855 </p><p>paragraphs
21856 </p>
21857 <p><br />
21858 </p><p><br />
21859 </p><p><br />
21860 </p><p><br />
21861 </p><p><br />
21862 </p>
21863 !! end
21864
21865 !! test
21866 preload: check <noinclude> and <includeonly>
21867 !! options
21868 preload
21869 !! wikitext
21870 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21871 !! html/php
21872 Hello kind world.
21873 !! end
21874
21875 !! test
21876 preload: check <onlyinclude>
21877 !! options
21878 preload
21879 !! wikitext
21880 Goodbye <onlyinclude>Hello world</onlyinclude>
21881 !! html/php
21882 Hello world
21883 !! end
21884
21885 !! test
21886 preload: can pass tags through if we want to
21887 !! options
21888 preload
21889 !! wikitext
21890 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21891 !! html/php
21892 <includeonly>Hello world</includeonly>
21893 !! end
21894
21895 !! test
21896 preload: check that it doesn't try to do tricks
21897 !! options
21898 preload
21899 !! wikitext
21900 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21901 !! html/php
21902 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21903 !! end
21904
21905 !! test
21906 Play a bit with r67090 and T5158
21907 !! wikitext
21908 <div style="width:50% !important">&nbsp;</div>
21909 <div style="width:50%&nbsp;!important">&nbsp;</div>
21910 <div style="width:50%&#160;!important">&nbsp;</div>
21911 <div style="border : solid;">&nbsp;</div>
21912 !! html/php
21913 <div style="width:50% !important">&#160;</div>
21914 <div style="width:50% !important">&#160;</div>
21915 <div style="width:50% !important">&#160;</div>
21916 <div style="border&#160;: solid;">&#160;</div>
21917
21918 !! html/parsoid
21919 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21920 <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>
21921 <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>
21922 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21923
21924 !! end
21925
21926 !! test
21927 HTML5 data attributes
21928 !! wikitext
21929 <span data-foo="bar">Baz</span>
21930 <p data-abc-def_hij="">Quuz</p>
21931 !! html/php
21932 <p><span data-foo="bar">Baz</span>
21933 </p>
21934 <p data-abc-def_hij="">Quuz</p>
21935
21936 !! html/parsoid
21937 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21938 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21939 !! end
21940
21941 !! test
21942 Strip reserved data attributes
21943 !! wikitext
21944 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21945 !! html/php
21946 <div data-ok="fred">d</div>
21947
21948 !! html/parsoid
21949 <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>
21950 !! end
21951
21952 !! test
21953 percent-encoding and + signs in internal links (T28410)
21954 !! wikitext
21955 [[User:+%]] [[Page+title%]]
21956 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21957 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21958 [[%33%45]] [[%33%45+]]
21959 !! html/php
21960 <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>
21961 <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>
21962 <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>
21963 <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>
21964 </p>
21965 !! html/parsoid
21966 <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>
21967 <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>
21968 <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>
21969 <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>
21970 !! end
21971
21972 !! test
21973 Special characters in embedded file links (T29679)
21974 !! wikitext
21975 [[File:Contains & ampersand.jpg]]
21976 [[File:Does not exist.jpg|Title with & ampersand]]
21977 !! html/php
21978 <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>
21979 <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>
21980 </p>
21981 !! html/parsoid
21982 <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>
21983 <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>
21984 !! end
21985
21986 !! test
21987 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21988 !! wikitext
21989 Text&apos;s been normalized?
21990 !! html
21991 <p>Text&#39;s been normalized?
21992 </p>
21993 !! end
21994
21995 !! test
21996 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21997 !! wikitext
21998 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21999 !! html
22000 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
22001 </p>
22002 !! end
22003
22004 !! test
22005 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
22006 !! wikitext
22007 [http://www.example.org/ ideograms]
22008 !! html
22009 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
22010 </p>
22011 !! end
22012
22013 !! test
22014 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
22015 !! wikitext
22016 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
22017 !! html
22018 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
22019 </p>
22020 !! end
22021
22022 !! article
22023 Mediawiki:loop1
22024 !! text
22025 {{Identical|A}}
22026 !! endarticle
22027
22028 !! article
22029 Mediawiki:loop2
22030 !! text
22031 {{Identical|B}}
22032 !! endarticle
22033
22034 !! article
22035 Template:Identical
22036 !! text
22037 {{int:loop1}}
22038 {{int:loop2}}
22039 !! endarticle
22040
22041 !! test
22042 T33098 Template which includes system messages which includes the template
22043 !! wikitext
22044 {{Identical}}
22045 !! html
22046 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22047 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22048 </p>
22049 !! end
22050
22051 !! test
22052 T33490 Turkish: ucfirst 'blah'
22053 !! options
22054 language=tr
22055 !! wikitext
22056 {{ucfirst:blah}}
22057 !! html
22058 <p>Blah
22059 </p>
22060 !! end
22061
22062 !! test
22063 T33490 Turkish: ucfirst 'ix'
22064 !! options
22065 language=tr
22066 !! wikitext
22067 {{ucfirst:ix}}
22068 !! html
22069 <p>İx
22070 </p>
22071 !! end
22072
22073 !! test
22074 T33490 Turkish: lcfirst 'BLAH'
22075 !! options
22076 language=tr
22077 !! wikitext
22078 {{lcfirst:BLAH}}
22079 !! html
22080 <p>bLAH
22081 </p>
22082 !! end
22083
22084 !! test
22085 T33490 Turkish: ucfırst (with a dotless i)
22086 !! options
22087 language=tr
22088 !! wikitext
22089 {{ucfırst:blah}}
22090 !! html
22091 <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>
22092 </p>
22093 !! end
22094
22095 !! test
22096 T33490 ucfırst (with a dotless i) with English language
22097 !! options
22098 language=en
22099 !! wikitext
22100 {{ucfırst:blah}}
22101 !! html
22102 <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>
22103 </p>
22104 !! end
22105
22106 !! test
22107 T28375: TOC with italics
22108 !! options
22109 title=[[Main Page]]
22110 !! wikitext
22111 __TOC__
22112 == ''Lost'' episodes ==
22113 !! html
22114 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22115 <ul>
22116 <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>
22117 </ul>
22118 </div>
22119
22120 <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>
22121
22122 !! end
22123
22124 !! test
22125 T28375: TOC with bold
22126 !! options
22127 title=[[Main Page]]
22128 !! wikitext
22129 __TOC__
22130 == '''should be bold''' then normal text ==
22131 !! html
22132 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22133 <ul>
22134 <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>
22135 </ul>
22136 </div>
22137
22138 <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>
22139
22140 !! end
22141
22142 !! test
22143 T35845: Headings become cursive in TOC when they contain an image
22144 !! options
22145 title=[[Main Page]]
22146 !! wikitext
22147 __TOC__
22148 == Image [[Image:foobar.jpg]] ==
22149 !! html
22150 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22151 <ul>
22152 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
22153 </ul>
22154 </div>
22155
22156 <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>
22157
22158 !! end
22159
22160 !! test
22161 T35845 (2): Headings become bold in TOC when they contain a blockquote
22162 !! options
22163 title=[[Main Page]]
22164 !! wikitext
22165 __TOC__
22166 == <blockquote>Quote</blockquote> ==
22167 !! html
22168 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22169 <ul>
22170 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22171 </ul>
22172 </div>
22173
22174 <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>
22175
22176 !! html+tidy
22177 <p></p>
22178 <div id="toc" class="toc">
22179 <div id="toctitle">
22180 <h2>Contents</h2>
22181 </div>
22182 <ul>
22183 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22184 </ul>
22185 </div>
22186 <p></p>
22187 <h2><span class="mw-headline" id="Quote"></span></h2>
22188 <blockquote>
22189 <p><span class="mw-headline" id="Quote">Quote</span></p>
22190 </blockquote>
22191 <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>
22192 !! end
22193
22194 !! test
22195 Unclosed tags in TOC
22196 !! options
22197 title=[[Main Page]]
22198 !! wikitext
22199 __TOC__
22200 == Proof: 2 < 3 ==
22201 <small>Hanc marginis exiguitas non caperet.</small>
22202 QED
22203 !! html
22204 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22205 <ul>
22206 <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>
22207 </ul>
22208 </div>
22209
22210 <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>
22211 <p><small>Hanc marginis exiguitas non caperet.</small>
22212 QED
22213 </p>
22214 !! end
22215
22216 !! test
22217 Multiple tags in TOC
22218 !! wikitext
22219 __TOC__
22220 == <i>Foo</i> <b>Bar</b> ==
22221
22222 == <i>Foo</i> <blockquote>Bar</blockquote> ==
22223 !! html
22224 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22225 <ul>
22226 <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>
22227 <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>
22228 </ul>
22229 </div>
22230
22231 <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>
22232 <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>
22233
22234 !! html+tidy
22235 <p></p>
22236 <div id="toc" class="toc">
22237 <div id="toctitle">
22238 <h2>Contents</h2>
22239 </div>
22240 <ul>
22241 <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>
22242 <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>
22243 </ul>
22244 </div>
22245 <p></p>
22246 <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>
22247 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
22248 <blockquote>
22249 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
22250 </blockquote>
22251 <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>
22252 !! end
22253
22254 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
22255 # html5 tag parsing.
22256 !! test
22257 Tags with parameters in TOC
22258 !! options
22259 parsoid=wt2html
22260 !! wikitext
22261 __TOC__
22262 == <sup class="in-h2">Hello</sup> ==
22263
22264 == <sup class="a > b">Evilbye</sup> ==
22265 !! html/php
22266 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22267 <ul>
22268 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
22269 <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>
22270 </ul>
22271 </div>
22272
22273 <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>
22274 <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>
22275
22276 !! html/parsoid
22277 <meta property="mw:PageProp/toc" />
22278 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
22279
22280 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
22281 !! end
22282
22283 !! test
22284 span tags with directionality in TOC
22285 !! wikitext
22286 __TOC__
22287 == <span dir="ltr">C++</span> ==
22288
22289 == <span dir="rtl">זבנג!</span> ==
22290
22291 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
22292
22293 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
22294
22295 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
22296 !! html
22297 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22298 <ul>
22299 <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>
22300 <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>
22301 <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>
22302 <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>
22303 <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>
22304 </ul>
22305 </div>
22306
22307 <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>
22308 <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>
22309 <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>
22310 <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>
22311 <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>
22312
22313 !! end
22314
22315 !! test
22316 T74884: bdi element in ToC
22317 !! wikitext
22318 __TOC__
22319 == <bdi>test</bdi> ==
22320 !! html
22321 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22322 <ul>
22323 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
22324 </ul>
22325 </div>
22326
22327 <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>
22328
22329 !! end
22330
22331 !! test
22332 T35715: s/strike element in ToC
22333 !! wikitext
22334 __TOC__
22335 == <s>test</s> test <strike>test</strike> ==
22336 !! html
22337 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22338 <ul>
22339 <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>
22340 </ul>
22341 </div>
22342
22343 <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>
22344
22345 !! end
22346
22347 # Note that the html output does not have the <p></p>, but the
22348 # html+tidy output *does*. This is because the empty <p></p> is
22349 # removed by the sanitizer, but only when tidy is *not* enabled (!).
22350 !! test
22351 Empty <p> tag in TOC, removed by Sanitizer (T92892)
22352 !! wikitext
22353 __TOC__
22354 == x ==
22355 !! html
22356 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22357 <ul>
22358 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22359 </ul>
22360 </div>
22361
22362 <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>
22363
22364 !! html+tidy
22365 <p></p>
22366 <div id="toc" class="toc">
22367 <div id="toctitle">
22368 <h2>Contents</h2>
22369 </div>
22370 <ul>
22371 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22372 </ul>
22373 </div>
22374 <p></p>
22375 <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>
22376 !! end
22377
22378 !! article
22379 MediaWiki:T34057
22380 !! text
22381 == {{int:headline_sample}} ==
22382 !! endarticle
22383
22384 !! test
22385 T34057: Title needed when expanding <h> nodes.
22386 !! options
22387 title=[[Main Page]]
22388 !! wikitext
22389 {{int:T34057}}
22390 !! html
22391 <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>
22392
22393 !! end
22394
22395 !! test
22396 Strip marker in urlencode
22397 !! wikitext
22398 {{urlencode:x<nowiki/>y}}
22399 {{urlencode:x<nowiki/>y|wiki}}
22400 {{urlencode:x<nowiki/>y|path}}
22401 {{urlencode:x<pre id="one">two</pre>y}}
22402 !! html/php
22403 <p>xy
22404 xy
22405 xy
22406 xy
22407 </p>
22408 !! end
22409
22410 !! test
22411 Strip marker in lc
22412 !! wikitext
22413 {{lc:x<nowiki/>y}}
22414 !! html
22415 <p>xy
22416 </p>
22417 !! end
22418
22419 !! test
22420 Strip marker in uc
22421 !! wikitext
22422 {{uc:x<nowiki/>y}}
22423 !! html
22424 <p>XY
22425 </p>
22426 !! end
22427
22428 !! test
22429 Strip marker in formatNum
22430 !! wikitext
22431 {{formatnum:1<nowiki/>2}}
22432 {{formatnum:1<nowiki/>2|R}}
22433 !! html
22434 <p>12
22435 12
22436 </p>
22437 !! end
22438
22439 !! test
22440 Check noCommafy in formatNum
22441 !! options
22442 language=be-tarask
22443 !! wikitext
22444 {{formatnum:123456.78}}
22445 {{formatnum:123456.78|NOSEP}}
22446 !! html
22447 <p>123 456,78
22448 123456.78
22449 </p>
22450 !! end
22451
22452 !! test
22453 Wrong option for formatNum (T58199)
22454 !! wikitext
22455 {{formatnum:1,234.56|Random}}
22456 {{formatnum:1,234.56|EVERYTHING}}
22457 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
22458 !! html
22459 <p>1,234.56
22460 1,234.56
22461 1,234.56
22462 </p>
22463 !! end
22464
22465 !! test
22466 Strip marker in grammar
22467 !! options
22468 language=fi
22469 !! wikitext
22470 {{grammar:elative|foo<nowiki/>bar}}
22471 !! html
22472 <p>foobarista
22473 </p>
22474 !! end
22475
22476 !! test
22477 Strip marker in padleft
22478 !! wikitext
22479 {{padleft:|2|x<nowiki/>y}}
22480 !! html
22481 <p>xy
22482 </p>
22483 !! end
22484
22485 !! test
22486 Strip marker in padright
22487 !! wikitext
22488 {{padright:|2|x<nowiki/>y}}
22489 !! html
22490 <p>xy
22491 </p>
22492 !! end
22493
22494 !! test
22495 Strip marker in anchorencode
22496 !! wikitext
22497 {{anchorencode:x<nowiki/>y}}
22498 !! html
22499 <p>xy
22500 </p>
22501 !! end
22502
22503 !! test
22504 nowiki inside link inside heading (T20295)
22505 !! wikitext
22506 ==[[foo|x<nowiki>y</nowiki>z]]==
22507 !! html
22508 <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>
22509
22510 !! end
22511
22512 !! test
22513 new support for bdi element (T33817)
22514 !! wikitext
22515 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22516 !! html
22517 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22518
22519 !!end
22520
22521 !! test
22522 Ignore pipe between table row attributes
22523 !! wikitext
22524 {|
22525 | quux
22526 |- id=foo | style='color: red'
22527 | bar
22528 |}
22529 !! html
22530 <table>
22531 <tr>
22532 <td> quux
22533 </td></tr>
22534 <tr id="foo" style="color: red">
22535 <td> bar
22536 </td></tr></table>
22537
22538 !! end
22539
22540 !!test
22541 Language parser function
22542 !! wikitext
22543 {{#language:ar}}
22544 !! html
22545 <p>العربية
22546 </p>
22547 !! end
22548
22549 !!test
22550 Padleft and padright as substr
22551 !! wikitext
22552 {{padleft:|3|abcde}}
22553 {{padright:|3|abcde}}
22554 !! html
22555 <p>abc
22556 abc
22557 </p>
22558 !! end
22559
22560 !!test
22561 Special parser function
22562 !! wikitext
22563 {{#special:RandomPage}}
22564 {{#special:BaDtItLe}}
22565 {{#special:Foobar}}
22566 !! html
22567 <p>Special:Random
22568 Special:Badtitle
22569 Special:Foobar
22570 </p>
22571 !! end
22572
22573 !!test
22574 T36939 - Case insensitive link parsing ([HttP://])
22575 !! wikitext
22576 [HttP://MediaWiki.Org/]
22577 !! html/php
22578 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
22579 </p>
22580 !! html/parsoid
22581 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
22582 !! end
22583
22584 !!test
22585 T36939 - Case insensitive link parsing ([HttP:// title])
22586 !! wikitext
22587 [HttP://MediaWiki.Org/ MediaWiki]
22588 !! html
22589 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22590 </p>
22591 !! end
22592
22593 !!test
22594 T36939 - Case insensitive link parsing (HttP://)
22595 !! wikitext
22596 HttP://MediaWiki.Org/
22597 !! html/php
22598 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22599 </p>
22600 !! html/parsoid
22601 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22602 !! end
22603
22604 !!test
22605 Disable TOC
22606 !! options
22607 notoc
22608 !! wikitext
22609 Lead
22610 == Section 1 ==
22611 == Section 2 ==
22612 == Section 3 ==
22613 == Section 4 ==
22614 == Section 5 ==
22615 !! html
22616 <p>Lead
22617 </p>
22618
22619 <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>
22620 <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>
22621 <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>
22622 <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>
22623 <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>
22624
22625 !! end
22626
22627
22628 ###
22629 ### Parsoid-specific tests
22630 ### Parsoid-PHP parser incompatibilities
22631 ###
22632 !!test
22633 1. SOL-sensitive wikitext tokens as template-args
22634 !!options
22635 parsoid=wt2html,wt2wt
22636 !! wikitext
22637 {{echo|*a}}
22638 {{echo|#a}}
22639 {{echo|:a}}
22640 !! html
22641 <span about="#mwt1" typeof="mw:Transclusion">
22642 </span><ul about="#mwt1"><li>a</li>
22643 </ul>
22644 <span about="#mwt2" typeof="mw:Transclusion">
22645 </span><ol about="#mwt2"><li>a</li>
22646 </ol>
22647 <span about="#mwt3" typeof="mw:Transclusion">
22648 </span><dl about="#mwt3"><dd>a</dd>
22649 </dl>
22650 !!end
22651
22652 #### -----------------------------------------------------------------
22653 #### Parsoid-specific functionality tests
22654 #### -----------------------------------------------------------------
22655
22656 # T65642/T68749: Formatting elt fixup around images is cleaned up.
22657 # We know wt2wt will fail, but we expect selser to pass.
22658 # Due to the nature of our testing, wt2wt and selser tests will enter the
22659 # blacklist and we'll catch selser regressions based on changes to the
22660 # blacklist entries for selser tests.
22661 !! test
22662 1. Bad treebuilder fixup of formatting elt is cleaned up
22663 !! options
22664 parsoid=wt2html,wt2wt
22665 !! wikitext
22666 {|
22667 |
22668 <small>
22669 [[Image:Foobar.jpg|right|Test]]
22670 </small>
22671 |}
22672 !! html/parsoid
22673 <table>
22674 <tbody><tr><td>
22675 <small>
22676 <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>
22677 </small>
22678 </td></tr>
22679 </tbody></table>
22680 !! end
22681
22682 !! test
22683 2. Bad treebuilder fixup of formatting elt is cleaned up
22684 !! options
22685 parsoid=wt2html,wt2wt
22686 !! wikitext
22687 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22688
22689 <small>[[Image:Foobar.jpg|right|300px]]</small>
22690 !! html/parsoid
22691
22692 <p><b>foo</b></p>
22693 <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>
22694 <p><b>bar</b></p>
22695 <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>
22696 !! end
22697
22698 !! test
22699 3. Bad treebuilder fixup of formatting elt is cleaned up
22700 !! options
22701 parsoid=wt2html,wt2wt
22702 !! wikitext
22703 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22704 !! html/parsoid
22705 <p><small><b>foo</b></small></p>
22706 <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>
22707 <p><small><b>bar</b></small></p>
22708 !! end
22709
22710 !! test
22711 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22712 !! options
22713 parsoid=wt2html,wt2wt
22714 !! wikitext
22715 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22716 !! html/parsoid
22717 <p><b><small></small></b></p>
22718 <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>
22719 <p></p>
22720 !! end
22721
22722 #### ----------------------------------------------------------------
22723 #### Parsoid-only testing of Parsoid's impl of LST
22724 #### Not implemented yet, see
22725 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22726 #### ----------------------------------------------------------------
22727
22728 ## We still need to support serializing the older format while content is stored.
22729 !! test
22730 LST Sections: Backwards compatibility
22731 !! options
22732 parsoid={
22733 "suppressErrors": true,
22734 "modes": ["html2wt"]
22735 }
22736 !! wikitext
22737 <section begin="2011-05-16" />
22738 <section end="2014-04-10 (MW 1.23wmf22)" />
22739 !! html/parsoid
22740 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22741 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22742 !! end
22743
22744 ## The unconventional output is the result of `usePHPPreProcessor` being
22745 ## disabled in parserTests.js. This test is mainly just to show <section> is
22746 ## recognized as an extension tag w/o a native handler.
22747 !! test
22748 LST Sections: Newfangled approach
22749 !! options
22750 parsoid={ "suppressErrors": true }
22751 !! wikitext
22752 <section begin="2011-05-16" />
22753 <section end="2014-04-10 (MW 1.23wmf22)" />
22754 !! html/parsoid
22755 <p><span typeof="mw:Extension/section" about="#mwt1" data-parsoid='{"stx":"html","selfClose":true,"src":"&lt;section begin=\"2011-05-16\" />","tagWidths":[30,0]}'>&lt;section begin="2011-05-16" /></span>
22756 <span typeof="mw:Extension/section" about="#mwt2" data-parsoid='{"stx":"html","selfClose":true,"src":"&lt;section end=\"2014-04-10 (MW 1.23wmf22)\" />","tagWidths":[43,0]}'>&lt;section end="2014-04-10 (MW 1.23wmf22)" /></span></p>
22757 !! end
22758
22759 #--------- Test stripping of empty nodes in template content ----------
22760 !!test
22761 Empty LI and TR nodes should be stripped from template content
22762 !!wikitext
22763 {{EmptyLITest}}
22764 {{EmptyTRTest}}
22765 !!html/parsoid
22766 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22767 <li>a</li>
22768 <li>b</li>
22769 </ul>
22770 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22771 <tbody>
22772 <tr>
22773 <td>foo</td>
22774 </tr>
22775 <tr>
22776 <td>bar</td>
22777 </tr>
22778 </tbody>
22779 </table>
22780 !!end
22781
22782 !!test
22783 Empty LI and TR nodes should not be stripped from top-level content
22784 !!wikitext
22785 * a
22786 *
22787 * b
22788 {|
22789 |-
22790 |-
22791 |foo
22792 |}
22793 !!html/parsoid
22794 <ul>
22795 <li> a</li>
22796 <li></li>
22797 <li> b</li>
22798 </ul>
22799 <table>
22800 <tbody>
22801 <tr></tr>
22802 <tr>
22803 <td>foo</td>
22804 </tr>
22805 </tbody>
22806 </table>
22807 !!end
22808
22809 !!test
22810 Empty TR nodes should not be stripped if they have any attributes set
22811 !!wikitext
22812 {{EmptyTRWithHTMLAttrTest}}
22813 !!html/parsoid
22814 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22815 <tr align="center"></tr>
22816 <tr><td>foo</td></tr>
22817 <tr align="center"></tr>
22818 <tr><td>bar</td></tr>
22819 </table>
22820 !!end
22821
22822 #### ----------------------------------------------------------------
22823 #### The following section of tests are primarily to test
22824 #### wikitext escaping capabilities of Parsoid. Given that
22825 #### escaping can be done any number of ways, the wikitext (input)
22826 #### is always adjusted to reflect how Parsoid adds nowiki
22827 #### escape tags.
22828 ####
22829 #### We are marking several tests as parsoid-only since the
22830 #### HTML in the result section is different from what the
22831 #### PHP parser generates for it.
22832 #### ----------------------------------------------------------------
22833
22834
22835 #### --------------- Headings ---------------
22836 #### 0. Unnested
22837 #### 1. Nested inside html <h1>=foo=</h1>
22838 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22839 #### 3. Nested inside html with wikitext split by html tags
22840 #### 4. No escape needed
22841 #### 5. Empty headings <h1></h1>
22842 #### 6. Heading chars in SOL context
22843 #### ----------------------------------------
22844 !! test
22845 Headings: 0. Unnested
22846 !! options
22847 parsoid=html2wt
22848 !! html/parsoid
22849 <p>=foo=</p>
22850
22851 <p> =foo=
22852 <!--cmt-->
22853 =foo=</p>
22854
22855 <p>=foo<i>a</i>=</p>
22856 !! wikitext
22857 <nowiki>=foo=</nowiki>
22858
22859 <nowiki> </nowiki>=foo=
22860 <!--cmt-->
22861 <nowiki>=foo=</nowiki>
22862
22863 =foo''a''<nowiki>=</nowiki>
22864 !!end
22865
22866 # New headings and existing headings are handled differently
22867 !! test
22868 Headings: 1. Nested inside html
22869 !! options
22870 parsoid=html2wt
22871 !! html/parsoid
22872 <h1>=foo=</h1>
22873 <h2>=foo=</h2>
22874 <h3>=foo=</h3>
22875
22876 <h1 data-parsoid=''>=foo=</h1>
22877 <h2 data-parsoid=''>=foo=</h2>
22878 <h3 data-parsoid=''>=foo=</h3>
22879 <h4 data-parsoid=''>=foo=</h4>
22880 <h5 data-parsoid=''>=foo=</h5>
22881 <h6 data-parsoid=''>=foo=</h6>
22882 !! wikitext
22883 = =foo= =
22884
22885 == =foo= ==
22886
22887 === =foo= ===
22888
22889 =<nowiki>=foo=</nowiki>=
22890 ==<nowiki>=foo=</nowiki>==
22891 ===<nowiki>=foo=</nowiki>===
22892 ====<nowiki>=foo=</nowiki>====
22893 =====<nowiki>=foo=</nowiki>=====
22894 ======<nowiki>=foo=</nowiki>======
22895
22896 !!end
22897
22898 !! test
22899 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22900 !! options
22901 parsoid=html2wt
22902 !! html/parsoid
22903 <h1>foo</h1>*bar
22904 <h1>foo</h1>=bar
22905 <h1>foo</h1>=bar=
22906 !! wikitext
22907 = foo =
22908 <nowiki>*</nowiki>bar
22909
22910 = foo =
22911 =bar
22912
22913 = foo =
22914 <nowiki>=bar=</nowiki>
22915 !!end
22916
22917 !! test
22918 Headings: 3. Nested inside html with wikitext split by html tags
22919 !! options
22920 parsoid=html2wt
22921 !! html/parsoid
22922 <h1>=<b>bold</b>foo=</h1>
22923 !! wikitext
22924 = ='''bold'''foo= =
22925 !!end
22926
22927 !! test
22928 Headings: 4a. No escaping needed (testing just h1 and h2)
22929 !! options
22930 parsoid=html2wt
22931 !! html/parsoid
22932 <h1>=foo</h1>
22933 <h1>foo=</h1>
22934 <h1> =foo= </h1>
22935 <h1>=foo= bar</h1>
22936 <h2>=foo</h2>
22937 <h2>foo=</h2>
22938 <h1>=</h1>
22939 <h1><i>=</i>foo=</h1>
22940 !! wikitext
22941 = =foo =
22942
22943 = foo= =
22944
22945 = =foo= =
22946
22947 = =foo= bar =
22948
22949 == =foo ==
22950
22951 == foo= ==
22952
22953 = = =
22954
22955 = ''=''foo= =
22956 !!end
22957
22958 !! test
22959 Headings: 4b. No escaping needed (inside p-tags)
22960 !! options
22961 parsoid=html2wt
22962 !! html/parsoid
22963 <p>===
22964 =foo= x
22965 =foo= <s></s>
22966 </p>
22967 !! wikitext
22968 ===
22969 =foo= x
22970 =foo= <s></s>
22971 !!end
22972
22973 !! test
22974 Headings: 5. Empty headings
22975 !! options
22976 parsoid=html2wt
22977 !! html/parsoid
22978 <h1 data-parsoid='{}'></h1>
22979
22980 <h2 data-parsoid='{}'></h2>
22981
22982 <h3 data-parsoid='{}'></h3>
22983
22984 <h4 data-parsoid='{}'></h4>
22985
22986 <h5 data-parsoid='{}'></h5>
22987
22988 <h6 data-parsoid='{}'></h6>
22989 !! wikitext
22990 =<nowiki/>=
22991
22992 ==<nowiki/>==
22993
22994 ===<nowiki/>===
22995
22996 ====<nowiki/>====
22997
22998 =====<nowiki/>=====
22999
23000 ======<nowiki/>======
23001 !!end
23002
23003 !! test
23004 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23005 !! options
23006 parsoid=html2wt
23007 !! html/parsoid
23008 <p>=a=</p>
23009
23010 <p>=a=</p>
23011
23012 <p>=a=</p>
23013 !! wikitext
23014 <nowiki>=a=</nowiki>
23015
23016 <nowiki>=a=</nowiki>
23017
23018 <nowiki>=a=</nowiki>
23019 !!end
23020
23021 !! test
23022 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23023 !! options
23024 parsoid=html2wt
23025 !! html/parsoid
23026 <p>=a=
23027 b</p>
23028
23029 <p>=a=
23030 b</p>
23031
23032 <p>=a=
23033 b</p>
23034 !! wikitext
23035 <nowiki>=a=</nowiki>
23036 b
23037
23038 <nowiki>=a=</nowiki>
23039 b
23040
23041 <nowiki>=a=</nowiki>
23042 b
23043 !!end
23044
23045 !! test
23046 Headings: 6c. Heading chars in SOL context (leading newline break)
23047 !! options
23048 parsoid=html2wt
23049 !! html/parsoid
23050 <p>a
23051 =b=</p>
23052 !! wikitext
23053 a
23054 <nowiki>=b=</nowiki>
23055 !!end
23056
23057 !! test
23058 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23059 !! options
23060 parsoid=html2wt
23061 !! html/parsoid
23062 <!--c0--><p>=a=</p>
23063
23064 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23065 !! wikitext
23066 <!--c0--><nowiki>=a=</nowiki>
23067
23068 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23069 !!end
23070
23071 !! test
23072 Headings: 6d. Heading chars in SOL context (No escaping needed)
23073 !! options
23074 parsoid=html2wt
23075 !! html/parsoid
23076 =a=<div>b</div>
23077 !! wikitext
23078 =a=<div>b</div>
23079 !!end
23080
23081 !! test
23082 Headings: 7. Insert a newline between new content and headings
23083 !! options
23084 parsoid=html2wt
23085 !! html/parsoid
23086 <h2>NEW</h2>
23087 <p>new</p>
23088 <h2 data-parsoid='{}'>A</h2>
23089 <p data-parsoid='{}'>a</p>
23090 !! wikitext
23091 == NEW ==
23092 new
23093
23094 ==A==
23095 a
23096
23097 !! end
23098
23099 #### --------------- Lists ---------------
23100 #### 0. Outside nests (*foo, etc.)
23101 #### 1. Nested inside html <ul><li>*foo</li></ul>
23102 #### 2. Inside definition lists
23103 #### 3. Only bullets at start should be escaped
23104 #### 4. No escapes needed
23105 #### 5. No unnecessary escapes
23106 #### 6. Escape bullets in SOL position
23107 #### 7. Escape bullets in a multi-line context
23108 #### ----------------------------------------
23109
23110 !! test
23111 Lists: 0. Outside nests
23112 !! options
23113 parsoid=html2wt
23114 !! html/parsoid
23115 <p>*foo</p>
23116
23117 <p>#foo</p>
23118
23119 <p>;Foo:bar</p>
23120 !! wikitext
23121 <nowiki>*</nowiki>foo
23122
23123 <nowiki>#</nowiki>foo
23124
23125 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23126 !!end
23127
23128 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23129 ## to test wikitext escaping, and insignificant whitespace diffs
23130 ## cause PHP parser tests to barf
23131 !! test
23132 Lists: 1. Nested inside html (No unnecessary escapes)
23133 !! options
23134 parsoid=html2wt
23135 !! html/parsoid
23136 <ul>
23137 <li>*foo</li>
23138 <li>#foo</li>
23139 <li>:foo</li>
23140 <li>;foo</li>
23141 <li data-parsoid='{}'>*foo</li>
23142 <li data-parsoid='{}'>#foo</li>
23143 <li data-parsoid='{}'>:foo</li>
23144 <li data-parsoid='{}'>;foo</li>
23145 </ul>
23146
23147 <ol>
23148 <li>*foo</li>
23149 <li>#foo</li>
23150 <li>:foo</li>
23151 <li>;foo</li>
23152 <li data-parsoid='{}'>*foo</li>
23153 <li data-parsoid='{}'>#foo</li>
23154 <li data-parsoid='{}'>:foo</li>
23155 <li data-parsoid='{}'>;foo</li>
23156 </ol>
23157 !! wikitext
23158 * *foo
23159 * #foo
23160 * :foo
23161 * ;foo
23162 *<nowiki>*foo</nowiki>
23163 *<nowiki>#foo</nowiki>
23164 *<nowiki>:foo</nowiki>
23165 *<nowiki>;foo</nowiki>
23166
23167 # *foo
23168 # #foo
23169 # :foo
23170 # ;foo
23171 #<nowiki>*foo</nowiki>
23172 #<nowiki>#foo</nowiki>
23173 #<nowiki>:foo</nowiki>
23174 #<nowiki>;foo</nowiki>
23175 !!end
23176
23177 !! test
23178 Lists: 2. Inside definition lists
23179 !! options
23180 parsoid=html2wt
23181 !! html/parsoid
23182 <dl><dt>;foo</dt></dl>
23183 <dl><dt>:foo</dt></dl>
23184 <dl><dt>:foo</dt>
23185 <dd>bar</dd></dl>
23186 <dl><dd>:foo</dd></dl>
23187 !! wikitext
23188 ; ;foo
23189
23190 ; <nowiki>:foo</nowiki>
23191
23192 ; <nowiki>:foo</nowiki>
23193 : bar
23194
23195 : :foo
23196 !!end
23197
23198 !! test
23199 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23200 !! options
23201 parsoid=html2wt
23202 !! html/parsoid
23203 <ul>
23204 <li>*foo*bar</li>
23205 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23206 </ul>
23207 !! wikitext
23208 * *foo*bar
23209 *<nowiki>*foo</nowiki>''it''*bar
23210 !!end
23211
23212 !! test
23213 Lists: 4. No escapes needed
23214 !! options
23215 parsoid=html2wt
23216 !! html/parsoid
23217 <ul>
23218 <li>foo*bar
23219 </li>
23220 </ul>
23221 <ul>
23222 <li><i>foo</i>*bar
23223 </li>
23224 </ul>
23225 <ul>
23226 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23227 </li>
23228 </ul>
23229 <ul>
23230 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23231 </li>
23232 </ul>
23233 !! wikitext
23234 *foo*bar
23235
23236 *''foo''*bar
23237
23238 *[[Foo]]: bar
23239
23240 *[[Foo]]*bar
23241 !!end
23242
23243 !! test
23244 Lists: 5. No unnecessary escapes
23245 !! options
23246 parsoid=html2wt
23247 !! html/parsoid
23248 <ul><li> bar <span>[[foo]]</span></li></ul>
23249 <ul><li> =bar <span>[[foo]]</span></li></ul>
23250 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23251 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23252 <ul><li> =bar <span>foo]]</span>=</li></ul>
23253 <ul><li> <s></s>: a</li></ul>
23254 <ul><li> <i>* foo</i></li></ul>
23255
23256 !! wikitext
23257 * bar <span><nowiki>[[foo]]</nowiki></span>
23258
23259 * =bar <span><nowiki>[[foo]]</nowiki></span>
23260
23261 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23262
23263 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23264
23265 * =bar <span>foo]]</span>=
23266
23267 * <s></s>: a
23268
23269 * ''* foo''
23270 !!end
23271
23272 !! test
23273 Lists: 6. Escape bullets in SOL position
23274 !! options
23275 parsoid=html2wt
23276 !! html/parsoid
23277 <p><!--cmt-->*foo</p>
23278 !! wikitext
23279 <!--cmt--><nowiki>*</nowiki>foo
23280 !!end
23281
23282 !! test
23283 Lists: 7. Escape bullets in a multi-line context
23284 !! options
23285 parsoid=html2wt
23286 !! html/parsoid
23287 <p>a
23288 *b
23289 </p>
23290 !! wikitext
23291 a
23292 <nowiki>*</nowiki>b
23293 !!end
23294
23295 !! test
23296 Lists: 8. Escape colons only if not present in tags
23297 !! options
23298 parsoid=html2wt
23299 !! html/parsoid
23300 <dl><dt>a:b<i>c:d</i></dt></dl>
23301 !! wikitext
23302 ; <nowiki>a:b</nowiki>''c:d''
23303 !! end
23304
23305 #### --------------- HRs ---------------
23306 #### 1. Single line
23307 #### -----------------------------------
23308
23309 !! test
23310 HRs: 1. Single line
23311 !! options
23312 parsoid=html2wt
23313 !! html/parsoid
23314 <hr />----
23315 <hr />=foo=
23316 <hr />*foo
23317 !! wikitext
23318 ----<nowiki>----</nowiki>
23319 ----=foo=
23320 ----*foo
23321 !! end
23322
23323 #### --------------- Tables ---------------
23324 #### 1a. Simple example
23325 #### 1b. No escaping needed (!foo)
23326 #### 1c. No escaping needed (|foo)
23327 #### 1d. No escaping needed (|}foo)
23328 ####
23329 #### 2a. Nested in td (<td>foo|bar</td>)
23330 #### 2b. Nested in td (<td>foo||bar</td>)
23331 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23332 ####
23333 #### 3a. Nested in th (<th>foo!bar</th>)
23334 #### 3b. Nested in th (<th>foo!!bar</th>)
23335 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23336 ####
23337 #### 4a. Escape -
23338 #### 4b. Escape +
23339 #### 4c. No escaping needed
23340 #### --------------------------------------
23341
23342 !! test
23343 Tables: 1a. Simple example
23344 !! options
23345 parsoid=html2wt
23346 !! html/parsoid
23347 <p>{|
23348 |}
23349 </p>
23350 !! wikitext
23351 <nowiki>{|</nowiki>
23352 |}
23353 !! end
23354
23355 !! test
23356 Tables: 1b. No escaping needed
23357 !! options
23358 parsoid=html2wt
23359 !! html/parsoid
23360 <p>!foo
23361 </p>
23362 !! wikitext
23363 !foo
23364 !! end
23365
23366 !! test
23367 Tables: 1c. No escaping needed
23368 !! options
23369 parsoid=html2wt
23370 !! html/parsoid
23371 <p>|foo
23372 </p>
23373 !! wikitext
23374 |foo
23375 !! end
23376
23377 !! test
23378 Tables: 1d. No escaping needed
23379 !! options
23380 parsoid=html2wt
23381 !! html/parsoid
23382 <p>|}foo
23383 </p>
23384 !! wikitext
23385 |}foo
23386 !! end
23387
23388 !! test
23389 Tables: 2a. Nested in td
23390 !! options
23391 parsoid=html2wt
23392 !! html/parsoid
23393 <table><tbody><tr>
23394 <td>foo|bar</td></tr>
23395 <tr><td>x<div>a|b</div></td>
23396 </tbody></table>
23397 !! wikitext
23398 {|
23399 |<nowiki>foo|bar</nowiki>
23400 |-
23401 |x<div><nowiki>a|b</nowiki></div>
23402 |}
23403 !! html/php+tidy
23404 <table>
23405 <tr>
23406 <td>foo|bar</td>
23407 </tr>
23408 <tr>
23409 <td>x
23410 <div>a|b</div>
23411 </td>
23412 </tr>
23413 </table>
23414 !! end
23415
23416 !! test
23417 Tables: 2b. Nested in td
23418 !! options
23419 parsoid=html2wt
23420 !! html/parsoid
23421 <table><tbody><tr>
23422 <td>foo||bar</td>
23423 <td>a<i>b||c</i></td>
23424 <td>a<i><div>b||c</div></i></td>
23425 </tr></tbody></table>
23426 !! wikitext
23427 {|
23428 |<nowiki>foo||bar</nowiki>
23429 |a''<nowiki>b||c</nowiki>''
23430 |a''<div><nowiki>b||c</nowiki></div>''
23431 |}
23432 !! html/php
23433 <table>
23434 <tr>
23435 <td>foo||bar
23436 </td>
23437 <td>a<i>b||c</i>
23438 </td>
23439 <td>a<i><div>b||c</div></i>
23440 </td></tr></table>
23441
23442 !! end
23443
23444 !! test
23445 Tables: 2c. Nested in td -- no escaping needed
23446 !! options
23447 parsoid=html2wt
23448 !! html/*
23449 <table>
23450 <tr>
23451 <td>foo!!bar
23452 </td></tr></table>
23453
23454 !! wikitext
23455 {|
23456 |foo!!bar
23457 |}
23458 !! end
23459
23460 !! test
23461 Tables: 3a. Nested in th
23462 !! options
23463 parsoid=html2wt
23464 !! html/*
23465 <table>
23466 <tr>
23467 <th>foo!bar
23468 </th></tr></table>
23469
23470 !! wikitext
23471 {|
23472 !foo!bar
23473 |}
23474 !! end
23475
23476 !! test
23477 Tables: 3b. Nested in th
23478 !! options
23479 parsoid=html2wt
23480 !! html/parsoid
23481 <table><tbody>
23482 <tr><th>foo!!bar</th>
23483 <th><i>foo|bar</i></th>
23484 <th><i>foo!!bar</i></th>
23485 <th><i><span>foo!!bar</span></i></th>
23486 </tr></tbody></table>
23487 !! wikitext
23488 {|
23489 !<nowiki>foo!!bar</nowiki>
23490 !''<nowiki>foo|bar</nowiki>''
23491 !''<nowiki>foo!!bar</nowiki>''
23492 !''<span><nowiki>foo!!bar</nowiki></span>''
23493 |}
23494 !! html/php
23495 <table>
23496 <tr>
23497 <th>foo!!bar
23498 </th>
23499 <th><i>foo|bar</i>
23500 </th>
23501 <th><i>foo!!bar</i>
23502 </th>
23503 <th><i><span>foo!!bar</span></i>
23504 </th></tr></table>
23505
23506 !! end
23507
23508 !! test
23509 Tables: 3c. Nested in th
23510 !! options
23511 parsoid=html2wt
23512 !! html/parsoid
23513 <table><tbody>
23514 <tr><th>foo||bar</th>
23515 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23516 </tr></tbody></table>
23517 !! wikitext
23518 {|
23519 !<nowiki>foo||bar</nowiki>
23520 !<nowiki>foo||bar</nowiki>
23521 |}
23522 !! html/php
23523 <table>
23524 <tr>
23525 <th>foo||bar
23526 </th>
23527 <th>foo||bar
23528 </th></tr></table>
23529
23530 !! end
23531
23532 !! test
23533 Tables: 4a. Escape -
23534 !! options
23535 parsoid=html2wt
23536 !! html/*
23537 <table>
23538 <tr>
23539 <th>-bar
23540 </th></tr>
23541 <tr>
23542 <td>-bar
23543 </td></tr></table>
23544
23545 !! wikitext
23546 {|
23547 !-bar
23548 |-
23549 |<nowiki>-bar</nowiki>
23550 |}
23551 !! end
23552
23553 !! test
23554 Tables: 4b. Escape +
23555 !! options
23556 parsoid=html2wt
23557 !! html/*
23558 <table>
23559 <tr>
23560 <th>+bar
23561 </th></tr>
23562 <tr>
23563 <td>+bar
23564 </td></tr></table>
23565
23566 !! wikitext
23567 {|
23568 !+bar
23569 |-
23570 |<nowiki>+bar</nowiki>
23571 |}
23572 !! end
23573
23574 !! test
23575 Tables: 4c. No escaping needed
23576 !! options
23577 parsoid=html2wt
23578 !! html/parsoid
23579 <table><tbody>
23580 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23581 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23582 <tr><td>foo
23583 <p>bar|baz
23584 +bar
23585 -bar</p></td></tr>
23586 <tr><td>x
23587 <div>a|b</div></td>
23588 </tbody></table>
23589 !! wikitext
23590 {|
23591 |foo-bar
23592 |foo+bar
23593 |-
23594 |''foo''-bar
23595 |''foo''+bar
23596 |-
23597 |foo
23598 bar|baz
23599 +bar
23600 -bar
23601 |-
23602 |x
23603 <div>a|b</div>
23604 |}
23605 !! html/php
23606 <table>
23607 <tr>
23608 <td>foo-bar
23609 </td>
23610 <td>foo+bar
23611 </td></tr>
23612 <tr>
23613 <td><i>foo</i>-bar
23614 </td>
23615 <td><i>foo</i>+bar
23616 </td></tr>
23617 <tr>
23618 <td>foo
23619 <p>bar|baz
23620 +bar
23621 -bar
23622 </p>
23623 </td></tr>
23624 <tr>
23625 <td>x
23626 <div>a|b</div>
23627 </td></tr></table>
23628
23629 !! end
23630
23631 !! test
23632 Tables: 4d. No escaping needed
23633 !! options
23634 parsoid=html2wt
23635 !! html/parsoid
23636 <table>
23637 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23638 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23639 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23640 </tbody></table>
23641 !! wikitext
23642 {|
23643 |[[Foo]]-bar
23644 ||+1
23645 ||-2
23646 |}
23647 !! html/php
23648 <table>
23649 <tr>
23650 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23651 </td>
23652 <td>+1
23653 </td>
23654 <td>-2
23655 </td></tr></table>
23656
23657 !! end
23658
23659 !! test
23660 T97430: Don't emit empty nowiki pairs around marker meta tags
23661 !! options
23662 parsoid=html2wt
23663 !! html/parsoid
23664 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23665 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23666 !! wikitext
23667 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23668 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23669 !! end
23670
23671 !! test
23672 Unclosed xmlish element in table line shouldn't eat end delimiters
23673 !! options
23674 parsoid=html2wt
23675 !! html/parsoid
23676 <table>
23677 <tbody><tr><td> &lt;foo</td>
23678 <td> bar></td></tr>
23679 </tbody></table>
23680 !! wikitext
23681 {|
23682 | <foo
23683 | bar>
23684 |}
23685 !! html/php
23686 <table>
23687 <tr>
23688 <td> &lt;foo
23689 </td>
23690 <td> bar&gt;
23691 </td></tr></table>
23692
23693 !! end
23694
23695 #### --------------- Links ----------------
23696 #### 1. Quote marks in link text
23697 #### 2. Wikilinks: Escapes needed
23698 #### 3. Wikilinks: No escapes needed
23699 #### 4. Extlinks: Escapes needed
23700 #### 5. Extlinks: No escapes needed
23701 #### --------------------------------------
23702 !! test
23703 Links 1. WikiLinks: No escapes needed
23704 !! options
23705 parsoid=html2wt
23706 !! html/parsoid
23707 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23708 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23709 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23710 !! wikitext
23711 [[Foo|Foo''boo'']]
23712 [[Foo|[Foobar]]]
23713 [[Foo|x [Foobar] x]]
23714 !! html/php
23715 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23716 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23717 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23718 </p>
23719 !! end
23720
23721 !! test
23722 Links 2. WikiLinks: Escapes needed
23723 !! options
23724 parsoid=html2wt
23725 !! html/parsoid
23726 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23727 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23728 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23729 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23730 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23731 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23732 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23733 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23734 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23735 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23736 !! wikitext
23737 [[Foo|<nowiki>Foobar]</nowiki>]]
23738 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23739 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23740 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23741 [[Foo|<nowiki>|Bar</nowiki>]]
23742 [[Foo|<nowiki>]]bar</nowiki>]]
23743 [[Foo|<nowiki>[[bar</nowiki>]]
23744 [[Foo|<nowiki>x [[ y</nowiki>]]
23745 [[Foo|<nowiki>x ]] y</nowiki>]]
23746 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23747 !! html/php
23748 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23749 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23750 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23751 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23752 <a href="/wiki/Foo" title="Foo">|Bar</a>
23753 <a href="/wiki/Foo" title="Foo">]]bar</a>
23754 <a href="/wiki/Foo" title="Foo">[[bar</a>
23755 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23756 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23757 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23758 </p>
23759 !! end
23760
23761 !! test
23762 Links 3. WikiLinks: No escapes needed
23763 !! options
23764 parsoid=html2wt
23765 !! html/parsoid
23766 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23767 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23768 !! wikitext
23769 [[Foo|[Foobar]]
23770 [[Foo|foo|bar]]
23771 !! html/php
23772 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23773 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23774 </p>
23775 !! end
23776
23777 !! test
23778 Links 4. ExtLinks: Escapes needed
23779 !! options
23780 parsoid=html2wt
23781 !! html/parsoid
23782 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23783 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23784 <p>[http://google.com]</p>
23785 <p>[http://google.com google]</p>
23786 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23787 <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>
23788 !! wikitext
23789 [http://google.com <nowiki>[google]</nowiki>]
23790 [http://google.com <nowiki>google]</nowiki>]
23791
23792 <nowiki>[http://google.com]</nowiki>
23793
23794 <nowiki>[http://google.com google]</nowiki>
23795
23796 [http://google.com<nowiki>]</nowiki>
23797
23798 [{{echo|http://google.com}}<nowiki>]</nowiki>
23799 !! html/php
23800 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23801 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23802 </p><p>[http://google.com]
23803 </p><p>[http://google.com google]
23804 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23805 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23806 </p>
23807 !! end
23808
23809 !! test
23810 Links 5. ExtLinks: No escapes needed
23811 !! options
23812 parsoid=html2wt
23813 !! html/parsoid
23814 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23815 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23816 !! wikitext
23817 [http://google.com [google]
23818
23819 [[http://google.com]]
23820 !! html/php
23821 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23822 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23823 </p>
23824 !! end
23825
23826 !! test
23827 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
23828 !! options
23829 parsoid=html2wt
23830 !! html/parsoid
23831 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23832 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23833 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23834 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23835 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23836 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23837 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23838 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23839 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23840 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23841 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23842 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23843 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23844 </p>
23845 !! wikitext
23846 x<nowiki/>http://example.com<nowiki/>y
23847 http://example.com<nowiki/>?x
23848 http://example.com<nowiki/>&x
23849 http://example.com<nowiki/>'x
23850 http://example.com<nowiki/>,x
23851 http://example.com<nowiki/>.x
23852 http://example.com<nowiki/>;x
23853 http://example.com<nowiki/>:x
23854 http://example.com<nowiki/>;x
23855 http://example.com<nowiki/>!x
23856 http://example.com<nowiki/>=x
23857 http://example.com<nowiki/>(x)
23858 http://example.com(x<nowiki/>)
23859 !! end
23860
23861 !! test
23862 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
23863 !! options
23864 parsoid=html2wt
23865 !! html/parsoid
23866 <p>x
23867 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23868 y
23869 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23870 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23871 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23872 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23873 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23874 </p>
23875 !! wikitext
23876 x
23877 http://example.com
23878 y
23879 "http://example.com"
23880 (http://example.com)
23881 (http://example.com) foo
23882 http://example.com,
23883 http://example.com, foo
23884 !! html/php
23885 <p>x
23886 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23887 y
23888 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23889 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23890 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23891 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23892 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23893 </p>
23894 !! end
23895
23896 !! test
23897 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
23898 !! options
23899 parsoid=html2wt
23900 !! html/parsoid
23901 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23902 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23903 !! wikitext
23904 http://example.com.,;:!?\
23905 -http://example.com:
23906 !! html/php
23907 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23908 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23909 </p>
23910 !! end
23911
23912 !! test
23913 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
23914 !! options
23915 parsoid=html2wt
23916 !! html/parsoid
23917 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23918 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23919 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23920 !! wikitext
23921 RFC 123<nowiki/>4
23922 RFC 123<nowiki/>y
23923 X<nowiki/>RFC 123<nowiki/>y
23924 !! end
23925
23926 !! test
23927 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
23928 !! options
23929 parsoid=html2wt
23930 !! html/parsoid
23931 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23932 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23933 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23934 </p>
23935 !! wikitext
23936 RFC 123?foo
23937 RFC 123&foo
23938 -RFC 123-
23939 !! html/php
23940 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23941 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23942 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23943 </p>
23944 !! end
23945
23946 !! test
23947 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
23948 !! options
23949 parsoid=html2wt
23950 !! html/parsoid
23951 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23952 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23953 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23954 !! wikitext
23955 PMID 123<nowiki/>4
23956 PMID 123<nowiki/>y
23957 X<nowiki/>PMID 123<nowiki/>y
23958 !! end
23959
23960 !! test
23961 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
23962 !! options
23963 parsoid=html2wt
23964 !! html/parsoid
23965 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23966 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23967 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23968 </p>
23969 !! wikitext
23970 PMID 123?foo
23971 PMID 123&foo
23972 -PMID 123-
23973 !! html/php
23974 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23975 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23976 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23977 </p>
23978 !! end
23979
23980 !! test
23981 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
23982 !! options
23983 parsoid=html2wt
23984 !! html/parsoid
23985 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23986 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23987 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23988 </p>
23989 !! wikitext
23990 ISBN 1234567890<nowiki/>1
23991 ISBN 1234567890<nowiki/>x
23992 a<nowiki/>ISBN 1234567890<nowiki/>b
23993 !! end
23994
23995 !! test
23996 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
23997 !! options
23998 parsoid=html2wt
23999 !! html/parsoid
24000 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24001 !! wikitext
24002 -ISBN 1234567890's
24003 !! html/php
24004 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24005 </p>
24006 !! end
24007
24008 !! test
24009 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24010 !! options
24011 parsoid=html2wt
24012 !! html/*
24013 <p>this is not a link: http://example.com
24014 </p>
24015 !! wikitext
24016 this is not a link: <nowiki>http://example.com</nowiki>
24017 !! end
24018
24019 !! test
24020 Links 15. Link trails can't become link prefixes.
24021 !! options
24022 language=is
24023 parsoid=html2wt
24024 !! html/parsoid
24025 <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>
24026 !! wikitext
24027 [[Söfnuður]]-[[00]]
24028 !! html/php
24029 <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>
24030 </p>
24031 !! end
24032
24033 #### --------------- Quotes ---------------
24034 #### 1. Quotes inside <b> and <i>
24035 #### 2. Link fragments separated by <i> and <b> tags
24036 #### 3. Link fragments inside <i> and <b>
24037 #### 4. No escaping needed
24038 #### --------------------------------------
24039 !! test
24040 1a. Quotes inside <b> and <i>
24041 !! options
24042 parsoid=html2wt
24043 !! html/*
24044 <p><i>'foo'</i>
24045 <i>''foo''</i>
24046 <i>'''foo'''</i>
24047 <i>foo</i>'s
24048 <b>'foo'</b>
24049 <b>''foo''</b>
24050 <b>'''foo'''</b>
24051 <b>foo'<i>bar'</i>baz</b>
24052 <b>foo</b>'s
24053 '<i>foo</i>
24054 <i>foo</i>'
24055 <i>foo'</i>'
24056 '<i>foo</i>'
24057 '<b>foo</b>
24058 <b>foo</b>'
24059 '<b>foo</b>'
24060 <i>fools'<span> errand</span></i>
24061 <i><span>fool</span>'s errand</i>
24062 '<i>foo</i> bar '<i>baz</i>
24063 a|!*#-:;+-~[]{}b'<i>x</i>
24064 </p>
24065 !! wikitext
24066 ''<nowiki/>'foo'''
24067 ''<nowiki>''foo''</nowiki>''
24068 ''<nowiki>'''foo'''</nowiki>''
24069 ''foo''<nowiki/>'s
24070 '''<nowiki/>'foo''''
24071 '''<nowiki>''foo''</nowiki>'''
24072 '''<nowiki>'''foo'''</nowiki>'''
24073 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24074 '''foo'''<nowiki/>'s
24075 '''foo''
24076 ''foo''<nowiki/>'
24077 ''foo'''<nowiki/>'
24078 '''foo''<nowiki/>'
24079 ''''foo'''
24080 '''foo'''<nowiki/>'
24081 ''''foo'''<nowiki/>'
24082 ''fools'<span> errand</span>''
24083 ''<span>fool</span>'s errand''
24084 '<nowiki/>''foo'' bar '''baz''
24085 a|!*#-:;+-~[]{}b'''x''
24086 !! end
24087
24088 !! test
24089 1b. Quotes inside <b> and <i> with other tags on same line
24090 !! options
24091 parsoid=html2wt
24092 !! html/parsoid
24093 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24094 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24095 <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>
24096 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24097 '<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>
24098 '<i>foo</i> <div title="name">test</div>
24099 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24100 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24101 <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>
24102 </ol>
24103 !! wikitext
24104 '''a'' foo ''[[bar]]''
24105 ''a''' foo ''[[bar]]''
24106 ''a''' foo '''{{echo|[[bar]]}}'''
24107 [[foo]] x'''[[bar]]''
24108 '''foo'' <ref>test</ref>
24109 '''foo'' <div title="name">test</div>
24110 '''foo'' and <br> bar
24111 <references />
24112 !! end
24113
24114 !! test
24115 2. Link fragments separated by <i> and <b> tags
24116 !! options
24117 parsoid=html2wt
24118 !! html/parsoid
24119 <p>[[<i>foo</i>hello]]</p>
24120 <p>[[<b>foo</b>hello]]</p>
24121 !! wikitext
24122 [[''foo''<nowiki>hello]]</nowiki>
24123
24124 [['''foo'''<nowiki>hello]]</nowiki>
24125 !! end
24126
24127 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24128 # this is one of the shortcomings of this format
24129 !! test
24130 3. Link fragments inside <i> and <b>
24131 !! options
24132 parsoid=html2wt
24133 !! html/parsoid
24134 <p><i>[[foo</i>]]</p>
24135 <p><b>[[foo</b>]]</p>
24136 !! wikitext
24137 ''[[foo''<nowiki>]]</nowiki>
24138
24139 '''[[foo'''<nowiki>]]</nowiki>
24140 !! end
24141
24142 !! test
24143 4. No escaping needed
24144 !! options
24145 options=html2wt
24146 !! html/parsoid
24147 <p>'<span><i>bar</i></span>'
24148 '<span><b>bar</b></span>'
24149 'a:b'foo
24150 </p>
24151 !! wikitext
24152 '<span>''bar''</span>'
24153 '<span>'''bar'''</span>'
24154 'a:b'foo
24155 !! end
24156
24157 #### ----------- Paragraphs ---------------
24158 #### 1. No unnecessary escapes
24159 #### --------------------------------------
24160
24161 !! test
24162 1. No unnecessary escapes
24163 !! options
24164 parsoid=html2wt
24165 !! html/parsoid
24166 <p>bar <span>[[foo]]</span>
24167 </p><p>=bar <span>[[foo]]</span>
24168 </p><p>[[bar <span>[[foo]]</span>
24169 </p><p>]]bar <span>[[foo]]</span>
24170 </p><p>=bar <span>foo]]</span>=
24171 </p>
24172 !! wikitext
24173 bar <span><nowiki>[[foo]]</nowiki></span>
24174
24175 =bar <span><nowiki>[[foo]]</nowiki></span>
24176
24177 [[bar <span><nowiki>[[foo]]</nowiki></span>
24178
24179 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24180
24181 =bar <span>foo]]</span><nowiki>=</nowiki>
24182 !!end
24183
24184 #### ----------------------- PRE --------------------------
24185 #### 1. Leading whitespace in SOL context should be escaped
24186 #### ------------------------------------------------------
24187 !! test
24188 1. Leading whitespace in SOL context should be escaped
24189 !! options
24190 parsoid=html2wt
24191 !! html/parsoid
24192 <p> a</p>
24193
24194 <p> a</p>
24195
24196 <p> a(tab)</p>
24197
24198 <p> a
24199 <!--cmt-->
24200 a</p>
24201
24202 <p>a
24203 b</p>
24204
24205 <p>a
24206 b</p>
24207
24208 <p>a
24209 b</p>
24210 !! wikitext
24211 <nowiki> </nowiki>a
24212
24213 <nowiki> </nowiki> a
24214
24215 a(tab)
24216
24217 <nowiki> </nowiki> a
24218 <!--cmt-->
24219 <nowiki> </nowiki>a
24220
24221 a
24222 <nowiki> </nowiki>b
24223
24224 a
24225 b
24226
24227 a
24228 b
24229 !! html/php
24230 <p> a
24231 </p><p> a
24232 </p><p> a(tab)
24233 </p><p> a
24234 a
24235 </p><p>a
24236 b
24237 </p><p>a
24238 b
24239 </p><p>a
24240 b
24241 </p>
24242 !! end
24243
24244 !! test
24245 2. Leading whitespace in non-indent-pre contexts should not be escaped
24246 !! options
24247 parsoid=html2wt
24248 !! html/parsoid
24249 <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>
24250 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24251 <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>
24252 b</span></li>
24253 </ol>
24254 !! wikitext
24255 foo <ref>''a''
24256 b</ref>
24257 <references />
24258 !! end
24259
24260 !! test
24261 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24262 !! options
24263 parsoid=html2wt
24264 !! html/parsoid
24265 <blockquote>
24266 <p>
24267 a
24268 <span>b</span>
24269 c</p>
24270 </blockquote>
24271 !! wikitext
24272 <blockquote>
24273 a
24274 <span>b</span>
24275 c
24276 </blockquote>
24277 !! end
24278
24279 !! test
24280 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24281 !! options
24282 options=html2wt
24283 !! html/parsoid
24284 <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>
24285 !! wikitext
24286 [[File:Foobar.jpg|thumb|caption]]
24287 !! end
24288
24289 !! test
24290 5. Nowiki escaping should account for indent-pres
24291 !! options
24292 parsoid=html2wt
24293 !! html/parsoid
24294 <pre>==foo==</pre>
24295 !! wikitext
24296 ==foo==
24297 !! end
24298
24299 !!test
24300 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24301 !! options
24302 parsoid=html2wt
24303 !! html/parsoid
24304 <pre>
24305 * foo
24306 * bar
24307 </pre>
24308 !! wikitext
24309 * foo
24310 * bar
24311 !! end
24312
24313 #### --------------- Behavior Switches --------------------
24314
24315 !! test
24316 1. Valid behavior switches should be escaped
24317 !! options
24318 parsoid=html2wt
24319 !! html/parsoid
24320 __TOC__
24321 <i>__TOC__</i>
24322 !! wikitext
24323 <nowiki>__TOC__</nowiki>
24324 ''<nowiki>__TOC__</nowiki>''
24325 !! end
24326
24327 !! test
24328 2. Invalid behavior switches should not be escaped
24329 !! options
24330 parsoid=html2wt
24331 !! html/parsoid
24332 __TOO__
24333 __|__
24334 !! wikitext
24335 __TOO__
24336 __|__
24337 !! end
24338
24339 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24340 !! test
24341 Behavior switches should be SOL-transparent
24342 !! options
24343 parsoid=html2wt
24344 !! html/parsoid
24345 <meta property="mw:PageProp/toc" />
24346
24347 <!-- this one's bogus -->
24348 <pre>__TOO__</pre>
24349
24350 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24351
24352 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24353 !! wikitext
24354 __TOC__
24355
24356 <!-- this one's bogus -->
24357 __TOO__
24358
24359 __TOC__ foo
24360
24361 __TOC__
24362 bar
24363 !! end
24364
24365 #### --------------- HTML tags ---------------
24366 #### 1. a tags
24367 #### 2. other tags
24368 #### 3. multi-line html tag
24369 #### 4. extension tags
24370 #### -----------------------------------------
24371 !! test
24372 1. a tags
24373 !! options
24374 parsoid=html2wt
24375 !! html/parsoid
24376 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24377 !! wikitext
24378 <a href="http://google.com">google</a>
24379 !! end
24380
24381 !! test
24382 2. other tags
24383 !! options
24384 parsoid=html2wt
24385 !! html/parsoid
24386 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24387 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24388 <li> &lt;td&gt;</li></ul>
24389
24390 !! wikitext
24391 * <nowiki><div>foo</div></nowiki>
24392 * <nowiki><div style="color:red">foo</div></nowiki>
24393 * <nowiki><td></nowiki>
24394 !! end
24395
24396 !! test
24397 3. multi-line html tag
24398 !! options
24399 parsoid=html2wt
24400 !! html/parsoid
24401 <p>&lt;div
24402 &gt;foo&lt;/div
24403 &gt;
24404 </p>
24405 !! wikitext
24406 <nowiki><div
24407 >foo</div
24408 ></nowiki>
24409 !! end
24410
24411 !! test
24412 4. extension tags
24413 !! options
24414 parsoid=html2wt
24415 !! html/parsoid
24416 <p>&lt;ref&gt;foo&lt;/ref&gt;
24417 </p><p>&lt;ref&gt;bar
24418 </p><p>baz&lt;/ref&gt;
24419 </p>
24420 !! wikitext
24421 <nowiki><ref>foo</ref></nowiki>
24422
24423 <nowiki><ref>bar</nowiki>
24424
24425 baz<nowiki></ref></nowiki>
24426 !! end
24427
24428 #### --------------- Others ---------------
24429 !! test
24430 Escaping nowikis
24431 !! options
24432 parsoid=html2wt
24433 !! html/parsoid
24434 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24435 </p>
24436 !! wikitext
24437 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24438 !! end
24439
24440 ## The quote-char in the input is necessary for triggering the bug
24441 !! test
24442 (T54035) Nowiki-escaping should not get tripped by " :" in text
24443 !! options
24444 parsoid=html2wt
24445 !! html/parsoid
24446 <p>foo's bar :</p>
24447 !! wikitext
24448 foo's bar :
24449 !! end
24450
24451 #----------- End of wikitext escaping tests --------------
24452
24453 !! test
24454
24455 Tag-like HTML structures are passed through as text
24456 !! wikitext
24457 <x y>
24458
24459 <x.y>
24460
24461 <x-y>
24462
24463 1>2
24464
24465 x<y
24466
24467 a>b
24468
24469 1<d e>f
24470 !! html
24471 <p>&lt;x y&gt;
24472 </p><p>&lt;x.y&gt;
24473 </p><p>&lt;x-y&gt;
24474 </p><p>1&gt;2
24475 </p><p>x&lt;y
24476 </p><p>a&gt;b
24477 </p><p>1&lt;d e&gt;f
24478 </p>
24479 !! end
24480
24481 !! test
24482 HTML tag with necessary entities in attributes
24483 !! wikitext
24484 <span title="&amp;amp;">foo</span>
24485 !! html
24486 <p><span title="&amp;amp;">foo</span>
24487 </p>
24488 !! end
24489
24490 !! test
24491 HTML tag with 'unnecessary' entity encoding in attributes
24492 !! wikitext
24493 <span title="&amp;">foo</span>
24494 !! html
24495 <p><span title="&amp;">foo</span>
24496 </p>
24497 !! end
24498
24499 !! test
24500 HTML tag with broken attribute value quoting
24501 !! options
24502 parsoid=wt2html,html2html
24503 !! wikitext
24504 <span title="Hello world>Foo</span>
24505 !! html/php
24506 <p><span title="Hello world">Foo</span>
24507 </p>
24508 !! html/parsoid
24509 <p><span title="Hello world">Foo</span></p>
24510 !! end
24511
24512 !! test
24513 Self-closed tag with broken attribute value quoting
24514 !! options
24515 parsoid=wt2html,html2html
24516 !! wikitext
24517 <div title="Hello world />Foo
24518 !! html/php+tidy
24519 <div title="Hello world"></div>
24520 <p>Foo</p>
24521 !! html/parsoid
24522 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24523 !! end
24524
24525 !! test
24526 Table with broken attribute value quoting
24527 !! options
24528 parsoid=wt2html,html2html
24529 !! wikitext
24530 {|
24531 | title="Hello world|Foo
24532 |}
24533 !! html/php
24534 <table>
24535 <tr>
24536 <td title="Hello world">Foo
24537 </td></tr></table>
24538
24539 !! html/parsoid
24540 <table>
24541 <tr>
24542 <td title="Hello world">Foo
24543 </td></tr></table>
24544
24545 !! end
24546
24547 !! test
24548 Table with broken attribute value quoting on consecutive lines
24549 !! options
24550 parsoid=wt2html,html2html
24551 !! wikitext
24552 {|
24553 | title="Hello world|Foo
24554 | style="color:red|Bar
24555 |}
24556 !! html/php
24557 <table>
24558 <tr>
24559 <td title="Hello world">Foo
24560 </td>
24561 <td style="color:red">Bar
24562 </td></tr></table>
24563
24564 !! html/parsoid
24565 <table><tbody>
24566 <tr>
24567 <td title="Hello world">Foo
24568 </td><td style="color: red">Bar
24569 </td></tr></tbody></table>
24570
24571 !! end
24572
24573 !!test
24574 Accept empty td cell attribute
24575 !! wikitext
24576 {|
24577 | align="center" | foo || |
24578 |}
24579 !! html
24580 <table>
24581 <tr>
24582 <td align="center"> foo </td>
24583 <td>
24584 </td></tr></table>
24585
24586 !!end
24587
24588 !!test
24589 Non-empty attributes in th-cells
24590 !! wikitext
24591 {|
24592 ! Foo !! style="color: red" | Bar
24593 |}
24594 !! html
24595 <table>
24596 <tr>
24597 <th> Foo </th>
24598 <th style="color: red"> Bar
24599 </th></tr></table>
24600
24601 !!end
24602
24603 !!test
24604 Accept empty attributes in th-cells
24605 !! wikitext
24606 {|
24607 !| foo !!| bar
24608 |}
24609 !! html
24610 <table>
24611 <tr>
24612 <th> foo </th>
24613 <th> bar
24614 </th></tr></table>
24615
24616 !!end
24617
24618 !!test
24619 Empty table rows go away
24620 !! wikitext
24621 {|
24622 | Hello
24623 | there
24624 |- class="foo"
24625 |-
24626 |}
24627 !! html
24628 <table>
24629 <tr>
24630 <td> Hello
24631 </td>
24632 <td> there
24633 </td></tr>
24634
24635 </table>
24636
24637 !! end
24638
24639 ###
24640 ### Parsoid-centric tests for testing RTing of inter-element separators
24641 ### Edge cases not tested by existing parser tests and specific to
24642 ### Parsoid-specific serialization strategies.
24643 ###
24644
24645 !!test
24646 RT-ed inter-element separators should be valid separators
24647 !! wikitext
24648 {|
24649 |- [[foo]]
24650 |}
24651 !! html/php
24652 <table>
24653
24654 </table>
24655
24656 !! html/parsoid
24657 <table>
24658 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24659 </tbody></table>
24660 !!end
24661
24662 # Parsoid-only since PHP parser relies on Tidy for correct output
24663 !!test
24664 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24665 !!options
24666 parsoid
24667 !! wikitext
24668 {|
24669 |<small>foo
24670 bar
24671 |}
24672
24673 {|
24674 |<small>foo<small>
24675 |}
24676 !! html
24677 <table>
24678 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24679 <p>bar</p></small></td></tr>
24680 </tbody></table>
24681
24682 <table>
24683 <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>
24684 </tbody></table>
24685 !!end
24686
24687 # Note that the "style" attribute is really a template parameter here.
24688 # The = would have to be {{=}} if you wanted the literal.
24689 !!test
24690 Empty TD followed by TD with tpl-generated attribute
24691 !! wikitext
24692 {|
24693 |-
24694 |
24695 |{{echo|style='color:red'}}|foo
24696 |}
24697 !! html
24698 <table>
24699
24700 <tr>
24701 <td>
24702 </td>
24703 <td>foo
24704 </td></tr></table>
24705
24706 !!end
24707
24708 !!test
24709 Indented table with an empty td
24710 !! wikitext
24711 {|
24712 |-
24713 |
24714 |foo
24715 |}
24716 !! html
24717 <table>
24718
24719 <tr>
24720 <td>
24721 </td>
24722 <td>foo
24723 </td></tr></table>
24724
24725 !!end
24726
24727 ## We have some newline diffs RT-ing this edge case
24728 ## and it is not important enough -- we seem to be emitting
24729 ## at most 2 newlines after a </tr> and this is unrelated to
24730 ## the issue from T85627 that this is testing.
24731 !!test
24732 Indented table with blank lines in between (T85627)
24733 !! options
24734 parsoid=wt2html
24735 !! wikitext
24736 {|
24737 |foo
24738
24739
24740 |}
24741 !! html
24742 <table>
24743
24744 <tr>
24745 <td>foo
24746 </td></tr></table>
24747
24748 !!end
24749
24750 !!test
24751 Indented block & table
24752 !! wikitext
24753 <div>foo</div>
24754 {|
24755 |foo
24756 |}
24757 !! html/php
24758 <div>foo</div>
24759 <table>
24760 <tr>
24761 <td>foo
24762 </td></tr></table>
24763
24764 !! html/parsoid
24765 <div data-parsoid='{"stx":"html"}'>foo</div>
24766 <table><tbody>
24767 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24768 </tbody></table>
24769 !!end
24770
24771 !! test
24772 Indent and comment before table row
24773 !! wikitext
24774 {|
24775 <!--hi-->|-
24776 | there
24777 |}
24778 !! html/php
24779 <table>
24780
24781 <tr>
24782 <td> there
24783 </td></tr></table>
24784
24785 !! html/parsoid
24786 <table>
24787 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24788 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24789 </tbody></table>
24790 !! end
24791
24792 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24793 !!test
24794 Empty TR followed by a template-generated TR
24795 !!options
24796 parsoid
24797 !! wikitext
24798 {|
24799 |-
24800 {{echo|<tr><td>foo</td></tr>}}
24801 |}
24802 !! html
24803 <table>
24804 <tbody>
24805 <tr></tr>
24806 <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}}]}'>
24807 <td>foo</td></tr>
24808 </tbody></table>
24809 !!end
24810
24811 ## PHP and parsoid output differ for this, and since this is primarily
24812 ## for testing Parsoid's serializer, marking this Parsoid only
24813 !!test
24814 Empty TR followed by mixed-ws-comment line should RT correctly
24815 !!options
24816 parsoid
24817 !! wikitext
24818 {|
24819 |-
24820 <!--c-->
24821 |-
24822 <!--c--> <!--d-->
24823 |}
24824 !! html
24825 <table>
24826 <tbody>
24827 <tr></tr>
24828 <!--c-->
24829 <tr>
24830 <!--c--> </tr><!--d-->
24831 </tbody></table>
24832
24833 !!end
24834
24835 !!test
24836 Multi-line image caption generated by templates with/without trailing newlines
24837 !! wikitext
24838 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24839 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24840 !! html/parsoid
24841 <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>
24842 <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>
24843 !!end
24844
24845 !! test
24846 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24847 !! options
24848 parsoid=html2wt
24849 !! html/parsoid
24850 <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>
24851
24852 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24853 !! wikitext
24854 <includeonly>foo</includeonly>
24855 new para
24856
24857 [[Category:Foo]]
24858
24859 = new heading =
24860 !! end
24861
24862 ## PHP emits broken html for this, and since this is primarily
24863 ## a Parsoid serializer test, marking this Parsoid only
24864 !!test
24865 Improperly nested inline or quotes tags with whitespace in between
24866 !! wikitext
24867 <span> <s>x</span> </s>
24868 ''' ''x''' ''
24869 !! html/parsoid
24870 <p><span> <s>x</s></span><s> </s>
24871 <b> <i>x</i></b><i> </i>
24872 </p>
24873 !!end
24874
24875 !!test
24876 Encapsulate protected attributes from wt
24877 !! wikitext
24878 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24879
24880 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
24881 | ok
24882 |}
24883 !! html/parsoid
24884 <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>
24885
24886 <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">
24887 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
24888 </tbody></table>
24889 !!end
24890
24891 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24892 ## Having nested or stray pre tags results in the attempt to add duplicates,
24893 ## causing an assertion fail. This test tries to prevent that situation.
24894 !!test
24895 Ensure ParagraphWrapper can deal with stray closing pre tags
24896 !!options
24897 parsoid=wt2html
24898 !! wikitext
24899 plain text</pre>
24900 !! html/parsoid
24901 plain text
24902 !!end
24903
24904 !!test
24905 1. Ensure fostered text content is wrapped in element nodes
24906 !!options
24907 parsoid=wt2html
24908 !! wikitext
24909 <table>hi</table><table>ho</table>
24910 !! html/parsoid
24911 <p>hi</p>
24912 <table></table>
24913 <p>ho</p>
24914 <table></table>
24915 !!end
24916
24917 !!test
24918 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24919 !!options
24920 parsoid=wt2html,wt2wt
24921 !! wikitext
24922 <table>
24923 <tr> || ||
24924 <td> a
24925 </table>
24926 !! html/parsoid
24927 <p> || ||
24928 </p><table>
24929 <tbody><tr><td> a</td></tr>
24930 </tbody></table>
24931 !!end
24932
24933 !!test
24934 Encapsulation properly handles null DSR information from foster box
24935 !!options
24936 parsoid=wt2html,wt2wt
24937 !! wikitext
24938 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24939 !! html/parsoid
24940 <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>
24941 !!end
24942
24943 !!test
24944 1. Encapsulate foster-parented transclusion content
24945 !!options
24946 parsoid=wt2wt,wt2html
24947 !! wikitext
24948 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24949 !! html/parsoid
24950 <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>
24951 <tbody>
24952 <tr>
24953 <td>bar</td>
24954 </tr>
24955 </tbody>
24956 </table>
24957 !!end
24958
24959 !!test
24960 2. Encapsulate foster-parented transclusion content
24961 !!options
24962 parsoid=wt2wt,wt2html
24963 !! wikitext
24964 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24965 !! html/parsoid
24966 <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>
24967 <table>
24968 <tbody>
24969 <tr>
24970 <td>bar</td>
24971 </tr>
24972 </tbody>
24973 </table>
24974 !!end
24975
24976 !!test
24977 3. Encapsulate foster-parented transclusion content
24978 !!options
24979 parsoid=wt2wt,wt2html
24980 !! wikitext
24981 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24982 !! html/parsoid
24983 <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;]}">
24984 <p>foo</p>
24985 </div>
24986 <table>
24987 <tbody>
24988 <tr>
24989 <td>bar</td>
24990 </tr>
24991 </tbody>
24992 </table>
24993 !!end
24994
24995 !!test
24996 4. Encapsulate foster-parented transclusion content
24997 !!options
24998 parsoid=wt2wt,wt2html
24999 !! wikitext
25000 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25001 !! html/parsoid
25002 <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;]}">
25003 <p>foo</p>
25004 </div>
25005 <table>
25006 <tbody>
25007 <tr>
25008 <td>bar</td>
25009 </tr>
25010 </tbody>
25011 </table>
25012 !!end
25013
25014 !!test
25015 5. Encapsulate foster-parented transclusion content
25016 !!options
25017 parsoid=wt2wt,wt2html
25018 !! wikitext
25019 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25020 !! html/parsoid
25021 <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>
25022 <table>
25023 <tbody>
25024 <tr>
25025 <td>
25026 <div>
25027 <p>foo</p>
25028 </div>
25029 </td>
25030 </tr>
25031 </tbody>
25032 </table>
25033 !!end
25034
25035 !!test
25036 6. Encapsulate foster-parented transclusion content
25037 !!options
25038 parsoid=wt2wt,wt2html
25039 !! wikitext
25040 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25041 !! html/parsoid
25042 <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>
25043 <table>
25044 <tbody>
25045 <tr>
25046 <td>
25047 <div>
25048 <p>foo</p>
25049 </div>
25050 </td>
25051 </tr>
25052 </tbody>
25053 </table>
25054 <p>ok</p>
25055 !!end
25056
25057 !!test
25058 7. Encapsulate foster-parented transclusion content
25059 !!options
25060 parsoid=wt2wt,wt2html
25061 !! wikitext
25062 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25063 !! html/parsoid
25064 <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>
25065 <table>
25066 <tbody>
25067 <tr>
25068 <td>bar</td>
25069 </tr>
25070 </tbody>
25071 </table>
25072 !!end
25073
25074 # Note that the wt is broken on purpose: the = should be {{=}} if you
25075 # don't want it to be a template parameter key.
25076 !!test
25077 8. Encapsulate foster-parented transclusion content
25078 !!options
25079 parsoid=wt2wt,wt2html
25080 !! wikitext
25081 {{echo|a
25082 }}{|{{echo|style='color:red'}}
25083 |-
25084 |b
25085 |}
25086 !! html/parsoid
25087 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25088 <span> </span>
25089 <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>
25090 <table>
25091 <tbody>
25092 <tr>
25093 <td>b</td>
25094 </tr>
25095 </tbody>
25096 </table>
25097 !!end
25098
25099 !!test
25100 9. Encapsulate foster-parented transclusion content
25101 !!options
25102 parsoid=wt2wt,wt2html
25103 !! wikitext
25104 <table>{{echo|hi</table>hello}}
25105 !! html/parsoid
25106 <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>
25107 !!end
25108
25109 !!test
25110 Table in fosterable position
25111 !!options
25112 parsoid=wt2html
25113 !! wikitext
25114 {{OpenTable}}
25115 <div>
25116 {|
25117 |}
25118 </div>
25119 |}
25120 !! html/parsoid
25121 <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">
25122 </span>
25123 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25124
25125 <table>
25126 </table>
25127 !!end
25128
25129 # Parsoid only for T66747
25130 !! test
25131 Properly encapsulate empty-content transclusions in fosterable positions
25132 !! wikitext
25133 <table>
25134 {{#if:|
25135 <td>foo</td>
25136 }}
25137 </table>
25138 !! html/parsoid
25139 <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"}]]}'>
25140
25141 </table>
25142 !! end
25143
25144 !! test
25145 Always encapsulate foster box when template range is expanded to table
25146 !! options
25147 parsoid=wt2wt
25148 !! wikitext
25149 {|
25150 hello
25151 {{OpenTable}}
25152 |}
25153 !! html/parsoid
25154
25155 !! end
25156
25157 !! test
25158 T115289: Unclosed table
25159 !! wikitext
25160 {{echo|<table>}}<!--c-->[[Category:Two]]
25161 !! html/parsoid
25162 <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>
25163 !! end
25164
25165 !! test
25166 T115289: Don't migrate newlines out of tables with fostered content
25167 !! wikitext
25168 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25169 !! html/parsoid
25170 <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>
25171 !! end
25172
25173 !! test
25174 T73074: More fostering fun
25175 !! wikitext
25176 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25177 !! html/parsoid
25178 <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>
25179 !! end
25180
25181 !!test
25182 Support <object> element with .data attribute
25183 !!options
25184 parsoid=html2wt
25185 !! html/parsoid
25186 <object data="test.swf"></object>
25187 !! wikitext
25188 <object data="test.swf"></object>
25189 !!end
25190
25191 !! test
25192 Don't block XML namespace declaration
25193 !! wikitext
25194 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25195 !! html/php
25196 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25197 </p>
25198 !! html/parsoid
25199 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25200 !! end
25201
25202 # -----------------------------------------------------------------
25203 # The following section of tests are primarily to spec requirements
25204 # around Parsoid's serialization (old, new, edited content)
25205 #
25206 # All these tests are marked Parsoid html2wt and html2html only
25207 # ----------------------------------------------------------------
25208
25209 !! test
25210 Ignore rel attribute in a-tags during serialization to url-links
25211 !! options
25212 parsoid=html2wt
25213 !! html/parsoid
25214 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25215 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25216 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25217 !! wikitext
25218 http://en.wikipedia.org/wiki/Foobar
25219 http://en.wikipedia.org/wiki/Foobar
25220 http://en.wikipedia.org/wiki/Foobar
25221 !! end
25222
25223 # 'mi' is a localinterwiki prefix as well as a language
25224 !! test
25225 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
25226 !! options
25227 parsoid=html2wt
25228 !! html/parsoid
25229 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25230 !! wikitext
25231 [[Foo]]
25232 !! end
25233
25234 # See T93839
25235 !! test
25236 New wikilinks should be serialized properly
25237 !! options
25238 parsoid=html2wt
25239 !! html/parsoid
25240 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25241 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25242 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25243 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25244 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25245 !! wikitext
25246 [[Foo]]
25247 [[Foo]]
25248 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25249 http://en.wikipedia.org/wiki/Foo
25250 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25251 !! end
25252
25253 !! test
25254 New wiki links (href variations)
25255 !! options
25256 parsoid=html2wt
25257 !! html/parsoid
25258 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25259 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25260 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25261 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25262 !! wikitext
25263 [[Foo_bar]]
25264 [[Foo_bar]]
25265 [[Foo_bar]]
25266 [[Toxine bactérienne]]
25267 !! end
25268
25269 !! test
25270 New wiki links (content string variations)
25271 !! options
25272 parsoid=html2wt
25273 !! html/parsoid
25274 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25275 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25276 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25277 !! wikitext
25278 [[Foo_bar]]
25279 [[Foo bar]]
25280 [[Foo_bar|./Foo_bar]]
25281 !! end
25282
25283 !! test
25284 New category links (href variations)
25285 !! options
25286 parsoid=html2wt
25287 !! html/parsoid
25288 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25289 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25290 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25291 !! wikitext
25292 [[Category:Toxine bactérienne]]
25293 [[Category:Toxine bactérienne]]
25294 [[Category:Toxine bactérienne]]
25295 !! end
25296
25297 !! test
25298 New sol transparent links don't need indent-pre nowiki protection
25299 !! options
25300 parsoid=html2wt
25301 language=de
25302 !! html/parsoid
25303 <link rel="mw:PageProp/redirect" href="./Main_Page">
25304 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25305 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25306 !! wikitext
25307 #WEITERLEITUNG [[Main Page]]
25308 <!-- this is good --> [[Category:Good]]
25309 <!-- this is great --> [[Kategorie:Great]]
25310 !! end
25311
25312 !! test
25313 New interlanguage links (href variations)
25314 !! options
25315 parsoid=html2wt
25316 !! html/parsoid
25317 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25318 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25319 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25320 !! wikitext
25321 [[es:Toxine bactérienne]]
25322 [[es:Toxine_bactérienne]]
25323 [[es:Toxine_bactérienne]]
25324 !! end
25325
25326 !! test
25327 Image: Modifying size of an image (1)
25328 !! options
25329 parsoid={
25330 "modes": ["wt2wt"],
25331 "changes": [
25332 ["img[height]", "attr", "height", "22"],
25333 ["img[width]", "attr", "width", "200"]
25334 ]
25335 }
25336 !! wikitext
25337 [[Image:Foobar.jpg|230x230px]]
25338 !! wikitext/edited
25339 [[Image:Foobar.jpg|200x200px]]
25340 !!end
25341
25342 !! test
25343 Image: Modifying size of an image (2)
25344 !! options
25345 parsoid={
25346 "modes": ["wt2wt"],
25347 "changes": [
25348 ["img[height]", "attr", "height", "100"],
25349 ["img[width]", "attr", "width", "500"]
25350 ]
25351 }
25352 !! wikitext
25353 [[Image:Foobar.jpg|230x230px]]
25354 !! wikitext/edited
25355 [[Image:Foobar.jpg|500x500px]]
25356 !!end
25357
25358 # Change in size is ignored so long as class='mw-default-size'
25359 !! test
25360 Image: Modifying size of an image (3)
25361 !! options
25362 parsoid={
25363 "modes": ["wt2wt"],
25364 "changes": [
25365 ["figure[class]", "removeClass", "mw-default-size"],
25366 ["figure img", "attr", "height", "19"],
25367 ["figure img", "attr", "width", "170"]
25368 ]
25369 }
25370 !! wikitext
25371 [[Image:Foobar.jpg|thumb]]
25372 !! wikitext/edited
25373 [[Image:Foobar.jpg|thumb|170x170px]]
25374 !!end
25375
25376 !! test
25377 Image: Modifying alignment of an image (T50665)
25378 !! options
25379 parsoid={
25380 "modes": ["wt2wt"],
25381 "changes": [
25382 ["figure[class]", "removeClass", "mw-halign-right"],
25383 ["figure[class]", "addClass", "mw-halign-left"]
25384 ]
25385 }
25386 !! wikitext
25387 [[Image:Foobar.jpg|thumb|caption|right]]
25388 !! wikitext/edited
25389 [[Image:Foobar.jpg|thumb|caption|left]]
25390 !! end
25391
25392 !! test
25393 Image: Modifying mw-default-size of an frameless image (T64805)
25394 !! options
25395 parsoid={
25396 "modes": ["wt2wt"],
25397 "changes": [
25398 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25399 ]
25400 }
25401 !! wikitext
25402 [[Image:Foobar.jpg|frameless|right]]
25403 !! wikitext/edited
25404 [[Image:Foobar.jpg|frameless|right|220x220px]]
25405 !! end
25406
25407 !! test
25408 Image: Modifying valign of an image (T51221)
25409 !! options
25410 parsoid={
25411 "modes": ["wt2wt"],
25412 "changes": [
25413 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25414 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25415 ]
25416 }
25417 !! wikitext
25418 [[File:Foobar.jpg|20px|middle]]
25419 !! wikitext/edited
25420 [[File:Foobar.jpg|20px|text-top]]
25421 !! end
25422
25423 !! test
25424 Image: Modifying alt attribute of an image (T58400)
25425 !! options
25426 parsoid={
25427 "modes": ["wt2wt"],
25428 "changes": [
25429 ["img[alt]", "attr", "alt", "some alternate edited text"]
25430 ]
25431 }
25432 !! wikitext
25433 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25434 !! wikitext/edited
25435 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25436 !!end
25437
25438 !! test
25439 Image: Modifying caption of an image
25440 !! options
25441 parsoid={
25442 "modes": ["wt2wt"],
25443 "changes": [
25444 ["figcaption", "text", "new caption"]
25445 ]
25446 }
25447 !! wikitext
25448 [[Image:Foobar.jpg|thumb|original caption]]
25449 !! wikitext/edited
25450 [[Image:Foobar.jpg|thumb|new caption]]
25451 !!end
25452
25453 !! test
25454 Image: empty alt attribute (T50924)
25455 !! options
25456 parsoid
25457 !! wikitext
25458 [[File:Foobar.jpg|thumb|alt=|bar]]
25459 !! html
25460 <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>
25461 !! end
25462
25463 !! test
25464 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
25465 !! options
25466 parsoid=html2wt
25467 language=ar
25468 disabled
25469 !! html/parsoid
25470 <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>
25471 !! wikitext
25472 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25473 !! end
25474
25475 !! test
25476 Image: Block level image should have \n before and after
25477 !! wikitext
25478 123
25479 [[File:Foobar.jpg|right|thumb|150x150px]]
25480 456
25481 !! html/parsoid
25482 <p>123</p>
25483 <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>
25484 <p>456</p>
25485 !!end
25486
25487 !! test
25488 Image: New block level image should have \n before and after (existing content)
25489 !! wikitext
25490 123
25491 [[File:Foobar.jpg|right|thumb|150x150px]]
25492 456
25493 !! html/parsoid
25494 <p>123</p>
25495 <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>
25496 <p>456</p>
25497 !!end
25498
25499 !! test
25500 Image: upright option (parsoid)
25501 !! wikitext
25502 [[File:Foobar.jpg|thumb|upright|caption]]
25503 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25504 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25505 !! html/parsoid
25506 <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>
25507 <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>
25508 <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>
25509 !!end
25510
25511 !! test
25512 Image: upright option is ignored on inline and frame images (parsoid)
25513 !! wikitext
25514 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25515 !! html/parsoid
25516 <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>
25517 !!end
25518
25519 !! test
25520 Image: from basic HTML (1)
25521 !! options
25522 parsoid=html2wt
25523 !! html/parsoid
25524 <span typeof="mw:Image">
25525 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25526 </span>
25527 !! wikitext
25528 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25529 !! end
25530
25531 !! test
25532 Image: from basic HTML (2)
25533 !! options
25534 parsoid=html2wt
25535 !! html/parsoid
25536 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25537 !! wikitext
25538 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25539 !! end
25540
25541 !! test
25542 Image: from basic HTML (3)
25543 !! options
25544 parsoid=html2wt
25545 !! html/parsoid
25546 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25547 !! wikitext
25548 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25549 !! end
25550
25551 !! test
25552 Image: from basic HTML (4)
25553 !! options
25554 parsoid=html2wt
25555 !! html/parsoid
25556 <img src="./File:Foobar.jpg">
25557 !! wikitext
25558 [[File:Foobar.jpg|link=]]
25559 !! end
25560
25561 !! test
25562 Image: Invalid title as link
25563 !! wikitext
25564 [[File:Foobar.jpg|link=<]]
25565 !! html/php
25566 <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>
25567 </p>
25568 !! html/parsoid
25569 <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>
25570 !! end
25571
25572 !! test
25573 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25574 !! options
25575 parsoid=html2wt
25576 !! html/parsoid
25577 <ul>
25578 <li><p>foo</p></li>
25579 </ul>
25580 !! wikitext
25581 * foo
25582 !! end
25583
25584 !! test
25585 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25586 !! options
25587 parsoid=html2wt
25588 !! html/parsoid
25589 <ul> <li>foo</li></ul>
25590 !! wikitext
25591 * foo
25592 !! end
25593
25594 !! test
25595 Don't strip leading whitespace when handling indent-pre suppressing tags
25596 !! options
25597 parsoid=html2wt
25598 !! html/parsoid
25599 <table>
25600 <tr><td> indented row</td></tr>
25601 </table>
25602 <blockquote><p>
25603 <b>This is very bold of you!</b>
25604 </p>
25605 <table><tr><td>
25606 indented cell (no pre-wrapping!)
25607 </td></tr></table>
25608 </blockquote>
25609 <p>foo</p>
25610 <div>bar</div>
25611 !! wikitext
25612 {|
25613 | indented row
25614 |}
25615 <blockquote>
25616 '''This is very bold of you!'''
25617
25618 {|
25619 |
25620 indented cell (no pre-wrapping!)
25621 |}
25622 </blockquote>
25623 foo
25624 <div>bar</div>
25625 !! end
25626
25627 !! test
25628 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25629 !! options
25630 parsoid=html2wt
25631 !! html/parsoid
25632 <p>foo</p>
25633 <span>bar</span>
25634
25635 <span>foo2
25636 </span>bar2
25637
25638 <div>foo</div>
25639 <span>bar</span>
25640
25641 <div>
25642 <span>foo</span>
25643 </div>
25644 !! wikitext
25645 foo
25646
25647 <span>bar</span>
25648
25649 <span>foo2
25650 <nowiki> </nowiki></span>bar2
25651
25652 <div>foo</div>
25653 <nowiki> </nowiki><span>bar</span>
25654
25655 <div>
25656 <nowiki> </nowiki><span>foo</span>
25657 </div>
25658 !! end
25659
25660 !! test
25661 Lists: Dont insert newlines in a serialized list item.
25662 !! options
25663 parsoid=html2wt
25664 !! html/parsoid
25665 <ul><li>a<br>b</li><li>c</li></ul>
25666 !! wikitext
25667 * a<br>b
25668 * c
25669 !! end
25670
25671 !! test
25672 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25673 !! options
25674 parsoid={
25675 "modes": ["html2wt"],
25676 "scrubWikitext": false
25677 }
25678 !! html/parsoid
25679 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25680 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25681
25682 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25683 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25684
25685 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25686
25687 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25688 !! wikitext
25689 == hello there [[Category:A1]] ==
25690
25691 == [[Category:A2]] hi pal ==
25692
25693 == <!--foo--> [[Category:A3]] how goes it ==
25694
25695 == it goes well [[Category:A4]] <!--bar--> ==
25696
25697 ==howdy [[Category:A5]]==
25698
25699 == __TOC__ ok ==
25700 !! end
25701
25702 !! test
25703 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25704 !! options
25705 parsoid={
25706 "modes": ["html2wt"],
25707 "scrubWikitext": true
25708 }
25709 !! html/parsoid
25710 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25711 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25712
25713 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25714 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25715
25716 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25717 !! wikitext
25718 == hello there ==
25719 [[Category:A1]]
25720 [[Category:A2]]
25721
25722 == hi pal ==
25723
25724 <!--foo--> [[Category:A3]]
25725
25726 == how goes it ==
25727
25728 == it goes well ==
25729 [[Category:A4]] <!--bar-->
25730
25731 __TOC__
25732
25733 == ok ==
25734 !! end
25735
25736 !! test
25737 Headings: Don't hoist metas that come from templates
25738 !! options
25739 parsoid={
25740 "modes": ["html2wt"],
25741 "scrubWikitext": true
25742 }
25743 !! html/parsoid
25744 <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>
25745 !! wikitext
25746 == {{echo|foo [[Category:Foo]]}} ==
25747 !! end
25748
25749 !! test
25750 Headings: Category in ref isn't hoisted
25751 !! options
25752 parsoid={
25753 "modes": ["html2wt"],
25754 "scrubWikitext": true
25755 }
25756 !! html/parsoid
25757 <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>
25758
25759 <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>
25760 !! wikitext
25761 == foo <ref>bar
25762 [[Category:Baz]] </ref> ==
25763
25764 <references />
25765 !! end
25766
25767 !! test
25768 Parsoid: Serialize positional parameters with = in them as named parameter
25769 !! options
25770 parsoid=html2wt
25771 !! html/parsoid
25772 <p about="#mwt1" typeof="mw:Transclusion"
25773 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25774
25775 <p about="#mwt1" typeof="mw:Transclusion"
25776 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25777
25778 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25779 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25780 <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>
25781 !! wikitext
25782 {{echo|1=f=oo}}
25783
25784 {{echo|1=f=oo|2=bar}}
25785
25786 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25787 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25788 {{echo|<nowiki>f=oo</nowiki>|bar}}
25789 !! end
25790
25791 !! test
25792 Parsoid: Serialize positional parameters with = in extlink as named parameter
25793 !! options
25794 parsoid=html2wt
25795 !! html/parsoid
25796 <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>
25797 !! wikitext
25798 {{echo|1=http://stuff?is=ok}}
25799 !! end
25800
25801 !! test
25802 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25803 !! options
25804 parsoid=html2wt
25805 !! html/parsoid
25806 <div>a<p>b</p></div>
25807 <div>a
25808 <p>b</p></div>
25809 <div>
25810 a
25811 <p>b</p></div>
25812 !! wikitext
25813 <div>a
25814 b
25815 </div>
25816 <div>a
25817 b
25818 </div>
25819 <div>
25820 a
25821
25822 b
25823 </div>
25824 !! end
25825
25826 !! test
25827 Substrings resembling wikitext in hrefs should not get nowiki escapes
25828 !! options
25829 parsoid=html2wt
25830 !! html/parsoid
25831 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25832 !! wikitext
25833 [[Foo''bar''baz]]
25834 !! end
25835
25836 !! test
25837 Enforce single-line context in the serializer
25838 !! options
25839 parsoid=html2wt
25840 !! html/parsoid
25841 <h2>testing
25842 123</h2>
25843
25844 <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">
25845 </span><span about="#mwt1">you</span> </h2>
25846
25847 <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>
25848
25849 <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
25850 there</span></li></ol>
25851
25852 <ul><li>asd
25853 sdf</li></ul>
25854
25855 <ul><li>foo
25856 bar
25857 baz</li>
25858 <li>foo <b>bar</b>
25859 baz</li></ul>
25860
25861 <dl><dt>hi
25862 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25863 ho</dd></dl>
25864
25865 <dl><dd> <table>
25866 <tbody><tr><td> ha
25867 ha
25868 ha</td></tr>
25869 </tbody></table></dd></dl>
25870 !! wikitext
25871 == testing 123 ==
25872
25873 == hi {{bogus|there
25874 you}} ==
25875
25876 == foo <ref>hello
25877 there</ref> ==
25878
25879 <references />
25880
25881 * asd sdf
25882
25883 * foo bar baz
25884 * foo '''bar''' baz
25885
25886 ; hi ho : hi ho
25887
25888 : {|
25889 | ha
25890 ha
25891 ha
25892 |}
25893 !! end
25894
25895 !! test
25896 Serialize new placeholder space without spans
25897 !! options
25898 parsoid=html2wt
25899 !! html/parsoid
25900 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25901
25902 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25903
25904 <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>
25905 !! wikitext
25906 foo : bar
25907
25908 foo : bar
25909
25910 <ref>foo : bar</ref>ok
25911 !! end
25912
25913
25914 #-----------------------
25915 # Tag minimization tests
25916 #-----------------------
25917
25918 !! test
25919 1. I/B quote minimization: wikitext-only tags should be combined
25920 !! options
25921 parsoid=html2wt
25922 !! html/parsoid
25923 <p><i>A</i><i>B</i></p>
25924 <p><b>A</b><b>B</b></p>
25925 <p><i>A</i><b><i>B</i></b></p>
25926 <p><b>A</b><i><b>B</b></i></p>
25927 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25928 <p><i><b>A</b></i><i><b>B</b></i></p>
25929 <p><i><b>A</b></i><b><i>B</i></b></p>
25930 <p><b><i>A</i></b><i><b>B</b></i></p>
25931 !! wikitext
25932 ''AB''
25933
25934 '''AB'''
25935
25936 ''A'''B'''''
25937
25938 '''A''B'''''
25939
25940 '''A''BC''D'''
25941
25942 '''''AB'''''
25943
25944 '''''AB'''''
25945
25946 '''''AB'''''
25947 !! end
25948
25949 !! test
25950 2. I/B quote minimization: wikitext and html tags should not be combined
25951 !! options
25952 parsoid=html2wt
25953 !! html/parsoid
25954 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25955 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25956 !! wikitext
25957 ''A''<i>B</i>
25958
25959 ''A''<nowiki/>'''<i>B</i>'''
25960 !! end
25961
25962 !! test
25963 3. I/B quote minimization: templated content stops minimization
25964 !! options
25965 parsoid=html2wt
25966 !! html/parsoid
25967 <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>
25968 <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>
25969 !! wikitext
25970 ''A''{{echo|''B''}}
25971
25972 ''A''{{echo|'''''B'''''}}
25973 !! end
25974
25975 !! test
25976 4. I/B quote minimization: new content should be mimimized with adjacent old content
25977 !! options
25978 parsoid=html2wt
25979 !! html/parsoid
25980 <p><i>A</i><i>B</i></p>
25981 <p><b>A</b><b>B</b></p>
25982 <p><i>A</i><b><i>B</i></b></p>
25983 !! wikitext
25984 ''AB''
25985
25986 '''AB'''
25987
25988 ''A'''B'''''
25989 !! end
25990
25991 !! test
25992 5a. Merge adjacent quote nodes if they've been edited
25993 !! options
25994 parsoid={
25995 "modes": ["wt2wt", "selser"],
25996 "changes": [
25997 ["p", "contents", "remove", ":contains('b')"]
25998 ]
25999 }
26000 !! wikitext
26001 ''a''b''c''
26002 !! wikitext/edited
26003 ''ac''
26004 !! end
26005
26006 !! test
26007 5b. Merge adjacent quote nodes if they've been edited
26008 !! options
26009 parsoid={
26010 "modes": ["wt2wt", "selser"],
26011 "changes": [
26012 ["#x", "remove"]
26013 ]
26014 }
26015 !! wikitext
26016 ''a''<span id="x">b</span>''c''
26017 !! wikitext/edited
26018 ''ac''
26019 !! end
26020
26021 !! test
26022 1. Merge adjacent link nodes as long as at least one element is new
26023 !! options
26024 parsoid={
26025 "modes": ["html2wt"],
26026 "scrubWikitext": true
26027 }
26028 !! html/parsoid
26029 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26030 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26031 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26032 !! wikitext
26033 [[Football]]
26034 [[Football]]
26035 [[Football|Foot]][[Football|ball]]
26036 !! end
26037
26038 !! test
26039 2. Merge adjacent link nodes and enable additional normalizations
26040 !! options
26041 parsoid={
26042 "modes": ["html2wt"],
26043 "scrubWikitext": true
26044 }
26045 !! html/parsoid
26046 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26047 !! wikitext
26048 [[Football|''Football'']]
26049 !! end
26050
26051 !! test
26052 3. Don't merge adjacent link nodes if scrubWikitext is false
26053 !! options
26054 parsoid={
26055 "modes": ["html2wt"],
26056 "scrubWikitext": false
26057 }
26058 !! html/parsoid
26059 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26060 !! wikitext
26061 [[Football|Foot]][[Football|ball]]
26062 !! end
26063
26064 #------------------------------
26065 # End of tag minimization tests
26066 #------------------------------
26067
26068 !!test
26069 T56262: New entities
26070 !! options
26071 parsoid=html2wt
26072 !! html/parsoid
26073 <span typeof="mw:Entity">&nbsp;</span>
26074 !! wikitext
26075 &nbsp;
26076 !! end
26077
26078 ## Note that there is no wikitext output for 'unknownproperty' ##
26079 ## Unknown magic words are silently dropped ##
26080
26081 !! test
26082 Magic words
26083 !! options
26084 parsoid=html2wt
26085 !! html/parsoid
26086 <meta property='mw:PageProp/toc' />
26087 <meta property='mw:PageProp/notoc' />
26088 <meta property='mw:PageProp/forcetoc' />
26089 <meta property='mw:PageProp/index' />
26090 <meta property='mw:PageProp/noindex' />
26091 <meta property='mw:PageProp/nogallery' />
26092 <meta property='mw:PageProp/noeditsection' />
26093 <meta property='mw:PageProp/notitleconvert' />
26094 <meta property='mw:PageProp/nocontentconvert' />
26095 <meta property='mw:PageProp/unknownproperty' />
26096 !! wikitext
26097 __TOC__
26098 __NOTOC__
26099 __FORCETOC__
26100 __INDEX__
26101 __NOINDEX__
26102 __NOGALLERY__
26103 __NOEDITSECTION__
26104 __NOTITLECONVERT__
26105 __NOCONTENTCONVERT__
26106 !! end
26107
26108 !! test
26109 Consecutive <pre>s should not get merged
26110 !! options
26111 parsoid=html2wt,html2html
26112 !! html/parsoid
26113 <pre>a</pre><pre>b</pre>
26114
26115 <pre>c
26116 </pre><pre>
26117 d</pre>
26118
26119 <pre>e
26120
26121 </pre><pre>
26122
26123 f</pre>
26124 !! wikitext
26125 a
26126
26127 b
26128
26129 c
26130
26131 d
26132
26133 e
26134
26135
26136
26137 f
26138 !! end
26139
26140 !! test
26141 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26142 !! options
26143 parsoid=html2wt
26144 !! html/parsoid
26145 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26146 !! wikitext
26147 [[Special:BookSources/1234567890|ISBN 1234567895]]
26148 !! end
26149
26150 !! test
26151 Edited RFC links not serializable as RFC links should serialize as extlinks
26152 !! options
26153 parsoid=html2wt
26154 !! html/parsoid
26155 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26156 !! wikitext
26157 [//tools.ietf.org/html/rfc123 New RFC]
26158 !! end
26159
26160 !! test
26161 Edited PMID links not serializable as PMID links should serialize as extlinks
26162 !! options
26163 parsoid=html2wt
26164 !! html/parsoid
26165 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26166 !! wikitext
26167 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26168 !! end
26169
26170 !! test
26171 WTS of autolinks with trailing/surrounding context
26172 !! options
26173 parsoid=html2wt
26174 !! html/parsoid
26175 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26176 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26177 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26178 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26179 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26180 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26181 !! wikitext
26182 http://cscott.net'''foo'''
26183
26184 http://cscott.net<b>foo</b>
26185
26186 '''http://cscott.net'''
26187
26188 '''http://cscott.net '''
26189
26190 '''http://cscott.net<nowiki/>x'''
26191
26192 http://cscott.net<nowiki/>x
26193 !! end
26194
26195 !! test
26196 WTS of autolinks with nowikis (round-trip)
26197 !! wikitext
26198 x<nowiki/>http://cscott.net<nowiki/>x
26199 !! html/parsoid
26200 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26201 !! end
26202
26203 # this is the "easy" test because it leaves in place all the
26204 # data-parsoid information indicating this is an autolink
26205 !! test
26206 WTS of autolinks with escapes (editing)
26207 !! options
26208 parsoid={
26209 "modes": ["wt2wt"],
26210 "changes": [
26211 [ "span", "remove" ]
26212 ]
26213 }
26214 !! wikitext
26215 x<nowiki/>http://cscott.net<nowiki/>x
26216 !! wikitext/edited
26217 x<nowiki/>http://cscott.net<nowiki/>x
26218 !! end
26219
26220 !! test
26221 WTS of edited autolink-like text (T103364)
26222 !! options
26223 parsoid={
26224 "modes": ["wt2wt"],
26225 "changes": [
26226 [ "span[typeof]", "removeAttr", "typeof" ]
26227 ]
26228 }
26229 !! wikitext
26230 Not a link: <nowiki>http://example.com</nowiki>.
26231 !! wikitext/edited
26232 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26233 !! end
26234
26235 !! test
26236 WTS of newly-authored autolink-like text (T103364)
26237 !! options
26238 parsoid=html2wt
26239 !! html/parsoid
26240 <p>http://example.com is not a link.</p>
26241 !! wikitext
26242 <nowiki>http://example.com</nowiki> is not a link.
26243 !! end
26244
26245 !! test
26246 WTS of autolink-like text after an autolink (T108563)
26247 !! options
26248 parsoid=html2wt
26249 !! html/parsoid
26250 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26251 !! wikitext
26252 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26253 !! end
26254
26255 !! test
26256 Magic links inside links (not autolinked)
26257 !! wikitext
26258 [[Foo|http://example.com]]
26259 [[Foo|RFC 1234]]
26260 [[Foo|PMID 1234]]
26261 [[Foo|ISBN 123456789x]]
26262
26263 [http://foo.com http://example.com]
26264 [http://foo.com RFC 1234]
26265 [http://foo.com PMID 1234]
26266 [http://foo.com ISBN 123456789x]
26267 !! html+tidy
26268 <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>
26269 <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>
26270 !! html/parsoid
26271 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26272 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26273 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26274 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26275
26276 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26277 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26278 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26279 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26280 !! end
26281
26282 !! test
26283 Magic links inside image captions (autolinked)
26284 !! wikitext
26285 [[File:Foobar.jpg|thumb|http://example.com]]
26286 [[File:Foobar.jpg|thumb|RFC 1234]]
26287 [[File:Foobar.jpg|thumb|PMID 1234]]
26288 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26289 !! html+tidy
26290 <div class="thumb tright">
26291 <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>
26292 <div class="thumbcaption">
26293 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26294 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26295 </div>
26296 </div>
26297 <div class="thumb tright">
26298 <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>
26299 <div class="thumbcaption">
26300 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26301 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26302 </div>
26303 </div>
26304 <div class="thumb tright">
26305 <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>
26306 <div class="thumbcaption">
26307 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26308 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26309 </div>
26310 </div>
26311 <div class="thumb tright">
26312 <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>
26313 <div class="thumbcaption">
26314 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26315 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26316 </div>
26317 </div>
26318 !! html/parsoid
26319 <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>
26320 <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>
26321 <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>
26322 <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>
26323 !! end
26324
26325 !! test
26326 WTS of magic word text (T109371)
26327 !! options
26328 parsoid=html2wt
26329 !! html/parsoid
26330 <p>RFC 1234</p>
26331 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26332 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26333 !! wikitext
26334 <nowiki>RFC 1234</nowiki>
26335
26336 [http://foo.com RFC 1234]
26337
26338 [[Foo|RFC 1234]]
26339 !! end
26340
26341 !! test
26342 Edited Redirect link should emit a non-piped wikitext link
26343 !! options
26344 parsoid=html2wt
26345 !! html/parsoid
26346 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26347 !! wikitext
26348 #REDIRECT [[Bar]]
26349 !! end
26350
26351 !! test
26352 T75121: Infer extension name from typeOf if data-mw is not present
26353 !! options
26354 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26355 !! html/parsoid
26356 <div typeOf="mw:Extension/foo"></div>
26357 !! wikitext
26358 <foo />
26359 !! end
26360
26361 # Note that the <p> wrapping isn't present in PHP parser output
26362 # The important thing for this test is that P-wrapping doesn't
26363 # interfere with the <nowiki> protection for leading - in <td>
26364 # (which isn't necessary for <th>).
26365 !! test
26366 T88318: p-wrapped dash in table.
26367 !! options
26368 parsoid=html2wt,wt2wt
26369 !! html/parsoid
26370 <table><tbody>
26371 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26372 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26373 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26374 </tbody></table>
26375 !! wikitext
26376 {|
26377 !-
26378 !-
26379 |-
26380 |<nowiki>-</nowiki>
26381 |<nowiki>- </nowiki>
26382 |-
26383 |<small>-</small>
26384 |<br>
26385 -
26386 |<br>
26387 -
26388 |}
26389 !! html/php+tidy
26390 <table>
26391 <tr>
26392 <th>-</th>
26393 <th>-</th>
26394 </tr>
26395 <tr>
26396 <td>-</td>
26397 <td>-</td>
26398 </tr>
26399 <tr>
26400 <td><small>-</small></td>
26401 <td><br />
26402 <p>-</p>
26403 </td>
26404 <td><br />
26405 <p>-</p>
26406 </td>
26407 </tr>
26408 </table>
26409 !! end
26410
26411 !! test
26412 T149209: WTS: Handle newlines in table cells properly
26413 !! options
26414 parsoid=html2wt
26415 !! html/parsoid
26416 <table>
26417 <tbody>
26418 <tr><td>a
26419 b
26420 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
26421 <tr><td><p>x</p>
26422 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
26423 </tbody></table>
26424 <table>
26425 <tbody>
26426 <tr><th>a
26427 b
26428 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
26429 <tr><th><p>x</h>
26430 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
26431 </tbody></table>
26432 !! wikitext
26433 {|
26434 |a
26435 b
26436 |c
26437 |-
26438 |x
26439 {{!}}y
26440 |}
26441 {|
26442 !a
26443 b
26444 !c
26445 |-
26446 !x
26447 !y
26448 |}
26449 !! end
26450
26451 !! test
26452 T149209: Selser: Handle newlines in table cells properly
26453 !! options
26454 parsoid={
26455 "modes": ["selser"],
26456 "changes": [
26457 [ "#h1", "html", "a\nb\n" ],
26458 [ "#h2", "html", "a\nb\n" ],
26459 [ "#c1", "html", "a\nb\n" ],
26460 [ "#c2", "html", "<p>a</p>" ],
26461 [ "#c3", "html", "<p>a</p>" ],
26462 [ "#c4", "html", "edit-me<p>a</p>" ]
26463 ]
26464 }
26465 !! wikitext
26466 {|
26467 ! id="h1" |edit-me!!1
26468 |-
26469 ! id="h2" |edit-me||2
26470 |-
26471 | id="c1" |edit-me||3
26472 |-
26473 | id="c2" |edit-me||4
26474 |-
26475 | id="c3" |edit-me||p||q||r
26476 |-
26477 | id="c4" |edit-me||p||q||r
26478 |}
26479 !! wikitext/edited
26480 {|
26481 ! id="h1" |a
26482 b
26483 !1
26484 |-
26485 ! id="h2" |a
26486 b
26487 !2
26488 |-
26489 | id="c1" |a
26490 b
26491 |3
26492 |-
26493 | id="c2" |a
26494 |4
26495 |-
26496 | id="c3" |a
26497 |p||q||r
26498 |-
26499 | id="c4" |edit-me
26500 a
26501 |p||q||r
26502 |}
26503 !! end
26504
26505 !! test
26506 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26507 !! options
26508 parsoid=html2wt
26509 !! html/parsoid
26510 <table id='mwAb'>
26511 <td id='mwAc'>foo</td>
26512 <td id='serialize-this'>bar</td>
26513 </table>
26514 !! wikitext
26515 {|
26516 |foo
26517 | id="serialize-this" |bar
26518 |}
26519 !! end
26520
26521 !! test
26522 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26523 !! options
26524 parsoid=html2wt
26525 !! html/parsoid
26526 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26527 !! wikitext
26528 <div id="hello">ok</div>
26529 !! end
26530
26531 !! test
26532 WTS change modes
26533 !! options
26534 parsoid={
26535 "modes": ["wt2wt"],
26536 "changes": [
26537 [ "#xyz", "before", "<b>before</b> stuff " ],
26538 [ "#xyz", "after", " stuff <i>after</i>" ],
26539 [ "#xyz", "html", "x <b>y</b> z" ]
26540 ]
26541 }
26542 !! wikitext
26543 <span id="xyz">hello</span>
26544 !! wikitext/edited
26545 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26546 !! end
26547
26548 !! test
26549 Never serialize a-tag as html, regardless of what data-parsoid has to say
26550 !! options
26551 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26552 !! html/parsoid
26553 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26554 !! wikitext
26555 [[Foo]]
26556 !! end
26557
26558 ## SSS FIXME: This is broken output nevertheless.
26559 ## What might be a reasonable non-broken output for this?
26560 ## This is an edge case unlikely to be seen in production
26561 ## that I am not wasting more time on this right now.
26562 !! test
26563 Never serialize a-tag as html, no matter what attributes it has
26564 !! options
26565 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26566 !! html/parsoid
26567 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26568 !! wikitext
26569 [http://boo.org http://boohoo.org]
26570 !! end
26571
26572 # Misnested is an indication that selser can reuse the source but these have
26573 # shown to sneak through on occasion. See T101768.
26574 # The original wikitext here is: [http://test.com [[one]] two three]
26575 !! test
26576 Strip span tags added to mark misnested links
26577 !! options
26578 parsoid=html2wt
26579 !! html/parsoid
26580 <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>
26581 !! wikitext
26582 [http://test.com][[one]] two three
26583 !! end
26584
26585 !! test
26586 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26587 !! options
26588 parsoid=html2wt
26589 !! html/parsoid
26590 <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|}"]}'>
26591 <tbody><tr><td>d
26592 </td></tr>
26593 </tbody></table>
26594 !! wikitext
26595 {{echo|a}}
26596 {|{{echo|c
26597 {{!}}d
26598 }}
26599 |}
26600 !! end
26601
26602 ## This test verifies the presence and computation of this attribute indirectly
26603 ## by making an edit and ensuring that the serialization is correct (which it would be
26604 ## only if firstWikitextNode is properly set).
26605 !! test
26606 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26607 !! options
26608 parsoid= {
26609 "modes": ["wt2wt"],
26610 "changes": [
26611 [ "div#x", "remove" ],
26612 [ "div", "before", "<div>new</div>" ]
26613 ]
26614 }
26615 !! wikitext
26616 <div id="x">foo</div>
26617 {|
26618 {{echo|<div>boo</div>
26619 {{!}}b}}
26620 |c
26621 |}
26622 !! wikitext/edited
26623
26624 <div>new</div>
26625 {|
26626 {{echo|<div>boo</div>
26627 {{!}}b}}
26628 |c
26629 |}
26630 !! end
26631
26632 # --------------------------------------------
26633 # Tests spec'ing wikitext serialization norms |
26634 # --------------------------------------------
26635
26636 !! test
26637 1. Categories should always be serialized on their own line
26638 !! options
26639 parsoid=html2wt
26640 !! html/parsoid
26641 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26642 !! wikitext
26643 foo
26644 [[Category:Foo]]
26645 bar
26646 !! end
26647
26648 !! test
26649 2. Categories that are part of templates should not introduce a line break
26650 !! wikitext
26651 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26652 !! html/parsoid
26653 <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>
26654 !! end
26655
26656 # Careful while editing these next 2 tests. There are \u200f characters
26657 # before and after the <link> tags in the HTML and following some
26658 # of the categories in wikitext
26659 # Do not remove these characters in edits.
26660 #
26661 # As part of the serialization, these bidi characters will get stripped.
26662 !! test
26663 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26664 !! options
26665 parsoid={
26666 "modes": ["html2wt"],
26667 "scrubWikitext": true
26668 }
26669 !! html/parsoid
26670 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26671 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26672 !! wikitext
26673 [[קטגוריה:טקסים]]
26674 [[קטגוריה: שיטות משפט]]
26675 !! end
26676
26677 !! test
26678 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26679 !! options
26680 parsoid={
26681 "modes": ["html2wt"],
26682 "scrubWikitext": true
26683 }
26684 !! html/parsoid
26685 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26686 !! wikitext
26687 [[קטגוריה:טקסים]]
26688 ‏y
26689 !! end
26690
26691 !! test
26692 Lists: Add space after bullets
26693 !! options
26694 parsoid=html2wt
26695 !! html/parsoid
26696 <ul>
26697 <li>foo</li>
26698 <li> bar</li>
26699 <li><span> baz</span></li>
26700 </ul>
26701 !! wikitext
26702 * foo
26703 * bar
26704 * <span> baz</span>
26705 !! end
26706
26707 !! test
26708 1. Headings: Add space before/after == (T53744)
26709 !! options
26710 parsoid=html2wt
26711 !! html/parsoid
26712 <h2>foo</h2>
26713 <h2> bar</h2>
26714 <h2>baz </h2>
26715 <h2><span> baz</span></h2>
26716 !! wikitext
26717 == foo ==
26718
26719 == bar ==
26720
26721 == baz ==
26722
26723 == <span> baz</span> ==
26724 !! end
26725
26726 !! test
26727 2. Headings: Add space before/after == even after hoisted content
26728 !! options
26729 parsoid={
26730 "modes": ["html2wt"],
26731 "scrubWikitext": true
26732 }
26733 !! html/parsoid
26734 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26735 !! wikitext
26736 [[Category:A2]]
26737
26738 == ok ==
26739 !! end
26740
26741 !! test
26742 1. Headings: suppress newly created empty headings
26743 !! options
26744 parsoid={
26745 "modes": ["html2wt"],
26746 "scrubWikitext": true
26747 }
26748 !! html/parsoid
26749 <h2></h2>
26750 !! wikitext
26751 !! end
26752
26753 !! test
26754 2. Headings: don't suppress empty headings if scrubWikitext is false
26755 !! options
26756 parsoid=html2wt
26757 !! html/parsoid
26758 <h2></h2>
26759 !! wikitext
26760 ==<nowiki/>==
26761 !! end
26762
26763 !! test
26764 3. Headings: suppress empty headings on edits
26765 !! options
26766 parsoid={
26767 "modes": ["selser"],
26768 "scrubWikitext": true,
26769 "changes": [
26770 [ "#x", "remove"]
26771 ]
26772 }
26773 !! wikitext
26774 ==<span id="x">foo</span>==
26775 !! wikitext/edited
26776 !! end
26777
26778 !! test
26779 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26780 !! options
26781 parsoid={
26782 "modes": ["html2wt"],
26783 "scrubWikitext": true
26784 }
26785 !! html/parsoid
26786 <h2>foo<br/>bar</h2>
26787 <h2>foo <span><br/>bar</span> baz</h2>
26788 !! wikitext
26789 == foo bar ==
26790
26791 == foo <span> bar</span> baz ==
26792 !! end
26793
26794 !! test
26795 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26796 !! options
26797 parsoid={
26798 "modes": ["html2wt"],
26799 "scrubWikitext": false
26800 }
26801 !! html/parsoid
26802 <h2>foo<br/>bar</h2>
26803 !! wikitext
26804 == foo<br> bar ==
26805 !! end
26806
26807 !! test
26808 1. WT Quote Tags: suppress newly created empty style tags
26809 !! options
26810 parsoid={
26811 "modes": ["html2wt"],
26812 "scrubWikitext": true
26813 }
26814 !! html/parsoid
26815 <i></i><b></b>
26816 !! wikitext
26817 !! end
26818
26819 !! test
26820 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26821 !! options
26822 parsoid=html2wt
26823 !! html/parsoid
26824 <i></i><b></b>
26825 !! wikitext
26826 ''<nowiki/>'''''<nowiki/>'''
26827 !! end
26828
26829 !! test
26830 3. WT Quote Tags: suppress empty style tags on edits
26831 !! options
26832 parsoid={
26833 "modes": ["selser"],
26834 "scrubWikitext": true,
26835 "changes": [
26836 [ "#x", "remove"]
26837 ]
26838 }
26839 !! wikitext
26840 '''<span id="x">foo</span>'''
26841 !! wikitext/edited
26842 !! end
26843
26844 !! test
26845 1. Anchors: suppress newly created empty anchors
26846 !! options
26847 parsoid={
26848 "modes": ["html2wt"],
26849 "scrubWikitext": true
26850 }
26851 !! html/parsoid
26852 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26853 !! wikitext
26854 !! end
26855
26856 !! test
26857 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26858 !! options
26859 parsoid={
26860 "modes": ["html2wt"],
26861 "scrubWikitext": false
26862 }
26863 !! html/parsoid
26864 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26865 !! wikitext
26866 [[Test|<nowiki/>]]
26867 !! end
26868
26869 !! test
26870 3. Anchors: suppress empty anchors on edits
26871 !! options
26872 parsoid={
26873 "modes": ["selser"],
26874 "scrubWikitext": true,
26875 "changes": [
26876 [ "#x", "remove"]
26877 ]
26878 }
26879 !! wikitext
26880 [[Test|<span id="x">foo</span>]]
26881 !! wikitext/edited
26882 !! end
26883
26884 !! test
26885 3a. Anchors: do not suppress numbered extlinks
26886 !! options
26887 parsoid={
26888 "modes": ["wt2wt"],
26889 "scrubWikitext": true
26890 }
26891 !! wikitext
26892 [http://foo.com]
26893 !! html/parsoid
26894 <a rel="mw:ExtLink" href="http://foo.com"></a>
26895 !! end
26896
26897 !! test
26898 3b. Anchors: do not suppress numbered extlinks
26899 !! options
26900 parsoid={
26901 "modes": ["wt2wt"],
26902 "scrubWikitext": true,
26903 "changes": [
26904 [ "#x", "remove"]
26905 ]
26906 }
26907 !! wikitext
26908 [http://foo.com <span id="x">foo</span>]
26909 !! wikitext/edited
26910 [http://foo.com]
26911 !! end
26912
26913 !!test
26914 Normalizations should be restricted to edited content
26915 !!options
26916 parsoid={
26917 "modes": ["selser"],
26918 "scrubWikitext": true,
26919 "changes": [
26920 [ "h1", "before", "<i></i>"]
26921 ]
26922 }
26923 !!wikitext
26924 a
26925 = =
26926 b
26927 !!wikitext/edited
26928 a
26929 = =
26930 b
26931 !!end
26932
26933 !! test
26934 1. Multiple normalizations (html2wt)
26935 !! options
26936 parsoid={
26937 "modes": ["html2wt"],
26938 "scrubWikitext": true
26939 }
26940 !! html
26941 <h2><i></i></h2>
26942 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26943 </a><b><i></i></b>x</p>
26944 !! wikitext
26945
26946 [[foo]]
26947 x
26948
26949 !! end
26950
26951 !! test
26952 2. Multiple normalizations (selser)
26953 !! options
26954 parsoid={
26955 "modes": ["selser"],
26956 "scrubWikitext": true,
26957 "changes": [
26958 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26959 ]
26960 }
26961 !! wikitext
26962 <span id="x">foo</span>
26963 !! wikitext/edited
26964 <span id="x">foo</span>
26965
26966 x
26967 !! end
26968
26969 !! test
26970 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26971 !! options
26972 parsoid={
26973 "modes": ["html2wt"],
26974 "scrubWikitext": true
26975 }
26976 !! html/parsoid
26977 <p> hi</p>
26978 <p> hello</p>
26979 !! wikitext
26980 hi
26981
26982 hello
26983 !! end
26984
26985 !! test
26986 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26987 !! options
26988 parsoid=html2wt
26989 !! html/parsoid
26990 <p> hi</p>
26991 <p> hello</p>
26992 !! wikitext
26993 <nowiki> </nowiki>hi
26994
26995 <nowiki> </nowiki> hello
26996 !! end
26997
26998 !! test
26999 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27000 !! options
27001 parsoid={
27002 "modes": ["html2wt"],
27003 "scrubWikitext": true
27004 }
27005 !! html/parsoid
27006 <p>Foo
27007 bar
27008 baz</p>
27009
27010 <table><tr><td>Foo
27011 bar
27012 baz bang</td></tr></table>
27013
27014 <p><!--boo--> foo
27015 bar</p>
27016
27017 <p> foo
27018 bar<span>boo</span></p>
27019 !! wikitext
27020 Foo
27021 bar
27022 baz
27023
27024 {|
27025 |Foo
27026 bar
27027 baz bang
27028 |}
27029
27030 <!--boo-->foo
27031 bar
27032
27033 foo
27034 bar<span>boo</span>
27035 !! end
27036
27037 !! test
27038 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27039 !! options
27040 parsoid={
27041 "modes": ["selser"],
27042 "scrubWikitext": true,
27043 "changes": [
27044 [ "p", "html", " a\n b" ]
27045 ]
27046 }
27047 !! wikitext
27048 xyz
27049 !! wikitext/edited
27050 a
27051 b
27052 !! end
27053
27054 !! test
27055 1. New links that end in spaces
27056 !! options
27057 parsoid={
27058 "modes": ["html2wt"],
27059 "scrubWikitext": false
27060 }
27061 !! html/parsoid
27062 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27063 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27064 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27065 !! wikitext
27066 [[Berlin ]]<nowiki/>is the capital of Germany.
27067
27068 [[Foo ]]'''bar'''
27069
27070 [[Boston ]] is a city.
27071 !! end
27072
27073 !! test
27074 2. New links that end in spaces
27075 !! options
27076 parsoid={
27077 "modes": ["html2wt"],
27078 "scrubWikitext": true
27079 }
27080 !! html/parsoid
27081 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27082 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27083 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27084 !! wikitext
27085 [[Berlin]] is the capital of Germany.
27086
27087 [[Foo]] '''bar'''
27088
27089 [[Boston]] is a city.
27090 !! end
27091
27092 !! test
27093 1. Table cells with escapable prefixes
27094 !! options
27095 parsoid={
27096 "modes": ["html2wt"],
27097 "scrubWikitext": false
27098 }
27099 !! html
27100 <table>
27101 <tr><td>a</td></tr>
27102 <tr><td>-</td></tr>
27103 <tr><td>+</td></tr>
27104 </table>
27105 !! wikitext
27106 {|
27107 |a
27108 |-
27109 |<nowiki>-</nowiki>
27110 |-
27111 |<nowiki>+</nowiki>
27112 |}
27113 !! end
27114
27115 !! test
27116 2. Table cells with escapable prefixes
27117 !! options
27118 parsoid={
27119 "modes": ["html2wt"],
27120 "scrubWikitext": true
27121 }
27122 !! html
27123 <table>
27124 <tr><td>a</td></tr>
27125 <tr><td>-</td></tr>
27126 <tr><td>+</td></tr>
27127 </table>
27128 !! wikitext
27129 {|
27130 |a
27131 |-
27132 | -
27133 |-
27134 | +
27135 |}
27136 !! end
27137
27138 !! test
27139 3a. Table cells with escapable prefixes after edits
27140 !! options
27141 parsoid={
27142 "modes": ["selser"],
27143 "scrubWikitext": true,
27144 "changes": [
27145 [ "table tbody tr:first-child td:first-child", "remove"]
27146 ]
27147 }
27148 !! wikitext
27149 {|
27150 |a||-
27151 |}
27152 !! wikitext/edited
27153 {|
27154 | -
27155 |}
27156 !! end
27157
27158 !! test
27159 3b. Table cells with escapable prefixes after edits
27160 !! options
27161 parsoid={
27162 "modes": ["selser"],
27163 "scrubWikitext": true,
27164 "changes": [
27165 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27166 [ "#x", "remove" ]
27167 ]
27168 }
27169 !! wikitext
27170 {|
27171 |pqr
27172 |<span id="x">foo</span>+
27173 |}
27174 !! wikitext/edited
27175 {|
27176 | -
27177 | +
27178 |}
27179 !! end
27180
27181 # FIXME: This test will fail because
27182 # normalization doesn't realize that the id attribute
27183 # will eliminate the escapable scenario
27184 !! test
27185 4a. Table cells without escapable prefixes after edits
27186 !! options
27187 parsoid={
27188 "modes": ["selser"],
27189 "scrubWikitext": true,
27190 "changes": [
27191 [ "#x", "html", "-" ]
27192 ]
27193 }
27194 !! wikitext
27195 {|
27196 | id="x" |abcd
27197 |}
27198 !! wikitext/edited
27199 {|
27200 | id="x" |-
27201 |}
27202 !! end
27203
27204 ## This tests normalizer's ability to discriminate between
27205 ## cells having identical content.
27206 !! test
27207 4b. Table cells without escapable prefixes after edits
27208 !! options
27209 parsoid={
27210 "modes": ["selser"],
27211 "scrubWikitext": true,
27212 "changes": [
27213 [ "td", "html", "-" ]
27214 ]
27215 }
27216 !! wikitext
27217 {|
27218 |a||b
27219 |}
27220 !! wikitext/edited
27221 {|
27222 | -||-
27223 |}
27224 !! end
27225
27226 ## This tests normalizer's ability to not be tripped by
27227 ## comments (and whitespace)
27228 !! test
27229 4c. Table cells without escapable prefixes after edits
27230 !! options
27231 parsoid={
27232 "modes": ["selser"],
27233 "scrubWikitext": true,
27234 "changes": [
27235 [ "table tbody tr td:first-child", "remove" ]
27236 ]
27237 }
27238 !! wikitext
27239 {|
27240 |-
27241 <!--foo--> |a||-
27242 |}
27243 !! wikitext/edited
27244 {|
27245 |-
27246 <!--foo--> | -
27247 |}
27248 !! end
27249
27250 ## This tests normalizer's ability to handle HTML cells
27251 !! test
27252 4d. Table cells without escapable prefixes after edits
27253 !! options
27254 parsoid={
27255 "modes": ["selser"],
27256 "scrubWikitext": true,
27257 "changes": [
27258 [ "td", "html", "-" ]
27259 ]
27260 }
27261 !! wikitext
27262 <table>
27263 <tr><td>a</td></tr>
27264 </table>
27265 !! wikitext/edited
27266 <table>
27267 <tr><td>-</td></tr>
27268 </table>
27269 !! end
27270
27271 ## T111151 Remove font elements without attributes
27272 !! test
27273 5a. font tags without attributes should be dropped in scrubWikitext mode
27274 !! options
27275 parsoid={
27276 "modes": ["html2wt"],
27277 "scrubWikitext": true
27278 }
27279 !! html
27280 <font>foo</font>
27281 <font><font>bar</font></font>
27282 <font class="x">boo</font>
27283 !! wikitext
27284 foo
27285 bar
27286 <font class="x">boo</font>
27287 !! end
27288
27289 !! test
27290 5b. font tags should not be dropped without scrubWikitext being enabled
27291 !! options
27292 parsoid={
27293 "modes": ["html2wt"],
27294 "scrubWikitext": false
27295 }
27296 !! html
27297 <font>foo</font>
27298 !! wikitext
27299 <font>foo</font>
27300 !! end
27301
27302 !! test
27303 Escape nowiki DOM elements
27304 !! options
27305 parsoid=html2wt
27306 !! html/parsoid
27307 <nowiki><i>foo</i></nowiki>
27308 !! wikitext
27309 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27310 !! end
27311
27312 # This is meant to be an interim fix while we go about figuring out
27313 # how to not introduce these trailing <nowiki/>s in the first place.
27314 !! test
27315 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27316 !! options
27317 parsoid=html2wt
27318 !! html/parsoid
27319 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27320 y</p>
27321 <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>
27322 <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>
27323 !! wikitext
27324 x
27325 y
27326
27327 {{echo|
27328 1 = <nowiki/>}}
27329
27330 {{echo|
27331 1 = <nowiki/>
27332 }}
27333 !! end
27334
27335 # ---------------------------------------------------
27336 # End of tests spec'ing wikitext serialization norms |
27337 # ---------------------------------------------------
27338
27339 # T104032
27340 !! test
27341 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27342 !! options
27343 parsoid=html2wt
27344 !! html/parsoid
27345 a<p>b</p>
27346 <b>c</b><p>d</p>
27347 <table><tr>
27348 <td>a<p>b</p></td>
27349 <td><b>c</b><p>d</p></td>
27350 </tr></table>
27351 !! wikitext
27352 a
27353
27354 b
27355
27356 '''c'''
27357
27358 d
27359 {|
27360 |a
27361 b
27362 |'''c'''
27363 d
27364 |}
27365 !! end
27366
27367 # -----------------------------------------------------------------
27368 # End of section for Parsoid-only html2wt tests for serialization
27369 # of new content
27370 # -----------------------------------------------------------------
27371
27372 # -----------------------------------------------------------------
27373 # The following section of tests are primarily to spec behavior of
27374 # the selective serializer. All these tests have manual selser
27375 # changes. The automated selser changes for all tests handle the
27376 # wide variation of changes, but these tests here capture specs
27377 # deterministically.
27378 # ----------------------------------------------------------------
27379
27380 ## T90517
27381 !! test
27382 Selser: New comments should not be lost
27383 !! options
27384 parsoid={
27385 "modes": ["selser"],
27386 "changes": [
27387 [ "#a", "after", "<!--c1-->" ],
27388 [ "#b", "before", "<!--c2-->" ]
27389 ]
27390 }
27391 !! wikitext
27392 <span id="a">a</span>
27393
27394 <span id="b">b</span>
27395 !! wikitext/edited
27396 <span id="a">a</span><!--c1-->
27397
27398 <!--c2--><span id="b">b</span>
27399 !! end
27400
27401 ## T89383
27402 !! test
27403 Selser: Check for validity of DSR before using it
27404 !! options
27405 parsoid={
27406 "modes": ["selser"],
27407 "changes": [
27408 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27409 ]
27410 }
27411 !! wikitext
27412 <span id="a">a</span>
27413 !! wikitext/edited
27414 {{DISPLAYTITLE:foo}}
27415 <span id="a">a</span>
27416 !! end
27417
27418 !! test
27419 1. DOMDiff: Changes to <ref> content should be looked up using id
27420 !! options
27421 parsoid={
27422 "modes": ["selser"],
27423 "changes": [
27424 ["#X", "after", "bar"],
27425 ["#Y", "after", "baz"]
27426 ]
27427 }
27428 !! wikitext
27429 X <ref><span id="X">foo</span></ref>
27430 Y <ref name="a" />
27431 <references>
27432 <ref name="a"><span id="Y">foo</span></ref>
27433 </references>
27434 !! wikitext/edited
27435 X <ref><span id="X">foo</span>bar</ref>
27436 Y <ref name="a" />
27437 <references>
27438 <ref name="a"><span id="Y">foo</span>baz</ref>
27439 </references>
27440 !! end
27441
27442 !! test
27443 2. DOMDiff: Changes to <ref> content should be looked up using id
27444 !! options
27445 parsoid={
27446 "modes": ["selser"],
27447 "changes": [
27448 ["#Z", "after", "bar"]
27449 ]
27450 }
27451 !! wikitext
27452 A <ref>foo bar for a</ref>
27453 B <ref group="X" name="b" />
27454
27455 <references />
27456
27457 <references group="X">
27458 <ref name="b"><span id="Z">foo</span></ref>
27459 </references>
27460 !! wikitext/edited
27461 A <ref>foo bar for a</ref>
27462 B <ref group="X" name="b" />
27463
27464 <references />
27465
27466 <references group="X">
27467 <ref name="b"><span id="Z">foo</span>bar</ref>
27468 </references>
27469 !! end
27470
27471 !! test
27472 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27473 !! options
27474 parsoid={
27475 "modes": ["selser"],
27476 "changes": [
27477 [ "div:first-child", "text", "bar" ]
27478 ]
27479 }
27480 !! wikitext
27481 <div style="{{1x|color:red;}}%">foo</div>
27482 !! wikitext/edited
27483 <div style="{{1x|color:red;}}%">bar</div>
27484 !! end
27485
27486 !! test
27487 Empty LI (T49673)
27488 !! wikitext
27489 * a
27490 *
27491 *
27492 * b
27493 !! html/php+tidy
27494 <ul>
27495 <li>a</li>
27496 <li class="mw-empty-elt"></li>
27497 <li class="mw-empty-elt"></li>
27498 <li>b</li>
27499 </ul>
27500 !! end
27501
27502 !! test
27503 Thumbnail output
27504 !! wikitext
27505 [[File:Thumb.png|thumb]]
27506 !! html/php+tidy
27507 <div class="thumb tright">
27508 <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>
27509 <div class="thumbcaption">
27510 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27511 </div>
27512 </div>
27513 </div>
27514 !! end
27515
27516 !! test
27517 unclosed internal link XSS (T137264)
27518 !! wikitext
27519 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27520 !! html/php
27521 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27522 </p>
27523 !! html/parsoid
27524 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
27525 !! end