Merge "Remove some ancient upgrade information from release notes"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from https://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 #
36 # You can also set the following parser properties via test options:
37 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
38 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
39 # wgEnableMagicLinks
40 #
41 # For testing purposes, temporary articles can created:
42 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
43 # where '/' denotes a newline.
44
45 # This is the standard article assumed to exist.
46 !! article
47 Main Page
48 !! text
49 blah blah
50 !! endarticle
51
52 !!article
53 Foo
54 !!text
55 FOO
56 !!endarticle
57
58 !!article
59 Template:Foo
60 !!text
61 FOO
62 !!endarticle
63
64 !! article
65 Template:Blank
66 !! text
67 !! endarticle
68
69 !! article
70 Template:pipe
71 !! text
72 |
73 !! endarticle
74
75 !! article
76 Template:=
77 !! text
78 <nowiki>=</nowiki>
79 !! endarticle
80
81 !!article
82 MediaWiki:bad image list
83 !!text
84 * [[File:Bad.jpg]] except [[Nasty page]]
85 !!endarticle
86
87 !! article
88 Template:inner list
89 !! text
90 * item 1
91 !! endarticle
92
93 !! article
94 Template:tbl-start
95 !! text
96 {|
97 !! endarticle
98
99 !! article
100 Template:tbl-end
101 !! text
102 |}
103 !! endarticle
104
105 !! article
106 Template:echo
107 !! text
108 {{{1}}}
109 !! endarticle
110
111 !! article
112 Template:echo_with_span
113 !! text
114 <span>{{{1}}}</span>
115 !! endarticle
116
117 !! article
118 Template:echo_with_div
119 !! text
120 <div>{{{1}}}</div>
121 !! endarticle
122
123 !! article
124 Template:blank_param
125 !! text
126 {{{1}}}
127 {{{}}}
128 !! endarticle
129
130 !! article
131 Template:table_attribs
132 !! text
133 <noinclude>
134 |</noinclude>style="color:red;"|Foo
135 !! endarticle
136
137 !! article
138 Template:table_attribs_2
139 !! text
140 <noinclude>
141 |</noinclude>style="color:red;"|Foo
142 |Bar||Baz
143 !! endarticle
144
145 !! article
146 Template:table_attribs_3
147 !! text
148 <noinclude>
149 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
150 !! endarticle
151
152 !! article
153 Template:table_attribs_4
154 !! text
155 | style="background-color:#DC241f;" width="10px" |
156 !! endarticle
157
158 !! article
159 Template:table_attribs_5
160 !! text
161 <noinclude>
162 |</noinclude>style="color:red;"||Bar
163 !! endarticle
164
165 !! article
166 Template:table_attribs_6
167 !! text
168 style="background: <nowiki>
169
170
171 red;</nowiki>" |
172 !! endarticle
173
174 !! article
175 Template:table_attribs_7
176 !! text
177 <noinclude>
178 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
179 !! endarticle
180
181 !! article
182 Template:table_header_cells
183 !! text
184 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
185 !! endarticle
186
187 !! article
188 Template:table_cells
189 !! text
190 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
191 !! endarticle
192
193 !! article
194 Template:PartialTable
195 !! text
196 {|
197 |-
198 !! endarticle
199
200 !! article
201 Template:image_attribs
202 !! text
203 <noinclude>
204 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
205 !! endarticle
206
207 ## See T48811 for details
208 !! article
209 Template:mixed_attr_content_template
210 !! text
211 style="color:red;" title="T48811"
212 |-
213 |foo
214 !! endarticle
215
216 !! article
217 Template:definition_list
218 !! text
219 one
220 ::two
221 !! endarticle
222
223 !! article
224 A?b
225 !! text
226 Weirdo titles!
227 !! endarticle
228
229 !!article
230 Template:Bullet
231 !!text
232 * Bar
233 !!endarticle
234
235 !!article
236 Template:OpenTable
237 !!text
238 {|
239 !!endarticle
240
241 !!article
242 Template:EmptyLITest
243 !!text
244 *a
245 *
246 *
247 *b
248 !!endarticle
249
250 !!article
251 Template:EmptyTRTest
252 !!text
253 {|
254 |-
255 |-
256 |foo
257 |-
258 |-
259 |bar
260 |}
261 !!endarticle
262
263 !!article
264 Template:EmptyTRWithHTMLAttrTest
265 !!text
266 <table>
267 <tr align="center"></tr>
268 <tr><td>foo</td></tr>
269 <tr align="center"></tr>
270 <tr><td>bar</td></tr>
271 </table>
272 !!endarticle
273
274 !! article
275 Template:CircularRef
276 !! text
277 <ref>{{CircularRef}}</ref>
278 !! endarticle
279
280 ###
281 ### Basic tests
282 ###
283 !! test
284 Blank input
285 !! wikitext
286 !! html
287 !! end
288
289 !! test
290 CircularRef
291 !! wikitext
292 {{CircularRef}}
293 <references />
294 !! html/parsoid
295 <p><span about="#mwt1" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"CircularRef","href":"./Template:CircularRef"},"params":{},"i":0}}]}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
296 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">Error: Expansion loop detected at <a data-parsoid='{"a":{"href":null},"sa":{"href":"Template:CircularRef"}}'>Template:CircularRef</a></span></li></ol>
297 !! end
298
299 !! test
300 Simple paragraph
301 !! wikitext
302 This is a simple paragraph.
303 !! html
304 <p>This is a simple paragraph.
305 </p>
306 !! end
307
308 !! test
309 Paragraphs with extra newline spacing
310 !! wikitext
311 foo
312
313 bar
314
315
316 baz
317
318
319
320 booz
321 !! html
322 <p>foo
323 </p><p>bar
324 </p><p><br />
325 baz
326 </p><p><br />
327 </p><p>booz
328 </p>
329 !! end
330
331 !! test
332 Paragraphs with newline spacing with comment lines in between
333 !! wikitext
334 ----
335 a
336 <!--foo-->
337 b
338 ----
339 a
340 <!--foo--><!--More than 1 comment, still stripped-->
341 b
342 ----
343 a
344 <!--foo--> <!----> <!-- bar -->
345 b
346 ----
347 a
348 <!--foo-->
349
350 b
351 ----
352 a
353
354 <!--foo-->
355 b
356 ----
357 a
358 <!--foo-->
359
360
361 b
362 ----
363 a
364
365
366 <!--foo-->
367 b
368 ----
369 !! html
370 <hr />
371 <p>a
372 b
373 </p>
374 <hr />
375 <p>a
376 b
377 </p>
378 <hr />
379 <p>a
380 b
381 </p>
382 <hr />
383 <p>a
384 </p><p>b
385 </p>
386 <hr />
387 <p>a
388 </p><p>b
389 </p>
390 <hr />
391 <p>a
392 </p><p><br />
393 b
394 </p>
395 <hr />
396 <p>a
397 </p><p><br />
398 b
399 </p>
400 <hr />
401
402 !! end
403
404 !! test
405 Paragraphs with newline spacing with non-empty white-space lines in between
406 !! wikitext
407 ----
408 a
409
410 b
411 ----
412 a
413
414
415 b
416 ----
417 !! html
418 <hr />
419 <p>a
420 </p><p>b
421 </p>
422 <hr />
423 <p>a
424 </p><p><br />
425 b
426 </p>
427 <hr />
428
429 !! end
430
431 !! test
432 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
433 !! wikitext
434 ----
435 a
436 <!--foo-->
437 b
438 ----
439 a
440 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
441 b
442 ----
443 a
444
445 <!--foo-->
446 <!--bar-->
447 b
448 ----
449 a
450
451 <!--foo-->
452 <!--bar-->
453
454 b
455 ----
456 !! html
457 <hr />
458 <p>a
459 b
460 </p>
461 <hr />
462 <p>a
463 b
464 </p>
465 <hr />
466 <p>a
467 </p><p>b
468 </p>
469 <hr />
470 <p>a
471 </p><p><br />
472 b
473 </p>
474 <hr />
475
476 !! end
477
478 !! test
479 Extra newlines: More paragraphs with indented comment
480 !! wikitext
481 a
482
483 <!--boo-->
484
485 b
486 !! html
487 <p>a
488 </p><p><br />
489 b
490 </p>
491 !!end
492
493 !! test
494 Extra newlines followed by heading
495 !! wikitext
496 a
497
498
499
500 =b=
501 [[a]]
502
503
504 =b=
505 !! html
506 <p>a
507 </p><p><br />
508 </p>
509 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
510 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
511 </p><p><br />
512 </p>
513 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
514
515 !! end
516
517 !! test
518 Extra newlines between heading and content are swallowed
519 !! wikitext
520 =b=
521
522
523
524 [[a]]
525 !! html
526 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
527 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
528 </p>
529 !! end
530
531 !! test
532 Heading with line break in nowiki
533 !! options
534 parsoid=wt2html
535 !! wikitext
536 == A <nowiki>B
537 C</nowiki> ==
538 !! html
539 <h2><span class="mw-headline" id="A_B.0AC">A B
540 C</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A B&#10;C">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
541
542 !! html/parsoid
543 <h2 id="A_B.0AC">A <span typeof="mw:Nowiki">B
544 C</span> </h2>
545 !! end
546
547 !! test
548 Parsing an URL
549 !! wikitext
550 http://fr.wikipedia.org/wiki/🍺
551 <!-- EasterEgg we love beer, better be able be able to link to it -->
552 !! html
553 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
554 </p>
555 !! end
556
557 # Note that the html+tidy output removes the spaces after the <li>,
558 # which is a bug (https://sourceforge.net/p/tidy/bugs/945/, etc).
559 # This is an issue for all tests with lists. We intentionally do
560 # *not* add html+tidy clauses for these, as we don't want to
561 # document/test the broken behavior. (Parsoid matches the non-tidy
562 # output in these cases.)
563
564 !! test
565 Simple list
566 !! wikitext
567 * Item 1
568 * Item 2
569 !! html
570 <ul><li> Item 1</li>
571 <li> Item 2</li></ul>
572
573 !! end
574
575 !! test
576 Italics and bold
577 !! wikitext
578 * plain
579 * plain''italic''plain
580 * plain''italic''plain''italic''plain
581 * plain'''bold'''plain
582 * plain'''bold'''plain'''bold'''plain
583 * plain''italic''plain'''bold'''plain
584 * plain'''bold'''plain''italic''plain
585 * plain''italic'''bold-italic'''italic''plain
586 * plain'''bold''bold-italic''bold'''plain
587 * plain'''''bold-italic'''italic''plain
588 * plain'''''bold-italic''bold'''plain
589 * plain''italic'''bold-italic'''''plain
590 * plain'''bold''bold-italic'''''plain
591 * plain l'''italic''plain
592 * plain l''''bold''' plain
593 !! html
594 <ul><li> plain</li>
595 <li> plain<i>italic</i>plain</li>
596 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
597 <li> plain<b>bold</b>plain</li>
598 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
599 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
600 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
601 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
602 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
603 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
604 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
605 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
606 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
607 <li> plain l'<i>italic</i>plain</li>
608 <li> plain l'<b>bold</b> plain</li></ul>
609
610 !! end
611
612 # this example taken from the [[simple:Moon]] article (T49326)
613 !! test
614 Italics and possessives (1)
615 !! wikitext
616 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
617 !! html
618 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
619 </p>
620 !! end
621
622 # this example taken from [[en:Flaming Pie]] (T51926)
623 !! test
624 Italics and possessives (2)
625 !! wikitext
626 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
627 !! html
628 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
629 </p>
630 !! end
631
632 # this example taken from [[en:Dictionary]] (T51926)
633 !! test
634 Italics and possessives (3)
635 !! wikitext
636 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
637 !! html
638 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
639 </p>
640 !! end
641
642
643 ###
644 ### 2-quote opening sequence tests
645 ###
646 !! test
647 Italics and bold: 2-quote opening sequence: (2,2)
648 !! wikitext
649 ''foo''
650 !! html
651 <p><i>foo</i>
652 </p>
653 !!end
654
655 !! test
656 Italics and bold: 2-quote opening sequence: (2,3)
657 !! wikitext
658 ''foo'''
659 !! html/*
660 <p><i>foo'</i>
661 </p>
662 !!end
663
664 !! test
665 Italics and bold: 2-quote opening sequence: (2,4)
666 !! options
667 parsoid=wt2html
668 !! wikitext
669 ''foo''''
670 !! html/*
671 <p><i>foo''</i>
672 </p>
673 !!end
674
675 # same html as previous, but wikitext adjusted to match parsoid html2wt
676 !! test
677 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
678 !! wikitext
679 ''foo<nowiki>''</nowiki>''
680 !! html
681 <p><i>foo''</i>
682 </p>
683 !! end
684
685 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
686 !! test
687 Italics and bold: 2-quote opening sequence: (2,5)
688 !! options
689 parsoid=wt2html
690 !! wikitext
691 ''foo'''''
692 !! html/php
693 <p><i>foo</i>
694 </p>
695 !! html/parsoid
696 <p><i>foo</i><b></b>
697 </p>
698 !!end
699
700 # same html as previous, but wikitext adjusted to match parsoid html2wt
701 !! test
702 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
703 !! wikitext
704 ''foo'''''<nowiki/>'''
705 !! html/php
706 <p><i>foo</i>
707 </p>
708 !! html/parsoid
709 <p><i>foo</i><b></b>
710 </p>
711 !! end
712
713
714 ###
715 ### 3-quote opening sequence tests
716 ###
717
718 !! test
719 Italics and bold: 3-quote opening sequence: (3,2)
720 !! wikitext
721 '''foo''
722 !! html/*
723 <p>'<i>foo</i>
724 </p>
725 !!end
726
727 !! test
728 Italics and bold: 3-quote opening sequence: (3,3)
729 !! wikitext
730 '''foo'''
731 !! html
732 <p><b>foo</b>
733 </p>
734 !!end
735
736 !! test
737 Italics and bold: 3-quote opening sequence: (3,4)
738 !! wikitext
739 '''foo''''
740 !! html/*
741 <p><b>foo'</b>
742 </p>
743 !!end
744
745 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
746 !! test
747 Italics and bold: 3-quote opening sequence: (3,5)
748 !! options
749 parsoid=wt2html
750 !! wikitext
751 '''foo'''''
752 !! html/php
753 <p><b>foo</b>
754 </p>
755 !! html/parsoid
756 <p><b>foo</b><i></i>
757 </p>
758 !!end
759
760 # same html as previous, but wikitext adjusted to match parsoid html2wt
761 !! test
762 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
763 !! wikitext
764 '''foo'''''<nowiki/>''
765 !! html/php
766 <p><b>foo</b>
767 </p>
768 !! html/parsoid
769 <p><b>foo</b><i></i>
770 </p>
771 !! end
772
773
774 ###
775 ### 4-quote opening sequence tests
776 ###
777
778 !! test
779 Italics and bold: 4-quote opening sequence: (4,2)
780 !! options
781 parsoid=wt2html
782 !! wikitext
783 ''''foo''
784 !! html/*
785 <p>''<i>foo</i>
786 </p>
787 !!end
788
789 # same html as previous, but wikitext adjusted to match parsoid html2wt
790 !! test
791 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
792 !! wikitext
793 <nowiki>''</nowiki>''foo''
794 !! html
795 <p>''<i>foo</i>
796 </p>
797 !! end
798
799 !! test
800 Italics and bold: 4-quote opening sequence: (4,3)
801 !! wikitext
802 ''''foo'''
803 !! html/*
804 <p>'<b>foo</b>
805 </p>
806 !!end
807
808 !! test
809 Italics and bold: 4-quote opening sequence: (4,4)
810 !! options
811 parsoid=wt2html
812 !! wikitext
813 ''''foo''''
814 !! html/*
815 <p>'<b>foo'</b>
816 </p>
817 !!end
818
819 # same html as previous, but wikitext adjusted to match parsoid html2wt
820 !! test
821 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
822 !! wikitext
823 '<nowiki/>'''foo''''
824 !! html
825 <p>'<b>foo'</b>
826 </p>
827 !! end
828
829 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
830 !! test
831 Italics and bold: 4-quote opening sequence: (4,5)
832 !! options
833 parsoid=wt2html
834 !! wikitext
835 ''''foo'''''
836 !! html/php
837 <p>'<b>foo</b>
838 </p>
839 !! html/parsoid
840 <p>'<b>foo</b><i></i>
841 </p>
842 !!end
843
844 # same html as previous, but wikitext adjusted to match parsoid html2wt
845 !! test
846 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
847 !! wikitext
848 '<nowiki/>'''foo'''''<nowiki/>''
849 !! html/php
850 <p>'<b>foo</b>
851 </p>
852 !! html/parsoid
853 <p>'<b>foo</b><i></i>
854 </p>
855 !! end
856
857
858 ###
859 ### 5-quote opening sequence tests
860 ###
861
862 !! test
863 Italics and bold: 5-quote opening sequence: (5,2)
864 !! options
865 parsoid=wt2html
866 !! wikitext
867 '''''foo''
868 !! html/*
869 <p><b><i>foo</i></b>
870 </p>
871 !!end
872
873 # same html as previous, but wikitext adjusted to match parsoid html2wt
874 !! test
875 Italics and bold: 5-quote opening sequence: (5,2+3)
876 !! wikitext
877 '''''foo'''''
878 !! html/*
879 <p><i><b>foo</b></i>
880 </p>
881 !! end
882
883 !! test
884 Italics and bold: 5-quote opening sequence: (5,3)
885 !! options
886 parsoid=wt2html
887 !! wikitext
888 '''''foo'''
889 !! html/*
890 <p><i><b>foo</b></i>
891 </p>
892 !!end
893
894 # same html as previous, but wikitext adjusted to match parsoid html2wt
895 !! test
896 Italics and bold: 5-quote opening sequence: (5,3+2)
897 !! wikitext
898 '''''foo'''''
899 !! html
900 <p><i><b>foo</b></i>
901 </p>
902 !! end
903
904 !! test
905 Italics and bold: 5-quote opening sequence: (5,4)
906 !! options
907 parsoid=wt2html
908 !! wikitext
909 '''''foo''''
910 !! html/*
911 <p><i><b>foo'</b></i>
912 </p>
913 !!end
914
915 !! test
916 Italics and bold: 5-quote opening sequence: (5,5)
917 !! wikitext
918 '''''foo'''''
919 !! html
920 <p><i><b>foo</b></i>
921 </p>
922 !!end
923
924 !! test
925 Italics and bold: 5-quote opening sequence: (5,6)
926 !! wikitext
927 '''''foo''''''
928 !! html/*
929 <p><i><b>foo'</b></i>
930 </p>
931 !! end
932
933 ###
934 ### multiple quote sequences in a line
935 ###
936
937 !! test
938 Italics and bold: multiple quote sequences: (2,4,2)
939 !! options
940 parsoid=wt2html
941 !! wikitext
942 ''foo''''bar''
943 !! html/*
944 <p><i>foo'<b>bar</b></i>
945 </p>
946 !! end
947
948 # same html as previous, but wikitext adjusted to match parsoid html2wt
949 !! test
950 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
951 !! wikitext
952 ''foo'<nowiki/>'''bar'''''
953 !! html
954 <p><i>foo'<b>bar</b></i>
955 </p>
956 !! end
957
958 !! test
959 Italics and bold: multiple quote sequences: (2,4,3)
960 !! options
961 parsoid=wt2html
962 !! wikitext
963 ''foo''''bar'''
964 !! html/*
965 <p><i>foo'<b>bar</b></i>
966 </p>
967 !! end
968
969 # same html as previous, but wikitext adjusted to match parsoid html2wt
970 !! test
971 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
972 !! wikitext
973 ''foo'<nowiki/>'''bar'''''
974 !! html
975 <p><i>foo'<b>bar</b></i>
976 </p>
977 !! end
978
979 !! test
980 Italics and bold: multiple quote sequences: (2,4,4)
981 !! options
982 parsoid=wt2html
983 !! wikitext
984 ''foo''''bar''''
985 !! html/*
986 <p><i>foo'<b>bar'</b></i>
987 </p>
988 !! end
989
990 # same html as previous, but wikitext adjusted to match parsoid html2wt
991 !! test
992 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
993 !! wikitext
994 ''foo'<nowiki/>'''bar'<nowiki/>'''''
995 !! html
996 <p><i>foo'<b>bar'</b></i>
997 </p>
998 !! end
999
1000 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1001 !! test
1002 Italics and bold: multiple quote sequences: (3,4,2)
1003 !! options
1004 parsoid=wt2html
1005 !! wikitext
1006 '''foo''''bar''
1007 !! html/php
1008 <p><b>foo'</b>bar
1009 </p>
1010 !! html/parsoid
1011 <p><b>foo'</b>bar<i></i>
1012 </p>
1013 !! end
1014
1015 # same html as previous, but wikitext adjusted to match parsoid html2wt
1016 !! test
1017 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1018 !! wikitext
1019 '''foo''''bar''<nowiki/>''
1020 !! html/php
1021 <p><b>foo'</b>bar
1022 </p>
1023 !! html/parsoid
1024 <p><b>foo'</b>bar<i></i>
1025 </p>
1026 !! end
1027
1028 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1029 !! test
1030 Italics and bold: multiple quote sequences: (3,4,3)
1031 !! options
1032 parsoid=wt2html
1033 !! wikitext
1034 '''foo''''bar'''
1035 !! html/php
1036 <p><b>foo'</b>bar
1037 </p>
1038 !! html/parsoid
1039 <p><b>foo'</b>bar<b></b>
1040 </p>
1041 !! end
1042
1043 # same html as previous, but wikitext adjusted to match parsoid html2wt
1044 !! test
1045 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1046 !! wikitext
1047 '''foo''''bar'''<nowiki/>'''
1048 !! html/php
1049 <p><b>foo'</b>bar
1050 </p>
1051 !! html/parsoid
1052 <p><b>foo'</b>bar<b></b>
1053 </p>
1054 !! end
1055
1056 ###
1057 ### other quote tests
1058 ###
1059 !! test
1060 Italics and bold: other quote tests: (2,3,5)
1061 !! wikitext
1062 ''this is about '''foo's family'''''
1063 !! html
1064 <p><i>this is about <b>foo's family</b></i>
1065 </p>
1066 !!end
1067
1068
1069 !! test
1070 Italics and bold: other quote tests: (2,(3,3),2)
1071 !! wikitext
1072 ''this is about '''foo's''' family''
1073 !! html
1074 <p><i>this is about <b>foo's</b> family</i>
1075 </p>
1076 !!end
1077
1078
1079 !! test
1080 Italics and bold: other quote tests: (3,2,3,2)
1081 !! options
1082 parsoid=wt2html
1083 !! wikitext
1084 '''this is about ''foo'''s family''
1085 !! html/*
1086 <p><b>this is about <i>foo</i></b><i>s family</i>
1087 </p>
1088 !!end
1089
1090
1091 # same html as previous, but wikitext adjusted to match parsoid html2wt
1092 !! test
1093 Italics and bold: other quote tests: (3,2,3+2+2,2)
1094 !! wikitext
1095 '''this is about ''foo'''''<nowiki/>''s family''
1096 !! html
1097 <p><b>this is about <i>foo</i></b><i>s family</i>
1098 </p>
1099 !! end
1100
1101
1102 !! test
1103 Italics and bold: other quote tests: (3,2,3,3)
1104 !! wikitext
1105 '''this is about ''foo'''s family'''
1106 !! html/*
1107 <p>'<i>this is about </i>foo<b>s family</b>
1108 </p>
1109 !!end
1110
1111
1112 !! test
1113 Italics and bold: other quote tests: (3,(2,2),3)
1114 !! wikitext
1115 '''this is about ''foo's'' family'''
1116 !! html
1117 <p><b>this is about <i>foo's</i> family</b>
1118 </p>
1119 !!end
1120
1121
1122 !! test
1123 Italicized possessive
1124 !! wikitext
1125 The ''[[Main Page]]'''s talk page.
1126 !! html/php
1127 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1128 </p>
1129 !! html/parsoid
1130 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1131 !! end
1132
1133 !! test
1134 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1135 (Requires tidy for PHP parser output to be fixed up)
1136 !! options
1137 parsoid=wt2html,wt2wt
1138 !! wikitext
1139 {|
1140 !''a!!''b
1141 |''a||''b
1142 |}
1143 !! html/php+tidy
1144 <table>
1145 <tr>
1146 <th><i>a</i></th>
1147 <th><i>b</i></th>
1148 <td><i>a</i></td>
1149 <td><i>b</i></td>
1150 </tr>
1151 </table>
1152 !! html/parsoid
1153 <table>
1154 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1155 <td><i>a</i></td><td><i>b</i></td></tr>
1156 </tbody></table>
1157 !! end
1158
1159 ###
1160 ### Non-html5 tags
1161 ###
1162
1163 !! test
1164 Non-html5 tags should be accepted
1165 !! wikitext
1166 <center>''foo''</center>
1167 <big>''foo''</big>
1168 <font>''foo''</font>
1169 <strike>''foo''</strike>
1170 <tt>''foo''</tt>
1171 !! html
1172 <center><i>foo</i></center>
1173 <p><big><i>foo</i></big>
1174 <font><i>foo</i></font>
1175 <strike><i>foo</i></strike>
1176 <tt><i>foo</i></tt>
1177 </p>
1178 !! end
1179
1180 !! test
1181 <wbr> is valid wikitext (T54468)
1182 !! wikitext
1183 <wbr>
1184 !! html
1185 <p><wbr />
1186 </p>
1187 !! end
1188
1189 # <strike> is HTML4, <s> is HTML4/5.
1190 !! test
1191 <s> or <strike> for strikethrough
1192 !! wikitext
1193 <strike>strike</strike>
1194
1195 <s>s</s>
1196 !! html
1197 <p><strike>strike</strike>
1198 </p><p><s>s</s>
1199 </p>
1200 !! end
1201
1202 ## a not permitted
1203 ## i,b,br omitted
1204 !! test
1205 Text-level semantic html elements in wikitext
1206 !! wikitext
1207 <em>text</em>
1208 <strong>text</strong>
1209 <small>text</small>
1210 <s>text</s>
1211 <cite>text</cite>
1212 <q>text</q>
1213 <dfn>text</dfn>
1214 <abbr>text</abbr>
1215 <data>text</data>
1216 <time>text</time>
1217 <code>text</code>
1218 <var>text</var>
1219 <samp>text</samp>
1220 <kbd>text</kbd>
1221 <sub>text</sub>
1222 <u>text</u>
1223 <mark>text</mark>
1224 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1225 <bdi>text</bdi>
1226 <bdo>text</bdo>
1227 <span>text</span>
1228 <wbr />
1229 !! html
1230 <p><em>text</em>
1231 <strong>text</strong>
1232 <small>text</small>
1233 <s>text</s>
1234 <cite>text</cite>
1235 <q>text</q>
1236 <dfn>text</dfn>
1237 <abbr>text</abbr>
1238 <data>text</data>
1239 <time>text</time>
1240 <code>text</code>
1241 <var>text</var>
1242 <samp>text</samp>
1243 <kbd>text</kbd>
1244 <sub>text</sub>
1245 <u>text</u>
1246 <mark>text</mark>
1247 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1248 <bdi>text</bdi>
1249 <bdo>text</bdo>
1250 <span>text</span>
1251 <wbr />
1252 </p>
1253 !! end
1254
1255 # test cases taken from
1256 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1257 !! test
1258 Ruby markup (W3C-style)
1259 !! wikitext
1260 ; Mono-ruby for individual base characters
1261 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1262 ; Group ruby
1263 : <ruby>今日<rt>きょう</rt></ruby>
1264 ; Jukugo ruby
1265 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1266 ; Inline ruby
1267 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1268 ; Double-sided ruby
1269 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1270 <ruby>
1271 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1272 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1273 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1274 </ruby>
1275 !! html
1276 <dl><dt> Mono-ruby for individual base characters</dt>
1277 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1278 <dt> Group ruby</dt>
1279 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1280 <dt> Jukugo ruby</dt>
1281 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1282 <dt> Inline ruby</dt>
1283 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1284 <dt> Double-sided ruby</dt>
1285 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1286 <p><ruby>
1287 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1288 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1289 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1290 </ruby>
1291 </p>
1292 !! end
1293
1294 # The next two test different paths in the sanitizer.
1295 !! test
1296 Non-word characters don't terminate tag names (T19663, T42670, T54022)
1297 !! wikitext
1298 <blockquote|>a</blockquote>
1299
1300 <b→> doesn't terminate </b→>
1301
1302 <bä> doesn't terminate </bä>
1303
1304 <boo> doesn't terminate </boo>
1305
1306 <s.foo> doesn't terminate </s.foo>
1307
1308 <sub-ID#1>
1309 !! html
1310 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1311 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1312 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1313 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1314 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1315 </p><p>&lt;sub-ID#1&gt;
1316 </p>
1317 !! end
1318
1319 # There is a tidy bug here: https://sourceforge.net/p/tidy/bugs/946/
1320 # If the non-word-character tag made it through the sanitizer, tidy
1321 # would munge it up.
1322 !! test
1323 Non-word characters don't terminate tag names + tidy
1324 !! wikitext
1325 <blockquote|>a</blockquote>
1326
1327 <b→> doesn't terminate </b→>
1328
1329 <bä> doesn't terminate </bä>
1330
1331 <boo> doesn't terminate </boo>
1332
1333 <s.foo> doesn't terminate </s.foo>
1334
1335 <sub-ID#1>
1336 !! html+tidy
1337 <p>&lt;blockquote|&gt;a</p>
1338 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1339 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1340 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1341 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1342 <p>&lt;sub-ID#1&gt;</p>
1343 !! end
1344
1345 ###
1346 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1347 ### This checks that HTML5 tags (with non-word characters in the tag
1348 ### name) make it safely through the parser -- the Sanitizer will
1349 ### munge them later, as it should.
1350 ###
1351 !! test
1352 Non-word characters are valid in extension tags (T19663)
1353 !! wikitext
1354 <tåg>tåg</tåg>
1355 !! html/php
1356 <pre>
1357 'tåg'
1358 array (
1359 )
1360 </pre>
1361
1362 !! html/parsoid
1363 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1364 !! end
1365
1366 !! test
1367 Isolated close tags should be treated as literal text (T54760)
1368 !! options
1369 parsoid=wt2html
1370 !! wikitext
1371 </b>
1372
1373 <s.foo>s</s>
1374 !! html/php+tidy
1375 <p>&lt;s.foo&gt;s</p>
1376 !! html/parsoid
1377 <p>&lt;s.foo&gt;s</p>
1378 !! end
1379
1380 ###
1381 ### Special characters
1382 ###
1383
1384 !! test
1385 Bare pipe character (T54363)
1386 !! wikitext
1387 |
1388 !! html
1389 <p>|
1390 </p>
1391 !! end
1392
1393 !! test
1394 Bare pipe character from a template (T54363)
1395 !! wikitext
1396 {{pipe}}
1397 !! html
1398 <p>|
1399 </p>
1400 !! end
1401
1402 ###
1403 ### <nowiki> test cases
1404 ###
1405
1406 !! test
1407 <nowiki> unordered list
1408 !! wikitext
1409 <nowiki>* This is not an unordered list item.</nowiki>
1410 !! html/php
1411 <p>* This is not an unordered list item.
1412 </p>
1413 !! html/parsoid
1414 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1415 !! end
1416
1417 !! test
1418 <nowiki> spacing
1419 !! wikitext
1420 <nowiki>Lorem ipsum dolor
1421
1422 sed abit.
1423 sed nullum.
1424
1425 :and a colon
1426 </nowiki>
1427 !! html/php
1428 <p>Lorem ipsum dolor
1429
1430 sed abit.
1431 sed nullum.
1432
1433 :and a colon
1434
1435 </p>
1436 !! html/parsoid
1437 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1438
1439 sed abit.
1440 sed nullum.
1441
1442 :and a colon
1443 </span></p>
1444 !! end
1445
1446 !! test
1447 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1448 !! wikitext
1449 <nowiki><span class="error"></nowiki>
1450 !! html/php
1451 <p>&lt;span class="error"&gt;
1452 </p>
1453 !! html/parsoid
1454 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1455 !! end
1456
1457 !! test
1458 nowiki 3
1459 !! wikitext
1460 :There is not nowiki.
1461 :There is <nowiki>nowiki</nowiki>.
1462
1463 #There is not nowiki.
1464 #There is <nowiki>nowiki</nowiki>.
1465
1466 *There is not nowiki.
1467 *There is <nowiki>nowiki</nowiki>.
1468 !! html/php
1469 <dl><dd>There is not nowiki.</dd>
1470 <dd>There is nowiki.</dd></dl>
1471 <ol><li>There is not nowiki.</li>
1472 <li>There is nowiki.</li></ol>
1473 <ul><li>There is not nowiki.</li>
1474 <li>There is nowiki.</li></ul>
1475
1476 !! html/parsoid
1477 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1478 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1479
1480 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1481 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1482
1483 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1484 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1485 !! end
1486
1487 !! test
1488 Entities inside <nowiki>
1489 !! wikitext
1490 <nowiki>&lt;</nowiki>
1491 !! html/php
1492 <p>&lt;
1493 </p>
1494 !! html/parsoid
1495 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
1496 !! end
1497
1498 !! test
1499 Entities inside template parameters
1500 !! wikitext
1501 {{echo|&ndash;}}
1502 !! html/php+tidy
1503 <p>–</p>
1504 !! html/parsoid
1505 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1506 !! end
1507
1508 !! test
1509 Properly escape nowiki when combined with other wiki markup
1510 !! options
1511 parsoid=html2wt
1512 !! html/parsoid
1513 <p>* &lt;/nowiki&gt; tag</p>
1514 !! wikitext
1515 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1516 !! end
1517
1518 !! test
1519 T93824: Put escaped HTML tags inside nowiki
1520 !! options
1521 parsoid=html2wt
1522 !! html/parsoid
1523 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1524 !! wikitext
1525 <nowiki><h2>foo</h2></nowiki>
1526 !! end
1527
1528 !! test
1529 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1530 !! options
1531 parsoid=html2wt
1532 !! html/parsoid
1533 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1534 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1535 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1536 !! wikitext
1537 This text: L'[[Foo]]
1538 This text: L<nowiki>''</nowiki>[[Foo]]
1539 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1540 !! end
1541
1542 # This test fails because wikitext whitespace is not normalized before comparing.
1543 !! test
1544 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1545 !! options
1546 parsoid=html2wt
1547 !! html/parsoid
1548 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1549 </p>
1550 !! wikitext
1551 This text : L<nowiki>''</nowiki>[[Foo]]
1552 !! end
1553
1554 # This test and the next one are html2wt only as they test that incorrect wikitext
1555 # passed in template arguments gets escaped or wrapped in nowikis where required.
1556 !! test
1557 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1558 !! options
1559 parsoid=html2wt
1560 !! html/parsoid
1561 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1562 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1563 !! wikitext
1564 {{echo|foo{{!}}bar}}
1565 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1566 !! end
1567
1568 !! test
1569 T53961: Output correct nowikis in template arguments
1570 !! options
1571 parsoid=html2wt
1572 !! html/parsoid
1573 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1574 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1575 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1576 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1577 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1578 !! wikitext
1579 {{echo|a [ b}}
1580 {{echo|<nowiki>a }} b</nowiki>}}
1581 {{echo|<nowiki>a [[ b</nowiki>}}
1582 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1583 {{echo|a <nowiki>}</nowiki>}}
1584 !! end
1585
1586 !! test
1587 Cases where "!!" needs nowiki protection
1588 !! options
1589 parsoid=html2wt
1590 !! html/parsoid
1591 <table>
1592 <tr><th>this needs protection !! here</th></tr>
1593 </table>
1594
1595 <table>
1596 <tr><th>this does not need
1597 protection !! here</th></tr>
1598 </table>
1599 !! wikitext
1600 {|
1601 !<nowiki>this needs protection !! here</nowiki>
1602 |}
1603
1604 {|
1605 !this does not need
1606 protection !! here
1607 |}
1608 !! end
1609
1610 ###
1611 ### Comments
1612 ###
1613 !! test
1614 Comments and Indent-Pre
1615 !! wikitext
1616 <!-- comment 1 --> asdf
1617
1618 <!-- comment 1 --> asdf
1619 <!-- comment 2 -->
1620
1621 <!-- comment 1 --> asdf
1622 <!-- comment 2 -->xyz
1623
1624 <!-- comment 1 --> asdf
1625 <!-- comment 2 --> xyz
1626 !! html
1627 <pre>asdf
1628 </pre>
1629 <pre>asdf
1630 </pre>
1631 <pre>asdf
1632 </pre>
1633 <p>xyz
1634 </p>
1635 <pre>asdf
1636 xyz
1637 </pre>
1638 !! end
1639
1640 !! test
1641 Comment test 2a
1642 !! wikitext
1643 asdf
1644 <!-- comment 1 -->
1645 jkl
1646 !! html
1647 <p>asdf
1648 jkl
1649 </p>
1650 !! end
1651
1652 !! test
1653 Comment test 2b
1654 !! wikitext
1655 asdf
1656 <!-- comment 1 -->
1657
1658 jkl
1659 !! html
1660 <p>asdf
1661 </p><p>jkl
1662 </p>
1663 !! end
1664
1665 !! test
1666 Comment test 3
1667 !! wikitext
1668 asdf
1669 <!-- comment 1 -->
1670 <!-- comment 2 -->
1671 jkl
1672 !! html
1673 <p>asdf
1674 jkl
1675 </p>
1676 !! end
1677
1678 !! test
1679 Comment test 4
1680 !! wikitext
1681 asdf<!-- comment 1 -->jkl
1682 !! html
1683 <p>asdfjkl
1684 </p>
1685 !! end
1686
1687 !! test
1688 Comment spacing
1689 !! wikitext
1690 a
1691 <!-- foo --> b <!-- bar -->
1692 c
1693 !! html
1694 <p>a
1695 </p>
1696 <pre> b
1697 </pre>
1698 <p>c
1699 </p>
1700 !! end
1701
1702 !! test
1703 Comment whitespace
1704 !! wikitext
1705 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1706 !! html
1707
1708 !! end
1709
1710 !! test
1711 Comment semantics and delimiters
1712 !! wikitext
1713 <!-- --><!----><!-----><!------>
1714 !! html/php
1715
1716 !! html/parsoid
1717 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1718 !! end
1719
1720 !! test
1721 Comment semantics and delimiters, redux
1722 !! wikitext
1723 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1724 -- foo -- funky huh? ... -->
1725 !! html/php
1726
1727 !! html/parsoid
1728 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1729 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1730 !! end
1731
1732 !! test
1733 Comment semantics and delimiters: directors cut
1734 !! wikitext
1735 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1736 everything starting with < followed by !-- until the first -- and > we see,
1737 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1738 -->-->
1739 !! html/php
1740 <p>--&gt;
1741 </p>
1742 !! html/parsoid
1743 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1744 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1745 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1746 --><p>--></p>
1747 !! end
1748
1749 !! test
1750 Comment semantics: nesting
1751 !! wikitext
1752 <!--<!-- no, we're not going to do anything fancy here -->-->
1753 !! html/php
1754 <p>--&gt;
1755 </p>
1756 !! html/parsoid
1757 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1758 !! end
1759
1760 # Parsoid closes the unclosed comment, even if it means a slight
1761 # round-trip diff.
1762 !! test
1763 Comment semantics: unclosed comment at end
1764 !! options
1765 parsoid=wt2html,html2html
1766 !! wikitext
1767 <!--This comment will run out to the end of the document
1768 !! html/php
1769
1770 !! html/parsoid
1771 <!--This comment will run out to the end of the document-->
1772 !! end
1773
1774 !! test
1775 Comment semantics: normalize comments to play nice with XML and browsers
1776 !! wikitext
1777 <!-- Browsers --!> think this is closed -->
1778 <!--> This would normally be text -->
1779 <!---> As would this -->
1780 <!-- XML doesn't like trailing dashes -------->
1781 <!-- Nor doubled hyphens -- anywhere in the data -->
1782 But this is not a comment.
1783 !! html/php
1784 <p>But this is not a comment.
1785 </p>
1786 !! html/parsoid
1787 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1788 <!--&#x3E; This would normally be text -->
1789 <!--&#x2D;&#x3E; As would this -->
1790 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1791 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1792 <p>But this is not a comment.</p>
1793 !! end
1794
1795 !! test
1796 Comment semantics: round-trip even text which contains encoded -->
1797 !! wikitext
1798 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1799 !! html/parsoid
1800 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1801 !! end
1802
1803 !! test
1804 Comment in template title
1805 !! wikitext
1806 {{f<!---->oo}}
1807 !! html
1808 <p>FOO
1809 </p>
1810 !! end
1811
1812 !! test
1813 Comment on its own line post-expand
1814 !! wikitext
1815 a
1816 {{blank}}<!---->
1817 b
1818 !! html
1819 <p>a
1820 </p><p>b
1821 </p>
1822 !! end
1823
1824 !! test
1825 Comment on its own line post-expand with non-significant whitespace
1826 !! wikitext
1827 a
1828 {{blank}} <!---->
1829 b
1830 !! html
1831 <p>a
1832 </p><p>b
1833 </p>
1834 !! end
1835
1836 !! test
1837 Multiple comments should still parse as SOL-transparent
1838 !! options
1839 parsoid=wt2html,wt2wt
1840 !! wikitext
1841 <!--c1-->*a
1842 <!--c2--><!--c3--><!--c4-->*b
1843 !! html/php
1844 <ul><li>a</li>
1845 <li>b</li></ul>
1846
1847 !! html/parsoid
1848 <!--c1--><ul>
1849 <li>a
1850 </li>
1851 <!--c2--><!--c3--><!--c4-->
1852 <li>b
1853 </li>
1854 </ul>
1855 !! end
1856
1857 ###
1858 ### paragraph wrapping tests
1859 ###
1860 !! test
1861 No block tags
1862 !! wikitext
1863 a
1864
1865 b
1866 !! html
1867 <p>a
1868 </p><p>b
1869 </p>
1870 !! end
1871
1872 !! test
1873 Block tag on one line (<div>)
1874 !! wikitext
1875 a <div>foo</div>
1876
1877 b
1878 !! html
1879 a <div>foo</div>
1880 <p>b
1881 </p>
1882 !! html+tidy
1883 <p>a</p>
1884 <div>foo</div>
1885 <p>b</p>
1886 !! end
1887
1888 !! test
1889 Block tag on one line (<blockquote>)
1890 !! wikitext
1891 a <blockquote>foo</blockquote>
1892
1893 b
1894 !! html
1895 a <blockquote>foo</blockquote>
1896 <p>b
1897 </p>
1898 !! html+tidy
1899 <p>a</p>
1900 <blockquote>
1901 <p>foo</p>
1902 </blockquote>
1903 <p>b</p>
1904 !! end
1905
1906 !! test
1907 Block tag on both lines (<div>)
1908 !! wikitext
1909 a <div>foo</div>
1910
1911 b <div>foo</div>
1912 !! html
1913 a <div>foo</div>
1914 b <div>foo</div>
1915
1916 !! html+tidy
1917 <p>a</p>
1918 <div>foo</div>
1919 <p>b</p>
1920 <div>foo</div>
1921 !! end
1922
1923 !! test
1924 Block tag on both lines (<blockquote>)
1925 !! wikitext
1926 a <blockquote>foo</blockquote>
1927
1928 b <blockquote>foo</blockquote>
1929 !! html
1930 a <blockquote>foo</blockquote>
1931 b <blockquote>foo</blockquote>
1932
1933 !! html+tidy
1934 <p>a</p>
1935 <blockquote>
1936 <p>foo</p>
1937 </blockquote>
1938 <p>b</p>
1939 <blockquote>
1940 <p>foo</p>
1941 </blockquote>
1942 !! end
1943
1944 !! test
1945 Multiple lines without block tags
1946 !! wikitext
1947 <div>foo</div> a
1948 b
1949 c
1950 d<!--foo--> e
1951 x <div>foo</div> z
1952 !! html
1953 <div>foo</div> a
1954 <p>b
1955 c
1956 d e
1957 </p>
1958 x <div>foo</div> z
1959
1960 !! html+tidy
1961 <div>foo</div>
1962 <p>a</p>
1963 <p>b c d e</p>
1964 <p>x</p>
1965 <div>foo</div>
1966 <p>z</p>
1967 !! end
1968
1969 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1970 # So, we have a separate section for Parsoid. We don't want
1971 # to mimic this stripping behavior in Parsoid. It affects
1972 # editing experience and also requires us to maintain additional
1973 # info for RT-ing.
1974 !! test
1975 Empty lines between lines with block tags
1976 !! wikitext
1977 <div></div>
1978
1979
1980 <div></div>a
1981
1982 b
1983 <div>a</div>b
1984
1985 <div>b</div>d
1986
1987
1988 <div>e</div>
1989 !! html
1990 <div></div>
1991 <p><br />
1992 </p>
1993 <div></div>a
1994 <p>b
1995 </p>
1996 <div>a</div>b
1997 <div>b</div>d
1998 <p><br />
1999 </p>
2000 <div>e</div>
2001
2002 !! html+tidy
2003 <p><br /></p>
2004 <p>a</p>
2005 <p>b</p>
2006 <div>a</div>
2007 <p>b</p>
2008 <div>b</div>
2009 <p>d</p>
2010 <p><br /></p>
2011 <div>e</div>
2012 !! html/parsoid
2013 <div data-parsoid='{"stx":"html"}'></div>
2014
2015 <p><br /></p>
2016 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2017
2018 <p>b</p>
2019 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2020
2021 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2022
2023 <p><br /></p>
2024 <div data-parsoid='{"stx":"html"}'>e</div>
2025 !! end
2026
2027 ## PHP parser emits output which is broken
2028 !! test
2029 Unclosed HTML p-tags should be handled properly
2030 !! wikitext
2031 <div><p>foo</div>
2032 a
2033
2034 b
2035 !! html/php+tidy
2036 <div>
2037 <p>foo</p>
2038 </div>
2039 <p>a</p>
2040 <p>b</p>
2041 !! html/parsoid
2042 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2043 <p>a</p>
2044 <p>b</p>
2045 !! end
2046
2047 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2048 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2049 ## them for now.
2050 !! test
2051 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2052 !! options
2053 parsoid=wt2html
2054 !! wikitext
2055 a [[Category:A1]] [[Category:A2]]
2056 [[Category:A3]]
2057 [[Category:A4]]
2058 !! html/parsoid
2059 <p>a</p>
2060 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2061 !! end
2062
2063 !! test
2064 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2065 !! options
2066 parsoid=wt2html
2067 !! wikitext
2068 [[Category:A1]]a
2069 !! html/parsoid
2070 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2071 !! end
2072
2073 ###
2074 ### Preformatted text
2075 ###
2076 !! test
2077 Preformatted text
2078 !! wikitext
2079 This is some
2080 Preformatted text
2081 With ''italic''
2082 And '''bold'''
2083 And a [[Main Page|link]]
2084 !! html
2085 <pre>This is some
2086 Preformatted text
2087 With <i>italic</i>
2088 And <b>bold</b>
2089 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2090 </pre>
2091 !! end
2092
2093 !! test
2094 Tabs don't trigger preformatted text
2095 !! wikitext
2096 This is not
2097 preformatted text.
2098 This is preformatted text.
2099 So is this.
2100 !! html/php
2101 <p> This is not
2102 preformatted text.
2103 </p>
2104 <pre>This is preformatted text.
2105 So is this.
2106 </pre>
2107 !! html/parsoid
2108 <p> This is not
2109 preformatted text.</p>
2110 <pre>This is preformatted text.
2111 So is this.</pre>
2112 !! end
2113
2114 !! test
2115 Space before tab needs nowiki pre protection
2116 !! options
2117 parsoid=html2wt
2118 !! html/parsoid
2119 <p> a</p>
2120 !! wikitext
2121 <nowiki> </nowiki> a
2122 !! end
2123
2124 !! test
2125 Ident preformatting with inline content
2126 !! wikitext
2127 a
2128 ''b''
2129 !! html
2130 <pre>a
2131 <i>b</i>
2132 </pre>
2133 !! end
2134
2135 !! test
2136 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2137 !! wikitext
2138 <pre><nowiki>
2139 <b>
2140 <cite>
2141 <em>
2142 </nowiki></pre>
2143 !! html
2144 <pre>
2145 &lt;b&gt;
2146 &lt;cite&gt;
2147 &lt;em&gt;
2148 </pre>
2149
2150 !! end
2151
2152 !! test
2153 Regression with preformatted in <center>
2154 !! wikitext
2155 <center>
2156 Blah
2157 </center>
2158 !! html
2159 <center>
2160 <pre>Blah
2161 </pre>
2162 </center>
2163
2164 !! end
2165
2166 !! test
2167 T54763: Preformatted in <blockquote>
2168 !! wikitext
2169 <blockquote>
2170 Blah
2171 {|
2172 |
2173 indented cell (no pre-wrapping!)
2174 |}
2175 </blockquote>
2176 !! html
2177 <blockquote>
2178 <p> Blah
2179 </p>
2180 <table>
2181 <tr>
2182 <td>
2183 <p> indented cell (no pre-wrapping!)
2184 </p>
2185 </td></tr></table>
2186 </blockquote>
2187
2188 !! end
2189
2190 !! test
2191 T53086: Double newlines in blockquotes should be turned into paragraphs
2192 !! wikitext
2193 <blockquote>
2194 Foo
2195
2196 Bar
2197 </blockquote>
2198 !! html
2199 <blockquote>
2200 <p>Foo
2201 </p><p>Bar
2202 </p>
2203 </blockquote>
2204
2205 !! end
2206
2207 !! test
2208 T17491: <ins>/<del> in blockquote
2209 !! wikitext
2210 <blockquote>
2211 Foo <del>bar</del> <ins>baz</ins> quux
2212 </blockquote>
2213 !! html
2214 <blockquote>
2215 <p>Foo <del>bar</del> <ins>baz</ins> quux
2216 </p>
2217 </blockquote>
2218
2219 !! end
2220
2221 # Note that the p-wrapping is newline sensitive, which could be
2222 # considered a bug: tidy will wrap only the 'Foo' in the example
2223 # below in a <p> tag. (see comment 23-25 of T8200)
2224 !! test
2225 T17491: <ins>/<del> in blockquote (2)
2226 !! wikitext
2227 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2228 </blockquote>
2229 !! html
2230 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2231 </blockquote>
2232
2233 !! html+tidy
2234 <blockquote>
2235 <p>Foo</p>
2236 <del>bar</del> <ins>baz</ins> quux</blockquote>
2237 !! end
2238
2239 !! test
2240 <pre> with attributes (T5202)
2241 !! wikitext
2242 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2243 !! html
2244 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2245
2246 !! end
2247
2248 !! test
2249 <pre> with width attribute (T5202)
2250 !! wikitext
2251 <pre width="8">Narrow screen goodies</pre>
2252 !! html
2253 <pre width="8">Narrow screen goodies</pre>
2254
2255 !! end
2256
2257 !! test
2258 <pre> with forbidden attribute (T5202)
2259 !! wikitext
2260 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2261 !! html
2262 <pre width="8">Narrow screen goodies</pre>
2263
2264 !! end
2265
2266 !! test
2267 Entities inside <pre>
2268 !! wikitext
2269 <pre>&lt;</pre>
2270 !! html
2271 <pre>&lt;</pre>
2272
2273 !! end
2274
2275 !! test
2276 <pre> with forbidden attribute values (T5202)
2277 !! wikitext
2278 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2279 !! html
2280 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2281
2282 !! end
2283
2284 !! test
2285 <nowiki> inside <pre> (T15238)
2286 !! wikitext
2287 <pre>
2288 <nowiki>
2289 </pre>
2290 <pre>
2291 <nowiki></nowiki>
2292 </pre>
2293 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2294 !! html
2295 <pre>
2296 &lt;nowiki&gt;
2297 </pre>
2298 <pre>
2299
2300 </pre>
2301 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2302
2303 !! end
2304
2305 !! test
2306 <nowiki> inside of #tag:pre
2307 !! wikitext
2308 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2309 !! html/php
2310 <pre>Foo &#8594;bar</pre>
2311
2312 !! html/parsoid
2313 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"#tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
2314 !! end
2315
2316 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2317 ## aren't enclosed in nowikis.
2318 !! test
2319 <nowiki> and <pre> preference (first one wins)
2320 !! options
2321 parsoid=wt2html
2322 !! wikitext
2323 <pre>
2324 <nowiki>
2325 </pre>
2326 </nowiki>
2327 </pre>
2328
2329 <nowiki>
2330 <pre>
2331 <nowiki>
2332 </pre>
2333 </nowiki>
2334 </pre>
2335
2336 !! html/php
2337 <pre>
2338 &lt;nowiki&gt;
2339 </pre>
2340 <p>&lt;/nowiki&gt;
2341 &lt;/pre&gt;
2342 </p><p>
2343 &lt;pre&gt;
2344 &lt;nowiki&gt;
2345 &lt;/pre&gt;
2346
2347 &lt;/pre&gt;
2348 </p>
2349 !! html/parsoid
2350 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2351 </pre>
2352 <p>&lt;/nowiki></p>
2353
2354
2355 <p><span typeof="mw:Nowiki">
2356 &lt;pre>
2357 &lt;nowiki>
2358 &lt;/pre>
2359 </span></p>
2360 !! end
2361
2362 !! test
2363 </pre> inside nowiki
2364 !! wikitext
2365 <nowiki></pre></nowiki>
2366 !! html
2367 <p>&lt;/pre&gt;
2368 </p>
2369 !! end
2370
2371 # Parsoid doesn't strip empty tags, like Tidy does.
2372 !! test
2373 Empty pre; pre inside other HTML tags (T56946)
2374 !! wikitext
2375 a
2376
2377 <div><pre>
2378 foo
2379 </pre></div>
2380 <pre></pre>
2381 !! html/php
2382 <p>a
2383 </p>
2384 <div><pre>
2385 foo
2386 </pre></div>
2387 <pre></pre>
2388
2389 !! html/php+tidy
2390 <p>a</p>
2391 <div>
2392 <pre>
2393 foo
2394 </pre></div>
2395 !! html/parsoid
2396 <p>a</p>
2397
2398 <div data-parsoid='{"stx":"html"}'><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
2399 </pre></div>
2400 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2401 !! end
2402
2403 !! test
2404 HTML pre followed by indent-pre
2405 !! wikitext
2406 <pre>foo</pre>
2407 bar
2408 !! html
2409 <pre>foo</pre>
2410 <pre>bar
2411 </pre>
2412 !! end
2413
2414 # Note that tidy removes the empty <p> tags from the start and end.
2415 # Parsoid does not, by design.
2416 !! test
2417 Block tag pre
2418 !! wikitext
2419 <p><pre>foo</pre></p>
2420 !! html/php+tidy
2421 <pre>
2422 foo
2423 </pre>
2424 !! html/parsoid
2425 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2426 !! end
2427
2428 !!test
2429 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2430 !! wikitext
2431 {{echo|}}
2432 !! html
2433
2434 !!end
2435
2436 !!test
2437 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2438 !! wikitext
2439 {{echo|
2440 foo}}
2441 !! html
2442 <p>foo
2443 </p>
2444 !!end
2445
2446 !! test
2447 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2448 !! wikitext
2449 {{echo|a
2450 b}}
2451 !! html
2452 <pre>a
2453 </pre>
2454 <p>b
2455 </p>
2456 !!end
2457
2458 !! test
2459 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2460 !! wikitext
2461 {{echo|a
2462 b
2463 c
2464 d
2465 e
2466 }}
2467 !! html
2468 <pre>a
2469 </pre>
2470 <p>b
2471 c
2472 </p>
2473 <pre>d
2474 </pre>
2475 <p>e
2476 </p>
2477 !!end
2478
2479 !!test
2480 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2481 !! wikitext
2482 {{echo| foo}}
2483
2484 {{echo| foo}}{{echo| bar}}
2485
2486 {{echo| foo}}
2487 {{echo| bar}}
2488
2489 {{echo|<!--cmt--> foo}}
2490
2491 <!--cmt-->{{echo| foo}}
2492
2493 {{echo|{{echo| }}bar}}
2494 !! html
2495 <pre>foo
2496 </pre>
2497 <pre>foo bar
2498 </pre>
2499 <pre>foo
2500 bar
2501 </pre>
2502 <pre>foo
2503 </pre>
2504 <pre>foo
2505 </pre>
2506 <pre>bar
2507 </pre>
2508 !!end
2509
2510 !! test
2511 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2512 !! wikitext
2513 {{echo| }}a
2514
2515 {{echo|
2516 }}a
2517
2518 {{echo|
2519 b}}
2520
2521 {{echo|a
2522 }}b
2523
2524 {{echo|a
2525 }} b
2526 !! html
2527 <pre>a
2528 </pre>
2529 <p><br />
2530 </p>
2531 <pre>a
2532 </pre>
2533 <p><br />
2534 </p>
2535 <pre>b
2536 </pre>
2537 <p>a
2538 </p>
2539 <pre>b
2540 </pre>
2541 <p>a
2542 </p>
2543 <pre>b
2544 </pre>
2545 !!end
2546
2547 ## Hmm, should Parsoid rt this?
2548 !! test
2549 Pres with newline attributes
2550 !! options
2551 parsoid=wt2html,html2html
2552 !! wikitext
2553 <pre class="one
2554 two">hi</pre>
2555 !! html/php
2556 <pre class="one two">hi</pre>
2557
2558 !! html/parsoid
2559 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2560 !! end
2561
2562 !! test
2563 Things that look like <pre> tags aren't treated as such
2564 !! wikitext
2565 Barack Obama <President> of the United States
2566 <President></President>
2567 !! html
2568 <p>Barack Obama &lt;President&gt; of the United States
2569 &lt;President&gt;&lt;/President&gt;
2570 </p>
2571 !! end
2572
2573 !! test
2574 Handle broken pre-like tags (T66025)
2575 !! options
2576 parsoid=wt2html
2577 !! wikitext
2578 {{echo|<pre <pre>x</pre>}}
2579
2580 <table><pre </table>
2581 !! html/php
2582 <pre>x</pre>
2583 <table>&lt;pre </table>
2584
2585 !! html/php+tidy
2586 <pre>
2587 x
2588 </pre>
2589 <p>&lt;pre</p>
2590 !! html/parsoid
2591 <pre about="#mwt1" typeof="mw:Transclusion mw:Extension/pre" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2592
2593
2594 <p>&lt;pre </p>
2595
2596 <table></table>
2597 !! end
2598
2599 !! test
2600 Parsoid: handle pre with space after attribute
2601 !! options
2602 parsoid=wt2html
2603 !! wikitext
2604 <pre style="width:50%;" >{{echo|foo}}</pre>
2605 !! html/php
2606 <pre style="width:50%;">{{echo|foo}}</pre>
2607
2608 !! html/parsoid
2609 <pre typeof="mw:Extension/pre" about="#mwt2" style="width:50%;" data-mw='{"name":"pre","attrs":{"style":"width:50%;"},"body":{"extsrc":"{{echo|foo}}"}}'>{{echo|foo}}</pre>
2610 !! end
2611
2612 # TODO / maybe: fix wt2wt for this
2613 !! test
2614 Parsoid: Don't paragraph-wrap fosterable content
2615 !! options
2616 parsoid=wt2html
2617 !! wikitext
2618 {|
2619 <td></td>
2620 <td></td>
2621
2622
2623
2624 |}
2625 !! html
2626 <table>
2627
2628 <tbody>
2629 <tr>
2630 <td></td>
2631
2632 <td></td></tr>
2633
2634
2635
2636 </tbody></table>
2637 !! end
2638
2639 !! test
2640 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2641 !! options
2642 parsoid=wt2html
2643 !! wikitext
2644 {|
2645 <td>
2646 <td>
2647 </td>
2648
2649
2650
2651 |}
2652 !! html
2653 <table>
2654
2655 <tbody>
2656 <tr>
2657 <td></td>
2658
2659 <td>
2660 </td></tr>
2661
2662
2663
2664 </tbody></table>
2665 !! end
2666
2667
2668 #--------------------------------------------------------------------
2669 # Transclusion parameter whitespace stripping tests
2670 # Behavior is different for positional and named parameters
2671 #--------------------------------------------------------------------
2672 !! test
2673 Templates: Strip leading and trailing whitespace from named-param values
2674 !! wikitext
2675 {{echo|1= a }}
2676
2677 {{echo|1= {{echo|b}} }}
2678
2679 {{echo| 1 =
2680 c }}
2681
2682 {{echo| 1 =
2683 * d
2684 }}
2685 !! html
2686 <p>a
2687 </p><p>b
2688 </p><p>c
2689 </p>
2690 <ul><li> d</li></ul>
2691
2692 !! end
2693
2694 !! test
2695 Templates: Don't strip whitespace from positional-param values
2696 !! wikitext
2697 {{echo|a }}
2698
2699 {{echo|{{echo|b}} }}
2700
2701 {{echo| c
2702 }}
2703
2704 {{echo| {{echo|d}}
2705 }}
2706
2707 {{echo|
2708 e}}
2709
2710 {{echo|
2711 * f}}
2712
2713 {{echo|
2714 }}g
2715 !! html
2716 <p>a
2717 </p><p>b
2718 </p>
2719 <pre>c
2720 </pre>
2721 <p><br />
2722 </p>
2723 <pre>d
2724 </pre>
2725 <p><br />
2726 </p>
2727 <pre>e
2728 </pre>
2729 <p><br />
2730 </p>
2731 <ul><li> f</li></ul>
2732 <p><br />
2733 </p>
2734 <pre>g
2735 </pre>
2736 !! end
2737
2738 !! test
2739 Templates: Handle empty comment-and-ws-only lines correctly
2740 !! wikitext
2741 {{echo|foo
2742 <!--should be ignored-->
2743 <!--should be ignored as well-->
2744 bar}}
2745 !! html/php
2746 <p>foo
2747 bar
2748 </p>
2749 !! html/parsoid
2750 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo\n&lt;!--should be ignored-->\n &lt;!--should be ignored as well-->\nbar"}},"i":0}}]}'>foo <!--should be ignored--> <!--should be ignored as well--> bar</p>
2751 !! end
2752
2753 !! test
2754 Templates: Handle comments in the target
2755 !! wikitext
2756 {{echo
2757 <!-- should be ignored -->
2758 |foo}}
2759
2760 {{echo
2761 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2762 |foo}}
2763
2764 {{echo<!-- should be ignored -->
2765 |foo}}
2766
2767 {{echo<!-- should be ignored -->|foo}}
2768
2769 {{<!-- should be ignored -->echo|foo}}
2770 !! html/php
2771 <p>foo
2772 </p><p>foo
2773 </p><p>foo
2774 </p><p>foo
2775 </p><p>foo
2776 </p>
2777 !! html/parsoid
2778 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2779
2780 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored and spaces on next line should not trip us up (T147742) -->\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2781
2782 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2783
2784 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2785
2786 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2787 !!end
2788
2789 !! test
2790 Templates: Handle comments in parameter names (T69657)
2791 !! wikitext
2792 {{echo|1
2793 <!-- should be ignored -->
2794 =foo}}
2795
2796 {{echo|
2797 <!-- should be ignored -->
2798 1 = foo}}
2799
2800 {{echo|1<!-- should be ignored -->=foo}}
2801
2802 {{echo|<!-- should be ignored -->1=foo}}
2803 !! html/php
2804 <p>foo
2805 </p><p>foo
2806 </p><p>foo
2807 </p><p>foo
2808 </p>
2809 !! html/parsoid
2810 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2811
2812 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2813
2814 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2815
2816 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2817 !!end
2818
2819 !! test
2820 Templates: Other wikitext in parameter names (T69657)
2821 !! wikitext
2822 {{echo|''1''=foo}}
2823 !! html/php
2824 <p>{{{1}}}
2825 </p>
2826 !! html/parsoid
2827 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2828 !!end
2829
2830 #--------------------------------------------------------------------
2831 # Transclusion parameter escaping tests
2832 #--------------------------------------------------------------------
2833 !! test
2834 Templates: Parsoid parameter escaping test 1
2835 !! wikitext
2836 {{echo|[foo]|{{echo|[bar]}}}}
2837 !! html/php+tidy
2838 <p>[foo]</p>
2839 !! html/parsoid
2840 <p about="#mwt1" typeof="mw:Transclusion"
2841 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2842 !! end
2843
2844 !! test
2845 Parsoid: Pipes in external links in template parameter
2846 !! wikitext
2847 {{echo|[{{echo|http://example.com}} link]}}
2848 !! html/php+tidy
2849 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2850 !! html/parsoid
2851 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2852 !! end
2853
2854 !! test
2855 Parsoid: pipe in transclusion parameter
2856 !! wikitext
2857 {{echo|http://foo.com/a&#124;b}}
2858 !! html/php+tidy
2859 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2860 !! html/parsoid
2861 <p><a rel="mw:ExtLink" href="http://foo.com/a%7Cb" about="#mwt1"
2862 typeof="mw:Transclusion"
2863 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a%7Cb</a></p>
2864 !! end
2865
2866 !! test
2867 Parsoid: Pipe in external link target and content in template parameter
2868 !! options
2869 parsoid=html2wt,wt2wt
2870 !! wikitext
2871 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2872 !! html/php+tidy
2873 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2874 !! html/parsoid
2875 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2876 typeof="mw:Transclusion"
2877 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2878 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2879 !! end
2880
2881 !! test
2882 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2883 !! options
2884 parsoid
2885 !! wikitext
2886 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2887 !! html
2888 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2889 !! end
2890
2891 !! test
2892 Templates: Don't escape already nowiki-escaped text in template parameters
2893 !! options
2894 parsoid=html2wt,wt2wt
2895 !! wikitext
2896 {{echo|foo<nowiki>|</nowiki>bar}}
2897 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2898 {{echo|<nowiki></nowiki>}}
2899 !! html/php+tidy
2900 <p>foo|bar &lt;div&gt;</p>
2901 !! html/parsoid
2902 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2903 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2904 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2905 </p>
2906 !! end
2907
2908 ## T54824
2909 !! test
2910 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2911 !! options
2912 parsoid=html2wt,wt2wt
2913 !! wikitext
2914 {{echo|{{echo|1=bar}}}}
2915 !! html/php+tidy
2916 <p>bar</p>
2917 !! html/parsoid
2918 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2919 !! end
2920
2921 ## T58733
2922 !! test
2923 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2924 !! wikitext
2925 {{echo|a : b}}
2926 !! html/php+tidy
2927 <p>a&#160;: b</p>
2928 !! html/parsoid
2929 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2930 !! end
2931
2932 ## T73412
2933 !! test
2934 Templates: Preserve blank parameter names
2935 !! wikitext
2936 {{echo|=foo}}
2937 !! html/php+tidy
2938 <p>{{{1}}}</p>
2939 !! html/parsoid
2940 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2941 !! end
2942
2943 !! test
2944 Templates: Preserve blank parameter names in other positions
2945 !! wikitext
2946 {{blank_param|bar|=foo}}
2947 !! html/php+tidy
2948 <p>bar foo</p>
2949 !! html/parsoid
2950 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2951 foo</p>
2952 !! end
2953
2954 ###
2955 ### Parsoid-centric tests for testing RT edge cases for pre
2956 ###
2957
2958 !!test
2959 1a. Indent-Pre and Comments
2960 !! wikitext
2961 a
2962 <!--a-->
2963 c
2964 !! html
2965 <pre>a
2966 </pre>
2967 <p>c
2968 </p>
2969 !!end
2970
2971 !!test
2972 1b. Indent-Pre and Comments
2973 !! wikitext
2974 a
2975 <!--a-->
2976 c
2977 !! html
2978 <pre>a
2979 </pre>
2980 <p>c
2981 </p>
2982 !!end
2983
2984 !!test
2985 1c. Indent-Pre and Comments
2986 !! wikitext
2987 <!--a--> a
2988
2989 <!--a--> a
2990 !! html
2991 <pre> a
2992 </pre>
2993 <pre> a
2994 </pre>
2995 !!end
2996
2997 !!test
2998 1d. Indent-Pre and Comments
2999 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3000 !! wikitext
3001 <!--a--> a
3002
3003 <!--b-->b
3004 !! html
3005 <pre>a
3006 </pre>
3007 <pre>b
3008 </pre>
3009 !!end
3010
3011 !!test
3012 2a. Indent-Pre and tables
3013 !! wikitext
3014 {|
3015 |-
3016 !h1!!h2
3017 |foo||bar
3018 |}
3019 !! html
3020 <table>
3021
3022 <tr>
3023 <th>h1</th>
3024 <th>h2
3025 </th>
3026 <td>foo</td>
3027 <td>bar
3028 </td></tr></table>
3029
3030 !!end
3031
3032 !!test
3033 2b. Indent-Pre and tables
3034 !! wikitext
3035 {|
3036 |-
3037 |foo
3038 |}
3039 !! html
3040 <table>
3041
3042 <tr>
3043 <td>foo
3044 </td></tr></table>
3045
3046 !!end
3047
3048 !!test
3049 2c. Indent-Pre and tables (T44252)
3050 !! wikitext
3051 {|
3052 |+ foo
3053 ! | bar
3054 |}
3055 !! html
3056 <table>
3057 <caption> foo
3058 </caption>
3059 <tr>
3060 <th> bar
3061 </th></tr></table>
3062
3063 !!end
3064
3065 !!test
3066 2d. Indent-Pre and tables
3067 !! wikitext
3068 a
3069 {|
3070 | b
3071 |}
3072 !! html/php
3073 <pre>a
3074 </pre>
3075 <table>
3076 <tr>
3077 <td> b
3078 </td></tr></table>
3079
3080 !! html/parsoid
3081 <pre>a</pre>
3082 <table>
3083 <tbody><tr><td> b</td></tr>
3084 </tbody></table>
3085 !!end
3086
3087 !!test
3088 2e. Indent-Pre and table-line syntax
3089 !! wikitext
3090 a
3091 | b
3092 | c
3093 !! html/php
3094 <pre>a
3095 | b
3096 | c
3097 </pre>
3098 !!end
3099
3100 !!test
3101 2f. Indent-pre started by table-line syntax
3102 !! wikitext
3103 a
3104 | b
3105 | c
3106 !! html/php
3107 <p>a
3108 </p>
3109 <pre>| b
3110 | c
3111 </pre>
3112 !! html/parsoid
3113 <p>a</p>
3114 <pre>
3115 | b
3116 | c</pre>
3117 !!end
3118
3119 !! test
3120 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3121 !! wikitext
3122 <table>
3123 <tr>
3124 <td>
3125 Text that should be rendered preformatted
3126 </td>
3127 </tr>
3128 </table>
3129 !! html
3130 <table>
3131 <tr>
3132 <td>
3133 <pre>Text that should be rendered preformatted
3134 </pre>
3135 </td>
3136 </tr>
3137 </table>
3138
3139 !! end
3140
3141 !!test
3142 3a. Indent-Pre and block tags (single-line html)
3143 !! wikitext
3144 a <p> foo </p>
3145 b <div> foo </div>
3146 c <blockquote> foo </blockquote>
3147 <span> foo </span>
3148 !! html
3149 a <p> foo </p>
3150 b <div> foo </div>
3151 c <blockquote> foo </blockquote>
3152 <pre><span> foo </span>
3153 </pre>
3154 !! html/parsoid
3155 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3156 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3157 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3158 <pre><span> foo </span>
3159 </pre>
3160 !! html+tidy
3161 <p>a</p>
3162 <p>foo</p>
3163 <p>b</p>
3164 <div>foo</div>
3165 <p>c</p>
3166 <blockquote>
3167 <p>foo</p>
3168 </blockquote>
3169 <pre>
3170 <span> foo </span>
3171 </pre>
3172 !! end
3173
3174 !!test
3175 3b. Indent-Pre and block tags (multi-line html)
3176 !! wikitext
3177 a <span>foo</span>
3178 b <div> foo </div>
3179 !! html
3180 <pre>a <span>foo</span>
3181 </pre>
3182 b <div> foo </div>
3183
3184 !! html/parsoid
3185 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3186 b <div data-parsoid='{"stx":"html"}'> foo </div>
3187 !! html+tidy
3188 <pre>
3189 a <span>foo</span>
3190 </pre>
3191 <p>b</p>
3192 <div>foo</div>
3193 !!end
3194
3195 !!test
3196 3c. Indent-Pre and block tags (pre-content on separate line)
3197 !! wikitext
3198 <p>
3199 foo
3200 </p>
3201
3202 <div>
3203 foo
3204 </div>
3205
3206 <center>
3207 foo
3208 </center>
3209
3210 <blockquote>
3211 foo
3212 </blockquote>
3213
3214 <blockquote>
3215 <pre>
3216 foo
3217 </pre>
3218 </blockquote>
3219
3220 <table><tr><td>
3221 foo
3222 </td></tr></table>
3223
3224 <ul><li>
3225 foo
3226 </li></ul>
3227
3228 !! html
3229 <p>
3230 foo
3231 </p>
3232 <div>
3233 <pre>foo
3234 </pre>
3235 </div>
3236 <center>
3237 <pre>foo
3238 </pre>
3239 </center>
3240 <blockquote>
3241 <p> foo
3242 </p>
3243 </blockquote>
3244 <blockquote>
3245 <pre>
3246 foo
3247 </pre>
3248 </blockquote>
3249 <table><tr><td>
3250 <pre>foo
3251 </pre>
3252 </td></tr></table>
3253 <ul><li>
3254 foo
3255 </li></ul>
3256
3257 !!end
3258
3259 !! test
3260 4. Indent-Pre and extension tags
3261 !! wikitext
3262 a <tag />
3263 !! html/php
3264 a <pre>
3265 NULL
3266 array (
3267 )
3268 </pre>
3269
3270 !! html/parsoid
3271 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3272 !! end
3273
3274 !! test
3275 5. Indent-Pre and html pre
3276 !! wikitext
3277 <pre class="123">hi</pre>
3278 !! html/php
3279 <pre class="123">hi</pre>
3280
3281 !! html/parsoid
3282 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3283 !! end
3284
3285 !!test
3286 Render paragraphs when indent-pre is suppressed in blocklevels
3287 !! wikitext
3288 <blockquote>
3289 foo
3290
3291 bar
3292 </blockquote>
3293 !! html
3294 <blockquote>
3295 <p> foo
3296 </p><p> bar
3297 </p>
3298 </blockquote>
3299
3300 !!end
3301
3302 !!test
3303 4. Multiple spaces at start-of-line
3304 !! wikitext
3305 <p> foo </p>
3306 foo
3307 {|
3308 |foo
3309 |}
3310 !! html
3311 <p> foo </p>
3312 <pre> foo
3313 </pre>
3314 <table>
3315 <tr>
3316 <td>foo
3317 </td></tr></table>
3318
3319 !!end
3320
3321 ## NOTE: the leading white-space chars on empty line are significant
3322 !! test
3323 5a. White-space in indent-pre
3324 !! wikitext
3325 a<br />
3326
3327 b
3328 !! html
3329 <pre>a<br />
3330
3331 b
3332 </pre>
3333 !! end
3334
3335 ## NOTE: the leading white-space chars on empty line are significant
3336 !! test
3337 5b. White-space in indent-pre
3338 !! wikitext
3339 a
3340
3341 b
3342
3343
3344 c
3345 !! html
3346 <pre>a
3347
3348 b
3349
3350
3351 c
3352 </pre>
3353 !! end
3354
3355 !! test
3356 5c. White-space in indent-pre
3357 !! wikitext
3358 ''a''
3359 ''b''
3360 ''c''
3361 !! html
3362 <pre><i>a</i>
3363 <i>b</i>
3364 <i>c</i>
3365 </pre>
3366 !! end
3367
3368 !! test
3369 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3370 !! wikitext
3371 a
3372
3373 <!-- continue -->
3374 b
3375
3376 c
3377
3378 d
3379 !! html
3380 <pre>a
3381
3382 b
3383 </pre>
3384 <pre>c
3385
3386 </pre>
3387 <p>d
3388 </p>
3389 !! end
3390
3391 !! test
3392 7a. Indent-pre and category links
3393 !! options
3394 parsoid=wt2html,wt2wt
3395 !! wikitext
3396 [[Category:foo]] <!-- No pre-wrapping -->
3397 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3398 !! html/php+tidy
3399 !! html/parsoid
3400 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3401 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3402 !! end
3403
3404 ## We used to, but no longer wt2wt this test since the default serializer
3405 ## will normalize all categories to serialize on their own line.
3406 ## This wikitext usage is going to be fairly uncommon in production and
3407 ## selser will take care of preserving formatting in those scenarios.
3408 !! test
3409 7b. Indent-pre and category links
3410 !! options
3411 parsoid=wt2html
3412 !! wikitext
3413 [[Category:foo]] a
3414 [[Category:foo]] {{echo|b}}
3415 !! html/parsoid
3416 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3417 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3418 !! end
3419
3420 !! test
3421 Indent-Pre: Newlines in comments shouldn't affect sol state
3422 !! wikitext
3423 a <!--
3424 foo
3425 --> b
3426 !! html/php+tidy
3427 <p>a b</p>
3428 !! html/parsoid
3429 <p>a <!--
3430 foo
3431 --> b</p>
3432 !! end
3433
3434 ###
3435 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3436 ###
3437
3438 !!test
3439 HTML-pre: 1. embedded newlines
3440 !! wikitext
3441 <pre>foo</pre>
3442
3443 <pre>
3444 foo
3445 </pre>
3446
3447 <pre>
3448
3449 foo
3450 </pre>
3451
3452 <pre>
3453
3454
3455 foo
3456 </pre>
3457 !! html/php+tidy
3458 <pre>
3459 foo
3460 </pre>
3461 <pre>
3462 foo
3463 </pre>
3464 <pre>
3465
3466 foo
3467 </pre>
3468 <pre>
3469
3470
3471 foo
3472 </pre>
3473 !! html/parsoid
3474 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3475
3476 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3477 </pre>
3478
3479 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3480
3481 foo
3482 </pre>
3483
3484 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3485
3486
3487 foo
3488 </pre>
3489 !!end
3490
3491 !! test
3492 HTML-pre: big spaces
3493 !! wikitext
3494 <pre>
3495
3496
3497
3498
3499 haha
3500
3501
3502
3503
3504 haha
3505
3506
3507
3508
3509 </pre>
3510 !! html/php+tidy
3511 <pre>
3512
3513
3514
3515
3516 haha
3517
3518
3519
3520
3521 haha
3522
3523
3524
3525
3526 </pre>
3527 !! html/parsoid
3528 <pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\n\n\nhaha\n\n\n\n\nhaha\n\n\n\n\n"}}'>
3529
3530
3531
3532
3533 haha
3534
3535
3536
3537
3538 haha
3539
3540
3541
3542
3543 </pre>
3544 !! end
3545
3546 !!test
3547 HTML-pre: 2: indented text
3548 !! wikitext
3549 <pre>
3550 foo
3551 </pre>
3552 !! html
3553 <pre>
3554 foo
3555 </pre>
3556
3557 !!end
3558
3559 !!test
3560 HTML-pre: 3: other wikitext
3561 !! wikitext
3562 <pre>
3563 * foo
3564 # bar
3565 = no-h =
3566 '' no-italic ''
3567 [[ NoLink ]]
3568 </pre>
3569 !! html/php
3570 <pre>
3571 * foo
3572 # bar
3573 = no-h =
3574 '' no-italic ''
3575 [[ NoLink ]]
3576 </pre>
3577
3578 !! html/parsoid
3579 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n* foo\n# bar\n= no-h =\n&#39;&#39; no-italic &#39;&#39;\n[[ NoLink ]]\n"}}'>* foo
3580 # bar
3581 = no-h =
3582 '' no-italic ''
3583 [[ NoLink ]]
3584 </pre>
3585 !!end
3586
3587 ###
3588 ### Definition lists
3589 ###
3590 !! test
3591 Simple definition
3592 !! wikitext
3593 ; name : Definition
3594 !! html
3595 <dl><dt> name&#160;</dt>
3596 <dd> Definition</dd></dl>
3597
3598 !! end
3599
3600 !! test
3601 Definition list for indentation only
3602 !! wikitext
3603 : Indented text
3604 !! html
3605 <dl><dd> Indented text</dd></dl>
3606
3607 !! end
3608
3609 !! test
3610 Definition list with no space
3611 !! wikitext
3612 ;name:Definition
3613 !! html
3614 <dl><dt>name</dt>
3615 <dd>Definition</dd></dl>
3616
3617 !!end
3618
3619 !! test
3620 Definition list with URL link
3621 !! wikitext
3622 ; http://example.com/ : definition
3623 !! html
3624 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3625 <dd> definition</dd></dl>
3626
3627 !! end
3628
3629 !! test
3630 Definition list with bracketed URL link
3631 !! wikitext
3632 ;[http://www.example.com/ Example]:Something about it
3633 !! html
3634 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3635 <dd>Something about it</dd></dl>
3636
3637 !! end
3638
3639 !! test
3640 Definition list with wikilink containing colon
3641 !! wikitext
3642 ; [[Help:FAQ]]: The least-read page on Wikipedia
3643 !! html
3644 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3645 <dd> The least-read page on Wikipedia</dd></dl>
3646
3647 !! end
3648
3649 # At Brion's and JeLuF's insistence... :)
3650 !! test
3651 Definition list with news link containing colon
3652 !! wikitext
3653 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3654 !! html/php
3655 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3656 <dd> This isn't even a real newsgroup!</dd></dl>
3657
3658 !! html/parsoid
3659 <dl><dt> <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3660 !! end
3661
3662 !! test
3663 Malformed definition list with colon
3664 !! wikitext
3665 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3666 !! html
3667 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3668
3669 !! end
3670
3671 !! test
3672 Definition lists: colon in external link text
3673 !! wikitext
3674 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3675 !! html
3676 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3677 <dd> OK, I made that up</dd></dl>
3678
3679 !! end
3680
3681 !! test
3682 Definition lists: colon in HTML attribute
3683 !! wikitext
3684 ;<b style="display: inline">bold</b>
3685 !! html
3686 <dl><dt><b style="display: inline">bold</b></dt></dl>
3687
3688 !! end
3689
3690 !! test
3691 Definition lists: self-closed tag
3692 !! wikitext
3693 ;one<br/>two : two-line fun
3694 !! html
3695 <dl><dt>one<br />two&#160;</dt>
3696 <dd> two-line fun</dd></dl>
3697
3698 !! end
3699
3700 !! test
3701 Definition lists: ignore colons inside tags
3702 !! wikitext
3703 ;one <b>two : tag <i>fun:</i>:</b>: def
3704 !! html
3705 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
3706 <dd> def</dd></dl>
3707
3708 !! end
3709
3710 !! test
3711 Definition lists: excess closed tags
3712 !! wikitext
3713 ;one</b>two : bad tag fun
3714 !! html/php+tidy
3715 <dl>
3716 <dt>onetwo&#160;</dt>
3717 <dd>bad tag fun</dd>
3718 </dl>
3719 !! html/parsoid
3720 <dl>
3721 <dt>onetwo</dt>
3722 <dd>bad tag fun</dd>
3723 </dl>
3724 !! end
3725
3726 !! test
3727 T13748: Literal closing tags
3728 !! wikitext
3729 <dl>
3730 <dt>test 1</dt>
3731 <dd>test test test test test</dd>
3732 <dt>test 2</dt>
3733 <dd>test test test test test</dd>
3734 </dl>
3735 !! html
3736 <dl>
3737 <dt>test 1</dt>
3738 <dd>test test test test test</dd>
3739 <dt>test 2</dt>
3740 <dd>test test test test test</dd>
3741 </dl>
3742
3743 !! end
3744
3745 !! test
3746 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3747 !! wikitext
3748 <ul><li>
3749 ; term : description
3750 * unordered
3751 </li></ul>
3752 !! html
3753 <ul><li>
3754 <dl><dt> term&#160;</dt>
3755 <dd> description</dd></dl>
3756 <ul><li> unordered</li></ul>
3757 </li></ul>
3758
3759 !! end
3760
3761 !! test
3762 Definition list with empty definition and following paragraph
3763 !! wikitext
3764 ; term:
3765 Paragraph text
3766 !! html
3767 <dl><dt> term</dt>
3768 <dd></dd></dl>
3769 <p>Paragraph text
3770 </p>
3771 !! end
3772
3773 !! test
3774 Nested definition lists using html syntax
3775 !! wikitext
3776 <dl><dt>x</dt>
3777 <dd>a</dd>
3778 <dd>b</dd></dl>
3779 !! html
3780 <dl><dt>x</dt>
3781 <dd>a</dd>
3782 <dd>b</dd></dl>
3783
3784 !! end
3785
3786 !! test
3787 Definition Lists: No nesting: Multiple dd's
3788 !! wikitext
3789 ;x
3790 :a
3791 :b
3792 !! html
3793 <dl><dt>x</dt>
3794 <dd>a</dd>
3795 <dd>b</dd></dl>
3796
3797 !! end
3798
3799 !! test
3800 Definition Lists: Indentation: Regular
3801 !! wikitext
3802 :i1
3803 ::i2
3804 :::i3
3805 !! html
3806 <dl><dd>i1
3807 <dl><dd>i2
3808 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3809
3810 !! end
3811
3812 !! test
3813 Definition Lists: Indentation: Missing 1st level
3814 !! wikitext
3815 ::i2
3816 :::i3
3817 !! html
3818 <dl><dd><dl><dd>i2
3819 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3820
3821 !! end
3822
3823 !! test
3824 Definition Lists: Indentation: Multi-level indent
3825 !! wikitext
3826 :::i3
3827 !! html
3828 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3829
3830 !! end
3831
3832 !! test
3833 Definition Lists: Hacky use to indent tables
3834 !! wikitext
3835 ::{|
3836 |foo
3837 |bar
3838 |}
3839 this text
3840 should be left alone
3841 !! html
3842 <dl><dd><dl><dd><table>
3843 <tr>
3844 <td>foo
3845 </td>
3846 <td>bar
3847 </td></tr></table></dd></dl></dd></dl>
3848 <p>this text
3849 should be left alone
3850 </p>
3851 !! end
3852
3853 !! test
3854 Definition Lists: Hacky use to indent tables, with comments (T65979)
3855 !! wikitext
3856 <!-- foo -->
3857 ::{|
3858 |foo
3859 |bar
3860 |}<!-- bar -->
3861 this text
3862 should be left alone
3863 !! html/parsoid
3864 <!-- foo -->
3865 <dl><dd><dl><dd><table><tr>
3866 <td>foo</td>
3867 <td>bar</td>
3868 </tr></table><!-- bar --></dd></dl></dd></dl>
3869 <p>this text
3870 should be left alone</p>
3871 !! end
3872
3873 !! test
3874 Definition Lists: Hacky use to indent tables, with comment before table
3875 !! wikitext
3876 ::<!-- foo -->{|
3877 |foo
3878 |}
3879 !! html/parsoid
3880 <dl><dd><dl><dd><!-- foo --><table><tr>
3881 <td>foo</td>
3882 </tr></table></dd></dl></dd></dl>
3883 !! end
3884
3885 # The trailing whitespace in this test is to catch a regression in
3886 # Parsoid after T54473.
3887 !! test
3888 Definition Lists: Hacky use to indent tables (WS-insensitive)
3889 !! wikitext
3890 : {|
3891 |a
3892 |}
3893 !! html/php
3894 <dl><dd><table>
3895 <tr>
3896 <td>a
3897 </td></tr></table></dd></dl>
3898
3899 !! html/parsoid
3900 <dl><dd> <table>
3901 <tbody><tr><td>a</td></tr>
3902 </tbody></table> </dd></dl>
3903 !! end
3904
3905 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3906 ## as an empty dt item. It also ignores all but the last ";" when followed
3907 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3908 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3909 ## ";"s.
3910 ##
3911 ## Ex: ";;t2 ::d2" is transformed into:
3912 ##
3913 ## <dl>
3914 ## <dt>t2 </dt>
3915 ## <dd>
3916 ## <dl>
3917 ## <dt></dt>
3918 ## <dd>d2</dd>
3919 ## </dl>
3920 ## </dd>
3921 ## </dl>
3922 ##
3923 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3924 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3925 ##
3926 ## <dl>
3927 ## <dt>
3928 ## <dl>
3929 ## <dt>t2 </dt>
3930 ## <dd>:d2</dd>
3931 ## </dl>
3932 ## </dt>
3933 ## </dl>
3934 ##
3935 ## All Parsoid only definition list tests have this difference.
3936 ##
3937 ## See also: https://phabricator.wikimedia.org/T8569
3938 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3939
3940 !! test
3941 Table / list interaction: indented table with lists in table contents
3942 !! wikitext
3943 :{|
3944 |-
3945 | a
3946 * b
3947 |-
3948 | c
3949 * d
3950 |}
3951 !! html
3952 <dl><dd><table>
3953
3954 <tr>
3955 <td> a
3956 <ul><li> b</li></ul>
3957 </td></tr>
3958 <tr>
3959 <td> c
3960 <ul><li> d</li></ul>
3961 </td></tr></table></dd></dl>
3962
3963 !! end
3964
3965 !!test
3966 Table / list interaction: lists nested in tables nested in indented lists
3967 !! wikitext
3968 :{|
3969 |
3970 :a
3971 :b
3972 |
3973 *c
3974 *d
3975 |}
3976
3977 *e
3978 *f
3979 !! html
3980 <dl><dd><table>
3981 <tr>
3982 <td>
3983 <dl><dd>a</dd>
3984 <dd>b</dd></dl>
3985 </td>
3986 <td>
3987 <ul><li>c</li>
3988 <li>d</li></ul>
3989 </td></tr></table></dd></dl>
3990 <ul><li>e</li>
3991 <li>f</li></ul>
3992
3993 !!end
3994
3995 !! test
3996 Definition Lists: Nesting: Multi-level (Parsoid only)
3997 !! options
3998 parsoid
3999 !! wikitext
4000 ;t1 :d1
4001 ;;t2 ::d2
4002 ;;;t3 :::d3
4003 !! html
4004 <dl>
4005 <dt>t1 </dt>
4006 <dd>d1</dd>
4007 <dt>
4008 <dl>
4009 <dt>t2 </dt>
4010 <dd>:d2</dd>
4011 <dt>
4012 <dl>
4013 <dt>t3 </dt>
4014 <dd>::d3</dd>
4015 </dl>
4016 </dt>
4017 </dl>
4018 </dt>
4019 </dl>
4020
4021
4022 !! end
4023
4024
4025 !! test
4026 Definition Lists: Nesting: Test 2 (Parsoid only)
4027 !! wikitext
4028 ;t1
4029 ::d2
4030 !! html/php+tidy
4031 <dl>
4032 <dt>t1</dt>
4033 <dd>
4034 <dl>
4035 <dd>d2</dd>
4036 </dl>
4037 </dd>
4038 </dl>
4039 !! html/parsoid
4040 <dl>
4041 <dt>t1</dt>
4042 <dd>
4043 <dl>
4044 <dd>d2</dd>
4045 </dl>
4046 </dd>
4047 </dl>
4048
4049 !! end
4050
4051
4052 !! test
4053 Definition Lists: Nesting: Test 3 (Parsoid only)
4054 !! wikitext
4055 :;t1
4056 ::::d2
4057 !! html/php+tidy
4058 <dl>
4059 <dd>
4060 <dl>
4061 <dt>t1</dt>
4062 <dd>
4063 <dl>
4064 <dd>
4065 <dl>
4066 <dd>d2</dd>
4067 </dl>
4068 </dd>
4069 </dl>
4070 </dd>
4071 </dl>
4072 </dd>
4073 </dl>
4074 !! html/parsoid
4075 <dl>
4076 <dd>
4077 <dl>
4078 <dt>t1</dt>
4079 <dd>
4080 <dl>
4081 <dd>
4082 <dl>
4083 <dd>d2</dd>
4084 </dl>
4085 </dd>
4086 </dl>
4087 </dd>
4088 </dl>
4089 </dd>
4090 </dl>
4091
4092 !! end
4093
4094
4095 !! test
4096 Definition Lists: Nesting: Test 4
4097 !! wikitext
4098 ::;t3
4099 :::d3
4100 !! html
4101 <dl><dd><dl><dd><dl><dt>t3</dt>
4102 <dd>d3</dd></dl></dd></dl></dd></dl>
4103
4104 !! end
4105
4106
4107 ## The Parsoid team believes the following three test exposes a
4108 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4109 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4110 ## It also exposes a "misfeature" in tidy, which doesn't like
4111 ## <dl> tags with a single <dt> child; it converts the <dt> into
4112 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4113 !! test
4114 Definition Lists: Mixed Lists: Test 1
4115 !! wikitext
4116 :;* foo
4117 ::* bar
4118 :; baz
4119 !! html/php
4120 <dl><dd><dl><dt><ul><li> foo</li>
4121 <li> bar</li></ul></dt></dl>
4122 <dl><dt> baz</dt></dl></dd></dl>
4123
4124 !! html/php+tidy
4125 <dl>
4126 <dd>
4127 <dl>
4128 <dd>
4129 <ul>
4130 <li>foo</li>
4131 <li>bar</li>
4132 </ul>
4133 </dd>
4134 </dl>
4135 <dl>
4136 <dt>baz</dt>
4137 </dl>
4138 </dd>
4139 </dl>
4140 !! html/parsoid
4141 <dl>
4142 <dd><dl>
4143 <dt><ul>
4144 <li> foo
4145 </li>
4146 </ul></dt>
4147 <dd><ul>
4148 <li> bar
4149 </li>
4150 </ul></dd>
4151 <dt> baz</dt>
4152 </dl></dd>
4153 </dl>
4154 !! end
4155
4156 !! test
4157 Definition Lists: Mixed Lists: Test 2
4158 !! wikitext
4159 *: d1
4160 *: d2
4161 !! html
4162 <ul><li><dl><dd> d1</dd>
4163 <dd> d2</dd></dl></li></ul>
4164
4165 !! end
4166
4167
4168 !! test
4169 Definition Lists: Mixed Lists: Test 3
4170 !! wikitext
4171 *::: d1
4172 *::: d2
4173 !! html
4174 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4175 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4176
4177 !! end
4178
4179
4180 !! test
4181 Definition Lists: Mixed Lists: Test 4
4182 !! wikitext
4183 *;d1 :d2
4184 *;d3 :d4
4185 !! html
4186 <ul><li><dl><dt>d1&#160;</dt>
4187 <dd>d2</dd>
4188 <dt>d3&#160;</dt>
4189 <dd>d4</dd></dl></li></ul>
4190
4191 !! end
4192
4193
4194 !! test
4195 Definition Lists: Mixed Lists: Test 5
4196 !! wikitext
4197 *:d1
4198 *:: d2
4199 !! html
4200 <ul><li><dl><dd>d1
4201 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4202
4203 !! end
4204
4205
4206 !! test
4207 Definition Lists: Mixed Lists: Test 6
4208 !! wikitext
4209 #*:d1
4210 #*::: d3
4211 !! html
4212 <ol><li><ul><li><dl><dd>d1
4213 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4214
4215 !! end
4216
4217
4218 !! test
4219 Definition Lists: Mixed Lists: Test 7
4220 !! wikitext
4221 :* d1
4222 :* d2
4223 !! html
4224 <dl><dd><ul><li> d1</li>
4225 <li> d2</li></ul></dd></dl>
4226
4227 !! end
4228
4229
4230 !! test
4231 Definition Lists: Mixed Lists: Test 8
4232 !! wikitext
4233 :* d1
4234 ::* d2
4235 !! html
4236 <dl><dd><ul><li> d1</li></ul>
4237 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4238
4239 !! end
4240
4241
4242 !! test
4243 Definition Lists: Mixed Lists: Test 9
4244 !! wikitext
4245 *;foo :bar
4246 !! html
4247 <ul><li><dl><dt>foo&#160;</dt>
4248 <dd>bar</dd></dl></li></ul>
4249
4250 !! end
4251
4252
4253 !! test
4254 Definition Lists: Mixed Lists: Test 10
4255 !! wikitext
4256 *#;foo :bar
4257 !! html
4258 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4259 <dd>bar</dd></dl></li></ol></li></ul>
4260
4261 !! end
4262
4263 # The Parsoid team disagrees with the PHP parser's seemingly-random
4264 # rules regarding dd/dt on the next two tests. Parsoid is more
4265 # consistent, and recognizes the shared nesting and keeps the
4266 # still-open tags around until the nesting is complete.
4267 # (And tidy again converts <dt> to <dd> before 'bar'.)
4268
4269 !! test
4270 Definition Lists: Mixed Lists: Test 11
4271 !! wikitext
4272 *#*#;*;;foo :bar
4273 *#*#;boo :baz
4274 !! html/php
4275 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4276 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4277 <dl><dt>boo&#160;</dt>
4278 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4279
4280 !! html/php+tidy
4281 <ul>
4282 <li>
4283 <ol>
4284 <li>
4285 <ul>
4286 <li>
4287 <ol>
4288 <li>
4289 <dl>
4290 <dt>foo&#160;</dt>
4291 <dd>
4292 <ul>
4293 <li>
4294 <dl>
4295 <dd>
4296 <dl>
4297 <dt>bar</dt>
4298 </dl>
4299 </dd>
4300 </dl>
4301 </li>
4302 </ul>
4303 </dd>
4304 </dl>
4305 <dl>
4306 <dt>boo&#160;</dt>
4307 <dd>baz</dd>
4308 </dl>
4309 </li>
4310 </ol>
4311 </li>
4312 </ul>
4313 </li>
4314 </ol>
4315 </li>
4316 </ul>
4317 !! html/parsoid
4318 <ul>
4319 <li>
4320 <ol>
4321 <li>
4322 <ul>
4323 <li>
4324 <ol>
4325 <li>
4326 <dl>
4327 <dt>
4328 <ul>
4329 <li>
4330 <dl>
4331 <dt>
4332 <dl>
4333 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4334 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4335 </dl></dt>
4336 </dl></li>
4337 </ul></dt>
4338 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4339 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4340 </dl></li>
4341 </ol></li>
4342 </ul></li>
4343 </ol></li>
4344 </ul>
4345 !! end
4346
4347
4348 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4349 # From whitelist:
4350 # * The test is wrong, there are two colons where there should be :;
4351 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4352 !! test
4353 Definition Lists: Weird Ones: Test 1
4354 !! wikitext
4355 *#;*::;; foo : bar (who uses this?)
4356 !! html/php
4357 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4358 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4359
4360 !! html/php+tidy
4361 <ul>
4362 <li>
4363 <ol>
4364 <li>
4365 <dl>
4366 <dt>foo&#160;</dt>
4367 <dd>
4368 <ul>
4369 <li>
4370 <dl>
4371 <dd>
4372 <dl>
4373 <dd>
4374 <dl>
4375 <dd>
4376 <dl>
4377 <dt>bar (who uses this?)</dt>
4378 </dl>
4379 </dd>
4380 </dl>
4381 </dd>
4382 </dl>
4383 </dd>
4384 </dl>
4385 </li>
4386 </ul>
4387 </dd>
4388 </dl>
4389 </li>
4390 </ol>
4391 </li>
4392 </ul>
4393 !! html/parsoid
4394 <ul>
4395 <li>
4396 <ol>
4397 <li>
4398 <dl>
4399 <dt>
4400 <ul>
4401 <li>
4402 <dl>
4403 <dd>
4404 <dl>
4405 <dd>
4406 <dl>
4407 <dt>
4408 <dl>
4409 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4410 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4411 </dl></dt>
4412 </dl></dd>
4413 </dl></dd>
4414 </dl></li>
4415 </ul></dt>
4416 </dl></li>
4417 </ol></li>
4418 </ul>
4419 !! end
4420
4421 !! test
4422 Definition Lists: colons occurring in tags
4423 !! wikitext
4424 ;a:b
4425 ;'''a:b'''
4426 ;<i>a:b</i>
4427 ;<span>a:b</span>
4428 ;<div>a:b</div>
4429 ;<div>a
4430 :b</div>
4431 ;{{echo|a:b}}
4432 ;{{echo|''a:b''}}
4433 ;;;''a:b''
4434 !! html+tidy
4435 <dl>
4436 <dt>a</dt>
4437 <dd>b</dd>
4438 <dt><b>a:b</b></dt>
4439 <dt><i>a:b</i></dt>
4440 <dt><span>a:b</span></dt>
4441 <dd>
4442 <div>a:b</div>
4443 </dd>
4444 <dd>
4445 <div>a
4446 <dl>
4447 <dd>b</dd>
4448 </dl>
4449 </div>
4450 </dd>
4451 <dt>a</dt>
4452 <dd>b</dd>
4453 <dt><i>a:b</i></dt>
4454 </dl>
4455 <dl>
4456 <dd>
4457 <dl>
4458 <dd>
4459 <dl>
4460 <dt><i>a:b</i></dt>
4461 </dl>
4462 </dd>
4463 </dl>
4464 </dd>
4465 </dl>
4466 !! html/parsoid
4467 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4468 <dt><b>a:b</b></dt>
4469 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4470 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4471 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4472 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4473 <dd>b</dd>
4474 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4475 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4476 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4477 !! end
4478
4479 !! test
4480 Definition Lists: colons and tables 1
4481 !! wikitext
4482 :{|
4483 | x
4484 |}
4485 :{|
4486 | y
4487 |}
4488 !! html
4489 <dl><dd><table>
4490 <tr>
4491 <td> x
4492 </td></tr></table></dd></dl>
4493 <dl><dd><table>
4494 <tr>
4495 <td> y
4496 </td></tr></table></dd></dl>
4497
4498 !! end
4499
4500 # Parsoid's output (as documented below) differs from php's in this case.
4501 # This is probably a bug. If we fixup parsoid to match php's output, the
4502 # above test should pass and the below test case can be removed. It is
4503 # unclear which output is more desirable.
4504
4505 !! test
4506 Definition Lists: colons and tables 2
4507 !! wikitext
4508 :{|
4509 | x
4510 |}
4511 :{|
4512 | y
4513 |}
4514 !! html/parsoid
4515 <dl><dd><table>
4516 <tr>
4517 <td> x
4518 </td></tr></table></dd>
4519 <dd><table>
4520 <tr>
4521 <td> y
4522 </td></tr></table></dd></dl>
4523 !! end
4524
4525 !! test
4526 Definition Lists: template interaction
4527 !! wikitext
4528 ::{{definition_list}}
4529
4530 :one
4531 ::{{definition_list}}
4532 :::two
4533 :::three
4534 ::four
4535 !! html/parsoid
4536 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4537 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4538
4539 <dl><dd data-parsoid='{}'>one
4540 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4541 </span><dd about="#mwt2">two
4542 <dl><dd>two</dd>
4543 <dd>three</dd></dl></dd>
4544 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4545 !! end
4546
4547
4548 ###
4549 ### External links
4550 ###
4551 !! test
4552 External links: non-bracketed
4553 !! wikitext
4554 Non-bracketed: http://example.com
4555 !! html
4556 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4557 </p>
4558 !! end
4559
4560 # parsoid doesn't explicitly mark autonumbered links, see T55505
4561 !! test
4562 External links: numbered
4563 !! wikitext
4564 Numbered: [http://example.com]
4565 Numbered: [http://example.net]
4566 Numbered: [http://example.com]
4567 !! html/php
4568 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4569 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4570 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4571 </p>
4572 !! html/parsoid
4573 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4574 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4575 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4576 !!end
4577
4578 !! test
4579 External links: specified text
4580 !! wikitext
4581 Specified text: [http://example.com link]
4582 !! html
4583 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4584 </p>
4585 !!end
4586
4587 !! test
4588 External links: trail
4589 !! wikitext
4590 Linktrails should not work for external links: [http://example.com link]s
4591 !! html
4592 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4593 </p>
4594 !! end
4595
4596 !! test
4597 External links: dollar sign in URL
4598 !! wikitext
4599 http://example.com/1$2345
4600 !! html
4601 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4602 </p>
4603 !! end
4604
4605 # parsoid doesn't explicitly mark autonumbered links, see T55505
4606 !! test
4607 External links: dollar sign in URL (autonumber)
4608 !! wikitext
4609 [http://example.com/1$2345]
4610 !! html/php
4611 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4612 </p>
4613 !! html/parsoid
4614 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4615 !!end
4616
4617 !! test
4618 External links: open square bracket forbidden in URL (T6377)
4619 !! options
4620 parsoid=wt2html,wt2wt,html2html
4621 !! wikitext
4622 http://example.com/1[2345
4623 !! html/php
4624 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4625 </p>
4626 !! html/parsoid
4627 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4628 !! end
4629
4630 !! test
4631 External links: open square bracket forbidden in URL (named) (T6377)
4632 !! options
4633 parsoid=wt2html,html2html
4634 !! wikitext
4635 [http://example.com/1[2345]
4636 !! html/php
4637 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4638 </p>
4639 !! html/parsoid
4640 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4641 !!end
4642
4643 # parsoid adds a space before the link name
4644 !! test
4645 External links: open square bracket forbidden in URL (named) (T6377)
4646 Parsoid variant.
4647 !! wikitext
4648 [http://example.com/1 [2345]
4649 !! html
4650 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4651 </p>
4652 !!end
4653
4654 !! test
4655 External links: nowiki in URL link text (T8230)
4656 !! wikitext
4657 [http://example.com/ <nowiki>''example site''</nowiki>]
4658 !! html
4659 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4660 </p>
4661 !! end
4662
4663 !! test
4664 External links: newline forbidden in text (T8230 regression check)
4665 !! wikitext
4666 [http://example.com/ first
4667 second]
4668 !! html
4669 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4670 second]
4671 </p>
4672 !!end
4673
4674 !! test
4675 External links: Pipe char between url and text
4676 !! wikitext
4677 [http://example.com | link]
4678 !! html
4679 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4680 </p>
4681 !!end
4682
4683 !! test
4684 External links: protocol-relative URL in brackets
4685 !! wikitext
4686 [//example.com/ Test]
4687 !! html
4688 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4689 </p>
4690 !! end
4691
4692 # parsoid doesn't explicitly mark autonumbered links, see T55505
4693 !! test
4694 External links: protocol-relative URL in brackets without text
4695 !! wikitext
4696 [//example.com]
4697 !! html/php
4698 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4699 </p>
4700 !! html/parsoid
4701 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4702 !! end
4703
4704 !! test
4705 External links: protocol-relative URL in free text is left alone
4706 !! wikitext
4707 //example.com/Foo
4708 !! html
4709 <p>//example.com/Foo
4710 </p>
4711 !!end
4712
4713 !! test
4714 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4715 !! wikitext
4716 foo//example.com/Foo
4717 !! html
4718 <p>foo//example.com/Foo
4719 </p>
4720 !! end
4721
4722 !! test
4723 External links: with no contents
4724 !! wikitext
4725 [http://en.wikipedia.org/wiki/Foo]
4726
4727 [[wikipedia:Foo|Bar]]
4728
4729 [[wikipedia:Foo|<span>Bar</span>]]
4730 !! html/php
4731 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4732 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4733 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4734 </p>
4735 !! html/parsoid
4736 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4737 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4738 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4739 !! end
4740
4741 !! test
4742 External links: Free with trailing punctuation
4743 !! wikitext
4744 http://example.com,
4745 http://example.com;
4746 http://example.com\
4747 http://example.com.
4748 http://example.com:
4749 http://example.com!
4750 http://example.com?
4751 http://example.com)
4752 http://example.com/url_with_(brackets)
4753 (http://example.com/url_without_brackets)
4754 http://example.com/url_with_entity&amp;
4755 http://example.com/url_with_entity&#x26;
4756 http://example.com/url_with_entity&#038;
4757 http://example.com/url_with_entity&nbsp;
4758 http://example.com/url_with_entity&#xA0;
4759 http://example.com/url_with_entity&#160;
4760 http://example.com/url_with_entity&lt;
4761 http://example.com/url_with_entity&#x3C;
4762 http://example.com/url_with_entity&#60;
4763 !! html/php
4764 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4765 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4766 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4767 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4768 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4769 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4770 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4771 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4772 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4773 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4774 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4775 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4776 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4777 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4778 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4779 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4780 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4781 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4782 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4783 </p>
4784 !! html/parsoid
4785 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4786 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4787 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4788 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4789 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4790 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4791 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4792 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4793 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4794 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4795 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4796 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4797 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4798 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4799 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4800 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4801 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4802 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
4803 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4804 !! end
4805
4806 !! test
4807 External links: tricky Parsoid html2html case
4808 !! options
4809 parsoid=wt2html,wt2wt,html2html
4810 !! wikitext
4811 http://example.com/url_with_entity&amp;amp;
4812 !! html/php
4813 <p><a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;
4814 </p>
4815 !! html/parsoid
4816 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4817 !! end
4818
4819 !! test
4820 External links: Free with trailing quotes (T113666)
4821 !! wikitext
4822 '''News:''' Stuff here
4823
4824 news:'a'b''c''d e
4825 !! html/php
4826 <p><b>News:</b> Stuff here
4827 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4828 </p>
4829 !! html/parsoid
4830 <p><b>News:</b> Stuff here</p>
4831 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4832 !! end
4833
4834 !! test
4835 External links: with entity
4836 !! wikitext
4837 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
4838 !! html/php
4839 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
4840 </p>
4841 !! html/parsoid
4842 <p><a rel="mw:ExtLink" href="http://+www.librarieswithoutborders.org" data-parsoid='{"a":{"href":"http://+www.librarieswithoutborders.org"},"sa":{"href":"http://&amp;#x20;www.librarieswithoutborders.org"}}'>Libraries without borders</a></p>
4843 !! end
4844
4845 !! test
4846 External links: Lone protocols are never linked (T105697)
4847 !! wikitext
4848 http://
4849 http://;
4850 (http://)
4851 bitcoin:
4852 bitcoin:;
4853 (bitcoin:)
4854 !! html
4855 <p>http://
4856 http://;
4857 (http://)
4858 bitcoin:
4859 bitcoin:;
4860 (bitcoin:)
4861 </p>
4862 !! end
4863
4864 !! test
4865 External links: No preceding word characters allowed (T67278)
4866 !! wikitext
4867 NOPEhttp://example.com
4868 N0http://example.com
4869 ok:http://example.com
4870 ok-http://example.com
4871 !! html
4872 <p>NOPEhttp://example.com
4873 N0http://example.com
4874 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4875 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4876 </p>
4877 !! end
4878
4879 !! test
4880 External links: nofollow domain exception
4881 !! wikitext
4882 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4883 !! html
4884 <p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
4885 </p>
4886 !!end
4887
4888 !! test
4889 External image
4890 !! wikitext
4891 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4892 !! html
4893 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4894 </p>
4895 !! end
4896
4897 !! test
4898 External image from https
4899 !! wikitext
4900 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4901 !! html
4902 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4903 </p>
4904 !! end
4905
4906 !! test
4907 External image (when not allowed)
4908 !! options
4909 wgAllowExternalImages=0
4910 !! wikitext
4911 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4912 !! html
4913 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
4914 </p>
4915 !! end
4916
4917 !! test
4918 Link to non-http image, no img tag
4919 !! wikitext
4920 Link to non-http image, no img tag: ftp://example.com/test.jpg
4921 !! html
4922 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
4923 </p>
4924 !! end
4925
4926 !! test
4927 External links: terminating separator
4928 !! wikitext
4929 Terminating separator: http://example.com/thing,
4930 !! html
4931 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4932 </p>
4933 !! end
4934
4935 !! test
4936 External links: intervening separator
4937 !! wikitext
4938 Intervening separator: http://example.com/1,2,3
4939 !! html
4940 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4941 </p>
4942 !! end
4943
4944 !! test
4945 External links: old bug with URL in query
4946 !! wikitext
4947 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4948 !! html
4949 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4950 </p>
4951 !! end
4952
4953 !! test
4954 External links: old URL-in-URL bug, mixed protocols
4955 !! wikitext
4956 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4957 !! html
4958 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4959 </p>
4960 !!end
4961
4962 # Since Parsoid is starting to emit canonical wikitext for links,
4963 # [http://example.com http://example.com] will not RT back to that
4964 # form anymore.
4965 !! test
4966 External links: URL in text
4967 !! options
4968 parsoid=wt2html
4969 !! wikitext
4970 URL in text: [http://example.com http://example.com]
4971 !! html/php
4972 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4973 </p>
4974 !! html/parsoid
4975 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4976 !! end
4977
4978 !! test
4979 External links: Clickable images
4980 !! wikitext
4981 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4982 !! html/php
4983 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/></a>
4984 </p>
4985 !! html/parsoid
4986 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
4987 !! end
4988
4989 !! test
4990 External links: raw ampersand
4991 !! wikitext
4992 Old &amp; use: http://x&y
4993 !! html
4994 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4995 </p>
4996 !! end
4997
4998 !! test
4999 External links: encoded ampersand
5000 !! wikitext
5001 Old &amp; use: http://x&amp;y
5002 !! html/php
5003 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5004 </p>
5005 !! html/parsoid
5006 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
5007 !! end
5008
5009 !! test
5010 External links: encoded equals (T8102)
5011 !! wikitext
5012 http://example.com/?foo&#61;bar
5013 !! html/php
5014 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5015 </p>
5016 !! html/parsoid
5017 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5018 !! end
5019
5020 ##
5021 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5022 ## does it number them. As discussed in T55505, we can identify
5023 ## autonumbered links via CSS.
5024 ##
5025
5026 !! test
5027 External links: [raw ampersand]
5028 !! wikitext
5029 Old &amp; use: [http://x&y]
5030 !! html/php
5031 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5032 </p>
5033 !! html/parsoid
5034 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5035 !! end
5036
5037 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5038 # mode will return the [raw ampersand] wikitext
5039 !! test
5040 External links: [encoded ampersand]
5041 !! options
5042 parsoid=wt2html,wt2wt,html2html
5043 !! wikitext
5044 Old &amp; use: [http://x&amp;y]
5045 !! html/php
5046 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5047 </p>
5048 !! html/parsoid
5049 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5050 !! end
5051
5052 !! test
5053 External links: [raw equals]
5054 !! wikitext
5055 [http://example.com/?foo=bar]
5056 !! html/php
5057 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5058 </p>
5059 !! html/parsoid
5060 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5061 !! end
5062
5063 # note that parsoid html is identical to [raw equals] case; so html2wt
5064 # mode will return the [raw equals] wikitext
5065 !! test
5066 External links: [encoded equals] (T8102)
5067 !! options
5068 parsoid=wt2html,wt2wt,html2html
5069 !! wikitext
5070 [http://example.com/?foo&#61;bar]
5071 !! html/php
5072 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5073 </p>
5074 !! html/parsoid
5075 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5076 !! end
5077
5078 # xxx parsoid strips the IDN character, so the round-trip tests will
5079 # obviously fail and are disabled. --cscott
5080 !! test
5081 External links: [IDN ignored character reference in hostname; strip it right off]
5082 !! options
5083 parsoid=wt2html,wt2wt,html2html
5084 !! wikitext
5085 [http://e&zwnj;xample.com/]
5086 !! html/php
5087 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5088 </p>
5089 !! html/parsoid
5090 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5091 !! end
5092
5093 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5094 # Where an external link could easily circumvent the sanitization of the text of
5095 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5096 # test demands a higher standard. That's a bit strange.
5097 #
5098 # Example:
5099 #
5100 # http://e‌xample.com -> [http://example.com|http://example.com]
5101 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5102 #
5103 # The first example is sanitized, but the second is not. Any security benefits
5104 # from this production are trivial to circumvent. Either remove this test and
5105 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5106 # the test accordingly.
5107 #
5108 # All our love,
5109 # The Parsoid team.
5110 # xxx parsoid strips the IDN character, so the round-trip tests will
5111 # obviously fail and are disabled. --cscott
5112 !! test
5113 External links: IDN ignored character reference in hostname; strip it right off
5114 !! options
5115 parsoid=wt2html,html2html
5116 !! wikitext
5117 http://e&zwnj;xample.com/
5118 !! html/php
5119 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5120 </p>
5121 !! html/parsoid
5122 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5123 !! end
5124
5125 !! test
5126 External links: www.jpeg.org (T2554)
5127 !! wikitext
5128 http://www.jpeg.org
5129 !! html
5130 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5131 </p>
5132 !! end
5133
5134 # parsoid doesn't explicitly mark autonumbered links, see T55505
5135 !! test
5136 External links: URL within URL (T2002)
5137 !! wikitext
5138 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5139 !! html/php
5140 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5141 </p>
5142 !! html/parsoid
5143 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5144 !! end
5145
5146 !! test
5147 T2361: URL inside bracketed URL
5148 !! wikitext
5149 [http://www.example.com/foo http://www.example.com/bar]
5150 !! html
5151 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5152 </p>
5153 !! end
5154
5155 !! test
5156 T2361: URL within URL, not bracketed
5157 !! wikitext
5158 http://www.example.com/foo?=http://www.example.com/bar
5159 !! html
5160 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
5161 </p>
5162 !! end
5163
5164 !! test
5165 T2289: ">"-token in URL-tail
5166 !! wikitext
5167 http://www.example.com/<hello>
5168 !! html
5169 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5170 </p>
5171 !!end
5172
5173 !! test
5174 T2289: literal ">"-token in URL-tail
5175 !! wikitext
5176 http://www.example.com/<b>html</b>
5177 !! html/php
5178 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5179 </p>
5180 !! html/parsoid
5181 <p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
5182 !! end
5183
5184 !! test
5185 T2289: ">"-token in bracketed URL
5186 !! wikitext
5187 [http://www.example.com/<hello> stuff]
5188 !! html
5189 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5190 </p>
5191 !!end
5192
5193 !! test
5194 T2289: literal ">"-token in bracketed URL
5195 !! wikitext
5196 [http://www.example.com/<b>html</b> stuff]
5197 !! html
5198 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5199 </p>
5200 !!end
5201
5202 !! test
5203 T2289: literal double quote at end of URL
5204 !! wikitext
5205 http://www.example.com/"hello"
5206 !! html
5207 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5208 </p>
5209 !!end
5210
5211 !! test
5212 T2289: literal double quote in bracketed URL
5213 !! wikitext
5214 [http://www.example.com/"hello" stuff]
5215 !! html
5216 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5217 </p>
5218 !!end
5219
5220 !! test
5221 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5222 !! wikitext
5223 [http://www.example.com test]
5224 !! html
5225 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5226 </p>
5227 !! end
5228
5229 !! test
5230 External links: link text with spaces
5231 !! wikitext
5232 [http://www.example.com a b c]
5233 [http://www.example.com ''a'' ''b'']
5234 !! html
5235 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5236 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5237 </p>
5238 !! end
5239
5240 !! test
5241 External links: wiki links within external link (T5695)
5242 !! options
5243 parsoid=wt2html,html2html
5244 !! wikitext
5245 [http://example.com [[wikilink]] embedded in ext link]
5246 !! html/php
5247 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5248 </p>
5249 !! html/parsoid
5250 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5251 !! end
5252
5253 !! test
5254 T2787: Links with one slash after the url protocol are invalid
5255 !! wikitext
5256 http:/example.com
5257
5258 [http:/example.com title]
5259 !! html
5260 <p>http:/example.com
5261 </p><p>[http:/example.com title]
5262 </p>
5263 !! end
5264
5265 !! test
5266 Bracketed external links with template-generated invalid target
5267 !! wikitext
5268 [{{echo|http:/example.com}} title]
5269 !! html
5270 <p>[http:/example.com title]
5271 </p>
5272 !! end
5273
5274 !! test
5275 T4702: Mismatched <i>, <b> and <a> tags are invalid
5276 !! wikitext
5277 ''[http://example.com text'']
5278 [http://example.com '''text]'''
5279 ''Something [http://example.com in italic'']
5280 ''Something [http://example.com mixed''''', even bold]'''
5281 '''''Now [http://example.com both''''']
5282 !! html
5283 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5284 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5285 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5286 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5287 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5288 </p>
5289 !! end
5290
5291
5292 !! test
5293 T6781: %26 in URL
5294 !! wikitext
5295 http://www.example.com/?title=AT%26T
5296 !! html/php
5297 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5298 </p>
5299 !! html/parsoid
5300 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5301 !! end
5302
5303 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5304 # % is actually legal in HTML5. Any change in output would need testing though.
5305 !! test
5306 T6781, T7267: %25 in URL
5307 !! wikitext
5308 http://www.example.com/?title=100%25_Bran
5309 !! html/php
5310 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
5311 </p>
5312 !! html/parsoid
5313 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5314 !! end
5315
5316 !! test
5317 T6781, T7267: %28, %29 in URL
5318 !! wikitext
5319 http://www.example.com/?title=Ben-Hur_%281959_film%29
5320 !! html/php
5321 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
5322 </p>
5323 !! html/parsoid
5324 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5325 !! end
5326
5327
5328 !! test
5329 T6781: %26 in autonumber URL
5330 !! wikitext
5331 [http://www.example.com/?title=AT%26T]
5332 !! html/php
5333 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5334 </p>
5335 !! html/parsoid
5336 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5337 !! end
5338
5339 !! test
5340 T6781, T7267: %26 in autonumber URL
5341 !! wikitext
5342 [http://www.example.com/?title=100%25_Bran]
5343 !! html/php
5344 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5345 </p>
5346 !! html/parsoid
5347 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5348 !! end
5349
5350 !! test
5351 T6781, T7267: %28, %29 in autonumber URL
5352 !! wikitext
5353 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5354 !! html/php
5355 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5356 </p>
5357 !! html/parsoid
5358 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5359 !! end
5360
5361
5362 !! test
5363 T6781: %26 in bracketed URL
5364 !! wikitext
5365 [http://www.example.com/?title=AT%26T link]
5366 !! html/php
5367 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5368 </p>
5369 !! html/parsoid
5370 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5371 !! end
5372
5373 !! test
5374 T6781, T7267: %25 in bracketed URL
5375 !! wikitext
5376 [http://www.example.com/?title=100%25_Bran link]
5377 !! html
5378 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5379 </p>
5380 !! end
5381
5382 !! test
5383 T6781, T7267: %28, %29 in bracketed URL
5384 !! wikitext
5385 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5386 !! html/php
5387 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5388 </p>
5389 !! html/parsoid
5390 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5391 !! end
5392
5393 !! test
5394 External link containing a period in the anchor. (T65947)
5395 !! wikitext
5396 [//foo.org/bar#baz. bang]
5397
5398 [//foo.org/bar. bang]
5399 !! html/php
5400 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5401 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5402 </p>
5403 !! html/parsoid
5404 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5405 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5406 !! end
5407
5408 !! test
5409 External link containing a single quote. (T65947)
5410 !! wikitext
5411 [//foo.org/bar'baz]
5412
5413 [//foo.org/bar'baz bang]
5414 !! html/php
5415 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5416 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5417 </p>
5418 !! html/parsoid
5419 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5420 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5421 !! end
5422
5423 !! test
5424 External link containing double-single-quotes in text '' (T6598 sanity check)
5425 !! wikitext
5426 Some [http://example.com/ pretty ''italics'' and stuff]!
5427 !! html
5428 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5429 </p>
5430 !! end
5431
5432 !! test
5433 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5434 !! wikitext
5435 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5436 !! html
5437 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
5438 </p>
5439 !! end
5440
5441 !! test
5442 External link containing double-single-quotes with no space separating the url from text in italics
5443 !! wikitext
5444 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
5445 !! html/php
5446 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
5447 </p>
5448 !! html/php+tidy
5449 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de</a> <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</p>
5450 !! html/parsoid
5451 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5452 !! end
5453
5454 !! test
5455 External link with comments in link text
5456 !! wikitext
5457 [http://www.google.com Google <!-- comment -->]
5458 !! html/php
5459 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5460 </p>
5461 !! html/parsoid
5462 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5463 !! end
5464
5465 !! test
5466 External link to bare IPv4 address
5467 !! wikitext
5468 [http://192.168.0.1 Link]
5469 !! html/php
5470 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5471 </p>
5472 !! html/parsoid
5473 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5474 !! end
5475
5476 !! test
5477 URL-encoding in URL functions (single parameter)
5478 !! wikitext
5479 {{localurl:Some page|amp=&}}
5480 !! html
5481 <p>/index.php?title=Some_page&amp;amp=&amp;
5482 </p>
5483 !! end
5484
5485 !! test
5486 URL-encoding in URL functions (multiple parameters)
5487 !! wikitext
5488 {{localurl:Some page|q=?&amp=&}}
5489 !! html
5490 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5491 </p>
5492 !! end
5493
5494 !! test
5495 Brackets in urls
5496 !! wikitext
5497 http://example.com/index.php?foozoid%5B%5D=bar
5498
5499 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5500 !! html/php
5501 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5502 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5503 </p>
5504 !! html/parsoid
5505 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5506
5507 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar" data-parsoid='{"stx":"url","a":{"href":"http://example.com/index.php?foozoid%5B%5D=bar"},"sa":{"href":"http://example.com/index.php?foozoid&amp;#x5B;&amp;#x5D;=bar"}}'>http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5508 !! end
5509
5510 !! test
5511 IPv6 urls, autolink format (T23261)
5512 !! wikitext
5513 http://[2404:130:0:1000::187:2]/index.php
5514
5515 Examples from RFC 2373, section 2.2:
5516 * http://[1080::8:800:200C:417A]/unicast
5517 * http://[FF01::101]/multicast
5518 * http://[::1]/loopback
5519 * http://[::]/unspecified
5520 * http://[::13.1.68.3]/ipv4compat
5521 * http://[::FFFF:129.144.52.38]/ipv4compat
5522
5523 Examples from RFC 2732, section 2:
5524 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5525 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5526 * http://[3ffe:2a00:100:7031::1]
5527 * http://[1080::8:800:200C:417A]/foo
5528 * http://[::192.9.5.5]/ipng
5529 * http://[::FFFF:129.144.52.38]:80/index.html
5530 * http://[2010:836B:4179::836B:4179]
5531
5532 !! html/php
5533 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
5534 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5535 </p>
5536 <ul><li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5537 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5538 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5539 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5540 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5541 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5542 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5543 </p>
5544 <ul><li> <a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5545 <li> <a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5546 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5547 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5548 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5549 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5550 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5551
5552 !! html/parsoid
5553 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5554
5555 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5556 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5557 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5558 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5559 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5560 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5561 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5562
5563 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5564 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5565 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5566 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5567 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5568 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5569 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5570 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5571 !! end
5572
5573 !! test
5574 IPv6 urls, bracketed format (T23261)
5575 !! wikitext
5576 [http://[2404:130:0:1000::187:2]/index.php test]
5577
5578 Examples from RFC 2373, section 2.2:
5579 * [http://[1080::8:800:200C:417A] unicast]
5580 * [http://[FF01::101] multicast]
5581 * [http://[::1]/ loopback]
5582 * [http://[::] unspecified]
5583 * [http://[::13.1.68.3] ipv4compat]
5584 * [http://[::FFFF:129.144.52.38] ipv4compat]
5585
5586 Examples from RFC 2732, section 2:
5587 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5588 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5589 * [http://[3ffe:2a00:100:7031::1] 3]
5590 * [http://[1080::8:800:200C:417A]/foo 4]
5591 * [http://[::192.9.5.5]/ipng 5]
5592 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5593 * [http://[2010:836B:4179::836B:4179] 7]
5594
5595 !! html/php
5596 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5597 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5598 </p>
5599 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5600 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5601 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5602 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5603 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5604 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5605 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5606 </p>
5607 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5608 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5609 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5610 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5611 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5612 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5613 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5614
5615 !! html/parsoid
5616 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5617
5618 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5619 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5620 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5621 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5622 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5623 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5624 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5625
5626 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5627 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5628 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5629 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5630 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5631 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5632 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5633 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5634 !! end
5635
5636 !! test
5637 Non-extlinks in brackets
5638 !! wikitext
5639 [foo]
5640 [foo bar]
5641 [foo ''bar'']
5642 [fool's] errand
5643 [fool's errand]
5644 [{{echo|foo}}]
5645 [{{echo|foo}} bar]
5646 [{{echo|foo}} ''bar'']
5647 [{{echo|foo}}l's] errand
5648 [{{echo|foo}}l's errand]
5649 [url={{echo|foo}}]
5650 [url=http://example.com]
5651 [http:// bare protocols don't count]
5652 !! html/php
5653 <p>[foo]
5654 [foo bar]
5655 [foo <i>bar</i>]
5656 [fool's] errand
5657 [fool's errand]
5658 [foo]
5659 [foo bar]
5660 [foo <i>bar</i>]
5661 [fool's] errand
5662 [fool's errand]
5663 [url=foo]
5664 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5665 [http:// bare protocols don't count]
5666 </p>
5667 !! html/parsoid
5668 <p>[foo]
5669 [foo bar]
5670 [foo <i>bar</i>]
5671 [fool's] errand
5672 [fool's errand]
5673 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5674 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5675 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5676 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5677 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5678 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5679 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5680 [http:// bare protocols don't count]</p>
5681 !! end
5682
5683 !! test
5684 Percent encoding in external links
5685 !! wikitext
5686 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5687 !! html/php
5688 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5689 </p>
5690 !! html/parsoid
5691 <p><a rel="mw:ExtLink"
5692 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5693 !! end
5694
5695 !! test
5696 Use url link syntax for links where the content is equal the link target
5697 !! wikitext
5698 http://example.com
5699 !! html/php
5700 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5701 </p>
5702 !! html/parsoid
5703 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5704 !! end
5705
5706 !! test
5707 Parenthesis in external links, especially URL links
5708 !! wikitext
5709 http://example.com)
5710
5711 http://example.com/test)
5712
5713 http://example.com/(test)
5714
5715 http://example.com/((test)
5716
5717 (http://example.com/(test))
5718
5719 (http://example.com/(test)))))
5720
5721 http://example.com/a)b
5722
5723 [http://example.com) foo]
5724 !! html/php
5725 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5726 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5727 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5728 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5729 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5730 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5731 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5732 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5733 </p>
5734 !! html/parsoid
5735 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5736 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5737 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5738 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5739 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5740 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5741 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5742 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5743 !! end
5744
5745 !! test
5746 Parenthesis in external links, w/ transclusion or comment
5747 !! wikitext
5748 (http://example.com/{{echo|hi}})
5749
5750 (http://example.com<!-- hi -->)
5751 !! html/php
5752 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5753 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5754 </p>
5755 !! html/parsoid
5756 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5757
5758 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
5759 !! end
5760
5761 !! test
5762 Serialize <a> tags with invalid link targets as plain text
5763 !! options
5764 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5765 !! html/parsoid
5766 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5767 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5768 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5769 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5770 !! wikitext
5771 text
5772 <nowiki>*</nowiki>text
5773 <nowiki>[[foo]]</nowiki>
5774 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5775 !! end
5776
5777 !! test
5778 mw:ExtLink -vs- mw:WikiLink (T94723)
5779 !! options
5780 parsoid=html2wt
5781 !! html/parsoid
5782 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5783 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5784 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5785 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5786 <p>
5787 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5788 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5789 </p>
5790 !! wikitext
5791 [[Foo|Bar]]
5792 [[Foo|Bar]]
5793 [[wikipedia:Foo|Bar]]
5794 [[wikipedia:Foo|Bar]]
5795
5796 [[wikipedia:European_Robin|European Robin]]
5797 [[wikipedia:European_Robin|European Robin]]
5798 !! end
5799
5800 !! test
5801 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5802 !! options
5803 parsoid=wt2wt
5804 !! wikitext
5805 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5806 !! html/parsoid
5807 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5808 !! end
5809
5810
5811 ###
5812 ### Quotes
5813 ###
5814
5815 !! test
5816 Quotes
5817 !! wikitext
5818 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5819
5820 Normal text. '''''Bold italic text.''''' Normal text.
5821 !! html
5822 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5823 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5824 </p>
5825 !! end
5826
5827
5828 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5829 # parser strips. The wikitext contains just the first half of the bold
5830 # quote pair.
5831 !! test
5832 Unclosed and unmatched quotes
5833 !! wikitext
5834 '''''Bold italic text '''with bold deactivated''' in between.'''''
5835
5836 '''''Bold italic text ''with italic deactivated'' in between.'''''
5837
5838 '''Bold text..
5839
5840 ..spanning two paragraphs (should not work).'''
5841
5842 '''Bold tag left open
5843
5844 ''Italic tag left open
5845
5846 Normal text.
5847
5848 <!-- Unmatching number of opening, closing tags: -->
5849 '''This year''''s election ''should'' beat '''last year''''s.
5850
5851 ''Tom'''s car is bigger than ''Susan'''s.
5852
5853 Plain ''italic'''s plain
5854 !! html/php
5855 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5856 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5857 </p><p><b>Bold text..</b>
5858 </p><p>..spanning two paragraphs (should not work).
5859 </p><p><b>Bold tag left open</b>
5860 </p><p><i>Italic tag left open</i>
5861 </p><p>Normal text.
5862 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5863 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5864 </p><p>Plain <i>italic'</i>s plain
5865 </p>
5866 !! html/parsoid
5867 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5868 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5869 </p><p><b>Bold text..</b>
5870 </p><p>..spanning two paragraphs (should not work).<b></b>
5871 </p><p><b>Bold tag left open</b>
5872 </p><p><i>Italic tag left open</i>
5873 </p><p>Normal text.
5874 </p>
5875 <!-- Unmatching number of opening, closing tags: -->
5876 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5877 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5878 </p><p>Plain <i>italic'</i>s plain
5879 </p>
5880 !! end
5881
5882 ###
5883 ### Tables
5884 ###
5885 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5886 ###
5887
5888 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5889 # is the bare minimum required by the spec, see:
5890 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5891 # Parsoid team replies: empty table tags are legal in HTML5
5892 !! test
5893 A table with no data.
5894 !! options
5895 parsoid=wt2html
5896 !! wikitext
5897 {||}
5898 !! html/php
5899
5900 !! html/parsoid
5901 <table></table>
5902
5903 !! end
5904
5905 !! test
5906 A table with stray table end tags on start tag line (wt2html)
5907 !! options
5908 parsoid=wt2html
5909 !! wikitext
5910 {|style="color: red;"|}
5911
5912 {|style="color: red;" |}
5913 |foo
5914 |}
5915
5916 {|style="color: red;"|} id="foo"
5917 |foo
5918 |}
5919
5920 {|style="color: red;" |} id="foo"
5921 |foo
5922 |}
5923 !! html
5924 <table style="color: red;"></table>
5925
5926 <table style="color: red;">
5927 <tbody><tr>
5928 <td>foo</td>
5929 </tr></tbody>
5930 </table>
5931
5932 <table style="color: red;" id="foo">
5933 <tbody><tr>
5934 <td>foo</td>
5935 </tr></tbody>
5936 </table>
5937
5938 <table style="color: red;" id="foo">
5939 <tbody><tr>
5940 <td>foo</td>
5941 </tr></tbody>
5942 </table>
5943
5944 !! end
5945
5946 !! test
5947 A table with no data (take 2)
5948 !! wikitext
5949 {|
5950 |}
5951 !! html/parsoid
5952 <table></table>
5953 !! end
5954
5955 # A table with nothing but a caption is invalid XHTML, we might want to render
5956 # this as <p>caption</p>
5957 # Parsoid team replies: table with only a caption is legal in HTML5
5958 !! test
5959 A table with nothing but a caption
5960 !! wikitext
5961 {|
5962 |+ caption
5963 |}
5964 !! html/php
5965 <table>
5966 <caption> caption
5967 </caption><tr><td></td></tr></table>
5968
5969 !! html/parsoid
5970 <table><caption> caption</caption></table>
5971 !! end
5972
5973 !! test
5974 A table with caption with default-spaced attributes and a table row
5975 !! wikitext
5976 {|
5977 |+ style="color: red;" | caption1
5978 |-
5979 | foo
5980 |}
5981 !! html
5982 <table>
5983 <caption style="color: red;"> caption1
5984 </caption>
5985 <tr>
5986 <td> foo
5987 </td></tr></table>
5988
5989 !! end
5990
5991 !! test
5992 A table with captions with non-default spaced attributes and a table row
5993 !! wikitext
5994 {|
5995 |+style="color: red;"|caption2
5996 |+ style="color: red;"| caption3
5997 |-
5998 | foo
5999 |}
6000 !! html
6001 <table>
6002 <caption style="color: red;">caption2
6003 </caption>
6004 <caption style="color: red;"> caption3
6005 </caption>
6006 <tr>
6007 <td> foo
6008 </td></tr></table>
6009
6010 !! end
6011
6012 !! test
6013 Table td-cell syntax variations
6014 !! wikitext
6015 {|
6016 | foo bar foo | baz
6017 | foo bar foo || baz
6018 | style='color:red;' | baz
6019 | style='color:red;' || baz
6020 |}
6021 !! html
6022 <table>
6023 <tr>
6024 <td> baz
6025 </td>
6026 <td> foo bar foo </td>
6027 <td> baz
6028 </td>
6029 <td style="color:red;"> baz
6030 </td>
6031 <td> style='color:red;' </td>
6032 <td> baz
6033 </td></tr></table>
6034
6035 !! end
6036
6037 !! test
6038 Simple table
6039 !! wikitext
6040 {|
6041 | 1 || 2
6042 |-
6043 | 3 || 4
6044 |}
6045 !! html
6046 <table>
6047 <tr>
6048 <td> 1 </td>
6049 <td> 2
6050 </td></tr>
6051 <tr>
6052 <td> 3 </td>
6053 <td> 4
6054 </td></tr></table>
6055
6056 !! end
6057
6058 !! test
6059 Simple table but with multiple dashes for row wikitext
6060 !! wikitext
6061 {|
6062 | foo
6063 |-----
6064 | bar
6065 |}
6066 !! html
6067 <table>
6068 <tr>
6069 <td> foo
6070 </td></tr>
6071 <tr>
6072 <td> bar
6073 </td></tr></table>
6074
6075 !! end
6076
6077 !! test
6078 Multiplication table
6079 !! wikitext
6080 {| border="1" cellpadding="2"
6081 |+Multiplication table
6082 |-
6083 ! &times; !! 1 !! 2 !! 3
6084 |-
6085 ! 1
6086 | 1 || 2 || 3
6087 |-
6088 ! 2
6089 | 2 || 4 || 6
6090 |-
6091 ! 3
6092 | 3 || 6 || 9
6093 |-
6094 ! 4
6095 | 4 || 8 || 12
6096 |-
6097 ! 5
6098 | 5 || 10 || 15
6099 |}
6100 !! html
6101 <table border="1" cellpadding="2">
6102 <caption>Multiplication table
6103 </caption>
6104 <tr>
6105 <th> &#215; </th>
6106 <th> 1 </th>
6107 <th> 2 </th>
6108 <th> 3
6109 </th></tr>
6110 <tr>
6111 <th> 1
6112 </th>
6113 <td> 1 </td>
6114 <td> 2 </td>
6115 <td> 3
6116 </td></tr>
6117 <tr>
6118 <th> 2
6119 </th>
6120 <td> 2 </td>
6121 <td> 4 </td>
6122 <td> 6
6123 </td></tr>
6124 <tr>
6125 <th> 3
6126 </th>
6127 <td> 3 </td>
6128 <td> 6 </td>
6129 <td> 9
6130 </td></tr>
6131 <tr>
6132 <th> 4
6133 </th>
6134 <td> 4 </td>
6135 <td> 8 </td>
6136 <td> 12
6137 </td></tr>
6138 <tr>
6139 <th> 5
6140 </th>
6141 <td> 5 </td>
6142 <td> 10 </td>
6143 <td> 15
6144 </td></tr></table>
6145
6146 !! end
6147
6148 !! test
6149 Accept "||" in table headings
6150 !! wikitext
6151 {|
6152 !h1 || h2
6153 |}
6154 !! html
6155 <table>
6156 <tr>
6157 <th>h1 </th>
6158 <th> h2
6159 </th></tr></table>
6160
6161 !! end
6162
6163 !! test
6164 Accept "!!" in table data
6165 !! wikitext
6166 {|
6167 | Foo!! ||
6168 |}
6169 !! html
6170 <table>
6171 <tr>
6172 <td> Foo!! </td>
6173 <td>
6174 </td></tr></table>
6175
6176 !! html/parsoid
6177 <table>
6178 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
6179 </tbody></table>
6180 !! end
6181
6182 !! test
6183 Accept "||" in indented table headings
6184 !! wikitext
6185 :{|
6186 !h1 || h2
6187 |}
6188 !! html
6189 <dl><dd><table>
6190 <tr>
6191 <th>h1 </th>
6192 <th> h2
6193 </th></tr></table></dd></dl>
6194
6195 !! end
6196
6197 !! test
6198 Accept "!!" in templates
6199 !! wikitext
6200 {|
6201 !a {{echo|b!!c}}
6202 |}
6203 !! html/php
6204 <table>
6205 <tr>
6206 <th>a b</th>
6207 <th>c
6208 </th></tr></table>
6209
6210 !! html/parsoid
6211 <table>
6212 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
6213 !! end
6214
6215 !! test
6216 Accept "!!" in table headings after newline
6217 !! wikitext
6218 {|
6219 !a
6220 b!!c
6221 |}
6222 !! html/php
6223 <table>
6224 <tr>
6225 <th>a
6226 <p>b!!c
6227 </p>
6228 </th></tr></table>
6229
6230 !! html/parsoid
6231 <table>
6232 <tbody><tr><th>a
6233 <p>b!!c</p></th></tr>
6234 </tbody></table>
6235 !! end
6236
6237 !! test
6238 Accept "!!" in table data of mixed wikitext / html syntax
6239 !! wikitext
6240 {|
6241 !a
6242 <tr><td>b!!c</td></tr>
6243 |}
6244 !! html+tidy
6245 <table>
6246 <tr>
6247 <th>a</th>
6248 </tr>
6249 <tr>
6250 <td>b!!c</td>
6251 </tr>
6252 </table>
6253 !! html/parsoid
6254 <table>
6255 <tbody><tr><th>a</th></tr>
6256 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6257 </tbody></table>
6258 !! end
6259
6260 !! test
6261 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6262 !! wikitext
6263 {|
6264 !| h1
6265 || a
6266 |}
6267 !! html
6268 <table>
6269 <tr>
6270 <th> h1
6271 </th>
6272 <td> a
6273 </td></tr></table>
6274
6275 !! end
6276
6277 !!test
6278 Accept "| !" at start of line in tables (ignore !-attribute)
6279 !! wikitext
6280 {|
6281 |-
6282 | !style="color:red" | bar
6283 |}
6284 !! html
6285 <table>
6286
6287 <tr>
6288 <td> bar
6289 </td></tr></table>
6290
6291 !!end
6292
6293 !!test
6294 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
6295 !! wikitext
6296 {|
6297 |-
6298 |style='color:red;'|+1
6299 |style='color:blue;'|-1
6300 |-
6301 | 1 || 2 || 3
6302 | 1 ||+2 ||-3
6303 |-
6304 | +1
6305 | -1
6306 |}
6307 !! html
6308 <table>
6309
6310 <tr>
6311 <td style="color:red;">+1
6312 </td>
6313 <td style="color:blue;">-1
6314 </td></tr>
6315 <tr>
6316 <td> 1 </td>
6317 <td> 2 </td>
6318 <td> 3
6319 </td>
6320 <td> 1 </td>
6321 <td>+2 </td>
6322 <td>-3
6323 </td></tr>
6324 <tr>
6325 <td> +1
6326 </td>
6327 <td> -1
6328 </td></tr></table>
6329
6330 !!end
6331
6332 !! test
6333 Table rowspan
6334 !! wikitext
6335 {| border=1
6336 | Cell 1, row 1
6337 |rowspan=2| Cell 2, row 1 (and 2)
6338 | Cell 3, row 1
6339 |-
6340 | Cell 1, row 2
6341 | Cell 3, row 2
6342 |}
6343 !! html
6344 <table border="1">
6345 <tr>
6346 <td> Cell 1, row 1
6347 </td>
6348 <td rowspan="2"> Cell 2, row 1 (and 2)
6349 </td>
6350 <td> Cell 3, row 1
6351 </td></tr>
6352 <tr>
6353 <td> Cell 1, row 2
6354 </td>
6355 <td> Cell 3, row 2
6356 </td></tr></table>
6357
6358 !! end
6359
6360 !! test
6361 Nested table
6362 !! wikitext
6363 {| border=1
6364 | &alpha;
6365 |
6366 {| bgcolor=#ABCDEF border=2
6367 |nested
6368 |-
6369 |table
6370 |}
6371 |the original table again
6372 |}
6373 !! html
6374 <table border="1">
6375 <tr>
6376 <td> &#945;
6377 </td>
6378 <td>
6379 <table bgcolor="#ABCDEF" border="2">
6380 <tr>
6381 <td>nested
6382 </td></tr>
6383 <tr>
6384 <td>table
6385 </td></tr></table>
6386 </td>
6387 <td>the original table again
6388 </td></tr></table>
6389
6390 !! end
6391
6392 !! test
6393 Invalid attributes in table cell (T3830)
6394 !! wikitext
6395 {|
6396 |Cell:|broken
6397 |}
6398 !! html
6399 <table>
6400 <tr>
6401 <td>broken
6402 </td></tr></table>
6403
6404 !! end
6405
6406 !! test
6407 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6408 !! wikitext
6409 {|
6410 | title="foo" |bar
6411 | title="foo<nowiki>|</nowiki>" |bar
6412 | title="foo<nowiki>|</nowiki>" bar
6413 |}
6414 !! html/php
6415 <table>
6416 <tr>
6417 <td title="foo">bar
6418 </td>
6419 <td title="foo&#124;">bar
6420 </td>
6421 <td> title="foo|" bar
6422 </td></tr></table>
6423
6424 !! html/parsoid
6425 <table>
6426 <tbody><tr><td title="foo">bar</td>
6427 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6428 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6429 </tbody></table>
6430 !! end
6431
6432 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6433 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6434 # *2wt modes will fail.
6435 !! test
6436 Table security: embedded pipes
6437 !! options
6438 parsoid=wt2html,html2html
6439 !! wikitext
6440 {|
6441 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6442 !! html/php
6443 <table>
6444 <tr>
6445 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6446 <td>]" onmouseover="alert(document.cookie)"&gt;test
6447 </td>
6448 </tr>
6449 </table>
6450
6451 !! html/parsoid
6452 <table><tbody>
6453 <tr>
6454 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'>[<a rel="mw:ExtLink" href="ftp://%7Cx" data-parsoid='{"stx":"url","a":{"href":"ftp://%7Cx"},"sa":{"href":"ftp://|x"}}'>ftp://%7Cx</a></td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'>]" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6455 !! end
6456
6457 !! test
6458 Element attributes with double ! should not be broken up by <th>
6459 !! wikitext
6460 {|
6461 ! hi <div class="!!">ha</div> ho
6462 |}
6463 !! html/php
6464 <table>
6465 <tr>
6466 <th> hi <div class="!!">ha</div> ho
6467 </th></tr></table>
6468
6469 !! html/parsoid
6470 <table>
6471 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6472 </tbody></table>
6473 !! end
6474
6475 !! test
6476 ! and || in element attributes should not be parsed as <th>/<td>
6477 !! wikitext
6478 {|
6479 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6480 |}
6481 !! html/php
6482 <table>
6483 <tr>
6484 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6485 </td></tr></table>
6486
6487 !! html/parsoid
6488 <table>
6489 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6490 </tbody></table>
6491 !! end
6492
6493 # FIXME: The output seems broken. Filed as T110268.
6494 !! test
6495 ! and || in td attributes should not be parsed as <th>/<td>
6496 !! options
6497 parsoid=wt2html
6498 !! wikitext
6499 {|
6500 | style="color: red !important;" data-contrived="put this here ||" | foo
6501 |}
6502 !! html/php
6503 <table>
6504 <tr>
6505 <td> style="color: red !important;" data-contrived="put this here </td>
6506 <td> foo
6507 </td></tr></table>
6508
6509 !! html/parsoid
6510 <table>
6511 <tbody><tr><td> style="color: red !important;" data-contrived="put this here </td><td data-parsoid='{"stx_v":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'> foo</td></tr>
6512 </tbody></table>
6513 !! end
6514
6515 !! test
6516 Break on | in element attribute in template
6517 !! options
6518 parsoid=wt2html,html2html
6519 !! wikitext
6520 {{echo|1=<div class="hi|ho">ha</div>}}
6521 !! html/php
6522 <p>ho"&gt;ha&lt;/div&gt;
6523 </p>
6524 !! html/parsoid
6525 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</span>
6526 !! end
6527
6528 !! test
6529 Break on | in element attribute name in template
6530 !! wikitext
6531 {{echo|<div cla|ss="hiho">ha</div>}}
6532 !! html/parsoid
6533 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"ss","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div cla"},"ss":{"wt":"\"hiho\">ha&lt;/div>"}},"i":0}}]}'>&lt;div cla</p>
6534 !! end
6535
6536 !! test
6537 Don't break on | in extension attribute in template
6538 !! wikitext
6539 {{echo|<ref name="hi|ho">ha</ref>}}
6540
6541 <references />
6542 !! html/parsoid
6543 <p><span about="#mwt2" class="mw-ref" id="cite_ref-hi.7Cho_1-0" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref name=\"hi|ho\">ha&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-hi.7Cho-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
6544
6545 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-hi.7Cho-1" id="cite_note-hi.7Cho-1"><a href="./Main_Page#cite_ref-hi.7Cho_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-hi.7Cho-1" class="mw-reference-text">ha</span></li></ol>
6546 !! end
6547
6548 ## We don't support roundtripping of these attributes in Parsoid.
6549 ## Selective serialization takes care of preventing dirty diffs.
6550 ## But, on edits, we dirty-diff the invalid attribute text.
6551 !! test
6552 Invalid text in table attributes should be discarded
6553 !! options
6554 parsoid=wt2html
6555 !! wikitext
6556 {| <span>boo</span> style='border:1px solid black'
6557 | <span>boo</span> style='color:blue' | 1
6558 |<span>boo</span> style='color:blue'| 2
6559 |}
6560 !! html/php
6561 <table style="border:1px solid black">
6562 <tr>
6563 <td style="color:blue"> 1
6564 </td>
6565 <td style="color:blue"> 2
6566 </td></tr></table>
6567
6568 !! html/parsoid
6569 <table style="border:1px solid black">
6570 <tr>
6571 <td style="color:blue"> 1</td>
6572 <td style="color:blue"> 2</td>
6573 </tr>
6574 </table>
6575 !! end
6576
6577 !! test
6578 Invalid text in table attributes should be preserved by selective serializer
6579 !! options
6580 parsoid={
6581 "modes": ["selser"],
6582 "changes": [
6583 ["td:first-child", "text", "abc"],
6584 ["td + td", "text", "xyz"]
6585 ]
6586 }
6587 !! wikitext
6588 {| <span>boo</span> style='border:1px solid black'
6589 | <span>boo</span> style='color:blue' | 1
6590 |<span>boo</span> style='color:blue'| 2
6591 |}
6592 !! wikitext/edited
6593 {| <span>boo</span> style='border:1px solid black'
6594 | <span>boo</span> style='color:blue' |abc
6595 |<span>boo</span> style='color:blue'|xyz
6596 |}
6597 !! end
6598
6599 !! test
6600 1. Template-generated table cell attributes and cell content
6601 !! wikitext
6602 {|
6603 |{{table_attribs}}
6604 | {{table_attribs}}
6605 || {{table_attribs_5}}
6606 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6607 |align=center {{table_attribs}}
6608 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6609 |}
6610 !! html
6611 <table>
6612 <tr>
6613 <td style="color:red;">Foo
6614 </td>
6615 <td style="color:red;">Foo
6616 </td>
6617 <td> style="color:red;"</td>
6618 <td>Bar
6619 </td>
6620 <td style="color:red;">Foo
6621 </td>
6622 <td align="center" style="color:red;">Foo
6623 </td>
6624 <td align="center" style="color:red;">Foo
6625 </td></tr></table>
6626
6627 !! end
6628
6629 !! test
6630 2. Template-generated table cell attributes and cell content
6631 !! wikitext
6632 {|
6633 |{{table_attribs_2}}
6634 |}
6635 !! html/php
6636 <table>
6637 <tr>
6638 <td style="color:red;">Foo
6639 </td>
6640 <td>Bar</td>
6641 <td>Baz
6642 </td></tr></table>
6643
6644 !! html/parsoid
6645 <table>
6646 <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
6647 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6648 </tbody></table>
6649 !! end
6650
6651 !! test
6652 3. Template-generated table cell attributes and cell content
6653 !! wikitext
6654 {|
6655 !align=center {{table_header_cells}}
6656 |-
6657 |align=center {{table_cells}}
6658 |}
6659 !! html/php
6660 <table>
6661 <tr>
6662 <th align="center" style="color:red;">Foo</th>
6663 <th style="color:red;"><i>Bar</i></th>
6664 <th style="color:brown;"><i>Foo</i> and Baz
6665 </th></tr>
6666 <tr>
6667 <td align="center" style="color:red;">Foo</td>
6668 <td style="color:red;"><i>Bar</i></td>
6669 <td style="color:brown;"><i>Foo</i> and Baz
6670 </td></tr></table>
6671
6672 !! html/parsoid
6673 <table>
6674 <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
6675 <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
6676 </tbody></table>
6677 !! end
6678
6679 !! test
6680 4. Template-generated table cell attributes and cell content inside a templated table
6681 !! wikitext
6682 {{tbl-start}}
6683 !align=center {{table_header_cells}}
6684 |-
6685 |align=center {{table_cells}}
6686 {{tbl-end}}
6687 !! html/php
6688 <table>
6689 <tr>
6690 <th align="center" style="color:red;">Foo</th>
6691 <th style="color:red;"><i>Bar</i></th>
6692 <th style="color:brown;"><i>Foo</i> and Baz
6693 </th></tr>
6694 <tr>
6695 <td align="center" style="color:red;">Foo</td>
6696 <td style="color:red;"><i>Bar</i></td>
6697 <td style="color:brown;"><i>Foo</i> and Baz
6698 </td></tr></table>
6699
6700 !! html/parsoid
6701 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
6702 <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
6703 <tr>
6704 <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
6705 </tbody></table>
6706 !! end
6707
6708 ## Edge case fix to prevent future regressions
6709 !! test
6710 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6711 !! wikitext
6712 {|
6713 |{{table_attribs_7}}
6714 |}
6715 <references />
6716 !! html/parsoid
6717 <table>
6718 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<span class="mw-ref" id="cite_ref-1" rel="dc:references" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></td></tr>
6719 </tbody></table>
6720 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
6721 !! end
6722
6723 !! test
6724 Table with row followed by newlines and table heading
6725 !! options
6726 parsoid=wt2html,html2html
6727 !! wikitext
6728 {|
6729 |-
6730
6731 ! foo
6732 |}
6733 !! html/*
6734 <table>
6735
6736
6737 <tr>
6738 <th> foo
6739 </th></tr></table>
6740
6741 !! end
6742
6743 !! test
6744 Table with empty line following the start tag
6745 !! options
6746 parsoid=wt2html,html2html
6747 !! wikitext
6748 {|
6749
6750 |-
6751 | foo
6752 |}
6753 !! html/*
6754 <table>
6755
6756
6757 <tr>
6758 <td> foo
6759 </td></tr></table>
6760
6761 !! end
6762
6763 !! test
6764 Table attributes with empty value
6765 !! options
6766 parsoid=wt2html,html2html
6767 !! wikitext
6768 {|
6769 | style=| hello
6770 |}
6771 !! html/php
6772 <table>
6773 <tr>
6774 <td style=""> hello
6775 </td></tr></table>
6776
6777 !! html/parsoid
6778 <table>
6779 <tbody><tr><td style=""> hello</td></tr>
6780 </tbody></table>
6781 !! end
6782
6783 !! test
6784 Wikitext table with a lot of comments
6785 !! wikitext
6786 {|
6787 <!-- c0 -->
6788 | foo
6789 <!-- c1 -->
6790 |-<!-- c2 -->
6791 <!-- c3 -->
6792 |<!-- c4 -->
6793 <!-- c5 -->
6794 |}
6795 !! html
6796 <table>
6797 <tr>
6798 <td> foo
6799 </td></tr>
6800 <tr>
6801 <td>
6802 </td></tr></table>
6803
6804 !! end
6805
6806 !! test
6807 Wikitext table comments represented in parsoid dom
6808 !! wikitext
6809 {|<!--c1--><!--c2-->
6810 |-<!--c3-->
6811 | x
6812 |}
6813 !! html/php+tidy
6814 <table>
6815 <tr>
6816 <td>x</td>
6817 </tr>
6818 </table>
6819 !! html/parsoid
6820 <table><!--c1--><!--c2-->
6821 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6822 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6823 </tbody></table>
6824 !! end
6825
6826 !! test
6827 Wikitext table with double-line table cell
6828 !! wikitext
6829 {|
6830 |a
6831 b
6832 |}
6833 !! html
6834 <table>
6835 <tr>
6836 <td>a
6837 <p>b
6838 </p>
6839 </td></tr></table>
6840
6841 !! end
6842
6843 !! test
6844 Table cell with a single comment
6845 !! wikitext
6846 {|
6847 | <!-- c1 -->
6848 | a
6849 |}
6850 !! html
6851 <table>
6852 <tr>
6853 <td>
6854 </td>
6855 <td> a
6856 </td></tr></table>
6857
6858 !! end
6859
6860 !! test
6861 Table-cell after a comment-only-empty-line
6862 !! wikitext
6863 {|
6864 |a
6865 <!--c1-->
6866 <!--c2-->| b
6867 |}
6868 !! html
6869 <table>
6870 <tr>
6871 <td>a
6872 </td>
6873 <td> b
6874 </td></tr></table>
6875
6876 !! html/parsoid
6877 <table>
6878 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6879 <!--c1-->
6880 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6881 </tbody></table>
6882
6883 !! end
6884
6885 !! test
6886 Build table with {{!}}
6887 !! wikitext
6888 {{{!}} class="wikitable"
6889 ! header
6890 ! second header
6891 {{!}}- style="color:red;"
6892 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6893 {{!}}}
6894 !! html
6895 <table class="wikitable">
6896 <tr>
6897 <th> header
6898 </th>
6899 <th> second header
6900 </th></tr>
6901 <tr style="color:red;">
6902 <td> data </td>
6903 <td style="color:red;"> second data
6904 </td></tr></table>
6905
6906 !! end
6907
6908 !! test
6909 Build table with pipe as data
6910 !! wikitext
6911 {| class="wikitable"
6912 ! header
6913 ! second header
6914 |- style="color:red;"
6915 | data || style="color:red;" | second data
6916 |-
6917 | style="color:red;" | data with | || style="color:red;" | second data with |
6918 |-
6919 || data with | ||| second data with |
6920 |}
6921 !! html
6922 <table class="wikitable">
6923 <tr>
6924 <th> header
6925 </th>
6926 <th> second header
6927 </th></tr>
6928 <tr style="color:red;">
6929 <td> data </td>
6930 <td style="color:red;"> second data
6931 </td></tr>
6932 <tr>
6933 <td style="color:red;"> data with | </td>
6934 <td style="color:red;"> second data with |
6935 </td></tr>
6936 <tr>
6937 <td> data with | </td>
6938 <td> second data with |
6939 </td></tr></table>
6940
6941 !! end
6942
6943 !! test
6944 Build table with wikilink
6945 !! wikitext
6946 {| class="wikitable"
6947 ! header || second header
6948 |- style="color:red;"
6949 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6950 |-
6951 | data || second data [[Main Page|link|text with pipe]]
6952 |}
6953 !! html
6954 <table class="wikitable">
6955 <tr>
6956 <th> header </th>
6957 <th> second header
6958 </th></tr>
6959 <tr style="color:red;">
6960 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6961 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6962 </td></tr>
6963 <tr>
6964 <td> data </td>
6965 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6966 </td></tr></table>
6967
6968 !! end
6969
6970 # The expected HTML structure in this test is debatable. The PHP parser does
6971 # not parse this kind of table at all. The main focus for Parsoid is on
6972 # round-tripping, so this output is ok for now. TODO: revisit!
6973 !! test
6974 Wikitext table with html-syntax row
6975 !! wikitext
6976 {|
6977 |-
6978 <td>foo</td>
6979 |}
6980 !! html/parsoid
6981 <table>
6982 <tbody>
6983 <tr>
6984 <td>foo</td></tr></tbody></table>
6985 !! end
6986
6987 !! test
6988 Implicit <td> after a |-
6989 !! options
6990 parsoid=wt2html,html2html
6991 !! wikitext
6992 {|
6993 |-
6994 a
6995 |}
6996 !! html/php
6997 <table>
6998
6999 a
7000 </table>
7001
7002 !! html/php+tidy
7003 <p>a</p>
7004 !! html/parsoid
7005 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>a</p><table>
7006 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7007
7008 </tr></tbody></table>
7009 !! end
7010
7011 !! test
7012 Lists should be recognized in an implicit <td> context
7013 !! options
7014 parsoid=wt2html,html2html
7015 !! wikitext
7016 {|
7017 |-
7018 *a
7019 |}
7020 !! html/php
7021 <table>
7022
7023 <ul><li>a</li></ul>
7024 </table>
7025
7026 !! html/php+tidy
7027 <ul>
7028 <li>a</li>
7029 </ul>
7030 !! html/parsoid
7031 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7032 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7033
7034 </tr></tbody></table>
7035 !! end
7036
7037 !! test
7038 Table cells not properly parsed in an implicit-td context
7039 !! wikitext
7040 {|
7041 |-
7042 {{table_attribs_4}} || a || b
7043 |}
7044 !! html/php+tidy
7045 <table>
7046 <tr>
7047 <td style="background-color:#DC241f;" width="10px"></td>
7048 <td>a</td>
7049 <td>b</td>
7050 </tr>
7051 </table>
7052 !! html/parsoid
7053 <table>
7054 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7055 <td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," || a || b"]}'> </td><td about="#mwt1"> a </td><td about="#mwt1"> b</td></tr>
7056 !! end
7057
7058 !! test
7059 Parsoid: Round-trip tables directly followed by content (T53219)
7060 !! options
7061 parsoid=wt2html,wt2wt
7062 !! wikitext
7063 {|
7064 |foo
7065 |} bar
7066
7067 {|
7068 |baz
7069 |}<b>quux</b>
7070 !! html+tidy
7071 <table>
7072 <tr>
7073 <td>foo</td>
7074 </tr>
7075 </table>
7076 <p>bar</p>
7077 <table>
7078 <tr>
7079 <td>baz</td>
7080 </tr>
7081 </table>
7082 <p><b>quux</b></p>
7083 !! end
7084
7085 !! test
7086 Parsoid: Default to a newline after tables in new content (T53219)
7087 !! options
7088 parsoid=html2wt
7089 !! html/parsoid
7090 <table><tbody>
7091 <tr><td>foo</td></tr></tbody></table> bar
7092 <table><tbody>
7093 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7094 !! wikitext
7095 {|
7096 |foo
7097 |}
7098 <nowiki> </nowiki>bar
7099 {|
7100 |baz
7101 |}
7102 '''quux'''
7103 !! end
7104
7105 !! test
7106 Parsoid: newline inducing block nodes don't suppress <nowiki>
7107 !! options
7108 parsoid=html2wt
7109 !! html/parsoid
7110 a<h1>foo</h1>
7111 !! wikitext
7112 <nowiki> </nowiki>a
7113
7114 = foo =
7115 !! end
7116
7117 !! test
7118 Parsoid: Row-syntax table headings followed by comment & table cells
7119 !! options
7120 parsoid=wt2html,wt2wt
7121 !! wikitext
7122 {|
7123 ! foo || bar
7124 <!-- foo --> || baz || quux
7125 |}
7126 !! html/php
7127 <table>
7128 <tr>
7129 <th> foo </th>
7130 <th> bar
7131 </th>
7132 <td> baz </td>
7133 <td> quux
7134 </td></tr></table>
7135
7136 !! html/parsoid
7137 <table>
7138 <tbody><tr><th> foo </th><th> bar
7139 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7140 </tbody></table>
7141 !! end
7142
7143 !!test
7144 Parsoid: Recover better from broken table attributes
7145 !!options
7146 parsoid=wt2html
7147 !!wikitext
7148 {| class="foo
7149 | class="bar" |
7150 foo
7151 |}
7152 !!html/php+tidy
7153 <table class="foo">
7154 <tr>
7155 <td class="bar">
7156 <p>foo</p>
7157 </td>
7158 </tr>
7159 </table>
7160 !!html/parsoid
7161 <table class="foo">
7162 <tr>
7163 <td class="bar">
7164 <p>foo</p></td></tr>
7165 </tbody></table>
7166 !!end
7167
7168 !! test
7169 Tables: Digest broken attributes on table and tr tag
7170 !! options
7171 parsoid=wt2html
7172 !! wikitext
7173 {| || |} ++
7174 |- || || ++ --
7175 |- > [
7176 |}
7177 !! html
7178 <table>
7179 <tbody>
7180 <tr></tr>
7181 <tr></tr>
7182 </tbody></table>
7183 !! end
7184
7185 # T137406: Whitespace in the HTML
7186 !! test
7187 1. Generate correct wikitext for tables with thead/tbody/tfoot
7188 !! options
7189 parsoid=html2wt
7190 !! html/parsoid
7191 <table>
7192 <caption>Test</caption>
7193 <thead>
7194 <tr>
7195 <th>Month</th>
7196 <th>Savings</th>
7197 </tr>
7198 </thead>
7199 <tbody>
7200 <tr>
7201 <td>January</td>
7202 <td>$100</td>
7203 </tr>
7204 <tr>
7205 <td>February</td>
7206 <td>$80</td>
7207 </tr>
7208 </tbody>
7209 <tfoot>
7210 <tr>
7211 <td>Sum</td>
7212 <td>$180</td>
7213 </tr>
7214 </tfoot>
7215 </table>
7216 !! wikitext
7217 {|
7218 |+Test
7219 !Month
7220 !Savings
7221 |-
7222 |January
7223 |$100
7224 |-
7225 |February
7226 |$80
7227 |-
7228 |Sum
7229 |$180
7230 |}
7231 !! html/php+tidy
7232 <table>
7233 <caption>Test</caption>
7234 <tr>
7235 <th>Month</th>
7236 <th>Savings</th>
7237 </tr>
7238 <tr>
7239 <td>January</td>
7240 <td>$100</td>
7241 </tr>
7242 <tr>
7243 <td>February</td>
7244 <td>$80</td>
7245 </tr>
7246 <tr>
7247 <td>Sum</td>
7248 <td>$180</td>
7249 </tr>
7250 </table>
7251 !! end
7252
7253 # T137406: No whitespace in the HTML
7254 !! test
7255 2. Generate correct wikitext for tables with thead/tbody/tfoot
7256 !! options
7257 parsoid=html2wt
7258 !! html/parsoid
7259 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7260 !! wikitext
7261 {|
7262 !heading
7263 |-
7264 |foo
7265 |}
7266 !! end
7267
7268 !! test
7269 Testing serialization after deletion in references
7270 !! options
7271 parsoid={
7272 "modes": ["wt2wt"],
7273 "changes": [
7274 ["#x", "remove"]
7275 ]
7276 }
7277 !! wikitext
7278 hi <ref><div id="x">ho</div></ref>
7279
7280 <references />
7281 !! wikitext/edited
7282 hi <ref></ref>
7283
7284 <references />
7285 !! end
7286
7287 !!test
7288 Testing serialization after deletion of table cells
7289 !!options
7290 parsoid={
7291 "modes": ["wt2wt", "selser"],
7292 "changes": [
7293 ["#x", "remove"]
7294 ]
7295 }
7296 !!wikitext
7297 {|
7298 !h1 !!h2 !!h3
7299 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7300 |}
7301 !! wikitext/edited
7302 {|
7303 !h1 !!h2 !!h3
7304 |c2 |||c3
7305 |}
7306 !!end
7307
7308 !! test
7309 Testing selser after addition of new row before first row (T125419)
7310 !! options
7311 parsoid={
7312 "modes": ["wt2wt", "selser"],
7313 "changes": [
7314 [ "tr", "before", "<tr><td>X</td></tr>" ]
7315 ]
7316 }
7317 !! wikitext
7318 {|
7319 |a
7320 |}
7321 !! wikitext/edited
7322 {|
7323 |X
7324 |-
7325 |a
7326 |}
7327 !! end
7328
7329 !! test
7330 Serialize new table rows in a HTML table using HTML tags
7331 !! options
7332 parsoid={
7333 "modes": ["wt2wt", "selser"],
7334 "changes": [
7335 [ "tr", "before", "<tr><td>X</td></tr>" ]
7336 ]
7337 }
7338 !! wikitext
7339 <table><tr><td>a</td></tr></table>
7340 !! wikitext/edited
7341 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7342 !! end
7343
7344 !! test
7345 Serialize new table cells in a HTML row using HTML tags
7346 !! options
7347 parsoid={
7348 "modes": ["wt2wt", "selser"],
7349 "changes": [
7350 [ "td", "before", "<td>X</td>" ]
7351 ]
7352 }
7353 !! wikitext
7354 <table><tr><td>a</td></tr></table>
7355 !! wikitext/edited
7356 <table><tr><td>X</td><td>a</td></tr></table>
7357 !! end
7358
7359 !! test
7360 Wikitext tables can be nested inside HTML tables
7361 !! options
7362 parsoid=html2wt
7363 !! html
7364 <table data-parsoid='{"stx":"html"}'>
7365 <tr><td>
7366 <table>
7367 <tr><td>foo</td></tr>
7368 </table>
7369 </td></tr>
7370 </table>
7371 !! wikitext
7372 <table>
7373 <tr><td>
7374 {|
7375 |foo
7376 |}
7377 </td></tr>
7378 </table>
7379 !! end
7380
7381 !! test
7382 Serialize wikitext list items as HTML list items when embedded in a HTML list
7383 !! options
7384 parsoid=html2wt
7385 !! html
7386 <ul data-parsoid='{"stx": "html"}'>
7387 <li data-parsoid='{}'>a</li>
7388 <li>b</li>
7389 </ul>
7390 !! wikitext
7391 <ul>
7392 <li>a</li>
7393 <li>b</li>
7394 </ul>
7395 !! end
7396
7397 # SSS FIXME: Is this actually a good thing given the
7398 # odd nested list output that is generated by MW?
7399 # <ul><li>foo<ul>..</ul></li></ul> instead of
7400 # <ul><li>foo</li><ul>..</ul></ul>
7401 !! test
7402 Wikitext lists can be nested inside HTML lists
7403 !! options
7404 parsoid=html2wt
7405 !! html
7406 <ul data-parsoid='{"stx": "html"}'>
7407 <li data-parsoid='{"stx": "html"}'>a
7408 <ul><li>b</li></ul>
7409 </li>
7410 </ul>
7411
7412 <ul data-parsoid='{"stx": "html"}'>
7413 <li>x
7414 <ul><li>y</li></ul>
7415 </li>
7416 </ul>
7417 !! wikitext
7418 <ul>
7419 <li>a
7420 * b
7421 </li>
7422 </ul>
7423
7424 <ul>
7425 <li>x
7426 * y
7427 </li>
7428 </ul>
7429 !! end
7430
7431 ###
7432 ### Internal links
7433 ###
7434 !! test
7435 Plain link, capitalized
7436 !! wikitext
7437 [[Main Page]]
7438 !! html
7439 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7440 </p>
7441 !! end
7442
7443 !! test
7444 Plain link, uncapitalized
7445 !! wikitext
7446 [[main Page]]
7447 !! html
7448 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7449 </p>
7450 !! end
7451
7452 !! test
7453 Piped link
7454 !! wikitext
7455 [[Main Page|The Main Page]]
7456 !! html
7457 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7458 </p>
7459 !! end
7460
7461 !! test
7462 Piped link with comment in link text
7463 !! wikitext
7464 [[Main Page|The Main<!--front--> Page]]
7465 !! html
7466 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7467 </p>
7468 !! end
7469
7470 !! test
7471 Piped link with multiple pipe characters in link text
7472 !! wikitext
7473 [[Main Page||The|Main|Page|]]
7474 !! html/php
7475 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7476 </p>
7477 !! html/parsoid
7478 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7479 !! end
7480
7481 !! test
7482 Piped link with no link text
7483 !! wikitext
7484 [[Thomas Bek (bishop of St David's)|]]
7485 !! html/php
7486 <p>[[Thomas Bek (bishop of St David's)|]]
7487 </p>
7488 !! html/parsoid
7489 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7490 !! end
7491
7492 !! test
7493 Piped link with empty link text
7494 !! wikitext
7495 [[Main Page|<nowiki/>]] - empty nowiki
7496 [[Main Page| ]] - empty space
7497 [[Main Page|&nbsp;]] - empty non breaking space
7498 !! html/php
7499 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7500 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7501 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7502 </p>
7503 !! html/parsoid
7504 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7505 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7506 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></a> - empty non breaking space</p>
7507 !! end
7508
7509 !! test
7510 Broken link
7511 !! wikitext
7512 [[Zigzagzogzagzig]]
7513 !! html
7514 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7515 </p>
7516 !! end
7517
7518 !! test
7519 Broken link with fragment
7520 !! wikitext
7521 [[Zigzagzogzagzig#zug]]
7522 !! html
7523 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7524 </p>
7525 !! end
7526
7527 !! test
7528 Special page link with fragment
7529 !! wikitext
7530 [[Special:Version#anchor]]
7531 !! html
7532 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7533 </p>
7534 !! end
7535
7536 !! test
7537 Nonexistent special page link with fragment
7538 !! wikitext
7539 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7540 !! html
7541 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7542 </p>
7543 !! end
7544
7545 !! test
7546 Link with prefix
7547 !! wikitext
7548 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7549 !! html
7550 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7551 </p>
7552 !! end
7553
7554 !! test
7555 Link with suffix
7556 !! wikitext
7557 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7558 !! html
7559 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
7560 </p>
7561 !! end
7562
7563 !! article
7564 prefixed article
7565 !! text
7566 Some text
7567 !! endarticle
7568
7569 !! test
7570 T45661: Piped links with identical prefixes
7571 !! wikitext
7572 [[prefixed article|prefixed articles with spaces]]
7573
7574 [[prefixed article|prefixed articlesaoeu]]
7575
7576 [[Main Page|Main Page test]]
7577 !! html
7578 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7579 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7580 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7581 </p>
7582 !! end
7583
7584
7585 !! test
7586 Link with HTML entity in suffix / tail
7587 !! wikitext
7588 [[Main Page]]&quot;, [[Main Page]]&#97;
7589 !! html/php
7590 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
7591 </p>
7592 !! html/parsoid
7593 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;quot;","srcContent":"\""}'>"</span>, <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#97;","srcContent":"a"}'>a</span></p>
7594 !! end
7595
7596 !! test
7597 Link with 3 brackets
7598 !! wikitext
7599 [[[Main Page]]]
7600 Foo [[[Main Page]]]
7601 !! html
7602 <p>[[[Main Page]]]
7603 Foo [[[Main Page]]]
7604 </p>
7605 !! end
7606
7607 !! test
7608 Link with 4 brackets
7609 !! wikitext
7610 [[[[Main Page]]]]
7611 !! html
7612 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7613 </p>
7614 !! end
7615
7616 !! test
7617 Piped link with 3 brackets
7618 !! wikitext
7619 [[[main page|the main page]]]
7620 !! html
7621 <p>[[[main page|the main page]]]
7622 </p>
7623 !! end
7624
7625 !! test
7626 Piped link with extlink-like text
7627 !! wikitext
7628 [[Main Page|[bar]]]
7629 [[Main Page|This is a [bar]]]
7630 !! html/php
7631 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7632 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7633 </p>
7634 !! html/parsoid
7635 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7636 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7637 !! end
7638
7639 !! test
7640 Link with multiple pipes
7641 !! wikitext
7642 [[Main Page|The|Main|Page]]
7643 !! html
7644 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7645 </p>
7646 !! end
7647
7648 !! test
7649 Anchor containing a #. (T65430)
7650 !! wikitext
7651 [[Main Page#And#Link]]
7652 !! html/php
7653 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7654 </p>
7655 !! html/parsoid
7656 <p><a rel="mw:WikiLink" href="./Main_Page#And.23Link" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#And.23Link"},"sa":{"href":"Main Page#And#Link"}}'>Main Page#And#Link</a></p>
7657 !! end
7658
7659 !! test
7660 Link to namespaces
7661 !! wikitext
7662 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7663 !! html
7664 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
7665 </p>
7666 !! end
7667
7668 !! test
7669 Link with space in namespace
7670 !! wikitext
7671 [[User talk:Foo bar]]
7672 !! html
7673 <p><a href="/index.php?title=User_talk:Foo_bar&amp;action=edit&amp;redlink=1" class="new" title="User talk:Foo bar (page does not exist)">User talk:Foo bar</a>
7674 </p>
7675 !! end
7676
7677 !! article
7678 MemoryAlpha:AlphaTest
7679 !! text
7680 This is an article in the MemoryAlpha namespace
7681 (which shadows the memoryalpha interwiki link).
7682 !! endarticle
7683
7684 !! test
7685 Namespace takes precedence over interwiki link (T53680)
7686 !! wikitext
7687 [[MemoryAlpha:AlphaTest]]
7688 !! html
7689 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7690 </p>
7691 !! end
7692
7693 # The previous test doesn't work correctly in html2*, due to not recognizing the
7694 # link as an internal one. This one checks for the correct behavior.
7695 !! test
7696 Link to namespace preferred over interwiki with correct rel attribute
7697 !! options
7698 parsoid=html2wt,html2html
7699 !! html/parsoid
7700 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7701 !! wikitext
7702 [[MemoryAlpha:AlphaTest]]
7703 !! end
7704
7705 !! test
7706 Piped link to namespace
7707 !! wikitext
7708 [[Meta:Disclaimers|The disclaimers]]
7709 !! html
7710 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
7711 </p>
7712 !! end
7713
7714 !! test
7715 Link containing }
7716 !! wikitext
7717 [[Usually caused by a typo (oops}]]
7718 !! html
7719 <p>[[Usually caused by a typo (oops}]]
7720 </p>
7721 !! end
7722
7723 !! article
7724 7% Solution
7725 !! text
7726 Just a test of an article title containing a percent.
7727 !! endarticle
7728
7729 !! test
7730 Link containing % (not as a hex sequence)
7731 !! wikitext
7732 [[7% Solution]]
7733 [[7% Solution|7%25 Solution]]
7734 !! html/php
7735 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7736 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7737 </p>
7738 !! html/parsoid
7739 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7740 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7741 !! end
7742
7743 # note that the parsoid HTML is identical to the previous test output,
7744 # so the previous test ensures that the html2wt mode will generate the
7745 # "not as a hex sequence" wikitext.
7746 !! test
7747 Link containing % as a single hex sequence interpreted to char
7748 !! options
7749 parsoid=wt2wt,wt2html,html2html
7750 !! wikitext
7751 [[7%25 Solution]]
7752 [[7%25 Solution|7%25 Solution]]
7753 !! html/php
7754 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7755 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7756 </p>
7757 !! html/parsoid
7758 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7759 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7760 !!end
7761
7762 !! test
7763 Link containing % as a double hex sequence interpreted to hex sequence
7764 !! wikitext
7765 [[7%2525 Solution]]
7766 !! html
7767 <p>[[7%2525 Solution]]
7768 </p>
7769 !!end
7770
7771 ## Example for such a section: == < ==
7772 !! test
7773 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7774 !! wikitext
7775 [[%23%3c]][[%23%3e]]
7776 !! html/php
7777 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7778 </p>
7779 !! html/parsoid
7780 <p><a rel="mw:WikiLink" href="./Main_Page#.3C" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#.3C"},"sa":{"href":"%23%3c"}}'>#&lt;</a><a rel="mw:WikiLink" href="./Main_Page#.3E" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#.3E"},"sa":{"href":"%23%3e"}}'>#></a></p>
7781 !! end
7782
7783 !! test
7784 Link containing "<#" and ">#" as a hex sequences
7785 !! wikitext
7786 [[%3c%23]][[%3e%23]]
7787 !! html
7788 <p>[[%3c%23]][[%3e%23]]
7789 </p>
7790 !! end
7791
7792 !! test
7793 Link containing an equals sign
7794 !! wikitext
7795 [[Special:BookSources/isbn=4-00-026157-6]]
7796 !! html/php
7797 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
7798 </p>
7799 !! html/parsoid
7800 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
7801 !! end
7802
7803 !! article
7804 Foo~bar
7805 !! text
7806 Just a test of an article title containing a tilde.
7807 !! endarticle
7808
7809 # note that links containing signatures, like [[Foo~~~~]], are
7810 # massaged by the pre-save transform (PST) and so the tildes are never
7811 # seen by the parser.
7812 !! test
7813 Link containing a tilde
7814 !! wikitext
7815 [[Foo~bar]]
7816 !! html/php
7817 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7818 </p>
7819 !! html/parsoid
7820 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7821 !! end
7822
7823 !! test
7824 Link containing double-single-quotes '' (T6598)
7825 !! wikitext
7826 [[Lista d''e paise d''o munno]]
7827 !! html/php
7828 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
7829 </p>
7830 !! html/parsoid
7831 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a></p>
7832 !! end
7833
7834 !! test
7835 Link containing double quotes and spaces
7836 !! wikitext
7837 [[Cool "Gator"]]
7838 !! html/php
7839 <p><a href="/index.php?title=Cool_%22Gator%22&amp;action=edit&amp;redlink=1" class="new" title="Cool &quot;Gator&quot; (page does not exist)">Cool "Gator"</a>
7840 </p>
7841 !! html/parsoid
7842 <p><a rel="mw:WikiLink" href="./Cool_%22Gator%22" title='Cool "Gator"'>Cool "Gator"</a></p>
7843 !! end
7844
7845 !! test
7846 File containing double quotes and spaces
7847 !! wikitext
7848 [[File:Cool "Gator".png]]
7849 !! html/parsoid
7850 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Cool_%22Gator%22.png" data-parsoid='{"a":{"href":"./File:Cool_%22Gator%22.png"},"sa":{"href":"File:Cool \"Gator\".png"}}'><img resource='./File:Cool_"Gator".png' src="./Special:FilePath/Cool_%22Gator%22.png" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Cool_\"Gator\".png","height":"220","width":"220","src":"./Special:FilePath/Cool_%22Gator%22.png"},"sa":{"resource":"File:Cool \"Gator\".png","src":"./Special:FilePath/Cool_\"Gator\".png"}}'/></a></span></p>
7851 !! end
7852
7853 !! test
7854 Redirect containing double quotes and spaces
7855 !! wikitext
7856 #REDIRECT [[Cool "Gator"]]
7857 !! html/parsoid
7858 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
7859 !! end
7860
7861 !! test
7862 Link containing double-single-quotes '' in text (T6598 sanity check)
7863 !! wikitext
7864 Some [[Link|pretty ''italics'' and stuff]]!
7865 !! html/php
7866 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
7867 </p>
7868 !! html/parsoid
7869 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7870 !! end
7871
7872 !! test
7873 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
7874 !! wikitext
7875 ''Some [[Link|pretty ''italics'' and stuff]]!''
7876 !! html
7877 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
7878 </p>
7879 !! end
7880
7881 !! test
7882 Link with double quotes in title part (literal) and alternate part (interpreted)
7883 !! wikitext
7884 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7885
7886 [[''Pentecoste'']]
7887
7888 [[''Pentecoste''|Pentecoste]]
7889
7890 [[''Pentecoste''|''Pentecoste'']]
7891 !! html/php
7892 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
7893 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
7894 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
7895 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
7896 </p>
7897 !! html/parsoid
7898 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></span></p>
7899 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7900 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7901 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7902 !! end
7903
7904 !! test
7905 Broken image links with HTML captions (T41700)
7906 !! wikitext
7907 [[File:Nonexistent|<script></script>]]
7908 [[File:Nonexistent|100x100px|<script></script>]]
7909 [[File:Nonexistent|&lt;]]
7910 [[File:Nonexistent|a<i>b</i>c]]
7911 !! html/php
7912 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7913 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7914 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7915 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7916 </p>
7917 !! html/parsoid
7918 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7919 <span typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"100","width":"100"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7920 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;lt;\",\"srcContent\":\"&amp;lt;\",\"dsr\":[107,111,null,null]}&#39;>&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7921 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"a&lt;i>b&lt;/i>c"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[134,142,3,4]}&#39;>b&lt;/i>c"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span></p>
7922 !! end
7923
7924 !! test
7925 Plain link to URL
7926 !! wikitext
7927 [[http://www.example.com]]
7928 !! html/php
7929 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7930 </p>
7931 !! html/parsoid
7932 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7933 !! end
7934
7935 !! test
7936 Plain link to URL with link text
7937 !! wikitext
7938 [[http://www.example.com Link text]]
7939 !! html
7940 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7941 </p>
7942 !! end
7943
7944 !! test
7945 Plain link to protocol-relative URL
7946 !! wikitext
7947 [[//www.example.com]]
7948 !! html/php
7949 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7950 </p>
7951 !! html/parsoid
7952 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7953 !! end
7954
7955 !! test
7956 Plain link to protocol-relative URL with link text
7957 !! wikitext
7958 [[//www.example.com Link text]]
7959 !! html
7960 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7961 </p>
7962 !! end
7963
7964 !! test
7965 Plain link to page with question mark in title
7966 !! wikitext
7967 [[A?b]]
7968
7969 [[A?b|Baz]]
7970 !! html
7971 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7972 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7973 </p>
7974 !! end
7975
7976
7977 # I'm fairly sure the expected result here is wrong.
7978 # We want these to be URL links, not pseudo-pages with URLs for titles....
7979 # However the current output is also pretty screwy.
7980 #
7981 # ----
7982 # I'm changing it to match the current output--it arguably makes more
7983 # sense in the light of the test above. Old expected result was:
7984 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7985 #</p>
7986 # But I think this test is bordering on "garbage in, garbage out" anyway.
7987 # -- wtm
7988 !! test
7989 Piped link to URL
7990 !! wikitext
7991 Piped link to URL: [[http://www.example.com|an example URL]]
7992 !! html/php
7993 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7994 </p>
7995 !! html/parsoid
7996 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com%7Can" data-parsoid='{"a":{"href":"http://www.example.com%7Can"},"sa":{"href":"http://www.example.com|an"}}'>example URL</a>]</p>
7997 !! end
7998
7999 !! test
8000 T2002: [[page|http://url/]] should link to page, not http://url/
8001 !! wikitext
8002 [[Main Page|http://url/]]
8003 !! html/php
8004 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8005 </p>
8006 !! html/parsoid
8007 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8008 !! end
8009
8010 # Parsoid does not mark self-links, by design.
8011 !! test
8012 T2337: Escaped self-links should be bold
8013 !! options
8014 title=[[Bug462]]
8015 !! wikitext
8016 [[Bu&#103;462]] [[Bug462]]
8017 !! html/php
8018 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8019 </p>
8020 !! html/php+tidy
8021 <p><a class="mw-selflink selflink">Bug462</a> <a class="mw-selflink selflink">Bug462</a></p>
8022 !! html/parsoid
8023 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8024 !! end
8025
8026 !! test
8027 Self-link to section should not be bold
8028 !! options
8029 title=[[Main Page]]
8030 !! wikitext
8031 [[Main Page#section]]
8032 !! html
8033 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8034 </p>
8035 !! end
8036
8037 !! article
8038 00
8039 !! text
8040 This is 00.
8041 !! endarticle
8042
8043 !!test
8044 Self-link to numeric title
8045 !!options
8046 title=[[0]]
8047 !! wikitext
8048 [[0]]
8049 !! html
8050 <p><a class="mw-selflink selflink">0</a>
8051 </p>
8052 !!end
8053
8054 !!test
8055 Link to numeric-equivalent title
8056 !!options
8057 title=[[0]]
8058 !! wikitext
8059 [[00]]
8060 !! html
8061 <p><a href="/wiki/00" title="00">00</a>
8062 </p>
8063 !!end
8064
8065 !! test
8066 <nowiki> inside a link
8067 !! wikitext
8068 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8069 !! html
8070 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8071 </p>
8072 !! end
8073
8074 !! test
8075 Non-breaking spaces in title
8076 !! wikitext
8077 [[&nbsp; Main &nbsp; Page &nbsp;]]
8078 !! html
8079 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8080 </p>
8081 !!end
8082
8083 !! test
8084 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8085 !! options
8086 language=ca
8087 !! wikitext
8088 '''[[Main Page]]'''
8089 !! html
8090 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8091 </p>
8092 !! end
8093
8094 !! test
8095 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8096 !! options
8097 language=ca
8098 !! wikitext
8099 ''[[Main Page]]''
8100 !! html
8101 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8102 </p>
8103 !! end
8104
8105 !! test
8106 Internal link with en linktrail: no apostrophes (T29473)
8107 !! options
8108 language=en
8109 !! wikitext
8110 [[Something]]'nice
8111 !! html
8112 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8113 </p>
8114 !! end
8115
8116 !! test
8117 Internal link with ca linktrail with apostrophes (T29473)
8118 !! options
8119 language=ca
8120 !! wikitext
8121 [[Something]]'nice
8122 !! html
8123 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8124 </p>
8125 !! end
8126
8127 !! test
8128 Internal link with kaa linktrail with apostrophes (T29473)
8129 !! options
8130 language=kaa
8131 !! wikitext
8132 [[Something]]'nice
8133 !! html
8134 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
8135 </p>
8136 !! end
8137
8138 !! test
8139 Link with multiple ":" in a subpage-supporting namespace (T65636)
8140 !! wikitext
8141 [[User:Foo/Test/63636:Bar|Test]]
8142 !! html/php
8143 <p><a href="/index.php?title=User:Foo/Test/63636:Bar&amp;action=edit&amp;redlink=1" class="new" title="User:Foo/Test/63636:Bar (page does not exist)">Test</a>
8144 </p>
8145 !! html/parsoid
8146 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8147 !! end
8148
8149 ## Mainly a sanity check for Parsoid
8150 !! test
8151 Handle title parsing for subpages
8152 !! options
8153 title=[[/123123]]
8154 subpage
8155 !! wikitext
8156 123
8157 !! html/php
8158 <p>123
8159 </p>
8160 !! html/parsoid
8161 <p>123</p>
8162 !! end
8163
8164 !! article
8165 User:Test/123
8166 !! text
8167 test 123
8168 !! endarticle
8169
8170 !! test
8171 Link to a subpage from a namespace other than main
8172 !! options
8173 title=[[User:Test]]
8174 subpage
8175 !! wikitext
8176 [[/123]]
8177 !! html/php
8178 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8179 </p>
8180 !! html/parsoid
8181 <p><a rel="mw:WikiLink" href="./User:Test/123" title="User:Test/123" data-parsoid='{"stx":"simple","a":{"href":"./User:Test/123"},"sa":{"href":"/123"}}'>/123</a></p>
8182 !! end
8183
8184 !! test
8185 Ensure that transclusion titles are not url-decoded
8186 !! options
8187 subpage title=[[Test]]
8188 parsoid=wt2html
8189 !! wikitext
8190 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8191 !! html/php
8192 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8193 </p>
8194 !! html/parsoid
8195 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8196 !! end
8197
8198 !! test
8199 Purely hash wikilink
8200 !! options
8201 title=[[User:Test/123]]
8202 subpage
8203 !! wikitext
8204 [[#a|b]]
8205 !! html/php
8206 <p><a href="#a">b</a>
8207 </p>
8208 !! html/parsoid
8209 <p><a rel="mw:WikiLink" href="./User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"./User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
8210 !! end
8211
8212 !! test
8213 1. Interaction of linktrail and template encapsulation
8214 !! wikitext
8215 {{echo|[[Foo]]}}l
8216 !! html/parsoid
8217 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
8218 !! end
8219
8220 !! test
8221 2. Interaction of linktrail and template encapsulation
8222 !! options
8223 parsoid
8224 !! wikitext
8225 {{echo|Some [[Fool]]}}s
8226 !! html
8227 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
8228 !! end
8229
8230 !! test
8231 3. Interaction of linktrail and template encapsulation
8232 !! options
8233 parsoid
8234 !! wikitext
8235 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8236 !! html
8237 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p>
8238 !! end
8239
8240 !! article
8241 Söfnuður
8242 !! text
8243 Test.
8244 !! endarticle
8245
8246 !! test
8247 Internal link with is link prefix
8248 !! options
8249 language=is
8250 !! wikitext
8251 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8252 !! html
8253 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8254 </p>
8255 !! end
8256
8257 !! article
8258 Mótmælendatrú
8259 !! text
8260 Test.
8261 !! endarticle
8262
8263 !! test
8264 Internal link with is link trail and link prefix
8265 !! options
8266 language=is
8267 !! wikitext
8268 [[mótmælendatrú|xxx]]ar
8269 [[mótmælendatrú]]ar
8270 mótmælenda[[söfnuður]]
8271 mótmælenda[[söfnuður|söfnuðir]]
8272 mótmælenda[[söfnuður|söfnuðir]]xxx
8273 !! html
8274 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8275 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8276 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8277 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8278 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8279 </p>
8280 !! end
8281
8282 !! test
8283 Parsoid link trail escaping
8284 !! options
8285 parsoid=html2wt,html2html
8286 !! html/parsoid
8287 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8288 !! wikitext
8289 [[apple]]<nowiki/>s
8290 !! end
8291
8292 !! test
8293 Parsoid link prefix escaping
8294 !! options
8295 language=is
8296 parsoid=html2wt,html2html
8297 !! html/parsoid
8298 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8299 !! wikitext
8300 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8301 !! end
8302
8303 !! test
8304 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8305 !! wikitext
8306 [[Foo| bar]]
8307
8308 [[Foo| ''bar'']]
8309
8310 [http://wp.org foo]
8311
8312 [http://wp.org ''foo'']
8313 !! html
8314 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8315 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8316 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8317 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8318 </p>
8319 !! end
8320
8321 !! test
8322 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8323 !! wikitext
8324 [[Foo|{{echo|a}} b {{echo|c}}]]
8325 !! html/parsoid
8326 <p><a rel="mw:WikiLink" href="./Foo" title="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
8327 !! end
8328
8329 !! test
8330 Link with angle bracket after anchor
8331 !! wikitext
8332 [[Foo#<bar>]]
8333 !! html/php
8334 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8335 </p>
8336 !! html/parsoid
8337 <p><a rel="mw:WikiLink" href="./Foo#.3Cbar.3E" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#.3Cbar.3E"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
8338 !! end
8339
8340 ###
8341 ### Interwiki links (see maintenance/interwiki.sql)
8342 ###
8343
8344 !! test
8345 Inline interwiki link
8346 !! options
8347 parsoid=wt2html,wt2wt,html2html
8348 !! wikitext
8349 [[MeatBall:SoftSecurity]]
8350 !! html/php
8351 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8352 </p>
8353 !! html/parsoid
8354 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8355 !! end
8356
8357 !! test
8358 Inline interwiki link with empty title (T4372)
8359 !! options
8360 parsoid=wt2html,wt2wt,html2html
8361 !! wikitext
8362 [[MeatBall:]]
8363 !! html/php
8364 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8365 </p>
8366 !! html/parsoid
8367 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8368 !! end
8369
8370 !! test
8371 Interwiki link encoding conversion (T3636)
8372 !! wikitext
8373 *[[Wikipedia:ro:Olteni&#0355;a]]
8374 *[[Wikipedia:ro:Olteni&#355;a]]
8375 !! html
8376 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li>
8377 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li></ul>
8378
8379 !! html+tidy
8380 <ul>
8381 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8382 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8383 </ul>
8384 !! end
8385
8386 !! test
8387 Interwiki link with fragment (T4130)
8388 !! wikitext
8389 [[MeatBall:SoftSecurity#foo]]
8390 !! html
8391 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8392 </p>
8393 !! end
8394
8395 !! test
8396 Link scenarios with escaped fragments
8397 !! wikitext
8398 [[#Is this great?]]
8399 [[Foo#Is this great?]]
8400 [[meatball:Foo#Is this great?]]
8401 !! html/php
8402 <p><a href="#Is_this_great.3F">#Is this great?</a>
8403 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8404 <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
8405 </p>
8406 !! html/parsoid
8407 <p><a rel="mw:WikiLink" href="./Main_Page#Is_this_great.3F" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Is_this_great.3F"},"sa":{"href":"#Is this great?"}}'>#Is this great?</a>
8408 <a rel="mw:WikiLink" href="./Foo#Is_this_great.3F" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#Is_this_great.3F"},"sa":{"href":"Foo#Is this great?"}}'>Foo#Is this great?</a>
8409 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" title="meatball:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F"},"sa":{"href":"meatball:Foo#Is this great?"},"isIW":true}'>meatball:Foo#Is this great?</a></p>
8410 !! end
8411
8412 # Ideally the wikipedia: prefix here should be proto-relative too
8413 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8414 # define the 'en' prefix, and originally the test used 'wikipedia',
8415 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8416 # article.
8417 !! test
8418 Different interwiki prefixes mapping to the same URL
8419 !! wikitext
8420 [[:en:Foo]]
8421
8422 [[:en:Foo|Foo]]
8423
8424 [[wikipedia:Foo]]
8425
8426 [[:wikipedia:Foo|Foo]]
8427
8428 [[wikipedia:en:Foo]]
8429
8430 [[:wikipedia:en:Foo]]
8431
8432 [[ wikiPEdia :Foo]]
8433 !! html/parsoid
8434 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">en:Foo</a></p>
8435
8436 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">Foo</a></p>
8437
8438 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">wikipedia:Foo</a></p>
8439
8440 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":":wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">Foo</a></p>
8441
8442 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8443
8444 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8445
8446 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":" wikiPEdia :Foo"},"isIW":true}' title="wikipedia:Foo"> wikiPEdia :Foo</a></p>
8447 !! end
8448
8449 !! test
8450 Interwiki links that cannot be represented in wiki syntax
8451 !! wikitext
8452 [[meatball:ok]]
8453 [[meatball:ok#foo|ok with fragment]]
8454 [[meatball:ok_as_well?|ok ending with ? mark]]
8455 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8456 [http://de.wikipedia.org/wiki/#foo is just fragment]
8457
8458 !! html/php
8459 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8460 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8461 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" class="extiw" title="meatball:ok as well?">ok ending with ? mark</a>
8462 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8463 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8464 </p>
8465 !! html/parsoid
8466 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8467 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8468 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?" title="meatball:ok as well?">ok ending with ? mark</a>
8469 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8470 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8471 !! end
8472
8473 !! test
8474 Interwiki links: trail
8475 !! wikitext
8476 [[wikipedia:Foo|Ba]]r
8477 !! html/php
8478 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8479 </p>
8480 !! html/parsoid
8481 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}' title="wikipedia:Foo">Bar</a></p>
8482 !! end
8483
8484 !! test
8485 Local interwiki link
8486 !! options
8487 parsoid=wt2html,wt2wt,html2html
8488 !! wikitext
8489 [[local:Template:Foo]]
8490 !! html/php
8491 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8492 </p>
8493 !! html/parsoid
8494 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8495 !! end
8496
8497 # Parsoid does not mark self-links, by design.
8498 !! test
8499 Local interwiki link: self-link to current page
8500 !! options
8501 title=[[Main Page]]
8502 parsoid=wt2html,wt2wt,html2html
8503 !! wikitext
8504 [[local:Main Page]]
8505 !! html/php
8506 <p><a class="mw-selflink selflink">local:Main Page</a>
8507 </p>
8508 !! html/parsoid
8509 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8510 !! end
8511
8512 !! test
8513 Local interwiki link: prefix only (T66167)
8514 !! options
8515 parsoid=wt2html,wt2wt,html2html
8516 !! wikitext
8517 [[local:]]
8518 !! html/php
8519 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8520 </p>
8521 !! html/parsoid
8522 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8523 !! end
8524
8525 !! test
8526 Local interwiki link: with additional interwiki prefix (T63357)
8527 !! options
8528 parsoid=wt2html,wt2wt,html2html
8529 !! wikitext
8530 [[local:meatball:Hello]]
8531 !! html/php
8532 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8533 </p>
8534 !! html/parsoid
8535 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8536 !! end
8537
8538 !! test
8539 Multiple local interwiki link prefixes
8540 !! wikitext
8541 [[local:local:local:local:mi:local:Foo]]
8542 !! options
8543 parsoid=wt2html,wt2wt,html2html
8544 !! html/php
8545 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8546 </p>
8547 !! html/parsoid
8548 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8549 !! end
8550
8551 ###
8552 ### Interlanguage links
8553 ### Language links (so that searching for '### language' matches..)
8554 ###
8555
8556 !! test
8557 Interlanguage link
8558 !! wikitext
8559 Blah blah blah
8560 [[zh:Chinese]]
8561 !! html/php
8562 <p>Blah blah blah
8563 </p>
8564 !! html/parsoid
8565 <p>Blah blah blah</p>
8566 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8567 !! end
8568
8569 ## parsoid html2wt will lose the space variations
8570 !! test
8571 Interlanguage link with spacing
8572 !! options
8573 parsoid=wt2html,wt2wt,html2html
8574 !! wikitext
8575 Blah blah blah
8576 [[ zh : Chinese ]]
8577 !! html/php
8578 <p>Blah blah blah
8579 </p>
8580 !! html/parsoid
8581 <p>Blah blah blah</p>
8582 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8583 !! end
8584
8585 !! test
8586 Double interlanguage link
8587 !! wikitext
8588 Blah blah blah
8589 [[es:Spanish]]
8590 [[zh:Chinese]]
8591 !! html/php
8592 <p>Blah blah blah
8593 </p>
8594 !! html/parsoid
8595 <p>Blah blah blah</p>
8596 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8597 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8598 !! end
8599
8600 ## parsoid html2wt will lose the space variations
8601 !! test
8602 Interlanguage link variations
8603 !! options
8604 parsoid=wt2html,wt2wt,html2html
8605 !! wikitext
8606 Blah blah blah
8607 [[ es :Spanish]]
8608 [[ ZH :Chinese]]
8609 [[es:Foo_bar]]
8610 !! html/php
8611 <p>Blah blah blah
8612 </p>
8613 !! html/parsoid
8614 <p>Blah blah blah</p>
8615 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8616 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8617 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8618 !! end
8619
8620 !! test
8621 Escaping of interlanguage links (T129218, T156308)
8622 !! wikitext
8623 Blah blah blah
8624 [[:es:Spanish]]
8625 [[ : zh : Chinese ]]
8626 !! html/php
8627 <p>Blah blah blah
8628 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8629 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8630 </p>
8631 !! html/parsoid
8632 <p>Blah blah blah
8633 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8634 <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8635 !! end
8636
8637 ## parsoid html2wt will normalize the space to _
8638 !! test
8639 Space and question mark encoding in interlanguage links (T95473)
8640 !! options
8641 parsoid=wt2html,wt2wt,html2html
8642 !! wikitext
8643 Blah blah blah
8644 [[es:Foo bar?]]
8645 !! html/php
8646 <p>Blah blah blah
8647 </p>
8648 !! html/parsoid
8649 <p>Blah blah blah</p>
8650 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8651 !! end
8652
8653 !! test
8654 Interlanguage link, with prefix links
8655 !! options
8656 language=ln
8657 !! wikitext
8658 Blah blah blah
8659 [[zh:Chinese]]
8660 !! html/php
8661 <p>Blah blah blah
8662 </p>
8663 !! html/parsoid
8664 <p>Blah blah blah</p>
8665 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8666 !! end
8667
8668 !! test
8669 Double interlanguage link, with prefix links (T10897)
8670 !! options
8671 language=ln
8672 !! wikitext
8673 Blah blah blah
8674 [[es:Spanish]]
8675 [[zh:Chinese]]
8676 !! html/php
8677 <p>Blah blah blah
8678 </p>
8679 !! html/parsoid
8680 <p>Blah blah blah</p>
8681 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8682 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8683 !! end
8684
8685 !! test
8686 "Extra" interlanguage links (T34189 / gerrit 111390)
8687 !! wikitext
8688 Blah blah blah
8689 [[mul:Article]]
8690 !! html/php
8691 <p>Blah blah blah
8692 </p>
8693 !! html/parsoid
8694 <p>Blah blah blah</p>
8695 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8696 !! end
8697
8698 ## PHP parser tests script needs an update
8699 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8700 !! test
8701 Language links render as inline links if $wgInterwikiMagic=false
8702 !! options
8703 wgInterwikiMagic=false
8704 parsoid=wt2html,wt2wt,html2html
8705 !! wikitext
8706 Blah blah blah
8707 [[zh:Chinese]]
8708 !! html/parsoid
8709 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8710 !! end
8711
8712 ## PHP parser tests script needs an update
8713 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8714 !! test
8715 Language links render as inline links in the Talk namespace
8716 !! options
8717 title=Talk:Foo
8718 parsoid=wt2html,wt2wt,html2html
8719 !! wikitext
8720 Blah blah blah
8721 [[zh:Chinese]]
8722 !! html/parsoid
8723 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8724 !! end
8725
8726 !! test
8727 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8728 !! options
8729 language=ln
8730 !! wikitext
8731 [[WW&nbsp;II]]
8732 !! html
8733 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
8734 </p>
8735 !! end
8736
8737 !! test
8738 Parsoid T55221: Wikilinks should be properly entity-escaped
8739 !! options
8740 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8741 !! html/parsoid
8742 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8743 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8744 !! wikitext
8745 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8746
8747 He&amp;nbsp;llo He&amp;nbsp;llo
8748 !! html/php
8749 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8750 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8751 </p>
8752 !! end
8753
8754 # html2wt will fail because of title normalization without data-parsoid
8755 !! test
8756 Parsoid: handle constructor well
8757 !! options
8758 parsoid=wt2html,wt2wt
8759 !! wikitext
8760 [[constructor]]
8761
8762 [[constructor:foo]]
8763 !! html/php
8764 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8765 </p><p><a href="/index.php?title=Constructor:foo&amp;action=edit&amp;redlink=1" class="new" title="Constructor:foo (page does not exist)">constructor:foo</a>
8766 </p>
8767 !! html/parsoid
8768 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8769
8770 <p><a rel="mw:WikiLink" href="./Constructor:foo" title="Constructor:foo" data-parsoid='{"stx":"simple","a":{"href":"./Constructor:foo"},"sa":{"href":"constructor:foo"}}'>constructor:foo</a></p>
8771 !! end
8772
8773 !! article
8774 ko:
8775 !! text
8776 Test.
8777 !! endarticle
8778
8779 # Note that `ko` isn't a known interlanguage prefix
8780 !! test
8781 Parsoid: recognize interlanguage links without a target page
8782 !! options
8783 ill
8784 !! wikitext
8785 [[es:]]
8786
8787 [[ko:]]
8788 !! html/php
8789 es:
8790 !! html/parsoid
8791 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8792
8793 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8794 !! end
8795
8796 # Note that `ko` isn't a known interwiki prefix
8797 !! test
8798 Parsoid: recognize interwiki links without a target page
8799 !! options
8800 parsoid=wt2html,wt2wt,html2html
8801 !! wikitext
8802 [[:es:]]
8803
8804 [[:ko:]]
8805 !! html/php
8806 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8807 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8808 </p>
8809 !! html/parsoid
8810 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8811 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8812 !! end
8813
8814 !! test
8815 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
8816 !! wikitext
8817 [[mi:Foo]]
8818 !! html/php
8819 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8820 </p>
8821 !! html/parsoid
8822 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8823 !! end
8824
8825 !! test
8826 Interlanguage link with preceding local interwiki link (T70085)
8827 !! options
8828 parsoid=wt2html,wt2wt,html2html
8829 !! wikitext
8830 Blah blah blah
8831 [[local:es:Spanish]]
8832 !! html/php
8833 <p>Blah blah blah
8834 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8835 </p>
8836 !! html/parsoid
8837 <p>Blah blah blah
8838 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8839 !! end
8840
8841 !! test
8842 Looks like an interlanguage link, but is actually a local interwiki
8843 !! options
8844 parsoid=wt2html,wt2wt,html2html
8845 !! wikitext
8846 Blah blah blah
8847 [[mi:Template:Foo]]
8848 !! html/php
8849 <p>Blah blah blah
8850 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8851 </p>
8852 !! html/parsoid
8853 <p>Blah blah blah
8854 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8855 !! end
8856
8857 ###
8858 ### Redirects, Parsoid-only
8859 ###
8860
8861 !! test
8862 1. Simple redirect to page
8863 !! wikitext
8864 #REDIRECT [[Main Page]]
8865 !! html/parsoid
8866 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8867 !! end
8868
8869 !! test
8870 2. Other redirect variants
8871 !! wikitext
8872 #REDIRECT [[Main_Page]]
8873 !! html/parsoid
8874 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8875 !! end
8876
8877 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8878 # This tests the Parsoid bail-out code.
8879 !! test
8880 3. Other redirect variants
8881 !! wikitext
8882 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8883 !! html/parsoid
8884 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8885 !! end
8886
8887 !! test
8888 4. Redirect to a templated destination
8889 !! wikitext
8890 #REDIRECT [[{{echo|Foo}}bar]]
8891 !! html/parsoid
8892 <link about="#mwt2" typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-parsoid='{"a":{"href":"./Foobar"},"sa":{"href":"{{echo|Foo}}bar"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[12,24,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"Foo\"}},\"i\":0}}]}&#39;>Foo&lt;/span>bar"}]]}'/>
8893 !! end
8894
8895 !! test
8896 Empty redirect
8897 !! options
8898 parsoid=wt2html,wt2wt
8899 !! wikitext
8900 #REDIRECT [[]]
8901 !! html/parsoid
8902 <ol>
8903 <li>REDIRECT [[]]</li></ol>
8904 !! end
8905
8906 !! test
8907 Optional colon in #REDIRECT
8908 !! options
8909 # the colon is archaic syntax. we support it for wt2html, but we
8910 # don't care that it roundtrips back to the modern syntax.
8911 parsoid=wt2html,html2html
8912 !! wikitext
8913 #REDIRECT:[[Main Page]]
8914 !! html/parsoid
8915 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8916 !! end
8917
8918 !! test
8919 Whitespace in #REDIRECT with optional colon
8920 !! options
8921 # the colon and gratuitous whitespace is archaic syntax. we support
8922 # it for wt2html, but we don't care that it roundtrips back to the
8923 # modern syntax (without extra whitespace)
8924 parsoid=wt2html,html2html
8925 !! wikitext
8926
8927 #REDIRECT
8928 :
8929 [[Main Page]]
8930 !! html/parsoid
8931 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8932 !! end
8933
8934 !! test
8935 Piped link in #REDIRECT
8936 !! options
8937 # content after piped link is ignored. we support this syntax,
8938 # but don't care that the piped link is lost when we roundtrip this.
8939 parsoid=wt2html
8940 !! wikitext
8941 #REDIRECT [[Main Page|bar]]
8942 !! html/parsoid
8943 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8944 !! end
8945
8946 !! test
8947 Redirect to category (T104502)
8948 !! options
8949 parsoid=wt2html,wt2wt
8950 !! wikitext
8951 #REDIRECT [[Category:Foo]]
8952 !! html/parsoid
8953 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8954 !! end
8955
8956 !! test
8957 Redirect to category with URL encoding (T104502)
8958 !! options
8959 parsoid=wt2html
8960 !! wikitext
8961 #REDIRECT [[Category%3AFoo]]
8962 !! html/parsoid
8963 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8964 !! end
8965
8966 !! test
8967 Redirect to category page
8968 !! wikitext
8969 #REDIRECT [[:Category:Foo]]
8970 !! html/parsoid
8971 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8972 !! end
8973
8974 !! test
8975 Redirect to image page (1)
8976 !! wikitext
8977 #REDIRECT [[File:Wiki.png]]
8978 !! html/parsoid
8979 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8980 !! end
8981
8982 !! test
8983 Redirect to image page (2)
8984 !! wikitext
8985 #REDIRECT [[Image:Wiki.png]]
8986 !! html/parsoid
8987 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8988 !! end
8989
8990 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8991 # Next test confirms this.
8992 !! test
8993 Redirect to language (1) (T104918)
8994 !! options
8995 parsoid=wt2html,wt2wt,html2html
8996 !! wikitext
8997 #REDIRECT [[en:File:Wiki.png]]
8998 !! html/parsoid
8999 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9000 !! end
9001
9002 !! test
9003 Redirect to language (2) (T104918)
9004 !! wikitext
9005 #REDIRECT [[:en:File:Wiki.png]]
9006 !! html/parsoid
9007 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9008 !! end
9009
9010 !! test
9011 Redirect to interwiki (T104918)
9012 !! wikitext
9013 #REDIRECT [[meatball:File:Wiki.png]]
9014 !! html/parsoid
9015 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9016 !! end
9017
9018 !! test
9019 Non-English #REDIRECT
9020 !! options
9021 language=is
9022 !! wikitext
9023 #TILVÍSUN [[Main Page]]
9024 !! html/parsoid
9025 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9026 !! end
9027
9028 !! test
9029 Redirect syntax under text isn't considered a redirect
9030 !! wikitext
9031 some text
9032 #redirect [[Main Page]]
9033 !! html/parsoid
9034 <p>some text</p>
9035 <ol data-parsoid='{}'><li data-parsoid='{}'>redirect <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'>Main Page</a></li></ol>
9036 !! end
9037
9038 # FIXME: Should hoist the redirect to the top of the page and ensure there
9039 # is only one.
9040 !! test
9041 New redirect
9042 !! options
9043 parsoid=html2wt
9044 !! html/parsoid
9045 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9046 !! wikitext
9047 Foo
9048 #REDIRECT [[Foo]]
9049 !! end
9050
9051 ##
9052 ## XHTML tidiness
9053 ###
9054
9055 !! test
9056 <br> to <br />
9057 !! wikitext
9058 1<br>2<br />3
9059 !! html
9060 <p>1<br />2<br />3
9061 </p>
9062 !! end
9063
9064 !! test
9065 Broken br tag sanitization
9066 !! wikitext
9067 </br>
9068 !! html/php
9069 <p>&lt;/br&gt;
9070 </p>
9071 !! end
9072
9073 # TODO: Fix html2html mode (T53055)!
9074 !! test
9075 Parsoid: Broken br tag recognition
9076 !! options
9077 parsoid=wt2html
9078 !! wikitext
9079 </br>
9080
9081 <br/ >
9082 !! html+tidy
9083 <p><br /></p>
9084 <p><br /></p>
9085 !! end
9086
9087 !! test
9088 Incorrecly removing closing slashes from correctly formed XHTML
9089 !! wikitext
9090 <br style="clear:both;" />
9091 !! html
9092 <p><br style="clear:both;" />
9093 </p>
9094 !! end
9095
9096 !! test
9097 Failing to transform badly formed HTML into correct XHTML
9098 !! wikitext
9099 <br style="clear: left;">
9100 <br style="clear: right;">
9101 <br style="clear: both;">
9102 !! html
9103 <p><br style="clear: left;" />
9104 <br style="clear: right;" />
9105 <br style="clear: both;" />
9106 </p>
9107 !!end
9108
9109 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9110 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9111 !! test
9112 Handling html with a div self-closing tag
9113 !! wikitext
9114 <div title />
9115 <div title/>
9116 <div title/ >
9117 <div title=bar />
9118 <div title=bar/>
9119 <div title=bar/ >
9120 !! html/php
9121 <p>&lt;div title /&gt;
9122 &lt;div title/&gt;
9123 </p>
9124 <div>
9125 <p>&lt;div title=bar /&gt;
9126 &lt;div title=bar/&gt;
9127 </p>
9128 <div title="bar/"></div>
9129 </div>
9130
9131 !! html/parsoid
9132 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9133 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9134 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9135 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9136 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9137 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9138 !! end
9139
9140 !! test
9141 Handling html with a br self-closing tag
9142 !! wikitext
9143 <br title />
9144 <br title/>
9145 <br title/ >
9146 <br title=bar />
9147 <br title=bar/>
9148 <br title=bar/ >
9149 !! html/php
9150 <p><br title="" />
9151 <br title="" />
9152 <br />
9153 <br title="bar" />
9154 <br title="bar" />
9155 <br title="bar/" />
9156 </p>
9157 !! html/parsoid
9158 <p><br title="" />
9159 <br title="" />
9160 <br title="" />
9161 <br title="bar" />
9162 <br title="bar" />
9163 <br title="bar/" />
9164 </p>
9165 !! end
9166
9167 !! test
9168 Horizontal ruler (should it add that extra space?)
9169 !! wikitext
9170 <hr>
9171 <hr >
9172 foo <hr
9173 > bar
9174 !! html+tidy
9175 <hr />
9176 <hr />
9177 <p>foo</p>
9178 <hr />
9179 <p>bar</p>
9180 !! end
9181
9182 !! test
9183 Horizontal ruler -- 4+ dashes render hr
9184 !! wikitext
9185 ----
9186 !! html
9187 <hr />
9188
9189 !! end
9190
9191 !! test
9192 Horizontal ruler -- eats additional dashes on the same line
9193 !! wikitext
9194 ---------
9195 !! html
9196 <hr />
9197
9198 !! end
9199
9200 !! test
9201 Horizontal ruler -- does not collapse dashes on consecutive lines
9202 !! wikitext
9203 ----
9204 ----
9205 !! html
9206 <hr />
9207 <hr />
9208
9209 !! end
9210
9211 !! test
9212 Horizontal ruler -- <4 dashes render as plain text
9213 !! wikitext
9214 ---
9215 !! html
9216 <p>---
9217 </p>
9218 !! end
9219
9220 !! test
9221 Horizontal ruler -- Supports content following dashes on same line
9222 !! wikitext
9223 ---- Foo
9224 !! html
9225 <hr /> Foo
9226
9227 !! html+tidy
9228 <hr />
9229 <p>Foo</p>
9230 !! end
9231
9232 ###
9233 ### Block-level elements
9234 ###
9235 !! test
9236 Common list
9237 !! wikitext
9238 *Common list
9239 * item 2
9240 *item 3
9241 !! html
9242 <ul><li>Common list</li>
9243 <li> item 2</li>
9244 <li>item 3</li></ul>
9245
9246 !! end
9247
9248 !! test
9249 Numbered list
9250 !! wikitext
9251 #Numbered list
9252 #item 2
9253 # item 3
9254 !! html
9255 <ol><li>Numbered list</li>
9256 <li>item 2</li>
9257 <li> item 3</li></ol>
9258
9259 !! end
9260
9261 !! test
9262 Mixed list
9263 !! wikitext
9264 *Mixed list
9265 *# with numbers
9266 ** and bullets
9267 *# and numbers
9268 *bullets again
9269 **bullet level 2
9270 ***bullet level 3
9271 ***#Number on level 4
9272 **bullet level 2
9273 **#Number on level 3
9274 **#Number on level 3
9275 *#number level 2
9276 *Level 1
9277 *** Level 3
9278 #** Level 3, but ordered
9279 !! html
9280 <ul><li>Mixed list
9281 <ol><li> with numbers</li></ol>
9282 <ul><li> and bullets</li></ul>
9283 <ol><li> and numbers</li></ol></li>
9284 <li>bullets again
9285 <ul><li>bullet level 2
9286 <ul><li>bullet level 3
9287 <ol><li>Number on level 4</li></ol></li></ul></li>
9288 <li>bullet level 2
9289 <ol><li>Number on level 3</li>
9290 <li>Number on level 3</li></ol></li></ul>
9291 <ol><li>number level 2</li></ol></li>
9292 <li>Level 1
9293 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9294 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9295
9296 !! end
9297
9298 !! test
9299 1. Nested mixed wikitext and html list
9300 !! wikitext
9301 * hi
9302 * <ul><li>ho</li></ul>
9303 * hi
9304 ** ho
9305 !! html/php
9306 <ul><li> hi</li>
9307 <li> <ul><li>ho</li></ul></li>
9308 <li> hi
9309 <ul><li> ho</li></ul></li></ul>
9310
9311 !! html/parsoid
9312 <ul><li> hi</li>
9313 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9314 <li> hi
9315 <ul><li> ho</li></ul></li></ul>
9316 !! end
9317
9318 !! test
9319 2. Nested mixed wikitext and html list (incompatible)
9320 !! wikitext
9321 ; hi
9322 : {{echo|<li>ho</li>}}
9323 !! html/php
9324 <dl><dt> hi</dt>
9325 <dd> <li>ho</li></dd></dl>
9326
9327 !! html/parsoid
9328 <dl><dt> hi</dt>
9329 <dd> <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>ho&lt;/li>"}},"i":0}}]}'>ho</li></dd></dl>
9330 !! end
9331
9332 !! test
9333 Nested lists 1
9334 !! wikitext
9335 *foo
9336 **bar
9337 !! html
9338 <ul><li>foo
9339 <ul><li>bar</li></ul></li></ul>
9340
9341 !! end
9342
9343 !! test
9344 Nested lists 2
9345 !! wikitext
9346 **foo
9347 *bar
9348 !! html
9349 <ul><li><ul><li>foo</li></ul></li>
9350 <li>bar</li></ul>
9351
9352 !! end
9353
9354 !! test
9355 Nested lists 3 (first element empty)
9356 !! wikitext
9357 *
9358 **bar
9359 !! html
9360 <ul><li>
9361 <ul><li>bar</li></ul></li></ul>
9362
9363 !! end
9364
9365 !! test
9366 Nested lists 4 (first element empty)
9367 !! wikitext
9368 **
9369 *bar
9370 !! html
9371 <ul><li><ul><li></li></ul></li>
9372 <li>bar</li></ul>
9373
9374 !! end
9375
9376 !! test
9377 Nested lists 5 (both elements empty)
9378 !! wikitext
9379 **
9380 *
9381 !! html
9382 <ul><li><ul><li></li></ul></li>
9383 <li></li></ul>
9384
9385 !! end
9386
9387 !! test
9388 Nested lists 6 (both elements empty)
9389 !! wikitext
9390 *
9391 **
9392 !! html
9393 <ul><li>
9394 <ul><li></li></ul></li></ul>
9395
9396 !! end
9397
9398 !! test
9399 Nested lists 7 (skip initial nesting levels)
9400 !! wikitext
9401 *** foo
9402 !! html
9403 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9404
9405 !! end
9406
9407 !! test
9408 Nested lists 8 (multiple nesting transitions)
9409 !! wikitext
9410 * foo
9411 *** bar
9412 ** baz
9413 * boo
9414 !! html
9415 <ul><li> foo
9416 <ul><li><ul><li> bar</li></ul></li>
9417 <li> baz</li></ul></li>
9418 <li> boo</li></ul>
9419
9420 !! end
9421
9422 !! test
9423 Nested lists 9 (extension interaction)
9424 !! options
9425 parsoid
9426 !! wikitext
9427 *<references />
9428 !! html/parsoid
9429 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9430 !! end
9431
9432 !! test
9433 1. Lists with start-of-line-transparent tokens before bullets: Comments
9434 !! wikitext
9435 *foo
9436 *<!--cmt-->bar
9437 <!--cmt-->*baz
9438 !! html
9439 <ul><li>foo</li>
9440 <li>bar</li>
9441 <li>baz</li></ul>
9442
9443 !! end
9444
9445 !! test
9446 2. Lists with start-of-line-transparent tokens before bullets: Template close
9447 !! wikitext
9448 *foo {{echo|bar
9449 }}*baz
9450 !! html
9451 <ul><li>foo bar</li>
9452 <li>baz</li></ul>
9453
9454 !! end
9455
9456 !! test
9457 List items are not parsed correctly following a <pre> block (T2785)
9458 !! wikitext
9459 * <pre>foo</pre>
9460 * <pre>bar</pre>
9461 * zar
9462 !! html/php
9463 <ul><li> <pre>foo</pre></li>
9464 <li> <pre>bar</pre></li>
9465 <li> zar</li></ul>
9466
9467 !! html/parsoid
9468 <ul><li> <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9469 <li> <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9470 <li> zar</li></ul>
9471 !! end
9472
9473 !! test
9474 List items from template
9475 !! wikitext
9476
9477 {{inner list}}
9478 * item 2
9479
9480 * item 0
9481 {{inner list}}
9482 * item 2
9483
9484 * item 0
9485 * notSOL{{inner list}}
9486 * item 2
9487 !! html
9488 <ul><li> item 1</li>
9489 <li> item 2</li></ul>
9490 <ul><li> item 0</li>
9491 <li> item 1</li>
9492 <li> item 2</li></ul>
9493 <ul><li> item 0</li>
9494 <li> notSOL</li>
9495 <li> item 1</li>
9496 <li> item 2</li></ul>
9497
9498 !! end
9499
9500 !! test
9501 List interrupted by empty line or heading
9502 !! wikitext
9503 * foo
9504
9505 ** bar
9506 == A heading ==
9507 * Another list item
9508 !! html
9509 <ul><li> foo</li></ul>
9510 <ul><li><ul><li> bar</li></ul></li></ul>
9511 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9512 <ul><li> Another list item</li></ul>
9513
9514 !!end
9515
9516 !!test
9517 Multiple list tags generated by templates
9518 !! wikitext
9519 {{echo|<li>}}a
9520 {{echo|<li>}}b
9521 {{echo|<li>}}c
9522 !! html
9523 <li>a
9524 <li>b
9525 <li>c</li>
9526 </li>
9527 </li>
9528
9529 !! html+tidy
9530 <ul>
9531 <li>a</li>
9532 <li>b</li>
9533 <li>c</li>
9534 </ul>
9535 !!end
9536
9537 !!test
9538 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9539 !! wikitext
9540 *a
9541 <!--This line will NOT split the list-->
9542 *b
9543 <!--This line will NOT split the list either-->
9544 *c
9545 <!--foo--> <!----> <!--This line NOT split the list either-->
9546 *d
9547 !! html
9548 <ul><li>a</li>
9549 <li>b</li>
9550 <li>c</li>
9551 <li>d</li></ul>
9552
9553 !!end
9554
9555 !!test
9556 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9557 !! wikitext
9558 *a
9559 <!--This line will NOT split the list-->
9560 *b
9561 <!--This line will NOT split the list either-->
9562 *c
9563 <!--foo--> <!----> <!--This line NOT split the list
9564 either-->
9565 *d
9566 !! html
9567 <ul><li>a</li>
9568 <li>b</li>
9569 <li>c</li>
9570 <li>d</li></ul>
9571
9572 !!end
9573
9574 !!test
9575 Test the li-hack
9576 (The PHP parser relies on Tidy for the hack)
9577 !!options
9578 parsoid=wt2html,wt2wt
9579 !! wikitext
9580 * foo
9581 * <li>li-hack
9582 * {{echo|<li>templated li-hack}}
9583 * <!--foo--> <li> unsupported li-hack with preceding comments
9584
9585 <ul>
9586 <li><li>not a li-hack
9587 </li>
9588 </ul>
9589 !! html+tidy
9590 <ul>
9591 <li>foo</li>
9592 <li>li-hack</li>
9593 <li>templated li-hack</li>
9594 <li>unsupported li-hack with preceding comments</li>
9595 </ul>
9596 <ul>
9597 <li>not a li-hack</li>
9598 </ul>
9599 !!end
9600
9601 !! test
9602 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9603 !! options
9604 parsoid
9605 !! wikitext
9606 # foo
9607 ## bar
9608 * foo
9609 ** bar
9610 : foo
9611 :: bar
9612 !! html
9613 <ol>
9614 <li> foo<ol>
9615 <li> bar</li>
9616 </ol></li>
9617 </ol><ul>
9618 <li> foo<ul>
9619 <li> bar</li>
9620 </ul></li>
9621 </ul><dl>
9622 <dd> foo<dl>
9623 <dd> bar</dd>
9624 </dl></dd>
9625 </dl>
9626 !! end
9627
9628 !! test
9629 Parsoid: Test of whitespace serialization with Templated bullets
9630 !! options
9631 parsoid
9632 !! wikitext
9633 * {{bullet}}
9634 !! html
9635 <ul>
9636 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9637 </ul>
9638 !! end
9639
9640 # ------------------------------------------------------------------------
9641 # The next set of tests are about Parsoid's ability to handle badly nested
9642 # tags (parse, minimize scope of fixup, and roundtrip back)
9643 # ------------------------------------------------------------------------
9644
9645 !! test
9646 Unbalanced closing block tags break a list
9647 (php parser relies on Tidy to fix up)
9648 !! wikitext
9649 <div>
9650 *a</div><div>
9651 *b</div>
9652 !! html+tidy
9653 <div>
9654 <ul>
9655 <li>a</li>
9656 </ul>
9657 </div>
9658 <div>
9659 <ul>
9660 <li>b</li>
9661 </ul>
9662 </div>
9663 !! end
9664
9665 # Parsoid fails this test, but it might be tricky to support properly.
9666 # See T70395.
9667 !! test
9668 Unbalanced closing non-block tags don't break a list
9669 (php parser relies on Tidy to fix up)
9670 !! wikitext
9671 <span>
9672 *a</span><span>
9673 *b</span>
9674 !! html/php+tidy
9675 <ul>
9676 <li><span>a</span></li>
9677 <li><span>b</span></li>
9678 </ul>
9679 !! html/parsoid
9680 <span>
9681 <ul>
9682 <li>a<span></span>
9683 </li>
9684 <li>b
9685 </li>
9686 </ul>
9687 </span>
9688 !! end
9689
9690 !! test
9691 Unclosed formatting tags that straddle lists are closed and reopened
9692 (php parser relies on Tidy to fix up)
9693 !! options
9694 parsoid=wt2html,wt2wt,html2html
9695 !! wikitext
9696 # <s> a
9697 # b </s>
9698 !! html/php+tidy
9699 <ol>
9700 <li><s>a</s></li>
9701 <li><s>b</s></li>
9702 </ol>
9703 !! html/parsoid
9704 <ol><li> <s> a</s></li>
9705 <li><s> b </s></li></ol>
9706 !! end
9707
9708 # See T70395.
9709 !!test
9710 1. List embedded in a formatting tag
9711 !! wikitext
9712 <small>
9713 * foo
9714 </small>
9715 !! html/php+tidy
9716 <ul>
9717 <li><small>foo</small></li>
9718 </ul>
9719 !! html/parsoid
9720 <small>
9721 <ul>
9722 <li> foo</li>
9723 </ul>
9724 </small>
9725 !!end
9726
9727 ## Ugly Parsoid output here
9728 ## Not sure what the right output is.
9729 !!test
9730 2. List embedded in a formatting tag
9731 !! wikitext
9732 <small>
9733 *a
9734 *b</small>
9735 !! html/php+tidy
9736 <ul>
9737 <li><small>a</small></li>
9738 <li><small>b</small></li>
9739 </ul>
9740 !! html/parsoid
9741 <small></small>
9742 <ul><small>
9743 <li>a</li>
9744 </small>
9745 <li><small>b</small></li>
9746 </ul>
9747 !!end
9748
9749 # Ugly Parsoid and PHP parser output here
9750 # Not sure if we want to make this a test!
9751 #
9752 ## !!test
9753 ## 3. Unclosed formatting tags in list elements
9754 ## !! wikitext
9755 ## *<small>a
9756 ## *<small>b
9757 ## !! html/php+tidy
9758 ## <ul>
9759 ## <li><small>a</small></li>
9760 ## <li><small><small>b</small></small></li>
9761 ## </ul>
9762 ## !! html/parsoid
9763 ## <ul>
9764 ## <li><small>a</small></li>
9765 ## <small>
9766 ## <li><small>b</small></li>
9767 ## </small></ul>
9768 ## !!end
9769
9770 # This is a bug in the PHP parser + tidy combination.
9771 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9772 # and then fostered out of the table by tidy.)
9773 # We believe the Parsoid output to be correct.
9774 !! test
9775 Table with missing opening <tr> tag
9776 !! options
9777 parsoid=wt2html,wt2wt
9778 !! wikitext
9779 <table>
9780 <td>foo</td>
9781 </tr>
9782 </table>
9783 !! html+tidy
9784 <table>
9785 <tr>
9786 <td>foo</td>
9787 </tr>
9788 </table>
9789 !! end
9790
9791 ###
9792 ### Magic Words
9793 ###
9794
9795 # Note that the current date is hard-coded as
9796 # 1970-01-01T00:02:03Z (a Thursday)
9797 # when running parser tests. The timezone is also fixed to GMT, so
9798 # local date will be identical to current date.
9799
9800 !! test
9801 Magic Word: {{CURRENTDAY}}
9802 !! wikitext
9803 {{CURRENTDAY}}
9804 !! html
9805 <p>1
9806 </p>
9807 !! end
9808
9809 !! test
9810 Magic Word: {{CURRENTDAY2}}
9811 !! wikitext
9812 {{CURRENTDAY2}}
9813 !! html
9814 <p>01
9815 </p>
9816 !! end
9817
9818 !! test
9819 Magic Word: {{CURRENTDAYNAME}}
9820 !! wikitext
9821 {{CURRENTDAYNAME}}
9822 !! html
9823 <p>Thursday
9824 </p>
9825 !! end
9826
9827 !! test
9828 Magic Word: {{CURRENTDOW}}
9829 !! wikitext
9830 {{CURRENTDOW}}
9831 !! html
9832 <p>4
9833 </p>
9834 !! end
9835
9836 !! test
9837 Magic Word: {{CURRENTMONTH}}
9838 !! wikitext
9839 {{CURRENTMONTH}}
9840 !! html
9841 <p>01
9842 </p>
9843 !! end
9844
9845 !! test
9846 Magic Word: {{CURRENTMONTH1}}
9847 !! wikitext
9848 {{CURRENTMONTH1}}
9849 !! html
9850 <p>1
9851 </p>
9852 !! end
9853
9854 !! test
9855 Magic Word: {{CURRENTMONTHABBREV}}
9856 !! wikitext
9857 {{CURRENTMONTHABBREV}}
9858 !! html
9859 <p>Jan
9860 </p>
9861 !! end
9862
9863 !! test
9864 Magic Word: {{CURRENTMONTHNAME}}
9865 !! wikitext
9866 {{CURRENTMONTHNAME}}
9867 !! html
9868 <p>January
9869 </p>
9870 !! end
9871
9872 !! test
9873 Magic Word: {{CURRENTMONTHNAMEGEN}}
9874 !! wikitext
9875 {{CURRENTMONTHNAMEGEN}}
9876 !! html
9877 <p>January
9878 </p>
9879 !! end
9880
9881 !! test
9882 Magic Word: {{CURRENTTIME}}
9883 !! wikitext
9884 {{CURRENTTIME}}
9885 !! html
9886 <p>00:02
9887 </p>
9888 !! end
9889
9890 !! test
9891 Magic Word: {{CURRENTHOUR}}
9892 !! wikitext
9893 {{CURRENTHOUR}}
9894 !! html
9895 <p>00
9896 </p>
9897 !! end
9898
9899 !! test
9900 Magic Word: {{CURRENTWEEK}} (T6594)
9901 !! wikitext
9902 {{CURRENTWEEK}}
9903 !! html
9904 <p>1
9905 </p>
9906 !! end
9907
9908 !! test
9909 Magic Word: {{CURRENTYEAR}}
9910 !! wikitext
9911 {{CURRENTYEAR}}
9912 !! html
9913 <p>1970
9914 </p>
9915 !! end
9916
9917 !! test
9918 Magic Word: {{CURRENTTIMESTAMP}}
9919 !! wikitext
9920 {{CURRENTTIMESTAMP}}
9921 !! html
9922 <p>19700101000203
9923 </p>
9924 !! end
9925
9926 !! test
9927 Magic Words LOCAL (UTC)
9928 !! wikitext
9929 * {{LOCALMONTH}}
9930 * {{LOCALMONTH1}}
9931 * {{LOCALMONTHNAME}}
9932 * {{LOCALMONTHNAMEGEN}}
9933 * {{LOCALMONTHABBREV}}
9934 * {{LOCALDAY}}
9935 * {{LOCALDAY2}}
9936 * {{LOCALDAYNAME}}
9937 * {{LOCALYEAR}}
9938 * {{LOCALTIME}}
9939 * {{LOCALHOUR}}
9940 * {{LOCALWEEK}}
9941 * {{LOCALDOW}}
9942 * {{LOCALTIMESTAMP}}
9943 !! html
9944 <ul><li> 01</li>
9945 <li> 1</li>
9946 <li> January</li>
9947 <li> January</li>
9948 <li> Jan</li>
9949 <li> 1</li>
9950 <li> 01</li>
9951 <li> Thursday</li>
9952 <li> 1970</li>
9953 <li> 00:02</li>
9954 <li> 00</li>
9955 <li> 1</li>
9956 <li> 4</li>
9957 <li> 19700101000203</li></ul>
9958
9959 !! end
9960
9961 !! test
9962 Magic Word: {{FULLPAGENAME}}
9963 !! options
9964 title=[[User:Ævar Arnfjörð Bjarmason]]
9965 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
9966 !! wikitext
9967 {{FULLPAGENAME}}
9968 !! html/*
9969 <p>User:Ævar Arnfjörð Bjarmason
9970 </p>
9971 !! end
9972
9973 !! test
9974 Magic Word: {{FULLPAGENAMEE}}
9975 !! options
9976 title=[[User:Ævar Arnfjörð Bjarmason]]
9977 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
9978 !! wikitext
9979 {{FULLPAGENAMEE}}
9980 !! html/*
9981 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9982 </p>
9983 !! end
9984
9985 !! test
9986 Magic Word: {{TALKSPACE}}
9987 !! options
9988 title=[[User:Ævar Arnfjörð Bjarmason]]
9989 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
9990 !! wikitext
9991 {{TALKSPACE}}
9992 !! html/*
9993 <p>User talk
9994 </p>
9995 !! end
9996
9997 !! test
9998 Magic Word: {{TALKSPACE}}, same namespace
9999 !! options
10000 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10001 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10002 !! wikitext
10003 {{TALKSPACE}}
10004 !! html/*
10005 <p>User talk
10006 </p>
10007 !! end
10008
10009 !! test
10010 Magic Word: {{TALKSPACE}}, main namespace
10011 !! options
10012 title=[[Parser Test]]
10013 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10014 !! wikitext
10015 {{TALKSPACE}}
10016 !! html/*
10017 <p>Talk
10018 </p>
10019 !! end
10020
10021 !! test
10022 Magic Word: {{TALKSPACEE}}
10023 !! options
10024 title=[[User:Ævar Arnfjörð Bjarmason]]
10025 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10026 !! wikitext
10027 {{TALKSPACEE}}
10028 !! html/*
10029 <p>User_talk
10030 </p>
10031 !! end
10032
10033 !! test
10034 Magic Word: {{SUBJECTSPACE}}
10035 !! options
10036 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10037 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10038 !! wikitext
10039 {{SUBJECTSPACE}}
10040 !! html/*
10041 <p>User
10042 </p>
10043 !! end
10044
10045 !! test
10046 Magic Word: {{SUBJECTSPACE}}, same namespace
10047 !! options
10048 title=[[User:Ævar Arnfjörð Bjarmason]]
10049 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10050 !! wikitext
10051 {{SUBJECTSPACE}}
10052 !! html/*
10053 <p>User
10054 </p>
10055 !! end
10056
10057 !! test
10058 Magic Word: {{SUBJECTSPACE}}, main namespace
10059 !! options
10060 title=[[Parser Test]]
10061 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10062 !! wikitext
10063 {{SUBJECTSPACE}}
10064 !! html/*
10065
10066 !! end
10067
10068 !! test
10069 Magic Word: {{SUBJECTSPACEE}}
10070 !! options
10071 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10072 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10073 !! wikitext
10074 {{SUBJECTSPACEE}}
10075 !! html/*
10076 <p>User
10077 </p>
10078 !! end
10079
10080 !! test
10081 Magic Word: {{NAMESPACE}}
10082 !! options
10083 title=[[User:Ævar Arnfjörð Bjarmason]]
10084 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10085 !! wikitext
10086 {{NAMESPACE}}
10087 !! html/*
10088 <p>User
10089 </p>
10090 !! end
10091
10092 !! test
10093 Magic Word: {{NAMESPACEE}}
10094 !! options
10095 title=[[User:Ævar Arnfjörð Bjarmason]]
10096 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10097 !! wikitext
10098 {{NAMESPACEE}}
10099 !! html/*
10100 <p>User
10101 </p>
10102 !! end
10103
10104 !! test
10105 Magic Word: {{NAMESPACENUMBER}}
10106 !! options
10107 title=[[User:Ævar Arnfjörð Bjarmason]]
10108 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10109 !! wikitext
10110 {{NAMESPACENUMBER}}
10111 !! html/*
10112 <p>2
10113 </p>
10114 !! end
10115
10116 !! test
10117 Magic Word: {{SUBPAGENAME}}
10118 !! options
10119 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10120 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10121 !! wikitext
10122 {{SUBPAGENAME}}
10123 !! html/*
10124 <p>sub ö
10125 </p>
10126 !! end
10127
10128 !! test
10129 Magic Word: {{SUBPAGENAMEE}}
10130 !! options
10131 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10132 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10133 !! wikitext
10134 {{SUBPAGENAMEE}}
10135 !! html/*
10136 <p>sub_%C3%B6
10137 </p>
10138 !! end
10139
10140 !! test
10141 Magic Word: {{ROOTPAGENAME}}
10142 !! options
10143 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10144 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10145 !! wikitext
10146 {{ROOTPAGENAME}}
10147 !! html/*
10148 <p>Ævar Arnfjörð Bjarmason
10149 </p>
10150 !! end
10151
10152 !! test
10153 Magic Word: {{ROOTPAGENAMEE}}
10154 !! options
10155 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10156 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10157 !! wikitext
10158 {{ROOTPAGENAMEE}}
10159 !! html/*
10160 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10161 </p>
10162 !! end
10163
10164 !! test
10165 Magic Word: {{BASEPAGENAME}}
10166 !! options
10167 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10168 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10169 !! wikitext
10170 {{BASEPAGENAME}}
10171 !! html/*
10172 <p>Ævar Arnfjörð Bjarmason
10173 </p>
10174 !! end
10175
10176 !! test
10177 Magic Word: {{BASEPAGENAMEE}}
10178 !! options
10179 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10180 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10181 !! wikitext
10182 {{BASEPAGENAMEE}}
10183 !! html/*
10184 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10185 </p>
10186 !! end
10187
10188 !! test
10189 Magic Word: {{TALKPAGENAME}}
10190 !! options
10191 title=[[User:Ævar Arnfjörð Bjarmason]]
10192 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10193 !! wikitext
10194 {{TALKPAGENAME}}
10195 !! html/*
10196 <p>User talk:Ævar Arnfjörð Bjarmason
10197 </p>
10198 !! end
10199
10200 !! test
10201 Magic Word: {{TALKPAGENAMEE}}
10202 !! options
10203 title=[[User:Ævar Arnfjörð Bjarmason]]
10204 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10205 !! wikitext
10206 {{TALKPAGENAMEE}}
10207 !! html/*
10208 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10209 </p>
10210 !! end
10211
10212 !! test
10213 Magic Word: {{SUBJECTPAGENAME}}
10214 !! options
10215 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10216 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10217 !! wikitext
10218 {{SUBJECTPAGENAME}}
10219 !! html/*
10220 <p>User:Ævar Arnfjörð Bjarmason
10221 </p>
10222 !! end
10223
10224 !! test
10225 Magic Word: {{SUBJECTPAGENAMEE}}
10226 !! options
10227 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10228 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10229 !! wikitext
10230 {{SUBJECTPAGENAMEE}}
10231 !! html/*
10232 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10233 </p>
10234 !! end
10235
10236 !! test
10237 Magic Word: {{NUMBEROFFILES}}
10238 !! options
10239 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10240 !! wikitext
10241 {{NUMBEROFFILES}}
10242 !! html/*
10243 <p>7
10244 </p>
10245 !! end
10246
10247 !! test
10248 Magic Word: {{PAGENAME}}
10249 !! options
10250 title=[[User:Ævar Arnfjörð Bjarmason]]
10251 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10252 !! wikitext
10253 {{PAGENAME}}
10254 !! html/*
10255 <p>Ævar Arnfjörð Bjarmason
10256 </p>
10257 !! end
10258
10259 !! test
10260 Magic Word: {{PAGENAME}} with metacharacters
10261 !! options
10262 title=[['foo & bar = baz']]
10263 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10264 !! wikitext
10265 ''{{PAGENAME}}''
10266 !! html/php
10267 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10268 </p>
10269 !! html+tidy
10270 <p><i>'foo &amp; bar = baz'</i></p>
10271 !! end
10272
10273 !! test
10274 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10275 !! options
10276 title=[[*RFC 1234 http://example.com/]]
10277 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10278 !! wikitext
10279 {{PAGENAME}}
10280 !! html/php
10281 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10282 </p>
10283 !! html+tidy
10284 <p>*RFC 1234 http://example.com/</p>
10285 !! end
10286
10287 !! test
10288 Magic Word: {{PAGENAMEE}}
10289 !! options
10290 title=[[User:Ævar Arnfjörð Bjarmason]]
10291 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10292 !! wikitext
10293 {{PAGENAMEE}}
10294 !! html/*
10295 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10296 </p>
10297 !! end
10298
10299 !! test
10300 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10301 !! options
10302 title=[[*RFC 1234 http://example.com/]]
10303 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10304 !! wikitext
10305 {{PAGENAMEE}}
10306 !! html/php
10307 <p>&#42;RFC_1234_http&#58;//example.com/
10308 </p>
10309 !! html+tidy
10310 <p>*RFC_1234_http://example.com/</p>
10311 !! end
10312
10313 !! test
10314 Magic Word: {{REVISIONID}}
10315 !! options
10316 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10317 !! wikitext
10318 {{REVISIONID}}
10319 !! html/*
10320 <p>1337
10321 </p>
10322 !! end
10323
10324 !! test
10325 Magic Word: {{SCRIPTPATH}}
10326 !! options
10327 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10328 !! wikitext
10329 {{SCRIPTPATH}}
10330 !! html/*
10331
10332 !! end
10333
10334 !! test
10335 Magic Word: {{STYLEPATH}}
10336 !! options
10337 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10338 !! wikitext
10339 {{STYLEPATH}}
10340 !! html/*
10341 <p>/skins
10342 </p>
10343 !! end
10344
10345 !! test
10346 Magic Word: {{SERVER}}
10347 !! options
10348 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10349 !! wikitext
10350 {{SERVER}}
10351 !! html/*
10352 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10353 </p>
10354 !! end
10355
10356 !! test
10357 Magic Word: {{SERVERNAME}}
10358 !! options
10359 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10360 !! wikitext
10361 {{SERVERNAME}}
10362 !! html/*
10363 <p>example.org
10364 </p>
10365 !! end
10366
10367 !! test
10368 Magic Word: {{SITENAME}}
10369 !! options
10370 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10371 !! wikitext
10372 {{SITENAME}}
10373 !! html/*
10374 <p>MediaWiki
10375 </p>
10376 !! end
10377
10378 !! test
10379 Magic Word: {{PAGELANGUAGE}}
10380 !! options
10381 language=fr
10382 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10383 !! wikitext
10384 {{PAGELANGUAGE}}
10385 !! html/*
10386 <p>fr
10387 </p>
10388 !! end
10389
10390 !! test
10391 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10392 !! options
10393 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10394 !! wikitext
10395 {{PAGELANGUAGE}}
10396 !! html/*
10397 <p>en
10398 </p>
10399 !! end
10400
10401 !! test
10402 Case-sensitive magic words, when cased differently, should just be template transclusions
10403 !! wikitext
10404 {{CurrentMonth}}
10405 {{currentday}}
10406 {{cURreNTweEK}}
10407 {{currentHour}}
10408 !! html
10409 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
10410 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
10411 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
10412 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
10413 </p>
10414 !! end
10415
10416 !! test
10417 Case-insensitive magic words should still work with weird casing.
10418 !! wikitext
10419 {{sErVeRNaMe}}
10420 {{LCFirst:AOEU}}
10421 {{ucFIRST:aoeu}}
10422 {{SERver}}
10423 !! html
10424 <p>example.org
10425 aOEU
10426 Aoeu
10427 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10428 </p>
10429 !! end
10430
10431 # From plwiki:PLOS_ONE
10432 !! test
10433 Parsoid: Page property magic word with magic word contents
10434 !! wikitext
10435 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10436 !! html/parsoid
10437 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
10438 !! end
10439
10440 !! test
10441 Parsoid: Template-generated DISPLAYTITLE
10442 !! wikitext
10443 {{{{echo|DISPLAYTITLE}}:Foo}}
10444 !! html/parsoid
10445 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
10446 !! end
10447
10448 !! test
10449 Namespace 1 {{ns:1}}
10450 !! wikitext
10451 {{ns:1}}
10452 !! html
10453 <p>Talk
10454 </p>
10455 !! end
10456
10457 !! test
10458 Namespace 1 {{ns:01}}
10459 !! wikitext
10460 {{ns:01}}
10461 !! html
10462 <p>Talk
10463 </p>
10464 !! end
10465
10466 !! test
10467 Namespace 0 {{ns:0}} (T6783)
10468 !! wikitext
10469 {{ns:0}}
10470 !! html
10471
10472 !! end
10473
10474 !! test
10475 Namespace 0 {{ns:00}} (T6783)
10476 !! wikitext
10477 {{ns:00}}
10478 !! html
10479
10480 !! end
10481
10482 !! test
10483 Namespace -1 {{ns:-1}}
10484 !! wikitext
10485 {{ns:-1}}
10486 !! html
10487 <p>Special
10488 </p>
10489 !! end
10490
10491 !! test
10492 Namespace User {{ns:User}}
10493 !! wikitext
10494 {{ns:User}}
10495 !! html
10496 <p>User
10497 </p>
10498 !! end
10499
10500 !! test
10501 Namespace User talk {{ns:User_talk}}
10502 !! wikitext
10503 {{ns:User_talk}}
10504 !! html
10505 <p>User talk
10506 </p>
10507 !! end
10508
10509 !! test
10510 Namespace User talk {{ns:uSeR tAlK}}
10511 !! wikitext
10512 {{ns:uSeR tAlK}}
10513 !! html
10514 <p>User talk
10515 </p>
10516 !! end
10517
10518 !! test
10519 Namespace File {{ns:File}}
10520 !! wikitext
10521 {{ns:File}}
10522 !! html
10523 <p>File
10524 </p>
10525 !! end
10526
10527 !! test
10528 Namespace File {{ns:Image}}
10529 !! wikitext
10530 {{ns:Image}}
10531 !! html
10532 <p>File
10533 </p>
10534 !! end
10535
10536 !! test
10537 Namespace (lang=de) Benutzer {{ns:User}}
10538 !! options
10539 language=de
10540 !! wikitext
10541 {{ns:User}}
10542 !! html
10543 <p>Benutzer
10544 </p>
10545 !! end
10546
10547 !! test
10548 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10549 !! options
10550 language=de
10551 !! wikitext
10552 {{ns:3}}
10553 !! html
10554 <p>Benutzer Diskussion
10555 </p>
10556 !! end
10557
10558 !! test
10559 Urlencode
10560 !! wikitext
10561 {{urlencode:hi world?!}}
10562 {{urlencode:hi world?!|WIKI}}
10563 {{urlencode:hi world?!|PATH}}
10564 {{urlencode:hi world?!|QUERY}}
10565 !! html/php
10566 <p>hi+world%3F%21
10567 hi_world%3F!
10568 hi%20world%3F%21
10569 hi+world%3F%21
10570 </p>
10571 !! end
10572
10573 !! test
10574 Magic Word: prioritize type info over data-parsoid
10575 !! options
10576 parsoid=html2wt
10577 !! html/parsoid
10578 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10579 !! wikitext
10580 __FORCETOC__
10581 !! end
10582
10583 !! test
10584 Magic Word: serialize on separate line (parsoid)
10585 !! options
10586 parsoid=wt2wt,html2wt
10587 !! wikitext
10588 foo
10589 __NOTOC__
10590 bar
10591 !! html/parsoid
10592 foo<meta property="mw:PageProp/notoc"/>bar
10593 !! end
10594
10595 !! test
10596 Magic Word: rt non-english wikis
10597 !! options
10598 parsoid=wt2wt
10599 language=de
10600 !! wikitext
10601 __NOEDITSECTION__
10602 !! html/parsoid
10603 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10604 !! end
10605
10606 !!test
10607 __proto__ is treated as normal wikitext (T105997)
10608 !!wikitext
10609 __proto__
10610 !!html
10611 <p>__proto__
10612 </p>
10613 !!end
10614
10615 ###
10616 ### Magic links
10617 ###
10618 !! test
10619 Magic links: internal link to RFC (T2479)
10620 !! wikitext
10621 [[RFC 123]]
10622 !! html/php
10623 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
10624 </p>
10625 !! html/parsoid
10626 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10627 !! end
10628
10629 !! test
10630 Magic links: RFC (T2479)
10631 !! wikitext
10632 RFC 822
10633 !! html/php
10634 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10635 </p>
10636 !! html/parsoid
10637 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10638 !! end
10639
10640 !! test
10641 Magic links: RFC (T67278)
10642 !! wikitext
10643 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10644 !! html/php
10645 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
10646 </p>
10647 !! html/parsoid
10648 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10649 !! end
10650
10651 !! test
10652 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
10653 !! wikitext
10654 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10655 RFC
10656 822
10657 !! html/php
10658 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10659 RFC
10660 822
10661 </p>
10662 !! html/parsoid
10663 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
10664 RFC
10665 822</p>
10666 !! end
10667
10668 !! test
10669 Magic links: ISBN (T3937)
10670 !! wikitext
10671 ISBN 0-306-40615-2
10672 !! html/php
10673 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10674 </p>
10675 !! html/parsoid
10676 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10677 !! end
10678
10679 !! test
10680 Magic links: ISBN (T67278)
10681 !! wikitext
10682 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10683 !! html/php
10684 <p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10685 </p>
10686 !! html/parsoid
10687 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
10688 !! end
10689
10690 !! test
10691 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
10692 !! wikitext
10693 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10694 ISBN
10695 9780316098113
10696 ISBN 978
10697 0316098113
10698 !! html/php
10699 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10700 ISBN
10701 9780316098113
10702 ISBN 978
10703 0316098113
10704 </p>
10705 !! html/parsoid
10706 <p><a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 978<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>0<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>316<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span>09811<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>3</a>
10707 ISBN
10708 9780316098113
10709 ISBN 978
10710 0316098113</p>
10711 !! end
10712
10713 !! test
10714 Magic links: PMID incorrectly converts space to underscore
10715 !! wikitext
10716 PMID 1234
10717 !! html/php
10718 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10719 </p>
10720 !! html/parsoid
10721 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10722 !! end
10723
10724 !! test
10725 Magic links: PMID (T67278)
10726 !! wikitext
10727 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10728 !! html/php
10729 <p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.
10730 </p>
10731 !! html/parsoid
10732 <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
10733 !! end
10734
10735 !! test
10736 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
10737 !! wikitext
10738 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10739 PMID
10740 1234
10741 !! html/php
10742 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10743 PMID
10744 1234
10745 </p>
10746 !! html/parsoid
10747 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 1234</a>
10748 PMID
10749 1234</p>
10750 !! end
10751
10752 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10753 # since these are ExtLinkText, not MagicLinkText
10754 !! test
10755 Magic links: use appropriate serialization for "almost" magic links.
10756 !! wikitext
10757 X[[Special:BookSources/0978739256|foo]]
10758
10759 X[//tools.ietf.org/html/rfc1234 foo]
10760 !! html/php
10761 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10762 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10763 </p>
10764 !! html/parsoid
10765 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10766 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10767 !! end
10768
10769 !! test
10770 Magic links: All disabled (T47942)
10771 !! options
10772 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10773 !! wikitext
10774 ISBN 0-306-40615-2
10775 PMID 1234
10776 RFC 4321
10777 !! html/php
10778 <p>ISBN 0-306-40615-2
10779 PMID 1234
10780 RFC 4321
10781 </p>
10782 !! end
10783
10784 ###
10785 ### Templates
10786 ####
10787
10788 !! test
10789 Nonexistent template
10790 !! wikitext
10791 {{thistemplatedoesnotexist}}
10792 !! html
10793 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
10794 </p>
10795 !! end
10796
10797 !! test
10798 Template with invalid target containing tags
10799 !! wikitext
10800 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10801 !! html
10802 <p>{{a<b>b</b>|foo|a=b|a = b}}
10803 </p>
10804 !! end
10805
10806 !! test
10807 Template with invalid target containing unclosed tag
10808 !! wikitext
10809 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10810 !! html
10811 <p>{{a<b>|foo|a=b|a = b}}</b>
10812 </p>
10813 !! end
10814
10815 !! test
10816 Template with invalid target containing wikilink
10817 !! wikitext
10818 {{[[Main Page]]}}
10819 !! html/php
10820 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10821 </p>
10822 !! html/parsoid
10823 <p><span typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"[[Main Page]]"},"params":{},"i":0}}]}'>{{</span><a rel="mw:WikiLink" href="./Main_Page" about="#mwt1">Main Page</a><span about="#mwt1">}}</span></p>
10824 !! end
10825
10826 !! test
10827 Template with just whitespace in it, T70421
10828 !! wikitext
10829 {{echo|{{ }}}}
10830 !! html/parsoid
10831 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</p>
10832 !! end
10833
10834 !! article
10835 Template:test
10836 !! text
10837 This is a test template
10838 !! endarticle
10839
10840 !! test
10841 Simple template
10842 !! wikitext
10843 {{test}}
10844 !! html
10845 <p>This is a test template
10846 </p>
10847 !! end
10848
10849 !! test
10850 Template with explicit namespace
10851 !! wikitext
10852 {{Template:test}}
10853 !! html
10854 <p>This is a test template
10855 </p>
10856 !! end
10857
10858
10859 !! article
10860 Template:paramtest
10861 !! text
10862 This is a test template with parameter {{{param}}}
10863 !! endarticle
10864
10865 !! test
10866 Template parameter
10867 !! wikitext
10868 {{paramtest|param=foo}}
10869 !! html
10870 <p>This is a test template with parameter foo
10871 </p>
10872 !! end
10873
10874 !! article
10875 Template:paramtestnum
10876 !! text
10877 [[{{{1}}}|{{{2}}}]]
10878 !! endarticle
10879
10880 !! test
10881 Template unnamed parameter
10882 !! wikitext
10883 {{paramtestnum|Main Page|the main page}}
10884 !! html
10885 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10886 </p>
10887 !! end
10888
10889 !! article
10890 Template:templatesimple
10891 !! text
10892 (test)
10893 !! endarticle
10894
10895 !! article
10896 Template:templateredirect
10897 !! text
10898 #redirect [[Template:templatesimple]]
10899 !! endarticle
10900
10901 !! article
10902 Template:templateasargtestnum
10903 !! text
10904 {{{{{1}}}}}
10905 !! endarticle
10906
10907 !! article
10908 Template:templateasargtest
10909 !! text
10910 {{template{{{templ}}}}}
10911 !! endarticle
10912
10913 !! article
10914 Template:templateasargtest2
10915 !! text
10916 {{{{{templ}}}}}
10917 !! endarticle
10918
10919 !! test
10920 Template with template name as unnamed argument
10921 !! wikitext
10922 {{templateasargtestnum|templatesimple}}
10923 !! html
10924 <p>(test)
10925 </p>
10926 !! end
10927
10928 !! test
10929 Template with template name as argument
10930 !! wikitext
10931 {{templateasargtest|templ=simple}}
10932 !! html
10933 <p>(test)
10934 </p>
10935 !! end
10936
10937 !! test
10938 Template with template name as argument (2)
10939 !! wikitext
10940 {{templateasargtest2|templ=templatesimple}}
10941 !! html
10942 <p>(test)
10943 </p>
10944 !! end
10945
10946 !! article
10947 Template:templateasargtestdefault
10948 !! text
10949 {{{{{templ|templatesimple}}}}}
10950 !! endarticle
10951
10952 !! article
10953 Template:templa
10954 !! text
10955 '''templ'''
10956 !! endarticle
10957
10958 !! test
10959 Template with default value
10960 !! wikitext
10961 {{templateasargtestdefault}}
10962 !! html
10963 <p>(test)
10964 </p>
10965 !! end
10966
10967 !! test
10968 Template with default value (value set)
10969 !! wikitext
10970 {{templateasargtestdefault|templ=templa}}
10971 !! html
10972 <p><b>templ</b>
10973 </p>
10974 !! end
10975
10976 !! test
10977 Template redirect
10978 !! wikitext
10979 {{templateredirect}}
10980 !! html/php
10981 <p>(test)
10982 </p>
10983 !! html/parsoid
10984 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10985 !! end
10986
10987 !! test
10988 Template with argument in separate line
10989 !! wikitext
10990 {{ templateasargtest |
10991 templ = simple }}
10992 !! html
10993 <p>(test)
10994 </p>
10995 !! end
10996
10997 !! test
10998 Template with complex template as argument
10999 !! wikitext
11000 {{paramtest|
11001 param ={{ templateasargtest |
11002 templ = simple }}}}
11003 !! html
11004 <p>This is a test template with parameter (test)
11005 </p>
11006 !! end
11007
11008 !! test
11009 Template with thumb image (with link in description)
11010 !! wikitext
11011 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11012 !! html/php
11013 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
11014
11015 !! html+tidy
11016 <p>This is a test template with parameter</p>
11017 <div class="thumb tright">
11018 <div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a>
11019 <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div>
11020 </div>
11021 </div>
11022 !! html/parsoid
11023 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
11024 !! end
11025
11026 !! article
11027 Template:complextemplate
11028 !! text
11029 {{{1}}} {{paramtest|
11030 param ={{{param}}}}}
11031 !! endarticle
11032
11033 !! test
11034 Template with complex arguments
11035 !! wikitext
11036 {{complextemplate|
11037 param ={{ templateasargtest |
11038 templ = simple }}|[[Template:complextemplate|link]]}}
11039 !! html
11040 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11041 </p>
11042 !! end
11043
11044 !! test
11045 T2553: link with two variables in a piped link
11046 !! wikitext
11047 {|
11048 |[[{{{1}}}|{{{2}}}]]
11049 |}
11050 !! html/php
11051 <table>
11052 <tr>
11053 <td>[[{{{1}}}|{{{2}}}]]
11054 </td></tr></table>
11055
11056 !! html/parsoid
11057 <table>
11058 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{},"i":0}}]}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"2"},"params":{},"i":0}}]}'>{{{2}}}</span>]]</td></tr>
11059 </tbody></table>
11060 !! end
11061
11062 # See: T2553
11063 !! test
11064 Abort table cell attribute parsing on wikilink
11065 !! wikitext
11066 {|
11067 | testing [[one|two]] | three || four
11068 | testing one two | three || four
11069 | testing="[[one|two]]" | three || four
11070 |}
11071 !! html/php
11072 <table>
11073 <tr>
11074 <td> testing <a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a> | three </td>
11075 <td> four
11076 </td>
11077 <td> three </td>
11078 <td> four
11079 </td>
11080 <td> testing="<a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a>" | three </td>
11081 <td> four
11082 </td></tr></table>
11083
11084 !! html/parsoid
11085 <table>
11086 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> testing <a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a> | three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td>
11087 <td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'> three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td>
11088 <td> testing="<a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a>" | three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td></tr>
11089 </tbody></table>
11090 !! end
11091
11092 !! test
11093 Don't abort table cell attribute parsing if wikilink is found in template arg
11094 !! wikitext
11095 {|
11096 | Test {{#tag:ref|One two "[[three]]" four}}
11097 |}
11098 !! html/parsoid
11099 <table>
11100 <tbody><tr><td> Test <ref about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"#tag"},"params":{"1":{"wt":"One two \"[[three]]\" four"}},"i":0}}]}'>One two "<a rel="mw:WikiLink" href="./Three" title="Three">three</a>" four</ref></td></tr>
11101 </tbody></table>
11102 !! end
11103
11104 !! test
11105 Magic variable as template parameter
11106 !! wikitext
11107 {{paramtest|param={{SITENAME}}}}
11108 !! html
11109 <p>This is a test template with parameter MediaWiki
11110 </p>
11111 !! end
11112
11113 !! article
11114 Template:linktest
11115 !! text
11116 [[{{{param}}}|link]]
11117 !! endarticle
11118
11119 !! test
11120 Template parameter as link source
11121 !! wikitext
11122 {{linktest|param=Main Page}}
11123 !! html
11124 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11125 </p>
11126 !! end
11127
11128 !!article
11129 Template:paramtest2
11130 !! text
11131 including another template, {{paramtest|param={{{arg}}}}}
11132 !! endarticle
11133
11134 !! test
11135 Template passing argument to another template
11136 !! wikitext
11137 {{paramtest2|arg='hmm'}}
11138 !! html
11139 <p>including another template, This is a test template with parameter 'hmm'
11140 </p>
11141 !! end
11142
11143 !! article
11144 Template:Linktest2
11145 !! text
11146 Main Page
11147 !! endarticle
11148
11149 !! test
11150 Template as link source
11151 !! wikitext
11152 [[{{linktest2}}]]
11153
11154 [[{{linktest2}}|Main Page]]
11155
11156 [[{{linktest2}}]]Page
11157 !! html
11158 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11159 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11160 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11161 </p>
11162 !! end
11163
11164
11165 !! article
11166 Template:loop1
11167 !! text
11168 {{loop2}}
11169 !! endarticle
11170
11171 !! article
11172 Template:loop2
11173 !! text
11174 {{loop1}}
11175 !! endarticle
11176
11177 !! test
11178 Template infinite loop
11179 !! wikitext
11180 {{loop1}}
11181 !! html
11182 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11183 </p>
11184 !! end
11185
11186 !! test
11187 Template from main namespace
11188 !! wikitext
11189 {{:Main Page}}
11190 !! html
11191 <p>blah blah
11192 </p>
11193 !! end
11194
11195 !! article
11196 Template:table
11197 !! text
11198 {|
11199 | 1 || 2
11200 |-
11201 | 3 || 4
11202 |}
11203 !! endarticle
11204
11205 !! test
11206 T2529: Template with table, not included at beginning of line
11207 !! wikitext
11208 foo {{table}}
11209 !! html
11210 <p>foo
11211 </p>
11212 <table>
11213 <tr>
11214 <td> 1 </td>
11215 <td> 2
11216 </td></tr>
11217 <tr>
11218 <td> 3 </td>
11219 <td> 4
11220 </td></tr></table>
11221
11222 !! end
11223
11224 !! test
11225 T2523: Template shouldn't eat newline (or add an extra one before table)
11226 !! wikitext
11227 foo
11228 {{table}}
11229 !! html
11230 <p>foo
11231 </p>
11232 <table>
11233 <tr>
11234 <td> 1 </td>
11235 <td> 2
11236 </td></tr>
11237 <tr>
11238 <td> 3 </td>
11239 <td> 4
11240 </td></tr></table>
11241
11242 !! end
11243
11244 !! test
11245 T2041: Template parameters shown as broken links
11246 !! wikitext
11247 {{{parameter}}}
11248 !! html
11249 <p>{{{parameter}}}
11250 </p>
11251 !! end
11252
11253 !! test
11254 Template with targets containing wikilinks
11255 !! wikitext
11256 {{[[foo]]}}
11257
11258 {{[[{{echo|foo}}]]}}
11259
11260 {{{{echo|[[foo}}]]}}
11261 !! html
11262 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11263 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11264 </p><p>{{[[foo}}]]
11265 </p>
11266 !! end
11267
11268 !! article
11269 Template:''
11270 !! text
11271 bar
11272 !! endarticle
11273
11274 !! test
11275 Templates: Double quotes as template target
11276 !! wikitext
11277 foo {{''}} baz
11278 !! html/php
11279 <p>foo bar baz
11280 </p>
11281 !! html/parsoid
11282 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;","href":"./Template:&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
11283 </p>
11284 !! end
11285
11286 ## This test is about making sure Parsoid's data-mw is well formed in the
11287 ## face of multiple templates with intersecting and overlapping ranges. The
11288 ## wikitext itself is wretched.
11289 !! test
11290 Templates with intersecting and overlapping ranges
11291 !! wikitext
11292 {|{{echo|
11293 <p>ha</p>}}
11294 {|{{echo|
11295 <p>ho</p>}}
11296 {{echo|{{!}}hi}}
11297 |}
11298 !! html/php+tidy
11299 <p>ha</p>
11300 <p>ho</p>
11301 <table>
11302 <tr>
11303 <td></td>
11304 </tr>
11305 <tr>
11306 <td>hi</td>
11307 </tr>
11308 </table>
11309 <table>
11310 <tr>
11311 <td></td>
11312 </tr>
11313 </table>
11314 !! html/parsoid
11315 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]],"firstWikitextNode":"table"}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ha&lt;/p>"}},"i":0}},"\n","{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ho&lt;/p>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}}hi"}},"i":2}},"\n|}"]}'>ha</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11316
11317 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11318
11319 <tbody><tr><td>hi</td></tr>
11320 </tbody></table>
11321 !! end
11322
11323 !! article
11324 Template:MSGNW test
11325 !! text
11326 ''None'' of '''this''' should be
11327 * interpreted
11328 but rather passed unmodified
11329 {{test}}
11330 <gallery>
11331 File:Foobar.jpg
11332 </gallery>
11333 <!-- comment -->
11334 !! endarticle
11335
11336 # hmm, fix this or just deprecate msgnw and document its behavior?
11337 !! test
11338 msgnw keyword
11339 !! wikitext
11340 {{msgnw:MSGNW test}}
11341 !! html/php
11342 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11343 &#42; interpreted
11344 &#32;but rather passed unmodified
11345 &#123;&#123;test&#125;&#125;
11346 &#60;gallery&#62;
11347 File:Foobar.jpg
11348 &#60;/gallery&#62;
11349 &#60;!-- comment --&#62;
11350 </p>
11351 !! end
11352
11353 !! test
11354 int keyword
11355 !! wikitext
11356 {{int:youhavenewmessages|lots of money|not!}}
11357 !! html
11358 <p>You have lots of money (not!).
11359 </p>
11360 !! end
11361
11362 !! test
11363 int keyword - non-existing message
11364 !! wikitext
11365 {{int:var}}
11366 !! html
11367 <p>⧼var⧽
11368 </p>
11369 !! end
11370
11371 !! article
11372 Template:Includes
11373 !! text
11374 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11375 !! endarticle
11376
11377 !! test
11378 <includeonly> and <noinclude> being included
11379 !! wikitext
11380 {{Includes}}
11381 !! html
11382 <p>Foobar
11383 </p>
11384 !! end
11385
11386 !! article
11387 Template:Includes2
11388 !! text
11389 <onlyinclude>Foo</onlyinclude>bar
11390 !! endarticle
11391
11392 !! test
11393 <onlyinclude> being included
11394 !! wikitext
11395 {{Includes2}}
11396 !! html
11397 <p>Foo
11398 </p>
11399 !! end
11400
11401
11402 !! article
11403 Template:Includes3
11404 !! text
11405 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11406 !! endarticle
11407
11408 !! test
11409 <onlyinclude> and <includeonly> being included
11410 !! wikitext
11411 {{Includes3}}
11412 !! html
11413 <p>Foo
11414 </p>
11415 !! end
11416
11417 !! test
11418 <includeonly> and <noinclude> on a page
11419 !! wikitext
11420 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11421 !! html
11422 <p>Foozar
11423 </p>
11424 !! end
11425
11426 !! test
11427 Un-closed <noinclude>
11428 !! wikitext
11429 <noinclude>
11430 !! html
11431 !! end
11432
11433 !! test
11434 <onlyinclude> on a page
11435 !! wikitext
11436 <onlyinclude>Foo</onlyinclude>bar
11437 !! html
11438 <p>Foobar
11439 </p>
11440 !! end
11441
11442 !! test
11443 Un-closed <onlyinclude>
11444 !! wikitext
11445 <onlyinclude>
11446 !! html
11447 !! end
11448
11449 !!test
11450 Self-closed noinclude, includeonly, onlyinclude tags
11451 !! wikitext
11452 <noinclude />
11453 <includeonly />
11454 <onlyinclude />
11455 !! html
11456 <p><br />
11457 </p>
11458 !!end
11459
11460 !!test
11461 Unbalanced includeonly and noinclude tags
11462 !! wikitext
11463 {|
11464 |a</noinclude>
11465 |b</noinclude></noinclude>
11466 |c</noinclude></includeonly>
11467 |d</includeonly></includeonly>
11468 |}
11469 !! html
11470 <table>
11471 <tr>
11472 <td>a
11473 </td>
11474 <td>b
11475 </td>
11476 <td>c&lt;/includeonly&gt;
11477 </td>
11478 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11479 </td></tr></table>
11480
11481 !!end
11482
11483 !! article
11484 Template:Includeonly section
11485 !! text
11486 <includeonly>
11487 ==Includeonly section==
11488 </includeonly>
11489 ==Section T-1==
11490 !!endarticle
11491
11492 !! test
11493 T8563: Edit link generation for section shown by <includeonly>
11494 !! wikitext
11495 {{includeonly section}}
11496 !! html
11497 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11498 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11499
11500 !! end
11501
11502 # Uses same input as the contents of [[Template:Includeonly section]]
11503 !! test
11504 T8563: Section extraction for section shown by <includeonly>
11505 !! options
11506 section=T-2
11507 !! wikitext
11508 <includeonly>
11509 ==Includeonly section==
11510 </includeonly>
11511 ==Section T-2==
11512 !! html
11513 ==Section T-2==
11514 !! end
11515
11516 !! test
11517 T8563: Edit link generation for section suppressed by <includeonly>
11518 !! wikitext
11519 <includeonly>
11520 ==Includeonly section==
11521 </includeonly>
11522 ==Section 1==
11523 !! html
11524 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11525
11526 !! end
11527
11528 !! test
11529 T8563: Section extraction for section suppressed by <includeonly>
11530 !! options
11531 section=1
11532 !! wikitext
11533 <includeonly>
11534 ==Includeonly section==
11535 </includeonly>
11536 ==Section 1==
11537 !! html
11538 ==Section 1==
11539 !! end
11540
11541 !! test
11542 Un-closed <includeonly>
11543 !! wikitext
11544 <includeonly>
11545 !! html/php
11546 !! html/parsoid
11547 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11548 !! end
11549
11550 ## We used to, but no longer wt2wt this test since the default serializer
11551 ## will normalize the include directives to serialize on their own line.
11552 ## Selser will take care of preserving formatting in scenarios where they
11553 ## intermingled with other wikitext.
11554 !! test
11555 Includes and comments at SOL
11556 !! options
11557 parsoid=wt2html,html2html
11558 !! wikitext
11559 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11560
11561 <noinclude>
11562 some
11563 </noinclude>* stuff
11564 * here
11565
11566 <includeonly>can have stuff</includeonly>=== here ===
11567
11568 !! html/php
11569 <h2><span class="mw-headline" id="hu">hu</span></h2>
11570 <p>some
11571 </p>
11572 <ul><li> stuff</li>
11573 <li> here</li></ul>
11574 <h3><span class="mw-headline" id="here">here</span></h3>
11575
11576 !! html/parsoid
11577 <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment --><h2> hu </h2>
11578
11579 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11580 <p>some</p>
11581 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11582 <li> here</li></ul>
11583
11584 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3> here </h3>
11585
11586 !! end
11587
11588 # TODO: test with DOM fragment reuse!
11589 !! test
11590 Parsoid: DOM fragment reuse
11591 !! options
11592 parsoid=wt2wt,wt2html
11593 !! wikitext
11594 a{{echo|b<table></table>c}}d
11595
11596 a{{echo|b
11597 <table></table>
11598 c}}d
11599
11600 {{echo|a
11601
11602 <table></table>
11603
11604 b}}
11605 !! html
11606 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b&lt;table>&lt;/table>c"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
11607
11608 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n&lt;table>&lt;/table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><span about="#mwt2">
11609 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11610 </span><p about="#mwt2">cd</p>
11611
11612 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n&lt;table>&lt;/table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>a</p><span about="#mwt3">
11613
11614 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11615
11616 </span><p about="#mwt3">b</p>
11617 !! end
11618
11619 !! test
11620 Parsoid: Merge double tds (T52603)
11621 !! options
11622 parsoid
11623 !! wikitext
11624 {|
11625 |{{echo|{{!}} foo}}
11626 |}
11627 !! html
11628 <table><tbody>
11629 <tr><td about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":0}}]}'> foo</td></tr>
11630 </tbody></table>
11631 !! end
11632
11633 !! test
11634 Parsoid: Merge double tds in nested transclusion content (T52603)
11635 !! options
11636 parsoid
11637 !! wikitext
11638 {{echo|<div>}}
11639 {|
11640 |{{echo|{{!}} foo}}
11641 |}
11642 {{echo|</div>}}
11643 !! html
11644 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<div>"}},"i":0}},"\n{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":1}},"\n|}\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"</div>"}},"i":2}}]}'>
11645 <table><tbody>
11646 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11647 </tbody></table>
11648 </div>
11649 !! end
11650
11651 ###
11652 ### <includeonly> and <noinclude> in attributes
11653 ###
11654 !!test
11655 0. includeonly around the entire attribute
11656 !! wikitext
11657 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11658 !! html
11659 <p><span id="v2">bar</span>
11660 </p>
11661 !!end
11662
11663 !!test
11664 1. includeonly in html attr key
11665 !! wikitext
11666 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11667 !! html
11668 <p><span id="foo">bar</span>
11669 </p>
11670 !!end
11671
11672 !!test
11673 2. includeonly in html attr value
11674 !! wikitext
11675 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11676 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11677 !! html
11678 <p><span id="v1">bar</span>
11679 <span id="v1">bar</span>
11680 </p>
11681 !!end
11682
11683 !!test
11684 3. includeonly in part of an attr value
11685 !! wikitext
11686 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11687 !! html
11688 <p><span style="color:red;">bar</span>
11689 </p>
11690 !!end
11691
11692 !!test
11693 4. includeonly in table attributes
11694 !! wikitext
11695 {|
11696 |- <noinclude>
11697 |-
11698 |a
11699 </noinclude>
11700 |- <includeonly>
11701 |-
11702 |b
11703 </includeonly>
11704 |}
11705 !! html
11706 <table>
11707
11708
11709 <tr>
11710 <td>a
11711 </td></tr>
11712 </table>
11713
11714 !!end
11715
11716 ###
11717 ### Token Stream Patcher tests
11718 ###
11719 ### These tests won't always pass wt2wt and other modes because
11720 ### on serialization, the table will be output on a new line.
11721 ### For now, we are blacklisting them, and using this to test selser.
11722 ###
11723
11724 !!test
11725 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11726 !!options
11727 parsoid=wt2html,wt2wt
11728 !!wikitext
11729 {{echo|}}{| width = '100%'
11730 |foo
11731 |}
11732 !!html/parsoid
11733 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11734 <tbody><tr><td>foo</td></tr>
11735 </tbody></table>
11736 !!end
11737
11738 ## We used to, but no longer wt2wt this test since the default serializer
11739 ## will normalize the include directives to serialize on their own line.
11740 ## Selser will take care of preserving formatting in scenarios where they
11741 ## intermingled with other wikitext.
11742 !!test
11743 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11744 !!options
11745 parsoid=wt2html
11746 !!wikitext
11747 <includeonly>a</includeonly>{| {{{b}}}
11748 |c
11749 |}
11750 !!html/parsoid
11751 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}' data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[31,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"b\"},\"params\":{},\"i\":0}}]}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
11752 <tbody><tr><td>c</td></tr>
11753 </tbody></table>
11754 !!end
11755
11756 !! test
11757 Table wikitext syntax outside wiki-tables
11758 !! wikitext
11759 a
11760 |+ not a caption
11761 ! not a table heading
11762 |- not a table row
11763 | not a table cell
11764 | class="foo bar" | baz
11765 b
11766 |}
11767 |-
11768 c
11769 !! html
11770 <p>a
11771 |+ not a caption
11772 ! not a table heading
11773 |- not a table row
11774 | not a table cell
11775 | class="foo bar" | baz
11776 b
11777 |}
11778 |-
11779 c
11780 </p>
11781 !! end
11782
11783 ###
11784 ### Testing parsing of templates where a template arg
11785 ### has the same name as the template itself.
11786 ###
11787
11788 !! article
11789 Template:quote
11790 !! text
11791 {{{quote|{{{1}}}}}}
11792 !! endarticle
11793
11794 !!test
11795 Templates: Template Name/Arg clash: 1. Use of positional param
11796 !! wikitext
11797 {{quote|foo}}
11798 !! html
11799 <p>foo
11800 </p>
11801 !!end
11802
11803 !!test
11804 Templates: Template Name/Arg clash: 2. Use of named param
11805 !! wikitext
11806 {{quote|quote=foo}}
11807 !! html
11808 <p>foo
11809 </p>
11810 !!end
11811
11812 !!test
11813 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11814 !! wikitext
11815 {{quote|quote}}
11816 !! html
11817 <p>quote
11818 </p>
11819 !!end
11820
11821 ###
11822 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11823 ###
11824
11825 !!test
11826 Templates: 1. Simple use
11827 !! wikitext
11828 {{echo|Foo}}
11829 !! html
11830 <p>Foo
11831 </p>
11832 !!end
11833
11834 !!test
11835 Templates: 2. Inside a block tag
11836 !! wikitext
11837 <div>{{echo|Foo}}</div>
11838 <blockquote>{{echo|Foo}}</blockquote>
11839 !! html
11840 <div>Foo</div>
11841 <blockquote>Foo</blockquote>
11842
11843 !! html+tidy
11844 <div>Foo</div>
11845 <blockquote>
11846 <p>Foo</p>
11847 </blockquote>
11848 !!end
11849
11850 !!test
11851 Templates: P-wrapping: 1a. Templates on consecutive lines
11852 !! wikitext
11853 {{echo|Foo}}
11854 {{echo|bar}}
11855 !! html
11856 <p>Foo
11857 bar
11858 </p>
11859 !!end
11860
11861 !!test
11862 Templates: P-wrapping: 1b. Templates on consecutive lines
11863 !! wikitext
11864 Foo
11865
11866 {{echo|bar}}
11867 {{echo|baz}}
11868 !! html
11869 <p>Foo
11870 </p><p>bar
11871 baz
11872 </p>
11873 !!end
11874
11875 !!test
11876 Templates: P-wrapping: 1c. Templates on consecutive lines
11877 !! wikitext
11878 {{echo|Foo}}
11879 {{echo|bar}} <div>baz</div>
11880 !! html
11881 <p>Foo
11882 </p>
11883 bar <div>baz</div>
11884
11885 !! html+tidy
11886 <p>Foo</p>
11887 <p>bar</p>
11888 <div>baz</div>
11889 !! end
11890
11891 !!test
11892 Templates: P-wrapping: 1d. Template preceded by comment-only line
11893 !!options
11894 parsoid
11895 !! wikitext
11896 <!-- foo -->
11897 {{echo|Bar}}
11898 !! html
11899 <!-- foo -->
11900
11901 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11902 !!end
11903
11904 !!test
11905 Templates: Inline Text: 1. Multiple template uses
11906 !! wikitext
11907 {{echo|Foo}}bar{{echo|baz}}
11908 !! html
11909 <p>Foobarbaz
11910 </p>
11911 !!end
11912
11913 !!test
11914 Templates: Inline Text: 2. Back-to-back template uses
11915 !! wikitext
11916 {{echo|Foo}}{{echo|bar}}
11917 !! html
11918 <p>Foobar
11919 </p>
11920 !!end
11921
11922 !!test
11923 Templates: Block Tags: 1. Multiple template uses
11924 !! wikitext
11925 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11926 !! html
11927 <div>Foo</div><div>bar</div><div>baz</div>
11928
11929 !!end
11930
11931 !!test
11932 Templates: Block Tags: 2. Back-to-back template uses
11933 !! wikitext
11934 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11935 !! html
11936 <div>Foo</div><div>bar</div>
11937
11938 !!end
11939
11940 # This is an edge case relating to paragraph wrapping.
11941 !!test
11942 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11943 !! wikitext
11944 {{echo|a
11945 b</p>}}
11946 !! html/parsoid
11947 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\nb&lt;/p>"}},"i":0}}]}'>a
11948 b</p>
11949 !!end
11950
11951 !!test
11952 Templates: Links: 1. Simple example
11953 !! wikitext
11954 {{echo|[[Foo|bar]]}}
11955 !! html
11956 <p><a href="/wiki/Foo" title="Foo">bar</a>
11957 </p>
11958 !!end
11959
11960 !!test
11961 Templates: Links: 2. Generation of link href
11962 !! wikitext
11963 [[{{echo|Foo}}|bar]]
11964 !! html
11965 <p><a href="/wiki/Foo" title="Foo">bar</a>
11966 </p>
11967 !!end
11968
11969 !!test
11970 Templates: Links: 3. Generation of part of a link href
11971 !! wikitext
11972 [[Fo{{echo|o}}|bar]]
11973
11974 [[Foo{{echo|bar}}]]
11975
11976 [[Foo{{echo|bar}}baz]]
11977
11978 [[Foo{{echo|bar}}|bar]]
11979
11980 [[:Foo{{echo|bar}}]]
11981
11982 [[:Foo{{echo|bar}}|bar]]
11983 !! html
11984 <p><a href="/wiki/Foo" title="Foo">bar</a>
11985 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11986 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11987 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11988 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11989 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11990 </p>
11991 !!end
11992
11993 !!test
11994 Templates: Links: 4. Multiple templates generating link href
11995 !! wikitext
11996 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11997 !! html
11998 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11999 </p>
12000 !!end
12001
12002 !!test
12003 Templates: Links: 5. Generation of link text
12004 !! wikitext
12005 [[Foo|{{echo|bar}}]]
12006 !! html
12007 <p><a href="/wiki/Foo" title="Foo">bar</a>
12008 </p>
12009 !!end
12010
12011 !!test
12012 Templates: Links: 5. Nested templates (only outermost template should be marked)
12013 !! wikitext
12014 {{echo|[[{{echo|Foo}}|bar]]}}
12015 !! html
12016 <p><a href="/wiki/Foo" title="Foo">bar</a>
12017 </p>
12018 !!end
12019
12020 !!test
12021 Templates: HTML Tag: 1. Generation of HTML attr. key
12022 !! wikitext
12023 <div {{echo|style}}="color:red;">foo</div>
12024 !! html
12025 <div style="color:red;">foo</div>
12026
12027 !!end
12028
12029 !!test
12030 Templates: HTML Tag: 2. Generation of HTML attr. value
12031 !! wikitext
12032 <div style={{echo|'color:red;'}}>foo</div>
12033 !! html
12034 <div style="color:red;">foo</div>
12035
12036 !!end
12037
12038 !!test
12039 Templates: HTML Tag: 3. Generation of HTML attr key and value
12040 !! wikitext
12041 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12042 !! html
12043 <div style="color:red;">foo</div>
12044
12045 !!end
12046
12047 !!test
12048 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12049 !! wikitext
12050 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12051 !! html
12052 <div title="This is a long title with just one piece templated">foo</div>
12053
12054 !!end
12055
12056 !!test
12057 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12058 !! wikitext
12059 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12060 !! html
12061 <div title="This is a long title with just one piece templated">foo</div>
12062
12063 !!end
12064
12065 !!test
12066 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12067 !! wikitext
12068 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12069 !! html
12070 <div title="This is a long title with just one piece templated">foo</div>
12071
12072 !!end
12073
12074 # SSS FIXME: While it is great we added support for all this,
12075 # do we want to make this part of the spec? Maybe we want to
12076 # deprecate this kind of usage in the future?
12077 !!test
12078 Templates: HTML Tag: 7. Generation of partial attribute key string
12079 !! wikitext
12080 <div st{{echo|yle}}="color:red;">foo</div>
12081 !! html
12082 <div style="color:red;">foo</div>
12083
12084 !!end
12085
12086 !! test
12087 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12088 !! wikitext
12089 <div {{echo|1=id="v1"}}>bar</div>
12090 !! html
12091 <div id="v1">bar</div>
12092
12093 !!end
12094
12095 !! test
12096 Templates: HTML Tag: 9. Multiple template-generated attributes
12097 !! wikitext
12098 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12099 !! html
12100 <div id="v1" title="foo">bar</div>
12101
12102 !!end
12103
12104 !! test
12105 Templates: Support for templates generating attributes and content
12106 !! wikitext
12107 {| {{mixed_attr_content_template}}
12108 |-
12109 |bar
12110 |}
12111 !! html/php
12112 <table style="color:red;" title="T48811">
12113
12114 <tr>
12115 <td>foo
12116 </td></tr>
12117 <tr>
12118 <td>bar
12119 </td></tr></table>
12120
12121 !! html/parsoid
12122 <table style="color:red;" title="T48811" about="#mwt1" typeof="mw:Transclusion mw:ExpandedAttrs" data-mw='{"parts":["{| ",{"template":{"target":{"wt":"mixed_attr_content_template","href":"./Template:Mixed_attr_content_template"},"params":{},"i":0}},"\n|-\n|bar\n|}"]}'>
12123 <tbody><tr>
12124 <td>foo</td></tr>
12125 <tr>
12126 <td>bar</td></tr>
12127 </tbody></table>
12128 !!end
12129
12130 !! test
12131 1. Entities and nowikis inside templated attributes should be handled correctly
12132 !! wikitext
12133 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12134 !! html/php
12135 <div style="background:#f9f9f9;">foo</div>
12136
12137 !! html/parsoid
12138 <div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[5,49,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"style{{=}}\\\"background:&amp;amp;#35;f9f9f9;\\\"\"}},\"i\":0}}]}&#39;>style&lt;/span>&lt;span typeof=\"mw:Nowiki\" about=\"#mwt1\" data-parsoid=\"{}\">=&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">\"background:&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=&#39;{\"src\":\"&amp;amp;#35;\",\"srcContent\":\"#\"}&#39;>#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
12139 !! end
12140
12141 !! test
12142 2. Entities and nowikis inside templated attributes should be handled correctly
12143 !! wikitext
12144 {|
12145 |{{table_attribs_3}}
12146 |}
12147 !! html/php
12148 <table>
12149 <tr>
12150 <td style="background:#f9f9f9;">Foo
12151 </td></tr></table>
12152
12153 !! html/parsoid
12154 <table>
12155 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":0}}]}'>Foo</td></tr>
12156 </tbody></table>
12157 !! end
12158
12159 !! test
12160 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12161 !! wikitext
12162 {{tbl-start}}
12163 |{{table_attribs_3}}
12164 {{tbl-end}}
12165 !! html/php
12166 <table>
12167 <tr>
12168 <td style="background:#f9f9f9;">Foo
12169 </td></tr></table>
12170
12171 !! html/parsoid
12172 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":1}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":2}}]}'>
12173 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12174 </tbody></table>
12175 !! end
12176
12177 # T107622
12178 !! test
12179 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12180 !! wikitext
12181 {|
12182 | {{table_attribs_6}} hi
12183 |}
12184 !! html/php
12185 <table>
12186 <tr>
12187 <td style="background: red;"> hi
12188 </td></tr></table>
12189
12190 !! html/parsoid
12191 <table>
12192 <tbody><tr><td style="background: red;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["| ",{"template":{"target":{"wt":"table_attribs_6","href":"./Template:Table_attribs_6"},"params":{},"i":0}}," hi"]}'> hi</td></tr>
12193 </tbody></table>
12194 !! end
12195
12196 !!test
12197 Templates: HTML Tables: 1. Generating start of a HTML table
12198 !! wikitext
12199 {{echo|<table><tr><td>foo</td>}}</tr></table>
12200 !! html
12201 <table><tr><td>foo</td></tr></table>
12202
12203 !!end
12204
12205 !!test
12206 Templates: HTML Tables: 2a. Generating middle of a HTML table
12207 !! wikitext
12208 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12209 !! html
12210 <table><tr><td>foo</td></tr></table>
12211
12212 !!end
12213
12214 !!test
12215 Templates: HTML Tables: 2b. Generating middle of a HTML table
12216 !! wikitext
12217 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12218 !! html
12219 <table><tr><td>foo</td></tr></table>
12220
12221 !!end
12222
12223 !!test
12224 Templates: HTML Tables: 3. Generating end of a HTML table
12225 !! wikitext
12226 <table><tr>{{echo|<td>foo</td></tr></table>}}
12227 !! html
12228 <table><tr><td>foo</td></tr></table>
12229
12230 !!end
12231
12232 !!test
12233 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12234 !! wikitext
12235 {{echo|<table>}}<tr><td>foo</td></tr></table>
12236 !! html
12237 <table><tr><td>foo</td></tr></table>
12238
12239 !!end
12240
12241 !!test
12242 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12243 !! wikitext
12244 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12245 !! html
12246 <table><tr><td>foo</td></tr></table>
12247
12248 !!end
12249
12250 !!test
12251 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12252 !! wikitext
12253 <table><tr>{{echo|<td>}}foo</td></tr></table>
12254 !! html
12255 <table><tr><td>foo</td></tr></table>
12256
12257 !!end
12258
12259 !!test
12260 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12261 !! wikitext
12262 <table><tr><td>foo{{echo|</td>}}</tr></table>
12263 !! html
12264 <table><tr><td>foo</td></tr></table>
12265
12266 !!end
12267
12268 !!test
12269 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12270 !! wikitext
12271 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12272 !! html
12273 <table><tr><td>foo</td></tr></table>
12274
12275 !!end
12276
12277 !!test
12278 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12279 !! wikitext
12280 <table><tr><td>foo</td></tr>{{echo|</table>}}
12281 !! html
12282 <table><tr><td>foo</td></tr></table>
12283
12284 !!end
12285
12286 !!test
12287 Templates: HTML Tables: 5. Proper fostering of categories from inside
12288 !!options
12289 parsoid=wt2html,wt2wt
12290 !! wikitext
12291 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12292 <!--Two categories (T52330)-->
12293 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12294 !! html
12295 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12296 <!--Two categories (T52330)-->
12297 <link rel="mw:PageProp/Category" href="./Category:Bar1"><link rel="mw:PageProp/Category" href="./Category:Bar2"><table><tbody><tr><td>foo</td></tr></tbody></table>
12298 !!end
12299
12300 !!test
12301 Templates: Wiki Tables: 1a. Fostering of entire template content
12302 !! wikitext
12303 {|
12304 {{echo|a}}
12305 |}
12306 !! html
12307 <table>
12308 a
12309 <tr><td></td></tr></table>
12310
12311 !! html+tidy
12312 <p>a</p>
12313 <table>
12314 <tr>
12315 <td></td>
12316 </tr>
12317 </table>
12318 !! end
12319
12320 !!test
12321 Templates: Wiki Tables: 1b. Fostering of entire template content
12322 !! wikitext
12323 {|
12324 {{echo|<div>}}
12325 foo
12326 {{echo|</div>}}
12327 |}
12328 !! html
12329 <table>
12330 <div>
12331 <p>foo
12332 </p>
12333 </div>
12334 <tr><td></td></tr></table>
12335
12336 !! html+tidy
12337 <div>
12338 <p>foo</p>
12339 </div>
12340 <table>
12341 <tr>
12342 <td></td>
12343 </tr>
12344 </table>
12345 !! end
12346
12347 !!test
12348 Templates: Wiki Tables: 2. Fostering of partial template content
12349 !! wikitext
12350 {|
12351 {{echo|a
12352 <div>b</div>}}
12353 |}
12354 !! html
12355 <table>
12356 a
12357 <div>b</div>
12358 <tr><td></td></tr></table>
12359
12360 !! html+tidy
12361 <p>a</p>
12362 <div>b</div>
12363 <table>
12364 <tr>
12365 <td></td>
12366 </tr>
12367 </table>
12368 !! end
12369
12370 !!test
12371 Templates: Wiki Tables: 3. td-content via multiple templates
12372 !! wikitext
12373 {|
12374 {{echo|{{pipe}}a}}{{echo|b}}
12375 |}
12376 !! html
12377 <table>
12378 <tr>
12379 <td>ab
12380 </td></tr></table>
12381
12382 !!end
12383
12384 !!test
12385 Templates: Wiki Tables: 4. Templated tags, no content
12386 !! wikitext
12387 {{tbl-start}}
12388 {{tbl-end}}
12389 !! html
12390 <table>
12391 <tr><td></td></tr></table>
12392
12393 !!end
12394
12395 !!test
12396 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12397 !! wikitext
12398 {{tbl-start}}
12399 |foo
12400 {{tbl-end}}
12401 !! html
12402 <table>
12403 <tr>
12404 <td>foo
12405 </td></tr></table>
12406
12407 !!end
12408
12409 !!test
12410 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12411 !! wikitext
12412 {{tbl-start}}
12413 {{!}}foo
12414 {{tbl-end}}
12415 !! html
12416 <table>
12417 <tr>
12418 <td>foo
12419 </td></tr></table>
12420
12421 !!end
12422
12423 ## This test case is very specific to Parsoid's internals
12424 ## and is hence only tested for Parsoid's code. Parsoid uses
12425 ## a <meta> marker tag for <ref> tags and they are expanded
12426 ## much later. We are verifying that this <meta> tag usage
12427 ## doesn't prevent foster parenting.
12428 !!test
12429 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12430 !!wikitext
12431 {{PartialTable}}<ref>foo</ref>
12432 |}
12433
12434 <references />
12435 !!html/parsoid
12436 <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"&lt;ref>foo&lt;/ref>\n|}"]}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span><table about="#mwt2">
12437 <tbody>
12438 </tbody></table>
12439
12440 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
12441 !!end
12442
12443 !! test
12444 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12445 !! wikitext
12446 {{echo|
12447 {{{!}}
12448 {{!}}-}}
12449 <onlyinclude>
12450 |foo
12451 </onlyinclude>
12452 {{!}}}
12453 !! html/parsoid
12454 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n{{{!}}\n{{!}}-"}},"i":0}},"\n&lt;onlyinclude>\n|foo\n&lt;/onlyinclude>\n{{!}}}"]}'>
12455 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12456 <tbody><tr>
12457
12458 <td>foo
12459 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12460 </tbody></table>
12461 !! end
12462
12463 !!test
12464 Templates: Lists: Multi-line list-items via templates
12465 !! wikitext
12466 *{{echo|a {{nonexistent|
12467 unused}}}}
12468 *{{echo|b {{nonexistent|
12469 unused}}}}
12470 !! html
12471 <ul><li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li>
12472 <li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li></ul>
12473
12474 !!end
12475
12476 !!test
12477 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12478 !! wikitext
12479 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12480 !! html
12481 <p><i>ab</i>c<i>d</i>e
12482 </p>
12483 !!end
12484
12485 !!test
12486 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12487 (PHP parser generates misnested html)
12488 !! wikitext
12489 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12490 !! html/parsoid
12491 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></span><i about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}},{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:1}}]}"><span>b</span></i><span about="#mwt2">c</span><i about="#mwt2">d<span></span></i><span about="#mwt2">e</span></p>
12492 !!end
12493
12494 !!test
12495 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12496 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12497 !! options
12498 parsoid=wt2html,wt2wt
12499 !! wikitext
12500 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12501 !! html
12502 <div about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></div>
12503 <div about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}}]}"><i>b</i>c<i>d</i></div>
12504 <div about="#mwt3" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:0}}]}">e</div>
12505 !!end
12506
12507 !!test
12508 Templates: Ugly nesting: 4. Divs opened/closed across templates
12509 !! wikitext
12510 a<div>b{{echo|c</div>d}}e
12511 !! html
12512 a<div>bc</div>de
12513
12514 !! html+tidy
12515 <p>a</p>
12516 <div>bc</div>
12517 <p>de</p>
12518 !! end
12519
12520 !!test
12521 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12522 (Parsoid-centric)
12523 !! options
12524 parsoid
12525 !! wikitext
12526 {|
12527 |{{echo|foo</table>}}
12528 |bar
12529 |}
12530 !! html
12531 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</table>"}},"i":0}},"\n|bar\n|}"]}'>
12532
12533 <tbody>
12534 <tr>
12535 <td>foo</td></tr></tbody></table><span about="#mwt1">
12536 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12537 |}</span>
12538 !!end
12539
12540 !!test
12541 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12542 (Parsoid-centric)
12543 !! options
12544 parsoid
12545 !! wikitext
12546 <table>
12547 <tr>
12548 <td>
12549 <table>
12550 <tr>
12551 <td>1. {{echo|foo </table>}}</td>
12552 <td> bar </td>
12553 <td>2. {{echo|baz </table>}}</td>
12554 </tr>
12555 <tr>
12556 <td>abc</td>
12557 </tr>
12558 </table>
12559 </td>
12560 </tr>
12561 <tr>
12562 <td>xyz</td>
12563 </tr>
12564 </table>
12565 !! html
12566 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["<table>\n <tr>\n <td>\n <table>\n <tr>\n <td>1. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo </table>"}},"i":0}},"</td>\n <td> bar </td>\n <td>2. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"baz </table>"}},"i":1}},"</td>\n </tr>\n <tr>\n <td>abc</td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td>xyz</td>\n </tr>\n</table>"]}'>
12567 <tbody><tr>
12568 <td>
12569 <table>
12570 <tbody><tr>
12571 <td>1. foo </td></tr></tbody></table></td>
12572 <td> bar </td>
12573 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12574 </span><span about="#mwt2">
12575 </span><span about="#mwt2">
12576 </span><span about="#mwt2">abc</span><span about="#mwt2">
12577 </span><span about="#mwt2">
12578 </span><span about="#mwt2">
12579 </span><span about="#mwt2">
12580 </span><span about="#mwt2">
12581 </span><span about="#mwt2">
12582 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12583 </span><span about="#mwt2">
12584 </span>
12585 !!end
12586
12587 !! test
12588 Templates: Ugly templates: 3. newline-only template parameter
12589 !! wikitext
12590 foo {{echo|
12591 }}
12592 !! html
12593 <p>foo
12594 </p>
12595 !! end
12596
12597 # This looks like a bug: a single newline triggers p/br for some reason.
12598 !! test
12599 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12600 !! wikitext
12601 {{echo|
12602 }}
12603 !! html
12604 <p><br />
12605 </p>
12606 !! end
12607
12608 # T66017 -- ugly wikitext with fostered content generates two template ranges that
12609 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12610 !! test
12611 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12612 !! wikitext
12613 {{echo|<table>}}
12614 {{echo|<div>foo}}
12615 {{echo|</table>}}
12616 !! html/parsoid
12617 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>foo"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/table>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}'>foo
12618 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12619 </table>
12620 !! end
12621
12622 # T66017 -- ugly wikitext with fostered content generates two template ranges
12623 # that are "identical" and generate nesting cycles in the algorithm
12624 !! test
12625 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12626 !! wikitext
12627 {{echo|<table><tr><td><table>}}
12628 {{echo|<div>}}
12629 {{echo|</div>}}
12630 !! html/parsoid
12631 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>&lt;tr>&lt;td>&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/div>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
12632 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12633 </table></td></tr></tbody></table>
12634 !! end
12635
12636 !! test
12637 Templates: Parameters substituted at the top-level
12638 !! wikitext
12639 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12640
12641 {{{foo|bar|baz}}}
12642 !! html/php
12643 <p><i>who</i> me? <b>never!</b>
12644 </p><p>bar
12645 </p>
12646 !! html/parsoid
12647 <p about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"&#39;&#39;who&#39;&#39; {{echo|me}}? &#39;&#39;&#39;never!&#39;&#39;&#39;"}},"i":0}}]}'><i>who</i> me? <b>never!</b></p>
12648
12649 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
12650 !! end
12651
12652 !!test
12653 Parser Functions: 1. Simple example
12654 !! wikitext
12655 {{uc:foo}}
12656 !! html
12657 <p>FOO
12658 </p>
12659 !!end
12660
12661 !!test
12662 Parser Functions: 2. Nested use (only outermost should be marked up)
12663 !! wikitext
12664 {{uc:{{lc:FOO}}}}
12665 !! html
12666 <p>FOO
12667 </p>
12668 !!end
12669
12670 ###
12671 ### Pre-save transform tests
12672 ###
12673 !! test
12674 pre-save transform: subst:
12675 !! options
12676 pst
12677 !! wikitext
12678 {{subst:test}}
12679 !! html/php
12680 This is a test template
12681 !! end
12682
12683 !! test
12684 pre-save transform: normal template
12685 !! options
12686 pst
12687 !! wikitext
12688 {{test}}
12689 !! html/php
12690 {{test}}
12691 !! end
12692
12693 !! test
12694 pre-save transform: nonexistent template
12695 !! options
12696 pst
12697 !! wikitext
12698 {{thistemplatedoesnotexist}}
12699 !! html/php
12700 {{thistemplatedoesnotexist}}
12701 !! end
12702
12703 !! test
12704 pre-save transform: subst magic variables
12705 !! options
12706 pst
12707 !! wikitext
12708 {{subst:SITENAME}}
12709 !! html/php
12710 MediaWiki
12711 !! end
12712
12713 # This is T2089, which I fixed. -- wtm
12714 !! test
12715 pre-save transform: subst: templates with parameters
12716 !! options
12717 pst
12718 !! wikitext
12719 {{subst:paramtest|param="something else"}}
12720 !! html/php
12721 This is a test template with parameter "something else"
12722 !! end
12723
12724 !! article
12725 Template:nowikitest
12726 !! text
12727 <nowiki>'''not wiki'''</nowiki>
12728 !! endarticle
12729
12730 !! test
12731 pre-save transform: nowiki in subst (T3188)
12732 !! options
12733 pst
12734 !! wikitext
12735 {{subst:nowikitest}}
12736 !! html/php
12737 <nowiki>'''not wiki'''</nowiki>
12738 !! end
12739
12740 !! article
12741 Template:commenttest
12742 !! text
12743 This template has <!-- a comment --> in it.
12744 !! endarticle
12745
12746 !! test
12747 pre-save transform: comment in subst (T3936)
12748 !! options
12749 pst
12750 !! wikitext
12751 {{subst:commenttest}}
12752 !! html/php
12753 This template has <!-- a comment --> in it.
12754 !! end
12755
12756 !! test
12757 pre-save transform: unclosed tag
12758 !! options
12759 pst
12760 !! wikitext
12761 <nowiki>'''not wiki'''
12762 !! html/php
12763 <nowiki>'''not wiki'''
12764 !! end
12765
12766 !! test
12767 pre-save transform: mixed tag case
12768 !! options
12769 pst
12770 !! wikitext
12771 <NOwiki>'''not wiki'''</noWIKI>
12772 !! html/php
12773 <NOwiki>'''not wiki'''</noWIKI>
12774 !! end
12775
12776 !! test
12777 pre-save transform: unclosed comment in <nowiki>
12778 !! options
12779 pst
12780 !! wikitext
12781 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12782 !! html/php
12783 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12784 !!end
12785
12786 # Leading @ in this template definition works around a limitation
12787 # in parsoid's parserTests which otherwise strips the <span> from the
12788 # result (confusing it for a template wrapper)
12789 !! article
12790 Template:dangerous
12791 !!text
12792 @<span onmouseover="alert('crap')">Oh no</span>
12793 !!endarticle
12794
12795 !!test
12796 (confirming safety of fix for subst T3936)
12797 !! wikitext
12798 {{Template:dangerous}}
12799 !! html
12800 <p>@<span>Oh no</span>
12801 </p>
12802 !! end
12803
12804 !! test
12805 pre-save transform: comment containing gallery (T7024)
12806 !! options
12807 pst
12808 !! wikitext
12809 <!-- <gallery>data</gallery> -->
12810 !! html/php
12811 <!-- <gallery>data</gallery> -->
12812 !!end
12813
12814 !! test
12815 pre-save transform: comment containing extension
12816 !! options
12817 pst
12818 !! wikitext
12819 <!-- <tag>data</tag> -->
12820 !! html/php
12821 <!-- <tag>data</tag> -->
12822 !!end
12823
12824 !! test
12825 pre-save transform: comment containing nowiki
12826 !! options
12827 pst
12828 !! wikitext
12829 <!-- <nowiki>data</nowiki> -->
12830 !! html/php
12831 <!-- <nowiki>data</nowiki> -->
12832 !!end
12833
12834 !! test
12835 pre-save transform: <noinclude> in subst (T5298)
12836 !! options
12837 pst
12838 !! wikitext
12839 {{subst:Includes}}
12840 !! html/php
12841 Foobar
12842 !! end
12843
12844 !! test
12845 pre-save transform: <onlyinclude> in subst (T5298)
12846 !! options
12847 pst
12848 !! wikitext
12849 {{subst:Includes2}}
12850 !! html/php
12851 Foo
12852 !! end
12853
12854 !! article
12855 Template:SubstTest
12856 !!text
12857 {{<includeonly>subst:</includeonly>Includes}}
12858 !! endarticle
12859
12860 !! article
12861 Template:SafeSubstTest
12862 !! text
12863 {{<includeonly>safesubst:</includeonly>Includes}}
12864 !! endarticle
12865
12866 !! test
12867 T24297: safesubst: works during PST
12868 !! options
12869 pst
12870 !! wikitext
12871 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12872 !! html/php
12873 FoobarFoobar
12874 !! end
12875
12876 !! test
12877 T24297: safesubst: works during normal parse
12878 !! wikitext
12879 {{SafeSubstTest}}
12880 !! html
12881 <p>Foobar
12882 </p>
12883 !! end
12884
12885 !! test
12886 subst: does not work during normal parse
12887 !! wikitext
12888 {{SubstTest}}
12889 !! html
12890 <p>{{subst:Includes}}
12891 </p>
12892 !! end
12893
12894 !! test
12895 pre-save transform: context links ("pipe trick")
12896 !! options
12897 pst
12898 !! wikitext
12899 [[Article (context)|]]
12900 [[Bar:Article|]]
12901 [[:Bar:Article|]]
12902 [[Bar:Article (context)|]]
12903 [[:Bar:Article (context)|]]
12904 [[|Article]]
12905 [[|Article (context)]]
12906 [[Bar:X (Y) Z|]]
12907 [[:Bar:X (Y) Z|]]
12908 !! html/php
12909 [[Article (context)|Article]]
12910 [[Bar:Article|Article]]
12911 [[:Bar:Article|Article]]
12912 [[Bar:Article (context)|Article]]
12913 [[:Bar:Article (context)|Article]]
12914 [[Article]]
12915 [[Article (context)]]
12916 [[Bar:X (Y) Z|X (Y) Z]]
12917 [[:Bar:X (Y) Z|X (Y) Z]]
12918 !! end
12919
12920 !! test
12921 pre-save transform: context links ("pipe trick") with interwiki prefix
12922 !! options
12923 pst
12924 !! wikitext
12925 [[interwiki:Article|]]
12926 [[:interwiki:Article|]]
12927 [[interwiki:Bar:Article|]]
12928 [[:interwiki:Bar:Article|]]
12929 !! html/php
12930 [[interwiki:Article|Article]]
12931 [[:interwiki:Article|Article]]
12932 [[interwiki:Bar:Article|Bar:Article]]
12933 [[:interwiki:Bar:Article|Bar:Article]]
12934 !! end
12935
12936 !! test
12937 pre-save transform: context links ("pipe trick") with parens in title
12938 !! options
12939 pst title=[[Somearticle (context)]]
12940 !! wikitext
12941 [[|Article]]
12942 !! html/php
12943 [[Article (context)|Article]]
12944 !! end
12945
12946 !! test
12947 pre-save transform: context links ("pipe trick") with comma in title
12948 !! options
12949 pst title=[[Someplace, Somewhere]]
12950 !! wikitext
12951 [[|Otherplace]]
12952 [[Otherplace, Elsewhere|]]
12953 [[Otherplace, Elsewhere, Anywhere|]]
12954 !! html/php
12955 [[Otherplace, Somewhere|Otherplace]]
12956 [[Otherplace, Elsewhere|Otherplace]]
12957 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12958 !! end
12959
12960 !! test
12961 pre-save transform: context links ("pipe trick") with parens and comma
12962 !! options
12963 pst title=[[Someplace (IGNORED), Somewhere]]
12964 !! wikitext
12965 [[|Otherplace]]
12966 [[Otherplace (place), Elsewhere|]]
12967 !! html/php
12968 [[Otherplace, Somewhere|Otherplace]]
12969 [[Otherplace (place), Elsewhere|Otherplace]]
12970 !! end
12971
12972 !! test
12973 pre-save transform: context links ("pipe trick") with comma and parens
12974 !! options
12975 pst title=[[Who, me? (context)]]
12976 !! wikitext
12977 [[|Yes, you.]]
12978 [[Me, Myself, and I (1937 song)|]]
12979 !! html/php
12980 [[Yes, you. (context)|Yes, you.]]
12981 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12982 !! end
12983
12984 !! test
12985 pre-save transform: context links ("pipe trick") with namespace
12986 !! options
12987 pst title=[[Ns:Somearticle]]
12988 !! wikitext
12989 [[|Article]]
12990 !! html/php
12991 [[Ns:Article|Article]]
12992 !! end
12993
12994 !! test
12995 pre-save transform: context links ("pipe trick") with namespace and parens
12996 !! options
12997 pst title=[[Ns:Somearticle (context)]]
12998 !! wikitext
12999 [[|Article]]
13000 !! html/php
13001 [[Ns:Article (context)|Article]]
13002 !! end
13003
13004 !! test
13005 pre-save transform: context links ("pipe trick") with namespace and comma
13006 !! options
13007 pst title=[[Ns:Somearticle, Context, Whatever]]
13008 !! wikitext
13009 [[|Article]]
13010 !! html/php
13011 [[Ns:Article, Context, Whatever|Article]]
13012 !! end
13013
13014 !! test
13015 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13016 !! options
13017 pst title=[[Ns:Somearticle, Context (context)]]
13018 !! wikitext
13019 [[|Article]]
13020 !! html/php
13021 [[Ns:Article (context)|Article]]
13022 !! end
13023
13024 !! test
13025 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13026 !! options
13027 pst title=[[Ns:Somearticle (IGNORED), Context]]
13028 !! wikitext
13029 [[|Article]]
13030 !! html/php
13031 [[Ns:Article, Context|Article]]
13032 !! end
13033
13034 !! test
13035 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13036 !! options
13037 pst
13038 !! wikitext
13039 [[Article(context)|]]
13040 [[Bar:Article(context)|]]
13041 [[:Bar:Article(context)|]]
13042 [[|Article(context)]]
13043 [[Bar:X(Y)Z|]]
13044 [[:Bar:X(Y)Z|]]
13045 !! html/php
13046 [[Article(context)|Article]]
13047 [[Bar:Article(context)|Article]]
13048 [[:Bar:Article(context)|Article]]
13049 [[Article(context)]]
13050 [[Bar:X(Y)Z|X(Y)Z]]
13051 [[:Bar:X(Y)Z|X(Y)Z]]
13052 !! end
13053
13054 !! test
13055 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13056 !! options
13057 pst
13058 !! wikitext
13059 [[Article (context)|]]
13060 [[Bar:Article (context)|]]
13061 [[:Bar:Article (context)|]]
13062 [[|Article (context)]]
13063 [[Bar:X (Y) Z|]]
13064 [[:Bar:X (Y) Z|]]
13065 !! html/php
13066 [[Article (context)|Article]]
13067 [[Bar:Article (context)|Article]]
13068 [[:Bar:Article (context)|Article]]
13069 [[Article (context)]]
13070 [[Bar:X (Y) Z|X (Y) Z]]
13071 [[:Bar:X (Y) Z|X (Y) Z]]
13072 !! end
13073
13074 !! test
13075 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13076 !! options
13077 pst
13078 !! wikitext
13079 [[Article(context)|]]
13080 [[Bar:Article(context)|]]
13081 [[:Bar:Article(context)|]]
13082 [[|Article(context)]]
13083 [[Bar:X(Y)Z|]]
13084 [[:Bar:X(Y)Z|]]
13085 !! html/php
13086 [[Article(context)|Article]]
13087 [[Bar:Article(context)|Article]]
13088 [[:Bar:Article(context)|Article]]
13089 [[Article(context)]]
13090 [[Bar:X(Y)Z|X(Y)Z]]
13091 [[:Bar:X(Y)Z|X(Y)Z]]
13092 !! end
13093
13094 !! test
13095 pre-save transform: context links ("pipe trick") with commas (T23660)
13096 !! options
13097 pst
13098 !! wikitext
13099 [[Article (context), context|]]
13100 [[Article (context),context|]]
13101 [[Bar:Article (context), context|]]
13102 [[Bar:Article (context),context|]]
13103 [[:Bar:Article (context), context|]]
13104 [[:Bar:Article (context),context|]]
13105 !! html/php
13106 [[Article (context), context|Article]]
13107 [[Article (context),context|Article]]
13108 [[Bar:Article (context), context|Article]]
13109 [[Bar:Article (context),context|Article]]
13110 [[:Bar:Article (context), context|Article]]
13111 [[:Bar:Article (context),context|Article]]
13112 !! end
13113
13114 !! test
13115 pre-save transform: trim trailing empty lines
13116 !! options
13117 pst
13118 !! wikitext
13119 Empty lines are trimmed
13120
13121
13122
13123
13124 !! html/php
13125 Empty lines are trimmed
13126 !! end
13127
13128 !! test
13129 pre-save transform: Signature expansion
13130 !! options
13131 pst
13132 !! wikitext
13133 * ~~~
13134 * <noinclude>~~~</noinclude>
13135 * <includeonly>~~~</includeonly>
13136 * <onlyinclude>~~~</onlyinclude>
13137 !! html/php
13138 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13139 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13140 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13141 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13142 !! end
13143
13144
13145 !! test
13146 pre-save transform: Signature expansion in nowiki tags (T2093)
13147 !! options
13148 pst disabled
13149 !! wikitext
13150 Shall not expand:
13151
13152 <nowiki>~~~~</nowiki>
13153
13154 <includeonly><nowiki>~~~~</nowiki></includeonly>
13155
13156 <noinclude><nowiki>~~~~</nowiki></noinclude>
13157
13158 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13159
13160 {{subst:Foo}} shall be converted to FOO
13161
13162 As well as inside noinclude/onlyinclude
13163 <noinclude>{{subst:Foo}}</noinclude>
13164 <onlyinclude>{{subst:Foo}}</onlyinclude>
13165
13166 But not inside includeonly
13167 <includeonly>{{subst:Foo}}</includeonly>
13168 !! html/php
13169 Shall not expand:
13170
13171 <nowiki>~~~~</nowiki>
13172
13173 <includeonly><nowiki>~~~~</nowiki></includeonly>
13174
13175 <noinclude><nowiki>~~~~</nowiki></noinclude>
13176
13177 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13178
13179 FOO shall be converted to FOO
13180
13181 As well as inside noinclude/onlyinclude
13182 <noinclude>FOO</noinclude>
13183 <onlyinclude>FOO</onlyinclude>
13184
13185 But not inside includeonly
13186 <includeonly>{{subst:Foo}}</includeonly>
13187 !! end
13188
13189 !! test
13190 Parsoid: Recognize nowiki with trailing space in tags
13191 !! options
13192 parsoid=wt2html
13193 !! wikitext
13194 <nowiki ><div>[[foo]]</nowiki >
13195
13196 a<nowiki / >b
13197
13198 c<nowiki />d
13199
13200 e<nowiki/ >f
13201 !! html
13202 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13203 <p>ab</p>
13204 <p>cd</p>
13205 <p>ef</p>
13206 !! end
13207
13208 !! test
13209 Parsoid: Recognize nowiki with odd capitalization
13210 !! options
13211 parsoid=wt2html
13212 !! wikitext
13213 <noWikI ><div>[[foo]]</Nowiki >
13214 !! html
13215 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13216 !! end
13217
13218
13219 !! test
13220 Parsoid: Escape nowiki with trailing space in tags
13221 !! options
13222 parsoid=html2wt
13223 !! html/parsoid
13224 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13225 <p>a&lt;nowiki /&gt;b</p>
13226 <p>c&lt;nowiki/ &gt;d</p>
13227 !! wikitext
13228 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13229
13230 a&lt;nowiki /&gt;b
13231
13232 c&lt;nowiki/ &gt;d
13233 !! end
13234
13235 !! test
13236 Parsoid: Escape weird noWikI capitalizations
13237 !! options
13238 parsoid=html2wt
13239 !! html/parsoid
13240 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13241 !! wikitext
13242 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13243 !! end
13244
13245 ###
13246 ### Message transform tests
13247 ###
13248 !! test
13249 message transform: magic variables
13250 !! options
13251 msg
13252 !! wikitext
13253 {{SITENAME}}
13254 !! html
13255 MediaWiki
13256 !! end
13257
13258 !! test
13259 message transform: should not transform wiki markup
13260 !! options
13261 msg
13262 !! wikitext
13263 ''test''
13264 !! html
13265 ''test''
13266 !! end
13267
13268 !! test
13269 message transform: <noinclude> in transcluded template (T6926)
13270 !! options
13271 msg
13272 !! wikitext
13273 {{Includes}}
13274 !! html
13275 Foobar
13276 !! end
13277
13278 !! test
13279 message transform: <onlyinclude> in transcluded template (T6926)
13280 !! options
13281 msg
13282 !! wikitext
13283 {{Includes2}}
13284 !! html
13285 Foo
13286 !! end
13287
13288 !! test
13289 {{#special:}} page name, known
13290 !! options
13291 msg
13292 !! wikitext
13293 {{#special:Recentchanges}}
13294 !! html
13295 Special:RecentChanges
13296 !! end
13297
13298 !! test
13299 {{#special:}} page name with subpage, known
13300 !! options
13301 msg
13302 !! wikitext
13303 {{#special:Recentchanges/param}}
13304 !! html
13305 Special:RecentChanges/param
13306 !! end
13307
13308 !! test
13309 {{#special:}} page name, unknown
13310 !! options
13311 msg
13312 !! wikitext
13313 {{#special:foobar nonexistent}}
13314 !! html
13315 Special:Foobar nonexistent
13316 !! end
13317
13318 !! test
13319 {{#speciale:}} page name, known
13320 !! options
13321 msg
13322 !! wikitext
13323 {{#speciale:Recentchanges}}
13324 !! html
13325 Special:RecentChanges
13326 !! end
13327
13328 !! test
13329 {{#speciale:}} page name with subpage, known
13330 !! options
13331 msg
13332 !! wikitext
13333 {{#speciale:Recentchanges/param}}
13334 !! html
13335 Special:RecentChanges/param
13336 !! end
13337
13338 !! test
13339 {{#speciale:}} page name, unknown
13340 !! options
13341 msg
13342 !! wikitext
13343 {{#speciale:foobar nonexistent}}
13344 !! html
13345 Special:Foobar_nonexistent
13346 !! end
13347
13348 ###
13349 ### Images
13350 ###
13351 ### For Parsoid-specific tests, see
13352 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13353
13354 !! test
13355 Simple image
13356 !! options
13357 parsoid=wt2html,wt2wt,html2html
13358 !! wikitext
13359 [[Image:foobar.jpg]]
13360 !! html/php
13361 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13362 </p>
13363 !! html/parsoid
13364 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13365 !! end
13366
13367 !! test
13368 Simple image (using File: namespace, now canonical)
13369 !! wikitext
13370 [[File:Foobar.jpg]]
13371 !! html/php
13372 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13373 </p>
13374 !! html/parsoid
13375 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13376 !! end
13377
13378 !! test
13379 Right-aligned image
13380 !! wikitext
13381 [[File:Foobar.jpg|right]]
13382 !! html/php
13383 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
13384
13385 !! html/parsoid
13386 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13387 !! end
13388
13389 !! test
13390 Image with caption
13391 !! wikitext
13392 [[File:Foobar.jpg|right|Caption text]]
13393 !! html/php
13394 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
13395
13396 !! html/parsoid
13397 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
13398 !! end
13399
13400 !! test
13401 Image with caption, T55312 #1
13402 !! wikitext
13403 [[File:Foobar.jpg|right|Caption page stuff]]
13404 !! html/php
13405 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page stuff"><img alt="Caption page stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
13406
13407 !! html/parsoid
13408 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page stuff</figcaption></figure>
13409 !! end
13410
13411 !! test
13412 Image with caption, T55312 #2
13413 !! wikitext
13414 [[File:Foobar.jpg|right|Caption page=]]
13415 !! html/php
13416 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page="><img alt="Caption page=" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
13417
13418 !! html/parsoid
13419 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=</figcaption></figure>
13420 !! end
13421
13422 !! test
13423 Image with caption, T55312 #3
13424 !! wikitext
13425 [[File:Foobar.jpg|right|Caption page=stuff]]
13426 !! html/php
13427 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page=stuff"><img alt="Caption page=stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
13428
13429 !! html/parsoid
13430 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=stuff</figcaption></figure>
13431 !! end
13432
13433 !! test
13434 Allow empty links in image captions (T62753)
13435 !! options
13436 thumbsize=220
13437 !! wikitext
13438 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13439 [[]]
13440 [[Link2]]
13441 ]]
13442 !! html/php
13443 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Caption <a href="/index.php?title=Link1&amp;action=edit&amp;redlink=1" class="new" title="Link1 (page does not exist)">Link1</a> [[]] <a href="/index.php?title=Link2&amp;action=edit&amp;redlink=1" class="new" title="Link2 (page does not exist)">Link2</a></div></div></div>
13444
13445 !! html/parsoid
13446 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption [[Link1]]\n[[]]\n[[Link2]]\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption <a rel="mw:WikiLink" href="./Link1" title="Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"}}'>Link1</a>
13447 [[]]
13448 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13449 </figcaption></figure>
13450 !! end
13451
13452 !! test
13453 Titles in unlinked images (T23454)
13454 !! wikitext
13455 [[File:Foobar.jpg|link=|stuff]]
13456 !! html/php
13457 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13458 </p>
13459 !! end
13460
13461 !! test
13462 Link with empty target
13463 !! wikitext
13464 [[]]
13465 !! html
13466 <p>[[]]
13467 </p>
13468 !! end
13469
13470 !! test
13471 Image with link trail
13472 !! wikitext
13473 Linktrails should not work for images: [[File:Foobar.jpg]]s
13474 !! html/php
13475 <p>Linktrails should not work for images: <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>s
13476 </p>
13477 !! html/parsoid
13478 <p>Linktrails should not work for images: <span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span>s</p>
13479 !! end
13480
13481 !! test
13482 Image with empty attribute
13483 !! options
13484 parsoid=wt2html,wt2wt,html2html
13485 !! wikitext
13486 [[File:Foobar.jpg|right||Caption text]]
13487 !! html/php
13488 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
13489
13490 !! html/parsoid
13491 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
13492 !! end
13493
13494 !! test
13495 1. Block image with individual attributes from templates
13496 !! wikitext
13497 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13498 !! html/php
13499 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
13500
13501 !! html/parsoid
13502 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[24,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
13503 !! end
13504
13505 !! test
13506 2. Block Image with individual attributes from templates
13507 !! wikitext
13508 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13509 !! html/php
13510 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
13511
13512 !! html/parsoid
13513 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"{{echo|thumb}}"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,32,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"thumb\"}},\"i\":0}}]}&#39;>thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[33,47,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
13514 !! end
13515
13516 !! test
13517 3. Inline image with individual attributes from templates
13518 !! wikitext
13519 [[File:Foobar.jpg|{{echo|50px}}]]
13520 !! html/php
13521 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>
13522 </p>
13523 !! html/parsoid
13524 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}' data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"50px\"}},\"i\":0}}]}&#39;>50px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13525 !! end
13526
13527 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13528 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13529 !! test
13530 Image with multiple attributes from the same template
13531 !! wikitext
13532 [[File:Foobar.jpg|{{image_attribs}}]]
13533 !! html/php
13534 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
13535
13536 !! html/parsoid
13537 <figure class="mw-default-size mw-halign-right" typeof="mw:Image mw:Placeholder"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
13538 !! end
13539
13540 !! test
13541 Image with link tails
13542 !! options
13543 thumbsize=220
13544 !! wikitext
13545 123[[File:Foobar.jpg]]456
13546 123[[File:Foobar.jpg|right]]456
13547 123[[File:Foobar.jpg|thumb]]456
13548 !! html/php
13549 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
13550 </p>
13551 123<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>456
13552 123<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>456
13553
13554 !! html/php+tidy
13555 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456</p>
13556 <p>123</p>
13557 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
13558 <p>456 123</p>
13559 <div class="thumb tright">
13560 <div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>
13561 <div class="thumbcaption">
13562 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13563 </div>
13564 </div>
13565 </div>
13566 <p>456</p>
13567 !! html/parsoid
13568 <p>123<span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span>456</p>
13569 <p>123</p><figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure><p>456</p>
13570 <p>123</p><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure><p>456</p>
13571 !! end
13572
13573 !! test
13574 Image with multiple captions -- only last one is accepted
13575 !! wikitext
13576 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13577 !! html/php
13578 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption3 - accepted"><img alt="Caption3 - accepted" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
13579
13580 !! html/parsoid
13581 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption3 - accepted</figcaption></figure>
13582 !! end
13583
13584 !! test
13585 Image with multiple widths -- use last
13586 !! wikitext
13587 [[File:Foobar.jpg|200px|300px|caption]]
13588 !! html/php
13589 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" width="300" height="34" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/450px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/600px-Foobar.jpg 2x" /></a>
13590 </p>
13591 !! html/parsoid
13592 <p><span typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></span></p>
13593 !! end
13594
13595 !! test
13596 Image with multiple alignments -- use first (T50664)
13597 !! options
13598 thumbsize=220
13599 !! wikitext
13600 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13601
13602 [[File:Foobar.jpg|middle|text-top|caption]]
13603 !! html/php
13604 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13605 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" style="vertical-align: middle" /></a>
13606 </p>
13607 !! html/parsoid
13608 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13609 <p><span class="mw-default-size mw-valign-middle" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13610 !! end
13611
13612 !! test
13613 Image with width attribute at different positions
13614 !! wikitext
13615 [[File:Foobar.jpg|200px|right|Caption]]
13616 [[File:Foobar.jpg|right|200px|Caption]]
13617 [[File:Foobar.jpg|right|Caption|200px]]
13618 !! html/php
13619 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
13620 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
13621 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
13622
13623 !! html/parsoid
13624 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
13625 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
13626 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
13627 !! end
13628
13629 # a sad bit of backward-compatibility
13630 !! test
13631 Image with size specified with pxpx (T15500, T53628)
13632 !! options
13633 parsoid=wt2html,wt2wt,html2html
13634 !! wikitext
13635 [[File:Foobar.jpg|20pxpx]]
13636 [[File:Foobar.jpg|200x20pxpx]]
13637 !! html/php
13638 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
13639 <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" width="177" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/265px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/353px-Foobar.jpg 2x" /></a>
13640 </p>
13641 !! html/parsoid
13642 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="2" width="20"/></a></span> <span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="177"/></a></span></p>
13643 !! end
13644
13645 !! test
13646 Image with link parameter, wiki target
13647 !! wikitext
13648 [[File:Foobar.jpg|link=Main Page]]
13649 !! html/php
13650 <p><a href="/wiki/Main_Page" title="Main Page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13651 </p>
13652 !! html/parsoid
13653 <p><span class="mw-default-size" typeof="mw:Image"><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13654 !! end
13655
13656 # parsoid T51293 (part 1)
13657 !! test
13658 Image with link parameter, URL target
13659 !! wikitext
13660 [[File:Foobar.jpg|link=http://example.com/]]
13661 !! html/php
13662 <p><a href="http://example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13663 </p>
13664 !! html/parsoid
13665 <p><span class="mw-default-size" typeof="mw:Image"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13666 !! end
13667
13668 # parsoid T51293 (part 2)
13669 !! test
13670 Image with link parameter, protocol-less URL target
13671 !! wikitext
13672 [[File:Foobar.jpg|link=//example.com/]]
13673 !! html/php
13674 <p><a href="//example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13675 </p>
13676 !! html/parsoid
13677 <p><span class="mw-default-size" typeof="mw:Image"><a href="//example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13678 !! end
13679
13680 !! test
13681 Escaping non-block captions (T107435)
13682 !! options
13683 parsoid={
13684 "modes": ["wt2wt"],
13685 "changes": [
13686 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13687 ]
13688 }
13689 !! wikitext
13690 [[Image:Foobar.jpg|caption]]
13691 !! wikitext/edited
13692 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13693 !! end
13694
13695 # wgExternalLinkTarget not supported by Parsoid
13696 !! test
13697 Image with link parameter, wgExternalLinkTarget
13698 !! wikitext
13699 [[Image:foobar.jpg|link=http://example.com/]]
13700 !! config
13701 wgExternalLinkTarget='foobar'
13702 !! html/php
13703 <p><a href="http://example.com/" target="foobar" rel="nofollow noreferrer noopener"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13704 </p>
13705 !! end
13706
13707 !! test
13708 Image with link parameter, wgNoFollowLinks set to false
13709 !! wikitext
13710 [[Image:foobar.jpg|link=http://example.com/]]
13711 !! config
13712 wgNoFollowLinks=false
13713 !! html
13714 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13715 </p>
13716 !! end
13717
13718 !! test
13719 Image with link parameter, wgNoFollowDomainExceptions
13720 !! wikitext
13721 [[Image:foobar.jpg|link=http://example.com/]]
13722 !! config
13723 wgNoFollowDomainExceptions='example.com'
13724 !! html
13725 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13726 </p>
13727 !! end
13728
13729 # wgExternalLinkTarget not supported by Parsoid
13730 !! test
13731 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13732 !! wikitext
13733 [[Image:foobar.jpg|link=http://example.com/|Title]]
13734 !! config
13735 wgExternalLinkTarget='foobar'
13736 !! html/php
13737 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow noreferrer noopener"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13738 </p>
13739 !! end
13740
13741 !! test
13742 Image with empty link parameter
13743 !! wikitext
13744 [[File:Foobar.jpg|link=]]
13745 !! html/php
13746 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13747 </p>
13748 !! html/parsoid
13749 <p><span class="mw-default-size" typeof="mw:Image"><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></span></span></p>
13750 !! end
13751
13752 !! test
13753 Image with link parameter (wiki target) and unnamed parameter
13754 !! wikitext
13755 [[File:Foobar.jpg|link=Main_Page|Title]]
13756 !! html/php
13757 <p><a href="/wiki/Main_Page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13758 </p>
13759 !! html/parsoid
13760 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13761 !! end
13762
13763 !! test
13764 Image with link parameter (URL target) and unnamed parameter
13765 !! wikitext
13766 [[File:Foobar.jpg|link=http://example.com/|Title]]
13767 !! html/php
13768 <p><a href="http://example.com/" title="Title" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13769 </p>
13770 !! html/parsoid
13771 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13772 !! end
13773
13774 !! test
13775 Thumbnail image with link parameter
13776 !! options
13777 thumbsize=220
13778 parsoid=wt2html,wt2wt,html2html
13779 !! wikitext
13780 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13781 !! html/php
13782 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
13783
13784 !! html/parsoid
13785 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Title</figcaption></figure>
13786 !! end
13787
13788 !! test
13789 Manually-specified thumbnail image
13790 !! options
13791 thumbsize=220
13792 !! wikitext
13793 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
13794 !! html/php
13795 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
13796
13797 !! html/parsoid
13798 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
13799 !! end
13800
13801 !! test
13802 Manually-specified thumbnail image with explicit link to wiki page
13803 !! options
13804 thumbsize=220
13805 parsoid=wt2html,wt2wt,html2html
13806 !! wikitext
13807 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13808 !! html/php
13809 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
13810
13811 !! html/parsoid
13812 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
13813 !! end
13814
13815 !! test
13816 Manually-specified thumbnail image with explicit link to url
13817 !! options
13818 thumbsize=220
13819 parsoid=wt2html,wt2wt,html2html
13820 !! wikitext
13821 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13822 !! html/php
13823 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
13824
13825 !! html/parsoid
13826 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="http://example.com"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
13827 !! end
13828
13829 !! test
13830 Manually-specified thumbnail image with explicit no link
13831 !! options
13832 thumbsize=220
13833 parsoid=wt2html,wt2wt,html2html
13834 !! wikitext
13835 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13836 !! html/php
13837 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
13838
13839 !! html/parsoid
13840 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><span><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></span><figcaption>Title</figcaption></figure>
13841 !! end
13842
13843 !! test
13844 Manually-specified thumbnail image with explicit link and alt text
13845 !! options
13846 thumbsize=220
13847 parsoid=wt2html,wt2wt,html2html
13848 !! wikitext
13849 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13850 !! html/php
13851 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
13852
13853 !! html/parsoid
13854 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./Main_Page"><img alt="alttext" resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
13855 !! end
13856
13857 !! test
13858 Image with frame and link
13859 !! options
13860 parsoid=wt2html,wt2wt,html2html
13861 !! wikitext
13862 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13863 !! html/php
13864 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
13865
13866 !! html/parsoid
13867 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></figcaption></figure>
13868 !! end
13869
13870 !! test
13871 Image with frame and link and explicit alt
13872 !! options
13873 parsoid=wt2html,wt2wt,html2html
13874 !! wikitext
13875 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13876 !! html/php
13877 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
13878
13879 !! html/parsoid
13880 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img alt="Altitude" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></figcaption></figure>
13881 !! end
13882
13883 !! test
13884 Image with wiki markup in implicit alt
13885 !! wikitext
13886 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13887
13888 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13889 !! html/php
13890 <p><a href="/wiki/File:Foobar.jpg" class="image" title="testing bold in alt"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13891 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13892 </p>
13893 !! html/parsoid
13894 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}' data-mw='{"caption":"testing &lt;b data-parsoid=&#39;{\"dsr\":[27,37,3,3]}&#39;>bold&lt;/b> in alt"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></span></p>
13895
13896 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"alt":"testing bold in alt","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt","resource":"Image:Foobar.jpg"}}'/></a></span></p>
13897 !! end
13898
13899 !! test
13900 Alt image option should handle most kinds of wikitext without barfing
13901 !! wikitext
13902 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13903 !! html/php
13904 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a link and a bold template." src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is the image caption</div></div></div>
13905
13906 !! html/parsoid
13907 <figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[65,73,2,2]}&#39;>link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"dsr\":[80,106,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;#39;&amp;#39;bold template&amp;#39;&amp;#39;\"}},\"i\":0}}]}&#39;>bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
13908 !! end
13909
13910 ###################
13911 # Conflicting image format options.
13912 # First option specified should 'win'.
13913 # All three cases in each test should be identical.
13914
13915 !! test
13916 Image with 'frameless' first.
13917 !! options
13918 parsoid=wt2html,wt2wt,html2html
13919 !! wikitext
13920 [[File:Foobar.jpg|frameless|caption]]
13921
13922 [[File:Foobar.jpg|frameless|frame|caption]]
13923
13924 [[File:Foobar.jpg|frameless|thumb|caption]]
13925 !! html/php
13926 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
13927 </p><p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
13928 </p><p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
13929 </p>
13930 !! html/parsoid
13931 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
13932 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
13933 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
13934 !! end
13935
13936 !! test
13937 Image with 'frame' first.
13938 !! options
13939 parsoid=wt2html,wt2wt,html2html
13940 !! wikitext
13941 [[File:Foobar.jpg|frame|caption]]
13942 [[File:Foobar.jpg|frame|frameless|caption]]
13943 [[File:Foobar.jpg|frame|thumb|caption]]
13944 !! html/php
13945 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
13946 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
13947 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
13948
13949 !! html/parsoid
13950 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13951 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13952 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13953 !! end
13954
13955 !! test
13956 Image with 'thumb' first.
13957 !! options
13958 parsoid=wt2html,wt2wt,html2html
13959 !! wikitext
13960 [[File:Foobar.jpg|thumb|caption]]
13961 [[File:Foobar.jpg|thumb|frameless|caption]]
13962 [[File:Foobar.jpg|thumb|frame|caption]]
13963 !! html/php
13964 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13965 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13966 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13967
13968 !! html/parsoid
13969 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13970 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13971 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13972 !! end
13973
13974 ###################
13975 # Image sizing.
13976 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13977 # and https://phabricator.wikimedia.org/T64258
13978 # Foobar has actual size of 1941x220
13979 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13980 # a scalable format.
13981 # 2. Framed images always ignore size options; always render at default size.
13982 # 3. "Unspecified format" and border are the only types which can be
13983 # enlarged.
13984
13985 !! test
13986 Image: "unspecified format" and border enlarge
13987 !! options
13988 parsoid=wt2html,wt2wt,html2html
13989 !! wikitext
13990 [[File:Foobar.jpg|2000px]]
13991
13992 [[File:Foobar.jpg|border|2000px]]
13993 !! html/php
13994 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="2000" height="227" /></a>
13995 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="2000" height="227" class="thumbborder" /></a>
13996 </p>
13997 !! html/parsoid
13998 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p>
13999 <p><span class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p>
14000 !! end
14001
14002 !! test
14003 Image: "unspecified format" and border reduce
14004 !! options
14005 parsoid=wt2html,wt2wt,html2html
14006 !! wikitext
14007 [[File:Foobar.jpg|1000px]]
14008
14009 [[File:Foobar.jpg|border|1000px]]
14010 !! html/php
14011 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" width="1000" height="113" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/1500px-Foobar.jpg 1.5x, http://example.com/images/3/3a/Foobar.jpg 2x" /></a>
14012 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" width="1000" height="113" class="thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/1500px-Foobar.jpg 1.5x, http://example.com/images/3/3a/Foobar.jpg 2x" /></a>
14013 </p>
14014 !! html/parsoid
14015 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p>
14016 <p><span class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p>
14017 !! end
14018
14019 !! test
14020 Image: thumbs reduce
14021 !! options
14022 parsoid=wt2html,wt2wt,html2html
14023 !! wikitext
14024 [[File:Foobar.jpg|thumb|50px]]
14025 !! html/php
14026 <div class="thumb tright"><div class="thumbinner" style="width:52px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
14027
14028 !! html/parsoid
14029 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure>
14030 !! end
14031
14032 !! test
14033 Image: bitmap thumbs can't be enlarged past original size, but vector can.
14034 !! options
14035 parsoid=wt2html,wt2wt,html2html
14036 !! wikitext
14037 [[File:Foobar.jpg|thumb|2000px]]
14038
14039 [[File:Foobar.svg|thumb|2000px]]
14040 !! html/php
14041 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
14042 <div class="thumb tright"><div class="thumbinner" style="width:2002px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div></div></div></div>
14043
14044 !! html/parsoid
14045 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
14046 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/240px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></figure>
14047 !! end
14048
14049 !! test
14050 Image: frameless can reduce in size
14051 !! options
14052 parsoid=wt2html,wt2wt,html2html
14053 !! wikitext
14054 [[File:Foobar.jpg|frameless|50px]]
14055 !! html/php
14056 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>
14057 </p>
14058 !! html/parsoid
14059 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
14060 !! end
14061
14062 !! test
14063 Image: bitmap frameless can't be enlarged past original size, but vector can
14064 !! options
14065 parsoid=wt2html,wt2wt,html2html
14066 !! wikitext
14067 [[File:Foobar.jpg|frameless|2000px]]
14068
14069 [[File:Foobar.svg|frameless|2000px]]
14070 !! html/php
14071 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14072 </p><p><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a>
14073 </p>
14074 !! html/parsoid
14075 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14076 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/240px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></span></p>
14077 !! end
14078
14079 !! test
14080 Image: framed images are always unscaled.
14081 !! options
14082 parsoid=wt2html,wt2wt,html2html
14083 !! wikitext
14084 [[File:Foobar.jpg|frame]]
14085
14086 [[File:Foobar.jpg|frame|50px]]
14087
14088 [[File:Foobar.jpg|frame|50x50px]]
14089
14090 [[File:Foobar.jpg|frame|2000px]]
14091 !! html/php
14092 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
14093 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
14094 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
14095 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
14096
14097 !! html/parsoid
14098 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
14099 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
14100 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
14101 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
14102 !! end
14103
14104 ###################
14105
14106 !! test
14107 Link to image page- image page normally doesn't exists, hence edit link
14108 Add test with existing image page
14109 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14110 !! wikitext
14111 [[:Image:test]]
14112 !! html
14113 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">Image:test</a>
14114 </p>
14115 !! end
14116
14117 !! test
14118 T20784 Link to non-existent image page with caption should use caption as link text
14119 !! wikitext
14120 [[:Image:test|caption]]
14121 !! html
14122 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">caption</a>
14123 </p>
14124 !! end
14125
14126 !! test
14127 Frameless image caption with a free URL
14128 !! wikitext
14129 [[File:Foobar.jpg|http://example.com]]
14130 !! html/php
14131 <p><a href="/wiki/File:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14132 </p>
14133 !! html/parsoid
14134 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"http://example.com"}]}' data-mw='{"caption":"&lt;a rel=\"mw:ExtLink\" href=\"http://example.com\" data-parsoid=&#39;{\"stx\":\"url\",\"dsr\":[18,36,0,0]}&#39;>http://example.com&lt;/a>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14135 !! end
14136
14137 !! test
14138 Thumbnail image caption with a free URL
14139 !! options
14140 thumbsize=220
14141 !! wikitext
14142 [[File:Foobar.jpg|thumb|http://example.com]]
14143 !! html/php
14144 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
14145
14146 !! html/parsoid
14147 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
14148 !! end
14149
14150 !! test
14151 Thumbnail image caption with a free URL and explicit alt
14152 !! options
14153 thumbsize=220
14154 parsoid=wt2html,wt2wt,html2html
14155 !! wikitext
14156 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14157 !! html/php
14158 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
14159
14160 !! html/parsoid
14161 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img alt="Alteration" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
14162 !! end
14163
14164 !! test
14165 SVG thumbnails with no language set
14166 !! options
14167 !! wikitext
14168 [[File:Foobar.svg|thumb|caption]]
14169 !! html/php
14170 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14171
14172 !! html/parsoid
14173 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
14174 !! end
14175
14176 !! test
14177 SVG thumbnails with language de
14178 !! options
14179 parsoid=wt2html,wt2wt,html2html
14180 !! wikitext
14181 [[File:Foobar.svg|thumb|caption|lang=de]]
14182 !! html/php
14183 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=File:Foobar.svg&amp;lang=de" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/langde-180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langde-270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langde-360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14184
14185 !! html/parsoid
14186 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
14187 !! end
14188
14189 !! test
14190 SVG thumbnails with invalid language code
14191 !! options
14192 parsoid=wt2html,wt2wt,html2html
14193 !! wikitext
14194 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14195 !! html/php
14196 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>lang=invalid.language.code</div></div></div>
14197
14198 !! html/parsoid
14199 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>lang=invalid.language.code</figcaption></figure>
14200 !! end
14201
14202 !! test
14203 T3887: A ISBN with a thumbnail
14204 !! wikitext
14205 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14206 !! html/php
14207 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
14208
14209 !! html/parsoid
14210 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/1235467890" rel="mw:WikiLink">ISBN 1235467890</a></figcaption></figure>
14211 !! end
14212
14213 !! test
14214 T3887: A RFC with a thumbnail
14215 !! wikitext
14216 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14217 !! html/php
14218 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
14219
14220 !! html/parsoid
14221 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
14222 !! end
14223
14224 !! test
14225 T3887: A mailto link with a thumbnail
14226 !! wikitext
14227 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14228 !! html/php
14229 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
14230
14231 !! html/parsoid
14232 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Please <a rel="mw:ExtLink" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
14233 !! end
14234
14235 # Pending resolution to T2368
14236 !! test
14237 T2648: Frameless image caption with a link
14238 !! wikitext
14239 [[File:Foobar.jpg|text with a [[link]] in it]]
14240 !! html/php
14241 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14242 </p>
14243 !! html/parsoid
14244 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,38,2,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14245 !! end
14246
14247 !! test
14248 T2648: Frameless image caption with a link (suffix)
14249 !! wikitext
14250 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14251 !! html/php
14252 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14253 </p>
14254 !! html/parsoid
14255 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]]foo in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,41,2,5],\"tail\":\"foo\"}&#39;>linkfoo&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14256 !! end
14257
14258 !! test
14259 T2648: Frameless image caption with an interwiki link
14260 !! wikitext
14261 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14262 !! html/php
14263 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14264 </p>
14265 !! html/parsoid
14266 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,47,2,2]}&#39;>MeatBall:Link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14267 !! end
14268
14269 !! test
14270 T2648: Frameless image caption with a piped interwiki link
14271 !! wikitext
14272 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14273 !! html/php
14274 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14275 </p>
14276 !! html/parsoid
14277 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link|link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=&#39;{\"stx\":\"piped\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,52,16,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14278 !! end
14279
14280 !! test
14281 T107474: Frameless image caption with <nowiki>
14282 !! wikitext
14283 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14284 !! html/parsoid
14285 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;nowiki>text with a [[MeatBall:Link|link]] in it&lt;/nowiki>"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"dsr\":[18,75,8,9]}&#39;>text with a [[MeatBall:Link|link]] in it&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14286 !! end
14287
14288 !! test
14289 Escape HTML special chars in image alt text
14290 !! wikitext
14291 [[File:Foobar.jpg|& < > "]]
14292 !! html/php
14293 <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14294 </p>
14295 !! html/parsoid
14296 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp; &lt; > \""}]}' data-mw='{"caption":"&amp;amp; &amp;lt; > \""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14297 !! end
14298
14299 !! test
14300 Escape HTML special chars in image alt text with LanguageConverter
14301 !! options
14302 language=zh
14303 !! wikitext
14304 [[File:Foobar.jpg|& < > "]]
14305 !! html/php
14306 <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14307 </p>
14308 !! html/parsoid
14309 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp; &lt; > \""}]}' data-mw='{"caption":"&amp;amp; &amp;lt; > \""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14310 !! end
14311
14312 !! test
14313 Entities in file name and attributes
14314 !! wikitext
14315 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14316 !! html/php
14317 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14318 </p>
14319 !! html/parsoid
14320 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"manualthumb=7%25 solution.gif"},{"ck":"link","ak":"link=7%25 solution"},{"ck":"caption","ak":"[[7%25 solution]]"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./7%25_solution\" title=\"7% solution\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./7%25_solution\"},\"sa\":{\"href\":\"7%25 solution\"},\"dsr\":[74,91,2,2]}&#39;>7% solution&lt;/a>"}'><a href="./7%25_solution" data-parsoid='{"a":{"href":"./7%25_solution"},"sa":{"href":"link=7%25 solution"}}'><img resource="./File:7%25_solution.gif" src="./Special:FilePath/7%25_solution.gif" height="220" width="220" data-parsoid='{"a":{"resource":"./File:7%25_solution.gif","height":"220","width":"220"},"sa":{"resource":"File:7%25 solution.gif"}}'/></a></span></p>
14321 !! end
14322
14323 !! test
14324 T2499: Alt text should have &#1234;, not &amp;1234;
14325 !! wikitext
14326 [[File:Foobar.jpg|&#9792;]]
14327 !! html/php
14328 <p><a href="/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14329 </p>
14330 !! html/parsoid
14331 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;#9792;"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;#9792;\",\"srcContent\":\"♀\",\"dsr\":[18,25,null,null]}&#39;>♀&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14332 !! end
14333
14334 !! test
14335 Broken image caption with link
14336 !! options
14337 parsoid=wt2html,wt2wt,html2html
14338 !! wikitext
14339 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14340 !! html/php
14341 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a href="/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link.
14342 </p>
14343 !! html/parsoid
14344 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">this</a> is just an ordinary link.</p>
14345 !! end
14346
14347 !! test
14348 Image caption containing another image
14349 !! wikitext
14350 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14351 !! html/php
14352 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption with another <a href="/wiki/File:Thumb.png" class="image" title="image"><img alt="image" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" /></a> inside it!</div></div></div>
14353
14354 !! html/parsoid
14355 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is a caption with another <span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"image"}'><a href="./File:Thumb.png"><img resource="./File:Thumb.png" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a></span> inside it!</figcaption></figure>
14356 !! end
14357
14358 !! test
14359 Image: caption containing a newline
14360 !! wikitext
14361 [[File:Foobar.jpg|This
14362 *is some text]]
14363 !! html/php
14364 <p><a href="/wiki/File:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14365 </p>
14366 !! html/parsoid
14367 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"This\n*is some text"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14368 !!end
14369
14370 !!test
14371 Image: caption containing leading space
14372 (The leading space should not trigger nowiki escaping in wt2wt mode)
14373 !! wikitext
14374 [[File:Foobar.jpg|thumb| bar]]
14375 !! html/php
14376 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>bar</div></div></div>
14377
14378 !! html/parsoid
14379 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
14380 !!end
14381
14382 !! test
14383 Image: caption containing a table
14384 !! options
14385 parsoid=wt2html,wt2wt,html2html
14386 !! wikitext
14387 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14388 {|
14389 ! Foo !! Bar
14390 |-
14391 | Foo1 || Bar1
14392 |}
14393 and some more text.]]
14394 !! html/php
14395 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is an example image thumbnail caption with a table <table> <tr> <th> Foo </th> <th> Bar </th></tr> <tr> <td> Foo1 </td> <td> Bar1 </td></tr></table> and some more text.</div></div></div>
14396
14397 !! html/parsoid
14398 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This is an example image thumbnail caption with a table
14399 <table>
14400 <tbody>
14401 <tr><th>Foo </th><th>Bar</th></tr>
14402 <tr>
14403 <td>Foo1 </td>
14404 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14405 !! end
14406
14407 !! test
14408 T5090: External links other than http: in image captions
14409 !! wikitext
14410 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14411 !! html/php
14412 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This caption has <a rel="nofollow" class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" href="https://example.com">Secure</a> ext links in it.</div></div></div>
14413
14414 !! html/parsoid
14415 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has <a rel="mw:ExtLink" href="irc://example.net">irc</a> and <a rel="mw:ExtLink" href="https://example.com">Secure</a> ext links in it.</figcaption></figure>
14416 !! end
14417
14418 !! test
14419 Custom class
14420 !! options
14421 parsoid=wt2html,wt2wt,html2html
14422 !! wikitext
14423 [[Image:foobar.jpg|a|class=b]]
14424 !! html/php
14425 <p><a href="/wiki/File:Foobar.jpg" class="image" title="a"><img alt="a" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="b" /></a>
14426 </p>
14427 !! html/parsoid
14428 <p><span class="mw-default-size b" typeof="mw:Image" data-mw='{"caption":"a"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14429 !! end
14430
14431 !! test
14432 Localized image handling (1).
14433 !! options
14434 parsoid=wt2html,wt2wt,html2html
14435 language=es
14436 !! wikitext
14437 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14438 !! html/php
14439 <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14440
14441 !! html/parsoid
14442 <figure class="mw-default-size mw-halign-left" typeof="mw:Image"><a href="./Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
14443 !! end
14444
14445 !! test
14446 Localized image handling (2).
14447 !! options
14448 thumbsize=220
14449 parsoid=wt2html,wt2wt,html2html
14450 language=es
14451 !! wikitext
14452 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14453 !! html/php
14454 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"></a></div>caption</div></div></div>
14455
14456 !! html/parsoid
14457 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14458 !! end
14459
14460 !! test
14461 Localized image handling (3).
14462 !! options
14463 language=fa
14464 parsoid=html2wt
14465 !! html/parsoid
14466 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure>
14467 !! wikitext
14468 [[File:Foobar.jpg|بندانگشتی]]
14469 !! end
14470
14471 !! test
14472 "border", "frameless" and "class" attributes on an image.
14473 !! options
14474 thumbsize=220
14475 parsoid=wt2html,wt2wt,html2html
14476 !! wikitext
14477 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14478 !! html/php
14479 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>
14480 </p>
14481 !! html/parsoid
14482 <p><span class="mw-default-size mw-image-border extra" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
14483 !! end
14484
14485 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14486 !! test
14487 Invalid image attributes (T64500)
14488 !! options
14489 thumbsize=220
14490 parsoid=wt2html,wt2wt,html2html
14491 !! wikitext
14492 [[File:Foobar.jpg|thumb|float|left|caption]]
14493
14494 [[File:Foobar.jpg|thumb|righ|caption]]
14495
14496 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14497 !! html/php
14498 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14499 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14500 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14501
14502 !! html/parsoid
14503 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14504 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14505 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14506 !! end
14507
14508 !! article
14509 File:Barfoo.jpg
14510 !! text
14511 #REDIRECT [[File:Barfoo.jpg]]
14512 !! endarticle
14513
14514 # FIXME: Parsoid should run this test -- but we'd need to teach the
14515 # mockAPI about the redirected Barfoo.jpg image.
14516 !! test
14517 Redirected image
14518 !! wikitext
14519 [[Image:Barfoo.jpg]]
14520 !! html/php
14521 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14522 </p>
14523 !! end
14524
14525 !! test
14526 Missing image with uploads disabled
14527 !! options
14528 wgEnableUploads=0
14529 !! wikitext
14530 [[File:Foobaz.jpg]]
14531 !! html/php
14532 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14533 </p>
14534 !! html/parsoid
14535 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Foobaz.jpg"><img resource="./File:Foobaz.jpg" src="./Special:FilePath/Foobaz.jpg" height="220" width="220"/></a></span></p>
14536 !! end
14537
14538 # Parsoid-specific testing for images
14539 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14540 # Currently imperfect due to a flaw in the Parsoid testrunner
14541 # Work in progress
14542 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14543 # image tests.
14544
14545 !! test
14546 Parsoid-specific image handling - simple image with size and middle alignment
14547 !! wikitext
14548 [[File:Foobar.jpg|middle|50px]]
14549 !! html/parsoid
14550 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
14551 !! end
14552
14553 !! test
14554 Parsoid-specific image handling - simple image with size, middle alignment,
14555 non-standard namespace alias
14556 !! options
14557 parsoid=wt2wt,wt2html,html2html
14558 !! wikitext
14559 [[Image:Foobar.jpg|middle|50px]]
14560 !! html/parsoid
14561 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
14562 !! end
14563
14564 !! test
14565 Parsoid-specific image handling - simple image with size and middle alignment
14566 (existing content)
14567 !! wikitext
14568 [[File:Foobar.jpg|50px|middle]]
14569 !! html/parsoid
14570 <p><span class="mw-valign-middle" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"middle","ak":"middle"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14571 !! end
14572
14573 !! test
14574 Parsoid-specific image handling - simple image with size and middle alignment
14575 and non-standard namespace name
14576 !! options
14577 parsoid=wt2html,wt2wt,html2html
14578 !! wikitext
14579 [[Image:Foobar.jpg|50px|middle]]
14580 !! html/parsoid
14581 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
14582 !! end
14583
14584 !! test
14585 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14586 !! wikitext
14587 [[File:Foobar.jpg|500x10px|baseline|caption]]
14588 !! html/parsoid
14589 <p><span class="mw-valign-baseline" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"500x10px"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption"}],"size":"500x10"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="10" width="89" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"10","width":"89"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14590 !! end
14591
14592 !! test
14593 Parsoid-specific image handling - simple image with border and size spec
14594 !! wikitext
14595 [[File:Foobar.jpg|50px|border|caption]]
14596 !! html/parsoid
14597 <p><span class="mw-image-border" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14598 !! end
14599
14600 !! test
14601 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14602 !! wikitext
14603 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14604 !! html/parsoid
14605 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption content</figcaption></figure>
14606 !! end
14607
14608 !! test
14609 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14610 (existing content)
14611 !! wikitext
14612 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14613 !! html/parsoid
14614 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"left","ak":"left"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption content"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption content</figcaption></figure>
14615 !! end
14616
14617 !! test
14618 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14619 !! wikitext
14620 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14621 !! html/parsoid
14622 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a><figcaption>caption</figcaption></figure>
14623 !! end
14624
14625 !! test
14626 Parsoid-specific image handling - thumbnail with specific size, halign,
14627 valign, and caption (existing content)
14628 !! wikitext
14629 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14630 !! html/parsoid
14631 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"50x50px"},{"ck":"right","ak":"right"},{"ck":"middle","ak":"middle"},{"ck":"caption","ak":"caption"}],"size":"50x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption</figcaption></figure>
14632 !! end
14633
14634 !! test
14635 Parsoid-specific image handling - framed image with specific size and caption
14636 (size is ignored)
14637 !! options
14638 parsoid=wt2html,wt2wt,html2html
14639 !! wikitext
14640 [[File:Foobar.jpg|frame|500x50px|caption]]
14641 !! html/parsoid
14642 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
14643 !! end
14644
14645 !! test
14646 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14647 (size is ignored)
14648 !! options
14649 parsoid=wt2html,wt2wt,html2html
14650 !! wikitext
14651 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14652 !! html/parsoid
14653 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
14654 !! end
14655
14656 !! test
14657 Parsoid-specific image handling - frameless image with specific size, border, and caption
14658 !! wikitext
14659 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14660 !! html/parsoid
14661 <p><span class="mw-image-border" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"frameless","ak":"frameless"},{"ck":"width","ak":"442x50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}],"size":"442x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="50" width="442" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"50","width":"442"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14662 !! end
14663
14664 !! test
14665 Parsoid-specific image handling - simple image with a formatted caption
14666 !! wikitext
14667 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14668 !! html/parsoid
14669 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;table>&lt;tr>&lt;td>a&lt;/td>&lt;td>b&lt;/td>&lt;/tr>&lt;tr>&lt;td>c&lt;/td>&lt;/tr>&lt;/table>"}]}' data-mw='{"caption":"&lt;table data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[18,81,7,8]}&#39;>&lt;tbody data-parsoid=&#39;{\"dsr\":[25,73,0,0]}&#39;>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[25,54,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[29,39,4,5]}&#39;>a&lt;/td>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[39,49,4,5]}&#39;>b&lt;/td>&lt;/tr>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[54,73,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[58,68,4,5]}&#39;>c&lt;/td>&lt;/tr>&lt;/tbody>&lt;/table>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14670 !! end
14671
14672 !! test
14673 Parsoid-specific image handling - caption with a template in it
14674 !! wikitext
14675 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14676 !! html/parsoid
14677 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"></a><figcaption>This caption has a <span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;transclusion&quot;}},&quot;i&quot;:0}}]}">transclusion</span> in it.</figcaption></figure>
14678 !! end
14679
14680 !! test
14681 Parsoid-specific image handling - caption with unbalanced tags in it
14682 !! options
14683 parsoid=wt2html,wt2wt,html2html
14684 !! wikitext
14685 foo
14686 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14687 bar
14688 !! html/parsoid
14689 <p>foo</p>
14690 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has a <center>unbalanced tag in it.</center></figcaption></figure>
14691 <p>bar</p>
14692 !! end
14693
14694 !! test
14695 Parsoid-specific image handling - empty caption (1)
14696 !! options
14697 parsoid=wt2html,wt2wt
14698 !! wikitext
14699 [[File:Foobar.jpg|thumb|]]
14700 !! html/parsoid
14701 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption></figcaption></figure>
14702 !! end
14703
14704 # empty captions don't get serialized unless we're in the "round trip" case
14705 !! test
14706 Parsoid-specific image handling - empty caption (2)
14707 !! options
14708 parsoid=html2wt
14709 !! html/parsoid
14710 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14711 <a href="./File:Foobar.jpg">
14712 <img resource="./File:Foobar.jpg"
14713 src="//example.com/images/3/3a/Foobar.jpg"
14714 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14715 height="25" width="220"/>
14716 </a>
14717 <figcaption></figcaption>
14718 </figure>
14719 !! wikitext
14720 [[File:Foobar.jpg|thumb]]
14721 !! end
14722
14723 !! test
14724 Parsoid-specific image handling - whitespace caption
14725 !! wikitext
14726 [[File:Foobar.jpg|thumb| ]]
14727 !! html/parsoid
14728 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> </figcaption></figure>
14729 !! end
14730
14731 !! test
14732 Parsoid-specific image handling - lang option
14733 !! wikitext
14734 foo
14735 [[File:Foobar.svg|lang=de|caption]]
14736 bar
14737 !! html/parsoid
14738 <p>foo
14739 <span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="180" width="240"/></a></span>
14740 bar</p>
14741 !! end
14742
14743 ## Edge case bugs in Parsoid from T93580
14744 !! test
14745 T93580: 1. Templated <ref> inside block images
14746 !! wikitext
14747 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14748
14749 <references />
14750 !! html/parsoid
14751 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption with templated ref: {{echo|&lt;ref>foo&lt;/ref>}}"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption with templated ref: <span about="#mwt5" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></figcaption></figure>
14752
14753 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
14754 !! end
14755
14756 !! test
14757 T93580: 2. <ref> inside inline images
14758 !! wikitext
14759 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14760
14761 <references />
14762 !! html/parsoid
14763 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,78,5,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-1\"},\"attrs\":{}}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,78,5,6]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14764
14765 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
14766 !! end
14767
14768 !! test
14769 T93580: 3. Templated <ref> inside inline images
14770 !! wikitext
14771 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14772
14773 <references />
14774 !! html/parsoid
14775 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14776
14777 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
14778 !! end
14779
14780 ###
14781 ### Subpages
14782 ###
14783 !! article
14784 Subpage test/subpage
14785 !! text
14786 foo
14787 !! endarticle
14788
14789 !! test
14790 Subpage link
14791 !! options
14792 subpage title=[[Subpage test]]
14793 !! wikitext
14794 [[/subpage]]
14795 !! html
14796 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14797 </p>
14798 !! end
14799
14800 !! test
14801 Subpage noslash link
14802 !! options
14803 subpage title=[[Subpage test]]
14804 !! wikitext
14805 [[/subpage/]]
14806 !! html
14807 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14808 </p>
14809 !! end
14810
14811 !! article
14812 Subpage test/1/2/subpage
14813 !! text
14814 blah
14815 !! endarticle
14816
14817 !! test
14818 Relative subpage noslash link
14819 !! options
14820 parsoid=wt2wt,wt2html,html2html
14821 subpage title=[[Subpage test/1/2/3/4]]
14822 !! wikitext
14823 [[../../subpage/]]
14824
14825 [[../../subpage]]
14826 !! html/php
14827 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14828 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14829 </p>
14830 !! html/parsoid
14831 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14832 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14833 !! end
14834
14835 !! test
14836 Parsoid: dot-slash prefixed wikilinks
14837 !! wikitext
14838 [[./foo]]
14839
14840 [[././bar]]
14841
14842 [[././baz/]]
14843 !! html/php
14844 <p>[[./foo]]
14845 </p><p>[[././bar]]
14846 </p><p>[[././baz/]]
14847 </p>
14848 !! html/parsoid
14849 <p>[[./foo]]
14850 </p><p>[[././bar]]
14851 </p><p>[[././baz/]]
14852 </p>
14853 !! end
14854
14855 !! test
14856 Render invalid page names as plain text (T53090)
14857 !! wikitext
14858 [[./../foo|bar]]
14859 [[foo�|bar]]
14860 [[foo/.|bar]]
14861 [[foo/..|bar]]
14862 [[foo~~~bar]]
14863 [[foo>bar]]
14864 [[foo[bar]]
14865 [[.]]
14866 [[..]]
14867 [[foo././bar]]
14868
14869 [[{{echo|./../foo}}|bar]]
14870 [[{{echo|foo/.}}|bar]]
14871 [[{{echo|foo/..}}|bar]]
14872 [[{{echo|foo~~~~bar}}]]
14873 [[{{echo|foo>bar}}]]
14874 [[{{echo|foo././bar}}]]
14875 [[{{echo|foo{bar}}]]
14876 [[{{echo|foo}bar}}]]
14877 [[{{echo|foo[bar}}]]
14878 [[{{echo|foo]bar}}]]
14879 [[{{echo|foo<bar}}]]
14880 !!html/php
14881 <p>[[./../foo|bar]]
14882 [[foo�|bar]]
14883 [[foo/.|bar]]
14884 [[foo/..|bar]]
14885 [[foo~~~bar]]
14886 [[foo&gt;bar]]
14887 [[foo[bar]]
14888 [[.]]
14889 [[..]]
14890 [[foo././bar]]
14891 </p><p>[[./../foo|bar]]
14892 [[foo/.|bar]]
14893 [[foo/..|bar]]
14894 [[foo~~~~bar]]
14895 [[foo&gt;bar]]
14896 [[foo././bar]]
14897 [[foo{bar]]
14898 [[foo}bar]]
14899 [[foo[bar]]
14900 [[foo]bar]]
14901 [[foo&lt;bar]]
14902 </p>
14903 !!html/parsoid
14904 <p>[[./../foo|bar]]
14905 [[foo�|bar]]
14906 [[foo/.|bar]]
14907 [[foo/..|bar]]
14908 [[foo~~~bar]]
14909 [[foo>bar]]
14910 [[foo[bar]]
14911 [[.]]
14912 [[..]]
14913 [[foo././bar]]</p>
14914
14915 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14916 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14917 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14918 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14919 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14920 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14921 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14922 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14923 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14924 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14925 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;bar"}},"i":0}}]}'>foo&lt;bar</span>]]</p>
14926 !!end
14927
14928 !! test
14929 Disabled subpages
14930 !! wikitext
14931 [[/subpage]]
14932 !! html
14933 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14934 </p>
14935 !! end
14936
14937 !! test
14938 T2561: {{/Subpage}}
14939 !! options
14940 subpage title=[[Page]]
14941 !! wikitext
14942 {{/Subpage}}
14943 !! html
14944 <p><a href="/index.php?title=Page/Subpage&amp;action=edit&amp;redlink=1" class="new" title="Page/Subpage (page does not exist)">Page/Subpage</a>
14945 </p>
14946 !! end
14947
14948 ###
14949 ### Categories
14950 ###
14951 !! article
14952 Category:MediaWiki User's Guide
14953 !! text
14954 blah
14955 !! endarticle
14956
14957 !! test
14958 Link to category
14959 !! wikitext
14960 [[:Category:MediaWiki User's Guide]]
14961 !! html
14962 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14963 </p>
14964 !! end
14965
14966 !! test
14967 Simple category
14968 !! options
14969 cat
14970 !! wikitext
14971 [[Category:MediaWiki User's Guide]]
14972 !! html/php
14973 cat=MediaWiki_User's_Guide sort=
14974 !! html/parsoid
14975 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide" data-parsoid='{"stx":"simple","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
14976 !! end
14977
14978 !! test
14979 PAGESINCATEGORY invalid title fatal (r33546 fix)
14980 !! wikitext
14981 {{PAGESINCATEGORY:<bogus>}}
14982 !! html
14983 <p>0
14984 </p>
14985 !! end
14986
14987 !! test
14988 Category with different sort key
14989 !! options
14990 cat
14991 !! wikitext
14992 [[Category:MediaWiki User's Guide|Foo]]
14993 !! html/php
14994 cat=MediaWiki_User's_Guide sort=Foo
14995 !! html/parsoid
14996 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#Foo" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
14997 !! end
14998
14999 !! test
15000 Category with identical sort key
15001 !! options
15002 cat
15003 !! wikitext
15004 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15005 !! html/php
15006 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
15007 !! html/parsoid
15008 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#MediaWiki%20User's%20Guide" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
15009 !! end
15010
15011 !! test
15012 Category with empty sort key
15013 !! options
15014 cat
15015 pst
15016 !! wikitext
15017 [[Category:MediaWiki User's Guide|]]
15018 !! html/php
15019 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15020 !! end
15021
15022 !! test
15023 Category with empty sort key and parentheses
15024 !! options
15025 cat
15026 pst
15027 !! wikitext
15028 [[Category:Foo (bar)|]]
15029 !! html/php
15030 [[Category:Foo (bar)|Foo]]
15031 !! end
15032
15033 !! test
15034 Category with link tail
15035 !! options
15036 cat
15037 pst
15038 !! wikitext
15039 123[[Category:Foo]]456
15040 !! html/php
15041 123[[Category:Foo]]456
15042 !! end
15043
15044 !! test
15045 Category with template
15046 !! options
15047 cat
15048 pst
15049 !! wikitext
15050 [[Category:{{echo|Foo}}]]
15051 !! html/php
15052 [[Category:{{echo|Foo}}]]
15053 !! end
15054
15055 !! test
15056 Category with template in sort key
15057 !! options
15058 cat
15059 pst
15060 !! wikitext
15061 [[Category:Foo|{{echo|Bar}}]]
15062 !! html/php
15063 [[Category:Foo|{{echo|Bar}}]]
15064 !! end
15065
15066 !! test
15067 Category with template in sort key and title
15068 !! options
15069 cat
15070 pst
15071 !! wikitext
15072 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15073 !! html/php
15074 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15075 !! end
15076
15077 ## We used to, but no longer wt2wt this test since the default serializer
15078 ## will normalize all categories to serialize on their own line.
15079 ## This wikitext usage is going to be fairly uncommon in production and
15080 ## selser will take care of preserving formatting in those scenarios.
15081 !! test
15082 Category / paragraph interactions
15083 !! options
15084 parsoid=wt2html
15085 !! wikitext
15086 Foo [[Category:Baz]] Bar
15087
15088 Foo [[Category:Baz]]
15089 Bar
15090
15091 Foo
15092 [[Category:Baz]]
15093 Bar
15094
15095 Foo
15096 [[Category:Baz]] Bar
15097
15098 Foo
15099 [[Category:Baz]]
15100 [[Category:Baz]]
15101 [[Category:Baz]]
15102 Bar
15103
15104 [[Category:Baz]]
15105 [[Category:Baz]]
15106 [[Category:Baz]]
15107
15108 [[Category:Baz]]
15109 {{echo|[[Category:Baz]]}}
15110 [[Category:Baz]]
15111 !! html/php
15112 <p>Foo Bar
15113 </p><p>Foo
15114 Bar
15115 </p><p>Foo
15116 Bar
15117 </p><p>Foo Bar
15118 </p><p>Foo
15119 Bar
15120 </p>
15121 !! html/parsoid
15122 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15123 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15124 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15125 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15126 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Baz]]"}},"i":0}}]}'/></p>
15127 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15128 !! end
15129
15130 ## We used to, but no longer wt2wt this test since the default serializer
15131 ## will normalize all categories to serialize on their own line.
15132 ## This wikitext usage is going to be fairly uncommon in production and
15133 ## selser will take care of preserving formatting in those scenarios.
15134 ##
15135 ## The whitespace on the empty line is part of the test. Please do not delete
15136 !! test
15137 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15138 !! options
15139 parsoid=wt2html
15140 !! wikitext
15141 This
15142
15143 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15144
15145 {{echo|[[Category:Foo]] and so should this!}}
15146 !! html/php
15147 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15148 </p>
15149 !! html/parsoid
15150 <p>This
15151
15152 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15153
15154 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]] and so should this!"}},"i":0}}]}'/><span about="#mwt1"> and so should this!</span></p>
15155 !! end
15156
15157 ## Parsoid will not try to wt2wt this while preserving newlines because
15158 ## it suppresses excess newlines within list items -- and we don't want to
15159 ## introduce a special case just for categories, which is, in reality somewhat
15160 ## odd behavior -- categories are unlikely to be used in list items like this
15161 ## in top-level pages and are only likely to show up in template-generated
15162 ## list items where this RT-ing is a non-issue.
15163 ##
15164 ## The whitespace on the empty line is part of the test. Please do not delete
15165 !! test
15166 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15167 !! options
15168 parsoid=wt2html
15169 !! wikitext
15170 * This
15171
15172 [[Category:Foo]] and this should be part of the same list item
15173 * So should this
15174
15175 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15176 !! html
15177 <ul><li>This and this should be part of the same list item</li>
15178 <li>So should this and this should be part of the same list item</li></ul>
15179 !! html/parsoid
15180 <ul>
15181 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15182 <li>So should this <link rel="mw:PageProp/Category" href="./Category:Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]] and this should be part of the same list item"}},"i":0}}]}'/><span> and this should be part of the same list item</span></li>
15183 </ul>
15184 !! end
15185
15186 ## Newlines and categories that follow the last item of a list
15187 ## are treated differently because this (list followed by categories)
15188 ## is an extremely common pattern on wikis.
15189 !! test
15190 3. Categories and newlines: newline suppression for last list item should RT properly
15191 !! wikitext
15192 * a
15193 * b
15194
15195 [[Category:Foo]]
15196
15197 [[Category:Bar]]
15198 [[Category:Baz]]
15199 !! html/parsoid
15200 <ul><li> a</li>
15201 <li> b</li></ul>
15202
15203 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15204
15205 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15206 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15207 !! end
15208
15209 !! test
15210 4. Categories and newlines: newline suppression for last list item should RT properly
15211 !! wikitext
15212 * a
15213 **** b
15214
15215 [[Category:Foo]]
15216 !! html/parsoid
15217 <ul><li> a
15218 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15219
15220 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15221 !! end
15222
15223 ## only wt2html for this to make sure the algo only applies to the rightmost path
15224 !! test
15225 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15226 !! options
15227 parsoid=wt2html
15228 !! wikitext
15229 * a
15230 ** b
15231 [[Category:Foo]]
15232 * c
15233 ** d
15234 [[Category:Foo]]
15235 !! html/parsoid
15236 <ul><li> a
15237 <ul><li> b
15238 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15239 <li> c
15240 <ul><li> d</li></ul></li></ul>
15241 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15242 !! end
15243
15244 ## We used to, but no longer wt2wt this test since the default serializer
15245 ## will normalize all categories to serialize on their own line.
15246 ## This wikitext usage is going to be fairly uncommon in production and
15247 ## selser will take care of preserving formatting in those scenarios.
15248 !! test
15249 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15250 !! options
15251 parsoid=wt2html
15252 !! wikitext
15253 * a [[Category:Foo]]
15254 !! html/parsoid
15255 <ul><li>a <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul>
15256 !! end
15257
15258 # This test also demonstrates because of newline+category tunneling
15259 # through the list hander, template wrapping doesn't expand to the
15260 # containing list when the list item swallows the category.
15261 !! test
15262 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15263 !! wikitext
15264 * {{echo|a
15265 [[Category:Foo]]}}
15266 !! html/parsoid
15267 <ul><li> <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n[[Category:Foo]]"}},"i":0}}]}'>a
15268 </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul>
15269 !! end
15270
15271 !! test
15272 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15273 !! wikitext
15274 * a
15275
15276 {{echo|[[Category:Foo]]
15277 [[Category:Bar]]}}
15278 [[Category:Baz]]
15279 !! html/parsoid
15280 <ul><li> a</li></ul>
15281
15282 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]\n[[Category:Bar]]"}},"i":0}}]}'/><span about="#mwt1">
15283 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15284 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15285 !! end
15286
15287 !! test
15288 Category links with multiple namespaces
15289 !! wikitext
15290 [[Category:Project:Foo]]
15291 !! html/parsoid
15292 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15293 !! end
15294
15295 !! test
15296 Parsoid: Serialize link to category page with colon escape
15297 !! options
15298 parsoid
15299 !! wikitext
15300
15301 [[:Category:Foo]]
15302 [[:Category:Foo|Bar]]
15303 !! html
15304 <p>
15305 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15306 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15307 </p>
15308 !! end
15309
15310 # We used to, but no longer wt2wt this test since the default serializer
15311 # will normalize all categories to serialize on their own line.
15312 # This wikitext usage is going to be fairly uncommon in production and
15313 # selser will take care of preventing whitespace insertion if this
15314 # occurs in an article.
15315 #
15316 # html2html disabled for the same reason (whitespace insertion between
15317 # x and y).
15318 #
15319 # html2wt disabled because it localizes the "Category" namespace.
15320 !! test
15321 Link prefix/suffixes aren't applied to category links
15322 !! options
15323 parsoid=wt2html
15324 language=is
15325 !! wikitext
15326 x[[Category:Foo]]y
15327 !! html/php
15328 <p>xy
15329 </p>
15330 !! html/parsoid
15331 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15332 !! end
15333
15334 !! test
15335 Parsoid: Serialize link to file page with colon escape
15336 !! options
15337 parsoid
15338 !! wikitext
15339
15340 [[:File:Foo.png]]
15341 [[:File:Foo.png|Bar]]
15342 !! html
15343 <p>
15344 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15345 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15346 </p>
15347 !! end
15348
15349 !! test
15350 Parsoid: Serialize a genuine category link without colon escape
15351 !! options
15352 parsoid
15353 !! wikitext
15354 [[Category:Foo]]
15355 [[Category:Foo|Bar]]
15356 !! html
15357 <link rel="mw:PageProp/Category" href="./Category:Foo">
15358 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15359 !! end
15360
15361 !! test
15362 Normalize hrefs properly before testing for invalid link targets (T72894)
15363 !! options
15364 parsoid=html2wt
15365 !! html/parsoid
15366 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15367 !! wikitext
15368 [[Category:Toxine bactérienne]]
15369 !! end
15370
15371 !! test
15372 Parsoid: Defaultsort
15373 !! wikitext
15374 {{DEFAULTSORT:Foo}}
15375 !! html/parsoid
15376 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15377 !! end
15378
15379 !! test
15380 Parsoid: Defaultsort (template-generated)
15381 !! wikitext
15382 {{{{echo|DEFAULTSORT}}:Foo}}
15383 !! html/parsoid
15384 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DEFAULTSORT}}:Foo"},"params":{},"i":0}}]}'/>
15385 !! end
15386
15387 ###
15388 ### Inter-language links
15389 ###
15390 !! test
15391 Interlanguage links
15392 !! options
15393 ill
15394 !! wikitext
15395 [[es:Alimento]]
15396 [[fr:Nourriture]]
15397 [[zh:食品]]
15398 !! html/php
15399 es:Alimento fr:Nourriture zh:食品
15400 !! html/parsoid
15401 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15402 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15403 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15404 !! end
15405
15406 !! test
15407 Duplicate interlanguage links (T26502)
15408 !! options
15409 ill
15410 !! wikitext
15411 [[es:1]]
15412 [[es:2]]
15413 [[fr:1]]
15414 [[fr:2]]
15415 !! html/php
15416 es:1 fr:1
15417 !! html/parsoid
15418 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15419 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15420 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15421 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15422 !! end
15423
15424 ###
15425 ### Sections
15426 ###
15427 !! test
15428 Basic section headings
15429 !! wikitext
15430 == Headline 1 ==
15431 Some text
15432
15433 ==Headline 2==
15434 More
15435 ===Smaller headline===
15436 Blah blah
15437 !! html
15438 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15439 <p>Some text
15440 </p>
15441 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15442 <p>More
15443 </p>
15444 <h3><span class="mw-headline" id="Smaller_headline">Smaller headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15445 <p>Blah blah
15446 </p>
15447 !! end
15448
15449 !! test
15450 Section headings with TOC
15451 !! wikitext
15452 == Headline 1 ==
15453 === Subheadline 1 ===
15454 ===== Skipping a level =====
15455 ====== Skipping a level ======
15456
15457 == Headline 2 ==
15458 Some text
15459 ===Another headline===
15460 !! html
15461 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15462 <ul>
15463 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15464 <ul>
15465 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15466 <ul>
15467 <li class="toclevel-3 tocsection-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
15468 <ul>
15469 <li class="toclevel-4 tocsection-4"><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li>
15470 </ul>
15471 </li>
15472 </ul>
15473 </li>
15474 </ul>
15475 </li>
15476 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15477 <ul>
15478 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15479 </ul>
15480 </li>
15481 </ul>
15482 </div>
15483
15484 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15485 <h3><span class="mw-headline" id="Subheadline_1">Subheadline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15486 <h5><span class="mw-headline" id="Skipping_a_level">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
15487 <h6><span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
15488 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15489 <p>Some text
15490 </p>
15491 <h3><span class="mw-headline" id="Another_headline">Another headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15492
15493 !! end
15494
15495 !! test
15496 TOC anchors don't collide
15497 !! wikitext
15498 __FORCETOC__
15499 == Headline 2 ==
15500 == Headline ==
15501 == Headline 2 ==
15502 == Headline ==
15503 !! html/php
15504 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15505 <ul>
15506 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15507 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15508 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15509 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15510 </ul>
15511 </div>
15512
15513 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15514 <h2><span class="mw-headline" id="Headline">Headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15515 <h2><span class="mw-headline" id="Headline_2_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15516 <h2><span class="mw-headline" id="Headline_3">Headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15517
15518 !! end
15519
15520 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15521 !! test
15522 Handling of sections up to level 6 and beyond
15523 !! wikitext
15524 = Level 1 Heading=
15525 == Level 2 Heading==
15526 === Level 3 Heading===
15527 ==== Level 4 Heading====
15528 ===== Level 5 Heading=====
15529 ====== Level 6 Heading======
15530 ======= Level 7 Heading=======
15531 ======== Level 8 Heading========
15532 ========= Level 9 Heading=========
15533 ========== Level 10 Heading==========
15534 !! html
15535 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15536 <ul>
15537 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15538 <ul>
15539 <li class="toclevel-2 tocsection-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
15540 <ul>
15541 <li class="toclevel-3 tocsection-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
15542 <ul>
15543 <li class="toclevel-4 tocsection-4"><a href="#Level_4_Heading"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Level 4 Heading</span></a>
15544 <ul>
15545 <li class="toclevel-5 tocsection-5"><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a>
15546 <ul>
15547 <li class="toclevel-6 tocsection-6"><a href="#Level_6_Heading"><span class="tocnumber">1.1.1.1.1.1</span> <span class="toctext">Level 6 Heading</span></a></li>
15548 <li class="toclevel-6 tocsection-7"><a href="#.3D_Level_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">= Level 7 Heading=</span></a></li>
15549 <li class="toclevel-6 tocsection-8"><a href="#.3D.3D_Level_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">== Level 8 Heading==</span></a></li>
15550 <li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3D_Level_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">=== Level 9 Heading===</span></a></li>
15551 <li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">==== Level 10 Heading====</span></a></li>
15552 </ul>
15553 </li>
15554 </ul>
15555 </li>
15556 </ul>
15557 </li>
15558 </ul>
15559 </li>
15560 </ul>
15561 </li>
15562 </ul>
15563 </div>
15564
15565 <h1><span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
15566 <h2><span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15567 <h3><span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15568 <h4><span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
15569 <h5><span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
15570 <h6><span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
15571 <h6><span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
15572 <h6><span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
15573 <h6><span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
15574 <h6><span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
15575
15576 !! end
15577
15578 !! test
15579 TOC regression (T11764)
15580 !! wikitext
15581 == title 1 ==
15582 === title 1.1 ===
15583 ==== title 1.1.1 ====
15584 === title 1.2 ===
15585 == title 2 ==
15586 === title 2.1 ===
15587 !! html
15588 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15589 <ul>
15590 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15591 <ul>
15592 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a>
15593 <ul>
15594 <li class="toclevel-3 tocsection-3"><a href="#title_1.1.1"><span class="tocnumber">1.1.1</span> <span class="toctext">title 1.1.1</span></a></li>
15595 </ul>
15596 </li>
15597 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
15598 </ul>
15599 </li>
15600 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15601 <ul>
15602 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
15603 </ul>
15604 </li>
15605 </ul>
15606 </div>
15607
15608 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15609 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15610 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
15611 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15612 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15613 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15614
15615 !! end
15616
15617 !! test
15618 TOC for heading containing <span id="..."></span> (T96153)
15619 !! wikitext
15620 __FORCETOC__
15621 ==<span id="old-anchor"></span>New title==
15622 !! html/php
15623 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15624 <ul>
15625 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15626 </ul>
15627 </div>
15628
15629 <h2><span class="mw-headline" id="New_title"><span id="old-anchor"></span>New title</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: New title">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15630
15631 !! end
15632
15633 !! test
15634 TOC with wgMaxTocLevel=3 (T8204)
15635 !! options
15636 wgMaxTocLevel=3
15637 !! wikitext
15638 == title 1 ==
15639 === title 1.1 ===
15640 ==== title 1.1.1 ====
15641 === title 1.2 ===
15642 == title 2 ==
15643 === title 2.1 ===
15644 !! html
15645 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15646 <ul>
15647 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15648 <ul>
15649 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
15650 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
15651 </ul>
15652 </li>
15653 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15654 <ul>
15655 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
15656 </ul>
15657 </li>
15658 </ul>
15659 </div>
15660
15661 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15662 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15663 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
15664 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15665 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15666 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15667
15668 !! end
15669
15670 !! test
15671 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
15672 !! options
15673 wgMaxTocLevel=3
15674 !! wikitext
15675 ==Section 1==
15676 ===Section 1.1===
15677 ====Section 1.1.1====
15678 ====Section 1.1.1.1====
15679 ==Section 2==
15680 !! html
15681 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15682 <ul>
15683 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15684 <ul>
15685 <li class="toclevel-2 tocsection-2"><a href="#Section_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Section 1.1</span></a></li>
15686 </ul>
15687 </li>
15688 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15689 </ul>
15690 </div>
15691
15692 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15693 <h3><span class="mw-headline" id="Section_1.1">Section 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15694 <h4><span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
15695 <h4><span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
15696 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15697
15698 !! end
15699
15700
15701 !! test
15702 Resolving duplicate section names
15703 !! wikitext
15704 == Foo bar ==
15705 == Foo bar ==
15706 !! html
15707 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15708 <h2><span class="mw-headline" id="Foo_bar_2">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15709
15710 !! end
15711
15712 !! test
15713 Resolving duplicate section names with differing case (T12721)
15714 !! wikitext
15715 == Foo bar ==
15716 == Foo Bar ==
15717 !! html
15718 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15719 <h2><span class="mw-headline" id="Foo_Bar_2">Foo Bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15720
15721 !! end
15722
15723 !! article
15724 Template:sections
15725 !! text
15726 ===Section 1===
15727 ==Section 2==
15728 !! endarticle
15729
15730 !! test
15731 Template with sections, __NOTOC__
15732 !! wikitext
15733 __NOTOC__
15734 ==Section 0==
15735 {{sections}}
15736 ==Section 4==
15737 !! html
15738 <h2><span class="mw-headline" id="Section_0">Section 0</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15739 <h3><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15740 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15741 <h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15742
15743 !! end
15744
15745 !! test
15746 __NOEDITSECTION__ keyword
15747 !! wikitext
15748 __NOEDITSECTION__
15749 ==Section 1==
15750 ==Section 2==
15751 !! html
15752 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15753 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15754
15755 !! end
15756
15757 !! test
15758 Link inside a section heading
15759 !! wikitext
15760 ==Section with a [[Main Page|link]] in it==
15761 !! html
15762 <h2><span class="mw-headline" id="Section_with_a_link_in_it">Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15763
15764 !! end
15765
15766 !! test
15767 TOC regression (T14077)
15768 !! wikitext
15769 __TOC__
15770 == title 1 ==
15771 === title 1.1 ===
15772 == title 2 ==
15773 !! html
15774 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15775 <ul>
15776 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15777 <ul>
15778 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
15779 </ul>
15780 </li>
15781 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15782 </ul>
15783 </div>
15784
15785 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15786 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15787 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15788
15789 !! end
15790
15791 !! test
15792 T3219 URL next to image (good)
15793 !! wikitext
15794 http://example.com [[File:Foobar.jpg]]
15795 !! html/php
15796 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15797 </p>
15798 !! html/parsoid
15799 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> <span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
15800 !!end
15801
15802 !! test
15803 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
15804 !! wikitext
15805 ===
15806 The line above must have a trailing space!
15807 === <!--
15808 --> <!-- -->
15809 But just in case it doesn't...
15810 !! html
15811 <h1><span class="mw-headline" id=".3D">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
15812 <p>The line above must have a trailing space!
15813 </p>
15814 <h1><span class="mw-headline" id=".3D_2">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
15815 <p>But just in case it doesn't...
15816 </p>
15817 !! end
15818
15819 !! test
15820 Header with special characters (T27462)
15821 !! wikitext
15822 The tooltips shall not show entities to the user (ie. be double escaped)
15823
15824 == text > text ==
15825 section 1
15826
15827 == text < text ==
15828 section 2
15829
15830 == text & text ==
15831 section 3
15832
15833 == text ' text ==
15834 section 4
15835
15836 == text " text ==
15837 section 5
15838 !! html
15839 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15840 </p>
15841 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15842 <ul>
15843 <li class="toclevel-1 tocsection-1"><a href="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text &gt; text</span></a></li>
15844 <li class="toclevel-1 tocsection-2"><a href="#text_.3C_text"><span class="tocnumber">2</span> <span class="toctext">text &lt; text</span></a></li>
15845 <li class="toclevel-1 tocsection-3"><a href="#text_.26_text"><span class="tocnumber">3</span> <span class="toctext">text &amp; text</span></a></li>
15846 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15847 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15848 </ul>
15849 </div>
15850
15851 <h2><span class="mw-headline" id="text_.3E_text">text &gt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text &gt; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15852 <p>section 1
15853 </p>
15854 <h2><span class="mw-headline" id="text_.3C_text">text &lt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15855 <p>section 2
15856 </p>
15857 <h2><span class="mw-headline" id="text_.26_text">text &amp; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15858 <p>section 3
15859 </p>
15860 <h2><span class="mw-headline" id="text_.27_text">text ' text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15861 <p>section 4
15862 </p>
15863 <h2><span class="mw-headline" id="text_.22_text">text " text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15864 <p>section 5
15865 </p>
15866 !! end
15867
15868 !! test
15869 Header with space, plus and underscore as entity
15870 !! wikitext
15871 Id should not contain + for spaces
15872
15873 == Space between Text ==
15874 section 1
15875
15876 == Space-Entity&#32;between&#32;Text ==
15877 section 2
15878
15879 == Plus+between+Text ==
15880 section 3
15881
15882 == Plus-Entity&#43;between&#43;Text ==
15883 section 4
15884
15885 == Underscore_between_Text ==
15886 section 5
15887
15888 == Underscore-Entity&#95;between&#95;Text ==
15889 section 6
15890
15891 [[#Space between Text]]
15892 [[#Space-Entity&#32;between&#32;Text]]
15893 [[#Plus+between+Text]]
15894 [[#Plus-Entity&#43;between&#43;Text]]
15895 [[#Underscore_between_Text]]
15896 [[#Underscore-Entity&#95;between&#95;Text]]
15897 !! html
15898 <p>Id should not contain + for spaces
15899 </p>
15900 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15901 <ul>
15902 <li class="toclevel-1 tocsection-1"><a href="#Space_between_Text"><span class="tocnumber">1</span> <span class="toctext">Space between Text</span></a></li>
15903 <li class="toclevel-1 tocsection-2"><a href="#Space-Entity_between_Text"><span class="tocnumber">2</span> <span class="toctext">Space-Entity&#32;between&#32;Text</span></a></li>
15904 <li class="toclevel-1 tocsection-3"><a href="#Plus.2Bbetween.2BText"><span class="tocnumber">3</span> <span class="toctext">Plus+between+Text</span></a></li>
15905 <li class="toclevel-1 tocsection-4"><a href="#Plus-Entity.2Bbetween.2BText"><span class="tocnumber">4</span> <span class="toctext">Plus-Entity&#43;between&#43;Text</span></a></li>
15906 <li class="toclevel-1 tocsection-5"><a href="#Underscore_between_Text"><span class="tocnumber">5</span> <span class="toctext">Underscore_between_Text</span></a></li>
15907 <li class="toclevel-1 tocsection-6"><a href="#Underscore-Entity_between_Text"><span class="tocnumber">6</span> <span class="toctext">Underscore-Entity&#95;between&#95;Text</span></a></li>
15908 </ul>
15909 </div>
15910
15911 <h2><span class="mw-headline" id="Space_between_Text">Space between Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Space between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15912 <p>section 1
15913 </p>
15914 <h2><span class="mw-headline" id="Space-Entity_between_Text">Space-Entity&#32;between&#32;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Space-Entity between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15915 <p>section 2
15916 </p>
15917 <h2><span class="mw-headline" id="Plus.2Bbetween.2BText">Plus+between+Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Plus+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15918 <p>section 3
15919 </p>
15920 <h2><span class="mw-headline" id="Plus-Entity.2Bbetween.2BText">Plus-Entity&#43;between&#43;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Plus-Entity+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15921 <p>section 4
15922 </p>
15923 <h2><span class="mw-headline" id="Underscore_between_Text">Underscore_between_Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Underscore between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15924 <p>section 5
15925 </p>
15926 <h2><span class="mw-headline" id="Underscore-Entity_between_Text">Underscore-Entity&#95;between&#95;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Underscore-Entity_between_Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15927 <p>section 6
15928 </p><p><a href="#Space_between_Text">#Space between Text</a>
15929 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15930 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15931 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15932 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15933 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15934 </p>
15935 !! end
15936
15937 !! test
15938 Headers with excess '=' characters
15939 (Are similar tests necessary beyond the 1st level?)
15940 !! wikitext
15941 =foo==
15942 ==foo=
15943 =''italic'' heading==
15944 ==''italic'' heading=
15945 !! html
15946 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15947 <ul>
15948 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15949 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15950 <li class="toclevel-1 tocsection-3"><a href="#italic_heading.3D"><span class="tocnumber">3</span> <span class="toctext"><i>italic</i> heading=</span></a></li>
15951 <li class="toclevel-1 tocsection-4"><a href="#.3Ditalic_heading"><span class="tocnumber">4</span> <span class="toctext">=<i>italic</i> heading</span></a></li>
15952 </ul>
15953 </div>
15954
15955 <h1><span class="mw-headline" id="foo.3D">foo=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
15956 <h1><span class="mw-headline" id=".3Dfoo">=foo</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
15957 <h1><span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
15958 <h1><span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
15959
15960 !! end
15961
15962 !! test
15963 HTML headers vs TOC (T25393)
15964 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15965 !! wikitext
15966 <h1>Header 1</h1>
15967 == Header 1.1 ==
15968 == Header 1.2 ==
15969
15970 <h1>Header 2
15971 </h1>
15972 == Header 2.1 ==
15973 == Header 2.2 ==
15974 __NOEDITSECTION__
15975 !! html
15976 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
15977 <ul>
15978 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15979 <ul>
15980 <li class="toclevel-2 tocsection-1"><a href="#Header_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Header 1.1</span></a></li>
15981 <li class="toclevel-2 tocsection-2"><a href="#Header_1.2"><span class="tocnumber">1.2</span> <span class="toctext">Header 1.2</span></a></li>
15982 </ul>
15983 </li>
15984 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15985 <ul>
15986 <li class="toclevel-2 tocsection-3"><a href="#Header_2.1"><span class="tocnumber">2.1</span> <span class="toctext">Header 2.1</span></a></li>
15987 <li class="toclevel-2 tocsection-4"><a href="#Header_2.2"><span class="tocnumber">2.2</span> <span class="toctext">Header 2.2</span></a></li>
15988 </ul>
15989 </li>
15990 </ul>
15991 </div>
15992
15993 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15994 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15995 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15996 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15997 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15998 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15999
16000 !! end
16001
16002 !! test
16003 Single-line or multiline-comments can follow headings
16004 !! options
16005 parsoid=wt2html,wt2wt
16006 !! wikitext
16007 ==foo==<!---->
16008 ==bar==<!--c1-->
16009 ==baz==<!--
16010 c2
16011 c3-->
16012 !! html
16013 <h2><span class="mw-headline" id="foo">foo</span></h2>
16014 <h2><span class="mw-headline" id="bar">bar</span></h2>
16015 <h2><span class="mw-headline" id="baz">baz</span></h2>
16016
16017 !! end
16018
16019 !! test
16020 T3219 URL next to image (broken)
16021 !! wikitext
16022 http://example.com[[File:Foobar.jpg]]
16023 !! html/php
16024 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
16025 </p>
16026 !! html/parsoid
16027 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
16028 !!end
16029
16030 !! test
16031 T3186 news: in the middle of text
16032 !! wikitext
16033 http://en.wikinews.org/wiki/Wikinews:Workplace
16034 !! html
16035 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
16036 </p>
16037 !!end
16038
16039
16040 !! test
16041 Namespaced link must have a title
16042 !! wikitext
16043 [[Project:]]
16044 !! html
16045 <p>[[Project:]]
16046 </p>
16047 !!end
16048
16049 !! test
16050 Namespaced link must have a title (bad fragment version)
16051 !! wikitext
16052 [[Project:#fragment]]
16053 !! html
16054 <p>[[Project:#fragment]]
16055 </p>
16056 !!end
16057
16058
16059 ###
16060 ### HTML tags and HTML attributes
16061 ###
16062
16063 !! test
16064 div with no attributes
16065 !! wikitext
16066 <div>HTML rocks</div>
16067 !! html
16068 <div>HTML rocks</div>
16069
16070 !! end
16071
16072 !! test
16073 div with double-quoted attribute
16074 !! wikitext
16075 <div id="rock">HTML rocks</div>
16076 !! html
16077 <div id="rock">HTML rocks</div>
16078
16079 !! end
16080
16081 !! test
16082 div with single-quoted attribute
16083 !! wikitext
16084 <div id='rock'>HTML rocks</div>
16085 !! html
16086 <div id="rock">HTML rocks</div>
16087
16088 !! end
16089
16090 !! test
16091 div with unquoted attribute
16092 !! wikitext
16093 <div id=rock>HTML rocks</div>
16094 !! html
16095 <div id="rock">HTML rocks</div>
16096
16097 !! end
16098
16099 !! test
16100 div with illegal double attributes
16101 !! wikitext
16102 <div id="a" id="b">HTML rocks</div>
16103 !! html
16104 <div id="b">HTML rocks</div>
16105
16106 !!end
16107
16108 !! test
16109 div with empty attribute value, space before equals
16110 !! options
16111 parsoid=wt2html,html2html
16112 !! wikitext
16113 <div class =>HTML rocks</div>
16114 !! html/php
16115 <div class="">HTML rocks</div>
16116
16117 !! html/parsoid
16118 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16119 !! end
16120
16121 !! test
16122 div with multiple empty attribute values
16123 !! options
16124 parsoid=wt2html,html2html
16125 !! wikitext
16126 <div id= title=>HTML rocks</div>
16127 !! html/php
16128 <div id="title.3D">HTML rocks</div>
16129
16130 !! html/parsoid
16131 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16132 !! end
16133
16134 !! test
16135 table with multiple empty attribute values
16136 !! options
16137 parsoid=wt2html,html2html
16138 !! wikitext
16139 {| title= id=
16140 | hi
16141 |}
16142 !! html/php
16143 <table title="id=">
16144 <tr>
16145 <td> hi
16146 </td></tr></table>
16147
16148 !! html/parsoid
16149 <table title="id=">
16150 <tbody><tr><td> hi</td></tr>
16151 </tbody></table>
16152 !! end
16153
16154 !! test
16155 div with braces in attribute value
16156 !! wikitext
16157 <div title="{}">Foo</div>
16158 !! html/php
16159 <div title="&#123;&#125;">Foo</div>
16160
16161 !! html/parsoid
16162 <div title="{}">Foo</div>
16163 !! end
16164
16165 !! test
16166 div with empty attribute value, no space before equals
16167 !! options
16168 parsoid=wt2html,html2html
16169 !! wikitext
16170 <div class=>HTML rocks</div>
16171 !! html/php
16172 <div class="">HTML rocks</div>
16173
16174 !! html/parsoid
16175 <div class="">HTML rocks</div>
16176 !! end
16177
16178 !! test
16179 HTML multiple attributes correction
16180 !! wikitext
16181 <p class="error" class="awesome">Awesome!</p>
16182 !! html
16183 <p class="awesome">Awesome!</p>
16184
16185 !!end
16186
16187 !! test
16188 Table multiple attributes correction
16189 !! wikitext
16190 {|
16191 !+ class="error" class="awesome"| status
16192 |}
16193 !! html
16194 <table>
16195 <tr>
16196 <th class="awesome"> status
16197 </th></tr></table>
16198
16199 !!end
16200
16201 !! test
16202 DIV IN UPPERCASE
16203 !! wikitext
16204 <DIV ID="x">HTML ROCKS</DIV>
16205 !! html
16206 <div id="x">HTML ROCKS</div>
16207
16208 !!end
16209
16210 !! test
16211 Non-ASCII pseudo-tags are rendered as text
16212 !! wikitext
16213 <khyô>
16214 !! html
16215 <p>&lt;khyô&gt;
16216 </p>
16217 !! end
16218
16219 !! test
16220 Pseudo-tag with URL 'name' renders as url link
16221 !! wikitext
16222 <http://example.com/>
16223 !! html
16224 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16225 </p>
16226 !! end
16227
16228 !! test
16229 text with amp in the middle of nowhere
16230 !! wikitext
16231 Remember AT&T?
16232 !! html
16233 <p>Remember AT&amp;T?
16234 </p>
16235 !! end
16236
16237 !! test
16238 text with character entity: eacute
16239 !! wikitext
16240 I always thought &eacute; was a cute letter.
16241 !! html
16242 <p>I always thought &#233; was a cute letter.
16243 </p>
16244 !! html+tidy
16245 <p>I always thought é was a cute letter.</p>
16246 !! end
16247
16248 !! test
16249 text with entity-escaped character entity-like string: eacute
16250 !! wikitext
16251 I always thought &amp;eacute; was a cute letter.
16252 !! html
16253 <p>I always thought &amp;eacute; was a cute letter.
16254 </p>
16255 !! end
16256
16257 !! test
16258 text with undefined character entity: xacute
16259 !! wikitext
16260 I always thought &xacute; was a cute letter.
16261 !! html
16262 <p>I always thought &amp;xacute; was a cute letter.
16263 </p>
16264 !! end
16265
16266 !! test
16267 HTML5 tags
16268 !! wikitext
16269 <data value="5">five</data>
16270 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16271 <mark>This highlighted text</mark>
16272 !! html
16273 <p><data value="5">five</data>
16274 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16275 <mark>This highlighted text</mark>
16276 </p>
16277 !! end
16278
16279 !! test
16280 HTML tag with leading space is parsed as text
16281 !! wikitext
16282 < div>foo< /div>
16283 !! html
16284 <p>&lt; div&gt;foo&lt; /div&gt;
16285 </p>
16286 !! end
16287
16288 ###
16289 ### Nesting tests (see T43545, T52604, T53081)
16290 ###
16291
16292 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
16293 # Note that html2wt is considerably more difficult if we use <b> in
16294 # the test case, instead of <small>
16295 !! test
16296 Ensure that HTML adoption agency algorithm is properly implemented.
16297 !! wikitext
16298 <small>X<small>Y</small>Z</small>
16299 !! html
16300 <p><small>X<small>Y</small>Z</small>
16301 </p>
16302 !! end
16303
16304 # This was T43545 in the PHP parser.
16305 # Note that tidy doesn't handle this correctly.
16306 !! test
16307 Nesting of <kbd>
16308 !! wikitext
16309 <kbd>X<kbd>Y</kbd>Z</kbd>
16310 !! html
16311 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16312 </p>
16313 !! end
16314
16315 # The following cases were T53081 in the PHP parser.
16316 # Note that there are some other nestable tags (b, i, etc) which are
16317 # not covered; see T53081 for discussion.
16318
16319 # Note that tidy doesn't handle this correctly.
16320 !! test
16321 Nesting of <em>
16322 !! wikitext
16323 <em>X<em>Y</em>Z</em>
16324 !! html
16325 <p><em>X<em>Y</em>Z</em>
16326 </p>
16327 !! end
16328
16329 # Note that tidy doesn't handle this correctly.
16330 !! test
16331 Nesting of <strong>
16332 !! wikitext
16333 <strong>X<strong>Y</strong>Z</strong>
16334 !! html
16335 <p><strong>X<strong>Y</strong>Z</strong>
16336 </p>
16337 !! end
16338
16339 !! test
16340 Nesting of <q>
16341 !! wikitext
16342 <q>X<q>Y</q>Z</q>
16343 !! html+tidy
16344 <p><q>X<q>Y</q>Z</q></p>
16345 !! end
16346
16347 # Note that tidy doesn't handle this correctly.
16348 !! test
16349 Nesting of <ruby>
16350 !! wikitext
16351 <ruby>X<ruby>Y</ruby>Z</ruby>
16352 !! html
16353 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16354 </p>
16355 !! end
16356
16357 # Note that tidy doesn't handle this correctly.
16358 !! test
16359 Nesting of <bdo>
16360 !! wikitext
16361 <bdo>X<bdo>Y</bdo>Z</bdo>
16362 !! html
16363 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16364 </p>
16365 !! end
16366
16367
16368 ###
16369 ### Media links
16370 ###
16371
16372 !! test
16373 Media link
16374 !! wikitext
16375 [[Media:Foobar.jpg]]
16376 !! html
16377 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16378 </p>
16379 !! end
16380
16381 !! test
16382 Media link with text
16383 !! wikitext
16384 [[Media:Foobar.jpg|A neat file to look at]]
16385 !! html
16386 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16387 </p>
16388 !! end
16389
16390 # FIXME: this is still bad HTML tag nesting
16391 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16392 !! test
16393 Media link with nasty text
16394 !! wikitext
16395 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16396 !! html
16397 <a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link&lt;div style="display:none"&gt;" onmouseover="alert(document.cookie)" onfoo="&lt;/div&gt;</a>
16398
16399 !! html+tidy
16400 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16401 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16402 !! end
16403
16404 !! test
16405 Media link to nonexistent file (T3702)
16406 !! wikitext
16407 [[Media:No such.jpg]]
16408 !! html
16409 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16410 </p>
16411 !! end
16412
16413 !! test
16414 Image link to nonexistent file (T3850 - good)
16415 !! wikitext
16416 [[File:No_such.jpg]]
16417 !! html/php
16418 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="File:No such.jpg">File:No such.jpg</a>
16419 </p>
16420 !! html/parsoid
16421 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:No_such.jpg"><img resource="./File:No_such.jpg" src="./Special:FilePath/No_such.jpg" height="220" width="220"/></a></span></p>
16422 !! end
16423
16424 !! test
16425 :Image link to nonexistent file (T3850 - bad)
16426 !! wikitext
16427 [[:Image:No such.jpg]]
16428 !! html/php
16429 <p><a href="/index.php?title=File:No_such.jpg&amp;action=edit&amp;redlink=1" class="new" title="File:No such.jpg (page does not exist)">Image:No such.jpg</a>
16430 </p>
16431 !! html/parsoid
16432 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16433 !! end
16434
16435
16436
16437 !! test
16438 Character reference normalization in link text (T3938)
16439 !! wikitext
16440 [[Main Page|this&that]]
16441 !! html
16442 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16443 </p>
16444 !!end
16445
16446 !! article
16447 אַ
16448 !! text
16449 Test for unicode normalization
16450
16451 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16452 !! endarticle
16453
16454 !! test
16455 (T21451) Links should refer to the normalized form.
16456 !! wikitext
16457 [[&#xFB2E;]]
16458 [[&#x5d0;&#x5b7;]]
16459 [[&#x5d0;ַ]]
16460 [[א&#x5b7;]]
16461 [[אַ]]
16462 !! html
16463 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16464 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16465 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16466 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16467 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16468 </p>
16469 !! end
16470
16471 !! test
16472 Empty attribute crash test (T4067)
16473 !! wikitext
16474 <font color="">foo</font>
16475 !! html
16476 <p><font color="">foo</font>
16477 </p>
16478 !! end
16479
16480 !! test
16481 Empty attribute crash test single-quotes (T4067)
16482 !! wikitext
16483 <font color=''>foo</font>
16484 !! html
16485 <p><font color="">foo</font>
16486 </p>
16487 !! end
16488
16489 !! test
16490 Attribute test: equals, then nothing
16491 !! options
16492 parsoid=wt2html,html2html
16493 !! wikitext
16494 <font color=>foo</font>
16495 !! html/php
16496 <p><font color="">foo</font>
16497 </p>
16498 !! html/parsoid
16499 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16500 !! end
16501
16502 !! test
16503 Attribute test: unquoted value
16504 !! options
16505 parsoid=wt2html,html2html
16506 !! wikitext
16507 <font color=x>foo</font>
16508 !! html/php
16509 <p><font color="x">foo</font>
16510 </p>
16511 !! html/parsoid
16512 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16513 !! end
16514
16515 !! test
16516 Attribute test: unquoted but illegal value (hash)
16517 !! wikitext
16518 <font color=#x>foo</font>
16519 !! html
16520 <p><font color="#x">foo</font>
16521 </p>
16522 !! end
16523
16524 # Parsoid does not serialize to empty attribute syntax,
16525 # so wt2wt and html2wt cases are skipped
16526 !! test
16527 Attribute test: no value (T54330)
16528 !! options
16529 parsoid=wt2html,html2html
16530 !! wikitext
16531 <font color>foo</font>
16532 !! html/php
16533 <p><font color="">foo</font>
16534 </p>
16535 !! html/parsoid
16536 <p><font color="">foo</font></p>
16537 !! end
16538
16539 !! test
16540 T4095: link with three closing brackets
16541 !! wikitext
16542 [[Main Page]]]
16543 !! html/php
16544 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16545 </p>
16546 !! html/parsoid
16547 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16548 !! end
16549
16550 !! test
16551 T4095: link with pipe and three closing brackets
16552 !! wikitext
16553 [[Main Page|link]]]
16554 !! html/php
16555 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16556 </p>
16557 !! html/parsoid
16558 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16559 !! end
16560
16561 !! test
16562 T4095: link with pipe and three closing brackets, version 2
16563 !! wikitext
16564 [[Main Page|[http://example.com/]]]
16565 !! html/php
16566 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16567 </p>
16568 !! html/parsoid
16569 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16570 !! end
16571
16572
16573 ###
16574 ### Safety
16575 ###
16576
16577 !! article
16578 Template:Dangerous attribute
16579 !! text
16580 " onmouseover="alert(document.cookie)
16581 !! endarticle
16582
16583 !! article
16584 Template:Dangerous style attribute
16585 !! text
16586 border-size: expression(alert(document.cookie))
16587 !! endarticle
16588
16589 !! article
16590 Template:Div style
16591 !! text
16592 <div style="float: right; {{{1}}}">Magic div</div>
16593 !! endarticle
16594
16595 !! test
16596 T4304: HTML attribute safety (safe template; regression T4309)
16597 !! wikitext
16598 <div title="{{test}}"></div>
16599 !! html/php
16600 <div title="This is a test template"></div>
16601
16602 !! html/parsoid
16603 <div title="This is a test template" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"This is a test template"},"sa":{"title":"{{test}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,20,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"test\",\"href\":\"./Template:Test\"},\"params\":{},\"i\":0}}]}&#39;>This is a test template&lt;/span>"}]]}'></div>
16604 !! end
16605
16606 # Parsoid has enough context to handle this case
16607 !! test
16608 T4304: HTML attribute safety (dangerous template; 2309)
16609 !! wikitext
16610 <div title="{{dangerous attribute}}"></div>
16611 !! html/php
16612 <div title=""></div>
16613
16614 !! html/parsoid
16615 <div title='" onmouseover="alert(document.cookie)' about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"\" onmouseover=\"alert(document.cookie)"},"sa":{"title":"{{dangerous attribute}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,35,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous attribute\",\"href\":\"./Template:Dangerous_attribute\"},\"params\":{},\"i\":0}}]}&#39;>\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
16616 !! end
16617
16618 !! test
16619 T4304: HTML attribute safety (dangerous style template; 2309)
16620 !! wikitext
16621 <div style="{{dangerous style attribute}}"></div>
16622 !! html/php
16623 <div style="/* insecure input */"></div>
16624
16625 !! html/parsoid
16626 <div style="/* insecure input */" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"{{dangerous style attribute}}"}}' data-mw='{"attribs":[[{"txt":"style"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,41,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous style attribute\",\"href\":\"./Template:Dangerous_style_attribute\"},\"params\":{},\"i\":0}}]}&#39;>border-size: expression(alert(document.cookie))&lt;/span>"}]]}'></div>
16627 !! end
16628
16629 !! test
16630 T4304: HTML attribute safety (safe parameter; 2309)
16631 !! wikitext
16632 {{div style|width: 200px}}
16633 !! html/php
16634 <div style="float: right; width: 200px">Magic div</div>
16635
16636 !! html/parsoid
16637 <div style="float: right; width: 200px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","a":{"style":"float: right; width: 200px"},"sa":{"style":"float: right; {{{1}}}"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"div style","href":"./Template:Div_style"},"params":{"1":{"wt":"width: 200px"}},"i":0}}]}'>Magic div</div>
16638 !! end
16639
16640 !! test
16641 T4304: HTML attribute safety (unsafe parameter; 2309)
16642 !! wikitext
16643 {{div style|width: expression(alert(document.cookie))}}
16644 !! html/php
16645 <div style="/* insecure input */">Magic div</div>
16646
16647 !! html/parsoid
16648 <div style="/* insecure input */" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"float: right; {{{1}}}"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"div style","href":"./Template:Div_style"},"params":{"1":{"wt":"width: expression(alert(document.cookie))"}},"i":0}}]}'>Magic div</div>
16649 !! end
16650
16651 ## Parsoid output here differs; needs investigation.
16652 !! test
16653 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
16654 !! wikitext
16655 {{div style|"><script>alert(document.cookie)</script>}}
16656 !! html
16657 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16658
16659 !! end
16660
16661 ## Parsoid output here differs; needs investigation.
16662 !! test
16663 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16664 !! wikitext
16665 {{div style|" ><script>alert(document.cookie)</script>}}
16666 !! html
16667 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16668
16669 !! end
16670
16671 !! test
16672 T4304: HTML attribute safety (link)
16673 !! wikitext
16674 <div title="[[Main Page]]"></div>
16675 !! html
16676 <div title="&#91;&#91;Main Page]]"></div>
16677
16678 !! end
16679
16680 !! test
16681 T4304: HTML attribute safety (italics)
16682 !! wikitext
16683 <div title="''foobar''"></div>
16684 !! html
16685 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16686
16687 !! end
16688
16689 !! test
16690 T4304: HTML attribute safety (bold)
16691 !! wikitext
16692 <div title="'''foobar'''"></div>
16693 !! html
16694 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16695
16696 !! end
16697
16698 !! test
16699 T4304: HTML attribute safety (ISBN)
16700 !! wikitext
16701 <div title="ISBN 1234567890"></div>
16702 !! html
16703 <div title="&#73;SBN 1234567890"></div>
16704
16705 !! end
16706
16707 !! test
16708 T4304: HTML attribute safety (RFC)
16709 !! wikitext
16710 <div title="RFC 1234"></div>
16711 !! html
16712 <div title="&#82;FC 1234"></div>
16713
16714 !! end
16715
16716 !! test
16717 T4304: HTML attribute safety (PMID)
16718 !! wikitext
16719 <div title="PMID 1234567890"></div>
16720 !! html
16721 <div title="&#80;MID 1234567890"></div>
16722
16723 !! end
16724
16725 !! test
16726 T4304: HTML attribute safety (web link)
16727 !! wikitext
16728 <div title="http://example.com/"></div>
16729 !! html
16730 <div title="http&#58;//example.com/"></div>
16731
16732 !! end
16733
16734 !! test
16735 T4304: HTML attribute safety (named web link)
16736 !! wikitext
16737 <div title="[http://example.com/ link]"></div>
16738 !! html
16739 <div title="&#91;http&#58;//example.com/ link]"></div>
16740
16741 !! end
16742
16743 !! test
16744 T5244: HTML attribute safety (extension; safe)
16745 !! wikitext
16746 <div style="<nowiki>background:blue</nowiki>"></div>
16747 !! html/php
16748 <div style="background:blue"></div>
16749
16750 !! html/parsoid
16751 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
16752 !! end
16753
16754 !! test
16755 T5244: HTML attribute safety (extension; unsafe)
16756 !! wikitext
16757 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16758 !! html/php
16759 <div style="/* insecure input */"></div>
16760
16761 !! html/parsoid
16762 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"&lt;nowiki>border-left:expression(alert(document.cookie))&lt;/nowiki>"}}'></div>
16763 !! end
16764
16765 # More MSIE fun discovered by Tom Gilder
16766
16767 !! test
16768 MSIE CSS safety test: spurious slash
16769 !! wikitext
16770 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16771 !! html/php
16772 <div style="/* insecure input */">evil</div>
16773
16774 !! html/parsoid
16775 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:u\\rl(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
16776 !! end
16777
16778 !! test
16779 MSIE CSS safety test: hex code
16780 !! wikitext
16781 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16782 !! html/php
16783 <div style="/* insecure input */">evil</div>
16784
16785 !! html/parsoid
16786 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:u\\72l(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
16787 !! end
16788
16789 !! test
16790 MSIE CSS safety test: comment in url
16791 !! wikitext
16792 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16793 !! html/php
16794 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16795
16796 !! html/parsoid
16797 <div style="background-image:u rl(javascript:alert('boo'))" data-parsoid='{"stx":"html","a":{"style":"background-image:u rl(javascript:alert(&#39;boo&#39;))"},"sa":{"style":"background-image:u/**/rl(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
16798 !! end
16799
16800 !! test
16801 MSIE CSS safety test: comment in expression
16802 !! wikitext
16803 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16804 !! html/php
16805 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16806
16807 !! html/parsoid
16808 <div style="background-image:expres sion(alert('boo4'))" data-parsoid='{"stx":"html","a":{"style":"background-image:expres sion(alert(&#39;boo4&#39;))"},"sa":{"style":"background-image:expres/**/sion(alert(&#39;boo4&#39;))"}}'>evil4</div>
16809 !! end
16810
16811 !! test
16812 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
16813 !! wikitext
16814 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16815 !! html/php
16816 <p style="/* invalid control char */">A</p>
16817
16818 !! html/parsoid
16819 <p style="/* invalid control char */" data-parsoid='{"stx":"html","a":{"style":"/* invalid control char */"},"sa":{"style":"font-size: 100px; background-image:url\\b(https://www.google.com/images/srpr/logo6w.png)"}}'>A</p>
16820 !! end
16821
16822 !! test
16823 MSIE 6 CSS safety test: Fullwidth (T57332)
16824 !! wikitext
16825 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16826 <div style="top:EXPRESSION(alert())">B</div>
16827 !! html/php
16828 <p style="/* insecure input */">A</p>
16829 <div style="/* insecure input */">B</div>
16830
16831 !! html/parsoid
16832 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expression((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>A</p>
16833 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
16834 !! end
16835
16836 !! test
16837 MSIE 6 CSS safety test: IPA extensions (T57332)
16838 !! wikitext
16839 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16840 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16841 !! html/php
16842 <div style="/* insecure input */">A</div>
16843 <p style="/* insecure input */">B</p>
16844
16845 !! html/parsoid
16846 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
16847 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expʀessɪoɴ((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>B</p>
16848 !! end
16849
16850 !! test
16851 MSIE 6 CSS safety test: sup/sub script (T57332)
16852 !! wikitext
16853 <div style="background-image:url⁽javascript:alert())">A</div>
16854 <div style="background-image:url₍javascript:alert())">B</div>
16855 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16856 !! html/php
16857 <div style="/* insecure input */">A</div>
16858 <div style="/* insecure input */">B</div>
16859 <p style="/* insecure input */">C</p>
16860
16861 !! html/parsoid
16862 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
16863 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
16864 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expressioⁿ((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>C</p>
16865 !! end
16866
16867 !! test
16868 Opera -o-link CSS
16869 !! options
16870 parsoid=wt2html,html2html
16871 !! wikitext
16872 <div
16873 title="&#100;&#97;&#116;&#97;&#58;&#116;&#101;&#120;&#116;&#47;&#104;&#116;&#109;&#108;&#44;&#60;&#105;&#109;&#103;&#32;&#115;&#114;&#99;&#61;&#49;&#32;&#111;&#110;&#101;&#114;&#114;&#111;&#114;&#61;&#97;&#108;&#101;&#114;&#116;&#40;&#49;&#41;&#62;"
16874 style="-o-link:attr(title);-o-link-source:current">X</div>
16875 !! html/php
16876 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16877
16878 !! html/parsoid
16879 <div title="data:text/html,&lt;img src=1 onerror=alert(1)>" style="/* insecure input */" data-parsoid='{"stx":"html","a":{"title":"data:text/html,&lt;img src=1 onerror=alert(1)>","style":"/* insecure input */"},"sa":{"title":"&amp;#100;&amp;#97;&amp;#116;&amp;#97;&amp;#58;&amp;#116;&amp;#101;&amp;#120;&amp;#116;&amp;#47;&amp;#104;&amp;#116;&amp;#109;&amp;#108;&amp;#44;&amp;#60;&amp;#105;&amp;#109;&amp;#103;&amp;#32;&amp;#115;&amp;#114;&amp;#99;&amp;#61;&amp;#49;&amp;#32;&amp;#111;&amp;#110;&amp;#101;&amp;#114;&amp;#114;&amp;#111;&amp;#114;&amp;#61;&amp;#97;&amp;#108;&amp;#101;&amp;#114;&amp;#116;&amp;#40;&amp;#49;&amp;#41;&amp;#62;","style":"-o-link:attr(title);-o-link-source:current"}}'>X</div>
16880 !! end
16881
16882 !! test
16883 MSIE 6 CSS safety test: Repetition markers (T57332)
16884 !! wikitext
16885 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16886 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16887 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16888 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16889 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16890 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16891 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16892 !! html/php
16893 <p style="/* insecure input */">A</p>
16894 <p style="/* insecure input */">B</p>
16895 <p style="/* insecure input */">C</p>
16896 <p style="/* insecure input */">D</p>
16897 <p style="/* insecure input */">E</p>
16898 <p style="/* insecure input */">F</p>
16899 <p style="/* insecure input */">G</p>
16900
16901 !! html/parsoid
16902 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expres〱ion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>A</p>
16903 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresゝion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>B</p>
16904 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>C</p>
16905 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresヽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>D</p>
16906 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>E</p>
16907 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹼion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>F</p>
16908 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>G</p>
16909 !! end
16910
16911 !! test
16912 Table attribute legitimate extension
16913 !! wikitext
16914 {|
16915 !+ style="<nowiki>color:blue</nowiki>"| status
16916 |}
16917 !! html
16918 <table>
16919 <tr>
16920 <th style="color:blue"> status
16921 </th></tr></table>
16922
16923 !!end
16924
16925 !! test
16926 Table attribute safety
16927 !! wikitext
16928 {|
16929 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16930 |}
16931 !! html
16932 <table>
16933 <tr>
16934 <th style="/* insecure input */"> status
16935 </th></tr></table>
16936
16937 !! end
16938
16939 !! test
16940 CSS line continuation 1
16941 !! wikitext
16942 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16943 !! html
16944 <div style="/* insecure input */"></div>
16945
16946 !! end
16947
16948 !! test
16949 CSS line continuation 2
16950 !! wikitext
16951 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16952 !! html
16953 <div style="/* invalid control char */"></div>
16954
16955 !! end
16956
16957 !! article
16958 Template:Identity
16959 !! text
16960 {{{1}}}
16961 !! endarticle
16962
16963 !! test
16964 Expansion of multi-line templates in attribute values (T8255)
16965 !! wikitext
16966 <div style="background: {{identity|#00FF00}}">-</div>
16967 !! html
16968 <div style="background: #00FF00">-</div>
16969
16970 !! end
16971
16972 !! test
16973 Expansion of multi-line templates in attribute values (T8255 sanity check)
16974 !! wikitext
16975 <div style="background:
16976 #00FF00">-</div>
16977 !! html/php
16978 <div style="background: #00FF00">-</div>
16979
16980 !! html/parsoid
16981 <div style="background:
16982 #00FF00">-</div>
16983 !! end
16984
16985 !! test
16986 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
16987 !! wikitext
16988 <div style="background: &#10;#00FF00">-</div>
16989 !! html
16990 <div style="background: &#10;#00FF00">-</div>
16991
16992 !! end
16993
16994 !! test
16995 Tags which are hidden from Tidy cannot pass through the Sanitizer
16996 !! wikitext
16997 <mw:toc><script>alert();</script></mw:toc>
16998 !! html+tidy
16999 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
17000 !! end
17001
17002 ###
17003 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
17004 ###
17005
17006 !! test
17007 Parser hook: empty input
17008 !! wikitext
17009 <tag></tag>
17010 !! html/php
17011 <pre>
17012 ''
17013 array (
17014 )
17015 </pre>
17016
17017 !! html/parsoid
17018 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17019 !! end
17020
17021 ## Don't expect parsoid to rt this form.
17022 !! test
17023 Parser hook: empty input using terminated empty elements
17024 !! options
17025 parsoid=wt2html,html2html
17026 !! wikitext
17027 <tag/>
17028 !! html/php
17029 <pre>
17030 NULL
17031 array (
17032 )
17033 </pre>
17034
17035 !! html/parsoid
17036 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17037 !! end
17038
17039 !! test
17040 Parser hook: empty input using terminated empty elements (space before)
17041 !! wikitext
17042 <tag />
17043 !! html/php
17044 <pre>
17045 NULL
17046 array (
17047 )
17048 </pre>
17049
17050 !! html/parsoid
17051 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17052 !! end
17053
17054 !! test
17055 Parser hook: basic input
17056 !! wikitext
17057 <tag>input</tag>
17058 !! html/php
17059 <pre>
17060 'input'
17061 array (
17062 )
17063 </pre>
17064
17065 !! html/parsoid
17066 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17067 !! end
17068
17069 ## Don't expect parsoid to rt this form.
17070 !! test
17071 Parser hook: case insensitive
17072 !! options
17073 parsoid=wt2html,html2html
17074 !! wikitext
17075 <TAG>input</TAG>
17076 !! html/php
17077 <pre>
17078 'input'
17079 array (
17080 )
17081 </pre>
17082
17083 !! html/parsoid
17084 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17085 !! end
17086
17087 ## Don't expect parsoid to rt this form.
17088 !! test
17089 Parser hook: case insensitive, redux
17090 !! options
17091 parsoid=wt2html,html2html
17092 !! wikitext
17093 <TaG>input</TAg>
17094 !! html/php
17095 <pre>
17096 'input'
17097 array (
17098 )
17099 </pre>
17100
17101 !! html/parsoid
17102 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17103 !! end
17104
17105 !! test
17106 Parser hook: nested tags
17107 !! wikitext
17108 <tag><tag></tag></tag>
17109 !! html/php
17110 <pre>
17111 '<tag>'
17112 array (
17113 )
17114 </pre>&lt;/tag&gt;
17115
17116 !! html/parsoid
17117 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
17118 !! end
17119
17120 !! test
17121 Parser hook: basic arguments
17122 !! wikitext
17123 <tag width="200" height="100" depth="50" square=""></tag>
17124 !! html/php
17125 <pre>
17126 ''
17127 array (
17128 'width' => '200',
17129 'height' => '100',
17130 'depth' => '50',
17131 'square' => '',
17132 )
17133 </pre>
17134
17135 !! html/parsoid
17136 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17137 !! end
17138
17139 ## Don't expect parsoid to rt this form.
17140 !! test
17141 Parser hook: basic arguments, variations
17142 !! options
17143 parsoid=wt2html,html2html
17144 !! wikitext
17145 <tag width=200 height = "100" depth = '50' square></tag>
17146 !! html/php
17147 <pre>
17148 ''
17149 array (
17150 'width' => '200',
17151 'height' => '100',
17152 'depth' => '50',
17153 'square' => '',
17154 )
17155 </pre>
17156
17157 !! html/parsoid
17158 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17159 !! end
17160
17161 !! test
17162 Parser hook: argument containing a forward slash (T7344)
17163 !! wikitext
17164 <tag filename="/tmp/bla"></tag>
17165 !! html/php
17166 <pre>
17167 ''
17168 array (
17169 'filename' => '/tmp/bla',
17170 )
17171 </pre>
17172
17173 !! html/parsoid
17174 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17175 !! end
17176
17177 ## Don't expect parsoid to rt this form.
17178 !! test
17179 Parser hook: empty input using terminated empty elements (T4374)
17180 !! options
17181 parsoid=wt2html,html2html
17182 !! wikitext
17183 <tag foo=bar/>text
17184 !! html/php
17185 <pre>
17186 NULL
17187 array (
17188 'foo' => 'bar',
17189 )
17190 </pre>text
17191
17192 !! html/parsoid
17193 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
17194 !! end
17195
17196 ## </tag> should be output literally since there is no matching tag that begins it
17197 ## Don't expect parsoid to rt this form.
17198 !! test
17199 Parser hook: basic arguments using terminated empty elements (T4374)
17200 !! options
17201 parsoid=wt2html
17202 !! wikitext
17203 <tag width=200 height = "100" depth = '50' square/>
17204 other stuff
17205 </tag>
17206 !! html/php
17207 <pre>
17208 NULL
17209 array (
17210 'width' => '200',
17211 'height' => '100',
17212 'depth' => '50',
17213 'square' => '',
17214 )
17215 </pre>
17216 <p>other stuff
17217 &lt;/tag&gt;
17218 </p>
17219 !! html/parsoid
17220 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":null}' about="#mwt2"></pre><p>other stuff
17221 &lt;/tag></p>
17222 !! end
17223
17224 ## Don't expect parsoid to rt this form.
17225 !! test
17226 Parser hook: Don't allow unclosed extension tags
17227 !! options
17228 parsoid=wt2html
17229 !! wikitext
17230 test <tag>123
17231
17232 this is a '''test'''
17233 !! html/php
17234 <p>test &lt;tag&gt;123
17235 </p><p>this is a <b>test</b>
17236 </p>
17237 !! html/parsoid
17238 <p>test &lt;tag>123</p>
17239
17240 <p>this is a <b>test</b></p>
17241 !! end
17242
17243 ###
17244 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17245 ###
17246
17247 !! test
17248 Parser hook: static parser hook not inside a comment
17249 !! wikitext
17250 <statictag>hello, world</statictag>
17251
17252 <statictag action="flush" />
17253 !! html/php
17254 <p><br />
17255 hello, world
17256 </p>
17257 !! html/parsoid
17258 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17259 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17260 !! end
17261
17262 !! test
17263 Parser hook: static parser hook inside a comment
17264 !! wikitext
17265 <!-- <statictag>hello, world</statictag> -->
17266 <statictag action="flush" />
17267 !! html/php
17268 <p><br />
17269 </p>
17270 !! html/parsoid
17271 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17272 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17273 !! end
17274
17275 # Nested template calls; this case was broken by Parser.php rev 1.506,
17276 # since reverted.
17277
17278 !! article
17279 Template:One-parameter
17280 !! text
17281 (My parameter is: {{{1}}})
17282 !! endarticle
17283
17284 !! article
17285 Template:Map-one-parameter
17286 !! text
17287 {{{{{1}}}|{{{2}}}}}
17288 !! endarticle
17289
17290 !! test
17291 Nested template calls
17292 !! wikitext
17293 {{Map-one-parameter|One-parameter|param}}
17294 !! html
17295 <p>(My parameter is: param)
17296 </p>
17297 !! end
17298
17299
17300 ###
17301 ### Sanitizer
17302 ###
17303
17304 # HTML+Tidy effectively strips out the empty tags completely
17305 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17306 # which Tidy would have done for the PHP parser had there been content inside it.
17307 !! test
17308 Sanitizer: Closing of open tags
17309 !! wikitext
17310 <s></s><table></table>
17311 !! html
17312 <s></s><table></table>
17313
17314 !! html/parsoid
17315 <p><s></s></p><table></table>
17316 !! end
17317
17318 !! test
17319 Sanitizer: Closing of open but not closed tags
17320 !! wikitext
17321 <s>foo
17322 !! html
17323 <p><s>foo</s>
17324 </p>
17325 !! end
17326
17327 !! test
17328 Sanitizer: Closing of closed but not open tags
17329 !! options
17330 parsoid=wt2html
17331 !! wikitext
17332 </s>
17333 !! html/php+tidy
17334 !! html/parsoid
17335 !! end
17336
17337 !! test
17338 Sanitizer: Closing of closed but not open table tags
17339 !! options
17340 parsoid=wt2html
17341 !! wikitext
17342 Table not started</td></tr></table>
17343 !! html/php+tidy
17344 <p>Table not started</p>
17345 !! html/parsoid
17346 <p>Table not started</p>
17347 !! end
17348
17349 !! test
17350 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17351 !! wikitext
17352 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17353 !! html/php
17354 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17355 </p>
17356 !! html/parsoid
17357 <p><span id=".C3.A6:_v" data-parsoid='{"stx":"html","a":{"id":".C3.A6:_v"},"sa":{"id":"æ: v"}}'>byte</span><a rel="mw:WikiLink" href="./Main_Page#.C3.A6:_v" data-parsoid='{"stx":"piped","a":{"href":"./Main_Page#.C3.A6:_v"},"sa":{"href":"#æ: v"}}'>backlink</a></p>
17358 !! end
17359
17360 # In HTML5, the restrictions are that id must contain at least one character,
17361 # and must not contain any space characters.
17362 !! test
17363 Sanitizer: Validating the contents of the id attribute (T6515)
17364 !! options
17365 disabled
17366 !! wikitext
17367 <br id="" /><br id="a space" />
17368 !! html
17369 Something ...
17370 !! end
17371
17372 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17373 !! test
17374 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
17375 !! options
17376 disabled
17377 !! wikitext
17378 <br id="foo" /><br id="foo" />
17379 !! html
17380 Something need to be done. foo-2 ?
17381 !! end
17382
17383 !! test
17384 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17385 !! wikitext
17386 <div itemscope>
17387 <meta itemprop="hello" content="world">
17388 <meta http-equiv="refresh" content="5">
17389 <meta itemprop="hello" http-equiv="refresh" content="5">
17390 <link itemprop="hello" href="{{SERVER}}">
17391 <link rel="stylesheet" href="{{SERVER}}">
17392 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17393 </div>
17394 !! html
17395 <div itemscope="">
17396 <p> <meta itemprop="hello" content="world" />
17397 &lt;meta http-equiv="refresh" content="5"&gt;
17398 <meta itemprop="hello" content="5" />
17399 </p>
17400 <link itemprop="hello" href="http&#58;//example.org" />
17401 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17402 <link itemprop="hello" href="http&#58;//example.org" />
17403 </div>
17404
17405 !! end
17406
17407 !! test
17408 Language converter: output gets cut off unexpectedly (T7757)
17409 !! options
17410 language=zh
17411 !! wikitext
17412 this bit is safe: }-
17413
17414 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17415
17416 then we get cut off here: }-
17417
17418 all additional text is vanished
17419 !! html
17420 <p>this bit is safe: }-
17421 </p><p>but if we add a conversion instance: xxx
17422 </p><p>then we get cut off here: }-
17423 </p><p>all additional text is vanished
17424 </p>
17425 !! end
17426
17427 !! test
17428 Self closed html pairs (T7487)
17429 !! options
17430 !! wikitext
17431 <center><font id="bug" />Centered text</center>
17432 <div><font id="bug2" />In div text</div>
17433 !! html
17434 <center>&lt;font id="bug" /&gt;Centered text</center>
17435 <div>&lt;font id="bug2" /&gt;In div text</div>
17436
17437 !! end
17438
17439 #
17440 #
17441 #
17442
17443 !! test
17444 Punctuation: nbsp before exclamation
17445 !! wikitext
17446 C'est grave !
17447 !! html
17448 <p>C'est grave&#160;!
17449 </p>
17450 !! end
17451
17452 !! test
17453 Punctuation: CSS !important (T13874)
17454 !! wikitext
17455 <div style="width:50% !important">important</div>
17456 !! html
17457 <div style="width:50% !important">important</div>
17458
17459 !!end
17460
17461 !! test
17462 Punctuation: CSS ! important (T13874; with space after)
17463 !! wikitext
17464 <div style="width:50% ! important">important</div>
17465 !! html
17466 <div style="width:50% ! important">important</div>
17467
17468 !!end
17469
17470 !! test
17471 HTML bullet list, closed tags (T7497)
17472 !! wikitext
17473 <ul>
17474 <li>One</li>
17475 <li>Two</li>
17476 </ul>
17477 !! html/php
17478 <ul>
17479 <li>One</li>
17480 <li>Two</li>
17481 </ul>
17482
17483 !! html/parsoid
17484 <ul data-parsoid='{"stx":"html"}'>
17485 <li data-parsoid='{"stx":"html"}'>One</li>
17486 <li data-parsoid='{"stx":"html"}'>Two</li>
17487 </ul>
17488
17489 !! end
17490
17491 !! test
17492 HTML bullet list, unclosed tags (T7497)
17493 !! wikitext
17494 <ul>
17495 <li>One
17496 <li>Two
17497 </ul>
17498 !! html/php+tidy
17499 <ul>
17500 <li>One</li>
17501 <li>Two</li>
17502 </ul>
17503 !! html/parsoid
17504 <ul data-parsoid='{"stx":"html"}'>
17505 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17506 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17507 </ul>
17508
17509 !! end
17510
17511 !! test
17512 HTML ordered list, closed tags (T7497)
17513 !! wikitext
17514 <ol>
17515 <li>One</li>
17516 <li>Two</li>
17517 </ol>
17518 !! html/php
17519 <ol>
17520 <li>One</li>
17521 <li>Two</li>
17522 </ol>
17523
17524 !! html/parsoid
17525 <ol data-parsoid='{"stx":"html"}'>
17526 <li data-parsoid='{"stx":"html"}'>One</li>
17527 <li data-parsoid='{"stx":"html"}'>Two</li>
17528 </ol>
17529
17530 !! end
17531
17532 !! test
17533 HTML ordered list, unclosed tags (T7497)
17534 !! options
17535 !! wikitext
17536 <ol>
17537 <li>One
17538 <li>Two
17539 </ol>
17540 !! html/php+tidy
17541 <ol>
17542 <li>One</li>
17543 <li>Two</li>
17544 </ol>
17545 !! html/parsoid
17546 <ol data-parsoid='{"stx":"html"}'>
17547 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17548 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17549 </ol>
17550
17551 !! end
17552
17553 !! test
17554 HTML nested bullet list, closed tags (T7497)
17555 !! wikitext
17556 <ul>
17557 <li>One</li>
17558 <li>Two:
17559 <ul>
17560 <li>Sub-one</li>
17561 <li>Sub-two</li>
17562 </ul>
17563 </li>
17564 </ul>
17565 !! html/php
17566 <ul>
17567 <li>One</li>
17568 <li>Two:
17569 <ul>
17570 <li>Sub-one</li>
17571 <li>Sub-two</li>
17572 </ul>
17573 </li>
17574 </ul>
17575
17576 !! html/parsoid
17577 <ul data-parsoid='{"stx":"html"}'>
17578 <li data-parsoid='{"stx":"html"}'>One</li>
17579 <li data-parsoid='{"stx":"html"}'>Two:
17580 <ul data-parsoid='{"stx":"html"}'>
17581 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17582 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17583 </ul>
17584 </li>
17585 </ul>
17586 !! end
17587
17588 !! test
17589 HTML nested bullet list, open tags (T7497)
17590 !! wikitext
17591 <ul>
17592 <li>One
17593 <li>Two:
17594 <ul>
17595 <li>Sub-one
17596 <li>Sub-two
17597 </ul>
17598 </ul>
17599 !! html/php+tidy
17600 <ul>
17601 <li>One</li>
17602 <li>Two:
17603 <ul>
17604 <li>Sub-one</li>
17605 <li>Sub-two</li>
17606 </ul>
17607 </li>
17608 </ul>
17609 !! html/parsoid
17610 <ul>
17611 <li>One
17612 </li>
17613 <li>Two:
17614 <ul>
17615 <li>Sub-one
17616 </li>
17617 <li>Sub-two
17618 </li>
17619 </ul>
17620 </li>
17621 </ul>
17622
17623 !! end
17624
17625 !! test
17626 HTML nested ordered list, closed tags (T7497)
17627 !! wikitext
17628 <ol>
17629 <li>One</li>
17630 <li>Two:
17631 <ol>
17632 <li>Sub-one</li>
17633 <li>Sub-two</li>
17634 </ol>
17635 </li>
17636 </ol>
17637 !! html
17638 <ol>
17639 <li>One</li>
17640 <li>Two:
17641 <ol>
17642 <li>Sub-one</li>
17643 <li>Sub-two</li>
17644 </ol>
17645 </li>
17646 </ol>
17647
17648 !! end
17649
17650 !! test
17651 HTML nested ordered list, open tags (T7497)
17652 !! wikitext
17653 <ol>
17654 <li>One
17655 <li>Two:
17656 <ol>
17657 <li>Sub-one
17658 <li>Sub-two
17659 </ol>
17660 </ol>
17661 !! html/php
17662 <ol>
17663 <li>One
17664 <li>Two:
17665 <ol>
17666 <li>Sub-one
17667 <li>Sub-two
17668 </ol>
17669 </ol>
17670
17671 !! html/parsoid
17672 <ol>
17673 <li>One
17674 </li>
17675 <li>Two:
17676 <ol>
17677 <li>Sub-one
17678 </li>
17679 <li>Sub-two
17680 </li>
17681 </ol>
17682 </li>
17683 </ol>
17684
17685 !! end
17686
17687 !! test
17688 HTML ordered list item with parameters oddity
17689 !! wikitext
17690 <ol><li id="fragment">One</li>
17691 </ol>
17692 !! html
17693 <ol><li id="fragment">One</li>
17694 </ol>
17695
17696 !! end
17697
17698 # parsoid doesn't explicitly mark autonumbered links, see T55505
17699 !!test
17700 T7918: autonumbering
17701 !! wikitext
17702 [http://first/] [http://second] [ftp://ftp]
17703
17704 ftp://inlineftp
17705
17706 [mailto:enclosed@mail.tld With target]
17707
17708 [mailto:enclosed@mail.tld]
17709
17710 mailto:inline@mail.tld
17711 !! html/php
17712 <p><a rel="nofollow" class="external autonumber" href="http://first/">[1]</a> <a rel="nofollow" class="external autonumber" href="http://second">[2]</a> <a rel="nofollow" class="external autonumber" href="ftp://ftp">[3]</a>
17713 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17714 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17715 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17716 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17717 </p>
17718 !! html/parsoid
17719 <p><a rel="mw:ExtLink" href="http://first/"></a> <a rel="mw:ExtLink" href="http://second"></a> <a rel="mw:ExtLink" href="ftp://ftp"></a></p>
17720 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17721 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17722 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17723 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17724 !! end
17725
17726
17727 #
17728 # Security and HTML correctness
17729 # From Nick Jenkins' fuzz testing
17730 #
17731
17732 !! test
17733 Fuzz testing: Parser13
17734 !! wikitext
17735 {|
17736 | http://a|
17737 !! html
17738 <table>
17739 <tr>
17740 <td>
17741 </td>
17742 </tr>
17743 </table>
17744
17745 !! end
17746
17747 !! test
17748 Fuzz testing: Parser14
17749 !! wikitext
17750 == onmouseover= ==
17751 http://__TOC__
17752 !! html
17753 <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17754 http://<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
17755 <ul>
17756 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17757 </ul>
17758 </div>
17759
17760
17761 !! html+tidy
17762 <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17763 <p>http://</p>
17764 <div id="toc" class="toc">
17765 <div id="toctitle" class="toctitle">
17766 <h2>Contents</h2>
17767 </div>
17768 <ul>
17769 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17770 </ul>
17771 </div>
17772 <p></p>
17773 !! end
17774
17775 !! test
17776 Fuzz testing: Parser14-table
17777 !! options
17778 parsoid=wt2html,html2html
17779 !! wikitext
17780 ==a==
17781 {| STYLE=__TOC__
17782 !! html
17783 <h2><span class="mw-headline" id="a">a</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17784 <table style="&#95;_TOC&#95;_">
17785 <tr><td></td></tr>
17786 </table>
17787
17788 !! html+tidy
17789 <h2><span class="mw-headline" id="a">a</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17790 <table style="__TOC__">
17791 <tr>
17792 <td></td>
17793 </tr>
17794 </table>
17795 !! html/parsoid
17796 <h2>a</h2>
17797 <table style="__TOC__"></table>
17798 !! end
17799
17800 # Known to produce bogus xml (extra </td>)
17801 !! test
17802 Fuzz testing: Parser16
17803 !! wikitext
17804 {|
17805 !https://||||||
17806 !! html
17807 <table>
17808 <tr>
17809 <th>https://</th>
17810 <th></th>
17811 <th></th>
17812 <th>
17813 </td>
17814 </tr>
17815 </table>
17816
17817 !! html+tidy
17818 <table>
17819 <tr>
17820 <th>https://</th>
17821 <th></th>
17822 <th></th>
17823 <th></th>
17824 </tr>
17825 </table>
17826 !! end
17827
17828 !! test
17829 Fuzz testing: Parser21
17830 !! wikitext
17831 {|
17832 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17833 |
17834 !! html
17835 <table>
17836 <tr>
17837 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17838 </th>
17839 <td>
17840 </td>
17841 </tr>
17842 </table>
17843
17844 !! end
17845
17846 !! test
17847 Fuzz testing: Parser22
17848 !! wikitext
17849 http://===r:::https://b
17850
17851 {|
17852 !! html
17853 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17854 </p>
17855 <table>
17856 <tr><td></td></tr>
17857 </table>
17858
17859 !! end
17860
17861 # Known to produce bad XML for now
17862 !! test
17863 Fuzz testing: Parser24
17864 !! options
17865 parsoid=wt2html
17866 !! wikitext
17867 {|
17868 {{{|
17869 <u CLASS=
17870 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17871 <br style="onmouseover='alert(document.cookie);' " />
17872
17873 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17874 |
17875 !! html/php
17876 <table>
17877 {{{|
17878 <u class="&#124;">}}}} &gt;
17879 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17880
17881 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17882 <tr>
17883 <td></u>
17884 </td>
17885 </tr>
17886 </table>
17887
17888 !! html/parsoid
17889 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
17890 <u class="|" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":""},"autoInsertedEnd":true}' data-mw='{"attribs":[[{"txt":"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}","html":"{&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[21,79,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&amp;lt;noinclude>\"},\"params\":{},\"i\":0}}]}&#39;>{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}&lt;/span>}"},{"html":""}]]}'>
17891 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/></u></p><p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><u class="|" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":""},"autoInsertedEnd":true,"autoInsertedStart":true}' data-mw='{"attribs":[[{"txt":"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}","html":"{&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[21,79,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&amp;lt;noinclude>\"},\"params\":{},\"i\":0}}]}&#39;>{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}&lt;/span>}"},{"html":""}]]}'>MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p><table data-parsoid='{"autoInsertedEnd":true}'>
17892
17893
17894
17895 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
17896 !! end
17897
17898 # Note: the current result listed for this is not what the original one was,
17899 # but the original bug was JavaScript injection, which is fixed in any case.
17900 # It's not clear that the original result listed was any more correct than the
17901 # current one. Original result:
17902 # <p>{{{|
17903 # </p>
17904 # <li class="&#124;&#124;">
17905 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17906 !!test
17907 Fuzz testing: Parser25 (T8055)
17908 !! wikitext
17909 {{{
17910 |
17911 <LI CLASS=||
17912 >
17913 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17914 !! html/php
17915 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17916 </p>
17917 !! html/parsoid
17918 <span about="#mwt1" typeof="mw:Param" data-parsoid='{"pi":[[{"k":"1"},{"k":"2"},{"k":"3"}]]}' data-mw='{"parts":[{"templatearg":{"target":{"wt":"\n"},"params":{"1":{"wt":" \n&lt;LI CLASS="},"2":{"wt":""},"3":{"wt":"\n >\n"}},"i":0}},"blah\" onmouseover=\"alert(&#39;hello world&#39;);\" align=\"left\"&#39;&#39;&#39;MOVE MOUSE CURSOR OVER HERE"]}'>
17919 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
17920 !! end
17921
17922 !!test
17923 Fuzz testing: URL adjacent extension (with space, clean)
17924 !! wikitext
17925 http://example.com <nowiki>junk</nowiki>
17926 !! html/php
17927 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17928 </p>
17929 !! html/parsoid
17930 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17931 !! end
17932
17933 !!test
17934 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17935 !! wikitext
17936 http://example.com<nowiki>junk</nowiki>
17937 !! html/php
17938 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17939 </p>
17940 !! html/parsoid
17941 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17942 !! end
17943
17944 !! test
17945 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17946 !! wikitext
17947 http://example.com<pre>junk</pre>
17948 !! html/php
17949 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17950
17951 !! html/php+tidy
17952 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17953 <pre>
17954 junk
17955 </pre>
17956 !! html/parsoid
17957 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a></p><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"junk"}}'>junk</pre>
17958 !! end
17959
17960 !! test
17961 Fuzz testing: image with bogus manual thumbnail
17962 !! wikitext
17963 [[Image:foobar.jpg|thumbnail= ]]
17964 !! html/php
17965 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17966
17967 !! html/parsoid
17968 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}' data-mw='{"errors":[{"key":"missing-thumbnail","message":"This thumbnail does not exist.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
17969 !! end
17970
17971 !! test
17972 Fuzz testing: encoded newline in generated HTML replacements (T8577)
17973 !! wikitext
17974 <pre dir="&#10;"></pre>
17975 !! html/php
17976 <pre dir="&#10;"></pre>
17977
17978 !! html/parsoid
17979 <pre typeof="mw:Extension/pre" about="#mwt2" dir="&amp;#10;" data-mw='{"name":"pre","attrs":{"dir":"&amp;#10;"},"body":{"extsrc":""}}'></pre>
17980 !! end
17981
17982 !! test
17983 Parsing optional HTML elements (T8171)
17984 !! options
17985 !! wikitext
17986 <table>
17987 <tr>
17988 <td> Some tabular data</td>
17989 <td> More tabular data ...
17990 <td> And yet som tabular data</td>
17991 </tr>
17992 </table>
17993 !! html
17994 <table>
17995 <tr>
17996 <td> Some tabular data</td>
17997 <td> More tabular data ...
17998 </td><td> And yet som tabular data</td>
17999 </tr>
18000 </table>
18001
18002 !! end
18003
18004 !! test
18005 Correct handling of <td>, <tr> (T8171)
18006 !! options
18007 !! wikitext
18008 <table>
18009 <tr>
18010 <td> Some tabular data</td>
18011 <td> More tabular data ...</td>
18012 <td> And yet som tabular data</td>
18013 </tr>
18014 </table>
18015 !! html
18016 <table>
18017 <tr>
18018 <td> Some tabular data</td>
18019 <td> More tabular data ...</td>
18020 <td> And yet som tabular data</td>
18021 </tr>
18022 </table>
18023
18024 !! end
18025
18026
18027 !! test
18028 Parsing crashing regression (fr:JavaScript)
18029 !! wikitext
18030 </body></x>
18031 !! html
18032 <p>&lt;/body&gt;&lt;/x&gt;
18033 </p>
18034 !! end
18035
18036 !! test
18037 Inline wiki vs wiki block nesting
18038 !! wikitext
18039 '''Bold paragraph
18040
18041 New wiki paragraph
18042 !! html
18043 <p><b>Bold paragraph</b>
18044 </p><p>New wiki paragraph
18045 </p>
18046 !! end
18047
18048 # FIXME: The current php output is documented
18049 # and desired output is the parsoid target.
18050 !! test
18051 Inline HTML vs wiki block nesting
18052 !! wikitext
18053 <b>Bold paragraph
18054
18055 New wiki paragraph
18056 !! html/php
18057 <p><b>Bold paragraph
18058 </p><p>New wiki paragraph</b>
18059 </p>
18060 !! html/parsoid
18061 <p><b>Bold paragraph</b>
18062 </p><p>New wiki paragraph
18063 </p>
18064 !! end
18065
18066 # Original result was this:
18067 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
18068 # </p>
18069 # While that might be marginally more intuitive, maybe, the six-apostrophe
18070 # construct is clearly pathological and the result stated here (which is what
18071 # the parser actually does) is about as reasonable as anything.
18072 !!test
18073 Mixing markup for italics and bold
18074 !! options
18075 !! wikitext
18076 '''bold''''''bold''bolditalics'''''
18077 !! html
18078 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
18079 </p>
18080 !! end
18081
18082
18083 !! article
18084 Xyzzyx
18085 !! text
18086 Article for special page transclusion test
18087 !! endarticle
18088
18089 !! test
18090 Special page transclusion
18091 !! options
18092 !! wikitext
18093 {{Special:Prefixindex/Xyzzyx}}
18094 !! html
18095 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18096 </ul>
18097
18098 !! end
18099
18100 !! test
18101 Special page transclusion twice (T7021)
18102 !! options
18103 !! wikitext
18104 {{Special:Prefixindex/Xyzzyx}}
18105 {{Special:Prefixindex/Xyzzyx}}
18106 !! html
18107 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18108 </ul>
18109 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18110 </ul>
18111
18112 !! end
18113
18114 !! test
18115 Transclusion of default MediaWiki message
18116 !! wikitext
18117 {{MediaWiki:Mainpage}}
18118 !! html
18119 <p>Main Page
18120 </p>
18121 !! end
18122
18123 !! test
18124 Transclusion of nonexistent MediaWiki message
18125 !! wikitext
18126 {{MediaWiki:Mainpagexxx}}
18127 !! html
18128 <p><a href="/index.php?title=MediaWiki:Mainpagexxx&amp;action=edit&amp;redlink=1" class="new" title="MediaWiki:Mainpagexxx (page does not exist)">MediaWiki:Mainpagexxx</a>
18129 </p>
18130 !! end
18131
18132 !! test
18133 Transclusion of MediaWiki message with underscore
18134 !! wikitext
18135 {{MediaWiki:history_short}}
18136 !! html
18137 <p>History
18138 </p>
18139 !! end
18140
18141 !! test
18142 Transclusion of MediaWiki message with space
18143 !! wikitext
18144 {{MediaWiki:history short}}
18145 !! html
18146 <p>History
18147 </p>
18148 !! end
18149
18150 !! test
18151 Invalid header with following text
18152 !! wikitext
18153 = x = y
18154 !! html
18155 <p>= x = y
18156 </p>
18157 !! end
18158
18159
18160 !! test
18161 Section extraction test (section 0)
18162 !! options
18163 section=0
18164 !! wikitext
18165 start
18166 ==a==
18167 ===aa===
18168 ====aaa====
18169 ==b==
18170 ===ba===
18171 ===bb===
18172 ====bba====
18173 ===bc===
18174 ==c==
18175 ===ca===
18176 !! html/php
18177 start
18178 !! end
18179
18180 !! test
18181 Section extraction test (section 1)
18182 !! options
18183 section=1
18184 !! wikitext
18185 start
18186 ==a==
18187 ===aa===
18188 ====aaa====
18189 ==b==
18190 ===ba===
18191 ===bb===
18192 ====bba====
18193 ===bc===
18194 ==c==
18195 ===ca===
18196 !! html/php
18197 ==a==
18198 ===aa===
18199 ====aaa====
18200 !! end
18201
18202 !! test
18203 Section extraction test (section 2)
18204 !! options
18205 section=2
18206 !! wikitext
18207 start
18208 ==a==
18209 ===aa===
18210 ====aaa====
18211 ==b==
18212 ===ba===
18213 ===bb===
18214 ====bba====
18215 ===bc===
18216 ==c==
18217 ===ca===
18218 !! html/php
18219 ===aa===
18220 ====aaa====
18221 !! end
18222
18223 !! test
18224 Section extraction test (section 3)
18225 !! options
18226 section=3
18227 !! wikitext
18228 start
18229 ==a==
18230 ===aa===
18231 ====aaa====
18232 ==b==
18233 ===ba===
18234 ===bb===
18235 ====bba====
18236 ===bc===
18237 ==c==
18238 ===ca===
18239 !! html/php
18240 ====aaa====
18241 !! end
18242
18243 !! test
18244 Section extraction test (section 4)
18245 !! options
18246 section=4
18247 !! wikitext
18248 start
18249 ==a==
18250 ===aa===
18251 ====aaa====
18252 ==b==
18253 ===ba===
18254 ===bb===
18255 ====bba====
18256 ===bc===
18257 ==c==
18258 ===ca===
18259 !! html/php
18260 ==b==
18261 ===ba===
18262 ===bb===
18263 ====bba====
18264 ===bc===
18265 !! end
18266
18267 !! test
18268 Section extraction test (section 5)
18269 !! options
18270 section=5
18271 !! wikitext
18272 start
18273 ==a==
18274 ===aa===
18275 ====aaa====
18276 ==b==
18277 ===ba===
18278 ===bb===
18279 ====bba====
18280 ===bc===
18281 ==c==
18282 ===ca===
18283 !! html/php
18284 ===ba===
18285 !! end
18286
18287 !! test
18288 Section extraction test (section 6)
18289 !! options
18290 section=6
18291 !! wikitext
18292 start
18293 ==a==
18294 ===aa===
18295 ====aaa====
18296 ==b==
18297 ===ba===
18298 ===bb===
18299 ====bba====
18300 ===bc===
18301 ==c==
18302 ===ca===
18303 !! html/php
18304 ===bb===
18305 ====bba====
18306 !! end
18307
18308 !! test
18309 Section extraction test (section 7)
18310 !! options
18311 section=7
18312 !! wikitext
18313 start
18314 ==a==
18315 ===aa===
18316 ====aaa====
18317 ==b==
18318 ===ba===
18319 ===bb===
18320 ====bba====
18321 ===bc===
18322 ==c==
18323 ===ca===
18324 !! html/php
18325 ====bba====
18326 !! end
18327
18328 !! test
18329 Section extraction test (section 8)
18330 !! options
18331 section=8
18332 !! wikitext
18333 start
18334 ==a==
18335 ===aa===
18336 ====aaa====
18337 ==b==
18338 ===ba===
18339 ===bb===
18340 ====bba====
18341 ===bc===
18342 ==c==
18343 ===ca===
18344 !! html/php
18345 ===bc===
18346 !! end
18347
18348 !! test
18349 Section extraction test (section 9)
18350 !! options
18351 section=9
18352 !! wikitext
18353 start
18354 ==a==
18355 ===aa===
18356 ====aaa====
18357 ==b==
18358 ===ba===
18359 ===bb===
18360 ====bba====
18361 ===bc===
18362 ==c==
18363 ===ca===
18364 !! html/php
18365 ==c==
18366 ===ca===
18367 !! end
18368
18369 !! test
18370 Section extraction test (section 10)
18371 !! options
18372 section=10
18373 !! wikitext
18374 start
18375 ==a==
18376 ===aa===
18377 ====aaa====
18378 ==b==
18379 ===ba===
18380 ===bb===
18381 ====bba====
18382 ===bc===
18383 ==c==
18384 ===ca===
18385 !! html/php
18386 ===ca===
18387 !! end
18388
18389 !! test
18390 Section extraction test (nonexistent section 11)
18391 !! options
18392 section=11
18393 !! wikitext
18394 start
18395 ==a==
18396 ===aa===
18397 ====aaa====
18398 ==b==
18399 ===ba===
18400 ===bb===
18401 ====bba====
18402 ===bc===
18403 ==c==
18404 ===ca===
18405 !! html/php
18406 !! end
18407
18408 !! test
18409 Section extraction test with bogus heading (section 1)
18410 !! options
18411 section=1
18412 !! wikitext
18413 ==a==
18414 ==bogus== not a legal section
18415 ==b==
18416 !! html/php
18417 ==a==
18418 ==bogus== not a legal section
18419 !! end
18420
18421 !! test
18422 Section extraction test with bogus heading (section 2)
18423 !! options
18424 section=2
18425 !! wikitext
18426 ==a==
18427 ==bogus== not a legal section
18428 ==b==
18429 !! html/php
18430 ==b==
18431 !! end
18432
18433 !! test
18434 Section extraction test with comment after heading (section 1)
18435 !! options
18436 section=1
18437 !! wikitext
18438 ==a==
18439 ==b== <!-- -->
18440 ==c==
18441 !! html/php
18442 ==a==
18443 !! end
18444
18445 !! test
18446 Section extraction test with comment after heading (section 2)
18447 !! options
18448 section=2
18449 !! wikitext
18450 ==a==
18451 ==b== <!-- -->
18452 ==c==
18453 !! html/php
18454 ==b== <!-- -->
18455 !! end
18456
18457 !! test
18458 Section extraction test with bogus <nowiki> heading (section 1)
18459 !! options
18460 section=1
18461 !! wikitext
18462 ==a==
18463 ==bogus== <nowiki>not a legal section</nowiki>
18464 ==b==
18465 !! html/php
18466 ==a==
18467 ==bogus== <nowiki>not a legal section</nowiki>
18468 !! end
18469
18470 !! test
18471 Section extraction test with bogus <nowiki> heading (section 2)
18472 !! options
18473 section=2
18474 !! wikitext
18475 ==a==
18476 ==bogus== <nowiki>not a legal section</nowiki>
18477 ==b==
18478 !! html/php
18479 ==b==
18480 !! end
18481
18482 # Formerly testing for T4587, now resolved by the use of unmarked sections
18483 # instead of respecting commented sections
18484 !! test
18485 Section extraction prefixed by comment (section 1)
18486 !! options
18487 section=1
18488 !! wikitext
18489 <!-- -->==sec1==
18490 ==sec2==
18491 !! html/php
18492 ==sec2==
18493 !!end
18494
18495 !! test
18496 Section extraction prefixed by comment (section 2)
18497 !! options
18498 section=2
18499 !! wikitext
18500 <!-- -->==sec1==
18501 ==sec2==
18502 !! html/php
18503
18504 !!end
18505
18506 # Formerly testing for T4607, now resolved by the use of unmarked sections
18507 # instead of respecting HTML-style headings
18508 !! test
18509 Section extraction, mixed wiki and html (section 1)
18510 !! options
18511 section=1
18512 !! wikitext
18513 <h2>unmarked</h2>
18514 unmarked
18515 ==1==
18516 one
18517 ==2==
18518 two
18519 !! html/php
18520 ==1==
18521 one
18522 !! end
18523
18524 !! test
18525 Section extraction, mixed wiki and html (section 2)
18526 !! options
18527 section=2
18528 !! wikitext
18529 <h2>unmarked</h2>
18530 unmarked
18531 ==1==
18532 one
18533 ==2==
18534 two
18535 !! html/php
18536 ==2==
18537 two
18538 !! end
18539
18540
18541 # Formerly testing for T5342
18542 !! test
18543 Section extraction, heading surrounded by <noinclude>
18544 !! options
18545 section=1
18546 !! wikitext
18547 <noinclude>==unmarked==</noinclude>
18548 ==marked==
18549 !! html/php
18550 ==marked==
18551 !!end
18552
18553 # Test behavior of T21910
18554 !! test
18555 Sectiion with all-equals
18556 !! options
18557 section=2
18558 !! wikitext
18559 ===
18560 The line above must have a trailing space
18561 === <!--
18562 --> <!-- -->
18563 But just in case it doesn't...
18564 !! html/php
18565 === <!--
18566 --> <!-- -->
18567 But just in case it doesn't...
18568 !! end
18569
18570 !! test
18571 Section replacement test (section 0)
18572 !! options
18573 replace=0,"xxx"
18574 !! wikitext
18575 start
18576 ==a==
18577 ===aa===
18578 ====aaa====
18579 ==b==
18580 ===ba===
18581 ===bb===
18582 ====bba====
18583 ===bc===
18584 ==c==
18585 ===ca===
18586 !! html/php
18587 xxx
18588
18589 ==a==
18590 ===aa===
18591 ====aaa====
18592 ==b==
18593 ===ba===
18594 ===bb===
18595 ====bba====
18596 ===bc===
18597 ==c==
18598 ===ca===
18599 !! end
18600
18601 !! test
18602 Section replacement test (section 1)
18603 !! options
18604 replace=1,"xxx"
18605 !! wikitext
18606 start
18607 ==a==
18608 ===aa===
18609 ====aaa====
18610 ==b==
18611 ===ba===
18612 ===bb===
18613 ====bba====
18614 ===bc===
18615 ==c==
18616 ===ca===
18617 !! html/php
18618 start
18619 xxx
18620
18621 ==b==
18622 ===ba===
18623 ===bb===
18624 ====bba====
18625 ===bc===
18626 ==c==
18627 ===ca===
18628 !! end
18629
18630 !! test
18631 Section replacement test (section 2)
18632 !! options
18633 replace=2,"xxx"
18634 !! wikitext
18635 start
18636 ==a==
18637 ===aa===
18638 ====aaa====
18639 ==b==
18640 ===ba===
18641 ===bb===
18642 ====bba====
18643 ===bc===
18644 ==c==
18645 ===ca===
18646 !! html/php
18647 start
18648 ==a==
18649 xxx
18650
18651 ==b==
18652 ===ba===
18653 ===bb===
18654 ====bba====
18655 ===bc===
18656 ==c==
18657 ===ca===
18658 !! end
18659
18660 !! test
18661 Section replacement test (section 3)
18662 !! options
18663 replace=3,"xxx"
18664 !! wikitext
18665 start
18666 ==a==
18667 ===aa===
18668 ====aaa====
18669 ==b==
18670 ===ba===
18671 ===bb===
18672 ====bba====
18673 ===bc===
18674 ==c==
18675 ===ca===
18676 !! html/php
18677 start
18678 ==a==
18679 ===aa===
18680 xxx
18681
18682 ==b==
18683 ===ba===
18684 ===bb===
18685 ====bba====
18686 ===bc===
18687 ==c==
18688 ===ca===
18689 !! end
18690
18691 !! test
18692 Section replacement test (section 4)
18693 !! options
18694 replace=4,"xxx"
18695 !! wikitext
18696 start
18697 ==a==
18698 ===aa===
18699 ====aaa====
18700 ==b==
18701 ===ba===
18702 ===bb===
18703 ====bba====
18704 ===bc===
18705 ==c==
18706 ===ca===
18707 !! html/php
18708 start
18709 ==a==
18710 ===aa===
18711 ====aaa====
18712 xxx
18713
18714 ==c==
18715 ===ca===
18716 !! end
18717
18718 !! test
18719 Section replacement test (section 5)
18720 !! options
18721 replace=5,"xxx"
18722 !! wikitext
18723 start
18724 ==a==
18725 ===aa===
18726 ====aaa====
18727 ==b==
18728 ===ba===
18729 ===bb===
18730 ====bba====
18731 ===bc===
18732 ==c==
18733 ===ca===
18734 !! html/php
18735 start
18736 ==a==
18737 ===aa===
18738 ====aaa====
18739 ==b==
18740 xxx
18741
18742 ===bb===
18743 ====bba====
18744 ===bc===
18745 ==c==
18746 ===ca===
18747 !! end
18748
18749 !! test
18750 Section replacement test (section 6)
18751 !! options
18752 replace=6,"xxx"
18753 !! wikitext
18754 start
18755 ==a==
18756 ===aa===
18757 ====aaa====
18758 ==b==
18759 ===ba===
18760 ===bb===
18761 ====bba====
18762 ===bc===
18763 ==c==
18764 ===ca===
18765 !! html/php
18766 start
18767 ==a==
18768 ===aa===
18769 ====aaa====
18770 ==b==
18771 ===ba===
18772 xxx
18773
18774 ===bc===
18775 ==c==
18776 ===ca===
18777 !! end
18778
18779 !! test
18780 Section replacement test (section 7)
18781 !! options
18782 replace=7,"xxx"
18783 !! wikitext
18784 start
18785 ==a==
18786 ===aa===
18787 ====aaa====
18788 ==b==
18789 ===ba===
18790 ===bb===
18791 ====bba====
18792 ===bc===
18793 ==c==
18794 ===ca===
18795 !! html/php
18796 start
18797 ==a==
18798 ===aa===
18799 ====aaa====
18800 ==b==
18801 ===ba===
18802 ===bb===
18803 xxx
18804
18805 ===bc===
18806 ==c==
18807 ===ca===
18808 !! end
18809
18810 !! test
18811 Section replacement test (section 8)
18812 !! options
18813 replace=8,"xxx"
18814 !! wikitext
18815 start
18816 ==a==
18817 ===aa===
18818 ====aaa====
18819 ==b==
18820 ===ba===
18821 ===bb===
18822 ====bba====
18823 ===bc===
18824 ==c==
18825 ===ca===
18826 !! html/php
18827 start
18828 ==a==
18829 ===aa===
18830 ====aaa====
18831 ==b==
18832 ===ba===
18833 ===bb===
18834 ====bba====
18835 xxx
18836
18837 ==c==
18838 ===ca===
18839 !!end
18840
18841 !! test
18842 Section replacement test (section 9)
18843 !! options
18844 replace=9,"xxx"
18845 !! wikitext
18846 start
18847 ==a==
18848 ===aa===
18849 ====aaa====
18850 ==b==
18851 ===ba===
18852 ===bb===
18853 ====bba====
18854 ===bc===
18855 ==c==
18856 ===ca===
18857 !! html/php
18858 start
18859 ==a==
18860 ===aa===
18861 ====aaa====
18862 ==b==
18863 ===ba===
18864 ===bb===
18865 ====bba====
18866 ===bc===
18867 xxx
18868 !! end
18869
18870 !! test
18871 Section replacement test (section 10)
18872 !! options
18873 replace=10,"xxx"
18874 !! wikitext
18875 start
18876 ==a==
18877 ===aa===
18878 ====aaa====
18879 ==b==
18880 ===ba===
18881 ===bb===
18882 ====bba====
18883 ===bc===
18884 ==c==
18885 ===ca===
18886 !! html/php
18887 start
18888 ==a==
18889 ===aa===
18890 ====aaa====
18891 ==b==
18892 ===ba===
18893 ===bb===
18894 ====bba====
18895 ===bc===
18896 ==c==
18897 xxx
18898 !! end
18899
18900 !! test
18901 Section replacement test with initial whitespace (T15728)
18902 !! options
18903 replace=2,"xxx"
18904 !! wikitext
18905 Preformatted initial line
18906 ==a==
18907 ===a===
18908 !! html/php
18909 Preformatted initial line
18910 ==a==
18911 xxx
18912 !! end
18913
18914
18915 !! test
18916 Section extraction, heading followed by pre with 20 spaces (T8398)
18917 !! options
18918 section=1
18919 !! wikitext
18920 ==a==
18921 a
18922 !! html/php
18923 ==a==
18924 a
18925 !! end
18926
18927 !! test
18928 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
18929 !! options
18930 section=1
18931 !! wikitext
18932 ==a==
18933 a
18934 !! html/php
18935 ==a==
18936 a
18937 !! end
18938
18939
18940 !! test
18941 Section extraction, <pre> around bogus header (T12309)
18942 !! options
18943 section=2
18944 !! wikitext
18945 == Section One ==
18946 <pre>
18947 =======
18948 </pre>
18949
18950 == Section Two ==
18951 stuff
18952 !! html/php
18953 == Section Two ==
18954 stuff
18955 !! end
18956
18957 !! test
18958 Section replacement, <pre> around bogus header (T12309)
18959 !! options
18960 replace=2,"xxx"
18961 !! wikitext
18962 == Section One ==
18963 <pre>
18964 =======
18965 </pre>
18966
18967 == Section Two ==
18968 stuff
18969 !! html/php
18970 == Section One ==
18971 <pre>
18972 =======
18973 </pre>
18974
18975 xxx
18976 !! end
18977
18978 !! test
18979 Handling of &#x0A; in URLs
18980 !! wikitext
18981 ** irc://&#x0A;a
18982 !! html/php
18983 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18984
18985 !! html/parsoid
18986 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa" data-parsoid='{"stx":"url","a":{"href":"irc://%0Aa"},"sa":{"href":"irc://&amp;#x0A;a"}}'>irc://%0Aa</a></li></ul></li></ul>
18987 !! end
18988
18989 !! test
18990 Handling of %0A in URLs
18991 !! wikitext
18992 ** irc://%0Aa
18993 !! html/php
18994 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18995
18996 !! html/parsoid
18997 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18998 !! end
18999
19000 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
19001 !! test
19002 5 quotes, code coverage +1 line
19003 !! options
19004 parsoid=wt2html
19005 !! wikitext
19006 '''''
19007 !! html/php
19008 !! html/parsoid
19009 <p><b><i></i></b></p>
19010 !! end
19011
19012 # same html as previous, but wikitext adjusted to match parsoid html2wt
19013 # note that wt2html and html2html will put the <i> before the <b>
19014 !! test
19015 5 quotes, code coverage +1 line w/ nowiki (1)
19016 !! options
19017 parsoid=wt2wt,html2wt
19018 !! wikitext
19019 '''''<nowiki/>'''''
19020 !! html/php
19021 <p><i></i>
19022 </p>
19023 !! html/parsoid
19024 <p><b><i></i></b></p>
19025 !! end
19026
19027 # same as previous, just swapping the <i> and <b>
19028 !! test
19029 5 quotes, code coverage +1 line w/ nowiki (2)
19030 !! wikitext
19031 '''''<nowiki/>'''''
19032 !! html/php
19033 <p><i></i>
19034 </p>
19035 !! html/parsoid
19036 <p><i><b></b></i></p>
19037 !! end
19038
19039 !! test
19040 Special:Search page linking.
19041 !! wikitext
19042 {{Special:search}}
19043 !! html
19044 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
19045 </p>
19046 !! end
19047
19048 !! test
19049 {{!}} is a magic word
19050 !! wikitext
19051 {{!}} is a magic word there and {{!}} is still a magic word here
19052 | is not a magic word here but {{!}} is still a magic word here
19053 !! html/php
19054 <p>| is a magic word there and | is still a magic word here
19055 | is not a magic word here but | is still a magic word here
19056 </p>
19057 !! html/parsoid
19058 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is a magic word there and <span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is still a magic word here
19059 | is not a magic word here but <span about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is still a magic word here</p>
19060
19061 !! end
19062
19063 !! test
19064 Say the magic word
19065 !! options
19066 title=[[Parser test]]
19067 !! wikitext
19068 * {{PAGENAME}}
19069 * {{PAGENAMEE}}
19070 * {{FULLPAGENAME}}
19071 * {{FULLPAGENAMEE}}
19072 * {{BASEPAGENAME}}
19073 * {{BASEPAGENAMEE}}
19074 * {{SUBPAGENAME}}
19075 * {{SUBPAGENAMEE}}
19076 * {{ROOTPAGENAME}}
19077 * {{ROOTPAGENAMEE}}
19078 * {{TALKPAGENAME}}
19079 * {{TALKPAGENAMEE}}
19080 * {{SUBJECTPAGENAME}}
19081 * {{SUBJECTPAGENAMEE}}
19082 * {{NAMESPACEE}}
19083 * {{NAMESPACE}}
19084 * {{NAMESPACENUMBER}}
19085 * {{TALKSPACE}}
19086 * {{TALKSPACEE}}
19087 * {{SUBJECTSPACE}}
19088 * {{SUBJECTSPACEE}}
19089 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
19090 !! html
19091 <ul><li> Parser test</li>
19092 <li> Parser_test</li>
19093 <li> Parser test</li>
19094 <li> Parser_test</li>
19095 <li> Parser test</li>
19096 <li> Parser_test</li>
19097 <li> Parser test</li>
19098 <li> Parser_test</li>
19099 <li> Parser test</li>
19100 <li> Parser_test</li>
19101 <li> Talk:Parser test</li>
19102 <li> Talk:Parser_test</li>
19103 <li> Parser test</li>
19104 <li> Parser_test</li>
19105 <li> </li>
19106 <li> </li>
19107 <li> 0</li>
19108 <li> Talk</li>
19109 <li> Talk</li>
19110 <li> </li>
19111 <li> </li>
19112 <li> <a href="/index.php?title=Template:Dynamic&amp;action=edit&amp;redlink=1" class="new" title="Template:Dynamic (page does not exist)">Template:Dynamic</a></li></ul>
19113
19114 !! end
19115 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
19116
19117 !! test
19118 Gallery with valid attributes
19119 !! wikitext
19120 <gallery type="123" summary="345">
19121 File:File:Foobar.jpg
19122 </gallery>
19123 !! html/php
19124 <ul class="gallery mw-gallery-traditional" type="123">
19125 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19126 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
19127 <div class="gallerytext">
19128 </div>
19129 </div></li>
19130 </ul>
19131
19132 !! html/parsoid
19133 <ul class="gallery mw-gallery-traditional" type="123" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"type":"123","summary":"345"},"body":{"extsrc":"\nFile:File:Foobar.jpg\n"}}'>
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;">File:File:Foobar.jpg</span></div><div class="gallerytext"></div></li>
19135 </ul>
19136 !! end
19137
19138 ## Parsoid thinks the "centre" here is a property, not a caption.
19139 !! test
19140 Gallery
19141 !! options
19142 parsoid={
19143 "modes": ["wt2html"],
19144 "nativeGallery": true
19145 }
19146 !! wikitext
19147 <gallery>
19148 image1.png |
19149 image2.gif|||||
19150
19151 image3|
19152 image4 |300px| centre
19153 image5.svg| http://///////
19154 [[x|xx]]]]
19155 * image6
19156 </gallery>
19157 !! html/php
19158 <ul class="gallery mw-gallery-traditional">
19159 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19160 <div class="thumb" style="height: 150px;">Image1.png</div>
19161 <div class="gallerytext">
19162 </div>
19163 </div></li>
19164 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19165 <div class="thumb" style="height: 150px;">Image2.gif</div>
19166 <div class="gallerytext">
19167 </div>
19168 </div></li>
19169 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19170 <div class="thumb" style="height: 150px;">Image3</div>
19171 <div class="gallerytext">
19172 </div>
19173 </div></li>
19174 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19175 <div class="thumb" style="height: 150px;">Image4</div>
19176 <div class="gallerytext">
19177 <pre>centre
19178 </pre>
19179 </div>
19180 </div></li>
19181 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19182 <div class="thumb" style="height: 150px;">Image5.svg</div>
19183 <div class="gallerytext">
19184 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
19185 </p>
19186 </div>
19187 </div></li>
19188 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19189 <div class="thumb" style="height: 150px;">* image6</div>
19190 <div class="gallerytext">
19191 </div>
19192 </div></li>
19193 </ul>
19194
19195 !! html/parsoid
19196 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19197 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">image1.png </span></div><div class="gallerytext"></div></li>
19198 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">image2.gif</span></div><div class="gallerytext"></div></li>
19199 <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>
19200 <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>
19201 <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>
19202 <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>
19203 </ul>
19204 !! end
19205
19206 !! test
19207 Gallery (with options, html)
19208 !! options
19209 parsoid={
19210 "modes": ["wt2html", "html2html"],
19211 "nativeGallery": true
19212 }
19213 !! wikitext
19214 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19215 File:Nonexistent.jpg|caption
19216 File:Nonexistent.jpg
19217 image:foobar.jpg|some '''caption''' [[Main Page]]
19218 image:foobar.jpg
19219 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19220 </gallery>
19221 !! html/php
19222 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19223 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19224 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19225 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19226 <div class="gallerytext">
19227 <p>caption
19228 </p>
19229 </div>
19230 </div></li>
19231 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19232 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19233 <div class="gallerytext">
19234 </div>
19235 </div></li>
19236 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19237 <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>
19238 <div class="gallerytext">
19239 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19240 </p>
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="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>
19245 <div class="gallerytext">
19246 </div>
19247 </div></li>
19248 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19249 <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>
19250 <div class="gallerytext">
19251 <p>blabla.
19252 </p>
19253 </div>
19254 </div></li>
19255 </ul>
19256
19257 !! html/parsoid
19258 <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":{}}'>
19259 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19260 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext">caption</div></li>
19261 <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>
19262 <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>
19263 <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>
19264 <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>
19265 </ul>
19266 !! end
19267
19268 !! test
19269 Gallery (with options, extsrc)
19270 !! options
19271 parsoid={
19272 "nativeGallery": false
19273 }
19274 !! wikitext
19275 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19276 File:Nonexistent.jpg|caption
19277 File:Nonexistent.jpg
19278 image:foobar.jpg|some '''caption''' [[Main Page]]
19279 image:foobar.jpg
19280 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19281 </gallery>
19282 !! html/php
19283 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19284 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19285 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19286 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19287 <div class="gallerytext">
19288 <p>caption
19289 </p>
19290 </div>
19291 </div></li>
19292 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19293 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19294 <div class="gallerytext">
19295 </div>
19296 </div></li>
19297 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19298 <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>
19299 <div class="gallerytext">
19300 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19301 </p>
19302 </div>
19303 </div></li>
19304 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19305 <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>
19306 <div class="gallerytext">
19307 </div>
19308 </div></li>
19309 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19310 <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>
19311 <div class="gallerytext">
19312 <p>blabla.
19313 </p>
19314 </div>
19315 </div></li>
19316 </ul>
19317
19318 !! html/parsoid
19319 <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"}}'>
19320 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19321 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext">caption</div></li>
19322 <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>
19323 <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>
19324 <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>
19325 <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>
19326 </ul>
19327 !! end
19328
19329 !! test
19330 Gallery with link that has fragment
19331 !! options
19332 parsoid={
19333 "modes": ["wt2html", "html2html"],
19334 "nativeGallery": true
19335 }
19336 !! wikitext
19337 <gallery>
19338 image:foobar.jpg|link=Main_Page
19339 image:foobar.jpg|link=Main_Page#section
19340 image:foobar.jpg|link=Main Page#section|caption
19341 </gallery>
19342 !! html/php
19343 <ul class="gallery mw-gallery-traditional">
19344 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19345 <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>
19346 <div class="gallerytext">
19347 </div>
19348 </div></li>
19349 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19350 <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>
19351 <div class="gallerytext">
19352 </div>
19353 </div></li>
19354 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19355 <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>
19356 <div class="gallerytext">
19357 <p>caption
19358 </p>
19359 </div>
19360 </div></li>
19361 </ul>
19362
19363 !! html/parsoid
19364 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19365 <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>
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="./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>
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="./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>
19368 </ul>
19369 !! end
19370
19371 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19372 !! test
19373 Gallery with template inside caption
19374 !! options
19375 parsoid={
19376 "nativeGallery": true
19377 }
19378 !! wikitext
19379 <gallery caption="{{echo|hi}}">
19380 File:Foobar.jpg|{{echo|ho}}
19381 </gallery>
19382 !! html/php
19383 <ul class="gallery mw-gallery-traditional">
19384 <li class='gallerycaption'>{{echo|hi}}</li>
19385 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19386 <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>
19387 <div class="gallerytext">
19388 <p>ho
19389 </p>
19390 </div>
19391 </div></li>
19392 </ul>
19393
19394 !! html/parsoid
19395 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19396 <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>
19397 <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>
19398 </ul>
19399 !! end
19400
19401 !! test
19402 Gallery with wikitext inside caption
19403 !! options
19404 parsoid={
19405 "nativeGallery": true
19406 }
19407 !! wikitext
19408 <gallery>
19409 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19410 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19411 </gallery>
19412 !! html/php
19413 <ul class="gallery mw-gallery-traditional">
19414 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19415 <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>
19416 <div class="gallerytext">
19417 <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>
19418 </p>
19419 </div>
19420 </div></li>
19421 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19422 <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>
19423 <div class="gallerytext">
19424 <p>This is a test template
19425 </p>
19426 </div>
19427 </div></li>
19428 </ul>
19429
19430 !! html/parsoid
19431 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19432 <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>
19433 <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>
19434 </ul>
19435 !! end
19436
19437 !! test
19438 Gallery (with showfilename option)
19439 !! options
19440 parsoid={
19441 "nativeGallery": true
19442 }
19443 !! wikitext
19444 <gallery showfilename="">
19445 File:Nonexistent.jpg|caption
19446 File:Nonexistent.jpg
19447 File:Foobar.jpg|some '''caption''' [[Main Page]]
19448 File:Foobar.jpg
19449 </gallery>
19450 !! html/php
19451 <ul class="gallery mw-gallery-traditional">
19452 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19453 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19454 <div class="gallerytext">
19455 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19456 caption
19457 </p>
19458 </div>
19459 </div></li>
19460 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19461 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19462 <div class="gallerytext">
19463 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19464 </p>
19465 </div>
19466 </div></li>
19467 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19468 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
19469 <div class="gallerytext">
19470 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19471 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19472 </p>
19473 </div>
19474 </div></li>
19475 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19476 <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>
19477 <div class="gallerytext">
19478 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19479 </p>
19480 </div>
19481 </div></li>
19482 </ul>
19483
19484 !! html/parsoid
19485 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
19486 <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>
19487 <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>
19488 <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>
19489 <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>
19490 </ul>
19491 !! end
19492
19493 ## Should Parsoid be preserving these variations?
19494 !! test
19495 Gallery (with namespace-less filenames)
19496 !! options
19497 parsoid={
19498 "modes": ["wt2html", "html2html"],
19499 "nativeGallery": true
19500 }
19501 !! wikitext
19502 <gallery>
19503 File:Nonexistent.jpg
19504 Nonexistent.jpg
19505 image:foobar.jpg
19506 foobar.jpg
19507 </gallery>
19508 !! html/php
19509 <ul class="gallery mw-gallery-traditional">
19510 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19511 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19512 <div class="gallerytext">
19513 </div>
19514 </div></li>
19515 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19516 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19517 <div class="gallerytext">
19518 </div>
19519 </div></li>
19520 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19521 <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>
19522 <div class="gallerytext">
19523 </div>
19524 </div></li>
19525 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19526 <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>
19527 <div class="gallerytext">
19528 </div>
19529 </div></li>
19530 </ul>
19531
19532 !! html/parsoid
19533 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19534 <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>
19535 <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>
19536 <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>
19537 <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>
19538 </ul>
19539 !! end
19540
19541 !! test
19542 Gallery override link with WikiLink (T36852)
19543 !! options
19544 parsoid={
19545 "nativeGallery": true
19546 }
19547 !! wikitext
19548 <gallery>
19549 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
19550 </gallery>
19551 !! html/php
19552 <ul class="gallery mw-gallery-traditional">
19553 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19554 <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>
19555 <div class="gallerytext">
19556 </div>
19557 </div></li>
19558 </ul>
19559
19560 !! html/parsoid
19561 <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":{}}'>
19562 <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>
19563 </ul>
19564 !! end
19565
19566 !! test
19567 Gallery override link with absolute external link (T36852)
19568 !! options
19569 parsoid={
19570 "nativeGallery": true
19571 }
19572 !! wikitext
19573 <gallery>
19574 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
19575 </gallery>
19576 !! html/php
19577 <ul class="gallery mw-gallery-traditional">
19578 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19579 <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>
19580 <div class="gallerytext">
19581 </div>
19582 </div></li>
19583 </ul>
19584
19585 !! html/parsoid
19586 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19587 <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>
19588 </ul>
19589 !! end
19590
19591 !! test
19592 Gallery override link with absolute external link with LanguageConverter
19593 !! options
19594 language=zh
19595 !! input
19596 <gallery>
19597 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19598 </gallery>
19599 !! result
19600 <ul class="gallery mw-gallery-traditional">
19601 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19602 <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>
19603 <div class="gallerytext">
19604 <p>caption
19605 </p>
19606 </div>
19607 </div></li>
19608 </ul>
19609
19610 !! end
19611
19612 !! test
19613 Gallery override link with malicious javascript (T36852)
19614 !! options
19615 parsoid={
19616 "modes": ["wt2html", "html2html"],
19617 "nativeGallery": true
19618 }
19619 !! wikitext
19620 <gallery>
19621 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19622 </gallery>
19623 !! html/php
19624 <ul class="gallery mw-gallery-traditional">
19625 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19626 <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>
19627 <div class="gallerytext">
19628 </div>
19629 </div></li>
19630 </ul>
19631
19632 !! html/parsoid
19633 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19634 <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>
19635 </ul>
19636 !! end
19637
19638 !! test
19639 Gallery with invalid title as link (T45964)
19640 !! options
19641 parsoid={
19642 "modes": ["wt2html", "html2html"],
19643 "nativeGallery": true
19644 }
19645 !! wikitext
19646 <gallery>
19647 File:Foobar.jpg|link=<
19648 </gallery>
19649 !! html/php
19650 <ul class="gallery mw-gallery-traditional">
19651 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19652 <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>
19653 <div class="gallerytext">
19654 </div>
19655 </div></li>
19656 </ul>
19657
19658 !! html/parsoid
19659 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19660 <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>
19661 </ul>
19662 !! end
19663
19664 !! test
19665 Serialize gallery without attrs in data-mw
19666 !! options
19667 parsoid={
19668 "modes": ["html2wt"],
19669 "nativeGallery": true
19670 }
19671 !! html/parsoid
19672 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
19673 <li class="gallerycaption">123</li>
19674 <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>
19675 </ul>
19676 !! wikitext
19677 <gallery caption="123">
19678 File:Test.png
19679 </gallery>
19680 !! end
19681
19682 !! test
19683 Gallery with class and style attributes
19684 !! options
19685 parsoid={
19686 "nativeGallery": true
19687 }
19688 !! wikitext
19689 <gallery class="center" style="text-align: center;">
19690 File:Foobar.jpg
19691 </gallery>
19692 !! html/php
19693 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
19694 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19695 <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>
19696 <div class="gallerytext">
19697 </div>
19698 </div></li>
19699 </ul>
19700
19701 !! html/parsoid
19702 <ul class="gallery mw-gallery-traditional center" style="text-align: center;" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"class":"center","style":"text-align: center;"},"body":{}}'>
19703 <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>
19704 </ul>
19705 !! end
19706
19707 !! test
19708 Gallery in slideshow mode
19709 !! options
19710 parsoid={
19711 "nativeGallery": true
19712 }
19713 !! wikitext
19714 <gallery mode="slideshow" showthumbnails="">
19715 File:Foobar.jpg
19716 </gallery>
19717 !! html/php
19718 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
19719 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19720 <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>
19721 <div class="gallerytext">
19722 </div>
19723 </div></li>
19724 </ul>
19725
19726 !! html/parsoid
19727 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
19728 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px;"><span typeof="mw:Image"><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>
19729 </ul>
19730 !! end
19731
19732 !! test
19733 HTML Hex character encoding (spells the word "JavaScript")
19734 !! options
19735 parsoid=wt2html,wt2wt,html2html
19736 !! wikitext
19737 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19738 !! html/php
19739 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19740 </p>
19741 !! html/php+tidy
19742 <p>JavaScript</p>
19743 !! html/parsoid
19744 <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>
19745 !! end
19746
19747 !! test
19748 HTML Hex character encoding bogus encoding (T28437 regression check)
19749 !! wikitext
19750 &#xsee;&#XSEE;
19751 !! html/php
19752 <p>&amp;#xsee;&amp;#XSEE;
19753 </p>
19754 !! html/parsoid
19755 <p>&amp;#xsee;&amp;#XSEE;</p>
19756 !! end
19757
19758 !! test
19759 HTML Hex character encoding mixed case
19760 !! options
19761 parsoid=wt2html,wt2wt,html2html
19762 !! wikitext
19763 &#xEE;&#Xee;
19764 !! html/php
19765 <p>&#xee;&#xee;
19766 </p>
19767 !! html/php+tidy
19768 <p>îî</p>
19769 !! html/parsoid
19770 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19771 !! end
19772
19773 # See: https://www.w3.org/TR/html5/syntax.html#character-references
19774 # Note that U+000C (form feed) is not a valid XML character, so
19775 # it is banned even though allowed in HTML5.
19776 !! test
19777 Illegal character references (T106578)
19778 !! wikitext
19779 ; Null: &#00;
19780 ; FF: &#xC;
19781 ; CR: &#xD;
19782 ; Control (low): &#8;
19783 ; Control (high): &#x7F; &#x9F;
19784 ; Surrogate: &#xD83D;&#xDCA9;
19785 ; This is an okay astral character: &#x1F4A9;
19786 !! html+tidy
19787 <dl>
19788 <dt>Null</dt>
19789 <dd>&amp;#00;</dd>
19790 <dt>FF</dt>
19791 <dd>&amp;#xC;</dd>
19792 <dt>CR</dt>
19793 <dd>&amp;#xD;</dd>
19794 <dt>Control (low)</dt>
19795 <dd>&amp;#8;</dd>
19796 <dt>Control (high)</dt>
19797 <dd>&amp;#x7F; &amp;#x9F;</dd>
19798 <dt>Surrogate</dt>
19799 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19800 <dt>This is an okay astral character</dt>
19801 <dd>💩</dd>
19802 </dl>
19803 !! end
19804
19805 !! test
19806 __FORCETOC__ override
19807 !! wikitext
19808 __NEWSECTIONLINK__
19809 __FORCETOC__
19810 !! html/php
19811 <p><br />
19812 </p>
19813 !! end
19814
19815 !! test
19816 ISBN code coverage
19817 !! wikitext
19818 ISBN 978-0-1234-56&#x20;789
19819 !! html
19820 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19821 </p>
19822 !! html+tidy
19823 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19824 !! html/parsoid
19825 <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>
19826 !! end
19827
19828 !! test
19829 ISBN followed by 5 spaces
19830 !! wikitext
19831 ISBN
19832 !! html
19833 <p>ISBN
19834 </p>
19835 !! end
19836
19837 !! test
19838 Double ISBN
19839 !! wikitext
19840 ISBN ISBN 1234567890
19841 !! html/php
19842 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19843 </p>
19844 !! html/parsoid
19845 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19846 !! end
19847
19848 # Uppercase X and lowercase x as well
19849 !! test
19850 ISBN with an X
19851 !! wikitext
19852 ISBN 3-462-04561-X
19853 ISBN 3-462-04561-x
19854 ISBN 080442957X
19855 ISBN 080442957x
19856 ISBN 978080442957X
19857 ISBN 978080442957x
19858 !! html/php
19859 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19860 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19861 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19862 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19863 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19864 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19865 </p>
19866 !! html/parsoid
19867 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19868 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19869 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19870 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19871 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19872 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19873 !! end
19874
19875 !! test
19876 ISBN with empty prefix (parsoid test)
19877 !! wikitext
19878 ISBN 1234567890
19879 !! html/php
19880 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19881 </p>
19882 !! html/parsoid
19883 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19884 !! end
19885
19886 !! test
19887 T24905: <abbr> followed by ISBN followed by </a>
19888 !! wikitext
19889 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19890 !! html/php
19891 <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>
19892 </p>
19893 !! html/parsoid
19894 <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>
19895 !! end
19896
19897 !! test
19898 Double RFC
19899 !! wikitext
19900 RFC RFC 1234
19901 !! html
19902 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19903 </p>
19904 !! end
19905
19906 !! test
19907 Double RFC with a wiki link
19908 !! wikitext
19909 RFC [[RFC 1234]]
19910 !! html
19911 <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>
19912 </p>
19913 !! end
19914
19915 !! test
19916 RFC code coverage
19917 !! wikitext
19918 RFC 983&#x20;987
19919 !! html
19920 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19921 </p>
19922 !! html+tidy
19923 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19924 !! end
19925
19926 !! test
19927 Centre-aligned image
19928 !! wikitext
19929 [[Image:foobar.jpg|centre]]
19930 !! html
19931 <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>
19932
19933 !!end
19934
19935 !! test
19936 None-aligned image
19937 !! wikitext
19938 [[Image:foobar.jpg|none]]
19939 !! html
19940 <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>
19941
19942 !!end
19943
19944 !! test
19945 Width + Height sized image (using px) (height is ignored)
19946 !! wikitext
19947 [[Image:foobar.jpg|640x480px]]
19948 !! html
19949 <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>
19950 </p>
19951 !!end
19952
19953 !! test
19954 Width-sized image (using px, no following whitespace)
19955 !! wikitext
19956 [[Image:foobar.jpg|640px]]
19957 !! html
19958 <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>
19959 </p>
19960 !!end
19961
19962 !! test
19963 Width-sized image (using px, with following whitespace - test regression from r39467)
19964 !! wikitext
19965 [[Image:foobar.jpg|640px ]]
19966 !! html
19967 <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>
19968 </p>
19969 !!end
19970
19971 !! test
19972 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19973 !! wikitext
19974 [[Image:foobar.jpg| 640px]]
19975 !! html
19976 <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>
19977 </p>
19978 !!end
19979
19980 !! test
19981 Image with page parameter
19982 !! options
19983 djvu
19984 !! wikitext
19985 [[File:LoremIpsum.djvu|page=2]]
19986 !! html/php
19987 <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>
19988 </p>
19989 !! html/parsoid
19990 <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>
19991 !! end
19992
19993 !! test
19994 Another italics / bold test
19995 !! wikitext
19996 ''' ''x'
19997 !! html
19998 <pre>'<i> </i>x'
19999 </pre>
20000 !!end
20001
20002 # FIXME: The php output seems broken. It's interleaving some open/close tags.
20003 !! test
20004 dt/dd/dl test
20005 !! wikitext
20006 :;;;::
20007 !! html/php
20008 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
20009
20010 !! html/parsoid
20011 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
20012
20013 !!end
20014
20015 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
20016 !! test
20017 Images with the "|" character in the comment
20018 !! wikitext
20019 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
20020 !! html/php
20021 <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>
20022
20023 !! html/parsoid
20024 <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>
20025 !! end
20026
20027 !! test
20028 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
20029 !! wikitext
20030 <html><script>alert(1);</script></html>
20031 !! html
20032 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
20033 </p>
20034 !! end
20035
20036 !! test
20037 HTML with raw HTML ($wgRawHtml==true)
20038 !! options
20039 wgRawHtml=1
20040 !! wikitext
20041 <html><script>alert(1);</script></html>
20042 !! html
20043 <p><script>alert(1);</script>
20044 </p>
20045 !! end
20046
20047 !! test
20048 Parents of subpages, one level up
20049 !! options
20050 subpage title=[[Subpage test/L1/L2/L3]]
20051 !! wikitext
20052 [[../|L2]]
20053 !! html
20054 <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>
20055 </p>
20056 !! end
20057
20058
20059 !! test
20060 Parents of subpages, one level up, not named
20061 !! options
20062 subpage title=[[Subpage test/L1/L2/L3]]
20063 !! wikitext
20064 [[../]]
20065 !! html
20066 <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>
20067 </p>
20068 !! end
20069
20070
20071
20072 !! test
20073 Parents of subpages, two levels up
20074 !! options
20075 subpage title=[[Subpage test/L1/L2/L3]]
20076 !! wikitext
20077 [[../../|L1]]2
20078
20079 [[../../|L1]]l
20080 !! html
20081 <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
20082 </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>
20083 </p>
20084 !! end
20085
20086 !! test
20087 Parents of subpages, two levels up, without trailing slash or name.
20088 !! options
20089 subpage title=[[Subpage test/L1/L2/L3]]
20090 !! wikitext
20091 [[../..]]
20092 !! html
20093 <p>[[../..]]
20094 </p>
20095 !! end
20096
20097 !! test
20098 Parents of subpages, two levels up, with lots of extra trailing slashes.
20099 !! options
20100 subpage title=[[Subpage test/L1/L2/L3]]
20101 !! wikitext
20102 [[../../////]]
20103 !! html
20104 <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>
20105 </p>
20106 !! end
20107
20108 !! article
20109 Subpage test/L1/L2/L3Sibling
20110 !! text
20111 Sibling article
20112 !! endarticle
20113
20114 !! test
20115 Transclusion of a sibling page (one level up)
20116 !! options
20117 subpage title=[[Subpage test/L1/L2/L3]]
20118 !! wikitext
20119 {{../L3Sibling}}
20120 !! html
20121 <p>Sibling article
20122 </p>
20123 !! end
20124
20125 !! test
20126 Transclusion of a child page
20127 !! options
20128 subpage title=[[Subpage test/L1/L2]]
20129 !! wikitext
20130 {{/L3Sibling}}
20131 !! html
20132 <p>Sibling article
20133 </p>
20134 !! end
20135
20136 # This is wt2html only in Parsoid because we add <nowiki>
20137 # because of {{..}} and we don't expect to fix that to
20138 # eliminate the nowikis selective for {{..}} markup.
20139 !! test
20140 Non-transclusion because of too many up levels
20141 !! options
20142 subpage title=[[Subpage test/L1/L2/L3]]
20143 parsoid=wt2html
20144 !! wikitext
20145 {{../../../../More than parent}}
20146 !! html/php
20147 <p>{{../../../../More than parent}}
20148 </p>
20149 !! html/parsoid
20150 <p>{{../../../../More than parent}}</p>
20151 !! end
20152
20153 !! test
20154 Definition list code coverage
20155 !! wikitext
20156 ; title : def
20157 ; title : def
20158 ;title: def
20159 !! html/php
20160 <dl><dt> title &#160;</dt>
20161 <dd> def</dd>
20162 <dt> title&#160;</dt>
20163 <dd> def</dd>
20164 <dt>title</dt>
20165 <dd> def</dd></dl>
20166
20167 !! html/parsoid
20168 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20169 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20170 <dt>title</dt><dd> def</dd></dl>
20171 !! end
20172
20173 !! test
20174 Don't fall for the self-closing div
20175 !! wikitext
20176 <div>hello world</div/>
20177 !! html
20178 <div>hello world</div>
20179
20180 !! end
20181
20182 !! test
20183 MSGNW magic word
20184 !! wikitext
20185 {{MSGNW:msg}}
20186 !! html/php
20187 <p>&#91;&#91;:Template:Msg&#93;&#93;
20188 </p>
20189 !! end
20190
20191 !! test
20192 RAW magic word
20193 !! wikitext
20194 {{RAW:QUERTY}}
20195 !! html
20196 <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>
20197 </p>
20198 !! end
20199
20200 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
20201 !! test
20202 Always escape literal '>' in output, not just after '<'
20203 !! wikitext
20204 ><>
20205 !! html
20206 <p>&gt;&lt;&gt;
20207 </p>
20208 !! end
20209
20210 !! test
20211 Template caching
20212 !! wikitext
20213 {{Test}}
20214 {{Test}}
20215 !! html
20216 <p>This is a test template
20217 This is a test template
20218 </p>
20219 !! end
20220
20221
20222 !! article
20223 MediaWiki:Fake
20224 !! text
20225 ==header==
20226 !! endarticle
20227
20228 !! test
20229 Inclusion of !userCanEdit() content
20230 !! wikitext
20231 {{MediaWiki:Fake}}
20232 !! html
20233 <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>
20234
20235 !! end
20236
20237
20238 !! test
20239 Out-of-order TOC heading levels
20240 !! wikitext
20241 ==2==
20242 ======6======
20243 ===3===
20244 =1=
20245 =====5=====
20246 ==2==
20247 !! html
20248 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
20249 <ul>
20250 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
20251 <ul>
20252 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
20253 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
20254 </ul>
20255 </li>
20256 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
20257 <ul>
20258 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
20259 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
20260 </ul>
20261 </li>
20262 </ul>
20263 </div>
20264
20265 <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>
20266 <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>
20267 <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>
20268 <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>
20269 <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>
20270 <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>
20271
20272 !! end
20273
20274
20275 !! test
20276 ISBN with a dummy number
20277 !! wikitext
20278 ISBN ---
20279 !! html
20280 <p>ISBN ---
20281 </p>
20282 !! end
20283
20284
20285 !! test
20286 ISBN with space-delimited number
20287 !! wikitext
20288 ISBN 92 9017 032 8
20289 !! html
20290 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
20291 </p>
20292 !! end
20293
20294
20295 !! test
20296 ISBN with multiple spaces, no number
20297 !! wikitext
20298 ISBN foo
20299 !! html
20300 <p>ISBN foo
20301 </p>
20302 !! end
20303
20304
20305 !! test
20306 ISBN length
20307 !! wikitext
20308 ISBN 123456789
20309
20310 ISBN 1234567890
20311
20312 ISBN 12345678901
20313 !! html
20314 <p>ISBN 123456789
20315 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20316 </p><p>ISBN 12345678901
20317 </p>
20318 !! end
20319
20320
20321 !! test
20322 ISBN with trailing year (T9110)
20323 !! wikitext
20324 ISBN 1-234-56789-0 - 2006
20325
20326 ISBN 1 234 56789 0 - 2006
20327 !! html
20328 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
20329 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20330 </p>
20331 !! end
20332
20333
20334 !! test
20335 anchorencode
20336 !! wikitext
20337 {{anchorencode:foo bar©#%n}}
20338 !! html
20339 <p>foo_bar.C2.A9.23.25n
20340 </p>
20341 !! end
20342
20343 !! test
20344 anchorencode trims spaces
20345 !! wikitext
20346 {{anchorencode: __pretty__please__}}
20347 !! html
20348 <p>pretty_please
20349 </p>
20350 !! end
20351
20352 !! test
20353 anchorencode deals with links
20354 !! wikitext
20355 {{anchorencode: [[hello|world]] [[hi]]}}
20356 !! html
20357 <p>world_hi
20358 </p>
20359 !! end
20360
20361 !! test
20362 anchorencode deals with templates
20363 !! wikitext
20364 {{anchorencode: {{Foo}} }}
20365 !! html
20366 <p>FOO
20367 </p>
20368 !! end
20369
20370 !! test
20371 anchorencode encodes like the TOC generator: (T20431)
20372 !! wikitext
20373 === _ +:.3A%3A&&amp;]] ===
20374 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20375 __NOEDITSECTION__
20376 !! html
20377 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20378 <p>.2B:.3A.253A.26.26.5D.5D
20379 </p>
20380 !! end
20381
20382 !! test
20383 T8200: blockquotes and paragraph formatting
20384 !! wikitext
20385 <blockquote>
20386 foo
20387 </blockquote>
20388
20389 bar
20390
20391 baz
20392 !! html
20393 <blockquote>
20394 <p>foo
20395 </p>
20396 </blockquote>
20397 <p>bar
20398 </p>
20399 <pre>baz
20400 </pre>
20401 !! end
20402
20403 !! test
20404 T10293: Use of center tag ruins paragraph formatting
20405 !! wikitext
20406 <center>
20407 foo
20408 </center>
20409
20410 bar
20411
20412 baz
20413 !! html
20414 <center>
20415 <p>foo
20416 </p>
20417 </center>
20418 <p>bar
20419 </p>
20420 <pre>baz
20421 </pre>
20422 !! end
20423
20424 !!test
20425 Parsing of overlapping (improperly nested) inline html tags
20426 !! wikitext
20427 <span><s>x</span></s>
20428 !! html/php
20429 <p><span><s>x&lt;/span&gt;</s></span>
20430 </p>
20431 !! html/parsoid
20432 <p><span><s>x</s></span>
20433 </p>
20434 !!end
20435
20436 ###
20437 ### Language variants related tests
20438 ###
20439 !! test
20440 Self-link in language variants
20441 !! options
20442 title=[[Dunav]] language=sr
20443 !! wikitext
20444 Both [[Dunav]] and [[Дунав]] are names for this river.
20445 !! html
20446 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
20447 </p>
20448 !!end
20449
20450 !! article
20451 Дуна
20452 !! text
20453 content
20454 !! endarticle
20455
20456 !! test
20457 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
20458 !! options
20459 title=[[Duna]] language=sr
20460 !! wikitext
20461 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
20462 !! html
20463 <p><a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Дуна</a> is not a self-link while <a class="mw-selflink selflink">Duna</a> and <a class="mw-selflink selflink">Dуна</a> are still self-links.
20464 </p>
20465 !! end
20466
20467 !! test
20468 Link to a section of a variant of this title shouldn't be parsed as self-link
20469 !! options
20470 title=[[Duna]] language=sr
20471 !! wikitext
20472 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
20473 !! html
20474 <p><a class="mw-selflink selflink">Dуна</a> is a self-link while <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dunа#Foo</a> and <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dуна#Foo</a> are not self-links.
20475 </p>
20476 !! end
20477
20478 !! test
20479 Link to pages in language variants
20480 !! options
20481 language=sr
20482 !! wikitext
20483 Main Page can be written as [[Маин Паге]]
20484 !! html
20485 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
20486 </p>
20487 !!end
20488
20489
20490 !! test
20491 Multiple links to pages in language variants
20492 !! options
20493 language=sr
20494 !! wikitext
20495 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
20496 !! html
20497 <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>.
20498 </p>
20499 !!end
20500
20501
20502 !! test
20503 Simple template in language variants
20504 !! options
20505 language=sr
20506 !! wikitext
20507 {{тест}}
20508 !! html
20509 <p>This is a test template
20510 </p>
20511 !! end
20512
20513
20514 !! test
20515 Template with explicit namespace in language variants
20516 !! options
20517 language=sr
20518 !! wikitext
20519 {{Template:тест}}
20520 !! html
20521 <p>This is a test template
20522 </p>
20523 !! end
20524
20525
20526 !! test
20527 Basic test for template parameter in language variants
20528 !! options
20529 language=sr
20530 !! wikitext
20531 {{парамтест|param=foo}}
20532 !! html
20533 <p>This is a test template with parameter foo
20534 </p>
20535 !! end
20536
20537 !! test
20538 Simple category in language variants
20539 !! options
20540 language=sr cat
20541 !! wikitext
20542 [[Category:МедиаWики Усер'с Гуиде]]
20543 !! html/php
20544 cat=МедиаWики_Усер'с_Гуиде sort=
20545 !! html/parsoid
20546 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
20547 !! end
20548
20549 !! article
20550 Category:分类
20551 !! text
20552 blah
20553 !! endarticle
20554
20555 !! article
20556 Category:分類
20557 !! text
20558 blah
20559 !! endarticle
20560
20561 ## We used to, but no longer wt2wt this test since the default serializer
20562 ## will normalize all categories to serialize on their own line.
20563 ## This wikitext usage is going to be fairly uncommon in production and
20564 ## selser will take care of preserving formatting in those scenarios.
20565 !! test
20566 Don't convert blue categorylinks to another variant (T35210)
20567 !! options
20568 cat
20569 language=zh
20570 parsoid=wt2html
20571 !! wikitext
20572 [[A]][[Category:分类]]
20573 !! html/php
20574 cat=分类 sort=
20575 !! html/parsoid
20576 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
20577 <link rel="mw:PageProp/Category" href="./Category:分类"/>
20578 !! end
20579
20580 !! test
20581 Stripping -{}- tags (language variants)
20582 !! options
20583 language=sr
20584 !! wikitext
20585 Latin proverb: -{Ne nuntium necare}-
20586 !! html
20587 <p>Latin proverb: Ne nuntium necare
20588 </p>
20589 !! end
20590
20591
20592 !! test
20593 Prevent conversion with -{}- tags (language variants)
20594 !! options
20595 language=sr variant=sr-ec
20596 !! wikitext
20597 Latinski: -{Ne nuntium necare}-
20598 !! html
20599 <p>Латински: Ne nuntium necare
20600 </p>
20601 !! end
20602
20603
20604 !! test
20605 Prevent conversion of text with -{}- tags (language variants)
20606 !! options
20607 language=sr variant=sr-ec
20608 !! wikitext
20609 Latinski: -{Ne nuntium necare}-
20610 !! html
20611 <p>Латински: Ne nuntium necare
20612 </p>
20613 !! end
20614
20615
20616 !! test
20617 Prevent conversion of links with -{}- tags (language variants)
20618 !! options
20619 language=sr variant=sr-ec
20620 !! wikitext
20621 -{[[Main Page]]}-
20622 !! html
20623 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20624 </p>
20625 !! end
20626
20627
20628 !! test
20629 -{}- tags within headlines (within html for parserConvert())
20630 !! options
20631 language=sr variant=sr-ec
20632 !! wikitext
20633 == -{Naslov}- ==
20634 !! html
20635 <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>
20636
20637 !! end
20638
20639
20640 !! test
20641 Explicit definition of language variant alternatives
20642 !! options
20643 language=zh variant=zh-tw
20644 !! wikitext
20645 -{zh:China;zh-tw:Taiwan}-, not China
20646 !! html
20647 <p>Taiwan, not China
20648 </p>
20649 !! end
20650
20651
20652 !! test
20653 Conversion around HTML tags
20654 !! options
20655 language=sr variant=sr-ec
20656 !! wikitext
20657 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
20658 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
20659 !! html
20660 <p>
20661 <span title="ЛаCтин">ски</span>
20662 </p>
20663 !! end
20664
20665
20666 !! test
20667 Explicit session-wise language variant mapping (A flag and - flag)
20668 !! options
20669 language=zh variant=zh-tw
20670 !! wikitext
20671 Taiwan is not China.
20672 But -{A|zh:China;zh-tw:Taiwan}- is China,
20673 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20674 and -{China}- is China.
20675 !! html
20676 <p>Taiwan is not China.
20677 But Taiwan is Taiwan,
20678 (This should be stripped!)
20679 and China is China.
20680 </p>
20681 !! end
20682
20683 !! test
20684 Explicit session-wise language variant mapping (H flag for hide)
20685 !! options
20686 language=zh variant=zh-tw
20687 !! wikitext
20688 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20689 Taiwan is China.
20690 !! html
20691 <p>(This should be stripped!)
20692 Taiwan is Taiwan.
20693 </p>
20694 !! end
20695
20696 !! test
20697 Adding explicit conversion rule for title (T flag)
20698 !! options
20699 language=zh variant=zh-tw showtitle
20700 !! wikitext
20701 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20702 !! html
20703 Taiwan
20704 <p>Should be stripped!
20705 </p>
20706 !! end
20707
20708 !! test
20709 Testing that changing the language variant here in the tests actually works
20710 !! options
20711 language=zh variant=zh showtitle
20712 !! wikitext
20713 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20714 !! html
20715 China
20716 <p>Should be stripped!
20717 </p>
20718 !! end
20719
20720 !! test
20721 Recursive conversion of alt and title attrs shouldn't clear converter state
20722 !! options
20723 language=zh variant=zh-cn showtitle
20724 !! wikitext
20725 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20726 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20727 !! html
20728 China
20729 <p>
20730 Should be stripped<span title="Exclamation">!</span>
20731 </p>
20732 !! end
20733
20734 !! test
20735 T26072: more test on conversion rule for title
20736 !! options
20737 language=zh variant=zh-tw showtitle
20738 !! wikitext
20739 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20740 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20741 !! html
20742 Taiwan
20743 <p>This should be stripped!
20744 This won't take interferes with the title rule.
20745 </p>
20746 !! end
20747
20748 !! test
20749 Partly disable title conversion if variant == main language code
20750 !! options
20751 language=zh variant=zh title=[[ZH]] showtitle
20752 !! wikitext
20753 -{T|zh-cn:CN;zh-tw:TW}-
20754 !! html
20755 ZH
20756 <p>
20757 </p>
20758 !! end
20759
20760 !! test
20761 Partly disable title conversion if variant == main language code, more
20762 !! options
20763 language=zh variant=zh title=[[ZH]] showtitle
20764 !! wikitext
20765 -{T|TW}-
20766 !! html
20767 ZH
20768 <p>
20769 </p>
20770 !! end
20771
20772 !! test
20773 Raw output of variant escape tags (R flag)
20774 !! options
20775 language=zh variant=zh-tw
20776 !! wikitext
20777 Raw: -{R|zh:China;zh-tw:Taiwan}-
20778 !! html
20779 <p>Raw: zh:China;zh-tw:Taiwan
20780 </p>
20781 !! end
20782
20783 !! test
20784 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20785 !! options
20786 language=zh variant=zh-cn
20787 !! input
20788 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20789 !! result
20790 <p>0
20791 </p>
20792 !! end
20793
20794 !! test
20795 Conversion rules from [numeric-only string] to [something else] (T48634)
20796 !! options
20797 language=zh variant=zh-cn
20798 !! input
20799 -{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
20800 !! result
20801 <p>D12345EE12345
20802 </p>
20803 !! end
20804
20805 !! test
20806 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20807 !! options
20808 language=zh variant=zh-cn
20809 !! input
20810 -{H|zh-cn:foo;zh-tw:;}-foobar
20811 !! result
20812 <p>foobar
20813 </p>
20814 !! end
20815
20816 !! test
20817 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20818 !! options
20819 language=zh variant=zh-cn
20820 !! input
20821 -{H|=>zh-cn:foo;}-foobar
20822 !! result
20823 <p>foobar
20824 </p>
20825 !! end
20826
20827 !! test
20828 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20829 !! options
20830 language=zh variant=zh-cn
20831 !! input
20832 -{H|}-foobar
20833 !! result
20834 <p>foobar
20835 </p>
20836 !! end
20837
20838 !! test
20839 Nested using of manual convert syntax
20840 !! options
20841 language=zh variant=zh-hk
20842 !! wikitext
20843 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20844 !! html
20845 <p>Nested: Hello Hong Kong!
20846 </p>
20847 !! end
20848
20849 !! test
20850 HTML markups with conversion syntax in attribs, nested in other conversion blocks
20851 !! options
20852 language=zh variant=zh-cn
20853 !! wikitext
20854 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
20855 !! html
20856 <p><span title="X">A</span>
20857 </p>
20858 !! end
20859
20860 !! test
20861 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet)
20862 !! options
20863 language=zh variant=zh-cn disabled
20864 !! wikitext
20865 -{<span title="-{X}-">A</span>}-
20866 !! html
20867 <p><span title="X">A</span>
20868 </p>
20869 !! end
20870
20871 # Since Parsoid is starting to emit canonical wikitext for links,
20872 # [http://example.com http://example.com] will not RT back to that
20873 # form anymore.
20874 !! test
20875 Proper conversion of text in external links
20876 !! options
20877 language=sr variant=sr-ec
20878 parsoid=wt2html
20879 !! wikitext
20880 http://www.google.com
20881 gopher://www.google.com
20882 [http://www.google.com http://www.google.com]
20883 [gopher://www.google.com gopher://www.google.com]
20884 [https://www.google.com irc://www.google.com]
20885 [ftp://www.google.com www.google.com/ftp://dir]
20886 [//www.google.com www.google.com]
20887 !! html/php
20888 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20889 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20890 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20891 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20892 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20893 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20894 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20895 </p>
20896 !! html/parsoid
20897 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20898 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20899 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20900 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20901 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20902 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20903 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20904 !! end
20905
20906 !! test
20907 Do not convert roman numbers to language variants
20908 !! options
20909 language=sr variant=sr-ec
20910 !! wikitext
20911 Fridrih IV je car.
20912 !! html
20913 <p>Фридрих IV је цар.
20914 </p>
20915 !! end
20916
20917 !! test
20918 Unclosed language converter markup "-{"
20919 !! options
20920 language=sr
20921 !! wikitext
20922 -{T|hello
20923 !! html
20924 <p>-{T|hello
20925 </p>
20926 !! end
20927
20928 !! test
20929 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20930 !! options
20931 language=sr
20932 !! wikitext
20933 -{R|=&gt;}-
20934 !! html
20935 <p>=&gt;
20936 </p>
20937 !!end
20938
20939 !! test
20940 Don't break link parsing if language converter markup is in the caption.
20941 !! options
20942 language=sr variant=sr-ec
20943 !! wikitext
20944 [[Main Page|-{R|main page}-]]
20945 !! html
20946 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20947 </p>
20948 !! end
20949
20950 # FIXME: This test is currently broken in the PHP parser T153761
20951 !! test
20952 T146304: Don't break template parsing if language converter markup is in the parameter.
20953 !! options
20954 language=sr variant=sr-ec
20955 disabled
20956 !! wikitext
20957 {{echo|-{R|foo}-}}
20958 !! html/php
20959 <p>foo
20960 </p>
20961 !! end
20962
20963 !! test
20964 T146305: Don't break image parsing if language converter markup is in the caption.
20965 !! options
20966 language=sr
20967 !! wikitext
20968 [[File:Foobar.jpg|thumb|-{R|caption:}-]]
20969 !! html/php
20970 <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>
20971
20972 !! html/parsoid
20973 <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>
20974 !! end
20975
20976 !! test
20977 T146305: Don't break image parsing if nested language converter markup is in the caption.
20978 !! options
20979 language=zh variant=zh-cn
20980 !! wikitext
20981 [[File:Foobar.jpg|thumb|-{zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
20982 !! html/php
20983 <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>
20984
20985 !! html/parsoid
20986 <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>
20987 !! end
20988
20989 !! test
20990 Don't break gallery if language converter markup is inside.
20991 !! options
20992 language=zh
20993 !! wikitext
20994 <gallery>
20995 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
20996 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
20997 </gallery>
20998 !! html
20999 <ul class="gallery mw-gallery-traditional">
21000 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21001 <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>
21002 <div class="gallerytext">
21003 <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>
21004 </p>
21005 </div>
21006 </div></li>
21007 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21008 <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>
21009 <div class="gallerytext">
21010 <p>This is a test template
21011 </p>
21012 </div>
21013 </div></li>
21014 </ul>
21015
21016 !! end
21017
21018 !! test
21019 T153135: Don't break list handling if language converter markup is in the item.
21020 !! options
21021 language=zh variant=zh-cn
21022 !! wikitext
21023 ;-{zh-cn:AAA;zh-tw:BBB}-
21024 ;-{R|foo:bar}-
21025 !! html/php
21026 <dl><dt>AAA</dt>
21027 <dt>foo:bar</dt></dl>
21028
21029 !! html/parsoid
21030 <dl>
21031 <dt><span typeof="mw:LanguageVariant" data-mw='{"bidir":[{"l":"zh-cn","t":"AAA"},{"l":"zh-tw","t":"BBB"}],"show":true}'></span></dt>
21032 <dt><span typeof="mw:LanguageVariant" data-mw='{"disabled":true,"show":true,"text":"foo:bar"}'></span></dt>
21033 </dl>
21034 !! end
21035
21036 // Note that parsoid does not protect colons unless language converter
21037 // markup is properly nested, because it is a backtracking parser.
21038 !! test
21039 T153135: Unclosed markup in definition list (code coverage)
21040 !! options
21041 language=zh variant=zh-cn
21042 !! wikitext
21043 ;<b>foo:bar
21044 ;-{zh-cn:AAA
21045 !! html/php
21046 <dl><dt><b>foo:bar</dt>
21047 <dt>-{zh-cn:AAA</b></dt></dl>
21048
21049 !! html/parsoid
21050 <dl>
21051 <dt><b>foo:bar</b></dt>
21052 <b>
21053 <dt>-{zh-cn</dt>
21054 <dd>AAA</dd>
21055 </b></dl>
21056 !! end
21057
21058 !! test
21059 T153135: Nested language converter markup in definition list (code coverage)
21060 !! options
21061 language=zh variant=zh-cn
21062 !! wikitext
21063 ;-{zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
21064 !! html/php
21065 <dl><dt>AAA foo:bar bat:baz</dt>
21066 <dd>def</dd></dl>
21067
21068 !! html/parsoid
21069 <dl>
21070 <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>
21071 <dd>def</dd>
21072 </dl>
21073 !! end
21074
21075 !! test
21076 T153140: Don't break table handling if language converter markup is in the cell.
21077 !! options
21078 language=sr variant=sr-ec
21079 !! wikitext
21080 {|
21081 |-
21082 | -{R|B}-
21083 |}
21084 !! html/php
21085 <table>
21086
21087 <tr>
21088 <td> B
21089 </td></tr></table>
21090
21091 !! html/parsoid
21092 <table>
21093
21094 <tr>
21095 <td> B
21096 </td></tr></table>
21097
21098 !! end
21099
21100 !! test
21101 T2529: Uncovered bullet
21102 !! wikitext
21103 * Foo {{bullet}}
21104 !! html
21105 <ul><li> Foo </li>
21106 <li> Bar</li></ul>
21107
21108 !! end
21109
21110 # Plain MediaWiki does not remove empty lists, but tidy actually does.
21111 # Templates in Wikipedia rely on this behavior, as tidy has always been
21112 # enabled there. These tests are normally run *without* tidy, so specify the
21113 # full output here.
21114 # To test realistic parsing behavior, apply a tidy-like transformation to both
21115 # the expected output and your parser's output.
21116 !! test
21117 T2529: Uncovered bullet leaving empty list, normally removed by tidy
21118 !! wikitext
21119 ******* Foo {{bullet}}
21120 !! html
21121 <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>
21122 <li> Bar</li></ul>
21123
21124 !! end
21125
21126 !! test
21127 T2529: Uncovered table already at line-start
21128 !! wikitext
21129 x
21130
21131 {{table}}
21132 y
21133 !! html
21134 <p>x
21135 </p>
21136 <table>
21137 <tr>
21138 <td> 1 </td>
21139 <td> 2
21140 </td></tr>
21141 <tr>
21142 <td> 3 </td>
21143 <td> 4
21144 </td></tr></table>
21145 <p>y
21146 </p>
21147 !! end
21148
21149 !! test
21150 T2529: Uncovered bullet in parser function result
21151 !! wikitext
21152 * Foo {{lc:{{bullet}} }}
21153 !! html
21154 <ul><li> Foo </li>
21155 <li> bar</li></ul>
21156
21157 !! end
21158
21159 !! test
21160 T7678: Double-parsed template argument
21161 !! wikitext
21162 {{lc:{{{1}}}|hello}}
21163 !! html
21164 <p>{{{1}}}
21165 </p>
21166 !! end
21167
21168 !! test
21169 T7678: Double-parsed template invocation
21170 !! wikitext
21171 {{lc:{{paramtest {{!}} param = hello }} }}
21172 !! html
21173 <p>{{paramtest | param = hello }}
21174 </p>
21175 !! end
21176
21177 !! test
21178 Case insensitivity of parser functions for non-ASCII characters (T10143)
21179 !! options
21180 language=cs
21181 title=[[Main Page]]
21182 !! wikitext
21183 {{PRVNÍVELKÉ:ěščř}}
21184 {{prvnívelké:ěščř}}
21185 {{PRVNÍMALÉ:ěščř}}
21186 {{prvnímalé:ěščř}}
21187 {{MALÁ:ěščř}}
21188 {{malá:ěščř}}
21189 {{VELKÁ:ěščř}}
21190 {{velká:ěščř}}
21191 !! html
21192 <p>Ěščř
21193 Ěščř
21194 ěščř
21195 ěščř
21196 ěščř
21197 ěščř
21198 ĚŠČŘ
21199 ĚŠČŘ
21200 </p>
21201 !! end
21202
21203 !! test
21204 Morwen/13: Unclosed link followed by heading
21205 !! wikitext
21206 [[link
21207 ==heading==
21208 !! html
21209 <p>[[link
21210 </p>
21211 <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>
21212
21213 !! end
21214
21215 !! test
21216 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
21217 !! wikitext
21218 {{foo|
21219 =heading=
21220 !! html
21221 <p>{{foo|
21222 </p>
21223 <h1><span class="mw-headline" id="heading">heading</span></h1>
21224
21225 !! end
21226
21227 !! test
21228 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
21229 !! wikitext
21230 {{foo|
21231 ==heading==
21232 !! html
21233 <p>{{foo|
21234 </p>
21235 <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>
21236
21237 !! end
21238
21239 !! test
21240 Tildes in comments
21241 !! options
21242 pst
21243 !! wikitext
21244 <!-- ~~~~ -->
21245 !! html/php
21246 <!-- ~~~~ -->
21247 !! end
21248
21249 !! test
21250 Paragraphs inside divs (no extra line breaks)
21251 !! wikitext
21252 <div>Line one
21253
21254 Line two</div>
21255 !! html
21256 <div>Line one
21257 Line two</div>
21258
21259 !! end
21260
21261 !! test
21262 Paragraphs inside divs (extra line break on open)
21263 !! wikitext
21264 <div>
21265 Line one
21266
21267 Line two</div>
21268 !! html
21269 <div>
21270 <p>Line one
21271 </p>
21272 Line two</div>
21273
21274 !! end
21275
21276 !! test
21277 Paragraphs inside divs (extra line break on close)
21278 !! wikitext
21279 <div>Line one
21280
21281 Line two
21282 </div>
21283 !! html
21284 <div>Line one
21285 <p>Line two
21286 </p>
21287 </div>
21288
21289 !! end
21290
21291 !! test
21292 Paragraphs inside divs (extra line break on open and close)
21293 !! wikitext
21294 <div>
21295 Line one
21296
21297 Line two
21298 </div>
21299 !! html
21300 <div>
21301 <p>Line one
21302 </p><p>Line two
21303 </p>
21304 </div>
21305
21306 !! end
21307
21308 !! test
21309 Nesting tags, paragraphs on lines which begin with <div>
21310 !! wikitext
21311 <div></div><strong>A
21312 B</strong>
21313 !! html/php+tidy
21314 <p><strong>A</strong></p>
21315 <p><strong>B</strong></p>
21316 !! html/parsoid
21317 <div></div>
21318 <p><strong>A
21319 B</strong>
21320 </p>
21321 !! end
21322
21323 # T8200: <blockquote> should behave like <div> with respect to line breaks
21324 !! test
21325 T8200: paragraphs inside blockquotes (no extra line breaks)
21326 !! wikitext
21327 <blockquote>Line one
21328
21329 Line two</blockquote>
21330 !! html
21331 <blockquote>Line one
21332 Line two</blockquote>
21333
21334 !! html+tidy
21335 <blockquote>
21336 <p>Line one Line two</p>
21337 </blockquote>
21338 !! end
21339
21340 !! test
21341 T8200: paragraphs inside blockquotes (extra line break on open)
21342 !! wikitext
21343 <blockquote>
21344 Line one
21345
21346 Line two</blockquote>
21347 !! html
21348 <blockquote>
21349 <p>Line one
21350 </p>
21351 Line two</blockquote>
21352
21353 !! html+tidy
21354 <blockquote>
21355 <p>Line one</p>
21356 Line two</blockquote>
21357 !! end
21358
21359 !! test
21360 T8200: paragraphs inside blockquotes (extra line break on close)
21361 !! wikitext
21362 <blockquote>Line one
21363
21364 Line two
21365 </blockquote>
21366 !! html
21367 <blockquote>Line one
21368 <p>Line two
21369 </p>
21370 </blockquote>
21371
21372 !! html+tidy
21373 <blockquote>
21374 <p>Line one</p>
21375 <p>Line two</p>
21376 </blockquote>
21377 !! end
21378
21379 !! test
21380 T8200: paragraphs inside blockquotes (extra line break on open and close)
21381 !! wikitext
21382 <blockquote>
21383 Line one
21384
21385 Line two
21386 </blockquote>
21387 !! html
21388 <blockquote>
21389 <p>Line one
21390 </p><p>Line two
21391 </p>
21392 </blockquote>
21393
21394 !! html+tidy
21395 <blockquote>
21396 <p>Line one</p>
21397 <p>Line two</p>
21398 </blockquote>
21399 !! end
21400
21401 !! test
21402 Paragraphs inside blockquotes/divs (no extra line breaks)
21403 !! wikitext
21404 <blockquote><div>Line one
21405
21406 Line two</div></blockquote>
21407 !! html
21408 <blockquote><div>Line one
21409 Line two</div></blockquote>
21410
21411 !! end
21412
21413 !! test
21414 Paragraphs inside blockquotes/divs (extra line break on open)
21415 !! wikitext
21416 <blockquote><div>
21417 Line one
21418
21419 Line two</div></blockquote>
21420 !! html
21421 <blockquote><div>
21422 <p>Line one
21423 </p>
21424 Line two</div></blockquote>
21425
21426 !! end
21427
21428 !! test
21429 Paragraphs inside blockquotes/divs (extra line break on close)
21430 !! wikitext
21431 <blockquote><div>Line one
21432
21433 Line two
21434 </div></blockquote>
21435 !! html
21436 <blockquote><div>Line one
21437 <p>Line two
21438 </p>
21439 </div></blockquote>
21440
21441 !! end
21442
21443 !! test
21444 Paragraphs inside blockquotes/divs (extra line break on open and close)
21445 !! wikitext
21446 <blockquote><div>
21447 Line one
21448
21449 Line two
21450 </div></blockquote>
21451 !! html
21452 <blockquote><div>
21453 <p>Line one
21454 </p><p>Line two
21455 </p>
21456 </div></blockquote>
21457
21458 !! end
21459
21460 !! test
21461 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
21462 !! options
21463 wgLinkHolderBatchSize=0
21464 !! wikitext
21465 [[meatball:1]]
21466 [[meatball:2]]
21467 [[meatball:3]]
21468 !! html
21469 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
21470 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
21471 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
21472 </p>
21473 !! end
21474
21475 !! test
21476 Free external link invading image caption
21477 !! wikitext
21478 [[Image:Foobar.jpg|thumb|http://x|hello]]
21479 !! html
21480 <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>
21481
21482 !! end
21483
21484 !! test
21485 T17196: localised external link numbers
21486 !! options
21487 language=fa
21488 !! wikitext
21489 [http://en.wikipedia.org/]
21490 !! html/php
21491 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
21492 </p>
21493 !! html/parsoid
21494 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
21495 !! end
21496
21497 !! test
21498 Multibyte character in padleft
21499 !! wikitext
21500 {{padleft:-Hello|7|Æ}}
21501 !! html
21502 <p>Æ-Hello
21503 </p>
21504 !! end
21505
21506 !! test
21507 Multibyte character in padright
21508 !! wikitext
21509 {{padright:Hello-|7|Æ}}
21510 !! html
21511 <p>Hello-Æ
21512 </p>
21513 !! end
21514
21515 !!test
21516 formatdate parser function
21517 !! wikitext
21518 {{#formatdate:2009-03-24}}
21519 !! html
21520 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
21521 </p>
21522 !! end
21523
21524 !!test
21525 formatdate parser function, with default format
21526 !! wikitext
21527 {{#formatdate:2009-03-24|mdy}}
21528 !! html
21529 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
21530 </p>
21531 !! end
21532
21533 !! test
21534 Spacing of numbers in formatted dates
21535 !! wikitext
21536 {{#formatdate:January 15}}
21537 !! html
21538 <p><span class="mw-formatted-date" title="01-15">January 15</span>
21539 </p>
21540 !! end
21541
21542 !! test
21543 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
21544 !! options
21545 language=nl title=[[MediaWiki:Common.css]]
21546 !! wikitext
21547 {{#formatdate:2009-03-24|dmy}}
21548 !! html
21549 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
21550 </p>
21551 !! end
21552
21553 #
21554 #
21555 #
21556
21557 #
21558 # Edit comments
21559 #
21560
21561 !! test
21562 Edit comment with link
21563 !! options
21564 comment
21565 !! wikitext
21566 I like the [[Main Page]] a lot
21567 !! html/php
21568 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
21569 !!end
21570
21571 !! test
21572 Edit comment with link and link text
21573 !! options
21574 comment
21575 !! wikitext
21576 I like the [[Main Page|best pages]] a lot
21577 !! html/php
21578 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21579 !!end
21580
21581 !! test
21582 Edit comment with link and link text with suffix
21583 !! options
21584 comment
21585 !! wikitext
21586 I like the [[Main Page|best page]]s a lot
21587 !! html/php
21588 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21589 !!end
21590
21591 !! test
21592 Edit comment with section link (non-local, eg in history list)
21593 !! options
21594 comment title=[[Main Page]]
21595 !! wikitext
21596 /* External links */ removed bogus entries
21597 !! html/php
21598 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21599 !!end
21600
21601 !! test
21602 Edit comment with section link and text before it (non-local, eg in history list)
21603 !! options
21604 comment title=[[Main Page]]
21605 !! wikitext
21606 pre-comment text /* External links */ removed bogus entries
21607 !! html/php
21608 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>
21609 !!end
21610
21611 !! test
21612 Edit comment with section link (local, eg in diff view)
21613 !! options
21614 comment local title=[[Main Page]]
21615 !! wikitext
21616 /* External links */ removed bogus entries
21617 !! html/php
21618 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21619 !!end
21620
21621 !! test
21622 Edit comment with subpage link (T16080)
21623 !! options
21624 comment
21625 subpage
21626 title=[[Subpage test]]
21627 !! wikitext
21628 Poked at a [[/subpage]] here...
21629 !! html/php
21630 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
21631 !!end
21632
21633 !! test
21634 Edit comment with subpage link and link text (T16080)
21635 !! options
21636 comment
21637 subpage
21638 title=[[Subpage test]]
21639 !! wikitext
21640 Poked at a [[/subpage|neat little page]] here...
21641 !! html/php
21642 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
21643 !!end
21644
21645 !! test
21646 Edit comment with bogus subpage link in non-subpage NS (T16080)
21647 !! options
21648 comment
21649 title=[[Subpage test]]
21650 !! wikitext
21651 Poked at a [[/subpage]] here...
21652 !! html/php
21653 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...
21654 !!end
21655
21656 !! test
21657 Edit comment with bare anchor link (local, as on diff)
21658 !! options
21659 comment
21660 local
21661 title=[[Main Page]]
21662 !! wikitext
21663 [[#section]]
21664 !! html/php
21665 <a href="#section">#section</a>
21666 !! end
21667
21668 !! test
21669 Edit comment with bare anchor link (non-local, as on history)
21670 !! options
21671 comment
21672 title=[[Main Page]]
21673 !! wikitext
21674 [[#section]]
21675 !! html/php
21676 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
21677 !! end
21678
21679 !! test
21680 Anchor starting with underscore
21681 !! options
21682 title=[[Foo]]
21683 !! wikitext
21684 [[#_ref|One]]
21685 !! html/php
21686 <p><a href="#_ref">One</a>
21687 </p>
21688 !! html/parsoid
21689 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
21690 !! end
21691
21692 !! test
21693 Id starting with underscore
21694 !! wikitext
21695 <div id="_ref"></div>
21696 !! html/*
21697 <div id="_ref"></div>
21698
21699 !! end
21700
21701 !! test
21702 Edit comment with link with more than one pipe (T99346)
21703 !! options
21704 comment
21705 !! wikitext
21706 [[Main Page|Many|pipes]]
21707 !! html/php
21708 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
21709 !! end
21710
21711 !! test
21712 Complex edit comment with link with more than one pipe (T99346)
21713 !! options
21714 comment
21715 !! wikitext
21716 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
21717 !! html/php
21718 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;
21719 !! end
21720
21721 !! test
21722 Space normalisation on autocomment (T24784)
21723 !! options
21724 comment
21725 title=[[Main Page]]
21726 !! wikitext
21727 /* __hello__world__ */
21728 !! html/php
21729 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
21730 !! end
21731
21732 !! test
21733 percent-encoding and + signs in comments (T28410)
21734 !! options
21735 comment
21736 !! wikitext
21737 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
21738 !! html/php
21739 <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>
21740 !! end
21741
21742 # Parsoid doesn't support this yet: see T75581
21743 # but it *should* omit the 'src' attribute if the image is bad.
21744 # PHP side of tests was disabled in
21745 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
21746 # because of issues in the PHP parserTests infrastructure
21747 # (but the output below is indeed what the PHP side emits)
21748 !! test
21749 Bad images - basic functionality
21750 !! wikitext
21751 [[File:Bad.jpg]]
21752 !! DISABLED/html/php
21753 !! html/parsoid
21754 <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>
21755 !! end
21756
21757 !! test
21758 Bad images - T18039: text after bad image disappears
21759 !! wikitext
21760 Foo bar
21761 [[File:Bad.jpg]]
21762 Bar foo
21763 !! DISABLED/html/php
21764 <p>Foo bar
21765 </p><p>Bar foo
21766 </p>
21767 !! html/parsoid
21768 <p>Foo bar
21769 <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>
21770 Bar foo</p>
21771 !! end
21772
21773 !! test
21774 Verify that displaytitle works (T24501) no displaytitle
21775 !! options
21776 showtitle
21777 !! config
21778 wgAllowDisplayTitle=true
21779 wgRestrictDisplayTitle=false
21780 !! wikitext
21781 this is not the the title
21782 !! html/php
21783 Parser test
21784 <p>this is not the the title
21785 </p>
21786 !! end
21787
21788 !! test
21789 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
21790 !! options
21791 showtitle
21792 title=[[Screen]]
21793 !! config
21794 wgAllowDisplayTitle=true
21795 wgRestrictDisplayTitle=false
21796 !! wikitext
21797 this is not the the title
21798 {{DISPLAYTITLE:whatever}}
21799 !! html/php
21800 whatever
21801 <p>this is not the the title
21802 </p>
21803 !! end
21804
21805 !! test
21806 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
21807 !! options
21808 showtitle
21809 title=[[Screen]]
21810 !! config
21811 wgAllowDisplayTitle=true
21812 wgRestrictDisplayTitle=true
21813 !! wikitext
21814 this is not the the title
21815 {{DISPLAYTITLE:whatever}}
21816 !! html/php
21817 Screen
21818 <p>this is not the the title
21819 </p>
21820 !! end
21821
21822 !! test
21823 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
21824 !! options
21825 showtitle
21826 title=[[Screen]]
21827 !! config
21828 wgAllowDisplayTitle=true
21829 wgRestrictDisplayTitle=true
21830 !! wikitext
21831 this is not the the title
21832 {{DISPLAYTITLE:screen}}
21833 !! html/php
21834 screen
21835 <p>this is not the the title
21836 </p>
21837 !! end
21838
21839 !! test
21840 Verify that displaytitle works (T24501) AllowDisplayTitle=false
21841 !! options
21842 showtitle
21843 title=[[Screen]]
21844 !! config
21845 wgAllowDisplayTitle=false
21846 !! wikitext
21847 this is not the the title
21848 {{DISPLAYTITLE:screen}}
21849 !! html/php
21850 Screen
21851 <p>this is not the the title
21852 <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>
21853 </p>
21854 !! end
21855
21856 !! test
21857 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
21858 !! options
21859 showtitle
21860 title=[[Screen]]
21861 !! config
21862 wgAllowDisplayTitle=false
21863 !! wikitext
21864 this is not the the title
21865 !! html/php
21866 Screen
21867 <p>this is not the the title
21868 </p>
21869 !! end
21870
21871 !! test
21872 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
21873 !! options
21874 showtitle
21875 title=[[Screen]]
21876 !! config
21877 wgAllowDisplayTitle=true
21878 wgRestrictDisplayTitle=true
21879 !! wikitext
21880 this is not the the title
21881 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21882 !! html/php
21883 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21884 <p>this is not the the title
21885 </p>
21886 !! end
21887
21888 !! test
21889 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
21890 !! options
21891 showtitle
21892 title=[[Screen]]
21893 !! config
21894 wgAllowDisplayTitle=true
21895 wgRestrictDisplayTitle=true
21896 !! wikitext
21897 this is not the the title
21898 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21899 !! html/php
21900 <span style="color: red;">s</span>creen
21901 <p>this is not the the title
21902 </p>
21903 !! end
21904
21905 !! test
21906 Page status indicators: Empty name is invalid
21907 !! options
21908 showindicators
21909 !! wikitext
21910 <indicator name=" "></indicator>
21911 <indicator></indicator>
21912 !! html/php
21913 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21914 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21915 </p>
21916 !! end
21917
21918 !! test
21919 Page status indicators: Weird syntaxes that are okay
21920 !! options
21921 showindicators
21922 !! wikitext
21923 <indicator name="empty" />
21924 <indicator name="name"></indicator>
21925 !! html/php
21926 empty=
21927 name=
21928 <p><br />
21929 </p>
21930 !! end
21931
21932 !! test
21933 Page status indicators: Torture test
21934 !! options
21935 showindicators
21936 !! wikitext
21937 <indicator name="01">hello world</indicator>
21938 <indicator name="02">[[Main Page]]</indicator>
21939 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21940 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21941 <indicator name="05">* foo
21942 * bar</indicator>
21943 <indicator name="06"><nowiki>foo</nowiki></indicator>
21944 <indicator name="07"> Preformatted</indicator>
21945 <indicator name="08"><div>Broken tag</indicator>
21946 <indicator name="09">{| class=wikitable
21947 | cell
21948 |}</indicator>
21949 <indicator name="10">Two
21950
21951 paragraphs</indicator>
21952 !! html/php
21953 01=hello world
21954 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21955 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" />
21956 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>
21957 05=<ul><li> foo</li>
21958 <li> bar</li></ul>
21959
21960 06=foo
21961 07=<pre>Preformatted
21962 </pre>
21963 08=<div>Broken tag</div>
21964
21965 09=<table class="wikitable">
21966 <tr>
21967 <td> cell
21968 </td></tr></table>
21969
21970 10=<p>Two
21971 </p><p>paragraphs
21972 </p>
21973 <p><br />
21974 </p><p><br />
21975 </p><p><br />
21976 </p><p><br />
21977 </p><p><br />
21978 </p>
21979 !! end
21980
21981 !! test
21982 preload: check <noinclude> and <includeonly>
21983 !! options
21984 preload
21985 !! wikitext
21986 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21987 !! html/php
21988 Hello kind world.
21989 !! end
21990
21991 !! test
21992 preload: check <onlyinclude>
21993 !! options
21994 preload
21995 !! wikitext
21996 Goodbye <onlyinclude>Hello world</onlyinclude>
21997 !! html/php
21998 Hello world
21999 !! end
22000
22001 !! test
22002 preload: can pass tags through if we want to
22003 !! options
22004 preload
22005 !! wikitext
22006 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
22007 !! html/php
22008 <includeonly>Hello world</includeonly>
22009 !! end
22010
22011 !! test
22012 preload: check that it doesn't try to do tricks
22013 !! options
22014 preload
22015 !! wikitext
22016 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
22017 !! html/php
22018 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
22019 !! end
22020
22021 !! test
22022 Play a bit with r67090 and T5158
22023 !! wikitext
22024 <div style="width:50% !important">&nbsp;</div>
22025 <div style="width:50%&nbsp;!important">&nbsp;</div>
22026 <div style="width:50%&#160;!important">&nbsp;</div>
22027 <div style="border : solid;">&nbsp;</div>
22028 !! html/php
22029 <div style="width:50% !important">&#160;</div>
22030 <div style="width:50% !important">&#160;</div>
22031 <div style="width:50% !important">&#160;</div>
22032 <div style="border&#160;: solid;">&#160;</div>
22033
22034 !! html/parsoid
22035 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
22036 <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>
22037 <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>
22038 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
22039
22040 !! end
22041
22042 !! test
22043 HTML5 data attributes
22044 !! wikitext
22045 <span data-foo="bar">Baz</span>
22046 <p data-abc-def_hij="">Quuz</p>
22047 !! html/php
22048 <p><span data-foo="bar">Baz</span>
22049 </p>
22050 <p data-abc-def_hij="">Quuz</p>
22051
22052 !! html/parsoid
22053 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
22054 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
22055 !! end
22056
22057 !! test
22058 Strip reserved data attributes
22059 !! wikitext
22060 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
22061 !! html/php
22062 <div data-ok="fred">d</div>
22063
22064 !! html/parsoid
22065 <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>
22066 !! end
22067
22068 !! test
22069 percent-encoding and + signs in internal links (T28410)
22070 !! wikitext
22071 [[User:+%]] [[Page+title%]]
22072 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
22073 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
22074 [[%33%45]] [[%33%45+]]
22075 !! html/php
22076 <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>
22077 <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>
22078 <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>
22079 <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>
22080 </p>
22081 !! html/parsoid
22082 <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>
22083 <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>
22084 <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>
22085 <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>
22086 !! end
22087
22088 !! test
22089 Special characters in embedded file links (T29679)
22090 !! wikitext
22091 [[File:Contains & ampersand.jpg]]
22092 [[File:Does not exist.jpg|Title with & ampersand]]
22093 !! html/php
22094 <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>
22095 <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>
22096 </p>
22097 !! html/parsoid
22098 <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>
22099 <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>
22100 !! end
22101
22102 !! test
22103 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
22104 !! wikitext
22105 Text&apos;s been normalized?
22106 !! html
22107 <p>Text&#39;s been normalized?
22108 </p>
22109 !! end
22110
22111 !! test
22112 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
22113 !! wikitext
22114 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
22115 !! html
22116 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
22117 </p>
22118 !! end
22119
22120 !! test
22121 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
22122 !! wikitext
22123 [http://www.example.org/ ideograms]
22124 !! html
22125 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
22126 </p>
22127 !! end
22128
22129 !! test
22130 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
22131 !! wikitext
22132 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
22133 !! html
22134 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
22135 </p>
22136 !! end
22137
22138 !! article
22139 Mediawiki:loop1
22140 !! text
22141 {{Identical|A}}
22142 !! endarticle
22143
22144 !! article
22145 Mediawiki:loop2
22146 !! text
22147 {{Identical|B}}
22148 !! endarticle
22149
22150 !! article
22151 Template:Identical
22152 !! text
22153 {{int:loop1}}
22154 {{int:loop2}}
22155 !! endarticle
22156
22157 !! test
22158 T33098 Template which includes system messages which includes the template
22159 !! wikitext
22160 {{Identical}}
22161 !! html
22162 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22163 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22164 </p>
22165 !! end
22166
22167 !! test
22168 T33490 Turkish: ucfirst 'blah'
22169 !! options
22170 language=tr
22171 !! wikitext
22172 {{ucfirst:blah}}
22173 !! html
22174 <p>Blah
22175 </p>
22176 !! end
22177
22178 !! test
22179 T33490 Turkish: ucfirst 'ix'
22180 !! options
22181 language=tr
22182 !! wikitext
22183 {{ucfirst:ix}}
22184 !! html
22185 <p>İx
22186 </p>
22187 !! end
22188
22189 !! test
22190 T33490 Turkish: lcfirst 'BLAH'
22191 !! options
22192 language=tr
22193 !! wikitext
22194 {{lcfirst:BLAH}}
22195 !! html
22196 <p>bLAH
22197 </p>
22198 !! end
22199
22200 !! test
22201 T33490 Turkish: ucfırst (with a dotless i)
22202 !! options
22203 language=tr
22204 !! wikitext
22205 {{ucfırst:blah}}
22206 !! html
22207 <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>
22208 </p>
22209 !! end
22210
22211 !! test
22212 T33490 ucfırst (with a dotless i) with English language
22213 !! options
22214 language=en
22215 !! wikitext
22216 {{ucfırst:blah}}
22217 !! html
22218 <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>
22219 </p>
22220 !! end
22221
22222 !! test
22223 T28375: TOC with italics
22224 !! options
22225 title=[[Main Page]]
22226 !! wikitext
22227 __TOC__
22228 == ''Lost'' episodes ==
22229 !! html
22230 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22231 <ul>
22232 <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>
22233 </ul>
22234 </div>
22235
22236 <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>
22237
22238 !! end
22239
22240 !! test
22241 T28375: TOC with bold
22242 !! options
22243 title=[[Main Page]]
22244 !! wikitext
22245 __TOC__
22246 == '''should be bold''' then normal text ==
22247 !! html
22248 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22249 <ul>
22250 <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>
22251 </ul>
22252 </div>
22253
22254 <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>
22255
22256 !! end
22257
22258 !! test
22259 T35845: Headings become cursive in TOC when they contain an image
22260 !! options
22261 title=[[Main Page]]
22262 !! wikitext
22263 __TOC__
22264 == Image [[Image:foobar.jpg]] ==
22265 !! html
22266 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22267 <ul>
22268 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
22269 </ul>
22270 </div>
22271
22272 <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>
22273
22274 !! end
22275
22276 !! test
22277 T35845 (2): Headings become bold in TOC when they contain a blockquote
22278 !! options
22279 title=[[Main Page]]
22280 !! wikitext
22281 __TOC__
22282 == <blockquote>Quote</blockquote> ==
22283 !! html
22284 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22285 <ul>
22286 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22287 </ul>
22288 </div>
22289
22290 <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>
22291
22292 !! html+tidy
22293 <p></p>
22294 <div id="toc" class="toc">
22295 <div id="toctitle" class="toctitle">
22296 <h2>Contents</h2>
22297 </div>
22298 <ul>
22299 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22300 </ul>
22301 </div>
22302 <p></p>
22303 <h2><span class="mw-headline" id="Quote"></span></h2>
22304 <blockquote>
22305 <p><span class="mw-headline" id="Quote">Quote</span></p>
22306 </blockquote>
22307 <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>
22308 !! end
22309
22310 !! test
22311 Unclosed tags in TOC
22312 !! options
22313 title=[[Main Page]]
22314 !! wikitext
22315 __TOC__
22316 == Proof: 2 < 3 ==
22317 <small>Hanc marginis exiguitas non caperet.</small>
22318 QED
22319 !! html
22320 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22321 <ul>
22322 <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>
22323 </ul>
22324 </div>
22325
22326 <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>
22327 <p><small>Hanc marginis exiguitas non caperet.</small>
22328 QED
22329 </p>
22330 !! end
22331
22332 !! test
22333 Multiple tags in TOC
22334 !! wikitext
22335 __TOC__
22336 == <i>Foo</i> <b>Bar</b> ==
22337
22338 == <i>Foo</i> <blockquote>Bar</blockquote> ==
22339 !! html
22340 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22341 <ul>
22342 <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>
22343 <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>
22344 </ul>
22345 </div>
22346
22347 <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>
22348 <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>
22349
22350 !! html+tidy
22351 <p></p>
22352 <div id="toc" class="toc">
22353 <div id="toctitle" class="toctitle">
22354 <h2>Contents</h2>
22355 </div>
22356 <ul>
22357 <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>
22358 <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>
22359 </ul>
22360 </div>
22361 <p></p>
22362 <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>
22363 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
22364 <blockquote>
22365 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
22366 </blockquote>
22367 <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>
22368 !! end
22369
22370 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
22371 # html5 tag parsing.
22372 !! test
22373 Tags with parameters in TOC
22374 !! options
22375 parsoid=wt2html
22376 !! wikitext
22377 __TOC__
22378 == <sup class="in-h2">Hello</sup> ==
22379
22380 == <sup class="a > b">Evilbye</sup> ==
22381 !! html/php
22382 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22383 <ul>
22384 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
22385 <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>
22386 </ul>
22387 </div>
22388
22389 <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>
22390 <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>
22391
22392 !! html/parsoid
22393 <meta property="mw:PageProp/toc" />
22394 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
22395
22396 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
22397 !! end
22398
22399 !! test
22400 span tags with directionality in TOC
22401 !! wikitext
22402 __TOC__
22403 == <span dir="ltr">C++</span> ==
22404
22405 == <span dir="rtl">זבנג!</span> ==
22406
22407 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
22408
22409 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
22410
22411 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
22412 !! html
22413 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22414 <ul>
22415 <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>
22416 <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>
22417 <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>
22418 <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>
22419 <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>
22420 </ul>
22421 </div>
22422
22423 <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>
22424 <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>
22425 <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>
22426 <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>
22427 <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>
22428
22429 !! end
22430
22431 !! test
22432 T74884: bdi element in ToC
22433 !! wikitext
22434 __TOC__
22435 == <bdi>test</bdi> ==
22436 !! html
22437 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22438 <ul>
22439 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
22440 </ul>
22441 </div>
22442
22443 <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>
22444
22445 !! end
22446
22447 !! test
22448 T35715: s/strike element in ToC
22449 !! wikitext
22450 __TOC__
22451 == <s>test</s> test <strike>test</strike> ==
22452 !! html
22453 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22454 <ul>
22455 <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>
22456 </ul>
22457 </div>
22458
22459 <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>
22460
22461 !! end
22462
22463 # Note that the html output does not have the <p></p>, but the
22464 # html+tidy output *does*. This is because the empty <p></p> is
22465 # removed by the sanitizer, but only when tidy is *not* enabled (!).
22466 !! test
22467 Empty <p> tag in TOC, removed by Sanitizer (T92892)
22468 !! wikitext
22469 __TOC__
22470 == x ==
22471 !! html
22472 <div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
22473 <ul>
22474 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22475 </ul>
22476 </div>
22477
22478 <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>
22479
22480 !! html+tidy
22481 <p></p>
22482 <div id="toc" class="toc">
22483 <div id="toctitle" class="toctitle">
22484 <h2>Contents</h2>
22485 </div>
22486 <ul>
22487 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22488 </ul>
22489 </div>
22490 <p></p>
22491 <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>
22492 !! end
22493
22494 !! article
22495 MediaWiki:T34057
22496 !! text
22497 == {{int:headline_sample}} ==
22498 !! endarticle
22499
22500 !! test
22501 T34057: Title needed when expanding <h> nodes.
22502 !! options
22503 title=[[Main Page]]
22504 !! wikitext
22505 {{int:T34057}}
22506 !! html
22507 <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>
22508
22509 !! end
22510
22511 !! test
22512 Strip marker in urlencode
22513 !! wikitext
22514 {{urlencode:x<nowiki/>y}}
22515 {{urlencode:x<nowiki/>y|wiki}}
22516 {{urlencode:x<nowiki/>y|path}}
22517 {{urlencode:x<pre id="one">two</pre>y}}
22518 !! html/php
22519 <p>xy
22520 xy
22521 xy
22522 xy
22523 </p>
22524 !! end
22525
22526 !! test
22527 Strip marker in lc
22528 !! wikitext
22529 {{lc:x<nowiki/>y}}
22530 !! html
22531 <p>xy
22532 </p>
22533 !! end
22534
22535 !! test
22536 Strip marker in uc
22537 !! wikitext
22538 {{uc:x<nowiki/>y}}
22539 !! html
22540 <p>XY
22541 </p>
22542 !! end
22543
22544 !! test
22545 Strip marker in formatNum
22546 !! wikitext
22547 {{formatnum:1<nowiki/>2}}
22548 {{formatnum:1<nowiki/>2|R}}
22549 !! html
22550 <p>12
22551 12
22552 </p>
22553 !! end
22554
22555 !! test
22556 Check noCommafy in formatNum
22557 !! options
22558 language=be-tarask
22559 !! wikitext
22560 {{formatnum:123456.78}}
22561 {{formatnum:123456.78|NOSEP}}
22562 !! html
22563 <p>123 456,78
22564 123456.78
22565 </p>
22566 !! end
22567
22568 !! test
22569 Wrong option for formatNum (T58199)
22570 !! wikitext
22571 {{formatnum:1,234.56|Random}}
22572 {{formatnum:1,234.56|EVERYTHING}}
22573 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
22574 !! html
22575 <p>1,234.56
22576 1,234.56
22577 1,234.56
22578 </p>
22579 !! end
22580
22581 !! test
22582 Strip marker in grammar
22583 !! options
22584 language=fi
22585 !! wikitext
22586 {{grammar:elative|foo<nowiki/>bar}}
22587 !! html
22588 <p>foobarista
22589 </p>
22590 !! end
22591
22592 !! test
22593 Strip marker in padleft
22594 !! wikitext
22595 {{padleft:|2|x<nowiki/>y}}
22596 !! html
22597 <p>xy
22598 </p>
22599 !! end
22600
22601 !! test
22602 Strip marker in padright
22603 !! wikitext
22604 {{padright:|2|x<nowiki/>y}}
22605 !! html
22606 <p>xy
22607 </p>
22608 !! end
22609
22610 !! test
22611 Strip marker in anchorencode
22612 !! wikitext
22613 {{anchorencode:x<nowiki/>y}}
22614 !! html
22615 <p>xy
22616 </p>
22617 !! end
22618
22619 !! test
22620 nowiki inside link inside heading (T20295)
22621 !! wikitext
22622 ==[[foo|x<nowiki>y</nowiki>z]]==
22623 !! html
22624 <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>
22625
22626 !! end
22627
22628 !! test
22629 new support for bdi element (T33817)
22630 !! wikitext
22631 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22632 !! html
22633 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22634
22635 !!end
22636
22637 !! test
22638 Ignore pipe between table row attributes
22639 !! wikitext
22640 {|
22641 | quux
22642 |- id=foo | style='color: red'
22643 | bar
22644 |}
22645 !! html
22646 <table>
22647 <tr>
22648 <td> quux
22649 </td></tr>
22650 <tr id="foo" style="color: red">
22651 <td> bar
22652 </td></tr></table>
22653
22654 !! end
22655
22656 !!test
22657 Language parser function
22658 !! wikitext
22659 {{#language:ar}}
22660 !! html
22661 <p>العربية
22662 </p>
22663 !! end
22664
22665 !!test
22666 Padleft and padright as substr
22667 !! wikitext
22668 {{padleft:|3|abcde}}
22669 {{padright:|3|abcde}}
22670 !! html
22671 <p>abc
22672 abc
22673 </p>
22674 !! end
22675
22676 !!test
22677 Special parser function
22678 !! wikitext
22679 {{#special:RandomPage}}
22680 {{#special:BaDtItLe}}
22681 {{#special:Foobar}}
22682 !! html
22683 <p>Special:Random
22684 Special:Badtitle
22685 Special:Foobar
22686 </p>
22687 !! end
22688
22689 !!test
22690 T36939 - Case insensitive link parsing ([HttP://])
22691 !! wikitext
22692 [HttP://MediaWiki.Org/]
22693 !! html/php
22694 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
22695 </p>
22696 !! html/parsoid
22697 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
22698 !! end
22699
22700 !!test
22701 T36939 - Case insensitive link parsing ([HttP:// title])
22702 !! wikitext
22703 [HttP://MediaWiki.Org/ MediaWiki]
22704 !! html
22705 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22706 </p>
22707 !! end
22708
22709 !!test
22710 T36939 - Case insensitive link parsing (HttP://)
22711 !! wikitext
22712 HttP://MediaWiki.Org/
22713 !! html/php
22714 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22715 </p>
22716 !! html/parsoid
22717 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22718 !! end
22719
22720 !!test
22721 Disable TOC
22722 !! options
22723 notoc
22724 !! wikitext
22725 Lead
22726 == Section 1 ==
22727 == Section 2 ==
22728 == Section 3 ==
22729 == Section 4 ==
22730 == Section 5 ==
22731 !! html
22732 <p>Lead
22733 </p>
22734
22735 <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>
22736 <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>
22737 <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>
22738 <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>
22739 <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>
22740
22741 !! end
22742
22743
22744 ###
22745 ### Parsoid-specific tests
22746 ### Parsoid-PHP parser incompatibilities
22747 ###
22748 !!test
22749 1. SOL-sensitive wikitext tokens as template-args
22750 !!options
22751 parsoid=wt2html,wt2wt
22752 !! wikitext
22753 {{echo|*a}}
22754 {{echo|#a}}
22755 {{echo|:a}}
22756 !! html
22757 <span about="#mwt1" typeof="mw:Transclusion">
22758 </span><ul about="#mwt1"><li>a</li>
22759 </ul>
22760 <span about="#mwt2" typeof="mw:Transclusion">
22761 </span><ol about="#mwt2"><li>a</li>
22762 </ol>
22763 <span about="#mwt3" typeof="mw:Transclusion">
22764 </span><dl about="#mwt3"><dd>a</dd>
22765 </dl>
22766 !!end
22767
22768 #### -----------------------------------------------------------------
22769 #### Parsoid-specific functionality tests
22770 #### -----------------------------------------------------------------
22771
22772 # T65642/T68749: Formatting elt fixup around images is cleaned up.
22773 # We know wt2wt will fail, but we expect selser to pass.
22774 # Due to the nature of our testing, wt2wt and selser tests will enter the
22775 # blacklist and we'll catch selser regressions based on changes to the
22776 # blacklist entries for selser tests.
22777 !! test
22778 1. Bad treebuilder fixup of formatting elt is cleaned up
22779 !! options
22780 parsoid=wt2html,wt2wt
22781 !! wikitext
22782 {|
22783 |
22784 <small>
22785 [[Image:Foobar.jpg|right|Test]]
22786 </small>
22787 |}
22788 !! html/parsoid
22789 <table>
22790 <tbody><tr><td>
22791 <small>
22792 <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>
22793 </small>
22794 </td></tr>
22795 </tbody></table>
22796 !! end
22797
22798 !! test
22799 2. Bad treebuilder fixup of formatting elt is cleaned up
22800 !! options
22801 parsoid=wt2html,wt2wt
22802 !! wikitext
22803 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22804
22805 <small>[[Image:Foobar.jpg|right|300px]]</small>
22806 !! html/parsoid
22807
22808 <p><b>foo</b></p>
22809 <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>
22810 <p><b>bar</b></p>
22811 <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>
22812 !! end
22813
22814 !! test
22815 3. Bad treebuilder fixup of formatting elt is cleaned up
22816 !! options
22817 parsoid=wt2html,wt2wt
22818 !! wikitext
22819 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22820 !! html/parsoid
22821 <p><small><b>foo</b></small></p>
22822 <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>
22823 <p><small><b>bar</b></small></p>
22824 !! end
22825
22826 !! test
22827 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22828 !! options
22829 parsoid=wt2html,wt2wt
22830 !! wikitext
22831 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22832 !! html/parsoid
22833 <p><b><small></small></b></p>
22834 <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>
22835 <p></p>
22836 !! end
22837
22838 #### ----------------------------------------------------------------
22839 #### Parsoid-only testing of Parsoid's impl of LST
22840 #### Not implemented yet, see
22841 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22842 #### ----------------------------------------------------------------
22843
22844 ## We still need to support serializing the older format while content is stored.
22845 !! test
22846 LST Sections: Backwards compatibility
22847 !! options
22848 parsoid={
22849 "suppressErrors": true,
22850 "modes": ["html2wt"]
22851 }
22852 !! wikitext
22853 <section begin="2011-05-16" />
22854 <section end="2014-04-10 (MW 1.23wmf22)" />
22855 !! html/parsoid
22856 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22857 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22858 !! end
22859
22860 ## The unconventional output is the result of `usePHPPreProcessor` being
22861 ## disabled in parserTests.js. This test is mainly just to show <section> is
22862 ## recognized as an extension tag w/o a native handler.
22863 !! test
22864 LST Sections: Newfangled approach
22865 !! wikitext
22866 <section begin="2011-05-16" />
22867 <section end="2014-04-10 (MW 1.23wmf22)" />
22868 !! html/parsoid
22869 <p><span typeof="mw:Error mw:Extension/section" about="#mwt1" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null,"errors":[{"key":"mw-api-extexpand-error","message":"Could not expand extension source."}]}'>&lt;section begin="2011-05-16" /></span>
22870 <span typeof="mw:Error mw:Extension/section" about="#mwt2" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null,"errors":[{"key":"mw-api-extexpand-error","message":"Could not expand extension source."}]}'>&lt;section end="2014-04-10 (MW 1.23wmf22)" /></span></p>
22871 !! end
22872
22873 #--------- Test stripping of empty nodes in template content ----------
22874 !!test
22875 Empty LI and TR nodes should be stripped from template content
22876 !!wikitext
22877 {{EmptyLITest}}
22878 {{EmptyTRTest}}
22879 !!html/parsoid
22880 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22881 <li>a</li>
22882 <li>b</li>
22883 </ul>
22884 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22885 <tbody>
22886 <tr>
22887 <td>foo</td>
22888 </tr>
22889 <tr>
22890 <td>bar</td>
22891 </tr>
22892 </tbody>
22893 </table>
22894 !!end
22895
22896 !!test
22897 Empty LI and TR nodes should not be stripped from top-level content
22898 !!wikitext
22899 * a
22900 *
22901 * b
22902 {|
22903 |-
22904 |-
22905 |foo
22906 |}
22907 !!html/parsoid
22908 <ul>
22909 <li> a</li>
22910 <li></li>
22911 <li> b</li>
22912 </ul>
22913 <table>
22914 <tbody>
22915 <tr></tr>
22916 <tr>
22917 <td>foo</td>
22918 </tr>
22919 </tbody>
22920 </table>
22921 !!end
22922
22923 !!test
22924 Empty TR nodes should not be stripped if they have any attributes set
22925 !!wikitext
22926 {{EmptyTRWithHTMLAttrTest}}
22927 !!html/parsoid
22928 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22929 <tr align="center"></tr>
22930 <tr><td>foo</td></tr>
22931 <tr align="center"></tr>
22932 <tr><td>bar</td></tr>
22933 </table>
22934 !!end
22935
22936 #### ----------------------------------------------------------------
22937 #### The following section of tests are primarily to test
22938 #### wikitext escaping capabilities of Parsoid. Given that
22939 #### escaping can be done any number of ways, the wikitext (input)
22940 #### is always adjusted to reflect how Parsoid adds nowiki
22941 #### escape tags.
22942 ####
22943 #### We are marking several tests as parsoid-only since the
22944 #### HTML in the result section is different from what the
22945 #### PHP parser generates for it.
22946 #### ----------------------------------------------------------------
22947
22948
22949 #### --------------- Headings ---------------
22950 #### 0. Unnested
22951 #### 1. Nested inside html <h1>=foo=</h1>
22952 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22953 #### 3. Nested inside html with wikitext split by html tags
22954 #### 4. No escape needed
22955 #### 5. Empty headings <h1></h1>
22956 #### 6. Heading chars in SOL context
22957 #### ----------------------------------------
22958 !! test
22959 Headings: 0. Unnested
22960 !! options
22961 parsoid=html2wt
22962 !! html/parsoid
22963 <p>=foo=</p>
22964
22965 <p> =foo=
22966 <!--cmt-->
22967 =foo=</p>
22968
22969 <p>=foo<i>a</i>=</p>
22970 !! wikitext
22971 <nowiki>=foo=</nowiki>
22972
22973 <nowiki> </nowiki>=foo=
22974 <!--cmt-->
22975 <nowiki>=foo=</nowiki>
22976
22977 =foo''a''<nowiki>=</nowiki>
22978 !!end
22979
22980 # New headings and existing headings are handled differently
22981 !! test
22982 Headings: 1. Nested inside html
22983 !! options
22984 parsoid=html2wt
22985 !! html/parsoid
22986 <h1>=foo=</h1>
22987 <h2>=foo=</h2>
22988 <h3>=foo=</h3>
22989
22990 <h1 data-parsoid=''>=foo=</h1>
22991 <h2 data-parsoid=''>=foo=</h2>
22992 <h3 data-parsoid=''>=foo=</h3>
22993 <h4 data-parsoid=''>=foo=</h4>
22994 <h5 data-parsoid=''>=foo=</h5>
22995 <h6 data-parsoid=''>=foo=</h6>
22996 !! wikitext
22997 = =foo= =
22998
22999 == =foo= ==
23000
23001 === =foo= ===
23002
23003 =<nowiki>=foo=</nowiki>=
23004 ==<nowiki>=foo=</nowiki>==
23005 ===<nowiki>=foo=</nowiki>===
23006 ====<nowiki>=foo=</nowiki>====
23007 =====<nowiki>=foo=</nowiki>=====
23008 ======<nowiki>=foo=</nowiki>======
23009
23010 !!end
23011
23012 !! test
23013 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
23014 !! options
23015 parsoid=html2wt
23016 !! html/parsoid
23017 <h1>foo</h1>*bar
23018 <h1>foo</h1>=bar
23019 <h1>foo</h1>=bar=
23020 !! wikitext
23021 = foo =
23022 <nowiki>*</nowiki>bar
23023
23024 = foo =
23025 =bar
23026
23027 = foo =
23028 <nowiki>=bar=</nowiki>
23029 !!end
23030
23031 !! test
23032 Headings: 3. Nested inside html with wikitext split by html tags
23033 !! options
23034 parsoid=html2wt
23035 !! html/parsoid
23036 <h1>=<b>bold</b>foo=</h1>
23037 !! wikitext
23038 = ='''bold'''foo= =
23039 !!end
23040
23041 !! test
23042 Headings: 4a. No escaping needed (testing just h1 and h2)
23043 !! options
23044 parsoid=html2wt
23045 !! html/parsoid
23046 <h1>=foo</h1>
23047 <h1>foo=</h1>
23048 <h1> =foo= </h1>
23049 <h1>=foo= bar</h1>
23050 <h2>=foo</h2>
23051 <h2>foo=</h2>
23052 <h1>=</h1>
23053 <h1><i>=</i>foo=</h1>
23054 !! wikitext
23055 = =foo =
23056
23057 = foo= =
23058
23059 = =foo= =
23060
23061 = =foo= bar =
23062
23063 == =foo ==
23064
23065 == foo= ==
23066
23067 = = =
23068
23069 = ''=''foo= =
23070 !!end
23071
23072 !! test
23073 Headings: 4b. No escaping needed (inside p-tags)
23074 !! options
23075 parsoid=html2wt
23076 !! html/parsoid
23077 <p>===
23078 =foo= x
23079 =foo= <s></s>
23080 </p>
23081 !! wikitext
23082 ===
23083 =foo= x
23084 =foo= <s></s>
23085 !!end
23086
23087 !! test
23088 Headings: 5. Empty headings
23089 !! options
23090 parsoid=html2wt
23091 !! html/parsoid
23092 <h1 data-parsoid='{}'></h1>
23093
23094 <h2 data-parsoid='{}'></h2>
23095
23096 <h3 data-parsoid='{}'></h3>
23097
23098 <h4 data-parsoid='{}'></h4>
23099
23100 <h5 data-parsoid='{}'></h5>
23101
23102 <h6 data-parsoid='{}'></h6>
23103 !! wikitext
23104 =<nowiki/>=
23105
23106 ==<nowiki/>==
23107
23108 ===<nowiki/>===
23109
23110 ====<nowiki/>====
23111
23112 =====<nowiki/>=====
23113
23114 ======<nowiki/>======
23115 !!end
23116
23117 !! test
23118 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23119 !! options
23120 parsoid=html2wt
23121 !! html/parsoid
23122 <p>=a=</p>
23123
23124 <p>=a=</p>
23125
23126 <p>=a=</p>
23127 !! wikitext
23128 <nowiki>=a=</nowiki>
23129
23130 <nowiki>=a=</nowiki>
23131
23132 <nowiki>=a=</nowiki>
23133 !!end
23134
23135 !! test
23136 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23137 !! options
23138 parsoid=html2wt
23139 !! html/parsoid
23140 <p>=a=
23141 b</p>
23142
23143 <p>=a=
23144 b</p>
23145
23146 <p>=a=
23147 b</p>
23148 !! wikitext
23149 <nowiki>=a=</nowiki>
23150 b
23151
23152 <nowiki>=a=</nowiki>
23153 b
23154
23155 <nowiki>=a=</nowiki>
23156 b
23157 !!end
23158
23159 !! test
23160 Headings: 6c. Heading chars in SOL context (leading newline break)
23161 !! options
23162 parsoid=html2wt
23163 !! html/parsoid
23164 <p>a
23165 =b=</p>
23166 !! wikitext
23167 a
23168 <nowiki>=b=</nowiki>
23169 !!end
23170
23171 !! test
23172 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23173 !! options
23174 parsoid=html2wt
23175 !! html/parsoid
23176 <!--c0--><p>=a=</p>
23177
23178 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23179 !! wikitext
23180 <!--c0--><nowiki>=a=</nowiki>
23181
23182 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23183 !!end
23184
23185 !! test
23186 Headings: 6d. Heading chars in SOL context (No escaping needed)
23187 !! options
23188 parsoid=html2wt
23189 !! html/parsoid
23190 =a=<div>b</div>
23191 !! wikitext
23192 =a=<div>b</div>
23193 !!end
23194
23195 !! test
23196 Headings: 7. Insert a newline between new content and headings
23197 !! options
23198 parsoid=html2wt
23199 !! html/parsoid
23200 <h2>NEW</h2>
23201 <p>new</p>
23202 <h2 data-parsoid='{}'>A</h2>
23203 <p data-parsoid='{}'>a</p>
23204 !! wikitext
23205 == NEW ==
23206 new
23207
23208 ==A==
23209 a
23210
23211 !! end
23212
23213 #### --------------- Lists ---------------
23214 #### 0. Outside nests (*foo, etc.)
23215 #### 1. Nested inside html <ul><li>*foo</li></ul>
23216 #### 2. Inside definition lists
23217 #### 3. Only bullets at start should be escaped
23218 #### 4. No escapes needed
23219 #### 5. No unnecessary escapes
23220 #### 6. Escape bullets in SOL position
23221 #### 7. Escape bullets in a multi-line context
23222 #### ----------------------------------------
23223
23224 !! test
23225 Lists: 0. Outside nests
23226 !! options
23227 parsoid=html2wt
23228 !! html/parsoid
23229 <p>*foo</p>
23230
23231 <p>#foo</p>
23232
23233 <p>;Foo:bar</p>
23234 !! wikitext
23235 <nowiki>*</nowiki>foo
23236
23237 <nowiki>#</nowiki>foo
23238
23239 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23240 !!end
23241
23242 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23243 ## to test wikitext escaping, and insignificant whitespace diffs
23244 ## cause PHP parser tests to barf
23245 !! test
23246 Lists: 1. Nested inside html (No unnecessary escapes)
23247 !! options
23248 parsoid=html2wt
23249 !! html/parsoid
23250 <ul>
23251 <li>*foo</li>
23252 <li>#foo</li>
23253 <li>:foo</li>
23254 <li>;foo</li>
23255 <li data-parsoid='{}'>*foo</li>
23256 <li data-parsoid='{}'>#foo</li>
23257 <li data-parsoid='{}'>:foo</li>
23258 <li data-parsoid='{}'>;foo</li>
23259 </ul>
23260
23261 <ol>
23262 <li>*foo</li>
23263 <li>#foo</li>
23264 <li>:foo</li>
23265 <li>;foo</li>
23266 <li data-parsoid='{}'>*foo</li>
23267 <li data-parsoid='{}'>#foo</li>
23268 <li data-parsoid='{}'>:foo</li>
23269 <li data-parsoid='{}'>;foo</li>
23270 </ol>
23271 !! wikitext
23272 * *foo
23273 * #foo
23274 * :foo
23275 * ;foo
23276 *<nowiki>*foo</nowiki>
23277 *<nowiki>#foo</nowiki>
23278 *<nowiki>:foo</nowiki>
23279 *<nowiki>;foo</nowiki>
23280
23281 # *foo
23282 # #foo
23283 # :foo
23284 # ;foo
23285 #<nowiki>*foo</nowiki>
23286 #<nowiki>#foo</nowiki>
23287 #<nowiki>:foo</nowiki>
23288 #<nowiki>;foo</nowiki>
23289 !!end
23290
23291 !! test
23292 Lists: 2. Inside definition lists
23293 !! options
23294 parsoid=html2wt
23295 !! html/parsoid
23296 <dl><dt>;foo</dt></dl>
23297 <dl><dt>:foo</dt></dl>
23298 <dl><dt>:foo</dt>
23299 <dd>bar</dd></dl>
23300 <dl><dd>:foo</dd></dl>
23301 !! wikitext
23302 ; ;foo
23303
23304 ; <nowiki>:foo</nowiki>
23305
23306 ; <nowiki>:foo</nowiki>
23307 : bar
23308
23309 : :foo
23310 !!end
23311
23312 !! test
23313 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23314 !! options
23315 parsoid=html2wt
23316 !! html/parsoid
23317 <ul>
23318 <li>*foo*bar</li>
23319 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23320 </ul>
23321 !! wikitext
23322 * *foo*bar
23323 *<nowiki>*foo</nowiki>''it''*bar
23324 !!end
23325
23326 !! test
23327 Lists: 4. No escapes needed
23328 !! options
23329 parsoid=html2wt
23330 !! html/parsoid
23331 <ul>
23332 <li>foo*bar
23333 </li>
23334 </ul>
23335 <ul>
23336 <li><i>foo</i>*bar
23337 </li>
23338 </ul>
23339 <ul>
23340 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23341 </li>
23342 </ul>
23343 <ul>
23344 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23345 </li>
23346 </ul>
23347 !! wikitext
23348 *foo*bar
23349
23350 *''foo''*bar
23351
23352 *[[Foo]]: bar
23353
23354 *[[Foo]]*bar
23355 !!end
23356
23357 !! test
23358 Lists: 5. No unnecessary escapes
23359 !! options
23360 parsoid=html2wt
23361 !! html/parsoid
23362 <ul><li> bar <span>[[foo]]</span></li></ul>
23363 <ul><li> =bar <span>[[foo]]</span></li></ul>
23364 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23365 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23366 <ul><li> =bar <span>foo]]</span>=</li></ul>
23367 <ul><li> <s></s>: a</li></ul>
23368 <ul><li> <i>* foo</i></li></ul>
23369
23370 !! wikitext
23371 * bar <span><nowiki>[[foo]]</nowiki></span>
23372
23373 * =bar <span><nowiki>[[foo]]</nowiki></span>
23374
23375 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23376
23377 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23378
23379 * =bar <span>foo]]</span>=
23380
23381 * <s></s>: a
23382
23383 * ''* foo''
23384 !!end
23385
23386 !! test
23387 Lists: 6. Escape bullets in SOL position
23388 !! options
23389 parsoid=html2wt
23390 !! html/parsoid
23391 <p><!--cmt-->*foo</p>
23392 !! wikitext
23393 <!--cmt--><nowiki>*</nowiki>foo
23394 !!end
23395
23396 !! test
23397 Lists: 7. Escape bullets in a multi-line context
23398 !! options
23399 parsoid=html2wt
23400 !! html/parsoid
23401 <p>a
23402 *b
23403 </p>
23404 !! wikitext
23405 a
23406 <nowiki>*</nowiki>b
23407 !!end
23408
23409 !! test
23410 Lists: 8. Escape colons only if not present in tags
23411 !! options
23412 parsoid=html2wt
23413 !! html/parsoid
23414 <dl><dt>a:b<i>c:d</i></dt></dl>
23415 !! wikitext
23416 ; <nowiki>a:b</nowiki>''c:d''
23417 !! end
23418
23419 #### --------------- HRs ---------------
23420 #### 1. Single line
23421 #### -----------------------------------
23422
23423 !! test
23424 HRs: 1. Single line
23425 !! options
23426 parsoid=html2wt
23427 !! html/parsoid
23428 <hr />----
23429 <hr />=foo=
23430 <hr />*foo
23431 !! wikitext
23432 ----<nowiki>----</nowiki>
23433 ----=foo=
23434 ----*foo
23435 !! end
23436
23437 #### --------------- Tables ---------------
23438 #### 1a. Simple example
23439 #### 1b. No escaping needed (!foo)
23440 #### 1c. No escaping needed (|foo)
23441 #### 1d. No escaping needed (|}foo)
23442 ####
23443 #### 2a. Nested in td (<td>foo|bar</td>)
23444 #### 2b. Nested in td (<td>foo||bar</td>)
23445 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23446 ####
23447 #### 3a. Nested in th (<th>foo!bar</th>)
23448 #### 3b. Nested in th (<th>foo!!bar</th>)
23449 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23450 ####
23451 #### 4a. Escape -
23452 #### 4b. Escape +
23453 #### 4c. No escaping needed
23454 #### --------------------------------------
23455
23456 !! test
23457 Tables: 1a. Simple example
23458 !! options
23459 parsoid=html2wt
23460 !! html/parsoid
23461 <p>{|
23462 |}
23463 </p>
23464 !! wikitext
23465 <nowiki>{|</nowiki>
23466 |}
23467 !! end
23468
23469 !! test
23470 Tables: 1b. No escaping needed
23471 !! options
23472 parsoid=html2wt
23473 !! html/parsoid
23474 <p>!foo
23475 </p>
23476 !! wikitext
23477 !foo
23478 !! end
23479
23480 !! test
23481 Tables: 1c. No escaping needed
23482 !! options
23483 parsoid=html2wt
23484 !! html/parsoid
23485 <p>|foo
23486 </p>
23487 !! wikitext
23488 |foo
23489 !! end
23490
23491 !! test
23492 Tables: 1d. No escaping needed
23493 !! options
23494 parsoid=html2wt
23495 !! html/parsoid
23496 <p>|}foo
23497 </p>
23498 !! wikitext
23499 |}foo
23500 !! end
23501
23502 !! test
23503 Tables: 2a. Nested in td
23504 !! options
23505 parsoid=html2wt
23506 !! html/parsoid
23507 <table><tbody><tr>
23508 <td>foo|bar</td></tr>
23509 <tr><td>x<div>a|b</div></td>
23510 </tbody></table>
23511 !! wikitext
23512 {|
23513 |<nowiki>foo|bar</nowiki>
23514 |-
23515 |x<div><nowiki>a|b</nowiki></div>
23516 |}
23517 !! html/php+tidy
23518 <table>
23519 <tr>
23520 <td>foo|bar</td>
23521 </tr>
23522 <tr>
23523 <td>x
23524 <div>a|b</div>
23525 </td>
23526 </tr>
23527 </table>
23528 !! end
23529
23530 !! test
23531 Tables: 2b. Nested in td
23532 !! options
23533 parsoid=html2wt
23534 !! html/parsoid
23535 <table><tbody><tr>
23536 <td>foo||bar</td>
23537 <td>a<i>b||c</i></td>
23538 <td>a<i><div>b||c</div></i></td>
23539 </tr></tbody></table>
23540 !! wikitext
23541 {|
23542 |<nowiki>foo||bar</nowiki>
23543 |a''<nowiki>b||c</nowiki>''
23544 |a''<div><nowiki>b||c</nowiki></div>''
23545 |}
23546 !! html/php
23547 <table>
23548 <tr>
23549 <td>foo||bar
23550 </td>
23551 <td>a<i>b||c</i>
23552 </td>
23553 <td>a<i><div>b||c</div></i>
23554 </td></tr></table>
23555
23556 !! end
23557
23558 !! test
23559 Tables: 2c. Nested in td -- no escaping needed
23560 !! options
23561 parsoid=html2wt
23562 !! html/*
23563 <table>
23564 <tr>
23565 <td>foo!!bar
23566 </td></tr></table>
23567
23568 !! wikitext
23569 {|
23570 |foo!!bar
23571 |}
23572 !! end
23573
23574 !! test
23575 Tables: 3a. Nested in th
23576 !! options
23577 parsoid=html2wt
23578 !! html/*
23579 <table>
23580 <tr>
23581 <th>foo!bar
23582 </th></tr></table>
23583
23584 !! wikitext
23585 {|
23586 !foo!bar
23587 |}
23588 !! end
23589
23590 !! test
23591 Tables: 3b. Nested in th
23592 !! options
23593 parsoid=html2wt
23594 !! html/parsoid
23595 <table><tbody>
23596 <tr><th>foo!!bar</th>
23597 <th><i>foo|bar</i></th>
23598 <th><i>foo!!bar</i></th>
23599 <th><i><span>foo!!bar</span></i></th>
23600 </tr></tbody></table>
23601 !! wikitext
23602 {|
23603 !<nowiki>foo!!bar</nowiki>
23604 !''<nowiki>foo|bar</nowiki>''
23605 !''<nowiki>foo!!bar</nowiki>''
23606 !''<span><nowiki>foo!!bar</nowiki></span>''
23607 |}
23608 !! html/php
23609 <table>
23610 <tr>
23611 <th>foo!!bar
23612 </th>
23613 <th><i>foo|bar</i>
23614 </th>
23615 <th><i>foo!!bar</i>
23616 </th>
23617 <th><i><span>foo!!bar</span></i>
23618 </th></tr></table>
23619
23620 !! end
23621
23622 !! test
23623 Tables: 3c. Nested in th
23624 !! options
23625 parsoid=html2wt
23626 !! html/parsoid
23627 <table><tbody>
23628 <tr><th>foo||bar</th>
23629 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23630 </tr></tbody></table>
23631 !! wikitext
23632 {|
23633 !<nowiki>foo||bar</nowiki>
23634 !<nowiki>foo||bar</nowiki>
23635 |}
23636 !! html/php
23637 <table>
23638 <tr>
23639 <th>foo||bar
23640 </th>
23641 <th>foo||bar
23642 </th></tr></table>
23643
23644 !! end
23645
23646 !! test
23647 Tables: 4a. Escape -
23648 !! options
23649 parsoid=html2wt
23650 !! html/*
23651 <table>
23652 <tr>
23653 <th>-bar
23654 </th></tr>
23655 <tr>
23656 <td>-bar
23657 </td></tr></table>
23658
23659 !! wikitext
23660 {|
23661 !-bar
23662 |-
23663 |<nowiki>-bar</nowiki>
23664 |}
23665 !! end
23666
23667 !! test
23668 Tables: 4b. Escape +
23669 !! options
23670 parsoid=html2wt
23671 !! html/*
23672 <table>
23673 <tr>
23674 <th>+bar
23675 </th></tr>
23676 <tr>
23677 <td>+bar
23678 </td></tr></table>
23679
23680 !! wikitext
23681 {|
23682 !+bar
23683 |-
23684 |<nowiki>+bar</nowiki>
23685 |}
23686 !! end
23687
23688 !! test
23689 Tables: 4c. No escaping needed
23690 !! options
23691 parsoid=html2wt
23692 !! html/parsoid
23693 <table><tbody>
23694 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23695 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23696 <tr><td>foo
23697 <p>bar|baz
23698 +bar
23699 -bar</p></td></tr>
23700 <tr><td>x
23701 <div>a|b</div></td>
23702 </tbody></table>
23703 !! wikitext
23704 {|
23705 |foo-bar
23706 |foo+bar
23707 |-
23708 |''foo''-bar
23709 |''foo''+bar
23710 |-
23711 |foo
23712 bar|baz
23713 +bar
23714 -bar
23715 |-
23716 |x
23717 <div>a|b</div>
23718 |}
23719 !! html/php
23720 <table>
23721 <tr>
23722 <td>foo-bar
23723 </td>
23724 <td>foo+bar
23725 </td></tr>
23726 <tr>
23727 <td><i>foo</i>-bar
23728 </td>
23729 <td><i>foo</i>+bar
23730 </td></tr>
23731 <tr>
23732 <td>foo
23733 <p>bar|baz
23734 +bar
23735 -bar
23736 </p>
23737 </td></tr>
23738 <tr>
23739 <td>x
23740 <div>a|b</div>
23741 </td></tr></table>
23742
23743 !! end
23744
23745 !! test
23746 Tables: 4d. No escaping needed
23747 !! options
23748 parsoid=html2wt
23749 !! html/parsoid
23750 <table>
23751 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23752 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23753 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23754 </tbody></table>
23755 !! wikitext
23756 {|
23757 |[[Foo]]-bar
23758 ||+1
23759 ||-2
23760 |}
23761 !! html/php
23762 <table>
23763 <tr>
23764 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23765 </td>
23766 <td>+1
23767 </td>
23768 <td>-2
23769 </td></tr></table>
23770
23771 !! end
23772
23773 !! test
23774 T97430: Don't emit empty nowiki pairs around marker meta tags
23775 !! options
23776 parsoid=html2wt
23777 !! html/parsoid
23778 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23779 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23780 !! wikitext
23781 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23782 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23783 !! end
23784
23785 !! test
23786 Unclosed xmlish element in table line shouldn't eat end delimiters
23787 !! options
23788 parsoid=html2wt
23789 !! html/parsoid
23790 <table>
23791 <tbody><tr><td> &lt;foo</td>
23792 <td> bar></td></tr>
23793 </tbody></table>
23794 !! wikitext
23795 {|
23796 | <foo
23797 | bar>
23798 |}
23799 !! html/php
23800 <table>
23801 <tr>
23802 <td> &lt;foo
23803 </td>
23804 <td> bar&gt;
23805 </td></tr></table>
23806
23807 !! end
23808
23809 #### --------------- Links ----------------
23810 #### 1. Quote marks in link text
23811 #### 2. Wikilinks: Escapes needed
23812 #### 3. Wikilinks: No escapes needed
23813 #### 4. Extlinks: Escapes needed
23814 #### 5. Extlinks: No escapes needed
23815 #### --------------------------------------
23816 !! test
23817 Links 1. WikiLinks: No escapes needed
23818 !! options
23819 parsoid=html2wt
23820 !! html/parsoid
23821 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23822 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23823 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23824 !! wikitext
23825 [[Foo|Foo''boo'']]
23826 [[Foo|[Foobar]]]
23827 [[Foo|x [Foobar] x]]
23828 !! html/php
23829 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23830 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23831 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23832 </p>
23833 !! end
23834
23835 !! test
23836 Links 2. WikiLinks: Escapes needed
23837 !! options
23838 parsoid=html2wt
23839 !! html/parsoid
23840 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23841 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23842 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23843 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23844 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23845 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23846 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23847 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23848 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23849 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23850 !! wikitext
23851 [[Foo|<nowiki>Foobar]</nowiki>]]
23852 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23853 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23854 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23855 [[Foo|<nowiki>|Bar</nowiki>]]
23856 [[Foo|<nowiki>]]bar</nowiki>]]
23857 [[Foo|<nowiki>[[bar</nowiki>]]
23858 [[Foo|<nowiki>x [[ y</nowiki>]]
23859 [[Foo|<nowiki>x ]] y</nowiki>]]
23860 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23861 !! html/php
23862 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23863 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23864 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23865 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23866 <a href="/wiki/Foo" title="Foo">|Bar</a>
23867 <a href="/wiki/Foo" title="Foo">]]bar</a>
23868 <a href="/wiki/Foo" title="Foo">[[bar</a>
23869 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23870 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23871 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23872 </p>
23873 !! end
23874
23875 !! test
23876 Links 3. WikiLinks: No escapes needed
23877 !! options
23878 parsoid=html2wt
23879 !! html/parsoid
23880 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23881 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23882 !! wikitext
23883 [[Foo|[Foobar]]
23884 [[Foo|foo|bar]]
23885 !! html/php
23886 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23887 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23888 </p>
23889 !! end
23890
23891 !! test
23892 Links 4. ExtLinks: Escapes needed
23893 !! options
23894 parsoid=html2wt
23895 !! html/parsoid
23896 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23897 <a rel="mw:ExtLink" href="http://google.com">google]</a>
23898 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
23899 <p>[http://google.com]</p>
23900 <p>[http://google.com google]</p>
23901 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23902 <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>
23903 !! wikitext
23904 [http://google.com <nowiki>[google]</nowiki>]
23905 [http://google.com <nowiki>google]</nowiki>]
23906 [http://google.com <nowiki>goog] le</nowiki>]
23907
23908 <nowiki>[http://google.com]</nowiki>
23909
23910 <nowiki>[http://google.com google]</nowiki>
23911
23912 [http://google.com<nowiki>]</nowiki>
23913
23914 [{{echo|http://google.com}}<nowiki>]</nowiki>
23915 !! html/php
23916 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23917 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23918 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
23919 </p><p>[http://google.com]
23920 </p><p>[http://google.com google]
23921 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23922 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23923 </p>
23924 !! end
23925
23926 !! test
23927 Links 5. ExtLinks: No escapes needed
23928 !! options
23929 parsoid=html2wt
23930 !! html/parsoid
23931 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23932 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23933 !! wikitext
23934 [http://google.com [google]
23935
23936 [[http://google.com]]
23937 !! html/php
23938 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23939 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23940 </p>
23941 !! end
23942
23943 !! test
23944 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
23945 !! options
23946 parsoid=html2wt
23947 !! html/parsoid
23948 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23949 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23950 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23951 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23952 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23953 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23954 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23955 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23956 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23957 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23958 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23959 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23960 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23961 </p>
23962 !! wikitext
23963 x<nowiki/>http://example.com<nowiki/>y
23964 http://example.com<nowiki/>?x
23965 http://example.com<nowiki/>&x
23966 http://example.com<nowiki/>'x
23967 http://example.com<nowiki/>,x
23968 http://example.com<nowiki/>.x
23969 http://example.com<nowiki/>;x
23970 http://example.com<nowiki/>:x
23971 http://example.com<nowiki/>;x
23972 http://example.com<nowiki/>!x
23973 http://example.com<nowiki/>=x
23974 http://example.com<nowiki/>(x)
23975 http://example.com(x<nowiki/>)
23976 !! end
23977
23978 !! test
23979 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
23980 !! options
23981 parsoid=html2wt
23982 !! html/parsoid
23983 <p>x
23984 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23985 y
23986 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23987 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23988 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23989 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23990 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23991 </p>
23992 !! wikitext
23993 x
23994 http://example.com
23995 y
23996 "http://example.com"
23997 (http://example.com)
23998 (http://example.com) foo
23999 http://example.com,
24000 http://example.com, foo
24001 !! html/php
24002 <p>x
24003 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
24004 y
24005 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
24006 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
24007 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
24008 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
24009 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
24010 </p>
24011 !! end
24012
24013 !! test
24014 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
24015 !! options
24016 parsoid=html2wt
24017 !! html/parsoid
24018 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
24019 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
24020 !! wikitext
24021 http://example.com.,;:!?\
24022 -http://example.com:
24023 !! html/php
24024 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
24025 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
24026 </p>
24027 !! end
24028
24029 !! test
24030 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
24031 !! options
24032 parsoid=html2wt
24033 !! html/parsoid
24034 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
24035 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
24036 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
24037 !! wikitext
24038 RFC 123<nowiki/>4
24039 RFC 123<nowiki/>y
24040 X<nowiki/>RFC 123<nowiki/>y
24041 !! end
24042
24043 !! test
24044 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
24045 !! options
24046 parsoid=html2wt
24047 !! html/parsoid
24048 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24049 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24050 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24051 </p>
24052 !! wikitext
24053 RFC 123?foo
24054 RFC 123&foo
24055 -RFC 123-
24056 !! html/php
24057 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24058 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24059 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24060 </p>
24061 !! end
24062
24063 !! test
24064 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
24065 !! options
24066 parsoid=html2wt
24067 !! html/parsoid
24068 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24069 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24070 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24071 !! wikitext
24072 PMID 123<nowiki/>4
24073 PMID 123<nowiki/>y
24074 X<nowiki/>PMID 123<nowiki/>y
24075 !! end
24076
24077 !! test
24078 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
24079 !! options
24080 parsoid=html2wt
24081 !! html/parsoid
24082 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24083 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24084 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24085 </p>
24086 !! wikitext
24087 PMID 123?foo
24088 PMID 123&foo
24089 -PMID 123-
24090 !! html/php
24091 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24092 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24093 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24094 </p>
24095 !! end
24096
24097 !! test
24098 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
24099 !! options
24100 parsoid=html2wt
24101 !! html/parsoid
24102 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24103 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24104 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24105 </p>
24106 !! wikitext
24107 ISBN 1234567890<nowiki/>1
24108 ISBN 1234567890<nowiki/>x
24109 a<nowiki/>ISBN 1234567890<nowiki/>b
24110 !! end
24111
24112 !! test
24113 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
24114 !! options
24115 parsoid=html2wt
24116 !! html/parsoid
24117 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24118 !! wikitext
24119 -ISBN 1234567890's
24120 !! html/php
24121 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24122 </p>
24123 !! end
24124
24125 !! test
24126 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24127 !! options
24128 parsoid=html2wt
24129 !! html/*
24130 <p>this is not a link: http://example.com
24131 </p>
24132 !! wikitext
24133 this is not a link: <nowiki>http://example.com</nowiki>
24134 !! end
24135
24136 !! test
24137 Links 15. Link trails can't become link prefixes.
24138 !! options
24139 language=is
24140 parsoid=html2wt
24141 !! html/parsoid
24142 <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>
24143 !! wikitext
24144 [[Söfnuður]]-[[00]]
24145 !! html/php
24146 <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>
24147 </p>
24148 !! end
24149
24150 #### --------------- Quotes ---------------
24151 #### 1. Quotes inside <b> and <i>
24152 #### 2. Link fragments separated by <i> and <b> tags
24153 #### 3. Link fragments inside <i> and <b>
24154 #### 4. No escaping needed
24155 #### --------------------------------------
24156 !! test
24157 1a. Quotes inside <b> and <i>
24158 !! options
24159 parsoid=html2wt
24160 !! html/*
24161 <p><i>'foo'</i>
24162 <i>''foo''</i>
24163 <i>'''foo'''</i>
24164 <i>foo</i>'s
24165 <b>'foo'</b>
24166 <b>''foo''</b>
24167 <b>'''foo'''</b>
24168 <b>foo'<i>bar'</i>baz</b>
24169 <b>foo</b>'s
24170 '<i>foo</i>
24171 <i>foo</i>'
24172 <i>foo'</i>'
24173 '<i>foo</i>'
24174 '<b>foo</b>
24175 <b>foo</b>'
24176 '<b>foo</b>'
24177 <i>fools'<span> errand</span></i>
24178 <i><span>fool</span>'s errand</i>
24179 '<i>foo</i> bar '<i>baz</i>
24180 a|!*#-:;+-~[]{}b'<i>x</i>
24181 </p>
24182 !! wikitext
24183 ''<nowiki/>'foo'''
24184 ''<nowiki>''foo''</nowiki>''
24185 ''<nowiki>'''foo'''</nowiki>''
24186 ''foo''<nowiki/>'s
24187 '''<nowiki/>'foo''''
24188 '''<nowiki>''foo''</nowiki>'''
24189 '''<nowiki>'''foo'''</nowiki>'''
24190 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24191 '''foo'''<nowiki/>'s
24192 '''foo''
24193 ''foo''<nowiki/>'
24194 ''foo'''<nowiki/>'
24195 '''foo''<nowiki/>'
24196 ''''foo'''
24197 '''foo'''<nowiki/>'
24198 ''''foo'''<nowiki/>'
24199 ''fools'<span> errand</span>''
24200 ''<span>fool</span>'s errand''
24201 '<nowiki/>''foo'' bar '''baz''
24202 a|!*#-:;+-~[]{}b'''x''
24203 !! end
24204
24205 !! test
24206 1b. Quotes inside <b> and <i> with other tags on same line
24207 !! options
24208 parsoid=html2wt
24209 !! html/parsoid
24210 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24211 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24212 <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>
24213 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24214 '<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>
24215 '<i>foo</i> <div title="name">test</div>
24216 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24217 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24218 <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>
24219 </ol>
24220 !! wikitext
24221 '''a'' foo ''[[bar]]''
24222 ''a''' foo ''[[bar]]''
24223 ''a''' foo '''{{echo|[[bar]]}}'''
24224 [[foo]] x'''[[bar]]''
24225 '''foo'' <ref>test</ref>
24226 '''foo'' <div title="name">test</div>
24227 '''foo'' and <br> bar
24228 <references />
24229 !! end
24230
24231 !! test
24232 2. Link fragments separated by <i> and <b> tags
24233 !! options
24234 parsoid=html2wt
24235 !! html/parsoid
24236 <p>[[<i>foo</i>hello]]</p>
24237 <p>[[<b>foo</b>hello]]</p>
24238 !! wikitext
24239 [[''foo''<nowiki>hello]]</nowiki>
24240
24241 [['''foo'''<nowiki>hello]]</nowiki>
24242 !! end
24243
24244 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24245 # this is one of the shortcomings of this format
24246 !! test
24247 3. Link fragments inside <i> and <b>
24248 !! options
24249 parsoid=html2wt
24250 !! html/parsoid
24251 <p><i>[[foo</i>]]</p>
24252 <p><b>[[foo</b>]]</p>
24253 !! wikitext
24254 ''[[foo''<nowiki>]]</nowiki>
24255
24256 '''[[foo'''<nowiki>]]</nowiki>
24257 !! end
24258
24259 !! test
24260 4. No escaping needed
24261 !! options
24262 parsoid=html2wt
24263 !! html/parsoid
24264 <p>'<span><i>bar</i></span>'
24265 '<span><b>bar</b></span>'
24266 'a:b'foo
24267 </p>
24268 !! wikitext
24269 '<span>''bar''</span>'
24270 '<span>'''bar'''</span>'
24271 'a:b'foo
24272 !! end
24273
24274 #### ----------- Paragraphs ---------------
24275 #### 1. No unnecessary escapes
24276 #### --------------------------------------
24277
24278 !! test
24279 1. No unnecessary escapes
24280 !! options
24281 parsoid=html2wt
24282 !! html/parsoid
24283 <p>bar <span>[[foo]]</span>
24284 </p><p>=bar <span>[[foo]]</span>
24285 </p><p>[[bar <span>[[foo]]</span>
24286 </p><p>]]bar <span>[[foo]]</span>
24287 </p><p>=bar <span>foo]]</span>=
24288 </p>
24289 !! wikitext
24290 bar <span><nowiki>[[foo]]</nowiki></span>
24291
24292 =bar <span><nowiki>[[foo]]</nowiki></span>
24293
24294 [[bar <span><nowiki>[[foo]]</nowiki></span>
24295
24296 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24297
24298 =bar <span>foo]]</span><nowiki>=</nowiki>
24299 !!end
24300
24301 #### ----------------------- PRE --------------------------
24302 #### 1. Leading whitespace in SOL context should be escaped
24303 #### ------------------------------------------------------
24304 !! test
24305 1. Leading whitespace in SOL context should be escaped
24306 !! options
24307 parsoid=html2wt
24308 !! html/parsoid
24309 <p> a</p>
24310
24311 <p> a</p>
24312
24313 <p> a(tab)</p>
24314
24315 <p> a
24316 <!--cmt-->
24317 a</p>
24318
24319 <p>a
24320 b</p>
24321
24322 <p>a
24323 b</p>
24324
24325 <p>a
24326 b</p>
24327 !! wikitext
24328 <nowiki> </nowiki>a
24329
24330 <nowiki> </nowiki> a
24331
24332 a(tab)
24333
24334 <nowiki> </nowiki> a
24335 <!--cmt-->
24336 <nowiki> </nowiki>a
24337
24338 a
24339 <nowiki> </nowiki>b
24340
24341 a
24342 b
24343
24344 a
24345 b
24346 !! html/php
24347 <p> a
24348 </p><p> a
24349 </p><p> a(tab)
24350 </p><p> a
24351 a
24352 </p><p>a
24353 b
24354 </p><p>a
24355 b
24356 </p><p>a
24357 b
24358 </p>
24359 !! end
24360
24361 !! test
24362 2. Leading whitespace in non-indent-pre contexts should not be escaped
24363 !! options
24364 parsoid=html2wt
24365 !! html/parsoid
24366 <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>
24367 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24368 <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>
24369 b</span></li>
24370 </ol>
24371 !! wikitext
24372 foo <ref>''a''
24373 b</ref>
24374 <references />
24375 !! end
24376
24377 !! test
24378 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24379 !! options
24380 parsoid=html2wt
24381 !! html/parsoid
24382 <blockquote>
24383 <p>
24384 a
24385 <span>b</span>
24386 c</p>
24387 </blockquote>
24388 !! wikitext
24389 <blockquote>
24390 a
24391 <span>b</span>
24392 c
24393 </blockquote>
24394 !! end
24395
24396 !! test
24397 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24398 !! options
24399 parsoid=html2wt
24400 !! html/parsoid
24401 <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>
24402 !! wikitext
24403 [[File:Foobar.jpg|thumb|caption]]
24404 !! end
24405
24406 !! test
24407 5. Nowiki escaping should account for indent-pres
24408 !! options
24409 parsoid=html2wt
24410 !! html/parsoid
24411 <pre>==foo==</pre>
24412 !! wikitext
24413 ==foo==
24414 !! end
24415
24416 !!test
24417 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24418 !! options
24419 parsoid=html2wt
24420 !! html/parsoid
24421 <pre>
24422 * foo
24423 * bar
24424 </pre>
24425 !! wikitext
24426 * foo
24427 * bar
24428 !! end
24429
24430 #### --------------- Behavior Switches --------------------
24431
24432 !! test
24433 1. Valid behavior switches should be escaped
24434 !! options
24435 parsoid=html2wt
24436 !! html/parsoid
24437 __TOC__
24438 <i>__TOC__</i>
24439 !! wikitext
24440 <nowiki>__TOC__</nowiki>
24441 ''<nowiki>__TOC__</nowiki>''
24442 !! end
24443
24444 !! test
24445 2. Invalid behavior switches should not be escaped
24446 !! options
24447 parsoid=html2wt
24448 !! html/parsoid
24449 __TOO__
24450 __|__
24451 !! wikitext
24452 __TOO__
24453 __|__
24454 !! end
24455
24456 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24457 !! test
24458 Behavior switches should be SOL-transparent
24459 !! options
24460 parsoid=html2wt
24461 !! html/parsoid
24462 <meta property="mw:PageProp/toc" />
24463
24464 <!-- this one's bogus -->
24465 <pre>__TOO__</pre>
24466
24467 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24468
24469 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24470 !! wikitext
24471 __TOC__
24472
24473 <!-- this one's bogus -->
24474 __TOO__
24475
24476 __TOC__ foo
24477
24478 __TOC__
24479 bar
24480 !! end
24481
24482 #### --------------- HTML tags ---------------
24483 #### 1. a tags
24484 #### 2. other tags
24485 #### 3. multi-line html tag
24486 #### 4. extension tags
24487 #### -----------------------------------------
24488 !! test
24489 1. a tags
24490 !! options
24491 parsoid=html2wt
24492 !! html/parsoid
24493 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24494 !! wikitext
24495 <a href="http://google.com">google</a>
24496 !! end
24497
24498 !! test
24499 2. other tags
24500 !! options
24501 parsoid=html2wt
24502 !! html/parsoid
24503 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24504 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24505 <li> &lt;td&gt;</li></ul>
24506
24507 !! wikitext
24508 * <nowiki><div>foo</div></nowiki>
24509 * <nowiki><div style="color:red">foo</div></nowiki>
24510 * <nowiki><td></nowiki>
24511 !! end
24512
24513 !! test
24514 3. multi-line html tag
24515 !! options
24516 parsoid=html2wt
24517 !! html/parsoid
24518 <p>&lt;div
24519 &gt;foo&lt;/div
24520 &gt;
24521 </p>
24522 !! wikitext
24523 <nowiki><div
24524 >foo</div
24525 ></nowiki>
24526 !! end
24527
24528 !! test
24529 4. extension tags
24530 !! options
24531 parsoid=html2wt
24532 !! html/parsoid
24533 <p>&lt;ref&gt;foo&lt;/ref&gt;
24534 </p><p>&lt;ref&gt;bar
24535 </p><p>baz&lt;/ref&gt;
24536 </p>
24537 !! wikitext
24538 <nowiki><ref>foo</ref></nowiki>
24539
24540 <nowiki><ref>bar</nowiki>
24541
24542 baz<nowiki></ref></nowiki>
24543 !! end
24544
24545 #### --------------- Others ---------------
24546 !! test
24547 Escaping nowikis
24548 !! options
24549 parsoid=html2wt
24550 !! html/parsoid
24551 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24552 </p>
24553 !! wikitext
24554 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24555 !! end
24556
24557 ## The quote-char in the input is necessary for triggering the bug
24558 !! test
24559 (T54035) Nowiki-escaping should not get tripped by " :" in text
24560 !! options
24561 parsoid=html2wt
24562 !! html/parsoid
24563 <p>foo's bar :</p>
24564 !! wikitext
24565 foo's bar :
24566 !! end
24567
24568 #----------- End of wikitext escaping tests --------------
24569
24570 !! test
24571
24572 Tag-like HTML structures are passed through as text
24573 !! wikitext
24574 <x y>
24575
24576 <x.y>
24577
24578 <x-y>
24579
24580 1>2
24581
24582 x<y
24583
24584 a>b
24585
24586 1<d e>f
24587 !! html
24588 <p>&lt;x y&gt;
24589 </p><p>&lt;x.y&gt;
24590 </p><p>&lt;x-y&gt;
24591 </p><p>1&gt;2
24592 </p><p>x&lt;y
24593 </p><p>a&gt;b
24594 </p><p>1&lt;d e&gt;f
24595 </p>
24596 !! end
24597
24598 !! test
24599 HTML tag with necessary entities in attributes
24600 !! wikitext
24601 <span title="&amp;amp;">foo</span>
24602 !! html
24603 <p><span title="&amp;amp;">foo</span>
24604 </p>
24605 !! end
24606
24607 !! test
24608 HTML tag with 'unnecessary' entity encoding in attributes
24609 !! wikitext
24610 <span title="&amp;">foo</span>
24611 !! html
24612 <p><span title="&amp;">foo</span>
24613 </p>
24614 !! end
24615
24616 !! test
24617 HTML tag with broken attribute value quoting
24618 !! options
24619 parsoid=wt2html,html2html
24620 !! wikitext
24621 <span title="Hello world>Foo</span>
24622 !! html/php
24623 <p><span title="Hello world">Foo</span>
24624 </p>
24625 !! html/parsoid
24626 <p><span title="Hello world">Foo</span></p>
24627 !! end
24628
24629 !! test
24630 Self-closed tag with broken attribute value quoting
24631 !! options
24632 parsoid=wt2html,html2html
24633 !! wikitext
24634 <div title="Hello world />Foo
24635 !! html/php+tidy
24636 <div title="Hello world"></div>
24637 <p>Foo</p>
24638 !! html/parsoid
24639 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24640 !! end
24641
24642 !! test
24643 Table with broken attribute value quoting
24644 !! options
24645 parsoid=wt2html,html2html
24646 !! wikitext
24647 {|
24648 | title="Hello world|Foo
24649 |}
24650 !! html/php
24651 <table>
24652 <tr>
24653 <td title="Hello world">Foo
24654 </td></tr></table>
24655
24656 !! html/parsoid
24657 <table>
24658 <tr>
24659 <td title="Hello world">Foo
24660 </td></tr></table>
24661
24662 !! end
24663
24664 !! test
24665 Table with broken attribute value quoting on consecutive lines
24666 !! options
24667 parsoid=wt2html,html2html
24668 !! wikitext
24669 {|
24670 | title="Hello world|Foo
24671 | style="color:red|Bar
24672 |}
24673 !! html/php
24674 <table>
24675 <tr>
24676 <td title="Hello world">Foo
24677 </td>
24678 <td style="color:red">Bar
24679 </td></tr></table>
24680
24681 !! html/parsoid
24682 <table><tbody>
24683 <tr>
24684 <td title="Hello world">Foo
24685 </td><td style="color: red">Bar
24686 </td></tr></tbody></table>
24687
24688 !! end
24689
24690 !!test
24691 Accept empty td cell attribute
24692 !! wikitext
24693 {|
24694 | align="center" | foo || |
24695 |}
24696 !! html
24697 <table>
24698 <tr>
24699 <td align="center"> foo </td>
24700 <td>
24701 </td></tr></table>
24702
24703 !!end
24704
24705 !!test
24706 Non-empty attributes in th-cells
24707 !! wikitext
24708 {|
24709 ! Foo !! style="color: red" | Bar
24710 |}
24711 !! html
24712 <table>
24713 <tr>
24714 <th> Foo </th>
24715 <th style="color: red"> Bar
24716 </th></tr></table>
24717
24718 !!end
24719
24720 !!test
24721 Accept empty attributes in th-cells
24722 !! wikitext
24723 {|
24724 !| foo !!| bar
24725 |}
24726 !! html
24727 <table>
24728 <tr>
24729 <th> foo </th>
24730 <th> bar
24731 </th></tr></table>
24732
24733 !!end
24734
24735 !!test
24736 Empty table rows go away
24737 !! wikitext
24738 {|
24739 | Hello
24740 | there
24741 |- class="foo"
24742 |-
24743 |}
24744 !! html
24745 <table>
24746 <tr>
24747 <td> Hello
24748 </td>
24749 <td> there
24750 </td></tr>
24751
24752 </table>
24753
24754 !! end
24755
24756 ###
24757 ### Parsoid-centric tests for testing RTing of inter-element separators
24758 ### Edge cases not tested by existing parser tests and specific to
24759 ### Parsoid-specific serialization strategies.
24760 ###
24761
24762 !!test
24763 RT-ed inter-element separators should be valid separators
24764 !! wikitext
24765 {|
24766 |- [[foo]]
24767 |}
24768 !! html/php
24769 <table>
24770
24771 </table>
24772
24773 !! html/parsoid
24774 <table>
24775 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24776 </tbody></table>
24777 !!end
24778
24779 # Parsoid-only since PHP parser relies on Tidy for correct output
24780 !!test
24781 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24782 !!options
24783 parsoid
24784 !! wikitext
24785 {|
24786 |<small>foo
24787 bar
24788 |}
24789
24790 {|
24791 |<small>foo<small>
24792 |}
24793 !! html
24794 <table>
24795 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24796 <p>bar</p></small></td></tr>
24797 </tbody></table>
24798
24799 <table>
24800 <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>
24801 </tbody></table>
24802 !!end
24803
24804 # Note that the "style" attribute is really a template parameter here.
24805 # The = would have to be {{=}} if you wanted the literal.
24806 !!test
24807 Empty TD followed by TD with tpl-generated attribute
24808 !! wikitext
24809 {|
24810 |-
24811 |
24812 |{{echo|style='color:red'}}|foo
24813 |}
24814 !! html
24815 <table>
24816
24817 <tr>
24818 <td>
24819 </td>
24820 <td>foo
24821 </td></tr></table>
24822
24823 !!end
24824
24825 !!test
24826 Indented table with an empty td
24827 !! wikitext
24828 {|
24829 |-
24830 |
24831 |foo
24832 |}
24833 !! html
24834 <table>
24835
24836 <tr>
24837 <td>
24838 </td>
24839 <td>foo
24840 </td></tr></table>
24841
24842 !!end
24843
24844 ## We have some newline diffs RT-ing this edge case
24845 ## and it is not important enough -- we seem to be emitting
24846 ## at most 2 newlines after a </tr> and this is unrelated to
24847 ## the issue from T85627 that this is testing.
24848 !!test
24849 Indented table with blank lines in between (T85627)
24850 !! options
24851 parsoid=wt2html
24852 !! wikitext
24853 {|
24854 |foo
24855
24856
24857 |}
24858 !! html
24859 <table>
24860
24861 <tr>
24862 <td>foo
24863 </td></tr></table>
24864
24865 !!end
24866
24867 !!test
24868 Indented block & table
24869 !! wikitext
24870 <div>foo</div>
24871 {|
24872 |foo
24873 |}
24874 !! html/php
24875 <div>foo</div>
24876 <table>
24877 <tr>
24878 <td>foo
24879 </td></tr></table>
24880
24881 !! html/parsoid
24882 <div data-parsoid='{"stx":"html"}'>foo</div>
24883 <table><tbody>
24884 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24885 </tbody></table>
24886 !!end
24887
24888 !! test
24889 Indent and comment before table row
24890 !! wikitext
24891 {|
24892 <!--hi-->|-
24893 | there
24894 |}
24895 !! html/php
24896 <table>
24897
24898 <tr>
24899 <td> there
24900 </td></tr></table>
24901
24902 !! html/parsoid
24903 <table>
24904 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24905 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24906 </tbody></table>
24907 !! end
24908
24909 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24910 !!test
24911 Empty TR followed by a template-generated TR
24912 !!options
24913 parsoid
24914 !! wikitext
24915 {|
24916 |-
24917 {{echo|<tr><td>foo</td></tr>}}
24918 |}
24919 !! html
24920 <table>
24921 <tbody>
24922 <tr></tr>
24923 <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}}]}'>
24924 <td>foo</td></tr>
24925 </tbody></table>
24926 !!end
24927
24928 ## PHP and parsoid output differ for this, and since this is primarily
24929 ## for testing Parsoid's serializer, marking this Parsoid only
24930 !!test
24931 Empty TR followed by mixed-ws-comment line should RT correctly
24932 !!options
24933 parsoid
24934 !! wikitext
24935 {|
24936 |-
24937 <!--c-->
24938 |-
24939 <!--c--> <!--d-->
24940 |}
24941 !! html
24942 <table>
24943 <tbody>
24944 <tr></tr>
24945 <!--c-->
24946 <tr>
24947 <!--c--> </tr><!--d-->
24948 </tbody></table>
24949
24950 !!end
24951
24952 !!test
24953 Multi-line image caption generated by templates with/without trailing newlines
24954 !! wikitext
24955 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24956 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24957 !! html/parsoid
24958 <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>
24959 <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>
24960 !!end
24961
24962 !! test
24963 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24964 !! options
24965 parsoid=html2wt
24966 !! html/parsoid
24967 <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>
24968
24969 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24970 !! wikitext
24971 <includeonly>foo</includeonly>
24972 new para
24973
24974 [[Category:Foo]]
24975
24976 = new heading =
24977 !! end
24978
24979 ## PHP emits broken html for this, and since this is primarily
24980 ## a Parsoid serializer test, marking this Parsoid only
24981 !!test
24982 Improperly nested inline or quotes tags with whitespace in between
24983 !! wikitext
24984 <span> <s>x</span> </s>
24985 ''' ''x''' ''
24986 !! html/parsoid
24987 <p><span> <s>x</s></span><s> </s>
24988 <b> <i>x</i></b><i> </i>
24989 </p>
24990 !!end
24991
24992 !!test
24993 Encapsulate protected attributes from wt
24994 !! wikitext
24995 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24996
24997 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
24998 | ok
24999 |}
25000 !! html/parsoid
25001 <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>
25002
25003 <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">
25004 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
25005 </tbody></table>
25006 !!end
25007
25008 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
25009 ## Having nested or stray pre tags results in the attempt to add duplicates,
25010 ## causing an assertion fail. This test tries to prevent that situation.
25011 !!test
25012 Ensure ParagraphWrapper can deal with stray closing pre tags
25013 !!options
25014 parsoid=wt2html
25015 !! wikitext
25016 plain text</pre>
25017 !! html/parsoid
25018 plain text
25019 !!end
25020
25021 !!test
25022 1. Ensure fostered text content is wrapped in element nodes
25023 !!options
25024 parsoid=wt2html
25025 !! wikitext
25026 <table>hi</table><table>ho</table>
25027 !! html/parsoid
25028 <p>hi</p>
25029 <table></table>
25030 <p>ho</p>
25031 <table></table>
25032 !!end
25033
25034 !!test
25035 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
25036 !!options
25037 parsoid=wt2html,wt2wt
25038 !! wikitext
25039 <table>
25040 <tr> || ||
25041 <td> a
25042 </table>
25043 !! html/parsoid
25044 <p> || ||
25045 </p><table>
25046 <tbody><tr><td> a</td></tr>
25047 </tbody></table>
25048 !!end
25049
25050 !!test
25051 Encapsulation properly handles null DSR information from foster box
25052 !!options
25053 parsoid=wt2html,wt2wt
25054 !! wikitext
25055 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25056 !! html/parsoid
25057 <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>
25058 !!end
25059
25060 !!test
25061 1. Encapsulate foster-parented transclusion content
25062 !!options
25063 parsoid=wt2wt,wt2html
25064 !! wikitext
25065 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25066 !! html/parsoid
25067 <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>
25068 <tbody>
25069 <tr>
25070 <td>bar</td>
25071 </tr>
25072 </tbody>
25073 </table>
25074 !!end
25075
25076 !!test
25077 2. Encapsulate foster-parented transclusion content
25078 !!options
25079 parsoid=wt2wt,wt2html
25080 !! wikitext
25081 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25082 !! html/parsoid
25083 <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>
25084 <table>
25085 <tbody>
25086 <tr>
25087 <td>bar</td>
25088 </tr>
25089 </tbody>
25090 </table>
25091 !!end
25092
25093 !!test
25094 3. Encapsulate foster-parented transclusion content
25095 !!options
25096 parsoid=wt2wt,wt2html
25097 !! wikitext
25098 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25099 !! html/parsoid
25100 <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;]}">
25101 <p>foo</p>
25102 </div>
25103 <table>
25104 <tbody>
25105 <tr>
25106 <td>bar</td>
25107 </tr>
25108 </tbody>
25109 </table>
25110 !!end
25111
25112 !!test
25113 4. Encapsulate foster-parented transclusion content
25114 !!options
25115 parsoid=wt2wt,wt2html
25116 !! wikitext
25117 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25118 !! html/parsoid
25119 <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;]}">
25120 <p>foo</p>
25121 </div>
25122 <table>
25123 <tbody>
25124 <tr>
25125 <td>bar</td>
25126 </tr>
25127 </tbody>
25128 </table>
25129 !!end
25130
25131 !!test
25132 5. Encapsulate foster-parented transclusion content
25133 !!options
25134 parsoid=wt2wt,wt2html
25135 !! wikitext
25136 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25137 !! html/parsoid
25138 <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>
25139 <table>
25140 <tbody>
25141 <tr>
25142 <td>
25143 <div>
25144 <p>foo</p>
25145 </div>
25146 </td>
25147 </tr>
25148 </tbody>
25149 </table>
25150 !!end
25151
25152 !!test
25153 6. Encapsulate foster-parented transclusion content
25154 !!options
25155 parsoid=wt2wt,wt2html
25156 !! wikitext
25157 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25158 !! html/parsoid
25159 <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>
25160 <table>
25161 <tbody>
25162 <tr>
25163 <td>
25164 <div>
25165 <p>foo</p>
25166 </div>
25167 </td>
25168 </tr>
25169 </tbody>
25170 </table>
25171 <p>ok</p>
25172 !!end
25173
25174 !!test
25175 7. Encapsulate foster-parented transclusion content
25176 !!options
25177 parsoid=wt2wt,wt2html
25178 !! wikitext
25179 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25180 !! html/parsoid
25181 <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>
25182 <table>
25183 <tbody>
25184 <tr>
25185 <td>bar</td>
25186 </tr>
25187 </tbody>
25188 </table>
25189 !!end
25190
25191 # Note that the wt is broken on purpose: the = should be {{=}} if you
25192 # don't want it to be a template parameter key.
25193 !!test
25194 8. Encapsulate foster-parented transclusion content
25195 !!options
25196 parsoid=wt2wt,wt2html
25197 !! wikitext
25198 {{echo|a
25199 }}{|{{echo|style='color:red'}}
25200 |-
25201 |b
25202 |}
25203 !! html/parsoid
25204 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25205 <span> </span>
25206 <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>
25207 <table>
25208 <tbody>
25209 <tr>
25210 <td>b</td>
25211 </tr>
25212 </tbody>
25213 </table>
25214 !!end
25215
25216 !!test
25217 9. Encapsulate foster-parented transclusion content
25218 !!options
25219 parsoid=wt2wt,wt2html
25220 !! wikitext
25221 <table>{{echo|hi</table>hello}}
25222 !! html/parsoid
25223 <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>
25224 !!end
25225
25226 !!test
25227 Table in fosterable position
25228 !!options
25229 parsoid=wt2html
25230 !! wikitext
25231 {{OpenTable}}
25232 <div>
25233 {|
25234 |}
25235 </div>
25236 |}
25237 !! html/parsoid
25238 <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">
25239 </span>
25240 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25241
25242 <table>
25243 </table>
25244 !!end
25245
25246 # Parsoid only for T66747
25247 !! test
25248 Properly encapsulate empty-content transclusions in fosterable positions
25249 !! wikitext
25250 <table>
25251 {{#if:|
25252 <td>foo</td>
25253 }}
25254 </table>
25255 !! html/parsoid
25256 <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"}]]}'>
25257
25258 </table>
25259 !! end
25260
25261 !! test
25262 Always encapsulate foster box when template range is expanded to table
25263 !! options
25264 parsoid=wt2wt
25265 !! wikitext
25266 {|
25267 hello
25268 {{OpenTable}}
25269 |}
25270 !! html/parsoid
25271
25272 !! end
25273
25274 !! test
25275 T115289: Unclosed table
25276 !! wikitext
25277 {{echo|<table>}}<!--c-->[[Category:Two]]
25278 !! html/parsoid
25279 <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>
25280 !! end
25281
25282 !! test
25283 T115289: Don't migrate newlines out of tables with fostered content
25284 !! wikitext
25285 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25286 !! html/parsoid
25287 <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>
25288 !! end
25289
25290 !! test
25291 T73074: More fostering fun
25292 !! wikitext
25293 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25294 !! html/parsoid
25295 <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>
25296 !! end
25297
25298 !!test
25299 Support <object> element with .data attribute
25300 !!options
25301 parsoid=html2wt
25302 !! html/parsoid
25303 <object data="test.swf"></object>
25304 !! wikitext
25305 <object data="test.swf"></object>
25306 !!end
25307
25308 !! test
25309 Don't block XML namespace declaration
25310 !! wikitext
25311 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25312 !! html/php
25313 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25314 </p>
25315 !! html/parsoid
25316 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25317 !! end
25318
25319 # -----------------------------------------------------------------
25320 # The following section of tests are primarily to spec requirements
25321 # around Parsoid's serialization (old, new, edited content)
25322 #
25323 # All these tests are marked Parsoid html2wt and html2html only
25324 # ----------------------------------------------------------------
25325
25326 !! test
25327 Ignore rel attribute in a-tags during serialization to url-links
25328 !! options
25329 parsoid=html2wt
25330 !! html/parsoid
25331 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25332 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25333 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25334 !! wikitext
25335 http://en.wikipedia.org/wiki/Foobar
25336 http://en.wikipedia.org/wiki/Foobar
25337 http://en.wikipedia.org/wiki/Foobar
25338 !! end
25339
25340 # 'mi' is a localinterwiki prefix as well as a language
25341 !! test
25342 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
25343 !! options
25344 parsoid=html2wt
25345 !! html/parsoid
25346 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25347 !! wikitext
25348 [[Foo]]
25349 !! end
25350
25351 # See T93839
25352 !! test
25353 New wikilinks should be serialized properly
25354 !! options
25355 parsoid=html2wt
25356 !! html/parsoid
25357 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25358 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25359 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25360 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25361 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25362 !! wikitext
25363 [[Foo]]
25364 [[Foo]]
25365 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25366 http://en.wikipedia.org/wiki/Foo
25367 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25368 !! end
25369
25370 !! test
25371 New wiki links (href variations)
25372 !! options
25373 parsoid=html2wt
25374 !! html/parsoid
25375 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25376 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25377 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25378 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25379 !! wikitext
25380 [[Foo_bar]]
25381 [[Foo_bar]]
25382 [[Foo_bar]]
25383 [[Toxine bactérienne]]
25384 !! end
25385
25386 !! test
25387 New wiki links (content string variations)
25388 !! options
25389 parsoid=html2wt
25390 !! html/parsoid
25391 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25392 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25393 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25394 !! wikitext
25395 [[Foo_bar]]
25396 [[Foo bar]]
25397 [[Foo_bar|./Foo_bar]]
25398 !! end
25399
25400 !! test
25401 New category links (href variations)
25402 !! options
25403 parsoid=html2wt
25404 !! html/parsoid
25405 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25406 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25407 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25408 !! wikitext
25409 [[Category:Toxine bactérienne]]
25410 [[Category:Toxine bactérienne]]
25411 [[Category:Toxine bactérienne]]
25412 !! end
25413
25414 !! test
25415 New sol transparent links don't need indent-pre nowiki protection
25416 !! options
25417 parsoid=html2wt
25418 language=de
25419 !! html/parsoid
25420 <link rel="mw:PageProp/redirect" href="./Main_Page">
25421 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25422 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25423 !! wikitext
25424 #WEITERLEITUNG [[Main Page]]
25425 <!-- this is good --> [[Category:Good]]
25426 <!-- this is great --> [[Kategorie:Great]]
25427 !! end
25428
25429 !! test
25430 New interlanguage links (href variations)
25431 !! options
25432 parsoid=html2wt
25433 !! html/parsoid
25434 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25435 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25436 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25437 !! wikitext
25438 [[es:Toxine bactérienne]]
25439 [[es:Toxine_bactérienne]]
25440 [[es:Toxine_bactérienne]]
25441 !! end
25442
25443 !! test
25444 Image: Modifying size of an image (1)
25445 !! options
25446 parsoid={
25447 "modes": ["wt2wt"],
25448 "changes": [
25449 ["img[height]", "attr", "height", "22"],
25450 ["img[width]", "attr", "width", "200"]
25451 ]
25452 }
25453 !! wikitext
25454 [[Image:Foobar.jpg|230x230px]]
25455 !! wikitext/edited
25456 [[Image:Foobar.jpg|200x200px]]
25457 !!end
25458
25459 !! test
25460 Image: Modifying size of an image (2)
25461 !! options
25462 parsoid={
25463 "modes": ["wt2wt"],
25464 "changes": [
25465 ["img[height]", "attr", "height", "100"],
25466 ["img[width]", "attr", "width", "500"]
25467 ]
25468 }
25469 !! wikitext
25470 [[Image:Foobar.jpg|230x230px]]
25471 !! wikitext/edited
25472 [[Image:Foobar.jpg|500x500px]]
25473 !!end
25474
25475 # Change in size is ignored so long as class='mw-default-size'
25476 !! test
25477 Image: Modifying size of an image (3)
25478 !! options
25479 parsoid={
25480 "modes": ["wt2wt"],
25481 "changes": [
25482 ["figure[class]", "removeClass", "mw-default-size"],
25483 ["figure img", "attr", "height", "19"],
25484 ["figure img", "attr", "width", "170"]
25485 ]
25486 }
25487 !! wikitext
25488 [[Image:Foobar.jpg|thumb]]
25489 !! wikitext/edited
25490 [[Image:Foobar.jpg|thumb|170x170px]]
25491 !!end
25492
25493 !! test
25494 Image: Modifying alignment of an image (T50665)
25495 !! options
25496 parsoid={
25497 "modes": ["wt2wt"],
25498 "changes": [
25499 ["figure[class]", "removeClass", "mw-halign-right"],
25500 ["figure[class]", "addClass", "mw-halign-left"]
25501 ]
25502 }
25503 !! wikitext
25504 [[Image:Foobar.jpg|thumb|caption|right]]
25505 !! wikitext/edited
25506 [[Image:Foobar.jpg|thumb|caption|left]]
25507 !! end
25508
25509 !! test
25510 Image: Modifying mw-default-size of an frameless image (T64805)
25511 !! options
25512 parsoid={
25513 "modes": ["wt2wt"],
25514 "changes": [
25515 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25516 ]
25517 }
25518 !! wikitext
25519 [[Image:Foobar.jpg|frameless|right]]
25520 !! wikitext/edited
25521 [[Image:Foobar.jpg|frameless|right|220x220px]]
25522 !! end
25523
25524 !! test
25525 Image: Modifying valign of an image (T51221)
25526 !! options
25527 parsoid={
25528 "modes": ["wt2wt"],
25529 "changes": [
25530 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25531 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25532 ]
25533 }
25534 !! wikitext
25535 [[File:Foobar.jpg|20px|middle]]
25536 !! wikitext/edited
25537 [[File:Foobar.jpg|20px|text-top]]
25538 !! end
25539
25540 !! test
25541 Image: Modifying alt attribute of an image (T58400)
25542 !! options
25543 parsoid={
25544 "modes": ["wt2wt"],
25545 "changes": [
25546 ["img[alt]", "attr", "alt", "some alternate edited text"]
25547 ]
25548 }
25549 !! wikitext
25550 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25551 !! wikitext/edited
25552 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25553 !!end
25554
25555 !! test
25556 Image: Modifying caption of an image
25557 !! options
25558 parsoid={
25559 "modes": ["wt2wt"],
25560 "changes": [
25561 ["figcaption", "text", "new caption"]
25562 ]
25563 }
25564 !! wikitext
25565 [[Image:Foobar.jpg|thumb|original caption]]
25566 !! wikitext/edited
25567 [[Image:Foobar.jpg|thumb|new caption]]
25568 !!end
25569
25570 !! test
25571 Image: empty alt attribute (T50924)
25572 !! options
25573 parsoid
25574 !! wikitext
25575 [[File:Foobar.jpg|thumb|alt=|bar]]
25576 !! html
25577 <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>
25578 !! end
25579
25580 !! test
25581 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
25582 !! options
25583 parsoid=html2wt
25584 language=ar
25585 disabled
25586 !! html/parsoid
25587 <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>
25588 !! wikitext
25589 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25590 !! end
25591
25592 !! test
25593 Image: Block level image should have \n before and after
25594 !! wikitext
25595 123
25596 [[File:Foobar.jpg|right|thumb|150x150px]]
25597 456
25598 !! html/parsoid
25599 <p>123</p>
25600 <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>
25601 <p>456</p>
25602 !!end
25603
25604 !! test
25605 Image: New block level image should have \n before and after (existing content)
25606 !! wikitext
25607 123
25608 [[File:Foobar.jpg|right|thumb|150x150px]]
25609 456
25610 !! html/parsoid
25611 <p>123</p>
25612 <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>
25613 <p>456</p>
25614 !!end
25615
25616 !! test
25617 Image: upright option (parsoid)
25618 !! wikitext
25619 [[File:Foobar.jpg|thumb|upright|caption]]
25620 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25621 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25622 !! html/parsoid
25623 <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>
25624 <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>
25625 <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>
25626 !!end
25627
25628 !! test
25629 Image: upright option is ignored on inline and frame images (parsoid)
25630 !! wikitext
25631 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25632 !! html/parsoid
25633 <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>
25634 !!end
25635
25636 !! test
25637 Image: from basic HTML (1)
25638 !! options
25639 parsoid=html2wt
25640 !! html/parsoid
25641 <span typeof="mw:Image">
25642 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25643 </span>
25644 !! wikitext
25645 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25646 !! end
25647
25648 !! test
25649 Image: from basic HTML (2)
25650 !! options
25651 parsoid=html2wt
25652 !! html/parsoid
25653 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25654 !! wikitext
25655 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25656 !! end
25657
25658 !! test
25659 Image: from basic HTML (3)
25660 !! options
25661 parsoid=html2wt
25662 !! html/parsoid
25663 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25664 !! wikitext
25665 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25666 !! end
25667
25668 !! test
25669 Image: from basic HTML (4)
25670 !! options
25671 parsoid=html2wt
25672 !! html/parsoid
25673 <img src="./File:Foobar.jpg">
25674 !! wikitext
25675 [[File:Foobar.jpg|link=]]
25676 !! end
25677
25678 !! test
25679 Image: Invalid title as link
25680 !! wikitext
25681 [[File:Foobar.jpg|link=<]]
25682 !! html/php
25683 <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>
25684 </p>
25685 !! html/parsoid
25686 <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>
25687 !! end
25688
25689 !! test
25690 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25691 !! options
25692 parsoid=html2wt
25693 !! html/parsoid
25694 <ul>
25695 <li><p>foo</p></li>
25696 </ul>
25697 !! wikitext
25698 * foo
25699 !! end
25700
25701 !! test
25702 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25703 !! options
25704 parsoid=html2wt
25705 !! html/parsoid
25706 <ul> <li>foo</li></ul>
25707 !! wikitext
25708 * foo
25709 !! end
25710
25711 !! test
25712 Don't strip leading whitespace when handling indent-pre suppressing tags
25713 !! options
25714 parsoid=html2wt
25715 !! html/parsoid
25716 <table>
25717 <tr><td> indented row</td></tr>
25718 </table>
25719 <blockquote><p>
25720 <b>This is very bold of you!</b>
25721 </p>
25722 <table><tr><td>
25723 indented cell (no pre-wrapping!)
25724 </td></tr></table>
25725 </blockquote>
25726 <p>foo</p>
25727 <div>bar</div>
25728 !! wikitext
25729 {|
25730 | indented row
25731 |}
25732 <blockquote>
25733 '''This is very bold of you!'''
25734
25735 {|
25736 |
25737 indented cell (no pre-wrapping!)
25738 |}
25739 </blockquote>
25740 foo
25741 <div>bar</div>
25742 !! end
25743
25744 !! test
25745 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25746 !! options
25747 parsoid=html2wt
25748 !! html/parsoid
25749 <p>foo</p>
25750 <span>bar</span>
25751
25752 <span>foo2
25753 </span>bar2
25754
25755 <div>foo</div>
25756 <span>bar</span>
25757
25758 <div>
25759 <span>foo</span>
25760 </div>
25761 !! wikitext
25762 foo
25763
25764 <span>bar</span>
25765
25766 <span>foo2
25767 <nowiki> </nowiki></span>bar2
25768
25769 <div>foo</div>
25770 <nowiki> </nowiki><span>bar</span>
25771
25772 <div>
25773 <nowiki> </nowiki><span>foo</span>
25774 </div>
25775 !! end
25776
25777 !! test
25778 Lists: Dont insert newlines in a serialized list item.
25779 !! options
25780 parsoid=html2wt
25781 !! html/parsoid
25782 <ul><li>a<br>b</li><li>c</li></ul>
25783 !! wikitext
25784 * a<br>b
25785 * c
25786 !! end
25787
25788 !! test
25789 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25790 !! options
25791 parsoid={
25792 "modes": ["html2wt"],
25793 "scrubWikitext": false
25794 }
25795 !! html/parsoid
25796 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25797 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25798
25799 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25800 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25801
25802 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25803
25804 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25805 !! wikitext
25806 == hello there [[Category:A1]] ==
25807
25808 == [[Category:A2]] hi pal ==
25809
25810 == <!--foo--> [[Category:A3]] how goes it ==
25811
25812 == it goes well [[Category:A4]] <!--bar--> ==
25813
25814 ==howdy [[Category:A5]]==
25815
25816 == __TOC__ ok ==
25817 !! end
25818
25819 !! test
25820 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25821 !! options
25822 parsoid={
25823 "modes": ["html2wt"],
25824 "scrubWikitext": true
25825 }
25826 !! html/parsoid
25827 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25828 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25829
25830 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25831 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25832
25833 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25834 !! wikitext
25835 == hello there ==
25836 [[Category:A1]]
25837 [[Category:A2]]
25838
25839 == hi pal ==
25840
25841 <!--foo--> [[Category:A3]]
25842
25843 == how goes it ==
25844
25845 == it goes well ==
25846 [[Category:A4]] <!--bar-->
25847
25848 __TOC__
25849
25850 == ok ==
25851 !! end
25852
25853 !! test
25854 Headings: Don't hoist metas that come from templates
25855 !! options
25856 parsoid={
25857 "modes": ["html2wt"],
25858 "scrubWikitext": true
25859 }
25860 !! html/parsoid
25861 <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>
25862 !! wikitext
25863 == {{echo|foo [[Category:Foo]]}} ==
25864 !! end
25865
25866 !! test
25867 Headings: Category in ref isn't hoisted
25868 !! options
25869 parsoid={
25870 "modes": ["html2wt"],
25871 "scrubWikitext": true
25872 }
25873 !! html/parsoid
25874 <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>
25875
25876 <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>
25877 !! wikitext
25878 == foo <ref>bar
25879 [[Category:Baz]] </ref> ==
25880
25881 <references />
25882 !! end
25883
25884 !! test
25885 Parsoid: Serialize positional parameters with = in them as named parameter
25886 !! options
25887 parsoid=html2wt
25888 !! html/parsoid
25889 <p about="#mwt1" typeof="mw:Transclusion"
25890 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25891
25892 <p about="#mwt1" typeof="mw:Transclusion"
25893 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25894
25895 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25896 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25897 <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>
25898 !! wikitext
25899 {{echo|1=f=oo}}
25900
25901 {{echo|1=f=oo|2=bar}}
25902
25903 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25904 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25905 {{echo|<nowiki>f=oo</nowiki>|bar}}
25906 !! end
25907
25908 !! test
25909 Parsoid: Serialize positional parameters with = in extlink as named parameter
25910 !! options
25911 parsoid=html2wt
25912 !! html/parsoid
25913 <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>
25914 !! wikitext
25915 {{echo|1=http://stuff?is=ok}}
25916 !! end
25917
25918 !! test
25919 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25920 !! options
25921 parsoid=html2wt
25922 !! html/parsoid
25923 <div>a<p>b</p></div>
25924 <div>a
25925 <p>b</p></div>
25926 <div>
25927 a
25928 <p>b</p></div>
25929 !! wikitext
25930 <div>a
25931 b
25932 </div>
25933 <div>a
25934 b
25935 </div>
25936 <div>
25937 a
25938
25939 b
25940 </div>
25941 !! end
25942
25943 !! test
25944 Substrings resembling wikitext in hrefs should not get nowiki escapes
25945 !! options
25946 parsoid=html2wt
25947 !! html/parsoid
25948 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25949 !! wikitext
25950 [[Foo''bar''baz]]
25951 !! end
25952
25953 !! test
25954 Enforce single-line context in the serializer
25955 !! options
25956 parsoid=html2wt
25957 !! html/parsoid
25958 <h2>testing
25959 123</h2>
25960
25961 <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">
25962 </span><span about="#mwt1">you</span> </h2>
25963
25964 <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>
25965
25966 <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
25967 there</span></li></ol>
25968
25969 <ul><li>asd
25970 sdf</li></ul>
25971
25972 <ul><li>foo
25973 bar
25974 baz</li>
25975 <li>foo <b>bar</b>
25976 baz</li></ul>
25977
25978 <dl><dt>hi
25979 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25980 ho</dd></dl>
25981
25982 <dl><dd> <table>
25983 <tbody><tr><td> ha
25984 ha
25985 ha</td></tr>
25986 </tbody></table></dd></dl>
25987 !! wikitext
25988 == testing 123 ==
25989
25990 == hi {{bogus|there
25991 you}} ==
25992
25993 == foo <ref>hello
25994 there</ref> ==
25995
25996 <references />
25997
25998 * asd sdf
25999
26000 * foo bar baz
26001 * foo '''bar''' baz
26002
26003 ; hi ho : hi ho
26004
26005 : {|
26006 | ha
26007 ha
26008 ha
26009 |}
26010 !! end
26011
26012 !! test
26013 Serialize new placeholder space without spans
26014 !! options
26015 parsoid=html2wt
26016 !! html/parsoid
26017 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
26018
26019 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
26020
26021 <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>
26022 !! wikitext
26023 foo : bar
26024
26025 foo : bar
26026
26027 <ref>foo : bar</ref>ok
26028 !! end
26029
26030
26031 #-----------------------
26032 # Tag minimization tests
26033 #-----------------------
26034
26035 !! test
26036 1. I/B quote minimization: wikitext-only tags should be combined
26037 !! options
26038 parsoid=html2wt
26039 !! html/parsoid
26040 <p><i>A</i><i>B</i></p>
26041 <p><b>A</b><b>B</b></p>
26042 <p><i>A</i><b><i>B</i></b></p>
26043 <p><b>A</b><i><b>B</b></i></p>
26044 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
26045 <p><i><b>A</b></i><i><b>B</b></i></p>
26046 <p><i><b>A</b></i><b><i>B</i></b></p>
26047 <p><b><i>A</i></b><i><b>B</b></i></p>
26048 !! wikitext
26049 ''AB''
26050
26051 '''AB'''
26052
26053 ''A'''B'''''
26054
26055 '''A''B'''''
26056
26057 '''A''BC''D'''
26058
26059 '''''AB'''''
26060
26061 '''''AB'''''
26062
26063 '''''AB'''''
26064 !! end
26065
26066 !! test
26067 2. I/B quote minimization: wikitext and html tags should not be combined
26068 !! options
26069 parsoid=html2wt
26070 !! html/parsoid
26071 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26072 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26073 !! wikitext
26074 ''A''<i>B</i>
26075
26076 ''A''<nowiki/>'''<i>B</i>'''
26077 !! end
26078
26079 !! test
26080 3. I/B quote minimization: templated content stops minimization
26081 !! options
26082 parsoid=html2wt
26083 !! html/parsoid
26084 <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>
26085 <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>
26086 !! wikitext
26087 ''A''{{echo|''B''}}
26088
26089 ''A''{{echo|'''''B'''''}}
26090 !! end
26091
26092 !! test
26093 4. I/B quote minimization: new content should be mimimized with adjacent old content
26094 !! options
26095 parsoid=html2wt
26096 !! html/parsoid
26097 <p><i>A</i><i>B</i></p>
26098 <p><b>A</b><b>B</b></p>
26099 <p><i>A</i><b><i>B</i></b></p>
26100 !! wikitext
26101 ''AB''
26102
26103 '''AB'''
26104
26105 ''A'''B'''''
26106 !! end
26107
26108 !! test
26109 5a. Merge adjacent quote nodes if they've been edited
26110 !! options
26111 parsoid={
26112 "modes": ["wt2wt", "selser"],
26113 "changes": [
26114 ["p", "contents", "remove", ":contains('b')"]
26115 ]
26116 }
26117 !! wikitext
26118 ''a''b''c''
26119 !! wikitext/edited
26120 ''ac''
26121 !! end
26122
26123 !! test
26124 5b. Merge adjacent quote nodes if they've been edited
26125 !! options
26126 parsoid={
26127 "modes": ["wt2wt", "selser"],
26128 "changes": [
26129 ["#x", "remove"]
26130 ]
26131 }
26132 !! wikitext
26133 ''a''<span id="x">b</span>''c''
26134 !! wikitext/edited
26135 ''ac''
26136 !! end
26137
26138 !! test
26139 1. Merge adjacent link nodes as long as at least one element is new
26140 !! options
26141 parsoid={
26142 "modes": ["html2wt"],
26143 "scrubWikitext": true
26144 }
26145 !! html/parsoid
26146 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26147 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26148 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26149 !! wikitext
26150 [[Football]]
26151 [[Football]]
26152 [[Football|Foot]][[Football|ball]]
26153 !! end
26154
26155 !! test
26156 2. Merge adjacent link nodes and enable additional normalizations
26157 !! options
26158 parsoid={
26159 "modes": ["html2wt"],
26160 "scrubWikitext": true
26161 }
26162 !! html/parsoid
26163 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26164 !! wikitext
26165 [[Football|''Football'']]
26166 !! end
26167
26168 !! test
26169 3. Don't merge adjacent link nodes if scrubWikitext is false
26170 !! options
26171 parsoid={
26172 "modes": ["html2wt"],
26173 "scrubWikitext": false
26174 }
26175 !! html/parsoid
26176 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26177 !! wikitext
26178 [[Football|Foot]][[Football|ball]]
26179 !! end
26180
26181 #------------------------------
26182 # End of tag minimization tests
26183 #------------------------------
26184
26185 !!test
26186 T56262: New entities
26187 !! options
26188 parsoid=html2wt
26189 !! html/parsoid
26190 <span typeof="mw:Entity">&nbsp;</span>
26191 !! wikitext
26192 &nbsp;
26193 !! end
26194
26195 ## Note that there is no wikitext output for 'unknownproperty' ##
26196 ## Unknown magic words are silently dropped ##
26197
26198 !! test
26199 Magic words
26200 !! options
26201 parsoid=html2wt
26202 !! html/parsoid
26203 <meta property='mw:PageProp/toc' />
26204 <meta property='mw:PageProp/notoc' />
26205 <meta property='mw:PageProp/forcetoc' />
26206 <meta property='mw:PageProp/index' />
26207 <meta property='mw:PageProp/noindex' />
26208 <meta property='mw:PageProp/nogallery' />
26209 <meta property='mw:PageProp/noeditsection' />
26210 <meta property='mw:PageProp/notitleconvert' />
26211 <meta property='mw:PageProp/nocontentconvert' />
26212 <meta property='mw:PageProp/unknownproperty' />
26213 !! wikitext
26214 __TOC__
26215 __NOTOC__
26216 __FORCETOC__
26217 __INDEX__
26218 __NOINDEX__
26219 __NOGALLERY__
26220 __NOEDITSECTION__
26221 __NOTITLECONVERT__
26222 __NOCONTENTCONVERT__
26223 !! end
26224
26225 !! test
26226 Consecutive <pre>s should not get merged
26227 !! options
26228 parsoid=html2wt,html2html
26229 !! html/parsoid
26230 <pre>a</pre><pre>b</pre>
26231
26232 <pre>c
26233 </pre><pre>
26234 d</pre>
26235
26236 <pre>e
26237
26238 </pre><pre>
26239
26240 f</pre>
26241 !! wikitext
26242 a
26243
26244 b
26245
26246 c
26247
26248 d
26249
26250 e
26251
26252
26253
26254 f
26255 !! end
26256
26257 !! test
26258 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26259 !! options
26260 parsoid=html2wt
26261 !! html/parsoid
26262 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26263 !! wikitext
26264 [[Special:BookSources/1234567890|ISBN 1234567895]]
26265 !! end
26266
26267 !! test
26268 Edited RFC links not serializable as RFC links should serialize as extlinks
26269 !! options
26270 parsoid=html2wt
26271 !! html/parsoid
26272 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26273 !! wikitext
26274 [//tools.ietf.org/html/rfc123 New RFC]
26275 !! end
26276
26277 !! test
26278 Edited PMID links not serializable as PMID links should serialize as extlinks
26279 !! options
26280 parsoid=html2wt
26281 !! html/parsoid
26282 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26283 !! wikitext
26284 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26285 !! end
26286
26287 !! test
26288 WTS of autolinks with trailing/surrounding context
26289 !! options
26290 parsoid=html2wt
26291 !! html/parsoid
26292 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26293 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26294 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26295 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26296 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26297 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26298 !! wikitext
26299 http://cscott.net'''foo'''
26300
26301 http://cscott.net<b>foo</b>
26302
26303 '''http://cscott.net'''
26304
26305 '''http://cscott.net '''
26306
26307 '''http://cscott.net<nowiki/>x'''
26308
26309 http://cscott.net<nowiki/>x
26310 !! end
26311
26312 !! test
26313 WTS of autolinks with nowikis (round-trip)
26314 !! wikitext
26315 x<nowiki/>http://cscott.net<nowiki/>x
26316 !! html/parsoid
26317 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26318 !! end
26319
26320 # this is the "easy" test because it leaves in place all the
26321 # data-parsoid information indicating this is an autolink
26322 !! test
26323 WTS of autolinks with escapes (editing)
26324 !! options
26325 parsoid={
26326 "modes": ["wt2wt"],
26327 "changes": [
26328 [ "span", "remove" ]
26329 ]
26330 }
26331 !! wikitext
26332 x<nowiki/>http://cscott.net<nowiki/>x
26333 !! wikitext/edited
26334 x<nowiki/>http://cscott.net<nowiki/>x
26335 !! end
26336
26337 !! test
26338 WTS of edited autolink-like text (T103364)
26339 !! options
26340 parsoid={
26341 "modes": ["wt2wt"],
26342 "changes": [
26343 [ "span[typeof]", "removeAttr", "typeof" ]
26344 ]
26345 }
26346 !! wikitext
26347 Not a link: <nowiki>http://example.com</nowiki>.
26348 !! wikitext/edited
26349 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26350 !! end
26351
26352 !! test
26353 WTS of newly-authored autolink-like text (T103364)
26354 !! options
26355 parsoid=html2wt
26356 !! html/parsoid
26357 <p>http://example.com is not a link.</p>
26358 !! wikitext
26359 <nowiki>http://example.com</nowiki> is not a link.
26360 !! end
26361
26362 !! test
26363 WTS of autolink-like text after an autolink (T108563)
26364 !! options
26365 parsoid=html2wt
26366 !! html/parsoid
26367 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26368 !! wikitext
26369 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26370 !! end
26371
26372 !! test
26373 Magic links inside links (not autolinked)
26374 !! wikitext
26375 [[Foo|http://example.com]]
26376 [[Foo|RFC 1234]]
26377 [[Foo|PMID 1234]]
26378 [[Foo|ISBN 123456789x]]
26379
26380 [http://foo.com http://example.com]
26381 [http://foo.com RFC 1234]
26382 [http://foo.com PMID 1234]
26383 [http://foo.com ISBN 123456789x]
26384 !! html+tidy
26385 <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>
26386 <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>
26387 !! html/parsoid
26388 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26389 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26390 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26391 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26392
26393 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26394 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26395 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26396 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26397 !! end
26398
26399 !! test
26400 Magic links inside image captions (autolinked)
26401 !! wikitext
26402 [[File:Foobar.jpg|thumb|http://example.com]]
26403 [[File:Foobar.jpg|thumb|RFC 1234]]
26404 [[File:Foobar.jpg|thumb|PMID 1234]]
26405 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26406 !! html+tidy
26407 <div class="thumb tright">
26408 <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>
26409 <div class="thumbcaption">
26410 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26411 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26412 </div>
26413 </div>
26414 <div class="thumb tright">
26415 <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>
26416 <div class="thumbcaption">
26417 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26418 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26419 </div>
26420 </div>
26421 <div class="thumb tright">
26422 <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>
26423 <div class="thumbcaption">
26424 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26425 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26426 </div>
26427 </div>
26428 <div class="thumb tright">
26429 <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>
26430 <div class="thumbcaption">
26431 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26432 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26433 </div>
26434 </div>
26435 !! html/parsoid
26436 <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>
26437 <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>
26438 <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>
26439 <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>
26440 !! end
26441
26442 !! test
26443 WTS of magic word text (T109371)
26444 !! options
26445 parsoid=html2wt
26446 !! html/parsoid
26447 <p>RFC 1234</p>
26448 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26449 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26450 !! wikitext
26451 <nowiki>RFC 1234</nowiki>
26452
26453 [http://foo.com RFC 1234]
26454
26455 [[Foo|RFC 1234]]
26456 !! end
26457
26458 !! test
26459 Edited Redirect link should emit a non-piped wikitext link
26460 !! options
26461 parsoid=html2wt
26462 !! html/parsoid
26463 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26464 !! wikitext
26465 #REDIRECT [[Bar]]
26466 !! end
26467
26468 !! test
26469 T75121: Infer extension name from typeOf if data-mw is not present
26470 !! options
26471 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26472 !! html/parsoid
26473 <div typeOf="mw:Extension/foo"></div>
26474 !! wikitext
26475 <foo />
26476 !! end
26477
26478 # Note that the <p> wrapping isn't present in PHP parser output
26479 # The important thing for this test is that P-wrapping doesn't
26480 # interfere with the <nowiki> protection for leading - in <td>
26481 # (which isn't necessary for <th>).
26482 !! test
26483 T88318: p-wrapped dash in table.
26484 !! options
26485 parsoid=html2wt,wt2wt
26486 !! html/parsoid
26487 <table><tbody>
26488 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26489 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26490 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26491 </tbody></table>
26492 !! wikitext
26493 {|
26494 !-
26495 !-
26496 |-
26497 |<nowiki>-</nowiki>
26498 |<nowiki>- </nowiki>
26499 |-
26500 |<small>-</small>
26501 |<br>
26502 -
26503 |<br>
26504 -
26505 |}
26506 !! html/php+tidy
26507 <table>
26508 <tr>
26509 <th>-</th>
26510 <th>-</th>
26511 </tr>
26512 <tr>
26513 <td>-</td>
26514 <td>-</td>
26515 </tr>
26516 <tr>
26517 <td><small>-</small></td>
26518 <td><br />
26519 <p>-</p>
26520 </td>
26521 <td><br />
26522 <p>-</p>
26523 </td>
26524 </tr>
26525 </table>
26526 !! end
26527
26528 !! test
26529 T149209: WTS: Handle newlines in table cells properly
26530 !! options
26531 parsoid=html2wt
26532 !! html/parsoid
26533 <table>
26534 <tbody>
26535 <tr><td>a
26536 b
26537 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
26538 <tr><td><p>x</p>
26539 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
26540 </tbody></table>
26541 <table>
26542 <tbody>
26543 <tr><th>a
26544 b
26545 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
26546 <tr><th><p>x</h>
26547 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
26548 </tbody></table>
26549 !! wikitext
26550 {|
26551 |a
26552 b
26553 |c
26554 |-
26555 |x
26556 {{!}}y
26557 |}
26558 {|
26559 !a
26560 b
26561 !c
26562 |-
26563 !x
26564 !y
26565 |}
26566 !! end
26567
26568 !! test
26569 T149209: Selser: Handle newlines in table cells properly
26570 !! options
26571 parsoid={
26572 "modes": ["selser"],
26573 "changes": [
26574 [ "#h1", "html", "a\nb\n" ],
26575 [ "#h2", "html", "a\nb\n" ],
26576 [ "#c1", "html", "a\nb\n" ],
26577 [ "#c2", "html", "<p>a</p>" ],
26578 [ "#c3", "html", "<p>a</p>" ],
26579 [ "#c4", "html", "edit-me<p>a</p>" ]
26580 ]
26581 }
26582 !! wikitext
26583 {|
26584 ! id="h1" |edit-me!!1
26585 |-
26586 ! id="h2" |edit-me||2
26587 |-
26588 | id="c1" |edit-me||3
26589 |-
26590 | id="c2" |edit-me||4
26591 |-
26592 | id="c3" |edit-me||p||q||r
26593 |-
26594 | id="c4" |edit-me||p||q||r
26595 |}
26596 !! wikitext/edited
26597 {|
26598 ! id="h1" |a
26599 b
26600 !1
26601 |-
26602 ! id="h2" |a
26603 b
26604 !2
26605 |-
26606 | id="c1" |a
26607 b
26608 |3
26609 |-
26610 | id="c2" |a
26611 |4
26612 |-
26613 | id="c3" |a
26614 |p||q||r
26615 |-
26616 | id="c4" |edit-me
26617 a
26618 |p||q||r
26619 |}
26620 !! end
26621
26622 !! test
26623 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26624 !! options
26625 parsoid=html2wt
26626 !! html/parsoid
26627 <table id='mwAb'>
26628 <td id='mwAc'>foo</td>
26629 <td id='serialize-this'>bar</td>
26630 </table>
26631 !! wikitext
26632 {|
26633 |foo
26634 | id="serialize-this" |bar
26635 |}
26636 !! end
26637
26638 !! test
26639 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26640 !! options
26641 parsoid=html2wt
26642 !! html/parsoid
26643 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26644 !! wikitext
26645 <div id="hello">ok</div>
26646 !! end
26647
26648 !! test
26649 WTS change modes
26650 !! options
26651 parsoid={
26652 "modes": ["wt2wt"],
26653 "changes": [
26654 [ "#xyz", "before", "<b>before</b> stuff " ],
26655 [ "#xyz", "after", " stuff <i>after</i>" ],
26656 [ "#xyz", "html", "x <b>y</b> z" ]
26657 ]
26658 }
26659 !! wikitext
26660 <span id="xyz">hello</span>
26661 !! wikitext/edited
26662 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26663 !! end
26664
26665 !! test
26666 Never serialize a-tag as html, regardless of what data-parsoid has to say
26667 !! options
26668 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26669 !! html/parsoid
26670 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26671 !! wikitext
26672 [[Foo]]
26673 !! end
26674
26675 ## SSS FIXME: This is broken output nevertheless.
26676 ## What might be a reasonable non-broken output for this?
26677 ## This is an edge case unlikely to be seen in production
26678 ## that I am not wasting more time on this right now.
26679 !! test
26680 Never serialize a-tag as html, no matter what attributes it has
26681 !! options
26682 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26683 !! html/parsoid
26684 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26685 !! wikitext
26686 [http://boo.org http://boohoo.org]
26687 !! end
26688
26689 # Misnested is an indication that selser can reuse the source but these have
26690 # shown to sneak through on occasion. See T101768.
26691 # The original wikitext here is: [http://test.com [[one]] two three]
26692 !! test
26693 Strip span tags added to mark misnested links
26694 !! options
26695 parsoid=html2wt
26696 !! html/parsoid
26697 <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>
26698 !! wikitext
26699 [http://test.com][[one]] two three
26700 !! end
26701
26702 !! test
26703 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26704 !! options
26705 parsoid=html2wt
26706 !! html/parsoid
26707 <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|}"]}'>
26708 <tbody><tr><td>d
26709 </td></tr>
26710 </tbody></table>
26711 !! wikitext
26712 {{echo|a}}
26713 {|{{echo|c
26714 {{!}}d
26715 }}
26716 |}
26717 !! end
26718
26719 ## This test verifies the presence and computation of this attribute indirectly
26720 ## by making an edit and ensuring that the serialization is correct (which it would be
26721 ## only if firstWikitextNode is properly set).
26722 !! test
26723 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26724 !! options
26725 parsoid= {
26726 "modes": ["wt2wt"],
26727 "changes": [
26728 [ "div#x", "remove" ],
26729 [ "div", "before", "<div>new</div>" ]
26730 ]
26731 }
26732 !! wikitext
26733 <div id="x">foo</div>
26734 {|
26735 {{echo|<div>boo</div>
26736 {{!}}b}}
26737 |c
26738 |}
26739 !! wikitext/edited
26740
26741 <div>new</div>
26742 {|
26743 {{echo|<div>boo</div>
26744 {{!}}b}}
26745 |c
26746 |}
26747 !! end
26748
26749 # --------------------------------------------
26750 # Tests spec'ing wikitext serialization norms |
26751 # --------------------------------------------
26752
26753 !! test
26754 Serialize multi-line indent-pre starting with wikitext syntax
26755 !! options
26756 parsoid=html2wt
26757 !! html/parsoid
26758 <pre>* 1
26759 ** 2
26760 * 3</pre>
26761 !! wikitext
26762 * 1
26763 ** 2
26764 * 3
26765 !! end
26766
26767 !! test
26768 1. Categories should always be serialized on their own line
26769 !! options
26770 parsoid=html2wt
26771 !! html/parsoid
26772 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26773 !! wikitext
26774 foo
26775 [[Category:Foo]]
26776 bar
26777 !! end
26778
26779 !! test
26780 2. Categories that are part of templates should not introduce a line break
26781 !! wikitext
26782 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26783 !! html/parsoid
26784 <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>
26785 !! end
26786
26787 # Careful while editing these next 2 tests. There are \u200f characters
26788 # before and after the <link> tags in the HTML and following some
26789 # of the categories in wikitext
26790 # Do not remove these characters in edits.
26791 #
26792 # As part of the serialization, these bidi characters will get stripped.
26793 !! test
26794 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26795 !! options
26796 parsoid={
26797 "modes": ["html2wt"],
26798 "scrubWikitext": true
26799 }
26800 !! html/parsoid
26801 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26802 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26803 !! wikitext
26804 [[קטגוריה:טקסים]]
26805 [[קטגוריה: שיטות משפט]]
26806 !! end
26807
26808 !! test
26809 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26810 !! options
26811 parsoid={
26812 "modes": ["html2wt"],
26813 "scrubWikitext": true
26814 }
26815 !! html/parsoid
26816 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26817 !! wikitext
26818 [[קטגוריה:טקסים]]
26819 ‏y
26820 !! end
26821
26822 !! test
26823 Lists: Add space after bullets
26824 !! options
26825 parsoid=html2wt
26826 !! html/parsoid
26827 <ul>
26828 <li>foo</li>
26829 <li> bar</li>
26830 <li><span> baz</span></li>
26831 </ul>
26832 !! wikitext
26833 * foo
26834 * bar
26835 * <span> baz</span>
26836 !! end
26837
26838 !! test
26839 1. Headings: Add space before/after == (T53744)
26840 !! options
26841 parsoid=html2wt
26842 !! html/parsoid
26843 <h2>foo</h2>
26844 <h2> bar</h2>
26845 <h2>baz </h2>
26846 <h2><span> baz</span></h2>
26847 !! wikitext
26848 == foo ==
26849
26850 == bar ==
26851
26852 == baz ==
26853
26854 == <span> baz</span> ==
26855 !! end
26856
26857 !! test
26858 2. Headings: Add space before/after == even after hoisted content
26859 !! options
26860 parsoid={
26861 "modes": ["html2wt"],
26862 "scrubWikitext": true
26863 }
26864 !! html/parsoid
26865 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26866 !! wikitext
26867 [[Category:A2]]
26868
26869 == ok ==
26870 !! end
26871
26872 !! test
26873 1. Headings: suppress newly created empty headings
26874 !! options
26875 parsoid={
26876 "modes": ["html2wt"],
26877 "scrubWikitext": true
26878 }
26879 !! html/parsoid
26880 <h2></h2>
26881 !! wikitext
26882 !! end
26883
26884 !! test
26885 2. Headings: don't suppress empty headings if scrubWikitext is false
26886 !! options
26887 parsoid=html2wt
26888 !! html/parsoid
26889 <h2></h2>
26890 !! wikitext
26891 ==<nowiki/>==
26892 !! end
26893
26894 !! test
26895 3. Headings: suppress empty headings on edits
26896 !! options
26897 parsoid={
26898 "modes": ["selser"],
26899 "scrubWikitext": true,
26900 "changes": [
26901 [ "#x", "remove"]
26902 ]
26903 }
26904 !! wikitext
26905 ==<span id="x">foo</span>==
26906 !! wikitext/edited
26907 !! end
26908
26909 !! test
26910 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26911 !! options
26912 parsoid={
26913 "modes": ["html2wt"],
26914 "scrubWikitext": true
26915 }
26916 !! html/parsoid
26917 <h2>foo<br/>bar</h2>
26918 <h2>foo <span><br/>bar</span> baz</h2>
26919 !! wikitext
26920 == foo bar ==
26921
26922 == foo <span> bar</span> baz ==
26923 !! end
26924
26925 !! test
26926 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26927 !! options
26928 parsoid={
26929 "modes": ["html2wt"],
26930 "scrubWikitext": false
26931 }
26932 !! html/parsoid
26933 <h2>foo<br/>bar</h2>
26934 !! wikitext
26935 == foo<br> bar ==
26936 !! end
26937
26938 !! test
26939 1. WT Quote Tags: suppress newly created empty style tags
26940 !! options
26941 parsoid={
26942 "modes": ["html2wt"],
26943 "scrubWikitext": true
26944 }
26945 !! html/parsoid
26946 <i></i><b></b>
26947 !! wikitext
26948 !! end
26949
26950 !! test
26951 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26952 !! options
26953 parsoid=html2wt
26954 !! html/parsoid
26955 <i></i><b></b>
26956 !! wikitext
26957 ''<nowiki/>'''''<nowiki/>'''
26958 !! end
26959
26960 !! test
26961 3. WT Quote Tags: suppress empty style tags on edits
26962 !! options
26963 parsoid={
26964 "modes": ["selser"],
26965 "scrubWikitext": true,
26966 "changes": [
26967 [ "#x", "remove"]
26968 ]
26969 }
26970 !! wikitext
26971 '''<span id="x">foo</span>'''
26972 !! wikitext/edited
26973 !! end
26974
26975 !! test
26976 1. Anchors: suppress newly created empty anchors
26977 !! options
26978 parsoid={
26979 "modes": ["html2wt"],
26980 "scrubWikitext": true
26981 }
26982 !! html/parsoid
26983 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26984 !! wikitext
26985 !! end
26986
26987 !! test
26988 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26989 !! options
26990 parsoid={
26991 "modes": ["html2wt"],
26992 "scrubWikitext": false
26993 }
26994 !! html/parsoid
26995 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26996 !! wikitext
26997 [[Test|<nowiki/>]]
26998 !! end
26999
27000 !! test
27001 3. Anchors: suppress empty anchors on edits
27002 !! options
27003 parsoid={
27004 "modes": ["selser"],
27005 "scrubWikitext": true,
27006 "changes": [
27007 [ "#x", "remove"]
27008 ]
27009 }
27010 !! wikitext
27011 [[Test|<span id="x">foo</span>]]
27012 !! wikitext/edited
27013 !! end
27014
27015 !! test
27016 3a. Anchors: do not suppress numbered extlinks
27017 !! options
27018 parsoid={
27019 "modes": ["wt2wt"],
27020 "scrubWikitext": true
27021 }
27022 !! wikitext
27023 [http://foo.com]
27024 !! html/parsoid
27025 <a rel="mw:ExtLink" href="http://foo.com"></a>
27026 !! end
27027
27028 !! test
27029 3b. Anchors: do not suppress numbered extlinks
27030 !! options
27031 parsoid={
27032 "modes": ["wt2wt"],
27033 "scrubWikitext": true,
27034 "changes": [
27035 [ "#x", "remove"]
27036 ]
27037 }
27038 !! wikitext
27039 [http://foo.com <span id="x">foo</span>]
27040 !! wikitext/edited
27041 [http://foo.com]
27042 !! end
27043
27044 !!test
27045 Normalizations should be restricted to edited content
27046 !!options
27047 parsoid={
27048 "modes": ["selser"],
27049 "scrubWikitext": true,
27050 "changes": [
27051 [ "h1", "before", "<i></i>"]
27052 ]
27053 }
27054 !!wikitext
27055 a
27056 = =
27057 b
27058 !!wikitext/edited
27059 a
27060 = =
27061 b
27062 !!end
27063
27064 !! test
27065 1. Multiple normalizations (html2wt)
27066 !! options
27067 parsoid={
27068 "modes": ["html2wt"],
27069 "scrubWikitext": true
27070 }
27071 !! html
27072 <h2><i></i></h2>
27073 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27074 </a><b><i></i></b>x</p>
27075 !! wikitext
27076
27077 [[foo]]
27078 x
27079
27080 !! end
27081
27082 !! test
27083 2. Multiple normalizations (selser)
27084 !! options
27085 parsoid={
27086 "modes": ["selser"],
27087 "scrubWikitext": true,
27088 "changes": [
27089 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27090 ]
27091 }
27092 !! wikitext
27093 <span id="x">foo</span>
27094 !! wikitext/edited
27095 <span id="x">foo</span>
27096
27097 x
27098 !! end
27099
27100 !! test
27101 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27102 !! options
27103 parsoid={
27104 "modes": ["html2wt"],
27105 "scrubWikitext": true
27106 }
27107 !! html/parsoid
27108 <p> hi</p>
27109 <p> hello</p>
27110 !! wikitext
27111 hi
27112
27113 hello
27114 !! end
27115
27116 !! test
27117 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27118 !! options
27119 parsoid=html2wt
27120 !! html/parsoid
27121 <p> hi</p>
27122 <p> hello</p>
27123 !! wikitext
27124 <nowiki> </nowiki>hi
27125
27126 <nowiki> </nowiki> hello
27127 !! end
27128
27129 !! test
27130 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27131 !! options
27132 parsoid={
27133 "modes": ["html2wt"],
27134 "scrubWikitext": true
27135 }
27136 !! html/parsoid
27137 <p>Foo
27138 bar
27139 baz</p>
27140
27141 <table><tr><td>Foo
27142 bar
27143 baz bang</td></tr></table>
27144
27145 <p><!--boo--> foo
27146 bar</p>
27147
27148 <p> foo
27149 bar<span>boo</span></p>
27150 !! wikitext
27151 Foo
27152 bar
27153 baz
27154
27155 {|
27156 |Foo
27157 bar
27158 baz bang
27159 |}
27160
27161 <!--boo-->foo
27162 bar
27163
27164 foo
27165 bar<span>boo</span>
27166 !! end
27167
27168 !! test
27169 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27170 !! options
27171 parsoid={
27172 "modes": ["selser"],
27173 "scrubWikitext": true,
27174 "changes": [
27175 [ "p", "html", " a\n b" ]
27176 ]
27177 }
27178 !! wikitext
27179 xyz
27180 !! wikitext/edited
27181 a
27182 b
27183 !! end
27184
27185 !! test
27186 1. New links that end in spaces
27187 !! options
27188 parsoid={
27189 "modes": ["html2wt"],
27190 "scrubWikitext": false
27191 }
27192 !! html/parsoid
27193 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27194 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27195 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27196 !! wikitext
27197 [[Berlin ]]<nowiki/>is the capital of Germany.
27198
27199 [[Foo ]]'''bar'''
27200
27201 [[Boston ]] is a city.
27202 !! end
27203
27204 !! test
27205 2. New links that end in spaces
27206 !! options
27207 parsoid={
27208 "modes": ["html2wt"],
27209 "scrubWikitext": true
27210 }
27211 !! html/parsoid
27212 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27213 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27214 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27215 !! wikitext
27216 [[Berlin]] is the capital of Germany.
27217
27218 [[Foo]] '''bar'''
27219
27220 [[Boston]] is a city.
27221 !! end
27222
27223 !! test
27224 1. Table cells with escapable prefixes
27225 !! options
27226 parsoid={
27227 "modes": ["html2wt"],
27228 "scrubWikitext": false
27229 }
27230 !! html
27231 <table>
27232 <tr><td>a</td></tr>
27233 <tr><td>-</td></tr>
27234 <tr><td>+</td></tr>
27235 </table>
27236 !! wikitext
27237 {|
27238 |a
27239 |-
27240 |<nowiki>-</nowiki>
27241 |-
27242 |<nowiki>+</nowiki>
27243 |}
27244 !! end
27245
27246 !! test
27247 2. Table cells with escapable prefixes
27248 !! options
27249 parsoid={
27250 "modes": ["html2wt"],
27251 "scrubWikitext": true
27252 }
27253 !! html
27254 <table>
27255 <tr><td>a</td></tr>
27256 <tr><td>-</td></tr>
27257 <tr><td>+</td></tr>
27258 </table>
27259 !! wikitext
27260 {|
27261 |a
27262 |-
27263 | -
27264 |-
27265 | +
27266 |}
27267 !! end
27268
27269 !! test
27270 3a. Table cells with escapable prefixes after edits
27271 !! options
27272 parsoid={
27273 "modes": ["selser"],
27274 "scrubWikitext": true,
27275 "changes": [
27276 [ "table tbody tr:first-child td:first-child", "remove"]
27277 ]
27278 }
27279 !! wikitext
27280 {|
27281 |a||-
27282 |}
27283 !! wikitext/edited
27284 {|
27285 | -
27286 |}
27287 !! end
27288
27289 !! test
27290 3b. Table cells with escapable prefixes after edits
27291 !! options
27292 parsoid={
27293 "modes": ["selser"],
27294 "scrubWikitext": true,
27295 "changes": [
27296 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27297 [ "#x", "remove" ]
27298 ]
27299 }
27300 !! wikitext
27301 {|
27302 |pqr
27303 |<span id="x">foo</span>+
27304 |}
27305 !! wikitext/edited
27306 {|
27307 | -
27308 | +
27309 |}
27310 !! end
27311
27312 # FIXME: This test will fail because
27313 # normalization doesn't realize that the id attribute
27314 # will eliminate the escapable scenario
27315 !! test
27316 4a. Table cells without escapable prefixes after edits
27317 !! options
27318 parsoid={
27319 "modes": ["selser"],
27320 "scrubWikitext": true,
27321 "changes": [
27322 [ "#x", "html", "-" ]
27323 ]
27324 }
27325 !! wikitext
27326 {|
27327 | id="x" |abcd
27328 |}
27329 !! wikitext/edited
27330 {|
27331 | id="x" |-
27332 |}
27333 !! end
27334
27335 ## This tests normalizer's ability to discriminate between
27336 ## cells having identical content.
27337 !! test
27338 4b. Table cells without escapable prefixes after edits
27339 !! options
27340 parsoid={
27341 "modes": ["selser"],
27342 "scrubWikitext": true,
27343 "changes": [
27344 [ "td", "html", "-" ]
27345 ]
27346 }
27347 !! wikitext
27348 {|
27349 |a||b
27350 |}
27351 !! wikitext/edited
27352 {|
27353 | -||-
27354 |}
27355 !! end
27356
27357 ## This tests normalizer's ability to not be tripped by
27358 ## comments (and whitespace)
27359 !! test
27360 4c. Table cells without escapable prefixes after edits
27361 !! options
27362 parsoid={
27363 "modes": ["selser"],
27364 "scrubWikitext": true,
27365 "changes": [
27366 [ "table tbody tr td:first-child", "remove" ]
27367 ]
27368 }
27369 !! wikitext
27370 {|
27371 |-
27372 <!--foo--> |a||-
27373 |}
27374 !! wikitext/edited
27375 {|
27376 |-
27377 <!--foo--> | -
27378 |}
27379 !! end
27380
27381 ## This tests normalizer's ability to handle HTML cells
27382 !! test
27383 4d. Table cells without escapable prefixes after edits
27384 !! options
27385 parsoid={
27386 "modes": ["selser"],
27387 "scrubWikitext": true,
27388 "changes": [
27389 [ "td", "html", "-" ]
27390 ]
27391 }
27392 !! wikitext
27393 <table>
27394 <tr><td>a</td></tr>
27395 </table>
27396 !! wikitext/edited
27397 <table>
27398 <tr><td>-</td></tr>
27399 </table>
27400 !! end
27401
27402 ## T111151 Remove font elements without attributes
27403 !! test
27404 5a. font tags without attributes should be dropped in scrubWikitext mode
27405 !! options
27406 parsoid={
27407 "modes": ["html2wt"],
27408 "scrubWikitext": true
27409 }
27410 !! html
27411 <font>foo</font>
27412 <font><font>bar</font></font>
27413 <font class="x">boo</font>
27414 !! wikitext
27415 foo
27416 bar
27417 <font class="x">boo</font>
27418 !! end
27419
27420 !! test
27421 5b. font tags should not be dropped without scrubWikitext being enabled
27422 !! options
27423 parsoid={
27424 "modes": ["html2wt"],
27425 "scrubWikitext": false
27426 }
27427 !! html
27428 <font>foo</font>
27429 !! wikitext
27430 <font>foo</font>
27431 !! end
27432
27433 !! test
27434 Escape nowiki DOM elements
27435 !! options
27436 parsoid=html2wt
27437 !! html/parsoid
27438 <nowiki><i>foo</i></nowiki>
27439 !! wikitext
27440 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27441 !! end
27442
27443 # This is meant to be an interim fix while we go about figuring out
27444 # how to not introduce these trailing <nowiki/>s in the first place.
27445 !! test
27446 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27447 !! options
27448 parsoid=html2wt
27449 !! html/parsoid
27450 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27451 y</p>
27452 <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>
27453 <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>
27454 !! wikitext
27455 x
27456 y
27457
27458 {{echo|
27459 1 = <nowiki/>}}
27460
27461 {{echo|
27462 1 = <nowiki/>
27463 }}
27464 !! end
27465
27466 # ---------------------------------------------------
27467 # End of tests spec'ing wikitext serialization norms |
27468 # ---------------------------------------------------
27469
27470 # T104032
27471 !! test
27472 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27473 !! options
27474 parsoid=html2wt
27475 !! html/parsoid
27476 a<p>b</p>
27477 <b>c</b><p>d</p>
27478 <table><tr>
27479 <td>a<p>b</p></td>
27480 <td><b>c</b><p>d</p></td>
27481 </tr></table>
27482 !! wikitext
27483 a
27484
27485 b
27486
27487 '''c'''
27488
27489 d
27490 {|
27491 |a
27492 b
27493 |'''c'''
27494 d
27495 |}
27496 !! end
27497
27498 !! test
27499 Anchor without href scenarios
27500 !! options
27501 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27502 !! html/parsoid
27503 <a class="bc"></a>
27504 <a class="no">dice</a>
27505 <a name="foo"></a>
27506 !! wikitext
27507
27508 dice
27509 <span name="foo"></span>
27510 !! end
27511
27512 # -----------------------------------------------------------------
27513 # End of section for Parsoid-only html2wt tests for serialization
27514 # of new content
27515 # -----------------------------------------------------------------
27516
27517 # -----------------------------------------------------------------
27518 # The following section of tests are primarily to spec behavior of
27519 # the selective serializer. All these tests have manual selser
27520 # changes. The automated selser changes for all tests handle the
27521 # wide variation of changes, but these tests here capture specs
27522 # deterministically.
27523 # ----------------------------------------------------------------
27524
27525 ## T90517
27526 !! test
27527 Selser: New comments should not be lost
27528 !! options
27529 parsoid={
27530 "modes": ["selser"],
27531 "changes": [
27532 [ "#a", "after", "<!--c1-->" ],
27533 [ "#b", "before", "<!--c2-->" ]
27534 ]
27535 }
27536 !! wikitext
27537 <span id="a">a</span>
27538
27539 <span id="b">b</span>
27540 !! wikitext/edited
27541 <span id="a">a</span><!--c1-->
27542
27543 <!--c2--><span id="b">b</span>
27544 !! end
27545
27546 ## T89383
27547 !! test
27548 Selser: Check for validity of DSR before using it
27549 !! options
27550 parsoid={
27551 "modes": ["selser"],
27552 "changes": [
27553 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27554 ]
27555 }
27556 !! wikitext
27557 <span id="a">a</span>
27558 !! wikitext/edited
27559 {{DISPLAYTITLE:foo}}
27560 <span id="a">a</span>
27561 !! end
27562
27563 !! test
27564 1. DOMDiff: Changes to <ref> content should be looked up using id
27565 !! options
27566 parsoid={
27567 "modes": ["selser"],
27568 "changes": [
27569 ["#X", "after", "bar"],
27570 ["#Y", "after", "baz"]
27571 ]
27572 }
27573 !! wikitext
27574 X <ref><span id="X">foo</span></ref>
27575 Y <ref name="a" />
27576 <references>
27577 <ref name="a"><span id="Y">foo</span></ref>
27578 </references>
27579 !! wikitext/edited
27580 X <ref><span id="X">foo</span>bar</ref>
27581 Y <ref name="a" />
27582 <references>
27583 <ref name="a"><span id="Y">foo</span>baz</ref>
27584 </references>
27585 !! end
27586
27587 !! test
27588 2. DOMDiff: Changes to <ref> content should be looked up using id
27589 !! options
27590 parsoid={
27591 "modes": ["selser"],
27592 "changes": [
27593 ["#Z", "after", "bar"]
27594 ]
27595 }
27596 !! wikitext
27597 A <ref>foo bar for a</ref>
27598 B <ref group="X" name="b" />
27599
27600 <references />
27601
27602 <references group="X">
27603 <ref name="b"><span id="Z">foo</span></ref>
27604 </references>
27605 !! wikitext/edited
27606 A <ref>foo bar for a</ref>
27607 B <ref group="X" name="b" />
27608
27609 <references />
27610
27611 <references group="X">
27612 <ref name="b"><span id="Z">foo</span>bar</ref>
27613 </references>
27614 !! end
27615
27616 !! test
27617 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27618 !! options
27619 parsoid={
27620 "modes": ["selser"],
27621 "changes": [
27622 [ "div:first-child", "text", "bar" ]
27623 ]
27624 }
27625 !! wikitext
27626 <div style="{{1x|color:red;}}%">foo</div>
27627 !! wikitext/edited
27628 <div style="{{1x|color:red;}}%">bar</div>
27629 !! end
27630
27631 !! test
27632 Empty LI (T49673)
27633 !! wikitext
27634 * a
27635 *
27636 *
27637 * b
27638 !! html/php+tidy
27639 <ul>
27640 <li>a</li>
27641 <li class="mw-empty-elt"></li>
27642 <li class="mw-empty-elt"></li>
27643 <li>b</li>
27644 </ul>
27645 !! end
27646
27647 !! test
27648 Thumbnail output
27649 !! wikitext
27650 [[File:Thumb.png|thumb]]
27651 !! html/php+tidy
27652 <div class="thumb tright">
27653 <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>
27654 <div class="thumbcaption">
27655 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27656 </div>
27657 </div>
27658 </div>
27659 !! end
27660
27661 !! test
27662 unclosed internal link XSS (T137264)
27663 !! wikitext
27664 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27665 !! html/php
27666 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27667 </p>
27668 !! html/parsoid
27669 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
27670 !! end