Merge "Get better error message for duplicate names in MagicWordArray"
[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 # wrap include the normal wrapper <div class="mw-parser-output"> (since 1.30)
36 #
37 # You can also set the following parser properties via test options:
38 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
39 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
40 # wgEnableMagicLinks
41 #
42 # For testing purposes, temporary articles can created:
43 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
44 # where '/' denotes a newline.
45
46 # This is the standard article assumed to exist.
47 !! article
48 Main Page
49 !! text
50 blah blah
51 !! endarticle
52
53 !!article
54 Foo
55 !!text
56 FOO
57 !!endarticle
58
59 !!article
60 Template:Foo
61 !!text
62 FOO
63 !!endarticle
64
65 !! article
66 Template:Blank
67 !! text
68 !! endarticle
69
70 !! article
71 Template:pipe
72 !! text
73 |
74 !! endarticle
75
76 !! article
77 Template:=
78 !! text
79 <nowiki>=</nowiki>
80 !! endarticle
81
82 !!article
83 MediaWiki:bad image list
84 !!text
85 * [[File:Bad.jpg]] except [[Nasty page]]
86 !!endarticle
87
88 !! article
89 Template:inner list
90 !! text
91 * item 1
92 !! endarticle
93
94 !! article
95 Template:tbl-start
96 !! text
97 {|
98 !! endarticle
99
100 !! article
101 Template:tbl-end
102 !! text
103 |}
104 !! endarticle
105
106 !! article
107 Template:echo
108 !! text
109 {{{1}}}
110 !! endarticle
111
112 !! article
113 Template:echo_with_span
114 !! text
115 <span>{{{1}}}</span>
116 !! endarticle
117
118 !! article
119 Template:echo_with_div
120 !! text
121 <div>{{{1}}}</div>
122 !! endarticle
123
124 !! article
125 Template:blank_param
126 !! text
127 {{{1}}}
128 {{{}}}
129 !! endarticle
130
131 !! article
132 Template:table_attribs
133 !! text
134 <noinclude>
135 |</noinclude>style="color:red;"|Foo
136 !! endarticle
137
138 !! article
139 Template:table_attribs_2
140 !! text
141 <noinclude>
142 |</noinclude>style="color:red;"|Foo
143 |Bar||Baz
144 !! endarticle
145
146 !! article
147 Template:table_attribs_3
148 !! text
149 <noinclude>
150 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
151 !! endarticle
152
153 !! article
154 Template:table_attribs_4
155 !! text
156 | style="background-color:#DC241f;" width="10px" |
157 !! endarticle
158
159 !! article
160 Template:table_attribs_5
161 !! text
162 <noinclude>
163 |</noinclude>style="color:red;"||Bar
164 !! endarticle
165
166 !! article
167 Template:table_attribs_6
168 !! text
169 style="background: <nowiki>
170
171
172 red;</nowiki>" |
173 !! endarticle
174
175 !! article
176 Template:table_attribs_7
177 !! text
178 <noinclude>
179 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
180 !! endarticle
181
182 !! article
183 Template:table_header_cells
184 !! text
185 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
186 !! endarticle
187
188 !! article
189 Template:table_cells
190 !! text
191 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
192 !! endarticle
193
194 !! article
195 Template:PartialTable
196 !! text
197 {|
198 |-
199 !! endarticle
200
201 !! article
202 Template:image_attribs
203 !! text
204 <noinclude>
205 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
206 !! endarticle
207
208 ## See T48811 for details
209 !! article
210 Template:mixed_attr_content_template
211 !! text
212 style="color:red;" title="T48811"
213 |-
214 |foo
215 !! endarticle
216
217 !! article
218 Template:definition_list
219 !! text
220 one
221 ::two
222 !! endarticle
223
224 !! article
225 A?b
226 !! text
227 Weirdo titles!
228 !! endarticle
229
230 !!article
231 Template:Bullet
232 !!text
233 * Bar
234 !!endarticle
235
236 !!article
237 Template:OpenTable
238 !!text
239 {|
240 !!endarticle
241
242 !!article
243 Template:EmptyLITest
244 !!text
245 *a
246 *
247 *
248 *b
249 !!endarticle
250
251 !!article
252 Template:EmptyTRTest
253 !!text
254 {|
255 |-
256 |-
257 |foo
258 |-
259 |-
260 |bar
261 |}
262 !!endarticle
263
264 !!article
265 Template:EmptyTRWithHTMLAttrTest
266 !!text
267 <table>
268 <tr align="center"></tr>
269 <tr><td>foo</td></tr>
270 <tr align="center"></tr>
271 <tr><td>bar</td></tr>
272 </table>
273 !!endarticle
274
275 !! article
276 Template:CircularRef
277 !! text
278 <ref>{{CircularRef}}</ref>
279 !! endarticle
280
281 ###
282 ### Basic tests
283 ###
284 !! test
285 Blank input
286 !! wikitext
287 !! html
288 !! end
289
290 !! test
291 CircularRef
292 !! wikitext
293 {{CircularRef}}
294 <references />
295 !! html/parsoid
296 <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>
297 <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>
298 !! end
299
300 !! test
301 Simple paragraph
302 !! wikitext
303 This is a simple paragraph.
304 !! html
305 <p>This is a simple paragraph.
306 </p>
307 !! end
308
309 !! test
310 Paragraphs with extra newline spacing
311 !! wikitext
312 foo
313
314 bar
315
316
317 baz
318
319
320
321 booz
322 !! html
323 <p>foo
324 </p><p>bar
325 </p><p><br />
326 baz
327 </p><p><br />
328 </p><p>booz
329 </p>
330 !! end
331
332 !! test
333 Paragraphs with newline spacing with comment lines in between
334 !! wikitext
335 ----
336 a
337 <!--foo-->
338 b
339 ----
340 a
341 <!--foo--><!--More than 1 comment, still stripped-->
342 b
343 ----
344 a
345 <!--foo--> <!----> <!-- bar -->
346 b
347 ----
348 a
349 <!--foo-->
350
351 b
352 ----
353 a
354
355 <!--foo-->
356 b
357 ----
358 a
359 <!--foo-->
360
361
362 b
363 ----
364 a
365
366
367 <!--foo-->
368 b
369 ----
370 !! html
371 <hr />
372 <p>a
373 b
374 </p>
375 <hr />
376 <p>a
377 b
378 </p>
379 <hr />
380 <p>a
381 b
382 </p>
383 <hr />
384 <p>a
385 </p><p>b
386 </p>
387 <hr />
388 <p>a
389 </p><p>b
390 </p>
391 <hr />
392 <p>a
393 </p><p><br />
394 b
395 </p>
396 <hr />
397 <p>a
398 </p><p><br />
399 b
400 </p>
401 <hr />
402
403 !! end
404
405 !! test
406 Paragraphs with newline spacing with non-empty white-space lines in between
407 !! wikitext
408 ----
409 a
410
411 b
412 ----
413 a
414
415
416 b
417 ----
418 !! html
419 <hr />
420 <p>a
421 </p><p>b
422 </p>
423 <hr />
424 <p>a
425 </p><p><br />
426 b
427 </p>
428 <hr />
429
430 !! end
431
432 !! test
433 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
434 !! wikitext
435 ----
436 a
437 <!--foo-->
438 b
439 ----
440 a
441 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
442 b
443 ----
444 a
445
446 <!--foo-->
447 <!--bar-->
448 b
449 ----
450 a
451
452 <!--foo-->
453 <!--bar-->
454
455 b
456 ----
457 !! html
458 <hr />
459 <p>a
460 b
461 </p>
462 <hr />
463 <p>a
464 b
465 </p>
466 <hr />
467 <p>a
468 </p><p>b
469 </p>
470 <hr />
471 <p>a
472 </p><p><br />
473 b
474 </p>
475 <hr />
476
477 !! end
478
479 !! test
480 Extra newlines: More paragraphs with indented comment
481 !! wikitext
482 a
483
484 <!--boo-->
485
486 b
487 !! html
488 <p>a
489 </p><p><br />
490 b
491 </p>
492 !!end
493
494 !! test
495 Extra newlines followed by heading
496 !! wikitext
497 a
498
499
500
501 =b=
502 [[a]]
503
504
505 =b=
506 !! html
507 <p>a
508 </p><p><br />
509 </p>
510 <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>
511 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
512 </p><p><br />
513 </p>
514 <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>
515
516 !! end
517
518 !! test
519 Extra newlines between heading and content are swallowed
520 !! wikitext
521 =b=
522
523
524
525 [[a]]
526 !! html
527 <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>
528 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
529 </p>
530 !! end
531
532 !! test
533 Heading with line break in nowiki
534 !! options
535 parsoid=wt2html
536 !! wikitext
537 == A <nowiki>B
538 C</nowiki> ==
539 !! html
540 <h2><span class="mw-headline" id="A_B.0AC">A B
541 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>
542
543 !! html/parsoid
544 <h2 id="A_B.0AC">A <span typeof="mw:Nowiki">B
545 C</span> </h2>
546 !! end
547
548 !! test
549 Parsing an URL
550 !! wikitext
551 http://fr.wikipedia.org/wiki/🍺
552 <!-- EasterEgg we love beer, better be able be able to link to it -->
553 !! html
554 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
555 </p>
556 !! end
557
558 # Note that the html+tidy output removes the spaces after the <li>,
559 # which is a bug (https://sourceforge.net/p/tidy/bugs/945/, etc).
560 # This is an issue for all tests with lists. We intentionally do
561 # *not* add html+tidy clauses for these, as we don't want to
562 # document/test the broken behavior. (Parsoid matches the non-tidy
563 # output in these cases.)
564
565 !! test
566 Simple list
567 !! wikitext
568 * Item 1
569 * Item 2
570 !! html
571 <ul><li> Item 1</li>
572 <li> Item 2</li></ul>
573
574 !! end
575
576 !! test
577 Italics and bold
578 !! wikitext
579 * plain
580 * plain''italic''plain
581 * plain''italic''plain''italic''plain
582 * plain'''bold'''plain
583 * plain'''bold'''plain'''bold'''plain
584 * plain''italic''plain'''bold'''plain
585 * plain'''bold'''plain''italic''plain
586 * plain''italic'''bold-italic'''italic''plain
587 * plain'''bold''bold-italic''bold'''plain
588 * plain'''''bold-italic'''italic''plain
589 * plain'''''bold-italic''bold'''plain
590 * plain''italic'''bold-italic'''''plain
591 * plain'''bold''bold-italic'''''plain
592 * plain l'''italic''plain
593 * plain l''''bold''' plain
594 !! html
595 <ul><li> plain</li>
596 <li> plain<i>italic</i>plain</li>
597 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
598 <li> plain<b>bold</b>plain</li>
599 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
600 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
601 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
602 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
603 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
604 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
605 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
606 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
607 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
608 <li> plain l'<i>italic</i>plain</li>
609 <li> plain l'<b>bold</b> plain</li></ul>
610
611 !! end
612
613 # this example taken from the [[simple:Moon]] article (T49326)
614 !! test
615 Italics and possessives (1)
616 !! wikitext
617 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
618 !! html
619 <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
620 </p>
621 !! end
622
623 # this example taken from [[en:Flaming Pie]] (T51926)
624 !! test
625 Italics and possessives (2)
626 !! wikitext
627 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
628 !! html
629 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
630 </p>
631 !! end
632
633 # this example taken from [[en:Dictionary]] (T51926)
634 !! test
635 Italics and possessives (3)
636 !! wikitext
637 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''.
638 !! html
639 <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>.
640 </p>
641 !! end
642
643
644 ###
645 ### 2-quote opening sequence tests
646 ###
647 !! test
648 Italics and bold: 2-quote opening sequence: (2,2)
649 !! wikitext
650 ''foo''
651 !! html
652 <p><i>foo</i>
653 </p>
654 !!end
655
656 !! test
657 Italics and bold: 2-quote opening sequence: (2,3)
658 !! wikitext
659 ''foo'''
660 !! html/*
661 <p><i>foo'</i>
662 </p>
663 !!end
664
665 !! test
666 Italics and bold: 2-quote opening sequence: (2,4)
667 !! options
668 parsoid=wt2html
669 !! wikitext
670 ''foo''''
671 !! html/*
672 <p><i>foo''</i>
673 </p>
674 !!end
675
676 # same html as previous, but wikitext adjusted to match parsoid html2wt
677 !! test
678 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
679 !! wikitext
680 ''foo<nowiki>''</nowiki>''
681 !! html
682 <p><i>foo''</i>
683 </p>
684 !! end
685
686 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
687 !! test
688 Italics and bold: 2-quote opening sequence: (2,5)
689 !! options
690 parsoid=wt2html
691 !! wikitext
692 ''foo'''''
693 !! html/php
694 <p><i>foo</i>
695 </p>
696 !! html/parsoid
697 <p><i>foo</i><b></b>
698 </p>
699 !!end
700
701 # same html as previous, but wikitext adjusted to match parsoid html2wt
702 !! test
703 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
704 !! wikitext
705 ''foo'''''<nowiki/>'''
706 !! html/php
707 <p><i>foo</i>
708 </p>
709 !! html/parsoid
710 <p><i>foo</i><b></b>
711 </p>
712 !! end
713
714
715 ###
716 ### 3-quote opening sequence tests
717 ###
718
719 !! test
720 Italics and bold: 3-quote opening sequence: (3,2)
721 !! wikitext
722 '''foo''
723 !! html/*
724 <p>'<i>foo</i>
725 </p>
726 !!end
727
728 !! test
729 Italics and bold: 3-quote opening sequence: (3,3)
730 !! wikitext
731 '''foo'''
732 !! html
733 <p><b>foo</b>
734 </p>
735 !!end
736
737 !! test
738 Italics and bold: 3-quote opening sequence: (3,4)
739 !! wikitext
740 '''foo''''
741 !! html/*
742 <p><b>foo'</b>
743 </p>
744 !!end
745
746 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
747 !! test
748 Italics and bold: 3-quote opening sequence: (3,5)
749 !! options
750 parsoid=wt2html
751 !! wikitext
752 '''foo'''''
753 !! html/php
754 <p><b>foo</b>
755 </p>
756 !! html/parsoid
757 <p><b>foo</b><i></i>
758 </p>
759 !!end
760
761 # same html as previous, but wikitext adjusted to match parsoid html2wt
762 !! test
763 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
764 !! wikitext
765 '''foo'''''<nowiki/>''
766 !! html/php
767 <p><b>foo</b>
768 </p>
769 !! html/parsoid
770 <p><b>foo</b><i></i>
771 </p>
772 !! end
773
774
775 ###
776 ### 4-quote opening sequence tests
777 ###
778
779 !! test
780 Italics and bold: 4-quote opening sequence: (4,2)
781 !! options
782 parsoid=wt2html
783 !! wikitext
784 ''''foo''
785 !! html/*
786 <p>''<i>foo</i>
787 </p>
788 !!end
789
790 # same html as previous, but wikitext adjusted to match parsoid html2wt
791 !! test
792 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
793 !! wikitext
794 <nowiki>''</nowiki>''foo''
795 !! html
796 <p>''<i>foo</i>
797 </p>
798 !! end
799
800 !! test
801 Italics and bold: 4-quote opening sequence: (4,3)
802 !! wikitext
803 ''''foo'''
804 !! html/*
805 <p>'<b>foo</b>
806 </p>
807 !!end
808
809 !! test
810 Italics and bold: 4-quote opening sequence: (4,4)
811 !! options
812 parsoid=wt2html
813 !! wikitext
814 ''''foo''''
815 !! html/*
816 <p>'<b>foo'</b>
817 </p>
818 !!end
819
820 # same html as previous, but wikitext adjusted to match parsoid html2wt
821 !! test
822 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
823 !! wikitext
824 '<nowiki/>'''foo''''
825 !! html
826 <p>'<b>foo'</b>
827 </p>
828 !! end
829
830 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
831 !! test
832 Italics and bold: 4-quote opening sequence: (4,5)
833 !! options
834 parsoid=wt2html
835 !! wikitext
836 ''''foo'''''
837 !! html/php
838 <p>'<b>foo</b>
839 </p>
840 !! html/parsoid
841 <p>'<b>foo</b><i></i>
842 </p>
843 !!end
844
845 # same html as previous, but wikitext adjusted to match parsoid html2wt
846 !! test
847 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
848 !! wikitext
849 '<nowiki/>'''foo'''''<nowiki/>''
850 !! html/php
851 <p>'<b>foo</b>
852 </p>
853 !! html/parsoid
854 <p>'<b>foo</b><i></i>
855 </p>
856 !! end
857
858
859 ###
860 ### 5-quote opening sequence tests
861 ###
862
863 !! test
864 Italics and bold: 5-quote opening sequence: (5,2)
865 !! options
866 parsoid=wt2html
867 !! wikitext
868 '''''foo''
869 !! html/*
870 <p><b><i>foo</i></b>
871 </p>
872 !!end
873
874 # same html as previous, but wikitext adjusted to match parsoid html2wt
875 !! test
876 Italics and bold: 5-quote opening sequence: (5,2+3)
877 !! wikitext
878 '''''foo'''''
879 !! html/*
880 <p><i><b>foo</b></i>
881 </p>
882 !! end
883
884 !! test
885 Italics and bold: 5-quote opening sequence: (5,3)
886 !! options
887 parsoid=wt2html
888 !! wikitext
889 '''''foo'''
890 !! html/*
891 <p><i><b>foo</b></i>
892 </p>
893 !!end
894
895 # same html as previous, but wikitext adjusted to match parsoid html2wt
896 !! test
897 Italics and bold: 5-quote opening sequence: (5,3+2)
898 !! wikitext
899 '''''foo'''''
900 !! html
901 <p><i><b>foo</b></i>
902 </p>
903 !! end
904
905 !! test
906 Italics and bold: 5-quote opening sequence: (5,4)
907 !! options
908 parsoid=wt2html
909 !! wikitext
910 '''''foo''''
911 !! html/*
912 <p><i><b>foo'</b></i>
913 </p>
914 !!end
915
916 !! test
917 Italics and bold: 5-quote opening sequence: (5,5)
918 !! wikitext
919 '''''foo'''''
920 !! html
921 <p><i><b>foo</b></i>
922 </p>
923 !!end
924
925 !! test
926 Italics and bold: 5-quote opening sequence: (5,6)
927 !! wikitext
928 '''''foo''''''
929 !! html/*
930 <p><i><b>foo'</b></i>
931 </p>
932 !! end
933
934 ###
935 ### multiple quote sequences in a line
936 ###
937
938 !! test
939 Italics and bold: multiple quote sequences: (2,4,2)
940 !! options
941 parsoid=wt2html
942 !! wikitext
943 ''foo''''bar''
944 !! html/*
945 <p><i>foo'<b>bar</b></i>
946 </p>
947 !! end
948
949 # same html as previous, but wikitext adjusted to match parsoid html2wt
950 !! test
951 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
952 !! wikitext
953 ''foo'<nowiki/>'''bar'''''
954 !! html
955 <p><i>foo'<b>bar</b></i>
956 </p>
957 !! end
958
959 !! test
960 Italics and bold: multiple quote sequences: (2,4,3)
961 !! options
962 parsoid=wt2html
963 !! wikitext
964 ''foo''''bar'''
965 !! html/*
966 <p><i>foo'<b>bar</b></i>
967 </p>
968 !! end
969
970 # same html as previous, but wikitext adjusted to match parsoid html2wt
971 !! test
972 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
973 !! wikitext
974 ''foo'<nowiki/>'''bar'''''
975 !! html
976 <p><i>foo'<b>bar</b></i>
977 </p>
978 !! end
979
980 !! test
981 Italics and bold: multiple quote sequences: (2,4,4)
982 !! options
983 parsoid=wt2html
984 !! wikitext
985 ''foo''''bar''''
986 !! html/*
987 <p><i>foo'<b>bar'</b></i>
988 </p>
989 !! end
990
991 # same html as previous, but wikitext adjusted to match parsoid html2wt
992 !! test
993 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
994 !! wikitext
995 ''foo'<nowiki/>'''bar'<nowiki/>'''''
996 !! html
997 <p><i>foo'<b>bar'</b></i>
998 </p>
999 !! end
1000
1001 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1002 !! test
1003 Italics and bold: multiple quote sequences: (3,4,2)
1004 !! options
1005 parsoid=wt2html
1006 !! wikitext
1007 '''foo''''bar''
1008 !! html/php
1009 <p><b>foo'</b>bar
1010 </p>
1011 !! html/parsoid
1012 <p><b>foo'</b>bar<i></i>
1013 </p>
1014 !! end
1015
1016 # same html as previous, but wikitext adjusted to match parsoid html2wt
1017 !! test
1018 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1019 !! wikitext
1020 '''foo''''bar''<nowiki/>''
1021 !! html/php
1022 <p><b>foo'</b>bar
1023 </p>
1024 !! html/parsoid
1025 <p><b>foo'</b>bar<i></i>
1026 </p>
1027 !! end
1028
1029 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1030 !! test
1031 Italics and bold: multiple quote sequences: (3,4,3)
1032 !! options
1033 parsoid=wt2html
1034 !! wikitext
1035 '''foo''''bar'''
1036 !! html/php
1037 <p><b>foo'</b>bar
1038 </p>
1039 !! html/parsoid
1040 <p><b>foo'</b>bar<b></b>
1041 </p>
1042 !! end
1043
1044 # same html as previous, but wikitext adjusted to match parsoid html2wt
1045 !! test
1046 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1047 !! wikitext
1048 '''foo''''bar'''<nowiki/>'''
1049 !! html/php
1050 <p><b>foo'</b>bar
1051 </p>
1052 !! html/parsoid
1053 <p><b>foo'</b>bar<b></b>
1054 </p>
1055 !! end
1056
1057 ###
1058 ### other quote tests
1059 ###
1060 !! test
1061 Italics and bold: other quote tests: (2,3,5)
1062 !! wikitext
1063 ''this is about '''foo's family'''''
1064 !! html
1065 <p><i>this is about <b>foo's family</b></i>
1066 </p>
1067 !!end
1068
1069
1070 !! test
1071 Italics and bold: other quote tests: (2,(3,3),2)
1072 !! wikitext
1073 ''this is about '''foo's''' family''
1074 !! html
1075 <p><i>this is about <b>foo's</b> family</i>
1076 </p>
1077 !!end
1078
1079
1080 !! test
1081 Italics and bold: other quote tests: (3,2,3,2)
1082 !! options
1083 parsoid=wt2html
1084 !! wikitext
1085 '''this is about ''foo'''s family''
1086 !! html/*
1087 <p><b>this is about <i>foo</i></b><i>s family</i>
1088 </p>
1089 !!end
1090
1091
1092 # same html as previous, but wikitext adjusted to match parsoid html2wt
1093 !! test
1094 Italics and bold: other quote tests: (3,2,3+2+2,2)
1095 !! wikitext
1096 '''this is about ''foo'''''<nowiki/>''s family''
1097 !! html
1098 <p><b>this is about <i>foo</i></b><i>s family</i>
1099 </p>
1100 !! end
1101
1102
1103 !! test
1104 Italics and bold: other quote tests: (3,2,3,3)
1105 !! wikitext
1106 '''this is about ''foo'''s family'''
1107 !! html/*
1108 <p>'<i>this is about </i>foo<b>s family</b>
1109 </p>
1110 !!end
1111
1112
1113 !! test
1114 Italics and bold: other quote tests: (3,(2,2),3)
1115 !! wikitext
1116 '''this is about ''foo's'' family'''
1117 !! html
1118 <p><b>this is about <i>foo's</i> family</b>
1119 </p>
1120 !!end
1121
1122
1123 !! test
1124 Italicized possessive
1125 !! wikitext
1126 The ''[[Main Page]]'''s talk page.
1127 !! html/php
1128 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1129 </p>
1130 !! html/parsoid
1131 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1132 !! end
1133
1134 !! test
1135 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1136 (Requires tidy for PHP parser output to be fixed up)
1137 !! options
1138 parsoid=wt2html,wt2wt
1139 !! wikitext
1140 {|
1141 !''a!!''b
1142 |''a||''b
1143 |}
1144 !! html/php+tidy
1145 <table>
1146 <tr>
1147 <th><i>a</i></th>
1148 <th><i>b</i></th>
1149 <td><i>a</i></td>
1150 <td><i>b</i></td>
1151 </tr>
1152 </table>
1153 !! html/parsoid
1154 <table>
1155 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1156 <td><i>a</i></td><td><i>b</i></td></tr>
1157 </tbody></table>
1158 !! end
1159
1160 ###
1161 ### Non-html5 tags
1162 ###
1163
1164 !! test
1165 Non-html5 tags should be accepted
1166 !! wikitext
1167 <center>''foo''</center>
1168 <big>''foo''</big>
1169 <font>''foo''</font>
1170 <strike>''foo''</strike>
1171 <tt>''foo''</tt>
1172 !! html
1173 <center><i>foo</i></center>
1174 <p><big><i>foo</i></big>
1175 <font><i>foo</i></font>
1176 <strike><i>foo</i></strike>
1177 <tt><i>foo</i></tt>
1178 </p>
1179 !! end
1180
1181 !! test
1182 <wbr> is valid wikitext (T54468)
1183 !! wikitext
1184 <wbr>
1185 !! html
1186 <p><wbr />
1187 </p>
1188 !! end
1189
1190 # <strike> is HTML4, <s> is HTML4/5.
1191 !! test
1192 <s> or <strike> for strikethrough
1193 !! wikitext
1194 <strike>strike</strike>
1195
1196 <s>s</s>
1197 !! html
1198 <p><strike>strike</strike>
1199 </p><p><s>s</s>
1200 </p>
1201 !! end
1202
1203 ## a not permitted
1204 ## i,b,br omitted
1205 !! test
1206 Text-level semantic html elements in wikitext
1207 !! wikitext
1208 <em>text</em>
1209 <strong>text</strong>
1210 <small>text</small>
1211 <s>text</s>
1212 <cite>text</cite>
1213 <q>text</q>
1214 <dfn>text</dfn>
1215 <abbr>text</abbr>
1216 <data>text</data>
1217 <time>text</time>
1218 <code>text</code>
1219 <var>text</var>
1220 <samp>text</samp>
1221 <kbd>text</kbd>
1222 <sub>text</sub>
1223 <u>text</u>
1224 <mark>text</mark>
1225 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1226 <bdi>text</bdi>
1227 <bdo>text</bdo>
1228 <span>text</span>
1229 <wbr />
1230 !! html
1231 <p><em>text</em>
1232 <strong>text</strong>
1233 <small>text</small>
1234 <s>text</s>
1235 <cite>text</cite>
1236 <q>text</q>
1237 <dfn>text</dfn>
1238 <abbr>text</abbr>
1239 <data>text</data>
1240 <time>text</time>
1241 <code>text</code>
1242 <var>text</var>
1243 <samp>text</samp>
1244 <kbd>text</kbd>
1245 <sub>text</sub>
1246 <u>text</u>
1247 <mark>text</mark>
1248 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1249 <bdi>text</bdi>
1250 <bdo>text</bdo>
1251 <span>text</span>
1252 <wbr />
1253 </p>
1254 !! end
1255
1256 # test cases taken from
1257 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1258 !! test
1259 Ruby markup (W3C-style)
1260 !! wikitext
1261 ; Mono-ruby for individual base characters
1262 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1263 ; Group ruby
1264 : <ruby>今日<rt>きょう</rt></ruby>
1265 ; Jukugo ruby
1266 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1267 ; Inline ruby
1268 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1269 ; Double-sided ruby
1270 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1271 <ruby>
1272 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1273 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1274 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1275 </ruby>
1276 !! html
1277 <dl><dt> Mono-ruby for individual base characters</dt>
1278 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1279 <dt> Group ruby</dt>
1280 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1281 <dt> Jukugo ruby</dt>
1282 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1283 <dt> Inline ruby</dt>
1284 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1285 <dt> Double-sided ruby</dt>
1286 <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>
1287 <p><ruby>
1288 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1289 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1290 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1291 </ruby>
1292 </p>
1293 !! end
1294
1295 # The next two test different paths in the sanitizer.
1296 !! test
1297 Non-word characters don't terminate tag names (T19663, T42670, T54022)
1298 !! wikitext
1299 <blockquote|>a</blockquote>
1300
1301 <b→> doesn't terminate </b→>
1302
1303 <bä> doesn't terminate </bä>
1304
1305 <boo> doesn't terminate </boo>
1306
1307 <s.foo> doesn't terminate </s.foo>
1308
1309 <sub-ID#1>
1310 !! html
1311 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1312 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1313 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1314 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1315 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1316 </p><p>&lt;sub-ID#1&gt;
1317 </p>
1318 !! end
1319
1320 # There is a tidy bug here: https://sourceforge.net/p/tidy/bugs/946/
1321 # If the non-word-character tag made it through the sanitizer, tidy
1322 # would munge it up.
1323 !! test
1324 Non-word characters don't terminate tag names + tidy
1325 !! wikitext
1326 <blockquote|>a</blockquote>
1327
1328 <b→> doesn't terminate </b→>
1329
1330 <bä> doesn't terminate </bä>
1331
1332 <boo> doesn't terminate </boo>
1333
1334 <s.foo> doesn't terminate </s.foo>
1335
1336 <sub-ID#1>
1337 !! html+tidy
1338 <p>&lt;blockquote|&gt;a</p>
1339 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1340 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1341 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1342 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1343 <p>&lt;sub-ID#1&gt;</p>
1344 !! end
1345
1346 ###
1347 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1348 ### This checks that HTML5 tags (with non-word characters in the tag
1349 ### name) make it safely through the parser -- the Sanitizer will
1350 ### munge them later, as it should.
1351 ###
1352 !! test
1353 Non-word characters are valid in extension tags (T19663)
1354 !! wikitext
1355 <tåg>tåg</tåg>
1356 !! html/php
1357 <pre>
1358 'tåg'
1359 array (
1360 )
1361 </pre>
1362
1363 !! html/parsoid
1364 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1365 !! end
1366
1367 !! test
1368 Isolated close tags should be treated as literal text (T54760)
1369 !! options
1370 parsoid=wt2html
1371 !! wikitext
1372 </b>
1373
1374 <s.foo>s</s>
1375 !! html/php+tidy
1376 <p>&lt;s.foo&gt;s</p>
1377 !! html/parsoid
1378 <p>&lt;s.foo&gt;s</p>
1379 !! end
1380
1381 ###
1382 ### Special characters
1383 ###
1384
1385 !! test
1386 Bare pipe character (T54363)
1387 !! wikitext
1388 |
1389 !! html
1390 <p>|
1391 </p>
1392 !! end
1393
1394 !! test
1395 Bare pipe character from a template (T54363)
1396 !! wikitext
1397 {{pipe}}
1398 !! html
1399 <p>|
1400 </p>
1401 !! end
1402
1403 ###
1404 ### <nowiki> test cases
1405 ###
1406
1407 !! test
1408 <nowiki> unordered list
1409 !! wikitext
1410 <nowiki>* This is not an unordered list item.</nowiki>
1411 !! html/php
1412 <p>* This is not an unordered list item.
1413 </p>
1414 !! html/parsoid
1415 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1416 !! end
1417
1418 !! test
1419 <nowiki> spacing
1420 !! wikitext
1421 <nowiki>Lorem ipsum dolor
1422
1423 sed abit.
1424 sed nullum.
1425
1426 :and a colon
1427 </nowiki>
1428 !! html/php
1429 <p>Lorem ipsum dolor
1430
1431 sed abit.
1432 sed nullum.
1433
1434 :and a colon
1435
1436 </p>
1437 !! html/parsoid
1438 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1439
1440 sed abit.
1441 sed nullum.
1442
1443 :and a colon
1444 </span></p>
1445 !! end
1446
1447 !! test
1448 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1449 !! wikitext
1450 <nowiki><span class="error"></nowiki>
1451 !! html/php
1452 <p>&lt;span class="error"&gt;
1453 </p>
1454 !! html/parsoid
1455 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1456 !! end
1457
1458 !! test
1459 nowiki 3
1460 !! wikitext
1461 :There is not nowiki.
1462 :There is <nowiki>nowiki</nowiki>.
1463
1464 #There is not nowiki.
1465 #There is <nowiki>nowiki</nowiki>.
1466
1467 *There is not nowiki.
1468 *There is <nowiki>nowiki</nowiki>.
1469 !! html/php
1470 <dl><dd>There is not nowiki.</dd>
1471 <dd>There is nowiki.</dd></dl>
1472 <ol><li>There is not nowiki.</li>
1473 <li>There is nowiki.</li></ol>
1474 <ul><li>There is not nowiki.</li>
1475 <li>There is nowiki.</li></ul>
1476
1477 !! html/parsoid
1478 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1479 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1480
1481 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1482 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1483
1484 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1485 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1486 !! end
1487
1488 !! test
1489 Entities inside <nowiki>
1490 !! wikitext
1491 <nowiki>&lt;</nowiki>
1492 !! html/php
1493 <p>&lt;
1494 </p>
1495 !! html/parsoid
1496 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
1497 !! end
1498
1499 !! test
1500 Entities inside template parameters
1501 !! wikitext
1502 {{echo|&ndash;}}
1503 !! html/php+tidy
1504 <p>–</p>
1505 !! html/parsoid
1506 <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>
1507 !! end
1508
1509 !! test
1510 Properly escape nowiki when combined with other wiki markup
1511 !! options
1512 parsoid=html2wt
1513 !! html/parsoid
1514 <p>* &lt;/nowiki&gt; tag</p>
1515 !! wikitext
1516 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1517 !! end
1518
1519 !! test
1520 T93824: Put escaped HTML tags inside nowiki
1521 !! options
1522 parsoid=html2wt
1523 !! html/parsoid
1524 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1525 !! wikitext
1526 <nowiki><h2>foo</h2></nowiki>
1527 !! end
1528
1529 !! test
1530 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1531 !! options
1532 parsoid=html2wt
1533 !! html/parsoid
1534 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1535 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1536 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1537 !! wikitext
1538 This text: L'[[Foo]]
1539 This text: L<nowiki>''</nowiki>[[Foo]]
1540 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1541 !! end
1542
1543 # This test fails because wikitext whitespace is not normalized before comparing.
1544 !! test
1545 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1546 !! options
1547 parsoid=html2wt
1548 !! html/parsoid
1549 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1550 </p>
1551 !! wikitext
1552 This text : L<nowiki>''</nowiki>[[Foo]]
1553 !! end
1554
1555 # This test and the next one are html2wt only as they test that incorrect wikitext
1556 # passed in template arguments gets escaped or wrapped in nowikis where required.
1557 !! test
1558 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1559 !! options
1560 parsoid=html2wt
1561 !! html/parsoid
1562 <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>
1563 <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>
1564 !! wikitext
1565 {{echo|foo{{!}}bar}}
1566 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1567 !! end
1568
1569 !! test
1570 T53961: Output correct nowikis in template arguments
1571 !! options
1572 parsoid=html2wt
1573 !! html/parsoid
1574 <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>
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="#mwt2"></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 [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></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="#mwt4"></span>
1578 <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>
1579 !! wikitext
1580 {{echo|a [ b}}
1581 {{echo|<nowiki>a }} b</nowiki>}}
1582 {{echo|<nowiki>a [[ b</nowiki>}}
1583 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1584 {{echo|a <nowiki>}</nowiki>}}
1585 !! end
1586
1587 !! test
1588 Cases where "!!" needs nowiki protection
1589 !! options
1590 parsoid=html2wt
1591 !! html/parsoid
1592 <table>
1593 <tr><th>this needs protection !! here</th></tr>
1594 </table>
1595
1596 <table>
1597 <tr><th>this does not need
1598 protection !! here</th></tr>
1599 </table>
1600 !! wikitext
1601 {|
1602 !<nowiki>this needs protection !! here</nowiki>
1603 |}
1604
1605 {|
1606 !this does not need
1607 protection !! here
1608 |}
1609 !! end
1610
1611 ###
1612 ### Comments
1613 ###
1614 !! test
1615 Comments and Indent-Pre
1616 !! wikitext
1617 <!-- comment 1 --> asdf
1618
1619 <!-- comment 1 --> asdf
1620 <!-- comment 2 -->
1621
1622 <!-- comment 1 --> asdf
1623 <!-- comment 2 -->xyz
1624
1625 <!-- comment 1 --> asdf
1626 <!-- comment 2 --> xyz
1627 !! html
1628 <pre>asdf
1629 </pre>
1630 <pre>asdf
1631 </pre>
1632 <pre>asdf
1633 </pre>
1634 <p>xyz
1635 </p>
1636 <pre>asdf
1637 xyz
1638 </pre>
1639 !! end
1640
1641 !! test
1642 Comment test 2a
1643 !! wikitext
1644 asdf
1645 <!-- comment 1 -->
1646 jkl
1647 !! html
1648 <p>asdf
1649 jkl
1650 </p>
1651 !! end
1652
1653 !! test
1654 Comment test 2b
1655 !! wikitext
1656 asdf
1657 <!-- comment 1 -->
1658
1659 jkl
1660 !! html
1661 <p>asdf
1662 </p><p>jkl
1663 </p>
1664 !! end
1665
1666 !! test
1667 Comment test 3
1668 !! wikitext
1669 asdf
1670 <!-- comment 1 -->
1671 <!-- comment 2 -->
1672 jkl
1673 !! html
1674 <p>asdf
1675 jkl
1676 </p>
1677 !! end
1678
1679 !! test
1680 Comment test 4
1681 !! wikitext
1682 asdf<!-- comment 1 -->jkl
1683 !! html
1684 <p>asdfjkl
1685 </p>
1686 !! end
1687
1688 !! test
1689 Comment spacing
1690 !! wikitext
1691 a
1692 <!-- foo --> b <!-- bar -->
1693 c
1694 !! html
1695 <p>a
1696 </p>
1697 <pre> b
1698 </pre>
1699 <p>c
1700 </p>
1701 !! end
1702
1703 !! test
1704 Comment whitespace
1705 !! wikitext
1706 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1707 !! html
1708
1709 !! end
1710
1711 !! test
1712 Comment semantics and delimiters
1713 !! wikitext
1714 <!-- --><!----><!-----><!------>
1715 !! html/php
1716
1717 !! html/parsoid
1718 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1719 !! end
1720
1721 !! test
1722 Comment semantics and delimiters, redux
1723 !! wikitext
1724 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1725 -- foo -- funky huh? ... -->
1726 !! html/php
1727
1728 !! html/parsoid
1729 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1730 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1731 !! end
1732
1733 !! test
1734 Comment semantics and delimiters: directors cut
1735 !! wikitext
1736 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1737 everything starting with < followed by !-- until the first -- and > we see,
1738 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1739 -->-->
1740 !! html/php
1741 <p>--&gt;
1742 </p>
1743 !! html/parsoid
1744 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1745 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1746 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1747 --><p>--></p>
1748 !! end
1749
1750 !! test
1751 Comment semantics: nesting
1752 !! wikitext
1753 <!--<!-- no, we're not going to do anything fancy here -->-->
1754 !! html/php
1755 <p>--&gt;
1756 </p>
1757 !! html/parsoid
1758 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1759 !! end
1760
1761 # Parsoid closes the unclosed comment, even if it means a slight
1762 # round-trip diff.
1763 !! test
1764 Comment semantics: unclosed comment at end
1765 !! options
1766 parsoid=wt2html,html2html
1767 !! wikitext
1768 <!--This comment will run out to the end of the document
1769 !! html/php
1770
1771 !! html/parsoid
1772 <!--This comment will run out to the end of the document-->
1773 !! end
1774
1775 !! test
1776 Comment semantics: normalize comments to play nice with XML and browsers
1777 !! wikitext
1778 <!-- Browsers --!> think this is closed -->
1779 <!--> This would normally be text -->
1780 <!---> As would this -->
1781 <!-- XML doesn't like trailing dashes -------->
1782 <!-- Nor doubled hyphens -- anywhere in the data -->
1783 But this is not a comment.
1784 !! html/php
1785 <p>But this is not a comment.
1786 </p>
1787 !! html/parsoid
1788 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1789 <!--&#x3E; This would normally be text -->
1790 <!--&#x2D;&#x3E; As would this -->
1791 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1792 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1793 <p>But this is not a comment.</p>
1794 !! end
1795
1796 !! test
1797 Comment semantics: round-trip even text which contains encoded -->
1798 !! wikitext
1799 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1800 !! html/parsoid
1801 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1802 !! end
1803
1804 !! test
1805 Comment in template title
1806 !! wikitext
1807 {{f<!---->oo}}
1808 !! html
1809 <p>FOO
1810 </p>
1811 !! end
1812
1813 !! test
1814 Comment on its own line post-expand
1815 !! wikitext
1816 a
1817 {{blank}}<!---->
1818 b
1819 !! html
1820 <p>a
1821 </p><p>b
1822 </p>
1823 !! end
1824
1825 !! test
1826 Comment on its own line post-expand with non-significant whitespace
1827 !! wikitext
1828 a
1829 {{blank}} <!---->
1830 b
1831 !! html
1832 <p>a
1833 </p><p>b
1834 </p>
1835 !! end
1836
1837 !! test
1838 Multiple comments should still parse as SOL-transparent
1839 !! options
1840 parsoid=wt2html,wt2wt
1841 !! wikitext
1842 <!--c1-->*a
1843 <!--c2--><!--c3--><!--c4-->*b
1844 !! html/php
1845 <ul><li>a</li>
1846 <li>b</li></ul>
1847
1848 !! html/parsoid
1849 <!--c1--><ul>
1850 <li>a
1851 </li>
1852 <!--c2--><!--c3--><!--c4-->
1853 <li>b
1854 </li>
1855 </ul>
1856 !! end
1857
1858 ###
1859 ### paragraph wrapping tests
1860 ###
1861 !! test
1862 No block tags
1863 !! wikitext
1864 a
1865
1866 b
1867 !! html
1868 <p>a
1869 </p><p>b
1870 </p>
1871 !! end
1872
1873 !! test
1874 Block tag on one line (<div>)
1875 !! wikitext
1876 a <div>foo</div>
1877
1878 b
1879 !! html
1880 a <div>foo</div>
1881 <p>b
1882 </p>
1883 !! html+tidy
1884 <p>a</p>
1885 <div>foo</div>
1886 <p>b</p>
1887 !! end
1888
1889 !! test
1890 Block tag on one line (<blockquote>)
1891 !! wikitext
1892 a <blockquote>foo</blockquote>
1893
1894 b
1895 !! html
1896 a <blockquote>foo</blockquote>
1897 <p>b
1898 </p>
1899 !! html+tidy
1900 <p>a</p>
1901 <blockquote>
1902 <p>foo</p>
1903 </blockquote>
1904 <p>b</p>
1905 !! end
1906
1907 !! test
1908 Block tag on both lines (<div>)
1909 !! wikitext
1910 a <div>foo</div>
1911
1912 b <div>foo</div>
1913 !! html
1914 a <div>foo</div>
1915 b <div>foo</div>
1916
1917 !! html+tidy
1918 <p>a</p>
1919 <div>foo</div>
1920 <p>b</p>
1921 <div>foo</div>
1922 !! end
1923
1924 !! test
1925 Block tag on both lines (<blockquote>)
1926 !! wikitext
1927 a <blockquote>foo</blockquote>
1928
1929 b <blockquote>foo</blockquote>
1930 !! html
1931 a <blockquote>foo</blockquote>
1932 b <blockquote>foo</blockquote>
1933
1934 !! html+tidy
1935 <p>a</p>
1936 <blockquote>
1937 <p>foo</p>
1938 </blockquote>
1939 <p>b</p>
1940 <blockquote>
1941 <p>foo</p>
1942 </blockquote>
1943 !! end
1944
1945 !! test
1946 Multiple lines without block tags
1947 !! wikitext
1948 <div>foo</div> a
1949 b
1950 c
1951 d<!--foo--> e
1952 x <div>foo</div> z
1953 !! html
1954 <div>foo</div> a
1955 <p>b
1956 c
1957 d e
1958 </p>
1959 x <div>foo</div> z
1960
1961 !! html+tidy
1962 <div>foo</div>
1963 <p>a</p>
1964 <p>b c d e</p>
1965 <p>x</p>
1966 <div>foo</div>
1967 <p>z</p>
1968 !! end
1969
1970 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1971 # So, we have a separate section for Parsoid. We don't want
1972 # to mimic this stripping behavior in Parsoid. It affects
1973 # editing experience and also requires us to maintain additional
1974 # info for RT-ing.
1975 !! test
1976 Empty lines between lines with block tags
1977 !! wikitext
1978 <div></div>
1979
1980
1981 <div></div>a
1982
1983 b
1984 <div>a</div>b
1985
1986 <div>b</div>d
1987
1988
1989 <div>e</div>
1990 !! html
1991 <div></div>
1992 <p><br />
1993 </p>
1994 <div></div>a
1995 <p>b
1996 </p>
1997 <div>a</div>b
1998 <div>b</div>d
1999 <p><br />
2000 </p>
2001 <div>e</div>
2002
2003 !! html+tidy
2004 <p><br /></p>
2005 <p>a</p>
2006 <p>b</p>
2007 <div>a</div>
2008 <p>b</p>
2009 <div>b</div>
2010 <p>d</p>
2011 <p><br /></p>
2012 <div>e</div>
2013 !! html/parsoid
2014 <div data-parsoid='{"stx":"html"}'></div>
2015
2016 <p><br /></p>
2017 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2018
2019 <p>b</p>
2020 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2021
2022 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2023
2024 <p><br /></p>
2025 <div data-parsoid='{"stx":"html"}'>e</div>
2026 !! end
2027
2028 ## PHP parser emits output which is broken
2029 !! test
2030 Unclosed HTML p-tags should be handled properly
2031 !! wikitext
2032 <div><p>foo</div>
2033 a
2034
2035 b
2036 !! html/php+tidy
2037 <div>
2038 <p>foo</p>
2039 </div>
2040 <p>a</p>
2041 <p>b</p>
2042 !! html/parsoid
2043 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2044 <p>a</p>
2045 <p>b</p>
2046 !! end
2047
2048 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2049 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2050 ## them for now.
2051 !! test
2052 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2053 !! options
2054 parsoid=wt2html
2055 !! wikitext
2056 a [[Category:A1]] [[Category:A2]]
2057 [[Category:A3]]
2058 [[Category:A4]]
2059 !! html/parsoid
2060 <p>a</p>
2061 <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"/>
2062 !! end
2063
2064 !! test
2065 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2066 !! options
2067 parsoid=wt2html
2068 !! wikitext
2069 [[Category:A1]]a
2070 !! html/parsoid
2071 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2072 !! end
2073
2074 ###
2075 ### Preformatted text
2076 ###
2077 !! test
2078 Preformatted text
2079 !! wikitext
2080 This is some
2081 Preformatted text
2082 With ''italic''
2083 And '''bold'''
2084 And a [[Main Page|link]]
2085 !! html
2086 <pre>This is some
2087 Preformatted text
2088 With <i>italic</i>
2089 And <b>bold</b>
2090 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2091 </pre>
2092 !! end
2093
2094 !! test
2095 Tabs don't trigger preformatted text
2096 !! wikitext
2097 This is not
2098 preformatted text.
2099 This is preformatted text.
2100 So is this.
2101 !! html/php
2102 <p> This is not
2103 preformatted text.
2104 </p>
2105 <pre>This is preformatted text.
2106 So is this.
2107 </pre>
2108 !! html/parsoid
2109 <p> This is not
2110 preformatted text.</p>
2111 <pre>This is preformatted text.
2112 So is this.</pre>
2113 !! end
2114
2115 !! test
2116 Space before tab needs nowiki pre protection
2117 !! options
2118 parsoid=html2wt
2119 !! html/parsoid
2120 <p> a</p>
2121 !! wikitext
2122 <nowiki> </nowiki> a
2123 !! end
2124
2125 !! test
2126 Ident preformatting with inline content
2127 !! wikitext
2128 a
2129 ''b''
2130 !! html
2131 <pre>a
2132 <i>b</i>
2133 </pre>
2134 !! end
2135
2136 !! test
2137 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2138 !! wikitext
2139 <pre><nowiki>
2140 <b>
2141 <cite>
2142 <em>
2143 </nowiki></pre>
2144 !! html
2145 <pre>
2146 &lt;b&gt;
2147 &lt;cite&gt;
2148 &lt;em&gt;
2149 </pre>
2150
2151 !! end
2152
2153 !! test
2154 Regression with preformatted in <center>
2155 !! wikitext
2156 <center>
2157 Blah
2158 </center>
2159 !! html
2160 <center>
2161 <pre>Blah
2162 </pre>
2163 </center>
2164
2165 !! end
2166
2167 !! test
2168 T54763: Preformatted in <blockquote>
2169 !! wikitext
2170 <blockquote>
2171 Blah
2172 {|
2173 |
2174 indented cell (no pre-wrapping!)
2175 |}
2176 </blockquote>
2177 !! html
2178 <blockquote>
2179 <p> Blah
2180 </p>
2181 <table>
2182 <tr>
2183 <td>
2184 <p> indented cell (no pre-wrapping!)
2185 </p>
2186 </td></tr></table>
2187 </blockquote>
2188
2189 !! end
2190
2191 !! test
2192 T53086: Double newlines in blockquotes should be turned into paragraphs
2193 !! wikitext
2194 <blockquote>
2195 Foo
2196
2197 Bar
2198 </blockquote>
2199 !! html
2200 <blockquote>
2201 <p>Foo
2202 </p><p>Bar
2203 </p>
2204 </blockquote>
2205
2206 !! end
2207
2208 !! test
2209 T17491: <ins>/<del> in blockquote
2210 !! wikitext
2211 <blockquote>
2212 Foo <del>bar</del> <ins>baz</ins> quux
2213 </blockquote>
2214 !! html
2215 <blockquote>
2216 <p>Foo <del>bar</del> <ins>baz</ins> quux
2217 </p>
2218 </blockquote>
2219
2220 !! end
2221
2222 # Note that the p-wrapping is newline sensitive, which could be
2223 # considered a bug: tidy will wrap only the 'Foo' in the example
2224 # below in a <p> tag. (see comment 23-25 of T8200)
2225 !! test
2226 T17491: <ins>/<del> in blockquote (2)
2227 !! wikitext
2228 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2229 </blockquote>
2230 !! html
2231 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2232 </blockquote>
2233
2234 !! html+tidy
2235 <blockquote>
2236 <p>Foo</p>
2237 <del>bar</del> <ins>baz</ins> quux</blockquote>
2238 !! end
2239
2240 !! test
2241 <pre> with attributes (T5202)
2242 !! wikitext
2243 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2244 !! html
2245 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2246
2247 !! end
2248
2249 !! test
2250 <pre> with width attribute (T5202)
2251 !! wikitext
2252 <pre width="8">Narrow screen goodies</pre>
2253 !! html
2254 <pre width="8">Narrow screen goodies</pre>
2255
2256 !! end
2257
2258 !! test
2259 <pre> with forbidden attribute (T5202)
2260 !! wikitext
2261 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2262 !! html
2263 <pre width="8">Narrow screen goodies</pre>
2264
2265 !! end
2266
2267 !! test
2268 Entities inside <pre>
2269 !! wikitext
2270 <pre>&lt;</pre>
2271 !! html
2272 <pre>&lt;</pre>
2273
2274 !! end
2275
2276 !! test
2277 <pre> with forbidden attribute values (T5202)
2278 !! wikitext
2279 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2280 !! html
2281 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2282
2283 !! end
2284
2285 !! test
2286 <nowiki> inside <pre> (T15238)
2287 !! wikitext
2288 <pre>
2289 <nowiki>
2290 </pre>
2291 <pre>
2292 <nowiki></nowiki>
2293 </pre>
2294 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2295 !! html
2296 <pre>
2297 &lt;nowiki&gt;
2298 </pre>
2299 <pre>
2300
2301 </pre>
2302 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2303
2304 !! end
2305
2306 !! test
2307 <nowiki> inside of #tag:pre
2308 !! wikitext
2309 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2310 !! html/php
2311 <pre>Foo &#8594;bar</pre>
2312
2313 !! html/parsoid
2314 <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>
2315 !! end
2316
2317 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2318 ## aren't enclosed in nowikis.
2319 !! test
2320 <nowiki> and <pre> preference (first one wins)
2321 !! options
2322 parsoid=wt2html
2323 !! wikitext
2324 <pre>
2325 <nowiki>
2326 </pre>
2327 </nowiki>
2328 </pre>
2329
2330 <nowiki>
2331 <pre>
2332 <nowiki>
2333 </pre>
2334 </nowiki>
2335 </pre>
2336
2337 !! html/php
2338 <pre>
2339 &lt;nowiki&gt;
2340 </pre>
2341 <p>&lt;/nowiki&gt;
2342 &lt;/pre&gt;
2343 </p><p>
2344 &lt;pre&gt;
2345 &lt;nowiki&gt;
2346 &lt;/pre&gt;
2347
2348 &lt;/pre&gt;
2349 </p>
2350 !! html/parsoid
2351 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2352 </pre>
2353 <p>&lt;/nowiki></p>
2354
2355
2356 <p><span typeof="mw:Nowiki">
2357 &lt;pre>
2358 &lt;nowiki>
2359 &lt;/pre>
2360 </span></p>
2361 !! end
2362
2363 !! test
2364 </pre> inside nowiki
2365 !! wikitext
2366 <nowiki></pre></nowiki>
2367 !! html
2368 <p>&lt;/pre&gt;
2369 </p>
2370 !! end
2371
2372 # Parsoid doesn't strip empty tags, like Tidy does.
2373 !! test
2374 Empty pre; pre inside other HTML tags (T56946)
2375 !! wikitext
2376 a
2377
2378 <div><pre>
2379 foo
2380 </pre></div>
2381 <pre></pre>
2382 !! html/php
2383 <p>a
2384 </p>
2385 <div><pre>
2386 foo
2387 </pre></div>
2388 <pre></pre>
2389
2390 !! html/php+tidy
2391 <p>a</p>
2392 <div>
2393 <pre>
2394 foo
2395 </pre></div>
2396 !! html/parsoid
2397 <p>a</p>
2398
2399 <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
2400 </pre></div>
2401 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2402 !! end
2403
2404 !! test
2405 HTML pre followed by indent-pre
2406 !! wikitext
2407 <pre>foo</pre>
2408 bar
2409 !! html
2410 <pre>foo</pre>
2411 <pre>bar
2412 </pre>
2413 !! end
2414
2415 # Note that tidy removes the empty <p> tags from the start and end.
2416 # Parsoid does not, by design.
2417 !! test
2418 Block tag pre
2419 !! wikitext
2420 <p><pre>foo</pre></p>
2421 !! html/php+tidy
2422 <pre>
2423 foo
2424 </pre>
2425 !! html/parsoid
2426 <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>
2427 !! end
2428
2429 !!test
2430 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2431 !! wikitext
2432 {{echo|}}
2433 !! html
2434
2435 !!end
2436
2437 !!test
2438 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2439 !! wikitext
2440 {{echo|
2441 foo}}
2442 !! html
2443 <p>foo
2444 </p>
2445 !!end
2446
2447 !! test
2448 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2449 !! wikitext
2450 {{echo|a
2451 b}}
2452 !! html
2453 <pre>a
2454 </pre>
2455 <p>b
2456 </p>
2457 !!end
2458
2459 !! test
2460 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2461 !! wikitext
2462 {{echo|a
2463 b
2464 c
2465 d
2466 e
2467 }}
2468 !! html
2469 <pre>a
2470 </pre>
2471 <p>b
2472 c
2473 </p>
2474 <pre>d
2475 </pre>
2476 <p>e
2477 </p>
2478 !!end
2479
2480 !!test
2481 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2482 !! wikitext
2483 {{echo| foo}}
2484
2485 {{echo| foo}}{{echo| bar}}
2486
2487 {{echo| foo}}
2488 {{echo| bar}}
2489
2490 {{echo|<!--cmt--> foo}}
2491
2492 <!--cmt-->{{echo| foo}}
2493
2494 {{echo|{{echo| }}bar}}
2495 !! html
2496 <pre>foo
2497 </pre>
2498 <pre>foo bar
2499 </pre>
2500 <pre>foo
2501 bar
2502 </pre>
2503 <pre>foo
2504 </pre>
2505 <pre>foo
2506 </pre>
2507 <pre>bar
2508 </pre>
2509 !!end
2510
2511 !! test
2512 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2513 !! wikitext
2514 {{echo| }}a
2515
2516 {{echo|
2517 }}a
2518
2519 {{echo|
2520 b}}
2521
2522 {{echo|a
2523 }}b
2524
2525 {{echo|a
2526 }} b
2527 !! html
2528 <pre>a
2529 </pre>
2530 <p><br />
2531 </p>
2532 <pre>a
2533 </pre>
2534 <p><br />
2535 </p>
2536 <pre>b
2537 </pre>
2538 <p>a
2539 </p>
2540 <pre>b
2541 </pre>
2542 <p>a
2543 </p>
2544 <pre>b
2545 </pre>
2546 !!end
2547
2548 ## Hmm, should Parsoid rt this?
2549 !! test
2550 Pres with newline attributes
2551 !! options
2552 parsoid=wt2html,html2html
2553 !! wikitext
2554 <pre class="one
2555 two">hi</pre>
2556 !! html/php
2557 <pre class="one two">hi</pre>
2558
2559 !! html/parsoid
2560 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2561 !! end
2562
2563 !! test
2564 Things that look like <pre> tags aren't treated as such
2565 !! wikitext
2566 Barack Obama <President> of the United States
2567 <President></President>
2568 !! html
2569 <p>Barack Obama &lt;President&gt; of the United States
2570 &lt;President&gt;&lt;/President&gt;
2571 </p>
2572 !! end
2573
2574 !! test
2575 Handle broken pre-like tags (T66025)
2576 !! options
2577 parsoid=wt2html
2578 !! wikitext
2579 {{echo|<pre <pre>x</pre>}}
2580
2581 <table><pre </table>
2582 !! html/php
2583 <pre>x</pre>
2584 <table>&lt;pre </table>
2585
2586 !! html/php+tidy
2587 <pre>
2588 x
2589 </pre>
2590 <p>&lt;pre</p>
2591 !! html/parsoid
2592 <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>
2593
2594
2595 <p>&lt;pre </p>
2596
2597 <table></table>
2598 !! end
2599
2600 !! test
2601 Parsoid: handle pre with space after attribute
2602 !! options
2603 parsoid=wt2html
2604 !! wikitext
2605 <pre style="width:50%;" >{{echo|foo}}</pre>
2606 !! html/php
2607 <pre style="width:50%;">{{echo|foo}}</pre>
2608
2609 !! html/parsoid
2610 <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>
2611 !! end
2612
2613 # TODO / maybe: fix wt2wt for this
2614 !! test
2615 Parsoid: Don't paragraph-wrap fosterable content
2616 !! options
2617 parsoid=wt2html
2618 !! wikitext
2619 {|
2620 <td></td>
2621 <td></td>
2622
2623
2624
2625 |}
2626 !! html
2627 <table>
2628
2629 <tbody>
2630 <tr>
2631 <td></td>
2632
2633 <td></td></tr>
2634
2635
2636
2637 </tbody></table>
2638 !! end
2639
2640 !! test
2641 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2642 !! options
2643 parsoid=wt2html
2644 !! wikitext
2645 {|
2646 <td>
2647 <td>
2648 </td>
2649
2650
2651
2652 |}
2653 !! html
2654 <table>
2655
2656 <tbody>
2657 <tr>
2658 <td></td>
2659
2660 <td>
2661 </td></tr>
2662
2663
2664
2665 </tbody></table>
2666 !! end
2667
2668
2669 #--------------------------------------------------------------------
2670 # Transclusion parameter whitespace stripping tests
2671 # Behavior is different for positional and named parameters
2672 #--------------------------------------------------------------------
2673 !! test
2674 Templates: Strip leading and trailing whitespace from named-param values
2675 !! wikitext
2676 {{echo|1= a }}
2677
2678 {{echo|1= {{echo|b}} }}
2679
2680 {{echo| 1 =
2681 c }}
2682
2683 {{echo| 1 =
2684 * d
2685 }}
2686 !! html
2687 <p>a
2688 </p><p>b
2689 </p><p>c
2690 </p>
2691 <ul><li> d</li></ul>
2692
2693 !! end
2694
2695 !! test
2696 Templates: Don't strip whitespace from positional-param values
2697 !! wikitext
2698 {{echo|a }}
2699
2700 {{echo|{{echo|b}} }}
2701
2702 {{echo| c
2703 }}
2704
2705 {{echo| {{echo|d}}
2706 }}
2707
2708 {{echo|
2709 e}}
2710
2711 {{echo|
2712 * f}}
2713
2714 {{echo|
2715 }}g
2716 !! html
2717 <p>a
2718 </p><p>b
2719 </p>
2720 <pre>c
2721 </pre>
2722 <p><br />
2723 </p>
2724 <pre>d
2725 </pre>
2726 <p><br />
2727 </p>
2728 <pre>e
2729 </pre>
2730 <p><br />
2731 </p>
2732 <ul><li> f</li></ul>
2733 <p><br />
2734 </p>
2735 <pre>g
2736 </pre>
2737 !! end
2738
2739 !! test
2740 Templates: Don't recognize targets split by newlines
2741 !! options
2742 parsoid=wt2html
2743 !! wikitext
2744 {{ech
2745 o|foo}}
2746 !! html/php
2747 <p>{{ech
2748 o|foo}}
2749 </p>
2750 !! html/parsoid
2751 <p>{{ech
2752 o|foo}}</p>
2753 !! end
2754
2755 !! test
2756 Templates: Recognize targets when newlines and comments don't split the target
2757 !! options
2758 parsoid=wt2html
2759 !! wikitext
2760 {{
2761 <!--X--> ech<!--X-->o<!--X-->
2762 <!--X--> <!--X-->
2763
2764 |foo}}
2765 !! html/php
2766 <p>foo
2767 </p>
2768 !! html/parsoid
2769 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ech&lt;!--X-->o&lt;!--X--> \n &lt;!--X--> &lt;!--X-->\n\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2770 !! end
2771
2772 !! test
2773 Templates: Handle empty comment-and-ws-only lines correctly
2774 !! wikitext
2775 {{echo|foo
2776 <!--should be ignored-->
2777 <!--should be ignored as well-->
2778 bar}}
2779 !! html/php
2780 <p>foo
2781 bar
2782 </p>
2783 !! html/parsoid
2784 <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>
2785 !! end
2786
2787 !! test
2788 Templates: Handle comments in the target
2789 !! wikitext
2790 {{echo
2791 <!-- should be ignored -->
2792 |foo}}
2793
2794 {{echo
2795 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2796 |foo}}
2797
2798 {{echo<!-- should be ignored -->
2799 |foo}}
2800
2801 {{echo<!-- should be ignored -->|foo}}
2802
2803 {{<!-- should be ignored -->echo|foo}}
2804 !! html/php
2805 <p>foo
2806 </p><p>foo
2807 </p><p>foo
2808 </p><p>foo
2809 </p><p>foo
2810 </p>
2811 !! html/parsoid
2812 <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>
2813
2814 <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>
2815
2816 <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>
2817
2818 <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>
2819
2820 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2821 !!end
2822
2823 !! test
2824 Templates: Handle comments in parameter names (T69657)
2825 !! wikitext
2826 {{echo|1
2827 <!-- should be ignored -->
2828 =foo}}
2829
2830 {{echo|
2831 <!-- should be ignored -->
2832 1 = foo}}
2833
2834 {{echo|1<!-- should be ignored -->=foo}}
2835
2836 {{echo|<!-- should be ignored -->1=foo}}
2837 !! html/php
2838 <p>foo
2839 </p><p>foo
2840 </p><p>foo
2841 </p><p>foo
2842 </p>
2843 !! html/parsoid
2844 <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>
2845
2846 <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>
2847
2848 <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>
2849
2850 <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>
2851 !!end
2852
2853 !! test
2854 Templates: Other wikitext in parameter names (T69657)
2855 !! wikitext
2856 {{echo|''1''=foo}}
2857 !! html/php
2858 <p>{{{1}}}
2859 </p>
2860 !! html/parsoid
2861 <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>
2862 !!end
2863
2864 #--------------------------------------------------------------------
2865 # Transclusion parameter escaping tests
2866 #--------------------------------------------------------------------
2867 !! test
2868 Templates: Parsoid parameter escaping test 1
2869 !! wikitext
2870 {{echo|[foo]|{{echo|[bar]}}}}
2871 !! html/php+tidy
2872 <p>[foo]</p>
2873 !! html/parsoid
2874 <p about="#mwt1" typeof="mw:Transclusion"
2875 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2876 !! end
2877
2878 !! test
2879 Parsoid: Pipes in external links in template parameter
2880 !! wikitext
2881 {{echo|[{{echo|http://example.com}} link]}}
2882 !! html/php+tidy
2883 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2884 !! html/parsoid
2885 <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>
2886 !! end
2887
2888 !! test
2889 Parsoid: pipe in transclusion parameter
2890 !! wikitext
2891 {{echo|http://foo.com/a&#124;b}}
2892 !! html/php+tidy
2893 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2894 !! html/parsoid
2895 <p><a rel="mw:ExtLink" href="http://foo.com/a%7Cb" about="#mwt1"
2896 typeof="mw:Transclusion"
2897 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>
2898 !! end
2899
2900 !! test
2901 Parsoid: Pipe in external link target and content in template parameter
2902 !! options
2903 parsoid=html2wt,wt2wt
2904 !! wikitext
2905 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2906 !! html/php+tidy
2907 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2908 !! html/parsoid
2909 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2910 typeof="mw:Transclusion"
2911 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2912 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2913 !! end
2914
2915 !! test
2916 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2917 !! options
2918 parsoid
2919 !! wikitext
2920 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2921 !! html
2922 <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>
2923 !! end
2924
2925 !! test
2926 Templates: Don't escape already nowiki-escaped text in template parameters
2927 !! options
2928 parsoid=html2wt,wt2wt
2929 !! wikitext
2930 {{echo|foo<nowiki>|</nowiki>bar}}
2931 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2932 {{echo|<nowiki></nowiki>}}
2933 !! html/php+tidy
2934 <p>foo|bar &lt;div&gt;</p>
2935 !! html/parsoid
2936 <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>
2937 <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>
2938 <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>
2939 </p>
2940 !! end
2941
2942 ## T54824
2943 !! test
2944 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2945 !! options
2946 parsoid=html2wt,wt2wt
2947 !! wikitext
2948 {{echo|{{echo|1=bar}}}}
2949 !! html/php+tidy
2950 <p>bar</p>
2951 !! html/parsoid
2952 <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>
2953 !! end
2954
2955 ## T58733
2956 !! test
2957 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2958 !! wikitext
2959 {{echo|a : b}}
2960 !! html/php+tidy
2961 <p>a&#160;: b</p>
2962 !! html/parsoid
2963 <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>
2964 !! end
2965
2966 ## T73412
2967 !! test
2968 Templates: Preserve blank parameter names
2969 !! wikitext
2970 {{echo|=foo}}
2971 !! html/php+tidy
2972 <p>{{{1}}}</p>
2973 !! html/parsoid
2974 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2975 !! end
2976
2977 !! test
2978 Templates: Preserve blank parameter names in other positions
2979 !! wikitext
2980 {{blank_param|bar|=foo}}
2981 !! html/php+tidy
2982 <p>bar foo</p>
2983 !! html/parsoid
2984 <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
2985 foo</p>
2986 !! end
2987
2988 ###
2989 ### Parsoid-centric tests for testing RT edge cases for pre
2990 ###
2991
2992 !!test
2993 1a. Indent-Pre and Comments
2994 !! wikitext
2995 a
2996 <!--a-->
2997 c
2998 !! html
2999 <pre>a
3000 </pre>
3001 <p>c
3002 </p>
3003 !!end
3004
3005 !!test
3006 1b. Indent-Pre and Comments
3007 !! wikitext
3008 a
3009 <!--a-->
3010 c
3011 !! html
3012 <pre>a
3013 </pre>
3014 <p>c
3015 </p>
3016 !!end
3017
3018 !!test
3019 1c. Indent-Pre and Comments
3020 !! wikitext
3021 <!--a--> a
3022
3023 <!--a--> a
3024 !! html
3025 <pre> a
3026 </pre>
3027 <pre> a
3028 </pre>
3029 !!end
3030
3031 !!test
3032 1d. Indent-Pre and Comments
3033 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3034 !! wikitext
3035 <!--a--> a
3036
3037 <!--b-->b
3038 !! html
3039 <pre>a
3040 </pre>
3041 <pre>b
3042 </pre>
3043 !!end
3044
3045 !!test
3046 2a. Indent-Pre and tables
3047 !! wikitext
3048 {|
3049 |-
3050 !h1!!h2
3051 |foo||bar
3052 |}
3053 !! html
3054 <table>
3055
3056 <tr>
3057 <th>h1</th>
3058 <th>h2
3059 </th>
3060 <td>foo</td>
3061 <td>bar
3062 </td></tr></table>
3063
3064 !!end
3065
3066 !!test
3067 2b. Indent-Pre and tables
3068 !! wikitext
3069 {|
3070 |-
3071 |foo
3072 |}
3073 !! html
3074 <table>
3075
3076 <tr>
3077 <td>foo
3078 </td></tr></table>
3079
3080 !!end
3081
3082 !!test
3083 2c. Indent-Pre and tables (T44252)
3084 !! wikitext
3085 {|
3086 |+ foo
3087 ! | bar
3088 |}
3089 !! html
3090 <table>
3091 <caption> foo
3092 </caption>
3093 <tr>
3094 <th> bar
3095 </th></tr></table>
3096
3097 !!end
3098
3099 !!test
3100 2d. Indent-Pre and tables
3101 !! wikitext
3102 a
3103 {|
3104 | b
3105 |}
3106 !! html/php
3107 <pre>a
3108 </pre>
3109 <table>
3110 <tr>
3111 <td> b
3112 </td></tr></table>
3113
3114 !! html/parsoid
3115 <pre>a</pre>
3116 <table>
3117 <tbody><tr><td> b</td></tr>
3118 </tbody></table>
3119 !!end
3120
3121 !!test
3122 2e. Indent-Pre and table-line syntax
3123 !! wikitext
3124 a
3125 | b
3126 | c
3127 !! html/php
3128 <pre>a
3129 | b
3130 | c
3131 </pre>
3132 !!end
3133
3134 !!test
3135 2f. Indent-pre started by table-line syntax
3136 !! wikitext
3137 a
3138 | b
3139 | c
3140 !! html/php
3141 <p>a
3142 </p>
3143 <pre>| b
3144 | c
3145 </pre>
3146 !! html/parsoid
3147 <p>a</p>
3148 <pre>
3149 | b
3150 | c</pre>
3151 !!end
3152
3153 !! test
3154 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3155 !! wikitext
3156 <table>
3157 <tr>
3158 <td>
3159 Text that should be rendered preformatted
3160 </td>
3161 </tr>
3162 </table>
3163 !! html
3164 <table>
3165 <tr>
3166 <td>
3167 <pre>Text that should be rendered preformatted
3168 </pre>
3169 </td>
3170 </tr>
3171 </table>
3172
3173 !! end
3174
3175 !!test
3176 3a. Indent-Pre and block tags (single-line html)
3177 !! wikitext
3178 a <p> foo </p>
3179 b <div> foo </div>
3180 c <blockquote> foo </blockquote>
3181 <span> foo </span>
3182 !! html
3183 a <p> foo </p>
3184 b <div> foo </div>
3185 c <blockquote> foo </blockquote>
3186 <pre><span> foo </span>
3187 </pre>
3188 !! html/parsoid
3189 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3190 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3191 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3192 <pre><span> foo </span>
3193 </pre>
3194 !! html+tidy
3195 <p>a</p>
3196 <p>foo</p>
3197 <p>b</p>
3198 <div>foo</div>
3199 <p>c</p>
3200 <blockquote>
3201 <p>foo</p>
3202 </blockquote>
3203 <pre>
3204 <span> foo </span>
3205 </pre>
3206 !! end
3207
3208 !!test
3209 3b. Indent-Pre and block tags (multi-line html)
3210 !! wikitext
3211 a <span>foo</span>
3212 b <div> foo </div>
3213 !! html
3214 <pre>a <span>foo</span>
3215 </pre>
3216 b <div> foo </div>
3217
3218 !! html/parsoid
3219 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3220 b <div data-parsoid='{"stx":"html"}'> foo </div>
3221 !! html+tidy
3222 <pre>
3223 a <span>foo</span>
3224 </pre>
3225 <p>b</p>
3226 <div>foo</div>
3227 !!end
3228
3229 !!test
3230 3c. Indent-Pre and block tags (pre-content on separate line)
3231 !! wikitext
3232 <p>
3233 foo
3234 </p>
3235
3236 <div>
3237 foo
3238 </div>
3239
3240 <center>
3241 foo
3242 </center>
3243
3244 <blockquote>
3245 foo
3246 </blockquote>
3247
3248 <blockquote>
3249 <pre>
3250 foo
3251 </pre>
3252 </blockquote>
3253
3254 <table><tr><td>
3255 foo
3256 </td></tr></table>
3257
3258 <ul><li>
3259 foo
3260 </li></ul>
3261
3262 !! html
3263 <p>
3264 foo
3265 </p>
3266 <div>
3267 <pre>foo
3268 </pre>
3269 </div>
3270 <center>
3271 <pre>foo
3272 </pre>
3273 </center>
3274 <blockquote>
3275 <p> foo
3276 </p>
3277 </blockquote>
3278 <blockquote>
3279 <pre>
3280 foo
3281 </pre>
3282 </blockquote>
3283 <table><tr><td>
3284 <pre>foo
3285 </pre>
3286 </td></tr></table>
3287 <ul><li>
3288 foo
3289 </li></ul>
3290
3291 !!end
3292
3293 !! test
3294 4. Indent-Pre and extension tags
3295 !! wikitext
3296 a <tag />
3297 !! html/php
3298 a <pre>
3299 NULL
3300 array (
3301 )
3302 </pre>
3303
3304 !! html/parsoid
3305 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3306 !! end
3307
3308 !! test
3309 5. Indent-Pre and html pre
3310 !! wikitext
3311 <pre class="123">hi</pre>
3312 !! html/php
3313 <pre class="123">hi</pre>
3314
3315 !! html/parsoid
3316 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3317 !! end
3318
3319 !!test
3320 Render paragraphs when indent-pre is suppressed in blocklevels
3321 !! wikitext
3322 <blockquote>
3323 foo
3324
3325 bar
3326 </blockquote>
3327 !! html
3328 <blockquote>
3329 <p> foo
3330 </p><p> bar
3331 </p>
3332 </blockquote>
3333
3334 !!end
3335
3336 !!test
3337 4. Multiple spaces at start-of-line
3338 !! wikitext
3339 <p> foo </p>
3340 foo
3341 {|
3342 |foo
3343 |}
3344 !! html
3345 <p> foo </p>
3346 <pre> foo
3347 </pre>
3348 <table>
3349 <tr>
3350 <td>foo
3351 </td></tr></table>
3352
3353 !!end
3354
3355 ## NOTE: the leading white-space chars on empty line are significant
3356 !! test
3357 5a. White-space in indent-pre
3358 !! wikitext
3359 a<br />
3360
3361 b
3362 !! html
3363 <pre>a<br />
3364
3365 b
3366 </pre>
3367 !! end
3368
3369 ## NOTE: the leading white-space chars on empty line are significant
3370 !! test
3371 5b. White-space in indent-pre
3372 !! wikitext
3373 a
3374
3375 b
3376
3377
3378 c
3379 !! html
3380 <pre>a
3381
3382 b
3383
3384
3385 c
3386 </pre>
3387 !! end
3388
3389 !! test
3390 5c. White-space in indent-pre
3391 !! wikitext
3392 ''a''
3393 ''b''
3394 ''c''
3395 !! html
3396 <pre><i>a</i>
3397 <i>b</i>
3398 <i>c</i>
3399 </pre>
3400 !! end
3401
3402 !! test
3403 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3404 !! wikitext
3405 a
3406
3407 <!-- continue -->
3408 b
3409
3410 c
3411
3412 d
3413 !! html
3414 <pre>a
3415
3416 b
3417 </pre>
3418 <pre>c
3419
3420 </pre>
3421 <p>d
3422 </p>
3423 !! end
3424
3425 !! test
3426 7a. Indent-pre and category links
3427 !! options
3428 parsoid=wt2html,wt2wt
3429 !! wikitext
3430 [[Category:foo]] <!-- No pre-wrapping -->
3431 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3432 !! html/php+tidy
3433 !! html/parsoid
3434 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3435 <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 -->
3436 !! end
3437
3438 ## We used to, but no longer wt2wt this test since the default serializer
3439 ## will normalize all categories to serialize on their own line.
3440 ## This wikitext usage is going to be fairly uncommon in production and
3441 ## selser will take care of preserving formatting in those scenarios.
3442 !! test
3443 7b. Indent-pre and category links
3444 !! options
3445 parsoid=wt2html
3446 !! wikitext
3447 [[Category:foo]] a
3448 [[Category:foo]] {{echo|b}}
3449 !! html/parsoid
3450 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3451 <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>
3452 !! end
3453
3454 !! test
3455 Indent-Pre: Newlines in comments shouldn't affect sol state
3456 !! wikitext
3457 a <!--
3458 foo
3459 --> b
3460 !! html/php+tidy
3461 <p>a b</p>
3462 !! html/parsoid
3463 <p>a <!--
3464 foo
3465 --> b</p>
3466 !! end
3467
3468 ###
3469 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3470 ###
3471
3472 !!test
3473 HTML-pre: 1. embedded newlines
3474 !! wikitext
3475 <pre>foo</pre>
3476
3477 <pre>
3478 foo
3479 </pre>
3480
3481 <pre>
3482
3483 foo
3484 </pre>
3485
3486 <pre>
3487
3488
3489 foo
3490 </pre>
3491 !! html/php+tidy
3492 <pre>
3493 foo
3494 </pre>
3495 <pre>
3496 foo
3497 </pre>
3498 <pre>
3499
3500 foo
3501 </pre>
3502 <pre>
3503
3504
3505 foo
3506 </pre>
3507 !! html/parsoid
3508 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3509
3510 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3511 </pre>
3512
3513 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3514
3515 foo
3516 </pre>
3517
3518 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3519
3520
3521 foo
3522 </pre>
3523 !!end
3524
3525 !! test
3526 HTML-pre: big spaces
3527 !! wikitext
3528 <pre>
3529
3530
3531
3532
3533 haha
3534
3535
3536
3537
3538 haha
3539
3540
3541
3542
3543 </pre>
3544 !! html/php+tidy
3545 <pre>
3546
3547
3548
3549
3550 haha
3551
3552
3553
3554
3555 haha
3556
3557
3558
3559
3560 </pre>
3561 !! html/parsoid
3562 <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"}}'>
3563
3564
3565
3566
3567 haha
3568
3569
3570
3571
3572 haha
3573
3574
3575
3576
3577 </pre>
3578 !! end
3579
3580 !!test
3581 HTML-pre: 2: indented text
3582 !! wikitext
3583 <pre>
3584 foo
3585 </pre>
3586 !! html
3587 <pre>
3588 foo
3589 </pre>
3590
3591 !!end
3592
3593 !!test
3594 HTML-pre: 3: other wikitext
3595 !! wikitext
3596 <pre>
3597 * foo
3598 # bar
3599 = no-h =
3600 '' no-italic ''
3601 [[ NoLink ]]
3602 </pre>
3603 !! html/php
3604 <pre>
3605 * foo
3606 # bar
3607 = no-h =
3608 '' no-italic ''
3609 [[ NoLink ]]
3610 </pre>
3611
3612 !! html/parsoid
3613 <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
3614 # bar
3615 = no-h =
3616 '' no-italic ''
3617 [[ NoLink ]]
3618 </pre>
3619 !!end
3620
3621 ###
3622 ### Definition lists
3623 ###
3624 !! test
3625 Simple definition
3626 !! wikitext
3627 ; name : Definition
3628 !! html
3629 <dl><dt> name&#160;</dt>
3630 <dd> Definition</dd></dl>
3631
3632 !! end
3633
3634 !! test
3635 Definition list for indentation only
3636 !! wikitext
3637 : Indented text
3638 !! html
3639 <dl><dd> Indented text</dd></dl>
3640
3641 !! end
3642
3643 !! test
3644 Definition list with no space
3645 !! wikitext
3646 ;name:Definition
3647 !! html
3648 <dl><dt>name</dt>
3649 <dd>Definition</dd></dl>
3650
3651 !!end
3652
3653 !! test
3654 Definition list with URL link
3655 !! wikitext
3656 ; http://example.com/ : definition
3657 !! html
3658 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3659 <dd> definition</dd></dl>
3660
3661 !! end
3662
3663 !! test
3664 Definition list with bracketed URL link
3665 !! wikitext
3666 ;[http://www.example.com/ Example]:Something about it
3667 !! html
3668 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3669 <dd>Something about it</dd></dl>
3670
3671 !! end
3672
3673 !! test
3674 Definition list with wikilink containing colon
3675 !! wikitext
3676 ; [[Help:FAQ]]: The least-read page on Wikipedia
3677 !! html
3678 <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>
3679 <dd> The least-read page on Wikipedia</dd></dl>
3680
3681 !! end
3682
3683 # At Brion's and JeLuF's insistence... :)
3684 !! test
3685 Definition list with news link containing colon
3686 !! wikitext
3687 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3688 !! html/php
3689 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3690 <dd> This isn't even a real newsgroup!</dd></dl>
3691
3692 !! html/parsoid
3693 <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>
3694 !! end
3695
3696 !! test
3697 Malformed definition list with colon
3698 !! wikitext
3699 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3700 !! html
3701 <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>
3702
3703 !! end
3704
3705 !! test
3706 Definition lists: colon in external link text
3707 !! wikitext
3708 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3709 !! html
3710 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3711 <dd> OK, I made that up</dd></dl>
3712
3713 !! end
3714
3715 !! test
3716 Definition lists: colon in HTML attribute
3717 !! wikitext
3718 ;<b style="display: inline">bold</b>
3719 !! html
3720 <dl><dt><b style="display: inline">bold</b></dt></dl>
3721
3722 !! end
3723
3724 !! test
3725 Definition lists: self-closed tag
3726 !! wikitext
3727 ;one<br/>two : two-line fun
3728 !! html
3729 <dl><dt>one<br />two&#160;</dt>
3730 <dd> two-line fun</dd></dl>
3731
3732 !! end
3733
3734 !! test
3735 Definition lists: ignore colons inside tags
3736 !! wikitext
3737 ;one <b>two : tag <i>fun:</i>:</b>: def
3738 !! html
3739 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
3740 <dd> def</dd></dl>
3741
3742 !! end
3743
3744 !! test
3745 Definition lists: excess closed tags
3746 !! wikitext
3747 ;one</b>two : bad tag fun
3748 !! html/php+tidy
3749 <dl>
3750 <dt>onetwo&#160;</dt>
3751 <dd>bad tag fun</dd>
3752 </dl>
3753 !! html/parsoid
3754 <dl>
3755 <dt>onetwo</dt>
3756 <dd>bad tag fun</dd>
3757 </dl>
3758 !! end
3759
3760 !! test
3761 T13748: Literal closing tags
3762 !! wikitext
3763 <dl>
3764 <dt>test 1</dt>
3765 <dd>test test test test test</dd>
3766 <dt>test 2</dt>
3767 <dd>test test test test test</dd>
3768 </dl>
3769 !! html
3770 <dl>
3771 <dt>test 1</dt>
3772 <dd>test test test test test</dd>
3773 <dt>test 2</dt>
3774 <dd>test test test test test</dd>
3775 </dl>
3776
3777 !! end
3778
3779 !! test
3780 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3781 !! wikitext
3782 <ul><li>
3783 ; term : description
3784 * unordered
3785 </li></ul>
3786 !! html
3787 <ul><li>
3788 <dl><dt> term&#160;</dt>
3789 <dd> description</dd></dl>
3790 <ul><li> unordered</li></ul>
3791 </li></ul>
3792
3793 !! end
3794
3795 !! test
3796 Definition list with empty definition and following paragraph
3797 !! wikitext
3798 ; term:
3799 Paragraph text
3800 !! html
3801 <dl><dt> term</dt>
3802 <dd></dd></dl>
3803 <p>Paragraph text
3804 </p>
3805 !! end
3806
3807 !! test
3808 Nested definition lists using html syntax
3809 !! wikitext
3810 <dl><dt>x</dt>
3811 <dd>a</dd>
3812 <dd>b</dd></dl>
3813 !! html
3814 <dl><dt>x</dt>
3815 <dd>a</dd>
3816 <dd>b</dd></dl>
3817
3818 !! end
3819
3820 !! test
3821 Definition Lists: No nesting: Multiple dd's
3822 !! wikitext
3823 ;x
3824 :a
3825 :b
3826 !! html
3827 <dl><dt>x</dt>
3828 <dd>a</dd>
3829 <dd>b</dd></dl>
3830
3831 !! end
3832
3833 !! test
3834 Definition Lists: Indentation: Regular
3835 !! wikitext
3836 :i1
3837 ::i2
3838 :::i3
3839 !! html
3840 <dl><dd>i1
3841 <dl><dd>i2
3842 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3843
3844 !! end
3845
3846 !! test
3847 Definition Lists: Indentation: Missing 1st level
3848 !! wikitext
3849 ::i2
3850 :::i3
3851 !! html
3852 <dl><dd><dl><dd>i2
3853 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3854
3855 !! end
3856
3857 !! test
3858 Definition Lists: Indentation: Multi-level indent
3859 !! wikitext
3860 :::i3
3861 !! html
3862 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3863
3864 !! end
3865
3866 !! test
3867 Definition Lists: Hacky use to indent tables
3868 !! wikitext
3869 ::{|
3870 |foo
3871 |bar
3872 |}
3873 this text
3874 should be left alone
3875 !! html
3876 <dl><dd><dl><dd><table>
3877 <tr>
3878 <td>foo
3879 </td>
3880 <td>bar
3881 </td></tr></table></dd></dl></dd></dl>
3882 <p>this text
3883 should be left alone
3884 </p>
3885 !! end
3886
3887 !! test
3888 Definition Lists: Hacky use to indent tables, with comments (T65979)
3889 !! wikitext
3890 <!-- foo -->
3891 ::{|
3892 |foo
3893 |bar
3894 |}<!-- bar -->
3895 this text
3896 should be left alone
3897 !! html/parsoid
3898 <!-- foo -->
3899 <dl><dd><dl><dd><table><tr>
3900 <td>foo</td>
3901 <td>bar</td>
3902 </tr></table><!-- bar --></dd></dl></dd></dl>
3903 <p>this text
3904 should be left alone</p>
3905 !! end
3906
3907 !! test
3908 Definition Lists: Hacky use to indent tables, with comment before table
3909 !! wikitext
3910 ::<!-- foo -->{|
3911 |foo
3912 |}
3913 !! html/parsoid
3914 <dl><dd><dl><dd><!-- foo --><table><tr>
3915 <td>foo</td>
3916 </tr></table></dd></dl></dd></dl>
3917 !! end
3918
3919 # The trailing whitespace in this test is to catch a regression in
3920 # Parsoid after T54473.
3921 !! test
3922 Definition Lists: Hacky use to indent tables (WS-insensitive)
3923 !! wikitext
3924 : {|
3925 |a
3926 |}
3927 !! html/php
3928 <dl><dd><table>
3929 <tr>
3930 <td>a
3931 </td></tr></table></dd></dl>
3932
3933 !! html/parsoid
3934 <dl><dd> <table>
3935 <tbody><tr><td>a</td></tr>
3936 </tbody></table> </dd></dl>
3937 !! end
3938
3939 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3940 ## as an empty dt item. It also ignores all but the last ";" when followed
3941 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3942 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3943 ## ";"s.
3944 ##
3945 ## Ex: ";;t2 ::d2" is transformed into:
3946 ##
3947 ## <dl>
3948 ## <dt>t2 </dt>
3949 ## <dd>
3950 ## <dl>
3951 ## <dt></dt>
3952 ## <dd>d2</dd>
3953 ## </dl>
3954 ## </dd>
3955 ## </dl>
3956 ##
3957 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3958 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3959 ##
3960 ## <dl>
3961 ## <dt>
3962 ## <dl>
3963 ## <dt>t2 </dt>
3964 ## <dd>:d2</dd>
3965 ## </dl>
3966 ## </dt>
3967 ## </dl>
3968 ##
3969 ## All Parsoid only definition list tests have this difference.
3970 ##
3971 ## See also: https://phabricator.wikimedia.org/T8569
3972 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3973
3974 !! test
3975 Table / list interaction: indented table with lists in table contents
3976 !! wikitext
3977 :{|
3978 |-
3979 | a
3980 * b
3981 |-
3982 | c
3983 * d
3984 |}
3985 !! html
3986 <dl><dd><table>
3987
3988 <tr>
3989 <td> a
3990 <ul><li> b</li></ul>
3991 </td></tr>
3992 <tr>
3993 <td> c
3994 <ul><li> d</li></ul>
3995 </td></tr></table></dd></dl>
3996
3997 !! end
3998
3999 !!test
4000 Table / list interaction: lists nested in tables nested in indented lists
4001 !! wikitext
4002 :{|
4003 |
4004 :a
4005 :b
4006 |
4007 *c
4008 *d
4009 |}
4010
4011 *e
4012 *f
4013 !! html
4014 <dl><dd><table>
4015 <tr>
4016 <td>
4017 <dl><dd>a</dd>
4018 <dd>b</dd></dl>
4019 </td>
4020 <td>
4021 <ul><li>c</li>
4022 <li>d</li></ul>
4023 </td></tr></table></dd></dl>
4024 <ul><li>e</li>
4025 <li>f</li></ul>
4026
4027 !!end
4028
4029 !! test
4030 Definition Lists: Nesting: Multi-level (Parsoid only)
4031 !! options
4032 parsoid
4033 !! wikitext
4034 ;t1 :d1
4035 ;;t2 ::d2
4036 ;;;t3 :::d3
4037 !! html
4038 <dl>
4039 <dt>t1 </dt>
4040 <dd>d1</dd>
4041 <dt>
4042 <dl>
4043 <dt>t2 </dt>
4044 <dd>:d2</dd>
4045 <dt>
4046 <dl>
4047 <dt>t3 </dt>
4048 <dd>::d3</dd>
4049 </dl>
4050 </dt>
4051 </dl>
4052 </dt>
4053 </dl>
4054
4055
4056 !! end
4057
4058
4059 !! test
4060 Definition Lists: Nesting: Test 2 (Parsoid only)
4061 !! wikitext
4062 ;t1
4063 ::d2
4064 !! html/php+tidy
4065 <dl>
4066 <dt>t1</dt>
4067 <dd>
4068 <dl>
4069 <dd>d2</dd>
4070 </dl>
4071 </dd>
4072 </dl>
4073 !! html/parsoid
4074 <dl>
4075 <dt>t1</dt>
4076 <dd>
4077 <dl>
4078 <dd>d2</dd>
4079 </dl>
4080 </dd>
4081 </dl>
4082
4083 !! end
4084
4085
4086 !! test
4087 Definition Lists: Nesting: Test 3 (Parsoid only)
4088 !! wikitext
4089 :;t1
4090 ::::d2
4091 !! html/php+tidy
4092 <dl>
4093 <dd>
4094 <dl>
4095 <dt>t1</dt>
4096 <dd>
4097 <dl>
4098 <dd>
4099 <dl>
4100 <dd>d2</dd>
4101 </dl>
4102 </dd>
4103 </dl>
4104 </dd>
4105 </dl>
4106 </dd>
4107 </dl>
4108 !! html/parsoid
4109 <dl>
4110 <dd>
4111 <dl>
4112 <dt>t1</dt>
4113 <dd>
4114 <dl>
4115 <dd>
4116 <dl>
4117 <dd>d2</dd>
4118 </dl>
4119 </dd>
4120 </dl>
4121 </dd>
4122 </dl>
4123 </dd>
4124 </dl>
4125
4126 !! end
4127
4128
4129 !! test
4130 Definition Lists: Nesting: Test 4
4131 !! wikitext
4132 ::;t3
4133 :::d3
4134 !! html
4135 <dl><dd><dl><dd><dl><dt>t3</dt>
4136 <dd>d3</dd></dl></dd></dl></dd></dl>
4137
4138 !! end
4139
4140
4141 ## The Parsoid team believes the following three test exposes a
4142 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4143 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4144 ## It also exposes a "misfeature" in tidy, which doesn't like
4145 ## <dl> tags with a single <dt> child; it converts the <dt> into
4146 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4147 !! test
4148 Definition Lists: Mixed Lists: Test 1
4149 !! wikitext
4150 :;* foo
4151 ::* bar
4152 :; baz
4153 !! html/php
4154 <dl><dd><dl><dt><ul><li> foo</li>
4155 <li> bar</li></ul></dt></dl>
4156 <dl><dt> baz</dt></dl></dd></dl>
4157
4158 !! html/php+tidy
4159 <dl>
4160 <dd>
4161 <dl>
4162 <dd>
4163 <ul>
4164 <li>foo</li>
4165 <li>bar</li>
4166 </ul>
4167 </dd>
4168 </dl>
4169 <dl>
4170 <dt>baz</dt>
4171 </dl>
4172 </dd>
4173 </dl>
4174 !! html/parsoid
4175 <dl>
4176 <dd><dl>
4177 <dt><ul>
4178 <li> foo
4179 </li>
4180 </ul></dt>
4181 <dd><ul>
4182 <li> bar
4183 </li>
4184 </ul></dd>
4185 <dt> baz</dt>
4186 </dl></dd>
4187 </dl>
4188 !! end
4189
4190 !! test
4191 Definition Lists: Mixed Lists: Test 2
4192 !! wikitext
4193 *: d1
4194 *: d2
4195 !! html
4196 <ul><li><dl><dd> d1</dd>
4197 <dd> d2</dd></dl></li></ul>
4198
4199 !! end
4200
4201
4202 !! test
4203 Definition Lists: Mixed Lists: Test 3
4204 !! wikitext
4205 *::: d1
4206 *::: d2
4207 !! html
4208 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4209 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4210
4211 !! end
4212
4213
4214 !! test
4215 Definition Lists: Mixed Lists: Test 4
4216 !! wikitext
4217 *;d1 :d2
4218 *;d3 :d4
4219 !! html
4220 <ul><li><dl><dt>d1&#160;</dt>
4221 <dd>d2</dd>
4222 <dt>d3&#160;</dt>
4223 <dd>d4</dd></dl></li></ul>
4224
4225 !! end
4226
4227
4228 !! test
4229 Definition Lists: Mixed Lists: Test 5
4230 !! wikitext
4231 *:d1
4232 *:: d2
4233 !! html
4234 <ul><li><dl><dd>d1
4235 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4236
4237 !! end
4238
4239
4240 !! test
4241 Definition Lists: Mixed Lists: Test 6
4242 !! wikitext
4243 #*:d1
4244 #*::: d3
4245 !! html
4246 <ol><li><ul><li><dl><dd>d1
4247 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4248
4249 !! end
4250
4251
4252 !! test
4253 Definition Lists: Mixed Lists: Test 7
4254 !! wikitext
4255 :* d1
4256 :* d2
4257 !! html
4258 <dl><dd><ul><li> d1</li>
4259 <li> d2</li></ul></dd></dl>
4260
4261 !! end
4262
4263
4264 !! test
4265 Definition Lists: Mixed Lists: Test 8
4266 !! wikitext
4267 :* d1
4268 ::* d2
4269 !! html
4270 <dl><dd><ul><li> d1</li></ul>
4271 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4272
4273 !! end
4274
4275
4276 !! test
4277 Definition Lists: Mixed Lists: Test 9
4278 !! wikitext
4279 *;foo :bar
4280 !! html
4281 <ul><li><dl><dt>foo&#160;</dt>
4282 <dd>bar</dd></dl></li></ul>
4283
4284 !! end
4285
4286
4287 !! test
4288 Definition Lists: Mixed Lists: Test 10
4289 !! wikitext
4290 *#;foo :bar
4291 !! html
4292 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4293 <dd>bar</dd></dl></li></ol></li></ul>
4294
4295 !! end
4296
4297 # The Parsoid team disagrees with the PHP parser's seemingly-random
4298 # rules regarding dd/dt on the next two tests. Parsoid is more
4299 # consistent, and recognizes the shared nesting and keeps the
4300 # still-open tags around until the nesting is complete.
4301 # (And tidy again converts <dt> to <dd> before 'bar'.)
4302
4303 !! test
4304 Definition Lists: Mixed Lists: Test 11
4305 !! wikitext
4306 *#*#;*;;foo :bar
4307 *#*#;boo :baz
4308 !! html/php
4309 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4310 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4311 <dl><dt>boo&#160;</dt>
4312 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4313
4314 !! html/php+tidy
4315 <ul>
4316 <li>
4317 <ol>
4318 <li>
4319 <ul>
4320 <li>
4321 <ol>
4322 <li>
4323 <dl>
4324 <dt>foo&#160;</dt>
4325 <dd>
4326 <ul>
4327 <li>
4328 <dl>
4329 <dd>
4330 <dl>
4331 <dt>bar</dt>
4332 </dl>
4333 </dd>
4334 </dl>
4335 </li>
4336 </ul>
4337 </dd>
4338 </dl>
4339 <dl>
4340 <dt>boo&#160;</dt>
4341 <dd>baz</dd>
4342 </dl>
4343 </li>
4344 </ol>
4345 </li>
4346 </ul>
4347 </li>
4348 </ol>
4349 </li>
4350 </ul>
4351 !! html/parsoid
4352 <ul>
4353 <li>
4354 <ol>
4355 <li>
4356 <ul>
4357 <li>
4358 <ol>
4359 <li>
4360 <dl>
4361 <dt>
4362 <ul>
4363 <li>
4364 <dl>
4365 <dt>
4366 <dl>
4367 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4368 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4369 </dl></dt>
4370 </dl></li>
4371 </ul></dt>
4372 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4373 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4374 </dl></li>
4375 </ol></li>
4376 </ul></li>
4377 </ol></li>
4378 </ul>
4379 !! end
4380
4381
4382 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4383 # From whitelist:
4384 # * The test is wrong, there are two colons where there should be :;
4385 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4386 !! test
4387 Definition Lists: Weird Ones: Test 1
4388 !! wikitext
4389 *#;*::;; foo : bar (who uses this?)
4390 !! html/php
4391 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4392 <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>
4393
4394 !! html/php+tidy
4395 <ul>
4396 <li>
4397 <ol>
4398 <li>
4399 <dl>
4400 <dt>foo&#160;</dt>
4401 <dd>
4402 <ul>
4403 <li>
4404 <dl>
4405 <dd>
4406 <dl>
4407 <dd>
4408 <dl>
4409 <dd>
4410 <dl>
4411 <dt>bar (who uses this?)</dt>
4412 </dl>
4413 </dd>
4414 </dl>
4415 </dd>
4416 </dl>
4417 </dd>
4418 </dl>
4419 </li>
4420 </ul>
4421 </dd>
4422 </dl>
4423 </li>
4424 </ol>
4425 </li>
4426 </ul>
4427 !! html/parsoid
4428 <ul>
4429 <li>
4430 <ol>
4431 <li>
4432 <dl>
4433 <dt>
4434 <ul>
4435 <li>
4436 <dl>
4437 <dd>
4438 <dl>
4439 <dd>
4440 <dl>
4441 <dt>
4442 <dl>
4443 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4444 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4445 </dl></dt>
4446 </dl></dd>
4447 </dl></dd>
4448 </dl></li>
4449 </ul></dt>
4450 </dl></li>
4451 </ol></li>
4452 </ul>
4453 !! end
4454
4455 !! test
4456 Definition Lists: colons occurring in tags
4457 !! wikitext
4458 ;a:b
4459 ;'''a:b'''
4460 ;<i>a:b</i>
4461 ;<span>a:b</span>
4462 ;<div>a:b</div>
4463 ;<div>a
4464 :b</div>
4465 ;{{echo|a:b}}
4466 ;{{echo|''a:b''}}
4467 ;;;''a:b''
4468 !! html+tidy
4469 <dl>
4470 <dt>a</dt>
4471 <dd>b</dd>
4472 <dt><b>a:b</b></dt>
4473 <dt><i>a:b</i></dt>
4474 <dt><span>a:b</span></dt>
4475 <dd>
4476 <div>a:b</div>
4477 </dd>
4478 <dd>
4479 <div>a
4480 <dl>
4481 <dd>b</dd>
4482 </dl>
4483 </div>
4484 </dd>
4485 <dt>a</dt>
4486 <dd>b</dd>
4487 <dt><i>a:b</i></dt>
4488 </dl>
4489 <dl>
4490 <dd>
4491 <dl>
4492 <dd>
4493 <dl>
4494 <dt><i>a:b</i></dt>
4495 </dl>
4496 </dd>
4497 </dl>
4498 </dd>
4499 </dl>
4500 !! html/parsoid
4501 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4502 <dt><b>a:b</b></dt>
4503 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4504 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4505 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4506 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4507 <dd>b</dd>
4508 <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>
4509 <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>
4510 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4511 !! end
4512
4513 !! test
4514 Definition Lists: colons and tables 1
4515 !! wikitext
4516 :{|
4517 | x
4518 |}
4519 :{|
4520 | y
4521 |}
4522 !! html
4523 <dl><dd><table>
4524 <tr>
4525 <td> x
4526 </td></tr></table></dd></dl>
4527 <dl><dd><table>
4528 <tr>
4529 <td> y
4530 </td></tr></table></dd></dl>
4531
4532 !! end
4533
4534 # Parsoid's output (as documented below) differs from php's in this case.
4535 # This is probably a bug. If we fixup parsoid to match php's output, the
4536 # above test should pass and the below test case can be removed. It is
4537 # unclear which output is more desirable.
4538
4539 !! test
4540 Definition Lists: colons and tables 2
4541 !! wikitext
4542 :{|
4543 | x
4544 |}
4545 :{|
4546 | y
4547 |}
4548 !! html/parsoid
4549 <dl><dd><table>
4550 <tr>
4551 <td> x
4552 </td></tr></table></dd>
4553 <dd><table>
4554 <tr>
4555 <td> y
4556 </td></tr></table></dd></dl>
4557 !! end
4558
4559 !! test
4560 Definition Lists: template interaction
4561 !! wikitext
4562 ::{{definition_list}}
4563
4564 :one
4565 ::{{definition_list}}
4566 :::two
4567 :::three
4568 ::four
4569 !! html/parsoid
4570 <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">
4571 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4572
4573 <dl><dd data-parsoid='{}'>one
4574 <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">
4575 </span><dd about="#mwt2">two
4576 <dl><dd>two</dd>
4577 <dd>three</dd></dl></dd>
4578 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4579 !! end
4580
4581
4582 ###
4583 ### External links
4584 ###
4585 !! test
4586 External links: non-bracketed
4587 !! wikitext
4588 Non-bracketed: http://example.com
4589 !! html
4590 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4591 </p>
4592 !! end
4593
4594 # parsoid doesn't explicitly mark autonumbered links, see T55505
4595 !! test
4596 External links: numbered
4597 !! wikitext
4598 Numbered: [http://example.com]
4599 Numbered: [http://example.net]
4600 Numbered: [http://example.com]
4601 !! html/php
4602 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4603 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4604 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4605 </p>
4606 !! html/parsoid
4607 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4608 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4609 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4610 !!end
4611
4612 !! test
4613 External links: specified text
4614 !! wikitext
4615 Specified text: [http://example.com link]
4616 !! html
4617 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4618 </p>
4619 !!end
4620
4621 !! test
4622 External links: trail
4623 !! wikitext
4624 Linktrails should not work for external links: [http://example.com link]s
4625 !! html
4626 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4627 </p>
4628 !! end
4629
4630 !! test
4631 External links: dollar sign in URL
4632 !! wikitext
4633 http://example.com/1$2345
4634 !! html
4635 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4636 </p>
4637 !! end
4638
4639 # parsoid doesn't explicitly mark autonumbered links, see T55505
4640 !! test
4641 External links: dollar sign in URL (autonumber)
4642 !! wikitext
4643 [http://example.com/1$2345]
4644 !! html/php
4645 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4646 </p>
4647 !! html/parsoid
4648 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4649 !!end
4650
4651 !! test
4652 External links: open square bracket forbidden in URL (T6377)
4653 !! options
4654 parsoid=wt2html,wt2wt,html2html
4655 !! wikitext
4656 http://example.com/1[2345
4657 !! html/php
4658 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4659 </p>
4660 !! html/parsoid
4661 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4662 !! end
4663
4664 !! test
4665 External links: open square bracket forbidden in URL (named) (T6377)
4666 !! options
4667 parsoid=wt2html,html2html
4668 !! wikitext
4669 [http://example.com/1[2345]
4670 !! html/php
4671 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4672 </p>
4673 !! html/parsoid
4674 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4675 !!end
4676
4677 # parsoid adds a space before the link name
4678 !! test
4679 External links: open square bracket forbidden in URL (named) (T6377)
4680 Parsoid variant.
4681 !! wikitext
4682 [http://example.com/1 [2345]
4683 !! html
4684 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4685 </p>
4686 !!end
4687
4688 !! test
4689 External links: nowiki in URL link text (T8230)
4690 !! wikitext
4691 [http://example.com/ <nowiki>''example site''</nowiki>]
4692 !! html
4693 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4694 </p>
4695 !! end
4696
4697 !! test
4698 External links: newline forbidden in text (T8230 regression check)
4699 !! wikitext
4700 [http://example.com/ first
4701 second]
4702 !! html
4703 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4704 second]
4705 </p>
4706 !!end
4707
4708 !! test
4709 External links: Pipe char between url and text
4710 !! wikitext
4711 [http://example.com | link]
4712 !! html
4713 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4714 </p>
4715 !!end
4716
4717 !! test
4718 External links: protocol-relative URL in brackets
4719 !! wikitext
4720 [//example.com/ Test]
4721 !! html
4722 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4723 </p>
4724 !! end
4725
4726 # parsoid doesn't explicitly mark autonumbered links, see T55505
4727 !! test
4728 External links: protocol-relative URL in brackets without text
4729 !! wikitext
4730 [//example.com]
4731 !! html/php
4732 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4733 </p>
4734 !! html/parsoid
4735 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4736 !! end
4737
4738 !! test
4739 External links: protocol-relative URL in free text is left alone
4740 !! wikitext
4741 //example.com/Foo
4742 !! html
4743 <p>//example.com/Foo
4744 </p>
4745 !!end
4746
4747 !! test
4748 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4749 !! wikitext
4750 foo//example.com/Foo
4751 !! html
4752 <p>foo//example.com/Foo
4753 </p>
4754 !! end
4755
4756 !! test
4757 External links: with no contents
4758 !! wikitext
4759 [http://en.wikipedia.org/wiki/Foo]
4760
4761 [[wikipedia:Foo|Bar]]
4762
4763 [[wikipedia:Foo|<span>Bar</span>]]
4764 !! html/php
4765 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4766 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4767 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4768 </p>
4769 !! html/parsoid
4770 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4771 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4772 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4773 !! end
4774
4775 !! test
4776 External links: Free with trailing punctuation
4777 !! wikitext
4778 http://example.com,
4779 http://example.com;
4780 http://example.com\
4781 http://example.com.
4782 http://example.com:
4783 http://example.com!
4784 http://example.com?
4785 http://example.com)
4786 http://example.com/url_with_(brackets)
4787 (http://example.com/url_without_brackets)
4788 http://example.com/url_with_entity&amp;
4789 http://example.com/url_with_entity&#x26;
4790 http://example.com/url_with_entity&#038;
4791 http://example.com/url_with_entity&nbsp;
4792 http://example.com/url_with_entity&#xA0;
4793 http://example.com/url_with_entity&#160;
4794 http://example.com/url_with_entity&lt;
4795 http://example.com/url_with_entity&#x3C;
4796 http://example.com/url_with_entity&#60;
4797 !! html/php
4798 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4799 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4800 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4801 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4802 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4803 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4804 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4805 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4806 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4807 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4808 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4809 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4810 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4811 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4812 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4813 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4814 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4815 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4816 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4817 </p>
4818 !! html/parsoid
4819 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4820 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4821 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4822 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4823 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4824 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4825 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4826 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4827 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4828 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4829 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4830 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4831 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4832 <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>
4833 <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>
4834 <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>
4835 <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>
4836 <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>
4837 <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>
4838 !! end
4839
4840 !! test
4841 External links: tricky Parsoid html2html case
4842 !! options
4843 parsoid=wt2html,wt2wt,html2html
4844 !! wikitext
4845 http://example.com/url_with_entity&amp;amp;
4846 !! html/php
4847 <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>;
4848 </p>
4849 !! html/parsoid
4850 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4851 !! end
4852
4853 !! test
4854 External links: Free with trailing quotes (T113666)
4855 !! wikitext
4856 '''News:''' Stuff here
4857
4858 news:'a'b''c''d e
4859 !! html/php
4860 <p><b>News:</b> Stuff here
4861 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4862 </p>
4863 !! html/parsoid
4864 <p><b>News:</b> Stuff here</p>
4865 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4866 !! end
4867
4868 !! test
4869 External links: with entity
4870 !! wikitext
4871 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
4872 !! html/php
4873 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
4874 </p>
4875 !! html/parsoid
4876 <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>
4877 !! end
4878
4879 !! test
4880 External links: Lone protocols are never linked (T105697)
4881 !! wikitext
4882 http://
4883 http://;
4884 (http://)
4885 bitcoin:
4886 bitcoin:;
4887 (bitcoin:)
4888 !! html
4889 <p>http://
4890 http://;
4891 (http://)
4892 bitcoin:
4893 bitcoin:;
4894 (bitcoin:)
4895 </p>
4896 !! end
4897
4898 !! test
4899 External links: No preceding word characters allowed (T67278)
4900 !! wikitext
4901 NOPEhttp://example.com
4902 N0http://example.com
4903 ok:http://example.com
4904 ok-http://example.com
4905 !! html
4906 <p>NOPEhttp://example.com
4907 N0http://example.com
4908 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4909 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4910 </p>
4911 !! end
4912
4913 !! test
4914 External links: nofollow domain exception
4915 !! wikitext
4916 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4917 !! html
4918 <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>.
4919 </p>
4920 !!end
4921
4922 !! test
4923 External image
4924 !! wikitext
4925 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4926 !! html
4927 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4928 </p>
4929 !! end
4930
4931 !! test
4932 External image from https
4933 !! wikitext
4934 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4935 !! html
4936 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4937 </p>
4938 !! end
4939
4940 !! test
4941 External image (when not allowed)
4942 !! options
4943 wgAllowExternalImages=0
4944 !! wikitext
4945 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4946 !! html
4947 <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>
4948 </p>
4949 !! end
4950
4951 !! test
4952 Link to non-http image, no img tag
4953 !! wikitext
4954 Link to non-http image, no img tag: ftp://example.com/test.jpg
4955 !! html
4956 <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>
4957 </p>
4958 !! end
4959
4960 !! test
4961 External links: terminating separator
4962 !! wikitext
4963 Terminating separator: http://example.com/thing,
4964 !! html
4965 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4966 </p>
4967 !! end
4968
4969 !! test
4970 External links: intervening separator
4971 !! wikitext
4972 Intervening separator: http://example.com/1,2,3
4973 !! html
4974 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4975 </p>
4976 !! end
4977
4978 !! test
4979 External links: old bug with URL in query
4980 !! wikitext
4981 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4982 !! html
4983 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4984 </p>
4985 !! end
4986
4987 !! test
4988 External links: old URL-in-URL bug, mixed protocols
4989 !! wikitext
4990 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4991 !! html
4992 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4993 </p>
4994 !!end
4995
4996 # Since Parsoid is starting to emit canonical wikitext for links,
4997 # [http://example.com http://example.com] will not RT back to that
4998 # form anymore.
4999 !! test
5000 External links: URL in text
5001 !! options
5002 parsoid=wt2html
5003 !! wikitext
5004 URL in text: [http://example.com http://example.com]
5005 !! html/php
5006 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5007 </p>
5008 !! html/parsoid
5009 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5010 !! end
5011
5012 !! test
5013 External links: Clickable images
5014 !! wikitext
5015 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
5016 !! html/php
5017 <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>
5018 </p>
5019 !! html/parsoid
5020 <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>
5021 !! end
5022
5023 !! test
5024 External links: raw ampersand
5025 !! wikitext
5026 Old &amp; use: http://x&y
5027 !! html
5028 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5029 </p>
5030 !! end
5031
5032 !! test
5033 External links: encoded ampersand
5034 !! wikitext
5035 Old &amp; use: http://x&amp;y
5036 !! html/php
5037 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5038 </p>
5039 !! html/parsoid
5040 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
5041 !! end
5042
5043 !! test
5044 External links: encoded equals (T8102)
5045 !! wikitext
5046 http://example.com/?foo&#61;bar
5047 !! html/php
5048 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5049 </p>
5050 !! html/parsoid
5051 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5052 !! end
5053
5054 ##
5055 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5056 ## does it number them. As discussed in T55505, we can identify
5057 ## autonumbered links via CSS.
5058 ##
5059
5060 !! test
5061 External links: [raw ampersand]
5062 !! wikitext
5063 Old &amp; use: [http://x&y]
5064 !! html/php
5065 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5066 </p>
5067 !! html/parsoid
5068 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5069 !! end
5070
5071 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5072 # mode will return the [raw ampersand] wikitext
5073 !! test
5074 External links: [encoded ampersand]
5075 !! options
5076 parsoid=wt2html,wt2wt,html2html
5077 !! wikitext
5078 Old &amp; use: [http://x&amp;y]
5079 !! html/php
5080 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5081 </p>
5082 !! html/parsoid
5083 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5084 !! end
5085
5086 !! test
5087 External links: [raw equals]
5088 !! wikitext
5089 [http://example.com/?foo=bar]
5090 !! html/php
5091 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5092 </p>
5093 !! html/parsoid
5094 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5095 !! end
5096
5097 # note that parsoid html is identical to [raw equals] case; so html2wt
5098 # mode will return the [raw equals] wikitext
5099 !! test
5100 External links: [encoded equals] (T8102)
5101 !! options
5102 parsoid=wt2html,wt2wt,html2html
5103 !! wikitext
5104 [http://example.com/?foo&#61;bar]
5105 !! html/php
5106 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5107 </p>
5108 !! html/parsoid
5109 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5110 !! end
5111
5112 # xxx parsoid strips the IDN character, so the round-trip tests will
5113 # obviously fail and are disabled. --cscott
5114 !! test
5115 External links: [IDN ignored character reference in hostname; strip it right off]
5116 !! options
5117 parsoid=wt2html,wt2wt,html2html
5118 !! wikitext
5119 [http://e&zwnj;xample.com/]
5120 !! html/php
5121 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5122 </p>
5123 !! html/parsoid
5124 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5125 !! end
5126
5127 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5128 # Where an external link could easily circumvent the sanitization of the text of
5129 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5130 # test demands a higher standard. That's a bit strange.
5131 #
5132 # Example:
5133 #
5134 # http://e‌xample.com -> [http://example.com|http://example.com]
5135 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5136 #
5137 # The first example is sanitized, but the second is not. Any security benefits
5138 # from this production are trivial to circumvent. Either remove this test and
5139 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5140 # the test accordingly.
5141 #
5142 # All our love,
5143 # The Parsoid team.
5144 # xxx parsoid strips the IDN character, so the round-trip tests will
5145 # obviously fail and are disabled. --cscott
5146 !! test
5147 External links: IDN ignored character reference in hostname; strip it right off
5148 !! options
5149 parsoid=wt2html,html2html
5150 !! wikitext
5151 http://e&zwnj;xample.com/
5152 !! html/php
5153 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5154 </p>
5155 !! html/parsoid
5156 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5157 !! end
5158
5159 !! test
5160 External links: www.jpeg.org (T2554)
5161 !! wikitext
5162 http://www.jpeg.org
5163 !! html
5164 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5165 </p>
5166 !! end
5167
5168 # parsoid doesn't explicitly mark autonumbered links, see T55505
5169 !! test
5170 External links: URL within URL (T2002)
5171 !! wikitext
5172 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5173 !! html/php
5174 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5175 </p>
5176 !! html/parsoid
5177 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5178 !! end
5179
5180 !! test
5181 T2361: URL inside bracketed URL
5182 !! wikitext
5183 [http://www.example.com/foo http://www.example.com/bar]
5184 !! html
5185 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5186 </p>
5187 !! end
5188
5189 !! test
5190 T2361: URL within URL, not bracketed
5191 !! wikitext
5192 http://www.example.com/foo?=http://www.example.com/bar
5193 !! html
5194 <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>
5195 </p>
5196 !! end
5197
5198 !! test
5199 T2289: ">"-token in URL-tail
5200 !! wikitext
5201 http://www.example.com/<hello>
5202 !! html
5203 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5204 </p>
5205 !!end
5206
5207 !! test
5208 T2289: literal ">"-token in URL-tail
5209 !! wikitext
5210 http://www.example.com/<b>html</b>
5211 !! html/php
5212 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5213 </p>
5214 !! html/parsoid
5215 <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>
5216 !! end
5217
5218 !! test
5219 T2289: ">"-token in bracketed URL
5220 !! wikitext
5221 [http://www.example.com/<hello> stuff]
5222 !! html
5223 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5224 </p>
5225 !!end
5226
5227 !! test
5228 T2289: literal ">"-token in bracketed URL
5229 !! wikitext
5230 [http://www.example.com/<b>html</b> stuff]
5231 !! html
5232 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5233 </p>
5234 !!end
5235
5236 !! test
5237 T2289: literal double quote at end of URL
5238 !! wikitext
5239 http://www.example.com/"hello"
5240 !! html
5241 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5242 </p>
5243 !!end
5244
5245 !! test
5246 T2289: literal double quote in bracketed URL
5247 !! wikitext
5248 [http://www.example.com/"hello" stuff]
5249 !! html
5250 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5251 </p>
5252 !!end
5253
5254 !! test
5255 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5256 !! wikitext
5257 [http://www.example.com test]
5258 !! html
5259 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5260 </p>
5261 !! end
5262
5263 !! test
5264 External links: link text with spaces
5265 !! wikitext
5266 [http://www.example.com a b c]
5267 [http://www.example.com ''a'' ''b'']
5268 !! html
5269 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5270 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5271 </p>
5272 !! end
5273
5274 !! test
5275 External links: wiki links within external link (T5695)
5276 !! options
5277 parsoid=wt2html,html2html
5278 !! wikitext
5279 [http://example.com [[wikilink]] embedded in ext link]
5280 !! html/php
5281 <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>
5282 </p>
5283 !! html/parsoid
5284 <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>
5285 !! end
5286
5287 !! test
5288 T2787: Links with one slash after the url protocol are invalid
5289 !! wikitext
5290 http:/example.com
5291
5292 [http:/example.com title]
5293 !! html
5294 <p>http:/example.com
5295 </p><p>[http:/example.com title]
5296 </p>
5297 !! end
5298
5299 !! test
5300 Bracketed external links with template-generated invalid target
5301 !! wikitext
5302 [{{echo|http:/example.com}} title]
5303 !! html
5304 <p>[http:/example.com title]
5305 </p>
5306 !! end
5307
5308 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5309 !! test
5310 Broken wikilinks (but not external links) prevent templates from closing
5311 !! options
5312 parsoid=wt2html
5313 !! wikitext
5314 [http://example.com x
5315
5316 {{echo|[http://example.com x}}
5317
5318 [[Foo
5319
5320 {{echo|[[Foo}}
5321 !! html/php
5322 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5323 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5324 </p><p>[[Foo
5325 </p><p>{{echo|[[Foo}}
5326 </p>
5327 !! html/parsoid
5328 <p>[<a rel="mw:ExtLink" href="http://example.com">http://example.com</a> x</p>
5329 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://example.com x"}},"i":0}}]}'>[<a rel="mw:ExtLink" href="http://example.com">http://example.com</a> x</p>
5330 <p>[[Foo</p>
5331 <p>{{echo|[[Foo}}</p>
5332 !! end
5333
5334 !! test
5335 Wikilinks with embedded newlines are not broken
5336 !! wikitext
5337 {{echo|[[ Foo
5338 B
5339 C]]}}
5340 !! html/php
5341 <p>[[ Foo
5342 B
5343 C]]
5344 </p>
5345 !! html/parsoid
5346 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[ Foo\nB\nC]]"}},"i":0}}]}'>[[ Foo B C]]</p>
5347 !! end
5348
5349 !! test
5350 Broken templates
5351 !! options
5352 parsoid=wt2html
5353 !! wikitext
5354 {{echo|[[Foo|}}]]
5355
5356 [[Foo|{{echo|]]}}
5357 !! html/php
5358 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5359 </p><p>[[Foo|]]
5360 </p>
5361 !! html/parsoid
5362 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5363 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5364 !! end
5365
5366 !! test
5367 T4702: Mismatched <i>, <b> and <a> tags are invalid
5368 !! wikitext
5369 ''[http://example.com text'']
5370 [http://example.com '''text]'''
5371 ''Something [http://example.com in italic'']
5372 ''Something [http://example.com mixed''''', even bold]'''
5373 '''''Now [http://example.com both''''']
5374 !! html
5375 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5376 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5377 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5378 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5379 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5380 </p>
5381 !! end
5382
5383
5384 !! test
5385 T6781: %26 in URL
5386 !! wikitext
5387 http://www.example.com/?title=AT%26T
5388 !! html/php
5389 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5390 </p>
5391 !! html/parsoid
5392 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5393 !! end
5394
5395 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5396 # % is actually legal in HTML5. Any change in output would need testing though.
5397 !! test
5398 T6781, T7267: %25 in URL
5399 !! wikitext
5400 http://www.example.com/?title=100%25_Bran
5401 !! html/php
5402 <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>
5403 </p>
5404 !! html/parsoid
5405 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5406 !! end
5407
5408 !! test
5409 T6781, T7267: %28, %29 in URL
5410 !! wikitext
5411 http://www.example.com/?title=Ben-Hur_%281959_film%29
5412 !! html/php
5413 <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>
5414 </p>
5415 !! html/parsoid
5416 <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>
5417 !! end
5418
5419
5420 !! test
5421 T6781: %26 in autonumber URL
5422 !! wikitext
5423 [http://www.example.com/?title=AT%26T]
5424 !! html/php
5425 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5426 </p>
5427 !! html/parsoid
5428 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5429 !! end
5430
5431 !! test
5432 T6781, T7267: %26 in autonumber URL
5433 !! wikitext
5434 [http://www.example.com/?title=100%25_Bran]
5435 !! html/php
5436 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5437 </p>
5438 !! html/parsoid
5439 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5440 !! end
5441
5442 !! test
5443 T6781, T7267: %28, %29 in autonumber URL
5444 !! wikitext
5445 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5446 !! html/php
5447 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5448 </p>
5449 !! html/parsoid
5450 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5451 !! end
5452
5453
5454 !! test
5455 T6781: %26 in bracketed URL
5456 !! wikitext
5457 [http://www.example.com/?title=AT%26T link]
5458 !! html/php
5459 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5460 </p>
5461 !! html/parsoid
5462 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5463 !! end
5464
5465 !! test
5466 T6781, T7267: %25 in bracketed URL
5467 !! wikitext
5468 [http://www.example.com/?title=100%25_Bran link]
5469 !! html
5470 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5471 </p>
5472 !! end
5473
5474 !! test
5475 T6781, T7267: %28, %29 in bracketed URL
5476 !! wikitext
5477 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5478 !! html/php
5479 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5480 </p>
5481 !! html/parsoid
5482 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5483 !! end
5484
5485 !! test
5486 External link containing a period in the anchor. (T65947)
5487 !! wikitext
5488 [//foo.org/bar#baz. bang]
5489
5490 [//foo.org/bar. bang]
5491 !! html/php
5492 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5493 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5494 </p>
5495 !! html/parsoid
5496 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5497 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5498 !! end
5499
5500 !! test
5501 External link containing a single quote. (T65947)
5502 !! wikitext
5503 [//foo.org/bar'baz]
5504
5505 [//foo.org/bar'baz bang]
5506 !! html/php
5507 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5508 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5509 </p>
5510 !! html/parsoid
5511 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5512 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5513 !! end
5514
5515 !! test
5516 External link containing double-single-quotes in text '' (T6598 sanity check)
5517 !! wikitext
5518 Some [http://example.com/ pretty ''italics'' and stuff]!
5519 !! html
5520 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5521 </p>
5522 !! end
5523
5524 !! test
5525 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5526 !! wikitext
5527 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5528 !! html
5529 <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>
5530 </p>
5531 !! end
5532
5533 !! test
5534 External link containing double-single-quotes with no space separating the url from text in italics
5535 !! wikitext
5536 [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]].]
5537 !! html/php
5538 <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>
5539 </p>
5540 !! html/php+tidy
5541 <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>
5542 !! html/parsoid
5543 <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>
5544 !! end
5545
5546 !! test
5547 External link with comments in link text
5548 !! wikitext
5549 [http://www.google.com Google <!-- comment -->]
5550 !! html/php
5551 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5552 </p>
5553 !! html/parsoid
5554 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5555 !! end
5556
5557 !! test
5558 External link to bare IPv4 address
5559 !! wikitext
5560 [http://192.168.0.1 Link]
5561 !! html/php
5562 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5563 </p>
5564 !! html/parsoid
5565 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5566 !! end
5567
5568 !! test
5569 URL-encoding in URL functions (single parameter)
5570 !! wikitext
5571 {{localurl:Some page|amp=&}}
5572 !! html
5573 <p>/index.php?title=Some_page&amp;amp=&amp;
5574 </p>
5575 !! end
5576
5577 !! test
5578 URL-encoding in URL functions (multiple parameters)
5579 !! wikitext
5580 {{localurl:Some page|q=?&amp=&}}
5581 !! html
5582 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5583 </p>
5584 !! end
5585
5586 !! test
5587 Brackets in urls
5588 !! wikitext
5589 http://example.com/index.php?foozoid%5B%5D=bar
5590
5591 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5592 !! html/php
5593 <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>
5594 </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>
5595 </p>
5596 !! html/parsoid
5597 <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>
5598
5599 <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>
5600 !! end
5601
5602 !! test
5603 IPv6 urls, autolink format (T23261)
5604 !! wikitext
5605 http://[2404:130:0:1000::187:2]/index.php
5606
5607 Examples from RFC 2373, section 2.2:
5608 * http://[1080::8:800:200C:417A]/unicast
5609 * http://[FF01::101]/multicast
5610 * http://[::1]/loopback
5611 * http://[::]/unspecified
5612 * http://[::13.1.68.3]/ipv4compat
5613 * http://[::FFFF:129.144.52.38]/ipv4compat
5614
5615 Examples from RFC 2732, section 2:
5616 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5617 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5618 * http://[3ffe:2a00:100:7031::1]
5619 * http://[1080::8:800:200C:417A]/foo
5620 * http://[::192.9.5.5]/ipng
5621 * http://[::FFFF:129.144.52.38]:80/index.html
5622 * http://[2010:836B:4179::836B:4179]
5623
5624 !! html/php
5625 <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>
5626 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5627 </p>
5628 <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>
5629 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5630 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5631 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5632 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5633 <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>
5634 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5635 </p>
5636 <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>
5637 <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>
5638 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5639 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5640 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5641 <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>
5642 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5643
5644 !! html/parsoid
5645 <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>
5646
5647 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5648 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5649 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5650 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5651 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5652 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5653 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5654
5655 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5656 <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>
5657 <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>
5658 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5659 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5660 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5661 <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>
5662 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5663 !! end
5664
5665 !! test
5666 IPv6 urls, bracketed format (T23261)
5667 !! wikitext
5668 [http://[2404:130:0:1000::187:2]/index.php test]
5669
5670 Examples from RFC 2373, section 2.2:
5671 * [http://[1080::8:800:200C:417A] unicast]
5672 * [http://[FF01::101] multicast]
5673 * [http://[::1]/ loopback]
5674 * [http://[::] unspecified]
5675 * [http://[::13.1.68.3] ipv4compat]
5676 * [http://[::FFFF:129.144.52.38] ipv4compat]
5677
5678 Examples from RFC 2732, section 2:
5679 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5680 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5681 * [http://[3ffe:2a00:100:7031::1] 3]
5682 * [http://[1080::8:800:200C:417A]/foo 4]
5683 * [http://[::192.9.5.5]/ipng 5]
5684 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5685 * [http://[2010:836B:4179::836B:4179] 7]
5686
5687 !! html/php
5688 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5689 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5690 </p>
5691 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5692 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5693 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5694 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5695 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5696 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5697 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5698 </p>
5699 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5700 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5701 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5702 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5703 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5704 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5705 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5706
5707 !! html/parsoid
5708 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5709
5710 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5711 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5712 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5713 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5714 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5715 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5716 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5717
5718 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5719 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5720 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5721 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5722 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5723 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5724 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5725 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5726 !! end
5727
5728 !! test
5729 Non-extlinks in brackets
5730 !! wikitext
5731 [foo]
5732 [foo bar]
5733 [foo ''bar'']
5734 [fool's] errand
5735 [fool's errand]
5736 [{{echo|foo}}]
5737 [{{echo|foo}} bar]
5738 [{{echo|foo}} ''bar'']
5739 [{{echo|foo}}l's] errand
5740 [{{echo|foo}}l's errand]
5741 [url={{echo|foo}}]
5742 [url=http://example.com]
5743 [http:// bare protocols don't count]
5744 !! html/php
5745 <p>[foo]
5746 [foo bar]
5747 [foo <i>bar</i>]
5748 [fool's] errand
5749 [fool's errand]
5750 [foo]
5751 [foo bar]
5752 [foo <i>bar</i>]
5753 [fool's] errand
5754 [fool's errand]
5755 [url=foo]
5756 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5757 [http:// bare protocols don't count]
5758 </p>
5759 !! html/parsoid
5760 <p>[foo]
5761 [foo bar]
5762 [foo <i>bar</i>]
5763 [fool's] errand
5764 [fool's errand]
5765 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5766 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5767 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5768 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5769 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5770 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5771 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5772 [http:// bare protocols don't count]</p>
5773 !! end
5774
5775 !! test
5776 Percent encoding in external links
5777 !! wikitext
5778 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5779 !! html/php
5780 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5781 </p>
5782 !! html/parsoid
5783 <p><a rel="mw:ExtLink"
5784 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5785 !! end
5786
5787 !! test
5788 Use url link syntax for links where the content is equal the link target
5789 !! wikitext
5790 http://example.com
5791 !! html/php
5792 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5793 </p>
5794 !! html/parsoid
5795 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5796 !! end
5797
5798 !! test
5799 Parenthesis in external links, especially URL links
5800 !! wikitext
5801 http://example.com)
5802
5803 http://example.com/test)
5804
5805 http://example.com/(test)
5806
5807 http://example.com/((test)
5808
5809 (http://example.com/(test))
5810
5811 (http://example.com/(test)))))
5812
5813 http://example.com/a)b
5814
5815 [http://example.com) foo]
5816 !! html/php
5817 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5818 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5819 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5820 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5821 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5822 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5823 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5824 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5825 </p>
5826 !! html/parsoid
5827 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5828 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5829 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5830 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5831 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5832 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5833 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5834 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5835 !! end
5836
5837 !! test
5838 Parenthesis in external links, w/ transclusion or comment
5839 !! wikitext
5840 (http://example.com/{{echo|hi}})
5841
5842 (http://example.com<!-- hi -->)
5843 !! html/php
5844 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5845 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5846 </p>
5847 !! html/parsoid
5848 <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>
5849
5850 <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>
5851 !! end
5852
5853 !! test
5854 Serialize <a> tags with invalid link targets as plain text
5855 !! options
5856 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5857 !! html/parsoid
5858 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5859 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5860 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5861 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5862 !! wikitext
5863 text
5864 <nowiki>*</nowiki>text
5865 <nowiki>[[foo]]</nowiki>
5866 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5867 !! end
5868
5869 !! test
5870 mw:ExtLink -vs- mw:WikiLink (T94723)
5871 !! options
5872 parsoid=html2wt
5873 !! html/parsoid
5874 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5875 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5876 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5877 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5878 <p>
5879 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5880 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5881 </p>
5882 !! wikitext
5883 [[Foo|Bar]]
5884 [[Foo|Bar]]
5885 [[wikipedia:Foo|Bar]]
5886 [[wikipedia:Foo|Bar]]
5887
5888 [[wikipedia:European_Robin|European Robin]]
5889 [[wikipedia:European_Robin|European Robin]]
5890 !! end
5891
5892 !! test
5893 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5894 !! options
5895 parsoid=wt2wt
5896 !! wikitext
5897 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5898 !! html/parsoid
5899 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5900 !! end
5901
5902
5903 ###
5904 ### Quotes
5905 ###
5906
5907 !! test
5908 Quotes
5909 !! wikitext
5910 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5911
5912 Normal text. '''''Bold italic text.''''' Normal text.
5913 !! html
5914 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5915 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5916 </p>
5917 !! end
5918
5919
5920 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5921 # parser strips. The wikitext contains just the first half of the bold
5922 # quote pair.
5923 !! test
5924 Unclosed and unmatched quotes
5925 !! wikitext
5926 '''''Bold italic text '''with bold deactivated''' in between.'''''
5927
5928 '''''Bold italic text ''with italic deactivated'' in between.'''''
5929
5930 '''Bold text..
5931
5932 ..spanning two paragraphs (should not work).'''
5933
5934 '''Bold tag left open
5935
5936 ''Italic tag left open
5937
5938 Normal text.
5939
5940 <!-- Unmatching number of opening, closing tags: -->
5941 '''This year''''s election ''should'' beat '''last year''''s.
5942
5943 ''Tom'''s car is bigger than ''Susan'''s.
5944
5945 Plain ''italic'''s plain
5946 !! html/php
5947 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5948 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5949 </p><p><b>Bold text..</b>
5950 </p><p>..spanning two paragraphs (should not work).
5951 </p><p><b>Bold tag left open</b>
5952 </p><p><i>Italic tag left open</i>
5953 </p><p>Normal text.
5954 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5955 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5956 </p><p>Plain <i>italic'</i>s plain
5957 </p>
5958 !! html/parsoid
5959 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5960 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5961 </p><p><b>Bold text..</b>
5962 </p><p>..spanning two paragraphs (should not work).<b></b>
5963 </p><p><b>Bold tag left open</b>
5964 </p><p><i>Italic tag left open</i>
5965 </p><p>Normal text.
5966 </p>
5967 <!-- Unmatching number of opening, closing tags: -->
5968 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5969 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5970 </p><p>Plain <i>italic'</i>s plain
5971 </p>
5972 !! end
5973
5974 ###
5975 ### Tables
5976 ###
5977 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5978 ###
5979
5980 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5981 # is the bare minimum required by the spec, see:
5982 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5983 # Parsoid team replies: empty table tags are legal in HTML5
5984 !! test
5985 A table with no data.
5986 !! options
5987 parsoid=wt2html
5988 !! wikitext
5989 {||}
5990 !! html/php
5991
5992 !! html/parsoid
5993 <table></table>
5994
5995 !! end
5996
5997 !! test
5998 A table with stray table end tags on start tag line (wt2html)
5999 !! options
6000 parsoid=wt2html
6001 !! wikitext
6002 {|style="color: red;"|}
6003
6004 {|style="color: red;" |}
6005 |foo
6006 |}
6007
6008 {|style="color: red;"|} id="foo"
6009 |foo
6010 |}
6011
6012 {|style="color: red;" |} id="foo"
6013 |foo
6014 |}
6015 !! html
6016 <table style="color: red;"></table>
6017
6018 <table style="color: red;">
6019 <tbody><tr>
6020 <td>foo</td>
6021 </tr></tbody>
6022 </table>
6023
6024 <table style="color: red;" id="foo">
6025 <tbody><tr>
6026 <td>foo</td>
6027 </tr></tbody>
6028 </table>
6029
6030 <table style="color: red;" id="foo">
6031 <tbody><tr>
6032 <td>foo</td>
6033 </tr></tbody>
6034 </table>
6035
6036 !! end
6037
6038 !! test
6039 A table with no data (take 2)
6040 !! wikitext
6041 {|
6042 |}
6043 !! html/parsoid
6044 <table></table>
6045 !! end
6046
6047 # A table with nothing but a caption is invalid XHTML, we might want to render
6048 # this as <p>caption</p>
6049 # Parsoid team replies: table with only a caption is legal in HTML5
6050 !! test
6051 A table with nothing but a caption
6052 !! wikitext
6053 {|
6054 |+ caption
6055 |}
6056 !! html/php
6057 <table>
6058 <caption> caption
6059 </caption><tr><td></td></tr></table>
6060
6061 !! html/parsoid
6062 <table><caption> caption</caption></table>
6063 !! end
6064
6065 !! test
6066 A table with caption with default-spaced attributes and a table row
6067 !! wikitext
6068 {|
6069 |+ style="color: red;" | caption1
6070 |-
6071 | foo
6072 |}
6073 !! html
6074 <table>
6075 <caption style="color: red;"> caption1
6076 </caption>
6077 <tr>
6078 <td> foo
6079 </td></tr></table>
6080
6081 !! end
6082
6083 !! test
6084 A table with captions with non-default spaced attributes and a table row
6085 !! wikitext
6086 {|
6087 |+style="color: red;"|caption2
6088 |+ style="color: red;"| caption3
6089 |-
6090 | foo
6091 |}
6092 !! html
6093 <table>
6094 <caption style="color: red;">caption2
6095 </caption>
6096 <caption style="color: red;"> caption3
6097 </caption>
6098 <tr>
6099 <td> foo
6100 </td></tr></table>
6101
6102 !! end
6103
6104 !! test
6105 Table td-cell syntax variations
6106 !! wikitext
6107 {|
6108 | foo bar foo | baz
6109 | foo bar foo || baz
6110 | style='color:red;' | baz
6111 | style='color:red;' || baz
6112 |}
6113 !! html
6114 <table>
6115 <tr>
6116 <td> baz
6117 </td>
6118 <td> foo bar foo </td>
6119 <td> baz
6120 </td>
6121 <td style="color:red;"> baz
6122 </td>
6123 <td> style='color:red;' </td>
6124 <td> baz
6125 </td></tr></table>
6126
6127 !! end
6128
6129 !! test
6130 Simple table
6131 !! wikitext
6132 {|
6133 | 1 || 2
6134 |-
6135 | 3 || 4
6136 |}
6137 !! html
6138 <table>
6139 <tr>
6140 <td> 1 </td>
6141 <td> 2
6142 </td></tr>
6143 <tr>
6144 <td> 3 </td>
6145 <td> 4
6146 </td></tr></table>
6147
6148 !! end
6149
6150 !! test
6151 Simple table but with multiple dashes for row wikitext
6152 !! wikitext
6153 {|
6154 | foo
6155 |-----
6156 | bar
6157 |}
6158 !! html
6159 <table>
6160 <tr>
6161 <td> foo
6162 </td></tr>
6163 <tr>
6164 <td> bar
6165 </td></tr></table>
6166
6167 !! end
6168
6169 !! test
6170 Multiplication table
6171 !! wikitext
6172 {| border="1" cellpadding="2"
6173 |+Multiplication table
6174 |-
6175 ! &times; !! 1 !! 2 !! 3
6176 |-
6177 ! 1
6178 | 1 || 2 || 3
6179 |-
6180 ! 2
6181 | 2 || 4 || 6
6182 |-
6183 ! 3
6184 | 3 || 6 || 9
6185 |-
6186 ! 4
6187 | 4 || 8 || 12
6188 |-
6189 ! 5
6190 | 5 || 10 || 15
6191 |}
6192 !! html
6193 <table border="1" cellpadding="2">
6194 <caption>Multiplication table
6195 </caption>
6196 <tr>
6197 <th> &#215; </th>
6198 <th> 1 </th>
6199 <th> 2 </th>
6200 <th> 3
6201 </th></tr>
6202 <tr>
6203 <th> 1
6204 </th>
6205 <td> 1 </td>
6206 <td> 2 </td>
6207 <td> 3
6208 </td></tr>
6209 <tr>
6210 <th> 2
6211 </th>
6212 <td> 2 </td>
6213 <td> 4 </td>
6214 <td> 6
6215 </td></tr>
6216 <tr>
6217 <th> 3
6218 </th>
6219 <td> 3 </td>
6220 <td> 6 </td>
6221 <td> 9
6222 </td></tr>
6223 <tr>
6224 <th> 4
6225 </th>
6226 <td> 4 </td>
6227 <td> 8 </td>
6228 <td> 12
6229 </td></tr>
6230 <tr>
6231 <th> 5
6232 </th>
6233 <td> 5 </td>
6234 <td> 10 </td>
6235 <td> 15
6236 </td></tr></table>
6237
6238 !! end
6239
6240 !! test
6241 Accept "||" in table headings
6242 !! wikitext
6243 {|
6244 !h1 || h2
6245 |}
6246 !! html
6247 <table>
6248 <tr>
6249 <th>h1 </th>
6250 <th> h2
6251 </th></tr></table>
6252
6253 !! end
6254
6255 !! test
6256 Accept "!!" in table data
6257 !! wikitext
6258 {|
6259 | Foo!! ||
6260 |}
6261 !! html
6262 <table>
6263 <tr>
6264 <td> Foo!! </td>
6265 <td>
6266 </td></tr></table>
6267
6268 !! html/parsoid
6269 <table>
6270 <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>
6271 </tbody></table>
6272 !! end
6273
6274 !! test
6275 Accept "||" in indented table headings
6276 !! wikitext
6277 :{|
6278 !h1 || h2
6279 |}
6280 !! html
6281 <dl><dd><table>
6282 <tr>
6283 <th>h1 </th>
6284 <th> h2
6285 </th></tr></table></dd></dl>
6286
6287 !! end
6288
6289 !! test
6290 Accept "!!" in templates
6291 !! wikitext
6292 {|
6293 !a {{echo|b!!c}}
6294 |}
6295 !! html/php
6296 <table>
6297 <tr>
6298 <th>a b</th>
6299 <th>c
6300 </th></tr></table>
6301
6302 !! html/parsoid
6303 <table>
6304 <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>
6305 !! end
6306
6307 !! test
6308 Accept "!!" in table headings after newline
6309 !! wikitext
6310 {|
6311 !a
6312 b!!c
6313 |}
6314 !! html/php
6315 <table>
6316 <tr>
6317 <th>a
6318 <p>b!!c
6319 </p>
6320 </th></tr></table>
6321
6322 !! html/parsoid
6323 <table>
6324 <tbody><tr><th>a
6325 <p>b!!c</p></th></tr>
6326 </tbody></table>
6327 !! end
6328
6329 !! test
6330 Accept "!!" in table data of mixed wikitext / html syntax
6331 !! wikitext
6332 {|
6333 !a
6334 <tr><td>b!!c</td></tr>
6335 |}
6336 !! html+tidy
6337 <table>
6338 <tr>
6339 <th>a</th>
6340 </tr>
6341 <tr>
6342 <td>b!!c</td>
6343 </tr>
6344 </table>
6345 !! html/parsoid
6346 <table>
6347 <tbody><tr><th>a</th></tr>
6348 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6349 </tbody></table>
6350 !! end
6351
6352 !! test
6353 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6354 !! wikitext
6355 {|
6356 !| h1
6357 || a
6358 |}
6359 !! html
6360 <table>
6361 <tr>
6362 <th> h1
6363 </th>
6364 <td> a
6365 </td></tr></table>
6366
6367 !! end
6368
6369 !!test
6370 Accept "| !" at start of line in tables (ignore !-attribute)
6371 !! wikitext
6372 {|
6373 |-
6374 | !style="color:red" | bar
6375 |}
6376 !! html
6377 <table>
6378
6379 <tr>
6380 <td> bar
6381 </td></tr></table>
6382
6383 !!end
6384
6385 !!test
6386 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 +/-
6387 !! wikitext
6388 {|
6389 |-
6390 |style='color:red;'|+1
6391 |style='color:blue;'|-1
6392 |-
6393 | 1 || 2 || 3
6394 | 1 ||+2 ||-3
6395 |-
6396 | +1
6397 | -1
6398 |}
6399 !! html
6400 <table>
6401
6402 <tr>
6403 <td style="color:red;">+1
6404 </td>
6405 <td style="color:blue;">-1
6406 </td></tr>
6407 <tr>
6408 <td> 1 </td>
6409 <td> 2 </td>
6410 <td> 3
6411 </td>
6412 <td> 1 </td>
6413 <td>+2 </td>
6414 <td>-3
6415 </td></tr>
6416 <tr>
6417 <td> +1
6418 </td>
6419 <td> -1
6420 </td></tr></table>
6421
6422 !!end
6423
6424 !! test
6425 Table rowspan
6426 !! wikitext
6427 {| border=1
6428 | Cell 1, row 1
6429 |rowspan=2| Cell 2, row 1 (and 2)
6430 | Cell 3, row 1
6431 |-
6432 | Cell 1, row 2
6433 | Cell 3, row 2
6434 |}
6435 !! html
6436 <table border="1">
6437 <tr>
6438 <td> Cell 1, row 1
6439 </td>
6440 <td rowspan="2"> Cell 2, row 1 (and 2)
6441 </td>
6442 <td> Cell 3, row 1
6443 </td></tr>
6444 <tr>
6445 <td> Cell 1, row 2
6446 </td>
6447 <td> Cell 3, row 2
6448 </td></tr></table>
6449
6450 !! end
6451
6452 !! test
6453 Nested table
6454 !! wikitext
6455 {| border=1
6456 | &alpha;
6457 |
6458 {| bgcolor=#ABCDEF border=2
6459 |nested
6460 |-
6461 |table
6462 |}
6463 |the original table again
6464 |}
6465 !! html
6466 <table border="1">
6467 <tr>
6468 <td> &#945;
6469 </td>
6470 <td>
6471 <table bgcolor="#ABCDEF" border="2">
6472 <tr>
6473 <td>nested
6474 </td></tr>
6475 <tr>
6476 <td>table
6477 </td></tr></table>
6478 </td>
6479 <td>the original table again
6480 </td></tr></table>
6481
6482 !! end
6483
6484 !! test
6485 Invalid attributes in table cell (T3830)
6486 !! wikitext
6487 {|
6488 |Cell:|broken
6489 |}
6490 !! html
6491 <table>
6492 <tr>
6493 <td>broken
6494 </td></tr></table>
6495
6496 !! end
6497
6498 !! test
6499 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6500 !! wikitext
6501 {|
6502 | title="foo" |bar
6503 | title="foo<nowiki>|</nowiki>" |bar
6504 | title="foo<nowiki>|</nowiki>" bar
6505 |}
6506 !! html/php
6507 <table>
6508 <tr>
6509 <td title="foo">bar
6510 </td>
6511 <td title="foo&#124;">bar
6512 </td>
6513 <td> title="foo|" bar
6514 </td></tr></table>
6515
6516 !! html/parsoid
6517 <table>
6518 <tbody><tr><td title="foo">bar</td>
6519 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6520 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6521 </tbody></table>
6522 !! end
6523
6524 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6525 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6526 # *2wt modes will fail.
6527 !! test
6528 Table security: embedded pipes
6529 !! options
6530 parsoid=wt2html,html2html
6531 !! wikitext
6532 {|
6533 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6534 !! html/php
6535 <table>
6536 <tr>
6537 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6538 <td>]" onmouseover="alert(document.cookie)"&gt;test
6539 </td>
6540 </tr>
6541 </table>
6542
6543 !! html/parsoid
6544 <table><tbody>
6545 <tr>
6546 <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>
6547 !! end
6548
6549 !! test
6550 Element attributes with double ! should not be broken up by <th>
6551 !! wikitext
6552 {|
6553 ! hi <div class="!!">ha</div> ho
6554 |}
6555 !! html/php
6556 <table>
6557 <tr>
6558 <th> hi <div class="!!">ha</div> ho
6559 </th></tr></table>
6560
6561 !! html/parsoid
6562 <table>
6563 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6564 </tbody></table>
6565 !! end
6566
6567 !! test
6568 ! and || in element attributes should not be parsed as <th>/<td>
6569 !! wikitext
6570 {|
6571 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6572 |}
6573 !! html/php
6574 <table>
6575 <tr>
6576 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6577 </td></tr></table>
6578
6579 !! html/parsoid
6580 <table>
6581 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6582 </tbody></table>
6583 !! end
6584
6585 # FIXME: The output seems broken. Filed as T110268.
6586 !! test
6587 ! and || in td attributes should not be parsed as <th>/<td>
6588 !! options
6589 parsoid=wt2html
6590 !! wikitext
6591 {|
6592 | style="color: red !important;" data-contrived="put this here ||" | foo
6593 |}
6594 !! html/php
6595 <table>
6596 <tr>
6597 <td> style="color: red !important;" data-contrived="put this here </td>
6598 <td> foo
6599 </td></tr></table>
6600
6601 !! html/parsoid
6602 <table>
6603 <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>
6604 </tbody></table>
6605 !! end
6606
6607 !! test
6608 Break on | in element attribute in template
6609 !! options
6610 parsoid=wt2html,html2html
6611 !! wikitext
6612 {{echo|1=<div class="hi|ho">ha</div>}}
6613 !! html/php
6614 <p>ho"&gt;ha&lt;/div&gt;
6615 </p>
6616 !! html/parsoid
6617 <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>
6618 !! end
6619
6620 !! test
6621 Break on | in element attribute name in template
6622 !! wikitext
6623 {{echo|<div cla|ss="hiho">ha</div>}}
6624 !! html/parsoid
6625 <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>
6626 !! end
6627
6628 !! test
6629 Don't break on | in extension attribute in template
6630 !! wikitext
6631 {{echo|<ref name="hi|ho">ha</ref>}}
6632
6633 <references />
6634 !! html/parsoid
6635 <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>
6636
6637 <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>
6638 !! end
6639
6640 ## We don't support roundtripping of these attributes in Parsoid.
6641 ## Selective serialization takes care of preventing dirty diffs.
6642 ## But, on edits, we dirty-diff the invalid attribute text.
6643 !! test
6644 Invalid text in table attributes should be discarded
6645 !! options
6646 parsoid=wt2html
6647 !! wikitext
6648 {| <span>boo</span> style='border:1px solid black'
6649 | <span>boo</span> style='color:blue' | 1
6650 |<span>boo</span> style='color:blue'| 2
6651 |}
6652 !! html/php
6653 <table style="border:1px solid black">
6654 <tr>
6655 <td style="color:blue"> 1
6656 </td>
6657 <td style="color:blue"> 2
6658 </td></tr></table>
6659
6660 !! html/parsoid
6661 <table style="border:1px solid black">
6662 <tr>
6663 <td style="color:blue"> 1</td>
6664 <td style="color:blue"> 2</td>
6665 </tr>
6666 </table>
6667 !! end
6668
6669 !! test
6670 Invalid text in table attributes should be preserved by selective serializer
6671 !! options
6672 parsoid={
6673 "modes": ["selser"],
6674 "changes": [
6675 ["td:first-child", "text", "abc"],
6676 ["td + td", "text", "xyz"]
6677 ]
6678 }
6679 !! wikitext
6680 {| <span>boo</span> style='border:1px solid black'
6681 | <span>boo</span> style='color:blue' | 1
6682 |<span>boo</span> style='color:blue'| 2
6683 |}
6684 !! wikitext/edited
6685 {| <span>boo</span> style='border:1px solid black'
6686 | <span>boo</span> style='color:blue' |abc
6687 |<span>boo</span> style='color:blue'|xyz
6688 |}
6689 !! end
6690
6691 !! test
6692 1. Template-generated table cell attributes and cell content
6693 !! wikitext
6694 {|
6695 |{{table_attribs}}
6696 | {{table_attribs}}
6697 || {{table_attribs_5}}
6698 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6699 |align=center {{table_attribs}}
6700 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6701 |}
6702 !! html
6703 <table>
6704 <tr>
6705 <td style="color:red;">Foo
6706 </td>
6707 <td style="color:red;">Foo
6708 </td>
6709 <td> style="color:red;"</td>
6710 <td>Bar
6711 </td>
6712 <td style="color:red;">Foo
6713 </td>
6714 <td align="center" style="color:red;">Foo
6715 </td>
6716 <td align="center" style="color:red;">Foo
6717 </td></tr></table>
6718
6719 !! end
6720
6721 !! test
6722 2. Template-generated table cell attributes and cell content
6723 !! wikitext
6724 {|
6725 |{{table_attribs_2}}
6726 |}
6727 !! html/php
6728 <table>
6729 <tr>
6730 <td style="color:red;">Foo
6731 </td>
6732 <td>Bar</td>
6733 <td>Baz
6734 </td></tr></table>
6735
6736 !! html/parsoid
6737 <table>
6738 <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>
6739 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6740 </tbody></table>
6741 !! end
6742
6743 !! test
6744 3. Template-generated table cell attributes and cell content
6745 !! wikitext
6746 {|
6747 !align=center {{table_header_cells}}
6748 |-
6749 |align=center {{table_cells}}
6750 |}
6751 !! html/php
6752 <table>
6753 <tr>
6754 <th align="center" style="color:red;">Foo</th>
6755 <th style="color:red;"><i>Bar</i></th>
6756 <th style="color:brown;"><i>Foo</i> and Baz
6757 </th></tr>
6758 <tr>
6759 <td align="center" style="color:red;">Foo</td>
6760 <td style="color:red;"><i>Bar</i></td>
6761 <td style="color:brown;"><i>Foo</i> and Baz
6762 </td></tr></table>
6763
6764 !! html/parsoid
6765 <table>
6766 <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>
6767 <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>
6768 </tbody></table>
6769 !! end
6770
6771 !! test
6772 4. Template-generated table cell attributes and cell content inside a templated table
6773 !! wikitext
6774 {{tbl-start}}
6775 !align=center {{table_header_cells}}
6776 |-
6777 |align=center {{table_cells}}
6778 {{tbl-end}}
6779 !! html/php
6780 <table>
6781 <tr>
6782 <th align="center" style="color:red;">Foo</th>
6783 <th style="color:red;"><i>Bar</i></th>
6784 <th style="color:brown;"><i>Foo</i> and Baz
6785 </th></tr>
6786 <tr>
6787 <td align="center" style="color:red;">Foo</td>
6788 <td style="color:red;"><i>Bar</i></td>
6789 <td style="color:brown;"><i>Foo</i> and Baz
6790 </td></tr></table>
6791
6792 !! html/parsoid
6793 <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}}]}'>
6794 <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>
6795 <tr>
6796 <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>
6797 </tbody></table>
6798 !! end
6799
6800 ## Edge case fix to prevent future regressions
6801 !! test
6802 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6803 !! wikitext
6804 {|
6805 |{{table_attribs_7}}
6806 |}
6807 <references />
6808 !! html/parsoid
6809 <table>
6810 <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>
6811 </tbody></table>
6812 <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>
6813 !! end
6814
6815 !! test
6816 Table with row followed by newlines and table heading
6817 !! options
6818 parsoid=wt2html,html2html
6819 !! wikitext
6820 {|
6821 |-
6822
6823 ! foo
6824 |}
6825 !! html/*
6826 <table>
6827
6828
6829 <tr>
6830 <th> foo
6831 </th></tr></table>
6832
6833 !! end
6834
6835 !! test
6836 Table with empty line following the start tag
6837 !! options
6838 parsoid=wt2html,html2html
6839 !! wikitext
6840 {|
6841
6842 |-
6843 | foo
6844 |}
6845 !! html/*
6846 <table>
6847
6848
6849 <tr>
6850 <td> foo
6851 </td></tr></table>
6852
6853 !! end
6854
6855 !! test
6856 Table attributes with empty value
6857 !! options
6858 parsoid=wt2html,html2html
6859 !! wikitext
6860 {|
6861 | style=| hello
6862 |}
6863 !! html/php
6864 <table>
6865 <tr>
6866 <td style=""> hello
6867 </td></tr></table>
6868
6869 !! html/parsoid
6870 <table>
6871 <tbody><tr><td style=""> hello</td></tr>
6872 </tbody></table>
6873 !! end
6874
6875 !! test
6876 Wikitext table with a lot of comments
6877 !! wikitext
6878 {|
6879 <!-- c0 -->
6880 | foo
6881 <!-- c1 -->
6882 |-<!-- c2 -->
6883 <!-- c3 -->
6884 |<!-- c4 -->
6885 <!-- c5 -->
6886 |}
6887 !! html
6888 <table>
6889 <tr>
6890 <td> foo
6891 </td></tr>
6892 <tr>
6893 <td>
6894 </td></tr></table>
6895
6896 !! end
6897
6898 !! test
6899 Wikitext table comments represented in parsoid dom
6900 !! wikitext
6901 {|<!--c1--><!--c2-->
6902 |-<!--c3-->
6903 | x
6904 |}
6905 !! html/php+tidy
6906 <table>
6907 <tr>
6908 <td>x</td>
6909 </tr>
6910 </table>
6911 !! html/parsoid
6912 <table><!--c1--><!--c2-->
6913 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6914 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6915 </tbody></table>
6916 !! end
6917
6918 !! test
6919 Wikitext table with double-line table cell
6920 !! wikitext
6921 {|
6922 |a
6923 b
6924 |}
6925 !! html
6926 <table>
6927 <tr>
6928 <td>a
6929 <p>b
6930 </p>
6931 </td></tr></table>
6932
6933 !! end
6934
6935 !! test
6936 Table cell with a single comment
6937 !! wikitext
6938 {|
6939 | <!-- c1 -->
6940 | a
6941 |}
6942 !! html
6943 <table>
6944 <tr>
6945 <td>
6946 </td>
6947 <td> a
6948 </td></tr></table>
6949
6950 !! end
6951
6952 !! test
6953 Table-cell after a comment-only-empty-line
6954 !! wikitext
6955 {|
6956 |a
6957 <!--c1-->
6958 <!--c2-->| b
6959 |}
6960 !! html
6961 <table>
6962 <tr>
6963 <td>a
6964 </td>
6965 <td> b
6966 </td></tr></table>
6967
6968 !! html/parsoid
6969 <table>
6970 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6971 <!--c1-->
6972 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6973 </tbody></table>
6974
6975 !! end
6976
6977 !! test
6978 Build table with {{!}}
6979 !! wikitext
6980 {{{!}} class="wikitable"
6981 ! header
6982 ! second header
6983 {{!}}- style="color:red;"
6984 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6985 {{!}}}
6986 !! html
6987 <table class="wikitable">
6988 <tr>
6989 <th> header
6990 </th>
6991 <th> second header
6992 </th></tr>
6993 <tr style="color:red;">
6994 <td> data </td>
6995 <td style="color:red;"> second data
6996 </td></tr></table>
6997
6998 !! end
6999
7000 !! test
7001 Build table with pipe as data
7002 !! wikitext
7003 {| class="wikitable"
7004 ! header
7005 ! second header
7006 |- style="color:red;"
7007 | data || style="color:red;" | second data
7008 |-
7009 | style="color:red;" | data with | || style="color:red;" | second data with |
7010 |-
7011 || data with | ||| second data with |
7012 |}
7013 !! html
7014 <table class="wikitable">
7015 <tr>
7016 <th> header
7017 </th>
7018 <th> second header
7019 </th></tr>
7020 <tr style="color:red;">
7021 <td> data </td>
7022 <td style="color:red;"> second data
7023 </td></tr>
7024 <tr>
7025 <td style="color:red;"> data with | </td>
7026 <td style="color:red;"> second data with |
7027 </td></tr>
7028 <tr>
7029 <td> data with | </td>
7030 <td> second data with |
7031 </td></tr></table>
7032
7033 !! end
7034
7035 !! test
7036 Build table with wikilink
7037 !! wikitext
7038 {| class="wikitable"
7039 ! header || second header
7040 |- style="color:red;"
7041 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
7042 |-
7043 | data || second data [[Main Page|link|text with pipe]]
7044 |}
7045 !! html
7046 <table class="wikitable">
7047 <tr>
7048 <th> header </th>
7049 <th> second header
7050 </th></tr>
7051 <tr style="color:red;">
7052 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
7053 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7054 </td></tr>
7055 <tr>
7056 <td> data </td>
7057 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7058 </td></tr></table>
7059
7060 !! end
7061
7062 # The expected HTML structure in this test is debatable. The PHP parser does
7063 # not parse this kind of table at all. The main focus for Parsoid is on
7064 # round-tripping, so this output is ok for now. TODO: revisit!
7065 !! test
7066 Wikitext table with html-syntax row
7067 !! wikitext
7068 {|
7069 |-
7070 <td>foo</td>
7071 |}
7072 !! html/parsoid
7073 <table>
7074 <tbody>
7075 <tr>
7076 <td>foo</td></tr></tbody></table>
7077 !! end
7078
7079 !! test
7080 Implicit <td> after a |-
7081 !! options
7082 parsoid=wt2html,html2html
7083 !! wikitext
7084 {|
7085 |-
7086 a
7087 |}
7088 !! html/php
7089 <table>
7090
7091 a
7092 </table>
7093
7094 !! html/php+tidy
7095 <p>a</p>
7096 !! html/parsoid
7097 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>a</p><table>
7098 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7099
7100 </tr></tbody></table>
7101 !! end
7102
7103 !! test
7104 Lists should be recognized in an implicit <td> context
7105 !! options
7106 parsoid=wt2html,html2html
7107 !! wikitext
7108 {|
7109 |-
7110 *a
7111 |}
7112 !! html/php
7113 <table>
7114
7115 <ul><li>a</li></ul>
7116 </table>
7117
7118 !! html/php+tidy
7119 <ul>
7120 <li>a</li>
7121 </ul>
7122 !! html/parsoid
7123 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7124 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7125
7126 </tr></tbody></table>
7127 !! end
7128
7129 !! test
7130 Table cells not properly parsed in an implicit-td context
7131 !! wikitext
7132 {|
7133 |-
7134 {{table_attribs_4}} || a || b
7135 |}
7136 !! html/php+tidy
7137 <table>
7138 <tr>
7139 <td style="background-color:#DC241f;" width="10px"></td>
7140 <td>a</td>
7141 <td>b</td>
7142 </tr>
7143 </table>
7144 !! html/parsoid
7145 <table>
7146 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7147 <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>
7148 !! end
7149
7150 !! test
7151 Parsoid: Round-trip tables directly followed by content (T53219)
7152 !! options
7153 parsoid=wt2html,wt2wt
7154 !! wikitext
7155 {|
7156 |foo
7157 |} bar
7158
7159 {|
7160 |baz
7161 |}<b>quux</b>
7162 !! html+tidy
7163 <table>
7164 <tr>
7165 <td>foo</td>
7166 </tr>
7167 </table>
7168 <p>bar</p>
7169 <table>
7170 <tr>
7171 <td>baz</td>
7172 </tr>
7173 </table>
7174 <p><b>quux</b></p>
7175 !! end
7176
7177 !! test
7178 Parsoid: Default to a newline after tables in new content (T53219)
7179 !! options
7180 parsoid=html2wt
7181 !! html/parsoid
7182 <table><tbody>
7183 <tr><td>foo</td></tr></tbody></table> bar
7184 <table><tbody>
7185 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7186 !! wikitext
7187 {|
7188 |foo
7189 |}
7190 <nowiki> </nowiki>bar
7191 {|
7192 |baz
7193 |}
7194 '''quux'''
7195 !! end
7196
7197 !! test
7198 Parsoid: newline inducing block nodes don't suppress <nowiki>
7199 !! options
7200 parsoid=html2wt
7201 !! html/parsoid
7202 a<h1>foo</h1>
7203 !! wikitext
7204 <nowiki> </nowiki>a
7205
7206 = foo =
7207 !! end
7208
7209 !! test
7210 Parsoid: Row-syntax table headings followed by comment & table cells
7211 !! options
7212 parsoid=wt2html,wt2wt
7213 !! wikitext
7214 {|
7215 ! foo || bar
7216 <!-- foo --> || baz || quux
7217 |}
7218 !! html/php
7219 <table>
7220 <tr>
7221 <th> foo </th>
7222 <th> bar
7223 </th>
7224 <td> baz </td>
7225 <td> quux
7226 </td></tr></table>
7227
7228 !! html/parsoid
7229 <table>
7230 <tbody><tr><th> foo </th><th> bar
7231 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7232 </tbody></table>
7233 !! end
7234
7235 !!test
7236 Parsoid: Recover better from broken table attributes
7237 !!options
7238 parsoid=wt2html
7239 !!wikitext
7240 {| class="foo
7241 | class="bar" |
7242 foo
7243 |}
7244 !!html/php+tidy
7245 <table class="foo">
7246 <tr>
7247 <td class="bar">
7248 <p>foo</p>
7249 </td>
7250 </tr>
7251 </table>
7252 !!html/parsoid
7253 <table class="foo">
7254 <tr>
7255 <td class="bar">
7256 <p>foo</p></td></tr>
7257 </tbody></table>
7258 !!end
7259
7260 !! test
7261 Tables: Digest broken attributes on table and tr tag
7262 !! options
7263 parsoid=wt2html
7264 !! wikitext
7265 {| || |} ++
7266 |- || || ++ --
7267 |- > [
7268 |}
7269 !! html
7270 <table>
7271 <tbody>
7272 <tr></tr>
7273 <tr></tr>
7274 </tbody></table>
7275 !! end
7276
7277 # T137406: Whitespace in the HTML
7278 !! test
7279 1. Generate correct wikitext for tables with thead/tbody/tfoot
7280 !! options
7281 parsoid=html2wt
7282 !! html/parsoid
7283 <table>
7284 <caption>Test</caption>
7285 <thead>
7286 <tr>
7287 <th>Month</th>
7288 <th>Savings</th>
7289 </tr>
7290 </thead>
7291 <tbody>
7292 <tr>
7293 <td>January</td>
7294 <td>$100</td>
7295 </tr>
7296 <tr>
7297 <td>February</td>
7298 <td>$80</td>
7299 </tr>
7300 </tbody>
7301 <tfoot>
7302 <tr>
7303 <td>Sum</td>
7304 <td>$180</td>
7305 </tr>
7306 </tfoot>
7307 </table>
7308 !! wikitext
7309 {|
7310 |+Test
7311 !Month
7312 !Savings
7313 |-
7314 |January
7315 |$100
7316 |-
7317 |February
7318 |$80
7319 |-
7320 |Sum
7321 |$180
7322 |}
7323 !! html/php+tidy
7324 <table>
7325 <caption>Test</caption>
7326 <tr>
7327 <th>Month</th>
7328 <th>Savings</th>
7329 </tr>
7330 <tr>
7331 <td>January</td>
7332 <td>$100</td>
7333 </tr>
7334 <tr>
7335 <td>February</td>
7336 <td>$80</td>
7337 </tr>
7338 <tr>
7339 <td>Sum</td>
7340 <td>$180</td>
7341 </tr>
7342 </table>
7343 !! end
7344
7345 # T137406: No whitespace in the HTML
7346 !! test
7347 2. Generate correct wikitext for tables with thead/tbody/tfoot
7348 !! options
7349 parsoid=html2wt
7350 !! html/parsoid
7351 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7352 !! wikitext
7353 {|
7354 !heading
7355 |-
7356 |foo
7357 |}
7358 !! end
7359
7360 !! test
7361 Testing serialization after deletion in references
7362 !! options
7363 parsoid={
7364 "modes": ["wt2wt"],
7365 "changes": [
7366 ["#x", "remove"]
7367 ]
7368 }
7369 !! wikitext
7370 hi <ref><div id="x">ho</div></ref>
7371
7372 <references />
7373 !! wikitext/edited
7374 hi <ref></ref>
7375
7376 <references />
7377 !! end
7378
7379 !!test
7380 Testing serialization after deletion of table cells
7381 !!options
7382 parsoid={
7383 "modes": ["wt2wt", "selser"],
7384 "changes": [
7385 ["#x", "remove"]
7386 ]
7387 }
7388 !!wikitext
7389 {|
7390 !h1 !!h2 !!h3
7391 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7392 |}
7393 !! wikitext/edited
7394 {|
7395 !h1 !!h2 !!h3
7396 |c2 |||c3
7397 |}
7398 !!end
7399
7400 !! test
7401 Testing selser after addition of new row before first row (T125419)
7402 !! options
7403 parsoid={
7404 "modes": ["wt2wt", "selser"],
7405 "changes": [
7406 [ "tr", "before", "<tr><td>X</td></tr>" ]
7407 ]
7408 }
7409 !! wikitext
7410 {|
7411 |a
7412 |}
7413 !! wikitext/edited
7414 {|
7415 |X
7416 |-
7417 |a
7418 |}
7419 !! end
7420
7421 !! test
7422 Serialize new table rows in a HTML table using HTML tags
7423 !! options
7424 parsoid={
7425 "modes": ["wt2wt", "selser"],
7426 "changes": [
7427 [ "tr", "before", "<tr><td>X</td></tr>" ]
7428 ]
7429 }
7430 !! wikitext
7431 <table><tr><td>a</td></tr></table>
7432 !! wikitext/edited
7433 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7434 !! end
7435
7436 !! test
7437 Serialize new table cells in a HTML row using HTML tags
7438 !! options
7439 parsoid={
7440 "modes": ["wt2wt", "selser"],
7441 "changes": [
7442 [ "td", "before", "<td>X</td>" ]
7443 ]
7444 }
7445 !! wikitext
7446 <table><tr><td>a</td></tr></table>
7447 !! wikitext/edited
7448 <table><tr><td>X</td><td>a</td></tr></table>
7449 !! end
7450
7451 !! test
7452 Wikitext tables can be nested inside HTML tables
7453 !! options
7454 parsoid=html2wt
7455 !! html
7456 <table data-parsoid='{"stx":"html"}'>
7457 <tr><td>
7458 <table>
7459 <tr><td>foo</td></tr>
7460 </table>
7461 </td></tr>
7462 </table>
7463 !! wikitext
7464 <table>
7465 <tr><td>
7466 {|
7467 |foo
7468 |}
7469 </td></tr>
7470 </table>
7471 !! end
7472
7473 !! test
7474 Serialize wikitext list items as HTML list items when embedded in a HTML list
7475 !! options
7476 parsoid=html2wt
7477 !! html
7478 <ul data-parsoid='{"stx": "html"}'>
7479 <li data-parsoid='{}'>a</li>
7480 <li>b</li>
7481 </ul>
7482 !! wikitext
7483 <ul>
7484 <li>a</li>
7485 <li>b</li>
7486 </ul>
7487 !! end
7488
7489 # SSS FIXME: Is this actually a good thing given the
7490 # odd nested list output that is generated by MW?
7491 # <ul><li>foo<ul>..</ul></li></ul> instead of
7492 # <ul><li>foo</li><ul>..</ul></ul>
7493 !! test
7494 Wikitext lists can be nested inside HTML lists
7495 !! options
7496 parsoid=html2wt
7497 !! html
7498 <ul data-parsoid='{"stx": "html"}'>
7499 <li data-parsoid='{"stx": "html"}'>a
7500 <ul><li>b</li></ul>
7501 </li>
7502 </ul>
7503
7504 <ul data-parsoid='{"stx": "html"}'>
7505 <li>x
7506 <ul><li>y</li></ul>
7507 </li>
7508 </ul>
7509 !! wikitext
7510 <ul>
7511 <li>a
7512 * b
7513 </li>
7514 </ul>
7515
7516 <ul>
7517 <li>x
7518 * y
7519 </li>
7520 </ul>
7521 !! end
7522
7523 ###
7524 ### Internal links
7525 ###
7526 !! test
7527 Plain link, capitalized
7528 !! wikitext
7529 [[Main Page]]
7530 !! html
7531 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7532 </p>
7533 !! end
7534
7535 !! test
7536 Plain link, uncapitalized
7537 !! wikitext
7538 [[main Page]]
7539 !! html
7540 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7541 </p>
7542 !! end
7543
7544 !! test
7545 Piped link
7546 !! wikitext
7547 [[Main Page|The Main Page]]
7548 !! html
7549 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7550 </p>
7551 !! end
7552
7553 !! test
7554 Piped link with comment in link text
7555 !! wikitext
7556 [[Main Page|The Main<!--front--> Page]]
7557 !! html
7558 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7559 </p>
7560 !! end
7561
7562 !! test
7563 Piped link with multiple pipe characters in link text
7564 !! wikitext
7565 [[Main Page||The|Main|Page|]]
7566 !! html/php
7567 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7568 </p>
7569 !! html/parsoid
7570 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7571 !! end
7572
7573 !! test
7574 Piped link with no link text
7575 !! wikitext
7576 [[Thomas Bek (bishop of St David's)|]]
7577 !! html/php
7578 <p>[[Thomas Bek (bishop of St David's)|]]
7579 </p>
7580 !! html/parsoid
7581 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7582 !! end
7583
7584 !! test
7585 Piped link with empty link text
7586 !! wikitext
7587 [[Main Page|<nowiki/>]] - empty nowiki
7588 [[Main Page| ]] - empty space
7589 [[Main Page|&nbsp;]] - empty non breaking space
7590 !! html/php
7591 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7592 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7593 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7594 </p>
7595 !! html/parsoid
7596 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7597 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7598 <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>
7599 !! end
7600
7601 !! test
7602 Broken link
7603 !! wikitext
7604 [[Zigzagzogzagzig]]
7605 !! html
7606 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7607 </p>
7608 !! end
7609
7610 !! test
7611 Broken link with fragment
7612 !! wikitext
7613 [[Zigzagzogzagzig#zug]]
7614 !! html
7615 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7616 </p>
7617 !! end
7618
7619 !! test
7620 Special page link with fragment
7621 !! wikitext
7622 [[Special:Version#anchor]]
7623 !! html
7624 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7625 </p>
7626 !! end
7627
7628 !! test
7629 Nonexistent special page link with fragment
7630 !! wikitext
7631 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7632 !! html
7633 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7634 </p>
7635 !! end
7636
7637 !! test
7638 Link with prefix
7639 !! wikitext
7640 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7641 !! html
7642 <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>
7643 </p>
7644 !! end
7645
7646 !! test
7647 Link with suffix
7648 !! wikitext
7649 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7650 !! html
7651 <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>!!!
7652 </p>
7653 !! end
7654
7655 !! article
7656 prefixed article
7657 !! text
7658 Some text
7659 !! endarticle
7660
7661 !! test
7662 T45661: Piped links with identical prefixes
7663 !! wikitext
7664 [[prefixed article|prefixed articles with spaces]]
7665
7666 [[prefixed article|prefixed articlesaoeu]]
7667
7668 [[Main Page|Main Page test]]
7669 !! html
7670 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7671 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7672 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7673 </p>
7674 !! end
7675
7676
7677 !! test
7678 Link with HTML entity in suffix / tail
7679 !! wikitext
7680 [[Main Page]]&quot;, [[Main Page]]&#97;
7681 !! html/php
7682 <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;
7683 </p>
7684 !! html/parsoid
7685 <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>
7686 !! end
7687
7688 !! test
7689 Link with 3 brackets
7690 !! wikitext
7691 [[[Main Page]]]
7692 Foo [[[Main Page]]]
7693 !! html
7694 <p>[[[Main Page]]]
7695 Foo [[[Main Page]]]
7696 </p>
7697 !! end
7698
7699 !! test
7700 Link with 4 brackets
7701 !! wikitext
7702 [[[[Main Page]]]]
7703 !! html
7704 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7705 </p>
7706 !! end
7707
7708 !! test
7709 Piped link with 3 brackets
7710 !! wikitext
7711 [[[main page|the main page]]]
7712 !! html
7713 <p>[[[main page|the main page]]]
7714 </p>
7715 !! end
7716
7717 !! test
7718 Piped link with extlink-like text
7719 !! wikitext
7720 [[Main Page|[bar]]]
7721 [[Main Page|This is a [bar]]]
7722 !! html/php
7723 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7724 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7725 </p>
7726 !! html/parsoid
7727 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7728 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7729 !! end
7730
7731 !! test
7732 Link with multiple pipes
7733 !! wikitext
7734 [[Main Page|The|Main|Page]]
7735 !! html
7736 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7737 </p>
7738 !! end
7739
7740 !! test
7741 Anchor containing a #. (T65430)
7742 !! wikitext
7743 [[Main Page#And#Link]]
7744 !! html/php
7745 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7746 </p>
7747 !! html/parsoid
7748 <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>
7749 !! end
7750
7751 !! test
7752 Link to namespaces
7753 !! wikitext
7754 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7755 !! html
7756 <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>
7757 </p>
7758 !! end
7759
7760 !! test
7761 Link with space in namespace
7762 !! wikitext
7763 [[User talk:Foo bar]]
7764 !! html
7765 <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>
7766 </p>
7767 !! end
7768
7769 !! article
7770 MemoryAlpha:AlphaTest
7771 !! text
7772 This is an article in the MemoryAlpha namespace
7773 (which shadows the memoryalpha interwiki link).
7774 !! endarticle
7775
7776 !! test
7777 Namespace takes precedence over interwiki link (T53680)
7778 !! wikitext
7779 [[MemoryAlpha:AlphaTest]]
7780 !! html
7781 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7782 </p>
7783 !! end
7784
7785 # The previous test doesn't work correctly in html2*, due to not recognizing the
7786 # link as an internal one. This one checks for the correct behavior.
7787 !! test
7788 Link to namespace preferred over interwiki with correct rel attribute
7789 !! options
7790 parsoid=html2wt,html2html
7791 !! html/parsoid
7792 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7793 !! wikitext
7794 [[MemoryAlpha:AlphaTest]]
7795 !! end
7796
7797 !! test
7798 Piped link to namespace
7799 !! wikitext
7800 [[Meta:Disclaimers|The disclaimers]]
7801 !! html
7802 <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>
7803 </p>
7804 !! end
7805
7806 !! test
7807 Link containing }
7808 !! wikitext
7809 [[Usually caused by a typo (oops}]]
7810 !! html
7811 <p>[[Usually caused by a typo (oops}]]
7812 </p>
7813 !! end
7814
7815 !! article
7816 7% Solution
7817 !! text
7818 Just a test of an article title containing a percent.
7819 !! endarticle
7820
7821 !! test
7822 Link containing % (not as a hex sequence)
7823 !! wikitext
7824 [[7% Solution]]
7825 [[7% Solution|7%25 Solution]]
7826 !! html/php
7827 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7828 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7829 </p>
7830 !! html/parsoid
7831 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7832 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7833 !! end
7834
7835 # note that the parsoid HTML is identical to the previous test output,
7836 # so the previous test ensures that the html2wt mode will generate the
7837 # "not as a hex sequence" wikitext.
7838 !! test
7839 Link containing % as a single hex sequence interpreted to char
7840 !! options
7841 parsoid=wt2wt,wt2html,html2html
7842 !! wikitext
7843 [[7%25 Solution]]
7844 [[7%25 Solution|7%25 Solution]]
7845 !! html/php
7846 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7847 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7848 </p>
7849 !! html/parsoid
7850 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7851 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7852 !!end
7853
7854 !! test
7855 Link containing % as a double hex sequence interpreted to hex sequence
7856 !! wikitext
7857 [[7%2525 Solution]]
7858 !! html
7859 <p>[[7%2525 Solution]]
7860 </p>
7861 !!end
7862
7863 ## Example for such a section: == < ==
7864 !! test
7865 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7866 !! wikitext
7867 [[%23%3c]][[%23%3e]]
7868 !! html/php
7869 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7870 </p>
7871 !! html/parsoid
7872 <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>
7873 !! end
7874
7875 !! test
7876 Link containing "<#" and ">#" as a hex sequences
7877 !! wikitext
7878 [[%3c%23]][[%3e%23]]
7879 !! html
7880 <p>[[%3c%23]][[%3e%23]]
7881 </p>
7882 !! end
7883
7884 !! test
7885 Link containing an equals sign
7886 !! wikitext
7887 [[Special:BookSources/isbn=4-00-026157-6]]
7888 !! html/php
7889 <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>
7890 </p>
7891 !! html/parsoid
7892 <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>
7893 !! end
7894
7895 !! article
7896 Foo~bar
7897 !! text
7898 Just a test of an article title containing a tilde.
7899 !! endarticle
7900
7901 # note that links containing signatures, like [[Foo~~~~]], are
7902 # massaged by the pre-save transform (PST) and so the tildes are never
7903 # seen by the parser.
7904 !! test
7905 Link containing a tilde
7906 !! wikitext
7907 [[Foo~bar]]
7908 !! html/php
7909 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7910 </p>
7911 !! html/parsoid
7912 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7913 !! end
7914
7915 !! test
7916 Link containing double-single-quotes '' (T6598)
7917 !! wikitext
7918 [[Lista d''e paise d''o munno]]
7919 !! html/php
7920 <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>
7921 </p>
7922 !! html/parsoid
7923 <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>
7924 !! end
7925
7926 !! test
7927 Link containing double quotes and spaces
7928 !! wikitext
7929 [[Cool "Gator"]]
7930 !! html/php
7931 <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>
7932 </p>
7933 !! html/parsoid
7934 <p><a rel="mw:WikiLink" href="./Cool_%22Gator%22" title='Cool "Gator"'>Cool "Gator"</a></p>
7935 !! end
7936
7937 !! test
7938 File containing double quotes and spaces
7939 !! wikitext
7940 [[File:Cool "Gator".png]]
7941 !! html/parsoid
7942 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","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>
7943 !! end
7944
7945 !! test
7946 Redirect containing double quotes and spaces
7947 !! wikitext
7948 #REDIRECT [[Cool "Gator"]]
7949 !! html/parsoid
7950 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
7951 !! end
7952
7953 !! test
7954 Link containing double-single-quotes '' in text (T6598 sanity check)
7955 !! wikitext
7956 Some [[Link|pretty ''italics'' and stuff]]!
7957 !! html/php
7958 <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>!
7959 </p>
7960 !! html/parsoid
7961 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7962 !! end
7963
7964 !! test
7965 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
7966 !! wikitext
7967 ''Some [[Link|pretty ''italics'' and stuff]]!''
7968 !! html
7969 <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>
7970 </p>
7971 !! end
7972
7973 !! test
7974 Link with double quotes in title part (literal) and alternate part (interpreted)
7975 !! wikitext
7976 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7977
7978 [[''Pentecoste'']]
7979
7980 [[''Pentecoste''|Pentecoste]]
7981
7982 [[''Pentecoste''|''Pentecoste'']]
7983 !! html/php
7984 <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>
7985 </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>
7986 </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>
7987 </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>
7988 </p>
7989 !! html/parsoid
7990 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","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>
7991 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7992 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7993 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7994 !! end
7995
7996 !! test
7997 Broken image links with HTML captions (T41700)
7998 !! wikitext
7999 [[File:Nonexistent|<script></script>]]
8000 [[File:Nonexistent|100x100px|<script></script>]]
8001 [[File:Nonexistent|&lt;]]
8002 [[File:Nonexistent|a<i>b</i>c]]
8003 !! html/php
8004 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8005 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8006 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
8007 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
8008 </p>
8009 !! html/parsoid
8010 <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":"apierror-filedoesnotexist","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>
8011 <span typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","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>
8012 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","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>
8013 <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":"apierror-filedoesnotexist","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>
8014 !! end
8015
8016 !! test
8017 Plain link to URL
8018 !! wikitext
8019 [[http://www.example.com]]
8020 !! html/php
8021 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8022 </p>
8023 !! html/parsoid
8024 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
8025 !! end
8026
8027 !! test
8028 Plain link to URL with link text
8029 !! wikitext
8030 [[http://www.example.com Link text]]
8031 !! html
8032 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8033 </p>
8034 !! end
8035
8036 !! test
8037 Plain link to protocol-relative URL
8038 !! wikitext
8039 [[//www.example.com]]
8040 !! html/php
8041 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8042 </p>
8043 !! html/parsoid
8044 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
8045 !! end
8046
8047 !! test
8048 Plain link to protocol-relative URL with link text
8049 !! wikitext
8050 [[//www.example.com Link text]]
8051 !! html
8052 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8053 </p>
8054 !! end
8055
8056 !! test
8057 Plain link to page with question mark in title
8058 !! wikitext
8059 [[A?b]]
8060
8061 [[A?b|Baz]]
8062 !! html
8063 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8064 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8065 </p>
8066 !! end
8067
8068
8069 # I'm fairly sure the expected result here is wrong.
8070 # We want these to be URL links, not pseudo-pages with URLs for titles....
8071 # However the current output is also pretty screwy.
8072 #
8073 # ----
8074 # I'm changing it to match the current output--it arguably makes more
8075 # sense in the light of the test above. Old expected result was:
8076 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8077 #</p>
8078 # But I think this test is bordering on "garbage in, garbage out" anyway.
8079 # -- wtm
8080 !! test
8081 Piped link to URL
8082 !! wikitext
8083 Piped link to URL: [[http://www.example.com|an example URL]]
8084 !! html/php
8085 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8086 </p>
8087 !! html/parsoid
8088 <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>
8089 !! end
8090
8091 !! test
8092 T2002: [[page|http://url/]] should link to page, not http://url/
8093 !! wikitext
8094 [[Main Page|http://url/]]
8095 !! html/php
8096 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8097 </p>
8098 !! html/parsoid
8099 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8100 !! end
8101
8102 # Parsoid does not mark self-links, by design.
8103 !! test
8104 T2337: Escaped self-links should be bold
8105 !! options
8106 title=[[Bug462]]
8107 !! wikitext
8108 [[Bu&#103;462]] [[Bug462]]
8109 !! html/php
8110 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8111 </p>
8112 !! html/php+tidy
8113 <p><a class="mw-selflink selflink">Bug462</a> <a class="mw-selflink selflink">Bug462</a></p>
8114 !! html/parsoid
8115 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8116 !! end
8117
8118 !! test
8119 Self-link to section should not be bold
8120 !! options
8121 title=[[Main Page]]
8122 !! wikitext
8123 [[Main Page#section]]
8124 !! html
8125 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8126 </p>
8127 !! end
8128
8129 !! article
8130 00
8131 !! text
8132 This is 00.
8133 !! endarticle
8134
8135 !!test
8136 Self-link to numeric title
8137 !!options
8138 title=[[0]]
8139 !! wikitext
8140 [[0]]
8141 !! html
8142 <p><a class="mw-selflink selflink">0</a>
8143 </p>
8144 !!end
8145
8146 !!test
8147 Link to numeric-equivalent title
8148 !!options
8149 title=[[0]]
8150 !! wikitext
8151 [[00]]
8152 !! html
8153 <p><a href="/wiki/00" title="00">00</a>
8154 </p>
8155 !!end
8156
8157 !! test
8158 <nowiki> inside a link
8159 !! wikitext
8160 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8161 !! html
8162 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8163 </p>
8164 !! end
8165
8166 !! test
8167 Non-breaking spaces in title
8168 !! wikitext
8169 [[&nbsp; Main &nbsp; Page &nbsp;]]
8170 !! html
8171 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8172 </p>
8173 !!end
8174
8175 !! test
8176 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8177 !! options
8178 language=ca
8179 !! wikitext
8180 '''[[Main Page]]'''
8181 !! html
8182 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8183 </p>
8184 !! end
8185
8186 !! test
8187 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8188 !! options
8189 language=ca
8190 !! wikitext
8191 ''[[Main Page]]''
8192 !! html
8193 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8194 </p>
8195 !! end
8196
8197 !! test
8198 Internal link with en linktrail: no apostrophes (T29473)
8199 !! options
8200 language=en
8201 !! wikitext
8202 [[Something]]'nice
8203 !! html
8204 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8205 </p>
8206 !! end
8207
8208 !! test
8209 Internal link with ca linktrail with apostrophes (T29473)
8210 !! options
8211 language=ca
8212 !! wikitext
8213 [[Something]]'nice
8214 !! html
8215 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8216 </p>
8217 !! end
8218
8219 !! test
8220 Internal link with kaa linktrail with apostrophes (T29473)
8221 !! options
8222 language=kaa
8223 !! wikitext
8224 [[Something]]'nice
8225 !! html
8226 <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>
8227 </p>
8228 !! end
8229
8230 !! test
8231 Link with multiple ":" in a subpage-supporting namespace (T65636)
8232 !! wikitext
8233 [[User:Foo/Test/63636:Bar|Test]]
8234 !! html/php
8235 <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>
8236 </p>
8237 !! html/parsoid
8238 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8239 !! end
8240
8241 ## Mainly a sanity check for Parsoid
8242 !! test
8243 Handle title parsing for subpages
8244 !! options
8245 title=[[/123123]]
8246 subpage
8247 !! wikitext
8248 123
8249 !! html/php
8250 <p>123
8251 </p>
8252 !! html/parsoid
8253 <p>123</p>
8254 !! end
8255
8256 !! article
8257 User:Test/123
8258 !! text
8259 test 123
8260 !! endarticle
8261
8262 !! test
8263 Link to a subpage from a namespace other than main
8264 !! options
8265 title=[[User:Test]]
8266 subpage
8267 !! wikitext
8268 [[/123]]
8269 !! html/php
8270 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8271 </p>
8272 !! html/parsoid
8273 <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>
8274 !! end
8275
8276 !! test
8277 Ensure that transclusion titles are not url-decoded
8278 !! options
8279 subpage title=[[Test]]
8280 parsoid=wt2html
8281 !! wikitext
8282 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8283 !! html/php
8284 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8285 </p>
8286 !! html/parsoid
8287 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8288 !! end
8289
8290 !! test
8291 Purely hash wikilink
8292 !! options
8293 title=[[User:Test/123]]
8294 subpage
8295 !! wikitext
8296 [[#a|b]]
8297 !! html/php
8298 <p><a href="#a">b</a>
8299 </p>
8300 !! html/parsoid
8301 <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>
8302 !! end
8303
8304 !! test
8305 Serialization of purely hash wikilink
8306 !! options
8307 title=[[User:Test/123]]
8308 subpage
8309 parsoid=html2wt
8310 !! html/parsoid
8311 <p><a href="#a">[[</a></p>
8312 !! wikitext
8313 [[#a|<nowiki>[[</nowiki>]]
8314 !! html/php
8315 <p><a href="#a">[[</a>
8316 </p>
8317 !! end
8318
8319 !! test
8320 1. Interaction of linktrail and template encapsulation
8321 !! wikitext
8322 {{echo|[[Foo]]}}l
8323 !! html/parsoid
8324 <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>
8325 !! end
8326
8327 !! test
8328 2. Interaction of linktrail and template encapsulation
8329 !! options
8330 parsoid
8331 !! wikitext
8332 {{echo|Some [[Fool]]}}s
8333 !! html
8334 <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>
8335 !! end
8336
8337 !! test
8338 3. Interaction of linktrail and template encapsulation
8339 !! options
8340 parsoid
8341 !! wikitext
8342 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8343 !! html
8344 <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>
8345 !! end
8346
8347 !! article
8348 Söfnuður
8349 !! text
8350 Test.
8351 !! endarticle
8352
8353 !! test
8354 Internal link with is link prefix
8355 !! options
8356 language=is
8357 !! wikitext
8358 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8359 !! html
8360 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8361 </p>
8362 !! end
8363
8364 !! article
8365 Mótmælendatrú
8366 !! text
8367 Test.
8368 !! endarticle
8369
8370 !! test
8371 Internal link with is link trail and link prefix
8372 !! options
8373 language=is
8374 !! wikitext
8375 [[mótmælendatrú|xxx]]ar
8376 [[mótmælendatrú]]ar
8377 mótmælenda[[söfnuður]]
8378 mótmælenda[[söfnuður|söfnuðir]]
8379 mótmælenda[[söfnuður|söfnuðir]]xxx
8380 !! html
8381 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8382 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8383 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8384 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8385 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8386 </p>
8387 !! end
8388
8389 !! test
8390 Parsoid link trail escaping
8391 !! options
8392 parsoid=html2wt,html2html
8393 !! html/parsoid
8394 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8395 !! wikitext
8396 [[apple]]<nowiki/>s
8397 !! end
8398
8399 !! test
8400 Parsoid link prefix escaping
8401 !! options
8402 language=is
8403 parsoid=html2wt,html2html
8404 !! html/parsoid
8405 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8406 !! wikitext
8407 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8408 !! end
8409
8410 !! test
8411 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8412 !! wikitext
8413 [[Foo| bar]]
8414
8415 [[Foo| ''bar'']]
8416
8417 [http://wp.org foo]
8418
8419 [http://wp.org ''foo'']
8420 !! html
8421 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8422 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8423 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8424 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8425 </p>
8426 !! end
8427
8428 !! test
8429 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8430 !! wikitext
8431 [[Foo|{{echo|a}} b {{echo|c}}]]
8432 !! html/parsoid
8433 <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>
8434 !! end
8435
8436 !! test
8437 Link with angle bracket after anchor
8438 !! wikitext
8439 [[Foo#<bar>]]
8440 !! html/php
8441 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8442 </p>
8443 !! html/parsoid
8444 <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>
8445 !! end
8446
8447 ###
8448 ### Interwiki links (see maintenance/interwiki.sql)
8449 ###
8450
8451 !! test
8452 Inline interwiki link
8453 !! options
8454 parsoid=wt2html,wt2wt,html2html
8455 !! wikitext
8456 [[MeatBall:SoftSecurity]]
8457 !! html/php
8458 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8459 </p>
8460 !! html/parsoid
8461 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8462 !! end
8463
8464 !! test
8465 Inline interwiki link with empty title (T4372)
8466 !! options
8467 parsoid=wt2html,wt2wt,html2html
8468 !! wikitext
8469 [[MeatBall:]]
8470 !! html/php
8471 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8472 </p>
8473 !! html/parsoid
8474 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8475 !! end
8476
8477 !! test
8478 Interwiki link encoding conversion (T3636)
8479 !! wikitext
8480 *[[Wikipedia:ro:Olteni&#0355;a]]
8481 *[[Wikipedia:ro:Olteni&#355;a]]
8482 !! html
8483 <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>
8484 <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>
8485
8486 !! html+tidy
8487 <ul>
8488 <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>
8489 <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>
8490 </ul>
8491 !! end
8492
8493 !! test
8494 Interwiki link with fragment (T4130)
8495 !! wikitext
8496 [[MeatBall:SoftSecurity#foo]]
8497 !! html
8498 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8499 </p>
8500 !! end
8501
8502 !! test
8503 Link scenarios with escaped fragments
8504 !! wikitext
8505 [[#Is this great?]]
8506 [[Foo#Is this great?]]
8507 [[meatball:Foo#Is this great?]]
8508 !! html/php
8509 <p><a href="#Is_this_great.3F">#Is this great?</a>
8510 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8511 <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>
8512 </p>
8513 !! html/parsoid
8514 <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>
8515 <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>
8516 <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>
8517 !! end
8518
8519 # Ideally the wikipedia: prefix here should be proto-relative too
8520 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8521 # define the 'en' prefix, and originally the test used 'wikipedia',
8522 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8523 # article.
8524 !! test
8525 Different interwiki prefixes mapping to the same URL
8526 !! wikitext
8527 [[:en:Foo]]
8528
8529 [[:en:Foo|Foo]]
8530
8531 [[wikipedia:Foo]]
8532
8533 [[:wikipedia:Foo|Foo]]
8534
8535 [[wikipedia:en:Foo]]
8536
8537 [[:wikipedia:en:Foo]]
8538
8539 [[ wikiPEdia :Foo]]
8540 !! html/parsoid
8541 <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>
8542
8543 <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>
8544
8545 <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>
8546
8547 <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>
8548
8549 <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>
8550
8551 <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>
8552
8553 <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>
8554 !! end
8555
8556 !! test
8557 Interwiki links that cannot be represented in wiki syntax
8558 !! wikitext
8559 [[meatball:ok]]
8560 [[meatball:ok#foo|ok with fragment]]
8561 [[meatball:ok_as_well?|ok ending with ? mark]]
8562 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8563 [http://de.wikipedia.org/wiki/#foo is just fragment]
8564
8565 !! html/php
8566 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8567 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8568 <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>
8569 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8570 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8571 </p>
8572 !! html/parsoid
8573 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8574 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8575 <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>
8576 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8577 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8578 !! end
8579
8580 !! test
8581 Interwiki links: trail
8582 !! wikitext
8583 [[wikipedia:Foo|Ba]]r
8584 !! html/php
8585 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8586 </p>
8587 !! html/parsoid
8588 <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>
8589 !! end
8590
8591 !! test
8592 Local interwiki link
8593 !! options
8594 parsoid=wt2html,wt2wt,html2html
8595 !! wikitext
8596 [[local:Template:Foo]]
8597 !! html/php
8598 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8599 </p>
8600 !! html/parsoid
8601 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8602 !! end
8603
8604 # Parsoid does not mark self-links, by design.
8605 !! test
8606 Local interwiki link: self-link to current page
8607 !! options
8608 title=[[Main Page]]
8609 parsoid=wt2html,wt2wt,html2html
8610 !! wikitext
8611 [[local:Main Page]]
8612 !! html/php
8613 <p><a class="mw-selflink selflink">local:Main Page</a>
8614 </p>
8615 !! html/parsoid
8616 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8617 !! end
8618
8619 !! test
8620 Local interwiki link: prefix only (T66167)
8621 !! options
8622 parsoid=wt2html,wt2wt,html2html
8623 !! wikitext
8624 [[local:]]
8625 !! html/php
8626 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8627 </p>
8628 !! html/parsoid
8629 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8630 !! end
8631
8632 !! test
8633 Local interwiki link: with additional interwiki prefix (T63357)
8634 !! options
8635 parsoid=wt2html,wt2wt,html2html
8636 !! wikitext
8637 [[local:meatball:Hello]]
8638 !! html/php
8639 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8640 </p>
8641 !! html/parsoid
8642 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8643 !! end
8644
8645 !! test
8646 Multiple local interwiki link prefixes
8647 !! wikitext
8648 [[local:local:local:local:mi:local:Foo]]
8649 !! options
8650 parsoid=wt2html,wt2wt,html2html
8651 !! html/php
8652 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8653 </p>
8654 !! html/parsoid
8655 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8656 !! end
8657
8658 ###
8659 ### Interlanguage links
8660 ### Language links (so that searching for '### language' matches..)
8661 ###
8662
8663 !! test
8664 Interlanguage link
8665 !! wikitext
8666 Blah blah blah
8667 [[zh:Chinese]]
8668 !! html/php
8669 <p>Blah blah blah
8670 </p>
8671 !! html/parsoid
8672 <p>Blah blah blah</p>
8673 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8674 !! end
8675
8676 ## parsoid html2wt will lose the space variations
8677 !! test
8678 Interlanguage link with spacing
8679 !! options
8680 parsoid=wt2html,wt2wt,html2html
8681 !! wikitext
8682 Blah blah blah
8683 [[ zh : Chinese ]]
8684 !! html/php
8685 <p>Blah blah blah
8686 </p>
8687 !! html/parsoid
8688 <p>Blah blah blah</p>
8689 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8690 !! end
8691
8692 !! test
8693 Double interlanguage link
8694 !! wikitext
8695 Blah blah blah
8696 [[es:Spanish]]
8697 [[zh:Chinese]]
8698 !! html/php
8699 <p>Blah blah blah
8700 </p>
8701 !! html/parsoid
8702 <p>Blah blah blah</p>
8703 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8704 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8705 !! end
8706
8707 ## parsoid html2wt will lose the space variations
8708 !! test
8709 Interlanguage link variations
8710 !! options
8711 parsoid=wt2html,wt2wt,html2html
8712 !! wikitext
8713 Blah blah blah
8714 [[ es :Spanish]]
8715 [[ ZH :Chinese]]
8716 [[es:Foo_bar]]
8717 !! html/php
8718 <p>Blah blah blah
8719 </p>
8720 !! html/parsoid
8721 <p>Blah blah blah</p>
8722 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8723 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8724 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8725 !! end
8726
8727 !! test
8728 Escaping of interlanguage links (T129218, T156308)
8729 !! wikitext
8730 Blah blah blah
8731 [[:es:Spanish]]
8732 [[ : zh : Chinese ]]
8733 !! html/php
8734 <p>Blah blah blah
8735 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8736 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8737 </p>
8738 !! html/parsoid
8739 <p>Blah blah blah
8740 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8741 <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8742 !! end
8743
8744 !! test
8745 Multiple colons escaping interlanguage links
8746 !! wikitext
8747 [[:es:Spanish]]
8748 [[::es:Spanish]]
8749 [[:::es:Spanish]]
8750 !! html/php
8751 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8752 [[::es:Spanish]]
8753 [[:::es:Spanish]]
8754 </p>
8755 !! end
8756
8757 ## parsoid html2wt will normalize the space to _
8758 !! test
8759 Space and question mark encoding in interlanguage links (T95473)
8760 !! options
8761 parsoid=wt2html,wt2wt,html2html
8762 !! wikitext
8763 Blah blah blah
8764 [[es:Foo bar?]]
8765 !! html/php
8766 <p>Blah blah blah
8767 </p>
8768 !! html/parsoid
8769 <p>Blah blah blah</p>
8770 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8771 !! end
8772
8773 !! test
8774 Interlanguage link, with prefix links
8775 !! options
8776 language=ln
8777 !! wikitext
8778 Blah blah blah
8779 [[zh:Chinese]]
8780 !! html/php
8781 <p>Blah blah blah
8782 </p>
8783 !! html/parsoid
8784 <p>Blah blah blah</p>
8785 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8786 !! end
8787
8788 !! test
8789 Double interlanguage link, with prefix links (T10897)
8790 !! options
8791 language=ln
8792 !! wikitext
8793 Blah blah blah
8794 [[es:Spanish]]
8795 [[zh:Chinese]]
8796 !! html/php
8797 <p>Blah blah blah
8798 </p>
8799 !! html/parsoid
8800 <p>Blah blah blah</p>
8801 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8802 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8803 !! end
8804
8805 !! test
8806 "Extra" interlanguage links (T34189 / gerrit 111390)
8807 !! wikitext
8808 Blah blah blah
8809 [[mul:Article]]
8810 !! html/php
8811 <p>Blah blah blah
8812 </p>
8813 !! html/parsoid
8814 <p>Blah blah blah</p>
8815 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8816 !! end
8817
8818 ## PHP parser tests script needs an update
8819 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8820 !! test
8821 Language links render as inline links if $wgInterwikiMagic=false
8822 !! options
8823 wgInterwikiMagic=false
8824 parsoid=wt2html,wt2wt,html2html
8825 !! wikitext
8826 Blah blah blah
8827 [[zh:Chinese]]
8828 !! html/parsoid
8829 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8830 !! end
8831
8832 ## PHP parser tests script needs an update
8833 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8834 !! test
8835 Language links render as inline links in the Talk namespace
8836 !! options
8837 title=Talk:Foo
8838 parsoid=wt2html,wt2wt,html2html
8839 !! wikitext
8840 Blah blah blah
8841 [[zh:Chinese]]
8842 !! html/parsoid
8843 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8844 !! end
8845
8846 !! test
8847 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8848 !! options
8849 language=ln
8850 !! wikitext
8851 [[WW&nbsp;II]]
8852 !! html
8853 <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>
8854 </p>
8855 !! end
8856
8857 !! test
8858 Parsoid T55221: Wikilinks should be properly entity-escaped
8859 !! options
8860 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8861 !! html/parsoid
8862 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8863 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8864 !! wikitext
8865 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8866
8867 He&amp;nbsp;llo He&amp;nbsp;llo
8868 !! html/php
8869 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8870 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8871 </p>
8872 !! end
8873
8874 # html2wt will fail because of title normalization without data-parsoid
8875 !! test
8876 Parsoid: handle constructor well
8877 !! options
8878 parsoid=wt2html,wt2wt
8879 !! wikitext
8880 [[constructor]]
8881
8882 [[constructor:foo]]
8883 !! html/php
8884 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8885 </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>
8886 </p>
8887 !! html/parsoid
8888 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8889
8890 <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>
8891 !! end
8892
8893 !! article
8894 ko:
8895 !! text
8896 Test.
8897 !! endarticle
8898
8899 # Note that `ko` isn't a known interlanguage prefix
8900 !! test
8901 Parsoid: recognize interlanguage links without a target page
8902 !! options
8903 ill
8904 !! wikitext
8905 [[es:]]
8906
8907 [[ko:]]
8908 !! html/php
8909 es:
8910 !! html/parsoid
8911 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8912
8913 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8914 !! end
8915
8916 # Note that `ko` isn't a known interwiki prefix
8917 !! test
8918 Parsoid: recognize interwiki links without a target page
8919 !! options
8920 parsoid=wt2html,wt2wt,html2html
8921 !! wikitext
8922 [[:es:]]
8923
8924 [[:ko:]]
8925 !! html/php
8926 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8927 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8928 </p>
8929 !! html/parsoid
8930 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8931 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8932 !! end
8933
8934 !! test
8935 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
8936 !! wikitext
8937 [[mi:Foo]]
8938 !! html/php
8939 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8940 </p>
8941 !! html/parsoid
8942 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8943 !! end
8944
8945 !! test
8946 Interlanguage link with preceding local interwiki link (T70085)
8947 !! options
8948 parsoid=wt2html,wt2wt,html2html
8949 !! wikitext
8950 Blah blah blah
8951 [[local:es:Spanish]]
8952 !! html/php
8953 <p>Blah blah blah
8954 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8955 </p>
8956 !! html/parsoid
8957 <p>Blah blah blah
8958 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8959 !! end
8960
8961 !! test
8962 Looks like an interlanguage link, but is actually a local interwiki
8963 !! options
8964 parsoid=wt2html,wt2wt,html2html
8965 !! wikitext
8966 Blah blah blah
8967 [[mi:Template:Foo]]
8968 !! html/php
8969 <p>Blah blah blah
8970 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8971 </p>
8972 !! html/parsoid
8973 <p>Blah blah blah
8974 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8975 !! end
8976
8977 ###
8978 ### Redirects, Parsoid-only
8979 ###
8980
8981 !! test
8982 1. Simple redirect to page
8983 !! wikitext
8984 #REDIRECT [[Main Page]]
8985 !! html/parsoid
8986 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8987 !! end
8988
8989 !! test
8990 2. Other redirect variants
8991 !! wikitext
8992 #REDIRECT [[Main_Page]]
8993 !! html/parsoid
8994 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8995 !! end
8996
8997 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8998 # This tests the Parsoid bail-out code.
8999 !! test
9000 3. Other redirect variants
9001 !! wikitext
9002 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9003 !! html/parsoid
9004 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
9005 !! end
9006
9007 !! test
9008 4. Redirect to a templated destination
9009 !! wikitext
9010 #REDIRECT [[{{echo|Foo}}bar]]
9011 !! html/parsoid
9012 <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"}]]}'/>
9013 !! end
9014
9015 !! test
9016 Empty redirect
9017 !! options
9018 parsoid=wt2html,wt2wt
9019 !! wikitext
9020 #REDIRECT [[]]
9021 !! html/parsoid
9022 <ol>
9023 <li>REDIRECT [[]]</li></ol>
9024 !! end
9025
9026 !! test
9027 Optional colon in #REDIRECT
9028 !! options
9029 # the colon is archaic syntax. we support it for wt2html, but we
9030 # don't care that it roundtrips back to the modern syntax.
9031 parsoid=wt2html,html2html
9032 !! wikitext
9033 #REDIRECT:[[Main Page]]
9034 !! html/parsoid
9035 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9036 !! end
9037
9038 !! test
9039 Whitespace in #REDIRECT with optional colon
9040 !! options
9041 # the colon and gratuitous whitespace is archaic syntax. we support
9042 # it for wt2html, but we don't care that it roundtrips back to the
9043 # modern syntax (without extra whitespace)
9044 parsoid=wt2html,html2html
9045 !! wikitext
9046
9047 #REDIRECT
9048 :
9049 [[Main Page]]
9050 !! html/parsoid
9051 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9052 !! end
9053
9054 !! test
9055 Piped link in #REDIRECT
9056 !! options
9057 # content after piped link is ignored. we support this syntax,
9058 # but don't care that the piped link is lost when we roundtrip this.
9059 parsoid=wt2html
9060 !! wikitext
9061 #REDIRECT [[Main Page|bar]]
9062 !! html/parsoid
9063 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9064 !! end
9065
9066 !! test
9067 Redirect to category (T104502)
9068 !! options
9069 parsoid=wt2html,wt2wt
9070 !! wikitext
9071 #REDIRECT [[Category:Foo]]
9072 !! html/parsoid
9073 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9074 !! end
9075
9076 !! test
9077 Redirect to category with URL encoding (T104502)
9078 !! options
9079 parsoid=wt2html
9080 !! wikitext
9081 #REDIRECT [[Category%3AFoo]]
9082 !! html/parsoid
9083 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9084 !! end
9085
9086 !! test
9087 Redirect to category page
9088 !! wikitext
9089 #REDIRECT [[:Category:Foo]]
9090 !! html/parsoid
9091 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9092 !! end
9093
9094 !! test
9095 Redirect to image page (1)
9096 !! wikitext
9097 #REDIRECT [[File:Wiki.png]]
9098 !! html/parsoid
9099 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9100 !! end
9101
9102 !! test
9103 Redirect to image page (2)
9104 !! wikitext
9105 #REDIRECT [[Image:Wiki.png]]
9106 !! html/parsoid
9107 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9108 !! end
9109
9110 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9111 # Next test confirms this.
9112 !! test
9113 Redirect to language (1) (T104918)
9114 !! options
9115 parsoid=wt2html,wt2wt,html2html
9116 !! wikitext
9117 #REDIRECT [[en:File:Wiki.png]]
9118 !! html/parsoid
9119 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9120 !! end
9121
9122 !! test
9123 Redirect to language (2) (T104918)
9124 !! wikitext
9125 #REDIRECT [[:en:File:Wiki.png]]
9126 !! html/parsoid
9127 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9128 !! end
9129
9130 !! test
9131 Redirect to interwiki (T104918)
9132 !! wikitext
9133 #REDIRECT [[meatball:File:Wiki.png]]
9134 !! html/parsoid
9135 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9136 !! end
9137
9138 !! test
9139 Non-English #REDIRECT
9140 !! options
9141 language=is
9142 !! wikitext
9143 #TILVÍSUN [[Main Page]]
9144 !! html/parsoid
9145 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9146 !! end
9147
9148 !! test
9149 Redirect syntax under text isn't considered a redirect
9150 !! wikitext
9151 some text
9152 #redirect [[Main Page]]
9153 !! html/parsoid
9154 <p>some text</p>
9155 <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>
9156 !! end
9157
9158 # FIXME: Should hoist the redirect to the top of the page and ensure there
9159 # is only one.
9160 !! test
9161 New redirect
9162 !! options
9163 parsoid=html2wt
9164 !! html/parsoid
9165 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9166 !! wikitext
9167 Foo
9168 #REDIRECT [[Foo]]
9169 !! end
9170
9171 ##
9172 ## XHTML tidiness
9173 ###
9174
9175 !! test
9176 <br> to <br />
9177 !! wikitext
9178 1<br>2<br />3
9179 !! html
9180 <p>1<br />2<br />3
9181 </p>
9182 !! end
9183
9184 !! test
9185 Broken br tag sanitization
9186 !! wikitext
9187 </br>
9188 !! html/php
9189 <p>&lt;/br&gt;
9190 </p>
9191 !! end
9192
9193 # TODO: Fix html2html mode (T53055)!
9194 !! test
9195 Parsoid: Broken br tag recognition
9196 !! options
9197 parsoid=wt2html
9198 !! wikitext
9199 </br>
9200
9201 <br/ >
9202 !! html+tidy
9203 <p><br /></p>
9204 <p><br /></p>
9205 !! end
9206
9207 !! test
9208 Incorrecly removing closing slashes from correctly formed XHTML
9209 !! wikitext
9210 <br style="clear:both;" />
9211 !! html
9212 <p><br style="clear:both;" />
9213 </p>
9214 !! end
9215
9216 !! test
9217 Failing to transform badly formed HTML into correct XHTML
9218 !! wikitext
9219 <br style="clear: left;">
9220 <br style="clear: right;">
9221 <br style="clear: both;">
9222 !! html
9223 <p><br style="clear: left;" />
9224 <br style="clear: right;" />
9225 <br style="clear: both;" />
9226 </p>
9227 !!end
9228
9229 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9230 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9231 !! test
9232 Handling html with a div self-closing tag
9233 !! wikitext
9234 <div title />
9235 <div title/>
9236 <div title/ >
9237 <div title=bar />
9238 <div title=bar/>
9239 <div title=bar/ >
9240 !! html/php
9241 <p>&lt;div title /&gt;
9242 &lt;div title/&gt;
9243 </p>
9244 <div>
9245 <p>&lt;div title=bar /&gt;
9246 &lt;div title=bar/&gt;
9247 </p>
9248 <div title="bar/"></div>
9249 </div>
9250
9251 !! html/parsoid
9252 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9253 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9254 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9255 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9256 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9257 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9258 !! end
9259
9260 !! test
9261 Handling html with a br self-closing tag
9262 !! wikitext
9263 <br title />
9264 <br title/>
9265 <br title/ >
9266 <br title=bar />
9267 <br title=bar/>
9268 <br title=bar/ >
9269 !! html/php
9270 <p><br title="" />
9271 <br title="" />
9272 <br />
9273 <br title="bar" />
9274 <br title="bar" />
9275 <br title="bar/" />
9276 </p>
9277 !! html/parsoid
9278 <p><br title="" />
9279 <br title="" />
9280 <br title="" />
9281 <br title="bar" />
9282 <br title="bar" />
9283 <br title="bar/" />
9284 </p>
9285 !! end
9286
9287 !! test
9288 Horizontal ruler (should it add that extra space?)
9289 !! wikitext
9290 <hr>
9291 <hr >
9292 foo <hr
9293 > bar
9294 !! html+tidy
9295 <hr />
9296 <hr />
9297 <p>foo</p>
9298 <hr />
9299 <p>bar</p>
9300 !! end
9301
9302 !! test
9303 Horizontal ruler -- 4+ dashes render hr
9304 !! wikitext
9305 ----
9306 !! html
9307 <hr />
9308
9309 !! end
9310
9311 !! test
9312 Horizontal ruler -- eats additional dashes on the same line
9313 !! wikitext
9314 ---------
9315 !! html
9316 <hr />
9317
9318 !! end
9319
9320 !! test
9321 Horizontal ruler -- does not collapse dashes on consecutive lines
9322 !! wikitext
9323 ----
9324 ----
9325 !! html
9326 <hr />
9327 <hr />
9328
9329 !! end
9330
9331 !! test
9332 Horizontal ruler -- <4 dashes render as plain text
9333 !! wikitext
9334 ---
9335 !! html
9336 <p>---
9337 </p>
9338 !! end
9339
9340 !! test
9341 Horizontal ruler -- Supports content following dashes on same line
9342 !! wikitext
9343 ---- Foo
9344 !! html
9345 <hr /> Foo
9346
9347 !! html+tidy
9348 <hr />
9349 <p>Foo</p>
9350 !! end
9351
9352 ###
9353 ### Block-level elements
9354 ###
9355 !! test
9356 Common list
9357 !! wikitext
9358 *Common list
9359 * item 2
9360 *item 3
9361 !! html
9362 <ul><li>Common list</li>
9363 <li> item 2</li>
9364 <li>item 3</li></ul>
9365
9366 !! end
9367
9368 !! test
9369 Numbered list
9370 !! wikitext
9371 #Numbered list
9372 #item 2
9373 # item 3
9374 !! html
9375 <ol><li>Numbered list</li>
9376 <li>item 2</li>
9377 <li> item 3</li></ol>
9378
9379 !! end
9380
9381 !! test
9382 Mixed list
9383 !! wikitext
9384 *Mixed list
9385 *# with numbers
9386 ** and bullets
9387 *# and numbers
9388 *bullets again
9389 **bullet level 2
9390 ***bullet level 3
9391 ***#Number on level 4
9392 **bullet level 2
9393 **#Number on level 3
9394 **#Number on level 3
9395 *#number level 2
9396 *Level 1
9397 *** Level 3
9398 #** Level 3, but ordered
9399 !! html
9400 <ul><li>Mixed list
9401 <ol><li> with numbers</li></ol>
9402 <ul><li> and bullets</li></ul>
9403 <ol><li> and numbers</li></ol></li>
9404 <li>bullets again
9405 <ul><li>bullet level 2
9406 <ul><li>bullet level 3
9407 <ol><li>Number on level 4</li></ol></li></ul></li>
9408 <li>bullet level 2
9409 <ol><li>Number on level 3</li>
9410 <li>Number on level 3</li></ol></li></ul>
9411 <ol><li>number level 2</li></ol></li>
9412 <li>Level 1
9413 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9414 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9415
9416 !! end
9417
9418 !! test
9419 1. Nested mixed wikitext and html list
9420 !! wikitext
9421 * hi
9422 * <ul><li>ho</li></ul>
9423 * hi
9424 ** ho
9425 !! html/php
9426 <ul><li> hi</li>
9427 <li> <ul><li>ho</li></ul></li>
9428 <li> hi
9429 <ul><li> ho</li></ul></li></ul>
9430
9431 !! html/parsoid
9432 <ul><li> hi</li>
9433 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9434 <li> hi
9435 <ul><li> ho</li></ul></li></ul>
9436 !! end
9437
9438 !! test
9439 2. Nested mixed wikitext and html list (incompatible)
9440 !! wikitext
9441 ; hi
9442 : {{echo|<li>ho</li>}}
9443 !! html/php
9444 <dl><dt> hi</dt>
9445 <dd> <li>ho</li></dd></dl>
9446
9447 !! html/parsoid
9448 <dl><dt> hi</dt>
9449 <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>
9450 !! end
9451
9452 !! test
9453 Nested lists 1
9454 !! wikitext
9455 *foo
9456 **bar
9457 !! html
9458 <ul><li>foo
9459 <ul><li>bar</li></ul></li></ul>
9460
9461 !! end
9462
9463 !! test
9464 Nested lists 2
9465 !! wikitext
9466 **foo
9467 *bar
9468 !! html
9469 <ul><li><ul><li>foo</li></ul></li>
9470 <li>bar</li></ul>
9471
9472 !! end
9473
9474 !! test
9475 Nested lists 3 (first element empty)
9476 !! wikitext
9477 *
9478 **bar
9479 !! html
9480 <ul><li>
9481 <ul><li>bar</li></ul></li></ul>
9482
9483 !! end
9484
9485 !! test
9486 Nested lists 4 (first element empty)
9487 !! wikitext
9488 **
9489 *bar
9490 !! html
9491 <ul><li><ul><li></li></ul></li>
9492 <li>bar</li></ul>
9493
9494 !! end
9495
9496 !! test
9497 Nested lists 5 (both elements empty)
9498 !! wikitext
9499 **
9500 *
9501 !! html
9502 <ul><li><ul><li></li></ul></li>
9503 <li></li></ul>
9504
9505 !! end
9506
9507 !! test
9508 Nested lists 6 (both elements empty)
9509 !! wikitext
9510 *
9511 **
9512 !! html
9513 <ul><li>
9514 <ul><li></li></ul></li></ul>
9515
9516 !! end
9517
9518 !! test
9519 Nested lists 7 (skip initial nesting levels)
9520 !! wikitext
9521 *** foo
9522 !! html
9523 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9524
9525 !! end
9526
9527 !! test
9528 Nested lists 8 (multiple nesting transitions)
9529 !! wikitext
9530 * foo
9531 *** bar
9532 ** baz
9533 * boo
9534 !! html
9535 <ul><li> foo
9536 <ul><li><ul><li> bar</li></ul></li>
9537 <li> baz</li></ul></li>
9538 <li> boo</li></ul>
9539
9540 !! end
9541
9542 !! test
9543 Nested lists 9 (extension interaction)
9544 !! options
9545 parsoid
9546 !! wikitext
9547 *<references />
9548 !! html/parsoid
9549 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9550 !! end
9551
9552 !! test
9553 1. Lists with start-of-line-transparent tokens before bullets: Comments
9554 !! wikitext
9555 *foo
9556 *<!--cmt-->bar
9557 <!--cmt-->*baz
9558 !! html
9559 <ul><li>foo</li>
9560 <li>bar</li>
9561 <li>baz</li></ul>
9562
9563 !! end
9564
9565 !! test
9566 2. Lists with start-of-line-transparent tokens before bullets: Template close
9567 !! wikitext
9568 *foo {{echo|bar
9569 }}*baz
9570 !! html
9571 <ul><li>foo bar</li>
9572 <li>baz</li></ul>
9573
9574 !! end
9575
9576 !! test
9577 List items are not parsed correctly following a <pre> block (T2785)
9578 !! wikitext
9579 * <pre>foo</pre>
9580 * <pre>bar</pre>
9581 * zar
9582 !! html/php
9583 <ul><li> <pre>foo</pre></li>
9584 <li> <pre>bar</pre></li>
9585 <li> zar</li></ul>
9586
9587 !! html/parsoid
9588 <ul><li> <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9589 <li> <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9590 <li> zar</li></ul>
9591 !! end
9592
9593 !! test
9594 List items from template
9595 !! wikitext
9596
9597 {{inner list}}
9598 * item 2
9599
9600 * item 0
9601 {{inner list}}
9602 * item 2
9603
9604 * item 0
9605 * notSOL{{inner list}}
9606 * item 2
9607 !! html
9608 <ul><li> item 1</li>
9609 <li> item 2</li></ul>
9610 <ul><li> item 0</li>
9611 <li> item 1</li>
9612 <li> item 2</li></ul>
9613 <ul><li> item 0</li>
9614 <li> notSOL</li>
9615 <li> item 1</li>
9616 <li> item 2</li></ul>
9617
9618 !! end
9619
9620 !! test
9621 List interrupted by empty line or heading
9622 !! wikitext
9623 * foo
9624
9625 ** bar
9626 == A heading ==
9627 * Another list item
9628 !! html
9629 <ul><li> foo</li></ul>
9630 <ul><li><ul><li> bar</li></ul></li></ul>
9631 <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>
9632 <ul><li> Another list item</li></ul>
9633
9634 !!end
9635
9636 !!test
9637 Multiple list tags generated by templates
9638 !! wikitext
9639 {{echo|<li>}}a
9640 {{echo|<li>}}b
9641 {{echo|<li>}}c
9642 !! html
9643 <li>a
9644 <li>b
9645 <li>c</li>
9646 </li>
9647 </li>
9648
9649 !! html+tidy
9650 <ul>
9651 <li>a</li>
9652 <li>b</li>
9653 <li>c</li>
9654 </ul>
9655 !!end
9656
9657 !!test
9658 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9659 !! wikitext
9660 *a
9661 <!--This line will NOT split the list-->
9662 *b
9663 <!--This line will NOT split the list either-->
9664 *c
9665 <!--foo--> <!----> <!--This line NOT split the list either-->
9666 *d
9667 !! html
9668 <ul><li>a</li>
9669 <li>b</li>
9670 <li>c</li>
9671 <li>d</li></ul>
9672
9673 !!end
9674
9675 !!test
9676 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9677 !! wikitext
9678 *a
9679 <!--This line will NOT split the list-->
9680 *b
9681 <!--This line will NOT split the list either-->
9682 *c
9683 <!--foo--> <!----> <!--This line NOT split the list
9684 either-->
9685 *d
9686 !! html
9687 <ul><li>a</li>
9688 <li>b</li>
9689 <li>c</li>
9690 <li>d</li></ul>
9691
9692 !!end
9693
9694 !!test
9695 Test the li-hack
9696 (The PHP parser relies on Tidy for the hack)
9697 !!options
9698 parsoid=wt2html,wt2wt
9699 !! wikitext
9700 * foo
9701 * <li>li-hack
9702 * {{echo|<li>templated li-hack}}
9703 * <!--foo--> <li> unsupported li-hack with preceding comments
9704
9705 <ul>
9706 <li><li>not a li-hack
9707 </li>
9708 </ul>
9709 !! html+tidy
9710 <ul>
9711 <li>foo</li>
9712 <li>li-hack</li>
9713 <li>templated li-hack</li>
9714 <li>unsupported li-hack with preceding comments</li>
9715 </ul>
9716 <ul>
9717 <li>not a li-hack</li>
9718 </ul>
9719 !!end
9720
9721 !! test
9722 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9723 !! options
9724 parsoid
9725 !! wikitext
9726 # foo
9727 ## bar
9728 * foo
9729 ** bar
9730 : foo
9731 :: bar
9732 !! html
9733 <ol>
9734 <li> foo<ol>
9735 <li> bar</li>
9736 </ol></li>
9737 </ol><ul>
9738 <li> foo<ul>
9739 <li> bar</li>
9740 </ul></li>
9741 </ul><dl>
9742 <dd> foo<dl>
9743 <dd> bar</dd>
9744 </dl></dd>
9745 </dl>
9746 !! end
9747
9748 !! test
9749 Parsoid: Test of whitespace serialization with Templated bullets
9750 !! options
9751 parsoid
9752 !! wikitext
9753 * {{bullet}}
9754 !! html
9755 <ul>
9756 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9757 </ul>
9758 !! end
9759
9760 # ------------------------------------------------------------------------
9761 # The next set of tests are about Parsoid's ability to handle badly nested
9762 # tags (parse, minimize scope of fixup, and roundtrip back)
9763 # ------------------------------------------------------------------------
9764
9765 !! test
9766 Unbalanced closing block tags break a list
9767 (php parser relies on Tidy to fix up)
9768 !! wikitext
9769 <div>
9770 *a</div><div>
9771 *b</div>
9772 !! html+tidy
9773 <div>
9774 <ul>
9775 <li>a</li>
9776 </ul>
9777 </div>
9778 <div>
9779 <ul>
9780 <li>b</li>
9781 </ul>
9782 </div>
9783 !! end
9784
9785 # Parsoid fails this test, but it might be tricky to support properly.
9786 # See T70395.
9787 !! test
9788 Unbalanced closing non-block tags don't break a list
9789 (php parser relies on Tidy to fix up)
9790 !! wikitext
9791 <span>
9792 *a</span><span>
9793 *b</span>
9794 !! html/php+tidy
9795 <ul>
9796 <li><span>a</span></li>
9797 <li><span>b</span></li>
9798 </ul>
9799 !! html/parsoid
9800 <span>
9801 <ul>
9802 <li>a<span></span>
9803 </li>
9804 <li>b
9805 </li>
9806 </ul>
9807 </span>
9808 !! end
9809
9810 !! test
9811 Unclosed formatting tags that straddle lists are closed and reopened
9812 (php parser relies on Tidy to fix up)
9813 !! options
9814 parsoid=wt2html,wt2wt,html2html
9815 !! wikitext
9816 # <s> a
9817 # b </s>
9818 !! html/php+tidy
9819 <ol>
9820 <li><s>a</s></li>
9821 <li><s>b</s></li>
9822 </ol>
9823 !! html/parsoid
9824 <ol><li> <s> a</s></li>
9825 <li><s> b </s></li></ol>
9826 !! end
9827
9828 # See T70395.
9829 !!test
9830 1. List embedded in a formatting tag
9831 !! wikitext
9832 <small>
9833 * foo
9834 </small>
9835 !! html/php+tidy
9836 <ul>
9837 <li><small>foo</small></li>
9838 </ul>
9839 !! html/parsoid
9840 <small>
9841 <ul>
9842 <li> foo</li>
9843 </ul>
9844 </small>
9845 !!end
9846
9847 ## Ugly Parsoid output here
9848 ## Not sure what the right output is.
9849 !!test
9850 2. List embedded in a formatting tag
9851 !! wikitext
9852 <small>
9853 *a
9854 *b</small>
9855 !! html/php+tidy
9856 <ul>
9857 <li><small>a</small></li>
9858 <li><small>b</small></li>
9859 </ul>
9860 !! html/parsoid
9861 <small></small>
9862 <ul><small>
9863 <li>a</li>
9864 </small>
9865 <li><small>b</small></li>
9866 </ul>
9867 !!end
9868
9869 # Ugly Parsoid and PHP parser output here
9870 # Not sure if we want to make this a test!
9871 #
9872 ## !!test
9873 ## 3. Unclosed formatting tags in list elements
9874 ## !! wikitext
9875 ## *<small>a
9876 ## *<small>b
9877 ## !! html/php+tidy
9878 ## <ul>
9879 ## <li><small>a</small></li>
9880 ## <li><small><small>b</small></small></li>
9881 ## </ul>
9882 ## !! html/parsoid
9883 ## <ul>
9884 ## <li><small>a</small></li>
9885 ## <small>
9886 ## <li><small>b</small></li>
9887 ## </small></ul>
9888 ## !!end
9889
9890 # This is a bug in the PHP parser + tidy combination.
9891 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9892 # and then fostered out of the table by tidy.)
9893 # We believe the Parsoid output to be correct.
9894 !! test
9895 Table with missing opening <tr> tag
9896 !! options
9897 parsoid=wt2html,wt2wt
9898 !! wikitext
9899 <table>
9900 <td>foo</td>
9901 </tr>
9902 </table>
9903 !! html+tidy
9904 <table>
9905 <tr>
9906 <td>foo</td>
9907 </tr>
9908 </table>
9909 !! end
9910
9911 ###
9912 ### Magic Words
9913 ###
9914
9915 # Note that the current date is hard-coded as
9916 # 1970-01-01T00:02:03Z (a Thursday)
9917 # when running parser tests. The timezone is also fixed to GMT, so
9918 # local date will be identical to current date.
9919
9920 !! test
9921 Magic Word: {{CURRENTDAY}}
9922 !! wikitext
9923 {{CURRENTDAY}}
9924 !! html
9925 <p>1
9926 </p>
9927 !! end
9928
9929 !! test
9930 Magic Word: {{CURRENTDAY2}}
9931 !! wikitext
9932 {{CURRENTDAY2}}
9933 !! html
9934 <p>01
9935 </p>
9936 !! end
9937
9938 !! test
9939 Magic Word: {{CURRENTDAYNAME}}
9940 !! wikitext
9941 {{CURRENTDAYNAME}}
9942 !! html
9943 <p>Thursday
9944 </p>
9945 !! end
9946
9947 !! test
9948 Magic Word: {{CURRENTDOW}}
9949 !! wikitext
9950 {{CURRENTDOW}}
9951 !! html
9952 <p>4
9953 </p>
9954 !! end
9955
9956 !! test
9957 Magic Word: {{CURRENTMONTH}}
9958 !! wikitext
9959 {{CURRENTMONTH}}
9960 !! html
9961 <p>01
9962 </p>
9963 !! end
9964
9965 !! test
9966 Magic Word: {{CURRENTMONTH1}}
9967 !! wikitext
9968 {{CURRENTMONTH1}}
9969 !! html
9970 <p>1
9971 </p>
9972 !! end
9973
9974 !! test
9975 Magic Word: {{CURRENTMONTHABBREV}}
9976 !! wikitext
9977 {{CURRENTMONTHABBREV}}
9978 !! html
9979 <p>Jan
9980 </p>
9981 !! end
9982
9983 !! test
9984 Magic Word: {{CURRENTMONTHNAME}}
9985 !! wikitext
9986 {{CURRENTMONTHNAME}}
9987 !! html
9988 <p>January
9989 </p>
9990 !! end
9991
9992 !! test
9993 Magic Word: {{CURRENTMONTHNAMEGEN}}
9994 !! wikitext
9995 {{CURRENTMONTHNAMEGEN}}
9996 !! html
9997 <p>January
9998 </p>
9999 !! end
10000
10001 !! test
10002 Magic Word: {{CURRENTTIME}}
10003 !! wikitext
10004 {{CURRENTTIME}}
10005 !! html
10006 <p>00:02
10007 </p>
10008 !! end
10009
10010 !! test
10011 Magic Word: {{CURRENTHOUR}}
10012 !! wikitext
10013 {{CURRENTHOUR}}
10014 !! html
10015 <p>00
10016 </p>
10017 !! end
10018
10019 !! test
10020 Magic Word: {{CURRENTWEEK}} (T6594)
10021 !! wikitext
10022 {{CURRENTWEEK}}
10023 !! html
10024 <p>1
10025 </p>
10026 !! end
10027
10028 !! test
10029 Magic Word: {{CURRENTYEAR}}
10030 !! wikitext
10031 {{CURRENTYEAR}}
10032 !! html
10033 <p>1970
10034 </p>
10035 !! end
10036
10037 !! test
10038 Magic Word: {{CURRENTTIMESTAMP}}
10039 !! wikitext
10040 {{CURRENTTIMESTAMP}}
10041 !! html
10042 <p>19700101000203
10043 </p>
10044 !! end
10045
10046 !! test
10047 Magic Words LOCAL (UTC)
10048 !! wikitext
10049 * {{LOCALMONTH}}
10050 * {{LOCALMONTH1}}
10051 * {{LOCALMONTHNAME}}
10052 * {{LOCALMONTHNAMEGEN}}
10053 * {{LOCALMONTHABBREV}}
10054 * {{LOCALDAY}}
10055 * {{LOCALDAY2}}
10056 * {{LOCALDAYNAME}}
10057 * {{LOCALYEAR}}
10058 * {{LOCALTIME}}
10059 * {{LOCALHOUR}}
10060 * {{LOCALWEEK}}
10061 * {{LOCALDOW}}
10062 * {{LOCALTIMESTAMP}}
10063 !! html
10064 <ul><li> 01</li>
10065 <li> 1</li>
10066 <li> January</li>
10067 <li> January</li>
10068 <li> Jan</li>
10069 <li> 1</li>
10070 <li> 01</li>
10071 <li> Thursday</li>
10072 <li> 1970</li>
10073 <li> 00:02</li>
10074 <li> 00</li>
10075 <li> 1</li>
10076 <li> 4</li>
10077 <li> 19700101000203</li></ul>
10078
10079 !! end
10080
10081 !! test
10082 Magic Word: {{FULLPAGENAME}}
10083 !! options
10084 title=[[User:Ævar Arnfjörð Bjarmason]]
10085 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10086 !! wikitext
10087 {{FULLPAGENAME}}
10088 !! html/*
10089 <p>User:Ævar Arnfjörð Bjarmason
10090 </p>
10091 !! end
10092
10093 !! test
10094 Magic Word: {{FULLPAGENAMEE}}
10095 !! options
10096 title=[[User:Ævar Arnfjörð Bjarmason]]
10097 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10098 !! wikitext
10099 {{FULLPAGENAMEE}}
10100 !! html/*
10101 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10102 </p>
10103 !! end
10104
10105 !! test
10106 Magic Word: {{TALKSPACE}}
10107 !! options
10108 title=[[User:Ævar Arnfjörð Bjarmason]]
10109 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10110 !! wikitext
10111 {{TALKSPACE}}
10112 !! html/*
10113 <p>User talk
10114 </p>
10115 !! end
10116
10117 !! test
10118 Magic Word: {{TALKSPACE}}, same namespace
10119 !! options
10120 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10121 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10122 !! wikitext
10123 {{TALKSPACE}}
10124 !! html/*
10125 <p>User talk
10126 </p>
10127 !! end
10128
10129 !! test
10130 Magic Word: {{TALKSPACE}}, main namespace
10131 !! options
10132 title=[[Parser Test]]
10133 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10134 !! wikitext
10135 {{TALKSPACE}}
10136 !! html/*
10137 <p>Talk
10138 </p>
10139 !! end
10140
10141 !! test
10142 Magic Word: {{TALKSPACEE}}
10143 !! options
10144 title=[[User:Ævar Arnfjörð Bjarmason]]
10145 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10146 !! wikitext
10147 {{TALKSPACEE}}
10148 !! html/*
10149 <p>User_talk
10150 </p>
10151 !! end
10152
10153 !! test
10154 Magic Word: {{SUBJECTSPACE}}
10155 !! options
10156 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10157 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10158 !! wikitext
10159 {{SUBJECTSPACE}}
10160 !! html/*
10161 <p>User
10162 </p>
10163 !! end
10164
10165 !! test
10166 Magic Word: {{SUBJECTSPACE}}, same namespace
10167 !! options
10168 title=[[User:Ævar Arnfjörð Bjarmason]]
10169 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10170 !! wikitext
10171 {{SUBJECTSPACE}}
10172 !! html/*
10173 <p>User
10174 </p>
10175 !! end
10176
10177 !! test
10178 Magic Word: {{SUBJECTSPACE}}, main namespace
10179 !! options
10180 title=[[Parser Test]]
10181 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10182 !! wikitext
10183 {{SUBJECTSPACE}}
10184 !! html/*
10185
10186 !! end
10187
10188 !! test
10189 Magic Word: {{SUBJECTSPACEE}}
10190 !! options
10191 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10192 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10193 !! wikitext
10194 {{SUBJECTSPACEE}}
10195 !! html/*
10196 <p>User
10197 </p>
10198 !! end
10199
10200 !! test
10201 Magic Word: {{NAMESPACE}}
10202 !! options
10203 title=[[User:Ævar Arnfjörð Bjarmason]]
10204 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10205 !! wikitext
10206 {{NAMESPACE}}
10207 !! html/*
10208 <p>User
10209 </p>
10210 !! end
10211
10212 !! test
10213 Magic Word: {{NAMESPACEE}}
10214 !! options
10215 title=[[User:Ævar Arnfjörð Bjarmason]]
10216 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10217 !! wikitext
10218 {{NAMESPACEE}}
10219 !! html/*
10220 <p>User
10221 </p>
10222 !! end
10223
10224 !! test
10225 Magic Word: {{NAMESPACENUMBER}}
10226 !! options
10227 title=[[User:Ævar Arnfjörð Bjarmason]]
10228 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10229 !! wikitext
10230 {{NAMESPACENUMBER}}
10231 !! html/*
10232 <p>2
10233 </p>
10234 !! end
10235
10236 !! test
10237 Magic Word: {{SUBPAGENAME}}
10238 !! options
10239 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10240 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10241 !! wikitext
10242 {{SUBPAGENAME}}
10243 !! html/*
10244 <p>sub ö
10245 </p>
10246 !! end
10247
10248 !! test
10249 Magic Word: {{SUBPAGENAMEE}}
10250 !! options
10251 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10252 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10253 !! wikitext
10254 {{SUBPAGENAMEE}}
10255 !! html/*
10256 <p>sub_%C3%B6
10257 </p>
10258 !! end
10259
10260 !! test
10261 Magic Word: {{ROOTPAGENAME}}
10262 !! options
10263 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10264 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10265 !! wikitext
10266 {{ROOTPAGENAME}}
10267 !! html/*
10268 <p>Ævar Arnfjörð Bjarmason
10269 </p>
10270 !! end
10271
10272 !! test
10273 Magic Word: {{ROOTPAGENAMEE}}
10274 !! options
10275 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10276 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10277 !! wikitext
10278 {{ROOTPAGENAMEE}}
10279 !! html/*
10280 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10281 </p>
10282 !! end
10283
10284 !! test
10285 Magic Word: {{BASEPAGENAME}}
10286 !! options
10287 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10288 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10289 !! wikitext
10290 {{BASEPAGENAME}}
10291 !! html/*
10292 <p>Ævar Arnfjörð Bjarmason
10293 </p>
10294 !! end
10295
10296 !! test
10297 Magic Word: {{BASEPAGENAMEE}}
10298 !! options
10299 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10300 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10301 !! wikitext
10302 {{BASEPAGENAMEE}}
10303 !! html/*
10304 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10305 </p>
10306 !! end
10307
10308 !! test
10309 Magic Word: {{TALKPAGENAME}}
10310 !! options
10311 title=[[User:Ævar Arnfjörð Bjarmason]]
10312 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10313 !! wikitext
10314 {{TALKPAGENAME}}
10315 !! html/*
10316 <p>User talk:Ævar Arnfjörð Bjarmason
10317 </p>
10318 !! end
10319
10320 !! test
10321 Magic Word: {{TALKPAGENAMEE}}
10322 !! options
10323 title=[[User:Ævar Arnfjörð Bjarmason]]
10324 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10325 !! wikitext
10326 {{TALKPAGENAMEE}}
10327 !! html/*
10328 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10329 </p>
10330 !! end
10331
10332 !! test
10333 Magic Word: {{SUBJECTPAGENAME}}
10334 !! options
10335 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10336 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10337 !! wikitext
10338 {{SUBJECTPAGENAME}}
10339 !! html/*
10340 <p>User:Ævar Arnfjörð Bjarmason
10341 </p>
10342 !! end
10343
10344 !! test
10345 Magic Word: {{SUBJECTPAGENAMEE}}
10346 !! options
10347 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10348 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10349 !! wikitext
10350 {{SUBJECTPAGENAMEE}}
10351 !! html/*
10352 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10353 </p>
10354 !! end
10355
10356 !! test
10357 Magic Word: {{NUMBEROFFILES}}
10358 !! options
10359 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10360 !! wikitext
10361 {{NUMBEROFFILES}}
10362 !! html/*
10363 <p>7
10364 </p>
10365 !! end
10366
10367 !! test
10368 Magic Word: {{PAGENAME}}
10369 !! options
10370 title=[[User:Ævar Arnfjörð Bjarmason]]
10371 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10372 !! wikitext
10373 {{PAGENAME}}
10374 !! html/*
10375 <p>Ævar Arnfjörð Bjarmason
10376 </p>
10377 !! end
10378
10379 !! test
10380 Magic Word: {{PAGENAME}} with metacharacters
10381 !! options
10382 title=[['foo & bar = baz']]
10383 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10384 !! wikitext
10385 ''{{PAGENAME}}''
10386 !! html/php
10387 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10388 </p>
10389 !! html+tidy
10390 <p><i>'foo &amp; bar = baz'</i></p>
10391 !! end
10392
10393 !! test
10394 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10395 !! options
10396 title=[[*RFC 1234 http://example.com/]]
10397 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10398 !! wikitext
10399 {{PAGENAME}}
10400 !! html/php
10401 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10402 </p>
10403 !! html+tidy
10404 <p>*RFC 1234 http://example.com/</p>
10405 !! end
10406
10407 !! test
10408 Magic Word: {{PAGENAMEE}}
10409 !! options
10410 title=[[User:Ævar Arnfjörð Bjarmason]]
10411 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10412 !! wikitext
10413 {{PAGENAMEE}}
10414 !! html/*
10415 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10416 </p>
10417 !! end
10418
10419 !! test
10420 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10421 !! options
10422 title=[[*RFC 1234 http://example.com/]]
10423 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10424 !! wikitext
10425 {{PAGENAMEE}}
10426 !! html/php
10427 <p>&#42;RFC_1234_http&#58;//example.com/
10428 </p>
10429 !! html+tidy
10430 <p>*RFC_1234_http://example.com/</p>
10431 !! end
10432
10433 !! test
10434 Magic Word: {{REVISIONID}}
10435 !! options
10436 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10437 showflags
10438 !! wikitext
10439 {{REVISIONID}}
10440 !! html/*
10441 <p>1337
10442 </p>
10443 flags=vary-revision-id
10444 !! end
10445
10446 !! test
10447 Magic Word: {{SCRIPTPATH}}
10448 !! options
10449 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10450 !! wikitext
10451 {{SCRIPTPATH}}
10452 !! html/*
10453
10454 !! end
10455
10456 !! test
10457 Magic Word: {{STYLEPATH}}
10458 !! options
10459 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10460 !! wikitext
10461 {{STYLEPATH}}
10462 !! html/*
10463 <p>/skins
10464 </p>
10465 !! end
10466
10467 !! test
10468 Magic Word: {{SERVER}}
10469 !! options
10470 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10471 !! wikitext
10472 {{SERVER}}
10473 !! html/*
10474 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10475 </p>
10476 !! end
10477
10478 !! test
10479 Magic Word: {{SERVERNAME}}
10480 !! options
10481 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10482 !! wikitext
10483 {{SERVERNAME}}
10484 !! html/*
10485 <p>example.org
10486 </p>
10487 !! end
10488
10489 !! test
10490 Magic Word: {{SITENAME}}
10491 !! options
10492 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10493 !! wikitext
10494 {{SITENAME}}
10495 !! html/*
10496 <p>MediaWiki
10497 </p>
10498 !! end
10499
10500 !! test
10501 Magic Word: {{PAGELANGUAGE}}
10502 !! options
10503 language=fr
10504 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10505 !! wikitext
10506 {{PAGELANGUAGE}}
10507 !! html/*
10508 <p>fr
10509 </p>
10510 !! end
10511
10512 !! test
10513 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10514 !! options
10515 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10516 !! wikitext
10517 {{PAGELANGUAGE}}
10518 !! html/*
10519 <p>en
10520 </p>
10521 !! end
10522
10523 !! test
10524 Case-sensitive magic words, when cased differently, should just be template transclusions
10525 !! wikitext
10526 {{CurrentMonth}}
10527 {{currentday}}
10528 {{cURreNTweEK}}
10529 {{currentHour}}
10530 !! html
10531 <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>
10532 <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>
10533 <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>
10534 <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>
10535 </p>
10536 !! end
10537
10538 !! test
10539 Case-insensitive magic words should still work with weird casing.
10540 !! wikitext
10541 {{sErVeRNaMe}}
10542 {{LCFirst:AOEU}}
10543 {{ucFIRST:aoeu}}
10544 {{SERver}}
10545 !! html
10546 <p>example.org
10547 aOEU
10548 Aoeu
10549 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10550 </p>
10551 !! end
10552
10553 # From plwiki:PLOS_ONE
10554 !! test
10555 Parsoid: Page property magic word with magic word contents
10556 !! wikitext
10557 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10558 !! html/parsoid
10559 <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":"DISPLAYTITLE:&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
10560 !! end
10561
10562 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10563 # But, this is a limitation of our representation and is documented in
10564 # TemplateHandler.js in processSpecialMagicWord
10565 !! test
10566 Parsoid: Template-generated DISPLAYTITLE
10567 !! wikitext
10568 {{{{echo|DISPLAYTITLE}}:Foo}}
10569 !! options
10570 showtitle
10571 !! config
10572 wgAllowDisplayTitle=true
10573 wgRestrictDisplayTitle=false
10574 !! html/php
10575 Foo
10576
10577 !! html/parsoid
10578 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:ExpandedAttrs" data-parsoid='{"pi":[[]]}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,23,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"DISPLAYTITLE\"}},\"i\":0}}]}&#39;>DISPLAYTITLE&lt;/span>:Foo"}]]}'/>
10579 !! end
10580
10581 !! test
10582 Namespace 1 {{ns:1}}
10583 !! wikitext
10584 {{ns:1}}
10585 !! html
10586 <p>Talk
10587 </p>
10588 !! end
10589
10590 !! test
10591 Namespace 1 {{ns:01}}
10592 !! wikitext
10593 {{ns:01}}
10594 !! html
10595 <p>Talk
10596 </p>
10597 !! end
10598
10599 !! test
10600 Namespace 0 {{ns:0}} (T6783)
10601 !! wikitext
10602 {{ns:0}}
10603 !! html
10604
10605 !! end
10606
10607 !! test
10608 Namespace 0 {{ns:00}} (T6783)
10609 !! wikitext
10610 {{ns:00}}
10611 !! html
10612
10613 !! end
10614
10615 !! test
10616 Namespace -1 {{ns:-1}}
10617 !! wikitext
10618 {{ns:-1}}
10619 !! html
10620 <p>Special
10621 </p>
10622 !! end
10623
10624 !! test
10625 Namespace User {{ns:User}}
10626 !! wikitext
10627 {{ns:User}}
10628 !! html
10629 <p>User
10630 </p>
10631 !! end
10632
10633 !! test
10634 Namespace User talk {{ns:User_talk}}
10635 !! wikitext
10636 {{ns:User_talk}}
10637 !! html
10638 <p>User talk
10639 </p>
10640 !! end
10641
10642 !! test
10643 Namespace User talk {{ns:uSeR tAlK}}
10644 !! wikitext
10645 {{ns:uSeR tAlK}}
10646 !! html
10647 <p>User talk
10648 </p>
10649 !! end
10650
10651 !! test
10652 Namespace File {{ns:File}}
10653 !! wikitext
10654 {{ns:File}}
10655 !! html
10656 <p>File
10657 </p>
10658 !! end
10659
10660 !! test
10661 Namespace File {{ns:Image}}
10662 !! wikitext
10663 {{ns:Image}}
10664 !! html
10665 <p>File
10666 </p>
10667 !! end
10668
10669 !! test
10670 Namespace (lang=de) Benutzer {{ns:User}}
10671 !! options
10672 language=de
10673 !! wikitext
10674 {{ns:User}}
10675 !! html
10676 <p>Benutzer
10677 </p>
10678 !! end
10679
10680 !! test
10681 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10682 !! options
10683 language=de
10684 !! wikitext
10685 {{ns:3}}
10686 !! html
10687 <p>Benutzer Diskussion
10688 </p>
10689 !! end
10690
10691 !! test
10692 Urlencode
10693 !! wikitext
10694 {{urlencode:hi world?!}}
10695 {{urlencode:hi world?!|WIKI}}
10696 {{urlencode:hi world?!|PATH}}
10697 {{urlencode:hi world?!|QUERY}}
10698 !! html/php
10699 <p>hi+world%3F%21
10700 hi_world%3F!
10701 hi%20world%3F%21
10702 hi+world%3F%21
10703 </p>
10704 !! end
10705
10706 !! test
10707 Magic Word: prioritize type info over data-parsoid
10708 !! options
10709 parsoid=html2wt
10710 !! html/parsoid
10711 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10712 !! wikitext
10713 __FORCETOC__
10714 !! end
10715
10716 !! test
10717 Magic Word: serialize on separate line (parsoid)
10718 !! options
10719 parsoid=wt2wt,html2wt
10720 !! wikitext
10721 foo
10722 __NOTOC__
10723 bar
10724 !! html/parsoid
10725 foo<meta property="mw:PageProp/notoc"/>bar
10726 !! end
10727
10728 !! test
10729 Magic Word: rt non-english wikis
10730 !! options
10731 parsoid=wt2wt
10732 language=de
10733 !! wikitext
10734 __NOEDITSECTION__
10735 !! html/parsoid
10736 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10737 !! end
10738
10739 !!test
10740 __proto__ is treated as normal wikitext (T105997)
10741 !!wikitext
10742 __proto__
10743 !!html
10744 <p>__proto__
10745 </p>
10746 !!end
10747
10748 ###
10749 ### Magic links
10750 ###
10751 !! test
10752 Magic links: internal link to RFC (T2479)
10753 !! wikitext
10754 [[RFC 123]]
10755 !! html/php
10756 <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>
10757 </p>
10758 !! html/parsoid
10759 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10760 !! end
10761
10762 !! test
10763 Magic links: RFC (T2479)
10764 !! wikitext
10765 RFC 822
10766 !! html/php
10767 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10768 </p>
10769 !! html/parsoid
10770 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10771 !! end
10772
10773 !! test
10774 Magic links: RFC (T67278)
10775 !! wikitext
10776 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10777 !! html/php
10778 <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.
10779 </p>
10780 !! html/parsoid
10781 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10782 !! end
10783
10784 !! test
10785 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
10786 !! wikitext
10787 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10788 RFC
10789 822
10790 !! html/php
10791 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10792 RFC
10793 822
10794 </p>
10795 !! html/parsoid
10796 <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>
10797 RFC
10798 822</p>
10799 !! end
10800
10801 !! test
10802 Magic links: ISBN (T3937)
10803 !! wikitext
10804 ISBN 0-306-40615-2
10805 !! html/php
10806 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10807 </p>
10808 !! html/parsoid
10809 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10810 !! end
10811
10812 !! test
10813 Magic links: ISBN (T67278)
10814 !! wikitext
10815 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10816 !! html/php
10817 <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.
10818 </p>
10819 !! html/parsoid
10820 <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>
10821 !! end
10822
10823 !! test
10824 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
10825 !! wikitext
10826 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10827 ISBN
10828 9780316098113
10829 ISBN 978
10830 0316098113
10831 !! html/php
10832 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10833 ISBN
10834 9780316098113
10835 ISBN 978
10836 0316098113
10837 </p>
10838 !! html/parsoid
10839 <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>
10840 ISBN
10841 9780316098113
10842 ISBN 978
10843 0316098113</p>
10844 !! end
10845
10846 !! test
10847 Magic links: PMID incorrectly converts space to underscore
10848 !! wikitext
10849 PMID 1234
10850 !! html/php
10851 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10852 </p>
10853 !! html/parsoid
10854 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10855 !! end
10856
10857 !! test
10858 Magic links: PMID (T67278)
10859 !! wikitext
10860 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10861 !! html/php
10862 <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.
10863 </p>
10864 !! html/parsoid
10865 <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>
10866 !! end
10867
10868 !! test
10869 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
10870 !! wikitext
10871 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10872 PMID
10873 1234
10874 !! html/php
10875 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10876 PMID
10877 1234
10878 </p>
10879 !! html/parsoid
10880 <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>
10881 PMID
10882 1234</p>
10883 !! end
10884
10885 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10886 # since these are ExtLinkText, not MagicLinkText
10887 !! test
10888 Magic links: use appropriate serialization for "almost" magic links.
10889 !! wikitext
10890 X[[Special:BookSources/0978739256|foo]]
10891
10892 X[//tools.ietf.org/html/rfc1234 foo]
10893 !! html/php
10894 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10895 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10896 </p>
10897 !! html/parsoid
10898 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10899 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10900 !! end
10901
10902 !! test
10903 Magic links: All disabled (T47942)
10904 !! options
10905 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10906 !! wikitext
10907 ISBN 0-306-40615-2
10908 PMID 1234
10909 RFC 4321
10910 !! html/php
10911 <p>ISBN 0-306-40615-2
10912 PMID 1234
10913 RFC 4321
10914 </p>
10915 !! end
10916
10917 ###
10918 ### Templates
10919 ####
10920
10921 !! test
10922 Nonexistent template
10923 !! wikitext
10924 {{thistemplatedoesnotexist}}
10925 !! html
10926 <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>
10927 </p>
10928 !! end
10929
10930 !! test
10931 Template with invalid target containing tags
10932 !! wikitext
10933 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10934 !! html
10935 <p>{{a<b>b</b>|foo|a=b|a = b}}
10936 </p>
10937 !! end
10938
10939 !! test
10940 Template with invalid target containing unclosed tag
10941 !! wikitext
10942 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10943 !! html
10944 <p>{{a<b>|foo|a=b|a = b}}</b>
10945 </p>
10946 !! end
10947
10948 !! test
10949 Template with invalid target containing wikilink
10950 !! wikitext
10951 {{[[Main Page]]}}
10952 !! html/php
10953 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10954 </p>
10955 !! html/parsoid
10956 <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>
10957 !! end
10958
10959 !! test
10960 Template with just whitespace in it, T70421
10961 !! wikitext
10962 {{echo|{{ }}}}
10963 !! html/parsoid
10964 <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>
10965 !! end
10966
10967 !! article
10968 Template:test
10969 !! text
10970 This is a test template
10971 !! endarticle
10972
10973 !! test
10974 Simple template
10975 !! wikitext
10976 {{test}}
10977 !! html
10978 <p>This is a test template
10979 </p>
10980 !! end
10981
10982 !! test
10983 Template with explicit namespace
10984 !! wikitext
10985 {{Template:test}}
10986 !! html
10987 <p>This is a test template
10988 </p>
10989 !! end
10990
10991
10992 !! article
10993 Template:paramtest
10994 !! text
10995 This is a test template with parameter {{{param}}}
10996 !! endarticle
10997
10998 !! test
10999 Template parameter
11000 !! wikitext
11001 {{paramtest|param=foo}}
11002 !! html
11003 <p>This is a test template with parameter foo
11004 </p>
11005 !! end
11006
11007 !! article
11008 Template:paramtestnum
11009 !! text
11010 [[{{{1}}}|{{{2}}}]]
11011 !! endarticle
11012
11013 !! test
11014 Template unnamed parameter
11015 !! wikitext
11016 {{paramtestnum|Main Page|the main page}}
11017 !! html
11018 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11019 </p>
11020 !! end
11021
11022 !! article
11023 Template:templatesimple
11024 !! text
11025 (test)
11026 !! endarticle
11027
11028 !! article
11029 Template:templateredirect
11030 !! text
11031 #redirect [[Template:templatesimple]]
11032 !! endarticle
11033
11034 !! article
11035 Template:templateasargtestnum
11036 !! text
11037 {{{{{1}}}}}
11038 !! endarticle
11039
11040 !! article
11041 Template:templateasargtest
11042 !! text
11043 {{template{{{templ}}}}}
11044 !! endarticle
11045
11046 !! article
11047 Template:templateasargtest2
11048 !! text
11049 {{{{{templ}}}}}
11050 !! endarticle
11051
11052 !! test
11053 Template with template name as unnamed argument
11054 !! wikitext
11055 {{templateasargtestnum|templatesimple}}
11056 !! html
11057 <p>(test)
11058 </p>
11059 !! end
11060
11061 !! test
11062 Template with template name as argument
11063 !! wikitext
11064 {{templateasargtest|templ=simple}}
11065 !! html
11066 <p>(test)
11067 </p>
11068 !! end
11069
11070 !! test
11071 Template with template name as argument (2)
11072 !! wikitext
11073 {{templateasargtest2|templ=templatesimple}}
11074 !! html
11075 <p>(test)
11076 </p>
11077 !! end
11078
11079 !! article
11080 Template:templateasargtestdefault
11081 !! text
11082 {{{{{templ|templatesimple}}}}}
11083 !! endarticle
11084
11085 !! article
11086 Template:templa
11087 !! text
11088 '''templ'''
11089 !! endarticle
11090
11091 !! test
11092 Template with default value
11093 !! wikitext
11094 {{templateasargtestdefault}}
11095 !! html
11096 <p>(test)
11097 </p>
11098 !! end
11099
11100 !! test
11101 Template with default value (value set)
11102 !! wikitext
11103 {{templateasargtestdefault|templ=templa}}
11104 !! html
11105 <p><b>templ</b>
11106 </p>
11107 !! end
11108
11109 !! test
11110 Template redirect
11111 !! wikitext
11112 {{templateredirect}}
11113 !! html/php
11114 <p>(test)
11115 </p>
11116 !! html/parsoid
11117 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11118 !! end
11119
11120 !! test
11121 Template with argument in separate line
11122 !! wikitext
11123 {{ templateasargtest |
11124 templ = simple }}
11125 !! html
11126 <p>(test)
11127 </p>
11128 !! end
11129
11130 !! test
11131 Template with complex template as argument
11132 !! wikitext
11133 {{paramtest|
11134 param ={{ templateasargtest |
11135 templ = simple }}}}
11136 !! html
11137 <p>This is a test template with parameter (test)
11138 </p>
11139 !! end
11140
11141 !! test
11142 Templates with templated name
11143 !! wikitext
11144 {{{{echo|echo}}|foo}}
11145 {{{{echo|inner list}} }}
11146 !! html
11147 <p>foo
11148 </p>
11149 <ul><li> item 1</li></ul>
11150
11151 !! html/parsoid
11152 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|echo}}","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
11153 <ul about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|inner list}} ","href":"./Template:Inner_list"},"params":{},"i":0}}]}'><li> item 1</li></ul>
11154 !! end
11155
11156 # Parsoid markup is deliberate "broken". This is an edge case.
11157 # See long comment in TemplateHandler.js:convertAttribsToString.
11158 !! test
11159 Templates with invalid templated targets
11160 !! wikitext
11161 {{echo
11162 {{echo|foo}}
11163 }}
11164 !! html/php
11165 <p>{{echo
11166 foo
11167 }}
11168 </p>
11169 !! html/parsoid
11170 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11171 foo }}</p>
11172 !! end
11173
11174 !! test
11175 Template with thumb image (with link in description)
11176 !! wikitext
11177 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11178 !! html/php
11179 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>
11180
11181 !! html+tidy
11182 <p>This is a test template with parameter</p>
11183 <div class="thumb tright">
11184 <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>
11185 <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>
11186 </div>
11187 </div>
11188 !! html/parsoid
11189 <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":"apierror-filedoesnotexist","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>
11190 !! end
11191
11192 !! article
11193 Template:complextemplate
11194 !! text
11195 {{{1}}} {{paramtest|
11196 param ={{{param}}}}}
11197 !! endarticle
11198
11199 !! test
11200 Template with complex arguments
11201 !! wikitext
11202 {{complextemplate|
11203 param ={{ templateasargtest |
11204 templ = simple }}|[[Template:complextemplate|link]]}}
11205 !! html
11206 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11207 </p>
11208 !! end
11209
11210 !! test
11211 T2553: link with two variables in a piped link
11212 !! wikitext
11213 {|
11214 |[[{{{1}}}|{{{2}}}]]
11215 |}
11216 !! html/php
11217 <table>
11218 <tr>
11219 <td>[[{{{1}}}|{{{2}}}]]
11220 </td></tr></table>
11221
11222 !! html/parsoid
11223 <table>
11224 <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>
11225 </tbody></table>
11226 !! end
11227
11228 # See: T2553
11229 !! test
11230 Abort table cell attribute parsing on wikilink
11231 !! wikitext
11232 {|
11233 | testing [[one|two]] | three || four
11234 | testing one two | three || four
11235 | testing="[[one|two]]" | three || four
11236 |}
11237 !! html/php
11238 <table>
11239 <tr>
11240 <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>
11241 <td> four
11242 </td>
11243 <td> three </td>
11244 <td> four
11245 </td>
11246 <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>
11247 <td> four
11248 </td></tr></table>
11249
11250 !! html/parsoid
11251 <table>
11252 <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>
11253 <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>
11254 <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>
11255 </tbody></table>
11256 !! end
11257
11258 !! test
11259 Don't abort table cell attribute parsing if wikilink is found in template arg
11260 !! wikitext
11261 {|
11262 | Test {{#tag:ref|One two "[[three]]" four}}
11263 |}
11264 !! html/parsoid
11265 <table>
11266 <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>
11267 </tbody></table>
11268 !! end
11269
11270 !! test
11271 Magic variable as template parameter
11272 !! wikitext
11273 {{paramtest|param={{SITENAME}}}}
11274 !! html
11275 <p>This is a test template with parameter MediaWiki
11276 </p>
11277 !! end
11278
11279 !! article
11280 Template:linktest
11281 !! text
11282 [[{{{param}}}|link]]
11283 !! endarticle
11284
11285 !! test
11286 Template parameter as link source
11287 !! wikitext
11288 {{linktest|param=Main Page}}
11289 !! html
11290 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11291 </p>
11292 !! end
11293
11294 !!article
11295 Template:paramtest2
11296 !! text
11297 including another template, {{paramtest|param={{{arg}}}}}
11298 !! endarticle
11299
11300 !! test
11301 Template passing argument to another template
11302 !! wikitext
11303 {{paramtest2|arg='hmm'}}
11304 !! html
11305 <p>including another template, This is a test template with parameter 'hmm'
11306 </p>
11307 !! end
11308
11309 !! article
11310 Template:Linktest2
11311 !! text
11312 Main Page
11313 !! endarticle
11314
11315 !! test
11316 Template as link source
11317 !! wikitext
11318 [[{{linktest2}}]]
11319
11320 [[{{linktest2}}|Main Page]]
11321
11322 [[{{linktest2}}]]Page
11323 !! html
11324 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11325 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11326 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11327 </p>
11328 !! end
11329
11330
11331 !! article
11332 Template:loop1
11333 !! text
11334 {{loop2}}
11335 !! endarticle
11336
11337 !! article
11338 Template:loop2
11339 !! text
11340 {{loop1}}
11341 !! endarticle
11342
11343 !! test
11344 Template infinite loop
11345 !! wikitext
11346 {{loop1}}
11347 !! html
11348 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11349 </p>
11350 !! end
11351
11352 !! test
11353 Template from main namespace
11354 !! wikitext
11355 {{:Main Page}}
11356 !! html
11357 <p>blah blah
11358 </p>
11359 !! end
11360
11361 !! article
11362 Template:table
11363 !! text
11364 {|
11365 | 1 || 2
11366 |-
11367 | 3 || 4
11368 |}
11369 !! endarticle
11370
11371 !! test
11372 T2529: Template with table, not included at beginning of line
11373 !! wikitext
11374 foo {{table}}
11375 !! html
11376 <p>foo
11377 </p>
11378 <table>
11379 <tr>
11380 <td> 1 </td>
11381 <td> 2
11382 </td></tr>
11383 <tr>
11384 <td> 3 </td>
11385 <td> 4
11386 </td></tr></table>
11387
11388 !! end
11389
11390 !! test
11391 T2523: Template shouldn't eat newline (or add an extra one before table)
11392 !! wikitext
11393 foo
11394 {{table}}
11395 !! html
11396 <p>foo
11397 </p>
11398 <table>
11399 <tr>
11400 <td> 1 </td>
11401 <td> 2
11402 </td></tr>
11403 <tr>
11404 <td> 3 </td>
11405 <td> 4
11406 </td></tr></table>
11407
11408 !! end
11409
11410 !! test
11411 T2041: Template parameters shown as broken links
11412 !! wikitext
11413 {{{parameter}}}
11414 !! html
11415 <p>{{{parameter}}}
11416 </p>
11417 !! end
11418
11419 !! test
11420 Template with targets containing wikilinks
11421 !! options
11422 parsoid=wt2html
11423 !! wikitext
11424 {{[[foo]]}}
11425
11426 {{[[{{echo|foo}}]]}}
11427
11428 {{{{echo|[[foo}}]]}}
11429 !! html/php
11430 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11431 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11432 </p><p>{{[[foo}}]]
11433 </p>
11434 !! html/parsoid
11435 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11436 <p>{{<a typeof="mw:ExpandedAttrs" rel="mw:WikiLink" href="./Foo" title="Foo" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}&#39;>foo&lt;/span>"}]]}'>foo</a>}}</p>
11437 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11438 !! end
11439
11440 !! article
11441 Template:''
11442 !! text
11443 bar
11444 !! endarticle
11445
11446 !! test
11447 Templates: Double quotes as template target
11448 !! wikitext
11449 foo {{''}} baz
11450 !! html/php
11451 <p>foo bar baz
11452 </p>
11453 !! html/parsoid
11454 <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
11455 </p>
11456 !! end
11457
11458 ## This test is about making sure Parsoid's data-mw is well formed in the
11459 ## face of multiple templates with intersecting and overlapping ranges. The
11460 ## wikitext itself is wretched.
11461 !! test
11462 Templates with intersecting and overlapping ranges
11463 !! wikitext
11464 {|{{echo|
11465 <p>ha</p>}}
11466 {|{{echo|
11467 <p>ho</p>}}
11468 {{echo|{{!}}hi}}
11469 |}
11470 !! html/php+tidy
11471 <p>ha</p>
11472 <p>ho</p>
11473 <table>
11474 <tr>
11475 <td></td>
11476 </tr>
11477 <tr>
11478 <td>hi</td>
11479 </tr>
11480 </table>
11481 <table>
11482 <tr>
11483 <td></td>
11484 </tr>
11485 </table>
11486 !! html/parsoid
11487 <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":""}]]}'>
11488
11489 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11490
11491 <tbody><tr><td>hi</td></tr>
11492 </tbody></table>
11493 !! end
11494
11495 !! article
11496 Template:MSGNW test
11497 !! text
11498 ''None'' of '''this''' should be
11499 * interpreted
11500 but rather passed unmodified
11501 {{test}}
11502 <gallery>
11503 File:Foobar.jpg
11504 </gallery>
11505 <!-- comment -->
11506 !! endarticle
11507
11508 # hmm, fix this or just deprecate msgnw and document its behavior?
11509 !! test
11510 msgnw keyword
11511 !! wikitext
11512 {{msgnw:MSGNW test}}
11513 !! html/php
11514 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11515 &#42; interpreted
11516 &#32;but rather passed unmodified
11517 &#123;&#123;test&#125;&#125;
11518 &#60;gallery&#62;
11519 File:Foobar.jpg
11520 &#60;/gallery&#62;
11521 &#60;!-- comment --&#62;
11522 </p>
11523 !! end
11524
11525 !! test
11526 int keyword
11527 !! wikitext
11528 {{int:youhavenewmessages|lots of money|not!}}
11529 !! html
11530 <p>You have lots of money (not!).
11531 </p>
11532 !! end
11533
11534 !! test
11535 int keyword - non-existing message
11536 !! wikitext
11537 {{int:var}}
11538 !! html
11539 <p>⧼var⧽
11540 </p>
11541 !! end
11542
11543 !! article
11544 Template:Includes
11545 !! text
11546 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11547 !! endarticle
11548
11549 !! test
11550 <includeonly> and <noinclude> being included
11551 !! wikitext
11552 {{Includes}}
11553 !! html
11554 <p>Foobar
11555 </p>
11556 !! end
11557
11558 !! article
11559 Template:Includes2
11560 !! text
11561 <onlyinclude>Foo</onlyinclude>bar
11562 !! endarticle
11563
11564 !! test
11565 <onlyinclude> being included
11566 !! wikitext
11567 {{Includes2}}
11568 !! html
11569 <p>Foo
11570 </p>
11571 !! end
11572
11573
11574 !! article
11575 Template:Includes3
11576 !! text
11577 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11578 !! endarticle
11579
11580 !! test
11581 <onlyinclude> and <includeonly> being included
11582 !! wikitext
11583 {{Includes3}}
11584 !! html
11585 <p>Foo
11586 </p>
11587 !! end
11588
11589 !! test
11590 <includeonly> and <noinclude> on a page
11591 !! wikitext
11592 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11593 !! html
11594 <p>Foozar
11595 </p>
11596 !! end
11597
11598 !! test
11599 Un-closed <noinclude>
11600 !! wikitext
11601 <noinclude>
11602 !! html
11603 !! end
11604
11605 !! test
11606 <onlyinclude> on a page
11607 !! wikitext
11608 <onlyinclude>Foo</onlyinclude>bar
11609 !! html
11610 <p>Foobar
11611 </p>
11612 !! end
11613
11614 !! test
11615 Un-closed <onlyinclude>
11616 !! wikitext
11617 <onlyinclude>
11618 !! html
11619 !! end
11620
11621 !!test
11622 Self-closed noinclude, includeonly, onlyinclude tags
11623 !! wikitext
11624 <noinclude />
11625 <includeonly />
11626 <onlyinclude />
11627 !! html
11628 <p><br />
11629 </p>
11630 !!end
11631
11632 !!test
11633 Unbalanced includeonly and noinclude tags
11634 !! wikitext
11635 {|
11636 |a</noinclude>
11637 |b</noinclude></noinclude>
11638 |c</noinclude></includeonly>
11639 |d</includeonly></includeonly>
11640 |}
11641 !! html
11642 <table>
11643 <tr>
11644 <td>a
11645 </td>
11646 <td>b
11647 </td>
11648 <td>c&lt;/includeonly&gt;
11649 </td>
11650 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11651 </td></tr></table>
11652
11653 !!end
11654
11655 !! article
11656 Template:Includeonly section
11657 !! text
11658 <includeonly>
11659 ==Includeonly section==
11660 </includeonly>
11661 ==Section T-1==
11662 !!endarticle
11663
11664 !! test
11665 T8563: Edit link generation for section shown by <includeonly>
11666 !! wikitext
11667 {{includeonly section}}
11668 !! html
11669 <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>
11670 <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>
11671
11672 !! end
11673
11674 # Uses same input as the contents of [[Template:Includeonly section]]
11675 !! test
11676 T8563: Section extraction for section shown by <includeonly>
11677 !! options
11678 section=T-2
11679 !! wikitext
11680 <includeonly>
11681 ==Includeonly section==
11682 </includeonly>
11683 ==Section T-2==
11684 !! html
11685 ==Section T-2==
11686 !! end
11687
11688 !! test
11689 T8563: Edit link generation for section suppressed by <includeonly>
11690 !! wikitext
11691 <includeonly>
11692 ==Includeonly section==
11693 </includeonly>
11694 ==Section 1==
11695 !! html
11696 <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>
11697
11698 !! end
11699
11700 !! test
11701 T8563: Section extraction for section suppressed by <includeonly>
11702 !! options
11703 section=1
11704 !! wikitext
11705 <includeonly>
11706 ==Includeonly section==
11707 </includeonly>
11708 ==Section 1==
11709 !! html
11710 ==Section 1==
11711 !! end
11712
11713 !! test
11714 Un-closed <includeonly>
11715 !! wikitext
11716 <includeonly>
11717 !! html/php
11718 !! html/parsoid
11719 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11720 !! end
11721
11722 ## We used to, but no longer wt2wt this test since the default serializer
11723 ## will normalize the include directives to serialize on their own line.
11724 ## Selser will take care of preserving formatting in scenarios where they
11725 ## intermingled with other wikitext.
11726 !! test
11727 Includes and comments at SOL
11728 !! options
11729 parsoid=wt2html,html2html
11730 !! wikitext
11731 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11732
11733 <noinclude>
11734 some
11735 </noinclude>* stuff
11736 * here
11737
11738 <includeonly>can have stuff</includeonly>=== here ===
11739
11740 !! html/php
11741 <h2><span class="mw-headline" id="hu">hu</span></h2>
11742 <p>some
11743 </p>
11744 <ul><li> stuff</li>
11745 <li> here</li></ul>
11746 <h3><span class="mw-headline" id="here">here</span></h3>
11747
11748 !! html/parsoid
11749 <!-- 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>
11750
11751 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11752 <p>some</p>
11753 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11754 <li> here</li></ul>
11755
11756 <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>
11757
11758 !! end
11759
11760 # TODO: test with DOM fragment reuse!
11761 !! test
11762 Parsoid: DOM fragment reuse
11763 !! options
11764 parsoid=wt2wt,wt2html
11765 !! wikitext
11766 a{{echo|b<table></table>c}}d
11767
11768 a{{echo|b
11769 <table></table>
11770 c}}d
11771
11772 {{echo|a
11773
11774 <table></table>
11775
11776 b}}
11777 !! html
11778 <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>
11779
11780 <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">
11781 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11782 </span><p about="#mwt2">cd</p>
11783
11784 <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">
11785
11786 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11787
11788 </span><p about="#mwt3">b</p>
11789 !! end
11790
11791 !! test
11792 Parsoid: Merge double tds (T52603)
11793 !! options
11794 parsoid
11795 !! wikitext
11796 {|
11797 |{{echo|{{!}} foo}}
11798 |}
11799 !! html
11800 <table><tbody>
11801 <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>
11802 </tbody></table>
11803 !! end
11804
11805 !! test
11806 Parsoid: Merge double tds in nested transclusion content (T52603)
11807 !! options
11808 parsoid
11809 !! wikitext
11810 {{echo|<div>}}
11811 {|
11812 |{{echo|{{!}} foo}}
11813 |}
11814 {{echo|</div>}}
11815 !! html
11816 <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}}]}'>
11817 <table><tbody>
11818 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11819 </tbody></table>
11820 </div>
11821 !! end
11822
11823 ###
11824 ### <includeonly> and <noinclude> in attributes
11825 ###
11826 !!test
11827 0. includeonly around the entire attribute
11828 !! wikitext
11829 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11830 !! html
11831 <p><span id="v2">bar</span>
11832 </p>
11833 !!end
11834
11835 !!test
11836 1. includeonly in html attr key
11837 !! wikitext
11838 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11839 !! html
11840 <p><span id="foo">bar</span>
11841 </p>
11842 !!end
11843
11844 !!test
11845 2. includeonly in html attr value
11846 !! wikitext
11847 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11848 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11849 !! html
11850 <p><span id="v1">bar</span>
11851 <span id="v1">bar</span>
11852 </p>
11853 !!end
11854
11855 !!test
11856 3. includeonly in part of an attr value
11857 !! wikitext
11858 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11859 !! html
11860 <p><span style="color:red;">bar</span>
11861 </p>
11862 !!end
11863
11864 !!test
11865 4. includeonly in table attributes
11866 !! wikitext
11867 {|
11868 |- <noinclude>
11869 |-
11870 |a
11871 </noinclude>
11872 |- <includeonly>
11873 |-
11874 |b
11875 </includeonly>
11876 |}
11877 !! html
11878 <table>
11879
11880
11881 <tr>
11882 <td>a
11883 </td></tr>
11884 </table>
11885
11886 !!end
11887
11888 ###
11889 ### Preprocessor precedence tests
11890 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
11891 ###
11892 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
11893 !! test
11894 Preprocessor precedence 1: link is rightmost opening
11895 !! wikitext
11896 {{[[Foo|bar}}]]
11897
11898 But close-brace is not a valid character in a link title:
11899 {{[[Foo}}|bar]]
11900
11901 However, we can still tell this was handled as a link in the preprocessor:
11902 {{echo|[[Foo}}|bar]]|bat}}
11903 !! html
11904 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
11905 </p><p>But close-brace is not a valid character in a link title:
11906 {{[[Foo}}|bar]]
11907 </p><p>However, we can still tell this was handled as a link in the preprocessor:
11908 [[Foo}}|bar]]
11909 </p>
11910 !! end
11911
11912 !! test
11913 Preprocessor precedence 2: template is rightmost opening
11914 !! options
11915 language=zh
11916 !! wikitext
11917 -{{echo|foo}-}}-
11918 !! html
11919 <p>-foo}--
11920 </p>
11921 !! end
11922
11923 !! test
11924 Preprocessor precedence 3: language converter is rightmost opening
11925 !! options
11926 language=zh
11927 !! wikitext
11928 {{echo|hi}}
11929
11930 {{-{R|echo|hi}}}-
11931
11932 [[-{R|raw]]}-
11933 !! html
11934 <p>hi
11935 </p><p>{{echo|hi}}
11936 </p><p>[[raw]]
11937 </p>
11938 !! end
11939
11940 !! test
11941 Preprocessor precedence 4: left-most angle bracket
11942 !! options
11943 language=zh
11944 !! wikitext
11945 <!--{raw}-->
11946 !! html
11947 !! end
11948
11949 !! article
11950 Template:Precedence5
11951 !! text
11952 {{{{{1}}}}}
11953 !! endarticle
11954
11955 !! test
11956 Preprocessor precedence 5: tplarg takes precedence over template
11957 !! wikitext
11958 {{Precedence5|Bullet}}
11959 !! html
11960 <ul><li> Bar</li></ul>
11961
11962 !! end
11963
11964 !! test
11965 Preprocessor precedence 6: broken link is rightmost opening
11966 !! wikitext
11967 {{echo|[[Foo}}
11968
11969 {{echo|[[Foo|bar|bat=baz}}
11970 !! html
11971 <p>{{echo|[[Foo}}
11972 </p><p>{{echo|[[Foo|bar|bat=baz}}
11973 </p>
11974 !! end
11975
11976 # This next test exposes a difference between PHP and Parsoid:
11977 # Given [[Foo|{{echo|Bar]]x}}y]]z:
11978 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
11979 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
11980 # outer `[[Foo` extends until the `y]]`
11981 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
11982 # intermediate result (after template expansion), and link processing
11983 # happens on this intermediate result, which moves the wikilink
11984 # boundary leftward to `[[Foo|Bar]]`
11985 # 2b) Parsoid works in a single step, so it's going to keep the
11986 # wikilink as extending to the `y]]`
11987 # 3a) Then PHP does linktrail processing which slurps up the trailing
11988 # `xy` inside the link.
11989 # 3b) Parsoid will do linktrail processing to slurp up the trailing
11990 # `z` inside the link.
11991 # This is "correct" behavior. Parsoid's basic worldview is that the
11992 # `]]` inside the template shouldn't be allowed to leak out to affect
11993 # the surrounding wikilink. PHP may match Parsoid (in the future)
11994 # if you use {{#balance}} (T114445).
11995
11996 !! test
11997 Preprocessor precedence 7: broken template is rightmost opening
11998 !! wikitext
11999 [[Foo|{{echo|Bar]]
12000
12001 [[Foo|{{echo|Bar]]-x}}-y]]-z
12002
12003 Careful: linktrails can move the end of the wikilink:
12004 [[Foo|{{echo|y']]a}}l]]l
12005 !! html
12006 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12007 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12008 </p><p>Careful: linktrails can move the end of the wikilink:
12009 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12010 </p>
12011 !! end
12012
12013 !! test
12014 Preprocessor precedence 8: broken language converter is rightmost opening
12015 !! options
12016 language=zh
12017 !! wikitext
12018 [[Foo-{R|raw]]
12019 !! html
12020 <p>[[Foo-{R|raw]]
12021 </p>
12022 !! end
12023
12024 !! article
12025 Template:Preprocessor_precedence_9
12026 !! text
12027 ;4: {{{{1}}}}
12028 ;5: {{{{{2}}}}}
12029 ;6: {{{{{{3}}}}}}
12030 ;7: {{{{{{{4}}}}}}}
12031 !! endarticle
12032
12033 !! test
12034 Preprocessor precedence 9: groups of braces
12035 !! wikitext
12036 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12037 !! html
12038 <dl><dt>4</dt>
12039 <dd> {Four}</dd>
12040 <dt>5</dt>
12041 <dd> </dd></dl>
12042 <ul><li> Bar</li></ul>
12043 <dl><dt>6</dt>
12044 <dd> Four</dd>
12045 <dt>7</dt>
12046 <dd> {Bullet}</dd></dl>
12047
12048 !! end
12049
12050 !! article
12051 Template:Preprocessor_precedence_10
12052 !! text
12053 ;1: -{R|raw}-
12054 ;2: -{{Bullet}}-
12055 ;3: -{{{1}}}-
12056 ;4: -{{{{2}}}}-
12057 ;5: -{{{{{3}}}}}-
12058 ;6: -{{{{{{4}}}}}}-
12059 ;7: -{{{{{{{5}}}}}}}-
12060 !! endarticle
12061
12062 !! test
12063 Preprocessor precedence 10: groups of braces with leading dash
12064 !! options
12065 language=zh
12066 !! wikitext
12067 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12068 !! html
12069 <dl><dt>1</dt>
12070 <dd> raw</dd>
12071 <dt>2</dt>
12072 <dd> -</dd></dl>
12073 <ul><li> Bar-</li></ul>
12074 <dl><dt>3</dt>
12075 <dd> -Three-</dd>
12076 <dt>4</dt>
12077 <dd> raw2</dd>
12078 <dt>5</dt>
12079 <dd> -</dd></dl>
12080 <ul><li> Bar-</li></ul>
12081 <dl><dt>6</dt>
12082 <dd> -Three-</dd>
12083 <dt>7</dt>
12084 <dd> raw2</dd></dl>
12085
12086 !! end
12087
12088 !! test
12089 Preprocessor precedence 11: found during visual diff testing
12090 !! wikitext
12091 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12092
12093 {{echo|-{{echo|-{{echo|x}}}}}}
12094
12095 {{echo|-{{echo|x}}}}
12096 !! html
12097 <p><span>-<span>-x</span></span>
12098 </p><p>--x
12099 </p><p>-x
12100 </p>
12101 !! end
12102
12103 !! test
12104 Preprocessor precedence 12: broken language converter closed by brace.
12105 !! wikitext
12106 This form breaks the template, which is unfortunate:
12107 * {{echo|foo-{bar}bat}}
12108
12109 But if the broken language converter markup is inside an extension
12110 tag, nothing bad happens:
12111 * <nowiki>foo-{bar}bat</nowiki>
12112 * {{echo|<nowiki>foo-{bar}bat</nowiki>}}
12113 * <pre>foo-{bar}bat</pre>
12114 * {{echo|<pre>foo-{bar}bat</pre>}}
12115
12116 <tag>foo-{bar}bat</tag>
12117 {{echo|<tag>foo-{bar}bat</tag>}}
12118
12119 !! html+tidy
12120 <p>This form breaks the template, which is unfortunate:</p>
12121 <ul>
12122 <li>{{echo|foo-{bar}bat}}</li>
12123 </ul>
12124 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12125 <ul>
12126 <li>foo-{bar}bat</li>
12127 <li>foo-{bar}bat</li>
12128 <li>
12129 <pre>
12130 foo-{bar}bat
12131 </pre></li>
12132 <li>
12133 <pre>
12134 foo-{bar}bat
12135 </pre></li>
12136 </ul>
12137 <pre>
12138 'foo-{bar}bat'
12139 array (
12140 )
12141 </pre>
12142 <pre>
12143 'foo-{bar}bat'
12144 array (
12145 )
12146 </pre>
12147 !! end
12148
12149 !! test
12150 Preprocessor precedence, 13: broken language converter in external link
12151 !! wikitext
12152 * [http://example.com/-{foo Example in URL]
12153 * [http://example.com Example in -{link} description]
12154 * {{echo|[http://example.com/-{foo Breaks template, however]}}
12155 !! html+tidy
12156 <ul>
12157 <li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12158 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12159 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12160 </ul>
12161 !! end
12162
12163 !! test
12164 Preprocessor precedence, 14: broken language converter in comment
12165 !! wikitext
12166 * <!--{{foo}}--> ...should be ok
12167 * <!---{{foo}}--> ...extra dashes
12168 * {{echo|foo<!-- -{bar} -->bat}} ...should be ok
12169 !! html+tidy
12170 <ul>
12171 <li>...should be ok</li>
12172 <li>...extra dashes</li>
12173 <li>foobat ...should be ok</li>
12174 </ul>
12175 !! end
12176
12177 !! test
12178 Preprocessor precedence, 15: broken brace markup in headings
12179 !! wikitext
12180 __NOTOC__ __NOEDITSECTION__
12181 ===1 foo[bar 1===
12182 1
12183 ===2 foo[[bar 2===
12184 2
12185 ===3 foo{bar 3===
12186 3
12187 ===4 foo{{bar 4===
12188 4
12189 ===5 foo{{{bar 5===
12190 5
12191 ===6 foo-{bar 6===
12192 6
12193 !! html+tidy
12194 <h3><span class="mw-headline" id="1_foo.5Bbar_1">1 foo[bar 1</span></h3>
12195 <p>1</p>
12196 <h3><span class="mw-headline" id="2_foo.5B.5Bbar_2">2 foo[[bar 2</span></h3>
12197 <p>2</p>
12198 <h3><span class="mw-headline" id="3_foo.7Bbar_3">3 foo{bar 3</span></h3>
12199 <p>3</p>
12200 <h3><span class="mw-headline" id="4_foo.7B.7Bbar_4">4 foo{{bar 4</span></h3>
12201 <p>4</p>
12202 <h3><span class="mw-headline" id="5_foo.7B.7B.7Bbar_5">5 foo{{{bar 5</span></h3>
12203 <p>5</p>
12204 <h3><span class="mw-headline" id="6_foo-.7Bbar_6">6 foo-{bar 6</span></h3>
12205 <p>6</p>
12206 !! end
12207
12208 ###
12209 ### Token Stream Patcher tests
12210 ###
12211 ### These tests won't always pass wt2wt and other modes because
12212 ### on serialization, the table will be output on a new line.
12213 ### For now, we are blacklisting them, and using this to test selser.
12214 ###
12215
12216 !!test
12217 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12218 !!options
12219 parsoid=wt2html,wt2wt
12220 !!wikitext
12221 {{echo|}}{| width = '100%'
12222 |foo
12223 |}
12224 !!html/parsoid
12225 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12226 <tbody><tr><td>foo</td></tr>
12227 </tbody></table>
12228 !!end
12229
12230 ## We used to, but no longer wt2wt this test since the default serializer
12231 ## will normalize the include directives to serialize on their own line.
12232 ## Selser will take care of preserving formatting in scenarios where they
12233 ## intermingled with other wikitext.
12234 !!test
12235 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12236 !!options
12237 parsoid=wt2html
12238 !!wikitext
12239 <includeonly>a</includeonly>{| {{{b}}}
12240 |c
12241 |}
12242 !!html/parsoid
12243 <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":""}]]}'>
12244 <tbody><tr><td>c</td></tr>
12245 </tbody></table>
12246 !!end
12247
12248 !! test
12249 Table wikitext syntax outside wiki-tables
12250 !! wikitext
12251 a
12252 |+ not a caption
12253 ! not a table heading
12254 |- not a table row
12255 | not a table cell
12256 | class="foo bar" | baz
12257 b
12258 |}
12259 |-
12260 c
12261 !! html
12262 <p>a
12263 |+ not a caption
12264 ! not a table heading
12265 |- not a table row
12266 | not a table cell
12267 | class="foo bar" | baz
12268 b
12269 |}
12270 |-
12271 c
12272 </p>
12273 !! end
12274
12275 ###
12276 ### Testing parsing of templates where a template arg
12277 ### has the same name as the template itself.
12278 ###
12279
12280 !! article
12281 Template:quote
12282 !! text
12283 {{{quote|{{{1}}}}}}
12284 !! endarticle
12285
12286 !!test
12287 Templates: Template Name/Arg clash: 1. Use of positional param
12288 !! wikitext
12289 {{quote|foo}}
12290 !! html
12291 <p>foo
12292 </p>
12293 !!end
12294
12295 !!test
12296 Templates: Template Name/Arg clash: 2. Use of named param
12297 !! wikitext
12298 {{quote|quote=foo}}
12299 !! html
12300 <p>foo
12301 </p>
12302 !!end
12303
12304 !!test
12305 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12306 !! wikitext
12307 {{quote|quote}}
12308 !! html
12309 <p>quote
12310 </p>
12311 !!end
12312
12313 ###
12314 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12315 ###
12316
12317 !!test
12318 Templates: 1. Simple use
12319 !! wikitext
12320 {{echo|Foo}}
12321 !! html
12322 <p>Foo
12323 </p>
12324 !!end
12325
12326 !!test
12327 Templates: 2. Inside a block tag
12328 !! wikitext
12329 <div>{{echo|Foo}}</div>
12330 <blockquote>{{echo|Foo}}</blockquote>
12331 !! html
12332 <div>Foo</div>
12333 <blockquote>Foo</blockquote>
12334
12335 !! html+tidy
12336 <div>Foo</div>
12337 <blockquote>
12338 <p>Foo</p>
12339 </blockquote>
12340 !!end
12341
12342 !!test
12343 Templates: P-wrapping: 1a. Templates on consecutive lines
12344 !! wikitext
12345 {{echo|Foo}}
12346 {{echo|bar}}
12347 !! html
12348 <p>Foo
12349 bar
12350 </p>
12351 !!end
12352
12353 !!test
12354 Templates: P-wrapping: 1b. Templates on consecutive lines
12355 !! wikitext
12356 Foo
12357
12358 {{echo|bar}}
12359 {{echo|baz}}
12360 !! html
12361 <p>Foo
12362 </p><p>bar
12363 baz
12364 </p>
12365 !!end
12366
12367 !!test
12368 Templates: P-wrapping: 1c. Templates on consecutive lines
12369 !! wikitext
12370 {{echo|Foo}}
12371 {{echo|bar}} <div>baz</div>
12372 !! html
12373 <p>Foo
12374 </p>
12375 bar <div>baz</div>
12376
12377 !! html+tidy
12378 <p>Foo</p>
12379 <p>bar</p>
12380 <div>baz</div>
12381 !! end
12382
12383 !!test
12384 Templates: P-wrapping: 1d. Template preceded by comment-only line
12385 !!options
12386 parsoid
12387 !! wikitext
12388 <!-- foo -->
12389 {{echo|Bar}}
12390 !! html
12391 <!-- foo -->
12392
12393 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12394 !!end
12395
12396 !!test
12397 Templates: Inline Text: 1. Multiple template uses
12398 !! wikitext
12399 {{echo|Foo}}bar{{echo|baz}}
12400 !! html
12401 <p>Foobarbaz
12402 </p>
12403 !!end
12404
12405 !!test
12406 Templates: Inline Text: 2. Back-to-back template uses
12407 !! wikitext
12408 {{echo|Foo}}{{echo|bar}}
12409 !! html
12410 <p>Foobar
12411 </p>
12412 !!end
12413
12414 !!test
12415 Templates: Block Tags: 1. Multiple template uses
12416 !! wikitext
12417 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12418 !! html
12419 <div>Foo</div><div>bar</div><div>baz</div>
12420
12421 !!end
12422
12423 !!test
12424 Templates: Block Tags: 2. Back-to-back template uses
12425 !! wikitext
12426 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12427 !! html
12428 <div>Foo</div><div>bar</div>
12429
12430 !!end
12431
12432 # This is an edge case relating to paragraph wrapping.
12433 !!test
12434 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12435 !! wikitext
12436 {{echo|a
12437 b</p>}}
12438 !! html/parsoid
12439 <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
12440 b</p>
12441 !!end
12442
12443 !!test
12444 Templates: Links: 1. Simple example
12445 !! wikitext
12446 {{echo|[[Foo|bar]]}}
12447 !! html
12448 <p><a href="/wiki/Foo" title="Foo">bar</a>
12449 </p>
12450 !!end
12451
12452 !!test
12453 Templates: Links: 2. Generation of link href
12454 !! wikitext
12455 [[{{echo|Foo}}|bar]]
12456 !! html
12457 <p><a href="/wiki/Foo" title="Foo">bar</a>
12458 </p>
12459 !!end
12460
12461 !!test
12462 Templates: Links: 3. Generation of part of a link href
12463 !! wikitext
12464 [[Fo{{echo|o}}|bar]]
12465
12466 [[Foo{{echo|bar}}]]
12467
12468 [[Foo{{echo|bar}}baz]]
12469
12470 [[Foo{{echo|bar}}|bar]]
12471
12472 [[:Foo{{echo|bar}}]]
12473
12474 [[:Foo{{echo|bar}}|bar]]
12475 !! html
12476 <p><a href="/wiki/Foo" title="Foo">bar</a>
12477 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12478 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
12479 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12480 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12481 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12482 </p>
12483 !!end
12484
12485 !!test
12486 Templates: Links: 4. Multiple templates generating link href
12487 !! wikitext
12488 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12489 !! html
12490 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12491 </p>
12492 !!end
12493
12494 !!test
12495 Templates: Links: 5. Generation of link text
12496 !! wikitext
12497 [[Foo|{{echo|bar}}]]
12498 !! html
12499 <p><a href="/wiki/Foo" title="Foo">bar</a>
12500 </p>
12501 !!end
12502
12503 !!test
12504 Templates: Links: 5. Nested templates (only outermost template should be marked)
12505 !! wikitext
12506 {{echo|[[{{echo|Foo}}|bar]]}}
12507 !! html
12508 <p><a href="/wiki/Foo" title="Foo">bar</a>
12509 </p>
12510 !!end
12511
12512 !!test
12513 Templates: HTML Tag: 1. Generation of HTML attr. key
12514 !! wikitext
12515 <div {{echo|style}}="color:red;">foo</div>
12516 !! html
12517 <div style="color:red;">foo</div>
12518
12519 !!end
12520
12521 !!test
12522 Templates: HTML Tag: 2. Generation of HTML attr. value
12523 !! wikitext
12524 <div style={{echo|'color:red;'}}>foo</div>
12525 !! html
12526 <div style="color:red;">foo</div>
12527
12528 !!end
12529
12530 !!test
12531 Templates: HTML Tag: 3. Generation of HTML attr key and value
12532 !! wikitext
12533 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12534 !! html
12535 <div style="color:red;">foo</div>
12536
12537 !!end
12538
12539 !!test
12540 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12541 !! wikitext
12542 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12543 !! html
12544 <div title="This is a long title with just one piece templated">foo</div>
12545
12546 !!end
12547
12548 !!test
12549 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12550 !! wikitext
12551 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12552 !! html
12553 <div title="This is a long title with just one piece templated">foo</div>
12554
12555 !!end
12556
12557 !!test
12558 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12559 !! wikitext
12560 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12561 !! html
12562 <div title="This is a long title with just one piece templated">foo</div>
12563
12564 !!end
12565
12566 # SSS FIXME: While it is great we added support for all this,
12567 # do we want to make this part of the spec? Maybe we want to
12568 # deprecate this kind of usage in the future?
12569 !!test
12570 Templates: HTML Tag: 7. Generation of partial attribute key string
12571 !! wikitext
12572 <div st{{echo|yle}}="color:red;">foo</div>
12573 !! html
12574 <div style="color:red;">foo</div>
12575
12576 !!end
12577
12578 !! test
12579 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12580 !! wikitext
12581 <div {{echo|1=id="v1"}}>bar</div>
12582 !! html
12583 <div id="v1">bar</div>
12584
12585 !!end
12586
12587 !! test
12588 Templates: HTML Tag: 9. Multiple template-generated attributes
12589 !! wikitext
12590 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12591 !! html
12592 <div id="v1" title="foo">bar</div>
12593
12594 !!end
12595
12596 !! test
12597 Templates: Support for templates generating attributes and content
12598 !! wikitext
12599 {| {{mixed_attr_content_template}}
12600 |-
12601 |bar
12602 |}
12603 !! html/php
12604 <table style="color:red;" title="T48811">
12605
12606 <tr>
12607 <td>foo
12608 </td></tr>
12609 <tr>
12610 <td>bar
12611 </td></tr></table>
12612
12613 !! html/parsoid
12614 <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|}"]}'>
12615 <tbody><tr>
12616 <td>foo</td></tr>
12617 <tr>
12618 <td>bar</td></tr>
12619 </tbody></table>
12620 !!end
12621
12622 !! test
12623 1. Entities and nowikis inside templated attributes should be handled correctly
12624 !! wikitext
12625 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12626 !! html/php
12627 <div style="background:#f9f9f9;">foo</div>
12628
12629 !! html/parsoid
12630 <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>
12631 !! end
12632
12633 !! test
12634 2. Entities and nowikis inside templated attributes should be handled correctly
12635 !! wikitext
12636 {|
12637 |{{table_attribs_3}}
12638 |}
12639 !! html/php
12640 <table>
12641 <tr>
12642 <td style="background:#f9f9f9;">Foo
12643 </td></tr></table>
12644
12645 !! html/parsoid
12646 <table>
12647 <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>
12648 </tbody></table>
12649 !! end
12650
12651 !! test
12652 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12653 !! wikitext
12654 {{tbl-start}}
12655 |{{table_attribs_3}}
12656 {{tbl-end}}
12657 !! html/php
12658 <table>
12659 <tr>
12660 <td style="background:#f9f9f9;">Foo
12661 </td></tr></table>
12662
12663 !! html/parsoid
12664 <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}}]}'>
12665 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12666 </tbody></table>
12667 !! end
12668
12669 # T107622
12670 !! test
12671 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12672 !! wikitext
12673 {|
12674 | {{table_attribs_6}} hi
12675 |}
12676 !! html/php
12677 <table>
12678 <tr>
12679 <td style="background: red;"> hi
12680 </td></tr></table>
12681
12682 !! html/parsoid
12683 <table>
12684 <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>
12685 </tbody></table>
12686 !! end
12687
12688 !!test
12689 Templates: HTML Tables: 1. Generating start of a HTML table
12690 !! wikitext
12691 {{echo|<table><tr><td>foo</td>}}</tr></table>
12692 !! html
12693 <table><tr><td>foo</td></tr></table>
12694
12695 !!end
12696
12697 !!test
12698 Templates: HTML Tables: 2a. Generating middle of a HTML table
12699 !! wikitext
12700 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12701 !! html
12702 <table><tr><td>foo</td></tr></table>
12703
12704 !!end
12705
12706 !!test
12707 Templates: HTML Tables: 2b. Generating middle of a HTML table
12708 !! wikitext
12709 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12710 !! html
12711 <table><tr><td>foo</td></tr></table>
12712
12713 !!end
12714
12715 !!test
12716 Templates: HTML Tables: 3. Generating end of a HTML table
12717 !! wikitext
12718 <table><tr>{{echo|<td>foo</td></tr></table>}}
12719 !! html
12720 <table><tr><td>foo</td></tr></table>
12721
12722 !!end
12723
12724 !!test
12725 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12726 !! wikitext
12727 {{echo|<table>}}<tr><td>foo</td></tr></table>
12728 !! html
12729 <table><tr><td>foo</td></tr></table>
12730
12731 !!end
12732
12733 !!test
12734 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12735 !! wikitext
12736 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12737 !! html
12738 <table><tr><td>foo</td></tr></table>
12739
12740 !!end
12741
12742 !!test
12743 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12744 !! wikitext
12745 <table><tr>{{echo|<td>}}foo</td></tr></table>
12746 !! html
12747 <table><tr><td>foo</td></tr></table>
12748
12749 !!end
12750
12751 !!test
12752 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12753 !! wikitext
12754 <table><tr><td>foo{{echo|</td>}}</tr></table>
12755 !! html
12756 <table><tr><td>foo</td></tr></table>
12757
12758 !!end
12759
12760 !!test
12761 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12762 !! wikitext
12763 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12764 !! html
12765 <table><tr><td>foo</td></tr></table>
12766
12767 !!end
12768
12769 !!test
12770 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12771 !! wikitext
12772 <table><tr><td>foo</td></tr>{{echo|</table>}}
12773 !! html
12774 <table><tr><td>foo</td></tr></table>
12775
12776 !!end
12777
12778 !!test
12779 Templates: HTML Tables: 5. Proper fostering of categories from inside
12780 !!options
12781 parsoid=wt2html,wt2wt
12782 !! wikitext
12783 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12784 <!--Two categories (T52330)-->
12785 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12786 !! html
12787 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12788 <!--Two categories (T52330)-->
12789 <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>
12790 !!end
12791
12792 !!test
12793 Templates: Wiki Tables: 1a. Fostering of entire template content
12794 !! wikitext
12795 {|
12796 {{echo|a}}
12797 |}
12798 !! html
12799 <table>
12800 a
12801 <tr><td></td></tr></table>
12802
12803 !! html+tidy
12804 <p>a</p>
12805 <table>
12806 <tr>
12807 <td></td>
12808 </tr>
12809 </table>
12810 !! end
12811
12812 !!test
12813 Templates: Wiki Tables: 1b. Fostering of entire template content
12814 !! wikitext
12815 {|
12816 {{echo|<div>}}
12817 foo
12818 {{echo|</div>}}
12819 |}
12820 !! html
12821 <table>
12822 <div>
12823 <p>foo
12824 </p>
12825 </div>
12826 <tr><td></td></tr></table>
12827
12828 !! html+tidy
12829 <div>
12830 <p>foo</p>
12831 </div>
12832 <table>
12833 <tr>
12834 <td></td>
12835 </tr>
12836 </table>
12837 !! end
12838
12839 !!test
12840 Templates: Wiki Tables: 2. Fostering of partial template content
12841 !! wikitext
12842 {|
12843 {{echo|a
12844 <div>b</div>}}
12845 |}
12846 !! html
12847 <table>
12848 a
12849 <div>b</div>
12850 <tr><td></td></tr></table>
12851
12852 !! html+tidy
12853 <p>a</p>
12854 <div>b</div>
12855 <table>
12856 <tr>
12857 <td></td>
12858 </tr>
12859 </table>
12860 !! end
12861
12862 !!test
12863 Templates: Wiki Tables: 3. td-content via multiple templates
12864 !! wikitext
12865 {|
12866 {{echo|{{pipe}}a}}{{echo|b}}
12867 |}
12868 !! html
12869 <table>
12870 <tr>
12871 <td>ab
12872 </td></tr></table>
12873
12874 !!end
12875
12876 !!test
12877 Templates: Wiki Tables: 4. Templated tags, no content
12878 !! wikitext
12879 {{tbl-start}}
12880 {{tbl-end}}
12881 !! html
12882 <table>
12883 <tr><td></td></tr></table>
12884
12885 !!end
12886
12887 !!test
12888 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12889 !! wikitext
12890 {{tbl-start}}
12891 |foo
12892 {{tbl-end}}
12893 !! html
12894 <table>
12895 <tr>
12896 <td>foo
12897 </td></tr></table>
12898
12899 !!end
12900
12901 !!test
12902 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12903 !! wikitext
12904 {{tbl-start}}
12905 {{!}}foo
12906 {{tbl-end}}
12907 !! html
12908 <table>
12909 <tr>
12910 <td>foo
12911 </td></tr></table>
12912
12913 !!end
12914
12915 ## This test case is very specific to Parsoid's internals
12916 ## and is hence only tested for Parsoid's code. Parsoid uses
12917 ## a <meta> marker tag for <ref> tags and they are expanded
12918 ## much later. We are verifying that this <meta> tag usage
12919 ## doesn't prevent foster parenting.
12920 !!test
12921 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12922 !!wikitext
12923 {{PartialTable}}<ref>foo</ref>
12924 |}
12925
12926 <references />
12927 !!html/parsoid
12928 <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">
12929 <tbody>
12930 </tbody></table>
12931
12932 <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>
12933 !!end
12934
12935 !! test
12936 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12937 !! wikitext
12938 {{echo|
12939 {{{!}}
12940 {{!}}-}}
12941 <onlyinclude>
12942 |foo
12943 </onlyinclude>
12944 {{!}}}
12945 !! html/parsoid
12946 <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{{!}}}"]}'>
12947 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12948 <tbody><tr>
12949
12950 <td>foo
12951 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12952 </tbody></table>
12953 !! end
12954
12955 !!test
12956 Templates: Lists: Multi-line list-items via templates
12957 !! wikitext
12958 *{{echo|a {{nonexistent|
12959 unused}}}}
12960 *{{echo|b {{nonexistent|
12961 unused}}}}
12962 !! html
12963 <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>
12964 <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>
12965
12966 !!end
12967
12968 !!test
12969 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12970 !! wikitext
12971 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12972 !! html
12973 <p><i>ab</i>c<i>d</i>e
12974 </p>
12975 !!end
12976
12977 !!test
12978 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12979 (PHP parser generates misnested html)
12980 !! wikitext
12981 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12982 !! html/parsoid
12983 <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>
12984 !!end
12985
12986 !!test
12987 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12988 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12989 !! options
12990 parsoid=wt2html,wt2wt
12991 !! wikitext
12992 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12993 !! html
12994 <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>
12995 <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>
12996 <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>
12997 !!end
12998
12999 !!test
13000 Templates: Ugly nesting: 4. Divs opened/closed across templates
13001 !! wikitext
13002 a<div>b{{echo|c</div>d}}e
13003 !! html
13004 a<div>bc</div>de
13005
13006 !! html+tidy
13007 <p>a</p>
13008 <div>bc</div>
13009 <p>de</p>
13010 !! end
13011
13012 !!test
13013 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
13014 (Parsoid-centric)
13015 !! options
13016 parsoid
13017 !! wikitext
13018 {|
13019 |{{echo|foo</table>}}
13020 |bar
13021 |}
13022 !! html
13023 <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|}"]}'>
13024
13025 <tbody>
13026 <tr>
13027 <td>foo</td></tr></tbody></table><span about="#mwt1">
13028 </span><span about="#mwt1">|bar</span><span about="#mwt1">
13029 |}</span>
13030 !!end
13031
13032 !!test
13033 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
13034 (Parsoid-centric)
13035 !! options
13036 parsoid
13037 !! wikitext
13038 <table>
13039 <tr>
13040 <td>
13041 <table>
13042 <tr>
13043 <td>1. {{echo|foo </table>}}</td>
13044 <td> bar </td>
13045 <td>2. {{echo|baz </table>}}</td>
13046 </tr>
13047 <tr>
13048 <td>abc</td>
13049 </tr>
13050 </table>
13051 </td>
13052 </tr>
13053 <tr>
13054 <td>xyz</td>
13055 </tr>
13056 </table>
13057 !! html
13058 <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>"]}'>
13059 <tbody><tr>
13060 <td>
13061 <table>
13062 <tbody><tr>
13063 <td>1. foo </td></tr></tbody></table></td>
13064 <td> bar </td>
13065 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
13066 </span><span about="#mwt2">
13067 </span><span about="#mwt2">
13068 </span><span about="#mwt2">abc</span><span about="#mwt2">
13069 </span><span about="#mwt2">
13070 </span><span about="#mwt2">
13071 </span><span about="#mwt2">
13072 </span><span about="#mwt2">
13073 </span><span about="#mwt2">
13074 </span><span about="#mwt2">xyz</span><span about="#mwt2">
13075 </span><span about="#mwt2">
13076 </span>
13077 !!end
13078
13079 !! test
13080 Templates: Ugly templates: 3. newline-only template parameter
13081 !! wikitext
13082 foo {{echo|
13083 }}
13084 !! html
13085 <p>foo
13086 </p>
13087 !! end
13088
13089 # This looks like a bug: a single newline triggers p/br for some reason.
13090 !! test
13091 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13092 !! wikitext
13093 {{echo|
13094 }}
13095 !! html
13096 <p><br />
13097 </p>
13098 !! end
13099
13100 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13101 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13102 !! test
13103 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13104 !! wikitext
13105 {{echo|<table>}}
13106 {{echo|<div>foo}}
13107 {{echo|</table>}}
13108 !! html/parsoid
13109 <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
13110 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13111 </table>
13112 !! end
13113
13114 # T66017 -- ugly wikitext with fostered content generates two template ranges
13115 # that are "identical" and generate nesting cycles in the algorithm
13116 !! test
13117 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13118 !! wikitext
13119 {{echo|<table><tr><td><table>}}
13120 {{echo|<div>}}
13121 {{echo|</div>}}
13122 !! html/parsoid
13123 <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"}'>
13124 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13125 </table></td></tr></tbody></table>
13126 !! end
13127
13128 !! test
13129 Templates: Parameters substituted at the top-level
13130 !! wikitext
13131 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13132
13133 {{{foo|bar|baz}}}
13134 !! html/php
13135 <p><i>who</i> me? <b>never!</b>
13136 </p><p>bar
13137 </p>
13138 !! html/parsoid
13139 <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>
13140
13141 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13142 !! end
13143
13144 !!test
13145 Parser Functions: 1. Simple example
13146 !! wikitext
13147 {{uc:foo}}
13148 !! html
13149 <p>FOO
13150 </p>
13151 !!end
13152
13153 !!test
13154 Parser Functions: 2. Nested use (only outermost should be marked up)
13155 !! wikitext
13156 {{uc:{{lc:FOO}}}}
13157 !! html
13158 <p>FOO
13159 </p>
13160 !!end
13161
13162 ###
13163 ### Pre-save transform tests
13164 ###
13165 !! test
13166 pre-save transform: subst:
13167 !! options
13168 pst
13169 !! wikitext
13170 {{subst:test}}
13171 !! html/php
13172 This is a test template
13173 !! end
13174
13175 !! test
13176 pre-save transform: normal template
13177 !! options
13178 pst
13179 !! wikitext
13180 {{test}}
13181 !! html/php
13182 {{test}}
13183 !! end
13184
13185 !! test
13186 pre-save transform: nonexistent template
13187 !! options
13188 pst
13189 !! wikitext
13190 {{thistemplatedoesnotexist}}
13191 !! html/php
13192 {{thistemplatedoesnotexist}}
13193 !! end
13194
13195 !! test
13196 pre-save transform: subst magic variables
13197 !! options
13198 pst
13199 !! wikitext
13200 {{subst:SITENAME}}
13201 !! html/php
13202 MediaWiki
13203 !! end
13204
13205 # This is T2089, which I fixed. -- wtm
13206 !! test
13207 pre-save transform: subst: templates with parameters
13208 !! options
13209 pst
13210 !! wikitext
13211 {{subst:paramtest|param="something else"}}
13212 !! html/php
13213 This is a test template with parameter "something else"
13214 !! end
13215
13216 !! article
13217 Template:nowikitest
13218 !! text
13219 <nowiki>'''not wiki'''</nowiki>
13220 !! endarticle
13221
13222 !! test
13223 pre-save transform: nowiki in subst (T3188)
13224 !! options
13225 pst
13226 !! wikitext
13227 {{subst:nowikitest}}
13228 !! html/php
13229 <nowiki>'''not wiki'''</nowiki>
13230 !! end
13231
13232 !! article
13233 Template:commenttest
13234 !! text
13235 This template has <!-- a comment --> in it.
13236 !! endarticle
13237
13238 !! test
13239 pre-save transform: comment in subst (T3936)
13240 !! options
13241 pst
13242 !! wikitext
13243 {{subst:commenttest}}
13244 !! html/php
13245 This template has <!-- a comment --> in it.
13246 !! end
13247
13248 !! test
13249 pre-save transform: unclosed tag
13250 !! options
13251 pst
13252 !! wikitext
13253 <nowiki>'''not wiki'''
13254 !! html/php
13255 <nowiki>'''not wiki'''
13256 !! end
13257
13258 !! test
13259 pre-save transform: mixed tag case
13260 !! options
13261 pst
13262 !! wikitext
13263 <NOwiki>'''not wiki'''</noWIKI>
13264 !! html/php
13265 <NOwiki>'''not wiki'''</noWIKI>
13266 !! end
13267
13268 !! test
13269 pre-save transform: unclosed comment in <nowiki>
13270 !! options
13271 pst
13272 !! wikitext
13273 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13274 !! html/php
13275 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13276 !!end
13277
13278 # Leading @ in this template definition works around a limitation
13279 # in parsoid's parserTests which otherwise strips the <span> from the
13280 # result (confusing it for a template wrapper)
13281 !! article
13282 Template:dangerous
13283 !!text
13284 @<span onmouseover="alert('crap')">Oh no</span>
13285 !!endarticle
13286
13287 !!test
13288 (confirming safety of fix for subst T3936)
13289 !! wikitext
13290 {{Template:dangerous}}
13291 !! html
13292 <p>@<span>Oh no</span>
13293 </p>
13294 !! end
13295
13296 !! test
13297 pre-save transform: comment containing gallery (T7024)
13298 !! options
13299 pst
13300 !! wikitext
13301 <!-- <gallery>data</gallery> -->
13302 !! html/php
13303 <!-- <gallery>data</gallery> -->
13304 !!end
13305
13306 !! test
13307 pre-save transform: comment containing extension
13308 !! options
13309 pst
13310 !! wikitext
13311 <!-- <tag>data</tag> -->
13312 !! html/php
13313 <!-- <tag>data</tag> -->
13314 !!end
13315
13316 !! test
13317 pre-save transform: comment containing nowiki
13318 !! options
13319 pst
13320 !! wikitext
13321 <!-- <nowiki>data</nowiki> -->
13322 !! html/php
13323 <!-- <nowiki>data</nowiki> -->
13324 !!end
13325
13326 !! test
13327 pre-save transform: <noinclude> in subst (T5298)
13328 !! options
13329 pst
13330 !! wikitext
13331 {{subst:Includes}}
13332 !! html/php
13333 Foobar
13334 !! end
13335
13336 !! test
13337 pre-save transform: <onlyinclude> in subst (T5298)
13338 !! options
13339 pst
13340 !! wikitext
13341 {{subst:Includes2}}
13342 !! html/php
13343 Foo
13344 !! end
13345
13346 !! article
13347 Template:SubstTest
13348 !!text
13349 {{<includeonly>subst:</includeonly>Includes}}
13350 !! endarticle
13351
13352 !! article
13353 Template:SafeSubstTest
13354 !! text
13355 {{<includeonly>safesubst:</includeonly>Includes}}
13356 !! endarticle
13357
13358 !! test
13359 T24297: safesubst: works during PST
13360 !! options
13361 pst
13362 !! wikitext
13363 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13364 !! html/php
13365 FoobarFoobar
13366 !! end
13367
13368 !! test
13369 T24297: safesubst: works during normal parse
13370 !! wikitext
13371 {{SafeSubstTest}}
13372 !! html
13373 <p>Foobar
13374 </p>
13375 !! end
13376
13377 !! test
13378 subst: does not work during normal parse
13379 !! wikitext
13380 {{SubstTest}}
13381 !! html
13382 <p>{{subst:Includes}}
13383 </p>
13384 !! end
13385
13386 !! test
13387 pre-save transform: context links ("pipe trick")
13388 !! options
13389 pst
13390 !! wikitext
13391 [[Article (context)|]]
13392 [[Bar:Article|]]
13393 [[:Bar:Article|]]
13394 [[Bar:Article (context)|]]
13395 [[:Bar:Article (context)|]]
13396 [[|Article]]
13397 [[|Article (context)]]
13398 [[Bar:X (Y) Z|]]
13399 [[:Bar:X (Y) Z|]]
13400 !! html/php
13401 [[Article (context)|Article]]
13402 [[Bar:Article|Article]]
13403 [[:Bar:Article|Article]]
13404 [[Bar:Article (context)|Article]]
13405 [[:Bar:Article (context)|Article]]
13406 [[Article]]
13407 [[Article (context)]]
13408 [[Bar:X (Y) Z|X (Y) Z]]
13409 [[:Bar:X (Y) Z|X (Y) Z]]
13410 !! end
13411
13412 !! test
13413 pre-save transform: context links ("pipe trick") with interwiki prefix
13414 !! options
13415 pst
13416 !! wikitext
13417 [[interwiki:Article|]]
13418 [[:interwiki:Article|]]
13419 [[interwiki:Bar:Article|]]
13420 [[:interwiki:Bar:Article|]]
13421 !! html/php
13422 [[interwiki:Article|Article]]
13423 [[:interwiki:Article|Article]]
13424 [[interwiki:Bar:Article|Bar:Article]]
13425 [[:interwiki:Bar:Article|Bar:Article]]
13426 !! end
13427
13428 !! test
13429 pre-save transform: context links ("pipe trick") with parens in title
13430 !! options
13431 pst title=[[Somearticle (context)]]
13432 !! wikitext
13433 [[|Article]]
13434 !! html/php
13435 [[Article (context)|Article]]
13436 !! end
13437
13438 !! test
13439 pre-save transform: context links ("pipe trick") with comma in title
13440 !! options
13441 pst title=[[Someplace, Somewhere]]
13442 !! wikitext
13443 [[|Otherplace]]
13444 [[Otherplace, Elsewhere|]]
13445 [[Otherplace, Elsewhere, Anywhere|]]
13446 !! html/php
13447 [[Otherplace, Somewhere|Otherplace]]
13448 [[Otherplace, Elsewhere|Otherplace]]
13449 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13450 !! end
13451
13452 !! test
13453 pre-save transform: context links ("pipe trick") with parens and comma
13454 !! options
13455 pst title=[[Someplace (IGNORED), Somewhere]]
13456 !! wikitext
13457 [[|Otherplace]]
13458 [[Otherplace (place), Elsewhere|]]
13459 !! html/php
13460 [[Otherplace, Somewhere|Otherplace]]
13461 [[Otherplace (place), Elsewhere|Otherplace]]
13462 !! end
13463
13464 !! test
13465 pre-save transform: context links ("pipe trick") with comma and parens
13466 !! options
13467 pst title=[[Who, me? (context)]]
13468 !! wikitext
13469 [[|Yes, you.]]
13470 [[Me, Myself, and I (1937 song)|]]
13471 !! html/php
13472 [[Yes, you. (context)|Yes, you.]]
13473 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13474 !! end
13475
13476 !! test
13477 pre-save transform: context links ("pipe trick") with namespace
13478 !! options
13479 pst title=[[Ns:Somearticle]]
13480 !! wikitext
13481 [[|Article]]
13482 !! html/php
13483 [[Ns:Article|Article]]
13484 !! end
13485
13486 !! test
13487 pre-save transform: context links ("pipe trick") with namespace and parens
13488 !! options
13489 pst title=[[Ns:Somearticle (context)]]
13490 !! wikitext
13491 [[|Article]]
13492 !! html/php
13493 [[Ns:Article (context)|Article]]
13494 !! end
13495
13496 !! test
13497 pre-save transform: context links ("pipe trick") with namespace and comma
13498 !! options
13499 pst title=[[Ns:Somearticle, Context, Whatever]]
13500 !! wikitext
13501 [[|Article]]
13502 !! html/php
13503 [[Ns:Article, Context, Whatever|Article]]
13504 !! end
13505
13506 !! test
13507 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13508 !! options
13509 pst title=[[Ns:Somearticle, Context (context)]]
13510 !! wikitext
13511 [[|Article]]
13512 !! html/php
13513 [[Ns:Article (context)|Article]]
13514 !! end
13515
13516 !! test
13517 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13518 !! options
13519 pst title=[[Ns:Somearticle (IGNORED), Context]]
13520 !! wikitext
13521 [[|Article]]
13522 !! html/php
13523 [[Ns:Article, Context|Article]]
13524 !! end
13525
13526 !! test
13527 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13528 !! options
13529 pst
13530 !! wikitext
13531 [[Article(context)|]]
13532 [[Bar:Article(context)|]]
13533 [[:Bar:Article(context)|]]
13534 [[|Article(context)]]
13535 [[Bar:X(Y)Z|]]
13536 [[:Bar:X(Y)Z|]]
13537 !! html/php
13538 [[Article(context)|Article]]
13539 [[Bar:Article(context)|Article]]
13540 [[:Bar:Article(context)|Article]]
13541 [[Article(context)]]
13542 [[Bar:X(Y)Z|X(Y)Z]]
13543 [[:Bar:X(Y)Z|X(Y)Z]]
13544 !! end
13545
13546 !! test
13547 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13548 !! options
13549 pst
13550 !! wikitext
13551 [[Article (context)|]]
13552 [[Bar:Article (context)|]]
13553 [[:Bar:Article (context)|]]
13554 [[|Article (context)]]
13555 [[Bar:X (Y) Z|]]
13556 [[:Bar:X (Y) Z|]]
13557 !! html/php
13558 [[Article (context)|Article]]
13559 [[Bar:Article (context)|Article]]
13560 [[:Bar:Article (context)|Article]]
13561 [[Article (context)]]
13562 [[Bar:X (Y) Z|X (Y) Z]]
13563 [[:Bar:X (Y) Z|X (Y) Z]]
13564 !! end
13565
13566 !! test
13567 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13568 !! options
13569 pst
13570 !! wikitext
13571 [[Article(context)|]]
13572 [[Bar:Article(context)|]]
13573 [[:Bar:Article(context)|]]
13574 [[|Article(context)]]
13575 [[Bar:X(Y)Z|]]
13576 [[:Bar:X(Y)Z|]]
13577 !! html/php
13578 [[Article(context)|Article]]
13579 [[Bar:Article(context)|Article]]
13580 [[:Bar:Article(context)|Article]]
13581 [[Article(context)]]
13582 [[Bar:X(Y)Z|X(Y)Z]]
13583 [[:Bar:X(Y)Z|X(Y)Z]]
13584 !! end
13585
13586 !! test
13587 pre-save transform: context links ("pipe trick") with commas (T23660)
13588 !! options
13589 pst
13590 !! wikitext
13591 [[Article (context), context|]]
13592 [[Article (context),context|]]
13593 [[Bar:Article (context), context|]]
13594 [[Bar:Article (context),context|]]
13595 [[:Bar:Article (context), context|]]
13596 [[:Bar:Article (context),context|]]
13597 !! html/php
13598 [[Article (context), context|Article]]
13599 [[Article (context),context|Article]]
13600 [[Bar:Article (context), context|Article]]
13601 [[Bar:Article (context),context|Article]]
13602 [[:Bar:Article (context), context|Article]]
13603 [[:Bar:Article (context),context|Article]]
13604 !! end
13605
13606 !! test
13607 Parsoid: backwards pipe trick
13608 !! wikitext
13609 [[|'''bar''']]
13610 !! html/php
13611 <p>[[|<b>bar</b>]]
13612 </p>
13613 !! html/parsoid
13614 <p>[[|<b>bar</b>]]</p>
13615 !! end
13616
13617 !! test
13618 pre-save transform: trim trailing empty lines
13619 !! options
13620 pst
13621 !! wikitext
13622 Empty lines are trimmed
13623
13624
13625
13626
13627 !! html/php
13628 Empty lines are trimmed
13629 !! end
13630
13631 !! test
13632 pre-save transform: Signature expansion
13633 !! options
13634 pst
13635 !! wikitext
13636 * ~~~
13637 * ~~~~
13638 * ~~~~~
13639 * <noinclude>~~~</noinclude>
13640 * <includeonly>~~~</includeonly>
13641 * <onlyinclude>~~~</onlyinclude>
13642 !! html/php
13643 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13644 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13645 * 00:02, 1 January 1970 (UTC)
13646 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13647 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13648 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13649 !! end
13650
13651
13652 !! test
13653 ParserOutput flags from signature expansion (T84843)
13654 !! options
13655 pst
13656 showflags
13657 !! wikitext
13658 ~~~~
13659 !! html/php
13660 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13661 flags=user-signature
13662 !! end
13663
13664
13665 !! test
13666 pre-save transform: Signature expansion in nowiki tags (T2093)
13667 !! options
13668 pst disabled
13669 !! wikitext
13670 Shall not expand:
13671
13672 <nowiki>~~~~</nowiki>
13673
13674 <includeonly><nowiki>~~~~</nowiki></includeonly>
13675
13676 <noinclude><nowiki>~~~~</nowiki></noinclude>
13677
13678 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13679
13680 {{subst:Foo}} shall be converted to FOO
13681
13682 As well as inside noinclude/onlyinclude
13683 <noinclude>{{subst:Foo}}</noinclude>
13684 <onlyinclude>{{subst:Foo}}</onlyinclude>
13685
13686 But not inside includeonly
13687 <includeonly>{{subst:Foo}}</includeonly>
13688 !! html/php
13689 Shall not expand:
13690
13691 <nowiki>~~~~</nowiki>
13692
13693 <includeonly><nowiki>~~~~</nowiki></includeonly>
13694
13695 <noinclude><nowiki>~~~~</nowiki></noinclude>
13696
13697 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13698
13699 FOO shall be converted to FOO
13700
13701 As well as inside noinclude/onlyinclude
13702 <noinclude>FOO</noinclude>
13703 <onlyinclude>FOO</onlyinclude>
13704
13705 But not inside includeonly
13706 <includeonly>{{subst:Foo}}</includeonly>
13707 !! end
13708
13709 !! test
13710 Parsoid: Recognize nowiki with trailing space in tags
13711 !! options
13712 parsoid=wt2html
13713 !! wikitext
13714 <nowiki ><div>[[foo]]</nowiki >
13715
13716 a<nowiki / >b
13717
13718 c<nowiki />d
13719
13720 e<nowiki/ >f
13721 !! html
13722 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13723 <p>ab</p>
13724 <p>cd</p>
13725 <p>ef</p>
13726 !! end
13727
13728 !! test
13729 Parsoid: Recognize nowiki with odd capitalization
13730 !! options
13731 parsoid=wt2html
13732 !! wikitext
13733 <noWikI ><div>[[foo]]</Nowiki >
13734 !! html
13735 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13736 !! end
13737
13738
13739 !! test
13740 Parsoid: Escape nowiki with trailing space in tags
13741 !! options
13742 parsoid=html2wt
13743 !! html/parsoid
13744 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13745 <p>a&lt;nowiki /&gt;b</p>
13746 <p>c&lt;nowiki/ &gt;d</p>
13747 !! wikitext
13748 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13749
13750 a&lt;nowiki /&gt;b
13751
13752 c&lt;nowiki/ &gt;d
13753 !! end
13754
13755 !! test
13756 Parsoid: Escape weird noWikI capitalizations
13757 !! options
13758 parsoid=html2wt
13759 !! html/parsoid
13760 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13761 !! wikitext
13762 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13763 !! end
13764
13765 ###
13766 ### Message transform tests
13767 ###
13768 !! test
13769 message transform: magic variables
13770 !! options
13771 msg
13772 !! wikitext
13773 {{SITENAME}}
13774 !! html
13775 MediaWiki
13776 !! end
13777
13778 !! test
13779 message transform: should not transform wiki markup
13780 !! options
13781 msg
13782 !! wikitext
13783 ''test''
13784 !! html
13785 ''test''
13786 !! end
13787
13788 !! test
13789 message transform: <noinclude> in transcluded template (T6926)
13790 !! options
13791 msg
13792 !! wikitext
13793 {{Includes}}
13794 !! html
13795 Foobar
13796 !! end
13797
13798 !! test
13799 message transform: <onlyinclude> in transcluded template (T6926)
13800 !! options
13801 msg
13802 !! wikitext
13803 {{Includes2}}
13804 !! html
13805 Foo
13806 !! end
13807
13808 !! test
13809 {{#special:}} page name, known
13810 !! options
13811 msg
13812 !! wikitext
13813 {{#special:Recentchanges}}
13814 !! html
13815 Special:RecentChanges
13816 !! end
13817
13818 !! test
13819 {{#special:}} page name with subpage, known
13820 !! options
13821 msg
13822 !! wikitext
13823 {{#special:Recentchanges/param}}
13824 !! html
13825 Special:RecentChanges/param
13826 !! end
13827
13828 !! test
13829 {{#special:}} page name, unknown
13830 !! options
13831 msg
13832 !! wikitext
13833 {{#special:foobar nonexistent}}
13834 !! html
13835 Special:Foobar nonexistent
13836 !! end
13837
13838 !! test
13839 {{#speciale:}} page name, known
13840 !! options
13841 msg
13842 !! wikitext
13843 {{#speciale:Recentchanges}}
13844 !! html
13845 Special:RecentChanges
13846 !! end
13847
13848 !! test
13849 {{#speciale:}} page name with subpage, known
13850 !! options
13851 msg
13852 !! wikitext
13853 {{#speciale:Recentchanges/param}}
13854 !! html
13855 Special:RecentChanges/param
13856 !! end
13857
13858 !! test
13859 {{#speciale:}} page name, unknown
13860 !! options
13861 msg
13862 !! wikitext
13863 {{#speciale:foobar nonexistent}}
13864 !! html
13865 Special:Foobar_nonexistent
13866 !! end
13867
13868 ###
13869 ### Images
13870 ###
13871 ### For Parsoid-specific tests, see
13872 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13873
13874 !! test
13875 Simple image
13876 !! options
13877 parsoid=wt2html,wt2wt,html2html
13878 !! wikitext
13879 [[Image:foobar.jpg]]
13880 !! html/php
13881 <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>
13882 </p>
13883 !! html/parsoid
13884 <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>
13885 !! end
13886
13887 !! test
13888 Simple image (using File: namespace, now canonical)
13889 !! wikitext
13890 [[File:Foobar.jpg]]
13891 !! html/php
13892 <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>
13893 </p>
13894 !! html/parsoid
13895 <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>
13896 !! end
13897
13898 !! test
13899 Right-aligned image
13900 !! wikitext
13901 [[File:Foobar.jpg|right]]
13902 !! html/php
13903 <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>
13904
13905 !! html/parsoid
13906 <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>
13907 !! end
13908
13909 !! test
13910 Image with caption
13911 !! wikitext
13912 [[File:Foobar.jpg|right|Caption text]]
13913 !! html/php
13914 <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>
13915
13916 !! html/parsoid
13917 <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>
13918 !! end
13919
13920 !! test
13921 Image with caption, T55312 #1
13922 !! wikitext
13923 [[File:Foobar.jpg|right|Caption page stuff]]
13924 !! html/php
13925 <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>
13926
13927 !! html/parsoid
13928 <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>
13929 !! end
13930
13931 !! test
13932 Image with caption, T55312 #2
13933 !! wikitext
13934 [[File:Foobar.jpg|right|Caption page=]]
13935 !! html/php
13936 <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>
13937
13938 !! html/parsoid
13939 <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>
13940 !! end
13941
13942 !! test
13943 Image with caption, T55312 #3
13944 !! wikitext
13945 [[File:Foobar.jpg|right|Caption page=stuff]]
13946 !! html/php
13947 <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>
13948
13949 !! html/parsoid
13950 <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>
13951 !! end
13952
13953 !! test
13954 Allow empty links in image captions (T62753)
13955 !! options
13956 thumbsize=220
13957 !! wikitext
13958 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13959 [[]]
13960 [[Link2]]
13961 ]]
13962 !! html/php
13963 <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>
13964
13965 !! html/parsoid
13966 <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>
13967 [[]]
13968 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13969 </figcaption></figure>
13970 !! end
13971
13972 !! test
13973 Titles in unlinked images (T23454)
13974 !! wikitext
13975 [[File:Foobar.jpg|link=|stuff]]
13976 !! html/php
13977 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13978 </p>
13979 !! end
13980
13981 !! test
13982 Link with empty target
13983 !! wikitext
13984 [[]]
13985 !! html
13986 <p>[[]]
13987 </p>
13988 !! end
13989
13990 !! test
13991 Image with link trail
13992 !! wikitext
13993 Linktrails should not work for images: [[File:Foobar.jpg]]s
13994 !! html/php
13995 <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
13996 </p>
13997 !! html/parsoid
13998 <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>
13999 !! end
14000
14001 !! test
14002 Image with empty attribute
14003 !! options
14004 parsoid=wt2html,wt2wt,html2html
14005 !! wikitext
14006 [[File:Foobar.jpg|right||Caption text]]
14007 !! html/php
14008 <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>
14009
14010 !! html/parsoid
14011 <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>
14012 !! end
14013
14014 !! test
14015 1. Block image with individual attributes from templates
14016 !! wikitext
14017 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14018 !! html/php
14019 <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>
14020
14021 !! html/parsoid
14022 <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>
14023 !! end
14024
14025 !! test
14026 2. Block Image with individual attributes from templates
14027 !! wikitext
14028 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14029 !! html/php
14030 <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>
14031
14032 !! html/parsoid
14033 <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>
14034 !! end
14035
14036 !! test
14037 3. Inline image with individual attributes from templates
14038 !! wikitext
14039 [[File:Foobar.jpg|{{echo|50px}}]]
14040 !! html/php
14041 <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>
14042 </p>
14043 !! html/parsoid
14044 <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>
14045 !! end
14046
14047 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14048 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14049 !! test
14050 Image with multiple attributes from the same template
14051 !! wikitext
14052 [[File:Foobar.jpg|{{image_attribs}}]]
14053 !! html/php
14054 <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>
14055
14056 !! html/parsoid
14057 <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>
14058 !! end
14059
14060 !! test
14061 Image with link tails
14062 !! options
14063 thumbsize=220
14064 !! wikitext
14065 123[[File:Foobar.jpg]]456
14066 123[[File:Foobar.jpg|right]]456
14067 123[[File:Foobar.jpg|thumb]]456
14068 !! html/php
14069 <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
14070 </p>
14071 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
14072 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
14073
14074 !! html/php+tidy
14075 <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>
14076 <p>123</p>
14077 <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>
14078 <p>456 123</p>
14079 <div class="thumb tright">
14080 <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>
14081 <div class="thumbcaption">
14082 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
14083 </div>
14084 </div>
14085 </div>
14086 <p>456</p>
14087 !! html/parsoid
14088 <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>
14089 <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>
14090 <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>
14091 !! end
14092
14093 !! test
14094 Image with multiple captions -- only last one is accepted
14095 !! wikitext
14096 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14097 !! html/php
14098 <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>
14099
14100 !! html/parsoid
14101 <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>
14102 !! end
14103
14104 !! test
14105 Image with multiple widths -- use last
14106 !! wikitext
14107 [[File:Foobar.jpg|200px|300px|caption]]
14108 !! html/php
14109 <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>
14110 </p>
14111 !! html/parsoid
14112 <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>
14113 !! end
14114
14115 !! test
14116 Image with multiple alignments -- use first (T50664)
14117 !! options
14118 thumbsize=220
14119 !! wikitext
14120 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14121
14122 [[File:Foobar.jpg|middle|text-top|caption]]
14123 !! html/php
14124 <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>
14125 <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>
14126 </p>
14127 !! html/parsoid
14128 <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>
14129 <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>
14130 !! end
14131
14132 !! test
14133 Image with width attribute at different positions
14134 !! wikitext
14135 [[File:Foobar.jpg|200px|right|Caption]]
14136 [[File:Foobar.jpg|right|200px|Caption]]
14137 [[File:Foobar.jpg|right|Caption|200px]]
14138 !! html/php
14139 <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>
14140 <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>
14141 <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>
14142
14143 !! html/parsoid
14144 <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>
14145 <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>
14146 <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>
14147 !! end
14148
14149 # a sad bit of backward-compatibility
14150 !! test
14151 Image with size specified with pxpx (T15500, T53628)
14152 !! options
14153 parsoid=wt2html,wt2wt,html2html
14154 !! wikitext
14155 [[File:Foobar.jpg|20pxpx]]
14156 [[File:Foobar.jpg|200x20pxpx]]
14157 !! html/php
14158 <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>
14159 <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>
14160 </p>
14161 !! html/parsoid
14162 <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>
14163 !! end
14164
14165 !! test
14166 Image with link parameter, wiki target
14167 !! wikitext
14168 [[File:Foobar.jpg|link=Main Page]]
14169 !! html/php
14170 <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>
14171 </p>
14172 !! html/parsoid
14173 <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>
14174 !! end
14175
14176 # parsoid T51293 (part 1)
14177 !! test
14178 Image with link parameter, URL target
14179 !! wikitext
14180 [[File:Foobar.jpg|link=http://example.com/]]
14181 !! html/php
14182 <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>
14183 </p>
14184 !! html/parsoid
14185 <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>
14186 !! end
14187
14188 # parsoid T51293 (part 2)
14189 !! test
14190 Image with link parameter, protocol-less URL target
14191 !! wikitext
14192 [[File:Foobar.jpg|link=//example.com/]]
14193 !! html/php
14194 <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>
14195 </p>
14196 !! html/parsoid
14197 <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>
14198 !! end
14199
14200 !! test
14201 Escaping non-block captions (T107435)
14202 !! options
14203 parsoid={
14204 "modes": ["wt2wt"],
14205 "changes": [
14206 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14207 ]
14208 }
14209 !! wikitext
14210 [[Image:Foobar.jpg|caption]]
14211 !! wikitext/edited
14212 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14213 !! end
14214
14215 # wgExternalLinkTarget not supported by Parsoid
14216 !! test
14217 Image with link parameter, wgExternalLinkTarget
14218 !! wikitext
14219 [[Image:foobar.jpg|link=http://example.com/]]
14220 !! config
14221 wgExternalLinkTarget='foobar'
14222 !! html/php
14223 <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>
14224 </p>
14225 !! end
14226
14227 !! test
14228 Image with link parameter, wgNoFollowLinks set to false
14229 !! wikitext
14230 [[Image:foobar.jpg|link=http://example.com/]]
14231 !! config
14232 wgNoFollowLinks=false
14233 !! html
14234 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14235 </p>
14236 !! end
14237
14238 !! test
14239 Image with link parameter, wgNoFollowDomainExceptions
14240 !! wikitext
14241 [[Image:foobar.jpg|link=http://example.com/]]
14242 !! config
14243 wgNoFollowDomainExceptions='example.com'
14244 !! html
14245 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14246 </p>
14247 !! end
14248
14249 # wgExternalLinkTarget not supported by Parsoid
14250 !! test
14251 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14252 !! wikitext
14253 [[Image:foobar.jpg|link=http://example.com/|Title]]
14254 !! config
14255 wgExternalLinkTarget='foobar'
14256 !! html/php
14257 <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>
14258 </p>
14259 !! end
14260
14261 !! test
14262 Image with empty link parameter
14263 !! wikitext
14264 [[File:Foobar.jpg|link=]]
14265 !! html/php
14266 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14267 </p>
14268 !! html/parsoid
14269 <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>
14270 !! end
14271
14272 !! test
14273 Image with link parameter (wiki target) and unnamed parameter
14274 !! wikitext
14275 [[File:Foobar.jpg|link=Main_Page|Title]]
14276 !! html/php
14277 <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>
14278 </p>
14279 !! html/parsoid
14280 <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>
14281 !! end
14282
14283 !! test
14284 Image with link parameter (URL target) and unnamed parameter
14285 !! wikitext
14286 [[File:Foobar.jpg|link=http://example.com/|Title]]
14287 !! html/php
14288 <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>
14289 </p>
14290 !! html/parsoid
14291 <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>
14292 !! end
14293
14294 !! test
14295 Thumbnail image with link parameter
14296 !! options
14297 thumbsize=220
14298 parsoid=wt2html,wt2wt,html2html
14299 !! wikitext
14300 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14301 !! html/php
14302 <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>
14303
14304 !! html/parsoid
14305 <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>
14306 !! end
14307
14308 !! test
14309 Manually-specified thumbnail image
14310 !! options
14311 thumbsize=220
14312 !! wikitext
14313 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14314 !! html/php
14315 <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>
14316
14317 !! html/parsoid
14318 <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>
14319 !! end
14320
14321 !! test
14322 Manually-specified thumbnail image with explicit link to wiki page
14323 !! options
14324 thumbsize=220
14325 parsoid=wt2html,wt2wt,html2html
14326 !! wikitext
14327 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14328 !! html/php
14329 <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>
14330
14331 !! html/parsoid
14332 <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>
14333 !! end
14334
14335 !! test
14336 Manually-specified thumbnail image with explicit link to url
14337 !! options
14338 thumbsize=220
14339 parsoid=wt2html,wt2wt,html2html
14340 !! wikitext
14341 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14342 !! html/php
14343 <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>
14344
14345 !! html/parsoid
14346 <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>
14347 !! end
14348
14349 !! test
14350 Manually-specified thumbnail image with explicit no link
14351 !! options
14352 thumbsize=220
14353 parsoid=wt2html,wt2wt,html2html
14354 !! wikitext
14355 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14356 !! html/php
14357 <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>
14358
14359 !! html/parsoid
14360 <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>
14361 !! end
14362
14363 !! test
14364 Manually-specified thumbnail image with explicit link and alt text
14365 !! options
14366 thumbsize=220
14367 parsoid=wt2html,wt2wt,html2html
14368 !! wikitext
14369 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14370 !! html/php
14371 <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>
14372
14373 !! html/parsoid
14374 <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>
14375 !! end
14376
14377 !! test
14378 Image with frame and link
14379 !! options
14380 parsoid=wt2html,wt2wt,html2html
14381 !! wikitext
14382 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14383 !! html/php
14384 <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>
14385
14386 !! html/parsoid
14387 <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>
14388 !! end
14389
14390 !! test
14391 Image with frame and link and explicit alt
14392 !! options
14393 parsoid=wt2html,wt2wt,html2html
14394 !! wikitext
14395 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14396 !! html/php
14397 <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>
14398
14399 !! html/parsoid
14400 <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>
14401 !! end
14402
14403 !! test
14404 Image with wiki markup in implicit alt
14405 !! wikitext
14406 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14407
14408 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14409 !! html/php
14410 <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>
14411 </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>
14412 </p>
14413 !! html/parsoid
14414 <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>
14415
14416 <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>
14417 !! end
14418
14419 !! test
14420 Alt image option should handle most kinds of wikitext without barfing
14421 !! wikitext
14422 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14423 !! html/php
14424 <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>
14425
14426 !! html/parsoid
14427 <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>
14428 !! end
14429
14430 ###################
14431 # Conflicting image format options.
14432 # First option specified should 'win'.
14433 # All three cases in each test should be identical.
14434
14435 !! test
14436 Image with 'frameless' first.
14437 !! options
14438 parsoid=wt2html,wt2wt,html2html
14439 !! wikitext
14440 [[File:Foobar.jpg|frameless|caption]]
14441
14442 [[File:Foobar.jpg|frameless|frame|caption]]
14443
14444 [[File:Foobar.jpg|frameless|thumb|caption]]
14445 !! html/php
14446 <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>
14447 </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>
14448 </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>
14449 </p>
14450 !! html/parsoid
14451 <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>
14452 <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>
14453 <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>
14454 !! end
14455
14456 !! test
14457 Image with 'frame' first.
14458 !! options
14459 parsoid=wt2html,wt2wt,html2html
14460 !! wikitext
14461 [[File:Foobar.jpg|frame|caption]]
14462 [[File:Foobar.jpg|frame|frameless|caption]]
14463 [[File:Foobar.jpg|frame|thumb|caption]]
14464 !! html/php
14465 <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>
14466 <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>
14467 <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>
14468
14469 !! html/parsoid
14470 <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>
14471 <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>
14472 <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>
14473 !! end
14474
14475 !! test
14476 Image with 'thumb' first.
14477 !! options
14478 parsoid=wt2html,wt2wt,html2html
14479 !! wikitext
14480 [[File:Foobar.jpg|thumb|caption]]
14481 [[File:Foobar.jpg|thumb|frameless|caption]]
14482 [[File:Foobar.jpg|thumb|frame|caption]]
14483 !! html/php
14484 <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>
14485 <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>
14486 <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>
14487
14488 !! html/parsoid
14489 <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>
14490 <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>
14491 <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>
14492 !! end
14493
14494 ###################
14495 # Image sizing.
14496 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
14497 # and https://phabricator.wikimedia.org/T64258
14498 # Foobar has actual size of 1941x220
14499 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
14500 # a scalable format.
14501 # 2. Framed images always ignore size options; always render at default size.
14502 # 3. "Unspecified format" and border are the only types which can be
14503 # enlarged.
14504
14505 !! test
14506 Image: "unspecified format" and border enlarge
14507 !! options
14508 parsoid=wt2html,wt2wt,html2html
14509 !! wikitext
14510 [[File:Foobar.jpg|2000px]]
14511
14512 [[File:Foobar.jpg|border|2000px]]
14513 !! html/php
14514 <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>
14515 </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>
14516 </p>
14517 !! html/parsoid
14518 <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>
14519 <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>
14520 !! end
14521
14522 !! test
14523 Image: "unspecified format" and border reduce
14524 !! options
14525 parsoid=wt2html,wt2wt,html2html
14526 !! wikitext
14527 [[File:Foobar.jpg|1000px]]
14528
14529 [[File:Foobar.jpg|border|1000px]]
14530 !! html/php
14531 <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>
14532 </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>
14533 </p>
14534 !! html/parsoid
14535 <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>
14536 <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>
14537 !! end
14538
14539 !! test
14540 Image: thumbs reduce
14541 !! options
14542 parsoid=wt2html,wt2wt,html2html
14543 !! wikitext
14544 [[File:Foobar.jpg|thumb|50px]]
14545 !! html/php
14546 <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>
14547
14548 !! html/parsoid
14549 <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>
14550 !! end
14551
14552 !! test
14553 Image: bitmap thumbs can't be enlarged past original size, but vector can.
14554 !! options
14555 parsoid=wt2html,wt2wt,html2html
14556 !! wikitext
14557 [[File:Foobar.jpg|thumb|2000px]]
14558
14559 [[File:Foobar.svg|thumb|2000px]]
14560 !! html/php
14561 <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>
14562 <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>
14563
14564 !! html/parsoid
14565 <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>
14566 <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>
14567 !! end
14568
14569 !! test
14570 Image: frameless can reduce in size
14571 !! options
14572 parsoid=wt2html,wt2wt,html2html
14573 !! wikitext
14574 [[File:Foobar.jpg|frameless|50px]]
14575 !! html/php
14576 <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>
14577 </p>
14578 !! html/parsoid
14579 <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>
14580 !! end
14581
14582 !! test
14583 Image: bitmap frameless can't be enlarged past original size, but vector can
14584 !! options
14585 parsoid=wt2html,wt2wt,html2html
14586 !! wikitext
14587 [[File:Foobar.jpg|frameless|2000px]]
14588
14589 [[File:Foobar.svg|frameless|2000px]]
14590 !! html/php
14591 <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>
14592 </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>
14593 </p>
14594 !! html/parsoid
14595 <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>
14596 <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>
14597 !! end
14598
14599 !! test
14600 Image: framed images are always unscaled.
14601 !! options
14602 parsoid=wt2html,wt2wt,html2html
14603 !! wikitext
14604 [[File:Foobar.jpg|frame]]
14605
14606 [[File:Foobar.jpg|frame|50px]]
14607
14608 [[File:Foobar.jpg|frame|50x50px]]
14609
14610 [[File:Foobar.jpg|frame|2000px]]
14611 !! html/php
14612 <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>
14613 <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>
14614 <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>
14615 <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>
14616
14617 !! html/parsoid
14618 <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>
14619 <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>
14620 <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>
14621 <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>
14622 !! end
14623
14624 ###################
14625
14626 !! test
14627 Link to image page- image page normally doesn't exists, hence edit link
14628 Add test with existing image page
14629 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14630 !! wikitext
14631 [[:Image:test]]
14632 !! html
14633 <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>
14634 </p>
14635 !! end
14636
14637 !! test
14638 T20784 Link to non-existent image page with caption should use caption as link text
14639 !! wikitext
14640 [[:Image:test|caption]]
14641 !! html
14642 <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>
14643 </p>
14644 !! end
14645
14646 !! test
14647 Frameless image caption with a free URL
14648 !! wikitext
14649 [[File:Foobar.jpg|http://example.com]]
14650 !! html/php
14651 <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>
14652 </p>
14653 !! html/parsoid
14654 <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>
14655 !! end
14656
14657 !! test
14658 Thumbnail image caption with a free URL
14659 !! options
14660 thumbsize=220
14661 !! wikitext
14662 [[File:Foobar.jpg|thumb|http://example.com]]
14663 !! html/php
14664 <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>
14665
14666 !! html/parsoid
14667 <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>
14668 !! end
14669
14670 !! test
14671 Thumbnail image caption with a free URL and explicit alt
14672 !! options
14673 thumbsize=220
14674 parsoid=wt2html,wt2wt,html2html
14675 !! wikitext
14676 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14677 !! html/php
14678 <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>
14679
14680 !! html/parsoid
14681 <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>
14682 !! end
14683
14684 !! test
14685 SVG thumbnails with no language set
14686 !! options
14687 !! wikitext
14688 [[File:Foobar.svg|thumb|caption]]
14689 !! html/php
14690 <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>
14691
14692 !! html/parsoid
14693 <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>
14694 !! end
14695
14696 !! test
14697 SVG thumbnails with language de
14698 !! options
14699 parsoid=wt2html,wt2wt,html2html
14700 !! wikitext
14701 [[File:Foobar.svg|thumb|caption|lang=de]]
14702 !! html/php
14703 <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>
14704
14705 !! html/parsoid
14706 <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>
14707 !! end
14708
14709 !! test
14710 SVG thumbnails with invalid language code
14711 !! options
14712 parsoid=wt2html,wt2wt,html2html
14713 !! wikitext
14714 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14715 !! html/php
14716 <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>
14717
14718 !! html/parsoid
14719 <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>
14720 !! end
14721
14722 !! test
14723 T3887: A ISBN with a thumbnail
14724 !! wikitext
14725 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14726 !! html/php
14727 <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>
14728
14729 !! html/parsoid
14730 <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>
14731 !! end
14732
14733 !! test
14734 T3887: A RFC with a thumbnail
14735 !! wikitext
14736 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14737 !! html/php
14738 <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>
14739
14740 !! html/parsoid
14741 <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>
14742 !! end
14743
14744 !! test
14745 T3887: A mailto link with a thumbnail
14746 !! wikitext
14747 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14748 !! html/php
14749 <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>
14750
14751 !! html/parsoid
14752 <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>
14753 !! end
14754
14755 # Pending resolution to T2368
14756 !! test
14757 T2648: Frameless image caption with a link
14758 !! wikitext
14759 [[File:Foobar.jpg|text with a [[link]] in it]]
14760 !! html/php
14761 <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>
14762 </p>
14763 !! html/parsoid
14764 <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>
14765 !! end
14766
14767 !! test
14768 T2648: Frameless image caption with a link (suffix)
14769 !! wikitext
14770 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14771 !! html/php
14772 <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>
14773 </p>
14774 !! html/parsoid
14775 <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>
14776 !! end
14777
14778 !! test
14779 T2648: Frameless image caption with an interwiki link
14780 !! wikitext
14781 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14782 !! html/php
14783 <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>
14784 </p>
14785 !! html/parsoid
14786 <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>
14787 !! end
14788
14789 !! test
14790 T2648: Frameless image caption with a piped interwiki link
14791 !! wikitext
14792 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14793 !! html/php
14794 <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>
14795 </p>
14796 !! html/parsoid
14797 <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>
14798 !! end
14799
14800 !! test
14801 T107474: Frameless image caption with <nowiki>
14802 !! wikitext
14803 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14804 !! html/parsoid
14805 <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>
14806 !! end
14807
14808 !! test
14809 Escape HTML special chars in image alt text
14810 !! wikitext
14811 [[File:Foobar.jpg|& < > "]]
14812 !! html/php
14813 <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>
14814 </p>
14815 !! html/parsoid
14816 <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>
14817 !! end
14818
14819 !! test
14820 Escape HTML special chars in image alt text with LanguageConverter
14821 !! options
14822 language=zh
14823 !! wikitext
14824 [[File:Foobar.jpg|& < > "]]
14825 !! html/php
14826 <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>
14827 </p>
14828 !! html/parsoid
14829 <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>
14830 !! end
14831
14832 !! test
14833 Entities in file name and attributes
14834 !! wikitext
14835 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14836 !! html/php
14837 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14838 </p>
14839 !! html/parsoid
14840 <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":"apierror-filedoesnotexist","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>
14841 !! end
14842
14843 !! test
14844 T2499: Alt text should have &#1234;, not &amp;1234;
14845 !! wikitext
14846 [[File:Foobar.jpg|&#9792;]]
14847 !! html/php
14848 <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>
14849 </p>
14850 !! html/parsoid
14851 <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>
14852 !! end
14853
14854 !! test
14855 Broken image caption with link
14856 !! options
14857 parsoid=wt2html,wt2wt,html2html
14858 !! wikitext
14859 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14860 !! html/php
14861 <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.
14862 </p>
14863 !! html/parsoid
14864 <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>
14865 !! end
14866
14867 !! test
14868 Image caption containing another image
14869 !! wikitext
14870 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14871 !! html/php
14872 <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>
14873
14874 !! html/parsoid
14875 <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>
14876 !! end
14877
14878 !! test
14879 Image: caption containing a newline
14880 !! wikitext
14881 [[File:Foobar.jpg|This
14882 *is some text]]
14883 !! html/php
14884 <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>
14885 </p>
14886 !! html/parsoid
14887 <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>
14888 !!end
14889
14890 !!test
14891 Image: caption containing leading space
14892 (The leading space should not trigger nowiki escaping in wt2wt mode)
14893 !! wikitext
14894 [[File:Foobar.jpg|thumb| bar]]
14895 !! html/php
14896 <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>
14897
14898 !! html/parsoid
14899 <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>
14900 !!end
14901
14902 !! test
14903 Image: caption containing a table
14904 !! options
14905 parsoid=wt2html,wt2wt,html2html
14906 !! wikitext
14907 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14908 {|
14909 ! Foo !! Bar
14910 |-
14911 | Foo1 || Bar1
14912 |}
14913 and some more text.]]
14914 !! html/php
14915 <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>
14916
14917 !! html/parsoid
14918 <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
14919 <table>
14920 <tbody>
14921 <tr><th>Foo </th><th>Bar</th></tr>
14922 <tr>
14923 <td>Foo1 </td>
14924 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14925 !! end
14926
14927 !! test
14928 T5090: External links other than http: in image captions
14929 !! wikitext
14930 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14931 !! html/php
14932 <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>
14933
14934 !! html/parsoid
14935 <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>
14936 !! end
14937
14938 !! test
14939 Custom class
14940 !! options
14941 parsoid=wt2html,wt2wt,html2html
14942 !! wikitext
14943 [[Image:foobar.jpg|a|class=b]]
14944 !! html/php
14945 <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>
14946 </p>
14947 !! html/parsoid
14948 <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>
14949 !! end
14950
14951 !! test
14952 Localized image handling (1).
14953 !! options
14954 parsoid=wt2html,wt2wt,html2html
14955 language=es
14956 !! wikitext
14957 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14958 !! html/php
14959 <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>
14960
14961 !! html/parsoid
14962 <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>
14963 !! end
14964
14965 !! test
14966 Localized image handling (2).
14967 !! options
14968 thumbsize=220
14969 parsoid=wt2html,wt2wt,html2html
14970 language=es
14971 !! wikitext
14972 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14973 !! html/php
14974 <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>
14975
14976 !! html/parsoid
14977 <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>
14978 !! end
14979
14980 !! test
14981 Localized image handling (3).
14982 !! options
14983 language=fa
14984 parsoid=html2wt
14985 !! html/parsoid
14986 <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>
14987 !! wikitext
14988 [[File:Foobar.jpg|بندانگشتی]]
14989 !! end
14990
14991 !! test
14992 "border", "frameless" and "class" attributes on an image.
14993 !! options
14994 thumbsize=220
14995 parsoid=wt2html,wt2wt,html2html
14996 !! wikitext
14997 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14998 !! html/php
14999 <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>
15000 </p>
15001 !! html/parsoid
15002 <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>
15003 !! end
15004
15005 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15006 !! test
15007 Invalid image attributes (T64500)
15008 !! options
15009 thumbsize=220
15010 parsoid=wt2html,wt2wt,html2html
15011 !! wikitext
15012 [[File:Foobar.jpg|thumb|float|left|caption]]
15013
15014 [[File:Foobar.jpg|thumb|righ|caption]]
15015
15016 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15017 !! html/php
15018 <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>
15019 <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>
15020 <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>
15021
15022 !! html/parsoid
15023 <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>
15024 <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>
15025 <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>
15026 !! end
15027
15028 !! article
15029 File:Barfoo.jpg
15030 !! text
15031 #REDIRECT [[File:Barfoo.jpg]]
15032 !! endarticle
15033
15034 # FIXME: Parsoid should run this test -- but we'd need to teach the
15035 # mockAPI about the redirected Barfoo.jpg image.
15036 !! test
15037 Redirected image
15038 !! wikitext
15039 [[Image:Barfoo.jpg]]
15040 !! html/php
15041 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15042 </p>
15043 !! end
15044
15045 !! test
15046 Missing image with uploads disabled
15047 !! options
15048 wgEnableUploads=0
15049 !! wikitext
15050 [[File:Foobaz.jpg]]
15051 !! html/php
15052 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15053 </p>
15054 !! html/parsoid
15055 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","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>
15056 !! end
15057
15058 # Parsoid-specific testing for images
15059 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15060 # Currently imperfect due to a flaw in the Parsoid testrunner
15061 # Work in progress
15062 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15063 # image tests.
15064
15065 !! test
15066 Parsoid-specific image handling - simple image with size and middle alignment
15067 !! wikitext
15068 [[File:Foobar.jpg|middle|50px]]
15069 !! html/parsoid
15070 <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>
15071 !! end
15072
15073 !! test
15074 Parsoid-specific image handling - simple image with size, middle alignment,
15075 non-standard namespace alias
15076 !! options
15077 parsoid=wt2wt,wt2html,html2html
15078 !! wikitext
15079 [[Image:Foobar.jpg|middle|50px]]
15080 !! html/parsoid
15081 <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>
15082 !! end
15083
15084 !! test
15085 Parsoid-specific image handling - simple image with size and middle alignment
15086 (existing content)
15087 !! wikitext
15088 [[File:Foobar.jpg|50px|middle]]
15089 !! html/parsoid
15090 <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>
15091 !! end
15092
15093 !! test
15094 Parsoid-specific image handling - simple image with size and middle alignment
15095 and non-standard namespace name
15096 !! options
15097 parsoid=wt2html,wt2wt,html2html
15098 !! wikitext
15099 [[Image:Foobar.jpg|50px|middle]]
15100 !! html/parsoid
15101 <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>
15102 !! end
15103
15104 !! test
15105 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15106 !! wikitext
15107 [[File:Foobar.jpg|500x10px|baseline|caption]]
15108 !! html/parsoid
15109 <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>
15110 !! end
15111
15112 !! test
15113 Parsoid-specific image handling - simple image with border and size spec
15114 !! wikitext
15115 [[File:Foobar.jpg|50px|border|caption]]
15116 !! html/parsoid
15117 <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>
15118 !! end
15119
15120 !! test
15121 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15122 !! wikitext
15123 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15124 !! html/parsoid
15125 <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>
15126 !! end
15127
15128 !! test
15129 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15130 (existing content)
15131 !! wikitext
15132 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15133 !! html/parsoid
15134 <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>
15135 !! end
15136
15137 !! test
15138 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15139 !! wikitext
15140 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15141 !! html/parsoid
15142 <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>
15143 !! end
15144
15145 !! test
15146 Parsoid-specific image handling - thumbnail with specific size, halign,
15147 valign, and caption (existing content)
15148 !! wikitext
15149 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15150 !! html/parsoid
15151 <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>
15152 !! end
15153
15154 !! test
15155 Parsoid-specific image handling - framed image with specific size and caption
15156 (size is ignored)
15157 !! options
15158 parsoid=wt2html,wt2wt,html2html
15159 !! wikitext
15160 [[File:Foobar.jpg|frame|500x50px|caption]]
15161 !! html/parsoid
15162 <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>
15163 !! end
15164
15165 !! test
15166 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
15167 (size is ignored)
15168 !! options
15169 parsoid=wt2html,wt2wt,html2html
15170 !! wikitext
15171 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15172 !! html/parsoid
15173 <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>
15174 !! end
15175
15176 !! test
15177 Parsoid-specific image handling - frameless image with specific size, border, and caption
15178 !! wikitext
15179 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15180 !! html/parsoid
15181 <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>
15182 !! end
15183
15184 !! test
15185 Parsoid-specific image handling - simple image with a formatted caption
15186 !! wikitext
15187 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15188 !! html/parsoid
15189 <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>
15190 !! end
15191
15192 !! test
15193 Parsoid-specific image handling - caption with a template in it
15194 !! wikitext
15195 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15196 !! html/parsoid
15197 <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>
15198 !! end
15199
15200 !! test
15201 Parsoid-specific image handling - caption with unbalanced tags in it
15202 !! options
15203 parsoid=wt2html,wt2wt,html2html
15204 !! wikitext
15205 foo
15206 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15207 bar
15208 !! html/parsoid
15209 <p>foo</p>
15210 <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>
15211 <p>bar</p>
15212 !! end
15213
15214 !! test
15215 Parsoid-specific image handling - empty caption (1)
15216 !! options
15217 parsoid=wt2html,wt2wt
15218 !! wikitext
15219 [[File:Foobar.jpg|thumb|]]
15220 !! html/parsoid
15221 <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>
15222 !! end
15223
15224 # empty captions don't get serialized unless we're in the "round trip" case
15225 !! test
15226 Parsoid-specific image handling - empty caption (2)
15227 !! options
15228 parsoid=html2wt
15229 !! html/parsoid
15230 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15231 <a href="./File:Foobar.jpg">
15232 <img resource="./File:Foobar.jpg"
15233 src="//example.com/images/3/3a/Foobar.jpg"
15234 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15235 height="25" width="220"/>
15236 </a>
15237 <figcaption></figcaption>
15238 </figure>
15239 !! wikitext
15240 [[File:Foobar.jpg|thumb]]
15241 !! end
15242
15243 !! test
15244 Parsoid-specific image handling - whitespace caption
15245 !! wikitext
15246 [[File:Foobar.jpg|thumb| ]]
15247 !! html/parsoid
15248 <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>
15249 !! end
15250
15251 !! test
15252 Parsoid-specific image handling - lang option
15253 !! wikitext
15254 foo
15255 [[File:Foobar.svg|lang=de|caption]]
15256 bar
15257 !! html/parsoid
15258 <p>foo
15259 <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>
15260 bar</p>
15261 !! end
15262
15263 ## Edge case bugs in Parsoid from T93580
15264 !! test
15265 T93580: 1. Templated <ref> inside block images
15266 !! wikitext
15267 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15268
15269 <references />
15270 !! html/parsoid
15271 <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>
15272
15273 <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>
15274 !! end
15275
15276 !! test
15277 T93580: 2. <ref> inside inline images
15278 !! wikitext
15279 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15280
15281 <references />
15282 !! html/parsoid
15283 <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>
15284
15285 <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>
15286 !! end
15287
15288 !! test
15289 T93580: 3. Templated <ref> inside inline images
15290 !! wikitext
15291 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15292
15293 <references />
15294 !! html/parsoid
15295 <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>
15296
15297 <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>
15298 !! end
15299
15300 ###
15301 ### Subpages
15302 ###
15303 !! article
15304 Subpage test/subpage
15305 !! text
15306 foo
15307 !! endarticle
15308
15309 !! test
15310 Subpage link
15311 !! options
15312 subpage title=[[Subpage test]]
15313 !! wikitext
15314 [[/subpage]]
15315 !! html
15316 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15317 </p>
15318 !! end
15319
15320 !! test
15321 Subpage noslash link
15322 !! options
15323 subpage title=[[Subpage test]]
15324 !! wikitext
15325 [[/subpage/]]
15326 !! html
15327 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15328 </p>
15329 !! end
15330
15331 !! article
15332 Subpage test/1/2/subpage
15333 !! text
15334 blah
15335 !! endarticle
15336
15337 !! test
15338 Relative subpage noslash link
15339 !! options
15340 parsoid=wt2wt,wt2html,html2html
15341 subpage title=[[Subpage test/1/2/3/4]]
15342 !! wikitext
15343 [[../../subpage/]]
15344
15345 [[../../subpage]]
15346 !! html/php
15347 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
15348 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
15349 </p>
15350 !! html/parsoid
15351 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
15352 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
15353 !! end
15354
15355 !! test
15356 Parsoid: dot-slash prefixed wikilinks
15357 !! wikitext
15358 [[./foo]]
15359
15360 [[././bar]]
15361
15362 [[././baz/]]
15363 !! html/php
15364 <p>[[./foo]]
15365 </p><p>[[././bar]]
15366 </p><p>[[././baz/]]
15367 </p>
15368 !! html/parsoid
15369 <p>[[./foo]]
15370 </p><p>[[././bar]]
15371 </p><p>[[././baz/]]
15372 </p>
15373 !! end
15374
15375 !! test
15376 Render invalid page names as plain text (T53090)
15377 !! wikitext
15378 [[./../foo|bar]]
15379 [[foo�|bar]]
15380 [[foo/.|bar]]
15381 [[foo/..|bar]]
15382 [[foo~~~bar]]
15383 [[foo>bar]]
15384 [[foo[bar]]
15385 [[.]]
15386 [[..]]
15387 [[foo././bar]]
15388 [[foo[http://example.com]xyz]]
15389
15390 [[{{echo|./../foo}}|bar]]
15391 [[{{echo|foo/.}}|bar]]
15392 [[{{echo|foo/..}}|bar]]
15393 [[{{echo|foo~~~~bar}}]]
15394 [[{{echo|foo>bar}}]]
15395 [[{{echo|foo././bar}}]]
15396 [[{{echo|foo{bar}}]]
15397 [[{{echo|foo}bar}}]]
15398 [[{{echo|foo[bar}}]]
15399 [[{{echo|foo]bar}}]]
15400 [[{{echo|foo<bar}}]]
15401 !!html/php
15402 <p>[[./../foo|bar]]
15403 [[foo�|bar]]
15404 [[foo/.|bar]]
15405 [[foo/..|bar]]
15406 [[foo~~~bar]]
15407 [[foo&gt;bar]]
15408 [[foo[bar]]
15409 [[.]]
15410 [[..]]
15411 [[foo././bar]]
15412 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15413 </p><p>[[./../foo|bar]]
15414 [[foo/.|bar]]
15415 [[foo/..|bar]]
15416 [[foo~~~~bar]]
15417 [[foo&gt;bar]]
15418 [[foo././bar]]
15419 [[foo{bar]]
15420 [[foo}bar]]
15421 [[foo[bar]]
15422 [[foo]bar]]
15423 [[foo&lt;bar]]
15424 </p>
15425 !!html/parsoid
15426 <p>[[./../foo|bar]]
15427 [[foo�|bar]]
15428 [[foo/.|bar]]
15429 [[foo/..|bar]]
15430 [[foo~~~bar]]
15431 [[foo>bar]]
15432 [[foo[bar]]
15433 [[.]]
15434 [[..]]
15435 [[foo././bar]]
15436 [[foo<a rel="mw:ExtLink" href="http://example.com"></a>xyz]]</p>
15437
15438 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
15439 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
15440 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
15441 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
15442 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
15443 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
15444 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
15445 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
15446 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
15447 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
15448 [[<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>
15449 !!end
15450
15451 !! test
15452 Disabled subpages
15453 !! wikitext
15454 [[/subpage]]
15455 !! html
15456 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
15457 </p>
15458 !! end
15459
15460 !! test
15461 T2561: {{/Subpage}}
15462 !! options
15463 subpage title=[[Page]]
15464 !! wikitext
15465 {{/Subpage}}
15466 !! html
15467 <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>
15468 </p>
15469 !! end
15470
15471 ###
15472 ### Categories
15473 ###
15474 !! article
15475 Category:MediaWiki User's Guide
15476 !! text
15477 blah
15478 !! endarticle
15479
15480 !! test
15481 Link to category
15482 !! wikitext
15483 [[:Category:MediaWiki User's Guide]]
15484 !! html
15485 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
15486 </p>
15487 !! end
15488
15489 !! test
15490 Simple category
15491 !! options
15492 cat
15493 !! wikitext
15494 [[Category:MediaWiki User's Guide]]
15495 !! html/php
15496 cat=MediaWiki_User's_Guide sort=
15497 !! html/parsoid
15498 <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"}}'/>
15499 !! end
15500
15501 !! test
15502 PAGESINCATEGORY invalid title fatal (r33546 fix)
15503 !! wikitext
15504 {{PAGESINCATEGORY:<bogus>}}
15505 !! html
15506 <p>0
15507 </p>
15508 !! end
15509
15510 !! test
15511 Category with different sort key
15512 !! options
15513 cat
15514 !! wikitext
15515 [[Category:MediaWiki User's Guide|Foo]]
15516 !! html/php
15517 cat=MediaWiki_User's_Guide sort=Foo
15518 !! html/parsoid
15519 <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"}}'/>
15520 !! end
15521
15522 !! test
15523 Category with identical sort key
15524 !! options
15525 cat
15526 !! wikitext
15527 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15528 !! html/php
15529 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
15530 !! html/parsoid
15531 <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"}}'/>
15532 !! end
15533
15534 !! test
15535 Category with empty sort key
15536 !! options
15537 cat
15538 pst
15539 !! wikitext
15540 [[Category:MediaWiki User's Guide|]]
15541 !! html/php
15542 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15543 !! end
15544
15545 !! test
15546 Category with empty sort key and parentheses
15547 !! options
15548 cat
15549 pst
15550 !! wikitext
15551 [[Category:Foo (bar)|]]
15552 !! html/php
15553 [[Category:Foo (bar)|Foo]]
15554 !! end
15555
15556 !! test
15557 Category with link tail
15558 !! options
15559 cat
15560 pst
15561 !! wikitext
15562 123[[Category:Foo]]456
15563 !! html/php
15564 123[[Category:Foo]]456
15565 !! end
15566
15567 !! test
15568 Category with template
15569 !! options
15570 cat
15571 pst
15572 !! wikitext
15573 [[Category:{{echo|Foo}}]]
15574 !! html/php
15575 [[Category:{{echo|Foo}}]]
15576 !! end
15577
15578 !! test
15579 Category with template in sort key
15580 !! options
15581 cat
15582 pst
15583 !! wikitext
15584 [[Category:Foo|{{echo|Bar}}]]
15585 !! html/php
15586 [[Category:Foo|{{echo|Bar}}]]
15587 !! end
15588
15589 !! test
15590 Category with template in sort key and title
15591 !! options
15592 cat
15593 pst
15594 !! wikitext
15595 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15596 !! html/php
15597 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15598 !! end
15599
15600 ## We used to, but no longer wt2wt this test since the default serializer
15601 ## will normalize all categories to serialize on their own line.
15602 ## This wikitext usage is going to be fairly uncommon in production and
15603 ## selser will take care of preserving formatting in those scenarios.
15604 !! test
15605 Category / paragraph interactions
15606 !! options
15607 parsoid=wt2html
15608 !! wikitext
15609 Foo [[Category:Baz]] Bar
15610
15611 Foo [[Category:Baz]]
15612 Bar
15613
15614 Foo
15615 [[Category:Baz]]
15616 Bar
15617
15618 Foo
15619 [[Category:Baz]] Bar
15620
15621 Foo
15622 [[Category:Baz]]
15623 [[Category:Baz]]
15624 [[Category:Baz]]
15625 Bar
15626
15627 [[Category:Baz]]
15628 [[Category:Baz]]
15629 [[Category:Baz]]
15630
15631 [[Category:Baz]]
15632 {{echo|[[Category:Baz]]}}
15633 [[Category:Baz]]
15634 !! html/php
15635 <p>Foo Bar
15636 </p><p>Foo
15637 Bar
15638 </p><p>Foo
15639 Bar
15640 </p><p>Foo Bar
15641 </p><p>Foo
15642 Bar
15643 </p>
15644 !! html/parsoid
15645 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15646 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15647 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15648 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15649 <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>
15650 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15651 !! end
15652
15653 ## We used to, but no longer wt2wt this test since the default serializer
15654 ## will normalize all categories to serialize on their own line.
15655 ## This wikitext usage is going to be fairly uncommon in production and
15656 ## selser will take care of preserving formatting in those scenarios.
15657 ##
15658 ## The whitespace on the empty line is part of the test. Please do not delete
15659 !! test
15660 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15661 !! options
15662 parsoid=wt2html
15663 !! wikitext
15664 This
15665
15666 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15667
15668 {{echo|[[Category:Foo]] and so should this!}}
15669 !! html/php
15670 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15671 </p>
15672 !! html/parsoid
15673 <p>This
15674
15675 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15676
15677 <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>
15678 !! end
15679
15680 ## Parsoid will not try to wt2wt this while preserving newlines because
15681 ## it suppresses excess newlines within list items -- and we don't want to
15682 ## introduce a special case just for categories, which is, in reality somewhat
15683 ## odd behavior -- categories are unlikely to be used in list items like this
15684 ## in top-level pages and are only likely to show up in template-generated
15685 ## list items where this RT-ing is a non-issue.
15686 ##
15687 ## The whitespace on the empty line is part of the test. Please do not delete
15688 !! test
15689 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15690 !! options
15691 parsoid=wt2html
15692 !! wikitext
15693 * This
15694
15695 [[Category:Foo]] and this should be part of the same list item
15696 * So should this
15697
15698 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15699 !! html
15700 <ul><li>This and this should be part of the same list item</li>
15701 <li>So should this and this should be part of the same list item</li></ul>
15702 !! html/parsoid
15703 <ul>
15704 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15705 <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>
15706 </ul>
15707 !! end
15708
15709 ## Newlines and categories that follow the last item of a list
15710 ## are treated differently because this (list followed by categories)
15711 ## is an extremely common pattern on wikis.
15712 !! test
15713 3. Categories and newlines: newline suppression for last list item should RT properly
15714 !! wikitext
15715 * a
15716 * b
15717
15718 [[Category:Foo]]
15719
15720 [[Category:Bar]]
15721 [[Category:Baz]]
15722 !! html/parsoid
15723 <ul><li> a</li>
15724 <li> b</li></ul>
15725
15726 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15727
15728 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15729 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15730 !! end
15731
15732 !! test
15733 4. Categories and newlines: newline suppression for last list item should RT properly
15734 !! wikitext
15735 * a
15736 **** b
15737
15738 [[Category:Foo]]
15739 !! html/parsoid
15740 <ul><li> a
15741 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15742
15743 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15744 !! end
15745
15746 ## only wt2html for this to make sure the algo only applies to the rightmost path
15747 !! test
15748 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15749 !! options
15750 parsoid=wt2html
15751 !! wikitext
15752 * a
15753 ** b
15754 [[Category:Foo]]
15755 * c
15756 ** d
15757 [[Category:Foo]]
15758 !! html/parsoid
15759 <ul><li> a
15760 <ul><li> b
15761 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15762 <li> c
15763 <ul><li> d</li></ul></li></ul>
15764 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15765 !! end
15766
15767 ## We used to, but no longer wt2wt this test since the default serializer
15768 ## will normalize all categories to serialize on their own line.
15769 ## This wikitext usage is going to be fairly uncommon in production and
15770 ## selser will take care of preserving formatting in those scenarios.
15771 !! test
15772 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15773 !! options
15774 parsoid=wt2html
15775 !! wikitext
15776 * a [[Category:Foo]]
15777 !! html/parsoid
15778 <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>
15779 !! end
15780
15781 # This test also demonstrates because of newline+category tunneling
15782 # through the list hander, template wrapping doesn't expand to the
15783 # containing list when the list item swallows the category.
15784 !! test
15785 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15786 !! wikitext
15787 * {{echo|a
15788 [[Category:Foo]]}}
15789 !! html/parsoid
15790 <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
15791 </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>
15792 !! end
15793
15794 !! test
15795 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15796 !! wikitext
15797 * a
15798
15799 {{echo|[[Category:Foo]]
15800 [[Category:Bar]]}}
15801 [[Category:Baz]]
15802 !! html/parsoid
15803 <ul><li> a</li></ul>
15804
15805 <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">
15806 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15807 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15808 !! end
15809
15810 !! test
15811 9. Categories and newlines: should behave properly with linkprefix (T87753)
15812 !! options
15813 language=ar
15814 !! wikitext
15815 foo bar
15816 foo bar
15817 [[تصنيف:Foo]]
15818 [[تصنيف:Bar]]
15819 !! html/php
15820 <p>foo bar
15821 foo bar
15822 </p>
15823 !! html/parsoid
15824 <p>foo bar
15825 foo bar</p>
15826 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
15827 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
15828 !! end
15829
15830 !! test
15831 Category links with multiple namespaces
15832 !! wikitext
15833 [[Category:Project:Foo]]
15834 !! html/parsoid
15835 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15836 !! end
15837
15838 !! test
15839 Parsoid: Serialize link to category page with colon escape
15840 !! options
15841 parsoid
15842 !! wikitext
15843
15844 [[:Category:Foo]]
15845 [[:Category:Foo|Bar]]
15846 !! html
15847 <p>
15848 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15849 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15850 </p>
15851 !! end
15852
15853 # We used to, but no longer wt2wt this test since the default serializer
15854 # will normalize all categories to serialize on their own line.
15855 # This wikitext usage is going to be fairly uncommon in production and
15856 # selser will take care of preventing whitespace insertion if this
15857 # occurs in an article.
15858 #
15859 # html2html disabled for the same reason (whitespace insertion between
15860 # x and y).
15861 #
15862 # html2wt disabled because it localizes the "Category" namespace.
15863 !! test
15864 Link prefix/suffixes aren't applied to category links
15865 !! options
15866 parsoid=wt2html
15867 language=is
15868 !! wikitext
15869 x[[Category:Foo]]y
15870 !! html/php
15871 <p>xy
15872 </p>
15873 !! html/parsoid
15874 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15875 !! end
15876
15877 !! test
15878 Link prefix/suffixes aren't applied to language links
15879 !! options
15880 parsoid=wt2html
15881 language=is
15882 !! wikitext
15883 x[[es:Foo]]y
15884 !! html/php
15885 <p>xy
15886 </p>
15887 !! html/parsoid
15888 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
15889 !! end
15890
15891 !! test
15892 Parsoid: Serialize link to file page with colon escape
15893 !! options
15894 parsoid
15895 !! wikitext
15896
15897 [[:File:Foo.png]]
15898 [[:File:Foo.png|Bar]]
15899 !! html
15900 <p>
15901 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15902 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15903 </p>
15904 !! end
15905
15906 !! test
15907 Parsoid: Serialize a genuine category link without colon escape
15908 !! options
15909 parsoid
15910 !! wikitext
15911 [[Category:Foo]]
15912 [[Category:Foo|Bar]]
15913 !! html
15914 <link rel="mw:PageProp/Category" href="./Category:Foo">
15915 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15916 !! end
15917
15918 !! test
15919 Normalize hrefs properly before testing for invalid link targets (T72894)
15920 !! options
15921 parsoid=html2wt
15922 !! html/parsoid
15923 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15924 !! wikitext
15925 [[Category:Toxine bactérienne]]
15926 !! end
15927
15928 !! test
15929 Parsoid: Defaultsort
15930 !! wikitext
15931 {{DEFAULTSORT:Foo}}
15932 !! html/parsoid
15933 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15934 !! end
15935
15936 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
15937 # But, this is a limitation of our representation and is documented in
15938 # TemplateHandler.js in processSpecialMagicWord
15939 !! test
15940 Parsoid: Defaultsort (template-generated)
15941 !! wikitext
15942 {{{{echo|DEFAULTSORT}}:Foo}}
15943 !! html/parsoid
15944 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{{{echo|DEFAULTSORT}}:Foo}}","dsr":[0,26,null,null]}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,22,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"DEFAULTSORT\"}},\"i\":0}}]}&#39;>DEFAULTSORT&lt;/span>:Foo"}]]}'/>
15945 !! end
15946
15947 ###
15948 ### Inter-language links
15949 ###
15950 !! test
15951 Interlanguage links
15952 !! options
15953 ill
15954 !! wikitext
15955 [[es:Alimento]]
15956 [[fr:Nourriture]]
15957 [[zh:食品]]
15958 !! html/php
15959 es:Alimento fr:Nourriture zh:食品
15960 !! html/parsoid
15961 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15962 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15963 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15964 !! end
15965
15966 !! test
15967 Duplicate interlanguage links (T26502)
15968 !! options
15969 ill
15970 !! wikitext
15971 [[es:1]]
15972 [[es:2]]
15973 [[fr:1]]
15974 [[fr:2]]
15975 !! html/php
15976 es:1 fr:1
15977 !! html/parsoid
15978 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15979 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15980 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15981 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15982 !! end
15983
15984 ###
15985 ### Sections
15986 ###
15987 !! test
15988 Basic section headings
15989 !! wikitext
15990 == Headline 1 ==
15991 Some text
15992
15993 ==Headline 2==
15994 More
15995 ===Smaller headline===
15996 Blah blah
15997 !! html
15998 <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>
15999 <p>Some text
16000 </p>
16001 <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>
16002 <p>More
16003 </p>
16004 <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>
16005 <p>Blah blah
16006 </p>
16007 !! end
16008
16009 !! test
16010 Section headings with TOC
16011 !! wikitext
16012 == Headline 1 ==
16013 === Subheadline 1 ===
16014 ===== Skipping a level =====
16015 ====== Skipping a level ======
16016
16017 == Headline 2 ==
16018 Some text
16019 ===Another headline===
16020 !! html
16021 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16022 <ul>
16023 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
16024 <ul>
16025 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
16026 <ul>
16027 <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>
16028 <ul>
16029 <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>
16030 </ul>
16031 </li>
16032 </ul>
16033 </li>
16034 </ul>
16035 </li>
16036 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16037 <ul>
16038 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16039 </ul>
16040 </li>
16041 </ul>
16042 </div>
16043
16044 <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>
16045 <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>
16046 <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>
16047 <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>
16048 <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>
16049 <p>Some text
16050 </p>
16051 <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>
16052
16053 !! end
16054
16055 !! test
16056 TOC anchors don't collide
16057 !! wikitext
16058 __FORCETOC__
16059 == Headline 2 ==
16060 == Headline ==
16061 == Headline 2 ==
16062 == Headline ==
16063 !! html/php
16064 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16065 <ul>
16066 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16067 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16068 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16069 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16070 </ul>
16071 </div>
16072
16073 <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>
16074 <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>
16075 <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>
16076 <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>
16077
16078 !! end
16079
16080 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16081 !! test
16082 Handling of sections up to level 6 and beyond
16083 !! wikitext
16084 = Level 1 Heading=
16085 == Level 2 Heading==
16086 === Level 3 Heading===
16087 ==== Level 4 Heading====
16088 ===== Level 5 Heading=====
16089 ====== Level 6 Heading======
16090 ======= Level 7 Heading=======
16091 ======== Level 8 Heading========
16092 ========= Level 9 Heading=========
16093 ========== Level 10 Heading==========
16094 !! html
16095 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16096 <ul>
16097 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16098 <ul>
16099 <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>
16100 <ul>
16101 <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>
16102 <ul>
16103 <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>
16104 <ul>
16105 <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>
16106 <ul>
16107 <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>
16108 <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>
16109 <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>
16110 <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>
16111 <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>
16112 </ul>
16113 </li>
16114 </ul>
16115 </li>
16116 </ul>
16117 </li>
16118 </ul>
16119 </li>
16120 </ul>
16121 </li>
16122 </ul>
16123 </div>
16124
16125 <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>
16126 <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>
16127 <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>
16128 <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>
16129 <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>
16130 <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>
16131 <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>
16132 <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>
16133 <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>
16134 <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>
16135
16136 !! end
16137
16138 !! test
16139 TOC regression (T11764)
16140 !! wikitext
16141 == title 1 ==
16142 === title 1.1 ===
16143 ==== title 1.1.1 ====
16144 === title 1.2 ===
16145 == title 2 ==
16146 === title 2.1 ===
16147 !! html
16148 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16149 <ul>
16150 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16151 <ul>
16152 <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>
16153 <ul>
16154 <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>
16155 </ul>
16156 </li>
16157 <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>
16158 </ul>
16159 </li>
16160 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16161 <ul>
16162 <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>
16163 </ul>
16164 </li>
16165 </ul>
16166 </div>
16167
16168 <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>
16169 <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>
16170 <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>
16171 <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>
16172 <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>
16173 <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>
16174
16175 !! end
16176
16177 !! test
16178 TOC for heading containing <span id="..."></span> (T96153)
16179 !! wikitext
16180 __FORCETOC__
16181 ==<span id="old-anchor"></span>New title==
16182 !! html/php
16183 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16184 <ul>
16185 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16186 </ul>
16187 </div>
16188
16189 <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>
16190
16191 !! end
16192
16193 !! test
16194 TOC with wgMaxTocLevel=3 (T8204)
16195 !! options
16196 wgMaxTocLevel=3
16197 !! wikitext
16198 == title 1 ==
16199 === title 1.1 ===
16200 ==== title 1.1.1 ====
16201 === title 1.2 ===
16202 == title 2 ==
16203 === title 2.1 ===
16204 !! html
16205 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16206 <ul>
16207 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16208 <ul>
16209 <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>
16210 <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>
16211 </ul>
16212 </li>
16213 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16214 <ul>
16215 <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>
16216 </ul>
16217 </li>
16218 </ul>
16219 </div>
16220
16221 <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>
16222 <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>
16223 <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>
16224 <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>
16225 <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>
16226 <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>
16227
16228 !! end
16229
16230 !! test
16231 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16232 !! options
16233 wgMaxTocLevel=3
16234 !! wikitext
16235 ==Section 1==
16236 ===Section 1.1===
16237 ====Section 1.1.1====
16238 ====Section 1.1.1.1====
16239 ==Section 2==
16240 !! html
16241 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16242 <ul>
16243 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16244 <ul>
16245 <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>
16246 </ul>
16247 </li>
16248 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16249 </ul>
16250 </div>
16251
16252 <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>
16253 <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>
16254 <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>
16255 <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>
16256 <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>
16257
16258 !! end
16259
16260
16261 !! test
16262 Resolving duplicate section names
16263 !! wikitext
16264 == Foo bar ==
16265 == Foo bar ==
16266 !! html
16267 <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>
16268 <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>
16269
16270 !! end
16271
16272 !! test
16273 Resolving duplicate section names with differing case (T12721)
16274 !! wikitext
16275 == Foo bar ==
16276 == Foo Bar ==
16277 !! html
16278 <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>
16279 <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>
16280
16281 !! end
16282
16283 !! article
16284 Template:sections
16285 !! text
16286 ===Section 1===
16287 ==Section 2==
16288 !! endarticle
16289
16290 !! test
16291 Template with sections, __NOTOC__
16292 !! wikitext
16293 __NOTOC__
16294 ==Section 0==
16295 {{sections}}
16296 ==Section 4==
16297 !! html
16298 <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>
16299 <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>
16300 <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>
16301 <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>
16302
16303 !! end
16304
16305 !! test
16306 __NOEDITSECTION__ keyword
16307 !! wikitext
16308 __NOEDITSECTION__
16309 ==Section 1==
16310 ==Section 2==
16311 !! html
16312 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
16313 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
16314
16315 !! end
16316
16317 !! test
16318 Link inside a section heading
16319 !! wikitext
16320 ==Section with a [[Main Page|link]] in it==
16321 !! html
16322 <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>
16323
16324 !! end
16325
16326 !! test
16327 TOC regression (T14077)
16328 !! wikitext
16329 __TOC__
16330 == title 1 ==
16331 === title 1.1 ===
16332 == title 2 ==
16333 !! html
16334 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16335 <ul>
16336 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16337 <ul>
16338 <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>
16339 </ul>
16340 </li>
16341 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
16342 </ul>
16343 </div>
16344
16345 <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>
16346 <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>
16347 <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>
16348
16349 !! end
16350
16351 !! test
16352 T3219 URL next to image (good)
16353 !! wikitext
16354 http://example.com [[File:Foobar.jpg]]
16355 !! html/php
16356 <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>
16357 </p>
16358 !! html/parsoid
16359 <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>
16360 !!end
16361
16362 !! test
16363 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
16364 !! wikitext
16365 ===
16366 The line above must have a trailing space!
16367 === <!--
16368 --> <!-- -->
16369 But just in case it doesn't...
16370 !! html
16371 <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>
16372 <p>The line above must have a trailing space!
16373 </p>
16374 <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>
16375 <p>But just in case it doesn't...
16376 </p>
16377 !! end
16378
16379 !! test
16380 Header with special characters (T27462)
16381 !! wikitext
16382 The tooltips shall not show entities to the user (ie. be double escaped)
16383
16384 == text > text ==
16385 section 1
16386
16387 == text < text ==
16388 section 2
16389
16390 == text & text ==
16391 section 3
16392
16393 == text ' text ==
16394 section 4
16395
16396 == text " text ==
16397 section 5
16398 !! html
16399 <p>The tooltips shall not show entities to the user (ie. be double escaped)
16400 </p>
16401 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16402 <ul>
16403 <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>
16404 <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>
16405 <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>
16406 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
16407 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
16408 </ul>
16409 </div>
16410
16411 <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>
16412 <p>section 1
16413 </p>
16414 <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>
16415 <p>section 2
16416 </p>
16417 <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>
16418 <p>section 3
16419 </p>
16420 <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>
16421 <p>section 4
16422 </p>
16423 <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>
16424 <p>section 5
16425 </p>
16426 !! end
16427
16428 !! test
16429 Header with space, plus and underscore as entity
16430 !! wikitext
16431 Id should not contain + for spaces
16432
16433 == Space between Text ==
16434 section 1
16435
16436 == Space-Entity&#32;between&#32;Text ==
16437 section 2
16438
16439 == Plus+between+Text ==
16440 section 3
16441
16442 == Plus-Entity&#43;between&#43;Text ==
16443 section 4
16444
16445 == Underscore_between_Text ==
16446 section 5
16447
16448 == Underscore-Entity&#95;between&#95;Text ==
16449 section 6
16450
16451 [[#Space between Text]]
16452 [[#Space-Entity&#32;between&#32;Text]]
16453 [[#Plus+between+Text]]
16454 [[#Plus-Entity&#43;between&#43;Text]]
16455 [[#Underscore_between_Text]]
16456 [[#Underscore-Entity&#95;between&#95;Text]]
16457 !! html
16458 <p>Id should not contain + for spaces
16459 </p>
16460 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16461 <ul>
16462 <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>
16463 <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>
16464 <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>
16465 <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>
16466 <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>
16467 <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>
16468 </ul>
16469 </div>
16470
16471 <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>
16472 <p>section 1
16473 </p>
16474 <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>
16475 <p>section 2
16476 </p>
16477 <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>
16478 <p>section 3
16479 </p>
16480 <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>
16481 <p>section 4
16482 </p>
16483 <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>
16484 <p>section 5
16485 </p>
16486 <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>
16487 <p>section 6
16488 </p><p><a href="#Space_between_Text">#Space between Text</a>
16489 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
16490 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
16491 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
16492 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
16493 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
16494 </p>
16495 !! end
16496
16497 !! test
16498 Headers with excess '=' characters
16499 (Are similar tests necessary beyond the 1st level?)
16500 !! wikitext
16501 =foo==
16502 ==foo=
16503 =''italic'' heading==
16504 ==''italic'' heading=
16505 !! html
16506 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16507 <ul>
16508 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
16509 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
16510 <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>
16511 <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>
16512 </ul>
16513 </div>
16514
16515 <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>
16516 <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>
16517 <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>
16518 <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>
16519
16520 !! end
16521
16522 !! test
16523 HTML headers vs TOC (T25393)
16524 (__NOEDITSECTION__ for clearer output, doesn't matter here)
16525 !! wikitext
16526 <h1>Header 1</h1>
16527 == Header 1.1 ==
16528 == Header 1.2 ==
16529
16530 <h1>Header 2
16531 </h1>
16532 == Header 2.1 ==
16533 == Header 2.2 ==
16534 __NOEDITSECTION__
16535 !! html
16536 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16537 <ul>
16538 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
16539 <ul>
16540 <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>
16541 <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>
16542 </ul>
16543 </li>
16544 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
16545 <ul>
16546 <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>
16547 <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>
16548 </ul>
16549 </li>
16550 </ul>
16551 </div>
16552
16553 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
16554 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
16555 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
16556 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
16557 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
16558 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
16559
16560 !! end
16561
16562 !! test
16563 Single-line or multiline-comments can follow headings
16564 !! options
16565 parsoid=wt2html,wt2wt
16566 !! wikitext
16567 ==foo==<!---->
16568 ==bar==<!--c1-->
16569 ==baz==<!--
16570 c2
16571 c3-->
16572 !! html
16573 <h2><span class="mw-headline" id="foo">foo</span></h2>
16574 <h2><span class="mw-headline" id="bar">bar</span></h2>
16575 <h2><span class="mw-headline" id="baz">baz</span></h2>
16576
16577 !! end
16578
16579 !! test
16580 T3219 URL next to image (broken)
16581 !! wikitext
16582 http://example.com[[File:Foobar.jpg]]
16583 !! html/php
16584 <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>
16585 </p>
16586 !! html/parsoid
16587 <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>
16588 !!end
16589
16590 !! test
16591 T3186 news: in the middle of text
16592 !! wikitext
16593 http://en.wikinews.org/wiki/Wikinews:Workplace
16594 !! html
16595 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
16596 </p>
16597 !!end
16598
16599
16600 !! test
16601 Namespaced link must have a title
16602 !! wikitext
16603 [[Project:]]
16604 !! html
16605 <p>[[Project:]]
16606 </p>
16607 !!end
16608
16609 !! test
16610 Namespaced link must have a title (bad fragment version)
16611 !! wikitext
16612 [[Project:#fragment]]
16613 !! html
16614 <p>[[Project:#fragment]]
16615 </p>
16616 !!end
16617
16618
16619 ###
16620 ### HTML tags and HTML attributes
16621 ###
16622
16623 !! test
16624 div with no attributes
16625 !! wikitext
16626 <div>HTML rocks</div>
16627 !! html
16628 <div>HTML rocks</div>
16629
16630 !! end
16631
16632 !! test
16633 div with double-quoted attribute
16634 !! wikitext
16635 <div id="rock">HTML rocks</div>
16636 !! html
16637 <div id="rock">HTML rocks</div>
16638
16639 !! end
16640
16641 !! test
16642 div with single-quoted attribute
16643 !! wikitext
16644 <div id='rock'>HTML rocks</div>
16645 !! html
16646 <div id="rock">HTML rocks</div>
16647
16648 !! end
16649
16650 !! test
16651 div with unquoted attribute
16652 !! wikitext
16653 <div id=rock>HTML rocks</div>
16654 !! html
16655 <div id="rock">HTML rocks</div>
16656
16657 !! end
16658
16659 !! test
16660 div with illegal double attributes
16661 !! wikitext
16662 <div id="a" id="b">HTML rocks</div>
16663 !! html
16664 <div id="b">HTML rocks</div>
16665
16666 !!end
16667
16668 !! test
16669 div with empty attribute value, space before equals
16670 !! options
16671 parsoid=wt2html,html2html
16672 !! wikitext
16673 <div class =>HTML rocks</div>
16674 !! html/php
16675 <div class="">HTML rocks</div>
16676
16677 !! html/parsoid
16678 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16679 !! end
16680
16681 !! test
16682 div with multiple empty attribute values
16683 !! options
16684 parsoid=wt2html,html2html
16685 !! wikitext
16686 <div id= title=>HTML rocks</div>
16687 !! html/php
16688 <div id="title.3D">HTML rocks</div>
16689
16690 !! html/parsoid
16691 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16692 !! end
16693
16694 !! test
16695 table with multiple empty attribute values
16696 !! options
16697 parsoid=wt2html,html2html
16698 !! wikitext
16699 {| title= id=
16700 | hi
16701 |}
16702 !! html/php
16703 <table title="id=">
16704 <tr>
16705 <td> hi
16706 </td></tr></table>
16707
16708 !! html/parsoid
16709 <table title="id=">
16710 <tbody><tr><td> hi</td></tr>
16711 </tbody></table>
16712 !! end
16713
16714 !! test
16715 div with braces in attribute value
16716 !! wikitext
16717 <div title="{}">Foo</div>
16718 !! html/php
16719 <div title="&#123;&#125;">Foo</div>
16720
16721 !! html/parsoid
16722 <div title="{}">Foo</div>
16723 !! end
16724
16725 !! test
16726 div with empty attribute value, no space before equals
16727 !! options
16728 parsoid=wt2html,html2html
16729 !! wikitext
16730 <div class=>HTML rocks</div>
16731 !! html/php
16732 <div class="">HTML rocks</div>
16733
16734 !! html/parsoid
16735 <div class="">HTML rocks</div>
16736 !! end
16737
16738 !! test
16739 HTML multiple attributes correction
16740 !! wikitext
16741 <p class="error" class="awesome">Awesome!</p>
16742 !! html
16743 <p class="awesome">Awesome!</p>
16744
16745 !!end
16746
16747 !! test
16748 Table multiple attributes correction
16749 !! wikitext
16750 {|
16751 !+ class="error" class="awesome"| status
16752 |}
16753 !! html
16754 <table>
16755 <tr>
16756 <th class="awesome"> status
16757 </th></tr></table>
16758
16759 !!end
16760
16761 !! test
16762 DIV IN UPPERCASE
16763 !! wikitext
16764 <DIV ID="x">HTML ROCKS</DIV>
16765 !! html
16766 <div id="x">HTML ROCKS</div>
16767
16768 !!end
16769
16770 !! test
16771 Non-ASCII pseudo-tags are rendered as text
16772 !! wikitext
16773 <khyô>
16774 !! html
16775 <p>&lt;khyô&gt;
16776 </p>
16777 !! end
16778
16779 !! test
16780 Pseudo-tag with URL 'name' renders as url link
16781 !! wikitext
16782 <http://example.com/>
16783 !! html
16784 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16785 </p>
16786 !! end
16787
16788 !! test
16789 text with amp in the middle of nowhere
16790 !! wikitext
16791 Remember AT&T?
16792 !! html
16793 <p>Remember AT&amp;T?
16794 </p>
16795 !! end
16796
16797 !! test
16798 text with character entity: eacute
16799 !! wikitext
16800 I always thought &eacute; was a cute letter.
16801 !! html
16802 <p>I always thought &#233; was a cute letter.
16803 </p>
16804 !! html+tidy
16805 <p>I always thought é was a cute letter.</p>
16806 !! end
16807
16808 !! test
16809 text with entity-escaped character entity-like string: eacute
16810 !! wikitext
16811 I always thought &amp;eacute; was a cute letter.
16812 !! html
16813 <p>I always thought &amp;eacute; was a cute letter.
16814 </p>
16815 !! end
16816
16817 !! test
16818 text with undefined character entity: xacute
16819 !! wikitext
16820 I always thought &xacute; was a cute letter.
16821 !! html
16822 <p>I always thought &amp;xacute; was a cute letter.
16823 </p>
16824 !! end
16825
16826 !! test
16827 HTML5 tags
16828 !! wikitext
16829 <data value="5">five</data>
16830 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16831 <mark>This highlighted text</mark>
16832 !! html
16833 <p><data value="5">five</data>
16834 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16835 <mark>This highlighted text</mark>
16836 </p>
16837 !! end
16838
16839 !! test
16840 HTML tag with leading space is parsed as text
16841 !! wikitext
16842 < div>foo< /div>
16843 !! html
16844 <p>&lt; div&gt;foo&lt; /div&gt;
16845 </p>
16846 !! end
16847
16848 ###
16849 ### Nesting tests (see T43545, T52604, T53081)
16850 ###
16851
16852 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
16853 # Note that html2wt is considerably more difficult if we use <b> in
16854 # the test case, instead of <small>
16855 !! test
16856 Ensure that HTML adoption agency algorithm is properly implemented.
16857 !! wikitext
16858 <small>X<small>Y</small>Z</small>
16859 !! html
16860 <p><small>X<small>Y</small>Z</small>
16861 </p>
16862 !! end
16863
16864 # This was T43545 in the PHP parser.
16865 # Note that tidy doesn't handle this correctly.
16866 !! test
16867 Nesting of <kbd>
16868 !! wikitext
16869 <kbd>X<kbd>Y</kbd>Z</kbd>
16870 !! html
16871 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16872 </p>
16873 !! end
16874
16875 # The following cases were T53081 in the PHP parser.
16876 # Note that there are some other nestable tags (b, i, etc) which are
16877 # not covered; see T53081 for discussion.
16878
16879 # Note that tidy doesn't handle this correctly.
16880 !! test
16881 Nesting of <em>
16882 !! wikitext
16883 <em>X<em>Y</em>Z</em>
16884 !! html
16885 <p><em>X<em>Y</em>Z</em>
16886 </p>
16887 !! end
16888
16889 # Note that tidy doesn't handle this correctly.
16890 !! test
16891 Nesting of <strong>
16892 !! wikitext
16893 <strong>X<strong>Y</strong>Z</strong>
16894 !! html
16895 <p><strong>X<strong>Y</strong>Z</strong>
16896 </p>
16897 !! end
16898
16899 !! test
16900 Nesting of <q>
16901 !! wikitext
16902 <q>X<q>Y</q>Z</q>
16903 !! html+tidy
16904 <p><q>X<q>Y</q>Z</q></p>
16905 !! end
16906
16907 # Note that tidy doesn't handle this correctly.
16908 !! test
16909 Nesting of <ruby>
16910 !! wikitext
16911 <ruby>X<ruby>Y</ruby>Z</ruby>
16912 !! html
16913 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16914 </p>
16915 !! end
16916
16917 # Note that tidy doesn't handle this correctly.
16918 !! test
16919 Nesting of <bdo>
16920 !! wikitext
16921 <bdo>X<bdo>Y</bdo>Z</bdo>
16922 !! html
16923 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16924 </p>
16925 !! end
16926
16927
16928 ###
16929 ### Media links
16930 ###
16931
16932 !! test
16933 Media link
16934 !! wikitext
16935 [[Media:Foobar.jpg]]
16936 !! html/php
16937 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16938 </p>
16939 !! html/parsoid
16940 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a></p>
16941 !! end
16942
16943 !! test
16944 Media link with text
16945 !! wikitext
16946 [[Media:Foobar.jpg|A neat file to look at]]
16947 !! html/php
16948 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16949 </p>
16950 !! html/parsoid
16951 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
16952 !! end
16953
16954 # FIXME: this is still bad HTML tag nesting
16955 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16956 !! test
16957 Media link with nasty text
16958 !! wikitext
16959 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16960 !! html/php
16961 <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>
16962
16963 !! html+php/tidy
16964 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16965 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16966 !! html/parsoid
16967 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg" data-parsoid='{"autoInsertedEnd":true}'>Safe Link</a></p><div style="display:none" data-parsoid='{"stx":"html"}'><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg" data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'>" onmouseover="alert(document.cookie)" onfoo="</a></div>
16968
16969 !! end
16970
16971 !! test
16972 Media link to nonexistent file (T3702)
16973 !! wikitext
16974 [[Media:No such.jpg]]
16975 [[Media:No_such file.jpg]]
16976 !! html/php
16977 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16978 <a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such_file.jpg" class="new" title="No such file.jpg">Media:No_such file.jpg</a>
16979 </p>
16980 !! html/parsoid
16981 <p><a rel="mw:MediaLink" href="./Special:FilePath/No_such.jpg" title="No such.jpg" typeof="mw:Error" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}' data-parsoid='{"a":{"fileName":"No_such.jpg"},"sa":{"fileName":"No such.jpg"}}'>Media:No such.jpg</a>
16982 <a rel="mw:MediaLink" href="./Special:FilePath/No_such_file.jpg" title="No such file.jpg" typeof="mw:Error" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}' data-parsoid='{"a":{"fileName":"No_such_file.jpg"},"sa":{"fileName":"No_such file.jpg"}}'>Media:No_such file.jpg</a></p>
16983 !! end
16984
16985 !! test
16986 Image link to nonexistent file (T3850 - good)
16987 !! wikitext
16988 [[File:No_such.jpg]]
16989 !! html/php
16990 <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>
16991 </p>
16992 !! html/parsoid
16993 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","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>
16994 !! end
16995
16996 !! test
16997 :Image link to nonexistent file (T3850 - bad)
16998 !! wikitext
16999 [[:Image:No such.jpg]]
17000 !! html/php
17001 <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>
17002 </p>
17003 !! html/parsoid
17004 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17005 !! end
17006
17007
17008
17009 !! test
17010 Character reference normalization in link text (T3938)
17011 !! wikitext
17012 [[Main Page|this&that]]
17013 !! html
17014 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17015 </p>
17016 !!end
17017
17018 !! article
17019 אַ
17020 !! text
17021 Test for unicode normalization
17022
17023 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17024 !! endarticle
17025
17026 !! test
17027 (T21451) Links should refer to the normalized form.
17028 !! wikitext
17029 [[&#xFB2E;]]
17030 [[&#x5d0;&#x5b7;]]
17031 [[&#x5d0;ַ]]
17032 [[א&#x5b7;]]
17033 [[אַ]]
17034 !! html
17035 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17036 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17037 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17038 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17039 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17040 </p>
17041 !! end
17042
17043 !! test
17044 Empty attribute crash test (T4067)
17045 !! wikitext
17046 <font color="">foo</font>
17047 !! html
17048 <p><font color="">foo</font>
17049 </p>
17050 !! end
17051
17052 !! test
17053 Empty attribute crash test single-quotes (T4067)
17054 !! wikitext
17055 <font color=''>foo</font>
17056 !! html
17057 <p><font color="">foo</font>
17058 </p>
17059 !! end
17060
17061 !! test
17062 Attribute test: equals, then nothing
17063 !! options
17064 parsoid=wt2html,html2html
17065 !! wikitext
17066 <font color=>foo</font>
17067 !! html/php
17068 <p><font color="">foo</font>
17069 </p>
17070 !! html/parsoid
17071 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17072 !! end
17073
17074 !! test
17075 Attribute test: unquoted value
17076 !! options
17077 parsoid=wt2html,html2html
17078 !! wikitext
17079 <font color=x>foo</font>
17080 !! html/php
17081 <p><font color="x">foo</font>
17082 </p>
17083 !! html/parsoid
17084 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
17085 !! end
17086
17087 !! test
17088 Attribute test: unquoted but illegal value (hash)
17089 !! wikitext
17090 <font color=#x>foo</font>
17091 !! html
17092 <p><font color="#x">foo</font>
17093 </p>
17094 !! end
17095
17096 # Parsoid does not serialize to empty attribute syntax,
17097 # so wt2wt and html2wt cases are skipped
17098 !! test
17099 Attribute test: no value (T54330)
17100 !! options
17101 parsoid=wt2html,html2html
17102 !! wikitext
17103 <font color>foo</font>
17104 !! html/php
17105 <p><font color="">foo</font>
17106 </p>
17107 !! html/parsoid
17108 <p><font color="">foo</font></p>
17109 !! end
17110
17111 !! test
17112 T4095: link with three closing brackets
17113 !! wikitext
17114 [[Main Page]]]
17115 !! html/php
17116 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17117 </p>
17118 !! html/parsoid
17119 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17120 !! end
17121
17122 !! test
17123 T4095: link with pipe and three closing brackets
17124 !! wikitext
17125 [[Main Page|link]]]
17126 !! html/php
17127 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17128 </p>
17129 !! html/parsoid
17130 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17131 !! end
17132
17133 !! test
17134 T4095: link with pipe and three closing brackets, version 2
17135 !! wikitext
17136 [[Main Page|[http://example.com/]]]
17137 !! html/php
17138 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17139 </p>
17140 !! html/parsoid
17141 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17142 !! end
17143
17144
17145 ###
17146 ### Safety
17147 ###
17148
17149 !! article
17150 Template:Dangerous attribute
17151 !! text
17152 " onmouseover="alert(document.cookie)
17153 !! endarticle
17154
17155 !! article
17156 Template:Dangerous style attribute
17157 !! text
17158 border-size: expression(alert(document.cookie))
17159 !! endarticle
17160
17161 !! article
17162 Template:Div style
17163 !! text
17164 <div style="float: right; {{{1}}}">Magic div</div>
17165 !! endarticle
17166
17167 !! test
17168 T4304: HTML attribute safety (safe template; regression T4309)
17169 !! wikitext
17170 <div title="{{test}}"></div>
17171 !! html/php
17172 <div title="This is a test template"></div>
17173
17174 !! html/parsoid
17175 <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>
17176 !! end
17177
17178 # Parsoid has enough context to handle this case
17179 !! test
17180 T4304: HTML attribute safety (dangerous template; 2309)
17181 !! wikitext
17182 <div title="{{dangerous attribute}}"></div>
17183 !! html/php
17184 <div title=""></div>
17185
17186 !! html/parsoid
17187 <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>
17188 !! end
17189
17190 !! test
17191 T4304: HTML attribute safety (dangerous style template; 2309)
17192 !! wikitext
17193 <div style="{{dangerous style attribute}}"></div>
17194 !! html/php
17195 <div style="/* insecure input */"></div>
17196
17197 !! html/parsoid
17198 <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>
17199 !! end
17200
17201 !! test
17202 T4304: HTML attribute safety (safe parameter; 2309)
17203 !! wikitext
17204 {{div style|width: 200px}}
17205 !! html/php
17206 <div style="float: right; width: 200px">Magic div</div>
17207
17208 !! html/parsoid
17209 <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>
17210 !! end
17211
17212 !! test
17213 T4304: HTML attribute safety (unsafe parameter; 2309)
17214 !! wikitext
17215 {{div style|width: expression(alert(document.cookie))}}
17216 !! html/php
17217 <div style="/* insecure input */">Magic div</div>
17218
17219 !! html/parsoid
17220 <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>
17221 !! end
17222
17223 ## Parsoid output here differs; needs investigation.
17224 !! test
17225 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
17226 !! wikitext
17227 {{div style|"><script>alert(document.cookie)</script>}}
17228 !! html
17229 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17230
17231 !! end
17232
17233 ## Parsoid output here differs; needs investigation.
17234 !! test
17235 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
17236 !! wikitext
17237 {{div style|" ><script>alert(document.cookie)</script>}}
17238 !! html
17239 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17240
17241 !! end
17242
17243 !! test
17244 T4304: HTML attribute safety (link)
17245 !! wikitext
17246 <div title="[[Main Page]]"></div>
17247 !! html
17248 <div title="&#91;&#91;Main Page]]"></div>
17249
17250 !! end
17251
17252 !! test
17253 T4304: HTML attribute safety (italics)
17254 !! wikitext
17255 <div title="''foobar''"></div>
17256 !! html
17257 <div title="&#39;&#39;foobar&#39;&#39;"></div>
17258
17259 !! end
17260
17261 !! test
17262 T4304: HTML attribute safety (bold)
17263 !! wikitext
17264 <div title="'''foobar'''"></div>
17265 !! html
17266 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
17267
17268 !! end
17269
17270 !! test
17271 T4304: HTML attribute safety (ISBN)
17272 !! wikitext
17273 <div title="ISBN 1234567890"></div>
17274 !! html
17275 <div title="&#73;SBN 1234567890"></div>
17276
17277 !! end
17278
17279 !! test
17280 T4304: HTML attribute safety (RFC)
17281 !! wikitext
17282 <div title="RFC 1234"></div>
17283 !! html
17284 <div title="&#82;FC 1234"></div>
17285
17286 !! end
17287
17288 !! test
17289 T4304: HTML attribute safety (PMID)
17290 !! wikitext
17291 <div title="PMID 1234567890"></div>
17292 !! html
17293 <div title="&#80;MID 1234567890"></div>
17294
17295 !! end
17296
17297 !! test
17298 T4304: HTML attribute safety (web link)
17299 !! wikitext
17300 <div title="http://example.com/"></div>
17301 !! html
17302 <div title="http&#58;//example.com/"></div>
17303
17304 !! end
17305
17306 !! test
17307 T4304: HTML attribute safety (named web link)
17308 !! wikitext
17309 <div title="[http://example.com/ link]"></div>
17310 !! html
17311 <div title="&#91;http&#58;//example.com/ link]"></div>
17312
17313 !! end
17314
17315 !! test
17316 T5244: HTML attribute safety (extension; safe)
17317 !! wikitext
17318 <div style="<nowiki>background:blue</nowiki>"></div>
17319 !! html/php
17320 <div style="background:blue"></div>
17321
17322 !! html/parsoid
17323 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
17324 !! end
17325
17326 !! test
17327 T5244: HTML attribute safety (extension; unsafe)
17328 !! wikitext
17329 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
17330 !! html/php
17331 <div style="/* insecure input */"></div>
17332
17333 !! html/parsoid
17334 <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>
17335 !! end
17336
17337 # More MSIE fun discovered by Tom Gilder
17338
17339 !! test
17340 MSIE CSS safety test: spurious slash
17341 !! wikitext
17342 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
17343 !! html/php
17344 <div style="/* insecure input */">evil</div>
17345
17346 !! html/parsoid
17347 <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>
17348 !! end
17349
17350 !! test
17351 MSIE CSS safety test: hex code
17352 !! wikitext
17353 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
17354 !! html/php
17355 <div style="/* insecure input */">evil</div>
17356
17357 !! html/parsoid
17358 <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>
17359 !! end
17360
17361 !! test
17362 MSIE CSS safety test: comment in url
17363 !! wikitext
17364 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
17365 !! html/php
17366 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
17367
17368 !! html/parsoid
17369 <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>
17370 !! end
17371
17372 !! test
17373 MSIE CSS safety test: comment in expression
17374 !! wikitext
17375 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
17376 !! html/php
17377 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
17378
17379 !! html/parsoid
17380 <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>
17381 !! end
17382
17383 !! test
17384 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
17385 !! wikitext
17386 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
17387 !! html/php
17388 <p style="/* invalid control char */">A</p>
17389
17390 !! html/parsoid
17391 <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>
17392 !! end
17393
17394 !! test
17395 MSIE 6 CSS safety test: Fullwidth (T57332)
17396 !! wikitext
17397 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
17398 <div style="top:EXPRESSION(alert())">B</div>
17399 !! html/php
17400 <p style="/* insecure input */">A</p>
17401 <div style="/* insecure input */">B</div>
17402
17403 !! html/parsoid
17404 <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>
17405 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
17406 !! end
17407
17408 !! test
17409 MSIE 6 CSS safety test: IPA extensions (T57332)
17410 !! wikitext
17411 <div style="background-image:uʀʟ(javascript:alert())">A</div>
17412 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
17413 !! html/php
17414 <div style="/* insecure input */">A</div>
17415 <p style="/* insecure input */">B</p>
17416
17417 !! html/parsoid
17418 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
17419 <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>
17420 !! end
17421
17422 !! test
17423 MSIE 6 CSS safety test: sup/sub script (T57332)
17424 !! wikitext
17425 <div style="background-image:url⁽javascript:alert())">A</div>
17426 <div style="background-image:url₍javascript:alert())">B</div>
17427 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
17428 !! html/php
17429 <div style="/* insecure input */">A</div>
17430 <div style="/* insecure input */">B</div>
17431 <p style="/* insecure input */">C</p>
17432
17433 !! html/parsoid
17434 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
17435 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
17436 <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>
17437 !! end
17438
17439 !! test
17440 Opera -o-link CSS
17441 !! options
17442 parsoid=wt2html,html2html
17443 !! wikitext
17444 <div
17445 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;"
17446 style="-o-link:attr(title);-o-link-source:current">X</div>
17447 !! html/php
17448 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
17449
17450 !! html/parsoid
17451 <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>
17452 !! end
17453
17454 !! test
17455 MSIE 6 CSS safety test: Repetition markers (T57332)
17456 !! wikitext
17457 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
17458 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
17459 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
17460 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
17461 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
17462 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
17463 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
17464 !! html/php
17465 <p style="/* insecure input */">A</p>
17466 <p style="/* insecure input */">B</p>
17467 <p style="/* insecure input */">C</p>
17468 <p style="/* insecure input */">D</p>
17469 <p style="/* insecure input */">E</p>
17470 <p style="/* insecure input */">F</p>
17471 <p style="/* insecure input */">G</p>
17472
17473 !! html/parsoid
17474 <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>
17475 <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>
17476 <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>
17477 <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>
17478 <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>
17479 <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>
17480 <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>
17481 !! end
17482
17483 !! test
17484 Table attribute legitimate extension
17485 !! wikitext
17486 {|
17487 !+ style="<nowiki>color:blue</nowiki>"| status
17488 |}
17489 !! html
17490 <table>
17491 <tr>
17492 <th style="color:blue"> status
17493 </th></tr></table>
17494
17495 !!end
17496
17497 !! test
17498 Table attribute safety
17499 !! wikitext
17500 {|
17501 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
17502 |}
17503 !! html
17504 <table>
17505 <tr>
17506 <th style="/* insecure input */"> status
17507 </th></tr></table>
17508
17509 !! end
17510
17511 !! test
17512 CSS line continuation 1
17513 !! wikitext
17514 <div style="background-image: u\&#10;rl(test.jpg);"></div>
17515 !! html
17516 <div style="/* insecure input */"></div>
17517
17518 !! end
17519
17520 !! test
17521 CSS line continuation 2
17522 !! wikitext
17523 <div style="background-image: u\&#13;rl(test.jpg); "></div>
17524 !! html
17525 <div style="/* invalid control char */"></div>
17526
17527 !! end
17528
17529 !! article
17530 Template:Identity
17531 !! text
17532 {{{1}}}
17533 !! endarticle
17534
17535 !! test
17536 Expansion of multi-line templates in attribute values (T8255)
17537 !! wikitext
17538 <div style="background: {{identity|#00FF00}}">-</div>
17539 !! html
17540 <div style="background: #00FF00">-</div>
17541
17542 !! end
17543
17544 !! test
17545 Expansion of multi-line templates in attribute values (T8255 sanity check)
17546 !! wikitext
17547 <div style="background:
17548 #00FF00">-</div>
17549 !! html/php
17550 <div style="background: #00FF00">-</div>
17551
17552 !! html/parsoid
17553 <div style="background:
17554 #00FF00">-</div>
17555 !! end
17556
17557 !! test
17558 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
17559 !! wikitext
17560 <div style="background: &#10;#00FF00">-</div>
17561 !! html
17562 <div style="background: &#10;#00FF00">-</div>
17563
17564 !! end
17565
17566 !! test
17567 Tags which are hidden from Tidy cannot pass through the Sanitizer
17568 !! wikitext
17569 <mw:toc><script>alert();</script></mw:toc>
17570 !! html+tidy
17571 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
17572 !! end
17573
17574 ###
17575 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
17576 ###
17577
17578 !! test
17579 Parser hook: empty input
17580 !! wikitext
17581 <tag></tag>
17582 !! html/php
17583 <pre>
17584 ''
17585 array (
17586 )
17587 </pre>
17588
17589 !! html/parsoid
17590 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17591 !! end
17592
17593 ## Don't expect parsoid to rt this form.
17594 !! test
17595 Parser hook: empty input using terminated empty elements
17596 !! options
17597 parsoid=wt2html,html2html
17598 !! wikitext
17599 <tag/>
17600 !! html/php
17601 <pre>
17602 NULL
17603 array (
17604 )
17605 </pre>
17606
17607 !! html/parsoid
17608 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17609 !! end
17610
17611 !! test
17612 Parser hook: empty input using terminated empty elements (space before)
17613 !! wikitext
17614 <tag />
17615 !! html/php
17616 <pre>
17617 NULL
17618 array (
17619 )
17620 </pre>
17621
17622 !! html/parsoid
17623 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17624 !! end
17625
17626 !! test
17627 Parser hook: basic input
17628 !! wikitext
17629 <tag>input</tag>
17630 !! html/php
17631 <pre>
17632 'input'
17633 array (
17634 )
17635 </pre>
17636
17637 !! html/parsoid
17638 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17639 !! end
17640
17641 ## Don't expect parsoid to rt this form.
17642 !! test
17643 Parser hook: case insensitive
17644 !! options
17645 parsoid=wt2html,html2html
17646 !! wikitext
17647 <TAG>input</TAG>
17648 !! html/php
17649 <pre>
17650 'input'
17651 array (
17652 )
17653 </pre>
17654
17655 !! html/parsoid
17656 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17657 !! end
17658
17659 ## Don't expect parsoid to rt this form.
17660 !! test
17661 Parser hook: case insensitive, redux
17662 !! options
17663 parsoid=wt2html,html2html
17664 !! wikitext
17665 <TaG>input</TAg>
17666 !! html/php
17667 <pre>
17668 'input'
17669 array (
17670 )
17671 </pre>
17672
17673 !! html/parsoid
17674 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17675 !! end
17676
17677 !! test
17678 Parser hook: nested tags
17679 !! wikitext
17680 <tag><tag></tag></tag>
17681 !! html/php
17682 <pre>
17683 '<tag>'
17684 array (
17685 )
17686 </pre>&lt;/tag&gt;
17687
17688 !! html/parsoid
17689 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
17690 !! end
17691
17692 !! test
17693 Parser hook: basic arguments
17694 !! wikitext
17695 <tag width="200" height="100" depth="50" square=""></tag>
17696 !! html/php
17697 <pre>
17698 ''
17699 array (
17700 'width' => '200',
17701 'height' => '100',
17702 'depth' => '50',
17703 'square' => '',
17704 )
17705 </pre>
17706
17707 !! html/parsoid
17708 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17709 !! end
17710
17711 ## Don't expect parsoid to rt this form.
17712 !! test
17713 Parser hook: basic arguments, variations
17714 !! options
17715 parsoid=wt2html,html2html
17716 !! wikitext
17717 <tag width=200 height = "100" depth = '50' square></tag>
17718 !! html/php
17719 <pre>
17720 ''
17721 array (
17722 'width' => '200',
17723 'height' => '100',
17724 'depth' => '50',
17725 'square' => '',
17726 )
17727 </pre>
17728
17729 !! html/parsoid
17730 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17731 !! end
17732
17733 !! test
17734 Parser hook: argument containing a forward slash (T7344)
17735 !! wikitext
17736 <tag filename="/tmp/bla"></tag>
17737 !! html/php
17738 <pre>
17739 ''
17740 array (
17741 'filename' => '/tmp/bla',
17742 )
17743 </pre>
17744
17745 !! html/parsoid
17746 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17747 !! end
17748
17749 ## Don't expect parsoid to rt this form.
17750 !! test
17751 Parser hook: empty input using terminated empty elements (T4374)
17752 !! options
17753 parsoid=wt2html,html2html
17754 !! wikitext
17755 <tag foo=bar/>text
17756 !! html/php
17757 <pre>
17758 NULL
17759 array (
17760 'foo' => 'bar',
17761 )
17762 </pre>text
17763
17764 !! html/parsoid
17765 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
17766 !! end
17767
17768 ## </tag> should be output literally since there is no matching tag that begins it
17769 ## Don't expect parsoid to rt this form.
17770 !! test
17771 Parser hook: basic arguments using terminated empty elements (T4374)
17772 !! options
17773 parsoid=wt2html
17774 !! wikitext
17775 <tag width=200 height = "100" depth = '50' square/>
17776 other stuff
17777 </tag>
17778 !! html/php
17779 <pre>
17780 NULL
17781 array (
17782 'width' => '200',
17783 'height' => '100',
17784 'depth' => '50',
17785 'square' => '',
17786 )
17787 </pre>
17788 <p>other stuff
17789 &lt;/tag&gt;
17790 </p>
17791 !! html/parsoid
17792 <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
17793 &lt;/tag></p>
17794 !! end
17795
17796 ## Don't expect parsoid to rt this form.
17797 !! test
17798 Parser hook: Don't allow unclosed extension tags
17799 !! options
17800 parsoid=wt2html
17801 !! wikitext
17802 test <tag>123
17803
17804 this is a '''test'''
17805 !! html/php
17806 <p>test &lt;tag&gt;123
17807 </p><p>this is a <b>test</b>
17808 </p>
17809 !! html/parsoid
17810 <p>test &lt;tag>123</p>
17811
17812 <p>this is a <b>test</b></p>
17813 !! end
17814
17815 ###
17816 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17817 ###
17818
17819 !! test
17820 Parser hook: static parser hook not inside a comment
17821 !! wikitext
17822 <statictag>hello, world</statictag>
17823
17824 <statictag action="flush" />
17825 !! html/php
17826 <p><br />
17827 hello, world
17828 </p>
17829 !! html/parsoid
17830 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17831 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17832 !! end
17833
17834 !! test
17835 Parser hook: static parser hook inside a comment
17836 !! wikitext
17837 <!-- <statictag>hello, world</statictag> -->
17838 <statictag action="flush" />
17839 !! html/php
17840 <p><br />
17841 </p>
17842 !! html/parsoid
17843 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17844 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17845 !! end
17846
17847 # Nested template calls; this case was broken by Parser.php rev 1.506,
17848 # since reverted.
17849
17850 !! article
17851 Template:One-parameter
17852 !! text
17853 (My parameter is: {{{1}}})
17854 !! endarticle
17855
17856 !! article
17857 Template:Map-one-parameter
17858 !! text
17859 {{{{{1}}}|{{{2}}}}}
17860 !! endarticle
17861
17862 !! test
17863 Nested template calls
17864 !! wikitext
17865 {{Map-one-parameter|One-parameter|param}}
17866 !! html
17867 <p>(My parameter is: param)
17868 </p>
17869 !! end
17870
17871
17872 ###
17873 ### Sanitizer
17874 ###
17875
17876 # HTML+Tidy effectively strips out the empty tags completely
17877 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17878 # which Tidy would have done for the PHP parser had there been content inside it.
17879 !! test
17880 Sanitizer: Closing of open tags
17881 !! wikitext
17882 <s></s><table></table>
17883 !! html
17884 <s></s><table></table>
17885
17886 !! html/parsoid
17887 <p><s></s></p><table></table>
17888 !! end
17889
17890 !! test
17891 Sanitizer: Closing of open but not closed tags
17892 !! wikitext
17893 <s>foo
17894 !! html
17895 <p><s>foo</s>
17896 </p>
17897 !! end
17898
17899 !! test
17900 Sanitizer: Closing of closed but not open tags
17901 !! options
17902 parsoid=wt2html
17903 !! wikitext
17904 </s>
17905 !! html/php+tidy
17906 !! html/parsoid
17907 !! end
17908
17909 !! test
17910 Sanitizer: Closing of closed but not open table tags
17911 !! options
17912 parsoid=wt2html
17913 !! wikitext
17914 Table not started</td></tr></table>
17915 !! html/php+tidy
17916 <p>Table not started</p>
17917 !! html/parsoid
17918 <p>Table not started</p>
17919 !! end
17920
17921 !! test
17922 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17923 !! wikitext
17924 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17925 !! html/php
17926 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17927 </p>
17928 !! html/parsoid
17929 <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>
17930 !! end
17931
17932 # In HTML5, the restrictions are that id must contain at least one character,
17933 # and must not contain any space characters.
17934 !! test
17935 Sanitizer: Validating the contents of the id attribute (T6515)
17936 !! options
17937 disabled
17938 !! wikitext
17939 <br id="" /><br id="a space" />
17940 !! html
17941 Something ...
17942 !! end
17943
17944 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17945 !! test
17946 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
17947 !! options
17948 disabled
17949 !! wikitext
17950 <br id="foo" /><br id="foo" />
17951 !! html
17952 Something need to be done. foo-2 ?
17953 !! end
17954
17955 !! test
17956 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17957 !! wikitext
17958 <div itemscope>
17959 <meta itemprop="hello" content="world">
17960 <meta http-equiv="refresh" content="5">
17961 <meta itemprop="hello" http-equiv="refresh" content="5">
17962 <link itemprop="hello" href="{{SERVER}}">
17963 <link rel="stylesheet" href="{{SERVER}}">
17964 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17965 </div>
17966 !! html
17967 <div itemscope="">
17968 <p> <meta itemprop="hello" content="world" />
17969 &lt;meta http-equiv="refresh" content="5"&gt;
17970 <meta itemprop="hello" content="5" />
17971 <link itemprop="hello" href="http&#58;//example.org" />
17972 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17973 <link itemprop="hello" href="http&#58;//example.org" />
17974 </p>
17975 </div>
17976
17977 !! end
17978
17979 !! test
17980 Sanitizer: Strip comments from CSS attributes
17981 !! options
17982 parsoid=wt2html,wt2wt
17983 !! wikitext
17984 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
17985 !! html/php
17986 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
17987 </p>
17988 !! html/parsoid
17989 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
17990 !! end
17991
17992 !! test
17993 Language converter: output gets cut off unexpectedly (T7757)
17994 !! options
17995 language=zh
17996 !! wikitext
17997 this bit is safe: }-
17998
17999 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18000
18001 then we get cut off here: }-
18002
18003 all additional text is vanished
18004 !! html
18005 <p>this bit is safe: }-
18006 </p><p>but if we add a conversion instance: xxx
18007 </p><p>then we get cut off here: }-
18008 </p><p>all additional text is vanished
18009 </p>
18010 !! end
18011
18012 !! test
18013 Self closed html pairs (T7487)
18014 !! wikitext
18015 <center><font id="bug" />Centered text</center>
18016 <div><font id="bug2" />In div text</div>
18017 !! html+tidy
18018 <center><font id="bug"></font>Centered text</center>
18019 <div><font id="bug2"></font>In div text</div>
18020 !! end
18021
18022 #
18023 #
18024 #
18025
18026 !! test
18027 Punctuation: nbsp before exclamation
18028 !! wikitext
18029 C'est grave !
18030 !! html
18031 <p>C'est grave&#160;!
18032 </p>
18033 !! end
18034
18035 !! test
18036 Punctuation: CSS !important (T13874)
18037 !! wikitext
18038 <div style="width:50% !important">important</div>
18039 !! html
18040 <div style="width:50% !important">important</div>
18041
18042 !!end
18043
18044 !! test
18045 Punctuation: CSS ! important (T13874; with space after)
18046 !! wikitext
18047 <div style="width:50% ! important">important</div>
18048 !! html
18049 <div style="width:50% ! important">important</div>
18050
18051 !!end
18052
18053 !! test
18054 HTML bullet list, closed tags (T7497)
18055 !! wikitext
18056 <ul>
18057 <li>One</li>
18058 <li>Two</li>
18059 </ul>
18060 !! html/php
18061 <ul>
18062 <li>One</li>
18063 <li>Two</li>
18064 </ul>
18065
18066 !! html/parsoid
18067 <ul data-parsoid='{"stx":"html"}'>
18068 <li data-parsoid='{"stx":"html"}'>One</li>
18069 <li data-parsoid='{"stx":"html"}'>Two</li>
18070 </ul>
18071
18072 !! end
18073
18074 !! test
18075 HTML bullet list, unclosed tags (T7497)
18076 !! wikitext
18077 <ul>
18078 <li>One
18079 <li>Two
18080 </ul>
18081 !! html/php+tidy
18082 <ul>
18083 <li>One</li>
18084 <li>Two</li>
18085 </ul>
18086 !! html/parsoid
18087 <ul data-parsoid='{"stx":"html"}'>
18088 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18089 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18090 </ul>
18091
18092 !! end
18093
18094 !! test
18095 HTML ordered list, closed tags (T7497)
18096 !! wikitext
18097 <ol>
18098 <li>One</li>
18099 <li>Two</li>
18100 </ol>
18101 !! html/php
18102 <ol>
18103 <li>One</li>
18104 <li>Two</li>
18105 </ol>
18106
18107 !! html/parsoid
18108 <ol data-parsoid='{"stx":"html"}'>
18109 <li data-parsoid='{"stx":"html"}'>One</li>
18110 <li data-parsoid='{"stx":"html"}'>Two</li>
18111 </ol>
18112
18113 !! end
18114
18115 !! test
18116 HTML ordered list, unclosed tags (T7497)
18117 !! options
18118 !! wikitext
18119 <ol>
18120 <li>One
18121 <li>Two
18122 </ol>
18123 !! html/php+tidy
18124 <ol>
18125 <li>One</li>
18126 <li>Two</li>
18127 </ol>
18128 !! html/parsoid
18129 <ol data-parsoid='{"stx":"html"}'>
18130 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18131 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18132 </ol>
18133
18134 !! end
18135
18136 !! test
18137 HTML nested bullet list, closed tags (T7497)
18138 !! wikitext
18139 <ul>
18140 <li>One</li>
18141 <li>Two:
18142 <ul>
18143 <li>Sub-one</li>
18144 <li>Sub-two</li>
18145 </ul>
18146 </li>
18147 </ul>
18148 !! html/php
18149 <ul>
18150 <li>One</li>
18151 <li>Two:
18152 <ul>
18153 <li>Sub-one</li>
18154 <li>Sub-two</li>
18155 </ul>
18156 </li>
18157 </ul>
18158
18159 !! html/parsoid
18160 <ul data-parsoid='{"stx":"html"}'>
18161 <li data-parsoid='{"stx":"html"}'>One</li>
18162 <li data-parsoid='{"stx":"html"}'>Two:
18163 <ul data-parsoid='{"stx":"html"}'>
18164 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
18165 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
18166 </ul>
18167 </li>
18168 </ul>
18169 !! end
18170
18171 !! test
18172 HTML nested bullet list, open tags (T7497)
18173 !! wikitext
18174 <ul>
18175 <li>One
18176 <li>Two:
18177 <ul>
18178 <li>Sub-one
18179 <li>Sub-two
18180 </ul>
18181 </ul>
18182 !! html/php+tidy
18183 <ul>
18184 <li>One</li>
18185 <li>Two:
18186 <ul>
18187 <li>Sub-one</li>
18188 <li>Sub-two</li>
18189 </ul>
18190 </li>
18191 </ul>
18192 !! html/parsoid
18193 <ul>
18194 <li>One
18195 </li>
18196 <li>Two:
18197 <ul>
18198 <li>Sub-one
18199 </li>
18200 <li>Sub-two
18201 </li>
18202 </ul>
18203 </li>
18204 </ul>
18205
18206 !! end
18207
18208 !! test
18209 HTML nested ordered list, closed tags (T7497)
18210 !! wikitext
18211 <ol>
18212 <li>One</li>
18213 <li>Two:
18214 <ol>
18215 <li>Sub-one</li>
18216 <li>Sub-two</li>
18217 </ol>
18218 </li>
18219 </ol>
18220 !! html
18221 <ol>
18222 <li>One</li>
18223 <li>Two:
18224 <ol>
18225 <li>Sub-one</li>
18226 <li>Sub-two</li>
18227 </ol>
18228 </li>
18229 </ol>
18230
18231 !! end
18232
18233 !! test
18234 HTML nested ordered list, open tags (T7497)
18235 !! wikitext
18236 <ol>
18237 <li>One
18238 <li>Two:
18239 <ol>
18240 <li>Sub-one
18241 <li>Sub-two
18242 </ol>
18243 </ol>
18244 !! html/php
18245 <ol>
18246 <li>One
18247 <li>Two:
18248 <ol>
18249 <li>Sub-one
18250 <li>Sub-two
18251 </ol>
18252 </ol>
18253
18254 !! html/parsoid
18255 <ol>
18256 <li>One
18257 </li>
18258 <li>Two:
18259 <ol>
18260 <li>Sub-one
18261 </li>
18262 <li>Sub-two
18263 </li>
18264 </ol>
18265 </li>
18266 </ol>
18267
18268 !! end
18269
18270 !! test
18271 HTML ordered list item with parameters oddity
18272 !! wikitext
18273 <ol><li id="fragment">One</li>
18274 </ol>
18275 !! html
18276 <ol><li id="fragment">One</li>
18277 </ol>
18278
18279 !! end
18280
18281 # parsoid doesn't explicitly mark autonumbered links, see T55505
18282 !!test
18283 T7918: autonumbering
18284 !! wikitext
18285 [http://first/] [http://second] [ftp://ftp]
18286
18287 ftp://inlineftp
18288
18289 [mailto:enclosed@mail.tld With target]
18290
18291 [mailto:enclosed@mail.tld]
18292
18293 mailto:inline@mail.tld
18294 !! html/php
18295 <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>
18296 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
18297 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
18298 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
18299 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
18300 </p>
18301 !! html/parsoid
18302 <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>
18303 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
18304 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
18305 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
18306 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
18307 !! end
18308
18309
18310 #
18311 # Security and HTML correctness
18312 # From Nick Jenkins' fuzz testing
18313 #
18314
18315 !! test
18316 Fuzz testing: Parser13
18317 !! wikitext
18318 {|
18319 | http://a|
18320 !! html
18321 <table>
18322 <tr>
18323 <td>
18324 </td>
18325 </tr>
18326 </table>
18327
18328 !! end
18329
18330 !! test
18331 Fuzz testing: Parser14
18332 !! wikitext
18333 == onmouseover= ==
18334 http://__TOC__
18335 !! html
18336 <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>
18337 http://<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
18338 <ul>
18339 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18340 </ul>
18341 </div>
18342
18343
18344 !! html+tidy
18345 <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>
18346 <p>http://</p>
18347 <div id="toc" class="toc">
18348 <div class="toctitle">
18349 <h2>Contents</h2>
18350 </div>
18351 <ul>
18352 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18353 </ul>
18354 </div>
18355 <p></p>
18356 !! end
18357
18358 !! test
18359 Fuzz testing: Parser14-table
18360 !! options
18361 parsoid=wt2html,html2html
18362 !! wikitext
18363 ==a==
18364 {| STYLE=__TOC__
18365 !! html
18366 <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>
18367 <table style="&#95;_TOC&#95;_">
18368 <tr><td></td></tr>
18369 </table>
18370
18371 !! html+tidy
18372 <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>
18373 <table style="__TOC__">
18374 <tr>
18375 <td></td>
18376 </tr>
18377 </table>
18378 !! html/parsoid
18379 <h2>a</h2>
18380 <table style="__TOC__"></table>
18381 !! end
18382
18383 # Known to produce bogus xml (extra </td>)
18384 !! test
18385 Fuzz testing: Parser16
18386 !! wikitext
18387 {|
18388 !https://||||||
18389 !! html
18390 <table>
18391 <tr>
18392 <th>https://</th>
18393 <th></th>
18394 <th></th>
18395 <th>
18396 </td>
18397 </tr>
18398 </table>
18399
18400 !! html+tidy
18401 <table>
18402 <tr>
18403 <th>https://</th>
18404 <th></th>
18405 <th></th>
18406 <th></th>
18407 </tr>
18408 </table>
18409 !! end
18410
18411 !! test
18412 Fuzz testing: Parser21
18413 !! wikitext
18414 {|
18415 ! irc://{{ftp://a" onmouseover="alert('hello world');"
18416 |
18417 !! html
18418 <table>
18419 <tr>
18420 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
18421 </th>
18422 <td>
18423 </td>
18424 </tr>
18425 </table>
18426
18427 !! end
18428
18429 !! test
18430 Fuzz testing: Parser22
18431 !! wikitext
18432 http://===r:::https://b
18433
18434 {|
18435 !! html
18436 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
18437 </p>
18438 <table>
18439 <tr><td></td></tr>
18440 </table>
18441
18442 !! end
18443
18444 # Known to produce bad XML for now
18445 !! test
18446 Fuzz testing: Parser24
18447 !! options
18448 parsoid=wt2html
18449 !! wikitext
18450 {|
18451 {{{|
18452 <u CLASS=
18453 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
18454 <br style="onmouseover='alert(document.cookie);' " />
18455
18456 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18457 |
18458 !! html/php
18459 <table>
18460 {{{|
18461 <u class="&#124;">}}}} &gt;
18462 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
18463
18464 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18465 <tr>
18466 <td></u>
18467 </td>
18468 </tr>
18469 </table>
18470
18471 !! html/parsoid
18472 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
18473 <u class="|" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":""},"autoInsertedEnd":true}'><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>}}}} >
18474 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/></u></p><p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><u class="|" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":""},"autoInsertedEnd":true,"autoInsertedStart":true}'>MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p><table data-parsoid='{"autoInsertedEnd":true}'>
18475
18476
18477
18478 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
18479 !! end
18480
18481 # Note: the current result listed for this is not what the original one was,
18482 # but the original bug was JavaScript injection, which is fixed in any case.
18483 # It's not clear that the original result listed was any more correct than the
18484 # current one. Original result:
18485 # <p>{{{|
18486 # </p>
18487 # <li class="&#124;&#124;">
18488 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18489 !!test
18490 Fuzz testing: Parser25 (T8055)
18491 !! wikitext
18492 {{{
18493 |
18494 <LI CLASS=||
18495 >
18496 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
18497 !! html/php
18498 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18499 </p>
18500 !! html/parsoid
18501 <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"]}'>
18502 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
18503 !! end
18504
18505 !!test
18506 Fuzz testing: URL adjacent extension (with space, clean)
18507 !! wikitext
18508 http://example.com <nowiki>junk</nowiki>
18509 !! html/php
18510 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
18511 </p>
18512 !! html/parsoid
18513 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
18514 !! end
18515
18516 !!test
18517 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
18518 !! wikitext
18519 http://example.com<nowiki>junk</nowiki>
18520 !! html/php
18521 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
18522 </p>
18523 !! html/parsoid
18524 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
18525 !! end
18526
18527 !! test
18528 Fuzz testing: URL adjacent extension (no space, dirty; pre)
18529 !! wikitext
18530 http://example.com<pre>junk</pre>
18531 !! html/php
18532 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
18533
18534 !! html/php+tidy
18535 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
18536 <pre>
18537 junk
18538 </pre>
18539 !! html/parsoid
18540 <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>
18541 !! end
18542
18543 !! test
18544 Fuzz testing: image with bogus manual thumbnail
18545 !! wikitext
18546 [[Image:foobar.jpg|thumbnail= ]]
18547 !! html/php
18548 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
18549
18550 !! html/parsoid
18551 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}' data-mw='{"errors":[{"key":"apierror-invalidtitle","message":"Invalid thumbnail title.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"Image:foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/Foobar.jpg" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
18552 !! end
18553
18554 !! test
18555 Fuzz testing: encoded newline in generated HTML replacements (T8577)
18556 !! wikitext
18557 <pre dir="&#10;"></pre>
18558 !! html/php
18559 <pre dir="&#10;"></pre>
18560
18561 !! html/parsoid
18562 <pre typeof="mw:Extension/pre" about="#mwt2" dir="&amp;#10;" data-mw='{"name":"pre","attrs":{"dir":"&amp;#10;"},"body":{"extsrc":""}}'></pre>
18563 !! end
18564
18565 !! test
18566 Parsing optional HTML elements (T8171)
18567 !! options
18568 !! wikitext
18569 <table>
18570 <tr>
18571 <td> Some tabular data</td>
18572 <td> More tabular data ...
18573 <td> And yet som tabular data</td>
18574 </tr>
18575 </table>
18576 !! html
18577 <table>
18578 <tr>
18579 <td> Some tabular data</td>
18580 <td> More tabular data ...
18581 </td><td> And yet som tabular data</td>
18582 </tr>
18583 </table>
18584
18585 !! end
18586
18587 !! test
18588 Correct handling of <td>, <tr> (T8171)
18589 !! options
18590 !! wikitext
18591 <table>
18592 <tr>
18593 <td> Some tabular data</td>
18594 <td> More tabular data ...</td>
18595 <td> And yet som tabular data</td>
18596 </tr>
18597 </table>
18598 !! html
18599 <table>
18600 <tr>
18601 <td> Some tabular data</td>
18602 <td> More tabular data ...</td>
18603 <td> And yet som tabular data</td>
18604 </tr>
18605 </table>
18606
18607 !! end
18608
18609
18610 !! test
18611 Parsing crashing regression (fr:JavaScript)
18612 !! wikitext
18613 </body></x>
18614 !! html
18615 <p>&lt;/body&gt;&lt;/x&gt;
18616 </p>
18617 !! end
18618
18619 !! test
18620 Inline wiki vs wiki block nesting
18621 !! wikitext
18622 '''Bold paragraph
18623
18624 New wiki paragraph
18625 !! html
18626 <p><b>Bold paragraph</b>
18627 </p><p>New wiki paragraph
18628 </p>
18629 !! end
18630
18631 # FIXME: The current php output is documented
18632 # and desired output is the parsoid target.
18633 !! test
18634 Inline HTML vs wiki block nesting
18635 !! wikitext
18636 <b>Bold paragraph
18637
18638 New wiki paragraph
18639 !! html/php
18640 <p><b>Bold paragraph
18641 </p><p>New wiki paragraph</b>
18642 </p>
18643 !! html/parsoid
18644 <p><b>Bold paragraph</b>
18645 </p><p>New wiki paragraph
18646 </p>
18647 !! end
18648
18649 # Original result was this:
18650 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
18651 # </p>
18652 # While that might be marginally more intuitive, maybe, the six-apostrophe
18653 # construct is clearly pathological and the result stated here (which is what
18654 # the parser actually does) is about as reasonable as anything.
18655 !!test
18656 Mixing markup for italics and bold
18657 !! options
18658 !! wikitext
18659 '''bold''''''bold''bolditalics'''''
18660 !! html
18661 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
18662 </p>
18663 !! end
18664
18665
18666 !! article
18667 Xyzzyx
18668 !! text
18669 Article for special page transclusion test
18670 !! endarticle
18671
18672 !! test
18673 Special page transclusion
18674 !! options
18675 !! wikitext
18676 {{Special:Prefixindex/Xyzzyx}}
18677 !! html
18678 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18679 </ul>
18680
18681 !! end
18682
18683 !! test
18684 Special page transclusion twice (T7021)
18685 !! options
18686 !! wikitext
18687 {{Special:Prefixindex/Xyzzyx}}
18688 {{Special:Prefixindex/Xyzzyx}}
18689 !! html
18690 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18691 </ul>
18692 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18693 </ul>
18694
18695 !! end
18696
18697 !! test
18698 Transclusion of default MediaWiki message
18699 !! wikitext
18700 {{MediaWiki:Mainpage}}
18701 !! html
18702 <p>Main Page
18703 </p>
18704 !! end
18705
18706 !! test
18707 Transclusion of nonexistent MediaWiki message
18708 !! wikitext
18709 {{MediaWiki:Mainpagexxx}}
18710 !! html
18711 <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>
18712 </p>
18713 !! end
18714
18715 !! test
18716 Transclusion of MediaWiki message with underscore
18717 !! wikitext
18718 {{MediaWiki:history_short}}
18719 !! html
18720 <p>History
18721 </p>
18722 !! end
18723
18724 !! test
18725 Transclusion of MediaWiki message with space
18726 !! wikitext
18727 {{MediaWiki:history short}}
18728 !! html
18729 <p>History
18730 </p>
18731 !! end
18732
18733 !! test
18734 Invalid header with following text
18735 !! wikitext
18736 = x = y
18737 !! html
18738 <p>= x = y
18739 </p>
18740 !! end
18741
18742
18743 !! test
18744 Section extraction test (section 0)
18745 !! options
18746 section=0
18747 !! wikitext
18748 start
18749 ==a==
18750 ===aa===
18751 ====aaa====
18752 ==b==
18753 ===ba===
18754 ===bb===
18755 ====bba====
18756 ===bc===
18757 ==c==
18758 ===ca===
18759 !! html/php
18760 start
18761 !! end
18762
18763 !! test
18764 Section extraction test (section 1)
18765 !! options
18766 section=1
18767 !! wikitext
18768 start
18769 ==a==
18770 ===aa===
18771 ====aaa====
18772 ==b==
18773 ===ba===
18774 ===bb===
18775 ====bba====
18776 ===bc===
18777 ==c==
18778 ===ca===
18779 !! html/php
18780 ==a==
18781 ===aa===
18782 ====aaa====
18783 !! end
18784
18785 !! test
18786 Section extraction test (section 2)
18787 !! options
18788 section=2
18789 !! wikitext
18790 start
18791 ==a==
18792 ===aa===
18793 ====aaa====
18794 ==b==
18795 ===ba===
18796 ===bb===
18797 ====bba====
18798 ===bc===
18799 ==c==
18800 ===ca===
18801 !! html/php
18802 ===aa===
18803 ====aaa====
18804 !! end
18805
18806 !! test
18807 Section extraction test (section 3)
18808 !! options
18809 section=3
18810 !! wikitext
18811 start
18812 ==a==
18813 ===aa===
18814 ====aaa====
18815 ==b==
18816 ===ba===
18817 ===bb===
18818 ====bba====
18819 ===bc===
18820 ==c==
18821 ===ca===
18822 !! html/php
18823 ====aaa====
18824 !! end
18825
18826 !! test
18827 Section extraction test (section 4)
18828 !! options
18829 section=4
18830 !! wikitext
18831 start
18832 ==a==
18833 ===aa===
18834 ====aaa====
18835 ==b==
18836 ===ba===
18837 ===bb===
18838 ====bba====
18839 ===bc===
18840 ==c==
18841 ===ca===
18842 !! html/php
18843 ==b==
18844 ===ba===
18845 ===bb===
18846 ====bba====
18847 ===bc===
18848 !! end
18849
18850 !! test
18851 Section extraction test (section 5)
18852 !! options
18853 section=5
18854 !! wikitext
18855 start
18856 ==a==
18857 ===aa===
18858 ====aaa====
18859 ==b==
18860 ===ba===
18861 ===bb===
18862 ====bba====
18863 ===bc===
18864 ==c==
18865 ===ca===
18866 !! html/php
18867 ===ba===
18868 !! end
18869
18870 !! test
18871 Section extraction test (section 6)
18872 !! options
18873 section=6
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 ===bb===
18888 ====bba====
18889 !! end
18890
18891 !! test
18892 Section extraction test (section 7)
18893 !! options
18894 section=7
18895 !! wikitext
18896 start
18897 ==a==
18898 ===aa===
18899 ====aaa====
18900 ==b==
18901 ===ba===
18902 ===bb===
18903 ====bba====
18904 ===bc===
18905 ==c==
18906 ===ca===
18907 !! html/php
18908 ====bba====
18909 !! end
18910
18911 !! test
18912 Section extraction test (section 8)
18913 !! options
18914 section=8
18915 !! wikitext
18916 start
18917 ==a==
18918 ===aa===
18919 ====aaa====
18920 ==b==
18921 ===ba===
18922 ===bb===
18923 ====bba====
18924 ===bc===
18925 ==c==
18926 ===ca===
18927 !! html/php
18928 ===bc===
18929 !! end
18930
18931 !! test
18932 Section extraction test (section 9)
18933 !! options
18934 section=9
18935 !! wikitext
18936 start
18937 ==a==
18938 ===aa===
18939 ====aaa====
18940 ==b==
18941 ===ba===
18942 ===bb===
18943 ====bba====
18944 ===bc===
18945 ==c==
18946 ===ca===
18947 !! html/php
18948 ==c==
18949 ===ca===
18950 !! end
18951
18952 !! test
18953 Section extraction test (section 10)
18954 !! options
18955 section=10
18956 !! wikitext
18957 start
18958 ==a==
18959 ===aa===
18960 ====aaa====
18961 ==b==
18962 ===ba===
18963 ===bb===
18964 ====bba====
18965 ===bc===
18966 ==c==
18967 ===ca===
18968 !! html/php
18969 ===ca===
18970 !! end
18971
18972 !! test
18973 Section extraction test (nonexistent section 11)
18974 !! options
18975 section=11
18976 !! wikitext
18977 start
18978 ==a==
18979 ===aa===
18980 ====aaa====
18981 ==b==
18982 ===ba===
18983 ===bb===
18984 ====bba====
18985 ===bc===
18986 ==c==
18987 ===ca===
18988 !! html/php
18989 !! end
18990
18991 !! test
18992 Section extraction test with bogus heading (section 1)
18993 !! options
18994 section=1
18995 !! wikitext
18996 ==a==
18997 ==bogus== not a legal section
18998 ==b==
18999 !! html/php
19000 ==a==
19001 ==bogus== not a legal section
19002 !! end
19003
19004 !! test
19005 Section extraction test with bogus heading (section 2)
19006 !! options
19007 section=2
19008 !! wikitext
19009 ==a==
19010 ==bogus== not a legal section
19011 ==b==
19012 !! html/php
19013 ==b==
19014 !! end
19015
19016 !! test
19017 Section extraction test with comment after heading (section 1)
19018 !! options
19019 section=1
19020 !! wikitext
19021 ==a==
19022 ==b== <!-- -->
19023 ==c==
19024 !! html/php
19025 ==a==
19026 !! end
19027
19028 !! test
19029 Section extraction test with comment after heading (section 2)
19030 !! options
19031 section=2
19032 !! wikitext
19033 ==a==
19034 ==b== <!-- -->
19035 ==c==
19036 !! html/php
19037 ==b== <!-- -->
19038 !! end
19039
19040 !! test
19041 Section extraction test with bogus <nowiki> heading (section 1)
19042 !! options
19043 section=1
19044 !! wikitext
19045 ==a==
19046 ==bogus== <nowiki>not a legal section</nowiki>
19047 ==b==
19048 !! html/php
19049 ==a==
19050 ==bogus== <nowiki>not a legal section</nowiki>
19051 !! end
19052
19053 !! test
19054 Section extraction test with bogus <nowiki> heading (section 2)
19055 !! options
19056 section=2
19057 !! wikitext
19058 ==a==
19059 ==bogus== <nowiki>not a legal section</nowiki>
19060 ==b==
19061 !! html/php
19062 ==b==
19063 !! end
19064
19065 # Formerly testing for T4587, now resolved by the use of unmarked sections
19066 # instead of respecting commented sections
19067 !! test
19068 Section extraction prefixed by comment (section 1)
19069 !! options
19070 section=1
19071 !! wikitext
19072 <!-- -->==sec1==
19073 ==sec2==
19074 !! html/php
19075 ==sec2==
19076 !!end
19077
19078 !! test
19079 Section extraction prefixed by comment (section 2)
19080 !! options
19081 section=2
19082 !! wikitext
19083 <!-- -->==sec1==
19084 ==sec2==
19085 !! html/php
19086
19087 !!end
19088
19089 # Formerly testing for T4607, now resolved by the use of unmarked sections
19090 # instead of respecting HTML-style headings
19091 !! test
19092 Section extraction, mixed wiki and html (section 1)
19093 !! options
19094 section=1
19095 !! wikitext
19096 <h2>unmarked</h2>
19097 unmarked
19098 ==1==
19099 one
19100 ==2==
19101 two
19102 !! html/php
19103 ==1==
19104 one
19105 !! end
19106
19107 !! test
19108 Section extraction, mixed wiki and html (section 2)
19109 !! options
19110 section=2
19111 !! wikitext
19112 <h2>unmarked</h2>
19113 unmarked
19114 ==1==
19115 one
19116 ==2==
19117 two
19118 !! html/php
19119 ==2==
19120 two
19121 !! end
19122
19123
19124 # Formerly testing for T5342
19125 !! test
19126 Section extraction, heading surrounded by <noinclude>
19127 !! options
19128 section=1
19129 !! wikitext
19130 <noinclude>==unmarked==</noinclude>
19131 ==marked==
19132 !! html/php
19133 ==marked==
19134 !!end
19135
19136 # Test behavior of T21910
19137 !! test
19138 Sectiion with all-equals
19139 !! options
19140 section=2
19141 !! wikitext
19142 ===
19143 The line above must have a trailing space
19144 === <!--
19145 --> <!-- -->
19146 But just in case it doesn't...
19147 !! html/php
19148 === <!--
19149 --> <!-- -->
19150 But just in case it doesn't...
19151 !! end
19152
19153 !! test
19154 Section replacement test (section 0)
19155 !! options
19156 replace=0,"xxx"
19157 !! wikitext
19158 start
19159 ==a==
19160 ===aa===
19161 ====aaa====
19162 ==b==
19163 ===ba===
19164 ===bb===
19165 ====bba====
19166 ===bc===
19167 ==c==
19168 ===ca===
19169 !! html/php
19170 xxx
19171
19172 ==a==
19173 ===aa===
19174 ====aaa====
19175 ==b==
19176 ===ba===
19177 ===bb===
19178 ====bba====
19179 ===bc===
19180 ==c==
19181 ===ca===
19182 !! end
19183
19184 !! test
19185 Section replacement test (section 1)
19186 !! options
19187 replace=1,"xxx"
19188 !! wikitext
19189 start
19190 ==a==
19191 ===aa===
19192 ====aaa====
19193 ==b==
19194 ===ba===
19195 ===bb===
19196 ====bba====
19197 ===bc===
19198 ==c==
19199 ===ca===
19200 !! html/php
19201 start
19202 xxx
19203
19204 ==b==
19205 ===ba===
19206 ===bb===
19207 ====bba====
19208 ===bc===
19209 ==c==
19210 ===ca===
19211 !! end
19212
19213 !! test
19214 Section replacement test (section 2)
19215 !! options
19216 replace=2,"xxx"
19217 !! wikitext
19218 start
19219 ==a==
19220 ===aa===
19221 ====aaa====
19222 ==b==
19223 ===ba===
19224 ===bb===
19225 ====bba====
19226 ===bc===
19227 ==c==
19228 ===ca===
19229 !! html/php
19230 start
19231 ==a==
19232 xxx
19233
19234 ==b==
19235 ===ba===
19236 ===bb===
19237 ====bba====
19238 ===bc===
19239 ==c==
19240 ===ca===
19241 !! end
19242
19243 !! test
19244 Section replacement test (section 3)
19245 !! options
19246 replace=3,"xxx"
19247 !! wikitext
19248 start
19249 ==a==
19250 ===aa===
19251 ====aaa====
19252 ==b==
19253 ===ba===
19254 ===bb===
19255 ====bba====
19256 ===bc===
19257 ==c==
19258 ===ca===
19259 !! html/php
19260 start
19261 ==a==
19262 ===aa===
19263 xxx
19264
19265 ==b==
19266 ===ba===
19267 ===bb===
19268 ====bba====
19269 ===bc===
19270 ==c==
19271 ===ca===
19272 !! end
19273
19274 !! test
19275 Section replacement test (section 4)
19276 !! options
19277 replace=4,"xxx"
19278 !! wikitext
19279 start
19280 ==a==
19281 ===aa===
19282 ====aaa====
19283 ==b==
19284 ===ba===
19285 ===bb===
19286 ====bba====
19287 ===bc===
19288 ==c==
19289 ===ca===
19290 !! html/php
19291 start
19292 ==a==
19293 ===aa===
19294 ====aaa====
19295 xxx
19296
19297 ==c==
19298 ===ca===
19299 !! end
19300
19301 !! test
19302 Section replacement test (section 5)
19303 !! options
19304 replace=5,"xxx"
19305 !! wikitext
19306 start
19307 ==a==
19308 ===aa===
19309 ====aaa====
19310 ==b==
19311 ===ba===
19312 ===bb===
19313 ====bba====
19314 ===bc===
19315 ==c==
19316 ===ca===
19317 !! html/php
19318 start
19319 ==a==
19320 ===aa===
19321 ====aaa====
19322 ==b==
19323 xxx
19324
19325 ===bb===
19326 ====bba====
19327 ===bc===
19328 ==c==
19329 ===ca===
19330 !! end
19331
19332 !! test
19333 Section replacement test (section 6)
19334 !! options
19335 replace=6,"xxx"
19336 !! wikitext
19337 start
19338 ==a==
19339 ===aa===
19340 ====aaa====
19341 ==b==
19342 ===ba===
19343 ===bb===
19344 ====bba====
19345 ===bc===
19346 ==c==
19347 ===ca===
19348 !! html/php
19349 start
19350 ==a==
19351 ===aa===
19352 ====aaa====
19353 ==b==
19354 ===ba===
19355 xxx
19356
19357 ===bc===
19358 ==c==
19359 ===ca===
19360 !! end
19361
19362 !! test
19363 Section replacement test (section 7)
19364 !! options
19365 replace=7,"xxx"
19366 !! wikitext
19367 start
19368 ==a==
19369 ===aa===
19370 ====aaa====
19371 ==b==
19372 ===ba===
19373 ===bb===
19374 ====bba====
19375 ===bc===
19376 ==c==
19377 ===ca===
19378 !! html/php
19379 start
19380 ==a==
19381 ===aa===
19382 ====aaa====
19383 ==b==
19384 ===ba===
19385 ===bb===
19386 xxx
19387
19388 ===bc===
19389 ==c==
19390 ===ca===
19391 !! end
19392
19393 !! test
19394 Section replacement test (section 8)
19395 !! options
19396 replace=8,"xxx"
19397 !! wikitext
19398 start
19399 ==a==
19400 ===aa===
19401 ====aaa====
19402 ==b==
19403 ===ba===
19404 ===bb===
19405 ====bba====
19406 ===bc===
19407 ==c==
19408 ===ca===
19409 !! html/php
19410 start
19411 ==a==
19412 ===aa===
19413 ====aaa====
19414 ==b==
19415 ===ba===
19416 ===bb===
19417 ====bba====
19418 xxx
19419
19420 ==c==
19421 ===ca===
19422 !!end
19423
19424 !! test
19425 Section replacement test (section 9)
19426 !! options
19427 replace=9,"xxx"
19428 !! wikitext
19429 start
19430 ==a==
19431 ===aa===
19432 ====aaa====
19433 ==b==
19434 ===ba===
19435 ===bb===
19436 ====bba====
19437 ===bc===
19438 ==c==
19439 ===ca===
19440 !! html/php
19441 start
19442 ==a==
19443 ===aa===
19444 ====aaa====
19445 ==b==
19446 ===ba===
19447 ===bb===
19448 ====bba====
19449 ===bc===
19450 xxx
19451 !! end
19452
19453 !! test
19454 Section replacement test (section 10)
19455 !! options
19456 replace=10,"xxx"
19457 !! wikitext
19458 start
19459 ==a==
19460 ===aa===
19461 ====aaa====
19462 ==b==
19463 ===ba===
19464 ===bb===
19465 ====bba====
19466 ===bc===
19467 ==c==
19468 ===ca===
19469 !! html/php
19470 start
19471 ==a==
19472 ===aa===
19473 ====aaa====
19474 ==b==
19475 ===ba===
19476 ===bb===
19477 ====bba====
19478 ===bc===
19479 ==c==
19480 xxx
19481 !! end
19482
19483 !! test
19484 Section replacement test with initial whitespace (T15728)
19485 !! options
19486 replace=2,"xxx"
19487 !! wikitext
19488 Preformatted initial line
19489 ==a==
19490 ===a===
19491 !! html/php
19492 Preformatted initial line
19493 ==a==
19494 xxx
19495 !! end
19496
19497
19498 !! test
19499 Section extraction, heading followed by pre with 20 spaces (T8398)
19500 !! options
19501 section=1
19502 !! wikitext
19503 ==a==
19504 a
19505 !! html/php
19506 ==a==
19507 a
19508 !! end
19509
19510 !! test
19511 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
19512 !! options
19513 section=1
19514 !! wikitext
19515 ==a==
19516 a
19517 !! html/php
19518 ==a==
19519 a
19520 !! end
19521
19522
19523 !! test
19524 Section extraction, <pre> around bogus header (T12309)
19525 !! options
19526 section=2
19527 !! wikitext
19528 == Section One ==
19529 <pre>
19530 =======
19531 </pre>
19532
19533 == Section Two ==
19534 stuff
19535 !! html/php
19536 == Section Two ==
19537 stuff
19538 !! end
19539
19540 !! test
19541 Section replacement, <pre> around bogus header (T12309)
19542 !! options
19543 replace=2,"xxx"
19544 !! wikitext
19545 == Section One ==
19546 <pre>
19547 =======
19548 </pre>
19549
19550 == Section Two ==
19551 stuff
19552 !! html/php
19553 == Section One ==
19554 <pre>
19555 =======
19556 </pre>
19557
19558 xxx
19559 !! end
19560
19561 !! test
19562 Handling of &#x0A; in URLs
19563 !! wikitext
19564 ** irc://&#x0A;a
19565 !! html/php
19566 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19567
19568 !! html/parsoid
19569 <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>
19570 !! end
19571
19572 !! test
19573 Handling of %0A in URLs
19574 !! wikitext
19575 ** irc://%0Aa
19576 !! html/php
19577 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19578
19579 !! html/parsoid
19580 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19581 !! end
19582
19583 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
19584 !! test
19585 5 quotes, code coverage +1 line
19586 !! options
19587 parsoid=wt2html
19588 !! wikitext
19589 '''''
19590 !! html/php
19591 !! html/parsoid
19592 <p><b><i></i></b></p>
19593 !! end
19594
19595 # same html as previous, but wikitext adjusted to match parsoid html2wt
19596 # note that wt2html and html2html will put the <i> before the <b>
19597 !! test
19598 5 quotes, code coverage +1 line w/ nowiki (1)
19599 !! options
19600 parsoid=wt2wt,html2wt
19601 !! wikitext
19602 '''''<nowiki/>'''''
19603 !! html/php
19604 <p><i></i>
19605 </p>
19606 !! html/parsoid
19607 <p><b><i></i></b></p>
19608 !! end
19609
19610 # same as previous, just swapping the <i> and <b>
19611 !! test
19612 5 quotes, code coverage +1 line w/ nowiki (2)
19613 !! wikitext
19614 '''''<nowiki/>'''''
19615 !! html/php
19616 <p><i></i>
19617 </p>
19618 !! html/parsoid
19619 <p><i><b></b></i></p>
19620 !! end
19621
19622 !! test
19623 Special:Search page linking.
19624 !! wikitext
19625 {{Special:search}}
19626 !! html
19627 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
19628 </p>
19629 !! end
19630
19631 !! test
19632 {{!}} is a magic word
19633 !! wikitext
19634 {{!}} is a magic word there and {{!}} is still a magic word here
19635 | is not a magic word here but {{!}} is still a magic word here
19636 !! html/php
19637 <p>| is a magic word there and | is still a magic word here
19638 | is not a magic word here but | is still a magic word here
19639 </p>
19640 !! html/parsoid
19641 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","function":"!"},"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":"!","function":"!"},"params":{},"i":0}}]}'>|</span> is still a magic word here
19642 | is not a magic word here but <span about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","function":"!"},"params":{},"i":0}}]}'>|</span> is still a magic word here</p>
19643 !! end
19644
19645 !! test
19646 Say the magic word
19647 !! options
19648 title=[[Parser test]]
19649 !! wikitext
19650 * {{PAGENAME}}
19651 * {{PAGENAMEE}}
19652 * {{FULLPAGENAME}}
19653 * {{FULLPAGENAMEE}}
19654 * {{BASEPAGENAME}}
19655 * {{BASEPAGENAMEE}}
19656 * {{SUBPAGENAME}}
19657 * {{SUBPAGENAMEE}}
19658 * {{ROOTPAGENAME}}
19659 * {{ROOTPAGENAMEE}}
19660 * {{TALKPAGENAME}}
19661 * {{TALKPAGENAMEE}}
19662 * {{SUBJECTPAGENAME}}
19663 * {{SUBJECTPAGENAMEE}}
19664 * {{NAMESPACEE}}
19665 * {{NAMESPACE}}
19666 * {{NAMESPACENUMBER}}
19667 * {{TALKSPACE}}
19668 * {{TALKSPACEE}}
19669 * {{SUBJECTSPACE}}
19670 * {{SUBJECTSPACEE}}
19671 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
19672 !! html
19673 <ul><li> Parser test</li>
19674 <li> Parser_test</li>
19675 <li> Parser test</li>
19676 <li> Parser_test</li>
19677 <li> Parser test</li>
19678 <li> Parser_test</li>
19679 <li> Parser test</li>
19680 <li> Parser_test</li>
19681 <li> Parser test</li>
19682 <li> Parser_test</li>
19683 <li> Talk:Parser test</li>
19684 <li> Talk:Parser_test</li>
19685 <li> Parser test</li>
19686 <li> Parser_test</li>
19687 <li> </li>
19688 <li> </li>
19689 <li> 0</li>
19690 <li> Talk</li>
19691 <li> Talk</li>
19692 <li> </li>
19693 <li> </li>
19694 <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>
19695
19696 !! end
19697 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
19698
19699 !! test
19700 Gallery with valid attributes
19701 !! wikitext
19702 <gallery type="123" summary="345">
19703 File:File:Foobar.jpg
19704 </gallery>
19705 !! html/php
19706 <ul class="gallery mw-gallery-traditional" type="123">
19707 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19708 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
19709 <div class="gallerytext">
19710 </div>
19711 </div></li>
19712 </ul>
19713
19714 !! html/parsoid
19715 <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"}}'>
19716 <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>
19717 </ul>
19718 !! end
19719
19720 ## Parsoid thinks the "centre" here is a property, not a caption.
19721 !! test
19722 Gallery
19723 !! options
19724 parsoid={
19725 "modes": ["wt2html"],
19726 "nativeGallery": true
19727 }
19728 !! wikitext
19729 <gallery>
19730 image1.png |
19731 image2.gif|||||
19732
19733 image3|
19734 image4 |300px| centre
19735 image5.svg| http://///////
19736 [[x|xx]]]]
19737 * image6
19738 </gallery>
19739 !! html/php
19740 <ul class="gallery mw-gallery-traditional">
19741 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19742 <div class="thumb" style="height: 150px;">Image1.png</div>
19743 <div class="gallerytext">
19744 </div>
19745 </div></li>
19746 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19747 <div class="thumb" style="height: 150px;">Image2.gif</div>
19748 <div class="gallerytext">
19749 </div>
19750 </div></li>
19751 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19752 <div class="thumb" style="height: 150px;">Image3</div>
19753 <div class="gallerytext">
19754 </div>
19755 </div></li>
19756 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19757 <div class="thumb" style="height: 150px;">Image4</div>
19758 <div class="gallerytext">
19759 <pre>centre
19760 </pre>
19761 </div>
19762 </div></li>
19763 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19764 <div class="thumb" style="height: 150px;">Image5.svg</div>
19765 <div class="gallerytext">
19766 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
19767 </p>
19768 </div>
19769 </div></li>
19770 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19771 <div class="thumb" style="height: 150px;">* image6</div>
19772 <div class="gallerytext">
19773 </div>
19774 </div></li>
19775 </ul>
19776
19777 !! html/parsoid
19778 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19779 <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>
19780 <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>
19781 <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>
19782 <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>
19783 <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>
19784 <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>
19785 </ul>
19786 !! end
19787
19788 !! test
19789 Gallery (with options, html)
19790 !! options
19791 parsoid={
19792 "modes": ["wt2html", "html2html"],
19793 "nativeGallery": true
19794 }
19795 !! wikitext
19796 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19797 File:Nonexistent.jpg|caption
19798 File:Nonexistent.jpg
19799 image:foobar.jpg|some '''caption''' [[Main Page]]
19800 image:foobar.jpg
19801 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19802 </gallery>
19803 !! html/php
19804 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19805 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19806 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19807 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19808 <div class="gallerytext">
19809 <p>caption
19810 </p>
19811 </div>
19812 </div></li>
19813 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19814 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19815 <div class="gallerytext">
19816 </div>
19817 </div></li>
19818 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19819 <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>
19820 <div class="gallerytext">
19821 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19822 </p>
19823 </div>
19824 </div></li>
19825 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19826 <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>
19827 <div class="gallerytext">
19828 </div>
19829 </div></li>
19830 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19831 <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>
19832 <div class="gallerytext">
19833 <p>blabla.
19834 </p>
19835 </div>
19836 </div></li>
19837 </ul>
19838
19839 !! html/parsoid
19840 <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":{}}'>
19841 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19842 <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>
19843 <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>
19844 <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>
19845 <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>
19846 <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>
19847 </ul>
19848 !! end
19849
19850 !! test
19851 Gallery (with options, extsrc)
19852 !! options
19853 parsoid={
19854 "nativeGallery": false
19855 }
19856 !! wikitext
19857 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19858 File:Nonexistent.jpg|caption
19859 File:Nonexistent.jpg
19860 image:foobar.jpg|some '''caption''' [[Main Page]]
19861 image:foobar.jpg
19862 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19863 </gallery>
19864 !! html/php
19865 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19866 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19867 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19868 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19869 <div class="gallerytext">
19870 <p>caption
19871 </p>
19872 </div>
19873 </div></li>
19874 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19875 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19876 <div class="gallerytext">
19877 </div>
19878 </div></li>
19879 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19880 <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>
19881 <div class="gallerytext">
19882 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19883 </p>
19884 </div>
19885 </div></li>
19886 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19887 <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>
19888 <div class="gallerytext">
19889 </div>
19890 </div></li>
19891 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19892 <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>
19893 <div class="gallerytext">
19894 <p>blabla.
19895 </p>
19896 </div>
19897 </div></li>
19898 </ul>
19899
19900 !! html/parsoid
19901 <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"}}'>
19902 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19903 <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>
19904 <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>
19905 <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>
19906 <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>
19907 <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>
19908 </ul>
19909 !! end
19910
19911 !! test
19912 Gallery with link that has fragment
19913 !! options
19914 parsoid={
19915 "modes": ["wt2html", "html2html"],
19916 "nativeGallery": true
19917 }
19918 !! wikitext
19919 <gallery>
19920 image:foobar.jpg|link=Main_Page
19921 image:foobar.jpg|link=Main_Page#section
19922 image:foobar.jpg|link=Main Page#section|caption
19923 </gallery>
19924 !! html/php
19925 <ul class="gallery mw-gallery-traditional">
19926 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19927 <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>
19928 <div class="gallerytext">
19929 </div>
19930 </div></li>
19931 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19932 <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>
19933 <div class="gallerytext">
19934 </div>
19935 </div></li>
19936 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19937 <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>
19938 <div class="gallerytext">
19939 <p>caption
19940 </p>
19941 </div>
19942 </div></li>
19943 </ul>
19944
19945 !! html/parsoid
19946 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19947 <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>
19948 <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>
19949 <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>
19950 </ul>
19951 !! end
19952
19953 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19954 !! test
19955 Gallery with template inside caption
19956 !! options
19957 parsoid={
19958 "nativeGallery": true
19959 }
19960 !! wikitext
19961 <gallery caption="{{echo|hi}}">
19962 File:Foobar.jpg|{{echo|ho}}
19963 </gallery>
19964 !! html/php
19965 <ul class="gallery mw-gallery-traditional">
19966 <li class='gallerycaption'>{{echo|hi}}</li>
19967 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19968 <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>
19969 <div class="gallerytext">
19970 <p>ho
19971 </p>
19972 </div>
19973 </div></li>
19974 </ul>
19975
19976 !! html/parsoid
19977 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19978 <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>
19979 <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>
19980 </ul>
19981 !! end
19982
19983 !! test
19984 Gallery with wikitext inside caption
19985 !! options
19986 parsoid={
19987 "nativeGallery": true
19988 }
19989 !! wikitext
19990 <gallery>
19991 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19992 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19993 </gallery>
19994 !! html/php
19995 <ul class="gallery mw-gallery-traditional">
19996 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19997 <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>
19998 <div class="gallerytext">
19999 <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>
20000 </p>
20001 </div>
20002 </div></li>
20003 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20004 <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>
20005 <div class="gallerytext">
20006 <p>This is a test template
20007 </p>
20008 </div>
20009 </div></li>
20010 </ul>
20011
20012 !! html/parsoid
20013 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20014 <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>
20015 <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>
20016 </ul>
20017 !! end
20018
20019 !! test
20020 Gallery (with showfilename option)
20021 !! options
20022 parsoid={
20023 "nativeGallery": true
20024 }
20025 !! wikitext
20026 <gallery showfilename="">
20027 File:Nonexistent.jpg|caption
20028 File:Nonexistent.jpg
20029 File:Foobar.jpg|some '''caption''' [[Main Page]]
20030 File:Foobar.jpg
20031 </gallery>
20032 !! html/php
20033 <ul class="gallery mw-gallery-traditional">
20034 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20035 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20036 <div class="gallerytext">
20037 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20038 caption
20039 </p>
20040 </div>
20041 </div></li>
20042 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20043 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20044 <div class="gallerytext">
20045 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20046 </p>
20047 </div>
20048 </div></li>
20049 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20050 <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>
20051 <div class="gallerytext">
20052 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20053 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20054 </p>
20055 </div>
20056 </div></li>
20057 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20058 <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>
20059 <div class="gallerytext">
20060 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20061 </p>
20062 </div>
20063 </div></li>
20064 </ul>
20065
20066 !! html/parsoid
20067 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
20068 <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>
20069 <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>
20070 <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>
20071 <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>
20072 </ul>
20073 !! end
20074
20075 ## Should Parsoid be preserving these variations?
20076 !! test
20077 Gallery (with namespace-less filenames)
20078 !! options
20079 parsoid={
20080 "modes": ["wt2html", "html2html"],
20081 "nativeGallery": true
20082 }
20083 !! wikitext
20084 <gallery>
20085 File:Nonexistent.jpg
20086 Nonexistent.jpg
20087 image:foobar.jpg
20088 foobar.jpg
20089 </gallery>
20090 !! html/php
20091 <ul class="gallery mw-gallery-traditional">
20092 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20093 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20094 <div class="gallerytext">
20095 </div>
20096 </div></li>
20097 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20098 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20099 <div class="gallerytext">
20100 </div>
20101 </div></li>
20102 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20103 <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>
20104 <div class="gallerytext">
20105 </div>
20106 </div></li>
20107 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20108 <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>
20109 <div class="gallerytext">
20110 </div>
20111 </div></li>
20112 </ul>
20113
20114 !! html/parsoid
20115 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20116 <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>
20117 <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>
20118 <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>
20119 <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>
20120 </ul>
20121 !! end
20122
20123 !! test
20124 Gallery override link with WikiLink (T36852)
20125 !! options
20126 parsoid={
20127 "nativeGallery": true
20128 }
20129 !! wikitext
20130 <gallery>
20131 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
20132 </gallery>
20133 !! html/php
20134 <ul class="gallery mw-gallery-traditional">
20135 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20136 <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>
20137 <div class="gallerytext">
20138 </div>
20139 </div></li>
20140 </ul>
20141
20142 !! html/parsoid
20143 <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":{}}'>
20144 <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>
20145 </ul>
20146 !! end
20147
20148 !! test
20149 Gallery override link with absolute external link (T36852)
20150 !! options
20151 parsoid={
20152 "nativeGallery": true
20153 }
20154 !! wikitext
20155 <gallery>
20156 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
20157 </gallery>
20158 !! html/php
20159 <ul class="gallery mw-gallery-traditional">
20160 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20161 <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>
20162 <div class="gallerytext">
20163 </div>
20164 </div></li>
20165 </ul>
20166
20167 !! html/parsoid
20168 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20169 <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>
20170 </ul>
20171 !! end
20172
20173 !! test
20174 Gallery override link with absolute external link with LanguageConverter
20175 !! options
20176 language=zh
20177 !! input
20178 <gallery>
20179 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20180 </gallery>
20181 !! result
20182 <ul class="gallery mw-gallery-traditional">
20183 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20184 <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>
20185 <div class="gallerytext">
20186 <p>caption
20187 </p>
20188 </div>
20189 </div></li>
20190 </ul>
20191
20192 !! end
20193
20194 !! test
20195 Gallery override link with malicious javascript (T36852)
20196 !! options
20197 parsoid={
20198 "modes": ["wt2html", "html2html"],
20199 "nativeGallery": true
20200 }
20201 !! wikitext
20202 <gallery>
20203 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20204 </gallery>
20205 !! html/php
20206 <ul class="gallery mw-gallery-traditional">
20207 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20208 <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>
20209 <div class="gallerytext">
20210 </div>
20211 </div></li>
20212 </ul>
20213
20214 !! html/parsoid
20215 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20216 <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>
20217 </ul>
20218 !! end
20219
20220 !! test
20221 Gallery with invalid title as link (T45964)
20222 !! options
20223 parsoid={
20224 "modes": ["wt2html", "html2html"],
20225 "nativeGallery": true
20226 }
20227 !! wikitext
20228 <gallery>
20229 File:Foobar.jpg|link=<
20230 </gallery>
20231 !! html/php
20232 <ul class="gallery mw-gallery-traditional">
20233 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20234 <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>
20235 <div class="gallerytext">
20236 </div>
20237 </div></li>
20238 </ul>
20239
20240 !! html/parsoid
20241 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20242 <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>
20243 </ul>
20244 !! end
20245
20246 !! test
20247 Serialize gallery without attrs in data-mw
20248 !! options
20249 parsoid={
20250 "modes": ["html2wt"],
20251 "nativeGallery": true
20252 }
20253 !! html/parsoid
20254 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
20255 <li class="gallerycaption">123</li>
20256 <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>
20257 </ul>
20258 !! wikitext
20259 <gallery caption="123">
20260 File:Test.png
20261 </gallery>
20262 !! end
20263
20264 !! test
20265 Gallery with class and style attributes
20266 !! options
20267 parsoid={
20268 "nativeGallery": true
20269 }
20270 !! wikitext
20271 <gallery class="center" style="text-align: center;">
20272 File:Foobar.jpg
20273 </gallery>
20274 !! html/php
20275 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
20276 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20277 <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>
20278 <div class="gallerytext">
20279 </div>
20280 </div></li>
20281 </ul>
20282
20283 !! html/parsoid
20284 <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":{}}'>
20285 <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>
20286 </ul>
20287 !! end
20288
20289 !! test
20290 Gallery in slideshow mode
20291 !! options
20292 parsoid={
20293 "nativeGallery": true
20294 }
20295 !! wikitext
20296 <gallery mode="slideshow" showthumbnails="">
20297 File:Foobar.jpg
20298 </gallery>
20299 !! html/php
20300 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
20301 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20302 <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>
20303 <div class="gallerytext">
20304 </div>
20305 </div></li>
20306 </ul>
20307
20308 !! html/parsoid
20309 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
20310 <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>
20311 </ul>
20312 !! end
20313
20314 !! test
20315 HTML Hex character encoding (spells the word "JavaScript")
20316 !! options
20317 parsoid=wt2html,wt2wt,html2html
20318 !! wikitext
20319 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
20320 !! html/php
20321 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
20322 </p>
20323 !! html/php+tidy
20324 <p>JavaScript</p>
20325 !! html/parsoid
20326 <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>
20327 !! end
20328
20329 !! test
20330 HTML Hex character encoding bogus encoding (T28437 regression check)
20331 !! wikitext
20332 &#xsee;&#XSEE;
20333 !! html/php
20334 <p>&amp;#xsee;&amp;#XSEE;
20335 </p>
20336 !! html/parsoid
20337 <p>&amp;#xsee;&amp;#XSEE;</p>
20338 !! end
20339
20340 !! test
20341 HTML Hex character encoding mixed case
20342 !! options
20343 parsoid=wt2html,wt2wt,html2html
20344 !! wikitext
20345 &#xEE;&#Xee;
20346 !! html/php
20347 <p>&#xee;&#xee;
20348 </p>
20349 !! html/php+tidy
20350 <p>îî</p>
20351 !! html/parsoid
20352 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
20353 !! end
20354
20355 # See: https://www.w3.org/TR/html5/syntax.html#character-references
20356 # Note that U+000C (form feed) is not a valid XML character, so
20357 # it is banned even though allowed in HTML5.
20358 !! test
20359 Illegal character references (T106578)
20360 !! wikitext
20361 ; Null: &#00;
20362 ; FF: &#xC;
20363 ; CR: &#xD;
20364 ; Control (low): &#8;
20365 ; Control (high): &#x7F; &#x9F;
20366 ; Surrogate: &#xD83D;&#xDCA9;
20367 ; This is an okay astral character: &#x1F4A9;
20368 !! html+tidy
20369 <dl>
20370 <dt>Null</dt>
20371 <dd>&amp;#00;</dd>
20372 <dt>FF</dt>
20373 <dd>&amp;#xC;</dd>
20374 <dt>CR</dt>
20375 <dd>&amp;#xD;</dd>
20376 <dt>Control (low)</dt>
20377 <dd>&amp;#8;</dd>
20378 <dt>Control (high)</dt>
20379 <dd>&amp;#x7F; &amp;#x9F;</dd>
20380 <dt>Surrogate</dt>
20381 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
20382 <dt>This is an okay astral character</dt>
20383 <dd>💩</dd>
20384 </dl>
20385 !! end
20386
20387 !! test
20388 __FORCETOC__ override
20389 !! wikitext
20390 __NEWSECTIONLINK__
20391 __FORCETOC__
20392 !! html/php
20393 <p><br />
20394 </p>
20395 !! end
20396
20397 !! test
20398 ISBN code coverage
20399 !! wikitext
20400 ISBN 978-0-1234-56&#x20;789
20401 !! html
20402 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
20403 </p>
20404 !! html+tidy
20405 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
20406 !! html/parsoid
20407 <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>
20408 !! end
20409
20410 !! test
20411 ISBN followed by 5 spaces
20412 !! wikitext
20413 ISBN
20414 !! html
20415 <p>ISBN
20416 </p>
20417 !! end
20418
20419 !! test
20420 Double ISBN
20421 !! wikitext
20422 ISBN ISBN 1234567890
20423 !! html/php
20424 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20425 </p>
20426 !! html/parsoid
20427 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
20428 !! end
20429
20430 # Uppercase X and lowercase x as well
20431 !! test
20432 ISBN with an X
20433 !! wikitext
20434 ISBN 3-462-04561-X
20435 ISBN 3-462-04561-x
20436 ISBN 080442957X
20437 ISBN 080442957x
20438 ISBN 978080442957X
20439 ISBN 978080442957x
20440 !! html/php
20441 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
20442 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
20443 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
20444 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
20445 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
20446 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
20447 </p>
20448 !! html/parsoid
20449 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
20450 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
20451 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
20452 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
20453 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
20454 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
20455 !! end
20456
20457 !! test
20458 ISBN with empty prefix (parsoid test)
20459 !! wikitext
20460 ISBN 1234567890
20461 !! html/php
20462 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20463 </p>
20464 !! html/parsoid
20465 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
20466 !! end
20467
20468 !! test
20469 T24905: <abbr> followed by ISBN followed by </a>
20470 !! wikitext
20471 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
20472 !! html/php
20473 <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>
20474 </p>
20475 !! html/parsoid
20476 <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>
20477 !! end
20478
20479 !! test
20480 Double RFC
20481 !! wikitext
20482 RFC RFC 1234
20483 !! html
20484 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
20485 </p>
20486 !! end
20487
20488 !! test
20489 Double RFC with a wiki link
20490 !! wikitext
20491 RFC [[RFC 1234]]
20492 !! html
20493 <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>
20494 </p>
20495 !! end
20496
20497 !! test
20498 RFC code coverage
20499 !! wikitext
20500 RFC 983&#x20;987
20501 !! html
20502 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
20503 </p>
20504 !! html+tidy
20505 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
20506 !! end
20507
20508 !! test
20509 Centre-aligned image
20510 !! wikitext
20511 [[Image:foobar.jpg|centre]]
20512 !! html
20513 <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>
20514
20515 !!end
20516
20517 !! test
20518 None-aligned image
20519 !! wikitext
20520 [[Image:foobar.jpg|none]]
20521 !! html
20522 <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>
20523
20524 !!end
20525
20526 !! test
20527 Width + Height sized image (using px) (height is ignored)
20528 !! wikitext
20529 [[Image:foobar.jpg|640x480px]]
20530 !! html
20531 <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>
20532 </p>
20533 !!end
20534
20535 !! test
20536 Width-sized image (using px, no following whitespace)
20537 !! wikitext
20538 [[Image:foobar.jpg|640px]]
20539 !! html
20540 <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>
20541 </p>
20542 !!end
20543
20544 !! test
20545 Width-sized image (using px, with following whitespace - test regression from r39467)
20546 !! wikitext
20547 [[Image:foobar.jpg|640px ]]
20548 !! html
20549 <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>
20550 </p>
20551 !!end
20552
20553 !! test
20554 Width-sized image (using px, with preceding whitespace - test regression from r39467)
20555 !! wikitext
20556 [[Image:foobar.jpg| 640px]]
20557 !! html
20558 <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>
20559 </p>
20560 !!end
20561
20562 !! test
20563 Image with page parameter
20564 !! options
20565 djvu
20566 !! wikitext
20567 [[File:LoremIpsum.djvu|page=2]]
20568 !! html/php
20569 <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>
20570 </p>
20571 !! html/parsoid
20572 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"page","ak":"page=2"}]}' data-mw='{"page":"2"}'><a href="./File:LoremIpsum.djvu" data-parsoid='{"a":{"href":"./File:LoremIpsum.djvu"},"sa":{"href":"File:LoremIpsum.djvu"}}'><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>
20573 !! end
20574
20575 !! test
20576 Another italics / bold test
20577 !! wikitext
20578 ''' ''x'
20579 !! html
20580 <pre>'<i> </i>x'
20581 </pre>
20582 !!end
20583
20584 # FIXME: The php output seems broken. It's interleaving some open/close tags.
20585 !! test
20586 dt/dd/dl test
20587 !! wikitext
20588 :;;;::
20589 !! html/php
20590 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
20591
20592 !! html/parsoid
20593 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
20594
20595 !!end
20596
20597 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
20598 !! test
20599 Images with the "|" character in the comment
20600 !! wikitext
20601 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
20602 !! html/php
20603 <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>
20604
20605 !! html/parsoid
20606 <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>
20607 !! end
20608
20609 !! test
20610 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
20611 !! wikitext
20612 <html><script>alert(1);</script></html>
20613 !! html
20614 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
20615 </p>
20616 !! end
20617
20618 !! test
20619 HTML with raw HTML ($wgRawHtml==true)
20620 !! options
20621 wgRawHtml=1
20622 !! wikitext
20623 <html><script>alert(1);</script></html>
20624 !! html
20625 <p><script>alert(1);</script>
20626 </p>
20627 !! end
20628
20629 !! test
20630 Parents of subpages, one level up
20631 !! options
20632 subpage title=[[Subpage test/L1/L2/L3]]
20633 !! wikitext
20634 [[../|L2]]
20635 !! html
20636 <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>
20637 </p>
20638 !! end
20639
20640
20641 !! test
20642 Parents of subpages, one level up, not named
20643 !! options
20644 subpage title=[[Subpage test/L1/L2/L3]]
20645 !! wikitext
20646 [[../]]
20647 !! html
20648 <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>
20649 </p>
20650 !! end
20651
20652
20653
20654 !! test
20655 Parents of subpages, two levels up
20656 !! options
20657 subpage title=[[Subpage test/L1/L2/L3]]
20658 !! wikitext
20659 [[../../|L1]]2
20660
20661 [[../../|L1]]l
20662 !! html
20663 <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
20664 </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>
20665 </p>
20666 !! end
20667
20668 !! test
20669 Parents of subpages, two levels up, without trailing slash or name.
20670 !! options
20671 subpage title=[[Subpage test/L1/L2/L3]]
20672 !! wikitext
20673 [[../..]]
20674 !! html
20675 <p>[[../..]]
20676 </p>
20677 !! end
20678
20679 !! test
20680 Parents of subpages, two levels up, with lots of extra trailing slashes.
20681 !! options
20682 subpage title=[[Subpage test/L1/L2/L3]]
20683 !! wikitext
20684 [[../../////]]
20685 !! html
20686 <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>
20687 </p>
20688 !! end
20689
20690 !! article
20691 Subpage test/L1/L2/L3Sibling
20692 !! text
20693 Sibling article
20694 !! endarticle
20695
20696 !! test
20697 Transclusion of a sibling page (one level up)
20698 !! options
20699 subpage title=[[Subpage test/L1/L2/L3]]
20700 !! wikitext
20701 {{../L3Sibling}}
20702 !! html
20703 <p>Sibling article
20704 </p>
20705 !! end
20706
20707 !! test
20708 Transclusion of a child page
20709 !! options
20710 subpage title=[[Subpage test/L1/L2]]
20711 !! wikitext
20712 {{/L3Sibling}}
20713 !! html
20714 <p>Sibling article
20715 </p>
20716 !! end
20717
20718 # This is wt2html only in Parsoid because we add <nowiki>
20719 # because of {{..}} and we don't expect to fix that to
20720 # eliminate the nowikis selective for {{..}} markup.
20721 !! test
20722 Non-transclusion because of too many up levels
20723 !! options
20724 subpage title=[[Subpage test/L1/L2/L3]]
20725 parsoid=wt2html
20726 !! wikitext
20727 {{../../../../More than parent}}
20728 !! html/php
20729 <p>{{../../../../More than parent}}
20730 </p>
20731 !! html/parsoid
20732 <p>{{../../../../More than parent}}</p>
20733 !! end
20734
20735 !! test
20736 Definition list code coverage
20737 !! wikitext
20738 ; title : def
20739 ; title : def
20740 ;title: def
20741 !! html/php
20742 <dl><dt> title &#160;</dt>
20743 <dd> def</dd>
20744 <dt> title&#160;</dt>
20745 <dd> def</dd>
20746 <dt>title</dt>
20747 <dd> def</dd></dl>
20748
20749 !! html/parsoid
20750 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20751 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20752 <dt>title</dt><dd> def</dd></dl>
20753 !! end
20754
20755 !! test
20756 Don't fall for the self-closing div
20757 !! wikitext
20758 <div>hello world</div/>
20759 !! html
20760 <div>hello world</div>
20761
20762 !! end
20763
20764 !! test
20765 MSGNW magic word
20766 !! wikitext
20767 {{MSGNW:msg}}
20768 !! html/php
20769 <p>&#91;&#91;:Template:Msg&#93;&#93;
20770 </p>
20771 !! end
20772
20773 !! test
20774 RAW magic word
20775 !! wikitext
20776 {{RAW:QUERTY}}
20777 !! html
20778 <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>
20779 </p>
20780 !! end
20781
20782 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
20783 !! test
20784 Always escape literal '>' in output, not just after '<'
20785 !! wikitext
20786 ><>
20787 !! html
20788 <p>&gt;&lt;&gt;
20789 </p>
20790 !! end
20791
20792 !! test
20793 Template caching
20794 !! wikitext
20795 {{Test}}
20796 {{Test}}
20797 !! html
20798 <p>This is a test template
20799 This is a test template
20800 </p>
20801 !! end
20802
20803
20804 !! article
20805 MediaWiki:Fake
20806 !! text
20807 ==header==
20808 !! endarticle
20809
20810 !! test
20811 Inclusion of !userCanEdit() content
20812 !! wikitext
20813 {{MediaWiki:Fake}}
20814 !! html
20815 <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>
20816
20817 !! end
20818
20819
20820 !! test
20821 Out-of-order TOC heading levels
20822 !! wikitext
20823 ==2==
20824 ======6======
20825 ===3===
20826 =1=
20827 =====5=====
20828 ==2==
20829 !! html
20830 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
20831 <ul>
20832 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
20833 <ul>
20834 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
20835 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
20836 </ul>
20837 </li>
20838 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
20839 <ul>
20840 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
20841 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
20842 </ul>
20843 </li>
20844 </ul>
20845 </div>
20846
20847 <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>
20848 <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>
20849 <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>
20850 <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>
20851 <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>
20852 <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>
20853
20854 !! end
20855
20856
20857 !! test
20858 ISBN with a dummy number
20859 !! wikitext
20860 ISBN ---
20861 !! html
20862 <p>ISBN ---
20863 </p>
20864 !! end
20865
20866
20867 !! test
20868 ISBN with space-delimited number
20869 !! wikitext
20870 ISBN 92 9017 032 8
20871 !! html/php
20872 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
20873 </p>
20874 !! html/parsoid
20875 <p data-parsoid='{"dsr":[0,18,0,0]}'><a href="./Special:BookSources/9290170328" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink","dsr":[0,18,2,2]}'>ISBN 92 9017 032 8</a></p>
20876 !! end
20877
20878
20879 !! test
20880 ISBN with multiple spaces, no number
20881 !! wikitext
20882 ISBN foo
20883 !! html
20884 <p>ISBN foo
20885 </p>
20886 !! end
20887
20888
20889 !! test
20890 ISBN length
20891 !! wikitext
20892 ISBN 123456789
20893
20894 ISBN 1234567890
20895
20896 ISBN 12345678901
20897 !! html/php
20898 <p>ISBN 123456789
20899 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20900 </p><p>ISBN 12345678901
20901 </p>
20902 !! html/parsoid
20903 <p>ISBN 123456789</p>
20904
20905 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
20906
20907 <p>ISBN 12345678901</p>
20908 !! end
20909
20910
20911 !! test
20912 ISBN with trailing year (T9110)
20913 !! wikitext
20914 ISBN 1-234-56789-0 - 2006
20915
20916 ISBN 1 234 56789 0 - 2006
20917 !! html/php
20918 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
20919 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20920 </p>
20921 !! html/parsoid
20922 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
20923
20924 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
20925 !! end
20926
20927
20928 !! test
20929 anchorencode
20930 !! wikitext
20931 {{anchorencode:foo bar©#%n}}
20932 !! html
20933 <p>foo_bar.C2.A9.23.25n
20934 </p>
20935 !! end
20936
20937 !! test
20938 anchorencode trims spaces
20939 !! wikitext
20940 {{anchorencode: __pretty__please__}}
20941 !! html
20942 <p>pretty_please
20943 </p>
20944 !! end
20945
20946 !! test
20947 anchorencode deals with links
20948 !! wikitext
20949 {{anchorencode: [[hello|world]] [[hi]]}}
20950 !! html
20951 <p>world_hi
20952 </p>
20953 !! end
20954
20955 !! test
20956 anchorencode deals with templates
20957 !! wikitext
20958 {{anchorencode: {{Foo}} }}
20959 !! html
20960 <p>FOO
20961 </p>
20962 !! end
20963
20964 !! test
20965 anchorencode encodes like the TOC generator: (T20431)
20966 !! wikitext
20967 === _ +:.3A%3A&&amp;]] ===
20968 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20969 __NOEDITSECTION__
20970 !! html
20971 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20972 <p>.2B:.3A.253A.26.26.5D.5D
20973 </p>
20974 !! end
20975
20976 !! test
20977 T8200: blockquotes and paragraph formatting
20978 !! wikitext
20979 <blockquote>
20980 foo
20981 </blockquote>
20982
20983 bar
20984
20985 baz
20986 !! html
20987 <blockquote>
20988 <p>foo
20989 </p>
20990 </blockquote>
20991 <p>bar
20992 </p>
20993 <pre>baz
20994 </pre>
20995 !! end
20996
20997 !! test
20998 T10293: Use of center tag ruins paragraph formatting
20999 !! wikitext
21000 <center>
21001 foo
21002 </center>
21003
21004 bar
21005
21006 baz
21007 !! html
21008 <center>
21009 <p>foo
21010 </p>
21011 </center>
21012 <p>bar
21013 </p>
21014 <pre>baz
21015 </pre>
21016 !! end
21017
21018 !!test
21019 Parsing of overlapping (improperly nested) inline html tags
21020 !! wikitext
21021 <span><s>x</span></s>
21022 !! html/php
21023 <p><span><s>x&lt;/span&gt;</s></span>
21024 </p>
21025 !! html/parsoid
21026 <p><span><s>x</s></span>
21027 </p>
21028 !!end
21029
21030 ###
21031 ### Language variants related tests
21032 ###
21033 !! test
21034 Self-link in language variants
21035 !! options
21036 title=[[Dunav]] language=sr
21037 !! wikitext
21038 Both [[Dunav]] and [[Дунав]] are names for this river.
21039 !! html
21040 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
21041 </p>
21042 !!end
21043
21044 !! article
21045 Дуна
21046 !! text
21047 content
21048 !! endarticle
21049
21050 !! test
21051 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
21052 !! options
21053 title=[[Duna]] language=sr
21054 !! wikitext
21055 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
21056 !! html
21057 <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.
21058 </p>
21059 !! end
21060
21061 !! test
21062 Link to a section of a variant of this title shouldn't be parsed as self-link
21063 !! options
21064 title=[[Duna]] language=sr
21065 !! wikitext
21066 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
21067 !! html
21068 <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.
21069 </p>
21070 !! end
21071
21072 !! test
21073 Link to pages in language variants
21074 !! options
21075 language=sr
21076 !! wikitext
21077 Main Page can be written as [[Маин Паге]]
21078 !! html
21079 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
21080 </p>
21081 !!end
21082
21083
21084 !! test
21085 Multiple links to pages in language variants
21086 !! options
21087 language=sr
21088 !! wikitext
21089 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
21090 !! html
21091 <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>.
21092 </p>
21093 !!end
21094
21095
21096 !! test
21097 Simple template in language variants
21098 !! options
21099 language=sr
21100 !! wikitext
21101 {{тест}}
21102 !! html
21103 <p>This is a test template
21104 </p>
21105 !! end
21106
21107
21108 !! test
21109 Template with explicit namespace in language variants
21110 !! options
21111 language=sr
21112 !! wikitext
21113 {{Template:тест}}
21114 !! html
21115 <p>This is a test template
21116 </p>
21117 !! end
21118
21119
21120 !! test
21121 Basic test for template parameter in language variants
21122 !! options
21123 language=sr
21124 !! wikitext
21125 {{парамтест|param=foo}}
21126 !! html
21127 <p>This is a test template with parameter foo
21128 </p>
21129 !! end
21130
21131 !! test
21132 Simple category in language variants
21133 !! options
21134 language=sr cat
21135 !! wikitext
21136 [[Category:МедиаWики Усер'с Гуиде]]
21137 !! html/php
21138 cat=МедиаWики_Усер'с_Гуиде sort=
21139 !! html/parsoid
21140 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
21141 !! end
21142
21143 !! article
21144 Category:分类
21145 !! text
21146 blah
21147 !! endarticle
21148
21149 !! article
21150 Category:分類
21151 !! text
21152 blah
21153 !! endarticle
21154
21155 ## We used to, but no longer wt2wt this test since the default serializer
21156 ## will normalize all categories to serialize on their own line.
21157 ## This wikitext usage is going to be fairly uncommon in production and
21158 ## selser will take care of preserving formatting in those scenarios.
21159 !! test
21160 Don't convert blue categorylinks to another variant (T35210)
21161 !! options
21162 cat
21163 language=zh
21164 parsoid=wt2html
21165 !! wikitext
21166 [[A]][[Category:分类]]
21167 !! html/php
21168 cat=分类 sort=
21169 !! html/parsoid
21170 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
21171 <link rel="mw:PageProp/Category" href="./Category:分类"/>
21172 !! end
21173
21174 !! test
21175 Stripping -{}- tags (language variants)
21176 !! options
21177 language=sr
21178 !! wikitext
21179 Latin proverb: -{Ne nuntium necare}-
21180 !! html
21181 <p>Latin proverb: Ne nuntium necare
21182 </p>
21183 !! end
21184
21185
21186 !! test
21187 Prevent conversion with -{}- tags (language variants)
21188 !! options
21189 language=sr variant=sr-ec
21190 !! wikitext
21191 Latinski: -{Ne nuntium necare}-
21192 !! html
21193 <p>Латински: Ne nuntium necare
21194 </p>
21195 !! end
21196
21197
21198 !! test
21199 Prevent conversion of text with -{}- tags (language variants)
21200 !! options
21201 language=sr variant=sr-ec
21202 !! wikitext
21203 Latinski: -{Ne nuntium necare}-
21204 !! html
21205 <p>Латински: Ne nuntium necare
21206 </p>
21207 !! end
21208
21209
21210 !! test
21211 Prevent conversion of links with -{}- tags (language variants)
21212 !! options
21213 language=sr variant=sr-ec
21214 !! wikitext
21215 -{[[Main Page]]}-
21216 !! html
21217 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21218 </p>
21219 !! end
21220
21221
21222 !! test
21223 -{}- tags within headlines (within html for parserConvert())
21224 !! options
21225 language=sr variant=sr-ec
21226 !! wikitext
21227 == -{Naslov}- ==
21228 !! html
21229 <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>
21230
21231 !! end
21232
21233
21234 !! test
21235 Explicit definition of language variant alternatives
21236 !! options
21237 language=zh variant=zh-tw
21238 !! wikitext
21239 -{zh:China;zh-tw:Taiwan}-, not China
21240 !! html
21241 <p>Taiwan, not China
21242 </p>
21243 !! end
21244
21245
21246 !! test
21247 Conversion around HTML tags
21248 !! options
21249 language=sr variant=sr-ec
21250 !! wikitext
21251 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
21252 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
21253 !! html
21254 <p>
21255 <span title="ЛаCтин">ски</span>
21256 </p>
21257 !! end
21258
21259
21260 !! test
21261 Explicit session-wise language variant mapping (A flag and - flag)
21262 !! options
21263 language=zh variant=zh-tw
21264 !! wikitext
21265 Taiwan is not China.
21266 But -{A|zh:China;zh-tw:Taiwan}- is China,
21267 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
21268 and -{China}- is China.
21269 !! html
21270 <p>Taiwan is not China.
21271 But Taiwan is Taiwan,
21272 (This should be stripped!)
21273 and China is China.
21274 </p>
21275 !! end
21276
21277 !! test
21278 Explicit session-wise language variant mapping (H flag for hide)
21279 !! options
21280 language=zh variant=zh-tw
21281 !! wikitext
21282 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
21283 Taiwan is China.
21284 !! html
21285 <p>(This should be stripped!)
21286 Taiwan is Taiwan.
21287 </p>
21288 !! end
21289
21290 !! test
21291 Adding explicit conversion rule for title (T flag)
21292 !! options
21293 language=zh variant=zh-tw showtitle
21294 !! wikitext
21295 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
21296 !! html
21297 Taiwan
21298 <p>Should be stripped!
21299 </p>
21300 !! end
21301
21302 !! test
21303 Testing that changing the language variant here in the tests actually works
21304 !! options
21305 language=zh variant=zh showtitle
21306 !! wikitext
21307 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
21308 !! html
21309 China
21310 <p>Should be stripped!
21311 </p>
21312 !! end
21313
21314 !! test
21315 Recursive conversion of alt and title attrs shouldn't clear converter state
21316 !! options
21317 language=zh variant=zh-cn showtitle
21318 !! wikitext
21319 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
21320 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
21321 !! html
21322 China
21323 <p>
21324 Should be stripped<span title="Exclamation">!</span>
21325 </p>
21326 !! end
21327
21328 !! test
21329 T26072: more test on conversion rule for title
21330 !! options
21331 language=zh variant=zh-tw showtitle
21332 !! wikitext
21333 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
21334 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
21335 !! html
21336 Taiwan
21337 <p>This should be stripped!
21338 This won't take interferes with the title rule.
21339 </p>
21340 !! end
21341
21342 !! test
21343 Partly disable title conversion if variant == main language code
21344 !! options
21345 language=zh variant=zh title=[[ZH]] showtitle
21346 !! wikitext
21347 -{T|zh-cn:CN;zh-tw:TW}-
21348 !! html
21349 ZH
21350 <p>
21351 </p>
21352 !! end
21353
21354 !! test
21355 Partly disable title conversion if variant == main language code, more
21356 !! options
21357 language=zh variant=zh title=[[ZH]] showtitle
21358 !! wikitext
21359 -{T|TW}-
21360 !! html
21361 ZH
21362 <p>
21363 </p>
21364 !! end
21365
21366 !! test
21367 Raw output of variant escape tags (R flag)
21368 !! options
21369 language=zh variant=zh-tw
21370 !! wikitext
21371 Raw: -{R|zh:China;zh-tw:Taiwan}-
21372 !! html
21373 <p>Raw: zh:China;zh-tw:Taiwan
21374 </p>
21375 !! end
21376
21377 !! test
21378 Nested markup inside raw output of variant escape tags (R flag)
21379 !! options
21380 language=zh variant=zh-tw
21381 !! wikitext
21382 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
21383 !! html
21384 <p>Nested raw: nested Taiwan nested
21385 </p>
21386 !! end
21387
21388 !! test
21389 Templates inside raw output of variant escape tags (R flag)
21390 !! options
21391 language=zh variant=zh-tw
21392 !! wikitext
21393 Nested raw: -{R|nested {{echo|hi}} templates}-
21394 !! html
21395 <p>Nested raw: nested hi templates
21396 </p>
21397 !! end
21398
21399 !! test
21400 Strings evaluating false shouldn't be ignored by Language converter (T51072)
21401 !! options
21402 language=zh variant=zh-cn
21403 !! input
21404 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
21405 !! result
21406 <p>0
21407 </p>
21408 !! end
21409
21410 !! test
21411 Conversion rules from [numeric-only string] to [something else] (T48634)
21412 !! options
21413 language=zh variant=zh-cn
21414 !! input
21415 -{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
21416 !! result
21417 <p>D12345EE12345
21418 </p>
21419 !! end
21420
21421 !! test
21422 Bidirectional converter rule entries with an empty value should be ignored (T53551)
21423 !! options
21424 language=zh variant=zh-cn
21425 !! input
21426 -{H|zh-cn:foo;zh-tw:;}-foobar
21427 !! result
21428 <p>foobar
21429 </p>
21430 !! end
21431
21432 !! test
21433 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
21434 !! options
21435 language=zh variant=zh-cn
21436 !! input
21437 -{H|=>zh-cn:foo;}-foobar
21438 !! result
21439 <p>foobar
21440 </p>
21441 !! end
21442
21443 !! test
21444 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
21445 !! options
21446 language=zh variant=zh-cn
21447 !! input
21448 -{H|}-foobar
21449 !! result
21450 <p>foobar
21451 </p>
21452 !! end
21453
21454 !! test
21455 Nested using of manual convert syntax
21456 !! options
21457 language=zh variant=zh-hk
21458 !! wikitext
21459 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
21460 !! html
21461 <p>Nested: Hello Hong Kong!
21462 </p>
21463 !! end
21464
21465 !! test
21466 HTML markups with conversion syntax in attribs, nested in other conversion blocks
21467 !! options
21468 language=zh variant=zh-cn
21469 !! wikitext
21470 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
21471 !! html
21472 <p><span title="X">A</span>
21473 </p>
21474 !! end
21475
21476 !! test
21477 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet)
21478 !! options
21479 language=zh variant=zh-cn disabled
21480 !! wikitext
21481 -{<span title="-{X}-">A</span>}-
21482 !! html
21483 <p><span title="X">A</span>
21484 </p>
21485 !! end
21486
21487 # Since Parsoid is starting to emit canonical wikitext for links,
21488 # [http://example.com http://example.com] will not RT back to that
21489 # form anymore.
21490 !! test
21491 Proper conversion of text in external links
21492 !! options
21493 language=sr variant=sr-ec
21494 parsoid=wt2html
21495 !! wikitext
21496 http://www.google.com
21497 gopher://www.google.com
21498 [http://www.google.com http://www.google.com]
21499 [gopher://www.google.com gopher://www.google.com]
21500 [https://www.google.com irc://www.google.com]
21501 [ftp://www.google.com www.google.com/ftp://dir]
21502 [//www.google.com www.google.com]
21503 !! html/php
21504 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
21505 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
21506 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
21507 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
21508 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
21509 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
21510 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
21511 </p>
21512 !! html/parsoid
21513 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
21514 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
21515 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
21516 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
21517 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
21518 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
21519 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
21520 !! end
21521
21522 !! test
21523 Do not convert roman numbers to language variants
21524 !! options
21525 language=sr variant=sr-ec
21526 !! wikitext
21527 Fridrih IV je car.
21528 !! html
21529 <p>Фридрих IV је цар.
21530 </p>
21531 !! end
21532
21533 !! test
21534 Unclosed language converter markup "-{"
21535 !! options
21536 language=sr
21537 !! wikitext
21538 -{T|hello
21539 !! html
21540 <p>-{T|hello
21541 </p>
21542 !! end
21543
21544 !! test
21545 Don't convert raw rule "-{R|=&gt;}-" to "=>"
21546 !! options
21547 language=sr
21548 !! wikitext
21549 -{R|=&gt;}-
21550 !! html
21551 <p>=&gt;
21552 </p>
21553 !!end
21554
21555 !! test
21556 Don't break link parsing if language converter markup is in the caption.
21557 !! options
21558 language=sr variant=sr-ec
21559 !! wikitext
21560 [[Main Page|-{R|main page}-]]
21561 !! html
21562 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
21563 </p>
21564 !! end
21565
21566 !! test
21567 T146304: Don't break template parsing if language converter markup is in the parameter.
21568 !! options
21569 language=sr variant=sr-ec
21570 !! wikitext
21571 {{echo|-{R|foo}-}}
21572 !! html/php
21573 <p>foo
21574 </p>
21575 !! end
21576
21577 !! test
21578 T146305: Don't break image parsing if language converter markup is in the caption.
21579 !! options
21580 language=sr
21581 !! wikitext
21582 [[File:Foobar.jpg|thumb|-{R|caption:}-]]
21583 !! html/php
21584 <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>
21585
21586 !! html/parsoid
21587 <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>
21588 !! end
21589
21590 !! test
21591 T146305: Don't break image parsing if nested language converter markup is in the caption.
21592 !! options
21593 language=zh variant=zh-cn
21594 !! wikitext
21595 [[File:Foobar.jpg|thumb|-{zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
21596 !! html/php
21597 <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>
21598
21599 !! html/parsoid
21600 <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>
21601 !! end
21602
21603 !! test
21604 Don't break gallery if language converter markup is inside.
21605 !! options
21606 language=zh
21607 !! wikitext
21608 <gallery>
21609 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
21610 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
21611 </gallery>
21612 !! html
21613 <ul class="gallery mw-gallery-traditional">
21614 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21615 <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>
21616 <div class="gallerytext">
21617 <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>
21618 </p>
21619 </div>
21620 </div></li>
21621 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21622 <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>
21623 <div class="gallerytext">
21624 <p>This is a test template
21625 </p>
21626 </div>
21627 </div></li>
21628 </ul>
21629
21630 !! end
21631
21632 !! test
21633 T153135: Don't break list handling if language converter markup is in the item.
21634 !! options
21635 language=zh variant=zh-cn
21636 !! wikitext
21637 ;-{zh-cn:AAA;zh-tw:BBB}-
21638 ;-{R|foo:bar}-
21639 !! html/php
21640 <dl><dt>AAA</dt>
21641 <dt>foo:bar</dt></dl>
21642
21643 !! html/parsoid
21644 <dl>
21645 <dt><span typeof="mw:LanguageVariant" data-mw='{"bidir":[{"l":"zh-cn","t":"AAA"},{"l":"zh-tw","t":"BBB"}],"show":true}'></span></dt>
21646 <dt><span typeof="mw:LanguageVariant" data-mw='{"disabled":true,"show":true,"text":"foo:bar"}'></span></dt>
21647 </dl>
21648 !! end
21649
21650 // Note that parsoid does not protect colons unless language converter
21651 // markup is properly nested, because it is a backtracking parser.
21652 !! test
21653 T153135: Unclosed markup in definition list (code coverage)
21654 !! options
21655 language=zh variant=zh-cn
21656 !! wikitext
21657 ;<b>foo:bar
21658 ;-{zh-cn:AAA
21659 !! html/php
21660 <dl><dt><b>foo:bar</dt>
21661 <dt>-{zh-cn:AAA</b></dt></dl>
21662
21663 !! html/parsoid
21664 <dl>
21665 <dt><b>foo:bar</b></dt>
21666 <b>
21667 <dt>-{zh-cn</dt>
21668 <dd>AAA</dd>
21669 </b></dl>
21670 !! end
21671
21672 !! test
21673 T153135: Nested language converter markup in definition list (code coverage)
21674 !! options
21675 language=zh variant=zh-cn
21676 !! wikitext
21677 ;-{zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
21678 !! html/php
21679 <dl><dt>AAA foo:bar bat:baz</dt>
21680 <dd>def</dd></dl>
21681
21682 !! html/parsoid
21683 <dl>
21684 <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>
21685 <dd>def</dd>
21686 </dl>
21687 !! end
21688
21689 !! test
21690 T153140: Don't break table handling if language converter markup is in the cell.
21691 !! options
21692 language=sr variant=sr-ec
21693 !! wikitext
21694 {|
21695 |-
21696 | -{R|B}-
21697 |}
21698 !! html/php
21699 <table>
21700
21701 <tr>
21702 <td> B
21703 </td></tr></table>
21704
21705 !! html/parsoid
21706 <table>
21707
21708 <tr>
21709 <td> B
21710 </td></tr></table>
21711
21712 !! end
21713
21714 !! test
21715 T2529: Uncovered bullet
21716 !! wikitext
21717 * Foo {{bullet}}
21718 !! html
21719 <ul><li> Foo </li>
21720 <li> Bar</li></ul>
21721
21722 !! end
21723
21724 # Plain MediaWiki does not remove empty lists, but tidy actually does.
21725 # Templates in Wikipedia rely on this behavior, as tidy has always been
21726 # enabled there. These tests are normally run *without* tidy, so specify the
21727 # full output here.
21728 # To test realistic parsing behavior, apply a tidy-like transformation to both
21729 # the expected output and your parser's output.
21730 !! test
21731 T2529: Uncovered bullet leaving empty list, normally removed by tidy
21732 !! wikitext
21733 ******* Foo {{bullet}}
21734 !! html
21735 <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>
21736 <li> Bar</li></ul>
21737
21738 !! end
21739
21740 !! test
21741 T2529: Uncovered table already at line-start
21742 !! wikitext
21743 x
21744
21745 {{table}}
21746 y
21747 !! html
21748 <p>x
21749 </p>
21750 <table>
21751 <tr>
21752 <td> 1 </td>
21753 <td> 2
21754 </td></tr>
21755 <tr>
21756 <td> 3 </td>
21757 <td> 4
21758 </td></tr></table>
21759 <p>y
21760 </p>
21761 !! end
21762
21763 !! test
21764 T2529: Uncovered bullet in parser function result
21765 !! wikitext
21766 * Foo {{lc:{{bullet}} }}
21767 !! html
21768 <ul><li> Foo </li>
21769 <li> bar</li></ul>
21770
21771 !! end
21772
21773 !! test
21774 T7678: Double-parsed template argument
21775 !! wikitext
21776 {{lc:{{{1}}}|hello}}
21777 !! html
21778 <p>{{{1}}}
21779 </p>
21780 !! end
21781
21782 !! test
21783 T7678: Double-parsed template invocation
21784 !! wikitext
21785 {{lc:{{paramtest {{!}} param = hello }} }}
21786 !! html
21787 <p>{{paramtest | param = hello }}
21788 </p>
21789 !! end
21790
21791 !! test
21792 Case insensitivity of parser functions for non-ASCII characters (T10143)
21793 !! options
21794 language=cs
21795 title=[[Main Page]]
21796 !! wikitext
21797 {{PRVNÍVELKÉ:ěščř}}
21798 {{prvnívelké:ěščř}}
21799 {{PRVNÍMALÉ:ěščř}}
21800 {{prvnímalé:ěščř}}
21801 {{MALÁ:ěščř}}
21802 {{malá:ěščř}}
21803 {{VELKÁ:ěščř}}
21804 {{velká:ěščř}}
21805 !! html
21806 <p>Ěščř
21807 Ěščř
21808 ěščř
21809 ěščř
21810 ěščř
21811 ěščř
21812 ĚŠČŘ
21813 ĚŠČŘ
21814 </p>
21815 !! end
21816
21817 !! test
21818 Morwen/13: Unclosed link followed by heading
21819 !! wikitext
21820 [[link
21821 ==heading==
21822 !! html
21823 <p>[[link
21824 </p>
21825 <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>
21826
21827 !! end
21828
21829 !! test
21830 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
21831 !! wikitext
21832 {{foo|
21833 =heading=
21834 !! html
21835 <p>{{foo|
21836 </p>
21837 <h1><span class="mw-headline" id="heading">heading</span></h1>
21838
21839 !! end
21840
21841 !! test
21842 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
21843 !! wikitext
21844 {{foo|
21845 ==heading==
21846 !! html
21847 <p>{{foo|
21848 </p>
21849 <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>
21850
21851 !! end
21852
21853 !! test
21854 Tildes in comments
21855 !! options
21856 pst
21857 !! wikitext
21858 <!-- ~~~~ -->
21859 !! html/php
21860 <!-- ~~~~ -->
21861 !! end
21862
21863 !! test
21864 Paragraphs inside divs (no extra line breaks)
21865 !! wikitext
21866 <div>Line one
21867
21868 Line two</div>
21869 !! html
21870 <div>Line one
21871 Line two</div>
21872
21873 !! end
21874
21875 !! test
21876 Paragraphs inside divs (extra line break on open)
21877 !! wikitext
21878 <div>
21879 Line one
21880
21881 Line two</div>
21882 !! html
21883 <div>
21884 <p>Line one
21885 </p>
21886 Line two</div>
21887
21888 !! end
21889
21890 !! test
21891 Paragraphs inside divs (extra line break on close)
21892 !! wikitext
21893 <div>Line one
21894
21895 Line two
21896 </div>
21897 !! html
21898 <div>Line one
21899 <p>Line two
21900 </p>
21901 </div>
21902
21903 !! end
21904
21905 !! test
21906 Paragraphs inside divs (extra line break on open and close)
21907 !! wikitext
21908 <div>
21909 Line one
21910
21911 Line two
21912 </div>
21913 !! html
21914 <div>
21915 <p>Line one
21916 </p><p>Line two
21917 </p>
21918 </div>
21919
21920 !! end
21921
21922 !! test
21923 Nesting tags, paragraphs on lines which begin with <div>
21924 !! wikitext
21925 <div></div><strong>A
21926 B</strong>
21927 !! html/php+tidy
21928 <p><strong>A</strong></p>
21929 <p><strong>B</strong></p>
21930 !! html/parsoid
21931 <div></div>
21932 <p><strong>A
21933 B</strong>
21934 </p>
21935 !! end
21936
21937 # T8200: <blockquote> should behave like <div> with respect to line breaks
21938 !! test
21939 T8200: paragraphs inside blockquotes (no extra line breaks)
21940 !! wikitext
21941 <blockquote>Line one
21942
21943 Line two</blockquote>
21944 !! html
21945 <blockquote>Line one
21946 Line two</blockquote>
21947
21948 !! html+tidy
21949 <blockquote>
21950 <p>Line one Line two</p>
21951 </blockquote>
21952 !! end
21953
21954 !! test
21955 T8200: paragraphs inside blockquotes (extra line break on open)
21956 !! wikitext
21957 <blockquote>
21958 Line one
21959
21960 Line two</blockquote>
21961 !! html
21962 <blockquote>
21963 <p>Line one
21964 </p>
21965 Line two</blockquote>
21966
21967 !! html+tidy
21968 <blockquote>
21969 <p>Line one</p>
21970 Line two</blockquote>
21971 !! end
21972
21973 !! test
21974 T8200: paragraphs inside blockquotes (extra line break on close)
21975 !! wikitext
21976 <blockquote>Line one
21977
21978 Line two
21979 </blockquote>
21980 !! html
21981 <blockquote>Line one
21982 <p>Line two
21983 </p>
21984 </blockquote>
21985
21986 !! html+tidy
21987 <blockquote>
21988 <p>Line one</p>
21989 <p>Line two</p>
21990 </blockquote>
21991 !! end
21992
21993 !! test
21994 T8200: paragraphs inside blockquotes (extra line break on open and close)
21995 !! wikitext
21996 <blockquote>
21997 Line one
21998
21999 Line two
22000 </blockquote>
22001 !! html
22002 <blockquote>
22003 <p>Line one
22004 </p><p>Line two
22005 </p>
22006 </blockquote>
22007
22008 !! html+tidy
22009 <blockquote>
22010 <p>Line one</p>
22011 <p>Line two</p>
22012 </blockquote>
22013 !! end
22014
22015 !! test
22016 Paragraphs inside blockquotes/divs (no extra line breaks)
22017 !! wikitext
22018 <blockquote><div>Line one
22019
22020 Line two</div></blockquote>
22021 !! html
22022 <blockquote><div>Line one
22023 Line two</div></blockquote>
22024
22025 !! end
22026
22027 !! test
22028 Paragraphs inside blockquotes/divs (extra line break on open)
22029 !! wikitext
22030 <blockquote><div>
22031 Line one
22032
22033 Line two</div></blockquote>
22034 !! html
22035 <blockquote><div>
22036 <p>Line one
22037 </p>
22038 Line two</div></blockquote>
22039
22040 !! end
22041
22042 !! test
22043 Paragraphs inside blockquotes/divs (extra line break on close)
22044 !! wikitext
22045 <blockquote><div>Line one
22046
22047 Line two
22048 </div></blockquote>
22049 !! html
22050 <blockquote><div>Line one
22051 <p>Line two
22052 </p>
22053 </div></blockquote>
22054
22055 !! end
22056
22057 !! test
22058 Paragraphs inside blockquotes/divs (extra line break on open and close)
22059 !! wikitext
22060 <blockquote><div>
22061 Line one
22062
22063 Line two
22064 </div></blockquote>
22065 !! html
22066 <blockquote><div>
22067 <p>Line one
22068 </p><p>Line two
22069 </p>
22070 </div></blockquote>
22071
22072 !! end
22073
22074 !! test
22075 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
22076 !! options
22077 wgLinkHolderBatchSize=0
22078 !! wikitext
22079 [[meatball:1]]
22080 [[meatball:2]]
22081 [[meatball:3]]
22082 !! html
22083 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
22084 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
22085 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
22086 </p>
22087 !! end
22088
22089 !! test
22090 Free external link invading image caption
22091 !! wikitext
22092 [[Image:Foobar.jpg|thumb|http://x|hello]]
22093 !! html
22094 <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>
22095
22096 !! end
22097
22098 !! test
22099 T17196: localised external link numbers
22100 !! options
22101 language=fa
22102 !! wikitext
22103 [http://en.wikipedia.org/]
22104 !! html/php
22105 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
22106 </p>
22107 !! html/parsoid
22108 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
22109 !! end
22110
22111 !! test
22112 Multibyte character in padleft
22113 !! wikitext
22114 {{padleft:-Hello|7|Æ}}
22115 !! html
22116 <p>Æ-Hello
22117 </p>
22118 !! end
22119
22120 !! test
22121 Multibyte character in padright
22122 !! wikitext
22123 {{padright:Hello-|7|Æ}}
22124 !! html
22125 <p>Hello-Æ
22126 </p>
22127 !! end
22128
22129 !!test
22130 formatdate parser function
22131 !! wikitext
22132 {{#formatdate:2009-03-24}}
22133 !! html
22134 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
22135 </p>
22136 !! end
22137
22138 !!test
22139 formatdate parser function, with default format
22140 !! wikitext
22141 {{#formatdate:2009-03-24|mdy}}
22142 !! html
22143 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
22144 </p>
22145 !! end
22146
22147 !! test
22148 Spacing of numbers in formatted dates
22149 !! wikitext
22150 {{#formatdate:January 15}}
22151 !! html
22152 <p><span class="mw-formatted-date" title="01-15">January 15</span>
22153 </p>
22154 !! end
22155
22156 !! test
22157 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
22158 !! options
22159 language=nl title=[[MediaWiki:Common.css]]
22160 !! wikitext
22161 {{#formatdate:2009-03-24|dmy}}
22162 !! html
22163 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
22164 </p>
22165 !! end
22166
22167 #
22168 #
22169 #
22170
22171 #
22172 # Edit comments
22173 #
22174
22175 !! test
22176 Edit comment with link
22177 !! options
22178 comment
22179 !! wikitext
22180 I like the [[Main Page]] a lot
22181 !! html/php
22182 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
22183 !!end
22184
22185 !! test
22186 Edit comment with link and link text
22187 !! options
22188 comment
22189 !! wikitext
22190 I like the [[Main Page|best pages]] a lot
22191 !! html/php
22192 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
22193 !!end
22194
22195 !! test
22196 Edit comment with link and link text with suffix
22197 !! options
22198 comment
22199 !! wikitext
22200 I like the [[Main Page|best page]]s a lot
22201 !! html/php
22202 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
22203 !!end
22204
22205 !! test
22206 Edit comment with section link (non-local, eg in history list)
22207 !! options
22208 comment title=[[Main Page]]
22209 !! wikitext
22210 /* External links */ removed bogus entries
22211 !! html/php
22212 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
22213 !!end
22214
22215 !! test
22216 Edit comment with section link and text before it (non-local, eg in history list)
22217 !! options
22218 comment title=[[Main Page]]
22219 !! wikitext
22220 pre-comment text /* External links */ removed bogus entries
22221 !! html/php
22222 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>
22223 !!end
22224
22225 !! test
22226 Edit comment with section link (local, eg in diff view)
22227 !! options
22228 comment local title=[[Main Page]]
22229 !! wikitext
22230 /* External links */ removed bogus entries
22231 !! html/php
22232 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
22233 !!end
22234
22235 !! test
22236 Edit comment with subpage link (T16080)
22237 !! options
22238 comment
22239 subpage
22240 title=[[Subpage test]]
22241 !! wikitext
22242 Poked at a [[/subpage]] here...
22243 !! html/php
22244 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
22245 !!end
22246
22247 !! test
22248 Edit comment with subpage link and link text (T16080)
22249 !! options
22250 comment
22251 subpage
22252 title=[[Subpage test]]
22253 !! wikitext
22254 Poked at a [[/subpage|neat little page]] here...
22255 !! html/php
22256 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
22257 !!end
22258
22259 !! test
22260 Edit comment with bogus subpage link in non-subpage NS (T16080)
22261 !! options
22262 comment
22263 title=[[Subpage test]]
22264 !! wikitext
22265 Poked at a [[/subpage]] here...
22266 !! html/php
22267 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...
22268 !!end
22269
22270 !! test
22271 Edit comment with bare anchor link (local, as on diff)
22272 !! options
22273 comment
22274 local
22275 title=[[Main Page]]
22276 !! wikitext
22277 [[#section]]
22278 !! html/php
22279 <a href="#section">#section</a>
22280 !! end
22281
22282 !! test
22283 Edit comment with bare anchor link (non-local, as on history)
22284 !! options
22285 comment
22286 title=[[Main Page]]
22287 !! wikitext
22288 [[#section]]
22289 !! html/php
22290 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
22291 !! end
22292
22293 !! test
22294 Anchor starting with underscore
22295 !! options
22296 title=[[Foo]]
22297 !! wikitext
22298 [[#_ref|One]]
22299 !! html/php
22300 <p><a href="#_ref">One</a>
22301 </p>
22302 !! html/parsoid
22303 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
22304 !! end
22305
22306 !! test
22307 Id starting with underscore
22308 !! wikitext
22309 <div id="_ref"></div>
22310 !! html/*
22311 <div id="_ref"></div>
22312
22313 !! end
22314
22315 !! test
22316 Edit comment with link with more than one pipe (T99346)
22317 !! options
22318 comment
22319 !! wikitext
22320 [[Main Page|Many|pipes]]
22321 !! html/php
22322 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
22323 !! end
22324
22325 !! test
22326 Complex edit comment with link with more than one pipe (T99346)
22327 !! options
22328 comment
22329 !! wikitext
22330 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
22331 !! html/php
22332 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;
22333 !! end
22334
22335 !! test
22336 Space normalisation on autocomment (T24784)
22337 !! options
22338 comment
22339 title=[[Main Page]]
22340 !! wikitext
22341 /* __hello__world__ */
22342 !! html/php
22343 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
22344 !! end
22345
22346 !! test
22347 percent-encoding and + signs in comments (T28410)
22348 !! options
22349 comment
22350 !! wikitext
22351 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
22352 !! html/php
22353 <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>
22354 !! end
22355
22356 # Parsoid doesn't support this yet: see T75581
22357 # but it *should* omit the 'src' attribute if the image is bad.
22358 # PHP side of tests was disabled in
22359 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
22360 # because of issues in the PHP parserTests infrastructure
22361 # (but the output below is indeed what the PHP side emits)
22362 !! test
22363 Bad images - basic functionality
22364 !! wikitext
22365 [[File:Bad.jpg]]
22366 !! DISABLED/html/php
22367 !! html/parsoid
22368 <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>
22369 !! end
22370
22371 !! test
22372 Bad images - T18039: text after bad image disappears
22373 !! wikitext
22374 Foo bar
22375 [[File:Bad.jpg]]
22376 Bar foo
22377 !! DISABLED/html/php
22378 <p>Foo bar
22379 </p><p>Bar foo
22380 </p>
22381 !! html/parsoid
22382 <p>Foo bar
22383 <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>
22384 Bar foo</p>
22385 !! end
22386
22387 !! test
22388 Verify that displaytitle works (T24501) no displaytitle
22389 !! options
22390 showtitle
22391 !! config
22392 wgAllowDisplayTitle=true
22393 wgRestrictDisplayTitle=false
22394 !! wikitext
22395 this is not the the title
22396 !! html/php
22397 Parser test
22398 <p>this is not the the title
22399 </p>
22400 !! end
22401
22402 !! test
22403 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
22404 !! options
22405 showtitle
22406 title=[[Screen]]
22407 !! config
22408 wgAllowDisplayTitle=true
22409 wgRestrictDisplayTitle=false
22410 !! wikitext
22411 this is not the the title
22412 {{DISPLAYTITLE:whatever}}
22413 !! html/php
22414 whatever
22415 <p>this is not the the title
22416 </p>
22417 !! end
22418
22419 !! test
22420 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
22421 !! options
22422 showtitle
22423 title=[[Screen]]
22424 !! config
22425 wgAllowDisplayTitle=true
22426 wgRestrictDisplayTitle=true
22427 !! wikitext
22428 this is not the the title
22429 {{DISPLAYTITLE:whatever}}
22430 !! html/php
22431 Screen
22432 <p>this is not the the title
22433 </p>
22434 !! end
22435
22436 !! test
22437 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
22438 !! options
22439 showtitle
22440 title=[[Screen]]
22441 !! config
22442 wgAllowDisplayTitle=true
22443 wgRestrictDisplayTitle=true
22444 !! wikitext
22445 this is not the the title
22446 {{DISPLAYTITLE:screen}}
22447 !! html/php
22448 screen
22449 <p>this is not the the title
22450 </p>
22451 !! end
22452
22453 !! test
22454 Verify that displaytitle works (T24501) AllowDisplayTitle=false
22455 !! options
22456 showtitle
22457 title=[[Screen]]
22458 !! config
22459 wgAllowDisplayTitle=false
22460 !! wikitext
22461 this is not the the title
22462 {{DISPLAYTITLE:screen}}
22463 !! html/php
22464 Screen
22465 <p>this is not the the title
22466 <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>
22467 </p>
22468 !! end
22469
22470 !! test
22471 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
22472 !! options
22473 showtitle
22474 title=[[Screen]]
22475 !! config
22476 wgAllowDisplayTitle=false
22477 !! wikitext
22478 this is not the the title
22479 !! html/php
22480 Screen
22481 <p>this is not the the title
22482 </p>
22483 !! end
22484
22485 !! test
22486 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
22487 !! options
22488 showtitle
22489 title=[[Screen]]
22490 !! config
22491 wgAllowDisplayTitle=true
22492 wgRestrictDisplayTitle=true
22493 !! wikitext
22494 this is not the the title
22495 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
22496 !! html/php
22497 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
22498 <p>this is not the the title
22499 </p>
22500 !! end
22501
22502 !! test
22503 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
22504 !! options
22505 showtitle
22506 title=[[Screen]]
22507 !! config
22508 wgAllowDisplayTitle=true
22509 wgRestrictDisplayTitle=true
22510 !! wikitext
22511 this is not the the title
22512 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
22513 !! html/php
22514 <span style="color: red;">s</span>creen
22515 <p>this is not the the title
22516 </p>
22517 !! end
22518
22519 !! test
22520 Page status indicators: Empty name is invalid
22521 !! options
22522 showindicators
22523 !! wikitext
22524 <indicator name=" "></indicator>
22525 <indicator></indicator>
22526 !! html/php
22527 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
22528 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
22529 </p>
22530 !! end
22531
22532 !! test
22533 Page status indicators: Weird syntaxes that are okay
22534 !! options
22535 showindicators
22536 !! wikitext
22537 <indicator name="empty" />
22538 <indicator name="name"></indicator>
22539 !! html/php
22540 empty=
22541 name=
22542 <p><br />
22543 </p>
22544 !! end
22545
22546 !! test
22547 Page status indicators: Torture test
22548 !! options
22549 showindicators
22550 !! wikitext
22551 <indicator name="01">hello world</indicator>
22552 <indicator name="02">[[Main Page]]</indicator>
22553 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
22554 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
22555 <indicator name="05">* foo
22556 * bar</indicator>
22557 <indicator name="06"><nowiki>foo</nowiki></indicator>
22558 <indicator name="07"> Preformatted</indicator>
22559 <indicator name="08"><div>Broken tag</indicator>
22560 <indicator name="09">{| class=wikitable
22561 | cell
22562 |}</indicator>
22563 <indicator name="10">Two
22564
22565 paragraphs</indicator>
22566 !! html/php
22567 01=hello world
22568 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
22569 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" />
22570 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>
22571 05=<ul><li> foo</li>
22572 <li> bar</li></ul>
22573
22574 06=foo
22575 07=<pre>Preformatted
22576 </pre>
22577 08=<div>Broken tag</div>
22578
22579 09=<table class="wikitable">
22580 <tr>
22581 <td> cell
22582 </td></tr></table>
22583
22584 10=<p>Two
22585 </p><p>paragraphs
22586 </p>
22587 <p><br />
22588 </p><p><br />
22589 </p><p><br />
22590 </p><p><br />
22591 </p><p><br />
22592 </p>
22593 !! end
22594
22595 !! test
22596 preload: check <noinclude> and <includeonly>
22597 !! options
22598 preload
22599 !! wikitext
22600 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
22601 !! html/php
22602 Hello kind world.
22603 !! end
22604
22605 !! test
22606 preload: check <onlyinclude>
22607 !! options
22608 preload
22609 !! wikitext
22610 Goodbye <onlyinclude>Hello world</onlyinclude>
22611 !! html/php
22612 Hello world
22613 !! end
22614
22615 !! test
22616 preload: can pass tags through if we want to
22617 !! options
22618 preload
22619 !! wikitext
22620 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
22621 !! html/php
22622 <includeonly>Hello world</includeonly>
22623 !! end
22624
22625 !! test
22626 preload: check that it doesn't try to do tricks
22627 !! options
22628 preload
22629 !! wikitext
22630 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
22631 !! html/php
22632 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
22633 !! end
22634
22635 !! test
22636 Play a bit with r67090 and T5158
22637 !! wikitext
22638 <div style="width:50% !important">&nbsp;</div>
22639 <div style="width:50%&nbsp;!important">&nbsp;</div>
22640 <div style="width:50%&#160;!important">&nbsp;</div>
22641 <div style="border : solid;">&nbsp;</div>
22642 !! html/php
22643 <div style="width:50% !important">&#160;</div>
22644 <div style="width:50% !important">&#160;</div>
22645 <div style="width:50% !important">&#160;</div>
22646 <div style="border&#160;: solid;">&#160;</div>
22647
22648 !! html/parsoid
22649 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
22650 <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>
22651 <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>
22652 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
22653
22654 !! end
22655
22656 !! test
22657 HTML5 data attributes
22658 !! wikitext
22659 <span data-foo="bar">Baz</span>
22660 <p data-abc-def_hij="">Quuz</p>
22661 !! html/php
22662 <p><span data-foo="bar">Baz</span>
22663 </p>
22664 <p data-abc-def_hij="">Quuz</p>
22665
22666 !! html/parsoid
22667 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
22668 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
22669 !! end
22670
22671 !! test
22672 Strip reserved data attributes
22673 !! wikitext
22674 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
22675 !! html/php
22676 <div data-ok="fred">d</div>
22677
22678 !! html/parsoid
22679 <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>
22680 !! end
22681
22682 !! test
22683 percent-encoding and + signs in internal links (T28410)
22684 !! wikitext
22685 [[User:+%]] [[Page+title%]]
22686 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
22687 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
22688 [[%33%45]] [[%33%45+]]
22689 !! html/php
22690 <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>
22691 <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>
22692 <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>
22693 <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>
22694 </p>
22695 !! html/parsoid
22696 <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>
22697 <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>
22698 <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":"apierror-filedoesnotexist","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>
22699 <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>
22700 !! end
22701
22702 !! test
22703 Special characters in embedded file links (T29679)
22704 !! wikitext
22705 [[File:Contains & ampersand.jpg]]
22706 [[File:Does not exist.jpg|Title with & ampersand]]
22707 !! html/php
22708 <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>
22709 <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>
22710 </p>
22711 !! html/parsoid
22712 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","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>
22713 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","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>
22714 !! end
22715
22716 !! test
22717 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
22718 !! wikitext
22719 Text&apos;s been normalized?
22720 !! html
22721 <p>Text&#39;s been normalized?
22722 </p>
22723 !! end
22724
22725 !! test
22726 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
22727 !! wikitext
22728 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
22729 !! html
22730 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
22731 </p>
22732 !! end
22733
22734 !! test
22735 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
22736 !! wikitext
22737 [http://www.example.org/ ideograms]
22738 !! html
22739 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
22740 </p>
22741 !! end
22742
22743 !! test
22744 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
22745 !! wikitext
22746 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
22747 !! html
22748 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
22749 </p>
22750 !! end
22751
22752 !! article
22753 Mediawiki:loop1
22754 !! text
22755 {{Identical|A}}
22756 !! endarticle
22757
22758 !! article
22759 Mediawiki:loop2
22760 !! text
22761 {{Identical|B}}
22762 !! endarticle
22763
22764 !! article
22765 Template:Identical
22766 !! text
22767 {{int:loop1}}
22768 {{int:loop2}}
22769 !! endarticle
22770
22771 !! test
22772 T33098 Template which includes system messages which includes the template
22773 !! wikitext
22774 {{Identical}}
22775 !! html
22776 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22777 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22778 </p>
22779 !! end
22780
22781 !! test
22782 T33490 Turkish: ucfirst 'blah'
22783 !! options
22784 language=tr
22785 !! wikitext
22786 {{ucfirst:blah}}
22787 !! html
22788 <p>Blah
22789 </p>
22790 !! end
22791
22792 !! test
22793 T33490 Turkish: ucfirst 'ix'
22794 !! options
22795 language=tr
22796 !! wikitext
22797 {{ucfirst:ix}}
22798 !! html
22799 <p>İx
22800 </p>
22801 !! end
22802
22803 !! test
22804 T33490 Turkish: lcfirst 'BLAH'
22805 !! options
22806 language=tr
22807 !! wikitext
22808 {{lcfirst:BLAH}}
22809 !! html
22810 <p>bLAH
22811 </p>
22812 !! end
22813
22814 !! test
22815 T33490 Turkish: ucfırst (with a dotless i)
22816 !! options
22817 language=tr
22818 !! wikitext
22819 {{ucfırst:blah}}
22820 !! html
22821 <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>
22822 </p>
22823 !! end
22824
22825 !! test
22826 T33490 ucfırst (with a dotless i) with English language
22827 !! options
22828 language=en
22829 !! wikitext
22830 {{ucfırst:blah}}
22831 !! html
22832 <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>
22833 </p>
22834 !! end
22835
22836 # Note that Parsoid doesn't emit an explicit TOC.
22837 # Note also that the html2wt direction tends to emit an extra newline
22838 # between the __TOC__ magicword and the first heading unless *both*
22839 # the <meta> and the <h2> have a data-parsoid attribute set (even if
22840 # it's "{}").
22841
22842 !! test
22843 T28375: TOC with italics
22844 !! options
22845 title=[[Main Page]]
22846 !! wikitext
22847 __TOC__
22848 == ''Lost'' episodes ==
22849 !! html/php
22850 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
22851 <ul>
22852 <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>
22853 </ul>
22854 </div>
22855
22856 <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>
22857
22858 !! html/parsoid
22859 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22860 <h2 data-parsoid='{}'> <i>Lost</i> episodes </h2>
22861 !! end
22862
22863 !! test
22864 T28375: TOC with bold
22865 !! options
22866 title=[[Main Page]]
22867 !! wikitext
22868 __TOC__
22869 == '''should be bold''' then normal text ==
22870 !! html/php
22871 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
22872 <ul>
22873 <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>
22874 </ul>
22875 </div>
22876
22877 <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>
22878
22879 !! html/parsoid
22880 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22881 <h2 data-parsoid='{}'> <b>should be bold</b> then normal text </h2>
22882 !! end
22883
22884 !! test
22885 T35845: Headings become cursive in TOC when they contain an image
22886 !! options
22887 title=[[Main Page]]
22888 !! wikitext
22889 __TOC__
22890 == Image [[Image:foobar.jpg]] ==
22891 !! html/php
22892 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
22893 <ul>
22894 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
22895 </ul>
22896 </div>
22897
22898 <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>
22899
22900 !! html/parsoid
22901 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22902 <h2 data-parsoid='{}'> Image <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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></span> </h2>
22903 !! end
22904
22905 !! test
22906 T35845 (2): Headings become bold in TOC when they contain a blockquote
22907 !! options
22908 title=[[Main Page]]
22909 !! wikitext
22910 __TOC__
22911 == <blockquote>Quote</blockquote> ==
22912 !! html/php
22913 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
22914 <ul>
22915 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22916 </ul>
22917 </div>
22918
22919 <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>
22920
22921 !! html/php+tidy
22922 <p></p>
22923 <div id="toc" class="toc">
22924 <div class="toctitle">
22925 <h2>Contents</h2>
22926 </div>
22927 <ul>
22928 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22929 </ul>
22930 </div>
22931 <p></p>
22932 <h2><span class="mw-headline" id="Quote"></span></h2>
22933 <blockquote>
22934 <p><span class="mw-headline" id="Quote">Quote</span></p>
22935 </blockquote>
22936 <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>
22937 !! html/parsoid
22938 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22939 <h2 data-parsoid='{}'> <blockquote>Quote</blockquote> </h2>
22940 !! end
22941
22942 !! test
22943 Unclosed tags in TOC
22944 !! options
22945 title=[[Main Page]]
22946 !! wikitext
22947 __TOC__
22948 == Proof: 2 < 3 ==
22949 <small>Hanc marginis exiguitas non caperet.</small>
22950 QED
22951 !! html/php
22952 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
22953 <ul>
22954 <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>
22955 </ul>
22956 </div>
22957
22958 <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>
22959 <p><small>Hanc marginis exiguitas non caperet.</small>
22960 QED
22961 </p>
22962 !! html/parsoid
22963 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
22964 <h2 data-parsoid='{}'> Proof: 2 &lt; 3 </h2>
22965 <p><small>Hanc marginis exiguitas non caperet.</small>
22966 QED</p>
22967 !! end
22968
22969 !! test
22970 Multiple tags in TOC
22971 !! wikitext
22972 __TOC__
22973 == <i>Foo</i> <b>Bar</b> ==
22974
22975 == <i>Foo</i> <blockquote>Bar</blockquote> ==
22976 !! html/php
22977 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
22978 <ul>
22979 <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>
22980 <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>
22981 </ul>
22982 </div>
22983
22984 <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>
22985 <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>
22986
22987 !! html/php+tidy
22988 <p></p>
22989 <div id="toc" class="toc">
22990 <div class="toctitle">
22991 <h2>Contents</h2>
22992 </div>
22993 <ul>
22994 <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>
22995 <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>
22996 </ul>
22997 </div>
22998 <p></p>
22999 <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>
23000 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
23001 <blockquote>
23002 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
23003 </blockquote>
23004 <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>
23005 !! html/parsoid
23006 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23007 <h2 data-parsoid='{}'> <i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b> </h2>
23008 <h2> <i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote> </h2>
23009 !! end
23010
23011 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
23012 # html5 tag parsing.
23013 !! test
23014 Tags with parameters in TOC
23015 !! options
23016 parsoid=wt2html
23017 !! wikitext
23018 __TOC__
23019 == <sup class="in-h2">Hello</sup> ==
23020
23021 == <sup class="a > b">Evilbye</sup> ==
23022 !! html/php
23023 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23024 <ul>
23025 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
23026 <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>
23027 </ul>
23028 </div>
23029
23030 <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>
23031 <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>
23032
23033 !! html/parsoid
23034 <meta property="mw:PageProp/toc" />
23035 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
23036
23037 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
23038 !! end
23039
23040 !! test
23041 span tags with directionality in TOC
23042 !! wikitext
23043 __TOC__
23044 == <span dir="ltr">C++</span> ==
23045
23046 == <span dir="rtl">זבנג!</span> ==
23047
23048 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
23049
23050 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
23051
23052 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
23053 !! html/php
23054 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23055 <ul>
23056 <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>
23057 <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>
23058 <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>
23059 <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>
23060 <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>
23061 </ul>
23062 </div>
23063
23064 <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>
23065 <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>
23066 <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>
23067 <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>
23068 <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>
23069
23070 !! html/parsoid
23071 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23072 <h2 data-parsoid='{}'> <span dir="ltr">C++</span> </h2>
23073 <h2> <span dir="rtl">זבנג!</span> </h2>
23074 <h2> <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> </h2>
23075 <h2> <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> </h2>
23076 <h2> <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> </h2>
23077 !! end
23078
23079 !! test
23080 T74884: bdi element in ToC
23081 !! wikitext
23082 __TOC__
23083 == <bdi>test</bdi> ==
23084 !! html/php
23085 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23086 <ul>
23087 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
23088 </ul>
23089 </div>
23090
23091 <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>
23092
23093 !! html/parsoid
23094 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23095 <h2 data-parsoid='{}'> <bdi>test</bdi> </h2>
23096 !! end
23097
23098 !! test
23099 T35715: s/strike element in ToC
23100 !! wikitext
23101 __TOC__
23102 == <s>test</s> test <strike>test</strike> ==
23103 !! html/php
23104 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23105 <ul>
23106 <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>
23107 </ul>
23108 </div>
23109
23110 <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>
23111
23112 !! html/parsoid
23113 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23114 <h2 data-parsoid='{}'> <s>test</s> test <strike>test</strike> </h2>
23115 !! end
23116
23117 # Note that the html output does not have the <p></p>, but the
23118 # html+tidy output *does*. This is because the empty <p></p> is
23119 # removed by the sanitizer, but only when tidy is *not* enabled (!).
23120 !! test
23121 Empty <p> tag in TOC, removed by Sanitizer (T92892)
23122 !! wikitext
23123 __TOC__
23124 == x ==
23125 !! html/php
23126 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23127 <ul>
23128 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
23129 </ul>
23130 </div>
23131
23132 <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>
23133
23134 !! html/php+tidy
23135 <p></p>
23136 <div id="toc" class="toc">
23137 <div class="toctitle">
23138 <h2>Contents</h2>
23139 </div>
23140 <ul>
23141 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
23142 </ul>
23143 </div>
23144 <p></p>
23145 <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>
23146 !! html/parsoid
23147 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23148 <h2 data-parsoid='{}'> x </h2>
23149 !! end
23150
23151 !! article
23152 MediaWiki:T34057
23153 !! text
23154 == {{int:headline_sample}} ==
23155 !! endarticle
23156
23157 !! test
23158 T34057: Title needed when expanding <h> nodes.
23159 !! options
23160 title=[[Main Page]]
23161 !! wikitext
23162 {{int:T34057}}
23163 !! html
23164 <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>
23165
23166 !! end
23167
23168 !! test
23169 Strip marker in urlencode
23170 !! wikitext
23171 {{urlencode:x<nowiki/>y}}
23172 {{urlencode:x<nowiki/>y|wiki}}
23173 {{urlencode:x<nowiki/>y|path}}
23174 {{urlencode:x<pre id="one">two</pre>y}}
23175 !! html/php
23176 <p>xy
23177 xy
23178 xy
23179 xy
23180 </p>
23181 !! end
23182
23183 !! test
23184 Strip marker in lc
23185 !! wikitext
23186 {{lc:x<nowiki/>y}}
23187 !! html
23188 <p>xy
23189 </p>
23190 !! end
23191
23192 !! test
23193 Strip marker in uc
23194 !! wikitext
23195 {{uc:x<nowiki/>y}}
23196 !! html
23197 <p>XY
23198 </p>
23199 !! end
23200
23201 !! test
23202 Strip marker in formatNum
23203 !! wikitext
23204 {{formatnum:1<nowiki/>2}}
23205 {{formatnum:1<nowiki/>2|R}}
23206 !! html
23207 <p>12
23208 12
23209 </p>
23210 !! end
23211
23212 !! test
23213 Check noCommafy in formatNum
23214 !! options
23215 language=be-tarask
23216 !! wikitext
23217 {{formatnum:123456.78}}
23218 {{formatnum:123456.78|NOSEP}}
23219 !! html
23220 <p>123 456,78
23221 123456.78
23222 </p>
23223 !! end
23224
23225 !! test
23226 Wrong option for formatNum (T58199)
23227 !! wikitext
23228 {{formatnum:1,234.56|Random}}
23229 {{formatnum:1,234.56|EVERYTHING}}
23230 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
23231 !! html
23232 <p>1,234.56
23233 1,234.56
23234 1,234.56
23235 </p>
23236 !! end
23237
23238 !! test
23239 Strip marker in grammar
23240 !! options
23241 language=fi
23242 !! wikitext
23243 {{grammar:elative|foo<nowiki/>bar}}
23244 !! html
23245 <p>foobarista
23246 </p>
23247 !! end
23248
23249 !! test
23250 Strip marker in padleft
23251 !! wikitext
23252 {{padleft:|2|x<nowiki/>y}}
23253 !! html
23254 <p>xy
23255 </p>
23256 !! end
23257
23258 !! test
23259 Strip marker in padright
23260 !! wikitext
23261 {{padright:|2|x<nowiki/>y}}
23262 !! html
23263 <p>xy
23264 </p>
23265 !! end
23266
23267 !! test
23268 Strip marker in anchorencode
23269 !! wikitext
23270 {{anchorencode:x<nowiki/>y}}
23271 !! html
23272 <p>xy
23273 </p>
23274 !! end
23275
23276 !! test
23277 nowiki inside link inside heading (T20295)
23278 !! wikitext
23279 ==[[foo|x<nowiki>y</nowiki>z]]==
23280 !! html
23281 <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>
23282
23283 !! end
23284
23285 !! test
23286 new support for bdi element (T33817)
23287 !! wikitext
23288 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
23289 !! html
23290 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
23291
23292 !!end
23293
23294 !! test
23295 Ignore pipe between table row attributes
23296 !! wikitext
23297 {|
23298 | quux
23299 |- id=foo | style='color: red'
23300 | bar
23301 |}
23302 !! html
23303 <table>
23304 <tr>
23305 <td> quux
23306 </td></tr>
23307 <tr id="foo" style="color: red">
23308 <td> bar
23309 </td></tr></table>
23310
23311 !! end
23312
23313 !!test
23314 Language parser function
23315 !! wikitext
23316 {{#language:ar}}
23317 !! html
23318 <p>العربية
23319 </p>
23320 !! end
23321
23322 !!test
23323 Padleft and padright as substr
23324 !! wikitext
23325 {{padleft:|3|abcde}}
23326 {{padright:|3|abcde}}
23327 !! html
23328 <p>abc
23329 abc
23330 </p>
23331 !! end
23332
23333 !!test
23334 Special parser function
23335 !! wikitext
23336 {{#special:RandomPage}}
23337 {{#special:BaDtItLe}}
23338 {{#special:Foobar}}
23339 !! html
23340 <p>Special:Random
23341 Special:Badtitle
23342 Special:Foobar
23343 </p>
23344 !! end
23345
23346 !!test
23347 T36939 - Case insensitive link parsing ([HttP://])
23348 !! wikitext
23349 [HttP://MediaWiki.Org/]
23350 !! html/php
23351 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
23352 </p>
23353 !! html/parsoid
23354 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
23355 !! end
23356
23357 !!test
23358 T36939 - Case insensitive link parsing ([HttP:// title])
23359 !! wikitext
23360 [HttP://MediaWiki.Org/ MediaWiki]
23361 !! html
23362 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
23363 </p>
23364 !! end
23365
23366 !!test
23367 T36939 - Case insensitive link parsing (HttP://)
23368 !! wikitext
23369 HttP://MediaWiki.Org/
23370 !! html/php
23371 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
23372 </p>
23373 !! html/parsoid
23374 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
23375 !! end
23376
23377 !!test
23378 Disable TOC
23379 !! options
23380 notoc
23381 !! wikitext
23382 Lead
23383 == Section 1 ==
23384 == Section 2 ==
23385 == Section 3 ==
23386 == Section 4 ==
23387 == Section 5 ==
23388 !! html
23389 <p>Lead
23390 </p>
23391
23392 <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>
23393 <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>
23394 <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>
23395 <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>
23396 <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>
23397
23398 !! end
23399
23400
23401 ###
23402 ### Parsoid-specific tests
23403 ### Parsoid-PHP parser incompatibilities
23404 ###
23405 !!test
23406 1. SOL-sensitive wikitext tokens as template-args
23407 !!options
23408 parsoid=wt2html,wt2wt
23409 !! wikitext
23410 {{echo|*a}}
23411 {{echo|#a}}
23412 {{echo|:a}}
23413 !! html
23414 <span about="#mwt1" typeof="mw:Transclusion">
23415 </span><ul about="#mwt1"><li>a</li>
23416 </ul>
23417 <span about="#mwt2" typeof="mw:Transclusion">
23418 </span><ol about="#mwt2"><li>a</li>
23419 </ol>
23420 <span about="#mwt3" typeof="mw:Transclusion">
23421 </span><dl about="#mwt3"><dd>a</dd>
23422 </dl>
23423 !!end
23424
23425 #### -----------------------------------------------------------------
23426 #### Parsoid-specific functionality tests
23427 #### -----------------------------------------------------------------
23428
23429 # T65642/T68749: Formatting elt fixup around images is cleaned up.
23430 # We know wt2wt will fail, but we expect selser to pass.
23431 # Due to the nature of our testing, wt2wt and selser tests will enter the
23432 # blacklist and we'll catch selser regressions based on changes to the
23433 # blacklist entries for selser tests.
23434 !! test
23435 1. Bad treebuilder fixup of formatting elt is cleaned up
23436 !! options
23437 parsoid=wt2html,wt2wt
23438 !! wikitext
23439 {|
23440 |
23441 <small>
23442 [[Image:Foobar.jpg|right|Test]]
23443 </small>
23444 |}
23445 !! html/parsoid
23446 <table>
23447 <tbody><tr><td>
23448 <small>
23449 <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>
23450 </small>
23451 </td></tr>
23452 </tbody></table>
23453 !! end
23454
23455 !! test
23456 2. Bad treebuilder fixup of formatting elt is cleaned up
23457 !! options
23458 parsoid=wt2html,wt2wt
23459 !! wikitext
23460 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
23461
23462 <small>[[Image:Foobar.jpg|right|300px]]</small>
23463 !! html/parsoid
23464
23465 <p><b>foo</b></p>
23466 <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>
23467 <p><b>bar</b></p>
23468 <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>
23469 !! end
23470
23471 !! test
23472 3. Bad treebuilder fixup of formatting elt is cleaned up
23473 !! options
23474 parsoid=wt2html,wt2wt
23475 !! wikitext
23476 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
23477 !! html/parsoid
23478 <p><small><b>foo</b></small></p>
23479 <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>
23480 <p><small><b>bar</b></small></p>
23481 !! end
23482
23483 !! test
23484 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
23485 !! options
23486 parsoid=wt2html,wt2wt
23487 !! wikitext
23488 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
23489 !! html/parsoid
23490 <p><b><small></small></b></p>
23491 <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>
23492 <p></p>
23493 !! end
23494
23495 #### ----------------------------------------------------------------
23496 #### Parsoid-only testing of Parsoid's impl of LST
23497 #### Not implemented yet, see
23498 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
23499 #### ----------------------------------------------------------------
23500
23501 ## We still need to support serializing the older format while content is stored.
23502 !! test
23503 LST Sections: Backwards compatibility
23504 !! options
23505 parsoid={
23506 "suppressErrors": true,
23507 "modes": ["html2wt"]
23508 }
23509 !! wikitext
23510 <section begin="2011-05-16" />
23511 <section end="2014-04-10 (MW 1.23wmf22)" />
23512 !! html/parsoid
23513 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
23514 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
23515 !! end
23516
23517 !! test
23518 LST Sections: Newfangled approach
23519 !! wikitext
23520 <section begin="2011-05-16" />
23521 <section end="2014-04-10 (MW 1.23wmf22)" />
23522 !! html/parsoid
23523 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
23524 </span>
23525 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
23526 </span></p>
23527 !! end
23528
23529 #--------- Test stripping of empty nodes in template content ----------
23530
23531 !! test
23532 Empty LI and TR nodes should be stripped from template content
23533 !! wikitext
23534 {{EmptyLITest}}
23535 {{EmptyTRTest}}
23536 !! html/parsoid
23537 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
23538 <li>a</li>
23539 <li>b</li>
23540 </ul>
23541 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
23542 <tbody>
23543 <tr>
23544 <td>foo</td>
23545 </tr>
23546 <tr>
23547 <td>bar</td>
23548 </tr>
23549 </tbody>
23550 </table>
23551 !! end
23552
23553 !! test
23554 Empty LI and TR nodes should not be stripped from top-level content
23555 !! wikitext
23556 * a
23557 *
23558 * b
23559 {|
23560 |-
23561 |-
23562 |foo
23563 |}
23564 !! html/parsoid
23565 <ul>
23566 <li> a</li>
23567 <li></li>
23568 <li> b</li>
23569 </ul>
23570 <table>
23571 <tbody>
23572 <tr></tr>
23573 <tr>
23574 <td>foo</td>
23575 </tr>
23576 </tbody>
23577 </table>
23578 !! end
23579
23580 !! test
23581 Empty TR nodes should not be stripped if they have any attributes set
23582 !! wikitext
23583 {{EmptyTRWithHTMLAttrTest}}
23584 !! html/parsoid
23585 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
23586 <tr align="center"></tr>
23587 <tr><td>foo</td></tr>
23588 <tr align="center"></tr>
23589 <tr><td>bar</td></tr>
23590 </table>
23591 !! end
23592
23593 #### ----------------------------------------------------------------
23594 #### The following section of tests are primarily to test
23595 #### wikitext escaping capabilities of Parsoid. Given that
23596 #### escaping can be done any number of ways, the wikitext (input)
23597 #### is always adjusted to reflect how Parsoid adds nowiki
23598 #### escape tags.
23599 ####
23600 #### We are marking several tests as parsoid-only since the
23601 #### HTML in the result section is different from what the
23602 #### PHP parser generates for it.
23603 #### ----------------------------------------------------------------
23604
23605
23606 #### --------------- Headings ---------------
23607 #### 0. Unnested
23608 #### 1. Nested inside html <h1>=foo=</h1>
23609 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
23610 #### 3. Nested inside html with wikitext split by html tags
23611 #### 4. No escape needed
23612 #### 5. Empty headings <h1></h1>
23613 #### 6. Heading chars in SOL context
23614 #### ----------------------------------------
23615 !! test
23616 Headings: 0. Unnested
23617 !! options
23618 parsoid=html2wt
23619 !! html/parsoid
23620 <p>=foo=</p>
23621
23622 <p> =foo=
23623 <!--cmt-->
23624 =foo=</p>
23625
23626 <p>=foo<i>a</i>=</p>
23627 !! wikitext
23628 <nowiki>=foo=</nowiki>
23629
23630 <nowiki> </nowiki>=foo=
23631 <!--cmt-->
23632 <nowiki>=foo=</nowiki>
23633
23634 =foo''a''<nowiki>=</nowiki>
23635 !!end
23636
23637 # New headings and existing headings are handled differently
23638 !! test
23639 Headings: 1. Nested inside html
23640 !! options
23641 parsoid=html2wt
23642 !! html/parsoid
23643 <h1>=foo=</h1>
23644 <h2>=foo=</h2>
23645 <h3>=foo=</h3>
23646
23647 <h1 data-parsoid=''>=foo=</h1>
23648 <h2 data-parsoid=''>=foo=</h2>
23649 <h3 data-parsoid=''>=foo=</h3>
23650 <h4 data-parsoid=''>=foo=</h4>
23651 <h5 data-parsoid=''>=foo=</h5>
23652 <h6 data-parsoid=''>=foo=</h6>
23653 !! wikitext
23654 = =foo= =
23655
23656 == =foo= ==
23657
23658 === =foo= ===
23659
23660 =<nowiki>=foo=</nowiki>=
23661 ==<nowiki>=foo=</nowiki>==
23662 ===<nowiki>=foo=</nowiki>===
23663 ====<nowiki>=foo=</nowiki>====
23664 =====<nowiki>=foo=</nowiki>=====
23665 ======<nowiki>=foo=</nowiki>======
23666
23667 !!end
23668
23669 !! test
23670 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
23671 !! options
23672 parsoid=html2wt
23673 !! html/parsoid
23674 <h1>foo</h1>*bar
23675 <h1>foo</h1>=bar
23676 <h1>foo</h1>=bar=
23677 !! wikitext
23678 = foo =
23679 <nowiki>*</nowiki>bar
23680
23681 = foo =
23682 =bar
23683
23684 = foo =
23685 <nowiki>=bar=</nowiki>
23686 !!end
23687
23688 !! test
23689 Headings: 3. Nested inside html with wikitext split by html tags
23690 !! options
23691 parsoid=html2wt
23692 !! html/parsoid
23693 <h1>=<b>bold</b>foo=</h1>
23694 !! wikitext
23695 = ='''bold'''foo= =
23696 !!end
23697
23698 !! test
23699 Headings: 4a. No escaping needed (testing just h1 and h2)
23700 !! options
23701 parsoid=html2wt
23702 !! html/parsoid
23703 <h1>=foo</h1>
23704 <h1>foo=</h1>
23705 <h1> =foo= </h1>
23706 <h1>=foo= bar</h1>
23707 <h2>=foo</h2>
23708 <h2>foo=</h2>
23709 <h1>=</h1>
23710 <h1><i>=</i>foo=</h1>
23711 !! wikitext
23712 = =foo =
23713
23714 = foo= =
23715
23716 = =foo= =
23717
23718 = =foo= bar =
23719
23720 == =foo ==
23721
23722 == foo= ==
23723
23724 = = =
23725
23726 = ''=''foo= =
23727 !!end
23728
23729 !! test
23730 Headings: 4b. No escaping needed (inside p-tags)
23731 !! options
23732 parsoid=html2wt
23733 !! html/parsoid
23734 <p>===
23735 =foo= x
23736 =foo= <s></s>
23737 </p>
23738 !! wikitext
23739 ===
23740 =foo= x
23741 =foo= <s></s>
23742 !!end
23743
23744 !! test
23745 Headings: 5. Empty headings
23746 !! options
23747 parsoid=html2wt
23748 !! html/parsoid
23749 <h1 data-parsoid='{}'></h1>
23750
23751 <h2 data-parsoid='{}'></h2>
23752
23753 <h3 data-parsoid='{}'></h3>
23754
23755 <h4 data-parsoid='{}'></h4>
23756
23757 <h5 data-parsoid='{}'></h5>
23758
23759 <h6 data-parsoid='{}'></h6>
23760 !! wikitext
23761 =<nowiki/>=
23762
23763 ==<nowiki/>==
23764
23765 ===<nowiki/>===
23766
23767 ====<nowiki/>====
23768
23769 =====<nowiki/>=====
23770
23771 ======<nowiki/>======
23772 !!end
23773
23774 !! test
23775 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23776 !! options
23777 parsoid=html2wt
23778 !! html/parsoid
23779 <p>=a=</p>
23780
23781 <p>=a=</p>
23782
23783 <p>=a=</p>
23784 !! wikitext
23785 <nowiki>=a=</nowiki>
23786
23787 <nowiki>=a=</nowiki>
23788
23789 <nowiki>=a=</nowiki>
23790 !!end
23791
23792 !! test
23793 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23794 !! options
23795 parsoid=html2wt
23796 !! html/parsoid
23797 <p>=a=
23798 b</p>
23799
23800 <p>=a=
23801 b</p>
23802
23803 <p>=a=
23804 b</p>
23805 !! wikitext
23806 <nowiki>=a=</nowiki>
23807 b
23808
23809 <nowiki>=a=</nowiki>
23810 b
23811
23812 <nowiki>=a=</nowiki>
23813 b
23814 !!end
23815
23816 !! test
23817 Headings: 6c. Heading chars in SOL context (leading newline break)
23818 !! options
23819 parsoid=html2wt
23820 !! html/parsoid
23821 <p>a
23822 =b=</p>
23823 !! wikitext
23824 a
23825 <nowiki>=b=</nowiki>
23826 !!end
23827
23828 !! test
23829 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23830 !! options
23831 parsoid=html2wt
23832 !! html/parsoid
23833 <!--c0--><p>=a=</p>
23834
23835 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23836 !! wikitext
23837 <!--c0--><nowiki>=a=</nowiki>
23838
23839 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23840 !!end
23841
23842 !! test
23843 Headings: 6d. Heading chars in SOL context (No escaping needed)
23844 !! options
23845 parsoid=html2wt
23846 !! html/parsoid
23847 =a=<div>b</div>
23848 !! wikitext
23849 =a=<div>b</div>
23850 !!end
23851
23852 !! test
23853 Headings: 7. Insert a newline between new content and headings
23854 !! options
23855 parsoid=html2wt
23856 !! html/parsoid
23857 <h2>NEW</h2>
23858 <p>new</p>
23859 <h2 data-parsoid='{}'>A</h2>
23860 <p data-parsoid='{}'>a</p>
23861 !! wikitext
23862 == NEW ==
23863 new
23864
23865 ==A==
23866 a
23867
23868 !! end
23869
23870 #### --------------- Lists ---------------
23871 #### 0. Outside nests (*foo, etc.)
23872 #### 1. Nested inside html <ul><li>*foo</li></ul>
23873 #### 2. Inside definition lists
23874 #### 3. Only bullets at start should be escaped
23875 #### 4. No escapes needed
23876 #### 5. No unnecessary escapes
23877 #### 6. Escape bullets in SOL position
23878 #### 7. Escape bullets in a multi-line context
23879 #### ----------------------------------------
23880
23881 !! test
23882 Lists: 0. Outside nests
23883 !! options
23884 parsoid=html2wt
23885 !! html/parsoid
23886 <p>*foo</p>
23887
23888 <p>#foo</p>
23889
23890 <p>;Foo:bar</p>
23891 !! wikitext
23892 <nowiki>*</nowiki>foo
23893
23894 <nowiki>#</nowiki>foo
23895
23896 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23897 !!end
23898
23899 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23900 ## to test wikitext escaping, and insignificant whitespace diffs
23901 ## cause PHP parser tests to barf
23902 !! test
23903 Lists: 1. Nested inside html (No unnecessary escapes)
23904 !! options
23905 parsoid=html2wt
23906 !! html/parsoid
23907 <ul>
23908 <li>*foo</li>
23909 <li>#foo</li>
23910 <li>:foo</li>
23911 <li>;foo</li>
23912 <li data-parsoid='{}'>*foo</li>
23913 <li data-parsoid='{}'>#foo</li>
23914 <li data-parsoid='{}'>:foo</li>
23915 <li data-parsoid='{}'>;foo</li>
23916 </ul>
23917
23918 <ol>
23919 <li>*foo</li>
23920 <li>#foo</li>
23921 <li>:foo</li>
23922 <li>;foo</li>
23923 <li data-parsoid='{}'>*foo</li>
23924 <li data-parsoid='{}'>#foo</li>
23925 <li data-parsoid='{}'>:foo</li>
23926 <li data-parsoid='{}'>;foo</li>
23927 </ol>
23928 !! wikitext
23929 * *foo
23930 * #foo
23931 * :foo
23932 * ;foo
23933 *<nowiki>*foo</nowiki>
23934 *<nowiki>#foo</nowiki>
23935 *<nowiki>:foo</nowiki>
23936 *<nowiki>;foo</nowiki>
23937
23938 # *foo
23939 # #foo
23940 # :foo
23941 # ;foo
23942 #<nowiki>*foo</nowiki>
23943 #<nowiki>#foo</nowiki>
23944 #<nowiki>:foo</nowiki>
23945 #<nowiki>;foo</nowiki>
23946 !!end
23947
23948 !! test
23949 Lists: 2. Inside definition lists
23950 !! options
23951 parsoid=html2wt
23952 !! html/parsoid
23953 <dl><dt>;foo</dt></dl>
23954 <dl><dt>:foo</dt></dl>
23955 <dl><dt>:foo</dt>
23956 <dd>bar</dd></dl>
23957 <dl><dd>:foo</dd></dl>
23958 !! wikitext
23959 ; ;foo
23960
23961 ; <nowiki>:foo</nowiki>
23962
23963 ; <nowiki>:foo</nowiki>
23964 : bar
23965
23966 : :foo
23967 !!end
23968
23969 !! test
23970 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23971 !! options
23972 parsoid=html2wt
23973 !! html/parsoid
23974 <ul>
23975 <li>*foo*bar</li>
23976 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23977 </ul>
23978 !! wikitext
23979 * *foo*bar
23980 *<nowiki>*foo</nowiki>''it''*bar
23981 !!end
23982
23983 !! test
23984 Lists: 4. No escapes needed
23985 !! options
23986 parsoid=html2wt
23987 !! html/parsoid
23988 <ul>
23989 <li>foo*bar
23990 </li>
23991 </ul>
23992 <ul>
23993 <li><i>foo</i>*bar
23994 </li>
23995 </ul>
23996 <ul>
23997 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23998 </li>
23999 </ul>
24000 <ul>
24001 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
24002 </li>
24003 </ul>
24004 !! wikitext
24005 *foo*bar
24006
24007 *''foo''*bar
24008
24009 *[[Foo]]: bar
24010
24011 *[[Foo]]*bar
24012 !!end
24013
24014 !! test
24015 Lists: 5. No unnecessary escapes
24016 !! options
24017 parsoid=html2wt
24018 !! html/parsoid
24019 <ul><li> bar <span>[[foo]]</span></li></ul>
24020 <ul><li> =bar <span>[[foo]]</span></li></ul>
24021 <ul><li> [[bar <span>[[foo]]</span></li></ul>
24022 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
24023 <ul><li> =bar <span>foo]]</span>=</li></ul>
24024 <ul><li> <s></s>: a</li></ul>
24025 <ul><li> <i>* foo</i></li></ul>
24026
24027 !! wikitext
24028 * bar <span><nowiki>[[foo]]</nowiki></span>
24029
24030 * =bar <span><nowiki>[[foo]]</nowiki></span>
24031
24032 * [[bar <span><nowiki>[[foo]]</nowiki></span>
24033
24034 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
24035
24036 * =bar <span>foo]]</span>=
24037
24038 * <s></s>: a
24039
24040 * ''* foo''
24041 !!end
24042
24043 !! test
24044 Lists: 6. Escape bullets in SOL position
24045 !! options
24046 parsoid=html2wt
24047 !! html/parsoid
24048 <p><!--cmt-->*foo</p>
24049 !! wikitext
24050 <!--cmt--><nowiki>*</nowiki>foo
24051 !!end
24052
24053 !! test
24054 Lists: 7. Escape bullets in a multi-line context
24055 !! options
24056 parsoid=html2wt
24057 !! html/parsoid
24058 <p>a
24059 *b
24060 </p>
24061 !! wikitext
24062 a
24063 <nowiki>*</nowiki>b
24064 !!end
24065
24066 !! test
24067 Lists: 8. Escape colons only if not present in tags
24068 !! options
24069 parsoid=html2wt
24070 !! html/parsoid
24071 <dl><dt>a:b<i>c:d</i></dt></dl>
24072 !! wikitext
24073 ; <nowiki>a:b</nowiki>''c:d''
24074 !! end
24075
24076 #### --------------- HRs ---------------
24077 #### 1. Single line
24078 #### -----------------------------------
24079
24080 !! test
24081 HRs: 1. Single line
24082 !! options
24083 parsoid=html2wt
24084 !! html/parsoid
24085 <hr />----
24086 <hr />=foo=
24087 <hr />*foo
24088 !! wikitext
24089 ----<nowiki>----</nowiki>
24090 ----=foo=
24091 ----*foo
24092 !! end
24093
24094 #### --------------- Tables ---------------
24095 #### 1a. Simple example
24096 #### 1b. No escaping needed (!foo)
24097 #### 1c. No escaping needed (|foo)
24098 #### 1d. No escaping needed (|}foo)
24099 ####
24100 #### 2a. Nested in td (<td>foo|bar</td>)
24101 #### 2b. Nested in td (<td>foo||bar</td>)
24102 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
24103 ####
24104 #### 3a. Nested in th (<th>foo!bar</th>)
24105 #### 3b. Nested in th (<th>foo!!bar</th>)
24106 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
24107 ####
24108 #### 4a. Escape -
24109 #### 4b. Escape +
24110 #### 4c. No escaping needed
24111 #### --------------------------------------
24112
24113 !! test
24114 Tables: 1a. Simple example
24115 !! options
24116 parsoid=html2wt
24117 !! html/parsoid
24118 <p>{|
24119 |}
24120 </p>
24121 !! wikitext
24122 <nowiki>{|</nowiki>
24123 |}
24124 !! end
24125
24126 !! test
24127 Tables: 1b. No escaping needed
24128 !! options
24129 parsoid=html2wt
24130 !! html/parsoid
24131 <p>!foo
24132 </p>
24133 !! wikitext
24134 !foo
24135 !! end
24136
24137 !! test
24138 Tables: 1c. No escaping needed
24139 !! options
24140 parsoid=html2wt
24141 !! html/parsoid
24142 <p>|foo
24143 </p>
24144 !! wikitext
24145 |foo
24146 !! end
24147
24148 !! test
24149 Tables: 1d. No escaping needed
24150 !! options
24151 parsoid=html2wt
24152 !! html/parsoid
24153 <p>|}foo
24154 </p>
24155 !! wikitext
24156 |}foo
24157 !! end
24158
24159 !! test
24160 Tables: 2a. Nested in td
24161 !! options
24162 parsoid=html2wt
24163 !! html/parsoid
24164 <table><tbody><tr>
24165 <td>foo|bar</td></tr>
24166 <tr><td>x<div>a|b</div></td>
24167 </tbody></table>
24168 !! wikitext
24169 {|
24170 |<nowiki>foo|bar</nowiki>
24171 |-
24172 |x<div><nowiki>a|b</nowiki></div>
24173 |}
24174 !! html/php+tidy
24175 <table>
24176 <tr>
24177 <td>foo|bar</td>
24178 </tr>
24179 <tr>
24180 <td>x
24181 <div>a|b</div>
24182 </td>
24183 </tr>
24184 </table>
24185 !! end
24186
24187 !! test
24188 Tables: 2b. Nested in td
24189 !! options
24190 parsoid=html2wt
24191 !! html/parsoid
24192 <table><tbody><tr>
24193 <td>foo||bar</td>
24194 <td>a<i>b||c</i></td>
24195 <td>a<i><div>b||c</div></i></td>
24196 </tr></tbody></table>
24197 !! wikitext
24198 {|
24199 |<nowiki>foo||bar</nowiki>
24200 |a''<nowiki>b||c</nowiki>''
24201 |a''<div><nowiki>b||c</nowiki></div>''
24202 |}
24203 !! html/php
24204 <table>
24205 <tr>
24206 <td>foo||bar
24207 </td>
24208 <td>a<i>b||c</i>
24209 </td>
24210 <td>a<i><div>b||c</div></i>
24211 </td></tr></table>
24212
24213 !! end
24214
24215 !! test
24216 Tables: 2c. Nested in td -- no escaping needed
24217 !! options
24218 parsoid=html2wt
24219 !! html/*
24220 <table>
24221 <tr>
24222 <td>foo!!bar
24223 </td></tr></table>
24224
24225 !! wikitext
24226 {|
24227 |foo!!bar
24228 |}
24229 !! end
24230
24231 !! test
24232 Tables: 3a. Nested in th
24233 !! options
24234 parsoid=html2wt
24235 !! html/*
24236 <table>
24237 <tr>
24238 <th>foo!bar
24239 </th></tr></table>
24240
24241 !! wikitext
24242 {|
24243 !foo!bar
24244 |}
24245 !! end
24246
24247 !! test
24248 Tables: 3b. Nested in th
24249 !! options
24250 parsoid=html2wt
24251 !! html/parsoid
24252 <table><tbody>
24253 <tr><th>foo!!bar</th>
24254 <th><i>foo|bar</i></th>
24255 <th><i>foo!!bar</i></th>
24256 <th><i><span>foo!!bar</span></i></th>
24257 </tr></tbody></table>
24258 !! wikitext
24259 {|
24260 !<nowiki>foo!!bar</nowiki>
24261 !''<nowiki>foo|bar</nowiki>''
24262 !''<nowiki>foo!!bar</nowiki>''
24263 !''<span><nowiki>foo!!bar</nowiki></span>''
24264 |}
24265 !! html/php
24266 <table>
24267 <tr>
24268 <th>foo!!bar
24269 </th>
24270 <th><i>foo|bar</i>
24271 </th>
24272 <th><i>foo!!bar</i>
24273 </th>
24274 <th><i><span>foo!!bar</span></i>
24275 </th></tr></table>
24276
24277 !! end
24278
24279 !! test
24280 Tables: 3c. Nested in th
24281 !! options
24282 parsoid=html2wt
24283 !! html/parsoid
24284 <table><tbody>
24285 <tr><th>foo||bar</th>
24286 <th><span typeof="mw:Nowiki">foo||bar</span></th>
24287 </tr></tbody></table>
24288 !! wikitext
24289 {|
24290 !<nowiki>foo||bar</nowiki>
24291 !<nowiki>foo||bar</nowiki>
24292 |}
24293 !! html/php
24294 <table>
24295 <tr>
24296 <th>foo||bar
24297 </th>
24298 <th>foo||bar
24299 </th></tr></table>
24300
24301 !! end
24302
24303 !! test
24304 Tables: 4a. Escape -
24305 !! options
24306 parsoid=html2wt
24307 !! html/*
24308 <table>
24309 <tr>
24310 <th>-bar
24311 </th></tr>
24312 <tr>
24313 <td>-bar
24314 </td></tr></table>
24315
24316 !! wikitext
24317 {|
24318 !-bar
24319 |-
24320 |<nowiki>-bar</nowiki>
24321 |}
24322 !! end
24323
24324 !! test
24325 Tables: 4b. Escape +
24326 !! options
24327 parsoid=html2wt
24328 !! html/*
24329 <table>
24330 <tr>
24331 <th>+bar
24332 </th></tr>
24333 <tr>
24334 <td>+bar
24335 </td></tr></table>
24336
24337 !! wikitext
24338 {|
24339 !+bar
24340 |-
24341 |<nowiki>+bar</nowiki>
24342 |}
24343 !! end
24344
24345 !! test
24346 Tables: 4c. No escaping needed
24347 !! options
24348 parsoid=html2wt
24349 !! html/parsoid
24350 <table><tbody>
24351 <tr><td>foo-bar</td><td>foo+bar</td></tr>
24352 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
24353 <tr><td>foo
24354 <p>bar|baz
24355 +bar
24356 -bar</p></td></tr>
24357 <tr><td>x
24358 <div>a|b</div></td>
24359 </tbody></table>
24360 !! wikitext
24361 {|
24362 |foo-bar
24363 |foo+bar
24364 |-
24365 |''foo''-bar
24366 |''foo''+bar
24367 |-
24368 |foo
24369 bar|baz
24370 +bar
24371 -bar
24372 |-
24373 |x
24374 <div>a|b</div>
24375 |}
24376 !! html/php
24377 <table>
24378 <tr>
24379 <td>foo-bar
24380 </td>
24381 <td>foo+bar
24382 </td></tr>
24383 <tr>
24384 <td><i>foo</i>-bar
24385 </td>
24386 <td><i>foo</i>+bar
24387 </td></tr>
24388 <tr>
24389 <td>foo
24390 <p>bar|baz
24391 +bar
24392 -bar
24393 </p>
24394 </td></tr>
24395 <tr>
24396 <td>x
24397 <div>a|b</div>
24398 </td></tr></table>
24399
24400 !! end
24401
24402 !! test
24403 Tables: 4d. No escaping needed
24404 !! options
24405 parsoid=html2wt
24406 !! html/parsoid
24407 <table>
24408 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
24409 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
24410 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
24411 </tbody></table>
24412 !! wikitext
24413 {|
24414 |[[Foo]]-bar
24415 ||+1
24416 ||-2
24417 |}
24418 !! html/php
24419 <table>
24420 <tr>
24421 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
24422 </td>
24423 <td>+1
24424 </td>
24425 <td>-2
24426 </td></tr></table>
24427
24428 !! end
24429
24430 !! test
24431 T97430: Don't emit empty nowiki pairs around marker meta tags
24432 !! options
24433 parsoid=html2wt
24434 !! html/parsoid
24435 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24436 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
24437 !! wikitext
24438 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24439 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
24440 !! end
24441
24442 !! test
24443 Unclosed xmlish element in table line shouldn't eat end delimiters
24444 !! options
24445 parsoid=html2wt
24446 !! html/parsoid
24447 <table>
24448 <tbody><tr><td> &lt;foo</td>
24449 <td> bar></td></tr>
24450 </tbody></table>
24451 !! wikitext
24452 {|
24453 | <foo
24454 | bar>
24455 |}
24456 !! html/php
24457 <table>
24458 <tr>
24459 <td> &lt;foo
24460 </td>
24461 <td> bar&gt;
24462 </td></tr></table>
24463
24464 !! end
24465
24466 #### --------------- Links ----------------
24467 #### 1. Quote marks in link text
24468 #### 2. Wikilinks: Escapes needed
24469 #### 3. Wikilinks: No escapes needed
24470 #### 4. Extlinks: Escapes needed
24471 #### 5. Extlinks: No escapes needed
24472 #### --------------------------------------
24473 !! test
24474 Links 1. WikiLinks: No escapes needed
24475 !! options
24476 parsoid=html2wt
24477 !! html/parsoid
24478 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
24479 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
24480 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
24481 !! wikitext
24482 [[Foo|Foo''boo'']]
24483 [[Foo|[Foobar]]]
24484 [[Foo|x [Foobar] x]]
24485 !! html/php
24486 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
24487 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
24488 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
24489 </p>
24490 !! end
24491
24492 !! test
24493 Links 2. WikiLinks: Escapes needed
24494 !! options
24495 parsoid=html2wt
24496 !! html/parsoid
24497 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
24498 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
24499 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
24500 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
24501 <a href="Foo" rel="mw:WikiLink">|Bar</a>
24502 <a href="Foo" rel="mw:WikiLink">]]bar</a>
24503 <a href="Foo" rel="mw:WikiLink">[[bar</a>
24504 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
24505 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
24506 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
24507 !! wikitext
24508 [[Foo|<nowiki>Foobar]</nowiki>]]
24509 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
24510 [[Foo|<nowiki>[[Bar]]</nowiki>]]
24511 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
24512 [[Foo|<nowiki>|Bar</nowiki>]]
24513 [[Foo|<nowiki>]]bar</nowiki>]]
24514 [[Foo|<nowiki>[[bar</nowiki>]]
24515 [[Foo|<nowiki>x [[ y</nowiki>]]
24516 [[Foo|<nowiki>x ]] y</nowiki>]]
24517 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
24518 !! html/php
24519 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
24520 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
24521 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
24522 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
24523 <a href="/wiki/Foo" title="Foo">|Bar</a>
24524 <a href="/wiki/Foo" title="Foo">]]bar</a>
24525 <a href="/wiki/Foo" title="Foo">[[bar</a>
24526 <a href="/wiki/Foo" title="Foo">x [[ y</a>
24527 <a href="/wiki/Foo" title="Foo">x ]] y</a>
24528 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
24529 </p>
24530 !! end
24531
24532 !! test
24533 Links 3. WikiLinks: No escapes needed
24534 !! options
24535 parsoid=html2wt
24536 !! html/parsoid
24537 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
24538 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
24539 !! wikitext
24540 [[Foo|[Foobar]]
24541 [[Foo|foo|bar]]
24542 !! html/php
24543 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
24544 <a href="/wiki/Foo" title="Foo">foo|bar</a>
24545 </p>
24546 !! end
24547
24548 !! test
24549 Links 4. ExtLinks: Escapes needed
24550 !! options
24551 parsoid=html2wt
24552 !! html/parsoid
24553 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
24554 <a rel="mw:ExtLink" href="http://google.com">google]</a>
24555 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
24556 <p>[http://google.com]</p>
24557 <p>[http://google.com google]</p>
24558 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
24559 <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>
24560 !! wikitext
24561 [http://google.com <nowiki>[google]</nowiki>]
24562 [http://google.com <nowiki>google]</nowiki>]
24563 [http://google.com <nowiki>goog] le</nowiki>]
24564
24565 <nowiki>[http://google.com]</nowiki>
24566
24567 <nowiki>[http://google.com google]</nowiki>
24568
24569 [http://google.com<nowiki>]</nowiki>
24570
24571 [{{echo|http://google.com}}<nowiki>]</nowiki>
24572 !! html/php
24573 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
24574 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
24575 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
24576 </p><p>[http://google.com]
24577 </p><p>[http://google.com google]
24578 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24579 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24580 </p>
24581 !! end
24582
24583 !! test
24584 Links 5. ExtLinks: No escapes needed
24585 !! options
24586 parsoid=html2wt
24587 !! html/parsoid
24588 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
24589 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
24590 !! wikitext
24591 [http://google.com [google]
24592
24593 [[http://google.com]]
24594 !! html/php
24595 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
24596 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
24597 </p>
24598 !! end
24599
24600 !! test
24601 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
24602 !! options
24603 parsoid=html2wt
24604 !! html/parsoid
24605 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
24606 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
24607 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
24608 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
24609 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
24610 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
24611 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24612 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
24613 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24614 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
24615 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
24616 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
24617 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
24618 </p>
24619 !! wikitext
24620 x<nowiki/>http://example.com<nowiki/>y
24621 http://example.com<nowiki/>?x
24622 http://example.com<nowiki/>&x
24623 http://example.com<nowiki/>'x
24624 http://example.com<nowiki/>,x
24625 http://example.com<nowiki/>.x
24626 http://example.com<nowiki/>;x
24627 http://example.com<nowiki/>:x
24628 http://example.com<nowiki/>;x
24629 http://example.com<nowiki/>!x
24630 http://example.com<nowiki/>=x
24631 http://example.com<nowiki/>(x)
24632 http://example.com(x<nowiki/>)
24633 !! end
24634
24635 !! test
24636 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
24637 !! options
24638 parsoid=html2wt
24639 !! html/parsoid
24640 <p>x
24641 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
24642 y
24643 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
24644 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
24645 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
24646 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
24647 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
24648 </p>
24649 !! wikitext
24650 x
24651 http://example.com
24652 y
24653 "http://example.com"
24654 (http://example.com)
24655 (http://example.com) foo
24656 http://example.com,
24657 http://example.com, foo
24658 !! html/php
24659 <p>x
24660 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
24661 y
24662 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
24663 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
24664 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
24665 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
24666 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
24667 </p>
24668 !! end
24669
24670 !! test
24671 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
24672 !! options
24673 parsoid=html2wt
24674 !! html/parsoid
24675 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
24676 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
24677 !! wikitext
24678 http://example.com.,;:!?\
24679 -http://example.com:
24680 !! html/php
24681 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
24682 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
24683 </p>
24684 !! end
24685
24686 !! test
24687 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
24688 !! options
24689 parsoid=html2wt
24690 !! html/parsoid
24691 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
24692 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
24693 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
24694 !! wikitext
24695 RFC 123<nowiki/>4
24696 RFC 123<nowiki/>y
24697 X<nowiki/>RFC 123<nowiki/>y
24698 !! end
24699
24700 !! test
24701 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
24702 !! options
24703 parsoid=html2wt
24704 !! html/parsoid
24705 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24706 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24707 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24708 </p>
24709 !! wikitext
24710 RFC 123?foo
24711 RFC 123&foo
24712 -RFC 123-
24713 !! html/php
24714 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24715 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24716 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24717 </p>
24718 !! end
24719
24720 !! test
24721 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
24722 !! options
24723 parsoid=html2wt
24724 !! html/parsoid
24725 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24726 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24727 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24728 !! wikitext
24729 PMID 123<nowiki/>4
24730 PMID 123<nowiki/>y
24731 X<nowiki/>PMID 123<nowiki/>y
24732 !! end
24733
24734 !! test
24735 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
24736 !! options
24737 parsoid=html2wt
24738 !! html/parsoid
24739 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24740 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24741 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24742 </p>
24743 !! wikitext
24744 PMID 123?foo
24745 PMID 123&foo
24746 -PMID 123-
24747 !! html/php
24748 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24749 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24750 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24751 </p>
24752 !! end
24753
24754 !! test
24755 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
24756 !! options
24757 parsoid=html2wt
24758 !! html/parsoid
24759 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24760 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24761 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24762 </p>
24763 !! wikitext
24764 ISBN 1234567890<nowiki/>1
24765 ISBN 1234567890<nowiki/>x
24766 a<nowiki/>ISBN 1234567890<nowiki/>b
24767 !! end
24768
24769 !! test
24770 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
24771 !! options
24772 parsoid=html2wt
24773 !! html/parsoid
24774 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24775 !! wikitext
24776 -ISBN 1234567890's
24777 !! html/php
24778 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24779 </p>
24780 !! end
24781
24782 !! test
24783 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24784 !! options
24785 parsoid=html2wt
24786 !! html/*
24787 <p>this is not a link: http://example.com
24788 </p>
24789 !! wikitext
24790 this is not a link: <nowiki>http://example.com</nowiki>
24791 !! end
24792
24793 !! test
24794 Links 15. Link trails can't become link prefixes.
24795 !! options
24796 language=is
24797 parsoid=html2wt
24798 !! html/parsoid
24799 <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>
24800 !! wikitext
24801 [[Söfnuður]]-[[00]]
24802 !! html/php
24803 <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>
24804 </p>
24805 !! end
24806
24807 #### --------------- Quotes ---------------
24808 #### 1. Quotes inside <b> and <i>
24809 #### 2. Link fragments separated by <i> and <b> tags
24810 #### 3. Link fragments inside <i> and <b>
24811 #### 4. No escaping needed
24812 #### --------------------------------------
24813 !! test
24814 1a. Quotes inside <b> and <i>
24815 !! options
24816 parsoid=html2wt
24817 !! html/*
24818 <p><i>'foo'</i>
24819 <i>''foo''</i>
24820 <i>'''foo'''</i>
24821 <i>foo</i>'s
24822 <b>'foo'</b>
24823 <b>''foo''</b>
24824 <b>'''foo'''</b>
24825 <b>foo'<i>bar'</i>baz</b>
24826 <b>foo</b>'s
24827 '<i>foo</i>
24828 <i>foo</i>'
24829 <i>foo'</i>'
24830 '<i>foo</i>'
24831 '<b>foo</b>
24832 <b>foo</b>'
24833 '<b>foo</b>'
24834 <i>fools'<span> errand</span></i>
24835 <i><span>fool</span>'s errand</i>
24836 '<i>foo</i> bar '<i>baz</i>
24837 a|!*#-:;+-~[]{}b'<i>x</i>
24838 </p>
24839 !! wikitext
24840 ''<nowiki/>'foo'''
24841 ''<nowiki>''foo''</nowiki>''
24842 ''<nowiki>'''foo'''</nowiki>''
24843 ''foo''<nowiki/>'s
24844 '''<nowiki/>'foo''''
24845 '''<nowiki>''foo''</nowiki>'''
24846 '''<nowiki>'''foo'''</nowiki>'''
24847 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24848 '''foo'''<nowiki/>'s
24849 '''foo''
24850 ''foo''<nowiki/>'
24851 ''foo'''<nowiki/>'
24852 '''foo''<nowiki/>'
24853 ''''foo'''
24854 '''foo'''<nowiki/>'
24855 ''''foo'''<nowiki/>'
24856 ''fools'<span> errand</span>''
24857 ''<span>fool</span>'s errand''
24858 '<nowiki/>''foo'' bar '''baz''
24859 a|!*#-:;+-~[]{}b'''x''
24860 !! end
24861
24862 !! test
24863 1b. Quotes inside <b> and <i> with other tags on same line
24864 !! options
24865 parsoid=html2wt
24866 !! html/parsoid
24867 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24868 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24869 <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>
24870 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24871 '<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>
24872 '<i>foo</i> <div title="name">test</div>
24873 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24874 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24875 <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>
24876 </ol>
24877 !! wikitext
24878 '''a'' foo ''[[bar]]''
24879 ''a''' foo ''[[bar]]''
24880 ''a''' foo '''{{echo|[[bar]]}}'''
24881 [[foo]] x'''[[bar]]''
24882 '''foo'' <ref>test</ref>
24883 '''foo'' <div title="name">test</div>
24884 '''foo'' and <br> bar
24885 <references />
24886 !! end
24887
24888 !! test
24889 2. Link fragments separated by <i> and <b> tags
24890 !! options
24891 parsoid=html2wt
24892 !! html/parsoid
24893 <p>[[<i>foo</i>hello]]</p>
24894 <p>[[<b>foo</b>hello]]</p>
24895 !! wikitext
24896 [[''foo''<nowiki>hello]]</nowiki>
24897
24898 [['''foo'''<nowiki>hello]]</nowiki>
24899 !! end
24900
24901 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24902 # this is one of the shortcomings of this format
24903 !! test
24904 3. Link fragments inside <i> and <b>
24905 !! options
24906 parsoid=html2wt
24907 !! html/parsoid
24908 <p><i>[[foo</i>]]</p>
24909 <p><b>[[foo</b>]]</p>
24910 !! wikitext
24911 ''[[foo''<nowiki>]]</nowiki>
24912
24913 '''[[foo'''<nowiki>]]</nowiki>
24914 !! end
24915
24916 !! test
24917 4. No escaping needed
24918 !! options
24919 parsoid=html2wt
24920 !! html/parsoid
24921 <p>'<span><i>bar</i></span>'
24922 '<span><b>bar</b></span>'
24923 'a:b'foo
24924 </p>
24925 !! wikitext
24926 '<span>''bar''</span>'
24927 '<span>'''bar'''</span>'
24928 'a:b'foo
24929 !! end
24930
24931 #### ----------- Paragraphs ---------------
24932 #### 1. No unnecessary escapes
24933 #### --------------------------------------
24934
24935 !! test
24936 1. No unnecessary escapes
24937 !! options
24938 parsoid=html2wt
24939 !! html/parsoid
24940 <p>bar <span>[[foo]]</span>
24941 </p><p>=bar <span>[[foo]]</span>
24942 </p><p>[[bar <span>[[foo]]</span>
24943 </p><p>]]bar <span>[[foo]]</span>
24944 </p><p>=bar <span>foo]]</span>=
24945 </p>
24946 !! wikitext
24947 bar <span><nowiki>[[foo]]</nowiki></span>
24948
24949 =bar <span><nowiki>[[foo]]</nowiki></span>
24950
24951 [[bar <span><nowiki>[[foo]]</nowiki></span>
24952
24953 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24954
24955 =bar <span>foo]]</span><nowiki>=</nowiki>
24956 !!end
24957
24958 #### ----------------------- PRE --------------------------
24959 #### 1. Leading whitespace in SOL context should be escaped
24960 #### ------------------------------------------------------
24961 !! test
24962 1. Leading whitespace in SOL context should be escaped
24963 !! options
24964 parsoid=html2wt
24965 !! html/parsoid
24966 <p> a</p>
24967
24968 <p> a</p>
24969
24970 <p> a(tab)</p>
24971
24972 <p> a
24973 <!--cmt-->
24974 a</p>
24975
24976 <p>a
24977 b</p>
24978
24979 <p>a
24980 b</p>
24981
24982 <p>a
24983 b</p>
24984 !! wikitext
24985 <nowiki> </nowiki>a
24986
24987 <nowiki> </nowiki> a
24988
24989 a(tab)
24990
24991 <nowiki> </nowiki> a
24992 <!--cmt-->
24993 <nowiki> </nowiki>a
24994
24995 a
24996 <nowiki> </nowiki>b
24997
24998 a
24999 b
25000
25001 a
25002 b
25003 !! html/php
25004 <p> a
25005 </p><p> a
25006 </p><p> a(tab)
25007 </p><p> a
25008 a
25009 </p><p>a
25010 b
25011 </p><p>a
25012 b
25013 </p><p>a
25014 b
25015 </p>
25016 !! end
25017
25018 !! test
25019 2. Leading whitespace in non-indent-pre contexts should not be escaped
25020 !! options
25021 parsoid=html2wt
25022 !! html/parsoid
25023 <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>
25024 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
25025 <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>
25026 b</span></li>
25027 </ol>
25028 !! wikitext
25029 foo <ref>''a''
25030 b</ref>
25031 <references />
25032 !! end
25033
25034 !! test
25035 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
25036 !! options
25037 parsoid=html2wt
25038 !! html/parsoid
25039 <blockquote>
25040 <p>
25041 a
25042 <span>b</span>
25043 c</p>
25044 </blockquote>
25045 !! wikitext
25046 <blockquote>
25047 a
25048 <span>b</span>
25049 c
25050 </blockquote>
25051 !! end
25052
25053 !! test
25054 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
25055 !! options
25056 parsoid=html2wt
25057 !! html/parsoid
25058 <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>
25059 !! wikitext
25060 [[File:Foobar.jpg|thumb|caption]]
25061 !! end
25062
25063 !! test
25064 5. Nowiki escaping should account for indent-pres
25065 !! options
25066 parsoid=html2wt
25067 !! html/parsoid
25068 <pre>==foo==</pre>
25069 !! wikitext
25070 ==foo==
25071 !! end
25072
25073 !!test
25074 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
25075 !! options
25076 parsoid=html2wt
25077 !! html/parsoid
25078 <pre>
25079 * foo
25080 * bar
25081 </pre>
25082 !! wikitext
25083 * foo
25084 * bar
25085 !! end
25086
25087 #### --------------- Behavior Switches --------------------
25088
25089 !! test
25090 1. Valid behavior switches should be escaped
25091 !! options
25092 parsoid=html2wt
25093 !! html/parsoid
25094 __TOC__
25095 <i>__TOC__</i>
25096 !! wikitext
25097 <nowiki>__TOC__</nowiki>
25098 ''<nowiki>__TOC__</nowiki>''
25099 !! end
25100
25101 !! test
25102 2. Invalid behavior switches should not be escaped
25103 !! options
25104 parsoid=html2wt
25105 !! html/parsoid
25106 __TOO__
25107 __|__
25108 !! wikitext
25109 __TOO__
25110 __|__
25111 !! end
25112
25113 # We use indent-pre as an indirect way to test for sol-transparent behavior.
25114 !! test
25115 Behavior switches should be SOL-transparent
25116 !! options
25117 parsoid=html2wt
25118 !! html/parsoid
25119 <meta property="mw:PageProp/toc" />
25120
25121 <!-- this one's bogus -->
25122 <pre>__TOO__</pre>
25123
25124 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
25125
25126 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
25127 !! wikitext
25128 __TOC__
25129
25130 <!-- this one's bogus -->
25131 __TOO__
25132
25133 __TOC__ foo
25134
25135 __TOC__
25136 bar
25137 !! end
25138
25139 #### --------------- HTML tags ---------------
25140 #### 1. a tags
25141 #### 2. other tags
25142 #### 3. multi-line html tag
25143 #### 4. extension tags
25144 #### -----------------------------------------
25145 !! test
25146 1. a tags
25147 !! options
25148 parsoid=html2wt
25149 !! html/parsoid
25150 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
25151 !! wikitext
25152 <a href="http://google.com">google</a>
25153 !! end
25154
25155 !! test
25156 2. other tags
25157 !! options
25158 parsoid=html2wt
25159 !! html/parsoid
25160 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
25161 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
25162 <li> &lt;td&gt;</li></ul>
25163
25164 !! wikitext
25165 * <nowiki><div>foo</div></nowiki>
25166 * <nowiki><div style="color:red">foo</div></nowiki>
25167 * <nowiki><td></nowiki>
25168 !! end
25169
25170 !! test
25171 3. multi-line html tag
25172 !! options
25173 parsoid=html2wt
25174 !! html/parsoid
25175 <p>&lt;div
25176 &gt;foo&lt;/div
25177 &gt;
25178 </p>
25179 !! wikitext
25180 <nowiki><div
25181 >foo</div
25182 ></nowiki>
25183 !! end
25184
25185 !! test
25186 4. extension tags
25187 !! options
25188 parsoid=html2wt
25189 !! html/parsoid
25190 <p>&lt;ref&gt;foo&lt;/ref&gt;
25191 </p><p>&lt;ref&gt;bar
25192 </p><p>baz&lt;/ref&gt;
25193 </p>
25194 !! wikitext
25195 <nowiki><ref>foo</ref></nowiki>
25196
25197 <nowiki><ref>bar</nowiki>
25198
25199 baz<nowiki></ref></nowiki>
25200 !! end
25201
25202 #### --------------- Others ---------------
25203 !! test
25204 Escaping nowikis
25205 !! options
25206 parsoid=html2wt
25207 !! html/parsoid
25208 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
25209 </p>
25210 !! wikitext
25211 &lt;nowiki&gt;foo&lt;/nowiki&gt;
25212 !! end
25213
25214 ## The quote-char in the input is necessary for triggering the bug
25215 !! test
25216 (T54035) Nowiki-escaping should not get tripped by " :" in text
25217 !! options
25218 parsoid=html2wt
25219 !! html/parsoid
25220 <p>foo's bar :</p>
25221 !! wikitext
25222 foo's bar :
25223 !! end
25224
25225 #----------- End of wikitext escaping tests --------------
25226
25227 !! test
25228
25229 Tag-like HTML structures are passed through as text
25230 !! wikitext
25231 <x y>
25232
25233 <x.y>
25234
25235 <x-y>
25236
25237 1>2
25238
25239 x<y
25240
25241 a>b
25242
25243 1<d e>f
25244 !! html
25245 <p>&lt;x y&gt;
25246 </p><p>&lt;x.y&gt;
25247 </p><p>&lt;x-y&gt;
25248 </p><p>1&gt;2
25249 </p><p>x&lt;y
25250 </p><p>a&gt;b
25251 </p><p>1&lt;d e&gt;f
25252 </p>
25253 !! end
25254
25255 !! test
25256 HTML tag with necessary entities in attributes
25257 !! wikitext
25258 <span title="&amp;amp;">foo</span>
25259 !! html
25260 <p><span title="&amp;amp;">foo</span>
25261 </p>
25262 !! end
25263
25264 !! test
25265 HTML tag with 'unnecessary' entity encoding in attributes
25266 !! wikitext
25267 <span title="&amp;">foo</span>
25268 !! html
25269 <p><span title="&amp;">foo</span>
25270 </p>
25271 !! end
25272
25273 !! test
25274 HTML tag with broken attribute value quoting
25275 !! options
25276 parsoid=wt2html,html2html
25277 !! wikitext
25278 <span title="Hello world>Foo</span>
25279 !! html/php
25280 <p><span title="Hello world">Foo</span>
25281 </p>
25282 !! html/parsoid
25283 <p><span title="Hello world">Foo</span></p>
25284 !! end
25285
25286 !! test
25287 Self-closed tag with broken attribute value quoting
25288 !! options
25289 parsoid=wt2html,html2html
25290 !! wikitext
25291 <div title="Hello world />Foo
25292 !! html/php+tidy
25293 <div title="Hello world"></div>
25294 <p>Foo</p>
25295 !! html/parsoid
25296 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
25297 !! end
25298
25299 !! test
25300 Table with broken attribute value quoting
25301 !! options
25302 parsoid=wt2html,html2html
25303 !! wikitext
25304 {|
25305 | title="Hello world|Foo
25306 |}
25307 !! html/php
25308 <table>
25309 <tr>
25310 <td title="Hello world">Foo
25311 </td></tr></table>
25312
25313 !! html/parsoid
25314 <table>
25315 <tr>
25316 <td title="Hello world">Foo
25317 </td></tr></table>
25318
25319 !! end
25320
25321 !! test
25322 Table with broken attribute value quoting on consecutive lines
25323 !! options
25324 parsoid=wt2html,html2html
25325 !! wikitext
25326 {|
25327 | title="Hello world|Foo
25328 | style="color:red|Bar
25329 |}
25330 !! html/php
25331 <table>
25332 <tr>
25333 <td title="Hello world">Foo
25334 </td>
25335 <td style="color:red">Bar
25336 </td></tr></table>
25337
25338 !! html/parsoid
25339 <table><tbody>
25340 <tr>
25341 <td title="Hello world">Foo
25342 </td><td style="color: red">Bar
25343 </td></tr></tbody></table>
25344
25345 !! end
25346
25347 !!test
25348 Accept empty td cell attribute
25349 !! wikitext
25350 {|
25351 | align="center" | foo || |
25352 |}
25353 !! html
25354 <table>
25355 <tr>
25356 <td align="center"> foo </td>
25357 <td>
25358 </td></tr></table>
25359
25360 !!end
25361
25362 !!test
25363 Non-empty attributes in th-cells
25364 !! wikitext
25365 {|
25366 ! Foo !! style="color: red" | Bar
25367 |}
25368 !! html
25369 <table>
25370 <tr>
25371 <th> Foo </th>
25372 <th style="color: red"> Bar
25373 </th></tr></table>
25374
25375 !!end
25376
25377 !!test
25378 Accept empty attributes in th-cells
25379 !! wikitext
25380 {|
25381 !| foo !!| bar
25382 |}
25383 !! html
25384 <table>
25385 <tr>
25386 <th> foo </th>
25387 <th> bar
25388 </th></tr></table>
25389
25390 !!end
25391
25392 !!test
25393 Empty table rows go away
25394 !! wikitext
25395 {|
25396 | Hello
25397 | there
25398 |- class="foo"
25399 |-
25400 |}
25401 !! html
25402 <table>
25403 <tr>
25404 <td> Hello
25405 </td>
25406 <td> there
25407 </td></tr>
25408
25409 </table>
25410
25411 !! end
25412
25413 ###
25414 ### Parsoid-centric tests for testing RTing of inter-element separators
25415 ### Edge cases not tested by existing parser tests and specific to
25416 ### Parsoid-specific serialization strategies.
25417 ###
25418
25419 !!test
25420 RT-ed inter-element separators should be valid separators
25421 !! wikitext
25422 {|
25423 |- [[foo]]
25424 |}
25425 !! html/php
25426 <table>
25427
25428 </table>
25429
25430 !! html/parsoid
25431 <table>
25432 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
25433 </tbody></table>
25434 !!end
25435
25436 # Parsoid-only since PHP parser relies on Tidy for correct output
25437 !!test
25438 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
25439 !!options
25440 parsoid
25441 !! wikitext
25442 {|
25443 |<small>foo
25444 bar
25445 |}
25446
25447 {|
25448 |<small>foo<small>
25449 |}
25450 !! html
25451 <table>
25452 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
25453 <p>bar</p></small></td></tr>
25454 </tbody></table>
25455
25456 <table>
25457 <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>
25458 </tbody></table>
25459 !!end
25460
25461 # Note that the "style" attribute is really a template parameter here.
25462 # The = would have to be {{=}} if you wanted the literal.
25463 !!test
25464 Empty TD followed by TD with tpl-generated attribute
25465 !! wikitext
25466 {|
25467 |-
25468 |
25469 |{{echo|style='color:red'}}|foo
25470 |}
25471 !! html
25472 <table>
25473
25474 <tr>
25475 <td>
25476 </td>
25477 <td>foo
25478 </td></tr></table>
25479
25480 !!end
25481
25482 !!test
25483 Indented table with an empty td
25484 !! wikitext
25485 {|
25486 |-
25487 |
25488 |foo
25489 |}
25490 !! html
25491 <table>
25492
25493 <tr>
25494 <td>
25495 </td>
25496 <td>foo
25497 </td></tr></table>
25498
25499 !!end
25500
25501 ## We have some newline diffs RT-ing this edge case
25502 ## and it is not important enough -- we seem to be emitting
25503 ## at most 2 newlines after a </tr> and this is unrelated to
25504 ## the issue from T85627 that this is testing.
25505 !!test
25506 Indented table with blank lines in between (T85627)
25507 !! options
25508 parsoid=wt2html
25509 !! wikitext
25510 {|
25511 |foo
25512
25513
25514 |}
25515 !! html
25516 <table>
25517
25518 <tr>
25519 <td>foo
25520 </td></tr></table>
25521
25522 !!end
25523
25524 !!test
25525 Indented block & table
25526 !! wikitext
25527 <div>foo</div>
25528 {|
25529 |foo
25530 |}
25531 !! html/php
25532 <div>foo</div>
25533 <table>
25534 <tr>
25535 <td>foo
25536 </td></tr></table>
25537
25538 !! html/parsoid
25539 <div data-parsoid='{"stx":"html"}'>foo</div>
25540 <table><tbody>
25541 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
25542 </tbody></table>
25543 !!end
25544
25545 !! test
25546 Indent and comment before table row
25547 !! wikitext
25548 {|
25549 <!--hi-->|-
25550 | there
25551 |}
25552 !! html/php
25553 <table>
25554
25555 <tr>
25556 <td> there
25557 </td></tr></table>
25558
25559 !! html/parsoid
25560 <table>
25561 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
25562 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
25563 </tbody></table>
25564 !! end
25565
25566 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
25567 !!test
25568 Empty TR followed by a template-generated TR
25569 !!options
25570 parsoid
25571 !! wikitext
25572 {|
25573 |-
25574 {{echo|<tr><td>foo</td></tr>}}
25575 |}
25576 !! html
25577 <table>
25578 <tbody>
25579 <tr></tr>
25580 <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}}]}'>
25581 <td>foo</td></tr>
25582 </tbody></table>
25583 !!end
25584
25585 ## PHP and parsoid output differ for this, and since this is primarily
25586 ## for testing Parsoid's serializer, marking this Parsoid only
25587 !!test
25588 Empty TR followed by mixed-ws-comment line should RT correctly
25589 !!options
25590 parsoid
25591 !! wikitext
25592 {|
25593 |-
25594 <!--c-->
25595 |-
25596 <!--c--> <!--d-->
25597 |}
25598 !! html
25599 <table>
25600 <tbody>
25601 <tr></tr>
25602 <!--c-->
25603 <tr>
25604 <!--c--> </tr><!--d-->
25605 </tbody></table>
25606
25607 !!end
25608
25609 !!test
25610 Multi-line image caption generated by templates with/without trailing newlines
25611 !! wikitext
25612 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
25613 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
25614 !! html/parsoid
25615 <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>
25616 <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>
25617 !!end
25618
25619 !! test
25620 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
25621 !! options
25622 parsoid=html2wt
25623 !! html/parsoid
25624 <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>
25625
25626 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
25627 !! wikitext
25628 <includeonly>foo</includeonly>
25629 new para
25630
25631 [[Category:Foo]]
25632
25633 = new heading =
25634 !! end
25635
25636 ## PHP emits broken html for this, and since this is primarily
25637 ## a Parsoid serializer test, marking this Parsoid only
25638 !!test
25639 Improperly nested inline or quotes tags with whitespace in between
25640 !! wikitext
25641 <span> <s>x</span> </s>
25642 ''' ''x''' ''
25643 !! html/parsoid
25644 <p><span> <s>x</s></span><s> </s>
25645 <b> <i>x</i></b><i> </i>
25646 </p>
25647 !!end
25648
25649 !!test
25650 Encapsulate protected attributes from wt
25651 !! wikitext
25652 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
25653
25654 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
25655 | ok
25656 |}
25657 !! html/parsoid
25658 <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>
25659
25660 <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">
25661 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
25662 </tbody></table>
25663 !!end
25664
25665 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
25666 ## Having nested or stray pre tags results in the attempt to add duplicates,
25667 ## causing an assertion fail. This test tries to prevent that situation.
25668 !!test
25669 Ensure ParagraphWrapper can deal with stray closing pre tags
25670 !!options
25671 parsoid=wt2html
25672 !! wikitext
25673 plain text</pre>
25674 !! html/parsoid
25675 plain text
25676 !!end
25677
25678 !!test
25679 1. Ensure fostered text content is wrapped in element nodes
25680 !!options
25681 parsoid=wt2html
25682 !! wikitext
25683 <table>hi</table><table>ho</table>
25684 !! html/parsoid
25685 <p>hi</p>
25686 <table></table>
25687 <p>ho</p>
25688 <table></table>
25689 !!end
25690
25691 !!test
25692 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
25693 !!options
25694 parsoid=wt2html,wt2wt
25695 !! wikitext
25696 <table>
25697 <tr> || ||
25698 <td> a
25699 </table>
25700 !! html/parsoid
25701 <p> || ||
25702 </p><table>
25703 <tbody><tr><td> a</td></tr>
25704 </tbody></table>
25705 !!end
25706
25707 !!test
25708 Encapsulation properly handles null DSR information from foster box
25709 !!options
25710 parsoid=wt2html,wt2wt
25711 !! wikitext
25712 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25713 !! html/parsoid
25714 <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>
25715 !!end
25716
25717 !!test
25718 1. Encapsulate foster-parented transclusion content
25719 !!options
25720 parsoid=wt2wt,wt2html
25721 !! wikitext
25722 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25723 !! html/parsoid
25724 <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>
25725 <tbody>
25726 <tr>
25727 <td>bar</td>
25728 </tr>
25729 </tbody>
25730 </table>
25731 !!end
25732
25733 !!test
25734 2. Encapsulate foster-parented transclusion content
25735 !!options
25736 parsoid=wt2wt,wt2html
25737 !! wikitext
25738 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25739 !! html/parsoid
25740 <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>
25741 <table>
25742 <tbody>
25743 <tr>
25744 <td>bar</td>
25745 </tr>
25746 </tbody>
25747 </table>
25748 !!end
25749
25750 !!test
25751 3. Encapsulate foster-parented transclusion content
25752 !!options
25753 parsoid=wt2wt,wt2html
25754 !! wikitext
25755 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25756 !! html/parsoid
25757 <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;]}">
25758 <p>foo</p>
25759 </div>
25760 <table>
25761 <tbody>
25762 <tr>
25763 <td>bar</td>
25764 </tr>
25765 </tbody>
25766 </table>
25767 !!end
25768
25769 !!test
25770 4. Encapsulate foster-parented transclusion content
25771 !!options
25772 parsoid=wt2wt,wt2html
25773 !! wikitext
25774 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25775 !! html/parsoid
25776 <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;]}">
25777 <p>foo</p>
25778 </div>
25779 <table>
25780 <tbody>
25781 <tr>
25782 <td>bar</td>
25783 </tr>
25784 </tbody>
25785 </table>
25786 !!end
25787
25788 !!test
25789 5. Encapsulate foster-parented transclusion content
25790 !!options
25791 parsoid=wt2wt,wt2html
25792 !! wikitext
25793 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25794 !! html/parsoid
25795 <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>
25796 <table>
25797 <tbody>
25798 <tr>
25799 <td>
25800 <div>
25801 <p>foo</p>
25802 </div>
25803 </td>
25804 </tr>
25805 </tbody>
25806 </table>
25807 !!end
25808
25809 !!test
25810 6. Encapsulate foster-parented transclusion content
25811 !!options
25812 parsoid=wt2wt,wt2html
25813 !! wikitext
25814 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25815 !! html/parsoid
25816 <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>
25817 <table>
25818 <tbody>
25819 <tr>
25820 <td>
25821 <div>
25822 <p>foo</p>
25823 </div>
25824 </td>
25825 </tr>
25826 </tbody>
25827 </table>
25828 <p>ok</p>
25829 !!end
25830
25831 !!test
25832 7. Encapsulate foster-parented transclusion content
25833 !!options
25834 parsoid=wt2wt,wt2html
25835 !! wikitext
25836 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25837 !! html/parsoid
25838 <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>
25839 <table>
25840 <tbody>
25841 <tr>
25842 <td>bar</td>
25843 </tr>
25844 </tbody>
25845 </table>
25846 !!end
25847
25848 # Note that the wt is broken on purpose: the = should be {{=}} if you
25849 # don't want it to be a template parameter key.
25850 !!test
25851 8. Encapsulate foster-parented transclusion content
25852 !!options
25853 parsoid=wt2wt,wt2html
25854 !! wikitext
25855 {{echo|a
25856 }}{|{{echo|style='color:red'}}
25857 |-
25858 |b
25859 |}
25860 !! html/parsoid
25861 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25862 <span> </span>
25863 <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>
25864 <table>
25865 <tbody>
25866 <tr>
25867 <td>b</td>
25868 </tr>
25869 </tbody>
25870 </table>
25871 !!end
25872
25873 !!test
25874 9. Encapsulate foster-parented transclusion content
25875 !!options
25876 parsoid=wt2wt,wt2html
25877 !! wikitext
25878 <table>{{echo|hi</table>hello}}
25879 !! html/parsoid
25880 <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>
25881 !!end
25882
25883 !!test
25884 Table in fosterable position
25885 !!options
25886 parsoid=wt2html
25887 !! wikitext
25888 {{OpenTable}}
25889 <div>
25890 {|
25891 |}
25892 </div>
25893 |}
25894 !! html/parsoid
25895 <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">
25896 </span>
25897 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25898
25899 <table>
25900 </table>
25901 !!end
25902
25903 # Parsoid only for T66747
25904 !! test
25905 Properly encapsulate empty-content transclusions in fosterable positions
25906 !! wikitext
25907 <table>
25908 {{#if:|
25909 <td>foo</td>
25910 }}
25911 </table>
25912 !! html/parsoid
25913 <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"}]]}'>
25914
25915 </table>
25916 !! end
25917
25918 !! test
25919 Always encapsulate foster box when template range is expanded to table
25920 !! options
25921 parsoid=wt2wt
25922 !! wikitext
25923 {|
25924 hello
25925 {{OpenTable}}
25926 |}
25927 !! html/parsoid
25928
25929 !! end
25930
25931 !! test
25932 T115289: Unclosed table
25933 !! wikitext
25934 {{echo|<table>}}<!--c-->[[Category:Two]]
25935 !! html/parsoid
25936 <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>
25937 !! end
25938
25939 !! test
25940 T115289: Don't migrate newlines out of tables with fostered content
25941 !! wikitext
25942 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25943 !! html/parsoid
25944 <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>
25945 !! end
25946
25947 !! test
25948 T73074: More fostering fun
25949 !! wikitext
25950 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25951 !! html/parsoid
25952 <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>
25953 !! end
25954
25955 !!test
25956 Support <object> element with .data attribute
25957 !!options
25958 parsoid=html2wt
25959 !! html/parsoid
25960 <object data="test.swf"></object>
25961 !! wikitext
25962 <object data="test.swf"></object>
25963 !!end
25964
25965 !! test
25966 Don't block XML namespace declaration
25967 !! wikitext
25968 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25969 !! html/php
25970 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25971 </p>
25972 !! html/parsoid
25973 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25974 !! end
25975
25976 # -----------------------------------------------------------------
25977 # The following section of tests are primarily to spec requirements
25978 # around Parsoid's serialization (old, new, edited content)
25979 #
25980 # All these tests are marked Parsoid html2wt and html2html only
25981 # ----------------------------------------------------------------
25982
25983 !! test
25984 Ignore rel attribute in a-tags during serialization to url-links
25985 !! options
25986 parsoid=html2wt
25987 !! html/parsoid
25988 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25989 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25990 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25991 !! wikitext
25992 http://en.wikipedia.org/wiki/Foobar
25993 http://en.wikipedia.org/wiki/Foobar
25994 http://en.wikipedia.org/wiki/Foobar
25995 !! end
25996
25997 # 'mi' is a localinterwiki prefix as well as a language
25998 !! test
25999 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
26000 !! options
26001 parsoid=html2wt
26002 !! html/parsoid
26003 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
26004 !! wikitext
26005 [[Foo]]
26006 !! end
26007
26008 !! test
26009 Parsoid should accept interwiki shortcuts
26010 !! options
26011 parsoid=html2wt
26012 !! html/parsoid
26013 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
26014 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
26015 <a href='./fr:Foo'>Foo</a></p>
26016 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
26017 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
26018 <a href='fr%3AFoo'>Foo</a></p>
26019 !! wikitext
26020 [[:fr:Foo|Foo]]
26021 [[:fr:Foo|Foo]]
26022 [[:fr:Foo|Foo]]
26023
26024 [[:fr:Foo|Foo]]
26025 [[:fr:Foo|Foo]]
26026 [[:fr:Foo|Foo]]
26027 !! end
26028
26029 !! test
26030 Parsoid should not accept invalid interwiki shortcuts
26031 !! options
26032 parsoid=html2wt
26033 !! html/parsoid
26034 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
26035 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
26036 <a href='news:Foo'>Foo</a></p>
26037 !! wikitext
26038 [news:Foo Foo]
26039 [news:Foo Foo]
26040 [news:Foo Foo]
26041 !! end
26042
26043 # See T93839
26044 !! test
26045 New wikilinks should be serialized properly
26046 !! options
26047 parsoid=html2wt
26048 !! html/parsoid
26049 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
26050 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
26051 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
26052 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
26053 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
26054 !! wikitext
26055 [[Foo]]
26056 [[Foo]]
26057 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
26058 http://en.wikipedia.org/wiki/Foo
26059 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
26060 !! end
26061
26062 !! test
26063 New wiki links (href variations)
26064 !! options
26065 parsoid=html2wt
26066 !! html/parsoid
26067 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
26068 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
26069 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
26070 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
26071 !! wikitext
26072 [[Foo_bar]]
26073 [[Foo_bar]]
26074 [[Foo_bar]]
26075 [[Toxine bactérienne]]
26076 !! end
26077
26078 !! test
26079 New wiki links (content string variations)
26080 !! options
26081 parsoid=html2wt
26082 !! html/parsoid
26083 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
26084 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
26085 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
26086 !! wikitext
26087 [[Foo_bar]]
26088 [[Foo bar]]
26089 [[Foo_bar|./Foo_bar]]
26090 !! end
26091
26092 !! test
26093 New category links (href variations)
26094 !! options
26095 parsoid=html2wt
26096 !! html/parsoid
26097 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
26098 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
26099 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
26100 !! wikitext
26101 [[Category:Toxine bactérienne]]
26102 [[Category:Toxine bactérienne]]
26103 [[Category:Toxine bactérienne]]
26104 !! end
26105
26106 !! test
26107 New sol transparent links don't need indent-pre nowiki protection
26108 !! options
26109 parsoid=html2wt
26110 language=de
26111 !! html/parsoid
26112 <link rel="mw:PageProp/redirect" href="./Main_Page">
26113 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
26114 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
26115 !! wikitext
26116 #WEITERLEITUNG [[Main Page]]
26117 <!-- this is good --> [[Category:Good]]
26118 <!-- this is great --> [[Kategorie:Great]]
26119 !! end
26120
26121 !! test
26122 New interlanguage links (href variations)
26123 !! options
26124 parsoid=html2wt
26125 !! html/parsoid
26126 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
26127 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
26128 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
26129 !! wikitext
26130 [[es:Toxine bactérienne]]
26131 [[es:Toxine_bactérienne]]
26132 [[es:Toxine_bactérienne]]
26133 !! end
26134
26135 !! test
26136 Image: Modifying size of an image (1)
26137 !! options
26138 parsoid={
26139 "modes": ["wt2wt"],
26140 "changes": [
26141 ["img[height]", "attr", "height", "22"],
26142 ["img[width]", "attr", "width", "200"]
26143 ]
26144 }
26145 !! wikitext
26146 [[Image:Foobar.jpg|230x230px]]
26147 !! wikitext/edited
26148 [[Image:Foobar.jpg|200x200px]]
26149 !!end
26150
26151 !! test
26152 Image: Modifying size of an image (2)
26153 !! options
26154 parsoid={
26155 "modes": ["wt2wt"],
26156 "changes": [
26157 ["img[height]", "attr", "height", "100"],
26158 ["img[width]", "attr", "width", "500"]
26159 ]
26160 }
26161 !! wikitext
26162 [[Image:Foobar.jpg|230x230px]]
26163 !! wikitext/edited
26164 [[Image:Foobar.jpg|500x500px]]
26165 !!end
26166
26167 # Change in size is ignored so long as class='mw-default-size'
26168 !! test
26169 Image: Modifying size of an image (3)
26170 !! options
26171 parsoid={
26172 "modes": ["wt2wt"],
26173 "changes": [
26174 ["figure[class]", "removeClass", "mw-default-size"],
26175 ["figure img", "attr", "height", "19"],
26176 ["figure img", "attr", "width", "170"]
26177 ]
26178 }
26179 !! wikitext
26180 [[Image:Foobar.jpg|thumb]]
26181 !! wikitext/edited
26182 [[Image:Foobar.jpg|thumb|170x170px]]
26183 !!end
26184
26185 !! test
26186 Image: Modifying alignment of an image (T50665)
26187 !! options
26188 parsoid={
26189 "modes": ["wt2wt"],
26190 "changes": [
26191 ["figure[class]", "removeClass", "mw-halign-right"],
26192 ["figure[class]", "addClass", "mw-halign-left"]
26193 ]
26194 }
26195 !! wikitext
26196 [[Image:Foobar.jpg|thumb|caption|right]]
26197 !! wikitext/edited
26198 [[Image:Foobar.jpg|thumb|caption|left]]
26199 !! end
26200
26201 !! test
26202 Image: Modifying mw-default-size of an frameless image (T64805)
26203 !! options
26204 parsoid={
26205 "modes": ["wt2wt"],
26206 "changes": [
26207 ["figure.mw-default-size", "removeClass", "mw-default-size"]
26208 ]
26209 }
26210 !! wikitext
26211 [[Image:Foobar.jpg|frameless|right]]
26212 !! wikitext/edited
26213 [[Image:Foobar.jpg|frameless|right|220x220px]]
26214 !! end
26215
26216 !! test
26217 Image: Modifying valign of an image (T51221)
26218 !! options
26219 parsoid={
26220 "modes": ["wt2wt"],
26221 "changes": [
26222 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
26223 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
26224 ]
26225 }
26226 !! wikitext
26227 [[File:Foobar.jpg|20px|middle]]
26228 !! wikitext/edited
26229 [[File:Foobar.jpg|20px|text-top]]
26230 !! end
26231
26232 !! test
26233 Image: Modifying alt attribute of an image (T58400)
26234 !! options
26235 parsoid={
26236 "modes": ["wt2wt"],
26237 "changes": [
26238 ["img[alt]", "attr", "alt", "some alternate edited text"]
26239 ]
26240 }
26241 !! wikitext
26242 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
26243 !! wikitext/edited
26244 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
26245 !!end
26246
26247 !! test
26248 Image: Modifying caption of an image
26249 !! options
26250 parsoid={
26251 "modes": ["wt2wt"],
26252 "changes": [
26253 ["figcaption", "text", "new caption"]
26254 ]
26255 }
26256 !! wikitext
26257 [[Image:Foobar.jpg|thumb|original caption]]
26258 !! wikitext/edited
26259 [[Image:Foobar.jpg|thumb|new caption]]
26260 !!end
26261
26262 !! test
26263 Image: empty alt attribute (T50924)
26264 !! options
26265 parsoid
26266 !! wikitext
26267 [[File:Foobar.jpg|thumb|alt=|bar]]
26268 !! html
26269 <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>
26270 !! end
26271
26272 !! test
26273 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
26274 !! options
26275 parsoid=html2wt
26276 language=ar
26277 disabled
26278 !! html/parsoid
26279 <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>
26280 !! wikitext
26281 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
26282 !! end
26283
26284 !! test
26285 Image: Block level image should have \n before and after
26286 !! wikitext
26287 123
26288 [[File:Foobar.jpg|right|thumb|150x150px]]
26289 456
26290 !! html/parsoid
26291 <p>123</p>
26292 <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>
26293 <p>456</p>
26294 !!end
26295
26296 !! test
26297 Image: New block level image should have \n before and after (existing content)
26298 !! wikitext
26299 123
26300 [[File:Foobar.jpg|right|thumb|150x150px]]
26301 456
26302 !! html/parsoid
26303 <p>123</p>
26304 <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>
26305 <p>456</p>
26306 !!end
26307
26308 !! test
26309 Image: upright option (parsoid)
26310 !! wikitext
26311 [[File:Foobar.jpg|thumb|upright|caption]]
26312 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
26313 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
26314 !! html/parsoid
26315 <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>
26316 <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>
26317 <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>
26318 !!end
26319
26320 !! test
26321 Image: upright option is ignored on inline and frame images (parsoid)
26322 !! wikitext
26323 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
26324 !! html/parsoid
26325 <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>
26326 !!end
26327
26328 !! test
26329 Image: from basic HTML (1)
26330 !! options
26331 parsoid=html2wt
26332 !! html/parsoid
26333 <span typeof="mw:Image">
26334 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
26335 </span>
26336 !! wikitext
26337 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
26338 !! end
26339
26340 !! test
26341 Image: from basic HTML (2)
26342 !! options
26343 parsoid=html2wt
26344 !! html/parsoid
26345 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
26346 !! wikitext
26347 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
26348 !! end
26349
26350 !! test
26351 Image: from basic HTML (3)
26352 !! options
26353 parsoid=html2wt
26354 !! html/parsoid
26355 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
26356 !! wikitext
26357 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
26358 !! end
26359
26360 !! test
26361 Image: from basic HTML (4)
26362 !! options
26363 parsoid=html2wt
26364 !! html/parsoid
26365 <img src="./File:Foobar.jpg">
26366 !! wikitext
26367 [[File:Foobar.jpg|link=]]
26368 !! end
26369
26370 !! test
26371 Image: Invalid title as link
26372 !! wikitext
26373 [[File:Foobar.jpg|link=<]]
26374 !! html/php
26375 <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>
26376 </p>
26377 !! html/parsoid
26378 <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>
26379 !! end
26380
26381 !! test
26382 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
26383 !! options
26384 parsoid=html2wt
26385 !! html/parsoid
26386 <ul>
26387 <li><p>foo</p></li>
26388 </ul>
26389 !! wikitext
26390 * foo
26391 !! end
26392
26393 !! test
26394 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
26395 !! options
26396 parsoid=html2wt
26397 !! html/parsoid
26398 <ul> <li>foo</li></ul>
26399 !! wikitext
26400 * foo
26401 !! end
26402
26403 !! test
26404 Don't strip leading whitespace when handling indent-pre suppressing tags
26405 !! options
26406 parsoid=html2wt
26407 !! html/parsoid
26408 <table>
26409 <tr><td> indented row</td></tr>
26410 </table>
26411 <blockquote><p>
26412 <b>This is very bold of you!</b>
26413 </p>
26414 <table><tr><td>
26415 indented cell (no pre-wrapping!)
26416 </td></tr></table>
26417 </blockquote>
26418 <p>foo</p>
26419 <div>bar</div>
26420 !! wikitext
26421 {|
26422 | indented row
26423 |}
26424 <blockquote>
26425 '''This is very bold of you!'''
26426
26427 {|
26428 |
26429 indented cell (no pre-wrapping!)
26430 |}
26431 </blockquote>
26432 foo
26433 <div>bar</div>
26434 !! end
26435
26436 !! test
26437 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
26438 !! options
26439 parsoid=html2wt
26440 !! html/parsoid
26441 <p>foo</p>
26442 <span>bar</span>
26443
26444 <span>foo2
26445 </span>bar2
26446
26447 <div>foo</div>
26448 <span>bar</span>
26449
26450 <div>
26451 <span>foo</span>
26452 </div>
26453 !! wikitext
26454 foo
26455
26456 <span>bar</span>
26457
26458 <span>foo2
26459 <nowiki> </nowiki></span>bar2
26460
26461 <div>foo</div>
26462 <nowiki> </nowiki><span>bar</span>
26463
26464 <div>
26465 <nowiki> </nowiki><span>foo</span>
26466 </div>
26467 !! end
26468
26469 !! test
26470 Lists: Dont insert newlines in a serialized list item.
26471 !! options
26472 parsoid=html2wt
26473 !! html/parsoid
26474 <ul><li>a<br>b</li><li>c</li></ul>
26475 !! wikitext
26476 * a<br>b
26477 * c
26478 !! end
26479
26480 !! test
26481 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
26482 !! options
26483 parsoid={
26484 "modes": ["html2wt"],
26485 "scrubWikitext": false
26486 }
26487 !! html/parsoid
26488 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26489 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26490
26491 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26492 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26493
26494 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
26495
26496 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26497 !! wikitext
26498 == hello there [[Category:A1]] ==
26499
26500 == [[Category:A2]] hi pal ==
26501
26502 == <!--foo--> [[Category:A3]] how goes it ==
26503
26504 == it goes well [[Category:A4]] <!--bar--> ==
26505
26506 ==howdy [[Category:A5]]==
26507
26508 == __TOC__ ok ==
26509 !! end
26510
26511 !! test
26512 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
26513 !! options
26514 parsoid={
26515 "modes": ["html2wt"],
26516 "scrubWikitext": true
26517 }
26518 !! html/parsoid
26519 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26520 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26521
26522 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26523 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26524
26525 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26526 !! wikitext
26527 == hello there ==
26528 [[Category:A1]]
26529 [[Category:A2]]
26530
26531 == hi pal ==
26532
26533 <!--foo--> [[Category:A3]]
26534
26535 == how goes it ==
26536
26537 == it goes well ==
26538 [[Category:A4]] <!--bar-->
26539
26540 __TOC__
26541
26542 == ok ==
26543 !! end
26544
26545 !! test
26546 Headings: Don't hoist metas that come from templates
26547 !! options
26548 parsoid={
26549 "modes": ["html2wt"],
26550 "scrubWikitext": true
26551 }
26552 !! html/parsoid
26553 <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>
26554 !! wikitext
26555 == {{echo|foo [[Category:Foo]]}} ==
26556 !! end
26557
26558 !! test
26559 Headings: Category in ref isn't hoisted
26560 !! options
26561 parsoid={
26562 "modes": ["html2wt"],
26563 "scrubWikitext": true
26564 }
26565 !! html/parsoid
26566 <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>
26567
26568 <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>
26569 !! wikitext
26570 == foo <ref>bar
26571 [[Category:Baz]] </ref> ==
26572
26573 <references />
26574 !! end
26575
26576 !! test
26577 Parsoid: Serialize positional parameters with = in them as named parameter
26578 !! options
26579 parsoid=html2wt
26580 !! html/parsoid
26581 <p about="#mwt1" typeof="mw:Transclusion"
26582 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
26583
26584 <p about="#mwt1" typeof="mw:Transclusion"
26585 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
26586
26587 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26588 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26589 <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>
26590 !! wikitext
26591 {{echo|1=f=oo}}
26592
26593 {{echo|1=f=oo|2=bar}}
26594
26595 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26596 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26597 {{echo|<nowiki>f=oo</nowiki>|bar}}
26598 !! end
26599
26600 !! test
26601 Parsoid: Serialize positional parameters with = in extlink as named parameter
26602 !! options
26603 parsoid=html2wt
26604 !! html/parsoid
26605 <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>
26606 !! wikitext
26607 {{echo|1=http://stuff?is=ok}}
26608 !! end
26609
26610 !! test
26611 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
26612 !! options
26613 parsoid=html2wt
26614 !! html/parsoid
26615 <div>a<p>b</p></div>
26616 <div>a
26617 <p>b</p></div>
26618 <div>
26619 a
26620 <p>b</p></div>
26621 !! wikitext
26622 <div>a
26623 b
26624 </div>
26625 <div>a
26626 b
26627 </div>
26628 <div>
26629 a
26630
26631 b
26632 </div>
26633 !! end
26634
26635 !! test
26636 Substrings resembling wikitext in hrefs should not get nowiki escapes
26637 !! options
26638 parsoid=html2wt
26639 !! html/parsoid
26640 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
26641 !! wikitext
26642 [[Foo''bar''baz]]
26643 !! end
26644
26645 !! test
26646 Enforce single-line context in the serializer
26647 !! options
26648 parsoid=html2wt
26649 !! html/parsoid
26650 <h2>testing
26651 123</h2>
26652
26653 <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">
26654 </span><span about="#mwt1">you</span> </h2>
26655
26656 <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>
26657
26658 <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
26659 there</span></li></ol>
26660
26661 <ul><li>asd
26662 sdf</li></ul>
26663
26664 <ul><li>foo
26665 bar
26666 baz</li>
26667 <li>foo <b>bar</b>
26668 baz</li></ul>
26669
26670 <dl><dt>hi
26671 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
26672 ho</dd></dl>
26673
26674 <dl><dd> <table>
26675 <tbody><tr><td> ha
26676 ha
26677 ha</td></tr>
26678 </tbody></table></dd></dl>
26679 !! wikitext
26680 == testing 123 ==
26681
26682 == hi {{bogus|there
26683 you}} ==
26684
26685 == foo <ref>hello
26686 there</ref> ==
26687
26688 <references />
26689
26690 * asd sdf
26691
26692 * foo bar baz
26693 * foo '''bar''' baz
26694
26695 ; hi ho : hi ho
26696
26697 : {|
26698 | ha
26699 ha
26700 ha
26701 |}
26702 !! end
26703
26704 !! test
26705 Serialize new placeholder space without spans
26706 !! options
26707 parsoid=html2wt
26708 !! html/parsoid
26709 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
26710
26711 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
26712
26713 <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>
26714 !! wikitext
26715 foo : bar
26716
26717 foo : bar
26718
26719 <ref>foo : bar</ref>ok
26720 !! end
26721
26722
26723 #-----------------------
26724 # Tag minimization tests
26725 #-----------------------
26726
26727 !! test
26728 1. I/B quote minimization: wikitext-only tags should be combined
26729 !! options
26730 parsoid=html2wt
26731 !! html/parsoid
26732 <p><i>A</i><i>B</i></p>
26733 <p><b>A</b><b>B</b></p>
26734 <p><i>A</i><b><i>B</i></b></p>
26735 <p><b>A</b><i><b>B</b></i></p>
26736 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
26737 <p><i><b>A</b></i><i><b>B</b></i></p>
26738 <p><i><b>A</b></i><b><i>B</i></b></p>
26739 <p><b><i>A</i></b><i><b>B</b></i></p>
26740 !! wikitext
26741 ''AB''
26742
26743 '''AB'''
26744
26745 ''A'''B'''''
26746
26747 '''A''B'''''
26748
26749 '''A''BC''D'''
26750
26751 '''''AB'''''
26752
26753 '''''AB'''''
26754
26755 '''''AB'''''
26756 !! end
26757
26758 !! test
26759 2. I/B quote minimization: wikitext and html tags should not be combined
26760 !! options
26761 parsoid=html2wt
26762 !! html/parsoid
26763 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26764 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26765 !! wikitext
26766 ''A''<i>B</i>
26767
26768 ''A''<nowiki/>'''<i>B</i>'''
26769 !! end
26770
26771 !! test
26772 3. I/B quote minimization: templated content stops minimization
26773 !! options
26774 parsoid=html2wt
26775 !! html/parsoid
26776 <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>
26777 <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>
26778 !! wikitext
26779 ''A''{{echo|''B''}}
26780
26781 ''A''{{echo|'''''B'''''}}
26782 !! end
26783
26784 !! test
26785 4. I/B quote minimization: new content should be mimimized with adjacent old content
26786 !! options
26787 parsoid=html2wt
26788 !! html/parsoid
26789 <p><i>A</i><i>B</i></p>
26790 <p><b>A</b><b>B</b></p>
26791 <p><i>A</i><b><i>B</i></b></p>
26792 !! wikitext
26793 ''AB''
26794
26795 '''AB'''
26796
26797 ''A'''B'''''
26798 !! end
26799
26800 !! test
26801 5a. Merge adjacent quote nodes if they've been edited
26802 !! options
26803 parsoid={
26804 "modes": ["wt2wt", "selser"],
26805 "changes": [
26806 ["p", "contents", "remove", ":contains('b')"]
26807 ]
26808 }
26809 !! wikitext
26810 ''a''b''c''
26811 !! wikitext/edited
26812 ''ac''
26813 !! end
26814
26815 !! test
26816 5b. Merge adjacent quote nodes if they've been edited
26817 !! options
26818 parsoid={
26819 "modes": ["wt2wt", "selser"],
26820 "changes": [
26821 ["#x", "remove"]
26822 ]
26823 }
26824 !! wikitext
26825 ''a''<span id="x">b</span>''c''
26826 !! wikitext/edited
26827 ''ac''
26828 !! end
26829
26830 !! test
26831 1. Merge adjacent link nodes as long as at least one element is new
26832 !! options
26833 parsoid={
26834 "modes": ["html2wt"],
26835 "scrubWikitext": true
26836 }
26837 !! html/parsoid
26838 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26839 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26840 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26841 !! wikitext
26842 [[Football]]
26843 [[Football]]
26844 [[Football|Foot]][[Football|ball]]
26845 !! end
26846
26847 !! test
26848 2. Merge adjacent link nodes and enable additional normalizations
26849 !! options
26850 parsoid={
26851 "modes": ["html2wt"],
26852 "scrubWikitext": true
26853 }
26854 !! html/parsoid
26855 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26856 !! wikitext
26857 [[Football|''Football'']]
26858 !! end
26859
26860 !! test
26861 3. Don't merge adjacent link nodes if scrubWikitext is false
26862 !! options
26863 parsoid={
26864 "modes": ["html2wt"],
26865 "scrubWikitext": false
26866 }
26867 !! html/parsoid
26868 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26869 !! wikitext
26870 [[Football|Foot]][[Football|ball]]
26871 !! end
26872
26873 #------------------------------
26874 # End of tag minimization tests
26875 #------------------------------
26876
26877 !!test
26878 T56262: New entities
26879 !! options
26880 parsoid=html2wt
26881 !! html/parsoid
26882 <span typeof="mw:Entity">&nbsp;</span>
26883 !! wikitext
26884 &nbsp;
26885 !! end
26886
26887 ## Note that there is no wikitext output for 'unknownproperty' ##
26888 ## Unknown magic words are silently dropped ##
26889
26890 !! test
26891 Magic words
26892 !! options
26893 parsoid=html2wt
26894 !! html/parsoid
26895 <meta property='mw:PageProp/toc' />
26896 <meta property='mw:PageProp/notoc' />
26897 <meta property='mw:PageProp/forcetoc' />
26898 <meta property='mw:PageProp/index' />
26899 <meta property='mw:PageProp/noindex' />
26900 <meta property='mw:PageProp/nogallery' />
26901 <meta property='mw:PageProp/noeditsection' />
26902 <meta property='mw:PageProp/notitleconvert' />
26903 <meta property='mw:PageProp/nocontentconvert' />
26904 <meta property='mw:PageProp/unknownproperty' />
26905 !! wikitext
26906 __TOC__
26907 __NOTOC__
26908 __FORCETOC__
26909 __INDEX__
26910 __NOINDEX__
26911 __NOGALLERY__
26912 __NOEDITSECTION__
26913 __NOTITLECONVERT__
26914 __NOCONTENTCONVERT__
26915 !! end
26916
26917 !! test
26918 Consecutive <pre>s should not get merged
26919 !! options
26920 parsoid=html2wt,html2html
26921 !! html/parsoid
26922 <pre>a</pre><pre>b</pre>
26923
26924 <pre>c
26925 </pre><pre>
26926 d</pre>
26927
26928 <pre>e
26929
26930 </pre><pre>
26931
26932 f</pre>
26933 !! wikitext
26934 a
26935
26936 b
26937
26938 c
26939
26940 d
26941
26942 e
26943
26944
26945
26946 f
26947 !! end
26948
26949 !! test
26950 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26951 !! options
26952 parsoid=html2wt
26953 !! html/parsoid
26954 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26955 !! wikitext
26956 [[Special:BookSources/1234567890|ISBN 1234567895]]
26957 !! end
26958
26959 !! test
26960 Edited RFC links not serializable as RFC links should serialize as extlinks
26961 !! options
26962 parsoid=html2wt
26963 !! html/parsoid
26964 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26965 !! wikitext
26966 [//tools.ietf.org/html/rfc123 New RFC]
26967 !! end
26968
26969 !! test
26970 Edited PMID links not serializable as PMID links should serialize as extlinks
26971 !! options
26972 parsoid=html2wt
26973 !! html/parsoid
26974 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26975 !! wikitext
26976 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26977 !! end
26978
26979 !! test
26980 WTS of autolinks with trailing/surrounding context
26981 !! options
26982 parsoid=html2wt
26983 !! html/parsoid
26984 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26985 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26986 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26987 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26988 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26989 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26990 !! wikitext
26991 http://cscott.net'''foo'''
26992
26993 http://cscott.net<b>foo</b>
26994
26995 '''http://cscott.net'''
26996
26997 '''http://cscott.net '''
26998
26999 '''http://cscott.net<nowiki/>x'''
27000
27001 http://cscott.net<nowiki/>x
27002 !! end
27003
27004 !! test
27005 WTS of autolinks with nowikis (round-trip)
27006 !! wikitext
27007 x<nowiki/>http://cscott.net<nowiki/>x
27008 !! html/parsoid
27009 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
27010 !! end
27011
27012 # this is the "easy" test because it leaves in place all the
27013 # data-parsoid information indicating this is an autolink
27014 !! test
27015 WTS of autolinks with escapes (editing)
27016 !! options
27017 parsoid={
27018 "modes": ["wt2wt"],
27019 "changes": [
27020 [ "span", "remove" ]
27021 ]
27022 }
27023 !! wikitext
27024 x<nowiki/>http://cscott.net<nowiki/>x
27025 !! wikitext/edited
27026 x<nowiki/>http://cscott.net<nowiki/>x
27027 !! end
27028
27029 !! test
27030 WTS of edited autolink-like text (T103364)
27031 !! options
27032 parsoid={
27033 "modes": ["wt2wt"],
27034 "changes": [
27035 [ "span[typeof]", "removeAttr", "typeof" ]
27036 ]
27037 }
27038 !! wikitext
27039 Not a link: <nowiki>http://example.com</nowiki>.
27040 !! wikitext/edited
27041 Not a link: <span><nowiki>http://example.com</nowiki></span>.
27042 !! end
27043
27044 !! test
27045 WTS of newly-authored autolink-like text (T103364)
27046 !! options
27047 parsoid=html2wt
27048 !! html/parsoid
27049 <p>http://example.com is not a link.</p>
27050 !! wikitext
27051 <nowiki>http://example.com</nowiki> is not a link.
27052 !! end
27053
27054 !! test
27055 WTS of autolink-like text after an autolink (T108563)
27056 !! options
27057 parsoid=html2wt
27058 !! html/parsoid
27059 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
27060 !! wikitext
27061 http://example.com <nowiki>http://example.com</nowiki> is not a link.
27062 !! end
27063
27064 !! test
27065 Magic links inside links (not autolinked)
27066 !! wikitext
27067 [[Foo|http://example.com]]
27068 [[Foo|RFC 1234]]
27069 [[Foo|PMID 1234]]
27070 [[Foo|ISBN 123456789x]]
27071
27072 [http://foo.com http://example.com]
27073 [http://foo.com RFC 1234]
27074 [http://foo.com PMID 1234]
27075 [http://foo.com ISBN 123456789x]
27076 !! html+tidy
27077 <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>
27078 <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>
27079 !! html/parsoid
27080 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
27081 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
27082 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
27083 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
27084
27085 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
27086 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
27087 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
27088 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
27089 !! end
27090
27091 !! test
27092 Magic links inside image captions (autolinked)
27093 !! wikitext
27094 [[File:Foobar.jpg|thumb|http://example.com]]
27095 [[File:Foobar.jpg|thumb|RFC 1234]]
27096 [[File:Foobar.jpg|thumb|PMID 1234]]
27097 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
27098 !! html+tidy
27099 <div class="thumb tright">
27100 <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>
27101 <div class="thumbcaption">
27102 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
27103 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
27104 </div>
27105 </div>
27106 <div class="thumb tright">
27107 <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>
27108 <div class="thumbcaption">
27109 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
27110 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
27111 </div>
27112 </div>
27113 <div class="thumb tright">
27114 <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>
27115 <div class="thumbcaption">
27116 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
27117 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
27118 </div>
27119 </div>
27120 <div class="thumb tright">
27121 <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>
27122 <div class="thumbcaption">
27123 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
27124 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
27125 </div>
27126 </div>
27127 !! html/parsoid
27128 <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>
27129 <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>
27130 <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>
27131 <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>
27132 !! end
27133
27134 !! test
27135 WTS of magic word text (T109371)
27136 !! options
27137 parsoid=html2wt
27138 !! html/parsoid
27139 <p>RFC 1234</p>
27140 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
27141 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
27142 !! wikitext
27143 <nowiki>RFC 1234</nowiki>
27144
27145 [http://foo.com RFC 1234]
27146
27147 [[Foo|RFC 1234]]
27148 !! end
27149
27150 !! test
27151 Edited Redirect link should emit a non-piped wikitext link
27152 !! options
27153 parsoid=html2wt
27154 !! html/parsoid
27155 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
27156 !! wikitext
27157 #REDIRECT [[Bar]]
27158 !! end
27159
27160 !! test
27161 T75121: Infer extension name from typeOf if data-mw is not present
27162 !! options
27163 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27164 !! html/parsoid
27165 <div typeOf="mw:Extension/foo"></div>
27166 !! wikitext
27167 <foo />
27168 !! end
27169
27170 # Note that the <p> wrapping isn't present in PHP parser output
27171 # The important thing for this test is that P-wrapping doesn't
27172 # interfere with the <nowiki> protection for leading - in <td>
27173 # (which isn't necessary for <th>).
27174 !! test
27175 T88318: p-wrapped dash in table.
27176 !! options
27177 parsoid=html2wt,wt2wt
27178 !! html/parsoid
27179 <table><tbody>
27180 <tr><th><p>-</p></th><th><p>- </p></th></tr>
27181 <tr><td><p>-</p></td><td><p>- </p></td></tr>
27182 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
27183 </tbody></table>
27184 !! wikitext
27185 {|
27186 !-
27187 !-
27188 |-
27189 |<nowiki>-</nowiki>
27190 |<nowiki>- </nowiki>
27191 |-
27192 |<small>-</small>
27193 |<br>
27194 -
27195 |<br>
27196 -
27197 |}
27198 !! html/php+tidy
27199 <table>
27200 <tr>
27201 <th>-</th>
27202 <th>-</th>
27203 </tr>
27204 <tr>
27205 <td>-</td>
27206 <td>-</td>
27207 </tr>
27208 <tr>
27209 <td><small>-</small></td>
27210 <td><br />
27211 <p>-</p>
27212 </td>
27213 <td><br />
27214 <p>-</p>
27215 </td>
27216 </tr>
27217 </table>
27218 !! end
27219
27220 !! test
27221 T149209: WTS: Handle newlines in table cells properly
27222 !! options
27223 parsoid=html2wt
27224 !! html/parsoid
27225 <table>
27226 <tbody>
27227 <tr><td>a
27228 b
27229 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
27230 <tr><td><p>x</p>
27231 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
27232 </tbody></table>
27233 <table>
27234 <tbody>
27235 <tr><th>a
27236 b
27237 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
27238 <tr><th><p>x</h>
27239 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
27240 </tbody></table>
27241 !! wikitext
27242 {|
27243 |a
27244 b
27245 |c
27246 |-
27247 |x
27248 {{!}}y
27249 |}
27250 {|
27251 !a
27252 b
27253 !c
27254 |-
27255 !x
27256 !y
27257 |}
27258 !! end
27259
27260 !! test
27261 T149209: Selser: Handle newlines in table cells properly
27262 !! options
27263 parsoid={
27264 "modes": ["selser"],
27265 "changes": [
27266 [ "#h1", "html", "a\nb\n" ],
27267 [ "#h2", "html", "a\nb\n" ],
27268 [ "#c1", "html", "a\nb\n" ],
27269 [ "#c2", "html", "<p>a</p>" ],
27270 [ "#c3", "html", "<p>a</p>" ],
27271 [ "#c4", "html", "edit-me<p>a</p>" ]
27272 ]
27273 }
27274 !! wikitext
27275 {|
27276 ! id="h1" |edit-me!!1
27277 |-
27278 ! id="h2" |edit-me||2
27279 |-
27280 | id="c1" |edit-me||3
27281 |-
27282 | id="c2" |edit-me||4
27283 |-
27284 | id="c3" |edit-me||p||q||r
27285 |-
27286 | id="c4" |edit-me||p||q||r
27287 |}
27288 !! wikitext/edited
27289 {|
27290 ! id="h1" |a
27291 b
27292 !1
27293 |-
27294 ! id="h2" |a
27295 b
27296 !2
27297 |-
27298 | id="c1" |a
27299 b
27300 |3
27301 |-
27302 | id="c2" |a
27303 |4
27304 |-
27305 | id="c3" |a
27306 |p||q||r
27307 |-
27308 | id="c4" |edit-me
27309 a
27310 |p||q||r
27311 |}
27312 !! end
27313
27314 !! test
27315 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
27316 !! options
27317 parsoid=html2wt
27318 !! html/parsoid
27319 <table id='mwAb'>
27320 <td id='mwAc'>foo</td>
27321 <td id='serialize-this'>bar</td>
27322 </table>
27323 !! wikitext
27324 {|
27325 |foo
27326 | id="serialize-this" |bar
27327 |}
27328 !! end
27329
27330 !! test
27331 Parsoid-like element ids should not be serialized to wikitext unless shadowed
27332 !! options
27333 parsoid=html2wt
27334 !! html/parsoid
27335 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
27336 !! wikitext
27337 <div id="hello">ok</div>
27338 !! end
27339
27340 !! test
27341 WTS change modes
27342 !! options
27343 parsoid={
27344 "modes": ["wt2wt"],
27345 "changes": [
27346 [ "#xyz", "before", "<b>before</b> stuff " ],
27347 [ "#xyz", "after", " stuff <i>after</i>" ],
27348 [ "#xyz", "html", "x <b>y</b> z" ]
27349 ]
27350 }
27351 !! wikitext
27352 <span id="xyz">hello</span>
27353 !! wikitext/edited
27354 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
27355 !! end
27356
27357 !! test
27358 Never serialize a-tag as html, regardless of what data-parsoid has to say
27359 !! options
27360 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27361 !! html/parsoid
27362 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
27363 !! wikitext
27364 [[Foo]]
27365 !! end
27366
27367 ## SSS FIXME: This is broken output nevertheless.
27368 ## What might be a reasonable non-broken output for this?
27369 ## This is an edge case unlikely to be seen in production
27370 ## that I am not wasting more time on this right now.
27371 !! test
27372 Never serialize a-tag as html, no matter what attributes it has
27373 !! options
27374 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27375 !! html/parsoid
27376 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
27377 !! wikitext
27378 [http://boo.org http://boohoo.org]
27379 !! end
27380
27381 # Misnested is an indication that selser can reuse the source but these have
27382 # shown to sneak through on occasion. See T101768.
27383 # The original wikitext here is: [http://test.com [[one]] two three]
27384 !! test
27385 Strip span tags added to mark misnested links
27386 !! options
27387 parsoid=html2wt
27388 !! html/parsoid
27389 <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>
27390 !! wikitext
27391 [http://test.com][[one]] two three
27392 !! end
27393
27394 !! test
27395 Catch regression when unpacking misnested links
27396 !! options
27397 parsoid=wt2html
27398 !! wikitext
27399 {{echo|hi}}[http://example.com [[ho]]]
27400 !! html/parsoid
27401 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</span><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Ho" title="Ho" data-parsoid='{"misnested":true}'>ho</a></p>
27402 !! end
27403
27404 !! test
27405 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
27406 !! options
27407 parsoid=html2wt
27408 !! html/parsoid
27409 <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|}"]}'>
27410 <tbody><tr><td>d
27411 </td></tr>
27412 </tbody></table>
27413 !! wikitext
27414 {{echo|a}}
27415 {|{{echo|c
27416 {{!}}d
27417 }}
27418 |}
27419 !! end
27420
27421 ## This test verifies the presence and computation of this attribute indirectly
27422 ## by making an edit and ensuring that the serialization is correct (which it would be
27423 ## only if firstWikitextNode is properly set).
27424 !! test
27425 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
27426 !! options
27427 parsoid= {
27428 "modes": ["wt2wt"],
27429 "changes": [
27430 [ "div#x", "remove" ],
27431 [ "div", "before", "<div>new</div>" ]
27432 ]
27433 }
27434 !! wikitext
27435 <div id="x">foo</div>
27436 {|
27437 {{echo|<div>boo</div>
27438 {{!}}b}}
27439 |c
27440 |}
27441 !! wikitext/edited
27442
27443 <div>new</div>
27444 {|
27445 {{echo|<div>boo</div>
27446 {{!}}b}}
27447 |c
27448 |}
27449 !! end
27450
27451 # --------------------------------------------
27452 # Tests spec'ing wikitext serialization norms |
27453 # --------------------------------------------
27454
27455 !! test
27456 Serialize multi-line indent-pre starting with wikitext syntax
27457 !! options
27458 parsoid=html2wt
27459 !! html/parsoid
27460 <pre>* 1
27461 ** 2
27462 * 3</pre>
27463 !! wikitext
27464 * 1
27465 ** 2
27466 * 3
27467 !! end
27468
27469 !! test
27470 1. Categories should always be serialized on their own line
27471 !! options
27472 parsoid=html2wt
27473 !! html/parsoid
27474 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
27475 !! wikitext
27476 foo
27477 [[Category:Foo]]
27478 bar
27479 !! end
27480
27481 !! test
27482 2. Categories that are part of templates should not introduce a line break
27483 !! wikitext
27484 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
27485 !! html/parsoid
27486 <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>
27487 !! end
27488
27489 # Careful while editing these next 2 tests. There are \u200f characters
27490 # before and after the <link> tags in the HTML and following some
27491 # of the categories in wikitext
27492 # Do not remove these characters in edits.
27493 #
27494 # As part of the serialization, these bidi characters will get stripped.
27495 !! test
27496 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
27497 !! options
27498 parsoid={
27499 "modes": ["html2wt"],
27500 "scrubWikitext": true
27501 }
27502 !! html/parsoid
27503 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
27504 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
27505 !! wikitext
27506 [[קטגוריה:טקסים]]
27507 [[קטגוריה: שיטות משפט]]
27508 !! end
27509
27510 !! test
27511 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
27512 !! options
27513 parsoid={
27514 "modes": ["html2wt"],
27515 "scrubWikitext": true
27516 }
27517 !! html/parsoid
27518 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
27519 !! wikitext
27520 [[קטגוריה:טקסים]]
27521 ‏y
27522 !! end
27523
27524 !! test
27525 Lists: Add space after bullets
27526 !! options
27527 parsoid=html2wt
27528 !! html/parsoid
27529 <ul>
27530 <li>foo</li>
27531 <li> bar</li>
27532 <li><span> baz</span></li>
27533 </ul>
27534 !! wikitext
27535 * foo
27536 * bar
27537 * <span> baz</span>
27538 !! end
27539
27540 !! test
27541 1. Headings: Add space before/after == (T53744)
27542 !! options
27543 parsoid=html2wt
27544 !! html/parsoid
27545 <h2>foo</h2>
27546 <h2> bar</h2>
27547 <h2>baz </h2>
27548 <h2><span> baz</span></h2>
27549 !! wikitext
27550 == foo ==
27551
27552 == bar ==
27553
27554 == baz ==
27555
27556 == <span> baz</span> ==
27557 !! end
27558
27559 !! test
27560 2. Headings: Add space before/after == even after hoisted content
27561 !! options
27562 parsoid={
27563 "modes": ["html2wt"],
27564 "scrubWikitext": true
27565 }
27566 !! html/parsoid
27567 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
27568 !! wikitext
27569 [[Category:A2]]
27570
27571 == ok ==
27572 !! end
27573
27574 !! test
27575 1. Headings: suppress newly created empty headings
27576 !! options
27577 parsoid={
27578 "modes": ["html2wt"],
27579 "scrubWikitext": true
27580 }
27581 !! html/parsoid
27582 <h2></h2>
27583 !! wikitext
27584 !! end
27585
27586 !! test
27587 2. Headings: don't suppress empty headings if scrubWikitext is false
27588 !! options
27589 parsoid=html2wt
27590 !! html/parsoid
27591 <h2></h2>
27592 !! wikitext
27593 ==<nowiki/>==
27594 !! end
27595
27596 !! test
27597 3. Headings: suppress empty headings on edits
27598 !! options
27599 parsoid={
27600 "modes": ["selser"],
27601 "scrubWikitext": true,
27602 "changes": [
27603 [ "#x", "remove"]
27604 ]
27605 }
27606 !! wikitext
27607 ==<span id="x">foo</span>==
27608 !! wikitext/edited
27609 !! end
27610
27611 !! test
27612 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
27613 !! options
27614 parsoid={
27615 "modes": ["html2wt"],
27616 "scrubWikitext": true
27617 }
27618 !! html/parsoid
27619 <h2>foo<br/>bar</h2>
27620 <h2>foo <span><br/>bar</span> baz</h2>
27621 !! wikitext
27622 == foo bar ==
27623
27624 == foo <span> bar</span> baz ==
27625 !! end
27626
27627 !! test
27628 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
27629 !! options
27630 parsoid={
27631 "modes": ["html2wt"],
27632 "scrubWikitext": false
27633 }
27634 !! html/parsoid
27635 <h2>foo<br/>bar</h2>
27636 !! wikitext
27637 == foo<br> bar ==
27638 !! end
27639
27640 !! test
27641 1. WT Quote Tags: suppress newly created empty style tags
27642 !! options
27643 parsoid={
27644 "modes": ["html2wt"],
27645 "scrubWikitext": true
27646 }
27647 !! html/parsoid
27648 <i></i><b></b>
27649 !! wikitext
27650 !! end
27651
27652 !! test
27653 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
27654 !! options
27655 parsoid=html2wt
27656 !! html/parsoid
27657 <i></i><b></b>
27658 !! wikitext
27659 ''<nowiki/>'''''<nowiki/>'''
27660 !! end
27661
27662 !! test
27663 3. WT Quote Tags: suppress empty style tags on edits
27664 !! options
27665 parsoid={
27666 "modes": ["selser"],
27667 "scrubWikitext": true,
27668 "changes": [
27669 [ "#x", "remove"]
27670 ]
27671 }
27672 !! wikitext
27673 '''<span id="x">foo</span>'''
27674 !! wikitext/edited
27675 !! end
27676
27677 !! test
27678 1. Anchors: suppress newly created empty anchors
27679 !! options
27680 parsoid={
27681 "modes": ["html2wt"],
27682 "scrubWikitext": true
27683 }
27684 !! html/parsoid
27685 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27686 !! wikitext
27687 !! end
27688
27689 !! test
27690 2. Anchors: don't suppress empty anchors if scrubWikitext is false
27691 !! options
27692 parsoid={
27693 "modes": ["html2wt"],
27694 "scrubWikitext": false
27695 }
27696 !! html/parsoid
27697 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27698 !! wikitext
27699 [[Test|<nowiki/>]]
27700 !! end
27701
27702 !! test
27703 3. Anchors: suppress empty anchors on edits
27704 !! options
27705 parsoid={
27706 "modes": ["selser"],
27707 "scrubWikitext": true,
27708 "changes": [
27709 [ "#x", "remove"]
27710 ]
27711 }
27712 !! wikitext
27713 [[Test|<span id="x">foo</span>]]
27714 !! wikitext/edited
27715 !! end
27716
27717 !! test
27718 3a. Anchors: do not suppress numbered extlinks
27719 !! options
27720 parsoid={
27721 "modes": ["wt2wt"],
27722 "scrubWikitext": true
27723 }
27724 !! wikitext
27725 [http://foo.com]
27726 !! html/parsoid
27727 <a rel="mw:ExtLink" href="http://foo.com"></a>
27728 !! end
27729
27730 !! test
27731 3b. Anchors: do not suppress numbered extlinks
27732 !! options
27733 parsoid={
27734 "modes": ["wt2wt"],
27735 "scrubWikitext": true,
27736 "changes": [
27737 [ "#x", "remove"]
27738 ]
27739 }
27740 !! wikitext
27741 [http://foo.com <span id="x">foo</span>]
27742 !! wikitext/edited
27743 [http://foo.com]
27744 !! end
27745
27746 !!test
27747 Normalizations should be restricted to edited content
27748 !!options
27749 parsoid={
27750 "modes": ["selser"],
27751 "scrubWikitext": true,
27752 "changes": [
27753 [ "h1", "before", "<i></i>"]
27754 ]
27755 }
27756 !!wikitext
27757 a
27758 = =
27759 b
27760 !!wikitext/edited
27761 a
27762 = =
27763 b
27764 !!end
27765
27766 !! test
27767 1. Multiple normalizations (html2wt)
27768 !! options
27769 parsoid={
27770 "modes": ["html2wt"],
27771 "scrubWikitext": true
27772 }
27773 !! html
27774 <h2><i></i></h2>
27775 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27776 </a><b><i></i></b>x</p>
27777 !! wikitext
27778
27779 [[foo]]
27780 x
27781
27782 !! end
27783
27784 !! test
27785 2. Multiple normalizations (selser)
27786 !! options
27787 parsoid={
27788 "modes": ["selser"],
27789 "scrubWikitext": true,
27790 "changes": [
27791 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27792 ]
27793 }
27794 !! wikitext
27795 <span id="x">foo</span>
27796 !! wikitext/edited
27797 <span id="x">foo</span>
27798
27799 x
27800 !! end
27801
27802 !! test
27803 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27804 !! options
27805 parsoid={
27806 "modes": ["html2wt"],
27807 "scrubWikitext": true
27808 }
27809 !! html/parsoid
27810 <p> hi</p>
27811 <p> hello</p>
27812 !! wikitext
27813 hi
27814
27815 hello
27816 !! end
27817
27818 !! test
27819 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27820 !! options
27821 parsoid=html2wt
27822 !! html/parsoid
27823 <p> hi</p>
27824 <p> hello</p>
27825 !! wikitext
27826 <nowiki> </nowiki>hi
27827
27828 <nowiki> </nowiki> hello
27829 !! end
27830
27831 !! test
27832 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27833 !! options
27834 parsoid={
27835 "modes": ["html2wt"],
27836 "scrubWikitext": true
27837 }
27838 !! html/parsoid
27839 <p>Foo
27840 bar
27841 baz</p>
27842
27843 <table><tr><td>Foo
27844 bar
27845 baz bang</td></tr></table>
27846
27847 <p><!--boo--> foo
27848 bar</p>
27849
27850 <p> foo
27851 bar<span>boo</span></p>
27852 !! wikitext
27853 Foo
27854 bar
27855 baz
27856
27857 {|
27858 |Foo
27859 bar
27860 baz bang
27861 |}
27862
27863 <!--boo-->foo
27864 bar
27865
27866 foo
27867 bar<span>boo</span>
27868 !! end
27869
27870 !! test
27871 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27872 !! options
27873 parsoid={
27874 "modes": ["selser"],
27875 "scrubWikitext": true,
27876 "changes": [
27877 [ "p", "html", " a\n b" ]
27878 ]
27879 }
27880 !! wikitext
27881 xyz
27882 !! wikitext/edited
27883 a
27884 b
27885 !! end
27886
27887 !! test
27888 1. New links that end in spaces
27889 !! options
27890 parsoid={
27891 "modes": ["html2wt"],
27892 "scrubWikitext": false
27893 }
27894 !! html/parsoid
27895 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27896 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27897 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27898 !! wikitext
27899 [[Berlin ]]<nowiki/>is the capital of Germany.
27900
27901 [[Foo ]]'''bar'''
27902
27903 [[Boston ]] is a city.
27904 !! end
27905
27906 !! test
27907 2. New links that end in spaces
27908 !! options
27909 parsoid={
27910 "modes": ["html2wt"],
27911 "scrubWikitext": true
27912 }
27913 !! html/parsoid
27914 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27915 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27916 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27917 !! wikitext
27918 [[Berlin]] is the capital of Germany.
27919
27920 [[Foo]] '''bar'''
27921
27922 [[Boston]] is a city.
27923 !! end
27924
27925 !! test
27926 1. Table cells with escapable prefixes
27927 !! options
27928 parsoid={
27929 "modes": ["html2wt"],
27930 "scrubWikitext": false
27931 }
27932 !! html
27933 <table>
27934 <tr><td>a</td></tr>
27935 <tr><td>-</td></tr>
27936 <tr><td>+</td></tr>
27937 </table>
27938 !! wikitext
27939 {|
27940 |a
27941 |-
27942 |<nowiki>-</nowiki>
27943 |-
27944 |<nowiki>+</nowiki>
27945 |}
27946 !! end
27947
27948 !! test
27949 2. Table cells with escapable prefixes
27950 !! options
27951 parsoid={
27952 "modes": ["html2wt"],
27953 "scrubWikitext": true
27954 }
27955 !! html
27956 <table>
27957 <tr><td>a</td></tr>
27958 <tr><td>-</td></tr>
27959 <tr><td>+</td></tr>
27960 </table>
27961 !! wikitext
27962 {|
27963 |a
27964 |-
27965 | -
27966 |-
27967 | +
27968 |}
27969 !! end
27970
27971 !! test
27972 3a. Table cells with escapable prefixes after edits
27973 !! options
27974 parsoid={
27975 "modes": ["selser"],
27976 "scrubWikitext": true,
27977 "changes": [
27978 [ "table tbody tr:first-child td:first-child", "remove"]
27979 ]
27980 }
27981 !! wikitext
27982 {|
27983 |a||-
27984 |}
27985 !! wikitext/edited
27986 {|
27987 | -
27988 |}
27989 !! end
27990
27991 !! test
27992 3b. Table cells with escapable prefixes after edits
27993 !! options
27994 parsoid={
27995 "modes": ["selser"],
27996 "scrubWikitext": true,
27997 "changes": [
27998 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27999 [ "#x", "remove" ]
28000 ]
28001 }
28002 !! wikitext
28003 {|
28004 |pqr
28005 |<span id="x">foo</span>+
28006 |}
28007 !! wikitext/edited
28008 {|
28009 | -
28010 | +
28011 |}
28012 !! end
28013
28014 # FIXME: This test will fail because
28015 # normalization doesn't realize that the id attribute
28016 # will eliminate the escapable scenario
28017 !! test
28018 4a. Table cells without escapable prefixes after edits
28019 !! options
28020 parsoid={
28021 "modes": ["selser"],
28022 "scrubWikitext": true,
28023 "changes": [
28024 [ "#x", "html", "-" ]
28025 ]
28026 }
28027 !! wikitext
28028 {|
28029 | id="x" |abcd
28030 |}
28031 !! wikitext/edited
28032 {|
28033 | id="x" |-
28034 |}
28035 !! end
28036
28037 ## This tests normalizer's ability to discriminate between
28038 ## cells having identical content.
28039 !! test
28040 4b. Table cells without escapable prefixes after edits
28041 !! options
28042 parsoid={
28043 "modes": ["selser"],
28044 "scrubWikitext": true,
28045 "changes": [
28046 [ "td", "html", "-" ]
28047 ]
28048 }
28049 !! wikitext
28050 {|
28051 |a||b
28052 |}
28053 !! wikitext/edited
28054 {|
28055 | -||-
28056 |}
28057 !! end
28058
28059 ## This tests normalizer's ability to not be tripped by
28060 ## comments (and whitespace)
28061 !! test
28062 4c. Table cells without escapable prefixes after edits
28063 !! options
28064 parsoid={
28065 "modes": ["selser"],
28066 "scrubWikitext": true,
28067 "changes": [
28068 [ "table tbody tr td:first-child", "remove" ]
28069 ]
28070 }
28071 !! wikitext
28072 {|
28073 |-
28074 <!--foo--> |a||-
28075 |}
28076 !! wikitext/edited
28077 {|
28078 |-
28079 <!--foo--> | -
28080 |}
28081 !! end
28082
28083 ## This tests normalizer's ability to handle HTML cells
28084 !! test
28085 4d. Table cells without escapable prefixes after edits
28086 !! options
28087 parsoid={
28088 "modes": ["selser"],
28089 "scrubWikitext": true,
28090 "changes": [
28091 [ "td", "html", "-" ]
28092 ]
28093 }
28094 !! wikitext
28095 <table>
28096 <tr><td>a</td></tr>
28097 </table>
28098 !! wikitext/edited
28099 <table>
28100 <tr><td>-</td></tr>
28101 </table>
28102 !! end
28103
28104 ## T111151 Remove font elements without attributes
28105 !! test
28106 5a. font tags without attributes should be dropped in scrubWikitext mode
28107 !! options
28108 parsoid={
28109 "modes": ["html2wt"],
28110 "scrubWikitext": true
28111 }
28112 !! html
28113 <font>foo</font>
28114 <font><font>bar</font></font>
28115 <font class="x">boo</font>
28116 !! wikitext
28117 foo
28118 bar
28119 <font class="x">boo</font>
28120 !! end
28121
28122 !! test
28123 5b. font tags should not be dropped without scrubWikitext being enabled
28124 !! options
28125 parsoid={
28126 "modes": ["html2wt"],
28127 "scrubWikitext": false
28128 }
28129 !! html
28130 <font>foo</font>
28131 !! wikitext
28132 <font>foo</font>
28133 !! end
28134
28135 !! test
28136 Escape nowiki DOM elements
28137 !! options
28138 parsoid=html2wt
28139 !! html/parsoid
28140 <nowiki><i>foo</i></nowiki>
28141 !! wikitext
28142 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
28143 !! end
28144
28145 # This is meant to be an interim fix while we go about figuring out
28146 # how to not introduce these trailing <nowiki/>s in the first place.
28147 !! test
28148 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
28149 !! options
28150 parsoid=html2wt
28151 !! html/parsoid
28152 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
28153 y</p>
28154 <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>
28155 <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>
28156 !! wikitext
28157 x
28158 y
28159
28160 {{echo|
28161 1 = <nowiki/>}}
28162
28163 {{echo|
28164 1 = <nowiki/>
28165 }}
28166 !! end
28167
28168 # ---------------------------------------------------
28169 # End of tests spec'ing wikitext serialization norms |
28170 # ---------------------------------------------------
28171
28172 # T104032
28173 !! test
28174 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
28175 !! options
28176 parsoid=html2wt
28177 !! html/parsoid
28178 a<p>b</p>
28179 <b>c</b><p>d</p>
28180 <table><tr>
28181 <td>a<p>b</p></td>
28182 <td><b>c</b><p>d</p></td>
28183 </tr></table>
28184 !! wikitext
28185 a
28186
28187 b
28188
28189 '''c'''
28190
28191 d
28192 {|
28193 |a
28194 b
28195 |'''c'''
28196 d
28197 |}
28198 !! end
28199
28200 !! test
28201 Anchor without href scenarios
28202 !! options
28203 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28204 !! html/parsoid
28205 <a class="bc"></a>
28206 <a class="no">dice</a>
28207 <a name="foo"></a>
28208 !! wikitext
28209
28210 dice
28211 <span name="foo"></span>
28212 !! end
28213
28214 !! test
28215 New transclusion added after a list should be serialized after the list
28216 !! options
28217 parsoid=html2wt
28218 !! html/parsoid
28219 <ul><li>a</li></ul><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>
28220 !! wikitext
28221 * a
28222 {{echo|foo}}
28223 !! end
28224
28225 # -----------------------------------------------------------------
28226 # End of section for Parsoid-only html2wt tests for serialization
28227 # of new content
28228 # -----------------------------------------------------------------
28229
28230 # -----------------------------------------------------------------
28231 # The following section of tests are primarily to spec behavior of
28232 # the selective serializer. All these tests have manual selser
28233 # changes. The automated selser changes for all tests handle the
28234 # wide variation of changes, but these tests here capture specs
28235 # deterministically.
28236 # ----------------------------------------------------------------
28237
28238 ## T90517
28239 !! test
28240 Selser: New comments should not be lost
28241 !! options
28242 parsoid={
28243 "modes": ["selser"],
28244 "changes": [
28245 [ "#a", "after", "<!--c1-->" ],
28246 [ "#b", "before", "<!--c2-->" ]
28247 ]
28248 }
28249 !! wikitext
28250 <span id="a">a</span>
28251
28252 <span id="b">b</span>
28253 !! wikitext/edited
28254 <span id="a">a</span><!--c1-->
28255
28256 <!--c2--><span id="b">b</span>
28257 !! end
28258
28259 ## T89383
28260 !! test
28261 Selser: Check for validity of DSR before using it
28262 !! options
28263 parsoid={
28264 "modes": ["selser"],
28265 "changes": [
28266 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
28267 ]
28268 }
28269 !! wikitext
28270 <span id="a">a</span>
28271 !! wikitext/edited
28272 {{DISPLAYTITLE:foo}}
28273 <span id="a">a</span>
28274 !! end
28275
28276 !! test
28277 1. DOMDiff: Changes to <ref> content should be looked up using id
28278 !! options
28279 parsoid={
28280 "modes": ["selser"],
28281 "changes": [
28282 ["#X", "after", "bar"],
28283 ["#Y", "after", "baz"]
28284 ]
28285 }
28286 !! wikitext
28287 X <ref><span id="X">foo</span></ref>
28288 Y <ref name="a" />
28289 <references>
28290 <ref name="a"><span id="Y">foo</span></ref>
28291 </references>
28292 !! wikitext/edited
28293 X <ref><span id="X">foo</span>bar</ref>
28294 Y <ref name="a" />
28295 <references>
28296 <ref name="a"><span id="Y">foo</span>baz</ref>
28297 </references>
28298 !! end
28299
28300 !! test
28301 2. DOMDiff: Changes to <ref> content should be looked up using id
28302 !! options
28303 parsoid={
28304 "modes": ["selser"],
28305 "changes": [
28306 ["#Z", "after", "bar"]
28307 ]
28308 }
28309 !! wikitext
28310 A <ref>foo bar for a</ref>
28311 B <ref group="X" name="b" />
28312
28313 <references />
28314
28315 <references group="X">
28316 <ref name="b"><span id="Z">foo</span></ref>
28317 </references>
28318 !! wikitext/edited
28319 A <ref>foo bar for a</ref>
28320 B <ref group="X" name="b" />
28321
28322 <references />
28323
28324 <references group="X">
28325 <ref name="b"><span id="Z">foo</span>bar</ref>
28326 </references>
28327 !! end
28328
28329 !! test
28330 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
28331 !! options
28332 parsoid={
28333 "modes": ["selser"],
28334 "changes": [
28335 [ "div:first-child", "text", "bar" ]
28336 ]
28337 }
28338 !! wikitext
28339 <div style="{{1x|color:red;}}%">foo</div>
28340 !! wikitext/edited
28341 <div style="{{1x|color:red;}}%">bar</div>
28342 !! end
28343
28344 !! test
28345 Empty LI (T49673)
28346 !! wikitext
28347 * a
28348 *
28349 *
28350 * b
28351 !! html/php+tidy
28352 <ul>
28353 <li>a</li>
28354 <li class="mw-empty-elt"></li>
28355 <li class="mw-empty-elt"></li>
28356 <li>b</li>
28357 </ul>
28358 !! end
28359
28360 !! test
28361 Thumbnail output
28362 !! wikitext
28363 [[File:Thumb.png|thumb]]
28364 !! html/php+tidy
28365 <div class="thumb tright">
28366 <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>
28367 <div class="thumbcaption">
28368 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
28369 </div>
28370 </div>
28371 </div>
28372 !! end
28373
28374 !! test
28375 unclosed internal link XSS (T137264)
28376 !! wikitext
28377 [[#%3Cscript%3Ealert(1)%3C/script%3E|
28378 !! html/php
28379 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
28380 </p>
28381 !! html/parsoid
28382 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
28383 !! end
28384
28385 !! test
28386 Validating that <style> isn't eaten by tidy (T167349)
28387 !! options
28388 # Use $wgRawHtml to inject a <style> tag, since you normally can't in wikitext
28389 wgRawHtml=1
28390 !! wikitext
28391 <div class="foo">
28392 <html><style>.foo::before { content: "<foo>"; }</style></html>
28393 <html><style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style></html>
28394 </div>
28395 !! html+tidy
28396 <div class="foo">
28397 <style>.foo::before { content: "<foo>"; }</style>
28398 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
28399 </div>
28400 !! end
28401
28402 !! test
28403 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
28404 !! wikitext
28405 == A&B&amp;C&amp;amp;D&amp;amp;amp;E ==
28406 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
28407 !! html/php
28408 <h2><span class="mw-headline" id="A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</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&amp;B&amp;C&amp;amp;D&amp;amp;amp;E">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
28409 <p><a href="#A.26B.26C.26D.26amp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
28410 </p>
28411 !! end
28412
28413 !! test
28414 Decoding of HTML entities in indicator names for IDs (T104196)
28415 !! options
28416 showindicators
28417 !! wikitext
28418 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
28419 !! html/php
28420 1&2&3&amp;4&amp;amp;5=Indicator
28421
28422 !! end
28423
28424 !! test
28425 HTML5 ids: fallback to legacy
28426 !! config
28427 wgFragmentMode=[ 'html5', 'legacy' ]
28428 !! wikitext
28429 == Foo bar ==
28430
28431 == foo Bar ==
28432
28433 == Тест ==
28434
28435 == Тест ==
28436
28437 == тест ==
28438
28439 == Hey < # " > % : ' ==
28440 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
28441
28442 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
28443
28444 <!-- These two links should produce identical HTML -->
28445 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
28446
28447 !! html/php
28448 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
28449 <ul>
28450 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
28451 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
28452 <li class="toclevel-1 tocsection-3"><a href="#%D0%A2%D0%B5%D1%81%D1%82"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
28453 <li class="toclevel-1 tocsection-4"><a href="#%D0%A2%D0%B5%D1%81%D1%82_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
28454 <li class="toclevel-1 tocsection-5"><a href="#%D1%82%D0%B5%D1%81%D1%82"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
28455 <li class="toclevel-1 tocsection-6"><a href="#Hey_%3C_%23_%22_%3E_%25_:_%27"><span class="tocnumber">6</span> <span class="toctext">Hey &lt; # " &gt;&#160;%&#160;: '</span></a></li>
28456 </ul>
28457 </div>
28458
28459 <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>
28460 <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>
28461 <div id=".D0.A2.D0.B5.D1.81.D1.82"></div><h2><span class="mw-headline" id="Тест">Тест</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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
28462 <div id=".D0.A2.D0.B5.D1.81.D1.82_2"></div><h2><span class="mw-headline" id="Тест_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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
28463 <div id=".D1.82.D0.B5.D1.81.D1.82"></div><h2><span class="mw-headline" id="тест">тест</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: тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
28464 <div id="Hey_.3C_.23_.22_.3E_.25_:_.27"></div><h2><span class="mw-headline" id="Hey_&lt;_#_&quot;_&gt;_%_:_'">Hey &lt; # " &gt;&#160;%&#160;: '</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: Hey &lt; # &quot; &gt; % : '">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
28465 <p><a href="#Foo_bar">#Foo bar</a> <a href="#foo_Bar">#foo Bar</a> <a href="#%D0%A2%D0%B5%D1%81%D1%82">#Тест</a> <a href="#%D1%82%D0%B5%D1%81%D1%82">#тест</a> <a href="#Hey_%3C_%23_%22_%3E_%25_:_%27">#Hey &lt; # " &gt;&#160;%&#160;: '</a>
28466 </p><p>%F0%9F%92%A9 <span id="%F0%9F%92%A9"></span>
28467 </p><p><a href="#%E5%95%A4%E9%85%92">#啤酒</a> <a href="#%E5%95%A4%E9%85%92">#啤酒</a>
28468 </p>
28469 !! end
28470
28471 !! test
28472 HTML5 ids: legacy with a fallback to modern
28473 !! config
28474 wgFragmentMode=[ 'legacy', 'html5' ]
28475 !! wikitext
28476 == Foo bar ==
28477
28478 == foo Bar ==
28479
28480 == Тест ==
28481
28482 == Тест ==
28483
28484 == тест ==
28485
28486 == Hey < # " > % : ' ==
28487 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
28488
28489 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
28490
28491 <!-- These two links should produce identical HTML -->
28492 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
28493
28494 !! html/php
28495 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
28496 <ul>
28497 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
28498 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
28499 <li class="toclevel-1 tocsection-3"><a href="#.D0.A2.D0.B5.D1.81.D1.82"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
28500 <li class="toclevel-1 tocsection-4"><a href="#.D0.A2.D0.B5.D1.81.D1.82_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
28501 <li class="toclevel-1 tocsection-5"><a href="#.D1.82.D0.B5.D1.81.D1.82"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
28502 <li class="toclevel-1 tocsection-6"><a href="#Hey_.3C_.23_.22_.3E_.25_:_.27"><span class="tocnumber">6</span> <span class="toctext">Hey &lt; # " &gt;&#160;%&#160;: '</span></a></li>
28503 </ul>
28504 </div>
28505
28506 <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>
28507 <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>
28508 <div id="Тест"></div><h2><span class="mw-headline" id=".D0.A2.D0.B5.D1.81.D1.82">Тест</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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
28509 <div id="Тест_2"></div><h2><span class="mw-headline" id=".D0.A2.D0.B5.D1.81.D1.82_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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
28510 <div id="тест"></div><h2><span class="mw-headline" id=".D1.82.D0.B5.D1.81.D1.82">тест</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: тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
28511 <div id="Hey_&lt;_#_&quot;_&gt;_%_:_'"></div><h2><span class="mw-headline" id="Hey_.3C_.23_.22_.3E_.25_:_.27">Hey &lt; # " &gt;&#160;%&#160;: '</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: Hey &lt; # &quot; &gt; % : '">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
28512 <p><a href="#Foo_bar">#Foo bar</a> <a href="#foo_Bar">#foo Bar</a> <a href="#.D0.A2.D0.B5.D1.81.D1.82">#Тест</a> <a href="#.D1.82.D0.B5.D1.81.D1.82">#тест</a> <a href="#Hey_.3C_.23_.22_.3E_.25_:_.27">#Hey &lt; # " &gt;&#160;%&#160;: '</a>
28513 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
28514 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
28515 </p>
28516 !! end
28517
28518 !! test
28519 HTML5 ids: no legacy
28520 !! config
28521 wgFragmentMode=[ 'html5' ]
28522 !! wikitext
28523 == Foo bar ==
28524
28525 == foo Bar ==
28526
28527 == Тест ==
28528
28529 == Тест ==
28530
28531 == тест ==
28532
28533 == Hey < # " > % : ' ==
28534 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
28535
28536 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
28537
28538 <!-- These two links should produce identical HTML -->
28539 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
28540
28541 !! html/php
28542 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
28543 <ul>
28544 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
28545 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
28546 <li class="toclevel-1 tocsection-3"><a href="#%D0%A2%D0%B5%D1%81%D1%82"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
28547 <li class="toclevel-1 tocsection-4"><a href="#%D0%A2%D0%B5%D1%81%D1%82_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
28548 <li class="toclevel-1 tocsection-5"><a href="#%D1%82%D0%B5%D1%81%D1%82"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
28549 <li class="toclevel-1 tocsection-6"><a href="#Hey_%3C_%23_%22_%3E_%25_:_%27"><span class="tocnumber">6</span> <span class="toctext">Hey &lt; # " &gt;&#160;%&#160;: '</span></a></li>
28550 </ul>
28551 </div>
28552
28553 <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>
28554 <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>
28555 <h2><span class="mw-headline" id="Тест">Тест</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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
28556 <h2><span class="mw-headline" id="Тест_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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
28557 <h2><span class="mw-headline" id="тест">тест</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: тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
28558 <h2><span class="mw-headline" id="Hey_&lt;_#_&quot;_&gt;_%_:_'">Hey &lt; # " &gt;&#160;%&#160;: '</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: Hey &lt; # &quot; &gt; % : '">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
28559 <p><a href="#Foo_bar">#Foo bar</a> <a href="#foo_Bar">#foo Bar</a> <a href="#%D0%A2%D0%B5%D1%81%D1%82">#Тест</a> <a href="#%D1%82%D0%B5%D1%81%D1%82">#тест</a> <a href="#Hey_%3C_%23_%22_%3E_%25_:_%27">#Hey &lt; # " &gt;&#160;%&#160;: '</a>
28560 </p><p>%F0%9F%92%A9 <span id="%F0%9F%92%A9"></span>
28561 </p><p><a href="#%E5%95%A4%E9%85%92">#啤酒</a> <a href="#%E5%95%A4%E9%85%92">#啤酒</a>
28562 </p>
28563 !! end