b6f283056c54702cc856f3c8b8068ae1acaf7680
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from https://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 #
36 # You can also set the following parser properties via test options:
37 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
38 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
39 # wgEnableMagicLinks
40 #
41 # For testing purposes, temporary articles can created:
42 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
43 # where '/' denotes a newline.
44
45 # This is the standard article assumed to exist.
46 !! article
47 Main Page
48 !! text
49 blah blah
50 !! endarticle
51
52 !!article
53 Foo
54 !!text
55 FOO
56 !!endarticle
57
58 !!article
59 Template:Foo
60 !!text
61 FOO
62 !!endarticle
63
64 !! article
65 Template:Blank
66 !! text
67 !! endarticle
68
69 !! article
70 Template:pipe
71 !! text
72 |
73 !! endarticle
74
75 !! article
76 Template:=
77 !! text
78 <nowiki>=</nowiki>
79 !! endarticle
80
81 !!article
82 MediaWiki:bad image list
83 !!text
84 * [[File:Bad.jpg]] except [[Nasty page]]
85 !!endarticle
86
87 !! article
88 Template:inner list
89 !! text
90 * item 1
91 !! endarticle
92
93 !! article
94 Template:tbl-start
95 !! text
96 {|
97 !! endarticle
98
99 !! article
100 Template:tbl-end
101 !! text
102 |}
103 !! endarticle
104
105 !! article
106 Template:echo
107 !! text
108 {{{1}}}
109 !! endarticle
110
111 !! article
112 Template:echo_with_span
113 !! text
114 <span>{{{1}}}</span>
115 !! endarticle
116
117 !! article
118 Template:echo_with_div
119 !! text
120 <div>{{{1}}}</div>
121 !! endarticle
122
123 !! article
124 Template:blank_param
125 !! text
126 {{{1}}}
127 {{{}}}
128 !! endarticle
129
130 !! article
131 Template:table_attribs
132 !! text
133 <noinclude>
134 |</noinclude>style="color:red;"|Foo
135 !! endarticle
136
137 !! article
138 Template:table_attribs_2
139 !! text
140 <noinclude>
141 |</noinclude>style="color:red;"|Foo
142 |Bar||Baz
143 !! endarticle
144
145 !! article
146 Template:table_attribs_3
147 !! text
148 <noinclude>
149 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
150 !! endarticle
151
152 !! article
153 Template:table_attribs_4
154 !! text
155 | style="background-color:#DC241f;" width="10px" |
156 !! endarticle
157
158 !! article
159 Template:table_attribs_5
160 !! text
161 <noinclude>
162 |</noinclude>style="color:red;"||Bar
163 !! endarticle
164
165 !! article
166 Template:table_attribs_6
167 !! text
168 style="background: <nowiki>
169
170
171 red;</nowiki>" |
172 !! endarticle
173
174 !! article
175 Template:table_attribs_7
176 !! text
177 <noinclude>
178 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
179 !! endarticle
180
181 !! article
182 Template:table_header_cells
183 !! text
184 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
185 !! endarticle
186
187 !! article
188 Template:table_cells
189 !! text
190 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
191 !! endarticle
192
193 !! article
194 Template:PartialTable
195 !! text
196 {|
197 |-
198 !! endarticle
199
200 !! article
201 Template:image_attribs
202 !! text
203 <noinclude>
204 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
205 !! endarticle
206
207 ## See T48811 for details
208 !! article
209 Template:mixed_attr_content_template
210 !! text
211 style="color:red;" title="T48811"
212 |-
213 |foo
214 !! endarticle
215
216 !! article
217 Template:definition_list
218 !! text
219 one
220 ::two
221 !! endarticle
222
223 !! article
224 A?b
225 !! text
226 Weirdo titles!
227 !! endarticle
228
229 !!article
230 Template:Bullet
231 !!text
232 * Bar
233 !!endarticle
234
235 !!article
236 Template:OpenTable
237 !!text
238 {|
239 !!endarticle
240
241 !!article
242 Template:EmptyLITest
243 !!text
244 *a
245 *
246 *
247 *b
248 !!endarticle
249
250 !!article
251 Template:EmptyTRTest
252 !!text
253 {|
254 |-
255 |-
256 |foo
257 |-
258 |-
259 |bar
260 |}
261 !!endarticle
262
263 !!article
264 Template:EmptyTRWithHTMLAttrTest
265 !!text
266 <table>
267 <tr align="center"></tr>
268 <tr><td>foo</td></tr>
269 <tr align="center"></tr>
270 <tr><td>bar</td></tr>
271 </table>
272 !!endarticle
273
274 !! article
275 Template:CircularRef
276 !! text
277 <ref>{{CircularRef}}</ref>
278 !! endarticle
279
280 ###
281 ### Basic tests
282 ###
283 !! test
284 Blank input
285 !! wikitext
286 !! html
287 !! end
288
289 !! test
290 CircularRef
291 !! wikitext
292 {{CircularRef}}
293 <references />
294 !! html/parsoid
295 <p><span about="#mwt1" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"CircularRef","href":"./Template:CircularRef"},"params":{},"i":0}}]}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
296 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">Error: Expansion loop detected at <a data-parsoid='{"a":{"href":null},"sa":{"href":"Template:CircularRef"}}'>Template:CircularRef</a></span></li></ol>
297 !! end
298
299 !! test
300 Simple paragraph
301 !! wikitext
302 This is a simple paragraph.
303 !! html
304 <p>This is a simple paragraph.
305 </p>
306 !! end
307
308 !! test
309 Paragraphs with extra newline spacing
310 !! wikitext
311 foo
312
313 bar
314
315
316 baz
317
318
319
320 booz
321 !! html
322 <p>foo
323 </p><p>bar
324 </p><p><br />
325 baz
326 </p><p><br />
327 </p><p>booz
328 </p>
329 !! end
330
331 !! test
332 Paragraphs with newline spacing with comment lines in between
333 !! wikitext
334 ----
335 a
336 <!--foo-->
337 b
338 ----
339 a
340 <!--foo--><!--More than 1 comment, still stripped-->
341 b
342 ----
343 a
344 <!--foo--> <!----> <!-- bar -->
345 b
346 ----
347 a
348 <!--foo-->
349
350 b
351 ----
352 a
353
354 <!--foo-->
355 b
356 ----
357 a
358 <!--foo-->
359
360
361 b
362 ----
363 a
364
365
366 <!--foo-->
367 b
368 ----
369 !! html
370 <hr />
371 <p>a
372 b
373 </p>
374 <hr />
375 <p>a
376 b
377 </p>
378 <hr />
379 <p>a
380 b
381 </p>
382 <hr />
383 <p>a
384 </p><p>b
385 </p>
386 <hr />
387 <p>a
388 </p><p>b
389 </p>
390 <hr />
391 <p>a
392 </p><p><br />
393 b
394 </p>
395 <hr />
396 <p>a
397 </p><p><br />
398 b
399 </p>
400 <hr />
401
402 !! end
403
404 !! test
405 Paragraphs with newline spacing with non-empty white-space lines in between
406 !! wikitext
407 ----
408 a
409
410 b
411 ----
412 a
413
414
415 b
416 ----
417 !! html
418 <hr />
419 <p>a
420 </p><p>b
421 </p>
422 <hr />
423 <p>a
424 </p><p><br />
425 b
426 </p>
427 <hr />
428
429 !! end
430
431 !! test
432 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
433 !! wikitext
434 ----
435 a
436 <!--foo-->
437 b
438 ----
439 a
440 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
441 b
442 ----
443 a
444
445 <!--foo-->
446 <!--bar-->
447 b
448 ----
449 a
450
451 <!--foo-->
452 <!--bar-->
453
454 b
455 ----
456 !! html
457 <hr />
458 <p>a
459 b
460 </p>
461 <hr />
462 <p>a
463 b
464 </p>
465 <hr />
466 <p>a
467 </p><p>b
468 </p>
469 <hr />
470 <p>a
471 </p><p><br />
472 b
473 </p>
474 <hr />
475
476 !! end
477
478 !! test
479 Extra newlines: More paragraphs with indented comment
480 !! wikitext
481 a
482
483 <!--boo-->
484
485 b
486 !! html
487 <p>a
488 </p><p><br />
489 b
490 </p>
491 !!end
492
493 !! test
494 Extra newlines followed by heading
495 !! wikitext
496 a
497
498
499
500 =b=
501 [[a]]
502
503
504 =b=
505 !! html
506 <p>a
507 </p><p><br />
508 </p>
509 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
510 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
511 </p><p><br />
512 </p>
513 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
514
515 !! end
516
517 !! test
518 Extra newlines between heading and content are swallowed
519 !! wikitext
520 =b=
521
522
523
524 [[a]]
525 !! html
526 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
527 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
528 </p>
529 !! end
530
531 !! test
532 Heading with line break in nowiki
533 !! wikitext
534 == A <nowiki>B
535 C</nowiki> ==
536 !! html
537 <h2><span class="mw-headline" id="A_B.0AC">A B
538 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>
539
540 !! end
541
542 !! test
543 Parsing an URL
544 !! wikitext
545 http://fr.wikipedia.org/wiki/🍺
546 <!-- EasterEgg we love beer, better be able be able to link to it -->
547 !! html
548 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
549 </p>
550 !! end
551
552 # Note that the html+tidy output removes the spaces after the <li>,
553 # which is a bug (https://sourceforge.net/p/tidy/bugs/945/, etc).
554 # This is an issue for all tests with lists. We intentionally do
555 # *not* add html+tidy clauses for these, as we don't want to
556 # document/test the broken behavior. (Parsoid matches the non-tidy
557 # output in these cases.)
558
559 !! test
560 Simple list
561 !! wikitext
562 * Item 1
563 * Item 2
564 !! html
565 <ul><li> Item 1</li>
566 <li> Item 2</li></ul>
567
568 !! end
569
570 !! test
571 Italics and bold
572 !! wikitext
573 * plain
574 * plain''italic''plain
575 * plain''italic''plain''italic''plain
576 * plain'''bold'''plain
577 * plain'''bold'''plain'''bold'''plain
578 * plain''italic''plain'''bold'''plain
579 * plain'''bold'''plain''italic''plain
580 * plain''italic'''bold-italic'''italic''plain
581 * plain'''bold''bold-italic''bold'''plain
582 * plain'''''bold-italic'''italic''plain
583 * plain'''''bold-italic''bold'''plain
584 * plain''italic'''bold-italic'''''plain
585 * plain'''bold''bold-italic'''''plain
586 * plain l'''italic''plain
587 * plain l''''bold''' plain
588 !! html
589 <ul><li> plain</li>
590 <li> plain<i>italic</i>plain</li>
591 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
592 <li> plain<b>bold</b>plain</li>
593 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
594 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
595 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
596 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
597 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
598 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
599 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
600 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
601 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
602 <li> plain l'<i>italic</i>plain</li>
603 <li> plain l'<b>bold</b> plain</li></ul>
604
605 !! end
606
607 # this example taken from the [[simple:Moon]] article (bug 47326)
608 !! test
609 Italics and possessives (1)
610 !! wikitext
611 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
612 !! html
613 <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
614 </p>
615 !! end
616
617 # this example taken from [[en:Flaming Pie]] (bug 49926)
618 !! test
619 Italics and possessives (2)
620 !! wikitext
621 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
622 !! html
623 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
624 </p>
625 !! end
626
627 # this example taken from [[en:Dictionary]] (bug 49926)
628 !! test
629 Italics and possessives (3)
630 !! wikitext
631 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''.
632 !! html
633 <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>.
634 </p>
635 !! end
636
637
638 ###
639 ### 2-quote opening sequence tests
640 ###
641 !! test
642 Italics and bold: 2-quote opening sequence: (2,2)
643 !! wikitext
644 ''foo''
645 !! html
646 <p><i>foo</i>
647 </p>
648 !!end
649
650 !! test
651 Italics and bold: 2-quote opening sequence: (2,3)
652 !! wikitext
653 ''foo'''
654 !! html/*
655 <p><i>foo'</i>
656 </p>
657 !!end
658
659 !! test
660 Italics and bold: 2-quote opening sequence: (2,4)
661 !! options
662 parsoid=wt2html
663 !! wikitext
664 ''foo''''
665 !! html/*
666 <p><i>foo''</i>
667 </p>
668 !!end
669
670 # same html as previous, but wikitext adjusted to match parsoid html2wt
671 !! test
672 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
673 !! wikitext
674 ''foo<nowiki>''</nowiki>''
675 !! html
676 <p><i>foo''</i>
677 </p>
678 !! end
679
680 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
681 !! test
682 Italics and bold: 2-quote opening sequence: (2,5)
683 !! options
684 parsoid=wt2html
685 !! wikitext
686 ''foo'''''
687 !! html/php
688 <p><i>foo</i>
689 </p>
690 !! html/parsoid
691 <p><i>foo</i><b></b>
692 </p>
693 !!end
694
695 # same html as previous, but wikitext adjusted to match parsoid html2wt
696 !! test
697 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
698 !! wikitext
699 ''foo'''''<nowiki/>'''
700 !! html/php
701 <p><i>foo</i>
702 </p>
703 !! html/parsoid
704 <p><i>foo</i><b></b>
705 </p>
706 !! end
707
708
709 ###
710 ### 3-quote opening sequence tests
711 ###
712
713 !! test
714 Italics and bold: 3-quote opening sequence: (3,2)
715 !! wikitext
716 '''foo''
717 !! html/*
718 <p>'<i>foo</i>
719 </p>
720 !!end
721
722 !! test
723 Italics and bold: 3-quote opening sequence: (3,3)
724 !! wikitext
725 '''foo'''
726 !! html
727 <p><b>foo</b>
728 </p>
729 !!end
730
731 !! test
732 Italics and bold: 3-quote opening sequence: (3,4)
733 !! wikitext
734 '''foo''''
735 !! html/*
736 <p><b>foo'</b>
737 </p>
738 !!end
739
740 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
741 !! test
742 Italics and bold: 3-quote opening sequence: (3,5)
743 !! options
744 parsoid=wt2html
745 !! wikitext
746 '''foo'''''
747 !! html/php
748 <p><b>foo</b>
749 </p>
750 !! html/parsoid
751 <p><b>foo</b><i></i>
752 </p>
753 !!end
754
755 # same html as previous, but wikitext adjusted to match parsoid html2wt
756 !! test
757 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
758 !! wikitext
759 '''foo'''''<nowiki/>''
760 !! html/php
761 <p><b>foo</b>
762 </p>
763 !! html/parsoid
764 <p><b>foo</b><i></i>
765 </p>
766 !! end
767
768
769 ###
770 ### 4-quote opening sequence tests
771 ###
772
773 !! test
774 Italics and bold: 4-quote opening sequence: (4,2)
775 !! options
776 parsoid=wt2html
777 !! wikitext
778 ''''foo''
779 !! html/*
780 <p>''<i>foo</i>
781 </p>
782 !!end
783
784 # same html as previous, but wikitext adjusted to match parsoid html2wt
785 !! test
786 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
787 !! wikitext
788 <nowiki>''</nowiki>''foo''
789 !! html
790 <p>''<i>foo</i>
791 </p>
792 !! end
793
794 !! test
795 Italics and bold: 4-quote opening sequence: (4,3)
796 !! wikitext
797 ''''foo'''
798 !! html/*
799 <p>'<b>foo</b>
800 </p>
801 !!end
802
803 !! test
804 Italics and bold: 4-quote opening sequence: (4,4)
805 !! options
806 parsoid=wt2html
807 !! wikitext
808 ''''foo''''
809 !! html/*
810 <p>'<b>foo'</b>
811 </p>
812 !!end
813
814 # same html as previous, but wikitext adjusted to match parsoid html2wt
815 !! test
816 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
817 !! wikitext
818 '<nowiki/>'''foo''''
819 !! html
820 <p>'<b>foo'</b>
821 </p>
822 !! end
823
824 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
825 !! test
826 Italics and bold: 4-quote opening sequence: (4,5)
827 !! options
828 parsoid=wt2html
829 !! wikitext
830 ''''foo'''''
831 !! html/php
832 <p>'<b>foo</b>
833 </p>
834 !! html/parsoid
835 <p>'<b>foo</b><i></i>
836 </p>
837 !!end
838
839 # same html as previous, but wikitext adjusted to match parsoid html2wt
840 !! test
841 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
842 !! wikitext
843 '<nowiki/>'''foo'''''<nowiki/>''
844 !! html/php
845 <p>'<b>foo</b>
846 </p>
847 !! html/parsoid
848 <p>'<b>foo</b><i></i>
849 </p>
850 !! end
851
852
853 ###
854 ### 5-quote opening sequence tests
855 ###
856
857 !! test
858 Italics and bold: 5-quote opening sequence: (5,2)
859 !! options
860 parsoid=wt2html
861 !! wikitext
862 '''''foo''
863 !! html/*
864 <p><b><i>foo</i></b>
865 </p>
866 !!end
867
868 # same html as previous, but wikitext adjusted to match parsoid html2wt
869 !! test
870 Italics and bold: 5-quote opening sequence: (5,2+3)
871 !! wikitext
872 '''''foo'''''
873 !! html/*
874 <p><i><b>foo</b></i>
875 </p>
876 !! end
877
878 !! test
879 Italics and bold: 5-quote opening sequence: (5,3)
880 !! options
881 parsoid=wt2html
882 !! wikitext
883 '''''foo'''
884 !! html/*
885 <p><i><b>foo</b></i>
886 </p>
887 !!end
888
889 # same html as previous, but wikitext adjusted to match parsoid html2wt
890 !! test
891 Italics and bold: 5-quote opening sequence: (5,3+2)
892 !! wikitext
893 '''''foo'''''
894 !! html
895 <p><i><b>foo</b></i>
896 </p>
897 !! end
898
899 !! test
900 Italics and bold: 5-quote opening sequence: (5,4)
901 !! options
902 parsoid=wt2html
903 !! wikitext
904 '''''foo''''
905 !! html/*
906 <p><i><b>foo'</b></i>
907 </p>
908 !!end
909
910 !! test
911 Italics and bold: 5-quote opening sequence: (5,5)
912 !! wikitext
913 '''''foo'''''
914 !! html
915 <p><i><b>foo</b></i>
916 </p>
917 !!end
918
919 !! test
920 Italics and bold: 5-quote opening sequence: (5,6)
921 !! wikitext
922 '''''foo''''''
923 !! html/*
924 <p><i><b>foo'</b></i>
925 </p>
926 !! end
927
928 ###
929 ### multiple quote sequences in a line
930 ###
931 !! test
932 Italics and bold: multiple quote sequences: (2,4,2)
933 !! options
934 parsoid=wt2html
935 !! wikitext
936 ''foo''''bar''
937 !! html/*
938 <p><i>foo'<b>bar</b></i>
939 </p>
940 !!end
941
942
943 # same html as previous, but wikitext adjusted to match parsoid html2wt
944 !! test
945 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
946 !! wikitext
947 ''foo'<nowiki/>'''bar'''''
948 !! html
949 <p><i>foo'<b>bar</b></i>
950 </p>
951 !! end
952
953
954 !! test
955 Italics and bold: multiple quote sequences: (2,4,3)
956 !! options
957 parsoid=wt2html
958 !! wikitext
959 ''foo''''bar'''
960 !! html/*
961 <p><i>foo'<b>bar</b></i>
962 </p>
963 !!end
964
965
966 # same html as previous, but wikitext adjusted to match parsoid html2wt
967 !! test
968 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
969 !! wikitext
970 ''foo'<nowiki/>'''bar'''''
971 !! html
972 <p><i>foo'<b>bar</b></i>
973 </p>
974 !! end
975
976
977 !! test
978 Italics and bold: multiple quote sequences: (2,4,4)
979 !! options
980 parsoid=wt2html
981 !! wikitext
982 ''foo''''bar''''
983 !! html/*
984 <p><i>foo'<b>bar'</b></i>
985 </p>
986 !!end
987
988
989 # same html as previous, but wikitext adjusted to match parsoid html2wt
990 !! test
991 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
992 !! wikitext
993 ''foo'<nowiki/>'''bar'<nowiki/>'''''
994 !! html
995 <p><i>foo'<b>bar'</b></i>
996 </p>
997 !! end
998
999
1000 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1001 !! test
1002 Italics and bold: multiple quote sequences: (3,4,2)
1003 !! options
1004 parsoid=wt2html
1005 !! wikitext
1006 '''foo''''bar''
1007 !! html/php
1008 <p><b>foo'</b>bar
1009 </p>
1010 !! html/parsoid
1011 <p><b>foo'</b>bar<i></i>
1012 </p>
1013 !!end
1014
1015 # same html as previous, but wikitext adjusted to match parsoid html2wt
1016 !! test
1017 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1018 !! options
1019 parsoid
1020 !! wikitext
1021 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
1022 !! html/php
1023 <p><b>foo'</b>bar
1024 </p>
1025 !! html/parsoid
1026 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1027 </p>
1028 !! end
1029
1030
1031 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1032 !! test
1033 Italics and bold: multiple quote sequences: (3,4,3)
1034 !! options
1035 parsoid=wt2html
1036 !! wikitext
1037 '''foo''''bar'''
1038 !! html/php
1039 <p><b>foo'</b>bar
1040 </p>
1041 !! html/parsoid
1042 <p><b>foo'</b>bar<b></b>
1043 </p>
1044 !!end
1045
1046 # same html as previous, but wikitext adjusted to match parsoid html2wt
1047 !! test
1048 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1049 !! wikitext
1050 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1051 !! html/php
1052 <p><b>foo'</b>bar
1053 </p>
1054 !! html/parsoid
1055 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1056 </p>
1057 !! end
1058
1059 ###
1060 ### other quote tests
1061 ###
1062 !! test
1063 Italics and bold: other quote tests: (2,3,5)
1064 !! wikitext
1065 ''this is about '''foo's family'''''
1066 !! html
1067 <p><i>this is about <b>foo's family</b></i>
1068 </p>
1069 !!end
1070
1071
1072 !! test
1073 Italics and bold: other quote tests: (2,(3,3),2)
1074 !! wikitext
1075 ''this is about '''foo's''' family''
1076 !! html
1077 <p><i>this is about <b>foo's</b> family</i>
1078 </p>
1079 !!end
1080
1081
1082 !! test
1083 Italics and bold: other quote tests: (3,2,3,2)
1084 !! options
1085 parsoid=wt2html
1086 !! wikitext
1087 '''this is about ''foo'''s family''
1088 !! html/*
1089 <p><b>this is about <i>foo</i></b><i>s family</i>
1090 </p>
1091 !!end
1092
1093
1094 # same html as previous, but wikitext adjusted to match parsoid html2wt
1095 !! test
1096 Italics and bold: other quote tests: (3,2,3+2+2,2)
1097 !! wikitext
1098 '''this is about ''foo'''''<nowiki/>''s family''
1099 !! html
1100 <p><b>this is about <i>foo</i></b><i>s family</i>
1101 </p>
1102 !! end
1103
1104
1105 !! test
1106 Italics and bold: other quote tests: (3,2,3,3)
1107 !! wikitext
1108 '''this is about ''foo'''s family'''
1109 !! html/*
1110 <p>'<i>this is about </i>foo<b>s family</b>
1111 </p>
1112 !!end
1113
1114
1115 !! test
1116 Italics and bold: other quote tests: (3,(2,2),3)
1117 !! wikitext
1118 '''this is about ''foo's'' family'''
1119 !! html
1120 <p><b>this is about <i>foo's</i> family</b>
1121 </p>
1122 !!end
1123
1124
1125 !! test
1126 Italicized possessive
1127 !! wikitext
1128 The ''[[Main Page]]'''s talk page.
1129 !! html/php
1130 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1131 </p>
1132 !! html/parsoid
1133 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1134 !! end
1135
1136 !! test
1137 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1138 (Requires tidy for PHP parser output to be fixed up)
1139 !! options
1140 parsoid=wt2html,wt2wt
1141 !! wikitext
1142 {|
1143 !''a!!''b
1144 |''a||''b
1145 |}
1146 !! html/php+tidy
1147 <table>
1148 <tr>
1149 <th><i>a</i></th>
1150 <th><i>b</i></th>
1151 <td><i>a</i></td>
1152 <td><i>b</i></td>
1153 </tr>
1154 </table>
1155 !! html/parsoid
1156 <table>
1157 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1158 <td><i>a</i></td><td><i>b</i></td></tr>
1159 </tbody></table>
1160 !! end
1161
1162 ###
1163 ### Non-html5 tags
1164 ###
1165
1166 !! test
1167 Non-html5 tags should be accepted
1168 !! wikitext
1169 <center>''foo''</center>
1170 <big>''foo''</big>
1171 <font>''foo''</font>
1172 <strike>''foo''</strike>
1173 <tt>''foo''</tt>
1174 !! html
1175 <center><i>foo</i></center>
1176 <p><big><i>foo</i></big>
1177 <font><i>foo</i></font>
1178 <strike><i>foo</i></strike>
1179 <tt><i>foo</i></tt>
1180 </p>
1181 !! end
1182
1183 !! test
1184 <wbr> is valid wikitext (bug 52468)
1185 !! wikitext
1186 <wbr>
1187 !! html
1188 <p><wbr />
1189 </p>
1190 !! end
1191
1192 # <strike> is HTML4, <s> is HTML4/5.
1193 !! test
1194 <s> or <strike> for strikethrough
1195 !! wikitext
1196 <strike>strike</strike>
1197
1198 <s>s</s>
1199 !! html
1200 <p><strike>strike</strike>
1201 </p><p><s>s</s>
1202 </p>
1203 !! end
1204
1205 ## a not permitted
1206 ## i,b,br omitted
1207 !! test
1208 Text-level semantic html elements in wikitext
1209 !! wikitext
1210 <em>text</em>
1211 <strong>text</strong>
1212 <small>text</small>
1213 <s>text</s>
1214 <cite>text</cite>
1215 <q>text</q>
1216 <dfn>text</dfn>
1217 <abbr>text</abbr>
1218 <data>text</data>
1219 <time>text</time>
1220 <code>text</code>
1221 <var>text</var>
1222 <samp>text</samp>
1223 <kbd>text</kbd>
1224 <sub>text</sub>
1225 <u>text</u>
1226 <mark>text</mark>
1227 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1228 <bdi>text</bdi>
1229 <bdo>text</bdo>
1230 <span>text</span>
1231 <wbr />
1232 !! html
1233 <p><em>text</em>
1234 <strong>text</strong>
1235 <small>text</small>
1236 <s>text</s>
1237 <cite>text</cite>
1238 <q>text</q>
1239 <dfn>text</dfn>
1240 <abbr>text</abbr>
1241 <data>text</data>
1242 <time>text</time>
1243 <code>text</code>
1244 <var>text</var>
1245 <samp>text</samp>
1246 <kbd>text</kbd>
1247 <sub>text</sub>
1248 <u>text</u>
1249 <mark>text</mark>
1250 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1251 <bdi>text</bdi>
1252 <bdo>text</bdo>
1253 <span>text</span>
1254 <wbr />
1255 </p>
1256 !! end
1257
1258 # test cases taken from
1259 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1260 !! test
1261 Ruby markup (W3C-style)
1262 !! wikitext
1263 ; Mono-ruby for individual base characters
1264 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1265 ; Group ruby
1266 : <ruby>今日<rt>きょう</rt></ruby>
1267 ; Jukugo ruby
1268 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1269 ; Inline ruby
1270 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1271 ; Double-sided ruby
1272 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1273 <ruby>
1274 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1275 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1276 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1277 </ruby>
1278 !! html
1279 <dl><dt> Mono-ruby for individual base characters</dt>
1280 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1281 <dt> Group ruby</dt>
1282 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1283 <dt> Jukugo ruby</dt>
1284 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1285 <dt> Inline ruby</dt>
1286 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1287 <dt> Double-sided ruby</dt>
1288 <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>
1289 <p><ruby>
1290 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1291 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1292 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1293 </ruby>
1294 </p>
1295 !! end
1296
1297 # The next two test different paths in the sanitizer.
1298 !! test
1299 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1300 !! wikitext
1301 <blockquote|>a</blockquote>
1302
1303 <b→> doesn't terminate </b→>
1304
1305 <bä> doesn't terminate </bä>
1306
1307 <boo> doesn't terminate </boo>
1308
1309 <s.foo> doesn't terminate </s.foo>
1310
1311 <sub-ID#1>
1312 !! html
1313 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1314 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1315 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1316 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1317 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1318 </p><p>&lt;sub-ID#1&gt;
1319 </p>
1320 !! end
1321
1322 # There is a tidy bug here: https://sourceforge.net/p/tidy/bugs/946/
1323 # If the non-word-character tag made it through the sanitizer, tidy
1324 # would munge it up.
1325 !! test
1326 Non-word characters don't terminate tag names + tidy
1327 !! wikitext
1328 <blockquote|>a</blockquote>
1329
1330 <b→> doesn't terminate </b→>
1331
1332 <bä> doesn't terminate </bä>
1333
1334 <boo> doesn't terminate </boo>
1335
1336 <s.foo> doesn't terminate </s.foo>
1337
1338 <sub-ID#1>
1339 !! html+tidy
1340 <p>&lt;blockquote|&gt;a</p>
1341 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1342 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1343 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1344 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1345 <p>&lt;sub-ID#1&gt;</p>
1346 !! end
1347
1348 ###
1349 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1350 ### This checks that HTML5 tags (with non-word characters in the tag
1351 ### name) make it safely through the parser -- the Sanitizer will
1352 ### munge them later, as it should.
1353 ###
1354 !! test
1355 Non-word characters are valid in extension tags (T19663)
1356 !! wikitext
1357 <tåg>tåg</tåg>
1358 !! html/php
1359 <pre>
1360 'tåg'
1361 array (
1362 )
1363 </pre>
1364
1365 !! html/parsoid
1366 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1367 !! end
1368
1369 !! test
1370 Isolated close tags should be treated as literal text (bug 52760)
1371 !! options
1372 parsoid=wt2html
1373 !! wikitext
1374 </b>
1375
1376 <s.foo>s</s>
1377 !! html/php+tidy
1378 <p>&lt;s.foo&gt;s</p>
1379 !! html/parsoid
1380 <p>&lt;s.foo&gt;s</p>
1381 !! end
1382
1383 ###
1384 ### Special characters
1385 ###
1386
1387 !! test
1388 Bare pipe character (bug 52363)
1389 !! wikitext
1390 |
1391 !! html
1392 <p>|
1393 </p>
1394 !! end
1395
1396 !! test
1397 Bare pipe character from a template (bug 52363)
1398 !! wikitext
1399 {{pipe}}
1400 !! html
1401 <p>|
1402 </p>
1403 !! end
1404
1405 ###
1406 ### <nowiki> test cases
1407 ###
1408
1409 !! test
1410 <nowiki> unordered list
1411 !! wikitext
1412 <nowiki>* This is not an unordered list item.</nowiki>
1413 !! html/php
1414 <p>* This is not an unordered list item.
1415 </p>
1416 !! html/parsoid
1417 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1418 !! end
1419
1420 !! test
1421 <nowiki> spacing
1422 !! wikitext
1423 <nowiki>Lorem ipsum dolor
1424
1425 sed abit.
1426 sed nullum.
1427
1428 :and a colon
1429 </nowiki>
1430 !! html/php
1431 <p>Lorem ipsum dolor
1432
1433 sed abit.
1434 sed nullum.
1435
1436 :and a colon
1437
1438 </p>
1439 !! html/parsoid
1440 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1441
1442 sed abit.
1443 sed nullum.
1444
1445 :and a colon
1446 </span></p>
1447 !! end
1448
1449 !! test
1450 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1451 !! wikitext
1452 <nowiki><span class="error"></nowiki>
1453 !! html/php
1454 <p>&lt;span class="error"&gt;
1455 </p>
1456 !! html/parsoid
1457 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1458 !! end
1459
1460 !! test
1461 nowiki 3
1462 !! wikitext
1463 :There is not nowiki.
1464 :There is <nowiki>nowiki</nowiki>.
1465
1466 #There is not nowiki.
1467 #There is <nowiki>nowiki</nowiki>.
1468
1469 *There is not nowiki.
1470 *There is <nowiki>nowiki</nowiki>.
1471 !! html/php
1472 <dl><dd>There is not nowiki.</dd>
1473 <dd>There is nowiki.</dd></dl>
1474 <ol><li>There is not nowiki.</li>
1475 <li>There is nowiki.</li></ol>
1476 <ul><li>There is not nowiki.</li>
1477 <li>There is nowiki.</li></ul>
1478
1479 !! html/parsoid
1480 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1481 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1482
1483 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1484 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1485
1486 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1487 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1488 !! end
1489
1490 !! test
1491 Entities inside <nowiki>
1492 !! wikitext
1493 <nowiki>&lt;</nowiki>
1494 !! html
1495 <p>&lt;
1496 </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 Bug 52763: 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 Bug 51086: 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 Bug 15491: <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 bug #6200)
2225 !! test
2226 Bug 15491: <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 (bug 3202)
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 (bug 3202)
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 (bug 3202)
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 (bug 3202)
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> (bug 13238)
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 !! test
2318 <nowiki> and <pre> preference (first one wins)
2319 !! wikitext
2320 <pre>
2321 <nowiki>
2322 </pre>
2323 </nowiki>
2324 </pre>
2325
2326 <nowiki>
2327 <pre>
2328 <nowiki>
2329 </pre>
2330 </nowiki>
2331 </pre>
2332
2333 !! html/php
2334 <pre>
2335 &lt;nowiki&gt;
2336 </pre>
2337 <p>&lt;/nowiki&gt;
2338 &lt;/pre&gt;
2339 </p><p>
2340 &lt;pre&gt;
2341 &lt;nowiki&gt;
2342 &lt;/pre&gt;
2343
2344 &lt;/pre&gt;
2345 </p>
2346 !! html/parsoid
2347 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2348 </pre>
2349 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2350 &lt;/pre></p>
2351
2352 <p><span typeof="mw:Nowiki">
2353 &lt;pre>
2354 &lt;nowiki>
2355 &lt;/pre>
2356 </span>
2357 &lt;/pre></p>
2358 !! end
2359
2360 !! test
2361 </pre> inside nowiki
2362 !! wikitext
2363 <nowiki></pre></nowiki>
2364 !! html
2365 <p>&lt;/pre&gt;
2366 </p>
2367 !! end
2368
2369 # Parsoid doesn't strip empty tags, like Tidy does.
2370 !! test
2371 Empty pre; pre inside other HTML tags (bug 54946)
2372 !! options
2373 parsoid=wt2html,wt2wt
2374 !! wikitext
2375 a
2376
2377 <div><pre>
2378 foo
2379 </pre></div>
2380 <pre></pre>
2381 !! html/php
2382 <p>a
2383 </p>
2384 <div><pre>
2385 foo
2386 </pre></div>
2387 <pre></pre>
2388
2389 !! html/php+tidy
2390 <p>a</p>
2391 <div>
2392 <pre>
2393 foo
2394 </pre></div>
2395 !! html/parsoid
2396 <p>a</p>
2397
2398 <div><pre>foo
2399 </pre></div>
2400 <pre></pre>
2401 !! end
2402
2403 !! test
2404 HTML pre followed by indent-pre
2405 !! wikitext
2406 <pre>foo</pre>
2407 bar
2408 !! html
2409 <pre>foo</pre>
2410 <pre>bar
2411 </pre>
2412 !! end
2413
2414 # Note that tidy removes the empty <p> tags from the start and end.
2415 # Parsoid does not, by design.
2416 !!test
2417 Block tag pre
2418 !! wikitext
2419 <p><pre>foo</pre></p>
2420 !! html/php+tidy
2421 <pre>
2422 foo
2423 </pre>
2424 !! html/parsoid
2425 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2426 !!end
2427
2428 !!test
2429 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2430 !! wikitext
2431 {{echo|}}
2432 !! html
2433
2434 !!end
2435
2436 !!test
2437 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2438 !! wikitext
2439 {{echo|
2440 foo}}
2441 !! html
2442 <p>foo
2443 </p>
2444 !!end
2445
2446 !! test
2447 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2448 !! wikitext
2449 {{echo|a
2450 b}}
2451 !! html
2452 <pre>a
2453 </pre>
2454 <p>b
2455 </p>
2456 !!end
2457
2458 !! test
2459 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2460 !! wikitext
2461 {{echo|a
2462 b
2463 c
2464 d
2465 e
2466 }}
2467 !! html
2468 <pre>a
2469 </pre>
2470 <p>b
2471 c
2472 </p>
2473 <pre>d
2474 </pre>
2475 <p>e
2476 </p>
2477 !!end
2478
2479 !!test
2480 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2481 !! wikitext
2482 {{echo| foo}}
2483
2484 {{echo| foo}}{{echo| bar}}
2485
2486 {{echo| foo}}
2487 {{echo| bar}}
2488
2489 {{echo|<!--cmt--> foo}}
2490
2491 <!--cmt-->{{echo| foo}}
2492
2493 {{echo|{{echo| }}bar}}
2494 !! html
2495 <pre>foo
2496 </pre>
2497 <pre>foo bar
2498 </pre>
2499 <pre>foo
2500 bar
2501 </pre>
2502 <pre>foo
2503 </pre>
2504 <pre>foo
2505 </pre>
2506 <pre>bar
2507 </pre>
2508 !!end
2509
2510 !! test
2511 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2512 !! wikitext
2513 {{echo| }}a
2514
2515 {{echo|
2516 }}a
2517
2518 {{echo|
2519 b}}
2520
2521 {{echo|a
2522 }}b
2523
2524 {{echo|a
2525 }} b
2526 !! html
2527 <pre>a
2528 </pre>
2529 <p><br />
2530 </p>
2531 <pre>a
2532 </pre>
2533 <p><br />
2534 </p>
2535 <pre>b
2536 </pre>
2537 <p>a
2538 </p>
2539 <pre>b
2540 </pre>
2541 <p>a
2542 </p>
2543 <pre>b
2544 </pre>
2545 !!end
2546
2547 !! test
2548 Pres with newline attributes
2549 !! wikitext
2550 <pre class="one
2551 two">hi</pre>
2552 !! html/php
2553 <pre class="one two">hi</pre>
2554
2555 !! html/parsoid
2556 <pre class="one
2557 two" data-parsoid='{"stx":"html"}'>hi</pre>
2558 !! end
2559
2560 !! test
2561 Things that look like <pre> tags aren't treated as such
2562 !! wikitext
2563 Barack Obama <President> of the United States
2564 <President></President>
2565 !! html
2566 <p>Barack Obama &lt;President&gt; of the United States
2567 &lt;President&gt;&lt;/President&gt;
2568 </p>
2569 !! end
2570
2571 !! test
2572 Handle broken pre-like tags (bug 64025)
2573 !! options
2574 parsoid=wt2html
2575 !! wikitext
2576 {{echo|<pre <pre>x</pre>}}
2577
2578 <table><pre </table>
2579 !! html/php
2580 <pre>x</pre>
2581 <table>&lt;pre </table>
2582
2583 !! html/php+tidy
2584 <pre>
2585 x
2586 </pre>
2587 <p>&lt;pre</p>
2588 !! html/parsoid
2589 <pre about="#mwt1" typeof="mw:Transclusion" 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>
2590
2591
2592 <p>&lt;pre </p>
2593
2594 <table></table>
2595 !! end
2596
2597 !! test
2598 Parsoid: handle pre with space after attribute
2599 !! options
2600 parsoid=wt2html
2601 !! wikitext
2602 <pre style="width:50%;" >{{echo|foo}}</pre>
2603 !! html/php
2604 <pre style="width:50%;">{{echo|foo}}</pre>
2605
2606 !! html/parsoid
2607 <pre style="width:50%;">{{echo|foo}}</pre>
2608 !! end
2609
2610 # TODO / maybe: fix wt2wt for this
2611 !! test
2612 Parsoid: Don't paragraph-wrap fosterable content
2613 !! options
2614 parsoid=wt2html
2615 !! wikitext
2616 {|
2617 <td></td>
2618 <td></td>
2619
2620
2621
2622 |}
2623 !! html
2624 <table>
2625
2626 <tbody>
2627 <tr>
2628 <td></td>
2629
2630 <td></td></tr>
2631
2632
2633
2634 </tbody></table>
2635 !! end
2636
2637 !! test
2638 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2639 !! options
2640 parsoid=wt2html
2641 !! wikitext
2642 {|
2643 <td>
2644 <td>
2645 </td>
2646
2647
2648
2649 |}
2650 !! html
2651 <table>
2652
2653 <tbody>
2654 <tr>
2655 <td></td>
2656
2657 <td>
2658 </td></tr>
2659
2660
2661
2662 </tbody></table>
2663 !! end
2664
2665
2666 #--------------------------------------------------------------------
2667 # Transclusion parameter whitespace stripping tests
2668 # Behavior is different for positional and named parameters
2669 #--------------------------------------------------------------------
2670 !! test
2671 Templates: Strip leading and trailing whitespace from named-param values
2672 !! wikitext
2673 {{echo|1= a }}
2674
2675 {{echo|1= {{echo|b}} }}
2676
2677 {{echo| 1 =
2678 c }}
2679
2680 {{echo| 1 =
2681 * d
2682 }}
2683 !! html
2684 <p>a
2685 </p><p>b
2686 </p><p>c
2687 </p>
2688 <ul><li> d</li></ul>
2689
2690 !! end
2691
2692 !! test
2693 Templates: Don't strip whitespace from positional-param values
2694 !! wikitext
2695 {{echo|a }}
2696
2697 {{echo|{{echo|b}} }}
2698
2699 {{echo| c
2700 }}
2701
2702 {{echo| {{echo|d}}
2703 }}
2704
2705 {{echo|
2706 e}}
2707
2708 {{echo|
2709 * f}}
2710
2711 {{echo|
2712 }}g
2713 !! html
2714 <p>a
2715 </p><p>b
2716 </p>
2717 <pre>c
2718 </pre>
2719 <p><br />
2720 </p>
2721 <pre>d
2722 </pre>
2723 <p><br />
2724 </p>
2725 <pre>e
2726 </pre>
2727 <p><br />
2728 </p>
2729 <ul><li> f</li></ul>
2730 <p><br />
2731 </p>
2732 <pre>g
2733 </pre>
2734 !! end
2735
2736 !! test
2737 Templates: Handle empty comment-and-ws-only lines correctly
2738 !! wikitext
2739 {{echo|foo
2740 <!--should be ignored-->
2741 <!--should be ignored as well-->
2742 bar}}
2743 !! html/php
2744 <p>foo
2745 bar
2746 </p>
2747 !! html/parsoid
2748 <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>
2749 !! end
2750
2751 !! test
2752 Templates: Handle comments in the target
2753 !! wikitext
2754 {{echo
2755 <!-- should be ignored -->
2756 |foo}}
2757
2758 {{echo
2759 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2760 |foo}}
2761
2762 {{echo<!-- should be ignored -->
2763 |foo}}
2764
2765 {{echo<!-- should be ignored -->|foo}}
2766
2767 {{<!-- should be ignored -->echo|foo}}
2768 !! html/php
2769 <p>foo
2770 </p><p>foo
2771 </p><p>foo
2772 </p><p>foo
2773 </p><p>foo
2774 </p>
2775 !! html/parsoid
2776 <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>
2777
2778 <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>
2779
2780 <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>
2781
2782 <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>
2783
2784 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2785 !!end
2786
2787 !! test
2788 Templates: Handle comments in parameter names (bug 67657)
2789 !! wikitext
2790 {{echo|1
2791 <!-- should be ignored -->
2792 =foo}}
2793
2794 {{echo|
2795 <!-- should be ignored -->
2796 1 = foo}}
2797
2798 {{echo|1<!-- should be ignored -->=foo}}
2799
2800 {{echo|<!-- should be ignored -->1=foo}}
2801 !! html/php
2802 <p>foo
2803 </p><p>foo
2804 </p><p>foo
2805 </p><p>foo
2806 </p>
2807 !! html/parsoid
2808 <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>
2809
2810 <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>
2811
2812 <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>
2813
2814 <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>
2815 !!end
2816
2817 !! test
2818 Templates: Other wikitext in parameter names (bug 67657)
2819 !! wikitext
2820 {{echo|''1''=foo}}
2821 !! html/php
2822 <p>{{{1}}}
2823 </p>
2824 !! html/parsoid
2825 <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>
2826 !!end
2827
2828 #--------------------------------------------------------------------
2829 # Transclusion parameter escaping tests
2830 #--------------------------------------------------------------------
2831 !! test
2832 Templates: Parsoid parameter escaping test 1
2833 !! wikitext
2834 {{echo|[foo]|{{echo|[bar]}}}}
2835 !! html/php+tidy
2836 <p>[foo]</p>
2837 !! html/parsoid
2838 <p about="#mwt1" typeof="mw:Transclusion"
2839 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2840 !! end
2841
2842 !! test
2843 Parsoid: Pipes in external links in template parameter
2844 !! wikitext
2845 {{echo|[{{echo|http://example.com}} link]}}
2846 !! html/php+tidy
2847 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2848 !! html/parsoid
2849 <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>
2850 !! end
2851
2852 !! test
2853 Parsoid: pipe in transclusion parameter
2854 !! wikitext
2855 {{echo|http://foo.com/a&#124;b}}
2856 !! html/php+tidy
2857 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2858 !! html/parsoid
2859 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2860 typeof="mw:Transclusion"
2861 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|b</a></p>
2862 !! end
2863
2864 !! test
2865 Parsoid: Pipe in external link target and content in template parameter
2866 !! options
2867 parsoid=html2wt,wt2wt
2868 !! wikitext
2869 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2870 !! html/php+tidy
2871 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2872 !! html/parsoid
2873 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2874 typeof="mw:Transclusion"
2875 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2876 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2877 !! end
2878
2879 !! test
2880 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2881 !! options
2882 parsoid
2883 !! wikitext
2884 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2885 !! html
2886 <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>
2887 !! end
2888
2889 !! test
2890 Templates: Don't escape already nowiki-escaped text in template parameters
2891 !! options
2892 parsoid=html2wt,wt2wt
2893 !! wikitext
2894 {{echo|foo<nowiki>|</nowiki>bar}}
2895 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2896 {{echo|<nowiki></nowiki>}}
2897 !! html/php+tidy
2898 <p>foo|bar &lt;div&gt;</p>
2899 !! html/parsoid
2900 <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>
2901 <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>
2902 <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>
2903 </p>
2904 !! end
2905
2906 ## Bug 52824
2907 !! test
2908 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2909 !! options
2910 parsoid=html2wt,wt2wt
2911 !! wikitext
2912 {{echo|{{echo|1=bar}}}}
2913 !! html/php+tidy
2914 <p>bar</p>
2915 !! html/parsoid
2916 <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>
2917 !! end
2918
2919 ## Bug 56733
2920 !! test
2921 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2922 !! wikitext
2923 {{echo|a : b}}
2924 !! html/php+tidy
2925 <p>a&#160;: b</p>
2926 !! html/parsoid
2927 <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>
2928 !! end
2929
2930 ## Bug T73412
2931 !! test
2932 Templates: Preserve blank parameter names
2933 !! wikitext
2934 {{echo|=foo}}
2935 !! html/php+tidy
2936 <p>{{{1}}}</p>
2937 !! html/parsoid
2938 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2939 !! end
2940
2941 !! test
2942 Templates: Preserve blank parameter names in other positions
2943 !! wikitext
2944 {{blank_param|bar|=foo}}
2945 !! html/php+tidy
2946 <p>bar foo</p>
2947 !! html/parsoid
2948 <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
2949 foo</p>
2950 !! end
2951
2952 ###
2953 ### Parsoid-centric tests for testing RT edge cases for pre
2954 ###
2955
2956 !!test
2957 1a. Indent-Pre and Comments
2958 !! wikitext
2959 a
2960 <!--a-->
2961 c
2962 !! html
2963 <pre>a
2964 </pre>
2965 <p>c
2966 </p>
2967 !!end
2968
2969 !!test
2970 1b. Indent-Pre and Comments
2971 !! wikitext
2972 a
2973 <!--a-->
2974 c
2975 !! html
2976 <pre>a
2977 </pre>
2978 <p>c
2979 </p>
2980 !!end
2981
2982 !!test
2983 1c. Indent-Pre and Comments
2984 !! wikitext
2985 <!--a--> a
2986
2987 <!--a--> a
2988 !! html
2989 <pre> a
2990 </pre>
2991 <pre> a
2992 </pre>
2993 !!end
2994
2995 !!test
2996 1d. Indent-Pre and Comments
2997 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2998 !! wikitext
2999 <!--a--> a
3000
3001 <!--b-->b
3002 !! html
3003 <pre>a
3004 </pre>
3005 <pre>b
3006 </pre>
3007 !!end
3008
3009 !!test
3010 2a. Indent-Pre and tables
3011 !! wikitext
3012 {|
3013 |-
3014 !h1!!h2
3015 |foo||bar
3016 |}
3017 !! html
3018 <table>
3019
3020 <tr>
3021 <th>h1</th>
3022 <th>h2
3023 </th>
3024 <td>foo</td>
3025 <td>bar
3026 </td></tr></table>
3027
3028 !!end
3029
3030 !!test
3031 2b. Indent-Pre and tables
3032 !! wikitext
3033 {|
3034 |-
3035 |foo
3036 |}
3037 !! html
3038 <table>
3039
3040 <tr>
3041 <td>foo
3042 </td></tr></table>
3043
3044 !!end
3045
3046 !!test
3047 2c. Indent-Pre and tables (bug 42252)
3048 !! wikitext
3049 {|
3050 |+ foo
3051 ! | bar
3052 |}
3053 !! html
3054 <table>
3055 <caption> foo
3056 </caption>
3057 <tr>
3058 <th> bar
3059 </th></tr></table>
3060
3061 !!end
3062
3063 !!test
3064 2d. Indent-Pre and tables
3065 !! wikitext
3066 a
3067 {|
3068 | b
3069 |}
3070 !! html/php
3071 <pre>a
3072 </pre>
3073 <table>
3074 <tr>
3075 <td> b
3076 </td></tr></table>
3077
3078 !! html/parsoid
3079 <pre>a</pre>
3080 <table>
3081 <tbody><tr><td> b</td></tr>
3082 </tbody></table>
3083 !!end
3084
3085 !!test
3086 2e. Indent-Pre and table-line syntax
3087 !! wikitext
3088 a
3089 | b
3090 | c
3091 !! html/php
3092 <pre>a
3093 | b
3094 | c
3095 </pre>
3096 !!end
3097
3098 !!test
3099 2f. Indent-pre started by table-line syntax
3100 !! wikitext
3101 a
3102 | b
3103 | c
3104 !! html/php
3105 <p>a
3106 </p>
3107 <pre>| b
3108 | c
3109 </pre>
3110 !! html/parsoid
3111 <p>a</p>
3112 <pre>
3113 | b
3114 | c</pre>
3115 !!end
3116
3117 !! test
3118 2g. Indented table markup mixed with indented pre content (proposed in bug 6200)
3119 !! wikitext
3120 <table>
3121 <tr>
3122 <td>
3123 Text that should be rendered preformatted
3124 </td>
3125 </tr>
3126 </table>
3127 !! html
3128 <table>
3129 <tr>
3130 <td>
3131 <pre>Text that should be rendered preformatted
3132 </pre>
3133 </td>
3134 </tr>
3135 </table>
3136
3137 !! end
3138
3139 !!test
3140 3a. Indent-Pre and block tags (single-line html)
3141 !! wikitext
3142 a <p> foo </p>
3143 b <div> foo </div>
3144 c <blockquote> foo </blockquote>
3145 <span> foo </span>
3146 !! html
3147 a <p> foo </p>
3148 b <div> foo </div>
3149 c <blockquote> foo </blockquote>
3150 <pre><span> foo </span>
3151 </pre>
3152 !! html/parsoid
3153 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3154 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3155 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3156 <pre><span> foo </span>
3157 </pre>
3158 !! html+tidy
3159 <p>a</p>
3160 <p>foo</p>
3161 <p>b</p>
3162 <div>foo</div>
3163 <p>c</p>
3164 <blockquote>
3165 <p>foo</p>
3166 </blockquote>
3167 <pre>
3168 <span> foo </span>
3169 </pre>
3170 !! end
3171
3172 !!test
3173 3b. Indent-Pre and block tags (multi-line html)
3174 !! wikitext
3175 a <span>foo</span>
3176 b <div> foo </div>
3177 !! html
3178 <pre>a <span>foo</span>
3179 </pre>
3180 b <div> foo </div>
3181
3182 !! html/parsoid
3183 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3184 b <div data-parsoid='{"stx":"html"}'> foo </div>
3185 !! html+tidy
3186 <pre>
3187 a <span>foo</span>
3188 </pre>
3189 <p>b</p>
3190 <div>foo</div>
3191 !!end
3192
3193 !!test
3194 3c. Indent-Pre and block tags (pre-content on separate line)
3195 !! wikitext
3196 <p>
3197 foo
3198 </p>
3199
3200 <div>
3201 foo
3202 </div>
3203
3204 <center>
3205 foo
3206 </center>
3207
3208 <blockquote>
3209 foo
3210 </blockquote>
3211
3212 <blockquote>
3213 <pre>
3214 foo
3215 </pre>
3216 </blockquote>
3217
3218 <table><tr><td>
3219 foo
3220 </td></tr></table>
3221
3222 <ul><li>
3223 foo
3224 </li></ul>
3225
3226 !! html
3227 <p>
3228 foo
3229 </p>
3230 <div>
3231 <pre>foo
3232 </pre>
3233 </div>
3234 <center>
3235 <pre>foo
3236 </pre>
3237 </center>
3238 <blockquote>
3239 <p> foo
3240 </p>
3241 </blockquote>
3242 <blockquote>
3243 <pre>
3244 foo
3245 </pre>
3246 </blockquote>
3247 <table><tr><td>
3248 <pre>foo
3249 </pre>
3250 </td></tr></table>
3251 <ul><li>
3252 foo
3253 </li></ul>
3254
3255 !!end
3256
3257 !! test
3258 4. Indent-Pre and extension tags
3259 !! wikitext
3260 a <tag />
3261 !! html/php
3262 a <pre>
3263 NULL
3264 array (
3265 )
3266 </pre>
3267
3268 !! html/parsoid
3269 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3270 !! end
3271
3272 !!test
3273 Render paragraphs when indent-pre is suppressed in blocklevels
3274 !! wikitext
3275 <blockquote>
3276 foo
3277
3278 bar
3279 </blockquote>
3280 !! html
3281 <blockquote>
3282 <p> foo
3283 </p><p> bar
3284 </p>
3285 </blockquote>
3286
3287 !!end
3288
3289 !!test
3290 4. Multiple spaces at start-of-line
3291 !! wikitext
3292 <p> foo </p>
3293 foo
3294 {|
3295 |foo
3296 |}
3297 !! html
3298 <p> foo </p>
3299 <pre> foo
3300 </pre>
3301 <table>
3302 <tr>
3303 <td>foo
3304 </td></tr></table>
3305
3306 !!end
3307
3308 ## NOTE: the leading white-space chars on empty line are significant
3309 !! test
3310 5a. White-space in indent-pre
3311 !! wikitext
3312 a<br />
3313
3314 b
3315 !! html
3316 <pre>a<br />
3317
3318 b
3319 </pre>
3320 !! end
3321
3322 ## NOTE: the leading white-space chars on empty line are significant
3323 !! test
3324 5b. White-space in indent-pre
3325 !! wikitext
3326 a
3327
3328 b
3329
3330
3331 c
3332 !! html
3333 <pre>a
3334
3335 b
3336
3337
3338 c
3339 </pre>
3340 !! end
3341
3342 !! test
3343 5c. White-space in indent-pre
3344 !! wikitext
3345 ''a''
3346 ''b''
3347 ''c''
3348 !! html
3349 <pre><i>a</i>
3350 <i>b</i>
3351 <i>c</i>
3352 </pre>
3353 !! end
3354
3355 !! test
3356 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3357 !! wikitext
3358 a
3359
3360 <!-- continue -->
3361 b
3362
3363 c
3364
3365 d
3366 !! html
3367 <pre>a
3368
3369 b
3370 </pre>
3371 <pre>c
3372
3373 </pre>
3374 <p>d
3375 </p>
3376 !! end
3377
3378 !! test
3379 7a. Indent-pre and category links
3380 !! options
3381 parsoid=wt2html,wt2wt
3382 !! wikitext
3383 [[Category:foo]] <!-- No pre-wrapping -->
3384 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3385 !! html/php+tidy
3386 !! html/parsoid
3387 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3388 <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 -->
3389 !! end
3390
3391 ## We used to, but no longer wt2wt this test since the default serializer
3392 ## will normalize all categories to serialize on their own line.
3393 ## This wikitext usage is going to be fairly uncommon in production and
3394 ## selser will take care of preserving formatting in those scenarios.
3395 !! test
3396 7b. Indent-pre and category links
3397 !! options
3398 parsoid=wt2html
3399 !! wikitext
3400 [[Category:foo]] a
3401 [[Category:foo]] {{echo|b}}
3402 !! html/parsoid
3403 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3404 <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>
3405 !! end
3406
3407 !! test
3408 Indent-Pre: Newlines in comments shouldn't affect sol state
3409 !! wikitext
3410 a <!--
3411 foo
3412 --> b
3413 !! html/php+tidy
3414 <p>a b</p>
3415 !! html/parsoid
3416 <p>a <!--
3417 foo
3418 --> b</p>
3419 !! end
3420
3421 ###
3422 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3423 ###
3424
3425 !!test
3426 HTML-pre: 1. embedded newlines
3427 !! wikitext
3428 <pre>foo</pre>
3429
3430 <pre>
3431 foo
3432 </pre>
3433
3434 <pre>
3435
3436 foo
3437 </pre>
3438
3439 <pre>
3440
3441
3442 foo
3443 </pre>
3444 !! html/php+tidy
3445 <pre>
3446 foo
3447 </pre>
3448 <pre>
3449 foo
3450 </pre>
3451 <pre>
3452
3453 foo
3454 </pre>
3455 <pre>
3456
3457
3458 foo
3459 </pre>
3460 !! html/parsoid
3461 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3462
3463 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3464 foo
3465 </pre>
3466
3467 <pre data-parsoid='{"stx":"html"}'>
3468
3469 foo
3470 </pre>
3471
3472 <pre data-parsoid='{"stx":"html"}'>
3473
3474
3475 foo
3476 </pre>
3477 !!end
3478
3479 !! test
3480 HTML-pre: big spaces
3481 !! wikitext
3482 <pre>
3483
3484
3485
3486
3487 haha
3488
3489
3490
3491
3492 haha
3493
3494
3495
3496
3497 </pre>
3498 !! html/php+tidy
3499 <pre>
3500
3501
3502
3503
3504 haha
3505
3506
3507
3508
3509 haha
3510
3511
3512
3513
3514 </pre>
3515 !! html/parsoid
3516 <pre data-parsoid='{"stx":"html"}'>
3517
3518
3519
3520
3521 haha
3522
3523
3524
3525
3526 haha
3527
3528
3529
3530
3531 </pre>
3532 !! end
3533
3534 !!test
3535 HTML-pre: 2: indented text
3536 !! wikitext
3537 <pre>
3538 foo
3539 </pre>
3540 !! html
3541 <pre>
3542 foo
3543 </pre>
3544
3545 !!end
3546
3547 !!test
3548 HTML-pre: 3: other wikitext
3549 !! wikitext
3550 <pre>
3551 * foo
3552 # bar
3553 = no-h =
3554 '' no-italic ''
3555 [[ NoLink ]]
3556 </pre>
3557 !! html/php
3558 <pre>
3559 * foo
3560 # bar
3561 = no-h =
3562 '' no-italic ''
3563 [[ NoLink ]]
3564 </pre>
3565
3566 !! html/parsoid
3567 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3568 # bar
3569 = no-h =
3570 '' no-italic ''
3571 [[ NoLink ]]
3572 </pre>
3573 !!end
3574
3575 ###
3576 ### Definition lists
3577 ###
3578 !! test
3579 Simple definition
3580 !! wikitext
3581 ; name : Definition
3582 !! html
3583 <dl><dt> name&#160;</dt>
3584 <dd> Definition</dd></dl>
3585
3586 !! end
3587
3588 !! test
3589 Definition list for indentation only
3590 !! wikitext
3591 : Indented text
3592 !! html
3593 <dl><dd> Indented text</dd></dl>
3594
3595 !! end
3596
3597 !! test
3598 Definition list with no space
3599 !! wikitext
3600 ;name:Definition
3601 !! html
3602 <dl><dt>name</dt>
3603 <dd>Definition</dd></dl>
3604
3605 !!end
3606
3607 !! test
3608 Definition list with URL link
3609 !! wikitext
3610 ; http://example.com/ : definition
3611 !! html
3612 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3613 <dd> definition</dd></dl>
3614
3615 !! end
3616
3617 !! test
3618 Definition list with bracketed URL link
3619 !! wikitext
3620 ;[http://www.example.com/ Example]:Something about it
3621 !! html
3622 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3623 <dd>Something about it</dd></dl>
3624
3625 !! end
3626
3627 !! test
3628 Definition list with wikilink containing colon
3629 !! wikitext
3630 ; [[Help:FAQ]]: The least-read page on Wikipedia
3631 !! html
3632 <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>
3633 <dd> The least-read page on Wikipedia</dd></dl>
3634
3635 !! end
3636
3637 # At Brion's and JeLuF's insistence... :)
3638 !! test
3639 Definition list with news link containing colon
3640 !! wikitext
3641 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3642 !! html/php
3643 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3644 <dd> This isn't even a real newsgroup!</dd></dl>
3645
3646 !! html/parsoid
3647 <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>
3648 !! end
3649
3650 !! test
3651 Malformed definition list with colon
3652 !! wikitext
3653 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3654 !! html
3655 <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>
3656
3657 !! end
3658
3659 !! test
3660 Definition lists: colon in external link text
3661 !! wikitext
3662 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3663 !! html
3664 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3665 <dd> OK, I made that up</dd></dl>
3666
3667 !! end
3668
3669 !! test
3670 Definition lists: colon in HTML attribute
3671 !! wikitext
3672 ;<b style="display: inline">bold</b>
3673 !! html
3674 <dl><dt><b style="display: inline">bold</b></dt></dl>
3675
3676 !! end
3677
3678 !! test
3679 Definition lists: self-closed tag
3680 !! wikitext
3681 ;one<br/>two : two-line fun
3682 !! html
3683 <dl><dt>one<br />two&#160;</dt>
3684 <dd> two-line fun</dd></dl>
3685
3686 !! end
3687
3688 !! test
3689 Bug 11748: Literal closing tags
3690 !! wikitext
3691 <dl>
3692 <dt>test 1</dt>
3693 <dd>test test test test test</dd>
3694 <dt>test 2</dt>
3695 <dd>test test test test test</dd>
3696 </dl>
3697 !! html
3698 <dl>
3699 <dt>test 1</dt>
3700 <dd>test test test test test</dd>
3701 <dt>test 2</dt>
3702 <dd>test test test test test</dd>
3703 </dl>
3704
3705 !! end
3706
3707 !! test
3708 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3709 !! wikitext
3710 <ul><li>
3711 ; term : description
3712 * unordered
3713 </li></ul>
3714 !! html
3715 <ul><li>
3716 <dl><dt> term&#160;</dt>
3717 <dd> description</dd></dl>
3718 <ul><li> unordered</li></ul>
3719 </li></ul>
3720
3721 !! end
3722
3723 !! test
3724 Definition list with empty definition and following paragraph
3725 !! wikitext
3726 ; term:
3727 Paragraph text
3728 !! html
3729 <dl><dt> term</dt>
3730 <dd></dd></dl>
3731 <p>Paragraph text
3732 </p>
3733 !! end
3734
3735 !! test
3736 Nested definition lists using html syntax
3737 !! wikitext
3738 <dl><dt>x</dt>
3739 <dd>a</dd>
3740 <dd>b</dd></dl>
3741 !! html
3742 <dl><dt>x</dt>
3743 <dd>a</dd>
3744 <dd>b</dd></dl>
3745
3746 !! end
3747
3748 !! test
3749 Definition Lists: No nesting: Multiple dd's
3750 !! wikitext
3751 ;x
3752 :a
3753 :b
3754 !! html
3755 <dl><dt>x</dt>
3756 <dd>a</dd>
3757 <dd>b</dd></dl>
3758
3759 !! end
3760
3761 !! test
3762 Definition Lists: Indentation: Regular
3763 !! wikitext
3764 :i1
3765 ::i2
3766 :::i3
3767 !! html
3768 <dl><dd>i1
3769 <dl><dd>i2
3770 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3771
3772 !! end
3773
3774 !! test
3775 Definition Lists: Indentation: Missing 1st level
3776 !! wikitext
3777 ::i2
3778 :::i3
3779 !! html
3780 <dl><dd><dl><dd>i2
3781 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3782
3783 !! end
3784
3785 !! test
3786 Definition Lists: Indentation: Multi-level indent
3787 !! wikitext
3788 :::i3
3789 !! html
3790 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3791
3792 !! end
3793
3794 !! test
3795 Definition Lists: Hacky use to indent tables
3796 !! wikitext
3797 ::{|
3798 |foo
3799 |bar
3800 |}
3801 this text
3802 should be left alone
3803 !! html
3804 <dl><dd><dl><dd><table>
3805 <tr>
3806 <td>foo
3807 </td>
3808 <td>bar
3809 </td></tr></table></dd></dl></dd></dl>
3810 <p>this text
3811 should be left alone
3812 </p>
3813 !! end
3814
3815 !! test
3816 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3817 !! wikitext
3818 <!-- foo -->
3819 ::{|
3820 |foo
3821 |bar
3822 |}<!-- bar -->
3823 this text
3824 should be left alone
3825 !! html/parsoid
3826 <!-- foo -->
3827 <dl><dd><dl><dd><table><tr>
3828 <td>foo</td>
3829 <td>bar</td>
3830 </tr></table><!-- bar --></dd></dl></dd></dl>
3831 <p>this text
3832 should be left alone</p>
3833 !! end
3834
3835 !! test
3836 Definition Lists: Hacky use to indent tables, with comment before table
3837 !! wikitext
3838 ::<!-- foo -->{|
3839 |foo
3840 |}
3841 !! html/parsoid
3842 <dl><dd><dl><dd><!-- foo --><table><tr>
3843 <td>foo</td>
3844 </tr></table></dd></dl></dd></dl>
3845 !! end
3846
3847 # The trailing whitespace in this test is to catch a regression in
3848 # Parsoid after T54473.
3849 !! test
3850 Definition Lists: Hacky use to indent tables (WS-insensitive)
3851 !! wikitext
3852 : {|
3853 |a
3854 |}
3855 !! html/php
3856 <dl><dd><table>
3857 <tr>
3858 <td>a
3859 </td></tr></table></dd></dl>
3860
3861 !! html/parsoid
3862 <dl><dd> <table>
3863 <tbody><tr><td>a</td></tr>
3864 </tbody></table> </dd></dl>
3865 !! end
3866
3867 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3868 ## as an empty dt item. It also ignores all but the last ";" when followed
3869 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3870 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3871 ## ";"s.
3872 ##
3873 ## Ex: ";;t2 ::d2" is transformed into:
3874 ##
3875 ## <dl>
3876 ## <dt>t2 </dt>
3877 ## <dd>
3878 ## <dl>
3879 ## <dt></dt>
3880 ## <dd>d2</dd>
3881 ## </dl>
3882 ## </dd>
3883 ## </dl>
3884 ##
3885 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3886 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3887 ##
3888 ## <dl>
3889 ## <dt>
3890 ## <dl>
3891 ## <dt>t2 </dt>
3892 ## <dd>:d2</dd>
3893 ## </dl>
3894 ## </dt>
3895 ## </dl>
3896 ##
3897 ## All Parsoid only definition list tests have this difference.
3898 ##
3899 ## See also: https://phabricator.wikimedia.org/T8569
3900 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3901
3902 !! test
3903 Table / list interaction: indented table with lists in table contents
3904 !! wikitext
3905 :{|
3906 |-
3907 | a
3908 * b
3909 |-
3910 | c
3911 * d
3912 |}
3913 !! html
3914 <dl><dd><table>
3915
3916 <tr>
3917 <td> a
3918 <ul><li> b</li></ul>
3919 </td></tr>
3920 <tr>
3921 <td> c
3922 <ul><li> d</li></ul>
3923 </td></tr></table></dd></dl>
3924
3925 !! end
3926
3927 !!test
3928 Table / list interaction: lists nested in tables nested in indented lists
3929 !! wikitext
3930 :{|
3931 |
3932 :a
3933 :b
3934 |
3935 *c
3936 *d
3937 |}
3938
3939 *e
3940 *f
3941 !! html
3942 <dl><dd><table>
3943 <tr>
3944 <td>
3945 <dl><dd>a</dd>
3946 <dd>b</dd></dl>
3947 </td>
3948 <td>
3949 <ul><li>c</li>
3950 <li>d</li></ul>
3951 </td></tr></table></dd></dl>
3952 <ul><li>e</li>
3953 <li>f</li></ul>
3954
3955 !!end
3956
3957 !! test
3958 Definition Lists: Nesting: Multi-level (Parsoid only)
3959 !! options
3960 parsoid
3961 !! wikitext
3962 ;t1 :d1
3963 ;;t2 ::d2
3964 ;;;t3 :::d3
3965 !! html
3966 <dl>
3967 <dt>t1 </dt>
3968 <dd>d1</dd>
3969 <dt>
3970 <dl>
3971 <dt>t2 </dt>
3972 <dd>:d2</dd>
3973 <dt>
3974 <dl>
3975 <dt>t3 </dt>
3976 <dd>::d3</dd>
3977 </dl>
3978 </dt>
3979 </dl>
3980 </dt>
3981 </dl>
3982
3983
3984 !! end
3985
3986
3987 !! test
3988 Definition Lists: Nesting: Test 2 (Parsoid only)
3989 !! wikitext
3990 ;t1
3991 ::d2
3992 !! html/php+tidy
3993 <dl>
3994 <dt>t1</dt>
3995 <dd>
3996 <dl>
3997 <dd>d2</dd>
3998 </dl>
3999 </dd>
4000 </dl>
4001 !! html/parsoid
4002 <dl>
4003 <dt>t1</dt>
4004 <dd>
4005 <dl>
4006 <dd>d2</dd>
4007 </dl>
4008 </dd>
4009 </dl>
4010
4011 !! end
4012
4013
4014 !! test
4015 Definition Lists: Nesting: Test 3 (Parsoid only)
4016 !! wikitext
4017 :;t1
4018 ::::d2
4019 !! html/php+tidy
4020 <dl>
4021 <dd>
4022 <dl>
4023 <dt>t1</dt>
4024 <dd>
4025 <dl>
4026 <dd>
4027 <dl>
4028 <dd>d2</dd>
4029 </dl>
4030 </dd>
4031 </dl>
4032 </dd>
4033 </dl>
4034 </dd>
4035 </dl>
4036 !! html/parsoid
4037 <dl>
4038 <dd>
4039 <dl>
4040 <dt>t1</dt>
4041 <dd>
4042 <dl>
4043 <dd>
4044 <dl>
4045 <dd>d2</dd>
4046 </dl>
4047 </dd>
4048 </dl>
4049 </dd>
4050 </dl>
4051 </dd>
4052 </dl>
4053
4054 !! end
4055
4056
4057 !! test
4058 Definition Lists: Nesting: Test 4
4059 !! wikitext
4060 ::;t3
4061 :::d3
4062 !! html
4063 <dl><dd><dl><dd><dl><dt>t3</dt>
4064 <dd>d3</dd></dl></dd></dl></dd></dl>
4065
4066 !! end
4067
4068
4069 ## The Parsoid team believes the following three test exposes a
4070 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4071 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4072 ## It also exposes a "misfeature" in tidy, which doesn't like
4073 ## <dl> tags with a single <dt> child; it converts the <dt> into
4074 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4075 !! test
4076 Definition Lists: Mixed Lists: Test 1
4077 !! wikitext
4078 :;* foo
4079 ::* bar
4080 :; baz
4081 !! html/php
4082 <dl><dd><dl><dt><ul><li> foo</li>
4083 <li> bar</li></ul></dt></dl>
4084 <dl><dt> baz</dt></dl></dd></dl>
4085
4086 !! html/php+tidy
4087 <dl>
4088 <dd>
4089 <dl>
4090 <dd>
4091 <ul>
4092 <li>foo</li>
4093 <li>bar</li>
4094 </ul>
4095 </dd>
4096 </dl>
4097 <dl>
4098 <dt>baz</dt>
4099 </dl>
4100 </dd>
4101 </dl>
4102 !! html/parsoid
4103 <dl>
4104 <dd><dl>
4105 <dt><ul>
4106 <li> foo
4107 </li>
4108 </ul></dt>
4109 <dd><ul>
4110 <li> bar
4111 </li>
4112 </ul></dd>
4113 <dt> baz</dt>
4114 </dl></dd>
4115 </dl>
4116 !! end
4117
4118 !! test
4119 Definition Lists: Mixed Lists: Test 2
4120 !! wikitext
4121 *: d1
4122 *: d2
4123 !! html
4124 <ul><li><dl><dd> d1</dd>
4125 <dd> d2</dd></dl></li></ul>
4126
4127 !! end
4128
4129
4130 !! test
4131 Definition Lists: Mixed Lists: Test 3
4132 !! wikitext
4133 *::: d1
4134 *::: d2
4135 !! html
4136 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4137 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4138
4139 !! end
4140
4141
4142 !! test
4143 Definition Lists: Mixed Lists: Test 4
4144 !! wikitext
4145 *;d1 :d2
4146 *;d3 :d4
4147 !! html
4148 <ul><li><dl><dt>d1&#160;</dt>
4149 <dd>d2</dd>
4150 <dt>d3&#160;</dt>
4151 <dd>d4</dd></dl></li></ul>
4152
4153 !! end
4154
4155
4156 !! test
4157 Definition Lists: Mixed Lists: Test 5
4158 !! wikitext
4159 *:d1
4160 *:: d2
4161 !! html
4162 <ul><li><dl><dd>d1
4163 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4164
4165 !! end
4166
4167
4168 !! test
4169 Definition Lists: Mixed Lists: Test 6
4170 !! wikitext
4171 #*:d1
4172 #*::: d3
4173 !! html
4174 <ol><li><ul><li><dl><dd>d1
4175 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4176
4177 !! end
4178
4179
4180 !! test
4181 Definition Lists: Mixed Lists: Test 7
4182 !! wikitext
4183 :* d1
4184 :* d2
4185 !! html
4186 <dl><dd><ul><li> d1</li>
4187 <li> d2</li></ul></dd></dl>
4188
4189 !! end
4190
4191
4192 !! test
4193 Definition Lists: Mixed Lists: Test 8
4194 !! wikitext
4195 :* d1
4196 ::* d2
4197 !! html
4198 <dl><dd><ul><li> d1</li></ul>
4199 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4200
4201 !! end
4202
4203
4204 !! test
4205 Definition Lists: Mixed Lists: Test 9
4206 !! wikitext
4207 *;foo :bar
4208 !! html
4209 <ul><li><dl><dt>foo&#160;</dt>
4210 <dd>bar</dd></dl></li></ul>
4211
4212 !! end
4213
4214
4215 !! test
4216 Definition Lists: Mixed Lists: Test 10
4217 !! wikitext
4218 *#;foo :bar
4219 !! html
4220 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4221 <dd>bar</dd></dl></li></ol></li></ul>
4222
4223 !! end
4224
4225 # The Parsoid team disagrees with the PHP parser's seemingly-random
4226 # rules regarding dd/dt on the next two tests. Parsoid is more
4227 # consistent, and recognizes the shared nesting and keeps the
4228 # still-open tags around until the nesting is complete.
4229 # (And tidy again converts <dt> to <dd> before 'bar'.)
4230
4231 !! test
4232 Definition Lists: Mixed Lists: Test 11
4233 !! wikitext
4234 *#*#;*;;foo :bar
4235 *#*#;boo :baz
4236 !! html/php
4237 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4238 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4239 <dl><dt>boo&#160;</dt>
4240 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4241
4242 !! html/php+tidy
4243 <ul>
4244 <li>
4245 <ol>
4246 <li>
4247 <ul>
4248 <li>
4249 <ol>
4250 <li>
4251 <dl>
4252 <dt>foo&#160;</dt>
4253 <dd>
4254 <ul>
4255 <li>
4256 <dl>
4257 <dd>
4258 <dl>
4259 <dt>bar</dt>
4260 </dl>
4261 </dd>
4262 </dl>
4263 </li>
4264 </ul>
4265 </dd>
4266 </dl>
4267 <dl>
4268 <dt>boo&#160;</dt>
4269 <dd>baz</dd>
4270 </dl>
4271 </li>
4272 </ol>
4273 </li>
4274 </ul>
4275 </li>
4276 </ol>
4277 </li>
4278 </ul>
4279 !! html/parsoid
4280 <ul>
4281 <li>
4282 <ol>
4283 <li>
4284 <ul>
4285 <li>
4286 <ol>
4287 <li>
4288 <dl>
4289 <dt>
4290 <ul>
4291 <li>
4292 <dl>
4293 <dt>
4294 <dl>
4295 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4296 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4297 </dl></dt>
4298 </dl></li>
4299 </ul></dt>
4300 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4301 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4302 </dl></li>
4303 </ol></li>
4304 </ul></li>
4305 </ol></li>
4306 </ul>
4307 !! end
4308
4309
4310 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4311 # From whitelist:
4312 # * The test is wrong, there are two colons where there should be :;
4313 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4314 !! test
4315 Definition Lists: Weird Ones: Test 1
4316 !! wikitext
4317 *#;*::;; foo : bar (who uses this?)
4318 !! html/php
4319 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4320 <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>
4321
4322 !! html/php+tidy
4323 <ul>
4324 <li>
4325 <ol>
4326 <li>
4327 <dl>
4328 <dt>foo&#160;</dt>
4329 <dd>
4330 <ul>
4331 <li>
4332 <dl>
4333 <dd>
4334 <dl>
4335 <dd>
4336 <dl>
4337 <dd>
4338 <dl>
4339 <dt>bar (who uses this?)</dt>
4340 </dl>
4341 </dd>
4342 </dl>
4343 </dd>
4344 </dl>
4345 </dd>
4346 </dl>
4347 </li>
4348 </ul>
4349 </dd>
4350 </dl>
4351 </li>
4352 </ol>
4353 </li>
4354 </ul>
4355 !! html/parsoid
4356 <ul>
4357 <li>
4358 <ol>
4359 <li>
4360 <dl>
4361 <dt>
4362 <ul>
4363 <li>
4364 <dl>
4365 <dd>
4366 <dl>
4367 <dd>
4368 <dl>
4369 <dt>
4370 <dl>
4371 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4372 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4373 </dl></dt>
4374 </dl></dd>
4375 </dl></dd>
4376 </dl></li>
4377 </ul></dt>
4378 </dl></li>
4379 </ol></li>
4380 </ul>
4381 !! end
4382
4383 !! test
4384 Definition Lists: colons occurring in tags
4385 !! wikitext
4386 ;a:b
4387 ;'''a:b'''
4388 ;<i>a:b</i>
4389 ;<span>a:b</span>
4390 ;<div>a:b</div>
4391 ;<div>a
4392 :b</div>
4393 ;{{echo|a:b}}
4394 ;{{echo|''a:b''}}
4395 ;;;''a:b''
4396 !! html+tidy
4397 <dl>
4398 <dt>a</dt>
4399 <dd>b</dd>
4400 <dt><b>a:b</b></dt>
4401 <dt><i>a:b</i></dt>
4402 <dt><span>a:b</span></dt>
4403 <dd>
4404 <div>a:b</div>
4405 </dd>
4406 <dd>
4407 <div>a
4408 <dl>
4409 <dd>b</dd>
4410 </dl>
4411 </div>
4412 </dd>
4413 <dt>a</dt>
4414 <dd>b</dd>
4415 <dt><i>a:b</i></dt>
4416 </dl>
4417 <dl>
4418 <dd>
4419 <dl>
4420 <dd>
4421 <dl>
4422 <dt><i>a:b</i></dt>
4423 </dl>
4424 </dd>
4425 </dl>
4426 </dd>
4427 </dl>
4428 !! html/parsoid
4429 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4430 <dt><b>a:b</b></dt>
4431 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4432 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4433 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4434 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4435 <dd>b</dd>
4436 <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>
4437 <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>
4438 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4439 !! end
4440
4441 !! test
4442 Definition Lists: colons and tables 1
4443 !! wikitext
4444 :{|
4445 | x
4446 |}
4447 :{|
4448 | y
4449 |}
4450 !! html
4451 <dl><dd><table>
4452 <tr>
4453 <td> x
4454 </td></tr></table></dd></dl>
4455 <dl><dd><table>
4456 <tr>
4457 <td> y
4458 </td></tr></table></dd></dl>
4459
4460 !! end
4461
4462 # Parsoid's output (as documented below) differs from php's in this case.
4463 # This is probably a bug. If we fixup parsoid to match php's output, the
4464 # above test should pass and the below test case can be removed. It is
4465 # unclear which output is more desirable.
4466
4467 !! test
4468 Definition Lists: colons and tables 2
4469 !! wikitext
4470 :{|
4471 | x
4472 |}
4473 :{|
4474 | y
4475 |}
4476 !! html/parsoid
4477 <dl><dd><table>
4478 <tr>
4479 <td> x
4480 </td></tr></table></dd>
4481 <dd><table>
4482 <tr>
4483 <td> y
4484 </td></tr></table></dd></dl>
4485 !! end
4486
4487 !! test
4488 Definition Lists: template interaction
4489 !! wikitext
4490 ::{{definition_list}}
4491
4492 :one
4493 ::{{definition_list}}
4494 :::two
4495 :::three
4496 ::four
4497 !! html/parsoid
4498 <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">
4499 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4500
4501 <dl><dd data-parsoid='{}'>one
4502 <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">
4503 </span><dd about="#mwt2">two
4504 <dl><dd>two</dd>
4505 <dd>three</dd></dl></dd>
4506 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4507 !! end
4508
4509
4510 ###
4511 ### External links
4512 ###
4513 !! test
4514 External links: non-bracketed
4515 !! wikitext
4516 Non-bracketed: http://example.com
4517 !! html
4518 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4519 </p>
4520 !! end
4521
4522 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4523 !! test
4524 External links: numbered
4525 !! wikitext
4526 Numbered: [http://example.com]
4527 Numbered: [http://example.net]
4528 Numbered: [http://example.com]
4529 !! html/php
4530 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4531 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4532 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4533 </p>
4534 !! html/parsoid
4535 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4536 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4537 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4538 !!end
4539
4540 !! test
4541 External links: specified text
4542 !! wikitext
4543 Specified text: [http://example.com link]
4544 !! html
4545 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4546 </p>
4547 !!end
4548
4549 !! test
4550 External links: trail
4551 !! wikitext
4552 Linktrails should not work for external links: [http://example.com link]s
4553 !! html
4554 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4555 </p>
4556 !! end
4557
4558 !! test
4559 External links: dollar sign in URL
4560 !! wikitext
4561 http://example.com/1$2345
4562 !! html
4563 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4564 </p>
4565 !! end
4566
4567 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4568 !! test
4569 External links: dollar sign in URL (autonumber)
4570 !! wikitext
4571 [http://example.com/1$2345]
4572 !! html/php
4573 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4574 </p>
4575 !! html/parsoid
4576 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4577 !!end
4578
4579 !! test
4580 External links: open square bracket forbidden in URL (bug 4377)
4581 !! options
4582 parsoid=wt2html,wt2wt,html2html
4583 !! wikitext
4584 http://example.com/1[2345
4585 !! html/php
4586 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4587 </p>
4588 !! html/parsoid
4589 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4590 !! end
4591
4592 !! test
4593 External links: open square bracket forbidden in URL (named) (bug 4377)
4594 !! options
4595 parsoid=wt2html,html2html
4596 !! wikitext
4597 [http://example.com/1[2345]
4598 !! html/php
4599 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4600 </p>
4601 !! html/parsoid
4602 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4603 !!end
4604
4605 # parsoid adds a space before the link name
4606 !! test
4607 External links: open square bracket forbidden in URL (named) (bug 4377)
4608 Parsoid variant.
4609 !! wikitext
4610 [http://example.com/1 [2345]
4611 !! html
4612 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4613 </p>
4614 !!end
4615
4616 !! test
4617 External links: nowiki in URL link text (bug 6230)
4618 !! wikitext
4619 [http://example.com/ <nowiki>''example site''</nowiki>]
4620 !! html
4621 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4622 </p>
4623 !! end
4624
4625 !! test
4626 External links: newline forbidden in text (bug 6230 regression check)
4627 !! wikitext
4628 [http://example.com/ first
4629 second]
4630 !! html
4631 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4632 second]
4633 </p>
4634 !!end
4635
4636 !! test
4637 External links: Pipe char between url and text
4638 !! wikitext
4639 [http://example.com | link]
4640 !! html
4641 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4642 </p>
4643 !!end
4644
4645 !! test
4646 External links: protocol-relative URL in brackets
4647 !! wikitext
4648 [//example.com/ Test]
4649 !! html
4650 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4651 </p>
4652 !! end
4653
4654 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4655 !! test
4656 External links: protocol-relative URL in brackets without text
4657 !! wikitext
4658 [//example.com]
4659 !! html/php
4660 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4661 </p>
4662 !! html/parsoid
4663 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4664 !! end
4665
4666 !! test
4667 External links: protocol-relative URL in free text is left alone
4668 !! wikitext
4669 //example.com/Foo
4670 !! html
4671 <p>//example.com/Foo
4672 </p>
4673 !!end
4674
4675 !! test
4676 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4677 !! wikitext
4678 foo//example.com/Foo
4679 !! html
4680 <p>foo//example.com/Foo
4681 </p>
4682 !! end
4683
4684 !! test
4685 External links: with no contents
4686 !! wikitext
4687 [http://en.wikipedia.org/wiki/Foo]
4688
4689 [[wikipedia:Foo|Bar]]
4690
4691 [[wikipedia:Foo|<span>Bar</span>]]
4692 !! html/php
4693 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4694 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4695 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4696 </p>
4697 !! html/parsoid
4698 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4699 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4700 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4701 !! end
4702
4703 !! test
4704 External links: Free with trailing punctuation
4705 !! wikitext
4706 http://example.com,
4707 http://example.com;
4708 http://example.com\
4709 http://example.com.
4710 http://example.com:
4711 http://example.com!
4712 http://example.com?
4713 http://example.com)
4714 http://example.com/url_with_(brackets)
4715 (http://example.com/url_without_brackets)
4716 http://example.com/url_with_entity&amp;
4717 http://example.com/url_with_entity&#x26;
4718 http://example.com/url_with_entity&#038;
4719 http://example.com/url_with_entity&nbsp;
4720 http://example.com/url_with_entity&#xA0;
4721 http://example.com/url_with_entity&#160;
4722 http://example.com/url_with_entity&lt;
4723 http://example.com/url_with_entity&#x3C;
4724 http://example.com/url_with_entity&#60;
4725 !! html/php
4726 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4727 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4728 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4729 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4730 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4731 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4732 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4733 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4734 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4735 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4736 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4737 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4738 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4739 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4740 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4741 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4742 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4743 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4744 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4745 </p>
4746 !! html/parsoid
4747 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4748 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4749 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4750 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4751 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4752 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4753 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4754 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4755 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4756 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4757 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4758 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4759 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4760 <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>
4761 <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>
4762 <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>
4763 <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>
4764 <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>
4765 <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>
4766 !! end
4767
4768 !! test
4769 External links: tricky Parsoid html2html case
4770 !! options
4771 parsoid=wt2html,wt2wt,html2html
4772 !! wikitext
4773 http://example.com/url_with_entity&amp;amp;
4774 !! html/php
4775 <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>;
4776 </p>
4777 !! html/parsoid
4778 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4779 !! end
4780
4781 !! test
4782 External links: Free with trailing quotes (T113666)
4783 !! wikitext
4784 '''News:''' Stuff here
4785
4786 news:'a'b''c''d e
4787 !! html/php
4788 <p><b>News:</b> Stuff here
4789 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4790 </p>
4791 !! html/parsoid
4792 <p><b>News:</b> Stuff here</p>
4793 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4794 !! end
4795
4796 !! test
4797 External links: Lone protocols are never linked (T105697)
4798 !! wikitext
4799 http://
4800 http://;
4801 (http://)
4802 bitcoin:
4803 bitcoin:;
4804 (bitcoin:)
4805 !! html
4806 <p>http://
4807 http://;
4808 (http://)
4809 bitcoin:
4810 bitcoin:;
4811 (bitcoin:)
4812 </p>
4813 !! end
4814
4815 !! test
4816 External links: No preceding word characters allowed (bug 65278)
4817 !! wikitext
4818 NOPEhttp://example.com
4819 N0http://example.com
4820 ok:http://example.com
4821 ok-http://example.com
4822 !! html
4823 <p>NOPEhttp://example.com
4824 N0http://example.com
4825 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4826 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4827 </p>
4828 !! end
4829
4830 !! test
4831 External links: nofollow domain exception
4832 !! wikitext
4833 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4834 !! html
4835 <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>.
4836 </p>
4837 !!end
4838
4839 !! test
4840 External image
4841 !! wikitext
4842 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4843 !! html
4844 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4845 </p>
4846 !! end
4847
4848 !! test
4849 External image from https
4850 !! wikitext
4851 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4852 !! html
4853 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4854 </p>
4855 !! end
4856
4857 !! test
4858 External image (when not allowed)
4859 !! options
4860 wgAllowExternalImages=0
4861 !! wikitext
4862 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4863 !! html
4864 <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>
4865 </p>
4866 !! end
4867
4868 !! test
4869 Link to non-http image, no img tag
4870 !! wikitext
4871 Link to non-http image, no img tag: ftp://example.com/test.jpg
4872 !! html
4873 <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>
4874 </p>
4875 !! end
4876
4877 !! test
4878 External links: terminating separator
4879 !! wikitext
4880 Terminating separator: http://example.com/thing,
4881 !! html
4882 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4883 </p>
4884 !! end
4885
4886 !! test
4887 External links: intervening separator
4888 !! wikitext
4889 Intervening separator: http://example.com/1,2,3
4890 !! html
4891 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4892 </p>
4893 !! end
4894
4895 !! test
4896 External links: old bug with URL in query
4897 !! wikitext
4898 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4899 !! html
4900 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4901 </p>
4902 !! end
4903
4904 !! test
4905 External links: old URL-in-URL bug, mixed protocols
4906 !! wikitext
4907 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4908 !! html
4909 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4910 </p>
4911 !!end
4912
4913 # Since Parsoid is starting to emit canonical wikitext for links,
4914 # [http://example.com http://example.com] will not RT back to that
4915 # form anymore.
4916 !! test
4917 External links: URL in text
4918 !! options
4919 parsoid=wt2html
4920 !! wikitext
4921 URL in text: [http://example.com http://example.com]
4922 !! html/php
4923 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4924 </p>
4925 !! html/parsoid
4926 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4927 !! end
4928
4929 !! test
4930 External links: Clickable images
4931 !! wikitext
4932 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4933 !! html/php
4934 <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>
4935 </p>
4936 !! html/parsoid
4937 <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>
4938 !! end
4939
4940 !! test
4941 External links: raw ampersand
4942 !! wikitext
4943 Old &amp; use: http://x&y
4944 !! html
4945 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4946 </p>
4947 !! end
4948
4949 !! test
4950 External links: encoded ampersand
4951 !! wikitext
4952 Old &amp; use: http://x&amp;y
4953 !! html/php
4954 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4955 </p>
4956 !! html/parsoid
4957 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4958 !! end
4959
4960 !! test
4961 External links: encoded equals (bug 6102)
4962 !! wikitext
4963 http://example.com/?foo&#61;bar
4964 !! html/php
4965 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4966 </p>
4967 !! html/parsoid
4968 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4969 !! end
4970
4971 ##
4972 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4973 ## does it number them. As discussed in bug 53505, we can identify
4974 ## autonumbered links via CSS.
4975 ##
4976
4977 !! test
4978 External links: [raw ampersand]
4979 !! wikitext
4980 Old &amp; use: [http://x&y]
4981 !! html/php
4982 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4983 </p>
4984 !! html/parsoid
4985 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4986 !! end
4987
4988 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4989 # mode will return the [raw ampersand] wikitext
4990 !! test
4991 External links: [encoded ampersand]
4992 !! options
4993 parsoid=wt2html,wt2wt,html2html
4994 !! wikitext
4995 Old &amp; use: [http://x&amp;y]
4996 !! html/php
4997 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4998 </p>
4999 !! html/parsoid
5000 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5001 !! end
5002
5003 !! test
5004 External links: [raw equals]
5005 !! wikitext
5006 [http://example.com/?foo=bar]
5007 !! html/php
5008 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5009 </p>
5010 !! html/parsoid
5011 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5012 !! end
5013
5014 # note that parsoid html is identical to [raw equals] case; so html2wt
5015 # mode will return the [raw equals] wikitext
5016 !! test
5017 External links: [encoded equals] (bug 6102)
5018 !! options
5019 parsoid=wt2html,wt2wt,html2html
5020 !! wikitext
5021 [http://example.com/?foo&#61;bar]
5022 !! html/php
5023 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5024 </p>
5025 !! html/parsoid
5026 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5027 !! end
5028
5029 # xxx parsoid strips the IDN character, so the round-trip tests will
5030 # obviously fail and are disabled. --cscott
5031 !! test
5032 External links: [IDN ignored character reference in hostname; strip it right off]
5033 !! options
5034 parsoid=wt2html,wt2wt,html2html
5035 !! wikitext
5036 [http://e&zwnj;xample.com/]
5037 !! html/php
5038 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5039 </p>
5040 !! html/parsoid
5041 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5042 !! end
5043
5044 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5045 # Where an external link could easily circumvent the sanitization of the text of
5046 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5047 # test demands a higher standard. That's a bit strange.
5048 #
5049 # Example:
5050 #
5051 # http://e‌xample.com -> [http://example.com|http://example.com]
5052 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5053 #
5054 # The first example is sanitized, but the second is not. Any security benefits
5055 # from this production are trivial to circumvent. Either remove this test and
5056 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5057 # the test accordingly.
5058 #
5059 # All our love,
5060 # The Parsoid team.
5061 # xxx parsoid strips the IDN character, so the round-trip tests will
5062 # obviously fail and are disabled. --cscott
5063 !! test
5064 External links: IDN ignored character reference in hostname; strip it right off
5065 !! options
5066 parsoid=wt2html,html2html
5067 !! wikitext
5068 http://e&zwnj;xample.com/
5069 !! html/php
5070 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5071 </p>
5072 !! html/parsoid
5073 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5074 !! end
5075
5076 !! test
5077 External links: www.jpeg.org (bug 554)
5078 !! wikitext
5079 http://www.jpeg.org
5080 !! html
5081 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5082 </p>
5083 !! end
5084
5085 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5086 !! test
5087 External links: URL within URL (original bug 2)
5088 !! wikitext
5089 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5090 !! html/php
5091 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5092 </p>
5093 !! html/parsoid
5094 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5095 !! end
5096
5097 !! test
5098 BUG 361: URL inside bracketed URL
5099 !! wikitext
5100 [http://www.example.com/foo http://www.example.com/bar]
5101 !! html
5102 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5103 </p>
5104 !! end
5105
5106 !! test
5107 BUG 361: URL within URL, not bracketed
5108 !! wikitext
5109 http://www.example.com/foo?=http://www.example.com/bar
5110 !! html
5111 <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>
5112 </p>
5113 !! end
5114
5115 !! test
5116 BUG 289: ">"-token in URL-tail
5117 !! wikitext
5118 http://www.example.com/<hello>
5119 !! html
5120 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5121 </p>
5122 !!end
5123
5124 !! test
5125 BUG 289: literal ">"-token in URL-tail
5126 !! wikitext
5127 http://www.example.com/<b>html</b>
5128 !! html/php
5129 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5130 </p>
5131 !! html/parsoid
5132 <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>
5133 !! end
5134
5135 !! test
5136 BUG 289: ">"-token in bracketed URL
5137 !! wikitext
5138 [http://www.example.com/<hello> stuff]
5139 !! html
5140 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5141 </p>
5142 !!end
5143
5144 !! test
5145 BUG 289: literal ">"-token in bracketed URL
5146 !! wikitext
5147 [http://www.example.com/<b>html</b> stuff]
5148 !! html
5149 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5150 </p>
5151 !!end
5152
5153 !! test
5154 BUG 289: literal double quote at end of URL
5155 !! wikitext
5156 http://www.example.com/"hello"
5157 !! html
5158 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5159 </p>
5160 !!end
5161
5162 !! test
5163 BUG 289: literal double quote in bracketed URL
5164 !! wikitext
5165 [http://www.example.com/"hello" stuff]
5166 !! html
5167 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5168 </p>
5169 !!end
5170
5171 !! test
5172 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5173 !! wikitext
5174 [http://www.example.com test]
5175 !! html
5176 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5177 </p>
5178 !! end
5179
5180 !! test
5181 External links: link text with spaces
5182 !! wikitext
5183 [http://www.example.com a b c]
5184 [http://www.example.com ''a'' ''b'']
5185 !! html
5186 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5187 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5188 </p>
5189 !! end
5190
5191 !! test
5192 External links: wiki links within external link (Bug 3695)
5193 !! options
5194 parsoid=wt2html,html2html
5195 !! wikitext
5196 [http://example.com [[wikilink]] embedded in ext link]
5197 !! html/php
5198 <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>
5199 </p>
5200 !! html/parsoid
5201 <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>
5202 !! end
5203
5204 !! test
5205 BUG 787: Links with one slash after the url protocol are invalid
5206 !! wikitext
5207 http:/example.com
5208
5209 [http:/example.com title]
5210 !! html
5211 <p>http:/example.com
5212 </p><p>[http:/example.com title]
5213 </p>
5214 !! end
5215
5216 !! test
5217 Bracketed external links with template-generated invalid target
5218 !! wikitext
5219 [{{echo|http:/example.com}} title]
5220 !! html
5221 <p>[http:/example.com title]
5222 </p>
5223 !! end
5224
5225 !! test
5226 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5227 !! wikitext
5228 ''[http://example.com text'']
5229 [http://example.com '''text]'''
5230 ''Something [http://example.com in italic'']
5231 ''Something [http://example.com mixed''''', even bold]'''
5232 '''''Now [http://example.com both''''']
5233 !! html
5234 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5235 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5236 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5237 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5238 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5239 </p>
5240 !! end
5241
5242
5243 !! test
5244 Bug 4781: %26 in URL
5245 !! wikitext
5246 http://www.example.com/?title=AT%26T
5247 !! html/php
5248 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5249 </p>
5250 !! html/parsoid
5251 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5252 !! end
5253
5254 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5255 # % is actually legal in HTML5. Any change in output would need testing though.
5256 !! test
5257 Bug 4781, 5267: %25 in URL
5258 !! wikitext
5259 http://www.example.com/?title=100%25_Bran
5260 !! html/php
5261 <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>
5262 </p>
5263 !! html/parsoid
5264 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5265 !! end
5266
5267 !! test
5268 Bug 4781, 5267: %28, %29 in URL
5269 !! wikitext
5270 http://www.example.com/?title=Ben-Hur_%281959_film%29
5271 !! html/php
5272 <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>
5273 </p>
5274 !! html/parsoid
5275 <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>
5276 !! end
5277
5278
5279 !! test
5280 Bug 4781: %26 in autonumber URL
5281 !! wikitext
5282 [http://www.example.com/?title=AT%26T]
5283 !! html/php
5284 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5285 </p>
5286 !! html/parsoid
5287 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5288 !! end
5289
5290 !! test
5291 Bug 4781, 5267: %26 in autonumber URL
5292 !! wikitext
5293 [http://www.example.com/?title=100%25_Bran]
5294 !! html/php
5295 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5296 </p>
5297 !! html/parsoid
5298 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5299 !! end
5300
5301 !! test
5302 Bug 4781, 5267: %28, %29 in autonumber URL
5303 !! wikitext
5304 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5305 !! html/php
5306 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5307 </p>
5308 !! html/parsoid
5309 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5310 !! end
5311
5312
5313 !! test
5314 Bug 4781: %26 in bracketed URL
5315 !! wikitext
5316 [http://www.example.com/?title=AT%26T link]
5317 !! html/php
5318 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5319 </p>
5320 !! html/parsoid
5321 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5322 !! end
5323
5324 !! test
5325 Bug 4781, 5267: %25 in bracketed URL
5326 !! wikitext
5327 [http://www.example.com/?title=100%25_Bran link]
5328 !! html
5329 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5330 </p>
5331 !! end
5332
5333 !! test
5334 Bug 4781, 5267: %28, %29 in bracketed URL
5335 !! wikitext
5336 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5337 !! html/php
5338 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5339 </p>
5340 !! html/parsoid
5341 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5342 !! end
5343
5344 !! test
5345 External link containing a period in the anchor. (bug 63947)
5346 !! wikitext
5347 [//foo.org/bar#baz. bang]
5348
5349 [//foo.org/bar. bang]
5350 !! html/php
5351 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5352 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5353 </p>
5354 !! html/parsoid
5355 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5356 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5357 !! end
5358
5359 !! test
5360 External link containing a single quote. (bug 63947)
5361 !! wikitext
5362 [//foo.org/bar'baz]
5363
5364 [//foo.org/bar'baz bang]
5365 !! html/php
5366 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5367 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5368 </p>
5369 !! html/parsoid
5370 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5371 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5372 !! end
5373
5374 !! test
5375 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5376 !! wikitext
5377 Some [http://example.com/ pretty ''italics'' and stuff]!
5378 !! html
5379 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5380 </p>
5381 !! end
5382
5383 !! test
5384 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5385 !! wikitext
5386 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5387 !! html
5388 <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>
5389 </p>
5390 !! end
5391
5392 !! test
5393 External link containing double-single-quotes with no space separating the url from text in italics
5394 !! wikitext
5395 [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]].]
5396 !! html/php
5397 <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>
5398 </p>
5399 !! html/php+tidy
5400 <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>
5401 !! html/parsoid
5402 <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>
5403 !! end
5404
5405 !! test
5406 External link with comments in link text
5407 !! wikitext
5408 [http://www.google.com Google <!-- comment -->]
5409 !! html/php
5410 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5411 </p>
5412 !! html/parsoid
5413 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5414 !! end
5415
5416 !! test
5417 External link to bare IPv4 address
5418 !! wikitext
5419 [http://192.168.0.1 Link]
5420 !! html/php
5421 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5422 </p>
5423 !! html/parsoid
5424 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5425 !! end
5426
5427 !! test
5428 URL-encoding in URL functions (single parameter)
5429 !! wikitext
5430 {{localurl:Some page|amp=&}}
5431 !! html
5432 <p>/index.php?title=Some_page&amp;amp=&amp;
5433 </p>
5434 !! end
5435
5436 !! test
5437 URL-encoding in URL functions (multiple parameters)
5438 !! wikitext
5439 {{localurl:Some page|q=?&amp=&}}
5440 !! html
5441 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5442 </p>
5443 !! end
5444
5445 !! test
5446 Brackets in urls
5447 !! wikitext
5448 http://example.com/index.php?foozoid%5B%5D=bar
5449
5450 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5451 !! html/php
5452 <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>
5453 </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>
5454 </p>
5455 !! html/parsoid
5456 <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>
5457
5458 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5459 !! end
5460
5461 !! test
5462 IPv6 urls, autolink format (T23261)
5463 !! wikitext
5464 http://[2404:130:0:1000::187:2]/index.php
5465
5466 Examples from RFC 2373, section 2.2:
5467 * http://[1080::8:800:200C:417A]/unicast
5468 * http://[FF01::101]/multicast
5469 * http://[::1]/loopback
5470 * http://[::]/unspecified
5471 * http://[::13.1.68.3]/ipv4compat
5472 * http://[::FFFF:129.144.52.38]/ipv4compat
5473
5474 Examples from RFC 2732, section 2:
5475 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5476 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5477 * http://[3ffe:2a00:100:7031::1]
5478 * http://[1080::8:800:200C:417A]/foo
5479 * http://[::192.9.5.5]/ipng
5480 * http://[::FFFF:129.144.52.38]:80/index.html
5481 * http://[2010:836B:4179::836B:4179]
5482
5483 !! html/php
5484 <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>
5485 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5486 </p>
5487 <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>
5488 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5489 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5490 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5491 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5492 <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>
5493 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5494 </p>
5495 <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>
5496 <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>
5497 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5498 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5499 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5500 <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>
5501 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5502
5503 !! html/parsoid
5504 <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>
5505
5506 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5507 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5508 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5509 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5510 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5511 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5512 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5513
5514 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5515 <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>
5516 <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>
5517 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5518 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5519 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5520 <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>
5521 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5522 !! end
5523
5524 !! test
5525 IPv6 urls, bracketed format (T23261)
5526 !! wikitext
5527 [http://[2404:130:0:1000::187:2]/index.php test]
5528
5529 Examples from RFC 2373, section 2.2:
5530 * [http://[1080::8:800:200C:417A] unicast]
5531 * [http://[FF01::101] multicast]
5532 * [http://[::1]/ loopback]
5533 * [http://[::] unspecified]
5534 * [http://[::13.1.68.3] ipv4compat]
5535 * [http://[::FFFF:129.144.52.38] ipv4compat]
5536
5537 Examples from RFC 2732, section 2:
5538 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5539 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5540 * [http://[3ffe:2a00:100:7031::1] 3]
5541 * [http://[1080::8:800:200C:417A]/foo 4]
5542 * [http://[::192.9.5.5]/ipng 5]
5543 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5544 * [http://[2010:836B:4179::836B:4179] 7]
5545
5546 !! html/php
5547 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5548 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5549 </p>
5550 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5551 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5552 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5553 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5554 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5555 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5556 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5557 </p>
5558 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5559 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5560 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5561 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5562 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5563 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5564 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5565
5566 !! html/parsoid
5567 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5568
5569 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5570 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5571 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5572 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5573 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5574 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5575 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5576
5577 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5578 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5579 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5580 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5581 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5582 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5583 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5584 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5585 !! end
5586
5587 !! test
5588 Non-extlinks in brackets
5589 !! wikitext
5590 [foo]
5591 [foo bar]
5592 [foo ''bar'']
5593 [fool's] errand
5594 [fool's errand]
5595 [{{echo|foo}}]
5596 [{{echo|foo}} bar]
5597 [{{echo|foo}} ''bar'']
5598 [{{echo|foo}}l's] errand
5599 [{{echo|foo}}l's errand]
5600 [url={{echo|foo}}]
5601 [url=http://example.com]
5602 [http:// bare protocols don't count]
5603 !! html/php
5604 <p>[foo]
5605 [foo bar]
5606 [foo <i>bar</i>]
5607 [fool's] errand
5608 [fool's errand]
5609 [foo]
5610 [foo bar]
5611 [foo <i>bar</i>]
5612 [fool's] errand
5613 [fool's errand]
5614 [url=foo]
5615 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5616 [http:// bare protocols don't count]
5617 </p>
5618 !! html/parsoid
5619 <p>[foo]
5620 [foo bar]
5621 [foo <i>bar</i>]
5622 [fool's] errand
5623 [fool's errand]
5624 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5625 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5626 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5627 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5628 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5629 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5630 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5631 [http:// bare protocols don't count]</p>
5632 !! end
5633
5634 !! test
5635 Percent encoding in external links
5636 !! wikitext
5637 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5638 !! html/php
5639 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5640 </p>
5641 !! html/parsoid
5642 <p><a rel="mw:ExtLink"
5643 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5644 !! end
5645
5646 !! test
5647 Use url link syntax for links where the content is equal the link target
5648 !! wikitext
5649 http://example.com
5650 !! html/php
5651 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5652 </p>
5653 !! html/parsoid
5654 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5655 !! end
5656
5657 !! test
5658 Parenthesis in external links, especially URL links
5659 !! wikitext
5660 http://example.com)
5661
5662 http://example.com/test)
5663
5664 http://example.com/(test)
5665
5666 http://example.com/((test)
5667
5668 (http://example.com/(test))
5669
5670 (http://example.com/(test)))))
5671
5672 http://example.com/a)b
5673
5674 [http://example.com) foo]
5675 !! html/php
5676 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5677 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5678 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5679 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5680 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5681 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5682 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5683 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5684 </p>
5685 !! html/parsoid
5686 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5687 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5688 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5689 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5690 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5691 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5692 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5693 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5694 !! end
5695
5696 !! test
5697 Parenthesis in external links, w/ transclusion or comment
5698 !! wikitext
5699 (http://example.com/{{echo|hi}})
5700
5701 (http://example.com<!-- hi -->)
5702 !! html/php
5703 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5704 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5705 </p>
5706 !! html/parsoid
5707 <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>
5708
5709 <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>
5710 !! end
5711
5712 !! test
5713 Serialize <a> tags with invalid link targets as plain text
5714 !! options
5715 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5716 !! html/parsoid
5717 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5718 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5719 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5720 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5721 !! wikitext
5722 text
5723 <nowiki>*</nowiki>text
5724 <nowiki>[[foo]]</nowiki>
5725 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5726 !! end
5727
5728 !! test
5729 mw:ExtLink -vs- mw:WikiLink (T94723)
5730 !! options
5731 parsoid=html2wt
5732 !! html/parsoid
5733 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5734 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5735 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5736 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5737 <p>
5738 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5739 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5740 </p>
5741 !! wikitext
5742 [[Foo|Bar]]
5743 [[Foo|Bar]]
5744 [[wikipedia:Foo|Bar]]
5745 [[wikipedia:Foo|Bar]]
5746
5747 [[wikipedia:European_Robin|European Robin]]
5748 [[wikipedia:European_Robin|European Robin]]
5749 !! end
5750
5751 !! test
5752 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5753 !! options
5754 parsoid=wt2wt
5755 !! wikitext
5756 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5757 !! html/parsoid
5758 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5759 !! end
5760
5761
5762 ###
5763 ### Quotes
5764 ###
5765
5766 !! test
5767 Quotes
5768 !! wikitext
5769 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5770
5771 Normal text. '''''Bold italic text.''''' Normal text.
5772 !! html
5773 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5774 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5775 </p>
5776 !! end
5777
5778
5779 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5780 # parser strips. The wikitext contains just the first half of the bold
5781 # quote pair.
5782 !! test
5783 Unclosed and unmatched quotes
5784 !! wikitext
5785 '''''Bold italic text '''with bold deactivated''' in between.'''''
5786
5787 '''''Bold italic text ''with italic deactivated'' in between.'''''
5788
5789 '''Bold text..
5790
5791 ..spanning two paragraphs (should not work).'''
5792
5793 '''Bold tag left open
5794
5795 ''Italic tag left open
5796
5797 Normal text.
5798
5799 <!-- Unmatching number of opening, closing tags: -->
5800 '''This year''''s election ''should'' beat '''last year''''s.
5801
5802 ''Tom'''s car is bigger than ''Susan'''s.
5803
5804 Plain ''italic'''s plain
5805 !! html/php
5806 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5807 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5808 </p><p><b>Bold text..</b>
5809 </p><p>..spanning two paragraphs (should not work).
5810 </p><p><b>Bold tag left open</b>
5811 </p><p><i>Italic tag left open</i>
5812 </p><p>Normal text.
5813 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5814 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5815 </p><p>Plain <i>italic'</i>s plain
5816 </p>
5817 !! html/parsoid
5818 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5819 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5820 </p><p><b>Bold text..</b>
5821 </p><p>..spanning two paragraphs (should not work).<b></b>
5822 </p><p><b>Bold tag left open</b>
5823 </p><p><i>Italic tag left open</i>
5824 </p><p>Normal text.
5825 </p>
5826 <!-- Unmatching number of opening, closing tags: -->
5827 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5828 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5829 </p><p>Plain <i>italic'</i>s plain
5830 </p>
5831 !! end
5832
5833 ###
5834 ### Tables
5835 ###
5836 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5837 ###
5838
5839 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5840 # is the bare minimum required by the spec, see:
5841 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5842 # Parsoid team replies: empty table tags are legal in HTML5
5843 !! test
5844 A table with no data.
5845 !! options
5846 parsoid=wt2html
5847 !! wikitext
5848 {||}
5849 !! html/php
5850
5851 !! html/parsoid
5852 <table></table>
5853
5854 !! end
5855
5856 !! test
5857 A table with stray table end tags on start tag line (wt2html)
5858 !! options
5859 parsoid=wt2html
5860 !! wikitext
5861 {|style="color: red;"|}
5862
5863 {|style="color: red;" |}
5864 |foo
5865 |}
5866
5867 {|style="color: red;"|} id="foo"
5868 |foo
5869 |}
5870
5871 {|style="color: red;" |} id="foo"
5872 |foo
5873 |}
5874 !! html
5875 <table style="color: red;"></table>
5876
5877 <table style="color: red;">
5878 <tbody><tr>
5879 <td>foo</td>
5880 </tr></tbody>
5881 </table>
5882
5883 <table style="color: red;" id="foo">
5884 <tbody><tr>
5885 <td>foo</td>
5886 </tr></tbody>
5887 </table>
5888
5889 <table style="color: red;" id="foo">
5890 <tbody><tr>
5891 <td>foo</td>
5892 </tr></tbody>
5893 </table>
5894
5895 !! end
5896
5897 !! test
5898 A table with no data (take 2)
5899 !! wikitext
5900 {|
5901 |}
5902 !! html/parsoid
5903 <table></table>
5904 !! end
5905
5906 # A table with nothing but a caption is invalid XHTML, we might want to render
5907 # this as <p>caption</p>
5908 # Parsoid team replies: table with only a caption is legal in HTML5
5909 !! test
5910 A table with nothing but a caption
5911 !! wikitext
5912 {|
5913 |+ caption
5914 |}
5915 !! html/php
5916 <table>
5917 <caption> caption
5918 </caption><tr><td></td></tr></table>
5919
5920 !! html/parsoid
5921 <table><caption> caption</caption></table>
5922 !! end
5923
5924 !! test
5925 A table with caption with default-spaced attributes and a table row
5926 !! wikitext
5927 {|
5928 |+ style="color: red;" | caption1
5929 |-
5930 | foo
5931 |}
5932 !! html
5933 <table>
5934 <caption style="color: red;"> caption1
5935 </caption>
5936 <tr>
5937 <td> foo
5938 </td></tr></table>
5939
5940 !! end
5941
5942 !! test
5943 A table with captions with non-default spaced attributes and a table row
5944 !! wikitext
5945 {|
5946 |+style="color: red;"|caption2
5947 |+ style="color: red;"| caption3
5948 |-
5949 | foo
5950 |}
5951 !! html
5952 <table>
5953 <caption style="color: red;">caption2
5954 </caption>
5955 <caption style="color: red;"> caption3
5956 </caption>
5957 <tr>
5958 <td> foo
5959 </td></tr></table>
5960
5961 !! end
5962
5963 !! test
5964 Table td-cell syntax variations
5965 !! wikitext
5966 {|
5967 | foo bar foo | baz
5968 | foo bar foo || baz
5969 | style='color:red;' | baz
5970 | style='color:red;' || baz
5971 |}
5972 !! html
5973 <table>
5974 <tr>
5975 <td> baz
5976 </td>
5977 <td> foo bar foo </td>
5978 <td> baz
5979 </td>
5980 <td style="color:red;"> baz
5981 </td>
5982 <td> style='color:red;' </td>
5983 <td> baz
5984 </td></tr></table>
5985
5986 !! end
5987
5988 !! test
5989 Simple table
5990 !! wikitext
5991 {|
5992 | 1 || 2
5993 |-
5994 | 3 || 4
5995 |}
5996 !! html
5997 <table>
5998 <tr>
5999 <td> 1 </td>
6000 <td> 2
6001 </td></tr>
6002 <tr>
6003 <td> 3 </td>
6004 <td> 4
6005 </td></tr></table>
6006
6007 !! end
6008
6009 !! test
6010 Simple table but with multiple dashes for row wikitext
6011 !! wikitext
6012 {|
6013 | foo
6014 |-----
6015 | bar
6016 |}
6017 !! html
6018 <table>
6019 <tr>
6020 <td> foo
6021 </td></tr>
6022 <tr>
6023 <td> bar
6024 </td></tr></table>
6025
6026 !! end
6027
6028 !! test
6029 Multiplication table
6030 !! wikitext
6031 {| border="1" cellpadding="2"
6032 |+Multiplication table
6033 |-
6034 ! &times; !! 1 !! 2 !! 3
6035 |-
6036 ! 1
6037 | 1 || 2 || 3
6038 |-
6039 ! 2
6040 | 2 || 4 || 6
6041 |-
6042 ! 3
6043 | 3 || 6 || 9
6044 |-
6045 ! 4
6046 | 4 || 8 || 12
6047 |-
6048 ! 5
6049 | 5 || 10 || 15
6050 |}
6051 !! html
6052 <table border="1" cellpadding="2">
6053 <caption>Multiplication table
6054 </caption>
6055 <tr>
6056 <th> &#215; </th>
6057 <th> 1 </th>
6058 <th> 2 </th>
6059 <th> 3
6060 </th></tr>
6061 <tr>
6062 <th> 1
6063 </th>
6064 <td> 1 </td>
6065 <td> 2 </td>
6066 <td> 3
6067 </td></tr>
6068 <tr>
6069 <th> 2
6070 </th>
6071 <td> 2 </td>
6072 <td> 4 </td>
6073 <td> 6
6074 </td></tr>
6075 <tr>
6076 <th> 3
6077 </th>
6078 <td> 3 </td>
6079 <td> 6 </td>
6080 <td> 9
6081 </td></tr>
6082 <tr>
6083 <th> 4
6084 </th>
6085 <td> 4 </td>
6086 <td> 8 </td>
6087 <td> 12
6088 </td></tr>
6089 <tr>
6090 <th> 5
6091 </th>
6092 <td> 5 </td>
6093 <td> 10 </td>
6094 <td> 15
6095 </td></tr></table>
6096
6097 !! end
6098
6099 !! test
6100 Accept "||" in table headings
6101 !! wikitext
6102 {|
6103 !h1 || h2
6104 |}
6105 !! html
6106 <table>
6107 <tr>
6108 <th>h1 </th>
6109 <th> h2
6110 </th></tr></table>
6111
6112 !! end
6113
6114 !! test
6115 Accept "!!" in table data
6116 !! wikitext
6117 {|
6118 | Foo!! ||
6119 |}
6120 !! html
6121 <table>
6122 <tr>
6123 <td> Foo!! </td>
6124 <td>
6125 </td></tr></table>
6126
6127 !! html/parsoid
6128 <table>
6129 <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>
6130 </tbody></table>
6131 !! end
6132
6133 !! test
6134 Accept "||" in indented table headings
6135 !! wikitext
6136 :{|
6137 !h1 || h2
6138 |}
6139 !! html
6140 <dl><dd><table>
6141 <tr>
6142 <th>h1 </th>
6143 <th> h2
6144 </th></tr></table></dd></dl>
6145
6146 !! end
6147
6148 !! test
6149 Accept "!!" in templates
6150 !! wikitext
6151 {|
6152 !a {{echo|b!!c}}
6153 |}
6154 !! html/php
6155 <table>
6156 <tr>
6157 <th>a b</th>
6158 <th>c
6159 </th></tr></table>
6160
6161 !! html/parsoid
6162 <table>
6163 <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>
6164 !! end
6165
6166 !! test
6167 Accept "!!" in table headings after newline
6168 !! wikitext
6169 {|
6170 !a
6171 b!!c
6172 |}
6173 !! html/php
6174 <table>
6175 <tr>
6176 <th>a
6177 <p>b!!c
6178 </p>
6179 </th></tr></table>
6180
6181 !! html/parsoid
6182 <table>
6183 <tbody><tr><th>a
6184 <p>b!!c</p></th></tr>
6185 </tbody></table>
6186 !! end
6187
6188 !! test
6189 Accept "!!" in table data of mixed wikitext / html syntax
6190 !! wikitext
6191 {|
6192 !a
6193 <tr><td>b!!c</td></tr>
6194 |}
6195 !! html+tidy
6196 <table>
6197 <tr>
6198 <th>a</th>
6199 </tr>
6200 <tr>
6201 <td>b!!c</td>
6202 </tr>
6203 </table>
6204 !! html/parsoid
6205 <table>
6206 <tbody><tr><th>a</th></tr>
6207 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6208 </tbody></table>
6209 !! end
6210
6211 !! test
6212 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6213 !! wikitext
6214 {|
6215 !| h1
6216 || a
6217 |}
6218 !! html
6219 <table>
6220 <tr>
6221 <th> h1
6222 </th>
6223 <td> a
6224 </td></tr></table>
6225
6226 !! end
6227
6228 !!test
6229 Accept "| !" at start of line in tables (ignore !-attribute)
6230 !! wikitext
6231 {|
6232 |-
6233 | !style="color:red" | bar
6234 |}
6235 !! html
6236 <table>
6237
6238 <tr>
6239 <td> bar
6240 </td></tr></table>
6241
6242 !!end
6243
6244 !!test
6245 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 +/-
6246 !! wikitext
6247 {|
6248 |-
6249 |style='color:red;'|+1
6250 |style='color:blue;'|-1
6251 |-
6252 | 1 || 2 || 3
6253 | 1 ||+2 ||-3
6254 |-
6255 | +1
6256 | -1
6257 |}
6258 !! html
6259 <table>
6260
6261 <tr>
6262 <td style="color:red;">+1
6263 </td>
6264 <td style="color:blue;">-1
6265 </td></tr>
6266 <tr>
6267 <td> 1 </td>
6268 <td> 2 </td>
6269 <td> 3
6270 </td>
6271 <td> 1 </td>
6272 <td>+2 </td>
6273 <td>-3
6274 </td></tr>
6275 <tr>
6276 <td> +1
6277 </td>
6278 <td> -1
6279 </td></tr></table>
6280
6281 !!end
6282
6283 !! test
6284 Table rowspan
6285 !! wikitext
6286 {| border=1
6287 | Cell 1, row 1
6288 |rowspan=2| Cell 2, row 1 (and 2)
6289 | Cell 3, row 1
6290 |-
6291 | Cell 1, row 2
6292 | Cell 3, row 2
6293 |}
6294 !! html
6295 <table border="1">
6296 <tr>
6297 <td> Cell 1, row 1
6298 </td>
6299 <td rowspan="2"> Cell 2, row 1 (and 2)
6300 </td>
6301 <td> Cell 3, row 1
6302 </td></tr>
6303 <tr>
6304 <td> Cell 1, row 2
6305 </td>
6306 <td> Cell 3, row 2
6307 </td></tr></table>
6308
6309 !! end
6310
6311 !! test
6312 Nested table
6313 !! wikitext
6314 {| border=1
6315 | &alpha;
6316 |
6317 {| bgcolor=#ABCDEF border=2
6318 |nested
6319 |-
6320 |table
6321 |}
6322 |the original table again
6323 |}
6324 !! html
6325 <table border="1">
6326 <tr>
6327 <td> &#945;
6328 </td>
6329 <td>
6330 <table bgcolor="#ABCDEF" border="2">
6331 <tr>
6332 <td>nested
6333 </td></tr>
6334 <tr>
6335 <td>table
6336 </td></tr></table>
6337 </td>
6338 <td>the original table again
6339 </td></tr></table>
6340
6341 !! end
6342
6343 !! test
6344 Invalid attributes in table cell (bug 1830)
6345 !! wikitext
6346 {|
6347 |Cell:|broken
6348 |}
6349 !! html
6350 <table>
6351 <tr>
6352 <td>broken
6353 </td></tr></table>
6354
6355 !! end
6356
6357 !! test
6358 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6359 !! wikitext
6360 {|
6361 | title="foo" |bar
6362 | title="foo<nowiki>|</nowiki>" |bar
6363 | title="foo<nowiki>|</nowiki>" bar
6364 |}
6365 !! html/php
6366 <table>
6367 <tr>
6368 <td title="foo">bar
6369 </td>
6370 <td title="foo&#124;">bar
6371 </td>
6372 <td> title="foo|" bar
6373 </td></tr></table>
6374
6375 !! html/parsoid
6376 <table>
6377 <tbody><tr><td title="foo">bar</td>
6378 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6379 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6380 </tbody></table>
6381 !! end
6382
6383 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6384 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6385 # *2wt modes will fail.
6386 !! test
6387 Table security: embedded pipes
6388 !! options
6389 parsoid=wt2html,html2html
6390 !! wikitext
6391 {|
6392 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6393 !! html/php
6394 <table>
6395 <tr>
6396 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6397 <td>]" onmouseover="alert(document.cookie)"&gt;test
6398 </td>
6399 </tr>
6400 </table>
6401
6402 !! html/parsoid
6403 <table><tbody>
6404 <tr>
6405 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6406 !! end
6407
6408 !! test
6409 Element attributes with double ! should not be broken up by <th>
6410 !! wikitext
6411 {|
6412 ! hi <div class="!!">ha</div> ho
6413 |}
6414 !! html/php
6415 <table>
6416 <tr>
6417 <th> hi <div class="!!">ha</div> ho
6418 </th></tr></table>
6419
6420 !! html/parsoid
6421 <table>
6422 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6423 </tbody></table>
6424 !! end
6425
6426 !! test
6427 ! and || in element attributes should not be parsed as <th>/<td>
6428 !! wikitext
6429 {|
6430 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6431 |}
6432 !! html/php
6433 <table>
6434 <tr>
6435 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6436 </td></tr></table>
6437
6438 !! html/parsoid
6439 <table>
6440 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6441 </tbody></table>
6442 !! end
6443
6444 # FIXME: The output seems broken. Filed as T110268.
6445 !! test
6446 ! and || in td attributes should not be parsed as <th>/<td>
6447 !! options
6448 parsoid=wt2html
6449 !! wikitext
6450 {|
6451 | style="color: red !important;" data-contrived="put this here ||" | foo
6452 |}
6453 !! html/php
6454 <table>
6455 <tr>
6456 <td> style="color: red !important;" data-contrived="put this here </td>
6457 <td> foo
6458 </td></tr></table>
6459
6460 !! html/parsoid
6461 <table>
6462 <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>
6463 </tbody></table>
6464 !! end
6465
6466 !! test
6467 Break on | in element attribute in template
6468 !! options
6469 parsoid=wt2html,html2html
6470 !! wikitext
6471 {{echo|1=<div class="hi|ho">ha</div>}}
6472 !! html/php
6473 <p>ho"&gt;ha&lt;/div&gt;
6474 </p>
6475 !! html/parsoid
6476 <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>
6477 !! end
6478
6479 !! test
6480 Don't break on | in extension attribute in template
6481 !! wikitext
6482 {{echo|<ref name="hi|ho">ha</ref>}}
6483
6484 <references />
6485 !! html/parsoid
6486 <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>
6487
6488 <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>
6489 !! end
6490
6491 ## We don't support roundtripping of these attributes in Parsoid.
6492 ## Selective serialization takes care of preventing dirty diffs.
6493 ## But, on edits, we dirty-diff the invalid attribute text.
6494 !! test
6495 Invalid text in table attributes should be discarded
6496 !! options
6497 parsoid=wt2html
6498 !! wikitext
6499 {| <span>boo</span> style='border:1px solid black'
6500 | <span>boo</span> style='color:blue' | 1
6501 |<span>boo</span> style='color:blue'| 2
6502 |}
6503 !! html/php
6504 <table style="border:1px solid black">
6505 <tr>
6506 <td style="color:blue"> 1
6507 </td>
6508 <td style="color:blue"> 2
6509 </td></tr></table>
6510
6511 !! html/parsoid
6512 <table style="border:1px solid black">
6513 <tr>
6514 <td style="color:blue"> 1</td>
6515 <td style="color:blue"> 2</td>
6516 </tr>
6517 </table>
6518 !! end
6519
6520 !! test
6521 Invalid text in table attributes should be preserved by selective serializer
6522 !! options
6523 parsoid={
6524 "modes": ["selser"],
6525 "changes": [
6526 ["td:first-child", "text", "abc"],
6527 ["td + td", "text", "xyz"]
6528 ]
6529 }
6530 !! wikitext
6531 {| <span>boo</span> style='border:1px solid black'
6532 | <span>boo</span> style='color:blue' | 1
6533 |<span>boo</span> style='color:blue'| 2
6534 |}
6535 !! wikitext/edited
6536 {| <span>boo</span> style='border:1px solid black'
6537 | <span>boo</span> style='color:blue' |abc
6538 |<span>boo</span> style='color:blue'|xyz
6539 |}
6540 !! end
6541
6542 !! test
6543 1. Template-generated table cell attributes and cell content
6544 !! wikitext
6545 {|
6546 |{{table_attribs}}
6547 | {{table_attribs}}
6548 || {{table_attribs_5}}
6549 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6550 |align=center {{table_attribs}}
6551 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6552 |}
6553 !! html
6554 <table>
6555 <tr>
6556 <td style="color:red;">Foo
6557 </td>
6558 <td style="color:red;">Foo
6559 </td>
6560 <td> style="color:red;"</td>
6561 <td>Bar
6562 </td>
6563 <td style="color:red;">Foo
6564 </td>
6565 <td align="center" style="color:red;">Foo
6566 </td>
6567 <td align="center" style="color:red;">Foo
6568 </td></tr></table>
6569
6570 !! end
6571
6572 !! test
6573 2. Template-generated table cell attributes and cell content
6574 !! wikitext
6575 {|
6576 |{{table_attribs_2}}
6577 |}
6578 !! html/php
6579 <table>
6580 <tr>
6581 <td style="color:red;">Foo
6582 </td>
6583 <td>Bar</td>
6584 <td>Baz
6585 </td></tr></table>
6586
6587 !! html/parsoid
6588 <table>
6589 <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>
6590 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6591 </tbody></table>
6592 !! end
6593
6594 !! test
6595 3. Template-generated table cell attributes and cell content
6596 !! wikitext
6597 {|
6598 !align=center {{table_header_cells}}
6599 |-
6600 |align=center {{table_cells}}
6601 |}
6602 !! html/php
6603 <table>
6604 <tr>
6605 <th align="center" style="color:red;">Foo</th>
6606 <th style="color:red;"><i>Bar</i></th>
6607 <th style="color:brown;"><i>Foo</i> and Baz
6608 </th></tr>
6609 <tr>
6610 <td align="center" style="color:red;">Foo</td>
6611 <td style="color:red;"><i>Bar</i></td>
6612 <td style="color:brown;"><i>Foo</i> and Baz
6613 </td></tr></table>
6614
6615 !! html/parsoid
6616 <table>
6617 <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>
6618 <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>
6619 </tbody></table>
6620 !! end
6621
6622 !! test
6623 4. Template-generated table cell attributes and cell content inside a templated table
6624 !! wikitext
6625 {{tbl-start}}
6626 !align=center {{table_header_cells}}
6627 |-
6628 |align=center {{table_cells}}
6629 {{tbl-end}}
6630 !! html/php
6631 <table>
6632 <tr>
6633 <th align="center" style="color:red;">Foo</th>
6634 <th style="color:red;"><i>Bar</i></th>
6635 <th style="color:brown;"><i>Foo</i> and Baz
6636 </th></tr>
6637 <tr>
6638 <td align="center" style="color:red;">Foo</td>
6639 <td style="color:red;"><i>Bar</i></td>
6640 <td style="color:brown;"><i>Foo</i> and Baz
6641 </td></tr></table>
6642
6643 !! html/parsoid
6644 <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}}]}'>
6645 <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>
6646 <tr>
6647 <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>
6648 </tbody></table>
6649 !! end
6650
6651 ## Edge case fix to prevent future regressions
6652 !! test
6653 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6654 !! wikitext
6655 {|
6656 |{{table_attribs_7}}
6657 |}
6658 <references />
6659 !! html/parsoid
6660 <table>
6661 <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>
6662 </tbody></table>
6663 <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>
6664 !! end
6665
6666 !! test
6667 Table with row followed by newlines and table heading
6668 !! options
6669 parsoid=wt2html,html2html
6670 !! wikitext
6671 {|
6672 |-
6673
6674 ! foo
6675 |}
6676 !! html/*
6677 <table>
6678
6679
6680 <tr>
6681 <th> foo
6682 </th></tr></table>
6683
6684 !! end
6685
6686 !! test
6687 Table with empty line following the start tag
6688 !! options
6689 parsoid=wt2html,html2html
6690 !! wikitext
6691 {|
6692
6693 |-
6694 | foo
6695 |}
6696 !! html/*
6697 <table>
6698
6699
6700 <tr>
6701 <td> foo
6702 </td></tr></table>
6703
6704 !! end
6705
6706 !! test
6707 Table attributes with empty value
6708 !! options
6709 parsoid=wt2html,html2html
6710 !! wikitext
6711 {|
6712 | style=| hello
6713 |}
6714 !! html/php
6715 <table>
6716 <tr>
6717 <td style=""> hello
6718 </td></tr></table>
6719
6720 !! html/parsoid
6721 <table>
6722 <tbody><tr><td style=""> hello</td></tr>
6723 </tbody></table>
6724 !! end
6725
6726 !! test
6727 Wikitext table with a lot of comments
6728 !! wikitext
6729 {|
6730 <!-- c0 -->
6731 | foo
6732 <!-- c1 -->
6733 |-<!-- c2 -->
6734 <!-- c3 -->
6735 |<!-- c4 -->
6736 <!-- c5 -->
6737 |}
6738 !! html
6739 <table>
6740 <tr>
6741 <td> foo
6742 </td></tr>
6743 <tr>
6744 <td>
6745 </td></tr></table>
6746
6747 !! end
6748
6749 !! test
6750 Wikitext table comments represented in parsoid dom
6751 !! wikitext
6752 {|<!--c1--><!--c2-->
6753 |-<!--c3-->
6754 | x
6755 |}
6756 !! html/php+tidy
6757 <table>
6758 <tr>
6759 <td>x</td>
6760 </tr>
6761 </table>
6762 !! html/parsoid
6763 <table><!--c1--><!--c2-->
6764 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6765 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6766 </tbody></table>
6767 !! end
6768
6769 !! test
6770 Wikitext table with double-line table cell
6771 !! wikitext
6772 {|
6773 |a
6774 b
6775 |}
6776 !! html
6777 <table>
6778 <tr>
6779 <td>a
6780 <p>b
6781 </p>
6782 </td></tr></table>
6783
6784 !! end
6785
6786 !! test
6787 Table cell with a single comment
6788 !! wikitext
6789 {|
6790 | <!-- c1 -->
6791 | a
6792 |}
6793 !! html
6794 <table>
6795 <tr>
6796 <td>
6797 </td>
6798 <td> a
6799 </td></tr></table>
6800
6801 !! end
6802
6803 !! test
6804 Table-cell after a comment-only-empty-line
6805 !! wikitext
6806 {|
6807 |a
6808 <!--c1-->
6809 <!--c2-->| b
6810 |}
6811 !! html
6812 <table>
6813 <tr>
6814 <td>a
6815 </td>
6816 <td> b
6817 </td></tr></table>
6818
6819 !! html/parsoid
6820 <table>
6821 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6822 <!--c1-->
6823 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6824 </tbody></table>
6825
6826 !! end
6827
6828 !! test
6829 Build table with {{!}}
6830 !! wikitext
6831 {{{!}} class="wikitable"
6832 ! header
6833 ! second header
6834 {{!}}- style="color:red;"
6835 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6836 {{!}}}
6837 !! html
6838 <table class="wikitable">
6839 <tr>
6840 <th> header
6841 </th>
6842 <th> second header
6843 </th></tr>
6844 <tr style="color:red;">
6845 <td> data </td>
6846 <td style="color:red;"> second data
6847 </td></tr></table>
6848
6849 !! end
6850
6851 !! test
6852 Build table with pipe as data
6853 !! wikitext
6854 {| class="wikitable"
6855 ! header
6856 ! second header
6857 |- style="color:red;"
6858 | data || style="color:red;" | second data
6859 |-
6860 | style="color:red;" | data with | || style="color:red;" | second data with |
6861 |-
6862 || data with | ||| second data with |
6863 |}
6864 !! html
6865 <table class="wikitable">
6866 <tr>
6867 <th> header
6868 </th>
6869 <th> second header
6870 </th></tr>
6871 <tr style="color:red;">
6872 <td> data </td>
6873 <td style="color:red;"> second data
6874 </td></tr>
6875 <tr>
6876 <td style="color:red;"> data with | </td>
6877 <td style="color:red;"> second data with |
6878 </td></tr>
6879 <tr>
6880 <td> data with | </td>
6881 <td> second data with |
6882 </td></tr></table>
6883
6884 !! end
6885
6886 !! test
6887 Build table with wikilink
6888 !! wikitext
6889 {| class="wikitable"
6890 ! header || second header
6891 |- style="color:red;"
6892 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6893 |-
6894 | data || second data [[Main Page|link|text with pipe]]
6895 |}
6896 !! html
6897 <table class="wikitable">
6898 <tr>
6899 <th> header </th>
6900 <th> second header
6901 </th></tr>
6902 <tr style="color:red;">
6903 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6904 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6905 </td></tr>
6906 <tr>
6907 <td> data </td>
6908 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6909 </td></tr></table>
6910
6911 !! end
6912
6913 # The expected HTML structure in this test is debatable. The PHP parser does
6914 # not parse this kind of table at all. The main focus for Parsoid is on
6915 # round-tripping, so this output is ok for now. TODO: revisit!
6916 !! test
6917 Wikitext table with html-syntax row
6918 !! wikitext
6919 {|
6920 |-
6921 <td>foo</td>
6922 |}
6923 !! html/parsoid
6924 <table>
6925 <tbody>
6926 <tr>
6927 <td>foo</td></tr></tbody></table>
6928 !! end
6929
6930 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6931 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6932 ## PHP parser, which tidy then compounds by fostering the content
6933 ## entirely out of the table. Parsoid recognizes the table context
6934 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6935 ## depends on PHP's treatment of broken table markup!
6936 !! test
6937 Implicit <td> after a |-
6938 !! options
6939 parsoid=wt2html,html2html
6940 !! wikitext
6941 {|
6942 |-
6943 a
6944 |}
6945 !! html/php
6946 <table>
6947
6948 a
6949 </table>
6950
6951 !! html/php+tidy
6952 <p>a</p>
6953 !! html/parsoid
6954 <table>
6955 <tr><td>a</td></tr>
6956 </table>
6957 !! end
6958
6959 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6960 !! test
6961 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6962 !! options
6963 parsoid=wt2html,html2html
6964 !! wikitext
6965 {|
6966 |-
6967 |
6968 a
6969 |-
6970 b
6971 |}
6972 !! html/php
6973 <table>
6974
6975 <tr>
6976 <td>
6977 <pre>a
6978 </pre>
6979 </td></tr>
6980 b
6981 </table>
6982
6983 !! html/php+tidy
6984 <p>b</p>
6985 <table>
6986 <tr>
6987 <td>
6988 <pre>
6989 a
6990 </pre></td>
6991 </tr>
6992 </table>
6993 !! html/parsoid
6994 <table>
6995 <tbody>
6996 <tr><td><pre>a</pre></td></tr>
6997 <tr><td> b</td></tr>
6998 </tbody>
6999 </table>
7000 !! end
7001
7002 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
7003 # Parsoid generates the missing <td>, so wt2wt won't succeed.
7004 !! test
7005 Lists should be recognized in an implicit <td> context
7006 !! options
7007 parsoid=wt2html,html2html
7008 !! wikitext
7009 {|
7010 |-
7011 *a
7012 |}
7013 !! html/php
7014 <table>
7015
7016 <ul><li>a</li></ul>
7017 </table>
7018
7019 !! html/php+tidy
7020 <ul>
7021 <li>a</li>
7022 </ul>
7023 !! html/parsoid
7024 <table>
7025 <tr>
7026 <td><ul>
7027 <li>a</li>
7028 </ul></td>
7029 </tr>
7030 </table>
7031 !! end
7032
7033 !! test
7034 Table cells not properly parsed in an implicit-td context
7035 !! wikitext
7036 {|
7037 |-
7038 {{table_attribs_4}} || a || b
7039 |}
7040 !! html/php+tidy
7041 <table>
7042 <tr>
7043 <td style="background-color:#DC241f;" width="10px"></td>
7044 <td>a</td>
7045 <td>b</td>
7046 </tr>
7047 </table>
7048 !! html/parsoid
7049 <table>
7050 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7051 <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}}," "]}'> </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> a </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> b</td></tr>
7052 </tbody></table>
7053 !! end
7054
7055 !! test
7056 Parsoid: Round-trip tables directly followed by content (bug 51219)
7057 !! options
7058 parsoid=wt2html,wt2wt
7059 !! wikitext
7060 {|
7061 |foo
7062 |} bar
7063
7064 {|
7065 |baz
7066 |}<b>quux</b>
7067 !! html+tidy
7068 <table>
7069 <tr>
7070 <td>foo</td>
7071 </tr>
7072 </table>
7073 <p>bar</p>
7074 <table>
7075 <tr>
7076 <td>baz</td>
7077 </tr>
7078 </table>
7079 <p><b>quux</b></p>
7080 !! end
7081
7082 !! test
7083 Parsoid: Default to a newline after tables in new content (bug 51219)
7084 !! options
7085 parsoid=html2wt
7086 !! html/parsoid
7087 <table><tbody>
7088 <tr><td>foo</td></tr></tbody></table> bar
7089 <table><tbody>
7090 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7091 !! wikitext
7092 {|
7093 |foo
7094 |}
7095 <nowiki> </nowiki>bar
7096 {|
7097 |baz
7098 |}
7099 '''quux'''
7100 !! end
7101
7102 !! test
7103 Parsoid: newline inducing block nodes don't suppress <nowiki>
7104 !! options
7105 parsoid=html2wt
7106 !! html/parsoid
7107 a<h1>foo</h1>
7108 !! wikitext
7109 <nowiki> </nowiki>a
7110
7111 = foo =
7112 !! end
7113
7114 !! test
7115 Parsoid: Row-syntax table headings followed by comment & table cells
7116 !! options
7117 parsoid=wt2html,wt2wt
7118 !! wikitext
7119 {|
7120 ! foo || bar
7121 <!-- foo --> || baz || quux
7122 |}
7123 !! html/php
7124 <table>
7125 <tr>
7126 <th> foo </th>
7127 <th> bar
7128 </th>
7129 <td> baz </td>
7130 <td> quux
7131 </td></tr></table>
7132
7133 !! html/parsoid
7134 <table>
7135 <tbody><tr><th> foo </th><th> bar
7136 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7137 </tbody></table>
7138 !! end
7139
7140 !!test
7141 Parsoid: Recover better from broken table attributes
7142 !!options
7143 parsoid=wt2html
7144 !!wikitext
7145 {| class="foo
7146 | class="bar" |
7147 foo
7148 |}
7149 !!html/php+tidy
7150 <table class="foo">
7151 <tr>
7152 <td class="bar">
7153 <p>foo</p>
7154 </td>
7155 </tr>
7156 </table>
7157 !!html/parsoid
7158 <table class="foo">
7159 <tr>
7160 <td class="bar">
7161 <p>foo</p></td></tr>
7162 </tbody></table>
7163 !!end
7164
7165 !! test
7166 Tables: Digest broken attributes on table and tr tag
7167 !! options
7168 parsoid=wt2html
7169 !! wikitext
7170 {| || |} ++
7171 |- || || ++ --
7172 |- > [
7173 |}
7174 !! html
7175 <table>
7176 <tbody>
7177 <tr></tr>
7178 <tr></tr>
7179 </tbody></table>
7180 !! end
7181
7182 # T137406: Whitespace in the HTML
7183 !! test
7184 1. Generate correct wikitext for tables with thead/tbody/tfoot
7185 !! options
7186 parsoid=html2wt
7187 !! html/parsoid
7188 <table>
7189 <caption>Test</caption>
7190 <thead>
7191 <tr>
7192 <th>Month</th>
7193 <th>Savings</th>
7194 </tr>
7195 </thead>
7196 <tbody>
7197 <tr>
7198 <td>January</td>
7199 <td>$100</td>
7200 </tr>
7201 <tr>
7202 <td>February</td>
7203 <td>$80</td>
7204 </tr>
7205 </tbody>
7206 <tfoot>
7207 <tr>
7208 <td>Sum</td>
7209 <td>$180</td>
7210 </tr>
7211 </tfoot>
7212 </table>
7213 !! wikitext
7214 {|
7215 |+Test
7216 !Month
7217 !Savings
7218 |-
7219 |January
7220 |$100
7221 |-
7222 |February
7223 |$80
7224 |-
7225 |Sum
7226 |$180
7227 |}
7228 !! html/php+tidy
7229 <table>
7230 <caption>Test</caption>
7231 <tr>
7232 <th>Month</th>
7233 <th>Savings</th>
7234 </tr>
7235 <tr>
7236 <td>January</td>
7237 <td>$100</td>
7238 </tr>
7239 <tr>
7240 <td>February</td>
7241 <td>$80</td>
7242 </tr>
7243 <tr>
7244 <td>Sum</td>
7245 <td>$180</td>
7246 </tr>
7247 </table>
7248 !! end
7249
7250 # T137406: No whitespace in the HTML
7251 !! test
7252 2. Generate correct wikitext for tables with thead/tbody/tfoot
7253 !! options
7254 parsoid=html2wt
7255 !! html/parsoid
7256 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7257 !! wikitext
7258 {|
7259 !heading
7260 |-
7261 |foo
7262 |}
7263 !! end
7264
7265 !! test
7266 Testing serialization after deletion in references
7267 !! options
7268 parsoid={
7269 "modes": ["wt2wt"],
7270 "changes": [
7271 ["#x", "remove"]
7272 ]
7273 }
7274 !! wikitext
7275 hi <ref><div id="x">ho</div></ref>
7276
7277 <references />
7278 !! wikitext/edited
7279 hi <ref></ref>
7280
7281 <references />
7282 !! end
7283
7284 !!test
7285 Testing serialization after deletion of table cells
7286 !!options
7287 parsoid={
7288 "modes": ["wt2wt", "selser"],
7289 "changes": [
7290 ["#x", "remove"]
7291 ]
7292 }
7293 !!wikitext
7294 {|
7295 !h1 !!h2 !!h3
7296 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7297 |}
7298 !! wikitext/edited
7299 {|
7300 !h1 !!h2 !!h3
7301 |c2 |||c3
7302 |}
7303 !!end
7304
7305 !! test
7306 Testing selser after addition of new row before first row (T125419)
7307 !! options
7308 parsoid={
7309 "modes": ["wt2wt", "selser"],
7310 "changes": [
7311 [ "tr", "before", "<tr><td>X</td></tr>" ]
7312 ]
7313 }
7314 !! wikitext
7315 {|
7316 |a
7317 |}
7318 !! wikitext/edited
7319 {|
7320 |X
7321 |-
7322 |a
7323 |}
7324 !! end
7325
7326 !! test
7327 Serialize new table rows in a HTML table using HTML tags
7328 !! options
7329 parsoid={
7330 "modes": ["wt2wt", "selser"],
7331 "changes": [
7332 [ "tr", "before", "<tr><td>X</td></tr>" ]
7333 ]
7334 }
7335 !! wikitext
7336 <table><tr><td>a</td></tr></table>
7337 !! wikitext/edited
7338 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7339 !! end
7340
7341 !! test
7342 Serialize new table cells in a HTML row using HTML tags
7343 !! options
7344 parsoid={
7345 "modes": ["wt2wt", "selser"],
7346 "changes": [
7347 [ "td", "before", "<td>X</td>" ]
7348 ]
7349 }
7350 !! wikitext
7351 <table><tr><td>a</td></tr></table>
7352 !! wikitext/edited
7353 <table><tr><td>X</td><td>a</td></tr></table>
7354 !! end
7355
7356 !! test
7357 Wikitext tables can be nested inside HTML tables
7358 !! options
7359 parsoid=html2wt
7360 !! html
7361 <table data-parsoid='{"stx":"html"}'>
7362 <tr><td>
7363 <table>
7364 <tr><td>foo</td></tr>
7365 </table>
7366 </td></tr>
7367 </table>
7368 !! wikitext
7369 <table>
7370 <tr><td>
7371 {|
7372 |foo
7373 |}
7374 </td></tr>
7375 </table>
7376 !! end
7377
7378 !! test
7379 Serialize wikitext list items as HTML list items when embedded in a HTML list
7380 !! options
7381 parsoid=html2wt
7382 !! html
7383 <ul data-parsoid='{"stx": "html"}'>
7384 <li data-parsoid='{}'>a</li>
7385 <li>b</li>
7386 </ul>
7387 !! wikitext
7388 <ul>
7389 <li>a</li>
7390 <li>b</li>
7391 </ul>
7392 !! end
7393
7394 # SSS FIXME: Is this actually a good thing given the
7395 # odd nested list output that is generated by MW?
7396 # <ul><li>foo<ul>..</ul></li></ul> instead of
7397 # <ul><li>foo</li><ul>..</ul></ul>
7398 !! test
7399 Wikitext lists can be nested inside HTML lists
7400 !! options
7401 parsoid=html2wt
7402 !! html
7403 <ul data-parsoid='{"stx": "html"}'>
7404 <li data-parsoid='{"stx": "html"}'>a
7405 <ul><li>b</li></ul>
7406 </li>
7407 </ul>
7408
7409 <ul data-parsoid='{"stx": "html"}'>
7410 <li>x
7411 <ul><li>y</li></ul>
7412 </li>
7413 </ul>
7414 !! wikitext
7415 <ul>
7416 <li>a
7417 * b
7418 </li>
7419 </ul>
7420
7421 <ul>
7422 <li>x
7423 * y
7424 </li>
7425 </ul>
7426 !! end
7427
7428 ###
7429 ### Internal links
7430 ###
7431 !! test
7432 Plain link, capitalized
7433 !! wikitext
7434 [[Main Page]]
7435 !! html
7436 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7437 </p>
7438 !! end
7439
7440 !! test
7441 Plain link, uncapitalized
7442 !! wikitext
7443 [[main Page]]
7444 !! html
7445 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7446 </p>
7447 !! end
7448
7449 !! test
7450 Piped link
7451 !! wikitext
7452 [[Main Page|The Main Page]]
7453 !! html
7454 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7455 </p>
7456 !! end
7457
7458 !! test
7459 Piped link with comment in link text
7460 !! wikitext
7461 [[Main Page|The Main<!--front--> Page]]
7462 !! html
7463 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7464 </p>
7465 !! end
7466
7467 !! test
7468 Piped link with multiple pipe characters in link text
7469 !! wikitext
7470 [[Main Page||The|Main|Page|]]
7471 !! html/php
7472 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7473 </p>
7474 !! html/parsoid
7475 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7476 !! end
7477
7478 !! test
7479 Piped link with no link text
7480 !! wikitext
7481 [[Thomas Bek (bishop of St David's)|]]
7482 !! html/php
7483 <p>[[Thomas Bek (bishop of St David's)|]]
7484 </p>
7485 !! html/parsoid
7486 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7487 !! end
7488
7489 !! test
7490 Piped link with empty link text
7491 !! wikitext
7492 [[Main Page|<nowiki />]] - empty nowiki
7493 [[Main Page| ]] - empty space
7494 [[Main Page|&nbsp;]] - empty non breaking space
7495 !! html/php
7496 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7497 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7498 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7499 </p>
7500 !! html/parsoid
7501 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki />"}'/></a> - empty nowiki
7502 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7503 <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>
7504 !! end
7505
7506 !! test
7507 Broken link
7508 !! wikitext
7509 [[Zigzagzogzagzig]]
7510 !! html
7511 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7512 </p>
7513 !! end
7514
7515 !! test
7516 Broken link with fragment
7517 !! wikitext
7518 [[Zigzagzogzagzig#zug]]
7519 !! html
7520 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7521 </p>
7522 !! end
7523
7524 !! test
7525 Special page link with fragment
7526 !! wikitext
7527 [[Special:Version#anchor]]
7528 !! html
7529 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7530 </p>
7531 !! end
7532
7533 !! test
7534 Nonexistent special page link with fragment
7535 !! wikitext
7536 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7537 !! html
7538 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7539 </p>
7540 !! end
7541
7542 !! test
7543 Link with prefix
7544 !! wikitext
7545 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7546 !! html
7547 <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>
7548 </p>
7549 !! end
7550
7551 !! test
7552 Link with suffix
7553 !! wikitext
7554 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7555 !! html
7556 <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>!!!
7557 </p>
7558 !! end
7559
7560 !! article
7561 prefixed article
7562 !! text
7563 Some text
7564 !! endarticle
7565
7566 !! test
7567 Bug 43661: Piped links with identical prefixes
7568 !! wikitext
7569 [[prefixed article|prefixed articles with spaces]]
7570
7571 [[prefixed article|prefixed articlesaoeu]]
7572
7573 [[Main Page|Main Page test]]
7574 !! html
7575 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7576 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7577 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7578 </p>
7579 !! end
7580
7581
7582 !! test
7583 Link with HTML entity in suffix / tail
7584 !! wikitext
7585 [[Main Page]]&quot;, [[Main Page]]&#97;
7586 !! html/php
7587 <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;
7588 </p>
7589 !! html/parsoid
7590 <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>
7591 !! end
7592
7593 !! test
7594 Link with 3 brackets
7595 !! wikitext
7596 [[[Main Page]]]
7597 Foo [[[Main Page]]]
7598 !! html
7599 <p>[[[Main Page]]]
7600 Foo [[[Main Page]]]
7601 </p>
7602 !! end
7603
7604 !! test
7605 Link with 4 brackets
7606 !! wikitext
7607 [[[[Main Page]]]]
7608 !! html
7609 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7610 </p>
7611 !! end
7612
7613 !! test
7614 Piped link with 3 brackets
7615 !! wikitext
7616 [[[main page|the main page]]]
7617 !! html
7618 <p>[[[main page|the main page]]]
7619 </p>
7620 !! end
7621
7622 !! test
7623 Piped link with extlink-like text
7624 !! wikitext
7625 [[Main Page|[bar]]]
7626 [[Main Page|This is a [bar]]]
7627 !! html/php
7628 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7629 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7630 </p>
7631 !! html/parsoid
7632 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7633 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7634 !! end
7635
7636 !! test
7637 Link with multiple pipes
7638 !! wikitext
7639 [[Main Page|The|Main|Page]]
7640 !! html
7641 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7642 </p>
7643 !! end
7644
7645 !! test
7646 Anchor containing a #. (bug 63430)
7647 !! wikitext
7648 [[Main Page#And#Link]]
7649 !! html/php
7650 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7651 </p>
7652 !! html/parsoid
7653 <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>
7654 !! end
7655
7656 !! test
7657 Link to namespaces
7658 !! wikitext
7659 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7660 !! html
7661 <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>
7662 </p>
7663 !! end
7664
7665 !! test
7666 Link with space in namespace
7667 !! wikitext
7668 [[User talk:Foo bar]]
7669 !! html
7670 <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>
7671 </p>
7672 !! end
7673
7674 !! article
7675 MemoryAlpha:AlphaTest
7676 !! text
7677 This is an article in the MemoryAlpha namespace
7678 (which shadows the memoryalpha interwiki link).
7679 !! endarticle
7680
7681 !! test
7682 Namespace takes precedence over interwiki link (bug 51680)
7683 !! wikitext
7684 [[MemoryAlpha:AlphaTest]]
7685 !! html
7686 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7687 </p>
7688 !! end
7689
7690 # The previous test doesn't work correctly in html2*, due to not recognizing the
7691 # link as an internal one. This one checks for the correct behavior.
7692 !! test
7693 Link to namespace preferred over interwiki with correct rel attribute
7694 !! options
7695 parsoid=html2wt,html2html
7696 !! html/parsoid
7697 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7698 !! wikitext
7699 [[MemoryAlpha:AlphaTest]]
7700 !! end
7701
7702 !! test
7703 Piped link to namespace
7704 !! wikitext
7705 [[Meta:Disclaimers|The disclaimers]]
7706 !! html
7707 <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>
7708 </p>
7709 !! end
7710
7711 !! test
7712 Link containing }
7713 !! wikitext
7714 [[Usually caused by a typo (oops}]]
7715 !! html
7716 <p>[[Usually caused by a typo (oops}]]
7717 </p>
7718 !! end
7719
7720 !! article
7721 7% Solution
7722 !! text
7723 Just a test of an article title containing a percent.
7724 !! endarticle
7725
7726 !! test
7727 Link containing % (not as a hex sequence)
7728 !! wikitext
7729 [[7% Solution]]
7730 [[7% Solution|7%25 Solution]]
7731 !! html/php
7732 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7733 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7734 </p>
7735 !! html/parsoid
7736 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7737 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7738 !! end
7739
7740 # note that the parsoid HTML is identical to the previous test output,
7741 # so the previous test ensures that the html2wt mode will generate the
7742 # "not as a hex sequence" wikitext.
7743 !! test
7744 Link containing % as a single hex sequence interpreted to char
7745 !! options
7746 parsoid=wt2wt,wt2html,html2html
7747 !! wikitext
7748 [[7%25 Solution]]
7749 [[7%25 Solution|7%25 Solution]]
7750 !! html/php
7751 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7752 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7753 </p>
7754 !! html/parsoid
7755 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7756 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7757 !!end
7758
7759 !! test
7760 Link containing % as a double hex sequence interpreted to hex sequence
7761 !! wikitext
7762 [[7%2525 Solution]]
7763 !! html
7764 <p>[[7%2525 Solution]]
7765 </p>
7766 !!end
7767
7768 ## Example for such a section: == < ==
7769 !! test
7770 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7771 !! wikitext
7772 [[%23%3c]][[%23%3e]]
7773 !! html/php
7774 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7775 </p>
7776 !! html/parsoid
7777 <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>
7778 !! end
7779
7780 !! test
7781 Link containing "<#" and ">#" as a hex sequences
7782 !! wikitext
7783 [[%3c%23]][[%3e%23]]
7784 !! html
7785 <p>[[%3c%23]][[%3e%23]]
7786 </p>
7787 !! end
7788
7789 !! test
7790 Link containing an equals sign
7791 !! wikitext
7792 [[Special:BookSources/isbn=4-00-026157-6]]
7793 !! html/php
7794 <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>
7795 </p>
7796 !! html/parsoid
7797 <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>
7798 !! end
7799
7800 !! article
7801 Foo~bar
7802 !! text
7803 Just a test of an article title containing a tilde.
7804 !! endarticle
7805
7806 # note that links containing signatures, like [[Foo~~~~]], are
7807 # massaged by the pre-save transform (PST) and so the tildes are never
7808 # seen by the parser.
7809 !! test
7810 Link containing a tilde
7811 !! wikitext
7812 [[Foo~bar]]
7813 !! html/php
7814 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7815 </p>
7816 !! html/parsoid
7817 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7818 !! end
7819
7820 !! test
7821 Link containing double-single-quotes '' (bug 4598)
7822 !! wikitext
7823 [[Lista d''e paise d''o munno]]
7824 !! html/php
7825 <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>
7826 </p>
7827 !! html/parsoid
7828 <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>
7829 !! end
7830
7831 !! test
7832 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7833 !! wikitext
7834 Some [[Link|pretty ''italics'' and stuff]]!
7835 !! html/php
7836 <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>!
7837 </p>
7838 !! html/parsoid
7839 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7840 !! end
7841
7842 !! test
7843 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7844 !! wikitext
7845 ''Some [[Link|pretty ''italics'' and stuff]]!''
7846 !! html
7847 <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>
7848 </p>
7849 !! end
7850
7851 !! test
7852 Link with double quotes in title part (literal) and alternate part (interpreted)
7853 !! wikitext
7854 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7855
7856 [[''Pentecoste'']]
7857
7858 [[''Pentecoste''|Pentecoste]]
7859
7860 [[''Pentecoste''|''Pentecoste'']]
7861 !! html/php
7862 <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>
7863 </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>
7864 </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>
7865 </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>
7866 </p>
7867 !! html/parsoid
7868 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></span></p>
7869 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7870 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7871 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7872 !! end
7873
7874 !! test
7875 Broken image links with HTML captions (bug 39700)
7876 !! wikitext
7877 [[File:Nonexistent|<script></script>]]
7878 [[File:Nonexistent|100x100px|<script></script>]]
7879 [[File:Nonexistent|&lt;]]
7880 [[File:Nonexistent|a<i>b</i>c]]
7881 !! html/php
7882 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7883 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7884 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7885 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7886 </p>
7887 !! html/parsoid
7888 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7889 <span typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"100","width":"100"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7890 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;lt;\",\"srcContent\":\"&amp;lt;\",\"dsr\":[107,111,null,null]}&#39;>&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7891 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"a&lt;i>b&lt;/i>c"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[134,142,3,4]}&#39;>b&lt;/i>c"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span></p>
7892 !! end
7893
7894 !! test
7895 Plain link to URL
7896 !! wikitext
7897 [[http://www.example.com]]
7898 !! html/php
7899 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7900 </p>
7901 !! html/parsoid
7902 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7903 !! end
7904
7905 !! test
7906 Plain link to URL with link text
7907 !! wikitext
7908 [[http://www.example.com Link text]]
7909 !! html
7910 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7911 </p>
7912 !! end
7913
7914 !! test
7915 Plain link to protocol-relative URL
7916 !! wikitext
7917 [[//www.example.com]]
7918 !! html/php
7919 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7920 </p>
7921 !! html/parsoid
7922 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7923 !! end
7924
7925 !! test
7926 Plain link to protocol-relative URL with link text
7927 !! wikitext
7928 [[//www.example.com Link text]]
7929 !! html
7930 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7931 </p>
7932 !! end
7933
7934 !! test
7935 Plain link to page with question mark in title
7936 !! wikitext
7937 [[A?b]]
7938
7939 [[A?b|Baz]]
7940 !! html
7941 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7942 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7943 </p>
7944 !! end
7945
7946
7947 # I'm fairly sure the expected result here is wrong.
7948 # We want these to be URL links, not pseudo-pages with URLs for titles....
7949 # However the current output is also pretty screwy.
7950 #
7951 # ----
7952 # I'm changing it to match the current output--it arguably makes more
7953 # sense in the light of the test above. Old expected result was:
7954 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7955 #</p>
7956 # But I think this test is bordering on "garbage in, garbage out" anyway.
7957 # -- wtm
7958 !! test
7959 Piped link to URL
7960 !! wikitext
7961 Piped link to URL: [[http://www.example.com|an example URL]]
7962 !! html/php
7963 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7964 </p>
7965 !! html/parsoid
7966 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7967 !! end
7968
7969 !! test
7970 BUG 2: [[page|http://url/]] should link to page, not http://url/
7971 !! wikitext
7972 [[Main Page|http://url/]]
7973 !! html/php
7974 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7975 </p>
7976 !! html/parsoid
7977 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7978 !! end
7979
7980 # Parsoid does not mark self-links, by design.
7981 !! test
7982 BUG 337: Escaped self-links should be bold
7983 !! options
7984 title=[[Bug462]]
7985 !! wikitext
7986 [[Bu&#103;462]] [[Bug462]]
7987 !! html/php
7988 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7989 </p>
7990 !! html/php+tidy
7991 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7992 !! html/parsoid
7993 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7994 !! end
7995
7996 !! test
7997 Self-link to section should not be bold
7998 !! options
7999 title=[[Main Page]]
8000 !! wikitext
8001 [[Main Page#section]]
8002 !! html
8003 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8004 </p>
8005 !! end
8006
8007 !! article
8008 00
8009 !! text
8010 This is 00.
8011 !! endarticle
8012
8013 !!test
8014 Self-link to numeric title
8015 !!options
8016 title=[[0]]
8017 !! wikitext
8018 [[0]]
8019 !! html
8020 <p><strong class="selflink">0</strong>
8021 </p>
8022 !!end
8023
8024 !!test
8025 Link to numeric-equivalent title
8026 !!options
8027 title=[[0]]
8028 !! wikitext
8029 [[00]]
8030 !! html
8031 <p><a href="/wiki/00" title="00">00</a>
8032 </p>
8033 !!end
8034
8035 !! test
8036 <nowiki> inside a link
8037 !! wikitext
8038 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8039 !! html
8040 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8041 </p>
8042 !! end
8043
8044 !! test
8045 Non-breaking spaces in title
8046 !! wikitext
8047 [[&nbsp; Main &nbsp; Page &nbsp;]]
8048 !! html
8049 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8050 </p>
8051 !!end
8052
8053 !! test
8054 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
8055 !! options
8056 language=ca
8057 !! wikitext
8058 '''[[Main Page]]'''
8059 !! html
8060 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8061 </p>
8062 !! end
8063
8064 !! test
8065 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
8066 !! options
8067 language=ca
8068 !! wikitext
8069 ''[[Main Page]]''
8070 !! html
8071 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8072 </p>
8073 !! end
8074
8075 !! test
8076 Internal link with en linktrail: no apostrophes (bug 27473)
8077 !! options
8078 language=en
8079 !! wikitext
8080 [[Something]]'nice
8081 !! html
8082 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8083 </p>
8084 !! end
8085
8086 !! test
8087 Internal link with ca linktrail with apostrophes (bug 27473)
8088 !! options
8089 language=ca
8090 !! wikitext
8091 [[Something]]'nice
8092 !! html
8093 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8094 </p>
8095 !! end
8096
8097 !! test
8098 Internal link with kaa linktrail with apostrophes (bug 27473)
8099 !! options
8100 language=kaa
8101 !! wikitext
8102 [[Something]]'nice
8103 !! html
8104 <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>
8105 </p>
8106 !! end
8107
8108 !! test
8109 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
8110 !! wikitext
8111 [[User:Foo/Test/63636:Bar|Test]]
8112 !! html/php
8113 <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>
8114 </p>
8115 !! html/parsoid
8116 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8117 !! end
8118
8119 ## Mainly a sanity check for Parsoid
8120 !! test
8121 Handle title parsing for subpages
8122 !! options
8123 title=[[/123123]]
8124 !! wikitext
8125 123
8126 !! html/parsoid
8127 <p>123</p>
8128 !! end
8129
8130 ## FIXME: Add a working php section here
8131 !! test
8132 Link to a subpage from a namespace other than main
8133 !! options
8134 title=[[User:test]]
8135 !! wikitext
8136 [[/123]]
8137 !! html/parsoid
8138 <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>
8139 !! end
8140
8141 !! test
8142 Ensure that transclusion titles are not url-decoded
8143 !! options
8144 subpage title=[[Test]]
8145 parsoid=wt2html
8146 !! wikitext
8147 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8148 !! html/php
8149 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8150 </p>
8151 !! html/parsoid
8152 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8153 !! end
8154
8155 !! test
8156 Purely hash wikilink
8157 !! options
8158 title=[[User:test/123]]
8159 !! wikitext
8160 [[#a|b]]
8161 !! html/php
8162 <p><a href="#a">b</a>
8163 </p>
8164 !! html/parsoid
8165 <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>
8166 !! end
8167
8168 !! test
8169 1. Interaction of linktrail and template encapsulation
8170 !! options
8171 parsoid
8172 !! wikitext
8173 {{echo|[[Foo]]}}l
8174 !! html
8175 <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>
8176 !! end
8177
8178 !! test
8179 2. Interaction of linktrail and template encapsulation
8180 !! options
8181 parsoid
8182 !! wikitext
8183 {{echo|Some [[Fool]]}}s
8184 !! html
8185 <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>
8186 !! end
8187
8188 !! test
8189 3. Interaction of linktrail and template encapsulation
8190 !! options
8191 parsoid
8192 !! wikitext
8193 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8194 !! html
8195 <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>
8196 !! end
8197
8198 !! article
8199 Söfnuður
8200 !! text
8201 Test.
8202 !! endarticle
8203
8204 !! test
8205 Internal link with is link prefix
8206 !! options
8207 language=is
8208 !! wikitext
8209 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8210 !! html
8211 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8212 </p>
8213 !! end
8214
8215 !! article
8216 Mótmælendatrú
8217 !! text
8218 Test.
8219 !! endarticle
8220
8221 !! test
8222 Internal link with is link trail and link prefix
8223 !! options
8224 language=is
8225 !! wikitext
8226 [[mótmælendatrú|xxx]]ar
8227 [[mótmælendatrú]]ar
8228 mótmælenda[[söfnuður]]
8229 mótmælenda[[söfnuður|söfnuðir]]
8230 mótmælenda[[söfnuður|söfnuðir]]xxx
8231 !! html
8232 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8233 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8234 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8235 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8236 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8237 </p>
8238 !! end
8239
8240 !! test
8241 Parsoid link trail escaping
8242 !! options
8243 parsoid=html2wt,html2html
8244 !! html/parsoid
8245 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
8246 !! wikitext
8247 [[apple]]<nowiki/>s
8248 !! end
8249
8250 !! test
8251 Parsoid link prefix escaping
8252 !! options
8253 language=is
8254 parsoid=html2wt,html2html
8255 !! html/parsoid
8256 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
8257 !! wikitext
8258 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8259 !! end
8260
8261 !! test
8262 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8263 !! wikitext
8264 [[Foo| bar]]
8265
8266 [[Foo| ''bar'']]
8267
8268 [http://wp.org foo]
8269
8270 [http://wp.org ''foo'']
8271 !! html
8272 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8273 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8274 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8275 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8276 </p>
8277 !! end
8278
8279 !! test
8280 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8281 !! options
8282 parsoid
8283 !! wikitext
8284 [[Foo|{{echo|a}} b {{echo|c}}]]
8285 !! html
8286 <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>
8287 !! end
8288
8289 !! test
8290 Link with angle bracket after anchor
8291 !! wikitext
8292 [[Foo#<bar>]]
8293 !! html/php
8294 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8295 </p>
8296 !! html/parsoid
8297 <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>
8298 !! end
8299
8300 ###
8301 ### Interwiki links (see maintenance/interwiki.sql)
8302 ###
8303
8304 !! test
8305 Inline interwiki link
8306 !! options
8307 parsoid=wt2html,wt2wt,html2html
8308 !! wikitext
8309 [[MeatBall:SoftSecurity]]
8310 !! html/php
8311 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8312 </p>
8313 !! html/parsoid
8314 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8315 !! end
8316
8317 !! test
8318 Inline interwiki link with empty title (bug 2372)
8319 !! options
8320 parsoid=wt2html,wt2wt,html2html
8321 !! wikitext
8322 [[MeatBall:]]
8323 !! html/php
8324 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8325 </p>
8326 !! html/parsoid
8327 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8328 !! end
8329
8330 !! test
8331 Interwiki link encoding conversion (bug 1636)
8332 !! wikitext
8333 *[[Wikipedia:ro:Olteni&#0355;a]]
8334 *[[Wikipedia:ro:Olteni&#355;a]]
8335 !! html
8336 <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>
8337 <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>
8338
8339 !! html+tidy
8340 <ul>
8341 <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>
8342 <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>
8343 </ul>
8344 !! end
8345
8346 !! test
8347 Interwiki link with fragment (bug 2130)
8348 !! wikitext
8349 [[MeatBall:SoftSecurity#foo]]
8350 !! html
8351 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8352 </p>
8353 !! end
8354
8355 !! test
8356 Link scenarios with escaped fragments
8357 !! wikitext
8358 [[#Is this great?]]
8359 [[Foo#Is this great?]]
8360 [[meatball:Foo#Is this great?]]
8361 !! html/php
8362 <p><a href="#Is_this_great.3F">#Is this great?</a>
8363 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8364 <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>
8365 </p>
8366 !! html/parsoid
8367 <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>
8368 <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>
8369 <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>
8370 !! end
8371
8372 # Ideally the wikipedia: prefix here should be proto-relative too
8373 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8374 # define the 'en' prefix, and originally the test used 'wikipedia',
8375 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8376 # article.
8377 !! test
8378 Different interwiki prefixes mapping to the same URL
8379 !! wikitext
8380 [[:en:Foo]]
8381
8382 [[:en:Foo|Foo]]
8383
8384 [[wikipedia:Foo]]
8385
8386 [[:wikipedia:Foo|Foo]]
8387
8388 [[wikipedia:en:Foo]]
8389
8390 [[:wikipedia:en:Foo]]
8391
8392 [[ wikiPEdia :Foo]]
8393 !! html/parsoid
8394 <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>
8395
8396 <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>
8397
8398 <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>
8399
8400 <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>
8401
8402 <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>
8403
8404 <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>
8405
8406 <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>
8407 !! end
8408
8409 !! test
8410 Interwiki links that cannot be represented in wiki syntax
8411 !! wikitext
8412 [[meatball:ok]]
8413 [[meatball:ok#foo|ok with fragment]]
8414 [[meatball:ok_as_well?|ok ending with ? mark]]
8415 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8416 [http://de.wikipedia.org/wiki/#foo is just fragment]
8417
8418 !! html/php
8419 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8420 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8421 <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>
8422 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8423 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8424 </p>
8425 !! html/parsoid
8426 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8427 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8428 <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>
8429 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8430 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8431 !! end
8432
8433 !! test
8434 Interwiki links: trail
8435 !! wikitext
8436 [[wikipedia:Foo|Ba]]r
8437 !! html/php
8438 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8439 </p>
8440 !! html/parsoid
8441 <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>
8442 !! end
8443
8444 !! test
8445 Local interwiki link
8446 !! options
8447 parsoid=wt2html,wt2wt,html2html
8448 !! wikitext
8449 [[local:Template:Foo]]
8450 !! html/php
8451 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8452 </p>
8453 !! html/parsoid
8454 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8455 !! end
8456
8457 # Parsoid does not mark self-links, by design.
8458 !! test
8459 Local interwiki link: self-link to current page
8460 !! options
8461 title=[[Main Page]]
8462 parsoid=wt2html,wt2wt,html2html
8463 !! wikitext
8464 [[local:Main Page]]
8465 !! html/php
8466 <p><strong class="selflink">local:Main Page</strong>
8467 </p>
8468 !! html/parsoid
8469 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8470 !! end
8471
8472 !! test
8473 Local interwiki link: prefix only (bug 64167)
8474 !! options
8475 parsoid=wt2html,wt2wt,html2html
8476 !! wikitext
8477 [[local:]]
8478 !! html/php
8479 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8480 </p>
8481 !! html/parsoid
8482 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8483 !! end
8484
8485 !! test
8486 Local interwiki link: with additional interwiki prefix (bug 61357)
8487 !! options
8488 parsoid=wt2html,wt2wt,html2html
8489 !! wikitext
8490 [[local:meatball:Hello]]
8491 !! html/php
8492 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8493 </p>
8494 !! html/parsoid
8495 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8496 !! end
8497
8498 !! test
8499 Multiple local interwiki link prefixes
8500 !! wikitext
8501 [[local:local:local:local:mi:local:Foo]]
8502 !! options
8503 parsoid=wt2html,wt2wt,html2html
8504 !! html/php
8505 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8506 </p>
8507 !! html/parsoid
8508 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8509 !! end
8510
8511 ###
8512 ### Interlanguage links
8513 ### Language links (so that searching for '### language' matches..)
8514 ###
8515
8516 !! test
8517 Interlanguage link
8518 !! wikitext
8519 Blah blah blah
8520 [[zh:Chinese]]
8521 !! html/php
8522 <p>Blah blah blah
8523 </p>
8524 !! html/parsoid
8525 <p>Blah blah blah</p>
8526 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8527 !! end
8528
8529 ## parsoid html2wt will lose the space variations
8530 !! test
8531 Interlanguage link with spacing
8532 !! options
8533 parsoid=wt2html,wt2wt,html2html
8534 !! wikitext
8535 Blah blah blah
8536 [[ zh : Chinese ]]
8537 !! html/php
8538 <p>Blah blah blah
8539 </p>
8540 !! html/parsoid
8541 <p>Blah blah blah</p>
8542 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8543 !! end
8544
8545 !! test
8546 Double interlanguage link
8547 !! wikitext
8548 Blah blah blah
8549 [[es:Spanish]]
8550 [[zh:Chinese]]
8551 !! html/php
8552 <p>Blah blah blah
8553 </p>
8554 !! html/parsoid
8555 <p>Blah blah blah</p>
8556 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8557 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8558 !! end
8559
8560 ## parsoid html2wt will lose the space variations
8561 !! test
8562 Interlanguage link variations
8563 !! options
8564 parsoid=wt2html,wt2wt,html2html
8565 !! wikitext
8566 Blah blah blah
8567 [[ es :Spanish]]
8568 [[ ZH :Chinese]]
8569 [[es:Foo_bar]]
8570 !! html/php
8571 <p>Blah blah blah
8572 </p>
8573 !! html/parsoid
8574 <p>Blah blah blah</p>
8575 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8576 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8577 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8578 !! end
8579
8580 ## parsoid html2wt will normalize the space to _
8581 !! test
8582 Space and question mark encoding in interlanguage links (T95473)
8583 !! options
8584 parsoid=wt2html,wt2wt,html2html
8585 !! wikitext
8586 Blah blah blah
8587 [[es:Foo bar?]]
8588 !! html/php
8589 <p>Blah blah blah
8590 </p>
8591 !! html/parsoid
8592 <p>Blah blah blah</p>
8593 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8594 !! end
8595
8596 !! test
8597 Interlanguage link, with prefix links
8598 !! options
8599 language=ln
8600 !! wikitext
8601 Blah blah blah
8602 [[zh:Chinese]]
8603 !! html/php
8604 <p>Blah blah blah
8605 </p>
8606 !! html/parsoid
8607 <p>Blah blah blah</p>
8608 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8609 !! end
8610
8611 !! test
8612 Double interlanguage link, with prefix links (bug 8897)
8613 !! options
8614 language=ln
8615 !! wikitext
8616 Blah blah blah
8617 [[es:Spanish]]
8618 [[zh:Chinese]]
8619 !! html/php
8620 <p>Blah blah blah
8621 </p>
8622 !! html/parsoid
8623 <p>Blah blah blah</p>
8624 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8625 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8626 !! end
8627
8628 !! test
8629 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8630 !! wikitext
8631 Blah blah blah
8632 [[mul:Article]]
8633 !! html/php
8634 <p>Blah blah blah
8635 </p>
8636 !! html/parsoid
8637 <p>Blah blah blah</p>
8638 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8639 !! end
8640
8641 ## PHP parser tests script needs an update
8642 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8643 !! test
8644 Language links render as inline links if $wgInterwikiMagic=false
8645 !! options
8646 wgInterwikiMagic=false
8647 parsoid=wt2html,wt2wt,html2html
8648 !! wikitext
8649 Blah blah blah
8650 [[zh:Chinese]]
8651 !! html/parsoid
8652 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8653 !! end
8654
8655 ## PHP parser tests script needs an update
8656 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8657 !! test
8658 Language links render as inline links in the Talk namespace
8659 !! options
8660 title=Talk:Foo
8661 parsoid=wt2html,wt2wt,html2html
8662 !! wikitext
8663 Blah blah blah
8664 [[zh:Chinese]]
8665 !! html/parsoid
8666 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8667 !! end
8668
8669 !! test
8670 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8671 !! options
8672 language=ln
8673 !! wikitext
8674 [[WW&nbsp;II]]
8675 !! html
8676 <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>
8677 </p>
8678 !! end
8679
8680 !! test
8681 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8682 !! options
8683 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8684 !! html/parsoid
8685 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8686 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8687 !! wikitext
8688 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8689
8690 He&amp;nbsp;llo He&amp;nbsp;llo
8691 !! html/php
8692 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8693 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8694 </p>
8695 !! end
8696
8697 # html2wt will fail because of title normalization without data-parsoid
8698 !! test
8699 Parsoid: handle constructor well
8700 !! options
8701 parsoid=wt2html,wt2wt
8702 !! wikitext
8703 [[constructor]]
8704
8705 [[constructor:foo]]
8706 !! html/php
8707 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8708 </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>
8709 </p>
8710 !! html/parsoid
8711 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8712
8713 <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>
8714 !! end
8715
8716 !! article
8717 ko:
8718 !! text
8719 Test.
8720 !! endarticle
8721
8722 # Note that `ko` isn't a known interlanguage prefix
8723 !! test
8724 Parsoid: recognize interlanguage links without a target page
8725 !! options
8726 ill
8727 !! wikitext
8728 [[es:]]
8729
8730 [[ko:]]
8731 !! html/php
8732 es:
8733 !! html/parsoid
8734 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8735
8736 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8737 !! end
8738
8739 # Note that `ko` isn't a known interwiki prefix
8740 !! test
8741 Parsoid: recognize interwiki links without a target page
8742 !! options
8743 parsoid=wt2html,wt2wt,html2html
8744 !! wikitext
8745 [[:es:]]
8746
8747 [[:ko:]]
8748 !! html/php
8749 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8750 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8751 </p>
8752 !! html/parsoid
8753 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8754 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8755 !! end
8756
8757 !! test
8758 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8759 !! wikitext
8760 [[mi:Foo]]
8761 !! html/php
8762 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8763 </p>
8764 !! html/parsoid
8765 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8766 !! end
8767
8768 !! test
8769 Interlanguage link with preceding local interwiki link (bug 68085)
8770 !! options
8771 parsoid=wt2html,wt2wt,html2html
8772 !! wikitext
8773 Blah blah blah
8774 [[local:es:Spanish]]
8775 !! html/php
8776 <p>Blah blah blah
8777 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8778 </p>
8779 !! html/parsoid
8780 <p>Blah blah blah
8781 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8782 !! end
8783
8784 !! test
8785 Looks like an interlanguage link, but is actually a local interwiki
8786 !! options
8787 parsoid=wt2html,wt2wt,html2html
8788 !! wikitext
8789 Blah blah blah
8790 [[mi:Template:Foo]]
8791 !! html/php
8792 <p>Blah blah blah
8793 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8794 </p>
8795 !! html/parsoid
8796 <p>Blah blah blah
8797 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8798 !! end
8799
8800 ###
8801 ### Redirects, Parsoid-only
8802 ###
8803
8804 !! test
8805 1. Simple redirect to page
8806 !! wikitext
8807 #REDIRECT [[Main Page]]
8808 !! html/parsoid
8809 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8810 !! end
8811
8812 !! test
8813 2. Other redirect variants
8814 !! wikitext
8815 #REDIRECT [[Main_Page]]
8816 !! html/parsoid
8817 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8818 !! end
8819
8820 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8821 # This tests the Parsoid bail-out code.
8822 !! test
8823 3. Other redirect variants
8824 !! wikitext
8825 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8826 !! html/parsoid
8827 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8828 !! end
8829
8830 !! test
8831 4. Redirect to a templated destination
8832 !! wikitext
8833 #REDIRECT [[{{echo|Foo}}bar]]
8834 !! html/parsoid
8835 <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"}]]}'/>
8836 !! end
8837
8838 !! test
8839 Empty redirect
8840 !! options
8841 parsoid=wt2html,wt2wt
8842 !! wikitext
8843 #REDIRECT [[]]
8844 !! html/parsoid
8845 <ol>
8846 <li>REDIRECT [[]]</li></ol>
8847 !! end
8848
8849 !! test
8850 Optional colon in #REDIRECT
8851 !! options
8852 # the colon is archaic syntax. we support it for wt2html, but we
8853 # don't care that it roundtrips back to the modern syntax.
8854 parsoid=wt2html,html2html
8855 !! wikitext
8856 #REDIRECT:[[Main Page]]
8857 !! html/parsoid
8858 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8859 !! end
8860
8861 !! test
8862 Whitespace in #REDIRECT with optional colon
8863 !! options
8864 # the colon and gratuitous whitespace is archaic syntax. we support
8865 # it for wt2html, but we don't care that it roundtrips back to the
8866 # modern syntax (without extra whitespace)
8867 parsoid=wt2html,html2html
8868 !! wikitext
8869
8870 #REDIRECT
8871 :
8872 [[Main Page]]
8873 !! html/parsoid
8874 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8875 !! end
8876
8877 !! test
8878 Piped link in #REDIRECT
8879 !! options
8880 # content after piped link is ignored. we support this syntax,
8881 # but don't care that the piped link is lost when we roundtrip this.
8882 parsoid=wt2html
8883 !! wikitext
8884 #REDIRECT [[Main Page|bar]]
8885 !! html/parsoid
8886 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8887 !! end
8888
8889 !! test
8890 Redirect to category (T104502)
8891 !! options
8892 parsoid=wt2html,wt2wt
8893 !! wikitext
8894 #REDIRECT [[Category:Foo]]
8895 !! html/parsoid
8896 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8897 !! end
8898
8899 !! test
8900 Redirect to category with URL encoding (T104502)
8901 !! options
8902 parsoid=wt2html
8903 !! wikitext
8904 #REDIRECT [[Category%3AFoo]]
8905 !! html/parsoid
8906 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8907 !! end
8908
8909 !! test
8910 Redirect to category page
8911 !! wikitext
8912 #REDIRECT [[:Category:Foo]]
8913 !! html/parsoid
8914 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8915 !! end
8916
8917 !! test
8918 Redirect to image page (1)
8919 !! wikitext
8920 #REDIRECT [[File:Wiki.png]]
8921 !! html/parsoid
8922 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8923 !! end
8924
8925 !! test
8926 Redirect to image page (2)
8927 !! wikitext
8928 #REDIRECT [[Image:Wiki.png]]
8929 !! html/parsoid
8930 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8931 !! end
8932
8933 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8934 # Next test confirms this.
8935 !! test
8936 Redirect to language (1) (T104918)
8937 !! options
8938 parsoid=wt2html,wt2wt,html2html
8939 !! wikitext
8940 #REDIRECT [[en:File:Wiki.png]]
8941 !! html/parsoid
8942 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8943 !! end
8944
8945 !! test
8946 Redirect to language (2) (T104918)
8947 !! wikitext
8948 #REDIRECT [[:en:File:Wiki.png]]
8949 !! html/parsoid
8950 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8951 !! end
8952
8953 !! test
8954 Redirect to interwiki (T104918)
8955 !! wikitext
8956 #REDIRECT [[meatball:File:Wiki.png]]
8957 !! html/parsoid
8958 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8959 !! end
8960
8961 !! test
8962 Non-English #REDIRECT
8963 !! options
8964 language=is
8965 !! wikitext
8966 #TILVÍSUN [[Main Page]]
8967 !! html/parsoid
8968 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8969 !! end
8970
8971 !! test
8972 Redirect syntax under text isn't considered a redirect
8973 !! wikitext
8974 some text
8975 #redirect [[Main Page]]
8976 !! html/parsoid
8977 <p>some text</p>
8978 <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>
8979 !! end
8980
8981 # FIXME: Should hoist the redirect to the top of the page and ensure there
8982 # is only one.
8983 !! test
8984 New redirect
8985 !! options
8986 parsoid=html2wt
8987 !! html/parsoid
8988 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8989 !! wikitext
8990 Foo
8991 #REDIRECT [[Foo]]
8992 !! end
8993
8994 ##
8995 ## XHTML tidiness
8996 ###
8997
8998 !! test
8999 <br> to <br />
9000 !! wikitext
9001 1<br>2<br />3
9002 !! html
9003 <p>1<br />2<br />3
9004 </p>
9005 !! end
9006
9007 !! test
9008 Broken br tag sanitization
9009 !! wikitext
9010 </br>
9011 !! html/php
9012 <p>&lt;/br&gt;
9013 </p>
9014 !! end
9015
9016 # TODO: Fix html2html mode (bug 51055)!
9017 !! test
9018 Parsoid: Broken br tag recognition
9019 !! options
9020 parsoid=wt2html
9021 !! wikitext
9022 </br>
9023
9024 <br/ >
9025 !! html+tidy
9026 <p><br /></p>
9027 <p><br /></p>
9028 !! end
9029
9030 !! test
9031 Incorrecly removing closing slashes from correctly formed XHTML
9032 !! wikitext
9033 <br style="clear:both;" />
9034 !! html
9035 <p><br style="clear:both;" />
9036 </p>
9037 !! end
9038
9039 !! test
9040 Failing to transform badly formed HTML into correct XHTML
9041 !! wikitext
9042 <br style="clear: left;">
9043 <br style="clear: right;">
9044 <br style="clear: both;">
9045 !! html
9046 <p><br style="clear: left;" />
9047 <br style="clear: right;" />
9048 <br style="clear: both;" />
9049 </p>
9050 !!end
9051
9052 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9053 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9054 !! test
9055 Handling html with a div self-closing tag
9056 !! wikitext
9057 <div title />
9058 <div title/>
9059 <div title/ >
9060 <div title=bar />
9061 <div title=bar/>
9062 <div title=bar/ >
9063 !! html/php
9064 <p>&lt;div title /&gt;
9065 &lt;div title/&gt;
9066 </p>
9067 <div>
9068 <p>&lt;div title=bar /&gt;
9069 &lt;div title=bar/&gt;
9070 </p>
9071 <div title="bar/"></div>
9072 </div>
9073
9074 !! html/parsoid
9075 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9076 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9077 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9078 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9079 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9080 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9081 !! end
9082
9083 !! test
9084 Handling html with a br self-closing tag
9085 !! wikitext
9086 <br title />
9087 <br title/>
9088 <br title/ >
9089 <br title=bar />
9090 <br title=bar/>
9091 <br title=bar/ >
9092 !! html/php
9093 <p><br title="" />
9094 <br title="" />
9095 <br />
9096 <br title="bar" />
9097 <br title="bar" />
9098 <br title="bar/" />
9099 </p>
9100 !! html/parsoid
9101 <p><br title="" />
9102 <br title="" />
9103 <br title="" />
9104 <br title="bar" />
9105 <br title="bar" />
9106 <br title="bar/" />
9107 </p>
9108 !! end
9109
9110 !! test
9111 Horizontal ruler (should it add that extra space?)
9112 !! wikitext
9113 <hr>
9114 <hr >
9115 foo <hr
9116 > bar
9117 !! html+tidy
9118 <hr />
9119 <hr />
9120 <p>foo</p>
9121 <hr />
9122 <p>bar</p>
9123 !! end
9124
9125 !! test
9126 Horizontal ruler -- 4+ dashes render hr
9127 !! wikitext
9128 ----
9129 !! html
9130 <hr />
9131
9132 !! end
9133
9134 !! test
9135 Horizontal ruler -- eats additional dashes on the same line
9136 !! wikitext
9137 ---------
9138 !! html
9139 <hr />
9140
9141 !! end
9142
9143 !! test
9144 Horizontal ruler -- does not collapse dashes on consecutive lines
9145 !! wikitext
9146 ----
9147 ----
9148 !! html
9149 <hr />
9150 <hr />
9151
9152 !! end
9153
9154 !! test
9155 Horizontal ruler -- <4 dashes render as plain text
9156 !! wikitext
9157 ---
9158 !! html
9159 <p>---
9160 </p>
9161 !! end
9162
9163 !! test
9164 Horizontal ruler -- Supports content following dashes on same line
9165 !! wikitext
9166 ---- Foo
9167 !! html
9168 <hr /> Foo
9169
9170 !! html+tidy
9171 <hr />
9172 <p>Foo</p>
9173 !! end
9174
9175 ###
9176 ### Block-level elements
9177 ###
9178 !! test
9179 Common list
9180 !! wikitext
9181 *Common list
9182 * item 2
9183 *item 3
9184 !! html
9185 <ul><li>Common list</li>
9186 <li> item 2</li>
9187 <li>item 3</li></ul>
9188
9189 !! end
9190
9191 !! test
9192 Numbered list
9193 !! wikitext
9194 #Numbered list
9195 #item 2
9196 # item 3
9197 !! html
9198 <ol><li>Numbered list</li>
9199 <li>item 2</li>
9200 <li> item 3</li></ol>
9201
9202 !! end
9203
9204 !! test
9205 Mixed list
9206 !! wikitext
9207 *Mixed list
9208 *# with numbers
9209 ** and bullets
9210 *# and numbers
9211 *bullets again
9212 **bullet level 2
9213 ***bullet level 3
9214 ***#Number on level 4
9215 **bullet level 2
9216 **#Number on level 3
9217 **#Number on level 3
9218 *#number level 2
9219 *Level 1
9220 *** Level 3
9221 #** Level 3, but ordered
9222 !! html
9223 <ul><li>Mixed list
9224 <ol><li> with numbers</li></ol>
9225 <ul><li> and bullets</li></ul>
9226 <ol><li> and numbers</li></ol></li>
9227 <li>bullets again
9228 <ul><li>bullet level 2
9229 <ul><li>bullet level 3
9230 <ol><li>Number on level 4</li></ol></li></ul></li>
9231 <li>bullet level 2
9232 <ol><li>Number on level 3</li>
9233 <li>Number on level 3</li></ol></li></ul>
9234 <ol><li>number level 2</li></ol></li>
9235 <li>Level 1
9236 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9237 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9238
9239 !! end
9240
9241 !! test
9242 1. Nested mixed wikitext and html list
9243 !! wikitext
9244 * hi
9245 * <ul><li>ho</li></ul>
9246 * hi
9247 ** ho
9248 !! html/php
9249 <ul><li> hi</li>
9250 <li> <ul><li>ho</li></ul></li>
9251 <li> hi
9252 <ul><li> ho</li></ul></li></ul>
9253
9254 !! html/parsoid
9255 <ul><li> hi</li>
9256 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9257 <li> hi
9258 <ul><li> ho</li></ul></li></ul>
9259 !! end
9260
9261 !! test
9262 2. Nested mixed wikitext and html list (incompatible)
9263 !! wikitext
9264 ; hi
9265 : {{echo|<li>ho</li>}}
9266 !! html/php
9267 <dl><dt> hi</dt>
9268 <dd> <li>ho</li></dd></dl>
9269
9270 !! html/parsoid
9271 <dl><dt> hi</dt>
9272 <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>
9273 !! end
9274
9275 !! test
9276 Nested lists 1
9277 !! wikitext
9278 *foo
9279 **bar
9280 !! html
9281 <ul><li>foo
9282 <ul><li>bar</li></ul></li></ul>
9283
9284 !! end
9285
9286 !! test
9287 Nested lists 2
9288 !! wikitext
9289 **foo
9290 *bar
9291 !! html
9292 <ul><li><ul><li>foo</li></ul></li>
9293 <li>bar</li></ul>
9294
9295 !! end
9296
9297 !! test
9298 Nested lists 3 (first element empty)
9299 !! wikitext
9300 *
9301 **bar
9302 !! html
9303 <ul><li>
9304 <ul><li>bar</li></ul></li></ul>
9305
9306 !! end
9307
9308 !! test
9309 Nested lists 4 (first element empty)
9310 !! wikitext
9311 **
9312 *bar
9313 !! html
9314 <ul><li><ul><li></li></ul></li>
9315 <li>bar</li></ul>
9316
9317 !! end
9318
9319 !! test
9320 Nested lists 5 (both elements empty)
9321 !! wikitext
9322 **
9323 *
9324 !! html
9325 <ul><li><ul><li></li></ul></li>
9326 <li></li></ul>
9327
9328 !! end
9329
9330 !! test
9331 Nested lists 6 (both elements empty)
9332 !! wikitext
9333 *
9334 **
9335 !! html
9336 <ul><li>
9337 <ul><li></li></ul></li></ul>
9338
9339 !! end
9340
9341 !! test
9342 Nested lists 7 (skip initial nesting levels)
9343 !! wikitext
9344 *** foo
9345 !! html
9346 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9347
9348 !! end
9349
9350 !! test
9351 Nested lists 8 (multiple nesting transitions)
9352 !! wikitext
9353 * foo
9354 *** bar
9355 ** baz
9356 * boo
9357 !! html
9358 <ul><li> foo
9359 <ul><li><ul><li> bar</li></ul></li>
9360 <li> baz</li></ul></li>
9361 <li> boo</li></ul>
9362
9363 !! end
9364
9365 !! test
9366 Nested lists 9 (extension interaction)
9367 !! options
9368 parsoid
9369 !! wikitext
9370 *<references />
9371 !! html/parsoid
9372 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9373 !! end
9374
9375 !! test
9376 1. Lists with start-of-line-transparent tokens before bullets: Comments
9377 !! wikitext
9378 *foo
9379 *<!--cmt-->bar
9380 <!--cmt-->*baz
9381 !! html
9382 <ul><li>foo</li>
9383 <li>bar</li>
9384 <li>baz</li></ul>
9385
9386 !! end
9387
9388 !! test
9389 2. Lists with start-of-line-transparent tokens before bullets: Template close
9390 !! wikitext
9391 *foo {{echo|bar
9392 }}*baz
9393 !! html
9394 <ul><li>foo bar</li>
9395 <li>baz</li></ul>
9396
9397 !! end
9398
9399 !! test
9400 List items are not parsed correctly following a <pre> block (bug 785)
9401 !! wikitext
9402 * <pre>foo</pre>
9403 * <pre>bar</pre>
9404 * zar
9405 !! html/php
9406 <ul><li> <pre>foo</pre></li>
9407 <li> <pre>bar</pre></li>
9408 <li> zar</li></ul>
9409
9410 !! html/parsoid
9411 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9412 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9413 <li> zar</li></ul>
9414 !! end
9415
9416 !! test
9417 List items from template
9418 !! wikitext
9419
9420 {{inner list}}
9421 * item 2
9422
9423 * item 0
9424 {{inner list}}
9425 * item 2
9426
9427 * item 0
9428 * notSOL{{inner list}}
9429 * item 2
9430 !! html
9431 <ul><li> item 1</li>
9432 <li> item 2</li></ul>
9433 <ul><li> item 0</li>
9434 <li> item 1</li>
9435 <li> item 2</li></ul>
9436 <ul><li> item 0</li>
9437 <li> notSOL</li>
9438 <li> item 1</li>
9439 <li> item 2</li></ul>
9440
9441 !! end
9442
9443 !! test
9444 List interrupted by empty line or heading
9445 !! wikitext
9446 * foo
9447
9448 ** bar
9449 == A heading ==
9450 * Another list item
9451 !! html
9452 <ul><li> foo</li></ul>
9453 <ul><li><ul><li> bar</li></ul></li></ul>
9454 <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>
9455 <ul><li> Another list item</li></ul>
9456
9457 !!end
9458
9459 !!test
9460 Multiple list tags generated by templates
9461 !! wikitext
9462 {{echo|<li>}}a
9463 {{echo|<li>}}b
9464 {{echo|<li>}}c
9465 !! html
9466 <li>a
9467 <li>b
9468 <li>c</li>
9469 </li>
9470 </li>
9471
9472 !! html+tidy
9473 <ul>
9474 <li>a</li>
9475 <li>b</li>
9476 <li>c</li>
9477 </ul>
9478 !!end
9479
9480 !!test
9481 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9482 !! wikitext
9483 *a
9484 <!--This line will NOT split the list-->
9485 *b
9486 <!--This line will NOT split the list either-->
9487 *c
9488 <!--foo--> <!----> <!--This line NOT split the list either-->
9489 *d
9490 !! html
9491 <ul><li>a</li>
9492 <li>b</li>
9493 <li>c</li>
9494 <li>d</li></ul>
9495
9496 !!end
9497
9498 !!test
9499 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9500 !! wikitext
9501 *a
9502 <!--This line will NOT split the list-->
9503 *b
9504 <!--This line will NOT split the list either-->
9505 *c
9506 <!--foo--> <!----> <!--This line NOT split the list
9507 either-->
9508 *d
9509 !! html
9510 <ul><li>a</li>
9511 <li>b</li>
9512 <li>c</li>
9513 <li>d</li></ul>
9514
9515 !!end
9516
9517 !!test
9518 Test the li-hack
9519 (The PHP parser relies on Tidy for the hack)
9520 !!options
9521 parsoid=wt2html,wt2wt
9522 !! wikitext
9523 * foo
9524 * <li>li-hack
9525 * {{echo|<li>templated li-hack}}
9526 * <!--foo--> <li> unsupported li-hack with preceding comments
9527
9528 <ul>
9529 <li><li>not a li-hack
9530 </li>
9531 </ul>
9532 !! html+tidy
9533 <ul>
9534 <li>foo</li>
9535 <li>li-hack</li>
9536 <li>templated li-hack</li>
9537 <li>unsupported li-hack with preceding comments</li>
9538 </ul>
9539 <ul>
9540 <li>not a li-hack</li>
9541 </ul>
9542 !!end
9543
9544 !! test
9545 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9546 !! options
9547 parsoid
9548 !! wikitext
9549 # foo
9550 ## bar
9551 * foo
9552 ** bar
9553 : foo
9554 :: bar
9555 !! html
9556 <ol>
9557 <li> foo<ol>
9558 <li> bar</li>
9559 </ol></li>
9560 </ol><ul>
9561 <li> foo<ul>
9562 <li> bar</li>
9563 </ul></li>
9564 </ul><dl>
9565 <dd> foo<dl>
9566 <dd> bar</dd>
9567 </dl></dd>
9568 </dl>
9569 !! end
9570
9571 !! test
9572 Parsoid: Test of whitespace serialization with Templated bullets
9573 !! options
9574 parsoid
9575 !! wikitext
9576 * {{bullet}}
9577 !! html
9578 <ul>
9579 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9580 </ul>
9581 !! end
9582
9583 # ------------------------------------------------------------------------
9584 # The next set of tests are about Parsoid's ability to handle badly nested
9585 # tags (parse, minimize scope of fixup, and roundtrip back)
9586 # ------------------------------------------------------------------------
9587
9588 !! test
9589 Unbalanced closing block tags break a list
9590 (php parser relies on Tidy to fix up)
9591 !! wikitext
9592 <div>
9593 *a</div><div>
9594 *b</div>
9595 !! html+tidy
9596 <div>
9597 <ul>
9598 <li>a</li>
9599 </ul>
9600 </div>
9601 <div>
9602 <ul>
9603 <li>b</li>
9604 </ul>
9605 </div>
9606 !! end
9607
9608 # Parsoid fails this test, but it might be tricky to support properly.
9609 # See bug 68395.
9610 !! test
9611 Unbalanced closing non-block tags don't break a list
9612 (php parser relies on Tidy to fix up)
9613 !! wikitext
9614 <span>
9615 *a</span><span>
9616 *b</span>
9617 !! html/php+tidy
9618 <ul>
9619 <li><span>a</span></li>
9620 <li><span>b</span></li>
9621 </ul>
9622 !! html/parsoid
9623 <span>
9624 <ul>
9625 <li>a<span></span>
9626 </li>
9627 <li>b
9628 </li>
9629 </ul>
9630 </span>
9631 !! end
9632
9633 !! test
9634 Unclosed formatting tags that straddle lists are closed and reopened
9635 (php parser relies on Tidy to fix up)
9636 !! options
9637 parsoid=wt2html,wt2wt,html2html
9638 !! wikitext
9639 # <s> a
9640 # b </s>
9641 !! html/php+tidy
9642 <ol>
9643 <li><s>a</s></li>
9644 <li><s>b</s></li>
9645 </ol>
9646 !! html/parsoid
9647 <ol><li> <s> a</s></li>
9648 <li><s> b </s></li></ol>
9649 !! end
9650
9651 # See bug 68395.
9652 !!test
9653 1. List embedded in a formatting tag
9654 !! wikitext
9655 <small>
9656 * foo
9657 </small>
9658 !! html/php+tidy
9659 <ul>
9660 <li><small>foo</small></li>
9661 </ul>
9662 !! html/parsoid
9663 <small>
9664 <ul>
9665 <li> foo</li>
9666 </ul>
9667 </small>
9668 !!end
9669
9670 ## Ugly Parsoid output here
9671 ## Not sure what the right output is.
9672 !!test
9673 2. List embedded in a formatting tag
9674 !! wikitext
9675 <small>
9676 *a
9677 *b</small>
9678 !! html/php+tidy
9679 <ul>
9680 <li><small>a</small></li>
9681 <li><small>b</small></li>
9682 </ul>
9683 !! html/parsoid
9684 <small></small>
9685 <ul><small>
9686 <li>a</li>
9687 </small>
9688 <li><small>b</small></li>
9689 </ul>
9690 !!end
9691
9692 # Ugly Parsoid and PHP parser output here
9693 # Not sure if we want to make this a test!
9694 #
9695 ## !!test
9696 ## 3. Unclosed formatting tags in list elements
9697 ## !! wikitext
9698 ## *<small>a
9699 ## *<small>b
9700 ## !! html/php+tidy
9701 ## <ul>
9702 ## <li><small>a</small></li>
9703 ## <li><small><small>b</small></small></li>
9704 ## </ul>
9705 ## !! html/parsoid
9706 ## <ul>
9707 ## <li><small>a</small></li>
9708 ## <small>
9709 ## <li><small>b</small></li>
9710 ## </small></ul>
9711 ## !!end
9712
9713 # This is a bug in the PHP parser + tidy combination.
9714 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9715 # and then fostered out of the table by tidy.)
9716 # We believe the Parsoid output to be correct.
9717 !! test
9718 Table with missing opening <tr> tag
9719 !! options
9720 parsoid=wt2html,wt2wt
9721 !! wikitext
9722 <table>
9723 <td>foo</td>
9724 </tr>
9725 </table>
9726 !! html+tidy
9727 <table>
9728 <tr>
9729 <td>foo</td>
9730 </tr>
9731 </table>
9732 !! end
9733
9734 ###
9735 ### Magic Words
9736 ###
9737
9738 # Note that the current date is hard-coded as
9739 # 1970-01-01T00:02:03Z (a Thursday)
9740 # when running parser tests. The timezone is also fixed to GMT, so
9741 # local date will be identical to current date.
9742
9743 !! test
9744 Magic Word: {{CURRENTDAY}}
9745 !! wikitext
9746 {{CURRENTDAY}}
9747 !! html
9748 <p>1
9749 </p>
9750 !! end
9751
9752 !! test
9753 Magic Word: {{CURRENTDAY2}}
9754 !! wikitext
9755 {{CURRENTDAY2}}
9756 !! html
9757 <p>01
9758 </p>
9759 !! end
9760
9761 !! test
9762 Magic Word: {{CURRENTDAYNAME}}
9763 !! wikitext
9764 {{CURRENTDAYNAME}}
9765 !! html
9766 <p>Thursday
9767 </p>
9768 !! end
9769
9770 !! test
9771 Magic Word: {{CURRENTDOW}}
9772 !! wikitext
9773 {{CURRENTDOW}}
9774 !! html
9775 <p>4
9776 </p>
9777 !! end
9778
9779 !! test
9780 Magic Word: {{CURRENTMONTH}}
9781 !! wikitext
9782 {{CURRENTMONTH}}
9783 !! html
9784 <p>01
9785 </p>
9786 !! end
9787
9788 !! test
9789 Magic Word: {{CURRENTMONTH1}}
9790 !! wikitext
9791 {{CURRENTMONTH1}}
9792 !! html
9793 <p>1
9794 </p>
9795 !! end
9796
9797 !! test
9798 Magic Word: {{CURRENTMONTHABBREV}}
9799 !! wikitext
9800 {{CURRENTMONTHABBREV}}
9801 !! html
9802 <p>Jan
9803 </p>
9804 !! end
9805
9806 !! test
9807 Magic Word: {{CURRENTMONTHNAME}}
9808 !! wikitext
9809 {{CURRENTMONTHNAME}}
9810 !! html
9811 <p>January
9812 </p>
9813 !! end
9814
9815 !! test
9816 Magic Word: {{CURRENTMONTHNAMEGEN}}
9817 !! wikitext
9818 {{CURRENTMONTHNAMEGEN}}
9819 !! html
9820 <p>January
9821 </p>
9822 !! end
9823
9824 !! test
9825 Magic Word: {{CURRENTTIME}}
9826 !! wikitext
9827 {{CURRENTTIME}}
9828 !! html
9829 <p>00:02
9830 </p>
9831 !! end
9832
9833 !! test
9834 Magic Word: {{CURRENTHOUR}}
9835 !! wikitext
9836 {{CURRENTHOUR}}
9837 !! html
9838 <p>00
9839 </p>
9840 !! end
9841
9842 !! test
9843 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9844 !! wikitext
9845 {{CURRENTWEEK}}
9846 !! html
9847 <p>1
9848 </p>
9849 !! end
9850
9851 !! test
9852 Magic Word: {{CURRENTYEAR}}
9853 !! wikitext
9854 {{CURRENTYEAR}}
9855 !! html
9856 <p>1970
9857 </p>
9858 !! end
9859
9860 !! test
9861 Magic Word: {{CURRENTTIMESTAMP}}
9862 !! wikitext
9863 {{CURRENTTIMESTAMP}}
9864 !! html
9865 <p>19700101000203
9866 </p>
9867 !! end
9868
9869 !! test
9870 Magic Words LOCAL (UTC)
9871 !! wikitext
9872 * {{LOCALMONTH}}
9873 * {{LOCALMONTH1}}
9874 * {{LOCALMONTHNAME}}
9875 * {{LOCALMONTHNAMEGEN}}
9876 * {{LOCALMONTHABBREV}}
9877 * {{LOCALDAY}}
9878 * {{LOCALDAY2}}
9879 * {{LOCALDAYNAME}}
9880 * {{LOCALYEAR}}
9881 * {{LOCALTIME}}
9882 * {{LOCALHOUR}}
9883 * {{LOCALWEEK}}
9884 * {{LOCALDOW}}
9885 * {{LOCALTIMESTAMP}}
9886 !! html
9887 <ul><li> 01</li>
9888 <li> 1</li>
9889 <li> January</li>
9890 <li> January</li>
9891 <li> Jan</li>
9892 <li> 1</li>
9893 <li> 01</li>
9894 <li> Thursday</li>
9895 <li> 1970</li>
9896 <li> 00:02</li>
9897 <li> 00</li>
9898 <li> 1</li>
9899 <li> 4</li>
9900 <li> 19700101000203</li></ul>
9901
9902 !! end
9903
9904 !! test
9905 Magic Word: {{FULLPAGENAME}}
9906 !! options
9907 title=[[User:Ævar Arnfjörð Bjarmason]]
9908 !! wikitext
9909 {{FULLPAGENAME}}
9910 !! html
9911 <p>User:Ævar Arnfjörð Bjarmason
9912 </p>
9913 !! end
9914
9915 !! test
9916 Magic Word: {{FULLPAGENAMEE}}
9917 !! options
9918 title=[[User:Ævar Arnfjörð Bjarmason]]
9919 !! wikitext
9920 {{FULLPAGENAMEE}}
9921 !! html
9922 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9923 </p>
9924 !! end
9925
9926 !! test
9927 Magic Word: {{TALKSPACE}}
9928 !! options
9929 title=[[User:Ævar Arnfjörð Bjarmason]]
9930 !! wikitext
9931 {{TALKSPACE}}
9932 !! html
9933 <p>User talk
9934 </p>
9935 !! end
9936
9937 !! test
9938 Magic Word: {{TALKSPACE}}, same namespace
9939 !! options
9940 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9941 !! wikitext
9942 {{TALKSPACE}}
9943 !! html
9944 <p>User talk
9945 </p>
9946 !! end
9947
9948 !! test
9949 Magic Word: {{TALKSPACE}}, main namespace
9950 !! options
9951 title=[[Parser Test]]
9952 !! wikitext
9953 {{TALKSPACE}}
9954 !! html
9955 <p>Talk
9956 </p>
9957 !! end
9958
9959 !! test
9960 Magic Word: {{TALKSPACEE}}
9961 !! options
9962 title=[[User:Ævar Arnfjörð Bjarmason]]
9963 !! wikitext
9964 {{TALKSPACEE}}
9965 !! html
9966 <p>User_talk
9967 </p>
9968 !! end
9969
9970 !! test
9971 Magic Word: {{SUBJECTSPACE}}
9972 !! options
9973 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9974 !! wikitext
9975 {{SUBJECTSPACE}}
9976 !! html
9977 <p>User
9978 </p>
9979 !! end
9980
9981 !! test
9982 Magic Word: {{SUBJECTSPACE}}, same namespace
9983 !! options
9984 title=[[User:Ævar Arnfjörð Bjarmason]]
9985 !! wikitext
9986 {{SUBJECTSPACE}}
9987 !! html
9988 <p>User
9989 </p>
9990 !! end
9991
9992 !! test
9993 Magic Word: {{SUBJECTSPACE}}, main namespace
9994 !! options
9995 title=[[Parser Test]]
9996 !! wikitext
9997 {{SUBJECTSPACE}}
9998 !! html
9999
10000 !! end
10001
10002 !! test
10003 Magic Word: {{SUBJECTSPACEE}}
10004 !! options
10005 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10006 !! wikitext
10007 {{SUBJECTSPACEE}}
10008 !! html
10009 <p>User
10010 </p>
10011 !! end
10012
10013 !! test
10014 Magic Word: {{NAMESPACE}}
10015 !! options
10016 title=[[User:Ævar Arnfjörð Bjarmason]]
10017 !! wikitext
10018 {{NAMESPACE}}
10019 !! html
10020 <p>User
10021 </p>
10022 !! end
10023
10024 !! test
10025 Magic Word: {{NAMESPACEE}}
10026 !! options
10027 title=[[User:Ævar Arnfjörð Bjarmason]]
10028 !! wikitext
10029 {{NAMESPACEE}}
10030 !! html
10031 <p>User
10032 </p>
10033 !! end
10034
10035 !! test
10036 Magic Word: {{NAMESPACENUMBER}}
10037 !! options
10038 title=[[User:Ævar Arnfjörð Bjarmason]]
10039 !! wikitext
10040 {{NAMESPACENUMBER}}
10041 !! html
10042 <p>2
10043 </p>
10044 !! end
10045
10046 !! test
10047 Magic Word: {{SUBPAGENAME}}
10048 !! options
10049 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10050 !! wikitext
10051 {{SUBPAGENAME}}
10052 !! html
10053 <p>sub ö
10054 </p>
10055 !! end
10056
10057 !! test
10058 Magic Word: {{SUBPAGENAMEE}}
10059 !! options
10060 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10061 !! wikitext
10062 {{SUBPAGENAMEE}}
10063 !! html
10064 <p>sub_%C3%B6
10065 </p>
10066 !! end
10067
10068 !! test
10069 Magic Word: {{ROOTPAGENAME}}
10070 !! options
10071 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10072 !! wikitext
10073 {{ROOTPAGENAME}}
10074 !! html
10075 <p>Ævar Arnfjörð Bjarmason
10076 </p>
10077 !! end
10078
10079 !! test
10080 Magic Word: {{ROOTPAGENAMEE}}
10081 !! options
10082 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10083 !! wikitext
10084 {{ROOTPAGENAMEE}}
10085 !! html
10086 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10087 </p>
10088 !! end
10089
10090 !! test
10091 Magic Word: {{BASEPAGENAME}}
10092 !! options
10093 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10094 !! wikitext
10095 {{BASEPAGENAME}}
10096 !! html
10097 <p>Ævar Arnfjörð Bjarmason
10098 </p>
10099 !! end
10100
10101 !! test
10102 Magic Word: {{BASEPAGENAMEE}}
10103 !! options
10104 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10105 !! wikitext
10106 {{BASEPAGENAMEE}}
10107 !! html
10108 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10109 </p>
10110 !! end
10111
10112 !! test
10113 Magic Word: {{TALKPAGENAME}}
10114 !! options
10115 title=[[User:Ævar Arnfjörð Bjarmason]]
10116 !! wikitext
10117 {{TALKPAGENAME}}
10118 !! html
10119 <p>User talk:Ævar Arnfjörð Bjarmason
10120 </p>
10121 !! end
10122
10123 !! test
10124 Magic Word: {{TALKPAGENAMEE}}
10125 !! options
10126 title=[[User:Ævar Arnfjörð Bjarmason]]
10127 !! wikitext
10128 {{TALKPAGENAMEE}}
10129 !! html
10130 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10131 </p>
10132 !! end
10133
10134 !! test
10135 Magic Word: {{SUBJECTPAGENAME}}
10136 !! options
10137 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10138 !! wikitext
10139 {{SUBJECTPAGENAME}}
10140 !! html
10141 <p>User:Ævar Arnfjörð Bjarmason
10142 </p>
10143 !! end
10144
10145 !! test
10146 Magic Word: {{SUBJECTPAGENAMEE}}
10147 !! options
10148 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10149 !! wikitext
10150 {{SUBJECTPAGENAMEE}}
10151 !! html
10152 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10153 </p>
10154 !! end
10155
10156 !! test
10157 Magic Word: {{NUMBEROFFILES}}
10158 !! wikitext
10159 {{NUMBEROFFILES}}
10160 !! html
10161 <p>7
10162 </p>
10163 !! end
10164
10165 !! test
10166 Magic Word: {{PAGENAME}}
10167 !! options
10168 title=[[User:Ævar Arnfjörð Bjarmason]]
10169 !! wikitext
10170 {{PAGENAME}}
10171 !! html
10172 <p>Ævar Arnfjörð Bjarmason
10173 </p>
10174 !! end
10175
10176 !! test
10177 Magic Word: {{PAGENAME}} with metacharacters
10178 !! options
10179 title=[['foo & bar = baz']]
10180 !! wikitext
10181 ''{{PAGENAME}}''
10182 !! html/php
10183 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10184 </p>
10185 !! html+tidy
10186 <p><i>'foo &amp; bar = baz'</i></p>
10187 !! end
10188
10189 !! test
10190 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
10191 !! options
10192 title=[[*RFC 1234 http://example.com/]]
10193 !! wikitext
10194 {{PAGENAME}}
10195 !! html/php
10196 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10197 </p>
10198 !! html+tidy
10199 <p>*RFC 1234 http://example.com/</p>
10200 !! end
10201
10202 !! test
10203 Magic Word: {{PAGENAMEE}}
10204 !! options
10205 title=[[User:Ævar Arnfjörð Bjarmason]]
10206 !! wikitext
10207 {{PAGENAMEE}}
10208 !! html
10209 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10210 </p>
10211 !! end
10212
10213 !! test
10214 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10215 !! options
10216 title=[[*RFC 1234 http://example.com/]]
10217 !! wikitext
10218 {{PAGENAMEE}}
10219 !! html/php
10220 <p>&#42;RFC_1234_http&#58;//example.com/
10221 </p>
10222 !! html+tidy
10223 <p>*RFC_1234_http://example.com/</p>
10224 !! end
10225
10226 !! test
10227 Magic Word: {{REVISIONID}}
10228 !! wikitext
10229 {{REVISIONID}}
10230 !! html
10231 <p>1337
10232 </p>
10233 !! end
10234
10235 !! test
10236 Magic Word: {{SCRIPTPATH}}
10237 !! wikitext
10238 {{SCRIPTPATH}}
10239 !! html
10240
10241 !! end
10242
10243 !! test
10244 Magic Word: {{STYLEPATH}}
10245 !! wikitext
10246 {{STYLEPATH}}
10247 !! html
10248 <p>/skins
10249 </p>
10250 !! end
10251
10252 !! test
10253 Magic Word: {{SERVER}}
10254 !! wikitext
10255 {{SERVER}}
10256 !! html
10257 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10258 </p>
10259 !! end
10260
10261 !! test
10262 Magic Word: {{SERVERNAME}}
10263 !! wikitext
10264 {{SERVERNAME}}
10265 !! html
10266 <p>example.org
10267 </p>
10268 !! end
10269
10270 !! test
10271 Magic Word: {{SITENAME}}
10272 !! wikitext
10273 {{SITENAME}}
10274 !! html
10275 <p>MediaWiki
10276 </p>
10277 !! end
10278
10279 !! test
10280 Case-sensitive magic words, when cased differently, should just be template transclusions
10281 !! wikitext
10282 {{CurrentMonth}}
10283 {{currentday}}
10284 {{cURreNTweEK}}
10285 {{currentHour}}
10286 !! html
10287 <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>
10288 <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>
10289 <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>
10290 <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>
10291 </p>
10292 !! end
10293
10294 !! test
10295 Case-insensitive magic words should still work with weird casing.
10296 !! wikitext
10297 {{sErVeRNaMe}}
10298 {{LCFirst:AOEU}}
10299 {{ucFIRST:aoeu}}
10300 {{SERver}}
10301 !! html
10302 <p>example.org
10303 aOEU
10304 Aoeu
10305 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10306 </p>
10307 !! end
10308
10309 # From plwiki:PLOS_ONE
10310 !! test
10311 Parsoid: Page property magic word with magic word contents
10312 !! wikitext
10313 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10314 !! html/parsoid
10315 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#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>"}]]}'/>
10316 !! end
10317
10318 !! test
10319 Parsoid: Template-generated DISPLAYTITLE
10320 !! wikitext
10321 {{{{echo|DISPLAYTITLE}}:Foo}}
10322 !! html/parsoid
10323 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
10324 !! end
10325
10326 !! test
10327 Namespace 1 {{ns:1}}
10328 !! wikitext
10329 {{ns:1}}
10330 !! html
10331 <p>Talk
10332 </p>
10333 !! end
10334
10335 !! test
10336 Namespace 1 {{ns:01}}
10337 !! wikitext
10338 {{ns:01}}
10339 !! html
10340 <p>Talk
10341 </p>
10342 !! end
10343
10344 !! test
10345 Namespace 0 {{ns:0}} (bug 4783)
10346 !! wikitext
10347 {{ns:0}}
10348 !! html
10349
10350 !! end
10351
10352 !! test
10353 Namespace 0 {{ns:00}} (bug 4783)
10354 !! wikitext
10355 {{ns:00}}
10356 !! html
10357
10358 !! end
10359
10360 !! test
10361 Namespace -1 {{ns:-1}}
10362 !! wikitext
10363 {{ns:-1}}
10364 !! html
10365 <p>Special
10366 </p>
10367 !! end
10368
10369 !! test
10370 Namespace User {{ns:User}}
10371 !! wikitext
10372 {{ns:User}}
10373 !! html
10374 <p>User
10375 </p>
10376 !! end
10377
10378 !! test
10379 Namespace User talk {{ns:User_talk}}
10380 !! wikitext
10381 {{ns:User_talk}}
10382 !! html
10383 <p>User talk
10384 </p>
10385 !! end
10386
10387 !! test
10388 Namespace User talk {{ns:uSeR tAlK}}
10389 !! wikitext
10390 {{ns:uSeR tAlK}}
10391 !! html
10392 <p>User talk
10393 </p>
10394 !! end
10395
10396 !! test
10397 Namespace File {{ns:File}}
10398 !! wikitext
10399 {{ns:File}}
10400 !! html
10401 <p>File
10402 </p>
10403 !! end
10404
10405 !! test
10406 Namespace File {{ns:Image}}
10407 !! wikitext
10408 {{ns:Image}}
10409 !! html
10410 <p>File
10411 </p>
10412 !! end
10413
10414 !! test
10415 Namespace (lang=de) Benutzer {{ns:User}}
10416 !! options
10417 language=de
10418 !! wikitext
10419 {{ns:User}}
10420 !! html
10421 <p>Benutzer
10422 </p>
10423 !! end
10424
10425 !! test
10426 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10427 !! options
10428 language=de
10429 !! wikitext
10430 {{ns:3}}
10431 !! html
10432 <p>Benutzer Diskussion
10433 </p>
10434 !! end
10435
10436 !! test
10437 Urlencode
10438 !! wikitext
10439 {{urlencode:hi world?!}}
10440 {{urlencode:hi world?!|WIKI}}
10441 {{urlencode:hi world?!|PATH}}
10442 {{urlencode:hi world?!|QUERY}}
10443 !! html/php
10444 <p>hi+world%3F%21
10445 hi_world%3F!
10446 hi%20world%3F%21
10447 hi+world%3F%21
10448 </p>
10449 !! end
10450
10451 !! test
10452 Magic Word: prioritize type info over data-parsoid
10453 !! options
10454 parsoid=html2wt
10455 !! html/parsoid
10456 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10457 !! wikitext
10458 __FORCETOC__
10459 !! end
10460
10461 !! test
10462 Magic Word: serialize on separate line (parsoid)
10463 !! options
10464 parsoid=wt2wt,html2wt
10465 !! wikitext
10466 foo
10467 __NOTOC__
10468 bar
10469 !! html/parsoid
10470 foo<meta property="mw:PageProp/notoc"/>bar
10471 !! end
10472
10473 !! test
10474 Magic Word: rt non-english wikis
10475 !! options
10476 parsoid=wt2wt
10477 language=de
10478 !! wikitext
10479 __NOEDITSECTION__
10480 !! html/parsoid
10481 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10482 !! end
10483
10484 !!test
10485 __proto__ is treated as normal wikitext (T105997)
10486 !!wikitext
10487 __proto__
10488 !!html
10489 <p>__proto__
10490 </p>
10491 !!end
10492
10493 ###
10494 ### Magic links
10495 ###
10496 !! test
10497 Magic links: internal link to RFC (bug 479)
10498 !! wikitext
10499 [[RFC 123]]
10500 !! html/php
10501 <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>
10502 </p>
10503 !! html/parsoid
10504 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10505 !! end
10506
10507 !! test
10508 Magic links: RFC (bug 479)
10509 !! wikitext
10510 RFC 822
10511 !! html/php
10512 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10513 </p>
10514 !! html/parsoid
10515 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10516 !! end
10517
10518 !! test
10519 Magic links: RFC (bug 65278)
10520 !! wikitext
10521 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10522 !! html/php
10523 <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.
10524 </p>
10525 !! html/parsoid
10526 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10527 !! end
10528
10529 !! test
10530 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10531 !! wikitext
10532 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10533 RFC
10534 822
10535 !! html/php
10536 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10537 RFC
10538 822
10539 </p>
10540 !! html/parsoid
10541 <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>
10542 RFC
10543 822</p>
10544 !! end
10545
10546 !! test
10547 Magic links: ISBN (bug 1937)
10548 !! wikitext
10549 ISBN 0-306-40615-2
10550 !! html/php
10551 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10552 </p>
10553 !! html/parsoid
10554 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10555 !! end
10556
10557 !! test
10558 Magic links: ISBN (bug 65278)
10559 !! wikitext
10560 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10561 !! html/php
10562 <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.
10563 </p>
10564 !! html/parsoid
10565 <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>
10566 !! end
10567
10568 !! test
10569 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10570 !! wikitext
10571 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10572 ISBN
10573 9780316098113
10574 ISBN 978
10575 0316098113
10576 !! html/php
10577 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10578 ISBN
10579 9780316098113
10580 ISBN 978
10581 0316098113
10582 </p>
10583 !! html/parsoid
10584 <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>
10585 ISBN
10586 9780316098113
10587 ISBN 978
10588 0316098113</p>
10589 !! end
10590
10591 !! test
10592 Magic links: PMID incorrectly converts space to underscore
10593 !! wikitext
10594 PMID 1234
10595 !! html/php
10596 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10597 </p>
10598 !! html/parsoid
10599 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10600 !! end
10601
10602 !! test
10603 Magic links: PMID (bug 65278)
10604 !! wikitext
10605 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10606 !! html/php
10607 <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.
10608 </p>
10609 !! html/parsoid
10610 <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>
10611 !! end
10612
10613 !! test
10614 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10615 !! wikitext
10616 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10617 PMID
10618 1234
10619 !! html/php
10620 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10621 PMID
10622 1234
10623 </p>
10624 !! html/parsoid
10625 <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>
10626 PMID
10627 1234</p>
10628 !! end
10629
10630 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10631 # since these are ExtLinkText, not MagicLinkText
10632 !! test
10633 Magic links: use appropriate serialization for "almost" magic links.
10634 !! wikitext
10635 X[[Special:BookSources/0978739256|foo]]
10636
10637 X[//tools.ietf.org/html/rfc1234 foo]
10638 !! html/php
10639 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10640 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10641 </p>
10642 !! html/parsoid
10643 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10644 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10645 !! end
10646
10647 !! test
10648 Magic links: All disabled (T47942)
10649 !! options
10650 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10651 !! wikitext
10652 ISBN 0-306-40615-2
10653 PMID 1234
10654 RFC 4321
10655 !! html/php
10656 <p>ISBN 0-306-40615-2
10657 PMID 1234
10658 RFC 4321
10659 </p>
10660 !! end
10661
10662 ###
10663 ### Templates
10664 ####
10665
10666 !! test
10667 Nonexistent template
10668 !! wikitext
10669 {{thistemplatedoesnotexist}}
10670 !! html
10671 <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>
10672 </p>
10673 !! end
10674
10675 !! test
10676 Template with invalid target containing tags
10677 !! wikitext
10678 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10679 !! html
10680 <p>{{a<b>b</b>|foo|a=b|a = b}}
10681 </p>
10682 !! end
10683
10684 !! test
10685 Template with invalid target containing unclosed tag
10686 !! wikitext
10687 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10688 !! html
10689 <p>{{a<b>|foo|a=b|a = b}}</b>
10690 </p>
10691 !! end
10692
10693 !! test
10694 Template with invalid target containing wikilink
10695 !! wikitext
10696 {{[[Main Page]]}}
10697 !! html/php
10698 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10699 </p>
10700 !! html/parsoid
10701 <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>
10702 !! end
10703
10704 !! test
10705 Template with just whitespace in it, bug #68421
10706 !! wikitext
10707 {{echo|{{ }}}}
10708 !! html/parsoid
10709 <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>
10710 !! end
10711
10712 !! article
10713 Template:test
10714 !! text
10715 This is a test template
10716 !! endarticle
10717
10718 !! test
10719 Simple template
10720 !! wikitext
10721 {{test}}
10722 !! html
10723 <p>This is a test template
10724 </p>
10725 !! end
10726
10727 !! test
10728 Template with explicit namespace
10729 !! wikitext
10730 {{Template:test}}
10731 !! html
10732 <p>This is a test template
10733 </p>
10734 !! end
10735
10736
10737 !! article
10738 Template:paramtest
10739 !! text
10740 This is a test template with parameter {{{param}}}
10741 !! endarticle
10742
10743 !! test
10744 Template parameter
10745 !! wikitext
10746 {{paramtest|param=foo}}
10747 !! html
10748 <p>This is a test template with parameter foo
10749 </p>
10750 !! end
10751
10752 !! article
10753 Template:paramtestnum
10754 !! text
10755 [[{{{1}}}|{{{2}}}]]
10756 !! endarticle
10757
10758 !! test
10759 Template unnamed parameter
10760 !! wikitext
10761 {{paramtestnum|Main Page|the main page}}
10762 !! html
10763 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10764 </p>
10765 !! end
10766
10767 !! article
10768 Template:templatesimple
10769 !! text
10770 (test)
10771 !! endarticle
10772
10773 !! article
10774 Template:templateredirect
10775 !! text
10776 #redirect [[Template:templatesimple]]
10777 !! endarticle
10778
10779 !! article
10780 Template:templateasargtestnum
10781 !! text
10782 {{{{{1}}}}}
10783 !! endarticle
10784
10785 !! article
10786 Template:templateasargtest
10787 !! text
10788 {{template{{{templ}}}}}
10789 !! endarticle
10790
10791 !! article
10792 Template:templateasargtest2
10793 !! text
10794 {{{{{templ}}}}}
10795 !! endarticle
10796
10797 !! test
10798 Template with template name as unnamed argument
10799 !! wikitext
10800 {{templateasargtestnum|templatesimple}}
10801 !! html
10802 <p>(test)
10803 </p>
10804 !! end
10805
10806 !! test
10807 Template with template name as argument
10808 !! wikitext
10809 {{templateasargtest|templ=simple}}
10810 !! html
10811 <p>(test)
10812 </p>
10813 !! end
10814
10815 !! test
10816 Template with template name as argument (2)
10817 !! wikitext
10818 {{templateasargtest2|templ=templatesimple}}
10819 !! html
10820 <p>(test)
10821 </p>
10822 !! end
10823
10824 !! article
10825 Template:templateasargtestdefault
10826 !! text
10827 {{{{{templ|templatesimple}}}}}
10828 !! endarticle
10829
10830 !! article
10831 Template:templa
10832 !! text
10833 '''templ'''
10834 !! endarticle
10835
10836 !! test
10837 Template with default value
10838 !! wikitext
10839 {{templateasargtestdefault}}
10840 !! html
10841 <p>(test)
10842 </p>
10843 !! end
10844
10845 !! test
10846 Template with default value (value set)
10847 !! wikitext
10848 {{templateasargtestdefault|templ=templa}}
10849 !! html
10850 <p><b>templ</b>
10851 </p>
10852 !! end
10853
10854 !! test
10855 Template redirect
10856 !! wikitext
10857 {{templateredirect}}
10858 !! html/php
10859 <p>(test)
10860 </p>
10861 !! html/parsoid
10862 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10863 !! end
10864
10865 !! test
10866 Template with argument in separate line
10867 !! wikitext
10868 {{ templateasargtest |
10869 templ = simple }}
10870 !! html
10871 <p>(test)
10872 </p>
10873 !! end
10874
10875 !! test
10876 Template with complex template as argument
10877 !! wikitext
10878 {{paramtest|
10879 param ={{ templateasargtest |
10880 templ = simple }}}}
10881 !! html
10882 <p>This is a test template with parameter (test)
10883 </p>
10884 !! end
10885
10886 !! test
10887 Template with thumb image (with link in description)
10888 !! wikitext
10889 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10890 !! html/php
10891 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>
10892
10893 !! html+tidy
10894 <p>This is a test template with parameter</p>
10895 <div class="thumb tright">
10896 <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>
10897 <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>
10898 </div>
10899 </div>
10900 !! html/parsoid
10901 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
10902 !! end
10903
10904 !! article
10905 Template:complextemplate
10906 !! text
10907 {{{1}}} {{paramtest|
10908 param ={{{param}}}}}
10909 !! endarticle
10910
10911 !! test
10912 Template with complex arguments
10913 !! wikitext
10914 {{complextemplate|
10915 param ={{ templateasargtest |
10916 templ = simple }}|[[Template:complextemplate|link]]}}
10917 !! html
10918 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10919 </p>
10920 !! end
10921
10922 !! test
10923 BUG 553: link with two variables in a piped link
10924 !! wikitext
10925 {|
10926 |[[{{{1}}}|{{{2}}}]]
10927 |}
10928 !! html/php
10929 <table>
10930 <tr>
10931 <td>[[{{{1}}}|{{{2}}}]]
10932 </td></tr></table>
10933
10934 !! html/parsoid
10935 <table>
10936 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-parsoid='{"src":"{{{1}}}"}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-parsoid='{"src":"{{{2}}}"}'>{{{2}}}</span>]]</td></tr>
10937 !! end
10938
10939 # See: T2553
10940 !! test
10941 Abort table cell attribute parsing on wikilink
10942 !! wikitext
10943 {|
10944 | testing [[one|two]] | three || four
10945 | testing one two | three || four
10946 | testing="[[one|two]]" | three || four
10947 |}
10948 !! html/php
10949 <table>
10950 <tr>
10951 <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>
10952 <td> four
10953 </td>
10954 <td> three </td>
10955 <td> four
10956 </td>
10957 <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>
10958 <td> four
10959 </td></tr></table>
10960
10961 !! html/parsoid
10962 <table>
10963 <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>
10964 <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>
10965 <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>
10966 </tbody></table>
10967 !! end
10968
10969 !! test
10970 Don't abort table cell attribute parsing if wikilink is found in template arg
10971 !! wikitext
10972 {|
10973 | Test {{#tag:ref|One two "[[three]]" four}}
10974 |}
10975 !! html/parsoid
10976 <table>
10977 <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>
10978 </tbody></table>
10979 !! end
10980
10981 !! test
10982 Magic variable as template parameter
10983 !! wikitext
10984 {{paramtest|param={{SITENAME}}}}
10985 !! html
10986 <p>This is a test template with parameter MediaWiki
10987 </p>
10988 !! end
10989
10990 !! article
10991 Template:linktest
10992 !! text
10993 [[{{{param}}}|link]]
10994 !! endarticle
10995
10996 !! test
10997 Template parameter as link source
10998 !! wikitext
10999 {{linktest|param=Main Page}}
11000 !! html
11001 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11002 </p>
11003 !! end
11004
11005 !!article
11006 Template:paramtest2
11007 !! text
11008 including another template, {{paramtest|param={{{arg}}}}}
11009 !! endarticle
11010
11011 !! test
11012 Template passing argument to another template
11013 !! wikitext
11014 {{paramtest2|arg='hmm'}}
11015 !! html
11016 <p>including another template, This is a test template with parameter 'hmm'
11017 </p>
11018 !! end
11019
11020 !! article
11021 Template:Linktest2
11022 !! text
11023 Main Page
11024 !! endarticle
11025
11026 !! test
11027 Template as link source
11028 !! wikitext
11029 [[{{linktest2}}]]
11030
11031 [[{{linktest2}}|Main Page]]
11032
11033 [[{{linktest2}}]]Page
11034 !! html
11035 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11036 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11037 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11038 </p>
11039 !! end
11040
11041
11042 !! article
11043 Template:loop1
11044 !! text
11045 {{loop2}}
11046 !! endarticle
11047
11048 !! article
11049 Template:loop2
11050 !! text
11051 {{loop1}}
11052 !! endarticle
11053
11054 !! test
11055 Template infinite loop
11056 !! wikitext
11057 {{loop1}}
11058 !! html
11059 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11060 </p>
11061 !! end
11062
11063 !! test
11064 Template from main namespace
11065 !! wikitext
11066 {{:Main Page}}
11067 !! html
11068 <p>blah blah
11069 </p>
11070 !! end
11071
11072 !! article
11073 Template:table
11074 !! text
11075 {|
11076 | 1 || 2
11077 |-
11078 | 3 || 4
11079 |}
11080 !! endarticle
11081
11082 !! test
11083 BUG 529: Template with table, not included at beginning of line
11084 !! wikitext
11085 foo {{table}}
11086 !! html
11087 <p>foo
11088 </p>
11089 <table>
11090 <tr>
11091 <td> 1 </td>
11092 <td> 2
11093 </td></tr>
11094 <tr>
11095 <td> 3 </td>
11096 <td> 4
11097 </td></tr></table>
11098
11099 !! end
11100
11101 !! test
11102 BUG 523: Template shouldn't eat newline (or add an extra one before table)
11103 !! wikitext
11104 foo
11105 {{table}}
11106 !! html
11107 <p>foo
11108 </p>
11109 <table>
11110 <tr>
11111 <td> 1 </td>
11112 <td> 2
11113 </td></tr>
11114 <tr>
11115 <td> 3 </td>
11116 <td> 4
11117 </td></tr></table>
11118
11119 !! end
11120
11121 !! test
11122 BUG 41: Template parameters shown as broken links
11123 !! wikitext
11124 {{{parameter}}}
11125 !! html
11126 <p>{{{parameter}}}
11127 </p>
11128 !! end
11129
11130 !! test
11131 Template with targets containing wikilinks
11132 !! wikitext
11133 {{[[foo]]}}
11134
11135 {{[[{{echo|foo}}]]}}
11136
11137 {{{{echo|[[foo}}]]}}
11138 !! html
11139 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11140 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11141 </p><p>{{[[foo}}]]
11142 </p>
11143 !! end
11144
11145 !! article
11146 Template:''
11147 !! text
11148 bar
11149 !! endarticle
11150
11151 !! test
11152 Templates: Double quotes as template target
11153 !! wikitext
11154 foo {{''}} baz
11155 !! html/php
11156 <p>foo bar baz
11157 </p>
11158 !! html/parsoid
11159 <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
11160 </p>
11161 !! end
11162
11163 ## This test is about making sure Parsoid's data-mw is well formed in the
11164 ## face of multiple templates with intersecting and overlapping ranges. The
11165 ## wikitext itself is wretched.
11166 !! test
11167 Templates with intersecting and overlapping ranges
11168 !! wikitext
11169 {|{{echo|
11170 <p>ha</p>}}
11171 {|{{echo|
11172 <p>ho</p>}}
11173 {{echo|{{!}}hi}}
11174 |}
11175 !! html/php+tidy
11176 <p>ha</p>
11177 <p>ho</p>
11178 <table>
11179 <tr>
11180 <td></td>
11181 </tr>
11182 <tr>
11183 <td>hi</td>
11184 </tr>
11185 </table>
11186 <table>
11187 <tr>
11188 <td></td>
11189 </tr>
11190 </table>
11191 !! html/parsoid
11192 <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":""}]]}'>
11193
11194 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11195
11196 <tbody><tr><td>hi</td></tr>
11197 </tbody></table>
11198 !! end
11199
11200 !! article
11201 Template:MSGNW test
11202 !! text
11203 ''None'' of '''this''' should be
11204 * interpreted
11205 but rather passed unmodified
11206 {{test}}
11207 <gallery>
11208 File:Foobar.jpg
11209 </gallery>
11210 <!-- comment -->
11211 !! endarticle
11212
11213 # hmm, fix this or just deprecate msgnw and document its behavior?
11214 !! test
11215 msgnw keyword
11216 !! wikitext
11217 {{msgnw:MSGNW test}}
11218 !! html/php
11219 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11220 &#42; interpreted
11221 &#32;but rather passed unmodified
11222 &#123;&#123;test&#125;&#125;
11223 &#60;gallery&#62;
11224 File:Foobar.jpg
11225 &#60;/gallery&#62;
11226 &#60;!-- comment --&#62;
11227 </p>
11228 !! end
11229
11230 !! test
11231 int keyword
11232 !! wikitext
11233 {{int:youhavenewmessages|lots of money|not!}}
11234 !! html
11235 <p>You have lots of money (not!).
11236 </p>
11237 !! end
11238
11239 !! test
11240 int keyword - non-existing message
11241 !! wikitext
11242 {{int:var}}
11243 !! html
11244 <p>⧼var⧽
11245 </p>
11246 !! end
11247
11248 !! article
11249 Template:Includes
11250 !! text
11251 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11252 !! endarticle
11253
11254 !! test
11255 <includeonly> and <noinclude> being included
11256 !! wikitext
11257 {{Includes}}
11258 !! html
11259 <p>Foobar
11260 </p>
11261 !! end
11262
11263 !! article
11264 Template:Includes2
11265 !! text
11266 <onlyinclude>Foo</onlyinclude>bar
11267 !! endarticle
11268
11269 !! test
11270 <onlyinclude> being included
11271 !! wikitext
11272 {{Includes2}}
11273 !! html
11274 <p>Foo
11275 </p>
11276 !! end
11277
11278
11279 !! article
11280 Template:Includes3
11281 !! text
11282 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11283 !! endarticle
11284
11285 !! test
11286 <onlyinclude> and <includeonly> being included
11287 !! wikitext
11288 {{Includes3}}
11289 !! html
11290 <p>Foo
11291 </p>
11292 !! end
11293
11294 !! test
11295 <includeonly> and <noinclude> on a page
11296 !! wikitext
11297 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11298 !! html
11299 <p>Foozar
11300 </p>
11301 !! end
11302
11303 !! test
11304 Un-closed <noinclude>
11305 !! wikitext
11306 <noinclude>
11307 !! html
11308 !! end
11309
11310 !! test
11311 <onlyinclude> on a page
11312 !! wikitext
11313 <onlyinclude>Foo</onlyinclude>bar
11314 !! html
11315 <p>Foobar
11316 </p>
11317 !! end
11318
11319 !! test
11320 Un-closed <onlyinclude>
11321 !! wikitext
11322 <onlyinclude>
11323 !! html
11324 !! end
11325
11326 !!test
11327 Self-closed noinclude, includeonly, onlyinclude tags
11328 !! wikitext
11329 <noinclude />
11330 <includeonly />
11331 <onlyinclude />
11332 !! html
11333 <p><br />
11334 </p>
11335 !!end
11336
11337 !!test
11338 Unbalanced includeonly and noinclude tags
11339 !! wikitext
11340 {|
11341 |a</noinclude>
11342 |b</noinclude></noinclude>
11343 |c</noinclude></includeonly>
11344 |d</includeonly></includeonly>
11345 |}
11346 !! html
11347 <table>
11348 <tr>
11349 <td>a
11350 </td>
11351 <td>b
11352 </td>
11353 <td>c&lt;/includeonly&gt;
11354 </td>
11355 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11356 </td></tr></table>
11357
11358 !!end
11359
11360 !! article
11361 Template:Includeonly section
11362 !! text
11363 <includeonly>
11364 ==Includeonly section==
11365 </includeonly>
11366 ==Section T-1==
11367 !!endarticle
11368
11369 !! test
11370 Bug 6563: Edit link generation for section shown by <includeonly>
11371 !! wikitext
11372 {{includeonly section}}
11373 !! html
11374 <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>
11375 <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>
11376
11377 !! end
11378
11379 # Uses same input as the contents of [[Template:Includeonly section]]
11380 !! test
11381 Bug 6563: Section extraction for section shown by <includeonly>
11382 !! options
11383 section=T-2
11384 !! wikitext
11385 <includeonly>
11386 ==Includeonly section==
11387 </includeonly>
11388 ==Section T-2==
11389 !! html
11390 ==Section T-2==
11391 !! end
11392
11393 !! test
11394 Bug 6563: Edit link generation for section suppressed by <includeonly>
11395 !! wikitext
11396 <includeonly>
11397 ==Includeonly section==
11398 </includeonly>
11399 ==Section 1==
11400 !! html
11401 <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>
11402
11403 !! end
11404
11405 !! test
11406 Bug 6563: Section extraction for section suppressed by <includeonly>
11407 !! options
11408 section=1
11409 !! wikitext
11410 <includeonly>
11411 ==Includeonly section==
11412 </includeonly>
11413 ==Section 1==
11414 !! html
11415 ==Section 1==
11416 !! end
11417
11418 !! test
11419 Un-closed <includeonly>
11420 !! wikitext
11421 <includeonly>
11422 !! html/php
11423 !! html/parsoid
11424 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11425 !! end
11426
11427 ## We used to, but no longer wt2wt this test since the default serializer
11428 ## will normalize the include directives to serialize on their own line.
11429 ## Selser will take care of preserving formatting in scenarios where they
11430 ## intermingled with other wikitext.
11431 !! test
11432 Includes and comments at SOL
11433 !! options
11434 parsoid=wt2html,html2html
11435 !! wikitext
11436 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11437
11438 <noinclude>
11439 some
11440 </noinclude>* stuff
11441 * here
11442
11443 <includeonly>can have stuff</includeonly>=== here ===
11444
11445 !! html/php
11446 <h2><span class="mw-headline" id="hu">hu</span></h2>
11447 <p>some
11448 </p>
11449 <ul><li> stuff</li>
11450 <li> here</li></ul>
11451 <h3><span class="mw-headline" id="here">here</span></h3>
11452
11453 !! html/parsoid
11454 <!-- 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>
11455
11456 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11457 <p>some</p>
11458 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11459 <li> here</li></ul>
11460
11461 <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>
11462
11463 !! end
11464
11465 # TODO: test with DOM fragment reuse!
11466 !! test
11467 Parsoid: DOM fragment reuse
11468 !! options
11469 parsoid=wt2wt,wt2html
11470 !! wikitext
11471 a{{echo|b<table></table>c}}d
11472
11473 a{{echo|b
11474 <table></table>
11475 c}}d
11476
11477 {{echo|a
11478
11479 <table></table>
11480
11481 b}}
11482 !! html
11483 <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>
11484
11485 <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">
11486 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11487 </span><p about="#mwt2">cd</p>
11488
11489 <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">
11490
11491 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11492
11493 </span><p about="#mwt3">b</p>
11494 !! end
11495
11496 !! test
11497 Parsoid: Merge double tds (T52603)
11498 !! options
11499 parsoid
11500 !! wikitext
11501 {|
11502 |{{echo|{{!}} foo}}
11503 |}
11504 !! html
11505 <table><tbody>
11506 <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>
11507 </tbody></table>
11508 !! end
11509
11510 !! test
11511 Parsoid: Merge double tds in nested transclusion content (T52603)
11512 !! options
11513 parsoid
11514 !! wikitext
11515 {{echo|<div>}}
11516 {|
11517 |{{echo|{{!}} foo}}
11518 |}
11519 {{echo|</div>}}
11520 !! html
11521 <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}}]}'>
11522 <table><tbody>
11523 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11524 </tbody></table>
11525 </div>
11526 !! end
11527
11528 ###
11529 ### <includeonly> and <noinclude> in attributes
11530 ###
11531 !!test
11532 0. includeonly around the entire attribute
11533 !! wikitext
11534 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11535 !! html
11536 <p><span id="v2">bar</span>
11537 </p>
11538 !!end
11539
11540 !!test
11541 1. includeonly in html attr key
11542 !! wikitext
11543 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11544 !! html
11545 <p><span id="foo">bar</span>
11546 </p>
11547 !!end
11548
11549 !!test
11550 2. includeonly in html attr value
11551 !! wikitext
11552 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11553 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11554 !! html
11555 <p><span id="v1">bar</span>
11556 <span id="v1">bar</span>
11557 </p>
11558 !!end
11559
11560 !!test
11561 3. includeonly in part of an attr value
11562 !! wikitext
11563 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11564 !! html
11565 <p><span style="color:red;">bar</span>
11566 </p>
11567 !!end
11568
11569 !!test
11570 4. includeonly in table attributes
11571 !! wikitext
11572 {|
11573 |- <noinclude>
11574 |-
11575 |a
11576 </noinclude>
11577 |- <includeonly>
11578 |-
11579 |b
11580 </includeonly>
11581 |}
11582 !! html
11583 <table>
11584
11585
11586 <tr>
11587 <td>a
11588 </td></tr>
11589 </table>
11590
11591 !!end
11592
11593 ###
11594 ### Token Stream Patcher tests
11595 ###
11596 ### These tests won't always pass wt2wt and other modes because
11597 ### on serialization, the table will be output on a new line.
11598 ### For now, we are blacklisting them, and using this to test selser.
11599 ###
11600
11601 !!test
11602 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11603 !!options
11604 parsoid=wt2html,wt2wt
11605 !!wikitext
11606 {{echo|}}{| width = '100%'
11607 |foo
11608 |}
11609 !!html/parsoid
11610 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11611 <tbody><tr><td>foo</td></tr>
11612 </tbody></table>
11613 !!end
11614
11615 ## We used to, but no longer wt2wt this test since the default serializer
11616 ## will normalize the include directives to serialize on their own line.
11617 ## Selser will take care of preserving formatting in scenarios where they
11618 ## intermingled with other wikitext.
11619 !!test
11620 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11621 !!options
11622 parsoid=wt2html
11623 !!wikitext
11624 <includeonly>a</includeonly>{| {{{b}}}
11625 |c
11626 |}
11627 !!html/parsoid
11628 <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;{\"dsr\":[31,38,null,null],\"src\":\"{{{b}}}\"}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
11629 <tbody><tr><td>c</td></tr>
11630 </tbody></table>
11631 !!end
11632
11633 !! test
11634 Table wikitext syntax outside wiki-tables
11635 !! wikitext
11636 a
11637 |+ not a caption
11638 ! not a table heading
11639 |- not a table row
11640 | not a table cell
11641 | class="foo bar" | baz
11642 b
11643 |}
11644 |-
11645 c
11646 !! html
11647 <p>a
11648 |+ not a caption
11649 ! not a table heading
11650 |- not a table row
11651 | not a table cell
11652 | class="foo bar" | baz
11653 b
11654 |}
11655 |-
11656 c
11657 </p>
11658 !! end
11659
11660 ###
11661 ### Testing parsing of templates where a template arg
11662 ### has the same name as the template itself.
11663 ###
11664
11665 !! article
11666 Template:quote
11667 !! text
11668 {{{quote|{{{1}}}}}}
11669 !! endarticle
11670
11671 !!test
11672 Templates: Template Name/Arg clash: 1. Use of positional param
11673 !! wikitext
11674 {{quote|foo}}
11675 !! html
11676 <p>foo
11677 </p>
11678 !!end
11679
11680 !!test
11681 Templates: Template Name/Arg clash: 2. Use of named param
11682 !! wikitext
11683 {{quote|quote=foo}}
11684 !! html
11685 <p>foo
11686 </p>
11687 !!end
11688
11689 !!test
11690 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11691 !! wikitext
11692 {{quote|quote}}
11693 !! html
11694 <p>quote
11695 </p>
11696 !!end
11697
11698 ###
11699 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11700 ###
11701
11702 !!test
11703 Templates: 1. Simple use
11704 !! wikitext
11705 {{echo|Foo}}
11706 !! html
11707 <p>Foo
11708 </p>
11709 !!end
11710
11711 !!test
11712 Templates: 2. Inside a block tag
11713 !! wikitext
11714 <div>{{echo|Foo}}</div>
11715 <blockquote>{{echo|Foo}}</blockquote>
11716 !! html
11717 <div>Foo</div>
11718 <blockquote>Foo</blockquote>
11719
11720 !! html+tidy
11721 <div>Foo</div>
11722 <blockquote>
11723 <p>Foo</p>
11724 </blockquote>
11725 !!end
11726
11727 !!test
11728 Templates: P-wrapping: 1a. Templates on consecutive lines
11729 !! wikitext
11730 {{echo|Foo}}
11731 {{echo|bar}}
11732 !! html
11733 <p>Foo
11734 bar
11735 </p>
11736 !!end
11737
11738 !!test
11739 Templates: P-wrapping: 1b. Templates on consecutive lines
11740 !! wikitext
11741 Foo
11742
11743 {{echo|bar}}
11744 {{echo|baz}}
11745 !! html
11746 <p>Foo
11747 </p><p>bar
11748 baz
11749 </p>
11750 !!end
11751
11752 !!test
11753 Templates: P-wrapping: 1c. Templates on consecutive lines
11754 !! wikitext
11755 {{echo|Foo}}
11756 {{echo|bar}} <div>baz</div>
11757 !! html
11758 <p>Foo
11759 </p>
11760 bar <div>baz</div>
11761
11762 !! html+tidy
11763 <p>Foo</p>
11764 <p>bar</p>
11765 <div>baz</div>
11766 !! end
11767
11768 !!test
11769 Templates: P-wrapping: 1d. Template preceded by comment-only line
11770 !!options
11771 parsoid
11772 !! wikitext
11773 <!-- foo -->
11774 {{echo|Bar}}
11775 !! html
11776 <!-- foo -->
11777
11778 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11779 !!end
11780
11781 !!test
11782 Templates: Inline Text: 1. Multiple template uses
11783 !! wikitext
11784 {{echo|Foo}}bar{{echo|baz}}
11785 !! html
11786 <p>Foobarbaz
11787 </p>
11788 !!end
11789
11790 !!test
11791 Templates: Inline Text: 2. Back-to-back template uses
11792 !! wikitext
11793 {{echo|Foo}}{{echo|bar}}
11794 !! html
11795 <p>Foobar
11796 </p>
11797 !!end
11798
11799 !!test
11800 Templates: Block Tags: 1. Multiple template uses
11801 !! wikitext
11802 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11803 !! html
11804 <div>Foo</div><div>bar</div><div>baz</div>
11805
11806 !!end
11807
11808 !!test
11809 Templates: Block Tags: 2. Back-to-back template uses
11810 !! wikitext
11811 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11812 !! html
11813 <div>Foo</div><div>bar</div>
11814
11815 !!end
11816
11817 # This is an edge case relating to paragraph wrapping.
11818 !!test
11819 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11820 !! wikitext
11821 {{echo|a
11822 b</p>}}
11823 !! html/parsoid
11824 <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
11825 b</p>
11826 !!end
11827
11828 !!test
11829 Templates: Links: 1. Simple example
11830 !! wikitext
11831 {{echo|[[Foo|bar]]}}
11832 !! html
11833 <p><a href="/wiki/Foo" title="Foo">bar</a>
11834 </p>
11835 !!end
11836
11837 !!test
11838 Templates: Links: 2. Generation of link href
11839 !! wikitext
11840 [[{{echo|Foo}}|bar]]
11841 !! html
11842 <p><a href="/wiki/Foo" title="Foo">bar</a>
11843 </p>
11844 !!end
11845
11846 !!test
11847 Templates: Links: 3. Generation of part of a link href
11848 !! wikitext
11849 [[Fo{{echo|o}}|bar]]
11850
11851 [[Foo{{echo|bar}}]]
11852
11853 [[Foo{{echo|bar}}baz]]
11854
11855 [[Foo{{echo|bar}}|bar]]
11856
11857 [[:Foo{{echo|bar}}]]
11858
11859 [[:Foo{{echo|bar}}|bar]]
11860 !! html
11861 <p><a href="/wiki/Foo" title="Foo">bar</a>
11862 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11863 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11864 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11865 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11866 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11867 </p>
11868 !!end
11869
11870 !!test
11871 Templates: Links: 4. Multiple templates generating link href
11872 !! wikitext
11873 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11874 !! html
11875 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11876 </p>
11877 !!end
11878
11879 !!test
11880 Templates: Links: 5. Generation of link text
11881 !! wikitext
11882 [[Foo|{{echo|bar}}]]
11883 !! html
11884 <p><a href="/wiki/Foo" title="Foo">bar</a>
11885 </p>
11886 !!end
11887
11888 !!test
11889 Templates: Links: 5. Nested templates (only outermost template should be marked)
11890 !! wikitext
11891 {{echo|[[{{echo|Foo}}|bar]]}}
11892 !! html
11893 <p><a href="/wiki/Foo" title="Foo">bar</a>
11894 </p>
11895 !!end
11896
11897 !!test
11898 Templates: HTML Tag: 1. Generation of HTML attr. key
11899 !! wikitext
11900 <div {{echo|style}}="color:red;">foo</div>
11901 !! html
11902 <div style="color:red;">foo</div>
11903
11904 !!end
11905
11906 !!test
11907 Templates: HTML Tag: 2. Generation of HTML attr. value
11908 !! wikitext
11909 <div style={{echo|'color:red;'}}>foo</div>
11910 !! html
11911 <div style="color:red;">foo</div>
11912
11913 !!end
11914
11915 !!test
11916 Templates: HTML Tag: 3. Generation of HTML attr key and value
11917 !! wikitext
11918 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11919 !! html
11920 <div style="color:red;">foo</div>
11921
11922 !!end
11923
11924 !!test
11925 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11926 !! wikitext
11927 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11928 !! html
11929 <div title="This is a long title with just one piece templated">foo</div>
11930
11931 !!end
11932
11933 !!test
11934 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11935 !! wikitext
11936 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11937 !! html
11938 <div title="This is a long title with just one piece templated">foo</div>
11939
11940 !!end
11941
11942 !!test
11943 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11944 !! wikitext
11945 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11946 !! html
11947 <div title="This is a long title with just one piece templated">foo</div>
11948
11949 !!end
11950
11951 # SSS FIXME: While it is great we added support for all this,
11952 # do we want to make this part of the spec? Maybe we want to
11953 # deprecate this kind of usage in the future?
11954 !!test
11955 Templates: HTML Tag: 7. Generation of partial attribute key string
11956 !! wikitext
11957 <div st{{echo|yle}}="color:red;">foo</div>
11958 !! html
11959 <div style="color:red;">foo</div>
11960
11961 !!end
11962
11963 !! test
11964 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11965 !! wikitext
11966 <div {{echo|1=id="v1"}}>bar</div>
11967 !! html
11968 <div id="v1">bar</div>
11969
11970 !!end
11971
11972 !! test
11973 Templates: HTML Tag: 9. Multiple template-generated attributes
11974 !! wikitext
11975 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11976 !! html
11977 <div id="v1" title="foo">bar</div>
11978
11979 !!end
11980
11981 !! test
11982 Templates: Support for templates generating attributes and content
11983 !! wikitext
11984 {| {{mixed_attr_content_template}}
11985 |-
11986 |bar
11987 |}
11988 !! html/php
11989 <table style="color:red;" title="T48811">
11990
11991 <tr>
11992 <td>foo
11993 </td></tr>
11994 <tr>
11995 <td>bar
11996 </td></tr></table>
11997
11998 !! html/parsoid
11999 <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|}"]}'>
12000 <tbody><tr>
12001 <td>foo</td></tr>
12002 <tr>
12003 <td>bar</td></tr>
12004 </tbody></table>
12005 !!end
12006
12007 !! test
12008 1. Entities and nowikis inside templated attributes should be handled correctly
12009 !! wikitext
12010 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12011 !! html/php
12012 <div style="background:#f9f9f9;">foo</div>
12013
12014 !! html/parsoid
12015 <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>
12016 !! end
12017
12018 !! test
12019 2. Entities and nowikis inside templated attributes should be handled correctly
12020 !! wikitext
12021 {|
12022 |{{table_attribs_3}}
12023 |}
12024 !! html/php
12025 <table>
12026 <tr>
12027 <td style="background:#f9f9f9;">Foo
12028 </td></tr></table>
12029
12030 !! html/parsoid
12031 <table>
12032 <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>
12033 </tbody></table>
12034 !! end
12035
12036 !! test
12037 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12038 !! wikitext
12039 {{tbl-start}}
12040 |{{table_attribs_3}}
12041 {{tbl-end}}
12042 !! html/php
12043 <table>
12044 <tr>
12045 <td style="background:#f9f9f9;">Foo
12046 </td></tr></table>
12047
12048 !! html/parsoid
12049 <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}}]}'>
12050 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12051 </tbody></table>
12052 !! end
12053
12054 # T107622
12055 !! test
12056 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12057 !! wikitext
12058 {|
12059 | {{table_attribs_6}} hi
12060 |}
12061 !! html/php
12062 <table>
12063 <tr>
12064 <td style="background: red;"> hi
12065 </td></tr></table>
12066
12067 !! html/parsoid
12068 <table>
12069 <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>
12070 </tbody></table>
12071 !! end
12072
12073 !!test
12074 Templates: HTML Tables: 1. Generating start of a HTML table
12075 !! wikitext
12076 {{echo|<table><tr><td>foo</td>}}</tr></table>
12077 !! html
12078 <table><tr><td>foo</td></tr></table>
12079
12080 !!end
12081
12082 !!test
12083 Templates: HTML Tables: 2a. Generating middle of a HTML table
12084 !! wikitext
12085 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12086 !! html
12087 <table><tr><td>foo</td></tr></table>
12088
12089 !!end
12090
12091 !!test
12092 Templates: HTML Tables: 2b. Generating middle of a HTML table
12093 !! wikitext
12094 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12095 !! html
12096 <table><tr><td>foo</td></tr></table>
12097
12098 !!end
12099
12100 !!test
12101 Templates: HTML Tables: 3. Generating end of a HTML table
12102 !! wikitext
12103 <table><tr>{{echo|<td>foo</td></tr></table>}}
12104 !! html
12105 <table><tr><td>foo</td></tr></table>
12106
12107 !!end
12108
12109 !!test
12110 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12111 !! wikitext
12112 {{echo|<table>}}<tr><td>foo</td></tr></table>
12113 !! html
12114 <table><tr><td>foo</td></tr></table>
12115
12116 !!end
12117
12118 !!test
12119 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12120 !! wikitext
12121 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12122 !! html
12123 <table><tr><td>foo</td></tr></table>
12124
12125 !!end
12126
12127 !!test
12128 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12129 !! wikitext
12130 <table><tr>{{echo|<td>}}foo</td></tr></table>
12131 !! html
12132 <table><tr><td>foo</td></tr></table>
12133
12134 !!end
12135
12136 !!test
12137 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12138 !! wikitext
12139 <table><tr><td>foo{{echo|</td>}}</tr></table>
12140 !! html
12141 <table><tr><td>foo</td></tr></table>
12142
12143 !!end
12144
12145 !!test
12146 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12147 !! wikitext
12148 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12149 !! html
12150 <table><tr><td>foo</td></tr></table>
12151
12152 !!end
12153
12154 !!test
12155 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12156 !! wikitext
12157 <table><tr><td>foo</td></tr>{{echo|</table>}}
12158 !! html
12159 <table><tr><td>foo</td></tr></table>
12160
12161 !!end
12162
12163 !!test
12164 Templates: HTML Tables: 5. Proper fostering of categories from inside
12165 !!options
12166 parsoid=wt2html,wt2wt
12167 !! wikitext
12168 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12169 <!--Two categories (Bug 50330)-->
12170 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12171 !! html
12172 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12173 <!--Two categories (Bug 50330)-->
12174 <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>
12175 !!end
12176
12177 !!test
12178 Templates: Wiki Tables: 1a. Fostering of entire template content
12179 !! wikitext
12180 {|
12181 {{echo|a}}
12182 |}
12183 !! html
12184 <table>
12185 a
12186 <tr><td></td></tr></table>
12187
12188 !! html+tidy
12189 <p>a</p>
12190 <table>
12191 <tr>
12192 <td></td>
12193 </tr>
12194 </table>
12195 !! end
12196
12197 !!test
12198 Templates: Wiki Tables: 1b. Fostering of entire template content
12199 !! wikitext
12200 {|
12201 {{echo|<div>}}
12202 foo
12203 {{echo|</div>}}
12204 |}
12205 !! html
12206 <table>
12207 <div>
12208 <p>foo
12209 </p>
12210 </div>
12211 <tr><td></td></tr></table>
12212
12213 !! html+tidy
12214 <div>
12215 <p>foo</p>
12216 </div>
12217 <table>
12218 <tr>
12219 <td></td>
12220 </tr>
12221 </table>
12222 !! end
12223
12224 !!test
12225 Templates: Wiki Tables: 2. Fostering of partial template content
12226 !! wikitext
12227 {|
12228 {{echo|a
12229 <div>b</div>}}
12230 |}
12231 !! html
12232 <table>
12233 a
12234 <div>b</div>
12235 <tr><td></td></tr></table>
12236
12237 !! html+tidy
12238 <p>a</p>
12239 <div>b</div>
12240 <table>
12241 <tr>
12242 <td></td>
12243 </tr>
12244 </table>
12245 !! end
12246
12247 !!test
12248 Templates: Wiki Tables: 3. td-content via multiple templates
12249 !! wikitext
12250 {|
12251 {{echo|{{pipe}}a}}{{echo|b}}
12252 |}
12253 !! html
12254 <table>
12255 <tr>
12256 <td>ab
12257 </td></tr></table>
12258
12259 !!end
12260
12261 !!test
12262 Templates: Wiki Tables: 4. Templated tags, no content
12263 !! wikitext
12264 {{tbl-start}}
12265 {{tbl-end}}
12266 !! html
12267 <table>
12268 <tr><td></td></tr></table>
12269
12270 !!end
12271
12272 !!test
12273 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12274 !! wikitext
12275 {{tbl-start}}
12276 |foo
12277 {{tbl-end}}
12278 !! html
12279 <table>
12280 <tr>
12281 <td>foo
12282 </td></tr></table>
12283
12284 !!end
12285
12286 !!test
12287 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12288 !! wikitext
12289 {{tbl-start}}
12290 {{!}}foo
12291 {{tbl-end}}
12292 !! html
12293 <table>
12294 <tr>
12295 <td>foo
12296 </td></tr></table>
12297
12298 !!end
12299
12300 ## This test case is very specific to Parsoid's internals
12301 ## and is hence only tested for Parsoid's code. Parsoid uses
12302 ## a <meta> marker tag for <ref> tags and they are expanded
12303 ## much later. We are verifying that this <meta> tag usage
12304 ## doesn't prevent foster parenting.
12305 !!test
12306 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12307 !!wikitext
12308 {{PartialTable}}<ref>foo</ref>
12309 |}
12310
12311 <references />
12312 !!html/parsoid
12313 <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">
12314 <tbody>
12315 </tbody></table>
12316
12317 <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>
12318 !!end
12319
12320 !! test
12321 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12322 !! wikitext
12323 {{echo|
12324 {{{!}}
12325 {{!}}-}}
12326 <onlyinclude>
12327 |foo
12328 </onlyinclude>
12329 {{!}}}
12330 !! html/parsoid
12331 <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{{!}}}"]}'>
12332 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12333 <tbody><tr>
12334
12335 <td>foo
12336 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12337 </tbody></table>
12338 !! end
12339
12340 !!test
12341 Templates: Lists: Multi-line list-items via templates
12342 !! wikitext
12343 *{{echo|a {{nonexistent|
12344 unused}}}}
12345 *{{echo|b {{nonexistent|
12346 unused}}}}
12347 !! html
12348 <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>
12349 <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>
12350
12351 !!end
12352
12353 !!test
12354 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12355 !! wikitext
12356 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12357 !! html
12358 <p><i>ab</i>c<i>d</i>e
12359 </p>
12360 !!end
12361
12362 !!test
12363 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12364 (PHP parser generates misnested html)
12365 !! wikitext
12366 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12367 !! html/parsoid
12368 <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>
12369 !!end
12370
12371 !!test
12372 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12373 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12374 !! options
12375 parsoid=wt2html,wt2wt
12376 !! wikitext
12377 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12378 !! html
12379 <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>
12380 <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>
12381 <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>
12382 !!end
12383
12384 !!test
12385 Templates: Ugly nesting: 4. Divs opened/closed across templates
12386 !! wikitext
12387 a<div>b{{echo|c</div>d}}e
12388 !! html
12389 a<div>bc</div>de
12390
12391 !! html+tidy
12392 <p>a</p>
12393 <div>bc</div>
12394 <p>de</p>
12395 !! end
12396
12397 !!test
12398 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12399 (Parsoid-centric)
12400 !! options
12401 parsoid
12402 !! wikitext
12403 {|
12404 |{{echo|foo</table>}}
12405 |bar
12406 |}
12407 !! html
12408 <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|}"]}'>
12409
12410 <tbody>
12411 <tr>
12412 <td>foo</td></tr></tbody></table><span about="#mwt1">
12413 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12414 |}</span>
12415 !!end
12416
12417 !!test
12418 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12419 (Parsoid-centric)
12420 !! options
12421 parsoid
12422 !! wikitext
12423 <table>
12424 <tr>
12425 <td>
12426 <table>
12427 <tr>
12428 <td>1. {{echo|foo </table>}}</td>
12429 <td> bar </td>
12430 <td>2. {{echo|baz </table>}}</td>
12431 </tr>
12432 <tr>
12433 <td>abc</td>
12434 </tr>
12435 </table>
12436 </td>
12437 </tr>
12438 <tr>
12439 <td>xyz</td>
12440 </tr>
12441 </table>
12442 !! html
12443 <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>"]}'>
12444 <tbody><tr>
12445 <td>
12446 <table>
12447 <tbody><tr>
12448 <td>1. foo </td></tr></tbody></table></td>
12449 <td> bar </td>
12450 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12451 </span><span about="#mwt2">
12452 </span><span about="#mwt2">
12453 </span><span about="#mwt2">abc</span><span about="#mwt2">
12454 </span><span about="#mwt2">
12455 </span><span about="#mwt2">
12456 </span><span about="#mwt2">
12457 </span><span about="#mwt2">
12458 </span><span about="#mwt2">
12459 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12460 </span><span about="#mwt2">
12461 </span>
12462 !!end
12463
12464 !! test
12465 Templates: Ugly templates: 3. newline-only template parameter
12466 !! wikitext
12467 foo {{echo|
12468 }}
12469 !! html
12470 <p>foo
12471 </p>
12472 !! end
12473
12474 # This looks like a bug: a single newline triggers p/br for some reason.
12475 !! test
12476 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12477 !! wikitext
12478 {{echo|
12479 }}
12480 !! html
12481 <p><br />
12482 </p>
12483 !! end
12484
12485 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12486 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12487 !! test
12488 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12489 !! wikitext
12490 {{echo|<table>}}
12491 {{echo|<div>foo}}
12492 {{echo|</table>}}
12493 !! html/parsoid
12494 <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
12495 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12496 </table>
12497 !! end
12498
12499 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12500 # that are "identical" and generate nesting cycles in the algorithm
12501 !! test
12502 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12503 !! wikitext
12504 {{echo|<table><tr><td><table>}}
12505 {{echo|<div>}}
12506 {{echo|</div>}}
12507 !! html/parsoid
12508 <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"}'>
12509 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12510 </table></td></tr></tbody></table>
12511 !! end
12512
12513 !! test
12514 Templates: Parameters substituted at the top-level
12515 !! wikitext
12516 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12517 !! html/php
12518 <p><i>who</i> me? <b>never!</b>
12519 </p>
12520 !! html/parsoid
12521 <p about="#mwt2" typeof="mw:Param" data-parsoid="{&quot;src&quot;:&quot;{{{foo|''who'' {{echo|me}}? '''never!'''}}}&quot;}"><i>who</i> me? <b>never!</b></p>
12522 !! end
12523
12524 !!test
12525 Parser Functions: 1. Simple example
12526 !! wikitext
12527 {{uc:foo}}
12528 !! html
12529 <p>FOO
12530 </p>
12531 !!end
12532
12533 !!test
12534 Parser Functions: 2. Nested use (only outermost should be marked up)
12535 !! wikitext
12536 {{uc:{{lc:FOO}}}}
12537 !! html
12538 <p>FOO
12539 </p>
12540 !!end
12541
12542 ###
12543 ### Pre-save transform tests
12544 ###
12545 !! test
12546 pre-save transform: subst:
12547 !! options
12548 pst
12549 !! wikitext
12550 {{subst:test}}
12551 !! html/php
12552 This is a test template
12553 !! end
12554
12555 !! test
12556 pre-save transform: normal template
12557 !! options
12558 pst
12559 !! wikitext
12560 {{test}}
12561 !! html/php
12562 {{test}}
12563 !! end
12564
12565 !! test
12566 pre-save transform: nonexistent template
12567 !! options
12568 pst
12569 !! wikitext
12570 {{thistemplatedoesnotexist}}
12571 !! html/php
12572 {{thistemplatedoesnotexist}}
12573 !! end
12574
12575 !! test
12576 pre-save transform: subst magic variables
12577 !! options
12578 pst
12579 !! wikitext
12580 {{subst:SITENAME}}
12581 !! html/php
12582 MediaWiki
12583 !! end
12584
12585 # This is bug 89, which I fixed. -- wtm
12586 !! test
12587 pre-save transform: subst: templates with parameters
12588 !! options
12589 pst
12590 !! wikitext
12591 {{subst:paramtest|param="something else"}}
12592 !! html/php
12593 This is a test template with parameter "something else"
12594 !! end
12595
12596 !! article
12597 Template:nowikitest
12598 !! text
12599 <nowiki>'''not wiki'''</nowiki>
12600 !! endarticle
12601
12602 !! test
12603 pre-save transform: nowiki in subst (bug 1188)
12604 !! options
12605 pst
12606 !! wikitext
12607 {{subst:nowikitest}}
12608 !! html/php
12609 <nowiki>'''not wiki'''</nowiki>
12610 !! end
12611
12612 !! article
12613 Template:commenttest
12614 !! text
12615 This template has <!-- a comment --> in it.
12616 !! endarticle
12617
12618 !! test
12619 pre-save transform: comment in subst (bug 1936)
12620 !! options
12621 pst
12622 !! wikitext
12623 {{subst:commenttest}}
12624 !! html/php
12625 This template has <!-- a comment --> in it.
12626 !! end
12627
12628 !! test
12629 pre-save transform: unclosed tag
12630 !! options
12631 pst
12632 !! wikitext
12633 <nowiki>'''not wiki'''
12634 !! html/php
12635 <nowiki>'''not wiki'''
12636 !! end
12637
12638 !! test
12639 pre-save transform: mixed tag case
12640 !! options
12641 pst
12642 !! wikitext
12643 <NOwiki>'''not wiki'''</noWIKI>
12644 !! html/php
12645 <NOwiki>'''not wiki'''</noWIKI>
12646 !! end
12647
12648 !! test
12649 pre-save transform: unclosed comment in <nowiki>
12650 !! options
12651 pst
12652 !! wikitext
12653 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12654 !! html/php
12655 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12656 !!end
12657
12658 # Leading @ in this template definition works around a limitation
12659 # in parsoid's parserTests which otherwise strips the <span> from the
12660 # result (confusing it for a template wrapper)
12661 !! article
12662 Template:dangerous
12663 !!text
12664 @<span onmouseover="alert('crap')">Oh no</span>
12665 !!endarticle
12666
12667 !!test
12668 (confirming safety of fix for subst bug 1936)
12669 !! wikitext
12670 {{Template:dangerous}}
12671 !! html
12672 <p>@<span>Oh no</span>
12673 </p>
12674 !! end
12675
12676 !! test
12677 pre-save transform: comment containing gallery (bug 5024)
12678 !! options
12679 pst
12680 !! wikitext
12681 <!-- <gallery>data</gallery> -->
12682 !! html/php
12683 <!-- <gallery>data</gallery> -->
12684 !!end
12685
12686 !! test
12687 pre-save transform: comment containing extension
12688 !! options
12689 pst
12690 !! wikitext
12691 <!-- <tag>data</tag> -->
12692 !! html/php
12693 <!-- <tag>data</tag> -->
12694 !!end
12695
12696 !! test
12697 pre-save transform: comment containing nowiki
12698 !! options
12699 pst
12700 !! wikitext
12701 <!-- <nowiki>data</nowiki> -->
12702 !! html/php
12703 <!-- <nowiki>data</nowiki> -->
12704 !!end
12705
12706 !! test
12707 pre-save transform: <noinclude> in subst (bug 3298)
12708 !! options
12709 pst
12710 !! wikitext
12711 {{subst:Includes}}
12712 !! html/php
12713 Foobar
12714 !! end
12715
12716 !! test
12717 pre-save transform: <onlyinclude> in subst (bug 3298)
12718 !! options
12719 pst
12720 !! wikitext
12721 {{subst:Includes2}}
12722 !! html/php
12723 Foo
12724 !! end
12725
12726 !! article
12727 Template:SubstTest
12728 !!text
12729 {{<includeonly>subst:</includeonly>Includes}}
12730 !! endarticle
12731
12732 !! article
12733 Template:SafeSubstTest
12734 !! text
12735 {{<includeonly>safesubst:</includeonly>Includes}}
12736 !! endarticle
12737
12738 !! test
12739 bug 22297: safesubst: works during PST
12740 !! options
12741 pst
12742 !! wikitext
12743 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12744 !! html/php
12745 FoobarFoobar
12746 !! end
12747
12748 !! test
12749 bug 22297: safesubst: works during normal parse
12750 !! wikitext
12751 {{SafeSubstTest}}
12752 !! html
12753 <p>Foobar
12754 </p>
12755 !! end
12756
12757 !! test
12758 subst: does not work during normal parse
12759 !! wikitext
12760 {{SubstTest}}
12761 !! html
12762 <p>{{subst:Includes}}
12763 </p>
12764 !! end
12765
12766 !! test
12767 pre-save transform: context links ("pipe trick")
12768 !! options
12769 pst
12770 !! wikitext
12771 [[Article (context)|]]
12772 [[Bar:Article|]]
12773 [[:Bar:Article|]]
12774 [[Bar:Article (context)|]]
12775 [[:Bar:Article (context)|]]
12776 [[|Article]]
12777 [[|Article (context)]]
12778 [[Bar:X (Y) Z|]]
12779 [[:Bar:X (Y) Z|]]
12780 !! html/php
12781 [[Article (context)|Article]]
12782 [[Bar:Article|Article]]
12783 [[:Bar:Article|Article]]
12784 [[Bar:Article (context)|Article]]
12785 [[:Bar:Article (context)|Article]]
12786 [[Article]]
12787 [[Article (context)]]
12788 [[Bar:X (Y) Z|X (Y) Z]]
12789 [[:Bar:X (Y) Z|X (Y) Z]]
12790 !! end
12791
12792 !! test
12793 pre-save transform: context links ("pipe trick") with interwiki prefix
12794 !! options
12795 pst
12796 !! wikitext
12797 [[interwiki:Article|]]
12798 [[:interwiki:Article|]]
12799 [[interwiki:Bar:Article|]]
12800 [[:interwiki:Bar:Article|]]
12801 !! html/php
12802 [[interwiki:Article|Article]]
12803 [[:interwiki:Article|Article]]
12804 [[interwiki:Bar:Article|Bar:Article]]
12805 [[:interwiki:Bar:Article|Bar:Article]]
12806 !! end
12807
12808 !! test
12809 pre-save transform: context links ("pipe trick") with parens in title
12810 !! options
12811 pst title=[[Somearticle (context)]]
12812 !! wikitext
12813 [[|Article]]
12814 !! html/php
12815 [[Article (context)|Article]]
12816 !! end
12817
12818 !! test
12819 pre-save transform: context links ("pipe trick") with comma in title
12820 !! options
12821 pst title=[[Someplace, Somewhere]]
12822 !! wikitext
12823 [[|Otherplace]]
12824 [[Otherplace, Elsewhere|]]
12825 [[Otherplace, Elsewhere, Anywhere|]]
12826 !! html/php
12827 [[Otherplace, Somewhere|Otherplace]]
12828 [[Otherplace, Elsewhere|Otherplace]]
12829 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12830 !! end
12831
12832 !! test
12833 pre-save transform: context links ("pipe trick") with parens and comma
12834 !! options
12835 pst title=[[Someplace (IGNORED), Somewhere]]
12836 !! wikitext
12837 [[|Otherplace]]
12838 [[Otherplace (place), Elsewhere|]]
12839 !! html/php
12840 [[Otherplace, Somewhere|Otherplace]]
12841 [[Otherplace (place), Elsewhere|Otherplace]]
12842 !! end
12843
12844 !! test
12845 pre-save transform: context links ("pipe trick") with comma and parens
12846 !! options
12847 pst title=[[Who, me? (context)]]
12848 !! wikitext
12849 [[|Yes, you.]]
12850 [[Me, Myself, and I (1937 song)|]]
12851 !! html/php
12852 [[Yes, you. (context)|Yes, you.]]
12853 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12854 !! end
12855
12856 !! test
12857 pre-save transform: context links ("pipe trick") with namespace
12858 !! options
12859 pst title=[[Ns:Somearticle]]
12860 !! wikitext
12861 [[|Article]]
12862 !! html/php
12863 [[Ns:Article|Article]]
12864 !! end
12865
12866 !! test
12867 pre-save transform: context links ("pipe trick") with namespace and parens
12868 !! options
12869 pst title=[[Ns:Somearticle (context)]]
12870 !! wikitext
12871 [[|Article]]
12872 !! html/php
12873 [[Ns:Article (context)|Article]]
12874 !! end
12875
12876 !! test
12877 pre-save transform: context links ("pipe trick") with namespace and comma
12878 !! options
12879 pst title=[[Ns:Somearticle, Context, Whatever]]
12880 !! wikitext
12881 [[|Article]]
12882 !! html/php
12883 [[Ns:Article, Context, Whatever|Article]]
12884 !! end
12885
12886 !! test
12887 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12888 !! options
12889 pst title=[[Ns:Somearticle, Context (context)]]
12890 !! wikitext
12891 [[|Article]]
12892 !! html/php
12893 [[Ns:Article (context)|Article]]
12894 !! end
12895
12896 !! test
12897 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12898 !! options
12899 pst title=[[Ns:Somearticle (IGNORED), Context]]
12900 !! wikitext
12901 [[|Article]]
12902 !! html/php
12903 [[Ns:Article, Context|Article]]
12904 !! end
12905
12906 !! test
12907 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12908 !! options
12909 pst
12910 !! wikitext
12911 [[Article(context)|]]
12912 [[Bar:Article(context)|]]
12913 [[:Bar:Article(context)|]]
12914 [[|Article(context)]]
12915 [[Bar:X(Y)Z|]]
12916 [[:Bar:X(Y)Z|]]
12917 !! html/php
12918 [[Article(context)|Article]]
12919 [[Bar:Article(context)|Article]]
12920 [[:Bar:Article(context)|Article]]
12921 [[Article(context)]]
12922 [[Bar:X(Y)Z|X(Y)Z]]
12923 [[:Bar:X(Y)Z|X(Y)Z]]
12924 !! end
12925
12926 !! test
12927 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12928 !! options
12929 pst
12930 !! wikitext
12931 [[Article (context)|]]
12932 [[Bar:Article (context)|]]
12933 [[:Bar:Article (context)|]]
12934 [[|Article (context)]]
12935 [[Bar:X (Y) Z|]]
12936 [[:Bar:X (Y) Z|]]
12937 !! html/php
12938 [[Article (context)|Article]]
12939 [[Bar:Article (context)|Article]]
12940 [[:Bar:Article (context)|Article]]
12941 [[Article (context)]]
12942 [[Bar:X (Y) Z|X (Y) Z]]
12943 [[:Bar:X (Y) Z|X (Y) Z]]
12944 !! end
12945
12946 !! test
12947 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12948 !! options
12949 pst
12950 !! wikitext
12951 [[Article(context)|]]
12952 [[Bar:Article(context)|]]
12953 [[:Bar:Article(context)|]]
12954 [[|Article(context)]]
12955 [[Bar:X(Y)Z|]]
12956 [[:Bar:X(Y)Z|]]
12957 !! html/php
12958 [[Article(context)|Article]]
12959 [[Bar:Article(context)|Article]]
12960 [[:Bar:Article(context)|Article]]
12961 [[Article(context)]]
12962 [[Bar:X(Y)Z|X(Y)Z]]
12963 [[:Bar:X(Y)Z|X(Y)Z]]
12964 !! end
12965
12966 !! test
12967 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12968 !! options
12969 pst
12970 !! wikitext
12971 [[Article (context), context|]]
12972 [[Article (context),context|]]
12973 [[Bar:Article (context), context|]]
12974 [[Bar:Article (context),context|]]
12975 [[:Bar:Article (context), context|]]
12976 [[:Bar:Article (context),context|]]
12977 !! html/php
12978 [[Article (context), context|Article]]
12979 [[Article (context),context|Article]]
12980 [[Bar:Article (context), context|Article]]
12981 [[Bar:Article (context),context|Article]]
12982 [[:Bar:Article (context), context|Article]]
12983 [[:Bar:Article (context),context|Article]]
12984 !! end
12985
12986 !! test
12987 pre-save transform: trim trailing empty lines
12988 !! options
12989 pst
12990 !! wikitext
12991 Empty lines are trimmed
12992
12993
12994
12995
12996 !! html/php
12997 Empty lines are trimmed
12998 !! end
12999
13000 !! test
13001 pre-save transform: Signature expansion
13002 !! options
13003 pst
13004 !! wikitext
13005 * ~~~
13006 * <noinclude>~~~</noinclude>
13007 * <includeonly>~~~</includeonly>
13008 * <onlyinclude>~~~</onlyinclude>
13009 !! html/php
13010 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13011 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13012 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13013 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13014 !! end
13015
13016
13017 !! test
13018 pre-save transform: Signature expansion in nowiki tags (bug 93)
13019 !! options
13020 pst disabled
13021 !! wikitext
13022 Shall not expand:
13023
13024 <nowiki>~~~~</nowiki>
13025
13026 <includeonly><nowiki>~~~~</nowiki></includeonly>
13027
13028 <noinclude><nowiki>~~~~</nowiki></noinclude>
13029
13030 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13031
13032 {{subst:Foo}} shall be converted to FOO
13033
13034 As well as inside noinclude/onlyinclude
13035 <noinclude>{{subst:Foo}}</noinclude>
13036 <onlyinclude>{{subst:Foo}}</onlyinclude>
13037
13038 But not inside includeonly
13039 <includeonly>{{subst:Foo}}</includeonly>
13040 !! html/php
13041 Shall not expand:
13042
13043 <nowiki>~~~~</nowiki>
13044
13045 <includeonly><nowiki>~~~~</nowiki></includeonly>
13046
13047 <noinclude><nowiki>~~~~</nowiki></noinclude>
13048
13049 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13050
13051 FOO shall be converted to FOO
13052
13053 As well as inside noinclude/onlyinclude
13054 <noinclude>FOO</noinclude>
13055 <onlyinclude>FOO</onlyinclude>
13056
13057 But not inside includeonly
13058 <includeonly>{{subst:Foo}}</includeonly>
13059 !! end
13060
13061 !! test
13062 Parsoid: Recognize nowiki with trailing space in tags
13063 !! options
13064 parsoid=wt2html
13065 !! wikitext
13066 <nowiki ><div>[[foo]]</nowiki >
13067
13068 a<nowiki / >b
13069
13070 c<nowiki />d
13071
13072 e<nowiki/ >f
13073 !! html
13074 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13075 <p>ab</p>
13076 <p>cd</p>
13077 <p>ef</p>
13078 !! end
13079
13080 !! test
13081 Parsoid: Recognize nowiki with odd capitalization
13082 !! options
13083 parsoid=wt2html
13084 !! wikitext
13085 <noWikI ><div>[[foo]]</Nowiki >
13086 !! html
13087 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13088 !! end
13089
13090
13091 !! test
13092 Parsoid: Escape nowiki with trailing space in tags
13093 !! options
13094 parsoid=html2wt
13095 !! html/parsoid
13096 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13097 <p>a&lt;nowiki /&gt;b</p>
13098 <p>c&lt;nowiki/ &gt;d</p>
13099 !! wikitext
13100 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13101
13102 a&lt;nowiki /&gt;b
13103
13104 c&lt;nowiki/ &gt;d
13105 !! end
13106
13107 !! test
13108 Parsoid: Escape weird noWikI capitalizations
13109 !! options
13110 parsoid=html2wt
13111 !! html/parsoid
13112 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13113 !! wikitext
13114 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13115 !! end
13116
13117 ###
13118 ### Message transform tests
13119 ###
13120 !! test
13121 message transform: magic variables
13122 !! options
13123 msg
13124 !! wikitext
13125 {{SITENAME}}
13126 !! html
13127 MediaWiki
13128 !! end
13129
13130 !! test
13131 message transform: should not transform wiki markup
13132 !! options
13133 msg
13134 !! wikitext
13135 ''test''
13136 !! html
13137 ''test''
13138 !! end
13139
13140 !! test
13141 message transform: <noinclude> in transcluded template (bug 4926)
13142 !! options
13143 msg
13144 !! wikitext
13145 {{Includes}}
13146 !! html
13147 Foobar
13148 !! end
13149
13150 !! test
13151 message transform: <onlyinclude> in transcluded template (bug 4926)
13152 !! options
13153 msg
13154 !! wikitext
13155 {{Includes2}}
13156 !! html
13157 Foo
13158 !! end
13159
13160 !! test
13161 {{#special:}} page name, known
13162 !! options
13163 msg
13164 !! wikitext
13165 {{#special:Recentchanges}}
13166 !! html
13167 Special:RecentChanges
13168 !! end
13169
13170 !! test
13171 {{#special:}} page name with subpage, known
13172 !! options
13173 msg
13174 !! wikitext
13175 {{#special:Recentchanges/param}}
13176 !! html
13177 Special:RecentChanges/param
13178 !! end
13179
13180 !! test
13181 {{#special:}} page name, unknown
13182 !! options
13183 msg
13184 !! wikitext
13185 {{#special:foobar nonexistent}}
13186 !! html
13187 Special:Foobar nonexistent
13188 !! end
13189
13190 !! test
13191 {{#speciale:}} page name, known
13192 !! options
13193 msg
13194 !! wikitext
13195 {{#speciale:Recentchanges}}
13196 !! html
13197 Special:RecentChanges
13198 !! end
13199
13200 !! test
13201 {{#speciale:}} page name with subpage, known
13202 !! options
13203 msg
13204 !! wikitext
13205 {{#speciale:Recentchanges/param}}
13206 !! html
13207 Special:RecentChanges/param
13208 !! end
13209
13210 !! test
13211 {{#speciale:}} page name, unknown
13212 !! options
13213 msg
13214 !! wikitext
13215 {{#speciale:foobar nonexistent}}
13216 !! html
13217 Special:Foobar_nonexistent
13218 !! end
13219
13220 ###
13221 ### Images
13222 ###
13223 ### For Parsoid-specific tests, see
13224 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13225
13226 !! test
13227 Simple image
13228 !! options
13229 parsoid=wt2html,wt2wt,html2html
13230 !! wikitext
13231 [[Image:foobar.jpg]]
13232 !! html/php
13233 <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>
13234 </p>
13235 !! html/parsoid
13236 <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>
13237 !! end
13238
13239 !! test
13240 Simple image (using File: namespace, now canonical)
13241 !! wikitext
13242 [[File:Foobar.jpg]]
13243 !! html/php
13244 <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>
13245 </p>
13246 !! html/parsoid
13247 <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>
13248 !! end
13249
13250 !! test
13251 Right-aligned image
13252 !! wikitext
13253 [[File:Foobar.jpg|right]]
13254 !! html/php
13255 <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>
13256
13257 !! html/parsoid
13258 <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>
13259 !! end
13260
13261 !! test
13262 Image with caption
13263 !! wikitext
13264 [[File:Foobar.jpg|right|Caption text]]
13265 !! html/php
13266 <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>
13267
13268 !! html/parsoid
13269 <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>
13270 !! end
13271
13272 !! test
13273 Image with caption, bug 53312 #1
13274 !! wikitext
13275 [[File:Foobar.jpg|right|Caption page stuff]]
13276 !! html/php
13277 <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>
13278
13279 !! html/parsoid
13280 <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>
13281 !! end
13282
13283 !! test
13284 Image with caption, bug 53312 #2
13285 !! wikitext
13286 [[File:Foobar.jpg|right|Caption page=]]
13287 !! html/php
13288 <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>
13289
13290 !! html/parsoid
13291 <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>
13292 !! end
13293
13294 !! test
13295 Image with caption, bug 53312 #3
13296 !! wikitext
13297 [[File:Foobar.jpg|right|Caption page=stuff]]
13298 !! html/php
13299 <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>
13300
13301 !! html/parsoid
13302 <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>
13303 !! end
13304
13305 !! test
13306 Allow empty links in image captions (Bug 60753)
13307 !! options
13308 thumbsize=220
13309 !! wikitext
13310 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13311 [[]]
13312 [[Link2]]
13313 ]]
13314 !! html/php
13315 <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>
13316
13317 !! html/parsoid
13318 <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>
13319 [[]]
13320 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13321 </figcaption></figure>
13322 !! end
13323
13324 !! test
13325 Titles in unlinked images (T23454)
13326 !! wikitext
13327 [[File:Foobar.jpg|link=|stuff]]
13328 !! html/php
13329 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13330 </p>
13331 !! end
13332
13333 !! test
13334 Link with empty target
13335 !! wikitext
13336 [[]]
13337 !! html
13338 <p>[[]]
13339 </p>
13340 !! end
13341
13342 !! test
13343 Image with link trail
13344 !! wikitext
13345 Linktrails should not work for images: [[File:Foobar.jpg]]s
13346 !! html/php
13347 <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
13348 </p>
13349 !! html/parsoid
13350 <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>
13351 !! end
13352
13353 !! test
13354 Image with empty attribute
13355 !! options
13356 parsoid=wt2html,wt2wt,html2html
13357 !! wikitext
13358 [[File:Foobar.jpg|right||Caption text]]
13359 !! html/php
13360 <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>
13361
13362 !! html/parsoid
13363 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
13364 !! end
13365
13366 !! test
13367 1. Block image with individual attributes from templates
13368 !! wikitext
13369 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13370 !! html/php
13371 <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>
13372
13373 !! html/parsoid
13374 <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>
13375 !! end
13376
13377 !! test
13378 2. Block Image with individual attributes from templates
13379 !! wikitext
13380 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13381 !! html/php
13382 <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>
13383
13384 !! html/parsoid
13385 <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>
13386 !! end
13387
13388 !! test
13389 3. Inline image with individual attributes from templates
13390 !! wikitext
13391 [[File:Foobar.jpg|{{echo|50px}}]]
13392 !! html/php
13393 <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>
13394 </p>
13395 !! html/parsoid
13396 <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>
13397 !! end
13398
13399 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13400 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13401 !! test
13402 Image with multiple attributes from the same template
13403 !! wikitext
13404 [[File:Foobar.jpg|{{image_attribs}}]]
13405 !! html/php
13406 <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>
13407
13408 !! html/parsoid
13409 <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>
13410 !! end
13411
13412 !! test
13413 Image with link tails
13414 !! options
13415 thumbsize=220
13416 !! wikitext
13417 123[[File:Foobar.jpg]]456
13418 123[[File:Foobar.jpg|right]]456
13419 123[[File:Foobar.jpg|thumb]]456
13420 !! html/php
13421 <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
13422 </p>
13423 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
13424 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
13425
13426 !! html/php+tidy
13427 <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>
13428 <p>123</p>
13429 <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>
13430 <p>456 123</p>
13431 <div class="thumb tright">
13432 <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>
13433 <div class="thumbcaption">
13434 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13435 </div>
13436 </div>
13437 </div>
13438 <p>456</p>
13439 !! html/parsoid
13440 <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>
13441 <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>
13442 <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>
13443 !! end
13444
13445 !! test
13446 Image with multiple captions -- only last one is accepted
13447 !! wikitext
13448 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13449 !! html/php
13450 <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>
13451
13452 !! html/parsoid
13453 <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>
13454 !! end
13455
13456 !! test
13457 Image with multiple widths -- use last
13458 !! wikitext
13459 [[File:Foobar.jpg|200px|300px|caption]]
13460 !! html/php
13461 <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>
13462 </p>
13463 !! html/parsoid
13464 <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>
13465 !! end
13466
13467 !! test
13468 Image with multiple alignments -- use first (bug 48664)
13469 !! options
13470 thumbsize=220
13471 !! wikitext
13472 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13473
13474 [[File:Foobar.jpg|middle|text-top|caption]]
13475 !! html/php
13476 <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>
13477 <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>
13478 </p>
13479 !! html/parsoid
13480 <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>
13481 <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>
13482 !! end
13483
13484 !! test
13485 Image with width attribute at different positions
13486 !! wikitext
13487 [[File:Foobar.jpg|200px|right|Caption]]
13488 [[File:Foobar.jpg|right|200px|Caption]]
13489 [[File:Foobar.jpg|right|Caption|200px]]
13490 !! html/php
13491 <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>
13492 <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>
13493 <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>
13494
13495 !! html/parsoid
13496 <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>
13497 <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>
13498 <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>
13499 !! end
13500
13501 # a sad bit of backward-compatibility
13502 !! test
13503 Image with size specified with pxpx (bug 13500, 51628)
13504 !! options
13505 parsoid=wt2html,wt2wt,html2html
13506 !! wikitext
13507 [[File:Foobar.jpg|20pxpx]]
13508 [[File:Foobar.jpg|200x20pxpx]]
13509 !! html/php
13510 <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>
13511 <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>
13512 </p>
13513 !! html/parsoid
13514 <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>
13515 !! end
13516
13517 !! test
13518 Image with link parameter, wiki target
13519 !! wikitext
13520 [[File:Foobar.jpg|link=Main Page]]
13521 !! html/php
13522 <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>
13523 </p>
13524 !! html/parsoid
13525 <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>
13526 !! end
13527
13528 # parsoid bug 49293 (part 1)
13529 !! test
13530 Image with link parameter, URL target
13531 !! wikitext
13532 [[File:Foobar.jpg|link=http://example.com/]]
13533 !! html/php
13534 <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>
13535 </p>
13536 !! html/parsoid
13537 <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>
13538 !! end
13539
13540 # parsoid bug 49293 (part 2)
13541 !! test
13542 Image with link parameter, protocol-less URL target
13543 !! wikitext
13544 [[File:Foobar.jpg|link=//example.com/]]
13545 !! html/php
13546 <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>
13547 </p>
13548 !! html/parsoid
13549 <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>
13550 !! end
13551
13552 !! test
13553 Escaping non-block captions (T107435)
13554 !! options
13555 parsoid={
13556 "modes": ["wt2wt"],
13557 "changes": [
13558 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13559 ]
13560 }
13561 !! wikitext
13562 [[Image:Foobar.jpg|caption]]
13563 !! wikitext/edited
13564 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13565 !! end
13566
13567 # wgExternalLinkTarget not supported by Parsoid
13568 !! test
13569 Image with link parameter, wgExternalLinkTarget
13570 !! wikitext
13571 [[Image:foobar.jpg|link=http://example.com/]]
13572 !! config
13573 wgExternalLinkTarget='foobar'
13574 !! html/php
13575 <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>
13576 </p>
13577 !! end
13578
13579 !! test
13580 Image with link parameter, wgNoFollowLinks set to false
13581 !! wikitext
13582 [[Image:foobar.jpg|link=http://example.com/]]
13583 !! config
13584 wgNoFollowLinks=false
13585 !! html
13586 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13587 </p>
13588 !! end
13589
13590 !! test
13591 Image with link parameter, wgNoFollowDomainExceptions
13592 !! wikitext
13593 [[Image:foobar.jpg|link=http://example.com/]]
13594 !! config
13595 wgNoFollowDomainExceptions='example.com'
13596 !! html
13597 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13598 </p>
13599 !! end
13600
13601 # wgExternalLinkTarget not supported by Parsoid
13602 !! test
13603 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13604 !! wikitext
13605 [[Image:foobar.jpg|link=http://example.com/|Title]]
13606 !! config
13607 wgExternalLinkTarget='foobar'
13608 !! html/php
13609 <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>
13610 </p>
13611 !! end
13612
13613 !! test
13614 Image with empty link parameter
13615 !! wikitext
13616 [[File:Foobar.jpg|link=]]
13617 !! html/php
13618 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13619 </p>
13620 !! html/parsoid
13621 <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>
13622 !! end
13623
13624 !! test
13625 Image with link parameter (wiki target) and unnamed parameter
13626 !! wikitext
13627 [[File:Foobar.jpg|link=Main_Page|Title]]
13628 !! html/php
13629 <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>
13630 </p>
13631 !! html/parsoid
13632 <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>
13633 !! end
13634
13635 !! test
13636 Image with link parameter (URL target) and unnamed parameter
13637 !! wikitext
13638 [[File:Foobar.jpg|link=http://example.com/|Title]]
13639 !! html/php
13640 <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>
13641 </p>
13642 !! html/parsoid
13643 <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>
13644 !! end
13645
13646 !! test
13647 Thumbnail image with link parameter
13648 !! options
13649 thumbsize=220
13650 parsoid=wt2html,wt2wt,html2html
13651 !! wikitext
13652 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13653 !! html/php
13654 <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>
13655
13656 !! html/parsoid
13657 <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>
13658 !! end
13659
13660 !! test
13661 Manually-specified thumbnail image
13662 !! options
13663 thumbsize=220
13664 !! wikitext
13665 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13666 !! html/php
13667 <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>
13668
13669 !! html/parsoid
13670 <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>
13671 !! end
13672
13673 !! test
13674 Manually-specified thumbnail image with explicit link to wiki page
13675 !! options
13676 thumbsize=220
13677 parsoid=wt2html,wt2wt,html2html
13678 !! wikitext
13679 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13680 !! html/php
13681 <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>
13682
13683 !! html/parsoid
13684 <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>
13685 !! end
13686
13687 !! test
13688 Manually-specified thumbnail image with explicit link to url
13689 !! options
13690 thumbsize=220
13691 parsoid=wt2html,wt2wt,html2html
13692 !! wikitext
13693 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13694 !! html/php
13695 <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>
13696
13697 !! html/parsoid
13698 <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>
13699 !! end
13700
13701 !! test
13702 Manually-specified thumbnail image with explicit no link
13703 !! options
13704 thumbsize=220
13705 parsoid=wt2html,wt2wt,html2html
13706 !! wikitext
13707 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13708 !! html/php
13709 <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>
13710
13711 !! html/parsoid
13712 <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>
13713 !! end
13714
13715 !! test
13716 Manually-specified thumbnail image with explicit link and alt text
13717 !! options
13718 thumbsize=220
13719 parsoid=wt2html,wt2wt,html2html
13720 !! wikitext
13721 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13722 !! html/php
13723 <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>
13724
13725 !! html/parsoid
13726 <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>
13727 !! end
13728
13729 !! test
13730 Image with frame and link
13731 !! options
13732 parsoid=wt2html,wt2wt,html2html
13733 !! wikitext
13734 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13735 !! html/php
13736 <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>
13737
13738 !! html/parsoid
13739 <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>
13740 !! end
13741
13742 !! test
13743 Image with frame and link and explicit alt
13744 !! options
13745 parsoid=wt2html,wt2wt,html2html
13746 !! wikitext
13747 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13748 !! html/php
13749 <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>
13750
13751 !! html/parsoid
13752 <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>
13753 !! end
13754
13755 !! test
13756 Image with wiki markup in implicit alt
13757 !! wikitext
13758 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13759
13760 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13761 !! html/php
13762 <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>
13763 </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>
13764 </p>
13765 !! html/parsoid
13766 <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>
13767
13768 <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>
13769 !! end
13770
13771 !! test
13772 Alt image option should handle most kinds of wikitext without barfing
13773 !! wikitext
13774 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13775 !! html/php
13776 <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>
13777
13778 !! html/parsoid
13779 <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>
13780 !! end
13781
13782 ###################
13783 # Conflicting image format options.
13784 # First option specified should 'win'.
13785 # All three cases in each test should be identical.
13786
13787 !! test
13788 Image with 'frameless' first.
13789 !! options
13790 parsoid=wt2html,wt2wt,html2html
13791 !! wikitext
13792 [[File:Foobar.jpg|frameless|caption]]
13793
13794 [[File:Foobar.jpg|frameless|frame|caption]]
13795
13796 [[File:Foobar.jpg|frameless|thumb|caption]]
13797 !! html/php
13798 <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>
13799 </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>
13800 </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>
13801 </p>
13802 !! html/parsoid
13803 <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>
13804 <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>
13805 <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>
13806 !! end
13807
13808 !! test
13809 Image with 'frame' first.
13810 !! options
13811 parsoid=wt2html,wt2wt,html2html
13812 !! wikitext
13813 [[File:Foobar.jpg|frame|caption]]
13814 [[File:Foobar.jpg|frame|frameless|caption]]
13815 [[File:Foobar.jpg|frame|thumb|caption]]
13816 !! html/php
13817 <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>
13818 <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>
13819 <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>
13820
13821 !! html/parsoid
13822 <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>
13823 <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>
13824 <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>
13825 !! end
13826
13827 !! test
13828 Image with 'thumb' first.
13829 !! options
13830 parsoid=wt2html,wt2wt,html2html
13831 !! wikitext
13832 [[File:Foobar.jpg|thumb|caption]]
13833 [[File:Foobar.jpg|thumb|frameless|caption]]
13834 [[File:Foobar.jpg|thumb|frame|caption]]
13835 !! html/php
13836 <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>
13837 <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>
13838 <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>
13839
13840 !! html/parsoid
13841 <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>
13842 <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>
13843 <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>
13844 !! end
13845
13846 ###################
13847 # Image sizing.
13848 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13849 # and https://phabricator.wikimedia.org/T64258
13850 # Foobar has actual size of 1941x220
13851 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13852 # a scalable format.
13853 # 2. Framed images always ignore size options; always render at default size.
13854 # 3. "Unspecified format" and border are the only types which can be
13855 # enlarged.
13856
13857 !! test
13858 Image: "unspecified format" and border enlarge
13859 !! options
13860 parsoid=wt2html,wt2wt,html2html
13861 !! wikitext
13862 [[File:Foobar.jpg|2000px]]
13863
13864 [[File:Foobar.jpg|border|2000px]]
13865 !! html/php
13866 <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>
13867 </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>
13868 </p>
13869 !! html/parsoid
13870 <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>
13871 <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>
13872 !! end
13873
13874 !! test
13875 Image: "unspecified format" and border reduce
13876 !! options
13877 parsoid=wt2html,wt2wt,html2html
13878 !! wikitext
13879 [[File:Foobar.jpg|1000px]]
13880
13881 [[File:Foobar.jpg|border|1000px]]
13882 !! html/php
13883 <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>
13884 </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>
13885 </p>
13886 !! html/parsoid
13887 <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>
13888 <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>
13889 !! end
13890
13891 !! test
13892 Image: thumbs reduce
13893 !! options
13894 parsoid=wt2html,wt2wt,html2html
13895 !! wikitext
13896 [[File:Foobar.jpg|thumb|50px]]
13897 !! html/php
13898 <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>
13899
13900 !! html/parsoid
13901 <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>
13902 !! end
13903
13904 !! test
13905 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13906 !! options
13907 parsoid=wt2html,wt2wt,html2html
13908 !! wikitext
13909 [[File:Foobar.jpg|thumb|2000px]]
13910
13911 [[File:Foobar.svg|thumb|2000px]]
13912 !! html/php
13913 <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>
13914 <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>
13915
13916 !! html/parsoid
13917 <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>
13918 <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>
13919 !! end
13920
13921 !! test
13922 Image: frameless can reduce in size
13923 !! options
13924 parsoid=wt2html,wt2wt,html2html
13925 !! wikitext
13926 [[File:Foobar.jpg|frameless|50px]]
13927 !! html/php
13928 <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>
13929 </p>
13930 !! html/parsoid
13931 <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>
13932 !! end
13933
13934 !! test
13935 Image: bitmap frameless can't be enlarged past original size, but vector can
13936 !! options
13937 parsoid=wt2html,wt2wt,html2html
13938 !! wikitext
13939 [[File:Foobar.jpg|frameless|2000px]]
13940
13941 [[File:Foobar.svg|frameless|2000px]]
13942 !! html/php
13943 <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>
13944 </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>
13945 </p>
13946 !! html/parsoid
13947 <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>
13948 <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>
13949 !! end
13950
13951 !! test
13952 Image: framed images are always unscaled.
13953 !! options
13954 parsoid=wt2html,wt2wt,html2html
13955 !! wikitext
13956 [[File:Foobar.jpg|frame]]
13957
13958 [[File:Foobar.jpg|frame|50px]]
13959
13960 [[File:Foobar.jpg|frame|50x50px]]
13961
13962 [[File:Foobar.jpg|frame|2000px]]
13963 !! html/php
13964 <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>
13965 <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>
13966 <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>
13967 <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>
13968
13969 !! html/parsoid
13970 <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>
13971 <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>
13972 <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>
13973 <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>
13974 !! end
13975
13976 ###################
13977
13978 !! test
13979 Link to image page- image page normally doesn't exists, hence edit link
13980 Add test with existing image page
13981 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13982 !! wikitext
13983 [[:Image:test]]
13984 !! html
13985 <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>
13986 </p>
13987 !! end
13988
13989 !! test
13990 bug 18784 Link to non-existent image page with caption should use caption as link text
13991 !! wikitext
13992 [[:Image:test|caption]]
13993 !! html
13994 <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>
13995 </p>
13996 !! end
13997
13998 !! test
13999 Frameless image caption with a free URL
14000 !! wikitext
14001 [[File:Foobar.jpg|http://example.com]]
14002 !! html/php
14003 <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>
14004 </p>
14005 !! html/parsoid
14006 <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>
14007 !! end
14008
14009 !! test
14010 Thumbnail image caption with a free URL
14011 !! options
14012 thumbsize=220
14013 !! wikitext
14014 [[File:Foobar.jpg|thumb|http://example.com]]
14015 !! html/php
14016 <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>
14017
14018 !! html/parsoid
14019 <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>
14020 !! end
14021
14022 !! test
14023 Thumbnail image caption with a free URL and explicit alt
14024 !! options
14025 thumbsize=220
14026 parsoid=wt2html,wt2wt,html2html
14027 !! wikitext
14028 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14029 !! html/php
14030 <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>
14031
14032 !! html/parsoid
14033 <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>
14034 !! end
14035
14036 !! test
14037 SVG thumbnails with no language set
14038 !! options
14039 !! wikitext
14040 [[File:Foobar.svg|thumb|caption]]
14041 !! html/php
14042 <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>
14043
14044 !! html/parsoid
14045 <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>
14046 !! end
14047
14048 !! test
14049 SVG thumbnails with language de
14050 !! options
14051 parsoid=wt2html,wt2wt,html2html
14052 !! wikitext
14053 [[File:Foobar.svg|thumb|caption|lang=de]]
14054 !! html/php
14055 <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>
14056
14057 !! html/parsoid
14058 <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>
14059 !! end
14060
14061 !! test
14062 SVG thumbnails with invalid language code
14063 !! options
14064 parsoid=wt2html,wt2wt,html2html
14065 !! wikitext
14066 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14067 !! html/php
14068 <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>
14069
14070 !! html/parsoid
14071 <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>
14072 !! end
14073
14074 !! test
14075 BUG 1887: A ISBN with a thumbnail
14076 !! wikitext
14077 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14078 !! html/php
14079 <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>
14080
14081 !! html/parsoid
14082 <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>
14083 !! end
14084
14085 !! test
14086 BUG 1887: A RFC with a thumbnail
14087 !! wikitext
14088 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14089 !! html/php
14090 <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>
14091
14092 !! html/parsoid
14093 <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>
14094 !! end
14095
14096 !! test
14097 BUG 1887: A mailto link with a thumbnail
14098 !! wikitext
14099 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14100 !! html/php
14101 <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>
14102
14103 !! html/parsoid
14104 <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>
14105 !! end
14106
14107 # Pending resolution to bug 368
14108 !! test
14109 BUG 648: Frameless image caption with a link
14110 !! wikitext
14111 [[File:Foobar.jpg|text with a [[link]] in it]]
14112 !! html/php
14113 <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>
14114 </p>
14115 !! html/parsoid
14116 <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>
14117 !! end
14118
14119 !! test
14120 BUG 648: Frameless image caption with a link (suffix)
14121 !! wikitext
14122 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14123 !! html/php
14124 <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>
14125 </p>
14126 !! html/parsoid
14127 <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>
14128 !! end
14129
14130 !! test
14131 BUG 648: Frameless image caption with an interwiki link
14132 !! wikitext
14133 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14134 !! html/php
14135 <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>
14136 </p>
14137 !! html/parsoid
14138 <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>
14139 !! end
14140
14141 !! test
14142 BUG 648: Frameless image caption with a piped interwiki link
14143 !! wikitext
14144 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14145 !! html/php
14146 <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>
14147 </p>
14148 !! html/parsoid
14149 <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>
14150 !! end
14151
14152 !! test
14153 T107474: Frameless image caption with <nowiki>
14154 !! wikitext
14155 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14156 !! html/parsoid
14157 <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>
14158 !! end
14159
14160 !! test
14161 Escape HTML special chars in image alt text
14162 !! wikitext
14163 [[File:Foobar.jpg|& < > "]]
14164 !! html/php
14165 <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>
14166 </p>
14167 !! html/parsoid
14168 <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>
14169 !! end
14170
14171 !! test
14172 Escape HTML special chars in image alt text with LanguageConverter
14173 !! options
14174 language=zh
14175 !! wikitext
14176 [[File:Foobar.jpg|& < > "]]
14177 !! html/php
14178 <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>
14179 </p>
14180 !! html/parsoid
14181 <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>
14182 !! end
14183
14184 !! test
14185 Entities in file name and attributes
14186 !! wikitext
14187 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14188 !! html/php
14189 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14190 </p>
14191 !! html/parsoid
14192 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"manualthumb=7%25 solution.gif"},{"ck":"link","ak":"link=7%25 solution"},{"ck":"caption","ak":"[[7%25 solution]]"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./7%25_solution\" title=\"7% solution\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./7%25_solution\"},\"sa\":{\"href\":\"7%25 solution\"},\"dsr\":[74,91,2,2]}&#39;>7% solution&lt;/a>"}'><a href="./7%25_solution" data-parsoid='{"a":{"href":"./7%25_solution"},"sa":{"href":"link=7%25 solution"}}'><img resource="./File:7%25_solution.gif" src="./Special:FilePath/7%25_solution.gif" height="220" width="220" data-parsoid='{"a":{"resource":"./File:7%25_solution.gif","height":"220","width":"220"},"sa":{"resource":"File:7%25 solution.gif"}}'/></a></span></p>
14193 !! end
14194
14195 !! test
14196 BUG 499: Alt text should have &#1234;, not &amp;1234;
14197 !! wikitext
14198 [[File:Foobar.jpg|&#9792;]]
14199 !! html/php
14200 <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>
14201 </p>
14202 !! html/parsoid
14203 <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>
14204 !! end
14205
14206 !! test
14207 Broken image caption with link
14208 !! options
14209 parsoid=wt2html,wt2wt,html2html
14210 !! wikitext
14211 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14212 !! html/php
14213 <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.
14214 </p>
14215 !! html/parsoid
14216 <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>
14217 !! end
14218
14219 !! test
14220 Image caption containing another image
14221 !! wikitext
14222 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14223 !! html/php
14224 <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>
14225
14226 !! html/parsoid
14227 <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>
14228 !! end
14229
14230 !! test
14231 Image: caption containing a newline
14232 !! wikitext
14233 [[File:Foobar.jpg|This
14234 *is some text]]
14235 !! html/php
14236 <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>
14237 </p>
14238 !! html/parsoid
14239 <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>
14240 !!end
14241
14242 !!test
14243 Image: caption containing leading space
14244 (The leading space should not trigger nowiki escaping in wt2wt mode)
14245 !! wikitext
14246 [[File:Foobar.jpg|thumb| bar]]
14247 !! html/php
14248 <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>
14249
14250 !! html/parsoid
14251 <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>
14252 !!end
14253
14254 !! test
14255 Image: caption containing a table
14256 !! options
14257 parsoid=wt2html,wt2wt,html2html
14258 !! wikitext
14259 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14260 {|
14261 ! Foo !! Bar
14262 |-
14263 | Foo1 || Bar1
14264 |}
14265 and some more text.]]
14266 !! html/php
14267 <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>
14268
14269 !! html/parsoid
14270 <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
14271 <table>
14272 <tbody>
14273 <tr><th>Foo </th><th>Bar</th></tr>
14274 <tr>
14275 <td>Foo1 </td>
14276 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14277 !! end
14278
14279 !! test
14280 Bug 3090: External links other than http: in image captions
14281 !! wikitext
14282 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14283 !! html/php
14284 <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>
14285
14286 !! html/parsoid
14287 <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>
14288 !! end
14289
14290 !! test
14291 Custom class
14292 !! options
14293 parsoid=wt2html,wt2wt,html2html
14294 !! wikitext
14295 [[Image:foobar.jpg|a|class=b]]
14296 !! html/php
14297 <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>
14298 </p>
14299 !! html/parsoid
14300 <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>
14301 !! end
14302
14303 !! test
14304 Localized image handling (1).
14305 !! options
14306 parsoid=wt2html,wt2wt,html2html
14307 language=es
14308 !! wikitext
14309 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14310 !! html/php
14311 <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>
14312
14313 !! html/parsoid
14314 <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>
14315 !! end
14316
14317 !! test
14318 Localized image handling (2).
14319 !! options
14320 thumbsize=220
14321 parsoid=wt2html,wt2wt,html2html
14322 language=es
14323 !! wikitext
14324 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14325 !! html/php
14326 <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>
14327
14328 !! html/parsoid
14329 <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>
14330 !! end
14331
14332 !! test
14333 Localized image handling (3).
14334 !! options
14335 language=fa
14336 parsoid=html2wt
14337 !! html/parsoid
14338 <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>
14339 !! wikitext
14340 [[File:Foobar.jpg|بندانگشتی]]
14341 !! end
14342
14343 !! test
14344 "border", "frameless" and "class" attributes on an image.
14345 !! options
14346 thumbsize=220
14347 parsoid=wt2html,wt2wt,html2html
14348 !! wikitext
14349 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14350 !! html/php
14351 <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>
14352 </p>
14353 !! html/parsoid
14354 <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>
14355 !! end
14356
14357 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14358 !! test
14359 Invalid image attributes (bug 62500)
14360 !! options
14361 thumbsize=220
14362 parsoid=wt2html,wt2wt,html2html
14363 !! wikitext
14364 [[File:Foobar.jpg|thumb|float|left|caption]]
14365
14366 [[File:Foobar.jpg|thumb|righ|caption]]
14367
14368 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14369 !! html/php
14370 <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>
14371 <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>
14372 <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>
14373
14374 !! html/parsoid
14375 <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>
14376 <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>
14377 <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>
14378 !! end
14379
14380 !! article
14381 File:Barfoo.jpg
14382 !! text
14383 #REDIRECT [[File:Barfoo.jpg]]
14384 !! endarticle
14385
14386 # FIXME: Parsoid should run this test -- but we'd need to teach the
14387 # mockAPI about the redirected Barfoo.jpg image.
14388 !! test
14389 Redirected image
14390 !! wikitext
14391 [[Image:Barfoo.jpg]]
14392 !! html/php
14393 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14394 </p>
14395 !! end
14396
14397 !! test
14398 Missing image with uploads disabled
14399 !! options
14400 wgEnableUploads=0
14401 !! wikitext
14402 [[File:Foobaz.jpg]]
14403 !! html/php
14404 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14405 </p>
14406 !! html/parsoid
14407 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Foobaz.jpg"><img resource="./File:Foobaz.jpg" src="./Special:FilePath/Foobaz.jpg" height="220" width="220"/></a></span></p>
14408 !! end
14409
14410 # Parsoid-specific testing for images
14411 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14412 # Currently imperfect due to a flaw in the Parsoid testrunner
14413 # Work in progress
14414 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14415 # image tests.
14416
14417 !! test
14418 Parsoid-specific image handling - simple image with size and middle alignment
14419 !! wikitext
14420 [[File:Foobar.jpg|middle|50px]]
14421 !! html/parsoid
14422 <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>
14423 !! end
14424
14425 !! test
14426 Parsoid-specific image handling - simple image with size, middle alignment,
14427 non-standard namespace alias
14428 !! options
14429 parsoid=wt2wt,wt2html,html2html
14430 !! wikitext
14431 [[Image:Foobar.jpg|middle|50px]]
14432 !! html/parsoid
14433 <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>
14434 !! end
14435
14436 !! test
14437 Parsoid-specific image handling - simple image with size and middle alignment
14438 (existing content)
14439 !! wikitext
14440 [[File:Foobar.jpg|50px|middle]]
14441 !! html/parsoid
14442 <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>
14443 !! end
14444
14445 !! test
14446 Parsoid-specific image handling - simple image with size and middle alignment
14447 and non-standard namespace name
14448 !! options
14449 parsoid=wt2html,wt2wt,html2html
14450 !! wikitext
14451 [[Image:Foobar.jpg|50px|middle]]
14452 !! html/parsoid
14453 <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>
14454 !! end
14455
14456 !! test
14457 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14458 !! wikitext
14459 [[File:Foobar.jpg|500x10px|baseline|caption]]
14460 !! html/parsoid
14461 <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>
14462 !! end
14463
14464 !! test
14465 Parsoid-specific image handling - simple image with border and size spec
14466 !! wikitext
14467 [[File:Foobar.jpg|50px|border|caption]]
14468 !! html/parsoid
14469 <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>
14470 !! end
14471
14472 !! test
14473 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14474 !! wikitext
14475 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14476 !! html/parsoid
14477 <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>
14478 !! end
14479
14480 !! test
14481 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14482 (existing content)
14483 !! wikitext
14484 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14485 !! html/parsoid
14486 <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>
14487 !! end
14488
14489 !! test
14490 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14491 !! wikitext
14492 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14493 !! html/parsoid
14494 <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>
14495 !! end
14496
14497 !! test
14498 Parsoid-specific image handling - thumbnail with specific size, halign,
14499 valign, and caption (existing content)
14500 !! wikitext
14501 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14502 !! html/parsoid
14503 <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>
14504 !! end
14505
14506 !! test
14507 Parsoid-specific image handling - framed image with specific size and caption
14508 (size is ignored)
14509 !! options
14510 parsoid=wt2html,wt2wt,html2html
14511 !! wikitext
14512 [[File:Foobar.jpg|frame|500x50px|caption]]
14513 !! html/parsoid
14514 <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>
14515 !! end
14516
14517 !! test
14518 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14519 (size is ignored)
14520 !! options
14521 parsoid=wt2html,wt2wt,html2html
14522 !! wikitext
14523 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14524 !! html/parsoid
14525 <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>
14526 !! end
14527
14528 !! test
14529 Parsoid-specific image handling - frameless image with specific size, border, and caption
14530 !! wikitext
14531 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14532 !! html/parsoid
14533 <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>
14534 !! end
14535
14536 !! test
14537 Parsoid-specific image handling - simple image with a formatted caption
14538 !! wikitext
14539 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14540 !! html/parsoid
14541 <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>
14542 !! end
14543
14544 !! test
14545 Parsoid-specific image handling - caption with a template in it
14546 !! wikitext
14547 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
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/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>
14550 !! end
14551
14552 !! test
14553 Parsoid-specific image handling - caption with unbalanced tags in it
14554 !! options
14555 parsoid=wt2html,wt2wt,html2html
14556 !! wikitext
14557 foo
14558 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14559 bar
14560 !! html/parsoid
14561 <p>foo</p>
14562 <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>
14563 <p>bar</p>
14564 !! end
14565
14566 !! test
14567 Parsoid-specific image handling - empty caption (1)
14568 !! options
14569 parsoid=wt2html,wt2wt
14570 !! wikitext
14571 [[File:Foobar.jpg|thumb|]]
14572 !! html/parsoid
14573 <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>
14574 !! end
14575
14576 # empty captions don't get serialized unless we're in the "round trip" case
14577 !! test
14578 Parsoid-specific image handling - empty caption (2)
14579 !! options
14580 parsoid=html2wt
14581 !! html/parsoid
14582 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14583 <a href="./File:Foobar.jpg">
14584 <img resource="./File:Foobar.jpg"
14585 src="//example.com/images/3/3a/Foobar.jpg"
14586 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14587 height="25" width="220"/>
14588 </a>
14589 <figcaption></figcaption>
14590 </figure>
14591 !! wikitext
14592 [[File:Foobar.jpg|thumb]]
14593 !! end
14594
14595 !! test
14596 Parsoid-specific image handling - whitespace caption
14597 !! wikitext
14598 [[File:Foobar.jpg|thumb| ]]
14599 !! html/parsoid
14600 <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>
14601 !! end
14602
14603 !! test
14604 Parsoid-specific image handling - lang option
14605 !! wikitext
14606 foo
14607 [[File:Foobar.svg|lang=de|caption]]
14608 bar
14609 !! html/parsoid
14610 <p>foo
14611 <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>
14612 bar</p>
14613 !! end
14614
14615 ## Edge case bugs in Parsoid from T93580
14616 !! test
14617 T93580: 1. Templated <ref> inside block images
14618 !! wikitext
14619 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14620
14621 <references />
14622 !! html/parsoid
14623 <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>
14624
14625 <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>
14626 !! end
14627
14628 !! test
14629 T93580: 2. <ref> inside inline images
14630 !! wikitext
14631 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14632
14633 <references />
14634 !! html/parsoid
14635 <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>
14636
14637 <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>
14638 !! end
14639
14640 !! test
14641 T93580: 3. Templated <ref> inside inline images
14642 !! wikitext
14643 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14644
14645 <references />
14646 !! html/parsoid
14647 <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>
14648
14649 <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>
14650 !! end
14651
14652 ###
14653 ### Subpages
14654 ###
14655 !! article
14656 Subpage test/subpage
14657 !! text
14658 foo
14659 !! endarticle
14660
14661 !! test
14662 Subpage link
14663 !! options
14664 subpage title=[[Subpage test]]
14665 !! wikitext
14666 [[/subpage]]
14667 !! html
14668 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14669 </p>
14670 !! end
14671
14672 !! test
14673 Subpage noslash link
14674 !! options
14675 subpage title=[[Subpage test]]
14676 !! wikitext
14677 [[/subpage/]]
14678 !! html
14679 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14680 </p>
14681 !! end
14682
14683 !! article
14684 Subpage test/1/2/subpage
14685 !! text
14686 blah
14687 !! endarticle
14688
14689 !! test
14690 Relative subpage noslash link
14691 !! options
14692 parsoid=wt2wt,wt2html,html2html
14693 subpage title=[[Subpage test/1/2/3/4]]
14694 !! wikitext
14695 [[../../subpage/]]
14696
14697 [[../../subpage]]
14698 !! html/php
14699 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14700 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14701 </p>
14702 !! html/parsoid
14703 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14704 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14705 !! end
14706
14707 !! test
14708 Parsoid: dot-slash prefixed wikilinks
14709 !! wikitext
14710 [[./foo]]
14711
14712 [[././bar]]
14713
14714 [[././baz/]]
14715 !! html/php
14716 <p>[[./foo]]
14717 </p><p>[[././bar]]
14718 </p><p>[[././baz/]]
14719 </p>
14720 !! html/parsoid
14721 <p>[[./foo]]
14722 </p><p>[[././bar]]
14723 </p><p>[[././baz/]]
14724 </p>
14725 !! end
14726
14727 !! test
14728 Render invalid page names as plain text (bug 51090)
14729 !! wikitext
14730 [[./../foo|bar]]
14731 [[foo�|bar]]
14732 [[foo/.|bar]]
14733 [[foo/..|bar]]
14734 [[foo~~~bar]]
14735 [[foo>bar]]
14736 [[foo[bar]]
14737 [[.]]
14738 [[..]]
14739 [[foo././bar]]
14740
14741 [[{{echo|./../foo}}|bar]]
14742 [[{{echo|foo/.}}|bar]]
14743 [[{{echo|foo/..}}|bar]]
14744 [[{{echo|foo~~~~bar}}]]
14745 [[{{echo|foo>bar}}]]
14746 [[{{echo|foo././bar}}]]
14747 [[{{echo|foo{bar}}]]
14748 [[{{echo|foo}bar}}]]
14749 [[{{echo|foo[bar}}]]
14750 [[{{echo|foo]bar}}]]
14751 [[{{echo|foo<bar}}]]
14752 !!html/php
14753 <p>[[./../foo|bar]]
14754 [[foo�|bar]]
14755 [[foo/.|bar]]
14756 [[foo/..|bar]]
14757 [[foo~~~bar]]
14758 [[foo&gt;bar]]
14759 [[foo[bar]]
14760 [[.]]
14761 [[..]]
14762 [[foo././bar]]
14763 </p><p>[[./../foo|bar]]
14764 [[foo/.|bar]]
14765 [[foo/..|bar]]
14766 [[foo~~~~bar]]
14767 [[foo&gt;bar]]
14768 [[foo././bar]]
14769 [[foo{bar]]
14770 [[foo}bar]]
14771 [[foo[bar]]
14772 [[foo]bar]]
14773 [[foo&lt;bar]]
14774 </p>
14775 !!html/parsoid
14776 <p>[[./../foo|bar]]
14777 [[foo�|bar]]
14778 [[foo/.|bar]]
14779 [[foo/..|bar]]
14780 [[foo~~~bar]]
14781 [[foo>bar]]
14782 [[foo[bar]]
14783 [[.]]
14784 [[..]]
14785 [[foo././bar]]</p>
14786
14787 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14788 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14789 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14790 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14791 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14792 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14793 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14794 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14795 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14796 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14797 [[<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>
14798 !!end
14799
14800 !! test
14801 Disabled subpages
14802 !! wikitext
14803 [[/subpage]]
14804 !! html
14805 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14806 </p>
14807 !! end
14808
14809 !! test
14810 BUG 561: {{/Subpage}}
14811 !! options
14812 subpage title=[[Page]]
14813 !! wikitext
14814 {{/Subpage}}
14815 !! html
14816 <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>
14817 </p>
14818 !! end
14819
14820 ###
14821 ### Categories
14822 ###
14823 !! article
14824 Category:MediaWiki User's Guide
14825 !! text
14826 blah
14827 !! endarticle
14828
14829 !! test
14830 Link to category
14831 !! wikitext
14832 [[:Category:MediaWiki User's Guide]]
14833 !! html
14834 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14835 </p>
14836 !! end
14837
14838 !! test
14839 Simple category
14840 !! options
14841 cat
14842 !! wikitext
14843 [[Category:MediaWiki User's Guide]]
14844 !! html/php
14845 cat=MediaWiki_User's_Guide sort=
14846 !! html/parsoid
14847 <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"}}'/>
14848 !! end
14849
14850 !! test
14851 PAGESINCATEGORY invalid title fatal (r33546 fix)
14852 !! wikitext
14853 {{PAGESINCATEGORY:<bogus>}}
14854 !! html
14855 <p>0
14856 </p>
14857 !! end
14858
14859 !! test
14860 Category with different sort key
14861 !! options
14862 cat
14863 !! wikitext
14864 [[Category:MediaWiki User's Guide|Foo]]
14865 !! html/php
14866 cat=MediaWiki_User's_Guide sort=Foo
14867 !! html/parsoid
14868 <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"}}'/>
14869 !! end
14870
14871 !! test
14872 Category with identical sort key
14873 !! options
14874 cat
14875 !! wikitext
14876 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14877 !! html/php
14878 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
14879 !! html/parsoid
14880 <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"}}'/>
14881 !! end
14882
14883 !! test
14884 Category with empty sort key
14885 !! options
14886 cat
14887 pst
14888 !! wikitext
14889 [[Category:MediaWiki User's Guide|]]
14890 !! html/php
14891 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14892 !! end
14893
14894 !! test
14895 Category with empty sort key and parentheses
14896 !! options
14897 cat
14898 pst
14899 !! wikitext
14900 [[Category:Foo (bar)|]]
14901 !! html/php
14902 [[Category:Foo (bar)|Foo]]
14903 !! end
14904
14905 !! test
14906 Category with link tail
14907 !! options
14908 cat
14909 pst
14910 !! wikitext
14911 123[[Category:Foo]]456
14912 !! html/php
14913 123[[Category:Foo]]456
14914 !! end
14915
14916 !! test
14917 Category with template
14918 !! options
14919 cat
14920 pst
14921 !! wikitext
14922 [[Category:{{echo|Foo}}]]
14923 !! html/php
14924 [[Category:{{echo|Foo}}]]
14925 !! end
14926
14927 !! test
14928 Category with template in sort key
14929 !! options
14930 cat
14931 pst
14932 !! wikitext
14933 [[Category:Foo|{{echo|Bar}}]]
14934 !! html/php
14935 [[Category:Foo|{{echo|Bar}}]]
14936 !! end
14937
14938 !! test
14939 Category with template in sort key and title
14940 !! options
14941 cat
14942 pst
14943 !! wikitext
14944 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14945 !! html/php
14946 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14947 !! end
14948
14949 ## We used to, but no longer wt2wt this test since the default serializer
14950 ## will normalize all categories to serialize on their own line.
14951 ## This wikitext usage is going to be fairly uncommon in production and
14952 ## selser will take care of preserving formatting in those scenarios.
14953 !! test
14954 Category / paragraph interactions
14955 !! options
14956 parsoid=wt2html
14957 !! wikitext
14958 Foo [[Category:Baz]] Bar
14959
14960 Foo [[Category:Baz]]
14961 Bar
14962
14963 Foo
14964 [[Category:Baz]]
14965 Bar
14966
14967 Foo
14968 [[Category:Baz]] Bar
14969
14970 Foo
14971 [[Category:Baz]]
14972 [[Category:Baz]]
14973 [[Category:Baz]]
14974 Bar
14975
14976 [[Category:Baz]]
14977 [[Category:Baz]]
14978 [[Category:Baz]]
14979
14980 [[Category:Baz]]
14981 {{echo|[[Category:Baz]]}}
14982 [[Category:Baz]]
14983 !! html/php
14984 <p>Foo Bar
14985 </p><p>Foo
14986 Bar
14987 </p><p>Foo
14988 Bar
14989 </p><p>Foo Bar
14990 </p><p>Foo
14991 Bar
14992 </p>
14993 !! html/parsoid
14994 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14995 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14996 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14997 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14998 <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>
14999 <link rel="mw:PageProp/Category" href="Category:Baz"/>
15000 !! end
15001
15002 ## We used to, but no longer wt2wt this test since the default serializer
15003 ## will normalize all categories to serialize on their own line.
15004 ## This wikitext usage is going to be fairly uncommon in production and
15005 ## selser will take care of preserving formatting in those scenarios.
15006 ##
15007 ## The whitespace on the empty line is part of the test. Please do not delete
15008 !! test
15009 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
15010 !! options
15011 parsoid=wt2html
15012 !! wikitext
15013 This
15014
15015 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15016
15017 {{echo|[[Category:Foo]] and so should this!}}
15018 !! html/php
15019 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15020 </p>
15021 !! html/parsoid
15022 <p>This
15023
15024 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15025
15026 <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>
15027 !! end
15028
15029 ## Parsoid will not try to wt2wt this while preserving newlines because
15030 ## it suppresses excess newlines within list items -- and we don't want to
15031 ## introduce a special case just for categories, which is, in reality somewhat
15032 ## odd behavior -- categories are unlikely to be used in list items like this
15033 ## in top-level pages and are only likely to show up in template-generated
15034 ## list items where this RT-ing is a non-issue.
15035 ##
15036 ## The whitespace on the empty line is part of the test. Please do not delete
15037 !! test
15038 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
15039 !! options
15040 parsoid=wt2html
15041 !! wikitext
15042 * This
15043
15044 [[Category:Foo]] and this should be part of the same list item
15045 * So should this
15046
15047 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15048 !! html
15049 <ul><li>This and this should be part of the same list item</li>
15050 <li>So should this and this should be part of the same list item</li></ul>
15051 !! html/parsoid
15052 <ul>
15053 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15054 <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>
15055 </ul>
15056 !! end
15057
15058 ## Newlines and categories that follow the last item of a list
15059 ## are treated differently because this (list followed by categories)
15060 ## is an extremely common pattern on wikis.
15061 !! test
15062 3. Categories and newlines: newline suppression for last list item should RT properly
15063 !! wikitext
15064 * a
15065 * b
15066
15067 [[Category:Foo]]
15068
15069 [[Category:Bar]]
15070 [[Category:Baz]]
15071 !! html/parsoid
15072 <ul><li> a</li>
15073 <li> b</li></ul>
15074
15075 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15076
15077 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15078 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15079 !! end
15080
15081 !! test
15082 4. Categories and newlines: newline suppression for last list item should RT properly
15083 !! wikitext
15084 * a
15085 **** b
15086
15087 [[Category:Foo]]
15088 !! html/parsoid
15089 <ul><li> a
15090 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15091
15092 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15093 !! end
15094
15095 ## only wt2html for this to make sure the algo only applies to the rightmost path
15096 !! test
15097 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15098 !! options
15099 parsoid=wt2html
15100 !! wikitext
15101 * a
15102 ** b
15103 [[Category:Foo]]
15104 * c
15105 ** d
15106 [[Category:Foo]]
15107 !! html/parsoid
15108 <ul><li> a
15109 <ul><li> b
15110 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15111 <li> c
15112 <ul><li> d</li></ul></li></ul>
15113 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15114 !! end
15115
15116 ## We used to, but no longer wt2wt this test since the default serializer
15117 ## will normalize all categories to serialize on their own line.
15118 ## This wikitext usage is going to be fairly uncommon in production and
15119 ## selser will take care of preserving formatting in those scenarios.
15120 !! test
15121 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15122 !! options
15123 parsoid=wt2html
15124 !! wikitext
15125 * a [[Category:Foo]]
15126 !! html/parsoid
15127 <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>
15128 !! end
15129
15130 # This test also demonstrates because of newline+category tunneling
15131 # through the list hander, template wrapping doesn't expand to the
15132 # containing list when the list item swallows the category.
15133 !! test
15134 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15135 !! wikitext
15136 * {{echo|a
15137 [[Category:Foo]]}}
15138 !! html/parsoid
15139 <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
15140 </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>
15141 !! end
15142
15143 !! test
15144 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15145 !! wikitext
15146 * a
15147
15148 {{echo|[[Category:Foo]]
15149 [[Category:Bar]]}}
15150 [[Category:Baz]]
15151 !! html/parsoid
15152 <ul><li> a</li></ul>
15153
15154 <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">
15155 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15156 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15157 !! end
15158
15159 !! test
15160 Category links with multiple namespaces
15161 !! wikitext
15162 [[Category:Project:Foo]]
15163 !! html/parsoid
15164 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15165 !! end
15166
15167 !! test
15168 Parsoid: Serialize link to category page with colon escape
15169 !! options
15170 parsoid
15171 !! wikitext
15172
15173 [[:Category:Foo]]
15174 [[:Category:Foo|Bar]]
15175 !! html
15176 <p>
15177 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15178 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15179 </p>
15180 !! end
15181
15182 # We used to, but no longer wt2wt this test since the default serializer
15183 # will normalize all categories to serialize on their own line.
15184 # This wikitext usage is going to be fairly uncommon in production and
15185 # selser will take care of preventing whitespace insertion if this
15186 # occurs in an article.
15187 #
15188 # html2html disabled for the same reason (whitespace insertion between
15189 # x and y).
15190 #
15191 # html2wt disabled because it localizes the "Category" namespace.
15192 !! test
15193 Link prefix/suffixes aren't applied to category links
15194 !! options
15195 parsoid=wt2html
15196 language=is
15197 !! wikitext
15198 x[[Category:Foo]]y
15199 !! html/php
15200 <p>xy
15201 </p>
15202 !! html/parsoid
15203 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15204 !! end
15205
15206 !! test
15207 Parsoid: Serialize link to file page with colon escape
15208 !! options
15209 parsoid
15210 !! wikitext
15211
15212 [[:File:Foo.png]]
15213 [[:File:Foo.png|Bar]]
15214 !! html
15215 <p>
15216 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15217 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15218 </p>
15219 !! end
15220
15221 !! test
15222 Parsoid: Serialize a genuine category link without colon escape
15223 !! options
15224 parsoid
15225 !! wikitext
15226 [[Category:Foo]]
15227 [[Category:Foo|Bar]]
15228 !! html
15229 <link rel="mw:PageProp/Category" href="./Category:Foo">
15230 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15231 !! end
15232
15233 !! test
15234 Normalize hrefs properly before testing for invalid link targets (bug 70894)
15235 !! options
15236 parsoid=html2wt
15237 !! html/parsoid
15238 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15239 !! wikitext
15240 [[Category:Toxine bactérienne]]
15241 !! end
15242
15243 !! test
15244 Parsoid: Defaultsort
15245 !! wikitext
15246 {{DEFAULTSORT:Foo}}
15247 !! html/parsoid
15248 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15249 !! end
15250
15251 !! test
15252 Parsoid: Defaultsort (template-generated)
15253 !! wikitext
15254 {{{{echo|DEFAULTSORT}}:Foo}}
15255 !! html/parsoid
15256 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DEFAULTSORT}}:Foo"},"params":{},"i":0}}]}'/>
15257 !! end
15258
15259 ###
15260 ### Inter-language links
15261 ###
15262 !! test
15263 Interlanguage links
15264 !! options
15265 ill
15266 !! wikitext
15267 [[es:Alimento]]
15268 [[fr:Nourriture]]
15269 [[zh:食品]]
15270 !! html/php
15271 es:Alimento fr:Nourriture zh:食品
15272 !! html/parsoid
15273 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15274 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15275 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15276 !! end
15277
15278 !! test
15279 Duplicate interlanguage links (bug 24502)
15280 !! options
15281 ill
15282 !! wikitext
15283 [[es:1]]
15284 [[es:2]]
15285 [[fr:1]]
15286 [[fr:2]]
15287 !! html/php
15288 es:1 fr:1
15289 !! html/parsoid
15290 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15291 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15292 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15293 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15294 !! end
15295
15296 ###
15297 ### Sections
15298 ###
15299 !! test
15300 Basic section headings
15301 !! wikitext
15302 == Headline 1 ==
15303 Some text
15304
15305 ==Headline 2==
15306 More
15307 ===Smaller headline===
15308 Blah blah
15309 !! html
15310 <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>
15311 <p>Some text
15312 </p>
15313 <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>
15314 <p>More
15315 </p>
15316 <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>
15317 <p>Blah blah
15318 </p>
15319 !! end
15320
15321 !! test
15322 Section headings with TOC
15323 !! wikitext
15324 == Headline 1 ==
15325 === Subheadline 1 ===
15326 ===== Skipping a level =====
15327 ====== Skipping a level ======
15328
15329 == Headline 2 ==
15330 Some text
15331 ===Another headline===
15332 !! html
15333 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15334 <ul>
15335 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15336 <ul>
15337 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15338 <ul>
15339 <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>
15340 <ul>
15341 <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>
15342 </ul>
15343 </li>
15344 </ul>
15345 </li>
15346 </ul>
15347 </li>
15348 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15349 <ul>
15350 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15351 </ul>
15352 </li>
15353 </ul>
15354 </div>
15355
15356 <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>
15357 <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>
15358 <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>
15359 <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>
15360 <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>
15361 <p>Some text
15362 </p>
15363 <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>
15364
15365 !! end
15366
15367 !! test
15368 TOC anchors don't collide
15369 !! wikitext
15370 __FORCETOC__
15371 == Headline 2 ==
15372 == Headline ==
15373 == Headline 2 ==
15374 == Headline ==
15375 !! html/php
15376 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15377 <ul>
15378 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15379 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15380 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15381 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15382 </ul>
15383 </div>
15384
15385 <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>
15386 <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>
15387 <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>
15388 <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>
15389
15390 !! end
15391
15392 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15393 !! test
15394 Handling of sections up to level 6 and beyond
15395 !! wikitext
15396 = Level 1 Heading=
15397 == Level 2 Heading==
15398 === Level 3 Heading===
15399 ==== Level 4 Heading====
15400 ===== Level 5 Heading=====
15401 ====== Level 6 Heading======
15402 ======= Level 7 Heading=======
15403 ======== Level 8 Heading========
15404 ========= Level 9 Heading=========
15405 ========== Level 10 Heading==========
15406 !! html
15407 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15408 <ul>
15409 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15410 <ul>
15411 <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>
15412 <ul>
15413 <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>
15414 <ul>
15415 <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>
15416 <ul>
15417 <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>
15418 <ul>
15419 <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>
15420 <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>
15421 <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>
15422 <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>
15423 <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>
15424 </ul>
15425 </li>
15426 </ul>
15427 </li>
15428 </ul>
15429 </li>
15430 </ul>
15431 </li>
15432 </ul>
15433 </li>
15434 </ul>
15435 </div>
15436
15437 <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>
15438 <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>
15439 <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>
15440 <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>
15441 <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>
15442 <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>
15443 <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>
15444 <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>
15445 <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>
15446 <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>
15447
15448 !! end
15449
15450 !! test
15451 TOC regression (T11764)
15452 !! wikitext
15453 == title 1 ==
15454 === title 1.1 ===
15455 ==== title 1.1.1 ====
15456 === title 1.2 ===
15457 == title 2 ==
15458 === title 2.1 ===
15459 !! html
15460 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15461 <ul>
15462 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15463 <ul>
15464 <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>
15465 <ul>
15466 <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>
15467 </ul>
15468 </li>
15469 <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>
15470 </ul>
15471 </li>
15472 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15473 <ul>
15474 <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>
15475 </ul>
15476 </li>
15477 </ul>
15478 </div>
15479
15480 <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>
15481 <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>
15482 <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>
15483 <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>
15484 <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>
15485 <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>
15486
15487 !! end
15488
15489 !! test
15490 TOC for heading containing <span id="..."></span> (T96153)
15491 !! wikitext
15492 __FORCETOC__
15493 ==<span id="old-anchor"></span>New title==
15494 !! html/php
15495 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15496 <ul>
15497 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15498 </ul>
15499 </div>
15500
15501 <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>
15502
15503 !! end
15504
15505 !! test
15506 TOC with wgMaxTocLevel=3 (bug 6204)
15507 !! options
15508 wgMaxTocLevel=3
15509 !! wikitext
15510 == title 1 ==
15511 === title 1.1 ===
15512 ==== title 1.1.1 ====
15513 === title 1.2 ===
15514 == title 2 ==
15515 === title 2.1 ===
15516 !! html
15517 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15518 <ul>
15519 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15520 <ul>
15521 <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>
15522 <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>
15523 </ul>
15524 </li>
15525 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15526 <ul>
15527 <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>
15528 </ul>
15529 </li>
15530 </ul>
15531 </div>
15532
15533 <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>
15534 <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>
15535 <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>
15536 <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>
15537 <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>
15538 <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>
15539
15540 !! end
15541
15542 !! test
15543 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15544 !! options
15545 wgMaxTocLevel=3
15546 !! wikitext
15547 ==Section 1==
15548 ===Section 1.1===
15549 ====Section 1.1.1====
15550 ====Section 1.1.1.1====
15551 ==Section 2==
15552 !! html
15553 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15554 <ul>
15555 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15556 <ul>
15557 <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>
15558 </ul>
15559 </li>
15560 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15561 </ul>
15562 </div>
15563
15564 <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>
15565 <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>
15566 <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>
15567 <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>
15568 <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>
15569
15570 !! end
15571
15572
15573 !! test
15574 Resolving duplicate section names
15575 !! wikitext
15576 == Foo bar ==
15577 == Foo bar ==
15578 !! html
15579 <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>
15580 <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>
15581
15582 !! end
15583
15584 !! test
15585 Resolving duplicate section names with differing case (bug 10721)
15586 !! wikitext
15587 == Foo bar ==
15588 == Foo Bar ==
15589 !! html
15590 <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>
15591 <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>
15592
15593 !! end
15594
15595 !! article
15596 Template:sections
15597 !! text
15598 ===Section 1===
15599 ==Section 2==
15600 !! endarticle
15601
15602 !! test
15603 Template with sections, __NOTOC__
15604 !! wikitext
15605 __NOTOC__
15606 ==Section 0==
15607 {{sections}}
15608 ==Section 4==
15609 !! html
15610 <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>
15611 <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>
15612 <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>
15613 <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>
15614
15615 !! end
15616
15617 !! test
15618 __NOEDITSECTION__ keyword
15619 !! wikitext
15620 __NOEDITSECTION__
15621 ==Section 1==
15622 ==Section 2==
15623 !! html
15624 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15625 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15626
15627 !! end
15628
15629 !! test
15630 Link inside a section heading
15631 !! wikitext
15632 ==Section with a [[Main Page|link]] in it==
15633 !! html
15634 <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>
15635
15636 !! end
15637
15638 !! test
15639 TOC regression (T14077)
15640 !! wikitext
15641 __TOC__
15642 == title 1 ==
15643 === title 1.1 ===
15644 == title 2 ==
15645 !! html
15646 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15647 <ul>
15648 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15649 <ul>
15650 <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>
15651 </ul>
15652 </li>
15653 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15654 </ul>
15655 </div>
15656
15657 <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>
15658 <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>
15659 <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>
15660
15661 !! end
15662
15663 !! test
15664 BUG 1219 URL next to image (good)
15665 !! wikitext
15666 http://example.com [[File:Foobar.jpg]]
15667 !! html/php
15668 <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>
15669 </p>
15670 !! html/parsoid
15671 <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>
15672 !!end
15673
15674 !! test
15675 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15676 !! wikitext
15677 ===
15678 The line above must have a trailing space!
15679 === <!--
15680 --> <!-- -->
15681 But just in case it doesn't...
15682 !! html
15683 <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>
15684 <p>The line above must have a trailing space!
15685 </p>
15686 <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>
15687 <p>But just in case it doesn't...
15688 </p>
15689 !! end
15690
15691 !! test
15692 Header with special characters (bug 25462)
15693 !! wikitext
15694 The tooltips shall not show entities to the user (ie. be double escaped)
15695
15696 == text > text ==
15697 section 1
15698
15699 == text < text ==
15700 section 2
15701
15702 == text & text ==
15703 section 3
15704
15705 == text ' text ==
15706 section 4
15707
15708 == text " text ==
15709 section 5
15710 !! html
15711 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15712 </p>
15713 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15714 <ul>
15715 <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>
15716 <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>
15717 <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>
15718 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15719 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15720 </ul>
15721 </div>
15722
15723 <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>
15724 <p>section 1
15725 </p>
15726 <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>
15727 <p>section 2
15728 </p>
15729 <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>
15730 <p>section 3
15731 </p>
15732 <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>
15733 <p>section 4
15734 </p>
15735 <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>
15736 <p>section 5
15737 </p>
15738 !! end
15739
15740 !! test
15741 Header with space, plus and underscore as entity
15742 !! wikitext
15743 Id should not contain + for spaces
15744
15745 == Space between Text ==
15746 section 1
15747
15748 == Space-Entity&#32;between&#32;Text ==
15749 section 2
15750
15751 == Plus+between+Text ==
15752 section 3
15753
15754 == Plus-Entity&#43;between&#43;Text ==
15755 section 4
15756
15757 == Underscore_between_Text ==
15758 section 5
15759
15760 == Underscore-Entity&#95;between&#95;Text ==
15761 section 6
15762
15763 [[#Space between Text]]
15764 [[#Space-Entity&#32;between&#32;Text]]
15765 [[#Plus+between+Text]]
15766 [[#Plus-Entity&#43;between&#43;Text]]
15767 [[#Underscore_between_Text]]
15768 [[#Underscore-Entity&#95;between&#95;Text]]
15769 !! html
15770 <p>Id should not contain + for spaces
15771 </p>
15772 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15773 <ul>
15774 <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>
15775 <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>
15776 <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>
15777 <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>
15778 <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>
15779 <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>
15780 </ul>
15781 </div>
15782
15783 <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>
15784 <p>section 1
15785 </p>
15786 <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>
15787 <p>section 2
15788 </p>
15789 <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>
15790 <p>section 3
15791 </p>
15792 <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>
15793 <p>section 4
15794 </p>
15795 <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>
15796 <p>section 5
15797 </p>
15798 <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>
15799 <p>section 6
15800 </p><p><a href="#Space_between_Text">#Space between Text</a>
15801 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15802 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15803 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15804 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15805 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15806 </p>
15807 !! end
15808
15809 !! test
15810 Headers with excess '=' characters
15811 (Are similar tests necessary beyond the 1st level?)
15812 !! wikitext
15813 =foo==
15814 ==foo=
15815 =''italic'' heading==
15816 ==''italic'' heading=
15817 !! html
15818 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15819 <ul>
15820 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15821 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15822 <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>
15823 <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>
15824 </ul>
15825 </div>
15826
15827 <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>
15828 <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>
15829 <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>
15830 <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>
15831
15832 !! end
15833
15834 !! test
15835 HTML headers vs TOC (bug 23393)
15836 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15837 !! wikitext
15838 <h1>Header 1</h1>
15839 == Header 1.1 ==
15840 == Header 1.2 ==
15841
15842 <h1>Header 2
15843 </h1>
15844 == Header 2.1 ==
15845 == Header 2.2 ==
15846 __NOEDITSECTION__
15847 !! html
15848 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15849 <ul>
15850 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15851 <ul>
15852 <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>
15853 <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>
15854 </ul>
15855 </li>
15856 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15857 <ul>
15858 <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>
15859 <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>
15860 </ul>
15861 </li>
15862 </ul>
15863 </div>
15864
15865 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15866 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15867 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15868 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15869 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15870 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15871
15872 !! end
15873
15874 !! test
15875 Single-line or multiline-comments can follow headings
15876 !! options
15877 parsoid=wt2html,wt2wt
15878 !! wikitext
15879 ==foo==<!---->
15880 ==bar==<!--c1-->
15881 ==baz==<!--
15882 c2
15883 c3-->
15884 !! html
15885 <h2><span class="mw-headline" id="foo">foo</span></h2>
15886 <h2><span class="mw-headline" id="bar">bar</span></h2>
15887 <h2><span class="mw-headline" id="baz">baz</span></h2>
15888
15889 !! end
15890
15891 !! test
15892 BUG 1219 URL next to image (broken)
15893 !! wikitext
15894 http://example.com[[File:Foobar.jpg]]
15895 !! html/php
15896 <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>
15897 </p>
15898 !! html/parsoid
15899 <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>
15900 !!end
15901
15902 !! test
15903 Bug 1186 news: in the middle of text
15904 !! wikitext
15905 http://en.wikinews.org/wiki/Wikinews:Workplace
15906 !! html
15907 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15908 </p>
15909 !!end
15910
15911
15912 !! test
15913 Namespaced link must have a title
15914 !! wikitext
15915 [[Project:]]
15916 !! html
15917 <p>[[Project:]]
15918 </p>
15919 !!end
15920
15921 !! test
15922 Namespaced link must have a title (bad fragment version)
15923 !! wikitext
15924 [[Project:#fragment]]
15925 !! html
15926 <p>[[Project:#fragment]]
15927 </p>
15928 !!end
15929
15930
15931 ###
15932 ### HTML tags and HTML attributes
15933 ###
15934
15935 !! test
15936 div with no attributes
15937 !! wikitext
15938 <div>HTML rocks</div>
15939 !! html
15940 <div>HTML rocks</div>
15941
15942 !! end
15943
15944 !! test
15945 div with double-quoted attribute
15946 !! wikitext
15947 <div id="rock">HTML rocks</div>
15948 !! html
15949 <div id="rock">HTML rocks</div>
15950
15951 !! end
15952
15953 !! test
15954 div with single-quoted attribute
15955 !! wikitext
15956 <div id='rock'>HTML rocks</div>
15957 !! html
15958 <div id="rock">HTML rocks</div>
15959
15960 !! end
15961
15962 !! test
15963 div with unquoted attribute
15964 !! wikitext
15965 <div id=rock>HTML rocks</div>
15966 !! html
15967 <div id="rock">HTML rocks</div>
15968
15969 !! end
15970
15971 !! test
15972 div with illegal double attributes
15973 !! wikitext
15974 <div id="a" id="b">HTML rocks</div>
15975 !! html
15976 <div id="b">HTML rocks</div>
15977
15978 !!end
15979
15980 !! test
15981 div with empty attribute value, space before equals
15982 !! options
15983 parsoid=wt2html,html2html
15984 !! wikitext
15985 <div class =>HTML rocks</div>
15986 !! html/php
15987 <div class="">HTML rocks</div>
15988
15989 !! html/parsoid
15990 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15991 !! end
15992
15993 !! test
15994 div with multiple empty attribute values
15995 !! options
15996 parsoid=wt2html,html2html
15997 !! wikitext
15998 <div id= title=>HTML rocks</div>
15999 !! html/php
16000 <div id="title.3D">HTML rocks</div>
16001
16002 !! html/parsoid
16003 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16004 !! end
16005
16006 !! test
16007 table with multiple empty attribute values
16008 !! options
16009 parsoid=wt2html,html2html
16010 !! wikitext
16011 {| title= id=
16012 | hi
16013 |}
16014 !! html/php
16015 <table title="id=">
16016 <tr>
16017 <td> hi
16018 </td></tr></table>
16019
16020 !! html/parsoid
16021 <table title="id=">
16022 <tbody><tr><td> hi</td></tr>
16023 </tbody></table>
16024 !! end
16025
16026 !! test
16027 div with braces in attribute value
16028 !! wikitext
16029 <div title="{}">Foo</div>
16030 !! html/php
16031 <div title="&#123;}">Foo</div>
16032
16033 !! html/parsoid
16034 <div title="{}">Foo</div>
16035 !! end
16036
16037 !! test
16038 div with empty attribute value, no space before equals
16039 !! options
16040 parsoid=wt2html,html2html
16041 !! wikitext
16042 <div class=>HTML rocks</div>
16043 !! html/php
16044 <div class="">HTML rocks</div>
16045
16046 !! html/parsoid
16047 <div class="">HTML rocks</div>
16048 !! end
16049
16050 !! test
16051 HTML multiple attributes correction
16052 !! wikitext
16053 <p class="error" class="awesome">Awesome!</p>
16054 !! html
16055 <p class="awesome">Awesome!</p>
16056
16057 !!end
16058
16059 !! test
16060 Table multiple attributes correction
16061 !! wikitext
16062 {|
16063 !+ class="error" class="awesome"| status
16064 |}
16065 !! html
16066 <table>
16067 <tr>
16068 <th class="awesome"> status
16069 </th></tr></table>
16070
16071 !!end
16072
16073 !! test
16074 DIV IN UPPERCASE
16075 !! wikitext
16076 <DIV ID="x">HTML ROCKS</DIV>
16077 !! html
16078 <div id="x">HTML ROCKS</div>
16079
16080 !!end
16081
16082 !! test
16083 Non-ASCII pseudo-tags are rendered as text
16084 !! wikitext
16085 <khyô>
16086 !! html
16087 <p>&lt;khyô&gt;
16088 </p>
16089 !! end
16090
16091 !! test
16092 Pseudo-tag with URL 'name' renders as url link
16093 !! wikitext
16094 <http://example.com/>
16095 !! html
16096 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16097 </p>
16098 !! end
16099
16100 !! test
16101 text with amp in the middle of nowhere
16102 !! wikitext
16103 Remember AT&T?
16104 !! html
16105 <p>Remember AT&amp;T?
16106 </p>
16107 !! end
16108
16109 !! test
16110 text with character entity: eacute
16111 !! wikitext
16112 I always thought &eacute; was a cute letter.
16113 !! html
16114 <p>I always thought &#233; was a cute letter.
16115 </p>
16116 !! html+tidy
16117 <p>I always thought é was a cute letter.</p>
16118 !! end
16119
16120 !! test
16121 text with entity-escaped character entity-like string: eacute
16122 !! wikitext
16123 I always thought &amp;eacute; was a cute letter.
16124 !! html
16125 <p>I always thought &amp;eacute; was a cute letter.
16126 </p>
16127 !! end
16128
16129 !! test
16130 text with undefined character entity: xacute
16131 !! wikitext
16132 I always thought &xacute; was a cute letter.
16133 !! html
16134 <p>I always thought &amp;xacute; was a cute letter.
16135 </p>
16136 !! end
16137
16138 !! test
16139 HTML5 tags
16140 !! wikitext
16141 <data value="5">five</data>
16142 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16143 <mark>This highlighted text</mark>
16144 !! html
16145 <p><data value="5">five</data>
16146 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16147 <mark>This highlighted text</mark>
16148 </p>
16149 !! end
16150
16151 !! test
16152 HTML tag with leading space is parsed as text
16153 !! wikitext
16154 < div>foo< /div>
16155 !! html
16156 <p>&lt; div&gt;foo&lt; /div&gt;
16157 </p>
16158 !! end
16159
16160 ###
16161 ### Nesting tests (see bug 41545, 50604, 51081)
16162 ###
16163
16164 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
16165 # Note that html2wt is considerably more difficult if we use <b> in
16166 # the test case, instead of <big>
16167 !! test
16168 Ensure that HTML adoption agency algorithm is properly implemented.
16169 !! wikitext
16170 <big>X<big>Y</big>Z</big>
16171 !! html
16172 <p><big>X<big>Y</big>Z</big>
16173 </p>
16174 !! end
16175
16176 # This was bug 41545 in the PHP parser.
16177 # Note that tidy doesn't handle this correctly.
16178 !! test
16179 Nesting of <kbd>
16180 !! wikitext
16181 <kbd>X<kbd>Y</kbd>Z</kbd>
16182 !! html
16183 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16184 </p>
16185 !! end
16186
16187 # The following cases were bug 51081 in the PHP parser.
16188 # Note that there are some other nestable tags (b, i, etc) which are
16189 # not covered; see bug 51081 for discussion.
16190
16191 # Note that tidy doesn't handle this correctly.
16192 !! test
16193 Nesting of <em>
16194 !! wikitext
16195 <em>X<em>Y</em>Z</em>
16196 !! html
16197 <p><em>X<em>Y</em>Z</em>
16198 </p>
16199 !! end
16200
16201 # Note that tidy doesn't handle this correctly.
16202 !! test
16203 Nesting of <strong>
16204 !! wikitext
16205 <strong>X<strong>Y</strong>Z</strong>
16206 !! html
16207 <p><strong>X<strong>Y</strong>Z</strong>
16208 </p>
16209 !! end
16210
16211 !! test
16212 Nesting of <q>
16213 !! wikitext
16214 <q>X<q>Y</q>Z</q>
16215 !! html+tidy
16216 <p><q>X<q>Y</q>Z</q></p>
16217 !! end
16218
16219 # Note that tidy doesn't handle this correctly.
16220 !! test
16221 Nesting of <ruby>
16222 !! wikitext
16223 <ruby>X<ruby>Y</ruby>Z</ruby>
16224 !! html
16225 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16226 </p>
16227 !! end
16228
16229 # Note that tidy doesn't handle this correctly.
16230 !! test
16231 Nesting of <bdo>
16232 !! wikitext
16233 <bdo>X<bdo>Y</bdo>Z</bdo>
16234 !! html
16235 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16236 </p>
16237 !! end
16238
16239
16240 ###
16241 ### Media links
16242 ###
16243
16244 !! test
16245 Media link
16246 !! wikitext
16247 [[Media:Foobar.jpg]]
16248 !! html
16249 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16250 </p>
16251 !! end
16252
16253 !! test
16254 Media link with text
16255 !! wikitext
16256 [[Media:Foobar.jpg|A neat file to look at]]
16257 !! html
16258 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16259 </p>
16260 !! end
16261
16262 # FIXME: this is still bad HTML tag nesting
16263 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16264 !! test
16265 Media link with nasty text
16266 !! wikitext
16267 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16268 !! html
16269 <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>
16270
16271 !! html+tidy
16272 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16273 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16274 !! end
16275
16276 !! test
16277 Media link to nonexistent file (bug 1702)
16278 !! wikitext
16279 [[Media:No such.jpg]]
16280 !! html
16281 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16282 </p>
16283 !! end
16284
16285 !! test
16286 Image link to nonexistent file (bug 1850 - good)
16287 !! wikitext
16288 [[File:No_such.jpg]]
16289 !! html/php
16290 <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>
16291 </p>
16292 !! html/parsoid
16293 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:No_such.jpg"><img resource="./File:No_such.jpg" src="./Special:FilePath/No_such.jpg" height="220" width="220"/></a></span></p>
16294 !! end
16295
16296 !! test
16297 :Image link to nonexistent file (bug 1850 - bad)
16298 !! wikitext
16299 [[:Image:No such.jpg]]
16300 !! html/php
16301 <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>
16302 </p>
16303 !! html/parsoid
16304 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16305 !! end
16306
16307
16308
16309 !! test
16310 Character reference normalization in link text (bug 1938)
16311 !! wikitext
16312 [[Main Page|this&that]]
16313 !! html
16314 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16315 </p>
16316 !!end
16317
16318 !! article
16319 אַ
16320 !! text
16321 Test for unicode normalization
16322
16323 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16324 !! endarticle
16325
16326 !! test
16327 (bug 19451) Links should refer to the normalized form.
16328 !! wikitext
16329 [[&#xFB2E;]]
16330 [[&#x5d0;&#x5b7;]]
16331 [[&#x5d0;ַ]]
16332 [[א&#x5b7;]]
16333 [[אַ]]
16334 !! html
16335 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16336 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16337 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16338 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16339 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16340 </p>
16341 !! end
16342
16343 !! test
16344 Empty attribute crash test (bug 2067)
16345 !! wikitext
16346 <font color="">foo</font>
16347 !! html
16348 <p><font color="">foo</font>
16349 </p>
16350 !! end
16351
16352 !! test
16353 Empty attribute crash test single-quotes (bug 2067)
16354 !! wikitext
16355 <font color=''>foo</font>
16356 !! html
16357 <p><font color="">foo</font>
16358 </p>
16359 !! end
16360
16361 !! test
16362 Attribute test: equals, then nothing
16363 !! options
16364 parsoid=wt2html,html2html
16365 !! wikitext
16366 <font color=>foo</font>
16367 !! html/php
16368 <p><font color="">foo</font>
16369 </p>
16370 !! html/parsoid
16371 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16372 !! end
16373
16374 !! test
16375 Attribute test: unquoted value
16376 !! options
16377 parsoid=wt2html,html2html
16378 !! wikitext
16379 <font color=x>foo</font>
16380 !! html/php
16381 <p><font color="x">foo</font>
16382 </p>
16383 !! html/parsoid
16384 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16385 !! end
16386
16387 !! test
16388 Attribute test: unquoted but illegal value (hash)
16389 !! wikitext
16390 <font color=#x>foo</font>
16391 !! html
16392 <p><font color="#x">foo</font>
16393 </p>
16394 !! end
16395
16396 # Parsoid does not serialize to empty attribute syntax,
16397 # so wt2wt and html2wt cases are skipped
16398 !! test
16399 Attribute test: no value (T54330)
16400 !! options
16401 parsoid=wt2html,html2html
16402 !! wikitext
16403 <font color>foo</font>
16404 !! html/php
16405 <p><font color="">foo</font>
16406 </p>
16407 !! html/parsoid
16408 <p><font color="">foo</font></p>
16409 !! end
16410
16411 !! test
16412 Bug 2095: link with three closing brackets
16413 !! wikitext
16414 [[Main Page]]]
16415 !! html/php
16416 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16417 </p>
16418 !! html/parsoid
16419 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16420 !! end
16421
16422 !! test
16423 Bug 2095: link with pipe and three closing brackets
16424 !! wikitext
16425 [[Main Page|link]]]
16426 !! html/php
16427 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16428 </p>
16429 !! html/parsoid
16430 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16431 !! end
16432
16433 !! test
16434 Bug 2095: link with pipe and three closing brackets, version 2
16435 !! wikitext
16436 [[Main Page|[http://example.com/]]]
16437 !! html/php
16438 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16439 </p>
16440 !! html/parsoid
16441 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16442 !! end
16443
16444
16445 ###
16446 ### Safety
16447 ###
16448
16449 !! article
16450 Template:Dangerous attribute
16451 !! text
16452 " onmouseover="alert(document.cookie)
16453 !! endarticle
16454
16455 !! article
16456 Template:Dangerous style attribute
16457 !! text
16458 border-size: expression(alert(document.cookie))
16459 !! endarticle
16460
16461 !! article
16462 Template:Div style
16463 !! text
16464 <div style="float: right; {{{1}}}">Magic div</div>
16465 !! endarticle
16466
16467 !! test
16468 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16469 !! wikitext
16470 <div title="{{test}}"></div>
16471 !! html
16472 <div title="This is a test template"></div>
16473
16474 !! end
16475
16476 # Parsoid has enough context to handle this case
16477 !! test
16478 Bug 2304: HTML attribute safety (dangerous template; 2309)
16479 !! wikitext
16480 <div title="{{dangerous attribute}}"></div>
16481 !! html/php
16482 <div title=""></div>
16483
16484 !! html/parsoid
16485 <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>
16486 !! end
16487
16488 !! test
16489 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16490 !! wikitext
16491 <div style="{{dangerous style attribute}}"></div>
16492 !! html
16493 <div style="/* insecure input */"></div>
16494
16495 !! end
16496
16497 !! test
16498 Bug 2304: HTML attribute safety (safe parameter; 2309)
16499 !! wikitext
16500 {{div style|width: 200px}}
16501 !! html
16502 <div style="float: right; width: 200px">Magic div</div>
16503
16504 !! end
16505
16506 !! test
16507 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16508 !! wikitext
16509 {{div style|width: expression(alert(document.cookie))}}
16510 !! html
16511 <div style="/* insecure input */">Magic div</div>
16512
16513 !! end
16514
16515 !! test
16516 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16517 !! wikitext
16518 {{div style|"><script>alert(document.cookie)</script>}}
16519 !! html
16520 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16521
16522 !! end
16523
16524 !! test
16525 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16526 !! wikitext
16527 {{div style|" ><script>alert(document.cookie)</script>}}
16528 !! html
16529 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16530
16531 !! end
16532
16533 !! test
16534 Bug 2304: HTML attribute safety (link)
16535 !! wikitext
16536 <div title="[[Main Page]]"></div>
16537 !! html
16538 <div title="&#91;&#91;Main Page]]"></div>
16539
16540 !! end
16541
16542 !! test
16543 Bug 2304: HTML attribute safety (italics)
16544 !! wikitext
16545 <div title="''foobar''"></div>
16546 !! html
16547 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16548
16549 !! end
16550
16551 !! test
16552 Bug 2304: HTML attribute safety (bold)
16553 !! wikitext
16554 <div title="'''foobar'''"></div>
16555 !! html
16556 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16557
16558 !! end
16559
16560
16561 !! test
16562 Bug 2304: HTML attribute safety (ISBN)
16563 !! wikitext
16564 <div title="ISBN 1234567890"></div>
16565 !! html
16566 <div title="&#73;SBN 1234567890"></div>
16567
16568 !! end
16569
16570 !! test
16571 Bug 2304: HTML attribute safety (RFC)
16572 !! wikitext
16573 <div title="RFC 1234"></div>
16574 !! html
16575 <div title="&#82;FC 1234"></div>
16576
16577 !! end
16578
16579 !! test
16580 Bug 2304: HTML attribute safety (PMID)
16581 !! wikitext
16582 <div title="PMID 1234567890"></div>
16583 !! html
16584 <div title="&#80;MID 1234567890"></div>
16585
16586 !! end
16587
16588 !! test
16589 Bug 2304: HTML attribute safety (web link)
16590 !! wikitext
16591 <div title="http://example.com/"></div>
16592 !! html
16593 <div title="http&#58;//example.com/"></div>
16594
16595 !! end
16596
16597 !! test
16598 Bug 2304: HTML attribute safety (named web link)
16599 !! wikitext
16600 <div title="[http://example.com/ link]"></div>
16601 !! html
16602 <div title="&#91;http&#58;//example.com/ link]"></div>
16603
16604 !! end
16605
16606 !! test
16607 Bug 3244: HTML attribute safety (extension; safe)
16608 !! wikitext
16609 <div style="<nowiki>background:blue</nowiki>"></div>
16610 !! html
16611 <div style="background:blue"></div>
16612
16613 !! end
16614
16615 !! test
16616 Bug 3244: HTML attribute safety (extension; unsafe)
16617 !! wikitext
16618 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16619 !! html
16620 <div style="/* insecure input */"></div>
16621
16622 !! end
16623
16624 # More MSIE fun discovered by Tom Gilder
16625
16626 !! test
16627 MSIE CSS safety test: spurious slash
16628 !! wikitext
16629 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16630 !! html
16631 <div style="/* insecure input */">evil</div>
16632
16633 !! end
16634
16635 !! test
16636 MSIE CSS safety test: hex code
16637 !! wikitext
16638 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16639 !! html
16640 <div style="/* insecure input */">evil</div>
16641
16642 !! end
16643
16644 !! test
16645 MSIE CSS safety test: comment in url
16646 !! wikitext
16647 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16648 !! html
16649 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16650
16651 !! end
16652
16653 !! test
16654 MSIE CSS safety test: comment in expression
16655 !! wikitext
16656 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16657 !! html
16658 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16659
16660 !! end
16661
16662 !! test
16663 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16664 !! wikitext
16665 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16666 !! html
16667 <p style="/* invalid control char */">A</p>
16668
16669 !! end
16670
16671 !! test
16672 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16673 !! wikitext
16674 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16675 <div style="top:EXPRESSION(alert())">B</div>
16676 !! html
16677 <p style="/* insecure input */">A</p>
16678 <div style="/* insecure input */">B</div>
16679
16680 !! end
16681
16682 !! test
16683 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16684 !! wikitext
16685 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16686 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16687 !! html
16688 <div style="/* insecure input */">A</div>
16689 <p style="/* insecure input */">B</p>
16690
16691 !! end
16692
16693 !! test
16694 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16695 !! wikitext
16696 <div style="background-image:url⁽javascript:alert())">A</div>
16697 <div style="background-image:url₍javascript:alert())">B</div>
16698 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16699 !! html
16700 <div style="/* insecure input */">A</div>
16701 <div style="/* insecure input */">B</div>
16702 <p style="/* insecure input */">C</p>
16703
16704 !! end
16705
16706 # FIXME: Parsoid fails to sanitize this! See T58846.
16707 !! test
16708 Opera -o-link CSS
16709 !! wikitext
16710 <div
16711 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;"
16712 style="-o-link:attr(title);-o-link-source:current">X</div>
16713 !! html
16714 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16715
16716 !! end
16717
16718 !! test
16719 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16720 !! wikitext
16721 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16722 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16723 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16724 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16725 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16726 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16727 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16728 !! html
16729 <p style="/* insecure input */">A</p>
16730 <p style="/* insecure input */">B</p>
16731 <p style="/* insecure input */">C</p>
16732 <p style="/* insecure input */">D</p>
16733 <p style="/* insecure input */">E</p>
16734 <p style="/* insecure input */">F</p>
16735 <p style="/* insecure input */">G</p>
16736
16737 !! end
16738
16739 !! test
16740 Table attribute legitimate extension
16741 !! wikitext
16742 {|
16743 !+ style="<nowiki>color:blue</nowiki>"| status
16744 |}
16745 !! html
16746 <table>
16747 <tr>
16748 <th style="color:blue"> status
16749 </th></tr></table>
16750
16751 !!end
16752
16753 !! test
16754 Table attribute safety
16755 !! wikitext
16756 {|
16757 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16758 |}
16759 !! html
16760 <table>
16761 <tr>
16762 <th style="/* insecure input */"> status
16763 </th></tr></table>
16764
16765 !! end
16766
16767 !! test
16768 CSS line continuation 1
16769 !! wikitext
16770 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16771 !! html
16772 <div style="/* insecure input */"></div>
16773
16774 !! end
16775
16776 !! test
16777 CSS line continuation 2
16778 !! wikitext
16779 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16780 !! html
16781 <div style="/* invalid control char */"></div>
16782
16783 !! end
16784
16785 !! article
16786 Template:Identity
16787 !! text
16788 {{{1}}}
16789 !! endarticle
16790
16791 !! test
16792 Expansion of multi-line templates in attribute values (bug 6255)
16793 !! wikitext
16794 <div style="background: {{identity|#00FF00}}">-</div>
16795 !! html
16796 <div style="background: #00FF00">-</div>
16797
16798 !! end
16799
16800
16801 !! test
16802 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16803 !! wikitext
16804 <div style="background:
16805 #00FF00">-</div>
16806 !! html/php
16807 <div style="background: #00FF00">-</div>
16808
16809 !! html/parsoid
16810 <div style="background:
16811 #00FF00">-</div>
16812 !! end
16813
16814 !! test
16815 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16816 !! wikitext
16817 <div style="background: &#10;#00FF00">-</div>
16818 !! html
16819 <div style="background: &#10;#00FF00">-</div>
16820
16821 !! end
16822
16823 !! test
16824 Tags which are hidden from Tidy cannot pass through the Sanitizer
16825 !! wikitext
16826 <mw:toc><script>alert();</script></mw:toc>
16827 !! html+tidy
16828 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
16829 !! end
16830
16831 ###
16832 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16833 ###
16834 !! test
16835 Parser hook: empty input
16836 !! wikitext
16837 <tag></tag>
16838 !! html/php
16839 <pre>
16840 ''
16841 array (
16842 )
16843 </pre>
16844
16845 !! html/parsoid
16846 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16847 !! end
16848
16849 ## Don't expect parsoid to rt this form.
16850 !! test
16851 Parser hook: empty input using terminated empty elements
16852 !! options
16853 parsoid=wt2html,html2html
16854 !! wikitext
16855 <tag/>
16856 !! html/php
16857 <pre>
16858 NULL
16859 array (
16860 )
16861 </pre>
16862
16863 !! html/parsoid
16864 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16865 !! end
16866
16867 !! test
16868 Parser hook: empty input using terminated empty elements (space before)
16869 !! wikitext
16870 <tag />
16871 !! html/php
16872 <pre>
16873 NULL
16874 array (
16875 )
16876 </pre>
16877
16878 !! html/parsoid
16879 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16880 !! end
16881
16882 !! test
16883 Parser hook: basic input
16884 !! wikitext
16885 <tag>input</tag>
16886 !! html/php
16887 <pre>
16888 'input'
16889 array (
16890 )
16891 </pre>
16892
16893 !! html/parsoid
16894 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16895 !! end
16896
16897 ## Don't expect parsoid to rt this form.
16898 !! test
16899 Parser hook: case insensitive
16900 !! options
16901 parsoid=wt2html,html2html
16902 !! wikitext
16903 <TAG>input</TAG>
16904 !! html/php
16905 <pre>
16906 'input'
16907 array (
16908 )
16909 </pre>
16910
16911 !! html/parsoid
16912 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16913 !! end
16914
16915 ## Don't expect parsoid to rt this form.
16916 !! test
16917 Parser hook: case insensitive, redux
16918 !! options
16919 parsoid=wt2html,html2html
16920 !! wikitext
16921 <TaG>input</TAg>
16922 !! html/php
16923 <pre>
16924 'input'
16925 array (
16926 )
16927 </pre>
16928
16929 !! html/parsoid
16930 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16931 !! end
16932
16933 !! test
16934 Parser hook: nested tags
16935 !! wikitext
16936 <tag><tag></tag></tag>
16937 !! html/php
16938 <pre>
16939 '<tag>'
16940 array (
16941 )
16942 </pre>&lt;/tag&gt;
16943
16944 !! html/parsoid
16945 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16946 !! end
16947
16948 !! test
16949 Parser hook: basic arguments
16950 !! wikitext
16951 <tag width="200" height="100" depth="50" square=""></tag>
16952 !! html/php
16953 <pre>
16954 ''
16955 array (
16956 'width' => '200',
16957 'height' => '100',
16958 'depth' => '50',
16959 'square' => '',
16960 )
16961 </pre>
16962
16963 !! html/parsoid
16964 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16965 !! end
16966
16967 ## Don't expect parsoid to rt this form.
16968 !! test
16969 Parser hook: basic arguments, variations
16970 !! options
16971 parsoid=wt2html,html2html
16972 !! wikitext
16973 <tag width=200 height = "100" depth = '50' square></tag>
16974 !! html/php
16975 <pre>
16976 ''
16977 array (
16978 'width' => '200',
16979 'height' => '100',
16980 'depth' => '50',
16981 'square' => '',
16982 )
16983 </pre>
16984
16985 !! html/parsoid
16986 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16987 !! end
16988
16989 !! test
16990 Parser hook: argument containing a forward slash (bug 5344)
16991 !! wikitext
16992 <tag filename="/tmp/bla"></tag>
16993 !! html/php
16994 <pre>
16995 ''
16996 array (
16997 'filename' => '/tmp/bla',
16998 )
16999 </pre>
17000
17001 !! html/parsoid
17002 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17003 !! end
17004
17005 ## Don't expect parsoid to rt this form.
17006 !! test
17007 Parser hook: empty input using terminated empty elements (bug 2374)
17008 !! options
17009 parsoid=wt2html,html2html
17010 !! wikitext
17011 <tag foo=bar/>text
17012 !! html/php
17013 <pre>
17014 NULL
17015 array (
17016 'foo' => 'bar',
17017 )
17018 </pre>text
17019
17020 !! html/parsoid
17021 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
17022 !! end
17023
17024 ## </tag> should be output literally since there is no matching tag that begins it
17025 ## Don't expect parsoid to rt this form.
17026 !! test
17027 Parser hook: basic arguments using terminated empty elements (bug 2374)
17028 !! options
17029 parsoid=wt2html
17030 !! wikitext
17031 <tag width=200 height = "100" depth = '50' square/>
17032 other stuff
17033 </tag>
17034 !! html/php
17035 <pre>
17036 NULL
17037 array (
17038 'width' => '200',
17039 'height' => '100',
17040 'depth' => '50',
17041 'square' => '',
17042 )
17043 </pre>
17044 <p>other stuff
17045 &lt;/tag&gt;
17046 </p>
17047 !! html/parsoid
17048 <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
17049 &lt;/tag></p>
17050 !! end
17051
17052 ## Don't expect parsoid to rt this form.
17053 !! test
17054 Parser hook: Don't allow unclosed extension tags
17055 !! options
17056 parsoid=wt2html
17057 !! wikitext
17058 test <tag>123
17059
17060 this is a '''test'''
17061 !! html/php
17062 <p>test &lt;tag&gt;123
17063 </p><p>this is a <b>test</b>
17064 </p>
17065 !! html/parsoid
17066 <p>test &lt;tag>123</p>
17067
17068 <p>this is a <b>test</b></p>
17069 !! end
17070
17071 ###
17072 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17073 ###
17074
17075 !! test
17076 Parser hook: static parser hook not inside a comment
17077 !! wikitext
17078 <statictag>hello, world</statictag>
17079
17080 <statictag action="flush" />
17081 !! html/php
17082 <p><br />
17083 hello, world
17084 </p>
17085 !! html/parsoid
17086 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17087 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17088 !! end
17089
17090 !! test
17091 Parser hook: static parser hook inside a comment
17092 !! wikitext
17093 <!-- <statictag>hello, world</statictag> -->
17094 <statictag action="flush" />
17095 !! html/php
17096 <p><br />
17097 </p>
17098 !! html/parsoid
17099 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17100 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17101 !! end
17102
17103 # Nested template calls; this case was broken by Parser.php rev 1.506,
17104 # since reverted.
17105
17106 !! article
17107 Template:One-parameter
17108 !! text
17109 (My parameter is: {{{1}}})
17110 !! endarticle
17111
17112 !! article
17113 Template:Map-one-parameter
17114 !! text
17115 {{{{{1}}}|{{{2}}}}}
17116 !! endarticle
17117
17118 !! test
17119 Nested template calls
17120 !! wikitext
17121 {{Map-one-parameter|One-parameter|param}}
17122 !! html
17123 <p>(My parameter is: param)
17124 </p>
17125 !! end
17126
17127
17128 ###
17129 ### Sanitizer
17130 ###
17131
17132 # HTML+Tidy effectively strips out the empty tags completely
17133 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17134 # which Tidy would have done for the PHP parser had there been content inside it.
17135 !! test
17136 Sanitizer: Closing of open tags
17137 !! wikitext
17138 <s></s><table></table>
17139 !! html
17140 <s></s><table></table>
17141
17142 !! html/parsoid
17143 <p><s></s></p><table></table>
17144 !! end
17145
17146 !! test
17147 Sanitizer: Closing of open but not closed tags
17148 !! wikitext
17149 <s>foo
17150 !! html
17151 <p><s>foo</s>
17152 </p>
17153 !! end
17154
17155 !! test
17156 Sanitizer: Closing of closed but not open tags
17157 !! options
17158 parsoid=wt2html
17159 !! wikitext
17160 </s>
17161 !! html/php+tidy
17162 !! html/parsoid
17163 !! end
17164
17165 !! test
17166 Sanitizer: Closing of closed but not open table tags
17167 !! options
17168 parsoid=wt2html
17169 !! wikitext
17170 Table not started</td></tr></table>
17171 !! html/php+tidy
17172 <p>Table not started</p>
17173 !! html/parsoid
17174 <p>Table not started</p>
17175 !! end
17176
17177 !! test
17178 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17179 !! wikitext
17180 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17181 !! html/php
17182 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17183 </p>
17184 !! html/parsoid
17185 <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>
17186 !! end
17187
17188 # In HTML5, the restrictions are that id must contain at least one character,
17189 # and must not contain any space characters.
17190 !! test
17191 Sanitizer: Validating the contents of the id attribute (bug 4515)
17192 !! options
17193 disabled
17194 !! wikitext
17195 <br id="" /><br id="a space" />
17196 !! html
17197 Something ...
17198 !! end
17199
17200 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17201 !! test
17202 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
17203 !! options
17204 disabled
17205 !! wikitext
17206 <br id="foo" /><br id="foo" />
17207 !! html
17208 Something need to be done. foo-2 ?
17209 !! end
17210
17211 !! test
17212 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17213 !! wikitext
17214 <div itemscope>
17215 <meta itemprop="hello" content="world">
17216 <meta http-equiv="refresh" content="5">
17217 <meta itemprop="hello" http-equiv="refresh" content="5">
17218 <link itemprop="hello" href="{{SERVER}}">
17219 <link rel="stylesheet" href="{{SERVER}}">
17220 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17221 </div>
17222 !! html
17223 <div itemscope="">
17224 <p> <meta itemprop="hello" content="world" />
17225 &lt;meta http-equiv="refresh" content="5"&gt;
17226 <meta itemprop="hello" content="5" />
17227 </p>
17228 <link itemprop="hello" href="http&#58;//example.org" />
17229 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17230 <link itemprop="hello" href="http&#58;//example.org" />
17231 </div>
17232
17233 !! end
17234
17235 !! test
17236 Language converter: output gets cut off unexpectedly (bug 5757)
17237 !! options
17238 language=zh
17239 !! wikitext
17240 this bit is safe: }-
17241
17242 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17243
17244 then we get cut off here: }-
17245
17246 all additional text is vanished
17247 !! html
17248 <p>this bit is safe: }-
17249 </p><p>but if we add a conversion instance: xxx
17250 </p><p>then we get cut off here: }-
17251 </p><p>all additional text is vanished
17252 </p>
17253 !! end
17254
17255 !! test
17256 Self closed html pairs (bug 5487)
17257 !! options
17258 !! wikitext
17259 <center><font id="bug" />Centered text</center>
17260 <div><font id="bug2" />In div text</div>
17261 !! html
17262 <center>&lt;font id="bug" /&gt;Centered text</center>
17263 <div>&lt;font id="bug2" /&gt;In div text</div>
17264
17265 !! end
17266
17267 #
17268 #
17269 #
17270
17271 !! test
17272 Punctuation: nbsp before exclamation
17273 !! wikitext
17274 C'est grave !
17275 !! html
17276 <p>C'est grave&#160;!
17277 </p>
17278 !! end
17279
17280 !! test
17281 Punctuation: CSS !important (bug 11874)
17282 !! wikitext
17283 <div style="width:50% !important">important</div>
17284 !! html
17285 <div style="width:50% !important">important</div>
17286
17287 !!end
17288
17289 !! test
17290 Punctuation: CSS ! important (bug 11874; with space after)
17291 !! wikitext
17292 <div style="width:50% ! important">important</div>
17293 !! html
17294 <div style="width:50% ! important">important</div>
17295
17296 !!end
17297
17298 !! test
17299 HTML bullet list, closed tags (bug 5497)
17300 !! wikitext
17301 <ul>
17302 <li>One</li>
17303 <li>Two</li>
17304 </ul>
17305 !! html/php
17306 <ul>
17307 <li>One</li>
17308 <li>Two</li>
17309 </ul>
17310
17311 !! html/parsoid
17312 <ul data-parsoid='{"stx":"html"}'>
17313 <li data-parsoid='{"stx":"html"}'>One</li>
17314 <li data-parsoid='{"stx":"html"}'>Two</li>
17315 </ul>
17316
17317 !! end
17318
17319 !! test
17320 HTML bullet list, unclosed tags (bug 5497)
17321 !! wikitext
17322 <ul>
17323 <li>One
17324 <li>Two
17325 </ul>
17326 !! html/php+tidy
17327 <ul>
17328 <li>One</li>
17329 <li>Two</li>
17330 </ul>
17331 !! html/parsoid
17332 <ul data-parsoid='{"stx":"html"}'>
17333 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17334 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17335 </ul>
17336
17337 !! end
17338
17339 !! test
17340 HTML ordered list, closed tags (bug 5497)
17341 !! wikitext
17342 <ol>
17343 <li>One</li>
17344 <li>Two</li>
17345 </ol>
17346 !! html/php
17347 <ol>
17348 <li>One</li>
17349 <li>Two</li>
17350 </ol>
17351
17352 !! html/parsoid
17353 <ol data-parsoid='{"stx":"html"}'>
17354 <li data-parsoid='{"stx":"html"}'>One</li>
17355 <li data-parsoid='{"stx":"html"}'>Two</li>
17356 </ol>
17357
17358 !! end
17359
17360 !! test
17361 HTML ordered list, unclosed tags (bug 5497)
17362 !! options
17363 !! wikitext
17364 <ol>
17365 <li>One
17366 <li>Two
17367 </ol>
17368 !! html/php+tidy
17369 <ol>
17370 <li>One</li>
17371 <li>Two</li>
17372 </ol>
17373 !! html/parsoid
17374 <ol data-parsoid='{"stx":"html"}'>
17375 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17376 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17377 </ol>
17378
17379 !! end
17380
17381 !! test
17382 HTML nested bullet list, closed tags (bug 5497)
17383 !! wikitext
17384 <ul>
17385 <li>One</li>
17386 <li>Two:
17387 <ul>
17388 <li>Sub-one</li>
17389 <li>Sub-two</li>
17390 </ul>
17391 </li>
17392 </ul>
17393 !! html/php
17394 <ul>
17395 <li>One</li>
17396 <li>Two:
17397 <ul>
17398 <li>Sub-one</li>
17399 <li>Sub-two</li>
17400 </ul>
17401 </li>
17402 </ul>
17403
17404 !! html/parsoid
17405 <ul data-parsoid='{"stx":"html"}'>
17406 <li data-parsoid='{"stx":"html"}'>One</li>
17407 <li data-parsoid='{"stx":"html"}'>Two:
17408 <ul data-parsoid='{"stx":"html"}'>
17409 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17410 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17411 </ul>
17412 </li>
17413 </ul>
17414 !! end
17415
17416 !! test
17417 HTML nested bullet list, open tags (bug 5497)
17418 !! wikitext
17419 <ul>
17420 <li>One
17421 <li>Two:
17422 <ul>
17423 <li>Sub-one
17424 <li>Sub-two
17425 </ul>
17426 </ul>
17427 !! html/php+tidy
17428 <ul>
17429 <li>One</li>
17430 <li>Two:
17431 <ul>
17432 <li>Sub-one</li>
17433 <li>Sub-two</li>
17434 </ul>
17435 </li>
17436 </ul>
17437 !! html/parsoid
17438 <ul>
17439 <li>One
17440 </li>
17441 <li>Two:
17442 <ul>
17443 <li>Sub-one
17444 </li>
17445 <li>Sub-two
17446 </li>
17447 </ul>
17448 </li>
17449 </ul>
17450
17451 !! end
17452
17453 !! test
17454 HTML nested ordered list, closed tags (bug 5497)
17455 !! wikitext
17456 <ol>
17457 <li>One</li>
17458 <li>Two:
17459 <ol>
17460 <li>Sub-one</li>
17461 <li>Sub-two</li>
17462 </ol>
17463 </li>
17464 </ol>
17465 !! html
17466 <ol>
17467 <li>One</li>
17468 <li>Two:
17469 <ol>
17470 <li>Sub-one</li>
17471 <li>Sub-two</li>
17472 </ol>
17473 </li>
17474 </ol>
17475
17476 !! end
17477
17478 !! test
17479 HTML nested ordered list, open tags (bug 5497)
17480 !! wikitext
17481 <ol>
17482 <li>One
17483 <li>Two:
17484 <ol>
17485 <li>Sub-one
17486 <li>Sub-two
17487 </ol>
17488 </ol>
17489 !! html/php
17490 <ol>
17491 <li>One
17492 <li>Two:
17493 <ol>
17494 <li>Sub-one
17495 <li>Sub-two
17496 </ol>
17497 </ol>
17498
17499 !! html/parsoid
17500 <ol>
17501 <li>One
17502 </li>
17503 <li>Two:
17504 <ol>
17505 <li>Sub-one
17506 </li>
17507 <li>Sub-two
17508 </li>
17509 </ol>
17510 </li>
17511 </ol>
17512
17513 !! end
17514
17515 !! test
17516 HTML ordered list item with parameters oddity
17517 !! wikitext
17518 <ol><li id="fragment">One</li>
17519 </ol>
17520 !! html
17521 <ol><li id="fragment">One</li>
17522 </ol>
17523
17524 !! end
17525
17526 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17527 !!test
17528 bug 5918: autonumbering
17529 !! wikitext
17530 [http://first/] [http://second] [ftp://ftp]
17531
17532 ftp://inlineftp
17533
17534 [mailto:enclosed@mail.tld With target]
17535
17536 [mailto:enclosed@mail.tld]
17537
17538 mailto:inline@mail.tld
17539 !! html/php
17540 <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>
17541 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17542 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17543 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17544 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17545 </p>
17546 !! html/parsoid
17547 <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>
17548 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17549 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17550 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17551 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17552 !! end
17553
17554
17555 #
17556 # Security and HTML correctness
17557 # From Nick Jenkins' fuzz testing
17558 #
17559
17560 !! test
17561 Fuzz testing: Parser13
17562 !! wikitext
17563 {|
17564 | http://a|
17565 !! html
17566 <table>
17567 <tr>
17568 <td>
17569 </td>
17570 </tr>
17571 </table>
17572
17573 !! end
17574
17575 !! test
17576 Fuzz testing: Parser14
17577 !! wikitext
17578 == onmouseover= ==
17579 http://__TOC__
17580 !! html
17581 <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>
17582 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17583 <ul>
17584 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17585 </ul>
17586 </div>
17587
17588
17589 !! html+tidy
17590 <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>
17591 <p>http://</p>
17592 <div id="toc" class="toc">
17593 <div id="toctitle">
17594 <h2>Contents</h2>
17595 </div>
17596 <ul>
17597 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17598 </ul>
17599 </div>
17600 <p></p>
17601 !! end
17602
17603 !! test
17604 Fuzz testing: Parser14-table
17605 !! options
17606 parsoid=wt2html,html2html
17607 !! wikitext
17608 ==a==
17609 {| STYLE=__TOC__
17610 !! html
17611 <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>
17612 <table style="&#95;_TOC&#95;_">
17613 <tr><td></td></tr>
17614 </table>
17615
17616 !! html+tidy
17617 <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>
17618 <table style="__TOC__">
17619 <tr>
17620 <td></td>
17621 </tr>
17622 </table>
17623 !! html/parsoid
17624 <h2>a</h2>
17625 <table style="__TOC__"></table>
17626 !! end
17627
17628 # Known to produce bogus xml (extra </td>)
17629 !! test
17630 Fuzz testing: Parser16
17631 !! wikitext
17632 {|
17633 !https://||||||
17634 !! html
17635 <table>
17636 <tr>
17637 <th>https://</th>
17638 <th></th>
17639 <th></th>
17640 <th>
17641 </td>
17642 </tr>
17643 </table>
17644
17645 !! html+tidy
17646 <table>
17647 <tr>
17648 <th>https://</th>
17649 <th></th>
17650 <th></th>
17651 <th></th>
17652 </tr>
17653 </table>
17654 !! end
17655
17656 !! test
17657 Fuzz testing: Parser21
17658 !! wikitext
17659 {|
17660 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17661 |
17662 !! html
17663 <table>
17664 <tr>
17665 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17666 </th>
17667 <td>
17668 </td>
17669 </tr>
17670 </table>
17671
17672 !! end
17673
17674 !! test
17675 Fuzz testing: Parser22
17676 !! wikitext
17677 http://===r:::https://b
17678
17679 {|
17680 !! html
17681 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17682 </p>
17683 <table>
17684 <tr><td></td></tr>
17685 </table>
17686
17687 !! end
17688
17689 # Known to produce bad XML for now
17690 !! test
17691 Fuzz testing: Parser24
17692 !! wikitext
17693 {|
17694 {{{|
17695 <u CLASS=
17696 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17697 <br style="onmouseover='alert(document.cookie);' " />
17698
17699 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17700 |
17701 !! html
17702 <table>
17703 {{{|
17704 <u class="&#124;">}}}} &gt;
17705 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17706
17707 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17708 <tr>
17709 <td></u>
17710 </td>
17711 </tr>
17712 </table>
17713
17714 !! end
17715
17716 # Note: the current result listed for this is not what the original one was,
17717 # but the original bug was JavaScript injection, which is fixed in any case.
17718 # It's not clear that the original result listed was any more correct than the
17719 # current one. Original result:
17720 # <p>{{{|
17721 # </p>
17722 # <li class="&#124;&#124;">
17723 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17724 !!test
17725 Fuzz testing: Parser25 (bug 6055)
17726 !! wikitext
17727 {{{
17728 |
17729 <LI CLASS=||
17730 >
17731 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17732 !! html
17733 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17734 </p>
17735 !! end
17736
17737 !!test
17738 Fuzz testing: URL adjacent extension (with space, clean)
17739 !! wikitext
17740 http://example.com <nowiki>junk</nowiki>
17741 !! html/php
17742 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17743 </p>
17744 !! html/parsoid
17745 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17746 !! end
17747
17748 !!test
17749 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17750 !! wikitext
17751 http://example.com<nowiki>junk</nowiki>
17752 !! html/php
17753 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17754 </p>
17755 !! html/parsoid
17756 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17757 !! end
17758
17759 !!test
17760 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17761 !! wikitext
17762 http://example.com<pre>junk</pre>
17763 !! html/php
17764 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17765
17766 !! html/php+tidy
17767 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17768 <pre>
17769 junk
17770 </pre>
17771 !! html/parsoid
17772 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a></p><pre data-parsoid='{"stx":"html"}'>junk</pre>
17773 !!end
17774
17775 !!test
17776 Fuzz testing: image with bogus manual thumbnail
17777 !! wikitext
17778 [[Image:foobar.jpg|thumbnail= ]]
17779 !! html/php
17780 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17781
17782 !! html/parsoid
17783 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}' data-mw='{"errors":[{"key":"missing-thumbnail","message":"This thumbnail does not exist.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
17784 !!end
17785
17786 !! test
17787 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17788 !! wikitext
17789 <pre dir="&#10;"></pre>
17790 !! html
17791 <pre dir="&#10;"></pre>
17792
17793 !! end
17794
17795 !! test
17796 Parsing optional HTML elements (Bug 6171)
17797 !! options
17798 !! wikitext
17799 <table>
17800 <tr>
17801 <td> Some tabular data</td>
17802 <td> More tabular data ...
17803 <td> And yet som tabular data</td>
17804 </tr>
17805 </table>
17806 !! html
17807 <table>
17808 <tr>
17809 <td> Some tabular data</td>
17810 <td> More tabular data ...
17811 </td><td> And yet som tabular data</td>
17812 </tr>
17813 </table>
17814
17815 !! end
17816
17817 !! test
17818 Correct handling of <td>, <tr> (Bug 6171)
17819 !! options
17820 !! wikitext
17821 <table>
17822 <tr>
17823 <td> Some tabular data</td>
17824 <td> More tabular data ...</td>
17825 <td> And yet som tabular data</td>
17826 </tr>
17827 </table>
17828 !! html
17829 <table>
17830 <tr>
17831 <td> Some tabular data</td>
17832 <td> More tabular data ...</td>
17833 <td> And yet som tabular data</td>
17834 </tr>
17835 </table>
17836
17837 !! end
17838
17839
17840 !! test
17841 Parsing crashing regression (fr:JavaScript)
17842 !! wikitext
17843 </body></x>
17844 !! html
17845 <p>&lt;/body&gt;&lt;/x&gt;
17846 </p>
17847 !! end
17848
17849 !! test
17850 Inline wiki vs wiki block nesting
17851 !! wikitext
17852 '''Bold paragraph
17853
17854 New wiki paragraph
17855 !! html
17856 <p><b>Bold paragraph</b>
17857 </p><p>New wiki paragraph
17858 </p>
17859 !! end
17860
17861 # FIXME: The current php output is documented
17862 # and desired output is the parsoid target.
17863 !! test
17864 Inline HTML vs wiki block nesting
17865 !! wikitext
17866 <b>Bold paragraph
17867
17868 New wiki paragraph
17869 !! html/php
17870 <p><b>Bold paragraph
17871 </p><p>New wiki paragraph</b>
17872 </p>
17873 !! html/parsoid
17874 <p><b>Bold paragraph</b>
17875 </p><p>New wiki paragraph
17876 </p>
17877 !! end
17878
17879 # Original result was this:
17880 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17881 # </p>
17882 # While that might be marginally more intuitive, maybe, the six-apostrophe
17883 # construct is clearly pathological and the result stated here (which is what
17884 # the parser actually does) is about as reasonable as anything.
17885 !!test
17886 Mixing markup for italics and bold
17887 !! options
17888 !! wikitext
17889 '''bold''''''bold''bolditalics'''''
17890 !! html
17891 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17892 </p>
17893 !! end
17894
17895
17896 !! article
17897 Xyzzyx
17898 !! text
17899 Article for special page transclusion test
17900 !! endarticle
17901
17902 !! test
17903 Special page transclusion
17904 !! options
17905 !! wikitext
17906 {{Special:Prefixindex/Xyzzyx}}
17907 !! html
17908 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17909 </ul>
17910
17911 !! end
17912
17913 !! test
17914 Special page transclusion twice (bug 5021)
17915 !! options
17916 !! wikitext
17917 {{Special:Prefixindex/Xyzzyx}}
17918 {{Special:Prefixindex/Xyzzyx}}
17919 !! html
17920 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17921 </ul>
17922 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17923 </ul>
17924
17925 !! end
17926
17927 !! test
17928 Transclusion of default MediaWiki message
17929 !! wikitext
17930 {{MediaWiki:Mainpage}}
17931 !! html
17932 <p>Main Page
17933 </p>
17934 !! end
17935
17936 !! test
17937 Transclusion of nonexistent MediaWiki message
17938 !! wikitext
17939 {{MediaWiki:Mainpagexxx}}
17940 !! html
17941 <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>
17942 </p>
17943 !! end
17944
17945 !! test
17946 Transclusion of MediaWiki message with underscore
17947 !! wikitext
17948 {{MediaWiki:history_short}}
17949 !! html
17950 <p>History
17951 </p>
17952 !! end
17953
17954 !! test
17955 Transclusion of MediaWiki message with space
17956 !! wikitext
17957 {{MediaWiki:history short}}
17958 !! html
17959 <p>History
17960 </p>
17961 !! end
17962
17963 !! test
17964 Invalid header with following text
17965 !! wikitext
17966 = x = y
17967 !! html
17968 <p>= x = y
17969 </p>
17970 !! end
17971
17972
17973 !! test
17974 Section extraction test (section 0)
17975 !! options
17976 section=0
17977 !! wikitext
17978 start
17979 ==a==
17980 ===aa===
17981 ====aaa====
17982 ==b==
17983 ===ba===
17984 ===bb===
17985 ====bba====
17986 ===bc===
17987 ==c==
17988 ===ca===
17989 !! html/php
17990 start
17991 !! end
17992
17993 !! test
17994 Section extraction test (section 1)
17995 !! options
17996 section=1
17997 !! wikitext
17998 start
17999 ==a==
18000 ===aa===
18001 ====aaa====
18002 ==b==
18003 ===ba===
18004 ===bb===
18005 ====bba====
18006 ===bc===
18007 ==c==
18008 ===ca===
18009 !! html/php
18010 ==a==
18011 ===aa===
18012 ====aaa====
18013 !! end
18014
18015 !! test
18016 Section extraction test (section 2)
18017 !! options
18018 section=2
18019 !! wikitext
18020 start
18021 ==a==
18022 ===aa===
18023 ====aaa====
18024 ==b==
18025 ===ba===
18026 ===bb===
18027 ====bba====
18028 ===bc===
18029 ==c==
18030 ===ca===
18031 !! html/php
18032 ===aa===
18033 ====aaa====
18034 !! end
18035
18036 !! test
18037 Section extraction test (section 3)
18038 !! options
18039 section=3
18040 !! wikitext
18041 start
18042 ==a==
18043 ===aa===
18044 ====aaa====
18045 ==b==
18046 ===ba===
18047 ===bb===
18048 ====bba====
18049 ===bc===
18050 ==c==
18051 ===ca===
18052 !! html/php
18053 ====aaa====
18054 !! end
18055
18056 !! test
18057 Section extraction test (section 4)
18058 !! options
18059 section=4
18060 !! wikitext
18061 start
18062 ==a==
18063 ===aa===
18064 ====aaa====
18065 ==b==
18066 ===ba===
18067 ===bb===
18068 ====bba====
18069 ===bc===
18070 ==c==
18071 ===ca===
18072 !! html/php
18073 ==b==
18074 ===ba===
18075 ===bb===
18076 ====bba====
18077 ===bc===
18078 !! end
18079
18080 !! test
18081 Section extraction test (section 5)
18082 !! options
18083 section=5
18084 !! wikitext
18085 start
18086 ==a==
18087 ===aa===
18088 ====aaa====
18089 ==b==
18090 ===ba===
18091 ===bb===
18092 ====bba====
18093 ===bc===
18094 ==c==
18095 ===ca===
18096 !! html/php
18097 ===ba===
18098 !! end
18099
18100 !! test
18101 Section extraction test (section 6)
18102 !! options
18103 section=6
18104 !! wikitext
18105 start
18106 ==a==
18107 ===aa===
18108 ====aaa====
18109 ==b==
18110 ===ba===
18111 ===bb===
18112 ====bba====
18113 ===bc===
18114 ==c==
18115 ===ca===
18116 !! html/php
18117 ===bb===
18118 ====bba====
18119 !! end
18120
18121 !! test
18122 Section extraction test (section 7)
18123 !! options
18124 section=7
18125 !! wikitext
18126 start
18127 ==a==
18128 ===aa===
18129 ====aaa====
18130 ==b==
18131 ===ba===
18132 ===bb===
18133 ====bba====
18134 ===bc===
18135 ==c==
18136 ===ca===
18137 !! html/php
18138 ====bba====
18139 !! end
18140
18141 !! test
18142 Section extraction test (section 8)
18143 !! options
18144 section=8
18145 !! wikitext
18146 start
18147 ==a==
18148 ===aa===
18149 ====aaa====
18150 ==b==
18151 ===ba===
18152 ===bb===
18153 ====bba====
18154 ===bc===
18155 ==c==
18156 ===ca===
18157 !! html/php
18158 ===bc===
18159 !! end
18160
18161 !! test
18162 Section extraction test (section 9)
18163 !! options
18164 section=9
18165 !! wikitext
18166 start
18167 ==a==
18168 ===aa===
18169 ====aaa====
18170 ==b==
18171 ===ba===
18172 ===bb===
18173 ====bba====
18174 ===bc===
18175 ==c==
18176 ===ca===
18177 !! html/php
18178 ==c==
18179 ===ca===
18180 !! end
18181
18182 !! test
18183 Section extraction test (section 10)
18184 !! options
18185 section=10
18186 !! wikitext
18187 start
18188 ==a==
18189 ===aa===
18190 ====aaa====
18191 ==b==
18192 ===ba===
18193 ===bb===
18194 ====bba====
18195 ===bc===
18196 ==c==
18197 ===ca===
18198 !! html/php
18199 ===ca===
18200 !! end
18201
18202 !! test
18203 Section extraction test (nonexistent section 11)
18204 !! options
18205 section=11
18206 !! wikitext
18207 start
18208 ==a==
18209 ===aa===
18210 ====aaa====
18211 ==b==
18212 ===ba===
18213 ===bb===
18214 ====bba====
18215 ===bc===
18216 ==c==
18217 ===ca===
18218 !! html/php
18219 !! end
18220
18221 !! test
18222 Section extraction test with bogus heading (section 1)
18223 !! options
18224 section=1
18225 !! wikitext
18226 ==a==
18227 ==bogus== not a legal section
18228 ==b==
18229 !! html/php
18230 ==a==
18231 ==bogus== not a legal section
18232 !! end
18233
18234 !! test
18235 Section extraction test with bogus heading (section 2)
18236 !! options
18237 section=2
18238 !! wikitext
18239 ==a==
18240 ==bogus== not a legal section
18241 ==b==
18242 !! html/php
18243 ==b==
18244 !! end
18245
18246 !! test
18247 Section extraction test with comment after heading (section 1)
18248 !! options
18249 section=1
18250 !! wikitext
18251 ==a==
18252 ==b== <!-- -->
18253 ==c==
18254 !! html/php
18255 ==a==
18256 !! end
18257
18258 !! test
18259 Section extraction test with comment after heading (section 2)
18260 !! options
18261 section=2
18262 !! wikitext
18263 ==a==
18264 ==b== <!-- -->
18265 ==c==
18266 !! html/php
18267 ==b== <!-- -->
18268 !! end
18269
18270 !! test
18271 Section extraction test with bogus <nowiki> heading (section 1)
18272 !! options
18273 section=1
18274 !! wikitext
18275 ==a==
18276 ==bogus== <nowiki>not a legal section</nowiki>
18277 ==b==
18278 !! html/php
18279 ==a==
18280 ==bogus== <nowiki>not a legal section</nowiki>
18281 !! end
18282
18283 !! test
18284 Section extraction test with bogus <nowiki> heading (section 2)
18285 !! options
18286 section=2
18287 !! wikitext
18288 ==a==
18289 ==bogus== <nowiki>not a legal section</nowiki>
18290 ==b==
18291 !! html/php
18292 ==b==
18293 !! end
18294
18295 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18296 # instead of respecting commented sections
18297 !! test
18298 Section extraction prefixed by comment (section 1)
18299 !! options
18300 section=1
18301 !! wikitext
18302 <!-- -->==sec1==
18303 ==sec2==
18304 !! html/php
18305 ==sec2==
18306 !!end
18307
18308 !! test
18309 Section extraction prefixed by comment (section 2)
18310 !! options
18311 section=2
18312 !! wikitext
18313 <!-- -->==sec1==
18314 ==sec2==
18315 !! html/php
18316
18317 !!end
18318
18319 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18320 # instead of respecting HTML-style headings
18321 !! test
18322 Section extraction, mixed wiki and html (section 1)
18323 !! options
18324 section=1
18325 !! wikitext
18326 <h2>unmarked</h2>
18327 unmarked
18328 ==1==
18329 one
18330 ==2==
18331 two
18332 !! html/php
18333 ==1==
18334 one
18335 !! end
18336
18337 !! test
18338 Section extraction, mixed wiki and html (section 2)
18339 !! options
18340 section=2
18341 !! wikitext
18342 <h2>unmarked</h2>
18343 unmarked
18344 ==1==
18345 one
18346 ==2==
18347 two
18348 !! html/php
18349 ==2==
18350 two
18351 !! end
18352
18353
18354 # Formerly testing for bug 3342
18355 !! test
18356 Section extraction, heading surrounded by <noinclude>
18357 !! options
18358 section=1
18359 !! wikitext
18360 <noinclude>==unmarked==</noinclude>
18361 ==marked==
18362 !! html/php
18363 ==marked==
18364 !!end
18365
18366 # Test behavior of bug 19910
18367 !! test
18368 Sectiion with all-equals
18369 !! options
18370 section=2
18371 !! wikitext
18372 ===
18373 The line above must have a trailing space
18374 === <!--
18375 --> <!-- -->
18376 But just in case it doesn't...
18377 !! html/php
18378 === <!--
18379 --> <!-- -->
18380 But just in case it doesn't...
18381 !! end
18382
18383 !! test
18384 Section replacement test (section 0)
18385 !! options
18386 replace=0,"xxx"
18387 !! wikitext
18388 start
18389 ==a==
18390 ===aa===
18391 ====aaa====
18392 ==b==
18393 ===ba===
18394 ===bb===
18395 ====bba====
18396 ===bc===
18397 ==c==
18398 ===ca===
18399 !! html/php
18400 xxx
18401
18402 ==a==
18403 ===aa===
18404 ====aaa====
18405 ==b==
18406 ===ba===
18407 ===bb===
18408 ====bba====
18409 ===bc===
18410 ==c==
18411 ===ca===
18412 !! end
18413
18414 !! test
18415 Section replacement test (section 1)
18416 !! options
18417 replace=1,"xxx"
18418 !! wikitext
18419 start
18420 ==a==
18421 ===aa===
18422 ====aaa====
18423 ==b==
18424 ===ba===
18425 ===bb===
18426 ====bba====
18427 ===bc===
18428 ==c==
18429 ===ca===
18430 !! html/php
18431 start
18432 xxx
18433
18434 ==b==
18435 ===ba===
18436 ===bb===
18437 ====bba====
18438 ===bc===
18439 ==c==
18440 ===ca===
18441 !! end
18442
18443 !! test
18444 Section replacement test (section 2)
18445 !! options
18446 replace=2,"xxx"
18447 !! wikitext
18448 start
18449 ==a==
18450 ===aa===
18451 ====aaa====
18452 ==b==
18453 ===ba===
18454 ===bb===
18455 ====bba====
18456 ===bc===
18457 ==c==
18458 ===ca===
18459 !! html/php
18460 start
18461 ==a==
18462 xxx
18463
18464 ==b==
18465 ===ba===
18466 ===bb===
18467 ====bba====
18468 ===bc===
18469 ==c==
18470 ===ca===
18471 !! end
18472
18473 !! test
18474 Section replacement test (section 3)
18475 !! options
18476 replace=3,"xxx"
18477 !! wikitext
18478 start
18479 ==a==
18480 ===aa===
18481 ====aaa====
18482 ==b==
18483 ===ba===
18484 ===bb===
18485 ====bba====
18486 ===bc===
18487 ==c==
18488 ===ca===
18489 !! html/php
18490 start
18491 ==a==
18492 ===aa===
18493 xxx
18494
18495 ==b==
18496 ===ba===
18497 ===bb===
18498 ====bba====
18499 ===bc===
18500 ==c==
18501 ===ca===
18502 !! end
18503
18504 !! test
18505 Section replacement test (section 4)
18506 !! options
18507 replace=4,"xxx"
18508 !! wikitext
18509 start
18510 ==a==
18511 ===aa===
18512 ====aaa====
18513 ==b==
18514 ===ba===
18515 ===bb===
18516 ====bba====
18517 ===bc===
18518 ==c==
18519 ===ca===
18520 !! html/php
18521 start
18522 ==a==
18523 ===aa===
18524 ====aaa====
18525 xxx
18526
18527 ==c==
18528 ===ca===
18529 !! end
18530
18531 !! test
18532 Section replacement test (section 5)
18533 !! options
18534 replace=5,"xxx"
18535 !! wikitext
18536 start
18537 ==a==
18538 ===aa===
18539 ====aaa====
18540 ==b==
18541 ===ba===
18542 ===bb===
18543 ====bba====
18544 ===bc===
18545 ==c==
18546 ===ca===
18547 !! html/php
18548 start
18549 ==a==
18550 ===aa===
18551 ====aaa====
18552 ==b==
18553 xxx
18554
18555 ===bb===
18556 ====bba====
18557 ===bc===
18558 ==c==
18559 ===ca===
18560 !! end
18561
18562 !! test
18563 Section replacement test (section 6)
18564 !! options
18565 replace=6,"xxx"
18566 !! wikitext
18567 start
18568 ==a==
18569 ===aa===
18570 ====aaa====
18571 ==b==
18572 ===ba===
18573 ===bb===
18574 ====bba====
18575 ===bc===
18576 ==c==
18577 ===ca===
18578 !! html/php
18579 start
18580 ==a==
18581 ===aa===
18582 ====aaa====
18583 ==b==
18584 ===ba===
18585 xxx
18586
18587 ===bc===
18588 ==c==
18589 ===ca===
18590 !! end
18591
18592 !! test
18593 Section replacement test (section 7)
18594 !! options
18595 replace=7,"xxx"
18596 !! wikitext
18597 start
18598 ==a==
18599 ===aa===
18600 ====aaa====
18601 ==b==
18602 ===ba===
18603 ===bb===
18604 ====bba====
18605 ===bc===
18606 ==c==
18607 ===ca===
18608 !! html/php
18609 start
18610 ==a==
18611 ===aa===
18612 ====aaa====
18613 ==b==
18614 ===ba===
18615 ===bb===
18616 xxx
18617
18618 ===bc===
18619 ==c==
18620 ===ca===
18621 !! end
18622
18623 !! test
18624 Section replacement test (section 8)
18625 !! options
18626 replace=8,"xxx"
18627 !! wikitext
18628 start
18629 ==a==
18630 ===aa===
18631 ====aaa====
18632 ==b==
18633 ===ba===
18634 ===bb===
18635 ====bba====
18636 ===bc===
18637 ==c==
18638 ===ca===
18639 !! html/php
18640 start
18641 ==a==
18642 ===aa===
18643 ====aaa====
18644 ==b==
18645 ===ba===
18646 ===bb===
18647 ====bba====
18648 xxx
18649
18650 ==c==
18651 ===ca===
18652 !!end
18653
18654 !! test
18655 Section replacement test (section 9)
18656 !! options
18657 replace=9,"xxx"
18658 !! wikitext
18659 start
18660 ==a==
18661 ===aa===
18662 ====aaa====
18663 ==b==
18664 ===ba===
18665 ===bb===
18666 ====bba====
18667 ===bc===
18668 ==c==
18669 ===ca===
18670 !! html/php
18671 start
18672 ==a==
18673 ===aa===
18674 ====aaa====
18675 ==b==
18676 ===ba===
18677 ===bb===
18678 ====bba====
18679 ===bc===
18680 xxx
18681 !! end
18682
18683 !! test
18684 Section replacement test (section 10)
18685 !! options
18686 replace=10,"xxx"
18687 !! wikitext
18688 start
18689 ==a==
18690 ===aa===
18691 ====aaa====
18692 ==b==
18693 ===ba===
18694 ===bb===
18695 ====bba====
18696 ===bc===
18697 ==c==
18698 ===ca===
18699 !! html/php
18700 start
18701 ==a==
18702 ===aa===
18703 ====aaa====
18704 ==b==
18705 ===ba===
18706 ===bb===
18707 ====bba====
18708 ===bc===
18709 ==c==
18710 xxx
18711 !! end
18712
18713 !! test
18714 Section replacement test with initial whitespace (bug 13728)
18715 !! options
18716 replace=2,"xxx"
18717 !! wikitext
18718 Preformatted initial line
18719 ==a==
18720 ===a===
18721 !! html/php
18722 Preformatted initial line
18723 ==a==
18724 xxx
18725 !! end
18726
18727
18728 !! test
18729 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18730 !! options
18731 section=1
18732 !! wikitext
18733 ==a==
18734 a
18735 !! html/php
18736 ==a==
18737 a
18738 !! end
18739
18740 !! test
18741 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18742 !! options
18743 section=1
18744 !! wikitext
18745 ==a==
18746 a
18747 !! html/php
18748 ==a==
18749 a
18750 !! end
18751
18752
18753 !! test
18754 Section extraction, <pre> around bogus header (bug 10309)
18755 !! options
18756 section=2
18757 !! wikitext
18758 == Section One ==
18759 <pre>
18760 =======
18761 </pre>
18762
18763 == Section Two ==
18764 stuff
18765 !! html/php
18766 == Section Two ==
18767 stuff
18768 !! end
18769
18770 !! test
18771 Section replacement, <pre> around bogus header (bug 10309)
18772 !! options
18773 replace=2,"xxx"
18774 !! wikitext
18775 == Section One ==
18776 <pre>
18777 =======
18778 </pre>
18779
18780 == Section Two ==
18781 stuff
18782 !! html/php
18783 == Section One ==
18784 <pre>
18785 =======
18786 </pre>
18787
18788 xxx
18789 !! end
18790
18791
18792 !! test
18793 Handling of &#x0A; in URLs
18794 !! wikitext
18795 ** irc://&#x0A;a
18796 !! html/php
18797 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18798
18799 !! html/parsoid
18800 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18801 a">irc://
18802 a</a></li></ul></li></ul>
18803 !! end
18804
18805 !! test
18806 Handling of %0A in URLs
18807 !! wikitext
18808 ** irc://%0Aa
18809 !! html/php
18810 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18811
18812 !! html/parsoid
18813 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18814 !! end
18815
18816
18817 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18818 !! test
18819 5 quotes, code coverage +1 line
18820 !! options
18821 parsoid=wt2html
18822 !! wikitext
18823 '''''
18824 !! html/php
18825 !! html/parsoid
18826 <p><b><i></i></b></p>
18827 !! end
18828
18829 # same html as previous, but wikitext adjusted to match parsoid html2wt
18830 # note that wt2html and html2html will put the <i> before the <b>
18831 !! test
18832 5 quotes, code coverage +1 line w/ nowiki (1)
18833 !! options
18834 parsoid=wt2wt,html2wt
18835 !! wikitext
18836 '''''<nowiki/>'''''
18837 !! html/php
18838 <p><i></i>
18839 </p>
18840 !! html/parsoid
18841 <p><b><i></i></b></p>
18842 !! end
18843
18844 # same as previous, just swapping the <i> and <b>
18845 !! test
18846 5 quotes, code coverage +1 line w/ nowiki (2)
18847 !! wikitext
18848 '''''<nowiki/>'''''
18849 !! html/php
18850 <p><i></i>
18851 </p>
18852 !! html/parsoid
18853 <p><i><b></b></i></p>
18854 !! end
18855
18856 !! test
18857 Special:Search page linking.
18858 !! wikitext
18859 {{Special:search}}
18860 !! html
18861 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18862 </p>
18863 !! end
18864
18865 !! test
18866 {{!}} is a magic word
18867 !! wikitext
18868 {{!}} is a magic word there and {{!}} is still a magic word here
18869 | is not a magic word here but {{!}} is still a magic word here
18870 !! html/php
18871 <p>| is a magic word there and | is still a magic word here
18872 | is not a magic word here but | is still a magic word here
18873 </p>
18874 !! html/parsoid
18875 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is a magic word there and <span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is still a magic word here
18876 | is not a magic word here but <span about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is still a magic word here</p>
18877
18878 !! end
18879
18880 !! test
18881 Say the magic word
18882 !! options
18883 title=[[Parser test]]
18884 !! wikitext
18885 * {{PAGENAME}}
18886 * {{PAGENAMEE}}
18887 * {{FULLPAGENAME}}
18888 * {{FULLPAGENAMEE}}
18889 * {{BASEPAGENAME}}
18890 * {{BASEPAGENAMEE}}
18891 * {{SUBPAGENAME}}
18892 * {{SUBPAGENAMEE}}
18893 * {{ROOTPAGENAME}}
18894 * {{ROOTPAGENAMEE}}
18895 * {{TALKPAGENAME}}
18896 * {{TALKPAGENAMEE}}
18897 * {{SUBJECTPAGENAME}}
18898 * {{SUBJECTPAGENAMEE}}
18899 * {{NAMESPACEE}}
18900 * {{NAMESPACE}}
18901 * {{NAMESPACENUMBER}}
18902 * {{TALKSPACE}}
18903 * {{TALKSPACEE}}
18904 * {{SUBJECTSPACE}}
18905 * {{SUBJECTSPACEE}}
18906 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18907 !! html
18908 <ul><li> Parser test</li>
18909 <li> Parser_test</li>
18910 <li> Parser test</li>
18911 <li> Parser_test</li>
18912 <li> Parser test</li>
18913 <li> Parser_test</li>
18914 <li> Parser test</li>
18915 <li> Parser_test</li>
18916 <li> Parser test</li>
18917 <li> Parser_test</li>
18918 <li> Talk:Parser test</li>
18919 <li> Talk:Parser_test</li>
18920 <li> Parser test</li>
18921 <li> Parser_test</li>
18922 <li> </li>
18923 <li> </li>
18924 <li> 0</li>
18925 <li> Talk</li>
18926 <li> Talk</li>
18927 <li> </li>
18928 <li> </li>
18929 <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>
18930
18931 !! end
18932 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18933
18934 ## Parsoid thinks the "centre" here is a property, not a caption.
18935 !! test
18936 Gallery
18937 !! options
18938 parsoid={
18939 "modes": ["wt2html"],
18940 "nativeGallery": true
18941 }
18942 !! wikitext
18943 <gallery>
18944 image1.png |
18945 image2.gif|||||
18946
18947 image3|
18948 image4 |300px| centre
18949 image5.svg| http://///////
18950 [[x|xx]]]]
18951 * image6
18952 </gallery>
18953 !! html/php
18954 <ul class="gallery mw-gallery-traditional">
18955 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18956 <div class="thumb" style="height: 150px;">Image1.png</div>
18957 <div class="gallerytext">
18958 </div>
18959 </div></li>
18960 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18961 <div class="thumb" style="height: 150px;">Image2.gif</div>
18962 <div class="gallerytext">
18963 </div>
18964 </div></li>
18965 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18966 <div class="thumb" style="height: 150px;">Image3</div>
18967 <div class="gallerytext">
18968 </div>
18969 </div></li>
18970 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18971 <div class="thumb" style="height: 150px;">Image4</div>
18972 <div class="gallerytext">
18973 <pre>centre
18974 </pre>
18975 </div>
18976 </div></li>
18977 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18978 <div class="thumb" style="height: 150px;">Image5.svg</div>
18979 <div class="gallerytext">
18980 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18981 </p>
18982 </div>
18983 </div></li>
18984 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18985 <div class="thumb" style="height: 150px;">* image6</div>
18986 <div class="gallerytext">
18987 </div>
18988 </div></li>
18989 </ul>
18990
18991 !! html/parsoid
18992 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
18993 <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>
18994 <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>
18995 <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>
18996 <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>
18997 <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>
18998 <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>
18999 </ul>
19000 !! end
19001
19002 !! test
19003 Gallery (with options, html)
19004 !! options
19005 parsoid={
19006 "modes": ["wt2html", "html2html"],
19007 "nativeGallery": true
19008 }
19009 !! wikitext
19010 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19011 File:Nonexistent.jpg|caption
19012 File:Nonexistent.jpg
19013 image:foobar.jpg|some '''caption''' [[Main Page]]
19014 image:foobar.jpg
19015 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19016 </gallery>
19017 !! html/php
19018 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19019 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19020 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19021 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19022 <div class="gallerytext">
19023 <p>caption
19024 </p>
19025 </div>
19026 </div></li>
19027 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19028 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19029 <div class="gallerytext">
19030 </div>
19031 </div></li>
19032 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19033 <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>
19034 <div class="gallerytext">
19035 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19036 </p>
19037 </div>
19038 </div></li>
19039 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19040 <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>
19041 <div class="gallerytext">
19042 </div>
19043 </div></li>
19044 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19045 <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>
19046 <div class="gallerytext">
19047 <p>blabla.
19048 </p>
19049 </div>
19050 </div></li>
19051 </ul>
19052
19053 !! html/parsoid
19054 <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":{}}'>
19055 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19056 <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>
19057 <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>
19058 <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>
19059 <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>
19060 <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>
19061 </ul>
19062 !! end
19063
19064 !! test
19065 Gallery (with options, extsrc)
19066 !! options
19067 parsoid={
19068 "nativeGallery": false
19069 }
19070 !! wikitext
19071 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19072 File:Nonexistent.jpg|caption
19073 File:Nonexistent.jpg
19074 image:foobar.jpg|some '''caption''' [[Main Page]]
19075 image:foobar.jpg
19076 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19077 </gallery>
19078 !! html/php
19079 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19080 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19081 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19082 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19083 <div class="gallerytext">
19084 <p>caption
19085 </p>
19086 </div>
19087 </div></li>
19088 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19089 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19090 <div class="gallerytext">
19091 </div>
19092 </div></li>
19093 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19094 <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>
19095 <div class="gallerytext">
19096 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19097 </p>
19098 </div>
19099 </div></li>
19100 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19101 <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>
19102 <div class="gallerytext">
19103 </div>
19104 </div></li>
19105 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19106 <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>
19107 <div class="gallerytext">
19108 <p>blabla.
19109 </p>
19110 </div>
19111 </div></li>
19112 </ul>
19113
19114 !! html/parsoid
19115 <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"}}'>
19116 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19117 <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>
19118 <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>
19119 <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>
19120 <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>
19121 <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>
19122 </ul>
19123 !! end
19124
19125 !! test
19126 Gallery with link that has fragment
19127 !! options
19128 parsoid={
19129 "modes": ["wt2html", "html2html"],
19130 "nativeGallery": true
19131 }
19132 !! wikitext
19133 <gallery>
19134 image:foobar.jpg|link=Main_Page
19135 image:foobar.jpg|link=Main_Page#section
19136 image:foobar.jpg|link=Main Page#section|caption
19137 </gallery>
19138 !! html/php
19139 <ul class="gallery mw-gallery-traditional">
19140 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19141 <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>
19142 <div class="gallerytext">
19143 </div>
19144 </div></li>
19145 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19146 <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>
19147 <div class="gallerytext">
19148 </div>
19149 </div></li>
19150 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19151 <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>
19152 <div class="gallerytext">
19153 <p>caption
19154 </p>
19155 </div>
19156 </div></li>
19157 </ul>
19158
19159 !! html/parsoid
19160 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19161 <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>
19162 <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>
19163 <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>
19164 </ul>
19165 !! end
19166
19167 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19168 !! test
19169 Gallery with template inside caption
19170 !! options
19171 parsoid={
19172 "nativeGallery": true
19173 }
19174 !! wikitext
19175 <gallery caption="{{echo|hi}}">
19176 File:Foobar.jpg|{{echo|ho}}
19177 </gallery>
19178 !! html/php
19179 <ul class="gallery mw-gallery-traditional">
19180 <li class='gallerycaption'>{{echo|hi}}</li>
19181 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19182 <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>
19183 <div class="gallerytext">
19184 <p>ho
19185 </p>
19186 </div>
19187 </div></li>
19188 </ul>
19189
19190 !! html/parsoid
19191 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19192 <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>
19193 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span 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>
19194 </ul>
19195 !! end
19196
19197 !! test
19198 Gallery with wikitext inside caption
19199 !! options
19200 parsoid={
19201 "nativeGallery": true
19202 }
19203 !! wikitext
19204 <gallery>
19205 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19206 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19207 </gallery>
19208 !! html/php
19209 <ul class="gallery mw-gallery-traditional">
19210 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19211 <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>
19212 <div class="gallerytext">
19213 <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>
19214 </p>
19215 </div>
19216 </div></li>
19217 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19218 <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>
19219 <div class="gallerytext">
19220 <p>This is a test template
19221 </p>
19222 </div>
19223 </div></li>
19224 </ul>
19225
19226 !! html/parsoid
19227 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19228 <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>
19229 <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>
19230 </ul>
19231 !! end
19232
19233 !! test
19234 Gallery (with showfilename option)
19235 !! options
19236 parsoid={
19237 "nativeGallery": true
19238 }
19239 !! wikitext
19240 <gallery showfilename="">
19241 File:Nonexistent.jpg|caption
19242 File:Nonexistent.jpg
19243 File:Foobar.jpg|some '''caption''' [[Main Page]]
19244 File:Foobar.jpg
19245 </gallery>
19246 !! html/php
19247 <ul class="gallery mw-gallery-traditional">
19248 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19249 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19250 <div class="gallerytext">
19251 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19252 caption
19253 </p>
19254 </div>
19255 </div></li>
19256 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19257 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19258 <div class="gallerytext">
19259 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19260 </p>
19261 </div>
19262 </div></li>
19263 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19264 <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>
19265 <div class="gallerytext">
19266 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19267 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19268 </p>
19269 </div>
19270 </div></li>
19271 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19272 <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>
19273 <div class="gallerytext">
19274 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19275 </p>
19276 </div>
19277 </div></li>
19278 </ul>
19279
19280 !! html/parsoid
19281 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
19282 <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>
19283 <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>
19284 <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>
19285 <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>
19286 </ul>
19287 !! end
19288
19289 ## Should Parsoid be preserving these variations?
19290 !! test
19291 Gallery (with namespace-less filenames)
19292 !! options
19293 parsoid={
19294 "modes": ["wt2html", "html2html"],
19295 "nativeGallery": true
19296 }
19297 !! wikitext
19298 <gallery>
19299 File:Nonexistent.jpg
19300 Nonexistent.jpg
19301 image:foobar.jpg
19302 foobar.jpg
19303 </gallery>
19304 !! html/php
19305 <ul class="gallery mw-gallery-traditional">
19306 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19307 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19308 <div class="gallerytext">
19309 </div>
19310 </div></li>
19311 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19312 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19313 <div class="gallerytext">
19314 </div>
19315 </div></li>
19316 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19317 <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>
19318 <div class="gallerytext">
19319 </div>
19320 </div></li>
19321 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19322 <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>
19323 <div class="gallerytext">
19324 </div>
19325 </div></li>
19326 </ul>
19327
19328 !! html/parsoid
19329 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19330 <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>
19331 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">Nonexistent.jpg</span></div><div class="gallerytext"></div></li>
19332 <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>
19333 <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>
19334 </ul>
19335 !! end
19336
19337 !! test
19338 Gallery override link with WikiLink (T36852)
19339 !! options
19340 parsoid={
19341 "nativeGallery": true
19342 }
19343 !! wikitext
19344 <gallery>
19345 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
19346 </gallery>
19347 !! html/php
19348 <ul class="gallery mw-gallery-traditional">
19349 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19350 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
19351 <div class="gallerytext">
19352 </div>
19353 </div></li>
19354 </ul>
19355
19356 !! html/parsoid
19357 <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":{}}'>
19358 <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>
19359 </ul>
19360 !! end
19361
19362 !! test
19363 Gallery override link with absolute external link (T36852)
19364 !! options
19365 parsoid={
19366 "nativeGallery": true
19367 }
19368 !! wikitext
19369 <gallery>
19370 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
19371 </gallery>
19372 !! html/php
19373 <ul class="gallery mw-gallery-traditional">
19374 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19375 <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>
19376 <div class="gallerytext">
19377 </div>
19378 </div></li>
19379 </ul>
19380
19381 !! html/parsoid
19382 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19383 <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>
19384 </ul>
19385 !! end
19386
19387 !! test
19388 Gallery override link with malicious javascript (T36852)
19389 !! options
19390 parsoid={
19391 "modes": ["wt2html", "html2html"],
19392 "nativeGallery": true
19393 }
19394 !! wikitext
19395 <gallery>
19396 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19397 </gallery>
19398 !! html/php
19399 <ul class="gallery mw-gallery-traditional">
19400 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19401 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%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>
19402 <div class="gallerytext">
19403 </div>
19404 </div></li>
19405 </ul>
19406
19407 !! html/parsoid
19408 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19409 <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="./&quot;_onclick=&quot;alert('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>
19410 </ul>
19411 !! end
19412
19413 !! test
19414 Gallery with invalid title as link (T45964)
19415 !! options
19416 parsoid={
19417 "modes": ["wt2html", "html2html"],
19418 "nativeGallery": true
19419 }
19420 !! wikitext
19421 <gallery>
19422 File:Foobar.jpg|link=<
19423 </gallery>
19424 !! html/php
19425 <ul class="gallery mw-gallery-traditional">
19426 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19427 <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>
19428 <div class="gallerytext">
19429 </div>
19430 </div></li>
19431 </ul>
19432
19433 !! html/parsoid
19434 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19435 <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>
19436 </ul>
19437 !! end
19438
19439 !! test
19440 HTML Hex character encoding (spells the word "JavaScript")
19441 !! options
19442 parsoid=wt2html,wt2wt,html2html
19443 !! wikitext
19444 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19445 !! html/php
19446 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19447 </p>
19448 !! html/php+tidy
19449 <p>JavaScript</p>
19450 !! html/parsoid
19451 <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>
19452 !! end
19453
19454 !! test
19455 HTML Hex character encoding bogus encoding (bug 26437 regression check)
19456 !! wikitext
19457 &#xsee;&#XSEE;
19458 !! html/php
19459 <p>&amp;#xsee;&amp;#XSEE;
19460 </p>
19461 !! html/parsoid
19462 <p>&amp;#xsee;&amp;#XSEE;</p>
19463 !! end
19464
19465 !! test
19466 HTML Hex character encoding mixed case
19467 !! options
19468 parsoid=wt2html,wt2wt,html2html
19469 !! wikitext
19470 &#xEE;&#Xee;
19471 !! html/php
19472 <p>&#xee;&#xee;
19473 </p>
19474 !! html/php+tidy
19475 <p>îî</p>
19476 !! html/parsoid
19477 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19478 !! end
19479
19480 # See: https://www.w3.org/TR/html5/syntax.html#character-references
19481 # Note that U+000C (form feed) is not a valid XML character, so
19482 # it is banned even though allowed in HTML5.
19483 !! test
19484 Illegal character references (T106578)
19485 !! wikitext
19486 ; Null: &#00;
19487 ; FF: &#xC;
19488 ; CR: &#xD;
19489 ; Control (low): &#8;
19490 ; Control (high): &#x7F; &#x9F;
19491 ; Surrogate: &#xD83D;&#xDCA9;
19492 ; This is an okay astral character: &#x1F4A9;
19493 !! html+tidy
19494 <dl>
19495 <dt>Null</dt>
19496 <dd>&amp;#00;</dd>
19497 <dt>FF</dt>
19498 <dd>&amp;#xC;</dd>
19499 <dt>CR</dt>
19500 <dd>&amp;#xD;</dd>
19501 <dt>Control (low)</dt>
19502 <dd>&amp;#8;</dd>
19503 <dt>Control (high)</dt>
19504 <dd>&amp;#x7F; &amp;#x9F;</dd>
19505 <dt>Surrogate</dt>
19506 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19507 <dt>This is an okay astral character</dt>
19508 <dd>💩</dd>
19509 </dl>
19510 !! end
19511
19512 !! test
19513 __FORCETOC__ override
19514 !! wikitext
19515 __NEWSECTIONLINK__
19516 __FORCETOC__
19517 !! html/php
19518 <p><br />
19519 </p>
19520 !! end
19521
19522 !! test
19523 ISBN code coverage
19524 !! wikitext
19525 ISBN 978-0-1234-56&#x20;789
19526 !! html
19527 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19528 </p>
19529 !! html+tidy
19530 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19531 !! html/parsoid
19532 <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>
19533 !! end
19534
19535 !! test
19536 ISBN followed by 5 spaces
19537 !! wikitext
19538 ISBN
19539 !! html
19540 <p>ISBN
19541 </p>
19542 !! end
19543
19544 !! test
19545 Double ISBN
19546 !! wikitext
19547 ISBN ISBN 1234567890
19548 !! html/php
19549 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19550 </p>
19551 !! html/parsoid
19552 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19553 !! end
19554
19555 # Uppercase X and lowercase x as well
19556 !! test
19557 ISBN with an X
19558 !! wikitext
19559 ISBN 3-462-04561-X
19560 ISBN 3-462-04561-x
19561 ISBN 080442957X
19562 ISBN 080442957x
19563 ISBN 978080442957X
19564 ISBN 978080442957x
19565 !! html/php
19566 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19567 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19568 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19569 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19570 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19571 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19572 </p>
19573 !! html/parsoid
19574 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19575 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19576 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19577 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19578 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19579 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19580 !! end
19581
19582 !! test
19583 ISBN with empty prefix (parsoid test)
19584 !! wikitext
19585 ISBN 1234567890
19586 !! html/php
19587 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19588 </p>
19589 !! html/parsoid
19590 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19591 !! end
19592
19593 !! test
19594 Bug 22905: <abbr> followed by ISBN followed by </a>
19595 !! wikitext
19596 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19597 !! html/php
19598 <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>
19599 </p>
19600 !! html/parsoid
19601 <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>
19602 !! end
19603
19604 !! test
19605 Double RFC
19606 !! wikitext
19607 RFC RFC 1234
19608 !! html
19609 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19610 </p>
19611 !! end
19612
19613 !! test
19614 Double RFC with a wiki link
19615 !! wikitext
19616 RFC [[RFC 1234]]
19617 !! html
19618 <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>
19619 </p>
19620 !! end
19621
19622 !! test
19623 RFC code coverage
19624 !! wikitext
19625 RFC 983&#x20;987
19626 !! html
19627 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19628 </p>
19629 !! html+tidy
19630 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19631 !! end
19632
19633 !! test
19634 Centre-aligned image
19635 !! wikitext
19636 [[Image:foobar.jpg|centre]]
19637 !! html
19638 <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>
19639
19640 !!end
19641
19642 !! test
19643 None-aligned image
19644 !! wikitext
19645 [[Image:foobar.jpg|none]]
19646 !! html
19647 <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>
19648
19649 !!end
19650
19651 !! test
19652 Width + Height sized image (using px) (height is ignored)
19653 !! wikitext
19654 [[Image:foobar.jpg|640x480px]]
19655 !! html
19656 <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>
19657 </p>
19658 !!end
19659
19660 !! test
19661 Width-sized image (using px, no following whitespace)
19662 !! wikitext
19663 [[Image:foobar.jpg|640px]]
19664 !! html
19665 <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>
19666 </p>
19667 !!end
19668
19669 !! test
19670 Width-sized image (using px, with following whitespace - test regression from r39467)
19671 !! wikitext
19672 [[Image:foobar.jpg|640px ]]
19673 !! html
19674 <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>
19675 </p>
19676 !!end
19677
19678 !! test
19679 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19680 !! wikitext
19681 [[Image:foobar.jpg| 640px]]
19682 !! html
19683 <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>
19684 </p>
19685 !!end
19686
19687 !! test
19688 Image with page parameter
19689 !! options
19690 djvu
19691 !! wikitext
19692 [[File:LoremIpsum.djvu|page=2]]
19693 !! html/php
19694 <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>
19695 </p>
19696 !! html/parsoid
19697 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"page","ak":"page=2"}]}'><a href="./File:LoremIpsum.djvu" data-parsoid='{"a":{"href":"./File:LoremIpsum.djvu"},"sa":{}}'><img resource="./File:LoremIpsum.djvu" src="//example.com/images/5/5f/LoremIpsum.djvu" data-file-width="2480" data-file-height="3508" data-file-type="bitmap" height="3508" width="2480" data-parsoid='{"a":{"resource":"./File:LoremIpsum.djvu","height":"3508","width":"2480"},"sa":{"resource":"File:LoremIpsum.djvu"}}'/></a></span></p>
19698 !! end
19699
19700 !! test
19701 Another italics / bold test
19702 !! wikitext
19703 ''' ''x'
19704 !! html
19705 <pre>'<i> </i>x'
19706 </pre>
19707 !!end
19708
19709 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19710 !! test
19711 dt/dd/dl test
19712 !! wikitext
19713 :;;;::
19714 !! html/php
19715 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19716
19717 !! html/parsoid
19718 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19719
19720 !!end
19721
19722
19723 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19724 !! test
19725 Images with the "|" character in the comment
19726 !! wikitext
19727 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19728 !! html/php
19729 <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>
19730
19731 !! html/parsoid
19732 <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=|left|&amp;param2=|x">external</a> URL</figcaption></figure>
19733 !! end
19734
19735 !! test
19736 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19737 !! wikitext
19738 <html><script>alert(1);</script></html>
19739 !! html
19740 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19741 </p>
19742 !! end
19743
19744 !! test
19745 HTML with raw HTML ($wgRawHtml==true)
19746 !! options
19747 wgRawHtml=1
19748 !! wikitext
19749 <html><script>alert(1);</script></html>
19750 !! html
19751 <p><script>alert(1);</script>
19752 </p>
19753 !! end
19754
19755 !! test
19756 Parents of subpages, one level up
19757 !! options
19758 subpage title=[[Subpage test/L1/L2/L3]]
19759 !! wikitext
19760 [[../|L2]]
19761 !! html
19762 <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>
19763 </p>
19764 !! end
19765
19766
19767 !! test
19768 Parents of subpages, one level up, not named
19769 !! options
19770 subpage title=[[Subpage test/L1/L2/L3]]
19771 !! wikitext
19772 [[../]]
19773 !! html
19774 <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>
19775 </p>
19776 !! end
19777
19778
19779
19780 !! test
19781 Parents of subpages, two levels up
19782 !! options
19783 subpage title=[[Subpage test/L1/L2/L3]]
19784 !! wikitext
19785 [[../../|L1]]2
19786
19787 [[../../|L1]]l
19788 !! html
19789 <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
19790 </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>
19791 </p>
19792 !! end
19793
19794 !! test
19795 Parents of subpages, two levels up, without trailing slash or name.
19796 !! options
19797 subpage title=[[Subpage test/L1/L2/L3]]
19798 !! wikitext
19799 [[../..]]
19800 !! html
19801 <p>[[../..]]
19802 </p>
19803 !! end
19804
19805 !! test
19806 Parents of subpages, two levels up, with lots of extra trailing slashes.
19807 !! options
19808 subpage title=[[Subpage test/L1/L2/L3]]
19809 !! wikitext
19810 [[../../////]]
19811 !! html
19812 <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>
19813 </p>
19814 !! end
19815
19816 !! article
19817 Subpage test/L1/L2/L3Sibling
19818 !! text
19819 Sibling article
19820 !! endarticle
19821
19822 !! test
19823 Transclusion of a sibling page (one level up)
19824 !! options
19825 subpage title=[[Subpage test/L1/L2/L3]]
19826 !! wikitext
19827 {{../L3Sibling}}
19828 !! html
19829 <p>Sibling article
19830 </p>
19831 !! end
19832
19833 !! test
19834 Transclusion of a child page
19835 !! options
19836 subpage title=[[Subpage test/L1/L2]]
19837 !! wikitext
19838 {{/L3Sibling}}
19839 !! html
19840 <p>Sibling article
19841 </p>
19842 !! end
19843
19844 # This is wt2html only in Parsoid because we add <nowiki>
19845 # because of {{..}} and we don't expect to fix that to
19846 # eliminate the nowikis selective for {{..}} markup.
19847 !! test
19848 Non-transclusion because of too many up levels
19849 !! options
19850 subpage title=[[Subpage test/L1/L2/L3]]
19851 parsoid=wt2html
19852 !! wikitext
19853 {{../../../../More than parent}}
19854 !! html/php
19855 <p>{{../../../../More than parent}}
19856 </p>
19857 !! html/parsoid
19858 <p>{{../../../../More than parent}}</p>
19859 !! end
19860
19861 !! test
19862 Definition list code coverage
19863 !! wikitext
19864 ; title : def
19865 ; title : def
19866 ;title: def
19867 !! html/php
19868 <dl><dt> title &#160;</dt>
19869 <dd> def</dd>
19870 <dt> title&#160;</dt>
19871 <dd> def</dd>
19872 <dt>title</dt>
19873 <dd> def</dd></dl>
19874
19875 !! html/parsoid
19876 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19877 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19878 <dt>title</dt><dd> def</dd></dl>
19879 !! end
19880
19881 !! test
19882 Don't fall for the self-closing div
19883 !! wikitext
19884 <div>hello world</div/>
19885 !! html
19886 <div>hello world</div>
19887
19888 !! end
19889
19890 !! test
19891 MSGNW magic word
19892 !! wikitext
19893 {{MSGNW:msg}}
19894 !! html/php
19895 <p>&#91;&#91;:Template:Msg&#93;&#93;
19896 </p>
19897 !! end
19898
19899 !! test
19900 RAW magic word
19901 !! wikitext
19902 {{RAW:QUERTY}}
19903 !! html
19904 <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>
19905 </p>
19906 !! end
19907
19908 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19909 !! test
19910 Always escape literal '>' in output, not just after '<'
19911 !! wikitext
19912 ><>
19913 !! html
19914 <p>&gt;&lt;&gt;
19915 </p>
19916 !! end
19917
19918 !! test
19919 Template caching
19920 !! wikitext
19921 {{Test}}
19922 {{Test}}
19923 !! html
19924 <p>This is a test template
19925 This is a test template
19926 </p>
19927 !! end
19928
19929
19930 !! article
19931 MediaWiki:Fake
19932 !! text
19933 ==header==
19934 !! endarticle
19935
19936 !! test
19937 Inclusion of !userCanEdit() content
19938 !! wikitext
19939 {{MediaWiki:Fake}}
19940 !! html
19941 <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>
19942
19943 !! end
19944
19945
19946 !! test
19947 Out-of-order TOC heading levels
19948 !! wikitext
19949 ==2==
19950 ======6======
19951 ===3===
19952 =1=
19953 =====5=====
19954 ==2==
19955 !! html
19956 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19957 <ul>
19958 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19959 <ul>
19960 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19961 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19962 </ul>
19963 </li>
19964 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19965 <ul>
19966 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19967 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19968 </ul>
19969 </li>
19970 </ul>
19971 </div>
19972
19973 <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>
19974 <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>
19975 <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>
19976 <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>
19977 <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>
19978 <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>
19979
19980 !! end
19981
19982
19983 !! test
19984 ISBN with a dummy number
19985 !! wikitext
19986 ISBN ---
19987 !! html
19988 <p>ISBN ---
19989 </p>
19990 !! end
19991
19992
19993 !! test
19994 ISBN with space-delimited number
19995 !! wikitext
19996 ISBN 92 9017 032 8
19997 !! html
19998 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19999 </p>
20000 !! end
20001
20002
20003 !! test
20004 ISBN with multiple spaces, no number
20005 !! wikitext
20006 ISBN foo
20007 !! html
20008 <p>ISBN foo
20009 </p>
20010 !! end
20011
20012
20013 !! test
20014 ISBN length
20015 !! wikitext
20016 ISBN 123456789
20017
20018 ISBN 1234567890
20019
20020 ISBN 12345678901
20021 !! html
20022 <p>ISBN 123456789
20023 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20024 </p><p>ISBN 12345678901
20025 </p>
20026 !! end
20027
20028
20029 !! test
20030 ISBN with trailing year (bug 8110)
20031 !! wikitext
20032 ISBN 1-234-56789-0 - 2006
20033
20034 ISBN 1 234 56789 0 - 2006
20035 !! html
20036 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
20037 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20038 </p>
20039 !! end
20040
20041
20042 !! test
20043 anchorencode
20044 !! wikitext
20045 {{anchorencode:foo bar©#%n}}
20046 !! html
20047 <p>foo_bar.C2.A9.23.25n
20048 </p>
20049 !! end
20050
20051 !! test
20052 anchorencode trims spaces
20053 !! wikitext
20054 {{anchorencode: __pretty__please__}}
20055 !! html
20056 <p>pretty_please
20057 </p>
20058 !! end
20059
20060 !! test
20061 anchorencode deals with links
20062 !! wikitext
20063 {{anchorencode: [[hello|world]] [[hi]]}}
20064 !! html
20065 <p>world_hi
20066 </p>
20067 !! end
20068
20069 !! test
20070 anchorencode deals with templates
20071 !! wikitext
20072 {{anchorencode: {{Foo}} }}
20073 !! html
20074 <p>FOO
20075 </p>
20076 !! end
20077
20078 !! test
20079 anchorencode encodes like the TOC generator: (bug 18431)
20080 !! wikitext
20081 === _ +:.3A%3A&&amp;]] ===
20082 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20083 __NOEDITSECTION__
20084 !! html
20085 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20086 <p>.2B:.3A.253A.26.26.5D.5D
20087 </p>
20088 !! end
20089
20090 !! test
20091 Bug 6200: blockquotes and paragraph formatting
20092 !! wikitext
20093 <blockquote>
20094 foo
20095 </blockquote>
20096
20097 bar
20098
20099 baz
20100 !! html
20101 <blockquote>
20102 <p>foo
20103 </p>
20104 </blockquote>
20105 <p>bar
20106 </p>
20107 <pre>baz
20108 </pre>
20109 !! end
20110
20111 !! test
20112 Bug 8293: Use of center tag ruins paragraph formatting
20113 !! wikitext
20114 <center>
20115 foo
20116 </center>
20117
20118 bar
20119
20120 baz
20121 !! html
20122 <center>
20123 <p>foo
20124 </p>
20125 </center>
20126 <p>bar
20127 </p>
20128 <pre>baz
20129 </pre>
20130 !! end
20131
20132 !!test
20133 Parsing of overlapping (improperly nested) inline html tags
20134 !! wikitext
20135 <span><s>x</span></s>
20136 !! html/php
20137 <p><span><s>x&lt;/span&gt;</s></span>
20138 </p>
20139 !! html/parsoid
20140 <p><span><s>x</s></span>
20141 </p>
20142 !!end
20143
20144 ###
20145 ### Language variants related tests
20146 ###
20147 !! test
20148 Self-link in language variants
20149 !! options
20150 title=[[Dunav]] language=sr
20151 !! wikitext
20152 Both [[Dunav]] and [[Дунав]] are names for this river.
20153 !! html
20154 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
20155 </p>
20156 !!end
20157
20158 !! article
20159 Дуна
20160 !! text
20161 content
20162 !! endarticle
20163
20164 !! test
20165 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
20166 !! options
20167 title=[[Duna]] language=sr
20168 !! wikitext
20169 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
20170 !! html
20171 <p><a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Дуна</a> is not a self-link while <strong class="selflink">Duna</strong> and <strong class="selflink">Dуна</strong> are still self-links.
20172 </p>
20173 !! end
20174
20175 !! test
20176 Link to a section of a variant of this title shouldn't be parsed as self-link
20177 !! options
20178 title=[[Duna]] language=sr
20179 !! wikitext
20180 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
20181 !! html
20182 <p><strong class="selflink">Dуна</strong> is a self-link while <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dunа#Foo</a> and <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dуна#Foo</a> are not self-links.
20183 </p>
20184 !! end
20185
20186 !! test
20187 Link to pages in language variants
20188 !! options
20189 language=sr
20190 !! wikitext
20191 Main Page can be written as [[Маин Паге]]
20192 !! html
20193 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
20194 </p>
20195 !!end
20196
20197
20198 !! test
20199 Multiple links to pages in language variants
20200 !! options
20201 language=sr
20202 !! wikitext
20203 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
20204 !! html
20205 <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>.
20206 </p>
20207 !!end
20208
20209
20210 !! test
20211 Simple template in language variants
20212 !! options
20213 language=sr
20214 !! wikitext
20215 {{тест}}
20216 !! html
20217 <p>This is a test template
20218 </p>
20219 !! end
20220
20221
20222 !! test
20223 Template with explicit namespace in language variants
20224 !! options
20225 language=sr
20226 !! wikitext
20227 {{Template:тест}}
20228 !! html
20229 <p>This is a test template
20230 </p>
20231 !! end
20232
20233
20234 !! test
20235 Basic test for template parameter in language variants
20236 !! options
20237 language=sr
20238 !! wikitext
20239 {{парамтест|param=foo}}
20240 !! html
20241 <p>This is a test template with parameter foo
20242 </p>
20243 !! end
20244
20245 !! test
20246 Simple category in language variants
20247 !! options
20248 language=sr cat
20249 !! wikitext
20250 [[Category:МедиаWики Усер'с Гуиде]]
20251 !! html/php
20252 cat=МедиаWики_Усер'с_Гуиде sort=
20253 !! html/parsoid
20254 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
20255 !! end
20256
20257 !! article
20258 Category:分类
20259 !! text
20260 blah
20261 !! endarticle
20262
20263 !! article
20264 Category:分類
20265 !! text
20266 blah
20267 !! endarticle
20268
20269 ## We used to, but no longer wt2wt this test since the default serializer
20270 ## will normalize all categories to serialize on their own line.
20271 ## This wikitext usage is going to be fairly uncommon in production and
20272 ## selser will take care of preserving formatting in those scenarios.
20273 !! test
20274 Don't convert blue categorylinks to another variant (bug 33210)
20275 !! options
20276 cat
20277 language=zh
20278 parsoid=wt2html
20279 !! wikitext
20280 [[A]][[Category:分类]]
20281 !! html/php
20282 cat=分类 sort=
20283 !! html/parsoid
20284 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
20285 <link rel="mw:PageProp/Category" href="Category:分类"/>
20286 !! end
20287
20288 !! test
20289 Stripping -{}- tags (language variants)
20290 !! options
20291 language=sr
20292 !! wikitext
20293 Latin proverb: -{Ne nuntium necare}-
20294 !! html
20295 <p>Latin proverb: Ne nuntium necare
20296 </p>
20297 !! end
20298
20299
20300 !! test
20301 Prevent conversion with -{}- tags (language variants)
20302 !! options
20303 language=sr variant=sr-ec
20304 !! wikitext
20305 Latinski: -{Ne nuntium necare}-
20306 !! html
20307 <p>Латински: Ne nuntium necare
20308 </p>
20309 !! end
20310
20311
20312 !! test
20313 Prevent conversion of text with -{}- tags (language variants)
20314 !! options
20315 language=sr variant=sr-ec
20316 !! wikitext
20317 Latinski: -{Ne nuntium necare}-
20318 !! html
20319 <p>Латински: Ne nuntium necare
20320 </p>
20321 !! end
20322
20323
20324 !! test
20325 Prevent conversion of links with -{}- tags (language variants)
20326 !! options
20327 language=sr variant=sr-ec
20328 !! wikitext
20329 -{[[Main Page]]}-
20330 !! html
20331 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20332 </p>
20333 !! end
20334
20335
20336 !! test
20337 -{}- tags within headlines (within html for parserConvert())
20338 !! options
20339 language=sr variant=sr-ec
20340 !! wikitext
20341 == -{Naslov}- ==
20342 !! html
20343 <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>
20344
20345 !! end
20346
20347
20348 !! test
20349 Explicit definition of language variant alternatives
20350 !! options
20351 language=zh variant=zh-tw
20352 !! wikitext
20353 -{zh:China;zh-tw:Taiwan}-, not China
20354 !! html
20355 <p>Taiwan, not China
20356 </p>
20357 !! end
20358
20359
20360 !! test
20361 Conversion around HTML tags
20362 !! options
20363 language=sr variant=sr-ec
20364 !! wikitext
20365 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
20366 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
20367 !! html
20368 <p>
20369 <span title="ЛаCтин">ски</span>
20370 </p>
20371 !! end
20372
20373
20374 !! test
20375 Explicit session-wise language variant mapping (A flag and - flag)
20376 !! options
20377 language=zh variant=zh-tw
20378 !! wikitext
20379 Taiwan is not China.
20380 But -{A|zh:China;zh-tw:Taiwan}- is China,
20381 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20382 and -{China}- is China.
20383 !! html
20384 <p>Taiwan is not China.
20385 But Taiwan is Taiwan,
20386 (This should be stripped!)
20387 and China is China.
20388 </p>
20389 !! end
20390
20391 !! test
20392 Explicit session-wise language variant mapping (H flag for hide)
20393 !! options
20394 language=zh variant=zh-tw
20395 !! wikitext
20396 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20397 Taiwan is China.
20398 !! html
20399 <p>(This should be stripped!)
20400 Taiwan is Taiwan.
20401 </p>
20402 !! end
20403
20404 !! test
20405 Adding explicit conversion rule for title (T flag)
20406 !! options
20407 language=zh variant=zh-tw showtitle
20408 !! wikitext
20409 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20410 !! html
20411 Taiwan
20412 <p>Should be stripped!
20413 </p>
20414 !! end
20415
20416 !! test
20417 Testing that changing the language variant here in the tests actually works
20418 !! options
20419 language=zh variant=zh showtitle
20420 !! wikitext
20421 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20422 !! html
20423 China
20424 <p>Should be stripped!
20425 </p>
20426 !! end
20427
20428 !! test
20429 Recursive conversion of alt and title attrs shouldn't clear converter state
20430 !! options
20431 language=zh variant=zh-cn showtitle
20432 !! wikitext
20433 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20434 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20435 !! html
20436 China
20437 <p>
20438 Should be stripped<span title="Exclamation">!</span>
20439 </p>
20440 !! end
20441
20442 !! test
20443 Bug 24072: more test on conversion rule for title
20444 !! options
20445 language=zh variant=zh-tw showtitle
20446 !! wikitext
20447 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20448 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20449 !! html
20450 Taiwan
20451 <p>This should be stripped!
20452 This won't take interferes with the title rule.
20453 </p>
20454 !! end
20455
20456 !! test
20457 Partly disable title conversion if variant == main language code
20458 !! options
20459 language=zh variant=zh title=[[ZH]] showtitle
20460 !! wikitext
20461 -{T|zh-cn:CN;zh-tw:TW}-
20462 !! html
20463 ZH
20464 <p>
20465 </p>
20466 !! end
20467
20468 !! test
20469 Partly disable title conversion if variant == main language code, more
20470 !! options
20471 language=zh variant=zh title=[[ZH]] showtitle
20472 !! wikitext
20473 -{T|TW}-
20474 !! html
20475 ZH
20476 <p>
20477 </p>
20478 !! end
20479
20480 !! test
20481 Raw output of variant escape tags (R flag)
20482 !! options
20483 language=zh variant=zh-tw
20484 !! wikitext
20485 Raw: -{R|zh:China;zh-tw:Taiwan}-
20486 !! html
20487 <p>Raw: zh:China;zh-tw:Taiwan
20488 </p>
20489 !! end
20490
20491 !! test
20492 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20493 !! options
20494 language=zh variant=zh-cn
20495 !! input
20496 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20497 !! result
20498 <p>0
20499 </p>
20500 !! end
20501
20502 !! test
20503 Conversion rules from [numeric-only string] to [something else] (T48634)
20504 !! options
20505 language=zh variant=zh-cn
20506 !! input
20507 -{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
20508 !! result
20509 <p>D12345EE12345
20510 </p>
20511 !! end
20512
20513 !! test
20514 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20515 !! options
20516 language=zh variant=zh-cn
20517 !! input
20518 -{H|zh-cn:foo;zh-tw:;}-foobar
20519 !! result
20520 <p>foobar
20521 </p>
20522 !! end
20523
20524 !! test
20525 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20526 !! options
20527 language=zh variant=zh-cn
20528 !! input
20529 -{H|=>zh-cn:foo;}-foobar
20530 !! result
20531 <p>foobar
20532 </p>
20533 !! end
20534
20535 !! test
20536 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20537 !! options
20538 language=zh variant=zh-cn
20539 !! input
20540 -{H|}-foobar
20541 !! result
20542 <p>foobar
20543 </p>
20544 !! end
20545
20546 !! test
20547 Nested using of manual convert syntax
20548 !! options
20549 language=zh variant=zh-hk
20550 !! wikitext
20551 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20552 !! html
20553 <p>Nested: Hello Hong Kong!
20554 </p>
20555 !! end
20556
20557 # Since Parsoid is starting to emit canonical wikitext for links,
20558 # [http://example.com http://example.com] will not RT back to that
20559 # form anymore.
20560 !! test
20561 Proper conversion of text in external links
20562 !! options
20563 language=sr variant=sr-ec
20564 parsoid=wt2html
20565 !! wikitext
20566 http://www.google.com
20567 gopher://www.google.com
20568 [http://www.google.com http://www.google.com]
20569 [gopher://www.google.com gopher://www.google.com]
20570 [https://www.google.com irc://www.google.com]
20571 [ftp://www.google.com www.google.com/ftp://dir]
20572 [//www.google.com www.google.com]
20573 !! html/php
20574 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20575 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20576 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20577 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20578 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20579 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20580 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20581 </p>
20582 !! html/parsoid
20583 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20584 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20585 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20586 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20587 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20588 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20589 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20590 !! end
20591
20592 !! test
20593 Do not convert roman numbers to language variants
20594 !! options
20595 language=sr variant=sr-ec
20596 !! wikitext
20597 Fridrih IV je car.
20598 !! html
20599 <p>Фридрих IV је цар.
20600 </p>
20601 !! end
20602
20603 !! test
20604 Unclosed language converter markup "-{"
20605 !! options
20606 language=sr
20607 !! wikitext
20608 -{T|hello
20609 !! html
20610 <p>-{T|hello
20611 </p>
20612 !! end
20613
20614 !! test
20615 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20616 !! options
20617 language=sr
20618 !! wikitext
20619 -{R|=&gt;}-
20620 !! html
20621 <p>=&gt;
20622 </p>
20623 !!end
20624
20625 !! test
20626 Don't break link parsing if language converter markup is in the caption.
20627 !! options
20628 language=sr variant=sr-ec
20629 !! wikitext
20630 [[Main Page|-{R|main page}-]]
20631 !! html
20632 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20633 </p>
20634 !! end
20635
20636 !! test
20637 T146304: Don't break template parsing if language converter markup is in the parameter.
20638 !! options
20639 language=sr variant=sr-ec
20640 !! wikitext
20641 {{echo|-{R|foo}-}}
20642 !! html/php
20643 <p>foo
20644 </p>
20645 !! end
20646
20647 !! test
20648 T146305: Don't break image parsing if language converter markup is in the caption.
20649 !! options
20650 language=sr
20651 !! wikitext
20652 [[File:Foobar.jpg|thumb|-{R|caption:}-]]
20653 !! html/php
20654 <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>
20655
20656 !! html/parsoid
20657 <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>
20658 !! end
20659
20660 !! test
20661 T146305: Don't break image parsing if nested language converter markup is in the caption.
20662 !! options
20663 language=zh variant=zh-cn
20664 !! wikitext
20665 [[File:Foobar.jpg|thumb|-{zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
20666 !! html/php
20667 <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>
20668
20669 !! html/parsoid
20670 <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>
20671 !! end
20672
20673 !! test
20674 Don't break gallery if language converter markup is inside.
20675 !! options
20676 language=zh
20677 !! wikitext
20678 <gallery>
20679 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
20680 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
20681 </gallery>
20682 !! html
20683 <ul class="gallery mw-gallery-traditional">
20684 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20685 <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>
20686 <div class="gallerytext">
20687 <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>
20688 </p>
20689 </div>
20690 </div></li>
20691 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20692 <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>
20693 <div class="gallerytext">
20694 <p>This is a test template
20695 </p>
20696 </div>
20697 </div></li>
20698 </ul>
20699
20700 !! end
20701
20702 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20703 !! test
20704 Don't break list handling if language converter markup is in the item.
20705 !! options
20706 language=zh variant=zh-cn
20707 !! wikitext
20708 ;-{zh-cn:AAA;zh-tw:BBB}-
20709 !! html/php
20710 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20711
20712 !! html/parsoid
20713 <dl><dt>AAA
20714 </dt></dl>
20715 !! end
20716
20717 !! test
20718 T153140: Don't break table handling if language converter markup is in the cell.
20719 !! options
20720 language=sr variant=sr-ec
20721 !! wikitext
20722 {|
20723 |-
20724 | -{R|B}-
20725 |}
20726 !! html/php
20727 <table>
20728
20729 <tr>
20730 <td> B
20731 </td></tr></table>
20732
20733 !! html/parsoid
20734 <table>
20735
20736 <tr>
20737 <td> B
20738 </td></tr></table>
20739
20740 !! end
20741
20742 !! test
20743 Bug 529: Uncovered bullet
20744 !! wikitext
20745 * Foo {{bullet}}
20746 !! html
20747 <ul><li> Foo </li>
20748 <li> Bar</li></ul>
20749
20750 !! end
20751
20752 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20753 # Templates in Wikipedia rely on this behavior, as tidy has always been
20754 # enabled there. These tests are normally run *without* tidy, so specify the
20755 # full output here.
20756 # To test realistic parsing behavior, apply a tidy-like transformation to both
20757 # the expected output and your parser's output.
20758 !! test
20759 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20760 !! wikitext
20761 ******* Foo {{bullet}}
20762 !! html
20763 <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>
20764 <li> Bar</li></ul>
20765
20766 !! end
20767
20768 !! test
20769 Bug 529: Uncovered table already at line-start
20770 !! wikitext
20771 x
20772
20773 {{table}}
20774 y
20775 !! html
20776 <p>x
20777 </p>
20778 <table>
20779 <tr>
20780 <td> 1 </td>
20781 <td> 2
20782 </td></tr>
20783 <tr>
20784 <td> 3 </td>
20785 <td> 4
20786 </td></tr></table>
20787 <p>y
20788 </p>
20789 !! end
20790
20791 !! test
20792 Bug 529: Uncovered bullet in parser function result
20793 !! wikitext
20794 * Foo {{lc:{{bullet}} }}
20795 !! html
20796 <ul><li> Foo </li>
20797 <li> bar</li></ul>
20798
20799 !! end
20800
20801 !! test
20802 Bug 5678: Double-parsed template argument
20803 !! wikitext
20804 {{lc:{{{1}}}|hello}}
20805 !! html
20806 <p>{{{1}}}
20807 </p>
20808 !! end
20809
20810 !! test
20811 Bug 5678: Double-parsed template invocation
20812 !! wikitext
20813 {{lc:{{paramtest {{!}} param = hello }} }}
20814 !! html
20815 <p>{{paramtest | param = hello }}
20816 </p>
20817 !! end
20818
20819 !! test
20820 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20821 !! options
20822 language=cs
20823 title=[[Main Page]]
20824 !! wikitext
20825 {{PRVNÍVELKÉ:ěščř}}
20826 {{prvnívelké:ěščř}}
20827 {{PRVNÍMALÉ:ěščř}}
20828 {{prvnímalé:ěščř}}
20829 {{MALÁ:ěščř}}
20830 {{malá:ěščř}}
20831 {{VELKÁ:ěščř}}
20832 {{velká:ěščř}}
20833 !! html
20834 <p>Ěščř
20835 Ěščř
20836 ěščř
20837 ěščř
20838 ěščř
20839 ěščř
20840 ĚŠČŘ
20841 ĚŠČŘ
20842 </p>
20843 !! end
20844
20845 !! test
20846 Morwen/13: Unclosed link followed by heading
20847 !! wikitext
20848 [[link
20849 ==heading==
20850 !! html
20851 <p>[[link
20852 </p>
20853 <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>
20854
20855 !! end
20856
20857 !! test
20858 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20859 !! wikitext
20860 {{foo|
20861 =heading=
20862 !! html
20863 <p>{{foo|
20864 </p>
20865 <h1><span class="mw-headline" id="heading">heading</span></h1>
20866
20867 !! end
20868
20869 !! test
20870 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20871 !! wikitext
20872 {{foo|
20873 ==heading==
20874 !! html
20875 <p>{{foo|
20876 </p>
20877 <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>
20878
20879 !! end
20880
20881 !! test
20882 Tildes in comments
20883 !! options
20884 pst
20885 !! wikitext
20886 <!-- ~~~~ -->
20887 !! html/php
20888 <!-- ~~~~ -->
20889 !! end
20890
20891 !! test
20892 Paragraphs inside divs (no extra line breaks)
20893 !! wikitext
20894 <div>Line one
20895
20896 Line two</div>
20897 !! html
20898 <div>Line one
20899 Line two</div>
20900
20901 !! end
20902
20903 !! test
20904 Paragraphs inside divs (extra line break on open)
20905 !! wikitext
20906 <div>
20907 Line one
20908
20909 Line two</div>
20910 !! html
20911 <div>
20912 <p>Line one
20913 </p>
20914 Line two</div>
20915
20916 !! end
20917
20918 !! test
20919 Paragraphs inside divs (extra line break on close)
20920 !! wikitext
20921 <div>Line one
20922
20923 Line two
20924 </div>
20925 !! html
20926 <div>Line one
20927 <p>Line two
20928 </p>
20929 </div>
20930
20931 !! end
20932
20933 !! test
20934 Paragraphs inside divs (extra line break on open and close)
20935 !! wikitext
20936 <div>
20937 Line one
20938
20939 Line two
20940 </div>
20941 !! html
20942 <div>
20943 <p>Line one
20944 </p><p>Line two
20945 </p>
20946 </div>
20947
20948 !! end
20949
20950 !! test
20951 Nesting tags, paragraphs on lines which begin with <div>
20952 !! wikitext
20953 <div></div><strong>A
20954 B</strong>
20955 !! html/php+tidy
20956 <p><strong>A</strong></p>
20957 <p><strong>B</strong></p>
20958 !! html/parsoid
20959 <div></div>
20960 <p><strong>A
20961 B</strong>
20962 </p>
20963 !! end
20964
20965 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20966 !! test
20967 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20968 !! wikitext
20969 <blockquote>Line one
20970
20971 Line two</blockquote>
20972 !! html
20973 <blockquote>Line one
20974 Line two</blockquote>
20975
20976 !! html+tidy
20977 <blockquote>
20978 <p>Line one Line two</p>
20979 </blockquote>
20980 !! end
20981
20982 !! test
20983 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20984 !! wikitext
20985 <blockquote>
20986 Line one
20987
20988 Line two</blockquote>
20989 !! html
20990 <blockquote>
20991 <p>Line one
20992 </p>
20993 Line two</blockquote>
20994
20995 !! html+tidy
20996 <blockquote>
20997 <p>Line one</p>
20998 Line two</blockquote>
20999 !! end
21000
21001 !! test
21002 Bug 6200: paragraphs inside blockquotes (extra line break on close)
21003 !! wikitext
21004 <blockquote>Line one
21005
21006 Line two
21007 </blockquote>
21008 !! html
21009 <blockquote>Line one
21010 <p>Line two
21011 </p>
21012 </blockquote>
21013
21014 !! html+tidy
21015 <blockquote>
21016 <p>Line one</p>
21017 <p>Line two</p>
21018 </blockquote>
21019 !! end
21020
21021 !! test
21022 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
21023 !! wikitext
21024 <blockquote>
21025 Line one
21026
21027 Line two
21028 </blockquote>
21029 !! html
21030 <blockquote>
21031 <p>Line one
21032 </p><p>Line two
21033 </p>
21034 </blockquote>
21035
21036 !! html+tidy
21037 <blockquote>
21038 <p>Line one</p>
21039 <p>Line two</p>
21040 </blockquote>
21041 !! end
21042
21043 !! test
21044 Paragraphs inside blockquotes/divs (no extra line breaks)
21045 !! wikitext
21046 <blockquote><div>Line one
21047
21048 Line two</div></blockquote>
21049 !! html
21050 <blockquote><div>Line one
21051 Line two</div></blockquote>
21052
21053 !! end
21054
21055 !! test
21056 Paragraphs inside blockquotes/divs (extra line break on open)
21057 !! wikitext
21058 <blockquote><div>
21059 Line one
21060
21061 Line two</div></blockquote>
21062 !! html
21063 <blockquote><div>
21064 <p>Line one
21065 </p>
21066 Line two</div></blockquote>
21067
21068 !! end
21069
21070 !! test
21071 Paragraphs inside blockquotes/divs (extra line break on close)
21072 !! wikitext
21073 <blockquote><div>Line one
21074
21075 Line two
21076 </div></blockquote>
21077 !! html
21078 <blockquote><div>Line one
21079 <p>Line two
21080 </p>
21081 </div></blockquote>
21082
21083 !! end
21084
21085 !! test
21086 Paragraphs inside blockquotes/divs (extra line break on open and close)
21087 !! wikitext
21088 <blockquote><div>
21089 Line one
21090
21091 Line two
21092 </div></blockquote>
21093 !! html
21094 <blockquote><div>
21095 <p>Line one
21096 </p><p>Line two
21097 </p>
21098 </div></blockquote>
21099
21100 !! end
21101
21102 !! test
21103 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
21104 !! options
21105 wgLinkHolderBatchSize=0
21106 !! wikitext
21107 [[meatball:1]]
21108 [[meatball:2]]
21109 [[meatball:3]]
21110 !! html
21111 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
21112 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
21113 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
21114 </p>
21115 !! end
21116
21117 !! test
21118 Free external link invading image caption
21119 !! wikitext
21120 [[Image:Foobar.jpg|thumb|http://x|hello]]
21121 !! html
21122 <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>
21123
21124 !! end
21125
21126 !! test
21127 Bug 15196: localised external link numbers
21128 !! options
21129 language=fa
21130 !! wikitext
21131 [http://en.wikipedia.org/]
21132 !! html/php
21133 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
21134 </p>
21135 !! html/parsoid
21136 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
21137 !! end
21138
21139 !! test
21140 Multibyte character in padleft
21141 !! wikitext
21142 {{padleft:-Hello|7|Æ}}
21143 !! html
21144 <p>Æ-Hello
21145 </p>
21146 !! end
21147
21148 !! test
21149 Multibyte character in padright
21150 !! wikitext
21151 {{padright:Hello-|7|Æ}}
21152 !! html
21153 <p>Hello-Æ
21154 </p>
21155 !! end
21156
21157 !!test
21158 formatdate parser function
21159 !! wikitext
21160 {{#formatdate:2009-03-24}}
21161 !! html
21162 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
21163 </p>
21164 !! end
21165
21166 !!test
21167 formatdate parser function, with default format
21168 !! wikitext
21169 {{#formatdate:2009-03-24|mdy}}
21170 !! html
21171 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
21172 </p>
21173 !! end
21174
21175 !! test
21176 Spacing of numbers in formatted dates
21177 !! wikitext
21178 {{#formatdate:January 15}}
21179 !! html
21180 <p><span class="mw-formatted-date" title="01-15">January 15</span>
21181 </p>
21182 !! end
21183
21184 !! test
21185 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
21186 !! options
21187 language=nl title=[[MediaWiki:Common.css]]
21188 !! wikitext
21189 {{#formatdate:2009-03-24|dmy}}
21190 !! html
21191 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
21192 </p>
21193 !! end
21194
21195 #
21196 #
21197 #
21198
21199 #
21200 # Edit comments
21201 #
21202
21203 !! test
21204 Edit comment with link
21205 !! options
21206 comment
21207 !! wikitext
21208 I like the [[Main Page]] a lot
21209 !! html/php
21210 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
21211 !!end
21212
21213 !! test
21214 Edit comment with link and link text
21215 !! options
21216 comment
21217 !! wikitext
21218 I like the [[Main Page|best pages]] a lot
21219 !! html/php
21220 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21221 !!end
21222
21223 !! test
21224 Edit comment with link and link text with suffix
21225 !! options
21226 comment
21227 !! wikitext
21228 I like the [[Main Page|best page]]s a lot
21229 !! html/php
21230 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21231 !!end
21232
21233 !! test
21234 Edit comment with section link (non-local, eg in history list)
21235 !! options
21236 comment title=[[Main Page]]
21237 !! wikitext
21238 /* External links */ removed bogus entries
21239 !! html/php
21240 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21241 !!end
21242
21243 !! test
21244 Edit comment with section link and text before it (non-local, eg in history list)
21245 !! options
21246 comment title=[[Main Page]]
21247 !! wikitext
21248 pre-comment text /* External links */ removed bogus entries
21249 !! html/php
21250 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>
21251 !!end
21252
21253 !! test
21254 Edit comment with section link (local, eg in diff view)
21255 !! options
21256 comment local title=[[Main Page]]
21257 !! wikitext
21258 /* External links */ removed bogus entries
21259 !! html/php
21260 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21261 !!end
21262
21263 !! test
21264 Edit comment with subpage link (bug 14080)
21265 !! options
21266 comment
21267 subpage
21268 title=[[Subpage test]]
21269 !! wikitext
21270 Poked at a [[/subpage]] here...
21271 !! html/php
21272 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
21273 !!end
21274
21275 !! test
21276 Edit comment with subpage link and link text (bug 14080)
21277 !! options
21278 comment
21279 subpage
21280 title=[[Subpage test]]
21281 !! wikitext
21282 Poked at a [[/subpage|neat little page]] here...
21283 !! html/php
21284 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
21285 !!end
21286
21287 !! test
21288 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
21289 !! options
21290 comment
21291 title=[[Subpage test]]
21292 !! wikitext
21293 Poked at a [[/subpage]] here...
21294 !! html/php
21295 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...
21296 !!end
21297
21298 !! test
21299 Edit comment with bare anchor link (local, as on diff)
21300 !! options
21301 comment
21302 local
21303 title=[[Main Page]]
21304 !! wikitext
21305 [[#section]]
21306 !! html/php
21307 <a href="#section">#section</a>
21308 !! end
21309
21310 !! test
21311 Edit comment with bare anchor link (non-local, as on history)
21312 !! options
21313 comment
21314 title=[[Main Page]]
21315 !! wikitext
21316 [[#section]]
21317 !! html/php
21318 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
21319 !! end
21320
21321 !! test
21322 Anchor starting with underscore
21323 !! options
21324 title=[[Foo]]
21325 !! wikitext
21326 [[#_ref|One]]
21327 !! html/php
21328 <p><a href="#_ref">One</a>
21329 </p>
21330 !! html/parsoid
21331 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
21332 !! end
21333
21334 !! test
21335 Id starting with underscore
21336 !! wikitext
21337 <div id="_ref"></div>
21338 !! html/*
21339 <div id="_ref"></div>
21340
21341 !! end
21342
21343 !! test
21344 Edit comment with link with more than one pipe (T99346)
21345 !! options
21346 comment
21347 !! wikitext
21348 [[Main Page|Many|pipes]]
21349 !! html/php
21350 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
21351 !! end
21352
21353 !! test
21354 Complex edit comment with link with more than one pipe (T99346)
21355 !! options
21356 comment
21357 !! wikitext
21358 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
21359 !! html/php
21360 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;
21361 !! end
21362
21363 !! test
21364 Space normalisation on autocomment (bug 22784)
21365 !! options
21366 comment
21367 title=[[Main Page]]
21368 !! wikitext
21369 /* __hello__world__ */
21370 !! html/php
21371 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
21372 !! end
21373
21374 !! test
21375 percent-encoding and + signs in comments (Bug 26410)
21376 !! options
21377 comment
21378 !! wikitext
21379 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
21380 !! html/php
21381 <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>
21382 !! end
21383
21384 # Parsoid doesn't support this yet: see bug 73581
21385 # but it *should* omit the 'src' attribute if the image is bad.
21386 # PHP side of tests was disabled in
21387 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
21388 # because of issues in the PHP parserTests infrastructure
21389 # (but the output below is indeed what the PHP side emits)
21390 !! test
21391 Bad images - basic functionality
21392 !! wikitext
21393 [[File:Bad.jpg]]
21394 !! DISABLED/html/php
21395 !! html/parsoid
21396 <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>
21397 !! end
21398
21399 !! test
21400 Bad images - bug 16039: text after bad image disappears
21401 !! wikitext
21402 Foo bar
21403 [[File:Bad.jpg]]
21404 Bar foo
21405 !! DISABLED/html/php
21406 <p>Foo bar
21407 </p><p>Bar foo
21408 </p>
21409 !! html/parsoid
21410 <p>Foo bar
21411 <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>
21412 Bar foo</p>
21413 !! end
21414
21415 !! test
21416 Verify that displaytitle works (bug #22501) no displaytitle
21417 !! options
21418 showtitle
21419 !! config
21420 wgAllowDisplayTitle=true
21421 wgRestrictDisplayTitle=false
21422 !! wikitext
21423 this is not the the title
21424 !! html/php
21425 Parser test
21426 <p>this is not the the title
21427 </p>
21428 !! end
21429
21430 !! test
21431 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
21432 !! options
21433 showtitle
21434 title=[[Screen]]
21435 !! config
21436 wgAllowDisplayTitle=true
21437 wgRestrictDisplayTitle=false
21438 !! wikitext
21439 this is not the the title
21440 {{DISPLAYTITLE:whatever}}
21441 !! html/php
21442 whatever
21443 <p>this is not the the title
21444 </p>
21445 !! end
21446
21447 !! test
21448 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
21449 !! options
21450 showtitle
21451 title=[[Screen]]
21452 !! config
21453 wgAllowDisplayTitle=true
21454 wgRestrictDisplayTitle=true
21455 !! wikitext
21456 this is not the the title
21457 {{DISPLAYTITLE:whatever}}
21458 !! html/php
21459 Screen
21460 <p>this is not the the title
21461 </p>
21462 !! end
21463
21464 !! test
21465 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
21466 !! options
21467 showtitle
21468 title=[[Screen]]
21469 !! config
21470 wgAllowDisplayTitle=true
21471 wgRestrictDisplayTitle=true
21472 !! wikitext
21473 this is not the the title
21474 {{DISPLAYTITLE:screen}}
21475 !! html/php
21476 screen
21477 <p>this is not the the title
21478 </p>
21479 !! end
21480
21481 !! test
21482 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
21483 !! options
21484 showtitle
21485 title=[[Screen]]
21486 !! config
21487 wgAllowDisplayTitle=false
21488 !! wikitext
21489 this is not the the title
21490 {{DISPLAYTITLE:screen}}
21491 !! html/php
21492 Screen
21493 <p>this is not the the title
21494 <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>
21495 </p>
21496 !! end
21497
21498 !! test
21499 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
21500 !! options
21501 showtitle
21502 title=[[Screen]]
21503 !! config
21504 wgAllowDisplayTitle=false
21505 !! wikitext
21506 this is not the the title
21507 !! html/php
21508 Screen
21509 <p>this is not the the title
21510 </p>
21511 !! end
21512
21513 !! test
21514 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
21515 !! options
21516 showtitle
21517 title=[[Screen]]
21518 !! config
21519 wgAllowDisplayTitle=true
21520 wgRestrictDisplayTitle=true
21521 !! wikitext
21522 this is not the the title
21523 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21524 !! html/php
21525 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21526 <p>this is not the the title
21527 </p>
21528 !! end
21529
21530 !! test
21531 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
21532 !! options
21533 showtitle
21534 title=[[Screen]]
21535 !! config
21536 wgAllowDisplayTitle=true
21537 wgRestrictDisplayTitle=true
21538 !! wikitext
21539 this is not the the title
21540 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21541 !! html/php
21542 <span style="color: red;">s</span>creen
21543 <p>this is not the the title
21544 </p>
21545 !! end
21546
21547 !! test
21548 Page status indicators: Empty name is invalid
21549 !! options
21550 showindicators
21551 !! wikitext
21552 <indicator name=" "></indicator>
21553 <indicator></indicator>
21554 !! html
21555 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21556 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21557 </p>
21558 !! end
21559
21560 !! test
21561 Page status indicators: Weird syntaxes that are okay
21562 !! options
21563 showindicators
21564 !! wikitext
21565 <indicator name="empty" />
21566 <indicator name="name"></indicator>
21567 !! html
21568 empty=
21569 name=
21570 <p><br />
21571 </p>
21572 !! end
21573
21574 !! test
21575 Page status indicators: Torture test
21576 !! options
21577 showindicators
21578 !! wikitext
21579 <indicator name="01">hello world</indicator>
21580 <indicator name="02">[[Main Page]]</indicator>
21581 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21582 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21583 <indicator name="05">* foo
21584 * bar</indicator>
21585 <indicator name="06"><nowiki>foo</nowiki></indicator>
21586 <indicator name="07"> Preformatted</indicator>
21587 <indicator name="08"><div>Broken tag</indicator>
21588 <indicator name="09">{| class=wikitable
21589 | cell
21590 |}</indicator>
21591 <indicator name="10">Two
21592
21593 paragraphs</indicator>
21594 !! html
21595 01=hello world
21596 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21597 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" />
21598 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>
21599 05=<ul><li> foo</li>
21600 <li> bar</li></ul>
21601
21602 06=foo
21603 07=<pre>Preformatted
21604 </pre>
21605 08=<div>Broken tag</div>
21606
21607 09=<table class="wikitable">
21608 <tr>
21609 <td> cell
21610 </td></tr></table>
21611
21612 10=<p>Two
21613 </p><p>paragraphs
21614 </p>
21615 <p><br />
21616 </p><p><br />
21617 </p><p><br />
21618 </p><p><br />
21619 </p><p><br />
21620 </p>
21621 !! end
21622
21623 !! test
21624 preload: check <noinclude> and <includeonly>
21625 !! options
21626 preload
21627 !! wikitext
21628 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21629 !! html/php
21630 Hello kind world.
21631 !! end
21632
21633 !! test
21634 preload: check <onlyinclude>
21635 !! options
21636 preload
21637 !! wikitext
21638 Goodbye <onlyinclude>Hello world</onlyinclude>
21639 !! html/php
21640 Hello world
21641 !! end
21642
21643 !! test
21644 preload: can pass tags through if we want to
21645 !! options
21646 preload
21647 !! wikitext
21648 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21649 !! html/php
21650 <includeonly>Hello world</includeonly>
21651 !! end
21652
21653 !! test
21654 preload: check that it doesn't try to do tricks
21655 !! options
21656 preload
21657 !! wikitext
21658 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21659 !! html/php
21660 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21661 !! end
21662
21663 !! test
21664 Play a bit with r67090 and bug 3158
21665 !! wikitext
21666 <div style="width:50% !important">&nbsp;</div>
21667 <div style="width:50%&nbsp;!important">&nbsp;</div>
21668 <div style="width:50%&#160;!important">&nbsp;</div>
21669 <div style="border : solid;">&nbsp;</div>
21670 !! html/php
21671 <div style="width:50% !important">&#160;</div>
21672 <div style="width:50% !important">&#160;</div>
21673 <div style="width:50% !important">&#160;</div>
21674 <div style="border&#160;: solid;">&#160;</div>
21675
21676 !! html/parsoid
21677 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21678 <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>
21679 <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>
21680 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21681
21682 !! end
21683
21684 !! test
21685 HTML5 data attributes
21686 !! wikitext
21687 <span data-foo="bar">Baz</span>
21688 <p data-abc-def_hij="">Quuz</p>
21689 !! html/php
21690 <p><span data-foo="bar">Baz</span>
21691 </p>
21692 <p data-abc-def_hij="">Quuz</p>
21693
21694 !! html/parsoid
21695 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21696 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21697 !! end
21698
21699 !! test
21700 Strip reserved data attributes
21701 !! wikitext
21702 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21703 !! html/php
21704 <div data-ok="fred">d</div>
21705
21706 !! html/parsoid
21707 <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>
21708 !! end
21709
21710 !! test
21711 percent-encoding and + signs in internal links (Bug 26410)
21712 !! wikitext
21713 [[User:+%]] [[Page+title%]]
21714 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21715 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21716 [[%33%45]] [[%33%45+]]
21717 !! html/php
21718 <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>
21719 <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>
21720 <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>
21721 <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>
21722 </p>
21723 !! html/parsoid
21724 <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>
21725 <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>
21726 <a rel="mw:WikiLink" href="./%25" title="%" data-parsoid='{"stx":"simple","a":{"href":"./%25"},"sa":{"href":"%"}}'>%</a> <a rel="mw:WikiLink" href="./+" title="+" data-parsoid='{"stx":"simple","a":{"href":"./+"},"sa":{"href":"+"}}'>+</a> <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"foo"},{"ck":"caption","ak":"[[bar]]"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./Bar\" title=\"Bar\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bar\"},\"sa\":{\"href\":\"bar\"},\"dsr\":[94,101,2,2]}&#39;>bar&lt;/a>"}'><a href="./File:%25+abc9" data-parsoid='{"a":{"href":"./File:%25+abc9"},"sa":{}}'><img resource="./File:%25+abc9" src="./Special:FilePath/%25+abc9" height="220" width="220" data-parsoid='{"a":{"resource":"./File:%25+abc9","height":"220","width":"220"},"sa":{"resource":"File:%+abc%39"}}'/></a></span>
21727 <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>
21728 !! end
21729
21730 !! test
21731 Special characters in embedded file links (bug 27679)
21732 !! wikitext
21733 [[File:Contains & ampersand.jpg]]
21734 [[File:Does not exist.jpg|Title with & ampersand]]
21735 !! html/php
21736 <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>
21737 <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>
21738 </p>
21739 !! html/parsoid
21740 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Contains_&amp;_ampersand.jpg"><img resource="./File:Contains_&amp;_ampersand.jpg" src="./Special:FilePath/Contains_&amp;_ampersand.jpg" height="220" width="220"/></a></span>
21741 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"Title with &amp;amp; ampersand"}'><a href="./File:Does_not_exist.jpg"><img resource="./File:Does_not_exist.jpg" src="./Special:FilePath/Does_not_exist.jpg" height="220" width="220"/></a></span></p>
21742 !! end
21743
21744 !! test
21745 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21746 !! wikitext
21747 Text&apos;s been normalized?
21748 !! html
21749 <p>Text&#39;s been normalized?
21750 </p>
21751 !! end
21752
21753 !! test
21754 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21755 !! wikitext
21756 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21757 !! html
21758 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21759 </p>
21760 !! end
21761
21762 !! test
21763 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21764 !! wikitext
21765 [http://www.example.org/ ideograms]
21766 !! html
21767 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21768 </p>
21769 !! end
21770
21771 !! test
21772 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21773 !! wikitext
21774 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21775 !! html
21776 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21777 </p>
21778 !! end
21779
21780 !! article
21781 Mediawiki:loop1
21782 !! text
21783 {{Identical|A}}
21784 !! endarticle
21785
21786 !! article
21787 Mediawiki:loop2
21788 !! text
21789 {{Identical|B}}
21790 !! endarticle
21791
21792 !! article
21793 Template:Identical
21794 !! text
21795 {{int:loop1}}
21796 {{int:loop2}}
21797 !! endarticle
21798
21799 !! test
21800 Bug 31098 Template which includes system messages which includes the template
21801 !! wikitext
21802 {{Identical}}
21803 !! html
21804 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21805 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21806 </p>
21807 !! end
21808
21809 !! test
21810 Bug31490 Turkish: ucfirst 'blah'
21811 !! options
21812 language=tr
21813 !! wikitext
21814 {{ucfirst:blah}}
21815 !! html
21816 <p>Blah
21817 </p>
21818 !! end
21819
21820 !! test
21821 Bug31490 Turkish: ucfirst 'ix'
21822 !! options
21823 language=tr
21824 !! wikitext
21825 {{ucfirst:ix}}
21826 !! html
21827 <p>İx
21828 </p>
21829 !! end
21830
21831 !! test
21832 Bug31490 Turkish: lcfirst 'BLAH'
21833 !! options
21834 language=tr
21835 !! wikitext
21836 {{lcfirst:BLAH}}
21837 !! html
21838 <p>bLAH
21839 </p>
21840 !! end
21841
21842 !! test
21843 Bug31490 Turkish: ucfırst (with a dotless i)
21844 !! options
21845 language=tr
21846 !! wikitext
21847 {{ucfırst:blah}}
21848 !! html
21849 <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>
21850 </p>
21851 !! end
21852
21853 !! test
21854 Bug31490 ucfırst (with a dotless i) with English language
21855 !! options
21856 language=en
21857 !! wikitext
21858 {{ucfırst:blah}}
21859 !! html
21860 <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>
21861 </p>
21862 !! end
21863
21864 !! test
21865 Bug 26375: TOC with italics
21866 !! options
21867 title=[[Main Page]]
21868 !! wikitext
21869 __TOC__
21870 == ''Lost'' episodes ==
21871 !! html
21872 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21873 <ul>
21874 <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>
21875 </ul>
21876 </div>
21877
21878 <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>
21879
21880 !! end
21881
21882 !! test
21883 Bug 26375: TOC with bold
21884 !! options
21885 title=[[Main Page]]
21886 !! wikitext
21887 __TOC__
21888 == '''should be bold''' then normal text ==
21889 !! html
21890 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21891 <ul>
21892 <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>
21893 </ul>
21894 </div>
21895
21896 <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>
21897
21898 !! end
21899
21900 !! test
21901 Bug 33845: Headings become cursive in TOC when they contain an image
21902 !! options
21903 title=[[Main Page]]
21904 !! wikitext
21905 __TOC__
21906 == Image [[Image:foobar.jpg]] ==
21907 !! html
21908 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21909 <ul>
21910 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21911 </ul>
21912 </div>
21913
21914 <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>
21915
21916 !! end
21917
21918 !! test
21919 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21920 !! options
21921 title=[[Main Page]]
21922 !! wikitext
21923 __TOC__
21924 == <blockquote>Quote</blockquote> ==
21925 !! html
21926 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21927 <ul>
21928 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21929 </ul>
21930 </div>
21931
21932 <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>
21933
21934 !! html+tidy
21935 <p></p>
21936 <div id="toc" class="toc">
21937 <div id="toctitle">
21938 <h2>Contents</h2>
21939 </div>
21940 <ul>
21941 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21942 </ul>
21943 </div>
21944 <p></p>
21945 <h2><span class="mw-headline" id="Quote"></span></h2>
21946 <blockquote>
21947 <p><span class="mw-headline" id="Quote">Quote</span></p>
21948 </blockquote>
21949 <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>
21950 !! end
21951
21952 !! test
21953 Unclosed tags in TOC
21954 !! options
21955 title=[[Main Page]]
21956 !! wikitext
21957 __TOC__
21958 == Proof: 2 < 3 ==
21959 <small>Hanc marginis exiguitas non caperet.</small>
21960 QED
21961 !! html
21962 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21963 <ul>
21964 <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>
21965 </ul>
21966 </div>
21967
21968 <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>
21969 <p><small>Hanc marginis exiguitas non caperet.</small>
21970 QED
21971 </p>
21972 !! end
21973
21974 !! test
21975 Multiple tags in TOC
21976 !! wikitext
21977 __TOC__
21978 == <i>Foo</i> <b>Bar</b> ==
21979
21980 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21981 !! html
21982 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21983 <ul>
21984 <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>
21985 <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>
21986 </ul>
21987 </div>
21988
21989 <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>
21990 <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>
21991
21992 !! html+tidy
21993 <p></p>
21994 <div id="toc" class="toc">
21995 <div id="toctitle">
21996 <h2>Contents</h2>
21997 </div>
21998 <ul>
21999 <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>
22000 <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>
22001 </ul>
22002 </div>
22003 <p></p>
22004 <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>
22005 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
22006 <blockquote>
22007 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
22008 </blockquote>
22009 <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>
22010 !! end
22011
22012 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
22013 # html5 tag parsing.
22014 !! test
22015 Tags with parameters in TOC
22016 !! options
22017 parsoid=wt2html
22018 !! wikitext
22019 __TOC__
22020 == <sup class="in-h2">Hello</sup> ==
22021
22022 == <sup class="a > b">Evilbye</sup> ==
22023 !! html/php
22024 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22025 <ul>
22026 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
22027 <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>
22028 </ul>
22029 </div>
22030
22031 <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>
22032 <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>
22033
22034 !! html/parsoid
22035 <meta property="mw:PageProp/toc" />
22036 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
22037
22038 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
22039 !! end
22040
22041 !! test
22042 span tags with directionality in TOC
22043 !! wikitext
22044 __TOC__
22045 == <span dir="ltr">C++</span> ==
22046
22047 == <span dir="rtl">זבנג!</span> ==
22048
22049 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
22050
22051 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
22052
22053 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
22054 !! html
22055 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22056 <ul>
22057 <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>
22058 <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>
22059 <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>
22060 <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>
22061 <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>
22062 </ul>
22063 </div>
22064
22065 <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>
22066 <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>
22067 <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>
22068 <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>
22069 <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>
22070
22071 !! end
22072
22073 !! test
22074 Bug 72884: bdi element in ToC
22075 !! wikitext
22076 __TOC__
22077 == <bdi>test</bdi> ==
22078 !! html
22079 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22080 <ul>
22081 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
22082 </ul>
22083 </div>
22084
22085 <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>
22086
22087 !! end
22088
22089 !! test
22090 T35715: s/strike element in ToC
22091 !! wikitext
22092 __TOC__
22093 == <s>test</s> test <strike>test</strike> ==
22094 !! html
22095 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22096 <ul>
22097 <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>
22098 </ul>
22099 </div>
22100
22101 <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>
22102
22103 !! end
22104
22105 # Note that the html output does not have the <p></p>, but the
22106 # html+tidy output *does*. This is because the empty <p></p> is
22107 # removed by the sanitizer, but only when tidy is *not* enabled (!).
22108 !! test
22109 Empty <p> tag in TOC, removed by Sanitizer (T92892)
22110 !! wikitext
22111 __TOC__
22112 == x ==
22113 !! html
22114 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22115 <ul>
22116 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22117 </ul>
22118 </div>
22119
22120 <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>
22121
22122 !! html+tidy
22123 <p></p>
22124 <div id="toc" class="toc">
22125 <div id="toctitle">
22126 <h2>Contents</h2>
22127 </div>
22128 <ul>
22129 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22130 </ul>
22131 </div>
22132 <p></p>
22133 <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>
22134 !! end
22135
22136 !! article
22137 MediaWiki:Bug32057
22138 !! text
22139 == {{int:headline_sample}} ==
22140 !! endarticle
22141
22142 !! test
22143 Bug 32057: Title needed when expanding <h> nodes.
22144 !! options
22145 title=[[Main Page]]
22146 !! wikitext
22147 {{int:Bug32057}}
22148 !! html
22149 <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>
22150
22151 !! end
22152
22153 !! test
22154 Strip marker in urlencode
22155 !! wikitext
22156 {{urlencode:x<nowiki/>y}}
22157 {{urlencode:x<nowiki/>y|wiki}}
22158 {{urlencode:x<nowiki/>y|path}}
22159 {{urlencode:x<pre id="one">two</pre>y}}
22160 !! html/php
22161 <p>xy
22162 xy
22163 xy
22164 xy
22165 </p>
22166 !! end
22167
22168 !! test
22169 Strip marker in lc
22170 !! wikitext
22171 {{lc:x<nowiki/>y}}
22172 !! html
22173 <p>xy
22174 </p>
22175 !! end
22176
22177 !! test
22178 Strip marker in uc
22179 !! wikitext
22180 {{uc:x<nowiki/>y}}
22181 !! html
22182 <p>XY
22183 </p>
22184 !! end
22185
22186 !! test
22187 Strip marker in formatNum
22188 !! wikitext
22189 {{formatnum:1<nowiki/>2}}
22190 {{formatnum:1<nowiki/>2|R}}
22191 !! html
22192 <p>12
22193 12
22194 </p>
22195 !! end
22196
22197 !! test
22198 Check noCommafy in formatNum
22199 !! options
22200 language=be-tarask
22201 !! wikitext
22202 {{formatnum:123456.78}}
22203 {{formatnum:123456.78|NOSEP}}
22204 !! html
22205 <p>123 456,78
22206 123456.78
22207 </p>
22208 !! end
22209
22210 !! test
22211 Wrong option for formatNum (bug 56199)
22212 !! wikitext
22213 {{formatnum:1,234.56|Random}}
22214 {{formatnum:1,234.56|EVERYTHING}}
22215 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
22216 !! html
22217 <p>1,234.56
22218 1,234.56
22219 1,234.56
22220 </p>
22221 !! end
22222
22223 !! test
22224 Strip marker in grammar
22225 !! options
22226 language=fi
22227 !! wikitext
22228 {{grammar:elative|foo<nowiki/>bar}}
22229 !! html
22230 <p>foobarista
22231 </p>
22232 !! end
22233
22234 !! test
22235 Strip marker in padleft
22236 !! wikitext
22237 {{padleft:|2|x<nowiki/>y}}
22238 !! html
22239 <p>xy
22240 </p>
22241 !! end
22242
22243 !! test
22244 Strip marker in padright
22245 !! wikitext
22246 {{padright:|2|x<nowiki/>y}}
22247 !! html
22248 <p>xy
22249 </p>
22250 !! end
22251
22252 !! test
22253 Strip marker in anchorencode
22254 !! wikitext
22255 {{anchorencode:x<nowiki/>y}}
22256 !! html
22257 <p>xy
22258 </p>
22259 !! end
22260
22261 !! test
22262 nowiki inside link inside heading (bug 18295)
22263 !! wikitext
22264 ==[[foo|x<nowiki>y</nowiki>z]]==
22265 !! html
22266 <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>
22267
22268 !! end
22269
22270 !! test
22271 new support for bdi element (bug 31817)
22272 !! wikitext
22273 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22274 !! html
22275 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22276
22277 !!end
22278
22279 !! test
22280 Ignore pipe between table row attributes
22281 !! wikitext
22282 {|
22283 | quux
22284 |- id=foo | style='color: red'
22285 | bar
22286 |}
22287 !! html
22288 <table>
22289 <tr>
22290 <td> quux
22291 </td></tr>
22292 <tr id="foo" style="color: red">
22293 <td> bar
22294 </td></tr></table>
22295
22296 !! end
22297
22298 !!test
22299 Gallery override link with WikiLink (bug 34852)
22300 !! wikitext
22301 <gallery>
22302 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
22303 </gallery>
22304 !! html
22305 <ul class="gallery mw-gallery-traditional">
22306 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22307 <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>
22308 <div class="gallerytext">
22309 <p>caption
22310 </p>
22311 </div>
22312 </div></li>
22313 </ul>
22314
22315 !! end
22316
22317 !!test
22318 Gallery override link with absolute external link (bug 34852)
22319 !! wikitext
22320 <gallery>
22321 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
22322 </gallery>
22323 !! html
22324 <ul class="gallery mw-gallery-traditional">
22325 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22326 <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>
22327 <div class="gallerytext">
22328 <p>caption
22329 </p>
22330 </div>
22331 </div></li>
22332 </ul>
22333
22334 !! end
22335
22336 !! test
22337 Gallery override link with absolute external link with LanguageConverter
22338 !! options
22339 language=zh
22340 !! input
22341 <gallery>
22342 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
22343 </gallery>
22344 !! result
22345 <ul class="gallery mw-gallery-traditional">
22346 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22347 <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>
22348 <div class="gallerytext">
22349 <p>caption
22350 </p>
22351 </div>
22352 </div></li>
22353 </ul>
22354
22355 !! end
22356
22357 !!test
22358 Gallery override link with malicious javascript (bug 34852)
22359 !! wikitext
22360 <gallery>
22361 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
22362 </gallery>
22363 !! html
22364 <ul class="gallery mw-gallery-traditional">
22365 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22366 <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>
22367 <div class="gallerytext">
22368 <p>caption
22369 </p>
22370 </div>
22371 </div></li>
22372 </ul>
22373
22374 !! end
22375
22376 !!test
22377 Gallery with invalid title as link (bug 43964)
22378 !! wikitext
22379 <gallery>
22380 File:foobar.jpg|link=<
22381 </gallery>
22382 !! html
22383 <ul class="gallery mw-gallery-traditional">
22384 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22385 <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>
22386 <div class="gallerytext">
22387 </div>
22388 </div></li>
22389 </ul>
22390
22391 !! end
22392
22393 !!test
22394 Language parser function
22395 !! wikitext
22396 {{#language:ar}}
22397 !! html
22398 <p>العربية
22399 </p>
22400 !! end
22401
22402 !!test
22403 Padleft and padright as substr
22404 !! wikitext
22405 {{padleft:|3|abcde}}
22406 {{padright:|3|abcde}}
22407 !! html
22408 <p>abc
22409 abc
22410 </p>
22411 !! end
22412
22413 !!test
22414 Special parser function
22415 !! wikitext
22416 {{#special:RandomPage}}
22417 {{#special:BaDtItLe}}
22418 {{#special:Foobar}}
22419 !! html
22420 <p>Special:Random
22421 Special:Badtitle
22422 Special:Foobar
22423 </p>
22424 !! end
22425
22426 !!test
22427 Bug 34939 - Case insensitive link parsing ([HttP://])
22428 !! wikitext
22429 [HttP://MediaWiki.Org/]
22430 !! html/php
22431 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
22432 </p>
22433 !! html/parsoid
22434 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
22435 !! end
22436
22437 !!test
22438 Bug 34939 - Case insensitive link parsing ([HttP:// title])
22439 !! wikitext
22440 [HttP://MediaWiki.Org/ MediaWiki]
22441 !! html
22442 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22443 </p>
22444 !! end
22445
22446 !!test
22447 Bug 34939 - Case insensitive link parsing (HttP://)
22448 !! wikitext
22449 HttP://MediaWiki.Org/
22450 !! html/php
22451 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22452 </p>
22453 !! html/parsoid
22454 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22455 !! end
22456
22457 !!test
22458 Disable TOC
22459 !! options
22460 notoc
22461 !! wikitext
22462 Lead
22463 == Section 1 ==
22464 == Section 2 ==
22465 == Section 3 ==
22466 == Section 4 ==
22467 == Section 5 ==
22468 !! html
22469 <p>Lead
22470 </p>
22471
22472 <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>
22473 <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>
22474 <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>
22475 <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>
22476 <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>
22477
22478 !! end
22479
22480
22481 ###
22482 ### Parsoid-specific tests
22483 ### Parsoid-PHP parser incompatibilities
22484 ###
22485 !!test
22486 1. SOL-sensitive wikitext tokens as template-args
22487 !!options
22488 parsoid=wt2html,wt2wt
22489 !! wikitext
22490 {{echo|*a}}
22491 {{echo|#a}}
22492 {{echo|:a}}
22493 !! html
22494 <span about="#mwt1" typeof="mw:Transclusion">
22495 </span><ul about="#mwt1"><li>a</li>
22496 </ul>
22497 <span about="#mwt2" typeof="mw:Transclusion">
22498 </span><ol about="#mwt2"><li>a</li>
22499 </ol>
22500 <span about="#mwt3" typeof="mw:Transclusion">
22501 </span><dl about="#mwt3"><dd>a</dd>
22502 </dl>
22503 !!end
22504
22505 #### -----------------------------------------------------------------
22506 #### Parsoid-specific functionality tests
22507 #### -----------------------------------------------------------------
22508
22509 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
22510 # We know wt2wt will fail, but we expect selser to pass.
22511 # Due to the nature of our testing, wt2wt and selser tests will enter the
22512 # blacklist and we'll catch selser regressions based on changes to the
22513 # blacklist entries for selser tests.
22514 !! test
22515 1. Bad treebuilder fixup of formatting elt is cleaned up
22516 !! options
22517 parsoid=wt2html,wt2wt
22518 !! wikitext
22519 {|
22520 |
22521 <small>
22522 [[Image:Foobar.jpg|right|Test]]
22523 </small>
22524 |}
22525 !! html/parsoid
22526 <table>
22527 <tbody><tr><td>
22528 <small>
22529 <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>
22530 </small>
22531 </td></tr>
22532 </tbody></table>
22533 !! end
22534
22535 !! test
22536 2. Bad treebuilder fixup of formatting elt is cleaned up
22537 !! options
22538 parsoid=wt2html,wt2wt
22539 !! wikitext
22540 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22541
22542 <small>[[Image:Foobar.jpg|right|300px]]</small>
22543 !! html/parsoid
22544
22545 <p><b>foo</b></p>
22546 <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>
22547 <p><b>bar</b></p>
22548 <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>
22549 !! end
22550
22551 !! test
22552 3. Bad treebuilder fixup of formatting elt is cleaned up
22553 !! options
22554 parsoid=wt2html,wt2wt
22555 !! wikitext
22556 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22557 !! html/parsoid
22558 <p><small><b>foo</b></small></p>
22559 <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>
22560 <p><small><b>bar</b></small></p>
22561 !! end
22562
22563 !! test
22564 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22565 !! options
22566 parsoid=wt2html,wt2wt
22567 !! wikitext
22568 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22569 !! html/parsoid
22570 <p><b><small></small></b></p>
22571 <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>
22572 <p></p>
22573 !! end
22574
22575 #### ----------------------------------------------------------------
22576 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22577 #### tags. Parsoid's output for these tags differs from that of the
22578 #### PHP parser.
22579 #### ----------------------------------------------------------------
22580
22581 !!test
22582 Ref: 1. ref-location should be replaced with an index span
22583 !! wikitext
22584 A <ref>foo</ref>
22585 B <ref name="x">foo</ref>
22586 C <ref name="y" />
22587 <references />
22588 !! html/parsoid
22589 <p>A <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>
22590 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-2"},"attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-2"><span class="mw-reflink-text">[2]</span></a></span>
22591 C <span about="#mwt6" class="mw-ref" id="cite_ref-y_3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"y"}}'><a href="./Main_Page#cite_note-y-3"><span class="mw-reflink-text">[3]</span></a></span></p>
22592 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22593 <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>
22594 <li about="#cite_note-x-2" id="cite_note-x-2"><a href="./Main_Page#cite_ref-x_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-x-2" class="mw-reference-text">foo</span></li>
22595 <li about="#cite_note-y-3" id="cite_note-y-3"><a href="./Main_Page#cite_ref-y_3-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-y-3" class="mw-reference-text"></span></li>
22596 </ol>
22597 !!end
22598
22599 !!test
22600 Ref: 2. ref-tags with identical names should all get the same index
22601 !! wikitext
22602 A <ref name="x">foo</ref>
22603 B <ref name="x" />
22604 <references />
22605 !! html/parsoid
22606 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
22607 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22608 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22609 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
22610 </ol>
22611 !!end
22612
22613 !!test
22614 Ref: 3. spaces in ref-names should be ignored
22615 !! wikitext
22616 A <ref name="x">foo</ref>
22617 B <ref name=" x " />
22618 C <ref name= x />
22619 <references />
22620 !! html/parsoid
22621 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
22622 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
22623 C <span about="#mwt6" class="mw-ref" id="cite_ref-x_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22624 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22625 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a><a href="./Main_Page#cite_ref-x_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
22626 </ol>
22627 !!end
22628
22629 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22630 !!test
22631 Ref: 4. 'constructor' should be accepted as a valid ref-name
22632 !! wikitext
22633 A <ref name="constructor">foo</ref>
22634 <references />
22635 !! html/parsoid
22636 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-constructor_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-constructor-1"},"attrs":{"name":"constructor"}}'><a href="./Main_Page#cite_note-constructor-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22637 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22638 <li about="#cite_note-constructor-1" id="cite_note-constructor-1"><a href="./Main_Page#cite_ref-constructor_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-constructor-1" class="mw-reference-text">foo</span></li>
22639 </ol>
22640 !!end
22641
22642 !!test
22643 Ref: 5. body should accept generic wikitext
22644 !! wikitext
22645 A <ref>
22646 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22647 </ref>
22648
22649 <references />
22650 !! html/parsoid
22651 <p>A <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>
22652
22653 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22654 <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">This is a <b><a rel="mw:WikiLink" href="Bolded_link" title="Bolded link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span>
22655 </span></li>
22656 </ol>
22657 !!end
22658
22659 !!test
22660 Ref: 6. indent-pres should not be output in ref-body
22661 !! wikitext
22662 A <ref>
22663 foo
22664 bar
22665 baz
22666 </ref>
22667
22668 <references />
22669 !! html/parsoid
22670 <p>A <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>
22671
22672 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22673 <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
22674 bar
22675 baz
22676 </span></li>
22677 </ol>
22678 !!end
22679
22680 !!test
22681 Ref: 7. No p-wrapping in ref-body
22682 !! wikitext
22683 A <ref>
22684 foo
22685
22686 bar
22687
22688
22689 baz
22690
22691
22692
22693 booz
22694 </ref>
22695
22696 <references />
22697 !! html/parsoid
22698 <p>A <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>
22699
22700 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22701 <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
22702
22703 bar
22704
22705
22706 baz
22707
22708
22709
22710 booz
22711 </span></li>
22712 </ol>
22713 !!end
22714
22715 !!test
22716 Ref: 8. transclusion wikitext has lower precedence
22717 !! wikitext
22718 A <ref> foo {{echo|</ref> B C}}
22719
22720 <references />
22721 !! html/parsoid
22722 <p>A <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> B C}}</p>
22723 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22724 <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 {{echo|</span></li>
22725 </ol>
22726 !!end
22727
22728 !!test
22729 Ref: 9. unclosed comments should not leak out of ref-body
22730 !! wikitext
22731 A <ref> foo <!--</ref> B C
22732 <references />
22733 !! html/parsoid
22734 <p>A <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> B C</p>
22735 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22736 <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>
22737 </ol>
22738 !!end
22739
22740 !!test
22741 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22742 !! wikitext
22743 A <ref> <b> foo </ref> B C
22744
22745 <references />
22746 !! html/parsoid
22747 <p>A <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> B C</p>
22748
22749
22750 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22751 <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"><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></span></li>
22752 </ol>
22753 !!end
22754
22755 !!test
22756 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22757 !! wikitext
22758 A <ref>foo</ref> B
22759 C <ref>bar</ref> D
22760 <references />
22761 !! html/parsoid
22762 <p>A <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> B
22763 C <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> D</p>
22764 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22765 <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>
22766 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
22767 </ol>
22768 !!end
22769
22770 !!test
22771 Ref: 12. ref-tags act as trailing newline migration barrier
22772 !! wikitext
22773 <!--the newline at the end of this line moves out of the p tag-->a
22774
22775 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22776 <ref />
22777
22778 c
22779 <references />
22780 !! html/parsoid
22781 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22782
22783
22784 <p>b<!--the newline at the end of this line stays inside the p tag--> <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
22785 <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span></p>
22786
22787 <p>c</p>
22788 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22789 <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"></span></li>
22790 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"></span></li></ol>
22791 !!end
22792
22793 !!test
22794 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22795 !! wikitext
22796 <ref>foo</ref> A
22797 <ref>bar
22798 </ref> B
22799 <references />
22800 !! html/parsoid
22801 <p><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> A
22802 <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> B</p>
22803 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22804 <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>
22805 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar
22806 </span></li>
22807 </ol>
22808 !!end
22809
22810 ## Roundtripping fails because of nowiki'ing
22811 !! test
22812 Ref: 14. A nested ref-tag should be emitted as plain text
22813 !! options
22814 parsoid=wt2html
22815 !! wikitext
22816 <ref>foo <ref>bar</ref> baz</ref>
22817
22818 <references />
22819 !! html/parsoid
22820 <p><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" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span> baz&lt;/ref></p>
22821
22822 <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 &lt;ref>bar</span></li></ol>
22823 !! end
22824
22825 !!test
22826 Ref: 15. ref-tags with identical names should get identical indexes
22827 !! wikitext
22828 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22829 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22830
22831 <references />
22832 !! html/parsoid
22833 <p>A1 <span about="#mwt3" class="mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a-1"},"attrs":{"name":"a"}}'><a href="./Main_Page#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span> A2 <span about="#mwt4" class="mw-ref" id="cite_ref-a_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="./Main_Page#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
22834 B1 <span about="#mwt7" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"b"}}'><a href="./Main_Page#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span> B2 <span about="#mwt8" class="mw-ref" id="cite_ref-b_2-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="./Main_Page#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
22835
22836 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-a_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-a_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-b_2-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-b_2-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
22837 </ol>
22838 !!end
22839
22840 ## We don't bother wt2wt-ing non-standard whitespace
22841 !!test
22842 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22843 !!options
22844 parsoid=wt2html
22845 !! wikitext
22846 A <ref >foo</ref >
22847
22848 <references />
22849 !! html/parsoid
22850 <p>A <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>
22851 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22852 <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>
22853 !!end
22854
22855 !!test
22856 Ref: 17. Generate valid HTML5 id/about attributes
22857 !!wikitext
22858 <ref name="a b">foo</ref>
22859 <ref name=":0">ve-created name</ref>
22860
22861 <references />
22862 !!html/parsoid
22863 <p><span about="#mwt2" class="mw-ref" id="cite_ref-a_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_b-1"},"attrs":{"name":"a b"}}'><a href="./Main_Page#cite_note-a_b-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span>
22864 <span about="#mwt4" class="mw-ref" id="cite_ref-:0_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-:0-2"},"attrs":{"name":":0"}}'><a href="./Main_Page#cite_note-:0-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></span>
22865
22866 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a_b-1" id="cite_note-a_b-1"><a href="./Main_Page#cite_ref-a_b_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a_b-1" class="mw-reference-text">foo</span></li><li about="#cite_note-:0-2" id="cite_note-:0-2"><a href="./Main_Page#cite_ref-:0_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-:0-2" class="mw-reference-text">ve-created name</span></li></ol>
22867
22868 !!end
22869
22870 !!test
22871 Ref: 18. T58916: Extension attributes should be parsed as plain text
22872 !!wikitext
22873 <ref name="{{echo|a}}">foo</ref>
22874
22875 <references />
22876 !!html/parsoid
22877 <p><span class="mw-ref" id="cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1"},"attrs":{"name":"{{echo|a}}"}}'><a href="./Main_Page#cite_note-.7B.7Becho.7Ca.7D.7D-1"><span class="mw-reflink-text">[1]</span></a></span>
22878 </p>
22879
22880 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22881 <li about="#cite_note-.7B.7Becho.7Ca.7D.7D-1" id="cite_note-.7B.7Becho.7Ca.7D.7D-1"><a href="./Main_Page#cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1" class="mw-reference-text">foo</span></li>
22882 </ol>
22883 !!end
22884
22885 !!test
22886 Ref: 19. ref-tags with identical name encodings should get identical indexes
22887 !! wikitext
22888 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22889
22890 <references />
22891 !! html/parsoid
22892 <p>1 <span about="#mwt3" class="mw-ref" id="cite_ref-a_.26_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_.26_b-1"},"attrs":{"name":"a &amp; b"}}'><a href="./Main_Page#cite_note-a_.26_b-1"><span class="mw-reflink-text">[1]</span></a></span> 2 <span about="#mwt4" class="mw-ref" id="cite_ref-a_.26_b_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a &amp;amp; b"}}'><a href="./Main_Page#cite_note-a_.26_b-1"><span class="mw-reflink-text">[1]</span></a></span>
22893 </p>
22894 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22895 <li about="#cite_note-a_.26_b-1" id="cite_note-a_.26_b-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-a_.26_b_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-a_.26_b_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a_.26_b-1" class="mw-reference-text">foo</span></li>
22896 </ol>
22897 !!end
22898
22899 !!test
22900 Ref: 20. ref-tags with identical names but different content should keep it
22901 !! wikitext
22902 A <ref name="foo">Foo one</ref>
22903 B <ref name="foo">Foo two</ref>
22904 C <ref name="foo" />
22905
22906 <references />
22907 !! html/parsoid
22908 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-foo_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-foo-1"},"attrs":{"name":"foo"}}'><a href="./Main_Page#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
22909 B <span about="#mwt4" class="mw-ref" id="cite_ref-foo_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"Foo two"},"attrs":{"name":"foo"}}'><a href="./Main_Page#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
22910 C <span about="#mwt6" class="mw-ref" id="cite_ref-foo_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"foo"}}'><a href="./Main_Page#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22911
22912 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-foo-1" id="cite_note-foo-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-foo_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-foo_1-1"><span class="mw-linkback-text">2 </span></a><a href="./Main_Page#cite_ref-foo_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text">Foo one</span></li>
22913 </ol>
22914 !!end
22915
22916 !!test
22917 References: 1. references tag without any refs should be handled properly
22918 !! wikitext
22919 <references />
22920 !! html/parsoid
22921 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22922 !!end
22923
22924 !!test
22925 References: 2. references tag with group only outputs references from that group
22926 !! wikitext
22927 A <ref group="a">foo</ref>
22928 B <ref group="b">bar</ref>
22929 C <ref>baz</ref>
22930
22931 <references group="a" />
22932 <references />
22933 <references group="b" />
22934 !! html/parsoid
22935 <p>A <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":{"group":"a"}}'><a href="./Main_Page#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
22936 B <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"b"}}'><a href="./Main_Page#cite_note-2" data-mw-group="b"><span class="mw-reflink-text">[b 1]</span></a></span>
22937 C <span class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="./Main_Page#cite_note-3"><span class="mw-reflink-text">[1]</span></a></span></p>
22938
22939 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22940 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" data-mw-group="a" 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>
22941 </ol>
22942 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22943 <li about="#cite_note-3" id="cite_note-3"><a href="./Main_Page#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">baz</span></li>
22944 </ol>
22945 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22946 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" data-mw-group="b" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
22947 </ol>
22948 !!end
22949
22950 !!test
22951 References: 3. ref list should be cleared after processing references
22952 !! wikitext
22953 A <ref>foo</ref>
22954
22955 <references />
22956
22957 B <ref>bar</ref>
22958
22959 <references />
22960 !! html/parsoid
22961 <p>A <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>
22962
22963 <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>
22964 </ol>
22965
22966 <p>B <span about="#mwt6" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
22967
22968 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22969 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
22970 </ol>
22971 !!end
22972
22973 !!test
22974 References: 4. only referenced group should be cleared after processing references
22975 !! wikitext
22976 A <ref group="a">afoo</ref>
22977 B <ref>bfoo</ref>
22978
22979 <references group="a" />
22980
22981 C <ref>cfoo</ref>
22982
22983 <references />
22984 !! html/parsoid
22985 <p>A <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":{"group":"a"}}'><a href="./Main_Page#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
22986 B <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
22987
22988 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">afoo</span></li>
22989 </ol>
22990
22991 <p>C <span about="#mwt8" class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="./Main_Page#cite_note-3"><span class="mw-reflink-text">[2]</span></a></span></p>
22992
22993 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bfoo</span></li><li about="#cite_note-3" id="cite_note-3"><a href="./Main_Page#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">cfoo</span></li>
22994 </ol>
22995 !!end
22996
22997 ## Don't expect this to rt since we're dropping content
22998 !! test
22999 References: 5. ref tags in references should be processed while ignoring all other content
23000 !! options
23001 parsoid=wt2html,html2html
23002 !! wikitext
23003 A <ref name="a" />
23004 B <ref name="b">bar</ref>
23005
23006 <references>
23007 <ref name="a">foo</ref>
23008 This should just get lost.
23009 </references>
23010 !! html/parsoid
23011 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="./Main_Page#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
23012 B <span about="#mwt4" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="./Main_Page#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
23013
23014
23015 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{},"body":{"html":"\n&lt;span about=\"#mwt8\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-a-1\"},\"attrs\":{\"name\":\"a\"}}&#39;>&lt;a href=\"./Main_Page#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>\n"}}'><li about="#cite_note-a-1" id="cite_note-a-1"><a href="./Main_Page#cite_ref-a_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><a href="./Main_Page#cite_ref-b_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
23016 </ol>
23017 !! end
23018
23019 !! test
23020 References: 6. <references /> from a transclusion
23021 !! wikitext
23022 <ref>Foo</ref> {{echo|<references />}}
23023 !! html/parsoid
23024 <p><span about="#mwt3" 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> <ol class="mw-references" typeof="mw:Extension/references mw:Transclusion" about="#mwt4" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;references />"}},"i":0}}]}'><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>
23025 </ol>
23026 !! end
23027
23028 !! test
23029 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
23030 !! wikitext
23031 A <ref>foo bar for a</ref>
23032 B <ref group="X" name="b" />
23033
23034 <references />
23035
23036 <references group="X">
23037 <ref name="b">foo</ref>
23038 </references>
23039 !! html/parsoid
23040 <p>A <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>
23041 B <span about="#mwt4" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}'><a href="./Main_Page#cite_note-b-2" data-mw-group="X"><span class="mw-reflink-text">[X 1]</span></a></span>
23042 </p>
23043
23044 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
23045 <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 bar for a</span></li>
23046 </ol>
23047
23048 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="X" data-mw='{"name":"references","attrs":{"group":"X"},"body":{"html":"\n&lt;span about=\"#mwt10\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-b-2\"},\"attrs\":{\"name\":\"b\"}}&#39;>&lt;a href=\"./Main_Page#cite_note-b-2\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"X\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[X 1]&lt;/span>&lt;/a>&lt;/span>\n"}}'>
23049 <li about="#cite_note-b-2" id="cite_note-b-2"><a href="./Main_Page#cite_ref-b_2-0" data-mw-group="X" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">foo</span></li>
23050 </ol>
23051 !! end
23052
23053 !! test
23054 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
23055 !! wikitext
23056 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
23057 <references />
23058 !! html/parsoid
23059 <p>X<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":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo {{echo|&lt;b>bar&lt;/b>}} and {{echo|baz}} boo&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
23060 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt7" 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 <b data-parsoid='{"stx":"html"}'>bar</b> and baz boo</span></li>
23061 </ol>
23062 !!end
23063
23064 # This test only works in wt2html now as the <references /> are always generated
23065 # unless selser is active. Once T72722 is fixed, we should add a changes test
23066 # here to ensure that unrelated changes don't add the new <references />
23067 # when selser is active.
23068 !! test
23069 References: 9. Generate missing references list at the end
23070 !! wikitext
23071 A <ref>foo</ref>
23072 B <ref group="inexistent">bar</ref>
23073 !! html/parsoid
23074 <p>A <span 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> B <span class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"inexistent"}}'><a href="./Main_Page#cite_note-2" data-mw-group="inexistent"><span class="mw-reflink-text">[inexistent 1]</span></a></span></p>
23075 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
23076 <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>
23077 </ol>
23078 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
23079 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" data-mw-group="inexistent" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
23080 </ol>
23081 !! end
23082
23083 !! test
23084 References: 10. New <references/> shouldn't be added for unrelated edits.
23085 !! options
23086 parsoid={
23087 "modes": ["selser"],
23088 "changes": [["#x", "remove"]],
23089 "selser": "noauto"
23090 }
23091 !! wikitext
23092 Unrelated text<span id="x"> that's going to disappear</span>.
23093 A <ref>foo</ref>
23094 !! wikitext/edited
23095 Unrelated text.
23096 A <ref>foo</ref>
23097 !!end
23098
23099 !! test
23100 Entities in ref name
23101 !! wikitext
23102 <ref name="test &amp; me">hi</ref>
23103 <references />
23104 !! html/parsoid
23105 <p><span about="#mwt2" class="mw-ref" id="cite_ref-test_.26_me_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-test_.26_me-1"},"attrs":{"name":"test &amp;amp; me"}}'><a href="./Main_Page#cite_note-test_.26_me-1"><span class="mw-reflink-text">[1]</span></a></span></p>
23106 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23107 <li about="#cite_note-test_.26_me-1" id="cite_note-test_.26_me-1"><a href="./Main_Page#cite_ref-test_.26_me_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-test_.26_me-1" class="mw-reference-text">hi</span></li>
23108 </ol>
23109 !! end
23110
23111 ## The output here may look funny, but it's what the php parser will do. The
23112 ## unclosed references tag becomes escaped text, and then a new references
23113 ## tag is auto-generated. The test is wt2html only because it roundtrips with
23114 ## nowiki tags, and the auto-generated references tag is only dropped in
23115 ## rtTestMode.
23116 !! test
23117 Generate references for unclosed references tag
23118 !! options
23119 parsoid=wt2html
23120 !! wikitext
23121 a<ref>foo</ref>
23122
23123 <references>
23124 !! html/parsoid
23125 <p>a<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" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
23126
23127 <p>&lt;references></p>
23128 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><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>
23129 !! end
23130
23131 !! test
23132 New reference serializes on its own line
23133 !! options
23134 parsoid=wt2wt,html2wt
23135 !! wikitext
23136 foo
23137 <references />
23138 !! html/parsoid
23139 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
23140 !! end
23141
23142 #### ----------------------------------------------------------------
23143 #### Parsoid-only testing of Parsoid's impl of LST
23144 #### Not implemented yet, see
23145 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
23146 #### ----------------------------------------------------------------
23147
23148 ## We still need to support serializing the older format while content is stored.
23149 !! test
23150 LST Sections: Backwards compatibility
23151 !! options
23152 parsoid={
23153 "suppressErrors": true,
23154 "modes": ["html2wt"]
23155 }
23156 !! wikitext
23157 <section begin="2011-05-16" />
23158 <section end="2014-04-10 (MW 1.23wmf22)" />
23159 !! html/parsoid
23160 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
23161 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
23162 !! end
23163
23164 ## The unconventional output is the result of `usePHPPreProcessor` being
23165 ## disabled in parserTests.js. This test is mainly just to show <section> is
23166 ## recognized as an extension tag w/o a native handler.
23167 !! test
23168 LST Sections: Newfangled approach
23169 !! options
23170 parsoid={ "suppressErrors": true }
23171 !! wikitext
23172 <section begin="2011-05-16" />
23173 <section end="2014-04-10 (MW 1.23wmf22)" />
23174 !! html/parsoid
23175 <p><span typeof="mw:Extension/section" about="#mwt1" data-parsoid='{"stx":"html","selfClose":true,"src":"&lt;section begin=\"2011-05-16\" />","tagWidths":[30,0]}'>&lt;section begin="2011-05-16" /></span>
23176 <span typeof="mw:Extension/section" about="#mwt2" data-parsoid='{"stx":"html","selfClose":true,"src":"&lt;section end=\"2014-04-10 (MW 1.23wmf22)\" />","tagWidths":[43,0]}'>&lt;section end="2014-04-10 (MW 1.23wmf22)" /></span></p>
23177 !! end
23178
23179 #--------- Test stripping of empty nodes in template content ----------
23180 !!test
23181 Empty LI and TR nodes should be stripped from template content
23182 !!wikitext
23183 {{EmptyLITest}}
23184 {{EmptyTRTest}}
23185 !!html/parsoid
23186 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
23187 <li>a</li>
23188 <li>b</li>
23189 </ul>
23190 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
23191 <tbody>
23192 <tr>
23193 <td>foo</td>
23194 </tr>
23195 <tr>
23196 <td>bar</td>
23197 </tr>
23198 </tbody>
23199 </table>
23200 !!end
23201
23202 !!test
23203 Empty LI and TR nodes should not be stripped from top-level content
23204 !!wikitext
23205 * a
23206 *
23207 * b
23208 {|
23209 |-
23210 |-
23211 |foo
23212 |}
23213 !!html/parsoid
23214 <ul>
23215 <li> a</li>
23216 <li></li>
23217 <li> b</li>
23218 </ul>
23219 <table>
23220 <tbody>
23221 <tr></tr>
23222 <tr>
23223 <td>foo</td>
23224 </tr>
23225 </tbody>
23226 </table>
23227 !!end
23228
23229 !!test
23230 Empty TR nodes should not be stripped if they have any attributes set
23231 !!wikitext
23232 {{EmptyTRWithHTMLAttrTest}}
23233 !!html/parsoid
23234 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
23235 <tr align="center"></tr>
23236 <tr><td>foo</td></tr>
23237 <tr align="center"></tr>
23238 <tr><td>bar</td></tr>
23239 </table>
23240 !!end
23241
23242 #### ----------------------------------------------------------------
23243 #### The following section of tests are primarily to test
23244 #### wikitext escaping capabilities of Parsoid. Given that
23245 #### escaping can be done any number of ways, the wikitext (input)
23246 #### is always adjusted to reflect how Parsoid adds nowiki
23247 #### escape tags.
23248 ####
23249 #### We are marking several tests as parsoid-only since the
23250 #### HTML in the result section is different from what the
23251 #### PHP parser generates for it.
23252 #### ----------------------------------------------------------------
23253
23254
23255 #### --------------- Headings ---------------
23256 #### 0. Unnested
23257 #### 1. Nested inside html <h1>=foo=</h1>
23258 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
23259 #### 3. Nested inside html with wikitext split by html tags
23260 #### 4. No escape needed
23261 #### 5. Empty headings <h1></h1>
23262 #### 6. Heading chars in SOL context
23263 #### ----------------------------------------
23264 !! test
23265 Headings: 0. Unnested
23266 !! options
23267 parsoid=html2wt
23268 !! html/parsoid
23269 <p>=foo=</p>
23270
23271 <p> =foo=
23272 <!--cmt-->
23273 =foo=</p>
23274
23275 <p>=foo<i>a</i>=</p>
23276 !! wikitext
23277 <nowiki>=foo=</nowiki>
23278
23279 <nowiki> </nowiki>=foo=
23280 <!--cmt-->
23281 <nowiki>=foo=</nowiki>
23282
23283 =foo''a''<nowiki>=</nowiki>
23284 !!end
23285
23286 # New headings and existing headings are handled differently
23287 !! test
23288 Headings: 1. Nested inside html
23289 !! options
23290 parsoid=html2wt
23291 !! html/parsoid
23292 <h1>=foo=</h1>
23293 <h2>=foo=</h2>
23294 <h3>=foo=</h3>
23295
23296 <h1 data-parsoid=''>=foo=</h1>
23297 <h2 data-parsoid=''>=foo=</h2>
23298 <h3 data-parsoid=''>=foo=</h3>
23299 <h4 data-parsoid=''>=foo=</h4>
23300 <h5 data-parsoid=''>=foo=</h5>
23301 <h6 data-parsoid=''>=foo=</h6>
23302 !! wikitext
23303 = =foo= =
23304
23305 == =foo= ==
23306
23307 === =foo= ===
23308
23309 =<nowiki>=foo=</nowiki>=
23310 ==<nowiki>=foo=</nowiki>==
23311 ===<nowiki>=foo=</nowiki>===
23312 ====<nowiki>=foo=</nowiki>====
23313 =====<nowiki>=foo=</nowiki>=====
23314 ======<nowiki>=foo=</nowiki>======
23315
23316 !!end
23317
23318 !! test
23319 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
23320 !! options
23321 parsoid=html2wt
23322 !! html/parsoid
23323 <h1>foo</h1>*bar
23324 <h1>foo</h1>=bar
23325 <h1>foo</h1>=bar=
23326 !! wikitext
23327 = foo =
23328 <nowiki>*</nowiki>bar
23329
23330 = foo =
23331 =bar
23332
23333 = foo =
23334 <nowiki>=bar=</nowiki>
23335 !!end
23336
23337 !! test
23338 Headings: 3. Nested inside html with wikitext split by html tags
23339 !! options
23340 parsoid=html2wt
23341 !! html/parsoid
23342 <h1>=<b>bold</b>foo=</h1>
23343 !! wikitext
23344 = ='''bold'''foo= =
23345 !!end
23346
23347 !! test
23348 Headings: 4a. No escaping needed (testing just h1 and h2)
23349 !! options
23350 parsoid=html2wt
23351 !! html/parsoid
23352 <h1>=foo</h1>
23353 <h1>foo=</h1>
23354 <h1> =foo= </h1>
23355 <h1>=foo= bar</h1>
23356 <h2>=foo</h2>
23357 <h2>foo=</h2>
23358 <h1>=</h1>
23359 <h1><i>=</i>foo=</h1>
23360 !! wikitext
23361 = =foo =
23362
23363 = foo= =
23364
23365 = =foo= =
23366
23367 = =foo= bar =
23368
23369 == =foo ==
23370
23371 == foo= ==
23372
23373 = = =
23374
23375 = ''=''foo= =
23376 !!end
23377
23378 !! test
23379 Headings: 4b. No escaping needed (inside p-tags)
23380 !! options
23381 parsoid=html2wt
23382 !! html/parsoid
23383 <p>===
23384 =foo= x
23385 =foo= <s></s>
23386 </p>
23387 !! wikitext
23388 ===
23389 =foo= x
23390 =foo= <s></s>
23391 !!end
23392
23393 !! test
23394 Headings: 5. Empty headings
23395 !! options
23396 parsoid=html2wt
23397 !! html/parsoid
23398 <h1 data-parsoid='{}'></h1>
23399
23400 <h2 data-parsoid='{}'></h2>
23401
23402 <h3 data-parsoid='{}'></h3>
23403
23404 <h4 data-parsoid='{}'></h4>
23405
23406 <h5 data-parsoid='{}'></h5>
23407
23408 <h6 data-parsoid='{}'></h6>
23409 !! wikitext
23410 =<nowiki/>=
23411
23412 ==<nowiki/>==
23413
23414 ===<nowiki/>===
23415
23416 ====<nowiki/>====
23417
23418 =====<nowiki/>=====
23419
23420 ======<nowiki/>======
23421 !!end
23422
23423 !! test
23424 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23425 !! options
23426 parsoid=html2wt
23427 !! html/parsoid
23428 <p>=a=</p>
23429
23430 <p>=a=</p>
23431
23432 <p>=a=</p>
23433 !! wikitext
23434 <nowiki>=a=</nowiki>
23435
23436 <nowiki>=a=</nowiki>
23437
23438 <nowiki>=a=</nowiki>
23439 !!end
23440
23441 !! test
23442 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23443 !! options
23444 parsoid=html2wt
23445 !! html/parsoid
23446 <p>=a=
23447 b</p>
23448
23449 <p>=a=
23450 b</p>
23451
23452 <p>=a=
23453 b</p>
23454 !! wikitext
23455 <nowiki>=a=</nowiki>
23456 b
23457
23458 <nowiki>=a=</nowiki>
23459 b
23460
23461 <nowiki>=a=</nowiki>
23462 b
23463 !!end
23464
23465 !! test
23466 Headings: 6c. Heading chars in SOL context (leading newline break)
23467 !! options
23468 parsoid=html2wt
23469 !! html/parsoid
23470 <p>a
23471 =b=</p>
23472 !! wikitext
23473 a
23474 <nowiki>=b=</nowiki>
23475 !!end
23476
23477 !! test
23478 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23479 !! options
23480 parsoid=html2wt
23481 !! html/parsoid
23482 <!--c0--><p>=a=</p>
23483
23484 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23485 !! wikitext
23486 <!--c0--><nowiki>=a=</nowiki>
23487
23488 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23489 !!end
23490
23491 !! test
23492 Headings: 6d. Heading chars in SOL context (No escaping needed)
23493 !! options
23494 parsoid=html2wt
23495 !! html/parsoid
23496 =a=<div>b</div>
23497 !! wikitext
23498 =a=<div>b</div>
23499 !!end
23500
23501 !! test
23502 Headings: 7. Insert a newline between new content and headings
23503 !! options
23504 parsoid=html2wt
23505 !! html/parsoid
23506 <h2>NEW</h2>
23507 <p>new</p>
23508 <h2 data-parsoid='{}'>A</h2>
23509 <p data-parsoid='{}'>a</p>
23510 !! wikitext
23511 == NEW ==
23512 new
23513
23514 ==A==
23515 a
23516
23517 !! end
23518
23519 #### --------------- Lists ---------------
23520 #### 0. Outside nests (*foo, etc.)
23521 #### 1. Nested inside html <ul><li>*foo</li></ul>
23522 #### 2. Inside definition lists
23523 #### 3. Only bullets at start should be escaped
23524 #### 4. No escapes needed
23525 #### 5. No unnecessary escapes
23526 #### 6. Escape bullets in SOL position
23527 #### 7. Escape bullets in a multi-line context
23528 #### ----------------------------------------
23529
23530 !! test
23531 Lists: 0. Outside nests
23532 !! options
23533 parsoid=html2wt
23534 !! html/parsoid
23535 <p>*foo</p>
23536
23537 <p>#foo</p>
23538
23539 <p>;Foo:bar</p>
23540 !! wikitext
23541 <nowiki>*</nowiki>foo
23542
23543 <nowiki>#</nowiki>foo
23544
23545 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23546 !!end
23547
23548 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23549 ## to test wikitext escaping, and insignificant whitespace diffs
23550 ## cause PHP parser tests to barf
23551 !! test
23552 Lists: 1. Nested inside html (No unnecessary escapes)
23553 !! options
23554 parsoid=html2wt
23555 !! html/parsoid
23556 <ul>
23557 <li>*foo</li>
23558 <li>#foo</li>
23559 <li>:foo</li>
23560 <li>;foo</li>
23561 <li data-parsoid='{}'>*foo</li>
23562 <li data-parsoid='{}'>#foo</li>
23563 <li data-parsoid='{}'>:foo</li>
23564 <li data-parsoid='{}'>;foo</li>
23565 </ul>
23566
23567 <ol>
23568 <li>*foo</li>
23569 <li>#foo</li>
23570 <li>:foo</li>
23571 <li>;foo</li>
23572 <li data-parsoid='{}'>*foo</li>
23573 <li data-parsoid='{}'>#foo</li>
23574 <li data-parsoid='{}'>:foo</li>
23575 <li data-parsoid='{}'>;foo</li>
23576 </ol>
23577 !! wikitext
23578 * *foo
23579 * #foo
23580 * :foo
23581 * ;foo
23582 *<nowiki>*foo</nowiki>
23583 *<nowiki>#foo</nowiki>
23584 *<nowiki>:foo</nowiki>
23585 *<nowiki>;foo</nowiki>
23586
23587 # *foo
23588 # #foo
23589 # :foo
23590 # ;foo
23591 #<nowiki>*foo</nowiki>
23592 #<nowiki>#foo</nowiki>
23593 #<nowiki>:foo</nowiki>
23594 #<nowiki>;foo</nowiki>
23595 !!end
23596
23597 !! test
23598 Lists: 2. Inside definition lists
23599 !! options
23600 parsoid=html2wt
23601 !! html/parsoid
23602 <dl><dt>;foo</dt></dl>
23603 <dl><dt>:foo</dt></dl>
23604 <dl><dt>:foo</dt>
23605 <dd>bar</dd></dl>
23606 <dl><dd>:foo</dd></dl>
23607 !! wikitext
23608 ; ;foo
23609
23610 ; <nowiki>:foo</nowiki>
23611
23612 ; <nowiki>:foo</nowiki>
23613 : bar
23614
23615 : :foo
23616 !!end
23617
23618 !! test
23619 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23620 !! options
23621 parsoid=html2wt
23622 !! html/parsoid
23623 <ul>
23624 <li>*foo*bar</li>
23625 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23626 </ul>
23627 !! wikitext
23628 * *foo*bar
23629 *<nowiki>*foo</nowiki>''it''*bar
23630 !!end
23631
23632 !! test
23633 Lists: 4. No escapes needed
23634 !! options
23635 parsoid=html2wt
23636 !! html/parsoid
23637 <ul>
23638 <li>foo*bar
23639 </li>
23640 </ul>
23641 <ul>
23642 <li><i>foo</i>*bar
23643 </li>
23644 </ul>
23645 <ul>
23646 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23647 </li>
23648 </ul>
23649 <ul>
23650 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23651 </li>
23652 </ul>
23653 !! wikitext
23654 *foo*bar
23655
23656 *''foo''*bar
23657
23658 *[[Foo]]: bar
23659
23660 *[[Foo]]*bar
23661 !!end
23662
23663 !! test
23664 Lists: 5. No unnecessary escapes
23665 !! options
23666 parsoid=html2wt
23667 !! html/parsoid
23668 <ul><li> bar <span>[[foo]]</span></li></ul>
23669 <ul><li> =bar <span>[[foo]]</span></li></ul>
23670 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23671 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23672 <ul><li> =bar <span>foo]]</span>=</li></ul>
23673 <ul><li> <s></s>: a</li></ul>
23674 <ul><li> <i>* foo</i></li></ul>
23675
23676 !! wikitext
23677 * bar <span><nowiki>[[foo]]</nowiki></span>
23678
23679 * =bar <span><nowiki>[[foo]]</nowiki></span>
23680
23681 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23682
23683 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23684
23685 * =bar <span>foo]]</span>=
23686
23687 * <s></s>: a
23688
23689 * ''* foo''
23690 !!end
23691
23692 !! test
23693 Lists: 6. Escape bullets in SOL position
23694 !! options
23695 parsoid=html2wt
23696 !! html/parsoid
23697 <p><!--cmt-->*foo</p>
23698 !! wikitext
23699 <!--cmt--><nowiki>*</nowiki>foo
23700 !!end
23701
23702 !! test
23703 Lists: 7. Escape bullets in a multi-line context
23704 !! options
23705 parsoid=html2wt
23706 !! html/parsoid
23707 <p>a
23708 *b
23709 </p>
23710 !! wikitext
23711 a
23712 <nowiki>*</nowiki>b
23713 !!end
23714
23715 !! test
23716 Lists: 8. Escape colons only if not present in tags
23717 !! options
23718 parsoid=html2wt
23719 !! html/parsoid
23720 <dl><dt>a:b<i>c:d</i></dt></dl>
23721 !! wikitext
23722 ; <nowiki>a:b</nowiki>''c:d''
23723 !! end
23724
23725 #### --------------- HRs ---------------
23726 #### 1. Single line
23727 #### -----------------------------------
23728
23729 !! test
23730 HRs: 1. Single line
23731 !! options
23732 parsoid=html2wt
23733 !! html/parsoid
23734 <hr />----
23735 <hr />=foo=
23736 <hr />*foo
23737 !! wikitext
23738 ----<nowiki>----</nowiki>
23739 ----=foo=
23740 ----*foo
23741 !! end
23742
23743 #### --------------- Tables ---------------
23744 #### 1a. Simple example
23745 #### 1b. No escaping needed (!foo)
23746 #### 1c. No escaping needed (|foo)
23747 #### 1d. No escaping needed (|}foo)
23748 ####
23749 #### 2a. Nested in td (<td>foo|bar</td>)
23750 #### 2b. Nested in td (<td>foo||bar</td>)
23751 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23752 ####
23753 #### 3a. Nested in th (<th>foo!bar</th>)
23754 #### 3b. Nested in th (<th>foo!!bar</th>)
23755 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23756 ####
23757 #### 4a. Escape -
23758 #### 4b. Escape +
23759 #### 4c. No escaping needed
23760 #### --------------------------------------
23761
23762 !! test
23763 Tables: 1a. Simple example
23764 !! options
23765 parsoid=html2wt
23766 !! html/parsoid
23767 <p>{|
23768 |}
23769 </p>
23770 !! wikitext
23771 <nowiki>{|</nowiki>
23772 |}
23773 !! end
23774
23775 !! test
23776 Tables: 1b. No escaping needed
23777 !! options
23778 parsoid=html2wt
23779 !! html/parsoid
23780 <p>!foo
23781 </p>
23782 !! wikitext
23783 !foo
23784 !! end
23785
23786 !! test
23787 Tables: 1c. No escaping needed
23788 !! options
23789 parsoid=html2wt
23790 !! html/parsoid
23791 <p>|foo
23792 </p>
23793 !! wikitext
23794 |foo
23795 !! end
23796
23797 !! test
23798 Tables: 1d. No escaping needed
23799 !! options
23800 parsoid=html2wt
23801 !! html/parsoid
23802 <p>|}foo
23803 </p>
23804 !! wikitext
23805 |}foo
23806 !! end
23807
23808 !! test
23809 Tables: 2a. Nested in td
23810 !! options
23811 parsoid=html2wt
23812 !! html/parsoid
23813 <table><tbody><tr>
23814 <td>foo|bar</td></tr>
23815 <tr><td>x<div>a|b</div></td>
23816 </tbody></table>
23817 !! wikitext
23818 {|
23819 |<nowiki>foo|bar</nowiki>
23820 |-
23821 |x<div><nowiki>a|b</nowiki></div>
23822 |}
23823 !! html/php+tidy
23824 <table>
23825 <tr>
23826 <td>foo|bar</td>
23827 </tr>
23828 <tr>
23829 <td>x
23830 <div>a|b</div>
23831 </td>
23832 </tr>
23833 </table>
23834 !! end
23835
23836 !! test
23837 Tables: 2b. Nested in td
23838 !! options
23839 parsoid=html2wt
23840 !! html/parsoid
23841 <table><tbody><tr>
23842 <td>foo||bar</td>
23843 <td>a<i>b||c</i></td>
23844 <td>a<i><div>b||c</div></i></td>
23845 </tr></tbody></table>
23846 !! wikitext
23847 {|
23848 |<nowiki>foo||bar</nowiki>
23849 |a''<nowiki>b||c</nowiki>''
23850 |a''<div><nowiki>b||c</nowiki></div>''
23851 |}
23852 !! html/php
23853 <table>
23854 <tr>
23855 <td>foo||bar
23856 </td>
23857 <td>a<i>b||c</i>
23858 </td>
23859 <td>a<i><div>b||c</div></i>
23860 </td></tr></table>
23861
23862 !! end
23863
23864 !! test
23865 Tables: 2c. Nested in td -- no escaping needed
23866 !! options
23867 parsoid=html2wt
23868 !! html/*
23869 <table>
23870 <tr>
23871 <td>foo!!bar
23872 </td></tr></table>
23873
23874 !! wikitext
23875 {|
23876 |foo!!bar
23877 |}
23878 !! end
23879
23880 !! test
23881 Tables: 3a. Nested in th
23882 !! options
23883 parsoid=html2wt
23884 !! html/*
23885 <table>
23886 <tr>
23887 <th>foo!bar
23888 </th></tr></table>
23889
23890 !! wikitext
23891 {|
23892 !foo!bar
23893 |}
23894 !! end
23895
23896 !! test
23897 Tables: 3b. Nested in th
23898 !! options
23899 parsoid=html2wt
23900 !! html/parsoid
23901 <table><tbody>
23902 <tr><th>foo!!bar</th>
23903 <th><i>foo|bar</i></th>
23904 <th><i>foo!!bar</i></th>
23905 <th><i><span>foo!!bar</span></i></th>
23906 </tr></tbody></table>
23907 !! wikitext
23908 {|
23909 !<nowiki>foo!!bar</nowiki>
23910 !''<nowiki>foo|bar</nowiki>''
23911 !''<nowiki>foo!!bar</nowiki>''
23912 !''<span><nowiki>foo!!bar</nowiki></span>''
23913 |}
23914 !! html/php
23915 <table>
23916 <tr>
23917 <th>foo!!bar
23918 </th>
23919 <th><i>foo|bar</i>
23920 </th>
23921 <th><i>foo!!bar</i>
23922 </th>
23923 <th><i><span>foo!!bar</span></i>
23924 </th></tr></table>
23925
23926 !! end
23927
23928 !! test
23929 Tables: 3c. Nested in th
23930 !! options
23931 parsoid=html2wt
23932 !! html/parsoid
23933 <table><tbody>
23934 <tr><th>foo||bar</th>
23935 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23936 </tr></tbody></table>
23937 !! wikitext
23938 {|
23939 !<nowiki>foo||bar</nowiki>
23940 !<nowiki>foo||bar</nowiki>
23941 |}
23942 !! html/php
23943 <table>
23944 <tr>
23945 <th>foo||bar
23946 </th>
23947 <th>foo||bar
23948 </th></tr></table>
23949
23950 !! end
23951
23952 !! test
23953 Tables: 4a. Escape -
23954 !! options
23955 parsoid=html2wt
23956 !! html/*
23957 <table>
23958 <tr>
23959 <th>-bar
23960 </th></tr>
23961 <tr>
23962 <td>-bar
23963 </td></tr></table>
23964
23965 !! wikitext
23966 {|
23967 !-bar
23968 |-
23969 |<nowiki>-bar</nowiki>
23970 |}
23971 !! end
23972
23973 !! test
23974 Tables: 4b. Escape +
23975 !! options
23976 parsoid=html2wt
23977 !! html/*
23978 <table>
23979 <tr>
23980 <th>+bar
23981 </th></tr>
23982 <tr>
23983 <td>+bar
23984 </td></tr></table>
23985
23986 !! wikitext
23987 {|
23988 !+bar
23989 |-
23990 |<nowiki>+bar</nowiki>
23991 |}
23992 !! end
23993
23994 !! test
23995 Tables: 4c. No escaping needed
23996 !! options
23997 parsoid=html2wt
23998 !! html/parsoid
23999 <table><tbody>
24000 <tr><td>foo-bar</td><td>foo+bar</td></tr>
24001 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
24002 <tr><td>foo
24003 <p>bar|baz
24004 +bar
24005 -bar</p></td></tr>
24006 <tr><td>x
24007 <div>a|b</div></td>
24008 </tbody></table>
24009 !! wikitext
24010 {|
24011 |foo-bar
24012 |foo+bar
24013 |-
24014 |''foo''-bar
24015 |''foo''+bar
24016 |-
24017 |foo
24018 bar|baz
24019 +bar
24020 -bar
24021 |-
24022 |x
24023 <div>a|b</div>
24024 |}
24025 !! html/php
24026 <table>
24027 <tr>
24028 <td>foo-bar
24029 </td>
24030 <td>foo+bar
24031 </td></tr>
24032 <tr>
24033 <td><i>foo</i>-bar
24034 </td>
24035 <td><i>foo</i>+bar
24036 </td></tr>
24037 <tr>
24038 <td>foo
24039 <p>bar|baz
24040 +bar
24041 -bar
24042 </p>
24043 </td></tr>
24044 <tr>
24045 <td>x
24046 <div>a|b</div>
24047 </td></tr></table>
24048
24049 !! end
24050
24051 !! test
24052 Tables: 4d. No escaping needed
24053 !! options
24054 parsoid=html2wt
24055 !! html/parsoid
24056 <table>
24057 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
24058 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
24059 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
24060 </tbody></table>
24061 !! wikitext
24062 {|
24063 |[[Foo]]-bar
24064 ||+1
24065 ||-2
24066 |}
24067 !! html/php
24068 <table>
24069 <tr>
24070 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
24071 </td>
24072 <td>+1
24073 </td>
24074 <td>-2
24075 </td></tr></table>
24076
24077 !! end
24078
24079 !! test
24080 T97430: Don't emit empty nowiki pairs around marker meta tags
24081 !! options
24082 parsoid=html2wt
24083 !! html/parsoid
24084 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24085 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
24086 !! wikitext
24087 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24088 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
24089 !! end
24090
24091 !! test
24092 Unclosed xmlish element in table line shouldn't eat end delimiters
24093 !! options
24094 parsoid=html2wt
24095 !! html/parsoid
24096 <table>
24097 <tbody><tr><td> &lt;foo</td>
24098 <td> bar></td></tr>
24099 </tbody></table>
24100 !! wikitext
24101 {|
24102 | <foo
24103 | bar>
24104 |}
24105 !! html/php
24106 <table>
24107 <tr>
24108 <td> &lt;foo
24109 </td>
24110 <td> bar&gt;
24111 </td></tr></table>
24112
24113 !! end
24114
24115 #### --------------- Links ----------------
24116 #### 1. Quote marks in link text
24117 #### 2. Wikilinks: Escapes needed
24118 #### 3. Wikilinks: No escapes needed
24119 #### 4. Extlinks: Escapes needed
24120 #### 5. Extlinks: No escapes needed
24121 #### --------------------------------------
24122 !! test
24123 Links 1. WikiLinks: No escapes needed
24124 !! options
24125 parsoid=html2wt
24126 !! html/parsoid
24127 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
24128 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
24129 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
24130 !! wikitext
24131 [[Foo|Foo''boo'']]
24132 [[Foo|[Foobar]]]
24133 [[Foo|x [Foobar] x]]
24134 !! html/php
24135 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
24136 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
24137 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
24138 </p>
24139 !! end
24140
24141 !! test
24142 Links 2. WikiLinks: Escapes needed
24143 !! options
24144 parsoid=html2wt
24145 !! html/parsoid
24146 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
24147 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
24148 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
24149 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
24150 <a href="Foo" rel="mw:WikiLink">|Bar</a>
24151 <a href="Foo" rel="mw:WikiLink">]]bar</a>
24152 <a href="Foo" rel="mw:WikiLink">[[bar</a>
24153 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
24154 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
24155 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
24156 !! wikitext
24157 [[Foo|<nowiki>Foobar]</nowiki>]]
24158 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
24159 [[Foo|<nowiki>[[Bar]]</nowiki>]]
24160 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
24161 [[Foo|<nowiki>|Bar</nowiki>]]
24162 [[Foo|<nowiki>]]bar</nowiki>]]
24163 [[Foo|<nowiki>[[bar</nowiki>]]
24164 [[Foo|<nowiki>x [[ y</nowiki>]]
24165 [[Foo|<nowiki>x ]] y</nowiki>]]
24166 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
24167 !! html/php
24168 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
24169 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
24170 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
24171 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
24172 <a href="/wiki/Foo" title="Foo">|Bar</a>
24173 <a href="/wiki/Foo" title="Foo">]]bar</a>
24174 <a href="/wiki/Foo" title="Foo">[[bar</a>
24175 <a href="/wiki/Foo" title="Foo">x [[ y</a>
24176 <a href="/wiki/Foo" title="Foo">x ]] y</a>
24177 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
24178 </p>
24179 !! end
24180
24181 !! test
24182 Links 3. WikiLinks: No escapes needed
24183 !! options
24184 parsoid=html2wt
24185 !! html/parsoid
24186 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
24187 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
24188 !! wikitext
24189 [[Foo|[Foobar]]
24190 [[Foo|foo|bar]]
24191 !! html/php
24192 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
24193 <a href="/wiki/Foo" title="Foo">foo|bar</a>
24194 </p>
24195 !! end
24196
24197 !! test
24198 Links 4. ExtLinks: Escapes needed
24199 !! options
24200 parsoid=html2wt
24201 !! html/parsoid
24202 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
24203 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
24204 <p>[http://google.com]</p>
24205 <p>[http://google.com google]</p>
24206 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
24207 <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>
24208 !! wikitext
24209 [http://google.com <nowiki>[google]</nowiki>]
24210 [http://google.com <nowiki>google]</nowiki>]
24211
24212 <nowiki>[http://google.com]</nowiki>
24213
24214 <nowiki>[http://google.com google]</nowiki>
24215
24216 [http://google.com<nowiki>]</nowiki>
24217
24218 [{{echo|http://google.com}}<nowiki>]</nowiki>
24219 !! html/php
24220 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
24221 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
24222 </p><p>[http://google.com]
24223 </p><p>[http://google.com google]
24224 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24225 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24226 </p>
24227 !! end
24228
24229 !! test
24230 Links 5. ExtLinks: No escapes needed
24231 !! options
24232 parsoid=html2wt
24233 !! html/parsoid
24234 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
24235 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
24236 !! wikitext
24237 [http://google.com [google]
24238
24239 [[http://google.com]]
24240 !! html/php
24241 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
24242 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
24243 </p>
24244 !! end
24245
24246 !! test
24247 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
24248 !! options
24249 parsoid=html2wt
24250 !! html/parsoid
24251 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
24252 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
24253 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
24254 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
24255 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
24256 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
24257 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24258 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
24259 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24260 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
24261 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
24262 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
24263 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
24264 </p>
24265 !! wikitext
24266 x<nowiki/>http://example.com<nowiki/>y
24267 http://example.com<nowiki/>?x
24268 http://example.com<nowiki/>&x
24269 http://example.com<nowiki/>'x
24270 http://example.com<nowiki/>,x
24271 http://example.com<nowiki/>.x
24272 http://example.com<nowiki/>;x
24273 http://example.com<nowiki/>:x
24274 http://example.com<nowiki/>;x
24275 http://example.com<nowiki/>!x
24276 http://example.com<nowiki/>=x
24277 http://example.com<nowiki/>(x)
24278 http://example.com(x<nowiki/>)
24279 !! end
24280
24281 !! test
24282 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24283 !! options
24284 parsoid=html2wt
24285 !! html/parsoid
24286 <p>x
24287 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
24288 y
24289 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
24290 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
24291 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
24292 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
24293 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
24294 </p>
24295 !! wikitext
24296 x
24297 http://example.com
24298 y
24299 "http://example.com"
24300 (http://example.com)
24301 (http://example.com) foo
24302 http://example.com,
24303 http://example.com, foo
24304 !! html/php
24305 <p>x
24306 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
24307 y
24308 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
24309 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
24310 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
24311 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
24312 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
24313 </p>
24314 !! end
24315
24316 !! test
24317 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24318 !! options
24319 parsoid=html2wt
24320 !! html/parsoid
24321 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
24322 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
24323 !! wikitext
24324 http://example.com.,;:!?\
24325 -http://example.com:
24326 !! html/php
24327 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
24328 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
24329 </p>
24330 !! end
24331
24332 !! test
24333 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
24334 !! options
24335 parsoid=html2wt
24336 !! html/parsoid
24337 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
24338 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
24339 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
24340 !! wikitext
24341 RFC 123<nowiki/>4
24342 RFC 123<nowiki/>y
24343 X<nowiki/>RFC 123<nowiki/>y
24344 !! end
24345
24346 !! test
24347 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
24348 !! options
24349 parsoid=html2wt
24350 !! html/parsoid
24351 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24352 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24353 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24354 </p>
24355 !! wikitext
24356 RFC 123?foo
24357 RFC 123&foo
24358 -RFC 123-
24359 !! html/php
24360 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24361 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24362 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24363 </p>
24364 !! end
24365
24366 !! test
24367 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
24368 !! options
24369 parsoid=html2wt
24370 !! html/parsoid
24371 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24372 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24373 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24374 !! wikitext
24375 PMID 123<nowiki/>4
24376 PMID 123<nowiki/>y
24377 X<nowiki/>PMID 123<nowiki/>y
24378 !! end
24379
24380 !! test
24381 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
24382 !! options
24383 parsoid=html2wt
24384 !! html/parsoid
24385 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24386 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24387 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24388 </p>
24389 !! wikitext
24390 PMID 123?foo
24391 PMID 123&foo
24392 -PMID 123-
24393 !! html/php
24394 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24395 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24396 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24397 </p>
24398 !! end
24399
24400 !! test
24401 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
24402 !! options
24403 parsoid=html2wt
24404 !! html/parsoid
24405 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24406 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24407 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24408 </p>
24409 !! wikitext
24410 ISBN 1234567890<nowiki/>1
24411 ISBN 1234567890<nowiki/>x
24412 a<nowiki/>ISBN 1234567890<nowiki/>b
24413 !! end
24414
24415 !! test
24416 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
24417 !! options
24418 parsoid=html2wt
24419 !! html/parsoid
24420 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24421 !! wikitext
24422 -ISBN 1234567890's
24423 !! html/php
24424 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24425 </p>
24426 !! end
24427
24428 !! test
24429 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24430 !! options
24431 parsoid=html2wt
24432 !! html/*
24433 <p>this is not a link: http://example.com
24434 </p>
24435 !! wikitext
24436 this is not a link: <nowiki>http://example.com</nowiki>
24437 !! end
24438
24439 !! test
24440 Links 15. Link trails can't become link prefixes.
24441 !! options
24442 language=is
24443 parsoid=html2wt
24444 !! html/parsoid
24445 <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>
24446 !! wikitext
24447 [[Söfnuður]]-[[00]]
24448 !! html/php
24449 <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>
24450 </p>
24451 !! end
24452
24453 #### --------------- Quotes ---------------
24454 #### 1. Quotes inside <b> and <i>
24455 #### 2. Link fragments separated by <i> and <b> tags
24456 #### 3. Link fragments inside <i> and <b>
24457 #### 4. No escaping needed
24458 #### --------------------------------------
24459 !! test
24460 1a. Quotes inside <b> and <i>
24461 !! options
24462 parsoid=html2wt
24463 !! html/*
24464 <p><i>'foo'</i>
24465 <i>''foo''</i>
24466 <i>'''foo'''</i>
24467 <i>foo</i>'s
24468 <b>'foo'</b>
24469 <b>''foo''</b>
24470 <b>'''foo'''</b>
24471 <b>foo'<i>bar'</i>baz</b>
24472 <b>foo</b>'s
24473 '<i>foo</i>
24474 <i>foo</i>'
24475 <i>foo'</i>'
24476 '<i>foo</i>'
24477 '<b>foo</b>
24478 <b>foo</b>'
24479 '<b>foo</b>'
24480 <i>fools'<span> errand</span></i>
24481 <i><span>fool</span>'s errand</i>
24482 '<i>foo</i> bar '<i>baz</i>
24483 a|!*#-:;+-~[]{}b'<i>x</i>
24484 </p>
24485 !! wikitext
24486 ''<nowiki/>'foo'''
24487 ''<nowiki>''foo''</nowiki>''
24488 ''<nowiki>'''foo'''</nowiki>''
24489 ''foo''<nowiki/>'s
24490 '''<nowiki/>'foo''''
24491 '''<nowiki>''foo''</nowiki>'''
24492 '''<nowiki>'''foo'''</nowiki>'''
24493 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24494 '''foo'''<nowiki/>'s
24495 '''foo''
24496 ''foo''<nowiki/>'
24497 ''foo'''<nowiki/>'
24498 '''foo''<nowiki/>'
24499 ''''foo'''
24500 '''foo'''<nowiki/>'
24501 ''''foo'''<nowiki/>'
24502 ''fools'<span> errand</span>''
24503 ''<span>fool</span>'s errand''
24504 '<nowiki/>''foo'' bar '''baz''
24505 a|!*#-:;+-~[]{}b'''x''
24506 !! end
24507
24508 !! test
24509 1b. Quotes inside <b> and <i> with other tags on same line
24510 !! options
24511 parsoid=html2wt
24512 !! html/parsoid
24513 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24514 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24515 <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>
24516 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24517 '<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>
24518 '<i>foo</i> <div title="name">test</div>
24519 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24520 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24521 <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>
24522 </ol>
24523 !! wikitext
24524 '''a'' foo ''[[bar]]''
24525 ''a''' foo ''[[bar]]''
24526 ''a''' foo '''{{echo|[[bar]]}}'''
24527 [[foo]] x'''[[bar]]''
24528 '''foo'' <ref>test</ref>
24529 '''foo'' <div title="name">test</div>
24530 '''foo'' and <br> bar
24531 <references />
24532 !! end
24533
24534 !! test
24535 2. Link fragments separated by <i> and <b> tags
24536 !! options
24537 parsoid=html2wt
24538 !! html/parsoid
24539 <p>[[<i>foo</i>hello]]</p>
24540 <p>[[<b>foo</b>hello]]</p>
24541 !! wikitext
24542 [[''foo''<nowiki>hello]]</nowiki>
24543
24544 [['''foo'''<nowiki>hello]]</nowiki>
24545 !! end
24546
24547 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24548 # this is one of the shortcomings of this format
24549 !! test
24550 3. Link fragments inside <i> and <b>
24551 !! options
24552 parsoid=html2wt
24553 !! html/parsoid
24554 <p><i>[[foo</i>]]</p>
24555 <p><b>[[foo</b>]]</p>
24556 !! wikitext
24557 ''[[foo''<nowiki>]]</nowiki>
24558
24559 '''[[foo'''<nowiki>]]</nowiki>
24560 !! end
24561
24562 !! test
24563 4. No escaping needed
24564 !! options
24565 options=html2wt
24566 !! html/parsoid
24567 <p>'<span><i>bar</i></span>'
24568 '<span><b>bar</b></span>'
24569 'a:b'foo
24570 </p>
24571 !! wikitext
24572 '<span>''bar''</span>'
24573 '<span>'''bar'''</span>'
24574 'a:b'foo
24575 !! end
24576
24577 #### ----------- Paragraphs ---------------
24578 #### 1. No unnecessary escapes
24579 #### --------------------------------------
24580
24581 !! test
24582 1. No unnecessary escapes
24583 !! options
24584 parsoid=html2wt
24585 !! html/parsoid
24586 <p>bar <span>[[foo]]</span>
24587 </p><p>=bar <span>[[foo]]</span>
24588 </p><p>[[bar <span>[[foo]]</span>
24589 </p><p>]]bar <span>[[foo]]</span>
24590 </p><p>=bar <span>foo]]</span>=
24591 </p>
24592 !! wikitext
24593 bar <span><nowiki>[[foo]]</nowiki></span>
24594
24595 =bar <span><nowiki>[[foo]]</nowiki></span>
24596
24597 [[bar <span><nowiki>[[foo]]</nowiki></span>
24598
24599 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24600
24601 =bar <span>foo]]</span><nowiki>=</nowiki>
24602 !!end
24603
24604 #### ----------------------- PRE --------------------------
24605 #### 1. Leading whitespace in SOL context should be escaped
24606 #### ------------------------------------------------------
24607 !! test
24608 1. Leading whitespace in SOL context should be escaped
24609 !! options
24610 parsoid=html2wt
24611 !! html/parsoid
24612 <p> a</p>
24613
24614 <p> a</p>
24615
24616 <p> a(tab)</p>
24617
24618 <p> a
24619 <!--cmt-->
24620 a</p>
24621
24622 <p>a
24623 b</p>
24624
24625 <p>a
24626 b</p>
24627
24628 <p>a
24629 b</p>
24630 !! wikitext
24631 <nowiki> </nowiki>a
24632
24633 <nowiki> </nowiki> a
24634
24635 a(tab)
24636
24637 <nowiki> </nowiki> a
24638 <!--cmt-->
24639 <nowiki> </nowiki>a
24640
24641 a
24642 <nowiki> </nowiki>b
24643
24644 a
24645 b
24646
24647 a
24648 b
24649 !! html/php
24650 <p> a
24651 </p><p> a
24652 </p><p> a(tab)
24653 </p><p> a
24654 a
24655 </p><p>a
24656 b
24657 </p><p>a
24658 b
24659 </p><p>a
24660 b
24661 </p>
24662 !! end
24663
24664 !! test
24665 2. Leading whitespace in non-indent-pre contexts should not be escaped
24666 !! options
24667 parsoid=html2wt
24668 !! html/parsoid
24669 <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>
24670 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24671 <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>
24672 b</span></li>
24673 </ol>
24674 !! wikitext
24675 foo <ref>''a''
24676 b</ref>
24677 <references />
24678 !! end
24679
24680 !! test
24681 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24682 !! options
24683 parsoid=html2wt
24684 !! html/parsoid
24685 <blockquote>
24686 <p>
24687 a
24688 <span>b</span>
24689 c</p>
24690 </blockquote>
24691 !! wikitext
24692 <blockquote>
24693 a
24694 <span>b</span>
24695 c
24696 </blockquote>
24697 !! end
24698
24699 !! test
24700 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24701 !! options
24702 options=html2wt
24703 !! html/parsoid
24704 <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>
24705 !! wikitext
24706 [[File:Foobar.jpg|thumb|caption]]
24707 !! end
24708
24709 !! test
24710 5. Nowiki escaping should account for indent-pres
24711 !! options
24712 parsoid=html2wt
24713 !! html/parsoid
24714 <pre>==foo==</pre>
24715 !! wikitext
24716 ==foo==
24717 !! end
24718
24719 !!test
24720 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24721 !! options
24722 parsoid=html2wt
24723 !! html/parsoid
24724 <pre>
24725 * foo
24726 * bar
24727 </pre>
24728 !! wikitext
24729 * foo
24730 * bar
24731 !! end
24732
24733 #### --------------- Behavior Switches --------------------
24734
24735 !! test
24736 1. Valid behavior switches should be escaped
24737 !! options
24738 parsoid=html2wt
24739 !! html/parsoid
24740 __TOC__
24741 <i>__TOC__</i>
24742 !! wikitext
24743 <nowiki>__TOC__</nowiki>
24744 ''<nowiki>__TOC__</nowiki>''
24745 !! end
24746
24747 !! test
24748 2. Invalid behavior switches should not be escaped
24749 !! options
24750 parsoid=html2wt
24751 !! html/parsoid
24752 __TOO__
24753 __|__
24754 !! wikitext
24755 __TOO__
24756 __|__
24757 !! end
24758
24759 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24760 !! test
24761 Behavior switches should be SOL-transparent
24762 !! options
24763 parsoid=html2wt
24764 !! html/parsoid
24765 <meta property="mw:PageProp/toc" />
24766
24767 <!-- this one's bogus -->
24768 <pre>__TOO__</pre>
24769
24770 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24771
24772 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24773 !! wikitext
24774 __TOC__
24775
24776 <!-- this one's bogus -->
24777 __TOO__
24778
24779 __TOC__ foo
24780
24781 __TOC__
24782 bar
24783 !! end
24784
24785 #### --------------- HTML tags ---------------
24786 #### 1. a tags
24787 #### 2. other tags
24788 #### 3. multi-line html tag
24789 #### 4. extension tags
24790 #### -----------------------------------------
24791 !! test
24792 1. a tags
24793 !! options
24794 parsoid=html2wt
24795 !! html/parsoid
24796 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24797 !! wikitext
24798 <a href="http://google.com">google</a>
24799 !! end
24800
24801 !! test
24802 2. other tags
24803 !! options
24804 parsoid=html2wt
24805 !! html/parsoid
24806 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24807 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24808 <li> &lt;td&gt;</li></ul>
24809
24810 !! wikitext
24811 * <nowiki><div>foo</div></nowiki>
24812 * <nowiki><div style="color:red">foo</div></nowiki>
24813 * <nowiki><td></nowiki>
24814 !! end
24815
24816 !! test
24817 3. multi-line html tag
24818 !! options
24819 parsoid=html2wt
24820 !! html/parsoid
24821 <p>&lt;div
24822 &gt;foo&lt;/div
24823 &gt;
24824 </p>
24825 !! wikitext
24826 <nowiki><div
24827 >foo</div
24828 ></nowiki>
24829 !! end
24830
24831 !! test
24832 4. extension tags
24833 !! options
24834 parsoid=html2wt
24835 !! html/parsoid
24836 <p>&lt;ref&gt;foo&lt;/ref&gt;
24837 </p><p>&lt;ref&gt;bar
24838 </p><p>baz&lt;/ref&gt;
24839 </p>
24840 !! wikitext
24841 <nowiki><ref>foo</ref></nowiki>
24842
24843 <nowiki><ref>bar</nowiki>
24844
24845 baz<nowiki></ref></nowiki>
24846 !! end
24847
24848 #### --------------- Others ---------------
24849 !! test
24850 Escaping nowikis
24851 !! options
24852 parsoid=html2wt
24853 !! html/parsoid
24854 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24855 </p>
24856 !! wikitext
24857 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24858 !! end
24859
24860 ## The quote-char in the input is necessary for triggering the bug
24861 !! test
24862 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24863 !! options
24864 parsoid=html2wt
24865 !! html/parsoid
24866 <p>foo's bar :</p>
24867 !! wikitext
24868 foo's bar :
24869 !! end
24870
24871 #----------- End of wikitext escaping tests --------------
24872
24873 !! test
24874
24875 Tag-like HTML structures are passed through as text
24876 !! wikitext
24877 <x y>
24878
24879 <x.y>
24880
24881 <x-y>
24882
24883 1>2
24884
24885 x<y
24886
24887 a>b
24888
24889 1<d e>f
24890 !! html
24891 <p>&lt;x y&gt;
24892 </p><p>&lt;x.y&gt;
24893 </p><p>&lt;x-y&gt;
24894 </p><p>1&gt;2
24895 </p><p>x&lt;y
24896 </p><p>a&gt;b
24897 </p><p>1&lt;d e&gt;f
24898 </p>
24899 !! end
24900
24901 !! test
24902 HTML tag with necessary entities in attributes
24903 !! wikitext
24904 <span title="&amp;amp;">foo</span>
24905 !! html
24906 <p><span title="&amp;amp;">foo</span>
24907 </p>
24908 !! end
24909
24910 !! test
24911 HTML tag with 'unnecessary' entity encoding in attributes
24912 !! wikitext
24913 <span title="&amp;">foo</span>
24914 !! html
24915 <p><span title="&amp;">foo</span>
24916 </p>
24917 !! end
24918
24919 !! test
24920 HTML tag with broken attribute value quoting
24921 !! options
24922 parsoid=wt2html,html2html
24923 !! wikitext
24924 <span title="Hello world>Foo</span>
24925 !! html/php
24926 <p><span title="Hello world">Foo</span>
24927 </p>
24928 !! html/parsoid
24929 <p><span title="Hello world">Foo</span></p>
24930 !! end
24931
24932 !! test
24933 Self-closed tag with broken attribute value quoting
24934 !! options
24935 parsoid=wt2html,html2html
24936 !! wikitext
24937 <div title="Hello world />Foo
24938 !! html/php+tidy
24939 <div title="Hello world"></div>
24940 <p>Foo</p>
24941 !! html/parsoid
24942 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24943 !! end
24944
24945 !! test
24946 Table with broken attribute value quoting
24947 !! options
24948 parsoid=wt2html,html2html
24949 !! wikitext
24950 {|
24951 | title="Hello world|Foo
24952 |}
24953 !! html/php
24954 <table>
24955 <tr>
24956 <td title="Hello world">Foo
24957 </td></tr></table>
24958
24959 !! html/parsoid
24960 <table>
24961 <tr>
24962 <td title="Hello world">Foo
24963 </td></tr></table>
24964
24965 !! end
24966
24967 !! test
24968 Table with broken attribute value quoting on consecutive lines
24969 !! options
24970 parsoid=wt2html,html2html
24971 !! wikitext
24972 {|
24973 | title="Hello world|Foo
24974 | style="color:red|Bar
24975 |}
24976 !! html/php
24977 <table>
24978 <tr>
24979 <td title="Hello world">Foo
24980 </td>
24981 <td style="color:red">Bar
24982 </td></tr></table>
24983
24984 !! html/parsoid
24985 <table><tbody>
24986 <tr>
24987 <td title="Hello world">Foo
24988 </td><td style="color: red">Bar
24989 </td></tr></tbody></table>
24990
24991 !! end
24992
24993 !!test
24994 Accept empty td cell attribute
24995 !! wikitext
24996 {|
24997 | align="center" | foo || |
24998 |}
24999 !! html
25000 <table>
25001 <tr>
25002 <td align="center"> foo </td>
25003 <td>
25004 </td></tr></table>
25005
25006 !!end
25007
25008 !!test
25009 Non-empty attributes in th-cells
25010 !! wikitext
25011 {|
25012 ! Foo !! style="color: red" | Bar
25013 |}
25014 !! html
25015 <table>
25016 <tr>
25017 <th> Foo </th>
25018 <th style="color: red"> Bar
25019 </th></tr></table>
25020
25021 !!end
25022
25023 !!test
25024 Accept empty attributes in th-cells
25025 !! wikitext
25026 {|
25027 !| foo !!| bar
25028 |}
25029 !! html
25030 <table>
25031 <tr>
25032 <th> foo </th>
25033 <th> bar
25034 </th></tr></table>
25035
25036 !!end
25037
25038 !!test
25039 Empty table rows go away
25040 !! wikitext
25041 {|
25042 | Hello
25043 | there
25044 |- class="foo"
25045 |-
25046 |}
25047 !! html
25048 <table>
25049 <tr>
25050 <td> Hello
25051 </td>
25052 <td> there
25053 </td></tr>
25054
25055 </table>
25056
25057 !! end
25058
25059 ###
25060 ### Parsoid-centric tests for testing RTing of inter-element separators
25061 ### Edge cases not tested by existing parser tests and specific to
25062 ### Parsoid-specific serialization strategies.
25063 ###
25064
25065 !!test
25066 RT-ed inter-element separators should be valid separators
25067 !! wikitext
25068 {|
25069 |- [[foo]]
25070 |}
25071 !! html/php
25072 <table>
25073
25074 </table>
25075
25076 !! html/parsoid
25077 <table>
25078 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
25079 </tbody></table>
25080 !!end
25081
25082 # Parsoid-only since PHP parser relies on Tidy for correct output
25083 !!test
25084 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
25085 !!options
25086 parsoid
25087 !! wikitext
25088 {|
25089 |<small>foo
25090 bar
25091 |}
25092
25093 {|
25094 |<small>foo<small>
25095 |}
25096 !! html
25097 <table>
25098 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
25099 <p>bar</p></small></td></tr>
25100 </tbody></table>
25101
25102 <table>
25103 <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>
25104 </tbody></table>
25105 !!end
25106
25107 # Note that the "style" attribute is really a template parameter here.
25108 # The = would have to be {{=}} if you wanted the literal.
25109 !!test
25110 Empty TD followed by TD with tpl-generated attribute
25111 !! wikitext
25112 {|
25113 |-
25114 |
25115 |{{echo|style='color:red'}}|foo
25116 |}
25117 !! html
25118 <table>
25119
25120 <tr>
25121 <td>
25122 </td>
25123 <td>foo
25124 </td></tr></table>
25125
25126 !!end
25127
25128 !!test
25129 Indented table with an empty td
25130 !! wikitext
25131 {|
25132 |-
25133 |
25134 |foo
25135 |}
25136 !! html
25137 <table>
25138
25139 <tr>
25140 <td>
25141 </td>
25142 <td>foo
25143 </td></tr></table>
25144
25145 !!end
25146
25147 ## We have some newline diffs RT-ing this edge case
25148 ## and it is not important enough -- we seem to be emitting
25149 ## at most 2 newlines after a </tr> and this is unrelated to
25150 ## the issue from T85627 that this is testing.
25151 !!test
25152 Indented table with blank lines in between (T85627)
25153 !! options
25154 parsoid=wt2html
25155 !! wikitext
25156 {|
25157 |foo
25158
25159
25160 |}
25161 !! html
25162 <table>
25163
25164 <tr>
25165 <td>foo
25166 </td></tr></table>
25167
25168 !!end
25169
25170 !!test
25171 Indented block & table
25172 !! wikitext
25173 <div>foo</div>
25174 {|
25175 |foo
25176 |}
25177 !! html/php
25178 <div>foo</div>
25179 <table>
25180 <tr>
25181 <td>foo
25182 </td></tr></table>
25183
25184 !! html/parsoid
25185 <div data-parsoid='{"stx":"html"}'>foo</div>
25186 <table><tbody>
25187 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
25188 </tbody></table>
25189 !!end
25190
25191 !! test
25192 Indent and comment before table row
25193 !! wikitext
25194 {|
25195 <!--hi-->|-
25196 | there
25197 |}
25198 !! html/php
25199 <table>
25200
25201 <tr>
25202 <td> there
25203 </td></tr></table>
25204
25205 !! html/parsoid
25206 <table>
25207 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
25208 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
25209 </tbody></table>
25210 !! end
25211
25212 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
25213 !!test
25214 Empty TR followed by a template-generated TR
25215 !!options
25216 parsoid
25217 !! wikitext
25218 {|
25219 |-
25220 {{echo|<tr><td>foo</td></tr>}}
25221 |}
25222 !! html
25223 <table>
25224 <tbody>
25225 <tr></tr>
25226 <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}}]}'>
25227 <td>foo</td></tr>
25228 </tbody></table>
25229 !!end
25230
25231 ## PHP and parsoid output differ for this, and since this is primarily
25232 ## for testing Parsoid's serializer, marking this Parsoid only
25233 !!test
25234 Empty TR followed by mixed-ws-comment line should RT correctly
25235 !!options
25236 parsoid
25237 !! wikitext
25238 {|
25239 |-
25240 <!--c-->
25241 |-
25242 <!--c--> <!--d-->
25243 |}
25244 !! html
25245 <table>
25246 <tbody>
25247 <tr></tr>
25248 <!--c-->
25249 <tr>
25250 <!--c--> </tr><!--d-->
25251 </tbody></table>
25252
25253 !!end
25254
25255 !!test
25256 Multi-line image caption generated by templates with/without trailing newlines
25257 !! wikitext
25258 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
25259 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
25260 !! html/parsoid
25261 <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>
25262 <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>
25263 !!end
25264
25265 !! test
25266 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
25267 !! options
25268 parsoid=html2wt
25269 !! html/parsoid
25270 <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>
25271
25272 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
25273 !! wikitext
25274 <includeonly>foo</includeonly>
25275 new para
25276
25277 [[Category:Foo]]
25278
25279 = new heading =
25280 !! end
25281
25282 ## PHP emits broken html for this, and since this is primarily
25283 ## a Parsoid serializer test, marking this Parsoid only
25284 !!test
25285 Improperly nested inline or quotes tags with whitespace in between
25286 !! wikitext
25287 <span> <s>x</span> </s>
25288 ''' ''x''' ''
25289 !! html/parsoid
25290 <p><span> <s>x</s></span><s> </s>
25291 <b> <i>x</i></b><i> </i>
25292 </p>
25293 !!end
25294
25295 !!test
25296 Encapsulate protected attributes from wt
25297 !! wikitext
25298 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
25299
25300 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
25301 | ok
25302 |}
25303 !! html/parsoid
25304 <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>
25305
25306 <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">
25307 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
25308 </tbody></table>
25309 !!end
25310
25311 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
25312 ## Having nested or stray pre tags results in the attempt to add duplicates,
25313 ## causing an assertion fail. This test tries to prevent that situation.
25314 !!test
25315 Ensure ParagraphWrapper can deal with stray closing pre tags
25316 !!options
25317 parsoid=wt2html
25318 !! wikitext
25319 plain text</pre>
25320 !! html/parsoid
25321 plain text
25322 !!end
25323
25324 !!test
25325 1. Ensure fostered text content is wrapped in element nodes
25326 !!options
25327 parsoid=wt2html
25328 !! wikitext
25329 <table>hi</table><table>ho</table>
25330 !! html/parsoid
25331 <p>hi</p>
25332 <table></table>
25333 <p>ho</p>
25334 <table></table>
25335 !!end
25336
25337 !!test
25338 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
25339 !!options
25340 parsoid=wt2html,wt2wt
25341 !! wikitext
25342 <table>
25343 <tr> || ||
25344 <td> a
25345 </table>
25346 !! html/parsoid
25347 <p> || ||
25348 </p><table>
25349 <tbody><tr><td> a</td></tr>
25350 </tbody></table>
25351 !!end
25352
25353 !!test
25354 Encapsulation properly handles null DSR information from foster box
25355 !!options
25356 parsoid=wt2html,wt2wt
25357 !! wikitext
25358 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25359 !! html/parsoid
25360 <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>
25361 !!end
25362
25363 !!test
25364 1. Encapsulate foster-parented transclusion content
25365 !!options
25366 parsoid=wt2wt,wt2html
25367 !! wikitext
25368 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25369 !! html/parsoid
25370 <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>
25371 <tbody>
25372 <tr>
25373 <td>bar</td>
25374 </tr>
25375 </tbody>
25376 </table>
25377 !!end
25378
25379 !!test
25380 2. Encapsulate foster-parented transclusion content
25381 !!options
25382 parsoid=wt2wt,wt2html
25383 !! wikitext
25384 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25385 !! html/parsoid
25386 <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>
25387 <table>
25388 <tbody>
25389 <tr>
25390 <td>bar</td>
25391 </tr>
25392 </tbody>
25393 </table>
25394 !!end
25395
25396 !!test
25397 3. Encapsulate foster-parented transclusion content
25398 !!options
25399 parsoid=wt2wt,wt2html
25400 !! wikitext
25401 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25402 !! html/parsoid
25403 <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;]}">
25404 <p>foo</p>
25405 </div>
25406 <table>
25407 <tbody>
25408 <tr>
25409 <td>bar</td>
25410 </tr>
25411 </tbody>
25412 </table>
25413 !!end
25414
25415 !!test
25416 4. Encapsulate foster-parented transclusion content
25417 !!options
25418 parsoid=wt2wt,wt2html
25419 !! wikitext
25420 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25421 !! html/parsoid
25422 <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;]}">
25423 <p>foo</p>
25424 </div>
25425 <table>
25426 <tbody>
25427 <tr>
25428 <td>bar</td>
25429 </tr>
25430 </tbody>
25431 </table>
25432 !!end
25433
25434 !!test
25435 5. Encapsulate foster-parented transclusion content
25436 !!options
25437 parsoid=wt2wt,wt2html
25438 !! wikitext
25439 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25440 !! html/parsoid
25441 <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>
25442 <table>
25443 <tbody>
25444 <tr>
25445 <td>
25446 <div>
25447 <p>foo</p>
25448 </div>
25449 </td>
25450 </tr>
25451 </tbody>
25452 </table>
25453 !!end
25454
25455 !!test
25456 6. Encapsulate foster-parented transclusion content
25457 !!options
25458 parsoid=wt2wt,wt2html
25459 !! wikitext
25460 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25461 !! html/parsoid
25462 <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>
25463 <table>
25464 <tbody>
25465 <tr>
25466 <td>
25467 <div>
25468 <p>foo</p>
25469 </div>
25470 </td>
25471 </tr>
25472 </tbody>
25473 </table>
25474 <p>ok</p>
25475 !!end
25476
25477 !!test
25478 7. Encapsulate foster-parented transclusion content
25479 !!options
25480 parsoid=wt2wt,wt2html
25481 !! wikitext
25482 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25483 !! html/parsoid
25484 <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>
25485 <table>
25486 <tbody>
25487 <tr>
25488 <td>bar</td>
25489 </tr>
25490 </tbody>
25491 </table>
25492 !!end
25493
25494 # Note that the wt is broken on purpose: the = should be {{=}} if you
25495 # don't want it to be a template parameter key.
25496 !!test
25497 8. Encapsulate foster-parented transclusion content
25498 !!options
25499 parsoid=wt2wt,wt2html
25500 !! wikitext
25501 {{echo|a
25502 }}{|{{echo|style='color:red'}}
25503 |-
25504 |b
25505 |}
25506 !! html/parsoid
25507 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25508 <span> </span>
25509 <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>
25510 <table>
25511 <tbody>
25512 <tr>
25513 <td>b</td>
25514 </tr>
25515 </tbody>
25516 </table>
25517 !!end
25518
25519 !!test
25520 9. Encapsulate foster-parented transclusion content
25521 !!options
25522 parsoid=wt2wt,wt2html
25523 !! wikitext
25524 <table>{{echo|hi</table>hello}}
25525 !! html/parsoid
25526 <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>
25527 !!end
25528
25529 !!test
25530 Table in fosterable position
25531 !!options
25532 parsoid=wt2html
25533 !! wikitext
25534 {{OpenTable}}
25535 <div>
25536 {|
25537 |}
25538 </div>
25539 |}
25540 !! html/parsoid
25541 <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">
25542 </span>
25543 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25544
25545 <table>
25546 </table>
25547 !!end
25548
25549 # Parsoid only for bug 64747
25550 !! test
25551 Properly encapsulate empty-content transclusions in fosterable positions
25552 !! wikitext
25553 <table>
25554 {{#if:|
25555 <td>foo</td>
25556 }}
25557 </table>
25558 !! html/parsoid
25559 <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"}]]}'>
25560
25561 </table>
25562 !! end
25563
25564 !! test
25565 Always encapsulate foster box when template range is expanded to table
25566 !! options
25567 parsoid=wt2wt
25568 !! wikitext
25569 {|
25570 hello
25571 {{OpenTable}}
25572 |}
25573 !! html/parsoid
25574
25575 !! end
25576
25577 !! test
25578 T115289: Unclosed table
25579 !! wikitext
25580 {{echo|<table>}}<!--c-->[[Category:Two]]
25581 !! html/parsoid
25582 <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>
25583 !! end
25584
25585 !! test
25586 T115289: Don't migrate newlines out of tables with fostered content
25587 !! wikitext
25588 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25589 !! html/parsoid
25590 <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>
25591 !! end
25592
25593 !! test
25594 T73074: More fostering fun
25595 !! wikitext
25596 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25597 !! html/parsoid
25598 <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>
25599 !! end
25600
25601 !!test
25602 Support <object> element with .data attribute
25603 !!options
25604 parsoid=html2wt
25605 !! html/parsoid
25606 <object data="test.swf"></object>
25607 !! wikitext
25608 <object data="test.swf"></object>
25609 !!end
25610
25611 !! test
25612 Don't block XML namespace declaration
25613 !! wikitext
25614 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25615 !! html/php
25616 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25617 </p>
25618 !! html/parsoid
25619 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25620 !! end
25621
25622 # -----------------------------------------------------------------
25623 # The following section of tests are primarily to spec requirements
25624 # around Parsoid's serialization (old, new, edited content)
25625 #
25626 # All these tests are marked Parsoid html2wt and html2html only
25627 # ----------------------------------------------------------------
25628
25629 !! test
25630 Ignore rel attribute in a-tags during serialization to url-links
25631 !! options
25632 parsoid=html2wt
25633 !! html/parsoid
25634 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25635 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25636 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25637 !! wikitext
25638 http://en.wikipedia.org/wiki/Foobar
25639 http://en.wikipedia.org/wiki/Foobar
25640 http://en.wikipedia.org/wiki/Foobar
25641 !! end
25642
25643 # 'mi' is a localinterwiki prefix as well as a language
25644 !! test
25645 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
25646 !! options
25647 parsoid=html2wt
25648 !! html/parsoid
25649 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25650 !! wikitext
25651 [[Foo]]
25652 !! end
25653
25654 # See T93839
25655 !! test
25656 New wikilinks should be serialized properly
25657 !! options
25658 parsoid=html2wt
25659 !! html/parsoid
25660 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25661 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25662 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25663 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25664 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25665 !! wikitext
25666 [[Foo]]
25667 [[Foo]]
25668 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25669 http://en.wikipedia.org/wiki/Foo
25670 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25671 !! end
25672
25673 !! test
25674 New wiki links (href variations)
25675 !! options
25676 parsoid=html2wt
25677 !! html/parsoid
25678 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25679 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25680 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25681 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25682 !! wikitext
25683 [[Foo_bar]]
25684 [[Foo_bar]]
25685 [[Foo_bar]]
25686 [[Toxine bactérienne]]
25687 !! end
25688
25689 !! test
25690 New wiki links (content string variations)
25691 !! options
25692 parsoid=html2wt
25693 !! html/parsoid
25694 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25695 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25696 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25697 !! wikitext
25698 [[Foo_bar]]
25699 [[Foo bar]]
25700 [[Foo_bar|./Foo_bar]]
25701 !! end
25702
25703 !! test
25704 New category links (href variations)
25705 !! options
25706 parsoid=html2wt
25707 !! html/parsoid
25708 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25709 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25710 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25711 !! wikitext
25712 [[Category:Toxine bactérienne]]
25713 [[Category:Toxine bactérienne]]
25714 [[Category:Toxine bactérienne]]
25715 !! end
25716
25717 !! test
25718 New sol transparent links don't need indent-pre nowiki protection
25719 !! options
25720 parsoid=html2wt
25721 language=de
25722 !! html/parsoid
25723 <link rel="mw:PageProp/redirect" href="./Main_Page">
25724 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25725 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25726 !! wikitext
25727 #WEITERLEITUNG [[Main Page]]
25728 <!-- this is good --> [[Category:Good]]
25729 <!-- this is great --> [[Kategorie:Great]]
25730 !! end
25731
25732 !! test
25733 New interlanguage links (href variations)
25734 !! options
25735 parsoid=html2wt
25736 !! html/parsoid
25737 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25738 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25739 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25740 !! wikitext
25741 [[es:Toxine bactérienne]]
25742 [[es:Toxine_bactérienne]]
25743 [[es:Toxine_bactérienne]]
25744 !! end
25745
25746 !! test
25747 Image: Modifying size of an image (1)
25748 !! options
25749 parsoid={
25750 "modes": ["wt2wt"],
25751 "changes": [
25752 ["img[height]", "attr", "height", "22"],
25753 ["img[width]", "attr", "width", "200"]
25754 ]
25755 }
25756 !! wikitext
25757 [[Image:Foobar.jpg|230x230px]]
25758 !! wikitext/edited
25759 [[Image:Foobar.jpg|200x200px]]
25760 !!end
25761
25762 !! test
25763 Image: Modifying size of an image (2)
25764 !! options
25765 parsoid={
25766 "modes": ["wt2wt"],
25767 "changes": [
25768 ["img[height]", "attr", "height", "100"],
25769 ["img[width]", "attr", "width", "500"]
25770 ]
25771 }
25772 !! wikitext
25773 [[Image:Foobar.jpg|230x230px]]
25774 !! wikitext/edited
25775 [[Image:Foobar.jpg|500x500px]]
25776 !!end
25777
25778 # Change in size is ignored so long as class='mw-default-size'
25779 !! test
25780 Image: Modifying size of an image (3)
25781 !! options
25782 parsoid={
25783 "modes": ["wt2wt"],
25784 "changes": [
25785 ["figure[class]", "removeClass", "mw-default-size"],
25786 ["figure img", "attr", "height", "19"],
25787 ["figure img", "attr", "width", "170"]
25788 ]
25789 }
25790 !! wikitext
25791 [[Image:Foobar.jpg|thumb]]
25792 !! wikitext/edited
25793 [[Image:Foobar.jpg|thumb|170x170px]]
25794 !!end
25795
25796 !! test
25797 Image: Modifying alignment of an image (bug 48665)
25798 !! options
25799 parsoid={
25800 "modes": ["wt2wt"],
25801 "changes": [
25802 ["figure[class]", "removeClass", "mw-halign-right"],
25803 ["figure[class]", "addClass", "mw-halign-left"]
25804 ]
25805 }
25806 !! wikitext
25807 [[Image:Foobar.jpg|thumb|caption|right]]
25808 !! wikitext/edited
25809 [[Image:Foobar.jpg|thumb|caption|left]]
25810 !! end
25811
25812 !! test
25813 Image: Modifying mw-default-size of an frameless image (bug 62805)
25814 !! options
25815 parsoid={
25816 "modes": ["wt2wt"],
25817 "changes": [
25818 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25819 ]
25820 }
25821 !! wikitext
25822 [[Image:Foobar.jpg|frameless|right]]
25823 !! wikitext/edited
25824 [[Image:Foobar.jpg|frameless|right|220x220px]]
25825 !! end
25826
25827 !! test
25828 Image: Modifying valign of an image (bug 49221)
25829 !! options
25830 parsoid={
25831 "modes": ["wt2wt"],
25832 "changes": [
25833 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25834 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25835 ]
25836 }
25837 !! wikitext
25838 [[File:Foobar.jpg|20px|middle]]
25839 !! wikitext/edited
25840 [[File:Foobar.jpg|20px|text-top]]
25841 !! end
25842
25843 !! test
25844 Image: Modifying alt attribute of an image (bug 56400)
25845 !! options
25846 parsoid={
25847 "modes": ["wt2wt"],
25848 "changes": [
25849 ["img[alt]", "attr", "alt", "some alternate edited text"]
25850 ]
25851 }
25852 !! wikitext
25853 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25854 !! wikitext/edited
25855 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25856 !!end
25857
25858 !! test
25859 Image: Modifying caption of an image
25860 !! options
25861 parsoid={
25862 "modes": ["wt2wt"],
25863 "changes": [
25864 ["figcaption", "text", "new caption"]
25865 ]
25866 }
25867 !! wikitext
25868 [[Image:Foobar.jpg|thumb|original caption]]
25869 !! wikitext/edited
25870 [[Image:Foobar.jpg|thumb|new caption]]
25871 !!end
25872
25873 !! test
25874 Image: empty alt attribute (bug 48924)
25875 !! options
25876 parsoid
25877 !! wikitext
25878 [[File:Foobar.jpg|thumb|alt=|bar]]
25879 !! html
25880 <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>
25881 !! end
25882
25883 !! test
25884 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25885 !! options
25886 parsoid=html2wt
25887 language=ar
25888 disabled
25889 !! html/parsoid
25890 <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>
25891 !! wikitext
25892 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25893 !! end
25894
25895 !! test
25896 Image: Block level image should have \n before and after
25897 !! wikitext
25898 123
25899 [[File:Foobar.jpg|right|thumb|150x150px]]
25900 456
25901 !! html/parsoid
25902 <p>123</p>
25903 <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>
25904 <p>456</p>
25905 !!end
25906
25907 !! test
25908 Image: New block level image should have \n before and after (existing content)
25909 !! wikitext
25910 123
25911 [[File:Foobar.jpg|right|thumb|150x150px]]
25912 456
25913 !! html/parsoid
25914 <p>123</p>
25915 <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>
25916 <p>456</p>
25917 !!end
25918
25919 !! test
25920 Image: upright option (parsoid)
25921 !! wikitext
25922 [[File:Foobar.jpg|thumb|upright|caption]]
25923 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25924 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25925 !! html/parsoid
25926 <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>
25927 <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>
25928 <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>
25929 !!end
25930
25931 !! test
25932 Image: upright option is ignored on inline and frame images (parsoid)
25933 !! wikitext
25934 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25935 !! html/parsoid
25936 <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>
25937 !!end
25938
25939 !! test
25940 Image: from basic HTML (1)
25941 !! options
25942 parsoid=html2wt
25943 !! html/parsoid
25944 <span typeof="mw:Image">
25945 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25946 </span>
25947 !! wikitext
25948 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25949 !! end
25950
25951 !! test
25952 Image: from basic HTML (2)
25953 !! options
25954 parsoid=html2wt
25955 !! html/parsoid
25956 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25957 !! wikitext
25958 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25959 !! end
25960
25961 !! test
25962 Image: from basic HTML (3)
25963 !! options
25964 parsoid=html2wt
25965 !! html/parsoid
25966 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25967 !! wikitext
25968 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25969 !! end
25970
25971 !! test
25972 Image: from basic HTML (4)
25973 !! options
25974 parsoid=html2wt
25975 !! html/parsoid
25976 <img src="./File:Foobar.jpg">
25977 !! wikitext
25978 [[File:Foobar.jpg|link=]]
25979 !! end
25980
25981 !! test
25982 Image: Invalid title as link
25983 !! wikitext
25984 [[File:Foobar.jpg|link=<]]
25985 !! html/php
25986 <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>
25987 </p>
25988 !! html/parsoid
25989 <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>
25990 !! end
25991
25992 !! test
25993 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25994 !! options
25995 parsoid=html2wt
25996 !! html/parsoid
25997 <ul>
25998 <li><p>foo</p></li>
25999 </ul>
26000 !! wikitext
26001 * foo
26002 !! end
26003
26004 !! test
26005 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
26006 !! options
26007 parsoid=html2wt
26008 !! html/parsoid
26009 <ul> <li>foo</li></ul>
26010 !! wikitext
26011 * foo
26012 !! end
26013
26014 !! test
26015 Don't strip leading whitespace when handling indent-pre suppressing tags
26016 !! options
26017 parsoid=html2wt
26018 !! html/parsoid
26019 <table>
26020 <tr><td> indented row</td></tr>
26021 </table>
26022 <blockquote><p>
26023 <b>This is very bold of you!</b>
26024 </p>
26025 <table><tr><td>
26026 indented cell (no pre-wrapping!)
26027 </td></tr></table>
26028 </blockquote>
26029 <p>foo</p>
26030 <div>bar</div>
26031 !! wikitext
26032 {|
26033 | indented row
26034 |}
26035 <blockquote>
26036 '''This is very bold of you!'''
26037
26038 {|
26039 |
26040 indented cell (no pre-wrapping!)
26041 |}
26042 </blockquote>
26043 foo
26044 <div>bar</div>
26045 !! end
26046
26047 !! test
26048 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
26049 !! options
26050 parsoid=html2wt
26051 !! html/parsoid
26052 <p>foo</p>
26053 <span>bar</span>
26054
26055 <span>foo2
26056 </span>bar2
26057
26058 <div>foo</div>
26059 <span>bar</span>
26060
26061 <div>
26062 <span>foo</span>
26063 </div>
26064 !! wikitext
26065 foo
26066
26067 <span>bar</span>
26068
26069 <span>foo2
26070 <nowiki> </nowiki></span>bar2
26071
26072 <div>foo</div>
26073 <nowiki> </nowiki><span>bar</span>
26074
26075 <div>
26076 <nowiki> </nowiki><span>foo</span>
26077 </div>
26078 !! end
26079
26080 !! test
26081 Lists: Dont insert newlines in a serialized list item.
26082 !! options
26083 parsoid=html2wt
26084 !! html/parsoid
26085 <ul><li>a<br>b</li><li>c</li></ul>
26086 !! wikitext
26087 * a<br>b
26088 * c
26089 !! end
26090
26091 !! test
26092 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
26093 !! options
26094 parsoid={
26095 "modes": ["html2wt"],
26096 "scrubWikitext": false
26097 }
26098 !! html/parsoid
26099 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26100 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26101
26102 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26103 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26104
26105 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
26106
26107 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26108 !! wikitext
26109 == hello there [[Category:A1]] ==
26110
26111 == [[Category:A2]] hi pal ==
26112
26113 == <!--foo--> [[Category:A3]] how goes it ==
26114
26115 == it goes well [[Category:A4]] <!--bar--> ==
26116
26117 ==howdy [[Category:A5]]==
26118
26119 == __TOC__ ok ==
26120 !! end
26121
26122 !! test
26123 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
26124 !! options
26125 parsoid={
26126 "modes": ["html2wt"],
26127 "scrubWikitext": true
26128 }
26129 !! html/parsoid
26130 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26131 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26132
26133 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26134 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26135
26136 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26137 !! wikitext
26138 == hello there ==
26139 [[Category:A1]]
26140 [[Category:A2]]
26141
26142 == hi pal ==
26143
26144 <!--foo--> [[Category:A3]]
26145
26146 == how goes it ==
26147
26148 == it goes well ==
26149 [[Category:A4]] <!--bar-->
26150
26151 __TOC__
26152
26153 == ok ==
26154 !! end
26155
26156 !! test
26157 Headings: Don't hoist metas that come from templates
26158 !! options
26159 parsoid={
26160 "modes": ["html2wt"],
26161 "scrubWikitext": true
26162 }
26163 !! html/parsoid
26164 <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>
26165 !! wikitext
26166 == {{echo|foo [[Category:Foo]]}} ==
26167 !! end
26168
26169 !! test
26170 Headings: Category in ref isn't hoisted
26171 !! options
26172 parsoid={
26173 "modes": ["html2wt"],
26174 "scrubWikitext": true
26175 }
26176 !! html/parsoid
26177 <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>
26178
26179 <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>
26180 !! wikitext
26181 == foo <ref>bar
26182 [[Category:Baz]] </ref> ==
26183
26184 <references />
26185 !! end
26186
26187 !! test
26188 Parsoid: Serialize positional parameters with = in them as named parameter
26189 !! options
26190 parsoid=html2wt
26191 !! html/parsoid
26192 <p about="#mwt1" typeof="mw:Transclusion"
26193 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
26194
26195 <p about="#mwt1" typeof="mw:Transclusion"
26196 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
26197
26198 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26199 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26200 <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>
26201 !! wikitext
26202 {{echo|1=f=oo}}
26203
26204 {{echo|1=f=oo|2=bar}}
26205
26206 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26207 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26208 {{echo|<nowiki>f=oo</nowiki>|bar}}
26209 !! end
26210
26211 !! test
26212 Parsoid: Serialize positional parameters with = in extlink as named parameter
26213 !! options
26214 parsoid=html2wt
26215 !! html/parsoid
26216 <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>
26217 !! wikitext
26218 {{echo|1=http://stuff?is=ok}}
26219 !! end
26220
26221 !! test
26222 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
26223 !! options
26224 parsoid=html2wt
26225 !! html/parsoid
26226 <div>a<p>b</p></div>
26227 <div>a
26228 <p>b</p></div>
26229 <div>
26230 a
26231 <p>b</p></div>
26232 !! wikitext
26233 <div>a
26234 b
26235 </div>
26236 <div>a
26237 b
26238 </div>
26239 <div>
26240 a
26241
26242 b
26243 </div>
26244 !! end
26245
26246 !! test
26247 Substrings resembling wikitext in hrefs should not get nowiki escapes
26248 !! options
26249 parsoid=html2wt
26250 !! html/parsoid
26251 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
26252 !! wikitext
26253 [[Foo''bar''baz]]
26254 !! end
26255
26256 !! test
26257 Enforce single-line context in the serializer
26258 !! options
26259 parsoid=html2wt
26260 !! html/parsoid
26261 <h2>testing
26262 123</h2>
26263
26264 <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">
26265 </span><span about="#mwt1">you</span> </h2>
26266
26267 <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>
26268
26269 <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
26270 there</span></li></ol>
26271
26272 <ul><li>asd
26273 sdf</li></ul>
26274
26275 <ul><li>foo
26276 bar
26277 baz</li>
26278 <li>foo <b>bar</b>
26279 baz</li></ul>
26280
26281 <dl><dt>hi
26282 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
26283 ho</dd></dl>
26284
26285 <dl><dd> <table>
26286 <tbody><tr><td> ha
26287 ha
26288 ha</td></tr>
26289 </tbody></table></dd></dl>
26290 !! wikitext
26291 == testing 123 ==
26292
26293 == hi {{bogus|there
26294 you}} ==
26295
26296 == foo <ref>hello
26297 there</ref> ==
26298
26299 <references />
26300
26301 * asd sdf
26302
26303 * foo bar baz
26304 * foo '''bar''' baz
26305
26306 ; hi ho : hi ho
26307
26308 : {|
26309 | ha
26310 ha
26311 ha
26312 |}
26313 !! end
26314
26315 !! test
26316 Serialize new placeholder space without spans
26317 !! options
26318 parsoid=html2wt
26319 !! html/parsoid
26320 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
26321
26322 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
26323
26324 <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>
26325 !! wikitext
26326 foo : bar
26327
26328 foo : bar
26329
26330 <ref>foo : bar</ref>ok
26331 !! end
26332
26333
26334 #-----------------------
26335 # Tag minimization tests
26336 #-----------------------
26337
26338 !! test
26339 1. I/B quote minimization: wikitext-only tags should be combined
26340 !! options
26341 parsoid=html2wt
26342 !! html/parsoid
26343 <p><i>A</i><i>B</i></p>
26344 <p><b>A</b><b>B</b></p>
26345 <p><i>A</i><b><i>B</i></b></p>
26346 <p><b>A</b><i><b>B</b></i></p>
26347 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
26348 <p><i><b>A</b></i><i><b>B</b></i></p>
26349 <p><i><b>A</b></i><b><i>B</i></b></p>
26350 <p><b><i>A</i></b><i><b>B</b></i></p>
26351 !! wikitext
26352 ''AB''
26353
26354 '''AB'''
26355
26356 ''A'''B'''''
26357
26358 '''A''B'''''
26359
26360 '''A''BC''D'''
26361
26362 '''''AB'''''
26363
26364 '''''AB'''''
26365
26366 '''''AB'''''
26367 !! end
26368
26369 !! test
26370 2. I/B quote minimization: wikitext and html tags should not be combined
26371 !! options
26372 parsoid=html2wt
26373 !! html/parsoid
26374 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26375 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26376 !! wikitext
26377 ''A''<i>B</i>
26378
26379 ''A''<nowiki/>'''<i>B</i>'''
26380 !! end
26381
26382 !! test
26383 3. I/B quote minimization: templated content stops minimization
26384 !! options
26385 parsoid=html2wt
26386 !! html/parsoid
26387 <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>
26388 <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>
26389 !! wikitext
26390 ''A''{{echo|''B''}}
26391
26392 ''A''{{echo|'''''B'''''}}
26393 !! end
26394
26395 !! test
26396 4. I/B quote minimization: new content should be mimimized with adjacent old content
26397 !! options
26398 parsoid=html2wt
26399 !! html/parsoid
26400 <p><i>A</i><i>B</i></p>
26401 <p><b>A</b><b>B</b></p>
26402 <p><i>A</i><b><i>B</i></b></p>
26403 !! wikitext
26404 ''AB''
26405
26406 '''AB'''
26407
26408 ''A'''B'''''
26409 !! end
26410
26411 !! test
26412 5a. Merge adjacent quote nodes if they've been edited
26413 !! options
26414 parsoid={
26415 "modes": ["wt2wt", "selser"],
26416 "changes": [
26417 ["p", "contents", "remove", ":contains('b')"]
26418 ]
26419 }
26420 !! wikitext
26421 ''a''b''c''
26422 !! wikitext/edited
26423 ''ac''
26424 !! end
26425
26426 !! test
26427 5b. Merge adjacent quote nodes if they've been edited
26428 !! options
26429 parsoid={
26430 "modes": ["wt2wt", "selser"],
26431 "changes": [
26432 ["#x", "remove"]
26433 ]
26434 }
26435 !! wikitext
26436 ''a''<span id="x">b</span>''c''
26437 !! wikitext/edited
26438 ''ac''
26439 !! end
26440
26441 !! test
26442 1. Merge adjacent link nodes as long as at least one element is new
26443 !! options
26444 parsoid={
26445 "modes": ["html2wt"],
26446 "scrubWikitext": true
26447 }
26448 !! html/parsoid
26449 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26450 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26451 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26452 !! wikitext
26453 [[Football]]
26454 [[Football]]
26455 [[Football|Foot]][[Football|ball]]
26456 !! end
26457
26458 !! test
26459 2. Merge adjacent link nodes and enable additional normalizations
26460 !! options
26461 parsoid={
26462 "modes": ["html2wt"],
26463 "scrubWikitext": true
26464 }
26465 !! html/parsoid
26466 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26467 !! wikitext
26468 [[Football|''Football'']]
26469 !! end
26470
26471 !! test
26472 3. Don't merge adjacent link nodes if scrubWikitext is false
26473 !! options
26474 parsoid={
26475 "modes": ["html2wt"],
26476 "scrubWikitext": false
26477 }
26478 !! html/parsoid
26479 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26480 !! wikitext
26481 [[Football|Foot]][[Football|ball]]
26482 !! end
26483
26484 #------------------------------
26485 # End of tag minimization tests
26486 #------------------------------
26487
26488 !!test
26489 Bug 54262: New entities
26490 !! options
26491 parsoid=html2wt
26492 !! html/parsoid
26493 <span typeof="mw:Entity">&nbsp;</span>
26494 !! wikitext
26495 &nbsp;
26496 !! end
26497
26498 ## Note that there is no wikitext output for 'unknownproperty' ##
26499 ## Unknown magic words are silently dropped ##
26500
26501 !! test
26502 Magic words
26503 !! options
26504 parsoid=html2wt
26505 !! html/parsoid
26506 <meta property='mw:PageProp/toc' />
26507 <meta property='mw:PageProp/notoc' />
26508 <meta property='mw:PageProp/forcetoc' />
26509 <meta property='mw:PageProp/index' />
26510 <meta property='mw:PageProp/noindex' />
26511 <meta property='mw:PageProp/nogallery' />
26512 <meta property='mw:PageProp/noeditsection' />
26513 <meta property='mw:PageProp/notitleconvert' />
26514 <meta property='mw:PageProp/nocontentconvert' />
26515 <meta property='mw:PageProp/unknownproperty' />
26516 !! wikitext
26517 __TOC__
26518 __NOTOC__
26519 __FORCETOC__
26520 __INDEX__
26521 __NOINDEX__
26522 __NOGALLERY__
26523 __NOEDITSECTION__
26524 __NOTITLECONVERT__
26525 __NOCONTENTCONVERT__
26526 !! end
26527
26528 !! test
26529 Consecutive <pre>s should not get merged
26530 !! options
26531 parsoid=html2wt,html2html
26532 !! html/parsoid
26533 <pre>a</pre><pre>b</pre>
26534
26535 <pre>c
26536 </pre><pre>
26537 d</pre>
26538
26539 <pre>e
26540
26541 </pre><pre>
26542
26543 f</pre>
26544 !! wikitext
26545 a
26546
26547 b
26548
26549 c
26550
26551 d
26552
26553 e
26554
26555
26556
26557 f
26558 !! end
26559
26560 !! test
26561 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26562 !! options
26563 parsoid=html2wt
26564 !! html/parsoid
26565 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26566 !! wikitext
26567 [[Special:BookSources/1234567890|ISBN 1234567895]]
26568 !! end
26569
26570 !! test
26571 Edited RFC links not serializable as RFC links should serialize as extlinks
26572 !! options
26573 parsoid=html2wt
26574 !! html/parsoid
26575 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26576 !! wikitext
26577 [//tools.ietf.org/html/rfc123 New RFC]
26578 !! end
26579
26580 !! test
26581 Edited PMID links not serializable as PMID links should serialize as extlinks
26582 !! options
26583 parsoid=html2wt
26584 !! html/parsoid
26585 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26586 !! wikitext
26587 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26588 !! end
26589
26590 !! test
26591 WTS of autolinks with trailing/surrounding context
26592 !! options
26593 parsoid=html2wt
26594 !! html/parsoid
26595 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26596 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26597 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26598 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26599 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26600 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26601 !! wikitext
26602 http://cscott.net'''foo'''
26603
26604 http://cscott.net<b>foo</b>
26605
26606 '''http://cscott.net'''
26607
26608 '''http://cscott.net '''
26609
26610 '''http://cscott.net<nowiki/>x'''
26611
26612 http://cscott.net<nowiki/>x
26613 !! end
26614
26615 !! test
26616 WTS of autolinks with nowikis (round-trip)
26617 !! wikitext
26618 x<nowiki/>http://cscott.net<nowiki/>x
26619 !! html/parsoid
26620 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26621 !! end
26622
26623 # this is the "easy" test because it leaves in place all the
26624 # data-parsoid information indicating this is an autolink
26625 !! test
26626 WTS of autolinks with escapes (editing)
26627 !! options
26628 parsoid={
26629 "modes": ["wt2wt"],
26630 "changes": [
26631 [ "meta", "remove" ]
26632 ]
26633 }
26634 !! wikitext
26635 x<nowiki/>http://cscott.net<nowiki/>x
26636 !! wikitext/edited
26637 x<nowiki/>http://cscott.net<nowiki/>x
26638 !! end
26639
26640 !! test
26641 WTS of edited autolink-like text (T103364)
26642 !! options
26643 parsoid={
26644 "modes": ["wt2wt"],
26645 "changes": [
26646 [ "span[typeof]", "removeAttr", "typeof" ]
26647 ]
26648 }
26649 !! wikitext
26650 Not a link: <nowiki>http://example.com</nowiki>.
26651 !! wikitext/edited
26652 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26653 !! end
26654
26655 !! test
26656 WTS of newly-authored autolink-like text (T103364)
26657 !! options
26658 parsoid=html2wt
26659 !! html/parsoid
26660 <p>http://example.com is not a link.</p>
26661 !! wikitext
26662 <nowiki>http://example.com</nowiki> is not a link.
26663 !! end
26664
26665 !! test
26666 WTS of autolink-like text after an autolink (T108563)
26667 !! options
26668 parsoid=html2wt
26669 !! html/parsoid
26670 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26671 !! wikitext
26672 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26673 !! end
26674
26675 !! test
26676 Magic links inside links (not autolinked)
26677 !! wikitext
26678 [[Foo|http://example.com]]
26679 [[Foo|RFC 1234]]
26680 [[Foo|PMID 1234]]
26681 [[Foo|ISBN 123456789x]]
26682
26683 [http://foo.com http://example.com]
26684 [http://foo.com RFC 1234]
26685 [http://foo.com PMID 1234]
26686 [http://foo.com ISBN 123456789x]
26687 !! html+tidy
26688 <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>
26689 <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>
26690 !! html/parsoid
26691 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26692 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26693 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26694 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26695
26696 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26697 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26698 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26699 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26700 !! end
26701
26702 !! test
26703 Magic links inside image captions (autolinked)
26704 !! wikitext
26705 [[File:Foobar.jpg|thumb|http://example.com]]
26706 [[File:Foobar.jpg|thumb|RFC 1234]]
26707 [[File:Foobar.jpg|thumb|PMID 1234]]
26708 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26709 !! html+tidy
26710 <div class="thumb tright">
26711 <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>
26712 <div class="thumbcaption">
26713 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26714 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26715 </div>
26716 </div>
26717 <div class="thumb tright">
26718 <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>
26719 <div class="thumbcaption">
26720 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26721 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26722 </div>
26723 </div>
26724 <div class="thumb tright">
26725 <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>
26726 <div class="thumbcaption">
26727 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26728 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26729 </div>
26730 </div>
26731 <div class="thumb tright">
26732 <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>
26733 <div class="thumbcaption">
26734 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26735 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26736 </div>
26737 </div>
26738 !! html/parsoid
26739 <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>
26740 <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>
26741 <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>
26742 <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>
26743 !! end
26744
26745 !! test
26746 WTS of magic word text (T109371)
26747 !! options
26748 parsoid=html2wt
26749 !! html/parsoid
26750 <p>RFC 1234</p>
26751 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26752 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26753 !! wikitext
26754 <nowiki>RFC 1234</nowiki>
26755
26756 [http://foo.com RFC 1234]
26757
26758 [[Foo|RFC 1234]]
26759 !! end
26760
26761 !! test
26762 Edited Redirect link should emit a non-piped wikitext link
26763 !! options
26764 parsoid=html2wt
26765 !! html/parsoid
26766 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26767 !! wikitext
26768 #REDIRECT [[Bar]]
26769 !! end
26770
26771 !! test
26772 T75121: Infer extension name from typeOf if data-mw is not present
26773 !! options
26774 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26775 !! html/parsoid
26776 <div typeOf="mw:Extension/foo"></div>
26777 !! wikitext
26778 <foo />
26779 !! end
26780
26781 # Note that the <p> wrapping isn't present in PHP parser output
26782 # The important thing for this test is that P-wrapping doesn't
26783 # interfere with the <nowiki> protection for leading - in <td>
26784 # (which isn't necessary for <th>).
26785 !! test
26786 T88318: p-wrapped dash in table.
26787 !! options
26788 parsoid=html2wt,wt2wt
26789 !! html/parsoid
26790 <table><tbody>
26791 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26792 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26793 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26794 </tbody></table>
26795 !! wikitext
26796 {|
26797 !-
26798 !-
26799 |-
26800 |<nowiki>-</nowiki>
26801 |<nowiki>- </nowiki>
26802 |-
26803 |<small>-</small>
26804 |<br>
26805 -
26806 |<br>
26807 -
26808 |}
26809 !! html/php+tidy
26810 <table>
26811 <tr>
26812 <th>-</th>
26813 <th>-</th>
26814 </tr>
26815 <tr>
26816 <td>-</td>
26817 <td>-</td>
26818 </tr>
26819 <tr>
26820 <td><small>-</small></td>
26821 <td><br />
26822 <p>-</p>
26823 </td>
26824 <td><br />
26825 <p>-</p>
26826 </td>
26827 </tr>
26828 </table>
26829 !! end
26830
26831 !! test
26832 T149209: WTS: Handle newlines in table cells properly
26833 !! options
26834 parsoid=html2wt
26835 !! html/parsoid
26836 <table>
26837 <tbody>
26838 <tr><td>a
26839 b
26840 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
26841 <tr><td><p>x</p>
26842 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
26843 </tbody></table>
26844 <table>
26845 <tbody>
26846 <tr><th>a
26847 b
26848 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
26849 <tr><th><p>x</h>
26850 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
26851 </tbody></table>
26852 !! wikitext
26853 {|
26854 |a
26855 b
26856 |c
26857 |-
26858 |x
26859 {{!}}y
26860 |}
26861 {|
26862 !a
26863 b
26864 !c
26865 |-
26866 !x
26867 !y
26868 |}
26869 !! end
26870
26871 !! test
26872 T149209: Selser: Handle newlines in table cells properly
26873 !! options
26874 parsoid={
26875 "modes": ["selser"],
26876 "changes": [
26877 [ "#h1", "html", "a\nb\n" ],
26878 [ "#h2", "html", "a\nb\n" ],
26879 [ "#c1", "html", "a\nb\n" ],
26880 [ "#c2", "html", "<p>a</p>" ],
26881 [ "#c3", "html", "<p>a</p>" ],
26882 [ "#c4", "html", "edit-me<p>a</p>" ]
26883 ]
26884 }
26885 !! wikitext
26886 {|
26887 ! id="h1" |edit-me!!1
26888 |-
26889 ! id="h2" |edit-me||2
26890 |-
26891 | id="c1" |edit-me||3
26892 |-
26893 | id="c2" |edit-me||4
26894 |-
26895 | id="c3" |edit-me||p||q||r
26896 |-
26897 | id="c4" |edit-me||p||q||r
26898 |}
26899 !! wikitext/edited
26900 {|
26901 ! id="h1" |a
26902 b
26903 !1
26904 |-
26905 ! id="h2" |a
26906 b
26907 !2
26908 |-
26909 | id="c1" |a
26910 b
26911 |3
26912 |-
26913 | id="c2" |a
26914 |4
26915 |-
26916 | id="c3" |a
26917 |p||q||r
26918 |-
26919 | id="c4" |edit-me
26920 a
26921 |p||q||r
26922 |}
26923 !! end
26924
26925 !! test
26926 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26927 !! options
26928 parsoid=html2wt
26929 !! html/parsoid
26930 <table id='mwAb'>
26931 <td id='mwAc'>foo</td>
26932 <td id='serialize-this'>bar</td>
26933 </table>
26934 !! wikitext
26935 {|
26936 |foo
26937 | id="serialize-this" |bar
26938 |}
26939 !! end
26940
26941 !! test
26942 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26943 !! options
26944 parsoid=html2wt
26945 !! html/parsoid
26946 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26947 !! wikitext
26948 <div id="hello">ok</div>
26949 !! end
26950
26951 !! test
26952 WTS change modes
26953 !! options
26954 parsoid={
26955 "modes": ["wt2wt"],
26956 "changes": [
26957 [ "#xyz", "before", "<b>before</b> stuff " ],
26958 [ "#xyz", "after", " stuff <i>after</i>" ],
26959 [ "#xyz", "html", "x <b>y</b> z" ]
26960 ]
26961 }
26962 !! wikitext
26963 <span id="xyz">hello</span>
26964 !! wikitext/edited
26965 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26966 !! end
26967
26968 !! test
26969 Never serialize a-tag as html, regardless of what data-parsoid has to say
26970 !! options
26971 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26972 !! html/parsoid
26973 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26974 !! wikitext
26975 [[Foo]]
26976 !! end
26977
26978 ## SSS FIXME: This is broken output nevertheless.
26979 ## What might be a reasonable non-broken output for this?
26980 ## This is an edge case unlikely to be seen in production
26981 ## that I am not wasting more time on this right now.
26982 !! test
26983 Never serialize a-tag as html, no matter what attributes it has
26984 !! options
26985 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26986 !! html/parsoid
26987 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26988 !! wikitext
26989 [http://boo.org http://boohoo.org]
26990 !! end
26991
26992 # Misnested is an indication that selser can reuse the source but these have
26993 # shown to sneak through on occasion. See T101768.
26994 # The original wikitext here is: [http://test.com [[one]] two three]
26995 !! test
26996 Strip span tags added to mark misnested links
26997 !! options
26998 parsoid=html2wt
26999 !! html/parsoid
27000 <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>
27001 !! wikitext
27002 [http://test.com][[one]] two three
27003 !! end
27004
27005 !! test
27006 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
27007 !! options
27008 parsoid=html2wt
27009 !! html/parsoid
27010 <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|}"]}'>
27011 <tbody><tr><td>d
27012 </td></tr>
27013 </tbody></table>
27014 !! wikitext
27015 {{echo|a}}
27016 {|{{echo|c
27017 {{!}}d
27018 }}
27019 |}
27020 !! end
27021
27022 ## This test verifies the presence and computation of this attribute indirectly
27023 ## by making an edit and ensuring that the serialization is correct (which it would be
27024 ## only if firstWikitextNode is properly set).
27025 !! test
27026 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
27027 !! options
27028 parsoid= {
27029 "modes": ["wt2wt"],
27030 "changes": [
27031 [ "div#x", "remove" ],
27032 [ "div", "before", "<div>new</div>" ]
27033 ]
27034 }
27035 !! wikitext
27036 <div id="x">foo</div>
27037 {|
27038 {{echo|<div>boo</div>
27039 {{!}}b}}
27040 |c
27041 |}
27042 !! wikitext/edited
27043
27044 <div>new</div>
27045 {|
27046 {{echo|<div>boo</div>
27047 {{!}}b}}
27048 |c
27049 |}
27050 !! end
27051
27052 # --------------------------------------------
27053 # Tests spec'ing wikitext serialization norms |
27054 # --------------------------------------------
27055
27056 !! test
27057 1. Categories should always be serialized on their own line
27058 !! options
27059 parsoid=html2wt
27060 !! html/parsoid
27061 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
27062 !! wikitext
27063 foo
27064 [[Category:Foo]]
27065 bar
27066 !! end
27067
27068 !! test
27069 2. Categories that are part of templates should not introduce a line break
27070 !! wikitext
27071 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
27072 !! html/parsoid
27073 <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>
27074 !! end
27075
27076 # Careful while editing these next 2 tests. There are \u200f characters
27077 # before and after the <link> tags in the HTML and following some
27078 # of the categories in wikitext
27079 # Do not remove these characters in edits.
27080 #
27081 # As part of the serialization, these bidi characters will get stripped.
27082 !! test
27083 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
27084 !! options
27085 parsoid={
27086 "modes": ["html2wt"],
27087 "scrubWikitext": true
27088 }
27089 !! html/parsoid
27090 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
27091 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
27092 !! wikitext
27093 [[קטגוריה:טקסים]]
27094 [[קטגוריה: שיטות משפט]]
27095 !! end
27096
27097 !! test
27098 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
27099 !! options
27100 parsoid={
27101 "modes": ["html2wt"],
27102 "scrubWikitext": true
27103 }
27104 !! html/parsoid
27105 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
27106 !! wikitext
27107 [[קטגוריה:טקסים]]
27108 ‏y
27109 !! end
27110
27111 !! test
27112 Lists: Add space after bullets
27113 !! options
27114 parsoid=html2wt
27115 !! html/parsoid
27116 <ul>
27117 <li>foo</li>
27118 <li> bar</li>
27119 <li><span> baz</span></li>
27120 </ul>
27121 !! wikitext
27122 * foo
27123 * bar
27124 * <span> baz</span>
27125 !! end
27126
27127 !! test
27128 1. Headings: Add space before/after == (T53744)
27129 !! options
27130 parsoid=html2wt
27131 !! html/parsoid
27132 <h2>foo</h2>
27133 <h2> bar</h2>
27134 <h2>baz </h2>
27135 <h2><span> baz</span></h2>
27136 !! wikitext
27137 == foo ==
27138
27139 == bar ==
27140
27141 == baz ==
27142
27143 == <span> baz</span> ==
27144 !! end
27145
27146 !! test
27147 2. Headings: Add space before/after == even after hoisted content
27148 !! options
27149 parsoid={
27150 "modes": ["html2wt"],
27151 "scrubWikitext": true
27152 }
27153 !! html/parsoid
27154 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
27155 !! wikitext
27156 [[Category:A2]]
27157
27158 == ok ==
27159 !! end
27160
27161 !! test
27162 1. Headings: suppress newly created empty headings
27163 !! options
27164 parsoid={
27165 "modes": ["html2wt"],
27166 "scrubWikitext": true
27167 }
27168 !! html/parsoid
27169 <h2></h2>
27170 !! wikitext
27171 !! end
27172
27173 !! test
27174 2. Headings: don't suppress empty headings if scrubWikitext is false
27175 !! options
27176 parsoid=html2wt
27177 !! html/parsoid
27178 <h2></h2>
27179 !! wikitext
27180 ==<nowiki/>==
27181 !! end
27182
27183 !! test
27184 3. Headings: suppress empty headings on edits
27185 !! options
27186 parsoid={
27187 "modes": ["selser"],
27188 "scrubWikitext": true,
27189 "changes": [
27190 [ "#x", "remove"]
27191 ]
27192 }
27193 !! wikitext
27194 ==<span id="x">foo</span>==
27195 !! wikitext/edited
27196 !! end
27197
27198 !! test
27199 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
27200 !! options
27201 parsoid={
27202 "modes": ["html2wt"],
27203 "scrubWikitext": true
27204 }
27205 !! html/parsoid
27206 <h2>foo<br/>bar</h2>
27207 <h2>foo <span><br/>bar</span> baz</h2>
27208 !! wikitext
27209 == foo bar ==
27210
27211 == foo <span> bar</span> baz ==
27212 !! end
27213
27214 !! test
27215 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
27216 !! options
27217 parsoid={
27218 "modes": ["html2wt"],
27219 "scrubWikitext": false
27220 }
27221 !! html/parsoid
27222 <h2>foo<br/>bar</h2>
27223 !! wikitext
27224 == foo<br> bar ==
27225 !! end
27226
27227 !! test
27228 1. WT Quote Tags: suppress newly created empty style tags
27229 !! options
27230 parsoid={
27231 "modes": ["html2wt"],
27232 "scrubWikitext": true
27233 }
27234 !! html/parsoid
27235 <i></i><b></b>
27236 !! wikitext
27237 !! end
27238
27239 !! test
27240 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
27241 !! options
27242 parsoid=html2wt
27243 !! html/parsoid
27244 <i></i><b></b>
27245 !! wikitext
27246 ''<nowiki/>'''''<nowiki/>'''
27247 !! end
27248
27249 !! test
27250 3. WT Quote Tags: suppress empty style tags on edits
27251 !! options
27252 parsoid={
27253 "modes": ["selser"],
27254 "scrubWikitext": true,
27255 "changes": [
27256 [ "#x", "remove"]
27257 ]
27258 }
27259 !! wikitext
27260 '''<span id="x">foo</span>'''
27261 !! wikitext/edited
27262 !! end
27263
27264 !! test
27265 1. Anchors: suppress newly created empty anchors
27266 !! options
27267 parsoid={
27268 "modes": ["html2wt"],
27269 "scrubWikitext": true
27270 }
27271 !! html/parsoid
27272 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27273 !! wikitext
27274 !! end
27275
27276 !! test
27277 2. Anchors: don't suppress empty anchors if scrubWikitext is false
27278 !! options
27279 parsoid={
27280 "modes": ["html2wt"],
27281 "scrubWikitext": false
27282 }
27283 !! html/parsoid
27284 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27285 !! wikitext
27286 [[Test|<nowiki/>]]
27287 !! end
27288
27289 !! test
27290 3. Anchors: suppress empty anchors on edits
27291 !! options
27292 parsoid={
27293 "modes": ["selser"],
27294 "scrubWikitext": true,
27295 "changes": [
27296 [ "#x", "remove"]
27297 ]
27298 }
27299 !! wikitext
27300 [[Test|<span id="x">foo</span>]]
27301 !! wikitext/edited
27302 !! end
27303
27304 !! test
27305 3a. Anchors: do not suppress numbered extlinks
27306 !! options
27307 parsoid={
27308 "modes": ["wt2wt"],
27309 "scrubWikitext": true
27310 }
27311 !! wikitext
27312 [http://foo.com]
27313 !! html/parsoid
27314 <a rel="mw:ExtLink" href="http://foo.com"></a>
27315 !! end
27316
27317 !! test
27318 3b. Anchors: do not suppress numbered extlinks
27319 !! options
27320 parsoid={
27321 "modes": ["wt2wt"],
27322 "scrubWikitext": true,
27323 "changes": [
27324 [ "#x", "remove"]
27325 ]
27326 }
27327 !! wikitext
27328 [http://foo.com <span id="x">foo</span>]
27329 !! wikitext/edited
27330 [http://foo.com]
27331 !! end
27332
27333 !!test
27334 Normalizations should be restricted to edited content
27335 !!options
27336 parsoid={
27337 "modes": ["selser"],
27338 "scrubWikitext": true,
27339 "changes": [
27340 [ "h1", "before", "<i></i>"]
27341 ]
27342 }
27343 !!wikitext
27344 a
27345 = =
27346 b
27347 !!wikitext/edited
27348 a
27349 = =
27350 b
27351 !!end
27352
27353 !! test
27354 1. Multiple normalizations (html2wt)
27355 !! options
27356 parsoid={
27357 "modes": ["html2wt"],
27358 "scrubWikitext": true
27359 }
27360 !! html
27361 <h2><i></i></h2>
27362 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27363 </a><b><i></i></b>x</p>
27364 !! wikitext
27365
27366 [[foo]]
27367 x
27368
27369 !! end
27370
27371 !! test
27372 2. Multiple normalizations (selser)
27373 !! options
27374 parsoid={
27375 "modes": ["selser"],
27376 "scrubWikitext": true,
27377 "changes": [
27378 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27379 ]
27380 }
27381 !! wikitext
27382 <span id="x">foo</span>
27383 !! wikitext/edited
27384 <span id="x">foo</span>
27385
27386 x
27387 !! end
27388
27389 !! test
27390 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27391 !! options
27392 parsoid={
27393 "modes": ["html2wt"],
27394 "scrubWikitext": true
27395 }
27396 !! html/parsoid
27397 <p> hi</p>
27398 <p> hello</p>
27399 !! wikitext
27400 hi
27401
27402 hello
27403 !! end
27404
27405 !! test
27406 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27407 !! options
27408 parsoid=html2wt
27409 !! html/parsoid
27410 <p> hi</p>
27411 <p> hello</p>
27412 !! wikitext
27413 <nowiki> </nowiki>hi
27414
27415 <nowiki> </nowiki> hello
27416 !! end
27417
27418 !! test
27419 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27420 !! options
27421 parsoid={
27422 "modes": ["html2wt"],
27423 "scrubWikitext": true
27424 }
27425 !! html/parsoid
27426 <p>Foo
27427 bar
27428 baz</p>
27429
27430 <table><tr><td>Foo
27431 bar
27432 baz bang</td></tr></table>
27433
27434 <p><!--boo--> foo
27435 bar</p>
27436
27437 <p> foo
27438 bar<span>boo</span></p>
27439 !! wikitext
27440 Foo
27441 bar
27442 baz
27443
27444 {|
27445 |Foo
27446 bar
27447 baz bang
27448 |}
27449
27450 <!--boo-->foo
27451 bar
27452
27453 foo
27454 bar<span>boo</span>
27455 !! end
27456
27457 !! test
27458 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27459 !! options
27460 parsoid={
27461 "modes": ["selser"],
27462 "scrubWikitext": true,
27463 "changes": [
27464 [ "p", "html", " a\n b" ]
27465 ]
27466 }
27467 !! wikitext
27468 xyz
27469 !! wikitext/edited
27470 a
27471 b
27472 !! end
27473
27474 !! test
27475 1. New links that end in spaces
27476 !! options
27477 parsoid={
27478 "modes": ["html2wt"],
27479 "scrubWikitext": false
27480 }
27481 !! html/parsoid
27482 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27483 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27484 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27485 !! wikitext
27486 [[Berlin ]]<nowiki/>is the capital of Germany.
27487
27488 [[Foo ]]'''bar'''
27489
27490 [[Boston ]] is a city.
27491 !! end
27492
27493 !! test
27494 2. New links that end in spaces
27495 !! options
27496 parsoid={
27497 "modes": ["html2wt"],
27498 "scrubWikitext": true
27499 }
27500 !! html/parsoid
27501 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27502 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27503 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27504 !! wikitext
27505 [[Berlin]] is the capital of Germany.
27506
27507 [[Foo]] '''bar'''
27508
27509 [[Boston]] is a city.
27510 !! end
27511
27512 !! test
27513 1. Table cells with escapable prefixes
27514 !! options
27515 parsoid={
27516 "modes": ["html2wt"],
27517 "scrubWikitext": false
27518 }
27519 !! html
27520 <table>
27521 <tr><td>a</td></tr>
27522 <tr><td>-</td></tr>
27523 <tr><td>+</td></tr>
27524 </table>
27525 !! wikitext
27526 {|
27527 |a
27528 |-
27529 |<nowiki>-</nowiki>
27530 |-
27531 |<nowiki>+</nowiki>
27532 |}
27533 !! end
27534
27535 !! test
27536 2. Table cells with escapable prefixes
27537 !! options
27538 parsoid={
27539 "modes": ["html2wt"],
27540 "scrubWikitext": true
27541 }
27542 !! html
27543 <table>
27544 <tr><td>a</td></tr>
27545 <tr><td>-</td></tr>
27546 <tr><td>+</td></tr>
27547 </table>
27548 !! wikitext
27549 {|
27550 |a
27551 |-
27552 | -
27553 |-
27554 | +
27555 |}
27556 !! end
27557
27558 !! test
27559 3a. Table cells with escapable prefixes after edits
27560 !! options
27561 parsoid={
27562 "modes": ["selser"],
27563 "scrubWikitext": true,
27564 "changes": [
27565 [ "table tbody tr:first-child td:first-child", "remove"]
27566 ]
27567 }
27568 !! wikitext
27569 {|
27570 |a||-
27571 |}
27572 !! wikitext/edited
27573 {|
27574 | -
27575 |}
27576 !! end
27577
27578 !! test
27579 3b. Table cells with escapable prefixes after edits
27580 !! options
27581 parsoid={
27582 "modes": ["selser"],
27583 "scrubWikitext": true,
27584 "changes": [
27585 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27586 [ "#x", "remove" ]
27587 ]
27588 }
27589 !! wikitext
27590 {|
27591 |pqr
27592 |<span id="x">foo</span>+
27593 |}
27594 !! wikitext/edited
27595 {|
27596 | -
27597 | +
27598 |}
27599 !! end
27600
27601 # FIXME: This test will fail because
27602 # normalization doesn't realize that the id attribute
27603 # will eliminate the escapable scenario
27604 !! test
27605 4a. Table cells without escapable prefixes after edits
27606 !! options
27607 parsoid={
27608 "modes": ["selser"],
27609 "scrubWikitext": true,
27610 "changes": [
27611 [ "#x", "html", "-" ]
27612 ]
27613 }
27614 !! wikitext
27615 {|
27616 | id="x" |abcd
27617 |}
27618 !! wikitext/edited
27619 {|
27620 | id="x" |-
27621 |}
27622 !! end
27623
27624 ## This tests normalizer's ability to discriminate between
27625 ## cells having identical content.
27626 !! test
27627 4b. Table cells without escapable prefixes after edits
27628 !! options
27629 parsoid={
27630 "modes": ["selser"],
27631 "scrubWikitext": true,
27632 "changes": [
27633 [ "td", "html", "-" ]
27634 ]
27635 }
27636 !! wikitext
27637 {|
27638 |a||b
27639 |}
27640 !! wikitext/edited
27641 {|
27642 | -||-
27643 |}
27644 !! end
27645
27646 ## This tests normalizer's ability to not be tripped by
27647 ## comments (and whitespace)
27648 !! test
27649 4c. Table cells without escapable prefixes after edits
27650 !! options
27651 parsoid={
27652 "modes": ["selser"],
27653 "scrubWikitext": true,
27654 "changes": [
27655 [ "table tbody tr td:first-child", "remove" ]
27656 ]
27657 }
27658 !! wikitext
27659 {|
27660 |-
27661 <!--foo--> |a||-
27662 |}
27663 !! wikitext/edited
27664 {|
27665 |-
27666 <!--foo--> | -
27667 |}
27668 !! end
27669
27670 ## This tests normalizer's ability to handle HTML cells
27671 !! test
27672 4d. Table cells without escapable prefixes after edits
27673 !! options
27674 parsoid={
27675 "modes": ["selser"],
27676 "scrubWikitext": true,
27677 "changes": [
27678 [ "td", "html", "-" ]
27679 ]
27680 }
27681 !! wikitext
27682 <table>
27683 <tr><td>a</td></tr>
27684 </table>
27685 !! wikitext/edited
27686 <table>
27687 <tr><td>-</td></tr>
27688 </table>
27689 !! end
27690
27691 ## T111151 Remove font elements without attributes
27692 !! test
27693 5a. font tags without attributes should be dropped in scrubWikitext mode
27694 !! options
27695 parsoid={
27696 "modes": ["html2wt"],
27697 "scrubWikitext": true
27698 }
27699 !! html
27700 <font>foo</font>
27701 <font><font>bar</font></font>
27702 <font class="x">boo</font>
27703 !! wikitext
27704 foo
27705 bar
27706 <font class="x">boo</font>
27707 !! end
27708
27709 !! test
27710 5b. font tags should not be dropped without scrubWikitext being enabled
27711 !! options
27712 parsoid={
27713 "modes": ["html2wt"],
27714 "scrubWikitext": false
27715 }
27716 !! html
27717 <font>foo</font>
27718 !! wikitext
27719 <font>foo</font>
27720 !! end
27721
27722 !! test
27723 Escape nowiki DOM elements
27724 !! options
27725 parsoid=html2wt
27726 !! html/parsoid
27727 <nowiki><i>foo</i></nowiki>
27728 !! wikitext
27729 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27730 !! end
27731
27732 # This is meant to be an interim fix while we go about figuring out
27733 # how to not introduce these trailing <nowiki/>s in the first place.
27734 !! test
27735 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27736 !! options
27737 parsoid=html2wt
27738 !! html/parsoid
27739 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27740 y</p>
27741 <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>
27742 <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>
27743 !! wikitext
27744 x
27745 y
27746
27747 {{echo|
27748 1 = <nowiki/>}}
27749
27750 {{echo|
27751 1 = <nowiki/>
27752 }}
27753 !! end
27754
27755 # ---------------------------------------------------
27756 # End of tests spec'ing wikitext serialization norms |
27757 # ---------------------------------------------------
27758
27759 # T104032
27760 !! test
27761 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27762 !! options
27763 parsoid=html2wt
27764 !! html/parsoid
27765 a<p>b</p>
27766 <b>c</b><p>d</p>
27767 <table><tr>
27768 <td>a<p>b</p></td>
27769 <td><b>c</b><p>d</p></td>
27770 </tr></table>
27771 !! wikitext
27772 a
27773
27774 b
27775
27776 '''c'''
27777
27778 d
27779 {|
27780 |a
27781 b
27782 |'''c'''
27783 d
27784 |}
27785 !! end
27786
27787 # -----------------------------------------------------------------
27788 # End of section for Parsoid-only html2wt tests for serialization
27789 # of new content
27790 # -----------------------------------------------------------------
27791
27792 # -----------------------------------------------------------------
27793 # The following section of tests are primarily to spec behavior of
27794 # the selective serializer. All these tests have manual selser
27795 # changes. The automated selser changes for all tests handle the
27796 # wide variation of changes, but these tests here capture specs
27797 # deterministically.
27798 # ----------------------------------------------------------------
27799
27800 ## T90517
27801 !! test
27802 Selser: New comments should not be lost
27803 !! options
27804 parsoid={
27805 "modes": ["selser"],
27806 "changes": [
27807 [ "#a", "after", "<!--c1-->" ],
27808 [ "#b", "before", "<!--c2-->" ]
27809 ]
27810 }
27811 !! wikitext
27812 <span id="a">a</span>
27813
27814 <span id="b">b</span>
27815 !! wikitext/edited
27816 <span id="a">a</span><!--c1-->
27817
27818 <!--c2--><span id="b">b</span>
27819 !! end
27820
27821 ## T89383
27822 !! test
27823 Selser: Check for validity of DSR before using it
27824 !! options
27825 parsoid={
27826 "modes": ["selser"],
27827 "changes": [
27828 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27829 ]
27830 }
27831 !! wikitext
27832 <span id="a">a</span>
27833 !! wikitext/edited
27834 {{DISPLAYTITLE:foo}}
27835 <span id="a">a</span>
27836 !! end
27837
27838 !! test
27839 1. DOMDiff: Changes to <ref> content should be looked up using id
27840 !! options
27841 parsoid={
27842 "modes": ["selser"],
27843 "changes": [
27844 ["#X", "after", "bar"],
27845 ["#Y", "after", "baz"]
27846 ]
27847 }
27848 !! wikitext
27849 X <ref><span id="X">foo</span></ref>
27850 Y <ref name="a" />
27851 <references>
27852 <ref name="a"><span id="Y">foo</span></ref>
27853 </references>
27854 !! wikitext/edited
27855 X <ref><span id="X">foo</span>bar</ref>
27856 Y <ref name="a" />
27857 <references>
27858 <ref name="a"><span id="Y">foo</span>baz</ref>
27859 </references>
27860 !! end
27861
27862 !! test
27863 2. DOMDiff: Changes to <ref> content should be looked up using id
27864 !! options
27865 parsoid={
27866 "modes": ["selser"],
27867 "changes": [
27868 ["#Z", "after", "bar"]
27869 ]
27870 }
27871 !! wikitext
27872 A <ref>foo bar for a</ref>
27873 B <ref group="X" name="b" />
27874
27875 <references />
27876
27877 <references group="X">
27878 <ref name="b"><span id="Z">foo</span></ref>
27879 </references>
27880 !! wikitext/edited
27881 A <ref>foo bar for a</ref>
27882 B <ref group="X" name="b" />
27883
27884 <references />
27885
27886 <references group="X">
27887 <ref name="b"><span id="Z">foo</span>bar</ref>
27888 </references>
27889 !! end
27890
27891 !! test
27892 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27893 !! options
27894 parsoid={
27895 "modes": ["selser"],
27896 "changes": [
27897 [ "div:first-child", "text", "bar" ]
27898 ]
27899 }
27900 !! wikitext
27901 <div style="{{1x|color:red;}}%">foo</div>
27902 !! wikitext/edited
27903 <div style="{{1x|color:red;}}%">bar</div>
27904 !! end
27905
27906 !! test
27907 Empty LI (T49673)
27908 !! wikitext
27909 * a
27910 *
27911 *
27912 * b
27913 !! html/php+tidy
27914 <ul>
27915 <li>a</li>
27916 <li class="mw-empty-elt"></li>
27917 <li class="mw-empty-elt"></li>
27918 <li>b</li>
27919 </ul>
27920 !! end
27921
27922 !! test
27923 Thumbnail output
27924 !! wikitext
27925 [[File:Thumb.png|thumb]]
27926 !! html/php+tidy
27927 <div class="thumb tright">
27928 <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>
27929 <div class="thumbcaption">
27930 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27931 </div>
27932 </div>
27933 </div>
27934 !! end
27935
27936 !! test
27937 unclosed internal link XSS (T137264)
27938 !! wikitext
27939 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27940 !! html/php
27941 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27942 </p>
27943 !! html/parsoid
27944 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
27945 !! end