Merge "Sync up with Parsoid parserTests."
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from https://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 #
36 # You can also set the following parser properties via test options:
37 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
38 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
39 # wgEnableMagicLinks
40 #
41 # For testing purposes, temporary articles can created:
42 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
43 # where '/' denotes a newline.
44
45 # This is the standard article assumed to exist.
46 !! article
47 Main Page
48 !! text
49 blah blah
50 !! endarticle
51
52 !!article
53 Foo
54 !!text
55 FOO
56 !!endarticle
57
58 !!article
59 Template:Foo
60 !!text
61 FOO
62 !!endarticle
63
64 !! article
65 Template:Blank
66 !! text
67 !! endarticle
68
69 !! article
70 Template:pipe
71 !! text
72 |
73 !! endarticle
74
75 !! article
76 Template:=
77 !! text
78 <nowiki>=</nowiki>
79 !! endarticle
80
81 !!article
82 MediaWiki:bad image list
83 !!text
84 * [[File:Bad.jpg]] except [[Nasty page]]
85 !!endarticle
86
87 !! article
88 Template:inner list
89 !! text
90 * item 1
91 !! endarticle
92
93 !! article
94 Template:tbl-start
95 !! text
96 {|
97 !! endarticle
98
99 !! article
100 Template:tbl-end
101 !! text
102 |}
103 !! endarticle
104
105 !! article
106 Template:echo
107 !! text
108 {{{1}}}
109 !! endarticle
110
111 !! article
112 Template:echo_with_span
113 !! text
114 <span>{{{1}}}</span>
115 !! endarticle
116
117 !! article
118 Template:echo_with_div
119 !! text
120 <div>{{{1}}}</div>
121 !! endarticle
122
123 !! article
124 Template:blank_param
125 !! text
126 {{{1}}}
127 {{{}}}
128 !! endarticle
129
130 !! article
131 Template:table_attribs
132 !! text
133 <noinclude>
134 |</noinclude>style="color:red;"|Foo
135 !! endarticle
136
137 !! article
138 Template:table_attribs_2
139 !! text
140 <noinclude>
141 |</noinclude>style="color:red;"|Foo
142 |Bar||Baz
143 !! endarticle
144
145 !! article
146 Template:table_attribs_3
147 !! text
148 <noinclude>
149 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
150 !! endarticle
151
152 !! article
153 Template:table_attribs_4
154 !! text
155 | style="background-color:#DC241f;" width="10px" |
156 !! endarticle
157
158 !! article
159 Template:table_attribs_5
160 !! text
161 <noinclude>
162 |</noinclude>style="color:red;"||Bar
163 !! endarticle
164
165 !! article
166 Template:table_attribs_6
167 !! text
168 style="background: <nowiki>
169
170
171 red;</nowiki>" |
172 !! endarticle
173
174 !! article
175 Template:table_attribs_7
176 !! text
177 <noinclude>
178 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
179 !! endarticle
180
181 !! article
182 Template:table_header_cells
183 !! text
184 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
185 !! endarticle
186
187 !! article
188 Template:table_cells
189 !! text
190 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
191 !! endarticle
192
193 !! article
194 Template:PartialTable
195 !! text
196 {|
197 |-
198 !! endarticle
199
200 !! article
201 Template:image_attribs
202 !! text
203 <noinclude>
204 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
205 !! endarticle
206
207 ## See T48811 for details
208 !! article
209 Template:mixed_attr_content_template
210 !! text
211 style="color:red;" title="T48811"
212 |-
213 |foo
214 !! endarticle
215
216 !! article
217 Template:definition_list
218 !! text
219 one
220 ::two
221 !! endarticle
222
223 !! article
224 A?b
225 !! text
226 Weirdo titles!
227 !! endarticle
228
229 !!article
230 Template:Bullet
231 !!text
232 * Bar
233 !!endarticle
234
235 !!article
236 Template:OpenTable
237 !!text
238 {|
239 !!endarticle
240
241 !!article
242 Template:EmptyLITest
243 !!text
244 *a
245 *
246 *
247 *b
248 !!endarticle
249
250 !!article
251 Template:EmptyTRTest
252 !!text
253 {|
254 |-
255 |-
256 |foo
257 |-
258 |-
259 |bar
260 |}
261 !!endarticle
262
263 !!article
264 Template:EmptyTRWithHTMLAttrTest
265 !!text
266 <table>
267 <tr align="center"></tr>
268 <tr><td>foo</td></tr>
269 <tr align="center"></tr>
270 <tr><td>bar</td></tr>
271 </table>
272 !!endarticle
273
274 !! article
275 Template:CircularRef
276 !! text
277 <ref>{{CircularRef}}</ref>
278 !! endarticle
279
280 ###
281 ### Basic tests
282 ###
283 !! test
284 Blank input
285 !! wikitext
286 !! html
287 !! end
288
289 !! test
290 CircularRef
291 !! wikitext
292 {{CircularRef}}
293 <references />
294 !! html/parsoid
295 <p><span about="#mwt1" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"CircularRef","href":"./Template:CircularRef"},"params":{},"i":0}}]}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
296 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">Error: Expansion loop detected at <a data-parsoid='{"a":{"href":null},"sa":{"href":"Template:CircularRef"}}'>Template:CircularRef</a></span></li></ol>
297 !! end
298
299 !! test
300 Simple paragraph
301 !! wikitext
302 This is a simple paragraph.
303 !! html
304 <p>This is a simple paragraph.
305 </p>
306 !! end
307
308 !! test
309 Paragraphs with extra newline spacing
310 !! wikitext
311 foo
312
313 bar
314
315
316 baz
317
318
319
320 booz
321 !! html
322 <p>foo
323 </p><p>bar
324 </p><p><br />
325 baz
326 </p><p><br />
327 </p><p>booz
328 </p>
329 !! end
330
331 !! test
332 Paragraphs with newline spacing with comment lines in between
333 !! wikitext
334 ----
335 a
336 <!--foo-->
337 b
338 ----
339 a
340 <!--foo--><!--More than 1 comment, still stripped-->
341 b
342 ----
343 a
344 <!--foo--> <!----> <!-- bar -->
345 b
346 ----
347 a
348 <!--foo-->
349
350 b
351 ----
352 a
353
354 <!--foo-->
355 b
356 ----
357 a
358 <!--foo-->
359
360
361 b
362 ----
363 a
364
365
366 <!--foo-->
367 b
368 ----
369 !! html
370 <hr />
371 <p>a
372 b
373 </p>
374 <hr />
375 <p>a
376 b
377 </p>
378 <hr />
379 <p>a
380 b
381 </p>
382 <hr />
383 <p>a
384 </p><p>b
385 </p>
386 <hr />
387 <p>a
388 </p><p>b
389 </p>
390 <hr />
391 <p>a
392 </p><p><br />
393 b
394 </p>
395 <hr />
396 <p>a
397 </p><p><br />
398 b
399 </p>
400 <hr />
401
402 !! end
403
404 !! test
405 Paragraphs with newline spacing with non-empty white-space lines in between
406 !! wikitext
407 ----
408 a
409
410 b
411 ----
412 a
413
414
415 b
416 ----
417 !! html
418 <hr />
419 <p>a
420 </p><p>b
421 </p>
422 <hr />
423 <p>a
424 </p><p><br />
425 b
426 </p>
427 <hr />
428
429 !! end
430
431 !! test
432 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
433 !! wikitext
434 ----
435 a
436 <!--foo-->
437 b
438 ----
439 a
440 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
441 b
442 ----
443 a
444
445 <!--foo-->
446 <!--bar-->
447 b
448 ----
449 a
450
451 <!--foo-->
452 <!--bar-->
453
454 b
455 ----
456 !! html
457 <hr />
458 <p>a
459 b
460 </p>
461 <hr />
462 <p>a
463 b
464 </p>
465 <hr />
466 <p>a
467 </p><p>b
468 </p>
469 <hr />
470 <p>a
471 </p><p><br />
472 b
473 </p>
474 <hr />
475
476 !! end
477
478 !! test
479 Extra newlines: More paragraphs with indented comment
480 !! wikitext
481 a
482
483 <!--boo-->
484
485 b
486 !! html
487 <p>a
488 </p><p><br />
489 b
490 </p>
491 !!end
492
493 !! test
494 Extra newlines followed by heading
495 !! wikitext
496 a
497
498
499
500 =b=
501 [[a]]
502
503
504 =b=
505 !! html
506 <p>a
507 </p><p><br />
508 </p>
509 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
510 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
511 </p><p><br />
512 </p>
513 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
514
515 !! end
516
517 !! test
518 Extra newlines between heading and content are swallowed
519 !! wikitext
520 =b=
521
522
523
524 [[a]]
525 !! html
526 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
527 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
528 </p>
529 !! end
530
531 !! test
532 Heading with line break in nowiki
533 !! options
534 parsoid=wt2html
535 !! wikitext
536 == A <nowiki>B
537 C</nowiki> ==
538 !! html
539 <h2><span class="mw-headline" id="A_B.0AC">A B
540 C</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A B&#10;C">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
541
542 !! html/parsoid
543 <h2 id="A_B.0AC">A <span typeof="mw:Nowiki">B
544 C</span> </h2>
545 !! end
546
547 !! test
548 Parsing an URL
549 !! wikitext
550 http://fr.wikipedia.org/wiki/🍺
551 <!-- EasterEgg we love beer, better be able be able to link to it -->
552 !! html
553 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
554 </p>
555 !! end
556
557 # Note that the html+tidy output removes the spaces after the <li>,
558 # which is a bug (https://sourceforge.net/p/tidy/bugs/945/, etc).
559 # This is an issue for all tests with lists. We intentionally do
560 # *not* add html+tidy clauses for these, as we don't want to
561 # document/test the broken behavior. (Parsoid matches the non-tidy
562 # output in these cases.)
563
564 !! test
565 Simple list
566 !! wikitext
567 * Item 1
568 * Item 2
569 !! html
570 <ul><li> Item 1</li>
571 <li> Item 2</li></ul>
572
573 !! end
574
575 !! test
576 Italics and bold
577 !! wikitext
578 * plain
579 * plain''italic''plain
580 * plain''italic''plain''italic''plain
581 * plain'''bold'''plain
582 * plain'''bold'''plain'''bold'''plain
583 * plain''italic''plain'''bold'''plain
584 * plain'''bold'''plain''italic''plain
585 * plain''italic'''bold-italic'''italic''plain
586 * plain'''bold''bold-italic''bold'''plain
587 * plain'''''bold-italic'''italic''plain
588 * plain'''''bold-italic''bold'''plain
589 * plain''italic'''bold-italic'''''plain
590 * plain'''bold''bold-italic'''''plain
591 * plain l'''italic''plain
592 * plain l''''bold''' plain
593 !! html
594 <ul><li> plain</li>
595 <li> plain<i>italic</i>plain</li>
596 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
597 <li> plain<b>bold</b>plain</li>
598 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
599 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
600 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
601 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
602 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
603 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
604 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
605 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
606 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
607 <li> plain l'<i>italic</i>plain</li>
608 <li> plain l'<b>bold</b> plain</li></ul>
609
610 !! end
611
612 # this example taken from the [[simple:Moon]] article (bug 47326)
613 !! test
614 Italics and possessives (1)
615 !! wikitext
616 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
617 !! html
618 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
619 </p>
620 !! end
621
622 # this example taken from [[en:Flaming Pie]] (bug 49926)
623 !! test
624 Italics and possessives (2)
625 !! wikitext
626 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
627 !! html
628 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
629 </p>
630 !! end
631
632 # this example taken from [[en:Dictionary]] (bug 49926)
633 !! test
634 Italics and possessives (3)
635 !! wikitext
636 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
637 !! html
638 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
639 </p>
640 !! end
641
642
643 ###
644 ### 2-quote opening sequence tests
645 ###
646 !! test
647 Italics and bold: 2-quote opening sequence: (2,2)
648 !! wikitext
649 ''foo''
650 !! html
651 <p><i>foo</i>
652 </p>
653 !!end
654
655 !! test
656 Italics and bold: 2-quote opening sequence: (2,3)
657 !! wikitext
658 ''foo'''
659 !! html/*
660 <p><i>foo'</i>
661 </p>
662 !!end
663
664 !! test
665 Italics and bold: 2-quote opening sequence: (2,4)
666 !! options
667 parsoid=wt2html
668 !! wikitext
669 ''foo''''
670 !! html/*
671 <p><i>foo''</i>
672 </p>
673 !!end
674
675 # same html as previous, but wikitext adjusted to match parsoid html2wt
676 !! test
677 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
678 !! wikitext
679 ''foo<nowiki>''</nowiki>''
680 !! html
681 <p><i>foo''</i>
682 </p>
683 !! end
684
685 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
686 !! test
687 Italics and bold: 2-quote opening sequence: (2,5)
688 !! options
689 parsoid=wt2html
690 !! wikitext
691 ''foo'''''
692 !! html/php
693 <p><i>foo</i>
694 </p>
695 !! html/parsoid
696 <p><i>foo</i><b></b>
697 </p>
698 !!end
699
700 # same html as previous, but wikitext adjusted to match parsoid html2wt
701 !! test
702 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
703 !! wikitext
704 ''foo'''''<nowiki/>'''
705 !! html/php
706 <p><i>foo</i>
707 </p>
708 !! html/parsoid
709 <p><i>foo</i><b></b>
710 </p>
711 !! end
712
713
714 ###
715 ### 3-quote opening sequence tests
716 ###
717
718 !! test
719 Italics and bold: 3-quote opening sequence: (3,2)
720 !! wikitext
721 '''foo''
722 !! html/*
723 <p>'<i>foo</i>
724 </p>
725 !!end
726
727 !! test
728 Italics and bold: 3-quote opening sequence: (3,3)
729 !! wikitext
730 '''foo'''
731 !! html
732 <p><b>foo</b>
733 </p>
734 !!end
735
736 !! test
737 Italics and bold: 3-quote opening sequence: (3,4)
738 !! wikitext
739 '''foo''''
740 !! html/*
741 <p><b>foo'</b>
742 </p>
743 !!end
744
745 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
746 !! test
747 Italics and bold: 3-quote opening sequence: (3,5)
748 !! options
749 parsoid=wt2html
750 !! wikitext
751 '''foo'''''
752 !! html/php
753 <p><b>foo</b>
754 </p>
755 !! html/parsoid
756 <p><b>foo</b><i></i>
757 </p>
758 !!end
759
760 # same html as previous, but wikitext adjusted to match parsoid html2wt
761 !! test
762 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
763 !! wikitext
764 '''foo'''''<nowiki/>''
765 !! html/php
766 <p><b>foo</b>
767 </p>
768 !! html/parsoid
769 <p><b>foo</b><i></i>
770 </p>
771 !! end
772
773
774 ###
775 ### 4-quote opening sequence tests
776 ###
777
778 !! test
779 Italics and bold: 4-quote opening sequence: (4,2)
780 !! options
781 parsoid=wt2html
782 !! wikitext
783 ''''foo''
784 !! html/*
785 <p>''<i>foo</i>
786 </p>
787 !!end
788
789 # same html as previous, but wikitext adjusted to match parsoid html2wt
790 !! test
791 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
792 !! wikitext
793 <nowiki>''</nowiki>''foo''
794 !! html
795 <p>''<i>foo</i>
796 </p>
797 !! end
798
799 !! test
800 Italics and bold: 4-quote opening sequence: (4,3)
801 !! wikitext
802 ''''foo'''
803 !! html/*
804 <p>'<b>foo</b>
805 </p>
806 !!end
807
808 !! test
809 Italics and bold: 4-quote opening sequence: (4,4)
810 !! options
811 parsoid=wt2html
812 !! wikitext
813 ''''foo''''
814 !! html/*
815 <p>'<b>foo'</b>
816 </p>
817 !!end
818
819 # same html as previous, but wikitext adjusted to match parsoid html2wt
820 !! test
821 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
822 !! wikitext
823 '<nowiki/>'''foo''''
824 !! html
825 <p>'<b>foo'</b>
826 </p>
827 !! end
828
829 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
830 !! test
831 Italics and bold: 4-quote opening sequence: (4,5)
832 !! options
833 parsoid=wt2html
834 !! wikitext
835 ''''foo'''''
836 !! html/php
837 <p>'<b>foo</b>
838 </p>
839 !! html/parsoid
840 <p>'<b>foo</b><i></i>
841 </p>
842 !!end
843
844 # same html as previous, but wikitext adjusted to match parsoid html2wt
845 !! test
846 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
847 !! wikitext
848 '<nowiki/>'''foo'''''<nowiki/>''
849 !! html/php
850 <p>'<b>foo</b>
851 </p>
852 !! html/parsoid
853 <p>'<b>foo</b><i></i>
854 </p>
855 !! end
856
857
858 ###
859 ### 5-quote opening sequence tests
860 ###
861
862 !! test
863 Italics and bold: 5-quote opening sequence: (5,2)
864 !! options
865 parsoid=wt2html
866 !! wikitext
867 '''''foo''
868 !! html/*
869 <p><b><i>foo</i></b>
870 </p>
871 !!end
872
873 # same html as previous, but wikitext adjusted to match parsoid html2wt
874 !! test
875 Italics and bold: 5-quote opening sequence: (5,2+3)
876 !! wikitext
877 '''''foo'''''
878 !! html/*
879 <p><i><b>foo</b></i>
880 </p>
881 !! end
882
883 !! test
884 Italics and bold: 5-quote opening sequence: (5,3)
885 !! options
886 parsoid=wt2html
887 !! wikitext
888 '''''foo'''
889 !! html/*
890 <p><i><b>foo</b></i>
891 </p>
892 !!end
893
894 # same html as previous, but wikitext adjusted to match parsoid html2wt
895 !! test
896 Italics and bold: 5-quote opening sequence: (5,3+2)
897 !! wikitext
898 '''''foo'''''
899 !! html
900 <p><i><b>foo</b></i>
901 </p>
902 !! end
903
904 !! test
905 Italics and bold: 5-quote opening sequence: (5,4)
906 !! options
907 parsoid=wt2html
908 !! wikitext
909 '''''foo''''
910 !! html/*
911 <p><i><b>foo'</b></i>
912 </p>
913 !!end
914
915 !! test
916 Italics and bold: 5-quote opening sequence: (5,5)
917 !! wikitext
918 '''''foo'''''
919 !! html
920 <p><i><b>foo</b></i>
921 </p>
922 !!end
923
924 !! test
925 Italics and bold: 5-quote opening sequence: (5,6)
926 !! wikitext
927 '''''foo''''''
928 !! html/*
929 <p><i><b>foo'</b></i>
930 </p>
931 !! end
932
933 ###
934 ### multiple quote sequences in a line
935 ###
936
937 !! test
938 Italics and bold: multiple quote sequences: (2,4,2)
939 !! options
940 parsoid=wt2html
941 !! wikitext
942 ''foo''''bar''
943 !! html/*
944 <p><i>foo'<b>bar</b></i>
945 </p>
946 !! end
947
948 # same html as previous, but wikitext adjusted to match parsoid html2wt
949 !! test
950 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
951 !! wikitext
952 ''foo'<nowiki/>'''bar'''''
953 !! html
954 <p><i>foo'<b>bar</b></i>
955 </p>
956 !! end
957
958 !! test
959 Italics and bold: multiple quote sequences: (2,4,3)
960 !! options
961 parsoid=wt2html
962 !! wikitext
963 ''foo''''bar'''
964 !! html/*
965 <p><i>foo'<b>bar</b></i>
966 </p>
967 !! end
968
969 # same html as previous, but wikitext adjusted to match parsoid html2wt
970 !! test
971 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
972 !! wikitext
973 ''foo'<nowiki/>'''bar'''''
974 !! html
975 <p><i>foo'<b>bar</b></i>
976 </p>
977 !! end
978
979 !! test
980 Italics and bold: multiple quote sequences: (2,4,4)
981 !! options
982 parsoid=wt2html
983 !! wikitext
984 ''foo''''bar''''
985 !! html/*
986 <p><i>foo'<b>bar'</b></i>
987 </p>
988 !! end
989
990 # same html as previous, but wikitext adjusted to match parsoid html2wt
991 !! test
992 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
993 !! wikitext
994 ''foo'<nowiki/>'''bar'<nowiki/>'''''
995 !! html
996 <p><i>foo'<b>bar'</b></i>
997 </p>
998 !! end
999
1000 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1001 !! test
1002 Italics and bold: multiple quote sequences: (3,4,2)
1003 !! options
1004 parsoid=wt2html
1005 !! wikitext
1006 '''foo''''bar''
1007 !! html/php
1008 <p><b>foo'</b>bar
1009 </p>
1010 !! html/parsoid
1011 <p><b>foo'</b>bar<i></i>
1012 </p>
1013 !! end
1014
1015 # same html as previous, but wikitext adjusted to match parsoid html2wt
1016 !! test
1017 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1018 !! wikitext
1019 '''foo''''bar''<nowiki/>''
1020 !! html/php
1021 <p><b>foo'</b>bar
1022 </p>
1023 !! html/parsoid
1024 <p><b>foo'</b>bar<i></i>
1025 </p>
1026 !! end
1027
1028 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1029 !! test
1030 Italics and bold: multiple quote sequences: (3,4,3)
1031 !! options
1032 parsoid=wt2html
1033 !! wikitext
1034 '''foo''''bar'''
1035 !! html/php
1036 <p><b>foo'</b>bar
1037 </p>
1038 !! html/parsoid
1039 <p><b>foo'</b>bar<b></b>
1040 </p>
1041 !! end
1042
1043 # same html as previous, but wikitext adjusted to match parsoid html2wt
1044 !! test
1045 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1046 !! wikitext
1047 '''foo''''bar'''<nowiki/>'''
1048 !! html/php
1049 <p><b>foo'</b>bar
1050 </p>
1051 !! html/parsoid
1052 <p><b>foo'</b>bar<b></b>
1053 </p>
1054 !! end
1055
1056 ###
1057 ### other quote tests
1058 ###
1059 !! test
1060 Italics and bold: other quote tests: (2,3,5)
1061 !! wikitext
1062 ''this is about '''foo's family'''''
1063 !! html
1064 <p><i>this is about <b>foo's family</b></i>
1065 </p>
1066 !!end
1067
1068
1069 !! test
1070 Italics and bold: other quote tests: (2,(3,3),2)
1071 !! wikitext
1072 ''this is about '''foo's''' family''
1073 !! html
1074 <p><i>this is about <b>foo's</b> family</i>
1075 </p>
1076 !!end
1077
1078
1079 !! test
1080 Italics and bold: other quote tests: (3,2,3,2)
1081 !! options
1082 parsoid=wt2html
1083 !! wikitext
1084 '''this is about ''foo'''s family''
1085 !! html/*
1086 <p><b>this is about <i>foo</i></b><i>s family</i>
1087 </p>
1088 !!end
1089
1090
1091 # same html as previous, but wikitext adjusted to match parsoid html2wt
1092 !! test
1093 Italics and bold: other quote tests: (3,2,3+2+2,2)
1094 !! wikitext
1095 '''this is about ''foo'''''<nowiki/>''s family''
1096 !! html
1097 <p><b>this is about <i>foo</i></b><i>s family</i>
1098 </p>
1099 !! end
1100
1101
1102 !! test
1103 Italics and bold: other quote tests: (3,2,3,3)
1104 !! wikitext
1105 '''this is about ''foo'''s family'''
1106 !! html/*
1107 <p>'<i>this is about </i>foo<b>s family</b>
1108 </p>
1109 !!end
1110
1111
1112 !! test
1113 Italics and bold: other quote tests: (3,(2,2),3)
1114 !! wikitext
1115 '''this is about ''foo's'' family'''
1116 !! html
1117 <p><b>this is about <i>foo's</i> family</b>
1118 </p>
1119 !!end
1120
1121
1122 !! test
1123 Italicized possessive
1124 !! wikitext
1125 The ''[[Main Page]]'''s talk page.
1126 !! html/php
1127 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1128 </p>
1129 !! html/parsoid
1130 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1131 !! end
1132
1133 !! test
1134 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1135 (Requires tidy for PHP parser output to be fixed up)
1136 !! options
1137 parsoid=wt2html,wt2wt
1138 !! wikitext
1139 {|
1140 !''a!!''b
1141 |''a||''b
1142 |}
1143 !! html/php+tidy
1144 <table>
1145 <tr>
1146 <th><i>a</i></th>
1147 <th><i>b</i></th>
1148 <td><i>a</i></td>
1149 <td><i>b</i></td>
1150 </tr>
1151 </table>
1152 !! html/parsoid
1153 <table>
1154 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1155 <td><i>a</i></td><td><i>b</i></td></tr>
1156 </tbody></table>
1157 !! end
1158
1159 ###
1160 ### Non-html5 tags
1161 ###
1162
1163 !! test
1164 Non-html5 tags should be accepted
1165 !! wikitext
1166 <center>''foo''</center>
1167 <big>''foo''</big>
1168 <font>''foo''</font>
1169 <strike>''foo''</strike>
1170 <tt>''foo''</tt>
1171 !! html
1172 <center><i>foo</i></center>
1173 <p><big><i>foo</i></big>
1174 <font><i>foo</i></font>
1175 <strike><i>foo</i></strike>
1176 <tt><i>foo</i></tt>
1177 </p>
1178 !! end
1179
1180 !! test
1181 <wbr> is valid wikitext (bug 52468)
1182 !! wikitext
1183 <wbr>
1184 !! html
1185 <p><wbr />
1186 </p>
1187 !! end
1188
1189 # <strike> is HTML4, <s> is HTML4/5.
1190 !! test
1191 <s> or <strike> for strikethrough
1192 !! wikitext
1193 <strike>strike</strike>
1194
1195 <s>s</s>
1196 !! html
1197 <p><strike>strike</strike>
1198 </p><p><s>s</s>
1199 </p>
1200 !! end
1201
1202 ## a not permitted
1203 ## i,b,br omitted
1204 !! test
1205 Text-level semantic html elements in wikitext
1206 !! wikitext
1207 <em>text</em>
1208 <strong>text</strong>
1209 <small>text</small>
1210 <s>text</s>
1211 <cite>text</cite>
1212 <q>text</q>
1213 <dfn>text</dfn>
1214 <abbr>text</abbr>
1215 <data>text</data>
1216 <time>text</time>
1217 <code>text</code>
1218 <var>text</var>
1219 <samp>text</samp>
1220 <kbd>text</kbd>
1221 <sub>text</sub>
1222 <u>text</u>
1223 <mark>text</mark>
1224 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1225 <bdi>text</bdi>
1226 <bdo>text</bdo>
1227 <span>text</span>
1228 <wbr />
1229 !! html
1230 <p><em>text</em>
1231 <strong>text</strong>
1232 <small>text</small>
1233 <s>text</s>
1234 <cite>text</cite>
1235 <q>text</q>
1236 <dfn>text</dfn>
1237 <abbr>text</abbr>
1238 <data>text</data>
1239 <time>text</time>
1240 <code>text</code>
1241 <var>text</var>
1242 <samp>text</samp>
1243 <kbd>text</kbd>
1244 <sub>text</sub>
1245 <u>text</u>
1246 <mark>text</mark>
1247 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1248 <bdi>text</bdi>
1249 <bdo>text</bdo>
1250 <span>text</span>
1251 <wbr />
1252 </p>
1253 !! end
1254
1255 # test cases taken from
1256 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1257 !! test
1258 Ruby markup (W3C-style)
1259 !! wikitext
1260 ; Mono-ruby for individual base characters
1261 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1262 ; Group ruby
1263 : <ruby>今日<rt>きょう</rt></ruby>
1264 ; Jukugo ruby
1265 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1266 ; Inline ruby
1267 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1268 ; Double-sided ruby
1269 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1270 <ruby>
1271 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1272 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1273 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1274 </ruby>
1275 !! html
1276 <dl><dt> Mono-ruby for individual base characters</dt>
1277 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1278 <dt> Group ruby</dt>
1279 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1280 <dt> Jukugo ruby</dt>
1281 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1282 <dt> Inline ruby</dt>
1283 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1284 <dt> Double-sided ruby</dt>
1285 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1286 <p><ruby>
1287 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1288 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1289 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1290 </ruby>
1291 </p>
1292 !! end
1293
1294 # The next two test different paths in the sanitizer.
1295 !! test
1296 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1297 !! wikitext
1298 <blockquote|>a</blockquote>
1299
1300 <b→> doesn't terminate </b→>
1301
1302 <bä> doesn't terminate </bä>
1303
1304 <boo> doesn't terminate </boo>
1305
1306 <s.foo> doesn't terminate </s.foo>
1307
1308 <sub-ID#1>
1309 !! html
1310 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1311 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1312 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1313 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1314 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1315 </p><p>&lt;sub-ID#1&gt;
1316 </p>
1317 !! end
1318
1319 # There is a tidy bug here: https://sourceforge.net/p/tidy/bugs/946/
1320 # If the non-word-character tag made it through the sanitizer, tidy
1321 # would munge it up.
1322 !! test
1323 Non-word characters don't terminate tag names + tidy
1324 !! wikitext
1325 <blockquote|>a</blockquote>
1326
1327 <b→> doesn't terminate </b→>
1328
1329 <bä> doesn't terminate </bä>
1330
1331 <boo> doesn't terminate </boo>
1332
1333 <s.foo> doesn't terminate </s.foo>
1334
1335 <sub-ID#1>
1336 !! html+tidy
1337 <p>&lt;blockquote|&gt;a</p>
1338 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1339 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1340 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1341 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1342 <p>&lt;sub-ID#1&gt;</p>
1343 !! end
1344
1345 ###
1346 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1347 ### This checks that HTML5 tags (with non-word characters in the tag
1348 ### name) make it safely through the parser -- the Sanitizer will
1349 ### munge them later, as it should.
1350 ###
1351 !! test
1352 Non-word characters are valid in extension tags (T19663)
1353 !! wikitext
1354 <tåg>tåg</tåg>
1355 !! html/php
1356 <pre>
1357 'tåg'
1358 array (
1359 )
1360 </pre>
1361
1362 !! html/parsoid
1363 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1364 !! end
1365
1366 !! test
1367 Isolated close tags should be treated as literal text (bug 52760)
1368 !! options
1369 parsoid=wt2html
1370 !! wikitext
1371 </b>
1372
1373 <s.foo>s</s>
1374 !! html/php+tidy
1375 <p>&lt;s.foo&gt;s</p>
1376 !! html/parsoid
1377 <p>&lt;s.foo&gt;s</p>
1378 !! end
1379
1380 ###
1381 ### Special characters
1382 ###
1383
1384 !! test
1385 Bare pipe character (bug 52363)
1386 !! wikitext
1387 |
1388 !! html
1389 <p>|
1390 </p>
1391 !! end
1392
1393 !! test
1394 Bare pipe character from a template (bug 52363)
1395 !! wikitext
1396 {{pipe}}
1397 !! html
1398 <p>|
1399 </p>
1400 !! end
1401
1402 ###
1403 ### <nowiki> test cases
1404 ###
1405
1406 !! test
1407 <nowiki> unordered list
1408 !! wikitext
1409 <nowiki>* This is not an unordered list item.</nowiki>
1410 !! html/php
1411 <p>* This is not an unordered list item.
1412 </p>
1413 !! html/parsoid
1414 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1415 !! end
1416
1417 !! test
1418 <nowiki> spacing
1419 !! wikitext
1420 <nowiki>Lorem ipsum dolor
1421
1422 sed abit.
1423 sed nullum.
1424
1425 :and a colon
1426 </nowiki>
1427 !! html/php
1428 <p>Lorem ipsum dolor
1429
1430 sed abit.
1431 sed nullum.
1432
1433 :and a colon
1434
1435 </p>
1436 !! html/parsoid
1437 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1438
1439 sed abit.
1440 sed nullum.
1441
1442 :and a colon
1443 </span></p>
1444 !! end
1445
1446 !! test
1447 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1448 !! wikitext
1449 <nowiki><span class="error"></nowiki>
1450 !! html/php
1451 <p>&lt;span class="error"&gt;
1452 </p>
1453 !! html/parsoid
1454 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1455 !! end
1456
1457 !! test
1458 nowiki 3
1459 !! wikitext
1460 :There is not nowiki.
1461 :There is <nowiki>nowiki</nowiki>.
1462
1463 #There is not nowiki.
1464 #There is <nowiki>nowiki</nowiki>.
1465
1466 *There is not nowiki.
1467 *There is <nowiki>nowiki</nowiki>.
1468 !! html/php
1469 <dl><dd>There is not nowiki.</dd>
1470 <dd>There is nowiki.</dd></dl>
1471 <ol><li>There is not nowiki.</li>
1472 <li>There is nowiki.</li></ol>
1473 <ul><li>There is not nowiki.</li>
1474 <li>There is nowiki.</li></ul>
1475
1476 !! html/parsoid
1477 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1478 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1479
1480 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1481 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1482
1483 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1484 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1485 !! end
1486
1487 !! test
1488 Entities inside <nowiki>
1489 !! wikitext
1490 <nowiki>&lt;</nowiki>
1491 !! html
1492 <p>&lt;
1493 </p>
1494 !! end
1495
1496 !! test
1497 Entities inside template parameters
1498 !! wikitext
1499 {{echo|&ndash;}}
1500 !! html/php+tidy
1501 <p>–</p>
1502 !! html/parsoid
1503 <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>
1504 !! end
1505
1506 !! test
1507 Properly escape nowiki when combined with other wiki markup
1508 !! options
1509 parsoid=html2wt
1510 !! html/parsoid
1511 <p>* &lt;/nowiki&gt; tag</p>
1512 !! wikitext
1513 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1514 !! end
1515
1516 !! test
1517 T93824: Put escaped HTML tags inside nowiki
1518 !! options
1519 parsoid=html2wt
1520 !! html/parsoid
1521 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1522 !! wikitext
1523 <nowiki><h2>foo</h2></nowiki>
1524 !! end
1525
1526 !! test
1527 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1528 !! options
1529 parsoid=html2wt
1530 !! html/parsoid
1531 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1532 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1533 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1534 !! wikitext
1535 This text: L'[[Foo]]
1536 This text: L<nowiki>''</nowiki>[[Foo]]
1537 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1538 !! end
1539
1540 # This test fails because wikitext whitespace is not normalized before comparing.
1541 !! test
1542 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1543 !! options
1544 parsoid=html2wt
1545 !! html/parsoid
1546 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1547 </p>
1548 !! wikitext
1549 This text : L<nowiki>''</nowiki>[[Foo]]
1550 !! end
1551
1552 # This test and the next one are html2wt only as they test that incorrect wikitext
1553 # passed in template arguments gets escaped or wrapped in nowikis where required.
1554 !! test
1555 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1556 !! options
1557 parsoid=html2wt
1558 !! html/parsoid
1559 <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>
1560 <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>
1561 !! wikitext
1562 {{echo|foo{{!}}bar}}
1563 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1564 !! end
1565
1566 !! test
1567 T53961: Output correct nowikis in template arguments
1568 !! options
1569 parsoid=html2wt
1570 !! html/parsoid
1571 <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>
1572 <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>
1573 <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>
1574 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></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 }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1576 !! wikitext
1577 {{echo|a [ b}}
1578 {{echo|<nowiki>a }} b</nowiki>}}
1579 {{echo|<nowiki>a [[ b</nowiki>}}
1580 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1581 {{echo|a <nowiki>}</nowiki>}}
1582 !! end
1583
1584 !! test
1585 Cases where "!!" needs nowiki protection
1586 !! options
1587 parsoid=html2wt
1588 !! html/parsoid
1589 <table>
1590 <tr><th>this needs protection !! here</th></tr>
1591 </table>
1592
1593 <table>
1594 <tr><th>this does not need
1595 protection !! here</th></tr>
1596 </table>
1597 !! wikitext
1598 {|
1599 !<nowiki>this needs protection !! here</nowiki>
1600 |}
1601
1602 {|
1603 !this does not need
1604 protection !! here
1605 |}
1606 !! end
1607
1608 ###
1609 ### Comments
1610 ###
1611 !! test
1612 Comments and Indent-Pre
1613 !! wikitext
1614 <!-- comment 1 --> asdf
1615
1616 <!-- comment 1 --> asdf
1617 <!-- comment 2 -->
1618
1619 <!-- comment 1 --> asdf
1620 <!-- comment 2 -->xyz
1621
1622 <!-- comment 1 --> asdf
1623 <!-- comment 2 --> xyz
1624 !! html
1625 <pre>asdf
1626 </pre>
1627 <pre>asdf
1628 </pre>
1629 <pre>asdf
1630 </pre>
1631 <p>xyz
1632 </p>
1633 <pre>asdf
1634 xyz
1635 </pre>
1636 !! end
1637
1638 !! test
1639 Comment test 2a
1640 !! wikitext
1641 asdf
1642 <!-- comment 1 -->
1643 jkl
1644 !! html
1645 <p>asdf
1646 jkl
1647 </p>
1648 !! end
1649
1650 !! test
1651 Comment test 2b
1652 !! wikitext
1653 asdf
1654 <!-- comment 1 -->
1655
1656 jkl
1657 !! html
1658 <p>asdf
1659 </p><p>jkl
1660 </p>
1661 !! end
1662
1663 !! test
1664 Comment test 3
1665 !! wikitext
1666 asdf
1667 <!-- comment 1 -->
1668 <!-- comment 2 -->
1669 jkl
1670 !! html
1671 <p>asdf
1672 jkl
1673 </p>
1674 !! end
1675
1676 !! test
1677 Comment test 4
1678 !! wikitext
1679 asdf<!-- comment 1 -->jkl
1680 !! html
1681 <p>asdfjkl
1682 </p>
1683 !! end
1684
1685 !! test
1686 Comment spacing
1687 !! wikitext
1688 a
1689 <!-- foo --> b <!-- bar -->
1690 c
1691 !! html
1692 <p>a
1693 </p>
1694 <pre> b
1695 </pre>
1696 <p>c
1697 </p>
1698 !! end
1699
1700 !! test
1701 Comment whitespace
1702 !! wikitext
1703 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1704 !! html
1705
1706 !! end
1707
1708 !! test
1709 Comment semantics and delimiters
1710 !! wikitext
1711 <!-- --><!----><!-----><!------>
1712 !! html/php
1713
1714 !! html/parsoid
1715 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1716 !! end
1717
1718 !! test
1719 Comment semantics and delimiters, redux
1720 !! wikitext
1721 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1722 -- foo -- funky huh? ... -->
1723 !! html/php
1724
1725 !! html/parsoid
1726 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1727 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1728 !! end
1729
1730 !! test
1731 Comment semantics and delimiters: directors cut
1732 !! wikitext
1733 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1734 everything starting with < followed by !-- until the first -- and > we see,
1735 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1736 -->-->
1737 !! html/php
1738 <p>--&gt;
1739 </p>
1740 !! html/parsoid
1741 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1742 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1743 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1744 --><p>--></p>
1745 !! end
1746
1747 !! test
1748 Comment semantics: nesting
1749 !! wikitext
1750 <!--<!-- no, we're not going to do anything fancy here -->-->
1751 !! html/php
1752 <p>--&gt;
1753 </p>
1754 !! html/parsoid
1755 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1756 !! end
1757
1758 # Parsoid closes the unclosed comment, even if it means a slight
1759 # round-trip diff.
1760 !! test
1761 Comment semantics: unclosed comment at end
1762 !! options
1763 parsoid=wt2html,html2html
1764 !! wikitext
1765 <!--This comment will run out to the end of the document
1766 !! html/php
1767
1768 !! html/parsoid
1769 <!--This comment will run out to the end of the document-->
1770 !! end
1771
1772 !! test
1773 Comment semantics: normalize comments to play nice with XML and browsers
1774 !! wikitext
1775 <!-- Browsers --!> think this is closed -->
1776 <!--> This would normally be text -->
1777 <!---> As would this -->
1778 <!-- XML doesn't like trailing dashes -------->
1779 <!-- Nor doubled hyphens -- anywhere in the data -->
1780 But this is not a comment.
1781 !! html/php
1782 <p>But this is not a comment.
1783 </p>
1784 !! html/parsoid
1785 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1786 <!--&#x3E; This would normally be text -->
1787 <!--&#x2D;&#x3E; As would this -->
1788 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1789 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1790 <p>But this is not a comment.</p>
1791 !! end
1792
1793 !! test
1794 Comment semantics: round-trip even text which contains encoded -->
1795 !! wikitext
1796 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1797 !! html/parsoid
1798 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1799 !! end
1800
1801 !! test
1802 Comment in template title
1803 !! wikitext
1804 {{f<!---->oo}}
1805 !! html
1806 <p>FOO
1807 </p>
1808 !! end
1809
1810 !! test
1811 Comment on its own line post-expand
1812 !! wikitext
1813 a
1814 {{blank}}<!---->
1815 b
1816 !! html
1817 <p>a
1818 </p><p>b
1819 </p>
1820 !! end
1821
1822 !! test
1823 Comment on its own line post-expand with non-significant whitespace
1824 !! wikitext
1825 a
1826 {{blank}} <!---->
1827 b
1828 !! html
1829 <p>a
1830 </p><p>b
1831 </p>
1832 !! end
1833
1834 !! test
1835 Multiple comments should still parse as SOL-transparent
1836 !! options
1837 parsoid=wt2html,wt2wt
1838 !! wikitext
1839 <!--c1-->*a
1840 <!--c2--><!--c3--><!--c4-->*b
1841 !! html/php
1842 <ul><li>a</li>
1843 <li>b</li></ul>
1844
1845 !! html/parsoid
1846 <!--c1--><ul>
1847 <li>a
1848 </li>
1849 <!--c2--><!--c3--><!--c4-->
1850 <li>b
1851 </li>
1852 </ul>
1853 !! end
1854
1855 ###
1856 ### paragraph wrapping tests
1857 ###
1858 !! test
1859 No block tags
1860 !! wikitext
1861 a
1862
1863 b
1864 !! html
1865 <p>a
1866 </p><p>b
1867 </p>
1868 !! end
1869
1870 !! test
1871 Block tag on one line (<div>)
1872 !! wikitext
1873 a <div>foo</div>
1874
1875 b
1876 !! html
1877 a <div>foo</div>
1878 <p>b
1879 </p>
1880 !! html+tidy
1881 <p>a</p>
1882 <div>foo</div>
1883 <p>b</p>
1884 !! end
1885
1886 !! test
1887 Block tag on one line (<blockquote>)
1888 !! wikitext
1889 a <blockquote>foo</blockquote>
1890
1891 b
1892 !! html
1893 a <blockquote>foo</blockquote>
1894 <p>b
1895 </p>
1896 !! html+tidy
1897 <p>a</p>
1898 <blockquote>
1899 <p>foo</p>
1900 </blockquote>
1901 <p>b</p>
1902 !! end
1903
1904 !! test
1905 Block tag on both lines (<div>)
1906 !! wikitext
1907 a <div>foo</div>
1908
1909 b <div>foo</div>
1910 !! html
1911 a <div>foo</div>
1912 b <div>foo</div>
1913
1914 !! html+tidy
1915 <p>a</p>
1916 <div>foo</div>
1917 <p>b</p>
1918 <div>foo</div>
1919 !! end
1920
1921 !! test
1922 Block tag on both lines (<blockquote>)
1923 !! wikitext
1924 a <blockquote>foo</blockquote>
1925
1926 b <blockquote>foo</blockquote>
1927 !! html
1928 a <blockquote>foo</blockquote>
1929 b <blockquote>foo</blockquote>
1930
1931 !! html+tidy
1932 <p>a</p>
1933 <blockquote>
1934 <p>foo</p>
1935 </blockquote>
1936 <p>b</p>
1937 <blockquote>
1938 <p>foo</p>
1939 </blockquote>
1940 !! end
1941
1942 !! test
1943 Multiple lines without block tags
1944 !! wikitext
1945 <div>foo</div> a
1946 b
1947 c
1948 d<!--foo--> e
1949 x <div>foo</div> z
1950 !! html
1951 <div>foo</div> a
1952 <p>b
1953 c
1954 d e
1955 </p>
1956 x <div>foo</div> z
1957
1958 !! html+tidy
1959 <div>foo</div>
1960 <p>a</p>
1961 <p>b c d e</p>
1962 <p>x</p>
1963 <div>foo</div>
1964 <p>z</p>
1965 !! end
1966
1967 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1968 # So, we have a separate section for Parsoid. We don't want
1969 # to mimic this stripping behavior in Parsoid. It affects
1970 # editing experience and also requires us to maintain additional
1971 # info for RT-ing.
1972 !! test
1973 Empty lines between lines with block tags
1974 !! wikitext
1975 <div></div>
1976
1977
1978 <div></div>a
1979
1980 b
1981 <div>a</div>b
1982
1983 <div>b</div>d
1984
1985
1986 <div>e</div>
1987 !! html
1988 <div></div>
1989 <p><br />
1990 </p>
1991 <div></div>a
1992 <p>b
1993 </p>
1994 <div>a</div>b
1995 <div>b</div>d
1996 <p><br />
1997 </p>
1998 <div>e</div>
1999
2000 !! html+tidy
2001 <p><br /></p>
2002 <p>a</p>
2003 <p>b</p>
2004 <div>a</div>
2005 <p>b</p>
2006 <div>b</div>
2007 <p>d</p>
2008 <p><br /></p>
2009 <div>e</div>
2010 !! html/parsoid
2011 <div data-parsoid='{"stx":"html"}'></div>
2012
2013 <p><br /></p>
2014 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2015
2016 <p>b</p>
2017 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2018
2019 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2020
2021 <p><br /></p>
2022 <div data-parsoid='{"stx":"html"}'>e</div>
2023 !! end
2024
2025 ## PHP parser emits output which is broken
2026 !! test
2027 Unclosed HTML p-tags should be handled properly
2028 !! wikitext
2029 <div><p>foo</div>
2030 a
2031
2032 b
2033 !! html/php+tidy
2034 <div>
2035 <p>foo</p>
2036 </div>
2037 <p>a</p>
2038 <p>b</p>
2039 !! html/parsoid
2040 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2041 <p>a</p>
2042 <p>b</p>
2043 !! end
2044
2045 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2046 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2047 ## them for now.
2048 !! test
2049 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2050 !! options
2051 parsoid=wt2html
2052 !! wikitext
2053 a [[Category:A1]] [[Category:A2]]
2054 [[Category:A3]]
2055 [[Category:A4]]
2056 !! html/parsoid
2057 <p>a</p>
2058 <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"/>
2059 !! end
2060
2061 !! test
2062 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2063 !! options
2064 parsoid=wt2html
2065 !! wikitext
2066 [[Category:A1]]a
2067 !! html/parsoid
2068 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2069 !! end
2070
2071 ###
2072 ### Preformatted text
2073 ###
2074 !! test
2075 Preformatted text
2076 !! wikitext
2077 This is some
2078 Preformatted text
2079 With ''italic''
2080 And '''bold'''
2081 And a [[Main Page|link]]
2082 !! html
2083 <pre>This is some
2084 Preformatted text
2085 With <i>italic</i>
2086 And <b>bold</b>
2087 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2088 </pre>
2089 !! end
2090
2091 !! test
2092 Tabs don't trigger preformatted text
2093 !! wikitext
2094 This is not
2095 preformatted text.
2096 This is preformatted text.
2097 So is this.
2098 !! html/php
2099 <p> This is not
2100 preformatted text.
2101 </p>
2102 <pre>This is preformatted text.
2103 So is this.
2104 </pre>
2105 !! html/parsoid
2106 <p> This is not
2107 preformatted text.</p>
2108 <pre>This is preformatted text.
2109 So is this.</pre>
2110 !! end
2111
2112 !! test
2113 Space before tab needs nowiki pre protection
2114 !! options
2115 parsoid=html2wt
2116 !! html/parsoid
2117 <p> a</p>
2118 !! wikitext
2119 <nowiki> </nowiki> a
2120 !! end
2121
2122 !! test
2123 Ident preformatting with inline content
2124 !! wikitext
2125 a
2126 ''b''
2127 !! html
2128 <pre>a
2129 <i>b</i>
2130 </pre>
2131 !! end
2132
2133 !! test
2134 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2135 !! wikitext
2136 <pre><nowiki>
2137 <b>
2138 <cite>
2139 <em>
2140 </nowiki></pre>
2141 !! html
2142 <pre>
2143 &lt;b&gt;
2144 &lt;cite&gt;
2145 &lt;em&gt;
2146 </pre>
2147
2148 !! end
2149
2150 !! test
2151 Regression with preformatted in <center>
2152 !! wikitext
2153 <center>
2154 Blah
2155 </center>
2156 !! html
2157 <center>
2158 <pre>Blah
2159 </pre>
2160 </center>
2161
2162 !! end
2163
2164 !! test
2165 Bug 52763: Preformatted in <blockquote>
2166 !! wikitext
2167 <blockquote>
2168 Blah
2169 {|
2170 |
2171 indented cell (no pre-wrapping!)
2172 |}
2173 </blockquote>
2174 !! html
2175 <blockquote>
2176 <p> Blah
2177 </p>
2178 <table>
2179 <tr>
2180 <td>
2181 <p> indented cell (no pre-wrapping!)
2182 </p>
2183 </td></tr></table>
2184 </blockquote>
2185
2186 !! end
2187
2188 !! test
2189 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2190 !! wikitext
2191 <blockquote>
2192 Foo
2193
2194 Bar
2195 </blockquote>
2196 !! html
2197 <blockquote>
2198 <p>Foo
2199 </p><p>Bar
2200 </p>
2201 </blockquote>
2202
2203 !! end
2204
2205 !! test
2206 Bug 15491: <ins>/<del> in blockquote
2207 !! wikitext
2208 <blockquote>
2209 Foo <del>bar</del> <ins>baz</ins> quux
2210 </blockquote>
2211 !! html
2212 <blockquote>
2213 <p>Foo <del>bar</del> <ins>baz</ins> quux
2214 </p>
2215 </blockquote>
2216
2217 !! end
2218
2219 # Note that the p-wrapping is newline sensitive, which could be
2220 # considered a bug: tidy will wrap only the 'Foo' in the example
2221 # below in a <p> tag. (see comment 23-25 of bug #6200)
2222 !! test
2223 Bug 15491: <ins>/<del> in blockquote (2)
2224 !! wikitext
2225 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2226 </blockquote>
2227 !! html
2228 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2229 </blockquote>
2230
2231 !! html+tidy
2232 <blockquote>
2233 <p>Foo</p>
2234 <del>bar</del> <ins>baz</ins> quux</blockquote>
2235 !! end
2236
2237 !! test
2238 <pre> with attributes (bug 3202)
2239 !! wikitext
2240 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2241 !! html
2242 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2243
2244 !! end
2245
2246 !! test
2247 <pre> with width attribute (bug 3202)
2248 !! wikitext
2249 <pre width="8">Narrow screen goodies</pre>
2250 !! html
2251 <pre width="8">Narrow screen goodies</pre>
2252
2253 !! end
2254
2255 !! test
2256 <pre> with forbidden attribute (bug 3202)
2257 !! wikitext
2258 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2259 !! html
2260 <pre width="8">Narrow screen goodies</pre>
2261
2262 !! end
2263
2264 !! test
2265 Entities inside <pre>
2266 !! wikitext
2267 <pre>&lt;</pre>
2268 !! html
2269 <pre>&lt;</pre>
2270
2271 !! end
2272
2273 !! test
2274 <pre> with forbidden attribute values (bug 3202)
2275 !! wikitext
2276 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2277 !! html
2278 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2279
2280 !! end
2281
2282 !! test
2283 <nowiki> inside <pre> (bug 13238)
2284 !! wikitext
2285 <pre>
2286 <nowiki>
2287 </pre>
2288 <pre>
2289 <nowiki></nowiki>
2290 </pre>
2291 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2292 !! html
2293 <pre>
2294 &lt;nowiki&gt;
2295 </pre>
2296 <pre>
2297
2298 </pre>
2299 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2300
2301 !! end
2302
2303 !! test
2304 <nowiki> inside of #tag:pre
2305 !! wikitext
2306 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2307 !! html/php
2308 <pre>Foo &#8594;bar</pre>
2309
2310 !! html/parsoid
2311 <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>
2312 !! end
2313
2314 !! test
2315 <nowiki> and <pre> preference (first one wins)
2316 !! wikitext
2317 <pre>
2318 <nowiki>
2319 </pre>
2320 </nowiki>
2321 </pre>
2322
2323 <nowiki>
2324 <pre>
2325 <nowiki>
2326 </pre>
2327 </nowiki>
2328 </pre>
2329
2330 !! html/php
2331 <pre>
2332 &lt;nowiki&gt;
2333 </pre>
2334 <p>&lt;/nowiki&gt;
2335 &lt;/pre&gt;
2336 </p><p>
2337 &lt;pre&gt;
2338 &lt;nowiki&gt;
2339 &lt;/pre&gt;
2340
2341 &lt;/pre&gt;
2342 </p>
2343 !! html/parsoid
2344 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2345 </pre>
2346 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2347 &lt;/pre></p>
2348
2349 <p><span typeof="mw:Nowiki">
2350 &lt;pre>
2351 &lt;nowiki>
2352 &lt;/pre>
2353 </span>
2354 &lt;/pre></p>
2355 !! end
2356
2357 !! test
2358 </pre> inside nowiki
2359 !! wikitext
2360 <nowiki></pre></nowiki>
2361 !! html
2362 <p>&lt;/pre&gt;
2363 </p>
2364 !! end
2365
2366 # Parsoid doesn't strip empty tags, like Tidy does.
2367 !! test
2368 Empty pre; pre inside other HTML tags (bug 54946)
2369 !! options
2370 parsoid=wt2html,wt2wt
2371 !! wikitext
2372 a
2373
2374 <div><pre>
2375 foo
2376 </pre></div>
2377 <pre></pre>
2378 !! html/php
2379 <p>a
2380 </p>
2381 <div><pre>
2382 foo
2383 </pre></div>
2384 <pre></pre>
2385
2386 !! html/php+tidy
2387 <p>a</p>
2388 <div>
2389 <pre>
2390 foo
2391 </pre></div>
2392 !! html/parsoid
2393 <p>a</p>
2394
2395 <div><pre>foo
2396 </pre></div>
2397 <pre></pre>
2398 !! end
2399
2400 !! test
2401 HTML pre followed by indent-pre
2402 !! wikitext
2403 <pre>foo</pre>
2404 bar
2405 !! html
2406 <pre>foo</pre>
2407 <pre>bar
2408 </pre>
2409 !! end
2410
2411 # Note that tidy removes the empty <p> tags from the start and end.
2412 # Parsoid does not, by design.
2413 !!test
2414 Block tag pre
2415 !! wikitext
2416 <p><pre>foo</pre></p>
2417 !! html/php+tidy
2418 <pre>
2419 foo
2420 </pre>
2421 !! html/parsoid
2422 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2423 !!end
2424
2425 !!test
2426 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2427 !! wikitext
2428 {{echo|}}
2429 !! html
2430
2431 !!end
2432
2433 !!test
2434 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2435 !! wikitext
2436 {{echo|
2437 foo}}
2438 !! html
2439 <p>foo
2440 </p>
2441 !!end
2442
2443 !! test
2444 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2445 !! wikitext
2446 {{echo|a
2447 b}}
2448 !! html
2449 <pre>a
2450 </pre>
2451 <p>b
2452 </p>
2453 !!end
2454
2455 !! test
2456 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2457 !! wikitext
2458 {{echo|a
2459 b
2460 c
2461 d
2462 e
2463 }}
2464 !! html
2465 <pre>a
2466 </pre>
2467 <p>b
2468 c
2469 </p>
2470 <pre>d
2471 </pre>
2472 <p>e
2473 </p>
2474 !!end
2475
2476 !!test
2477 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2478 !! wikitext
2479 {{echo| foo}}
2480
2481 {{echo| foo}}{{echo| bar}}
2482
2483 {{echo| foo}}
2484 {{echo| bar}}
2485
2486 {{echo|<!--cmt--> foo}}
2487
2488 <!--cmt-->{{echo| foo}}
2489
2490 {{echo|{{echo| }}bar}}
2491 !! html
2492 <pre>foo
2493 </pre>
2494 <pre>foo bar
2495 </pre>
2496 <pre>foo
2497 bar
2498 </pre>
2499 <pre>foo
2500 </pre>
2501 <pre>foo
2502 </pre>
2503 <pre>bar
2504 </pre>
2505 !!end
2506
2507 !! test
2508 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2509 !! wikitext
2510 {{echo| }}a
2511
2512 {{echo|
2513 }}a
2514
2515 {{echo|
2516 b}}
2517
2518 {{echo|a
2519 }}b
2520
2521 {{echo|a
2522 }} b
2523 !! html
2524 <pre>a
2525 </pre>
2526 <p><br />
2527 </p>
2528 <pre>a
2529 </pre>
2530 <p><br />
2531 </p>
2532 <pre>b
2533 </pre>
2534 <p>a
2535 </p>
2536 <pre>b
2537 </pre>
2538 <p>a
2539 </p>
2540 <pre>b
2541 </pre>
2542 !!end
2543
2544 !! test
2545 Pres with newline attributes
2546 !! wikitext
2547 <pre class="one
2548 two">hi</pre>
2549 !! html/php
2550 <pre class="one two">hi</pre>
2551
2552 !! html/parsoid
2553 <pre class="one
2554 two" data-parsoid='{"stx":"html"}'>hi</pre>
2555 !! end
2556
2557 !! test
2558 Things that look like <pre> tags aren't treated as such
2559 !! wikitext
2560 Barack Obama <President> of the United States
2561 <President></President>
2562 !! html
2563 <p>Barack Obama &lt;President&gt; of the United States
2564 &lt;President&gt;&lt;/President&gt;
2565 </p>
2566 !! end
2567
2568 !! test
2569 Handle broken pre-like tags (bug 64025)
2570 !! options
2571 parsoid=wt2html
2572 !! wikitext
2573 {{echo|<pre <pre>x</pre>}}
2574
2575 <table><pre </table>
2576 !! html/php
2577 <pre>x</pre>
2578 <table>&lt;pre </table>
2579
2580 !! html/php+tidy
2581 <pre>
2582 x
2583 </pre>
2584 <p>&lt;pre</p>
2585 !! html/parsoid
2586 <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>
2587
2588
2589 <p>&lt;pre </p>
2590
2591 <table></table>
2592 !! end
2593
2594 !! test
2595 Parsoid: handle pre with space after attribute
2596 !! options
2597 parsoid=wt2html
2598 !! wikitext
2599 <pre style="width:50%;" >{{echo|foo}}</pre>
2600 !! html/php
2601 <pre style="width:50%;">{{echo|foo}}</pre>
2602
2603 !! html/parsoid
2604 <pre style="width:50%;">{{echo|foo}}</pre>
2605 !! end
2606
2607 # TODO / maybe: fix wt2wt for this
2608 !! test
2609 Parsoid: Don't paragraph-wrap fosterable content
2610 !! options
2611 parsoid=wt2html
2612 !! wikitext
2613 {|
2614 <td></td>
2615 <td></td>
2616
2617
2618
2619 |}
2620 !! html
2621 <table>
2622
2623 <tbody>
2624 <tr>
2625 <td></td>
2626
2627 <td></td></tr>
2628
2629
2630
2631 </tbody></table>
2632 !! end
2633
2634 !! test
2635 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2636 !! options
2637 parsoid=wt2html
2638 !! wikitext
2639 {|
2640 <td>
2641 <td>
2642 </td>
2643
2644
2645
2646 |}
2647 !! html
2648 <table>
2649
2650 <tbody>
2651 <tr>
2652 <td></td>
2653
2654 <td>
2655 </td></tr>
2656
2657
2658
2659 </tbody></table>
2660 !! end
2661
2662
2663 #--------------------------------------------------------------------
2664 # Transclusion parameter whitespace stripping tests
2665 # Behavior is different for positional and named parameters
2666 #--------------------------------------------------------------------
2667 !! test
2668 Templates: Strip leading and trailing whitespace from named-param values
2669 !! wikitext
2670 {{echo|1= a }}
2671
2672 {{echo|1= {{echo|b}} }}
2673
2674 {{echo| 1 =
2675 c }}
2676
2677 {{echo| 1 =
2678 * d
2679 }}
2680 !! html
2681 <p>a
2682 </p><p>b
2683 </p><p>c
2684 </p>
2685 <ul><li> d</li></ul>
2686
2687 !! end
2688
2689 !! test
2690 Templates: Don't strip whitespace from positional-param values
2691 !! wikitext
2692 {{echo|a }}
2693
2694 {{echo|{{echo|b}} }}
2695
2696 {{echo| c
2697 }}
2698
2699 {{echo| {{echo|d}}
2700 }}
2701
2702 {{echo|
2703 e}}
2704
2705 {{echo|
2706 * f}}
2707
2708 {{echo|
2709 }}g
2710 !! html
2711 <p>a
2712 </p><p>b
2713 </p>
2714 <pre>c
2715 </pre>
2716 <p><br />
2717 </p>
2718 <pre>d
2719 </pre>
2720 <p><br />
2721 </p>
2722 <pre>e
2723 </pre>
2724 <p><br />
2725 </p>
2726 <ul><li> f</li></ul>
2727 <p><br />
2728 </p>
2729 <pre>g
2730 </pre>
2731 !! end
2732
2733 !! test
2734 Templates: Handle empty comment-and-ws-only lines correctly
2735 !! wikitext
2736 {{echo|foo
2737 <!--should be ignored-->
2738 <!--should be ignored as well-->
2739 bar}}
2740 !! html/php
2741 <p>foo
2742 bar
2743 </p>
2744 !! html/parsoid
2745 <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>
2746 !! end
2747
2748 !! test
2749 Templates: Handle comments in the target
2750 !! wikitext
2751 {{echo
2752 <!-- should be ignored -->
2753 |foo}}
2754
2755 {{echo
2756 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2757 |foo}}
2758
2759 {{echo<!-- should be ignored -->
2760 |foo}}
2761
2762 {{echo<!-- should be ignored -->|foo}}
2763
2764 {{<!-- should be ignored -->echo|foo}}
2765 !! html/php
2766 <p>foo
2767 </p><p>foo
2768 </p><p>foo
2769 </p><p>foo
2770 </p><p>foo
2771 </p>
2772 !! html/parsoid
2773 <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>
2774
2775 <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>
2776
2777 <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>
2778
2779 <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>
2780
2781 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2782 !!end
2783
2784 !! test
2785 Templates: Handle comments in parameter names (bug 67657)
2786 !! wikitext
2787 {{echo|1
2788 <!-- should be ignored -->
2789 =foo}}
2790
2791 {{echo|
2792 <!-- should be ignored -->
2793 1 = foo}}
2794
2795 {{echo|1<!-- should be ignored -->=foo}}
2796
2797 {{echo|<!-- should be ignored -->1=foo}}
2798 !! html/php
2799 <p>foo
2800 </p><p>foo
2801 </p><p>foo
2802 </p><p>foo
2803 </p>
2804 !! html/parsoid
2805 <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>
2806
2807 <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>
2808
2809 <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>
2810
2811 <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>
2812 !!end
2813
2814 !! test
2815 Templates: Other wikitext in parameter names (bug 67657)
2816 !! wikitext
2817 {{echo|''1''=foo}}
2818 !! html/php
2819 <p>{{{1}}}
2820 </p>
2821 !! html/parsoid
2822 <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>
2823 !!end
2824
2825 #--------------------------------------------------------------------
2826 # Transclusion parameter escaping tests
2827 #--------------------------------------------------------------------
2828 !! test
2829 Templates: Parsoid parameter escaping test 1
2830 !! wikitext
2831 {{echo|[foo]|{{echo|[bar]}}}}
2832 !! html/php+tidy
2833 <p>[foo]</p>
2834 !! html/parsoid
2835 <p about="#mwt1" typeof="mw:Transclusion"
2836 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2837 !! end
2838
2839 !! test
2840 Parsoid: Pipes in external links in template parameter
2841 !! wikitext
2842 {{echo|[{{echo|http://example.com}} link]}}
2843 !! html/php+tidy
2844 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2845 !! html/parsoid
2846 <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>
2847 !! end
2848
2849 !! test
2850 Parsoid: pipe in transclusion parameter
2851 !! wikitext
2852 {{echo|http://foo.com/a&#124;b}}
2853 !! html/php+tidy
2854 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2855 !! html/parsoid
2856 <p><a rel="mw:ExtLink" href="http://foo.com/a%7Cb" about="#mwt1"
2857 typeof="mw:Transclusion"
2858 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a%7Cb</a></p>
2859 !! end
2860
2861 !! test
2862 Parsoid: Pipe in external link target and content in template parameter
2863 !! options
2864 parsoid=html2wt,wt2wt
2865 !! wikitext
2866 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2867 !! html/php+tidy
2868 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2869 !! html/parsoid
2870 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2871 typeof="mw:Transclusion"
2872 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2873 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2874 !! end
2875
2876 !! test
2877 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2878 !! options
2879 parsoid
2880 !! wikitext
2881 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2882 !! html
2883 <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>
2884 !! end
2885
2886 !! test
2887 Templates: Don't escape already nowiki-escaped text in template parameters
2888 !! options
2889 parsoid=html2wt,wt2wt
2890 !! wikitext
2891 {{echo|foo<nowiki>|</nowiki>bar}}
2892 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2893 {{echo|<nowiki></nowiki>}}
2894 !! html/php+tidy
2895 <p>foo|bar &lt;div&gt;</p>
2896 !! html/parsoid
2897 <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>
2898 <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>
2899 <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>
2900 </p>
2901 !! end
2902
2903 ## Bug 52824
2904 !! test
2905 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2906 !! options
2907 parsoid=html2wt,wt2wt
2908 !! wikitext
2909 {{echo|{{echo|1=bar}}}}
2910 !! html/php+tidy
2911 <p>bar</p>
2912 !! html/parsoid
2913 <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>
2914 !! end
2915
2916 ## Bug 56733
2917 !! test
2918 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2919 !! wikitext
2920 {{echo|a : b}}
2921 !! html/php+tidy
2922 <p>a&#160;: b</p>
2923 !! html/parsoid
2924 <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>
2925 !! end
2926
2927 ## Bug T73412
2928 !! test
2929 Templates: Preserve blank parameter names
2930 !! wikitext
2931 {{echo|=foo}}
2932 !! html/php+tidy
2933 <p>{{{1}}}</p>
2934 !! html/parsoid
2935 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2936 !! end
2937
2938 !! test
2939 Templates: Preserve blank parameter names in other positions
2940 !! wikitext
2941 {{blank_param|bar|=foo}}
2942 !! html/php+tidy
2943 <p>bar foo</p>
2944 !! html/parsoid
2945 <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
2946 foo</p>
2947 !! end
2948
2949 ###
2950 ### Parsoid-centric tests for testing RT edge cases for pre
2951 ###
2952
2953 !!test
2954 1a. Indent-Pre and Comments
2955 !! wikitext
2956 a
2957 <!--a-->
2958 c
2959 !! html
2960 <pre>a
2961 </pre>
2962 <p>c
2963 </p>
2964 !!end
2965
2966 !!test
2967 1b. Indent-Pre and Comments
2968 !! wikitext
2969 a
2970 <!--a-->
2971 c
2972 !! html
2973 <pre>a
2974 </pre>
2975 <p>c
2976 </p>
2977 !!end
2978
2979 !!test
2980 1c. Indent-Pre and Comments
2981 !! wikitext
2982 <!--a--> a
2983
2984 <!--a--> a
2985 !! html
2986 <pre> a
2987 </pre>
2988 <pre> a
2989 </pre>
2990 !!end
2991
2992 !!test
2993 1d. Indent-Pre and Comments
2994 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2995 !! wikitext
2996 <!--a--> a
2997
2998 <!--b-->b
2999 !! html
3000 <pre>a
3001 </pre>
3002 <pre>b
3003 </pre>
3004 !!end
3005
3006 !!test
3007 2a. Indent-Pre and tables
3008 !! wikitext
3009 {|
3010 |-
3011 !h1!!h2
3012 |foo||bar
3013 |}
3014 !! html
3015 <table>
3016
3017 <tr>
3018 <th>h1</th>
3019 <th>h2
3020 </th>
3021 <td>foo</td>
3022 <td>bar
3023 </td></tr></table>
3024
3025 !!end
3026
3027 !!test
3028 2b. Indent-Pre and tables
3029 !! wikitext
3030 {|
3031 |-
3032 |foo
3033 |}
3034 !! html
3035 <table>
3036
3037 <tr>
3038 <td>foo
3039 </td></tr></table>
3040
3041 !!end
3042
3043 !!test
3044 2c. Indent-Pre and tables (bug 42252)
3045 !! wikitext
3046 {|
3047 |+ foo
3048 ! | bar
3049 |}
3050 !! html
3051 <table>
3052 <caption> foo
3053 </caption>
3054 <tr>
3055 <th> bar
3056 </th></tr></table>
3057
3058 !!end
3059
3060 !!test
3061 2d. Indent-Pre and tables
3062 !! wikitext
3063 a
3064 {|
3065 | b
3066 |}
3067 !! html/php
3068 <pre>a
3069 </pre>
3070 <table>
3071 <tr>
3072 <td> b
3073 </td></tr></table>
3074
3075 !! html/parsoid
3076 <pre>a</pre>
3077 <table>
3078 <tbody><tr><td> b</td></tr>
3079 </tbody></table>
3080 !!end
3081
3082 !!test
3083 2e. Indent-Pre and table-line syntax
3084 !! wikitext
3085 a
3086 | b
3087 | c
3088 !! html/php
3089 <pre>a
3090 | b
3091 | c
3092 </pre>
3093 !!end
3094
3095 !!test
3096 2f. Indent-pre started by table-line syntax
3097 !! wikitext
3098 a
3099 | b
3100 | c
3101 !! html/php
3102 <p>a
3103 </p>
3104 <pre>| b
3105 | c
3106 </pre>
3107 !! html/parsoid
3108 <p>a</p>
3109 <pre>
3110 | b
3111 | c</pre>
3112 !!end
3113
3114 !! test
3115 2g. Indented table markup mixed with indented pre content (proposed in bug 6200)
3116 !! wikitext
3117 <table>
3118 <tr>
3119 <td>
3120 Text that should be rendered preformatted
3121 </td>
3122 </tr>
3123 </table>
3124 !! html
3125 <table>
3126 <tr>
3127 <td>
3128 <pre>Text that should be rendered preformatted
3129 </pre>
3130 </td>
3131 </tr>
3132 </table>
3133
3134 !! end
3135
3136 !!test
3137 3a. Indent-Pre and block tags (single-line html)
3138 !! wikitext
3139 a <p> foo </p>
3140 b <div> foo </div>
3141 c <blockquote> foo </blockquote>
3142 <span> foo </span>
3143 !! html
3144 a <p> foo </p>
3145 b <div> foo </div>
3146 c <blockquote> foo </blockquote>
3147 <pre><span> foo </span>
3148 </pre>
3149 !! html/parsoid
3150 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3151 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3152 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3153 <pre><span> foo </span>
3154 </pre>
3155 !! html+tidy
3156 <p>a</p>
3157 <p>foo</p>
3158 <p>b</p>
3159 <div>foo</div>
3160 <p>c</p>
3161 <blockquote>
3162 <p>foo</p>
3163 </blockquote>
3164 <pre>
3165 <span> foo </span>
3166 </pre>
3167 !! end
3168
3169 !!test
3170 3b. Indent-Pre and block tags (multi-line html)
3171 !! wikitext
3172 a <span>foo</span>
3173 b <div> foo </div>
3174 !! html
3175 <pre>a <span>foo</span>
3176 </pre>
3177 b <div> foo </div>
3178
3179 !! html/parsoid
3180 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3181 b <div data-parsoid='{"stx":"html"}'> foo </div>
3182 !! html+tidy
3183 <pre>
3184 a <span>foo</span>
3185 </pre>
3186 <p>b</p>
3187 <div>foo</div>
3188 !!end
3189
3190 !!test
3191 3c. Indent-Pre and block tags (pre-content on separate line)
3192 !! wikitext
3193 <p>
3194 foo
3195 </p>
3196
3197 <div>
3198 foo
3199 </div>
3200
3201 <center>
3202 foo
3203 </center>
3204
3205 <blockquote>
3206 foo
3207 </blockquote>
3208
3209 <blockquote>
3210 <pre>
3211 foo
3212 </pre>
3213 </blockquote>
3214
3215 <table><tr><td>
3216 foo
3217 </td></tr></table>
3218
3219 <ul><li>
3220 foo
3221 </li></ul>
3222
3223 !! html
3224 <p>
3225 foo
3226 </p>
3227 <div>
3228 <pre>foo
3229 </pre>
3230 </div>
3231 <center>
3232 <pre>foo
3233 </pre>
3234 </center>
3235 <blockquote>
3236 <p> foo
3237 </p>
3238 </blockquote>
3239 <blockquote>
3240 <pre>
3241 foo
3242 </pre>
3243 </blockquote>
3244 <table><tr><td>
3245 <pre>foo
3246 </pre>
3247 </td></tr></table>
3248 <ul><li>
3249 foo
3250 </li></ul>
3251
3252 !!end
3253
3254 !! test
3255 4. Indent-Pre and extension tags
3256 !! wikitext
3257 a <tag />
3258 !! html/php
3259 a <pre>
3260 NULL
3261 array (
3262 )
3263 </pre>
3264
3265 !! html/parsoid
3266 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3267 !! end
3268
3269 !!test
3270 Render paragraphs when indent-pre is suppressed in blocklevels
3271 !! wikitext
3272 <blockquote>
3273 foo
3274
3275 bar
3276 </blockquote>
3277 !! html
3278 <blockquote>
3279 <p> foo
3280 </p><p> bar
3281 </p>
3282 </blockquote>
3283
3284 !!end
3285
3286 !!test
3287 4. Multiple spaces at start-of-line
3288 !! wikitext
3289 <p> foo </p>
3290 foo
3291 {|
3292 |foo
3293 |}
3294 !! html
3295 <p> foo </p>
3296 <pre> foo
3297 </pre>
3298 <table>
3299 <tr>
3300 <td>foo
3301 </td></tr></table>
3302
3303 !!end
3304
3305 ## NOTE: the leading white-space chars on empty line are significant
3306 !! test
3307 5a. White-space in indent-pre
3308 !! wikitext
3309 a<br />
3310
3311 b
3312 !! html
3313 <pre>a<br />
3314
3315 b
3316 </pre>
3317 !! end
3318
3319 ## NOTE: the leading white-space chars on empty line are significant
3320 !! test
3321 5b. White-space in indent-pre
3322 !! wikitext
3323 a
3324
3325 b
3326
3327
3328 c
3329 !! html
3330 <pre>a
3331
3332 b
3333
3334
3335 c
3336 </pre>
3337 !! end
3338
3339 !! test
3340 5c. White-space in indent-pre
3341 !! wikitext
3342 ''a''
3343 ''b''
3344 ''c''
3345 !! html
3346 <pre><i>a</i>
3347 <i>b</i>
3348 <i>c</i>
3349 </pre>
3350 !! end
3351
3352 !! test
3353 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3354 !! wikitext
3355 a
3356
3357 <!-- continue -->
3358 b
3359
3360 c
3361
3362 d
3363 !! html
3364 <pre>a
3365
3366 b
3367 </pre>
3368 <pre>c
3369
3370 </pre>
3371 <p>d
3372 </p>
3373 !! end
3374
3375 !! test
3376 7a. Indent-pre and category links
3377 !! options
3378 parsoid=wt2html,wt2wt
3379 !! wikitext
3380 [[Category:foo]] <!-- No pre-wrapping -->
3381 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3382 !! html/php+tidy
3383 !! html/parsoid
3384 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3385 <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 -->
3386 !! end
3387
3388 ## We used to, but no longer wt2wt this test since the default serializer
3389 ## will normalize all categories to serialize on their own line.
3390 ## This wikitext usage is going to be fairly uncommon in production and
3391 ## selser will take care of preserving formatting in those scenarios.
3392 !! test
3393 7b. Indent-pre and category links
3394 !! options
3395 parsoid=wt2html
3396 !! wikitext
3397 [[Category:foo]] a
3398 [[Category:foo]] {{echo|b}}
3399 !! html/parsoid
3400 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3401 <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>
3402 !! end
3403
3404 !! test
3405 Indent-Pre: Newlines in comments shouldn't affect sol state
3406 !! wikitext
3407 a <!--
3408 foo
3409 --> b
3410 !! html/php+tidy
3411 <p>a b</p>
3412 !! html/parsoid
3413 <p>a <!--
3414 foo
3415 --> b</p>
3416 !! end
3417
3418 ###
3419 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3420 ###
3421
3422 !!test
3423 HTML-pre: 1. embedded newlines
3424 !! wikitext
3425 <pre>foo</pre>
3426
3427 <pre>
3428 foo
3429 </pre>
3430
3431 <pre>
3432
3433 foo
3434 </pre>
3435
3436 <pre>
3437
3438
3439 foo
3440 </pre>
3441 !! html/php+tidy
3442 <pre>
3443 foo
3444 </pre>
3445 <pre>
3446 foo
3447 </pre>
3448 <pre>
3449
3450 foo
3451 </pre>
3452 <pre>
3453
3454
3455 foo
3456 </pre>
3457 !! html/parsoid
3458 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3459
3460 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3461 foo
3462 </pre>
3463
3464 <pre data-parsoid='{"stx":"html"}'>
3465
3466 foo
3467 </pre>
3468
3469 <pre data-parsoid='{"stx":"html"}'>
3470
3471
3472 foo
3473 </pre>
3474 !!end
3475
3476 !! test
3477 HTML-pre: big spaces
3478 !! wikitext
3479 <pre>
3480
3481
3482
3483
3484 haha
3485
3486
3487
3488
3489 haha
3490
3491
3492
3493
3494 </pre>
3495 !! html/php+tidy
3496 <pre>
3497
3498
3499
3500
3501 haha
3502
3503
3504
3505
3506 haha
3507
3508
3509
3510
3511 </pre>
3512 !! html/parsoid
3513 <pre data-parsoid='{"stx":"html"}'>
3514
3515
3516
3517
3518 haha
3519
3520
3521
3522
3523 haha
3524
3525
3526
3527
3528 </pre>
3529 !! end
3530
3531 !!test
3532 HTML-pre: 2: indented text
3533 !! wikitext
3534 <pre>
3535 foo
3536 </pre>
3537 !! html
3538 <pre>
3539 foo
3540 </pre>
3541
3542 !!end
3543
3544 !!test
3545 HTML-pre: 3: other wikitext
3546 !! wikitext
3547 <pre>
3548 * foo
3549 # bar
3550 = no-h =
3551 '' no-italic ''
3552 [[ NoLink ]]
3553 </pre>
3554 !! html/php
3555 <pre>
3556 * foo
3557 # bar
3558 = no-h =
3559 '' no-italic ''
3560 [[ NoLink ]]
3561 </pre>
3562
3563 !! html/parsoid
3564 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3565 # bar
3566 = no-h =
3567 '' no-italic ''
3568 [[ NoLink ]]
3569 </pre>
3570 !!end
3571
3572 ###
3573 ### Definition lists
3574 ###
3575 !! test
3576 Simple definition
3577 !! wikitext
3578 ; name : Definition
3579 !! html
3580 <dl><dt> name&#160;</dt>
3581 <dd> Definition</dd></dl>
3582
3583 !! end
3584
3585 !! test
3586 Definition list for indentation only
3587 !! wikitext
3588 : Indented text
3589 !! html
3590 <dl><dd> Indented text</dd></dl>
3591
3592 !! end
3593
3594 !! test
3595 Definition list with no space
3596 !! wikitext
3597 ;name:Definition
3598 !! html
3599 <dl><dt>name</dt>
3600 <dd>Definition</dd></dl>
3601
3602 !!end
3603
3604 !! test
3605 Definition list with URL link
3606 !! wikitext
3607 ; http://example.com/ : definition
3608 !! html
3609 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3610 <dd> definition</dd></dl>
3611
3612 !! end
3613
3614 !! test
3615 Definition list with bracketed URL link
3616 !! wikitext
3617 ;[http://www.example.com/ Example]:Something about it
3618 !! html
3619 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3620 <dd>Something about it</dd></dl>
3621
3622 !! end
3623
3624 !! test
3625 Definition list with wikilink containing colon
3626 !! wikitext
3627 ; [[Help:FAQ]]: The least-read page on Wikipedia
3628 !! html
3629 <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>
3630 <dd> The least-read page on Wikipedia</dd></dl>
3631
3632 !! end
3633
3634 # At Brion's and JeLuF's insistence... :)
3635 !! test
3636 Definition list with news link containing colon
3637 !! wikitext
3638 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3639 !! html/php
3640 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3641 <dd> This isn't even a real newsgroup!</dd></dl>
3642
3643 !! html/parsoid
3644 <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>
3645 !! end
3646
3647 !! test
3648 Malformed definition list with colon
3649 !! wikitext
3650 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3651 !! html
3652 <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>
3653
3654 !! end
3655
3656 !! test
3657 Definition lists: colon in external link text
3658 !! wikitext
3659 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3660 !! html
3661 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3662 <dd> OK, I made that up</dd></dl>
3663
3664 !! end
3665
3666 !! test
3667 Definition lists: colon in HTML attribute
3668 !! wikitext
3669 ;<b style="display: inline">bold</b>
3670 !! html
3671 <dl><dt><b style="display: inline">bold</b></dt></dl>
3672
3673 !! end
3674
3675 !! test
3676 Definition lists: self-closed tag
3677 !! wikitext
3678 ;one<br/>two : two-line fun
3679 !! html
3680 <dl><dt>one<br />two&#160;</dt>
3681 <dd> two-line fun</dd></dl>
3682
3683 !! end
3684
3685 !! test
3686 Bug 11748: Literal closing tags
3687 !! wikitext
3688 <dl>
3689 <dt>test 1</dt>
3690 <dd>test test test test test</dd>
3691 <dt>test 2</dt>
3692 <dd>test test test test test</dd>
3693 </dl>
3694 !! html
3695 <dl>
3696 <dt>test 1</dt>
3697 <dd>test test test test test</dd>
3698 <dt>test 2</dt>
3699 <dd>test test test test test</dd>
3700 </dl>
3701
3702 !! end
3703
3704 !! test
3705 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3706 !! wikitext
3707 <ul><li>
3708 ; term : description
3709 * unordered
3710 </li></ul>
3711 !! html
3712 <ul><li>
3713 <dl><dt> term&#160;</dt>
3714 <dd> description</dd></dl>
3715 <ul><li> unordered</li></ul>
3716 </li></ul>
3717
3718 !! end
3719
3720 !! test
3721 Definition list with empty definition and following paragraph
3722 !! wikitext
3723 ; term:
3724 Paragraph text
3725 !! html
3726 <dl><dt> term</dt>
3727 <dd></dd></dl>
3728 <p>Paragraph text
3729 </p>
3730 !! end
3731
3732 !! test
3733 Nested definition lists using html syntax
3734 !! wikitext
3735 <dl><dt>x</dt>
3736 <dd>a</dd>
3737 <dd>b</dd></dl>
3738 !! html
3739 <dl><dt>x</dt>
3740 <dd>a</dd>
3741 <dd>b</dd></dl>
3742
3743 !! end
3744
3745 !! test
3746 Definition Lists: No nesting: Multiple dd's
3747 !! wikitext
3748 ;x
3749 :a
3750 :b
3751 !! html
3752 <dl><dt>x</dt>
3753 <dd>a</dd>
3754 <dd>b</dd></dl>
3755
3756 !! end
3757
3758 !! test
3759 Definition Lists: Indentation: Regular
3760 !! wikitext
3761 :i1
3762 ::i2
3763 :::i3
3764 !! html
3765 <dl><dd>i1
3766 <dl><dd>i2
3767 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3768
3769 !! end
3770
3771 !! test
3772 Definition Lists: Indentation: Missing 1st level
3773 !! wikitext
3774 ::i2
3775 :::i3
3776 !! html
3777 <dl><dd><dl><dd>i2
3778 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3779
3780 !! end
3781
3782 !! test
3783 Definition Lists: Indentation: Multi-level indent
3784 !! wikitext
3785 :::i3
3786 !! html
3787 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3788
3789 !! end
3790
3791 !! test
3792 Definition Lists: Hacky use to indent tables
3793 !! wikitext
3794 ::{|
3795 |foo
3796 |bar
3797 |}
3798 this text
3799 should be left alone
3800 !! html
3801 <dl><dd><dl><dd><table>
3802 <tr>
3803 <td>foo
3804 </td>
3805 <td>bar
3806 </td></tr></table></dd></dl></dd></dl>
3807 <p>this text
3808 should be left alone
3809 </p>
3810 !! end
3811
3812 !! test
3813 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3814 !! wikitext
3815 <!-- foo -->
3816 ::{|
3817 |foo
3818 |bar
3819 |}<!-- bar -->
3820 this text
3821 should be left alone
3822 !! html/parsoid
3823 <!-- foo -->
3824 <dl><dd><dl><dd><table><tr>
3825 <td>foo</td>
3826 <td>bar</td>
3827 </tr></table><!-- bar --></dd></dl></dd></dl>
3828 <p>this text
3829 should be left alone</p>
3830 !! end
3831
3832 !! test
3833 Definition Lists: Hacky use to indent tables, with comment before table
3834 !! wikitext
3835 ::<!-- foo -->{|
3836 |foo
3837 |}
3838 !! html/parsoid
3839 <dl><dd><dl><dd><!-- foo --><table><tr>
3840 <td>foo</td>
3841 </tr></table></dd></dl></dd></dl>
3842 !! end
3843
3844 # The trailing whitespace in this test is to catch a regression in
3845 # Parsoid after T54473.
3846 !! test
3847 Definition Lists: Hacky use to indent tables (WS-insensitive)
3848 !! wikitext
3849 : {|
3850 |a
3851 |}
3852 !! html/php
3853 <dl><dd><table>
3854 <tr>
3855 <td>a
3856 </td></tr></table></dd></dl>
3857
3858 !! html/parsoid
3859 <dl><dd> <table>
3860 <tbody><tr><td>a</td></tr>
3861 </tbody></table> </dd></dl>
3862 !! end
3863
3864 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3865 ## as an empty dt item. It also ignores all but the last ";" when followed
3866 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3867 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3868 ## ";"s.
3869 ##
3870 ## Ex: ";;t2 ::d2" is transformed into:
3871 ##
3872 ## <dl>
3873 ## <dt>t2 </dt>
3874 ## <dd>
3875 ## <dl>
3876 ## <dt></dt>
3877 ## <dd>d2</dd>
3878 ## </dl>
3879 ## </dd>
3880 ## </dl>
3881 ##
3882 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3883 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3884 ##
3885 ## <dl>
3886 ## <dt>
3887 ## <dl>
3888 ## <dt>t2 </dt>
3889 ## <dd>:d2</dd>
3890 ## </dl>
3891 ## </dt>
3892 ## </dl>
3893 ##
3894 ## All Parsoid only definition list tests have this difference.
3895 ##
3896 ## See also: https://phabricator.wikimedia.org/T8569
3897 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3898
3899 !! test
3900 Table / list interaction: indented table with lists in table contents
3901 !! wikitext
3902 :{|
3903 |-
3904 | a
3905 * b
3906 |-
3907 | c
3908 * d
3909 |}
3910 !! html
3911 <dl><dd><table>
3912
3913 <tr>
3914 <td> a
3915 <ul><li> b</li></ul>
3916 </td></tr>
3917 <tr>
3918 <td> c
3919 <ul><li> d</li></ul>
3920 </td></tr></table></dd></dl>
3921
3922 !! end
3923
3924 !!test
3925 Table / list interaction: lists nested in tables nested in indented lists
3926 !! wikitext
3927 :{|
3928 |
3929 :a
3930 :b
3931 |
3932 *c
3933 *d
3934 |}
3935
3936 *e
3937 *f
3938 !! html
3939 <dl><dd><table>
3940 <tr>
3941 <td>
3942 <dl><dd>a</dd>
3943 <dd>b</dd></dl>
3944 </td>
3945 <td>
3946 <ul><li>c</li>
3947 <li>d</li></ul>
3948 </td></tr></table></dd></dl>
3949 <ul><li>e</li>
3950 <li>f</li></ul>
3951
3952 !!end
3953
3954 !! test
3955 Definition Lists: Nesting: Multi-level (Parsoid only)
3956 !! options
3957 parsoid
3958 !! wikitext
3959 ;t1 :d1
3960 ;;t2 ::d2
3961 ;;;t3 :::d3
3962 !! html
3963 <dl>
3964 <dt>t1 </dt>
3965 <dd>d1</dd>
3966 <dt>
3967 <dl>
3968 <dt>t2 </dt>
3969 <dd>:d2</dd>
3970 <dt>
3971 <dl>
3972 <dt>t3 </dt>
3973 <dd>::d3</dd>
3974 </dl>
3975 </dt>
3976 </dl>
3977 </dt>
3978 </dl>
3979
3980
3981 !! end
3982
3983
3984 !! test
3985 Definition Lists: Nesting: Test 2 (Parsoid only)
3986 !! wikitext
3987 ;t1
3988 ::d2
3989 !! html/php+tidy
3990 <dl>
3991 <dt>t1</dt>
3992 <dd>
3993 <dl>
3994 <dd>d2</dd>
3995 </dl>
3996 </dd>
3997 </dl>
3998 !! html/parsoid
3999 <dl>
4000 <dt>t1</dt>
4001 <dd>
4002 <dl>
4003 <dd>d2</dd>
4004 </dl>
4005 </dd>
4006 </dl>
4007
4008 !! end
4009
4010
4011 !! test
4012 Definition Lists: Nesting: Test 3 (Parsoid only)
4013 !! wikitext
4014 :;t1
4015 ::::d2
4016 !! html/php+tidy
4017 <dl>
4018 <dd>
4019 <dl>
4020 <dt>t1</dt>
4021 <dd>
4022 <dl>
4023 <dd>
4024 <dl>
4025 <dd>d2</dd>
4026 </dl>
4027 </dd>
4028 </dl>
4029 </dd>
4030 </dl>
4031 </dd>
4032 </dl>
4033 !! html/parsoid
4034 <dl>
4035 <dd>
4036 <dl>
4037 <dt>t1</dt>
4038 <dd>
4039 <dl>
4040 <dd>
4041 <dl>
4042 <dd>d2</dd>
4043 </dl>
4044 </dd>
4045 </dl>
4046 </dd>
4047 </dl>
4048 </dd>
4049 </dl>
4050
4051 !! end
4052
4053
4054 !! test
4055 Definition Lists: Nesting: Test 4
4056 !! wikitext
4057 ::;t3
4058 :::d3
4059 !! html
4060 <dl><dd><dl><dd><dl><dt>t3</dt>
4061 <dd>d3</dd></dl></dd></dl></dd></dl>
4062
4063 !! end
4064
4065
4066 ## The Parsoid team believes the following three test exposes a
4067 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4068 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4069 ## It also exposes a "misfeature" in tidy, which doesn't like
4070 ## <dl> tags with a single <dt> child; it converts the <dt> into
4071 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4072 !! test
4073 Definition Lists: Mixed Lists: Test 1
4074 !! wikitext
4075 :;* foo
4076 ::* bar
4077 :; baz
4078 !! html/php
4079 <dl><dd><dl><dt><ul><li> foo</li>
4080 <li> bar</li></ul></dt></dl>
4081 <dl><dt> baz</dt></dl></dd></dl>
4082
4083 !! html/php+tidy
4084 <dl>
4085 <dd>
4086 <dl>
4087 <dd>
4088 <ul>
4089 <li>foo</li>
4090 <li>bar</li>
4091 </ul>
4092 </dd>
4093 </dl>
4094 <dl>
4095 <dt>baz</dt>
4096 </dl>
4097 </dd>
4098 </dl>
4099 !! html/parsoid
4100 <dl>
4101 <dd><dl>
4102 <dt><ul>
4103 <li> foo
4104 </li>
4105 </ul></dt>
4106 <dd><ul>
4107 <li> bar
4108 </li>
4109 </ul></dd>
4110 <dt> baz</dt>
4111 </dl></dd>
4112 </dl>
4113 !! end
4114
4115 !! test
4116 Definition Lists: Mixed Lists: Test 2
4117 !! wikitext
4118 *: d1
4119 *: d2
4120 !! html
4121 <ul><li><dl><dd> d1</dd>
4122 <dd> d2</dd></dl></li></ul>
4123
4124 !! end
4125
4126
4127 !! test
4128 Definition Lists: Mixed Lists: Test 3
4129 !! wikitext
4130 *::: d1
4131 *::: d2
4132 !! html
4133 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4134 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4135
4136 !! end
4137
4138
4139 !! test
4140 Definition Lists: Mixed Lists: Test 4
4141 !! wikitext
4142 *;d1 :d2
4143 *;d3 :d4
4144 !! html
4145 <ul><li><dl><dt>d1&#160;</dt>
4146 <dd>d2</dd>
4147 <dt>d3&#160;</dt>
4148 <dd>d4</dd></dl></li></ul>
4149
4150 !! end
4151
4152
4153 !! test
4154 Definition Lists: Mixed Lists: Test 5
4155 !! wikitext
4156 *:d1
4157 *:: d2
4158 !! html
4159 <ul><li><dl><dd>d1
4160 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4161
4162 !! end
4163
4164
4165 !! test
4166 Definition Lists: Mixed Lists: Test 6
4167 !! wikitext
4168 #*:d1
4169 #*::: d3
4170 !! html
4171 <ol><li><ul><li><dl><dd>d1
4172 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4173
4174 !! end
4175
4176
4177 !! test
4178 Definition Lists: Mixed Lists: Test 7
4179 !! wikitext
4180 :* d1
4181 :* d2
4182 !! html
4183 <dl><dd><ul><li> d1</li>
4184 <li> d2</li></ul></dd></dl>
4185
4186 !! end
4187
4188
4189 !! test
4190 Definition Lists: Mixed Lists: Test 8
4191 !! wikitext
4192 :* d1
4193 ::* d2
4194 !! html
4195 <dl><dd><ul><li> d1</li></ul>
4196 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4197
4198 !! end
4199
4200
4201 !! test
4202 Definition Lists: Mixed Lists: Test 9
4203 !! wikitext
4204 *;foo :bar
4205 !! html
4206 <ul><li><dl><dt>foo&#160;</dt>
4207 <dd>bar</dd></dl></li></ul>
4208
4209 !! end
4210
4211
4212 !! test
4213 Definition Lists: Mixed Lists: Test 10
4214 !! wikitext
4215 *#;foo :bar
4216 !! html
4217 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4218 <dd>bar</dd></dl></li></ol></li></ul>
4219
4220 !! end
4221
4222 # The Parsoid team disagrees with the PHP parser's seemingly-random
4223 # rules regarding dd/dt on the next two tests. Parsoid is more
4224 # consistent, and recognizes the shared nesting and keeps the
4225 # still-open tags around until the nesting is complete.
4226 # (And tidy again converts <dt> to <dd> before 'bar'.)
4227
4228 !! test
4229 Definition Lists: Mixed Lists: Test 11
4230 !! wikitext
4231 *#*#;*;;foo :bar
4232 *#*#;boo :baz
4233 !! html/php
4234 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4235 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4236 <dl><dt>boo&#160;</dt>
4237 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4238
4239 !! html/php+tidy
4240 <ul>
4241 <li>
4242 <ol>
4243 <li>
4244 <ul>
4245 <li>
4246 <ol>
4247 <li>
4248 <dl>
4249 <dt>foo&#160;</dt>
4250 <dd>
4251 <ul>
4252 <li>
4253 <dl>
4254 <dd>
4255 <dl>
4256 <dt>bar</dt>
4257 </dl>
4258 </dd>
4259 </dl>
4260 </li>
4261 </ul>
4262 </dd>
4263 </dl>
4264 <dl>
4265 <dt>boo&#160;</dt>
4266 <dd>baz</dd>
4267 </dl>
4268 </li>
4269 </ol>
4270 </li>
4271 </ul>
4272 </li>
4273 </ol>
4274 </li>
4275 </ul>
4276 !! html/parsoid
4277 <ul>
4278 <li>
4279 <ol>
4280 <li>
4281 <ul>
4282 <li>
4283 <ol>
4284 <li>
4285 <dl>
4286 <dt>
4287 <ul>
4288 <li>
4289 <dl>
4290 <dt>
4291 <dl>
4292 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4293 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4294 </dl></dt>
4295 </dl></li>
4296 </ul></dt>
4297 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4298 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4299 </dl></li>
4300 </ol></li>
4301 </ul></li>
4302 </ol></li>
4303 </ul>
4304 !! end
4305
4306
4307 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4308 # From whitelist:
4309 # * The test is wrong, there are two colons where there should be :;
4310 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4311 !! test
4312 Definition Lists: Weird Ones: Test 1
4313 !! wikitext
4314 *#;*::;; foo : bar (who uses this?)
4315 !! html/php
4316 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4317 <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>
4318
4319 !! html/php+tidy
4320 <ul>
4321 <li>
4322 <ol>
4323 <li>
4324 <dl>
4325 <dt>foo&#160;</dt>
4326 <dd>
4327 <ul>
4328 <li>
4329 <dl>
4330 <dd>
4331 <dl>
4332 <dd>
4333 <dl>
4334 <dd>
4335 <dl>
4336 <dt>bar (who uses this?)</dt>
4337 </dl>
4338 </dd>
4339 </dl>
4340 </dd>
4341 </dl>
4342 </dd>
4343 </dl>
4344 </li>
4345 </ul>
4346 </dd>
4347 </dl>
4348 </li>
4349 </ol>
4350 </li>
4351 </ul>
4352 !! html/parsoid
4353 <ul>
4354 <li>
4355 <ol>
4356 <li>
4357 <dl>
4358 <dt>
4359 <ul>
4360 <li>
4361 <dl>
4362 <dd>
4363 <dl>
4364 <dd>
4365 <dl>
4366 <dt>
4367 <dl>
4368 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4369 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4370 </dl></dt>
4371 </dl></dd>
4372 </dl></dd>
4373 </dl></li>
4374 </ul></dt>
4375 </dl></li>
4376 </ol></li>
4377 </ul>
4378 !! end
4379
4380 !! test
4381 Definition Lists: colons occurring in tags
4382 !! wikitext
4383 ;a:b
4384 ;'''a:b'''
4385 ;<i>a:b</i>
4386 ;<span>a:b</span>
4387 ;<div>a:b</div>
4388 ;<div>a
4389 :b</div>
4390 ;{{echo|a:b}}
4391 ;{{echo|''a:b''}}
4392 ;;;''a:b''
4393 !! html+tidy
4394 <dl>
4395 <dt>a</dt>
4396 <dd>b</dd>
4397 <dt><b>a:b</b></dt>
4398 <dt><i>a:b</i></dt>
4399 <dt><span>a:b</span></dt>
4400 <dd>
4401 <div>a:b</div>
4402 </dd>
4403 <dd>
4404 <div>a
4405 <dl>
4406 <dd>b</dd>
4407 </dl>
4408 </div>
4409 </dd>
4410 <dt>a</dt>
4411 <dd>b</dd>
4412 <dt><i>a:b</i></dt>
4413 </dl>
4414 <dl>
4415 <dd>
4416 <dl>
4417 <dd>
4418 <dl>
4419 <dt><i>a:b</i></dt>
4420 </dl>
4421 </dd>
4422 </dl>
4423 </dd>
4424 </dl>
4425 !! html/parsoid
4426 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4427 <dt><b>a:b</b></dt>
4428 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4429 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4430 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4431 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4432 <dd>b</dd>
4433 <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>
4434 <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>
4435 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4436 !! end
4437
4438 !! test
4439 Definition Lists: colons and tables 1
4440 !! wikitext
4441 :{|
4442 | x
4443 |}
4444 :{|
4445 | y
4446 |}
4447 !! html
4448 <dl><dd><table>
4449 <tr>
4450 <td> x
4451 </td></tr></table></dd></dl>
4452 <dl><dd><table>
4453 <tr>
4454 <td> y
4455 </td></tr></table></dd></dl>
4456
4457 !! end
4458
4459 # Parsoid's output (as documented below) differs from php's in this case.
4460 # This is probably a bug. If we fixup parsoid to match php's output, the
4461 # above test should pass and the below test case can be removed. It is
4462 # unclear which output is more desirable.
4463
4464 !! test
4465 Definition Lists: colons and tables 2
4466 !! wikitext
4467 :{|
4468 | x
4469 |}
4470 :{|
4471 | y
4472 |}
4473 !! html/parsoid
4474 <dl><dd><table>
4475 <tr>
4476 <td> x
4477 </td></tr></table></dd>
4478 <dd><table>
4479 <tr>
4480 <td> y
4481 </td></tr></table></dd></dl>
4482 !! end
4483
4484 !! test
4485 Definition Lists: template interaction
4486 !! wikitext
4487 ::{{definition_list}}
4488
4489 :one
4490 ::{{definition_list}}
4491 :::two
4492 :::three
4493 ::four
4494 !! html/parsoid
4495 <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">
4496 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4497
4498 <dl><dd data-parsoid='{}'>one
4499 <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">
4500 </span><dd about="#mwt2">two
4501 <dl><dd>two</dd>
4502 <dd>three</dd></dl></dd>
4503 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4504 !! end
4505
4506
4507 ###
4508 ### External links
4509 ###
4510 !! test
4511 External links: non-bracketed
4512 !! wikitext
4513 Non-bracketed: http://example.com
4514 !! html
4515 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4516 </p>
4517 !! end
4518
4519 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4520 !! test
4521 External links: numbered
4522 !! wikitext
4523 Numbered: [http://example.com]
4524 Numbered: [http://example.net]
4525 Numbered: [http://example.com]
4526 !! html/php
4527 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4528 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4529 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4530 </p>
4531 !! html/parsoid
4532 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4533 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4534 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4535 !!end
4536
4537 !! test
4538 External links: specified text
4539 !! wikitext
4540 Specified text: [http://example.com link]
4541 !! html
4542 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4543 </p>
4544 !!end
4545
4546 !! test
4547 External links: trail
4548 !! wikitext
4549 Linktrails should not work for external links: [http://example.com link]s
4550 !! html
4551 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4552 </p>
4553 !! end
4554
4555 !! test
4556 External links: dollar sign in URL
4557 !! wikitext
4558 http://example.com/1$2345
4559 !! html
4560 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4561 </p>
4562 !! end
4563
4564 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4565 !! test
4566 External links: dollar sign in URL (autonumber)
4567 !! wikitext
4568 [http://example.com/1$2345]
4569 !! html/php
4570 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4571 </p>
4572 !! html/parsoid
4573 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4574 !!end
4575
4576 !! test
4577 External links: open square bracket forbidden in URL (bug 4377)
4578 !! options
4579 parsoid=wt2html,wt2wt,html2html
4580 !! wikitext
4581 http://example.com/1[2345
4582 !! html/php
4583 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4584 </p>
4585 !! html/parsoid
4586 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4587 !! end
4588
4589 !! test
4590 External links: open square bracket forbidden in URL (named) (bug 4377)
4591 !! options
4592 parsoid=wt2html,html2html
4593 !! wikitext
4594 [http://example.com/1[2345]
4595 !! html/php
4596 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4597 </p>
4598 !! html/parsoid
4599 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4600 !!end
4601
4602 # parsoid adds a space before the link name
4603 !! test
4604 External links: open square bracket forbidden in URL (named) (bug 4377)
4605 Parsoid variant.
4606 !! wikitext
4607 [http://example.com/1 [2345]
4608 !! html
4609 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4610 </p>
4611 !!end
4612
4613 !! test
4614 External links: nowiki in URL link text (bug 6230)
4615 !! wikitext
4616 [http://example.com/ <nowiki>''example site''</nowiki>]
4617 !! html
4618 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4619 </p>
4620 !! end
4621
4622 !! test
4623 External links: newline forbidden in text (bug 6230 regression check)
4624 !! wikitext
4625 [http://example.com/ first
4626 second]
4627 !! html
4628 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4629 second]
4630 </p>
4631 !!end
4632
4633 !! test
4634 External links: Pipe char between url and text
4635 !! wikitext
4636 [http://example.com | link]
4637 !! html
4638 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4639 </p>
4640 !!end
4641
4642 !! test
4643 External links: protocol-relative URL in brackets
4644 !! wikitext
4645 [//example.com/ Test]
4646 !! html
4647 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4648 </p>
4649 !! end
4650
4651 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4652 !! test
4653 External links: protocol-relative URL in brackets without text
4654 !! wikitext
4655 [//example.com]
4656 !! html/php
4657 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4658 </p>
4659 !! html/parsoid
4660 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4661 !! end
4662
4663 !! test
4664 External links: protocol-relative URL in free text is left alone
4665 !! wikitext
4666 //example.com/Foo
4667 !! html
4668 <p>//example.com/Foo
4669 </p>
4670 !!end
4671
4672 !! test
4673 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4674 !! wikitext
4675 foo//example.com/Foo
4676 !! html
4677 <p>foo//example.com/Foo
4678 </p>
4679 !! end
4680
4681 !! test
4682 External links: with no contents
4683 !! wikitext
4684 [http://en.wikipedia.org/wiki/Foo]
4685
4686 [[wikipedia:Foo|Bar]]
4687
4688 [[wikipedia:Foo|<span>Bar</span>]]
4689 !! html/php
4690 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4691 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4692 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4693 </p>
4694 !! html/parsoid
4695 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4696 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4697 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4698 !! end
4699
4700 !! test
4701 External links: Free with trailing punctuation
4702 !! wikitext
4703 http://example.com,
4704 http://example.com;
4705 http://example.com\
4706 http://example.com.
4707 http://example.com:
4708 http://example.com!
4709 http://example.com?
4710 http://example.com)
4711 http://example.com/url_with_(brackets)
4712 (http://example.com/url_without_brackets)
4713 http://example.com/url_with_entity&amp;
4714 http://example.com/url_with_entity&#x26;
4715 http://example.com/url_with_entity&#038;
4716 http://example.com/url_with_entity&nbsp;
4717 http://example.com/url_with_entity&#xA0;
4718 http://example.com/url_with_entity&#160;
4719 http://example.com/url_with_entity&lt;
4720 http://example.com/url_with_entity&#x3C;
4721 http://example.com/url_with_entity&#60;
4722 !! html/php
4723 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4724 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4725 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4726 <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/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4732 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4733 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4734 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4735 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4736 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4737 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4738 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4739 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4740 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4741 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4742 </p>
4743 !! html/parsoid
4744 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4745 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4746 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4747 <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/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4753 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4754 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4755 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4756 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4757 <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>
4758 <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>
4759 <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>
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;lt;","srcContent":"&lt;"}'>&lt;</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;#x3C;","srcContent":"&lt;"}'>&lt;</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;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4763 !! end
4764
4765 !! test
4766 External links: tricky Parsoid html2html case
4767 !! options
4768 parsoid=wt2html,wt2wt,html2html
4769 !! wikitext
4770 http://example.com/url_with_entity&amp;amp;
4771 !! html/php
4772 <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>;
4773 </p>
4774 !! html/parsoid
4775 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4776 !! end
4777
4778 !! test
4779 External links: Free with trailing quotes (T113666)
4780 !! wikitext
4781 '''News:''' Stuff here
4782
4783 news:'a'b''c''d e
4784 !! html/php
4785 <p><b>News:</b> Stuff here
4786 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4787 </p>
4788 !! html/parsoid
4789 <p><b>News:</b> Stuff here</p>
4790 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4791 !! end
4792
4793 !! test
4794 External links: with entity
4795 !! wikitext
4796 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
4797 !! html/php
4798 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
4799 </p>
4800 !! html/parsoid
4801 <p><a rel="mw:ExtLink" href="http://+www.librarieswithoutborders.org" data-parsoid='{"a":{"href":"http://+www.librarieswithoutborders.org"},"sa":{"href":"http://&amp;#x20;www.librarieswithoutborders.org"}}'>Libraries without borders</a></p>
4802 !! end
4803
4804 !! test
4805 External links: Lone protocols are never linked (T105697)
4806 !! wikitext
4807 http://
4808 http://;
4809 (http://)
4810 bitcoin:
4811 bitcoin:;
4812 (bitcoin:)
4813 !! html
4814 <p>http://
4815 http://;
4816 (http://)
4817 bitcoin:
4818 bitcoin:;
4819 (bitcoin:)
4820 </p>
4821 !! end
4822
4823 !! test
4824 External links: No preceding word characters allowed (bug 65278)
4825 !! wikitext
4826 NOPEhttp://example.com
4827 N0http://example.com
4828 ok:http://example.com
4829 ok-http://example.com
4830 !! html
4831 <p>NOPEhttp://example.com
4832 N0http://example.com
4833 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4834 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4835 </p>
4836 !! end
4837
4838 !! test
4839 External links: nofollow domain exception
4840 !! wikitext
4841 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4842 !! html
4843 <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>.
4844 </p>
4845 !!end
4846
4847 !! test
4848 External image
4849 !! wikitext
4850 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4851 !! html
4852 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4853 </p>
4854 !! end
4855
4856 !! test
4857 External image from https
4858 !! wikitext
4859 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4860 !! html
4861 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4862 </p>
4863 !! end
4864
4865 !! test
4866 External image (when not allowed)
4867 !! options
4868 wgAllowExternalImages=0
4869 !! wikitext
4870 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4871 !! html
4872 <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>
4873 </p>
4874 !! end
4875
4876 !! test
4877 Link to non-http image, no img tag
4878 !! wikitext
4879 Link to non-http image, no img tag: ftp://example.com/test.jpg
4880 !! html
4881 <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>
4882 </p>
4883 !! end
4884
4885 !! test
4886 External links: terminating separator
4887 !! wikitext
4888 Terminating separator: http://example.com/thing,
4889 !! html
4890 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4891 </p>
4892 !! end
4893
4894 !! test
4895 External links: intervening separator
4896 !! wikitext
4897 Intervening separator: http://example.com/1,2,3
4898 !! html
4899 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4900 </p>
4901 !! end
4902
4903 !! test
4904 External links: old bug with URL in query
4905 !! wikitext
4906 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4907 !! html
4908 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4909 </p>
4910 !! end
4911
4912 !! test
4913 External links: old URL-in-URL bug, mixed protocols
4914 !! wikitext
4915 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4916 !! html
4917 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4918 </p>
4919 !!end
4920
4921 # Since Parsoid is starting to emit canonical wikitext for links,
4922 # [http://example.com http://example.com] will not RT back to that
4923 # form anymore.
4924 !! test
4925 External links: URL in text
4926 !! options
4927 parsoid=wt2html
4928 !! wikitext
4929 URL in text: [http://example.com http://example.com]
4930 !! html/php
4931 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4932 </p>
4933 !! html/parsoid
4934 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4935 !! end
4936
4937 !! test
4938 External links: Clickable images
4939 !! wikitext
4940 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4941 !! html/php
4942 <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>
4943 </p>
4944 !! html/parsoid
4945 <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>
4946 !! end
4947
4948 !! test
4949 External links: raw ampersand
4950 !! wikitext
4951 Old &amp; use: http://x&y
4952 !! html
4953 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4954 </p>
4955 !! end
4956
4957 !! test
4958 External links: encoded ampersand
4959 !! wikitext
4960 Old &amp; use: http://x&amp;y
4961 !! html/php
4962 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4963 </p>
4964 !! html/parsoid
4965 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4966 !! end
4967
4968 !! test
4969 External links: encoded equals (bug 6102)
4970 !! wikitext
4971 http://example.com/?foo&#61;bar
4972 !! html/php
4973 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4974 </p>
4975 !! html/parsoid
4976 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4977 !! end
4978
4979 ##
4980 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4981 ## does it number them. As discussed in bug 53505, we can identify
4982 ## autonumbered links via CSS.
4983 ##
4984
4985 !! test
4986 External links: [raw ampersand]
4987 !! wikitext
4988 Old &amp; use: [http://x&y]
4989 !! html/php
4990 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4991 </p>
4992 !! html/parsoid
4993 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4994 !! end
4995
4996 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4997 # mode will return the [raw ampersand] wikitext
4998 !! test
4999 External links: [encoded ampersand]
5000 !! options
5001 parsoid=wt2html,wt2wt,html2html
5002 !! wikitext
5003 Old &amp; use: [http://x&amp;y]
5004 !! html/php
5005 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5006 </p>
5007 !! html/parsoid
5008 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5009 !! end
5010
5011 !! test
5012 External links: [raw equals]
5013 !! wikitext
5014 [http://example.com/?foo=bar]
5015 !! html/php
5016 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5017 </p>
5018 !! html/parsoid
5019 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5020 !! end
5021
5022 # note that parsoid html is identical to [raw equals] case; so html2wt
5023 # mode will return the [raw equals] wikitext
5024 !! test
5025 External links: [encoded equals] (bug 6102)
5026 !! options
5027 parsoid=wt2html,wt2wt,html2html
5028 !! wikitext
5029 [http://example.com/?foo&#61;bar]
5030 !! html/php
5031 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5032 </p>
5033 !! html/parsoid
5034 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5035 !! end
5036
5037 # xxx parsoid strips the IDN character, so the round-trip tests will
5038 # obviously fail and are disabled. --cscott
5039 !! test
5040 External links: [IDN ignored character reference in hostname; strip it right off]
5041 !! options
5042 parsoid=wt2html,wt2wt,html2html
5043 !! wikitext
5044 [http://e&zwnj;xample.com/]
5045 !! html/php
5046 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5047 </p>
5048 !! html/parsoid
5049 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5050 !! end
5051
5052 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5053 # Where an external link could easily circumvent the sanitization of the text of
5054 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5055 # test demands a higher standard. That's a bit strange.
5056 #
5057 # Example:
5058 #
5059 # http://e‌xample.com -> [http://example.com|http://example.com]
5060 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5061 #
5062 # The first example is sanitized, but the second is not. Any security benefits
5063 # from this production are trivial to circumvent. Either remove this test and
5064 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5065 # the test accordingly.
5066 #
5067 # All our love,
5068 # The Parsoid team.
5069 # xxx parsoid strips the IDN character, so the round-trip tests will
5070 # obviously fail and are disabled. --cscott
5071 !! test
5072 External links: IDN ignored character reference in hostname; strip it right off
5073 !! options
5074 parsoid=wt2html,html2html
5075 !! wikitext
5076 http://e&zwnj;xample.com/
5077 !! html/php
5078 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5079 </p>
5080 !! html/parsoid
5081 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5082 !! end
5083
5084 !! test
5085 External links: www.jpeg.org (bug 554)
5086 !! wikitext
5087 http://www.jpeg.org
5088 !! html
5089 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5090 </p>
5091 !! end
5092
5093 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5094 !! test
5095 External links: URL within URL (original bug 2)
5096 !! wikitext
5097 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5098 !! html/php
5099 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5100 </p>
5101 !! html/parsoid
5102 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5103 !! end
5104
5105 !! test
5106 BUG 361: URL inside bracketed URL
5107 !! wikitext
5108 [http://www.example.com/foo http://www.example.com/bar]
5109 !! html
5110 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5111 </p>
5112 !! end
5113
5114 !! test
5115 BUG 361: URL within URL, not bracketed
5116 !! wikitext
5117 http://www.example.com/foo?=http://www.example.com/bar
5118 !! html
5119 <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>
5120 </p>
5121 !! end
5122
5123 !! test
5124 BUG 289: ">"-token in URL-tail
5125 !! wikitext
5126 http://www.example.com/<hello>
5127 !! html
5128 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5129 </p>
5130 !!end
5131
5132 !! test
5133 BUG 289: literal ">"-token in URL-tail
5134 !! wikitext
5135 http://www.example.com/<b>html</b>
5136 !! html/php
5137 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5138 </p>
5139 !! html/parsoid
5140 <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>
5141 !! end
5142
5143 !! test
5144 BUG 289: ">"-token in bracketed URL
5145 !! wikitext
5146 [http://www.example.com/<hello> stuff]
5147 !! html
5148 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5149 </p>
5150 !!end
5151
5152 !! test
5153 BUG 289: literal ">"-token in bracketed URL
5154 !! wikitext
5155 [http://www.example.com/<b>html</b> stuff]
5156 !! html
5157 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5158 </p>
5159 !!end
5160
5161 !! test
5162 BUG 289: literal double quote at end of URL
5163 !! wikitext
5164 http://www.example.com/"hello"
5165 !! html
5166 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5167 </p>
5168 !!end
5169
5170 !! test
5171 BUG 289: literal double quote in bracketed URL
5172 !! wikitext
5173 [http://www.example.com/"hello" stuff]
5174 !! html
5175 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5176 </p>
5177 !!end
5178
5179 !! test
5180 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5181 !! wikitext
5182 [http://www.example.com test]
5183 !! html
5184 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5185 </p>
5186 !! end
5187
5188 !! test
5189 External links: link text with spaces
5190 !! wikitext
5191 [http://www.example.com a b c]
5192 [http://www.example.com ''a'' ''b'']
5193 !! html
5194 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5195 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5196 </p>
5197 !! end
5198
5199 !! test
5200 External links: wiki links within external link (Bug 3695)
5201 !! options
5202 parsoid=wt2html,html2html
5203 !! wikitext
5204 [http://example.com [[wikilink]] embedded in ext link]
5205 !! html/php
5206 <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>
5207 </p>
5208 !! html/parsoid
5209 <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>
5210 !! end
5211
5212 !! test
5213 BUG 787: Links with one slash after the url protocol are invalid
5214 !! wikitext
5215 http:/example.com
5216
5217 [http:/example.com title]
5218 !! html
5219 <p>http:/example.com
5220 </p><p>[http:/example.com title]
5221 </p>
5222 !! end
5223
5224 !! test
5225 Bracketed external links with template-generated invalid target
5226 !! wikitext
5227 [{{echo|http:/example.com}} title]
5228 !! html
5229 <p>[http:/example.com title]
5230 </p>
5231 !! end
5232
5233 !! test
5234 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5235 !! wikitext
5236 ''[http://example.com text'']
5237 [http://example.com '''text]'''
5238 ''Something [http://example.com in italic'']
5239 ''Something [http://example.com mixed''''', even bold]'''
5240 '''''Now [http://example.com both''''']
5241 !! html
5242 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5243 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5244 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5245 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5246 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5247 </p>
5248 !! end
5249
5250
5251 !! test
5252 Bug 4781: %26 in URL
5253 !! wikitext
5254 http://www.example.com/?title=AT%26T
5255 !! html/php
5256 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5257 </p>
5258 !! html/parsoid
5259 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5260 !! end
5261
5262 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5263 # % is actually legal in HTML5. Any change in output would need testing though.
5264 !! test
5265 Bug 4781, 5267: %25 in URL
5266 !! wikitext
5267 http://www.example.com/?title=100%25_Bran
5268 !! html/php
5269 <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>
5270 </p>
5271 !! html/parsoid
5272 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5273 !! end
5274
5275 !! test
5276 Bug 4781, 5267: %28, %29 in URL
5277 !! wikitext
5278 http://www.example.com/?title=Ben-Hur_%281959_film%29
5279 !! html/php
5280 <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>
5281 </p>
5282 !! html/parsoid
5283 <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>
5284 !! end
5285
5286
5287 !! test
5288 Bug 4781: %26 in autonumber URL
5289 !! wikitext
5290 [http://www.example.com/?title=AT%26T]
5291 !! html/php
5292 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5293 </p>
5294 !! html/parsoid
5295 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5296 !! end
5297
5298 !! test
5299 Bug 4781, 5267: %26 in autonumber URL
5300 !! wikitext
5301 [http://www.example.com/?title=100%25_Bran]
5302 !! html/php
5303 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5304 </p>
5305 !! html/parsoid
5306 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5307 !! end
5308
5309 !! test
5310 Bug 4781, 5267: %28, %29 in autonumber URL
5311 !! wikitext
5312 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5313 !! html/php
5314 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5315 </p>
5316 !! html/parsoid
5317 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5318 !! end
5319
5320
5321 !! test
5322 Bug 4781: %26 in bracketed URL
5323 !! wikitext
5324 [http://www.example.com/?title=AT%26T link]
5325 !! html/php
5326 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5327 </p>
5328 !! html/parsoid
5329 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5330 !! end
5331
5332 !! test
5333 Bug 4781, 5267: %25 in bracketed URL
5334 !! wikitext
5335 [http://www.example.com/?title=100%25_Bran link]
5336 !! html
5337 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5338 </p>
5339 !! end
5340
5341 !! test
5342 Bug 4781, 5267: %28, %29 in bracketed URL
5343 !! wikitext
5344 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5345 !! html/php
5346 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5347 </p>
5348 !! html/parsoid
5349 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5350 !! end
5351
5352 !! test
5353 External link containing a period in the anchor. (bug 63947)
5354 !! wikitext
5355 [//foo.org/bar#baz. bang]
5356
5357 [//foo.org/bar. bang]
5358 !! html/php
5359 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5360 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5361 </p>
5362 !! html/parsoid
5363 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5364 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5365 !! end
5366
5367 !! test
5368 External link containing a single quote. (bug 63947)
5369 !! wikitext
5370 [//foo.org/bar'baz]
5371
5372 [//foo.org/bar'baz bang]
5373 !! html/php
5374 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5375 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5376 </p>
5377 !! html/parsoid
5378 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5379 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5380 !! end
5381
5382 !! test
5383 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5384 !! wikitext
5385 Some [http://example.com/ pretty ''italics'' and stuff]!
5386 !! html
5387 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5388 </p>
5389 !! end
5390
5391 !! test
5392 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5393 !! wikitext
5394 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5395 !! html
5396 <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>
5397 </p>
5398 !! end
5399
5400 !! test
5401 External link containing double-single-quotes with no space separating the url from text in italics
5402 !! wikitext
5403 [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]].]
5404 !! html/php
5405 <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>
5406 </p>
5407 !! html/php+tidy
5408 <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>
5409 !! html/parsoid
5410 <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>
5411 !! end
5412
5413 !! test
5414 External link with comments in link text
5415 !! wikitext
5416 [http://www.google.com Google <!-- comment -->]
5417 !! html/php
5418 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5419 </p>
5420 !! html/parsoid
5421 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5422 !! end
5423
5424 !! test
5425 External link to bare IPv4 address
5426 !! wikitext
5427 [http://192.168.0.1 Link]
5428 !! html/php
5429 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5430 </p>
5431 !! html/parsoid
5432 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5433 !! end
5434
5435 !! test
5436 URL-encoding in URL functions (single parameter)
5437 !! wikitext
5438 {{localurl:Some page|amp=&}}
5439 !! html
5440 <p>/index.php?title=Some_page&amp;amp=&amp;
5441 </p>
5442 !! end
5443
5444 !! test
5445 URL-encoding in URL functions (multiple parameters)
5446 !! wikitext
5447 {{localurl:Some page|q=?&amp=&}}
5448 !! html
5449 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5450 </p>
5451 !! end
5452
5453 !! test
5454 Brackets in urls
5455 !! wikitext
5456 http://example.com/index.php?foozoid%5B%5D=bar
5457
5458 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5459 !! html/php
5460 <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>
5461 </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>
5462 </p>
5463 !! html/parsoid
5464 <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>
5465
5466 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar" data-parsoid='{"stx":"url","a":{"href":"http://example.com/index.php?foozoid%5B%5D=bar"},"sa":{"href":"http://example.com/index.php?foozoid&amp;#x5B;&amp;#x5D;=bar"}}'>http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5467 !! end
5468
5469 !! test
5470 IPv6 urls, autolink format (T23261)
5471 !! wikitext
5472 http://[2404:130:0:1000::187:2]/index.php
5473
5474 Examples from RFC 2373, section 2.2:
5475 * http://[1080::8:800:200C:417A]/unicast
5476 * http://[FF01::101]/multicast
5477 * http://[::1]/loopback
5478 * http://[::]/unspecified
5479 * http://[::13.1.68.3]/ipv4compat
5480 * http://[::FFFF:129.144.52.38]/ipv4compat
5481
5482 Examples from RFC 2732, section 2:
5483 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5484 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5485 * http://[3ffe:2a00:100:7031::1]
5486 * http://[1080::8:800:200C:417A]/foo
5487 * http://[::192.9.5.5]/ipng
5488 * http://[::FFFF:129.144.52.38]:80/index.html
5489 * http://[2010:836B:4179::836B:4179]
5490
5491 !! html/php
5492 <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>
5493 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5494 </p>
5495 <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>
5496 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5497 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5498 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5499 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5500 <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>
5501 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5502 </p>
5503 <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>
5504 <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>
5505 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5506 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5507 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5508 <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>
5509 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5510
5511 !! html/parsoid
5512 <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>
5513
5514 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5515 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5516 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5517 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5518 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5519 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5520 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5521
5522 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5523 <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>
5524 <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>
5525 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5526 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5527 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5528 <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>
5529 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5530 !! end
5531
5532 !! test
5533 IPv6 urls, bracketed format (T23261)
5534 !! wikitext
5535 [http://[2404:130:0:1000::187:2]/index.php test]
5536
5537 Examples from RFC 2373, section 2.2:
5538 * [http://[1080::8:800:200C:417A] unicast]
5539 * [http://[FF01::101] multicast]
5540 * [http://[::1]/ loopback]
5541 * [http://[::] unspecified]
5542 * [http://[::13.1.68.3] ipv4compat]
5543 * [http://[::FFFF:129.144.52.38] ipv4compat]
5544
5545 Examples from RFC 2732, section 2:
5546 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5547 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5548 * [http://[3ffe:2a00:100:7031::1] 3]
5549 * [http://[1080::8:800:200C:417A]/foo 4]
5550 * [http://[::192.9.5.5]/ipng 5]
5551 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5552 * [http://[2010:836B:4179::836B:4179] 7]
5553
5554 !! html/php
5555 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5556 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5557 </p>
5558 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5559 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5560 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5561 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5562 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5563 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5564 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5565 </p>
5566 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5567 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5568 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5569 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5570 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5571 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5572 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5573
5574 !! html/parsoid
5575 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5576
5577 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5578 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5579 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5580 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5581 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5582 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5583 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5584
5585 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5586 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5587 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5588 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5589 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5590 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5591 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5592 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5593 !! end
5594
5595 !! test
5596 Non-extlinks in brackets
5597 !! wikitext
5598 [foo]
5599 [foo bar]
5600 [foo ''bar'']
5601 [fool's] errand
5602 [fool's errand]
5603 [{{echo|foo}}]
5604 [{{echo|foo}} bar]
5605 [{{echo|foo}} ''bar'']
5606 [{{echo|foo}}l's] errand
5607 [{{echo|foo}}l's errand]
5608 [url={{echo|foo}}]
5609 [url=http://example.com]
5610 [http:// bare protocols don't count]
5611 !! html/php
5612 <p>[foo]
5613 [foo bar]
5614 [foo <i>bar</i>]
5615 [fool's] errand
5616 [fool's errand]
5617 [foo]
5618 [foo bar]
5619 [foo <i>bar</i>]
5620 [fool's] errand
5621 [fool's errand]
5622 [url=foo]
5623 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5624 [http:// bare protocols don't count]
5625 </p>
5626 !! html/parsoid
5627 <p>[foo]
5628 [foo bar]
5629 [foo <i>bar</i>]
5630 [fool's] errand
5631 [fool's errand]
5632 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5633 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5634 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5635 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5636 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5637 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5638 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5639 [http:// bare protocols don't count]</p>
5640 !! end
5641
5642 !! test
5643 Percent encoding in external links
5644 !! wikitext
5645 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5646 !! html/php
5647 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5648 </p>
5649 !! html/parsoid
5650 <p><a rel="mw:ExtLink"
5651 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5652 !! end
5653
5654 !! test
5655 Use url link syntax for links where the content is equal the link target
5656 !! wikitext
5657 http://example.com
5658 !! html/php
5659 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5660 </p>
5661 !! html/parsoid
5662 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5663 !! end
5664
5665 !! test
5666 Parenthesis in external links, especially URL links
5667 !! wikitext
5668 http://example.com)
5669
5670 http://example.com/test)
5671
5672 http://example.com/(test)
5673
5674 http://example.com/((test)
5675
5676 (http://example.com/(test))
5677
5678 (http://example.com/(test)))))
5679
5680 http://example.com/a)b
5681
5682 [http://example.com) foo]
5683 !! html/php
5684 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5685 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5686 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5687 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5688 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5689 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5690 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5691 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5692 </p>
5693 !! html/parsoid
5694 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5695 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5696 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5697 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5698 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5699 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5700 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5701 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5702 !! end
5703
5704 !! test
5705 Parenthesis in external links, w/ transclusion or comment
5706 !! wikitext
5707 (http://example.com/{{echo|hi}})
5708
5709 (http://example.com<!-- hi -->)
5710 !! html/php
5711 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5712 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5713 </p>
5714 !! html/parsoid
5715 <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>
5716
5717 <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>
5718 !! end
5719
5720 !! test
5721 Serialize <a> tags with invalid link targets as plain text
5722 !! options
5723 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5724 !! html/parsoid
5725 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5726 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5727 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5728 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5729 !! wikitext
5730 text
5731 <nowiki>*</nowiki>text
5732 <nowiki>[[foo]]</nowiki>
5733 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5734 !! end
5735
5736 !! test
5737 mw:ExtLink -vs- mw:WikiLink (T94723)
5738 !! options
5739 parsoid=html2wt
5740 !! html/parsoid
5741 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5742 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5743 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5744 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5745 <p>
5746 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5747 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5748 </p>
5749 !! wikitext
5750 [[Foo|Bar]]
5751 [[Foo|Bar]]
5752 [[wikipedia:Foo|Bar]]
5753 [[wikipedia:Foo|Bar]]
5754
5755 [[wikipedia:European_Robin|European Robin]]
5756 [[wikipedia:European_Robin|European Robin]]
5757 !! end
5758
5759 !! test
5760 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5761 !! options
5762 parsoid=wt2wt
5763 !! wikitext
5764 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5765 !! html/parsoid
5766 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5767 !! end
5768
5769
5770 ###
5771 ### Quotes
5772 ###
5773
5774 !! test
5775 Quotes
5776 !! wikitext
5777 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5778
5779 Normal text. '''''Bold italic text.''''' Normal text.
5780 !! html
5781 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5782 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5783 </p>
5784 !! end
5785
5786
5787 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5788 # parser strips. The wikitext contains just the first half of the bold
5789 # quote pair.
5790 !! test
5791 Unclosed and unmatched quotes
5792 !! wikitext
5793 '''''Bold italic text '''with bold deactivated''' in between.'''''
5794
5795 '''''Bold italic text ''with italic deactivated'' in between.'''''
5796
5797 '''Bold text..
5798
5799 ..spanning two paragraphs (should not work).'''
5800
5801 '''Bold tag left open
5802
5803 ''Italic tag left open
5804
5805 Normal text.
5806
5807 <!-- Unmatching number of opening, closing tags: -->
5808 '''This year''''s election ''should'' beat '''last year''''s.
5809
5810 ''Tom'''s car is bigger than ''Susan'''s.
5811
5812 Plain ''italic'''s plain
5813 !! html/php
5814 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5815 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5816 </p><p><b>Bold text..</b>
5817 </p><p>..spanning two paragraphs (should not work).
5818 </p><p><b>Bold tag left open</b>
5819 </p><p><i>Italic tag left open</i>
5820 </p><p>Normal text.
5821 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5822 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5823 </p><p>Plain <i>italic'</i>s plain
5824 </p>
5825 !! html/parsoid
5826 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5827 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5828 </p><p><b>Bold text..</b>
5829 </p><p>..spanning two paragraphs (should not work).<b></b>
5830 </p><p><b>Bold tag left open</b>
5831 </p><p><i>Italic tag left open</i>
5832 </p><p>Normal text.
5833 </p>
5834 <!-- Unmatching number of opening, closing tags: -->
5835 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5836 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5837 </p><p>Plain <i>italic'</i>s plain
5838 </p>
5839 !! end
5840
5841 ###
5842 ### Tables
5843 ###
5844 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5845 ###
5846
5847 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5848 # is the bare minimum required by the spec, see:
5849 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5850 # Parsoid team replies: empty table tags are legal in HTML5
5851 !! test
5852 A table with no data.
5853 !! options
5854 parsoid=wt2html
5855 !! wikitext
5856 {||}
5857 !! html/php
5858
5859 !! html/parsoid
5860 <table></table>
5861
5862 !! end
5863
5864 !! test
5865 A table with stray table end tags on start tag line (wt2html)
5866 !! options
5867 parsoid=wt2html
5868 !! wikitext
5869 {|style="color: red;"|}
5870
5871 {|style="color: red;" |}
5872 |foo
5873 |}
5874
5875 {|style="color: red;"|} id="foo"
5876 |foo
5877 |}
5878
5879 {|style="color: red;" |} id="foo"
5880 |foo
5881 |}
5882 !! html
5883 <table style="color: red;"></table>
5884
5885 <table style="color: red;">
5886 <tbody><tr>
5887 <td>foo</td>
5888 </tr></tbody>
5889 </table>
5890
5891 <table style="color: red;" id="foo">
5892 <tbody><tr>
5893 <td>foo</td>
5894 </tr></tbody>
5895 </table>
5896
5897 <table style="color: red;" id="foo">
5898 <tbody><tr>
5899 <td>foo</td>
5900 </tr></tbody>
5901 </table>
5902
5903 !! end
5904
5905 !! test
5906 A table with no data (take 2)
5907 !! wikitext
5908 {|
5909 |}
5910 !! html/parsoid
5911 <table></table>
5912 !! end
5913
5914 # A table with nothing but a caption is invalid XHTML, we might want to render
5915 # this as <p>caption</p>
5916 # Parsoid team replies: table with only a caption is legal in HTML5
5917 !! test
5918 A table with nothing but a caption
5919 !! wikitext
5920 {|
5921 |+ caption
5922 |}
5923 !! html/php
5924 <table>
5925 <caption> caption
5926 </caption><tr><td></td></tr></table>
5927
5928 !! html/parsoid
5929 <table><caption> caption</caption></table>
5930 !! end
5931
5932 !! test
5933 A table with caption with default-spaced attributes and a table row
5934 !! wikitext
5935 {|
5936 |+ style="color: red;" | caption1
5937 |-
5938 | foo
5939 |}
5940 !! html
5941 <table>
5942 <caption style="color: red;"> caption1
5943 </caption>
5944 <tr>
5945 <td> foo
5946 </td></tr></table>
5947
5948 !! end
5949
5950 !! test
5951 A table with captions with non-default spaced attributes and a table row
5952 !! wikitext
5953 {|
5954 |+style="color: red;"|caption2
5955 |+ style="color: red;"| caption3
5956 |-
5957 | foo
5958 |}
5959 !! html
5960 <table>
5961 <caption style="color: red;">caption2
5962 </caption>
5963 <caption style="color: red;"> caption3
5964 </caption>
5965 <tr>
5966 <td> foo
5967 </td></tr></table>
5968
5969 !! end
5970
5971 !! test
5972 Table td-cell syntax variations
5973 !! wikitext
5974 {|
5975 | foo bar foo | baz
5976 | foo bar foo || baz
5977 | style='color:red;' | baz
5978 | style='color:red;' || baz
5979 |}
5980 !! html
5981 <table>
5982 <tr>
5983 <td> baz
5984 </td>
5985 <td> foo bar foo </td>
5986 <td> baz
5987 </td>
5988 <td style="color:red;"> baz
5989 </td>
5990 <td> style='color:red;' </td>
5991 <td> baz
5992 </td></tr></table>
5993
5994 !! end
5995
5996 !! test
5997 Simple table
5998 !! wikitext
5999 {|
6000 | 1 || 2
6001 |-
6002 | 3 || 4
6003 |}
6004 !! html
6005 <table>
6006 <tr>
6007 <td> 1 </td>
6008 <td> 2
6009 </td></tr>
6010 <tr>
6011 <td> 3 </td>
6012 <td> 4
6013 </td></tr></table>
6014
6015 !! end
6016
6017 !! test
6018 Simple table but with multiple dashes for row wikitext
6019 !! wikitext
6020 {|
6021 | foo
6022 |-----
6023 | bar
6024 |}
6025 !! html
6026 <table>
6027 <tr>
6028 <td> foo
6029 </td></tr>
6030 <tr>
6031 <td> bar
6032 </td></tr></table>
6033
6034 !! end
6035
6036 !! test
6037 Multiplication table
6038 !! wikitext
6039 {| border="1" cellpadding="2"
6040 |+Multiplication table
6041 |-
6042 ! &times; !! 1 !! 2 !! 3
6043 |-
6044 ! 1
6045 | 1 || 2 || 3
6046 |-
6047 ! 2
6048 | 2 || 4 || 6
6049 |-
6050 ! 3
6051 | 3 || 6 || 9
6052 |-
6053 ! 4
6054 | 4 || 8 || 12
6055 |-
6056 ! 5
6057 | 5 || 10 || 15
6058 |}
6059 !! html
6060 <table border="1" cellpadding="2">
6061 <caption>Multiplication table
6062 </caption>
6063 <tr>
6064 <th> &#215; </th>
6065 <th> 1 </th>
6066 <th> 2 </th>
6067 <th> 3
6068 </th></tr>
6069 <tr>
6070 <th> 1
6071 </th>
6072 <td> 1 </td>
6073 <td> 2 </td>
6074 <td> 3
6075 </td></tr>
6076 <tr>
6077 <th> 2
6078 </th>
6079 <td> 2 </td>
6080 <td> 4 </td>
6081 <td> 6
6082 </td></tr>
6083 <tr>
6084 <th> 3
6085 </th>
6086 <td> 3 </td>
6087 <td> 6 </td>
6088 <td> 9
6089 </td></tr>
6090 <tr>
6091 <th> 4
6092 </th>
6093 <td> 4 </td>
6094 <td> 8 </td>
6095 <td> 12
6096 </td></tr>
6097 <tr>
6098 <th> 5
6099 </th>
6100 <td> 5 </td>
6101 <td> 10 </td>
6102 <td> 15
6103 </td></tr></table>
6104
6105 !! end
6106
6107 !! test
6108 Accept "||" in table headings
6109 !! wikitext
6110 {|
6111 !h1 || h2
6112 |}
6113 !! html
6114 <table>
6115 <tr>
6116 <th>h1 </th>
6117 <th> h2
6118 </th></tr></table>
6119
6120 !! end
6121
6122 !! test
6123 Accept "!!" in table data
6124 !! wikitext
6125 {|
6126 | Foo!! ||
6127 |}
6128 !! html
6129 <table>
6130 <tr>
6131 <td> Foo!! </td>
6132 <td>
6133 </td></tr></table>
6134
6135 !! html/parsoid
6136 <table>
6137 <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>
6138 </tbody></table>
6139 !! end
6140
6141 !! test
6142 Accept "||" in indented table headings
6143 !! wikitext
6144 :{|
6145 !h1 || h2
6146 |}
6147 !! html
6148 <dl><dd><table>
6149 <tr>
6150 <th>h1 </th>
6151 <th> h2
6152 </th></tr></table></dd></dl>
6153
6154 !! end
6155
6156 !! test
6157 Accept "!!" in templates
6158 !! wikitext
6159 {|
6160 !a {{echo|b!!c}}
6161 |}
6162 !! html/php
6163 <table>
6164 <tr>
6165 <th>a b</th>
6166 <th>c
6167 </th></tr></table>
6168
6169 !! html/parsoid
6170 <table>
6171 <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>
6172 !! end
6173
6174 !! test
6175 Accept "!!" in table headings after newline
6176 !! wikitext
6177 {|
6178 !a
6179 b!!c
6180 |}
6181 !! html/php
6182 <table>
6183 <tr>
6184 <th>a
6185 <p>b!!c
6186 </p>
6187 </th></tr></table>
6188
6189 !! html/parsoid
6190 <table>
6191 <tbody><tr><th>a
6192 <p>b!!c</p></th></tr>
6193 </tbody></table>
6194 !! end
6195
6196 !! test
6197 Accept "!!" in table data of mixed wikitext / html syntax
6198 !! wikitext
6199 {|
6200 !a
6201 <tr><td>b!!c</td></tr>
6202 |}
6203 !! html+tidy
6204 <table>
6205 <tr>
6206 <th>a</th>
6207 </tr>
6208 <tr>
6209 <td>b!!c</td>
6210 </tr>
6211 </table>
6212 !! html/parsoid
6213 <table>
6214 <tbody><tr><th>a</th></tr>
6215 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6216 </tbody></table>
6217 !! end
6218
6219 !! test
6220 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6221 !! wikitext
6222 {|
6223 !| h1
6224 || a
6225 |}
6226 !! html
6227 <table>
6228 <tr>
6229 <th> h1
6230 </th>
6231 <td> a
6232 </td></tr></table>
6233
6234 !! end
6235
6236 !!test
6237 Accept "| !" at start of line in tables (ignore !-attribute)
6238 !! wikitext
6239 {|
6240 |-
6241 | !style="color:red" | bar
6242 |}
6243 !! html
6244 <table>
6245
6246 <tr>
6247 <td> bar
6248 </td></tr></table>
6249
6250 !!end
6251
6252 !!test
6253 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 +/-
6254 !! wikitext
6255 {|
6256 |-
6257 |style='color:red;'|+1
6258 |style='color:blue;'|-1
6259 |-
6260 | 1 || 2 || 3
6261 | 1 ||+2 ||-3
6262 |-
6263 | +1
6264 | -1
6265 |}
6266 !! html
6267 <table>
6268
6269 <tr>
6270 <td style="color:red;">+1
6271 </td>
6272 <td style="color:blue;">-1
6273 </td></tr>
6274 <tr>
6275 <td> 1 </td>
6276 <td> 2 </td>
6277 <td> 3
6278 </td>
6279 <td> 1 </td>
6280 <td>+2 </td>
6281 <td>-3
6282 </td></tr>
6283 <tr>
6284 <td> +1
6285 </td>
6286 <td> -1
6287 </td></tr></table>
6288
6289 !!end
6290
6291 !! test
6292 Table rowspan
6293 !! wikitext
6294 {| border=1
6295 | Cell 1, row 1
6296 |rowspan=2| Cell 2, row 1 (and 2)
6297 | Cell 3, row 1
6298 |-
6299 | Cell 1, row 2
6300 | Cell 3, row 2
6301 |}
6302 !! html
6303 <table border="1">
6304 <tr>
6305 <td> Cell 1, row 1
6306 </td>
6307 <td rowspan="2"> Cell 2, row 1 (and 2)
6308 </td>
6309 <td> Cell 3, row 1
6310 </td></tr>
6311 <tr>
6312 <td> Cell 1, row 2
6313 </td>
6314 <td> Cell 3, row 2
6315 </td></tr></table>
6316
6317 !! end
6318
6319 !! test
6320 Nested table
6321 !! wikitext
6322 {| border=1
6323 | &alpha;
6324 |
6325 {| bgcolor=#ABCDEF border=2
6326 |nested
6327 |-
6328 |table
6329 |}
6330 |the original table again
6331 |}
6332 !! html
6333 <table border="1">
6334 <tr>
6335 <td> &#945;
6336 </td>
6337 <td>
6338 <table bgcolor="#ABCDEF" border="2">
6339 <tr>
6340 <td>nested
6341 </td></tr>
6342 <tr>
6343 <td>table
6344 </td></tr></table>
6345 </td>
6346 <td>the original table again
6347 </td></tr></table>
6348
6349 !! end
6350
6351 !! test
6352 Invalid attributes in table cell (bug 1830)
6353 !! wikitext
6354 {|
6355 |Cell:|broken
6356 |}
6357 !! html
6358 <table>
6359 <tr>
6360 <td>broken
6361 </td></tr></table>
6362
6363 !! end
6364
6365 !! test
6366 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6367 !! wikitext
6368 {|
6369 | title="foo" |bar
6370 | title="foo<nowiki>|</nowiki>" |bar
6371 | title="foo<nowiki>|</nowiki>" bar
6372 |}
6373 !! html/php
6374 <table>
6375 <tr>
6376 <td title="foo">bar
6377 </td>
6378 <td title="foo&#124;">bar
6379 </td>
6380 <td> title="foo|" bar
6381 </td></tr></table>
6382
6383 !! html/parsoid
6384 <table>
6385 <tbody><tr><td title="foo">bar</td>
6386 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6387 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6388 </tbody></table>
6389 !! end
6390
6391 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6392 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6393 # *2wt modes will fail.
6394 !! test
6395 Table security: embedded pipes
6396 !! options
6397 parsoid=wt2html,html2html
6398 !! wikitext
6399 {|
6400 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6401 !! html/php
6402 <table>
6403 <tr>
6404 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6405 <td>]" onmouseover="alert(document.cookie)"&gt;test
6406 </td>
6407 </tr>
6408 </table>
6409
6410 !! html/parsoid
6411 <table><tbody>
6412 <tr>
6413 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'>[<a rel="mw:ExtLink" href="ftp://%7Cx" data-parsoid='{"stx":"url","a":{"href":"ftp://%7Cx"},"sa":{"href":"ftp://|x"}}'>ftp://%7Cx</a></td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'>]" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6414 !! end
6415
6416 !! test
6417 Element attributes with double ! should not be broken up by <th>
6418 !! wikitext
6419 {|
6420 ! hi <div class="!!">ha</div> ho
6421 |}
6422 !! html/php
6423 <table>
6424 <tr>
6425 <th> hi <div class="!!">ha</div> ho
6426 </th></tr></table>
6427
6428 !! html/parsoid
6429 <table>
6430 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6431 </tbody></table>
6432 !! end
6433
6434 !! test
6435 ! and || in element attributes should not be parsed as <th>/<td>
6436 !! wikitext
6437 {|
6438 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6439 |}
6440 !! html/php
6441 <table>
6442 <tr>
6443 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6444 </td></tr></table>
6445
6446 !! html/parsoid
6447 <table>
6448 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6449 </tbody></table>
6450 !! end
6451
6452 # FIXME: The output seems broken. Filed as T110268.
6453 !! test
6454 ! and || in td attributes should not be parsed as <th>/<td>
6455 !! options
6456 parsoid=wt2html
6457 !! wikitext
6458 {|
6459 | style="color: red !important;" data-contrived="put this here ||" | foo
6460 |}
6461 !! html/php
6462 <table>
6463 <tr>
6464 <td> style="color: red !important;" data-contrived="put this here </td>
6465 <td> foo
6466 </td></tr></table>
6467
6468 !! html/parsoid
6469 <table>
6470 <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>
6471 </tbody></table>
6472 !! end
6473
6474 !! test
6475 Break on | in element attribute in template
6476 !! options
6477 parsoid=wt2html,html2html
6478 !! wikitext
6479 {{echo|1=<div class="hi|ho">ha</div>}}
6480 !! html/php
6481 <p>ho"&gt;ha&lt;/div&gt;
6482 </p>
6483 !! html/parsoid
6484 <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>
6485 !! end
6486
6487 !! test
6488 Break on | in element attribute name in template
6489 !! wikitext
6490 {{echo|<div cla|ss="hiho">ha</div>}}
6491 !! html/parsoid
6492 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"ss","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div cla"},"ss":{"wt":"\"hiho\">ha&lt;/div>"}},"i":0}}]}'>&lt;div cla</p>
6493 !! end
6494
6495 !! test
6496 Don't break on | in extension attribute in template
6497 !! wikitext
6498 {{echo|<ref name="hi|ho">ha</ref>}}
6499
6500 <references />
6501 !! html/parsoid
6502 <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>
6503
6504 <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>
6505 !! end
6506
6507 ## We don't support roundtripping of these attributes in Parsoid.
6508 ## Selective serialization takes care of preventing dirty diffs.
6509 ## But, on edits, we dirty-diff the invalid attribute text.
6510 !! test
6511 Invalid text in table attributes should be discarded
6512 !! options
6513 parsoid=wt2html
6514 !! wikitext
6515 {| <span>boo</span> style='border:1px solid black'
6516 | <span>boo</span> style='color:blue' | 1
6517 |<span>boo</span> style='color:blue'| 2
6518 |}
6519 !! html/php
6520 <table style="border:1px solid black">
6521 <tr>
6522 <td style="color:blue"> 1
6523 </td>
6524 <td style="color:blue"> 2
6525 </td></tr></table>
6526
6527 !! html/parsoid
6528 <table style="border:1px solid black">
6529 <tr>
6530 <td style="color:blue"> 1</td>
6531 <td style="color:blue"> 2</td>
6532 </tr>
6533 </table>
6534 !! end
6535
6536 !! test
6537 Invalid text in table attributes should be preserved by selective serializer
6538 !! options
6539 parsoid={
6540 "modes": ["selser"],
6541 "changes": [
6542 ["td:first-child", "text", "abc"],
6543 ["td + td", "text", "xyz"]
6544 ]
6545 }
6546 !! wikitext
6547 {| <span>boo</span> style='border:1px solid black'
6548 | <span>boo</span> style='color:blue' | 1
6549 |<span>boo</span> style='color:blue'| 2
6550 |}
6551 !! wikitext/edited
6552 {| <span>boo</span> style='border:1px solid black'
6553 | <span>boo</span> style='color:blue' |abc
6554 |<span>boo</span> style='color:blue'|xyz
6555 |}
6556 !! end
6557
6558 !! test
6559 1. Template-generated table cell attributes and cell content
6560 !! wikitext
6561 {|
6562 |{{table_attribs}}
6563 | {{table_attribs}}
6564 || {{table_attribs_5}}
6565 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6566 |align=center {{table_attribs}}
6567 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6568 |}
6569 !! html
6570 <table>
6571 <tr>
6572 <td style="color:red;">Foo
6573 </td>
6574 <td style="color:red;">Foo
6575 </td>
6576 <td> style="color:red;"</td>
6577 <td>Bar
6578 </td>
6579 <td style="color:red;">Foo
6580 </td>
6581 <td align="center" style="color:red;">Foo
6582 </td>
6583 <td align="center" style="color:red;">Foo
6584 </td></tr></table>
6585
6586 !! end
6587
6588 !! test
6589 2. Template-generated table cell attributes and cell content
6590 !! wikitext
6591 {|
6592 |{{table_attribs_2}}
6593 |}
6594 !! html/php
6595 <table>
6596 <tr>
6597 <td style="color:red;">Foo
6598 </td>
6599 <td>Bar</td>
6600 <td>Baz
6601 </td></tr></table>
6602
6603 !! html/parsoid
6604 <table>
6605 <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>
6606 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6607 </tbody></table>
6608 !! end
6609
6610 !! test
6611 3. Template-generated table cell attributes and cell content
6612 !! wikitext
6613 {|
6614 !align=center {{table_header_cells}}
6615 |-
6616 |align=center {{table_cells}}
6617 |}
6618 !! html/php
6619 <table>
6620 <tr>
6621 <th align="center" style="color:red;">Foo</th>
6622 <th style="color:red;"><i>Bar</i></th>
6623 <th style="color:brown;"><i>Foo</i> and Baz
6624 </th></tr>
6625 <tr>
6626 <td align="center" style="color:red;">Foo</td>
6627 <td style="color:red;"><i>Bar</i></td>
6628 <td style="color:brown;"><i>Foo</i> and Baz
6629 </td></tr></table>
6630
6631 !! html/parsoid
6632 <table>
6633 <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>
6634 <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>
6635 </tbody></table>
6636 !! end
6637
6638 !! test
6639 4. Template-generated table cell attributes and cell content inside a templated table
6640 !! wikitext
6641 {{tbl-start}}
6642 !align=center {{table_header_cells}}
6643 |-
6644 |align=center {{table_cells}}
6645 {{tbl-end}}
6646 !! html/php
6647 <table>
6648 <tr>
6649 <th align="center" style="color:red;">Foo</th>
6650 <th style="color:red;"><i>Bar</i></th>
6651 <th style="color:brown;"><i>Foo</i> and Baz
6652 </th></tr>
6653 <tr>
6654 <td align="center" style="color:red;">Foo</td>
6655 <td style="color:red;"><i>Bar</i></td>
6656 <td style="color:brown;"><i>Foo</i> and Baz
6657 </td></tr></table>
6658
6659 !! html/parsoid
6660 <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}}]}'>
6661 <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>
6662 <tr>
6663 <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>
6664 </tbody></table>
6665 !! end
6666
6667 ## Edge case fix to prevent future regressions
6668 !! test
6669 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6670 !! wikitext
6671 {|
6672 |{{table_attribs_7}}
6673 |}
6674 <references />
6675 !! html/parsoid
6676 <table>
6677 <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>
6678 </tbody></table>
6679 <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>
6680 !! end
6681
6682 !! test
6683 Table with row followed by newlines and table heading
6684 !! options
6685 parsoid=wt2html,html2html
6686 !! wikitext
6687 {|
6688 |-
6689
6690 ! foo
6691 |}
6692 !! html/*
6693 <table>
6694
6695
6696 <tr>
6697 <th> foo
6698 </th></tr></table>
6699
6700 !! end
6701
6702 !! test
6703 Table with empty line following the start tag
6704 !! options
6705 parsoid=wt2html,html2html
6706 !! wikitext
6707 {|
6708
6709 |-
6710 | foo
6711 |}
6712 !! html/*
6713 <table>
6714
6715
6716 <tr>
6717 <td> foo
6718 </td></tr></table>
6719
6720 !! end
6721
6722 !! test
6723 Table attributes with empty value
6724 !! options
6725 parsoid=wt2html,html2html
6726 !! wikitext
6727 {|
6728 | style=| hello
6729 |}
6730 !! html/php
6731 <table>
6732 <tr>
6733 <td style=""> hello
6734 </td></tr></table>
6735
6736 !! html/parsoid
6737 <table>
6738 <tbody><tr><td style=""> hello</td></tr>
6739 </tbody></table>
6740 !! end
6741
6742 !! test
6743 Wikitext table with a lot of comments
6744 !! wikitext
6745 {|
6746 <!-- c0 -->
6747 | foo
6748 <!-- c1 -->
6749 |-<!-- c2 -->
6750 <!-- c3 -->
6751 |<!-- c4 -->
6752 <!-- c5 -->
6753 |}
6754 !! html
6755 <table>
6756 <tr>
6757 <td> foo
6758 </td></tr>
6759 <tr>
6760 <td>
6761 </td></tr></table>
6762
6763 !! end
6764
6765 !! test
6766 Wikitext table comments represented in parsoid dom
6767 !! wikitext
6768 {|<!--c1--><!--c2-->
6769 |-<!--c3-->
6770 | x
6771 |}
6772 !! html/php+tidy
6773 <table>
6774 <tr>
6775 <td>x</td>
6776 </tr>
6777 </table>
6778 !! html/parsoid
6779 <table><!--c1--><!--c2-->
6780 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6781 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6782 </tbody></table>
6783 !! end
6784
6785 !! test
6786 Wikitext table with double-line table cell
6787 !! wikitext
6788 {|
6789 |a
6790 b
6791 |}
6792 !! html
6793 <table>
6794 <tr>
6795 <td>a
6796 <p>b
6797 </p>
6798 </td></tr></table>
6799
6800 !! end
6801
6802 !! test
6803 Table cell with a single comment
6804 !! wikitext
6805 {|
6806 | <!-- c1 -->
6807 | a
6808 |}
6809 !! html
6810 <table>
6811 <tr>
6812 <td>
6813 </td>
6814 <td> a
6815 </td></tr></table>
6816
6817 !! end
6818
6819 !! test
6820 Table-cell after a comment-only-empty-line
6821 !! wikitext
6822 {|
6823 |a
6824 <!--c1-->
6825 <!--c2-->| b
6826 |}
6827 !! html
6828 <table>
6829 <tr>
6830 <td>a
6831 </td>
6832 <td> b
6833 </td></tr></table>
6834
6835 !! html/parsoid
6836 <table>
6837 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6838 <!--c1-->
6839 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6840 </tbody></table>
6841
6842 !! end
6843
6844 !! test
6845 Build table with {{!}}
6846 !! wikitext
6847 {{{!}} class="wikitable"
6848 ! header
6849 ! second header
6850 {{!}}- style="color:red;"
6851 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6852 {{!}}}
6853 !! html
6854 <table class="wikitable">
6855 <tr>
6856 <th> header
6857 </th>
6858 <th> second header
6859 </th></tr>
6860 <tr style="color:red;">
6861 <td> data </td>
6862 <td style="color:red;"> second data
6863 </td></tr></table>
6864
6865 !! end
6866
6867 !! test
6868 Build table with pipe as data
6869 !! wikitext
6870 {| class="wikitable"
6871 ! header
6872 ! second header
6873 |- style="color:red;"
6874 | data || style="color:red;" | second data
6875 |-
6876 | style="color:red;" | data with | || style="color:red;" | second data with |
6877 |-
6878 || data with | ||| second data with |
6879 |}
6880 !! html
6881 <table class="wikitable">
6882 <tr>
6883 <th> header
6884 </th>
6885 <th> second header
6886 </th></tr>
6887 <tr style="color:red;">
6888 <td> data </td>
6889 <td style="color:red;"> second data
6890 </td></tr>
6891 <tr>
6892 <td style="color:red;"> data with | </td>
6893 <td style="color:red;"> second data with |
6894 </td></tr>
6895 <tr>
6896 <td> data with | </td>
6897 <td> second data with |
6898 </td></tr></table>
6899
6900 !! end
6901
6902 !! test
6903 Build table with wikilink
6904 !! wikitext
6905 {| class="wikitable"
6906 ! header || second header
6907 |- style="color:red;"
6908 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6909 |-
6910 | data || second data [[Main Page|link|text with pipe]]
6911 |}
6912 !! html
6913 <table class="wikitable">
6914 <tr>
6915 <th> header </th>
6916 <th> second header
6917 </th></tr>
6918 <tr style="color:red;">
6919 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6920 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6921 </td></tr>
6922 <tr>
6923 <td> data </td>
6924 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6925 </td></tr></table>
6926
6927 !! end
6928
6929 # The expected HTML structure in this test is debatable. The PHP parser does
6930 # not parse this kind of table at all. The main focus for Parsoid is on
6931 # round-tripping, so this output is ok for now. TODO: revisit!
6932 !! test
6933 Wikitext table with html-syntax row
6934 !! wikitext
6935 {|
6936 |-
6937 <td>foo</td>
6938 |}
6939 !! html/parsoid
6940 <table>
6941 <tbody>
6942 <tr>
6943 <td>foo</td></tr></tbody></table>
6944 !! end
6945
6946 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6947 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6948 ## PHP parser, which tidy then compounds by fostering the content
6949 ## entirely out of the table. Parsoid recognizes the table context
6950 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6951 ## depends on PHP's treatment of broken table markup!
6952 !! test
6953 Implicit <td> after a |-
6954 !! options
6955 parsoid=wt2html,html2html
6956 !! wikitext
6957 {|
6958 |-
6959 a
6960 |}
6961 !! html/php
6962 <table>
6963
6964 a
6965 </table>
6966
6967 !! html/php+tidy
6968 <p>a</p>
6969 !! html/parsoid
6970 <table>
6971 <tr><td>a</td></tr>
6972 </table>
6973 !! end
6974
6975 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6976 !! test
6977 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6978 !! options
6979 parsoid=wt2html,html2html
6980 !! wikitext
6981 {|
6982 |-
6983 |
6984 a
6985 |-
6986 b
6987 |}
6988 !! html/php
6989 <table>
6990
6991 <tr>
6992 <td>
6993 <pre>a
6994 </pre>
6995 </td></tr>
6996 b
6997 </table>
6998
6999 !! html/php+tidy
7000 <p>b</p>
7001 <table>
7002 <tr>
7003 <td>
7004 <pre>
7005 a
7006 </pre></td>
7007 </tr>
7008 </table>
7009 !! html/parsoid
7010 <table>
7011 <tbody>
7012 <tr><td><pre>a</pre></td></tr>
7013 <tr><td> b</td></tr>
7014 </tbody>
7015 </table>
7016 !! end
7017
7018 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
7019 # Parsoid generates the missing <td>, so wt2wt won't succeed.
7020 !! test
7021 Lists should be recognized in an implicit <td> context
7022 !! options
7023 parsoid=wt2html,html2html
7024 !! wikitext
7025 {|
7026 |-
7027 *a
7028 |}
7029 !! html/php
7030 <table>
7031
7032 <ul><li>a</li></ul>
7033 </table>
7034
7035 !! html/php+tidy
7036 <ul>
7037 <li>a</li>
7038 </ul>
7039 !! html/parsoid
7040 <table>
7041 <tr>
7042 <td><ul>
7043 <li>a</li>
7044 </ul></td>
7045 </tr>
7046 </table>
7047 !! end
7048
7049 !! test
7050 Table cells not properly parsed in an implicit-td context
7051 !! wikitext
7052 {|
7053 |-
7054 {{table_attribs_4}} || a || b
7055 |}
7056 !! html/php+tidy
7057 <table>
7058 <tr>
7059 <td style="background-color:#DC241f;" width="10px"></td>
7060 <td>a</td>
7061 <td>b</td>
7062 </tr>
7063 </table>
7064 !! html/parsoid
7065 <table>
7066 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7067 <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>
7068 </tbody></table>
7069 !! end
7070
7071 !! test
7072 Parsoid: Round-trip tables directly followed by content (bug 51219)
7073 !! options
7074 parsoid=wt2html,wt2wt
7075 !! wikitext
7076 {|
7077 |foo
7078 |} bar
7079
7080 {|
7081 |baz
7082 |}<b>quux</b>
7083 !! html+tidy
7084 <table>
7085 <tr>
7086 <td>foo</td>
7087 </tr>
7088 </table>
7089 <p>bar</p>
7090 <table>
7091 <tr>
7092 <td>baz</td>
7093 </tr>
7094 </table>
7095 <p><b>quux</b></p>
7096 !! end
7097
7098 !! test
7099 Parsoid: Default to a newline after tables in new content (bug 51219)
7100 !! options
7101 parsoid=html2wt
7102 !! html/parsoid
7103 <table><tbody>
7104 <tr><td>foo</td></tr></tbody></table> bar
7105 <table><tbody>
7106 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7107 !! wikitext
7108 {|
7109 |foo
7110 |}
7111 <nowiki> </nowiki>bar
7112 {|
7113 |baz
7114 |}
7115 '''quux'''
7116 !! end
7117
7118 !! test
7119 Parsoid: newline inducing block nodes don't suppress <nowiki>
7120 !! options
7121 parsoid=html2wt
7122 !! html/parsoid
7123 a<h1>foo</h1>
7124 !! wikitext
7125 <nowiki> </nowiki>a
7126
7127 = foo =
7128 !! end
7129
7130 !! test
7131 Parsoid: Row-syntax table headings followed by comment & table cells
7132 !! options
7133 parsoid=wt2html,wt2wt
7134 !! wikitext
7135 {|
7136 ! foo || bar
7137 <!-- foo --> || baz || quux
7138 |}
7139 !! html/php
7140 <table>
7141 <tr>
7142 <th> foo </th>
7143 <th> bar
7144 </th>
7145 <td> baz </td>
7146 <td> quux
7147 </td></tr></table>
7148
7149 !! html/parsoid
7150 <table>
7151 <tbody><tr><th> foo </th><th> bar
7152 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7153 </tbody></table>
7154 !! end
7155
7156 !!test
7157 Parsoid: Recover better from broken table attributes
7158 !!options
7159 parsoid=wt2html
7160 !!wikitext
7161 {| class="foo
7162 | class="bar" |
7163 foo
7164 |}
7165 !!html/php+tidy
7166 <table class="foo">
7167 <tr>
7168 <td class="bar">
7169 <p>foo</p>
7170 </td>
7171 </tr>
7172 </table>
7173 !!html/parsoid
7174 <table class="foo">
7175 <tr>
7176 <td class="bar">
7177 <p>foo</p></td></tr>
7178 </tbody></table>
7179 !!end
7180
7181 !! test
7182 Tables: Digest broken attributes on table and tr tag
7183 !! options
7184 parsoid=wt2html
7185 !! wikitext
7186 {| || |} ++
7187 |- || || ++ --
7188 |- > [
7189 |}
7190 !! html
7191 <table>
7192 <tbody>
7193 <tr></tr>
7194 <tr></tr>
7195 </tbody></table>
7196 !! end
7197
7198 # T137406: Whitespace in the HTML
7199 !! test
7200 1. Generate correct wikitext for tables with thead/tbody/tfoot
7201 !! options
7202 parsoid=html2wt
7203 !! html/parsoid
7204 <table>
7205 <caption>Test</caption>
7206 <thead>
7207 <tr>
7208 <th>Month</th>
7209 <th>Savings</th>
7210 </tr>
7211 </thead>
7212 <tbody>
7213 <tr>
7214 <td>January</td>
7215 <td>$100</td>
7216 </tr>
7217 <tr>
7218 <td>February</td>
7219 <td>$80</td>
7220 </tr>
7221 </tbody>
7222 <tfoot>
7223 <tr>
7224 <td>Sum</td>
7225 <td>$180</td>
7226 </tr>
7227 </tfoot>
7228 </table>
7229 !! wikitext
7230 {|
7231 |+Test
7232 !Month
7233 !Savings
7234 |-
7235 |January
7236 |$100
7237 |-
7238 |February
7239 |$80
7240 |-
7241 |Sum
7242 |$180
7243 |}
7244 !! html/php+tidy
7245 <table>
7246 <caption>Test</caption>
7247 <tr>
7248 <th>Month</th>
7249 <th>Savings</th>
7250 </tr>
7251 <tr>
7252 <td>January</td>
7253 <td>$100</td>
7254 </tr>
7255 <tr>
7256 <td>February</td>
7257 <td>$80</td>
7258 </tr>
7259 <tr>
7260 <td>Sum</td>
7261 <td>$180</td>
7262 </tr>
7263 </table>
7264 !! end
7265
7266 # T137406: No whitespace in the HTML
7267 !! test
7268 2. Generate correct wikitext for tables with thead/tbody/tfoot
7269 !! options
7270 parsoid=html2wt
7271 !! html/parsoid
7272 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7273 !! wikitext
7274 {|
7275 !heading
7276 |-
7277 |foo
7278 |}
7279 !! end
7280
7281 !! test
7282 Testing serialization after deletion in references
7283 !! options
7284 parsoid={
7285 "modes": ["wt2wt"],
7286 "changes": [
7287 ["#x", "remove"]
7288 ]
7289 }
7290 !! wikitext
7291 hi <ref><div id="x">ho</div></ref>
7292
7293 <references />
7294 !! wikitext/edited
7295 hi <ref></ref>
7296
7297 <references />
7298 !! end
7299
7300 !!test
7301 Testing serialization after deletion of table cells
7302 !!options
7303 parsoid={
7304 "modes": ["wt2wt", "selser"],
7305 "changes": [
7306 ["#x", "remove"]
7307 ]
7308 }
7309 !!wikitext
7310 {|
7311 !h1 !!h2 !!h3
7312 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7313 |}
7314 !! wikitext/edited
7315 {|
7316 !h1 !!h2 !!h3
7317 |c2 |||c3
7318 |}
7319 !!end
7320
7321 !! test
7322 Testing selser after addition of new row before first row (T125419)
7323 !! options
7324 parsoid={
7325 "modes": ["wt2wt", "selser"],
7326 "changes": [
7327 [ "tr", "before", "<tr><td>X</td></tr>" ]
7328 ]
7329 }
7330 !! wikitext
7331 {|
7332 |a
7333 |}
7334 !! wikitext/edited
7335 {|
7336 |X
7337 |-
7338 |a
7339 |}
7340 !! end
7341
7342 !! test
7343 Serialize new table rows in a HTML table using HTML tags
7344 !! options
7345 parsoid={
7346 "modes": ["wt2wt", "selser"],
7347 "changes": [
7348 [ "tr", "before", "<tr><td>X</td></tr>" ]
7349 ]
7350 }
7351 !! wikitext
7352 <table><tr><td>a</td></tr></table>
7353 !! wikitext/edited
7354 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7355 !! end
7356
7357 !! test
7358 Serialize new table cells in a HTML row using HTML tags
7359 !! options
7360 parsoid={
7361 "modes": ["wt2wt", "selser"],
7362 "changes": [
7363 [ "td", "before", "<td>X</td>" ]
7364 ]
7365 }
7366 !! wikitext
7367 <table><tr><td>a</td></tr></table>
7368 !! wikitext/edited
7369 <table><tr><td>X</td><td>a</td></tr></table>
7370 !! end
7371
7372 !! test
7373 Wikitext tables can be nested inside HTML tables
7374 !! options
7375 parsoid=html2wt
7376 !! html
7377 <table data-parsoid='{"stx":"html"}'>
7378 <tr><td>
7379 <table>
7380 <tr><td>foo</td></tr>
7381 </table>
7382 </td></tr>
7383 </table>
7384 !! wikitext
7385 <table>
7386 <tr><td>
7387 {|
7388 |foo
7389 |}
7390 </td></tr>
7391 </table>
7392 !! end
7393
7394 !! test
7395 Serialize wikitext list items as HTML list items when embedded in a HTML list
7396 !! options
7397 parsoid=html2wt
7398 !! html
7399 <ul data-parsoid='{"stx": "html"}'>
7400 <li data-parsoid='{}'>a</li>
7401 <li>b</li>
7402 </ul>
7403 !! wikitext
7404 <ul>
7405 <li>a</li>
7406 <li>b</li>
7407 </ul>
7408 !! end
7409
7410 # SSS FIXME: Is this actually a good thing given the
7411 # odd nested list output that is generated by MW?
7412 # <ul><li>foo<ul>..</ul></li></ul> instead of
7413 # <ul><li>foo</li><ul>..</ul></ul>
7414 !! test
7415 Wikitext lists can be nested inside HTML lists
7416 !! options
7417 parsoid=html2wt
7418 !! html
7419 <ul data-parsoid='{"stx": "html"}'>
7420 <li data-parsoid='{"stx": "html"}'>a
7421 <ul><li>b</li></ul>
7422 </li>
7423 </ul>
7424
7425 <ul data-parsoid='{"stx": "html"}'>
7426 <li>x
7427 <ul><li>y</li></ul>
7428 </li>
7429 </ul>
7430 !! wikitext
7431 <ul>
7432 <li>a
7433 * b
7434 </li>
7435 </ul>
7436
7437 <ul>
7438 <li>x
7439 * y
7440 </li>
7441 </ul>
7442 !! end
7443
7444 ###
7445 ### Internal links
7446 ###
7447 !! test
7448 Plain link, capitalized
7449 !! wikitext
7450 [[Main Page]]
7451 !! html
7452 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7453 </p>
7454 !! end
7455
7456 !! test
7457 Plain link, uncapitalized
7458 !! wikitext
7459 [[main Page]]
7460 !! html
7461 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7462 </p>
7463 !! end
7464
7465 !! test
7466 Piped link
7467 !! wikitext
7468 [[Main Page|The Main Page]]
7469 !! html
7470 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7471 </p>
7472 !! end
7473
7474 !! test
7475 Piped link with comment in link text
7476 !! wikitext
7477 [[Main Page|The Main<!--front--> Page]]
7478 !! html
7479 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7480 </p>
7481 !! end
7482
7483 !! test
7484 Piped link with multiple pipe characters in link text
7485 !! wikitext
7486 [[Main Page||The|Main|Page|]]
7487 !! html/php
7488 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7489 </p>
7490 !! html/parsoid
7491 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7492 !! end
7493
7494 !! test
7495 Piped link with no link text
7496 !! wikitext
7497 [[Thomas Bek (bishop of St David's)|]]
7498 !! html/php
7499 <p>[[Thomas Bek (bishop of St David's)|]]
7500 </p>
7501 !! html/parsoid
7502 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7503 !! end
7504
7505 !! test
7506 Piped link with empty link text
7507 !! wikitext
7508 [[Main Page|<nowiki />]] - empty nowiki
7509 [[Main Page| ]] - empty space
7510 [[Main Page|&nbsp;]] - empty non breaking space
7511 !! html/php
7512 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7513 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7514 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7515 </p>
7516 !! html/parsoid
7517 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki />"}'/></a> - empty nowiki
7518 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7519 <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>
7520 !! end
7521
7522 !! test
7523 Broken link
7524 !! wikitext
7525 [[Zigzagzogzagzig]]
7526 !! html
7527 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7528 </p>
7529 !! end
7530
7531 !! test
7532 Broken link with fragment
7533 !! wikitext
7534 [[Zigzagzogzagzig#zug]]
7535 !! html
7536 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7537 </p>
7538 !! end
7539
7540 !! test
7541 Special page link with fragment
7542 !! wikitext
7543 [[Special:Version#anchor]]
7544 !! html
7545 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7546 </p>
7547 !! end
7548
7549 !! test
7550 Nonexistent special page link with fragment
7551 !! wikitext
7552 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7553 !! html
7554 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7555 </p>
7556 !! end
7557
7558 !! test
7559 Link with prefix
7560 !! wikitext
7561 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7562 !! html
7563 <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>
7564 </p>
7565 !! end
7566
7567 !! test
7568 Link with suffix
7569 !! wikitext
7570 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7571 !! html
7572 <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>!!!
7573 </p>
7574 !! end
7575
7576 !! article
7577 prefixed article
7578 !! text
7579 Some text
7580 !! endarticle
7581
7582 !! test
7583 Bug 43661: Piped links with identical prefixes
7584 !! wikitext
7585 [[prefixed article|prefixed articles with spaces]]
7586
7587 [[prefixed article|prefixed articlesaoeu]]
7588
7589 [[Main Page|Main Page test]]
7590 !! html
7591 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7592 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7593 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7594 </p>
7595 !! end
7596
7597
7598 !! test
7599 Link with HTML entity in suffix / tail
7600 !! wikitext
7601 [[Main Page]]&quot;, [[Main Page]]&#97;
7602 !! html/php
7603 <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;
7604 </p>
7605 !! html/parsoid
7606 <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>
7607 !! end
7608
7609 !! test
7610 Link with 3 brackets
7611 !! wikitext
7612 [[[Main Page]]]
7613 Foo [[[Main Page]]]
7614 !! html
7615 <p>[[[Main Page]]]
7616 Foo [[[Main Page]]]
7617 </p>
7618 !! end
7619
7620 !! test
7621 Link with 4 brackets
7622 !! wikitext
7623 [[[[Main Page]]]]
7624 !! html
7625 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7626 </p>
7627 !! end
7628
7629 !! test
7630 Piped link with 3 brackets
7631 !! wikitext
7632 [[[main page|the main page]]]
7633 !! html
7634 <p>[[[main page|the main page]]]
7635 </p>
7636 !! end
7637
7638 !! test
7639 Piped link with extlink-like text
7640 !! wikitext
7641 [[Main Page|[bar]]]
7642 [[Main Page|This is a [bar]]]
7643 !! html/php
7644 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7645 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7646 </p>
7647 !! html/parsoid
7648 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7649 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7650 !! end
7651
7652 !! test
7653 Link with multiple pipes
7654 !! wikitext
7655 [[Main Page|The|Main|Page]]
7656 !! html
7657 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7658 </p>
7659 !! end
7660
7661 !! test
7662 Anchor containing a #. (bug 63430)
7663 !! wikitext
7664 [[Main Page#And#Link]]
7665 !! html/php
7666 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7667 </p>
7668 !! html/parsoid
7669 <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>
7670 !! end
7671
7672 !! test
7673 Link to namespaces
7674 !! wikitext
7675 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7676 !! html
7677 <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>
7678 </p>
7679 !! end
7680
7681 !! test
7682 Link with space in namespace
7683 !! wikitext
7684 [[User talk:Foo bar]]
7685 !! html
7686 <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>
7687 </p>
7688 !! end
7689
7690 !! article
7691 MemoryAlpha:AlphaTest
7692 !! text
7693 This is an article in the MemoryAlpha namespace
7694 (which shadows the memoryalpha interwiki link).
7695 !! endarticle
7696
7697 !! test
7698 Namespace takes precedence over interwiki link (bug 51680)
7699 !! wikitext
7700 [[MemoryAlpha:AlphaTest]]
7701 !! html
7702 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7703 </p>
7704 !! end
7705
7706 # The previous test doesn't work correctly in html2*, due to not recognizing the
7707 # link as an internal one. This one checks for the correct behavior.
7708 !! test
7709 Link to namespace preferred over interwiki with correct rel attribute
7710 !! options
7711 parsoid=html2wt,html2html
7712 !! html/parsoid
7713 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7714 !! wikitext
7715 [[MemoryAlpha:AlphaTest]]
7716 !! end
7717
7718 !! test
7719 Piped link to namespace
7720 !! wikitext
7721 [[Meta:Disclaimers|The disclaimers]]
7722 !! html
7723 <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>
7724 </p>
7725 !! end
7726
7727 !! test
7728 Link containing }
7729 !! wikitext
7730 [[Usually caused by a typo (oops}]]
7731 !! html
7732 <p>[[Usually caused by a typo (oops}]]
7733 </p>
7734 !! end
7735
7736 !! article
7737 7% Solution
7738 !! text
7739 Just a test of an article title containing a percent.
7740 !! endarticle
7741
7742 !! test
7743 Link containing % (not as a hex sequence)
7744 !! wikitext
7745 [[7% Solution]]
7746 [[7% Solution|7%25 Solution]]
7747 !! html/php
7748 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7749 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7750 </p>
7751 !! html/parsoid
7752 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7753 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7754 !! end
7755
7756 # note that the parsoid HTML is identical to the previous test output,
7757 # so the previous test ensures that the html2wt mode will generate the
7758 # "not as a hex sequence" wikitext.
7759 !! test
7760 Link containing % as a single hex sequence interpreted to char
7761 !! options
7762 parsoid=wt2wt,wt2html,html2html
7763 !! wikitext
7764 [[7%25 Solution]]
7765 [[7%25 Solution|7%25 Solution]]
7766 !! html/php
7767 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7768 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7769 </p>
7770 !! html/parsoid
7771 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7772 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7773 !!end
7774
7775 !! test
7776 Link containing % as a double hex sequence interpreted to hex sequence
7777 !! wikitext
7778 [[7%2525 Solution]]
7779 !! html
7780 <p>[[7%2525 Solution]]
7781 </p>
7782 !!end
7783
7784 ## Example for such a section: == < ==
7785 !! test
7786 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7787 !! wikitext
7788 [[%23%3c]][[%23%3e]]
7789 !! html/php
7790 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7791 </p>
7792 !! html/parsoid
7793 <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>
7794 !! end
7795
7796 !! test
7797 Link containing "<#" and ">#" as a hex sequences
7798 !! wikitext
7799 [[%3c%23]][[%3e%23]]
7800 !! html
7801 <p>[[%3c%23]][[%3e%23]]
7802 </p>
7803 !! end
7804
7805 !! test
7806 Link containing an equals sign
7807 !! wikitext
7808 [[Special:BookSources/isbn=4-00-026157-6]]
7809 !! html/php
7810 <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>
7811 </p>
7812 !! html/parsoid
7813 <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>
7814 !! end
7815
7816 !! article
7817 Foo~bar
7818 !! text
7819 Just a test of an article title containing a tilde.
7820 !! endarticle
7821
7822 # note that links containing signatures, like [[Foo~~~~]], are
7823 # massaged by the pre-save transform (PST) and so the tildes are never
7824 # seen by the parser.
7825 !! test
7826 Link containing a tilde
7827 !! wikitext
7828 [[Foo~bar]]
7829 !! html/php
7830 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7831 </p>
7832 !! html/parsoid
7833 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7834 !! end
7835
7836 !! test
7837 Link containing double-single-quotes '' (bug 4598)
7838 !! wikitext
7839 [[Lista d''e paise d''o munno]]
7840 !! html/php
7841 <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>
7842 </p>
7843 !! html/parsoid
7844 <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>
7845 !! end
7846
7847 !! test
7848 Link containing double quotes and spaces
7849 !! wikitext
7850 [[Cool "Gator"]]
7851 !! html/php
7852 <p><a href="/index.php?title=Cool_%22Gator%22&amp;action=edit&amp;redlink=1" class="new" title="Cool &quot;Gator&quot; (page does not exist)">Cool "Gator"</a>
7853 </p>
7854 !! html/parsoid
7855 <p><a rel="mw:WikiLink" href="./Cool_%22Gator%22" title='Cool "Gator"'>Cool "Gator"</a></p>
7856 !! end
7857
7858 !! test
7859 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7860 !! wikitext
7861 Some [[Link|pretty ''italics'' and stuff]]!
7862 !! html/php
7863 <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>!
7864 </p>
7865 !! html/parsoid
7866 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7867 !! end
7868
7869 !! test
7870 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7871 !! wikitext
7872 ''Some [[Link|pretty ''italics'' and stuff]]!''
7873 !! html
7874 <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>
7875 </p>
7876 !! end
7877
7878 !! test
7879 Link with double quotes in title part (literal) and alternate part (interpreted)
7880 !! wikitext
7881 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7882
7883 [[''Pentecoste'']]
7884
7885 [[''Pentecoste''|Pentecoste]]
7886
7887 [[''Pentecoste''|''Pentecoste'']]
7888 !! html/php
7889 <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>
7890 </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>
7891 </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>
7892 </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>
7893 </p>
7894 !! html/parsoid
7895 <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>
7896 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7897 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7898 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7899 !! end
7900
7901 !! test
7902 Broken image links with HTML captions (bug 39700)
7903 !! wikitext
7904 [[File:Nonexistent|<script></script>]]
7905 [[File:Nonexistent|100x100px|<script></script>]]
7906 [[File:Nonexistent|&lt;]]
7907 [[File:Nonexistent|a<i>b</i>c]]
7908 !! html/php
7909 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7910 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7911 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7912 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7913 </p>
7914 !! html/parsoid
7915 <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>
7916 <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>
7917 <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>
7918 <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>
7919 !! end
7920
7921 !! test
7922 Plain link to URL
7923 !! wikitext
7924 [[http://www.example.com]]
7925 !! html/php
7926 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7927 </p>
7928 !! html/parsoid
7929 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7930 !! end
7931
7932 !! test
7933 Plain link to URL with link text
7934 !! wikitext
7935 [[http://www.example.com Link text]]
7936 !! html
7937 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7938 </p>
7939 !! end
7940
7941 !! test
7942 Plain link to protocol-relative URL
7943 !! wikitext
7944 [[//www.example.com]]
7945 !! html/php
7946 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7947 </p>
7948 !! html/parsoid
7949 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7950 !! end
7951
7952 !! test
7953 Plain link to protocol-relative URL with link text
7954 !! wikitext
7955 [[//www.example.com Link text]]
7956 !! html
7957 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7958 </p>
7959 !! end
7960
7961 !! test
7962 Plain link to page with question mark in title
7963 !! wikitext
7964 [[A?b]]
7965
7966 [[A?b|Baz]]
7967 !! html
7968 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7969 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7970 </p>
7971 !! end
7972
7973
7974 # I'm fairly sure the expected result here is wrong.
7975 # We want these to be URL links, not pseudo-pages with URLs for titles....
7976 # However the current output is also pretty screwy.
7977 #
7978 # ----
7979 # I'm changing it to match the current output--it arguably makes more
7980 # sense in the light of the test above. Old expected result was:
7981 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7982 #</p>
7983 # But I think this test is bordering on "garbage in, garbage out" anyway.
7984 # -- wtm
7985 !! test
7986 Piped link to URL
7987 !! wikitext
7988 Piped link to URL: [[http://www.example.com|an example URL]]
7989 !! html/php
7990 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7991 </p>
7992 !! html/parsoid
7993 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com%7Can" data-parsoid='{"a":{"href":"http://www.example.com%7Can"},"sa":{"href":"http://www.example.com|an"}}'>example URL</a>]</p>
7994 !! end
7995
7996 !! test
7997 BUG 2: [[page|http://url/]] should link to page, not http://url/
7998 !! wikitext
7999 [[Main Page|http://url/]]
8000 !! html/php
8001 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8002 </p>
8003 !! html/parsoid
8004 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8005 !! end
8006
8007 # Parsoid does not mark self-links, by design.
8008 !! test
8009 BUG 337: Escaped self-links should be bold
8010 !! options
8011 title=[[Bug462]]
8012 !! wikitext
8013 [[Bu&#103;462]] [[Bug462]]
8014 !! html/php
8015 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
8016 </p>
8017 !! html/php+tidy
8018 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
8019 !! html/parsoid
8020 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8021 !! end
8022
8023 !! test
8024 Self-link to section should not be bold
8025 !! options
8026 title=[[Main Page]]
8027 !! wikitext
8028 [[Main Page#section]]
8029 !! html
8030 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8031 </p>
8032 !! end
8033
8034 !! article
8035 00
8036 !! text
8037 This is 00.
8038 !! endarticle
8039
8040 !!test
8041 Self-link to numeric title
8042 !!options
8043 title=[[0]]
8044 !! wikitext
8045 [[0]]
8046 !! html
8047 <p><strong class="selflink">0</strong>
8048 </p>
8049 !!end
8050
8051 !!test
8052 Link to numeric-equivalent title
8053 !!options
8054 title=[[0]]
8055 !! wikitext
8056 [[00]]
8057 !! html
8058 <p><a href="/wiki/00" title="00">00</a>
8059 </p>
8060 !!end
8061
8062 !! test
8063 <nowiki> inside a link
8064 !! wikitext
8065 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8066 !! html
8067 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8068 </p>
8069 !! end
8070
8071 !! test
8072 Non-breaking spaces in title
8073 !! wikitext
8074 [[&nbsp; Main &nbsp; Page &nbsp;]]
8075 !! html
8076 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8077 </p>
8078 !!end
8079
8080 !! test
8081 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
8082 !! options
8083 language=ca
8084 !! wikitext
8085 '''[[Main Page]]'''
8086 !! html
8087 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8088 </p>
8089 !! end
8090
8091 !! test
8092 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
8093 !! options
8094 language=ca
8095 !! wikitext
8096 ''[[Main Page]]''
8097 !! html
8098 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8099 </p>
8100 !! end
8101
8102 !! test
8103 Internal link with en linktrail: no apostrophes (bug 27473)
8104 !! options
8105 language=en
8106 !! wikitext
8107 [[Something]]'nice
8108 !! html
8109 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8110 </p>
8111 !! end
8112
8113 !! test
8114 Internal link with ca linktrail with apostrophes (bug 27473)
8115 !! options
8116 language=ca
8117 !! wikitext
8118 [[Something]]'nice
8119 !! html
8120 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8121 </p>
8122 !! end
8123
8124 !! test
8125 Internal link with kaa linktrail with apostrophes (bug 27473)
8126 !! options
8127 language=kaa
8128 !! wikitext
8129 [[Something]]'nice
8130 !! html
8131 <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>
8132 </p>
8133 !! end
8134
8135 !! test
8136 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
8137 !! wikitext
8138 [[User:Foo/Test/63636:Bar|Test]]
8139 !! html/php
8140 <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>
8141 </p>
8142 !! html/parsoid
8143 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8144 !! end
8145
8146 ## Mainly a sanity check for Parsoid
8147 !! test
8148 Handle title parsing for subpages
8149 !! options
8150 title=[[/123123]]
8151 !! wikitext
8152 123
8153 !! html/parsoid
8154 <p>123</p>
8155 !! end
8156
8157 ## FIXME: Add a working php section here
8158 !! test
8159 Link to a subpage from a namespace other than main
8160 !! options
8161 title=[[User:test]]
8162 !! wikitext
8163 [[/123]]
8164 !! html/parsoid
8165 <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>
8166 !! end
8167
8168 !! test
8169 Ensure that transclusion titles are not url-decoded
8170 !! options
8171 subpage title=[[Test]]
8172 parsoid=wt2html
8173 !! wikitext
8174 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8175 !! html/php
8176 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8177 </p>
8178 !! html/parsoid
8179 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8180 !! end
8181
8182 !! test
8183 Purely hash wikilink
8184 !! options
8185 title=[[User:test/123]]
8186 !! wikitext
8187 [[#a|b]]
8188 !! html/php
8189 <p><a href="#a">b</a>
8190 </p>
8191 !! html/parsoid
8192 <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>
8193 !! end
8194
8195 !! test
8196 1. Interaction of linktrail and template encapsulation
8197 !! wikitext
8198 {{echo|[[Foo]]}}l
8199 !! html/parsoid
8200 <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>
8201 !! end
8202
8203 !! test
8204 2. Interaction of linktrail and template encapsulation
8205 !! options
8206 parsoid
8207 !! wikitext
8208 {{echo|Some [[Fool]]}}s
8209 !! html
8210 <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>
8211 !! end
8212
8213 !! test
8214 3. Interaction of linktrail and template encapsulation
8215 !! options
8216 parsoid
8217 !! wikitext
8218 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8219 !! html
8220 <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>
8221 !! end
8222
8223 !! article
8224 Söfnuður
8225 !! text
8226 Test.
8227 !! endarticle
8228
8229 !! test
8230 Internal link with is link prefix
8231 !! options
8232 language=is
8233 !! wikitext
8234 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8235 !! html
8236 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8237 </p>
8238 !! end
8239
8240 !! article
8241 Mótmælendatrú
8242 !! text
8243 Test.
8244 !! endarticle
8245
8246 !! test
8247 Internal link with is link trail and link prefix
8248 !! options
8249 language=is
8250 !! wikitext
8251 [[mótmælendatrú|xxx]]ar
8252 [[mótmælendatrú]]ar
8253 mótmælenda[[söfnuður]]
8254 mótmælenda[[söfnuður|söfnuðir]]
8255 mótmælenda[[söfnuður|söfnuðir]]xxx
8256 !! html
8257 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8258 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8259 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8260 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8261 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8262 </p>
8263 !! end
8264
8265 !! test
8266 Parsoid link trail escaping
8267 !! options
8268 parsoid=html2wt,html2html
8269 !! html/parsoid
8270 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8271 !! wikitext
8272 [[apple]]<nowiki/>s
8273 !! end
8274
8275 !! test
8276 Parsoid link prefix escaping
8277 !! options
8278 language=is
8279 parsoid=html2wt,html2html
8280 !! html/parsoid
8281 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8282 !! wikitext
8283 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8284 !! end
8285
8286 !! test
8287 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8288 !! wikitext
8289 [[Foo| bar]]
8290
8291 [[Foo| ''bar'']]
8292
8293 [http://wp.org foo]
8294
8295 [http://wp.org ''foo'']
8296 !! html
8297 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8298 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8299 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8300 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8301 </p>
8302 !! end
8303
8304 !! test
8305 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8306 !! wikitext
8307 [[Foo|{{echo|a}} b {{echo|c}}]]
8308 !! html/parsoid
8309 <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>
8310 !! end
8311
8312 !! test
8313 Link with angle bracket after anchor
8314 !! wikitext
8315 [[Foo#<bar>]]
8316 !! html/php
8317 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8318 </p>
8319 !! html/parsoid
8320 <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>
8321 !! end
8322
8323 ###
8324 ### Interwiki links (see maintenance/interwiki.sql)
8325 ###
8326
8327 !! test
8328 Inline interwiki link
8329 !! options
8330 parsoid=wt2html,wt2wt,html2html
8331 !! wikitext
8332 [[MeatBall:SoftSecurity]]
8333 !! html/php
8334 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8335 </p>
8336 !! html/parsoid
8337 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8338 !! end
8339
8340 !! test
8341 Inline interwiki link with empty title (bug 2372)
8342 !! options
8343 parsoid=wt2html,wt2wt,html2html
8344 !! wikitext
8345 [[MeatBall:]]
8346 !! html/php
8347 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8348 </p>
8349 !! html/parsoid
8350 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8351 !! end
8352
8353 !! test
8354 Interwiki link encoding conversion (bug 1636)
8355 !! wikitext
8356 *[[Wikipedia:ro:Olteni&#0355;a]]
8357 *[[Wikipedia:ro:Olteni&#355;a]]
8358 !! html
8359 <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>
8360 <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>
8361
8362 !! html+tidy
8363 <ul>
8364 <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>
8365 <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>
8366 </ul>
8367 !! end
8368
8369 !! test
8370 Interwiki link with fragment (bug 2130)
8371 !! wikitext
8372 [[MeatBall:SoftSecurity#foo]]
8373 !! html
8374 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8375 </p>
8376 !! end
8377
8378 !! test
8379 Link scenarios with escaped fragments
8380 !! wikitext
8381 [[#Is this great?]]
8382 [[Foo#Is this great?]]
8383 [[meatball:Foo#Is this great?]]
8384 !! html/php
8385 <p><a href="#Is_this_great.3F">#Is this great?</a>
8386 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8387 <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>
8388 </p>
8389 !! html/parsoid
8390 <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>
8391 <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>
8392 <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>
8393 !! end
8394
8395 # Ideally the wikipedia: prefix here should be proto-relative too
8396 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8397 # define the 'en' prefix, and originally the test used 'wikipedia',
8398 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8399 # article.
8400 !! test
8401 Different interwiki prefixes mapping to the same URL
8402 !! wikitext
8403 [[:en:Foo]]
8404
8405 [[:en:Foo|Foo]]
8406
8407 [[wikipedia:Foo]]
8408
8409 [[:wikipedia:Foo|Foo]]
8410
8411 [[wikipedia:en:Foo]]
8412
8413 [[:wikipedia:en:Foo]]
8414
8415 [[ wikiPEdia :Foo]]
8416 !! html/parsoid
8417 <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>
8418
8419 <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>
8420
8421 <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>
8422
8423 <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>
8424
8425 <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>
8426
8427 <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>
8428
8429 <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>
8430 !! end
8431
8432 !! test
8433 Interwiki links that cannot be represented in wiki syntax
8434 !! wikitext
8435 [[meatball:ok]]
8436 [[meatball:ok#foo|ok with fragment]]
8437 [[meatball:ok_as_well?|ok ending with ? mark]]
8438 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8439 [http://de.wikipedia.org/wiki/#foo is just fragment]
8440
8441 !! html/php
8442 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8443 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8444 <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>
8445 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8446 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8447 </p>
8448 !! html/parsoid
8449 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8450 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8451 <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>
8452 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8453 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8454 !! end
8455
8456 !! test
8457 Interwiki links: trail
8458 !! wikitext
8459 [[wikipedia:Foo|Ba]]r
8460 !! html/php
8461 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8462 </p>
8463 !! html/parsoid
8464 <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>
8465 !! end
8466
8467 !! test
8468 Local interwiki link
8469 !! options
8470 parsoid=wt2html,wt2wt,html2html
8471 !! wikitext
8472 [[local:Template:Foo]]
8473 !! html/php
8474 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8475 </p>
8476 !! html/parsoid
8477 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8478 !! end
8479
8480 # Parsoid does not mark self-links, by design.
8481 !! test
8482 Local interwiki link: self-link to current page
8483 !! options
8484 title=[[Main Page]]
8485 parsoid=wt2html,wt2wt,html2html
8486 !! wikitext
8487 [[local:Main Page]]
8488 !! html/php
8489 <p><strong class="selflink">local:Main Page</strong>
8490 </p>
8491 !! html/parsoid
8492 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8493 !! end
8494
8495 !! test
8496 Local interwiki link: prefix only (bug 64167)
8497 !! options
8498 parsoid=wt2html,wt2wt,html2html
8499 !! wikitext
8500 [[local:]]
8501 !! html/php
8502 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8503 </p>
8504 !! html/parsoid
8505 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8506 !! end
8507
8508 !! test
8509 Local interwiki link: with additional interwiki prefix (bug 61357)
8510 !! options
8511 parsoid=wt2html,wt2wt,html2html
8512 !! wikitext
8513 [[local:meatball:Hello]]
8514 !! html/php
8515 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8516 </p>
8517 !! html/parsoid
8518 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8519 !! end
8520
8521 !! test
8522 Multiple local interwiki link prefixes
8523 !! wikitext
8524 [[local:local:local:local:mi:local:Foo]]
8525 !! options
8526 parsoid=wt2html,wt2wt,html2html
8527 !! html/php
8528 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8529 </p>
8530 !! html/parsoid
8531 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8532 !! end
8533
8534 ###
8535 ### Interlanguage links
8536 ### Language links (so that searching for '### language' matches..)
8537 ###
8538
8539 !! test
8540 Interlanguage link
8541 !! wikitext
8542 Blah blah blah
8543 [[zh:Chinese]]
8544 !! html/php
8545 <p>Blah blah blah
8546 </p>
8547 !! html/parsoid
8548 <p>Blah blah blah</p>
8549 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8550 !! end
8551
8552 ## parsoid html2wt will lose the space variations
8553 !! test
8554 Interlanguage link with spacing
8555 !! options
8556 parsoid=wt2html,wt2wt,html2html
8557 !! wikitext
8558 Blah blah blah
8559 [[ zh : Chinese ]]
8560 !! html/php
8561 <p>Blah blah blah
8562 </p>
8563 !! html/parsoid
8564 <p>Blah blah blah</p>
8565 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8566 !! end
8567
8568 !! test
8569 Double interlanguage link
8570 !! wikitext
8571 Blah blah blah
8572 [[es:Spanish]]
8573 [[zh:Chinese]]
8574 !! html/php
8575 <p>Blah blah blah
8576 </p>
8577 !! html/parsoid
8578 <p>Blah blah blah</p>
8579 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8580 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8581 !! end
8582
8583 ## parsoid html2wt will lose the space variations
8584 !! test
8585 Interlanguage link variations
8586 !! options
8587 parsoid=wt2html,wt2wt,html2html
8588 !! wikitext
8589 Blah blah blah
8590 [[ es :Spanish]]
8591 [[ ZH :Chinese]]
8592 [[es:Foo_bar]]
8593 !! html/php
8594 <p>Blah blah blah
8595 </p>
8596 !! html/parsoid
8597 <p>Blah blah blah</p>
8598 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8599 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8600 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8601 !! end
8602
8603 !! test
8604 Escaping of interlanguage links
8605 !! wikitext
8606 Blah blah blah
8607 [[:es:Spanish]]
8608 [[ : zh : Chinese ]]
8609 !! html/php
8610 <p>Blah blah blah
8611 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8612 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8613 </p>
8614 !! html/parsoid
8615 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8616 <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8617 !! end
8618
8619 ## parsoid html2wt will normalize the space to _
8620 !! test
8621 Space and question mark encoding in interlanguage links (T95473)
8622 !! options
8623 parsoid=wt2html,wt2wt,html2html
8624 !! wikitext
8625 Blah blah blah
8626 [[es:Foo bar?]]
8627 !! html/php
8628 <p>Blah blah blah
8629 </p>
8630 !! html/parsoid
8631 <p>Blah blah blah</p>
8632 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8633 !! end
8634
8635 !! test
8636 Interlanguage link, with prefix links
8637 !! options
8638 language=ln
8639 !! wikitext
8640 Blah blah blah
8641 [[zh:Chinese]]
8642 !! html/php
8643 <p>Blah blah blah
8644 </p>
8645 !! html/parsoid
8646 <p>Blah blah blah</p>
8647 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8648 !! end
8649
8650 !! test
8651 Double interlanguage link, with prefix links (bug 8897)
8652 !! options
8653 language=ln
8654 !! wikitext
8655 Blah blah blah
8656 [[es:Spanish]]
8657 [[zh:Chinese]]
8658 !! html/php
8659 <p>Blah blah blah
8660 </p>
8661 !! html/parsoid
8662 <p>Blah blah blah</p>
8663 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8664 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8665 !! end
8666
8667 !! test
8668 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8669 !! wikitext
8670 Blah blah blah
8671 [[mul:Article]]
8672 !! html/php
8673 <p>Blah blah blah
8674 </p>
8675 !! html/parsoid
8676 <p>Blah blah blah</p>
8677 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8678 !! end
8679
8680 ## PHP parser tests script needs an update
8681 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8682 !! test
8683 Language links render as inline links if $wgInterwikiMagic=false
8684 !! options
8685 wgInterwikiMagic=false
8686 parsoid=wt2html,wt2wt,html2html
8687 !! wikitext
8688 Blah blah blah
8689 [[zh:Chinese]]
8690 !! html/parsoid
8691 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8692 !! end
8693
8694 ## PHP parser tests script needs an update
8695 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8696 !! test
8697 Language links render as inline links in the Talk namespace
8698 !! options
8699 title=Talk:Foo
8700 parsoid=wt2html,wt2wt,html2html
8701 !! wikitext
8702 Blah blah blah
8703 [[zh:Chinese]]
8704 !! html/parsoid
8705 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8706 !! end
8707
8708 !! test
8709 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8710 !! options
8711 language=ln
8712 !! wikitext
8713 [[WW&nbsp;II]]
8714 !! html
8715 <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>
8716 </p>
8717 !! end
8718
8719 !! test
8720 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8721 !! options
8722 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8723 !! html/parsoid
8724 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8725 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8726 !! wikitext
8727 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8728
8729 He&amp;nbsp;llo He&amp;nbsp;llo
8730 !! html/php
8731 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8732 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8733 </p>
8734 !! end
8735
8736 # html2wt will fail because of title normalization without data-parsoid
8737 !! test
8738 Parsoid: handle constructor well
8739 !! options
8740 parsoid=wt2html,wt2wt
8741 !! wikitext
8742 [[constructor]]
8743
8744 [[constructor:foo]]
8745 !! html/php
8746 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8747 </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>
8748 </p>
8749 !! html/parsoid
8750 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8751
8752 <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>
8753 !! end
8754
8755 !! article
8756 ko:
8757 !! text
8758 Test.
8759 !! endarticle
8760
8761 # Note that `ko` isn't a known interlanguage prefix
8762 !! test
8763 Parsoid: recognize interlanguage links without a target page
8764 !! options
8765 ill
8766 !! wikitext
8767 [[es:]]
8768
8769 [[ko:]]
8770 !! html/php
8771 es:
8772 !! html/parsoid
8773 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8774
8775 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8776 !! end
8777
8778 # Note that `ko` isn't a known interwiki prefix
8779 !! test
8780 Parsoid: recognize interwiki links without a target page
8781 !! options
8782 parsoid=wt2html,wt2wt,html2html
8783 !! wikitext
8784 [[:es:]]
8785
8786 [[:ko:]]
8787 !! html/php
8788 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8789 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8790 </p>
8791 !! html/parsoid
8792 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8793 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8794 !! end
8795
8796 !! test
8797 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8798 !! wikitext
8799 [[mi:Foo]]
8800 !! html/php
8801 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8802 </p>
8803 !! html/parsoid
8804 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8805 !! end
8806
8807 !! test
8808 Interlanguage link with preceding local interwiki link (bug 68085)
8809 !! options
8810 parsoid=wt2html,wt2wt,html2html
8811 !! wikitext
8812 Blah blah blah
8813 [[local:es:Spanish]]
8814 !! html/php
8815 <p>Blah blah blah
8816 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8817 </p>
8818 !! html/parsoid
8819 <p>Blah blah blah
8820 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8821 !! end
8822
8823 !! test
8824 Looks like an interlanguage link, but is actually a local interwiki
8825 !! options
8826 parsoid=wt2html,wt2wt,html2html
8827 !! wikitext
8828 Blah blah blah
8829 [[mi:Template:Foo]]
8830 !! html/php
8831 <p>Blah blah blah
8832 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8833 </p>
8834 !! html/parsoid
8835 <p>Blah blah blah
8836 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8837 !! end
8838
8839 ###
8840 ### Redirects, Parsoid-only
8841 ###
8842
8843 !! test
8844 1. Simple redirect to page
8845 !! wikitext
8846 #REDIRECT [[Main Page]]
8847 !! html/parsoid
8848 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8849 !! end
8850
8851 !! test
8852 2. Other redirect variants
8853 !! wikitext
8854 #REDIRECT [[Main_Page]]
8855 !! html/parsoid
8856 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8857 !! end
8858
8859 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8860 # This tests the Parsoid bail-out code.
8861 !! test
8862 3. Other redirect variants
8863 !! wikitext
8864 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8865 !! html/parsoid
8866 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8867 !! end
8868
8869 !! test
8870 4. Redirect to a templated destination
8871 !! wikitext
8872 #REDIRECT [[{{echo|Foo}}bar]]
8873 !! html/parsoid
8874 <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"}]]}'/>
8875 !! end
8876
8877 !! test
8878 Empty redirect
8879 !! options
8880 parsoid=wt2html,wt2wt
8881 !! wikitext
8882 #REDIRECT [[]]
8883 !! html/parsoid
8884 <ol>
8885 <li>REDIRECT [[]]</li></ol>
8886 !! end
8887
8888 !! test
8889 Optional colon in #REDIRECT
8890 !! options
8891 # the colon is archaic syntax. we support it for wt2html, but we
8892 # don't care that it roundtrips back to the modern syntax.
8893 parsoid=wt2html,html2html
8894 !! wikitext
8895 #REDIRECT:[[Main Page]]
8896 !! html/parsoid
8897 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8898 !! end
8899
8900 !! test
8901 Whitespace in #REDIRECT with optional colon
8902 !! options
8903 # the colon and gratuitous whitespace is archaic syntax. we support
8904 # it for wt2html, but we don't care that it roundtrips back to the
8905 # modern syntax (without extra whitespace)
8906 parsoid=wt2html,html2html
8907 !! wikitext
8908
8909 #REDIRECT
8910 :
8911 [[Main Page]]
8912 !! html/parsoid
8913 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8914 !! end
8915
8916 !! test
8917 Piped link in #REDIRECT
8918 !! options
8919 # content after piped link is ignored. we support this syntax,
8920 # but don't care that the piped link is lost when we roundtrip this.
8921 parsoid=wt2html
8922 !! wikitext
8923 #REDIRECT [[Main Page|bar]]
8924 !! html/parsoid
8925 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8926 !! end
8927
8928 !! test
8929 Redirect to category (T104502)
8930 !! options
8931 parsoid=wt2html,wt2wt
8932 !! wikitext
8933 #REDIRECT [[Category:Foo]]
8934 !! html/parsoid
8935 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8936 !! end
8937
8938 !! test
8939 Redirect to category with URL encoding (T104502)
8940 !! options
8941 parsoid=wt2html
8942 !! wikitext
8943 #REDIRECT [[Category%3AFoo]]
8944 !! html/parsoid
8945 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8946 !! end
8947
8948 !! test
8949 Redirect to category page
8950 !! wikitext
8951 #REDIRECT [[:Category:Foo]]
8952 !! html/parsoid
8953 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8954 !! end
8955
8956 !! test
8957 Redirect to image page (1)
8958 !! wikitext
8959 #REDIRECT [[File:Wiki.png]]
8960 !! html/parsoid
8961 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8962 !! end
8963
8964 !! test
8965 Redirect to image page (2)
8966 !! wikitext
8967 #REDIRECT [[Image:Wiki.png]]
8968 !! html/parsoid
8969 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8970 !! end
8971
8972 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8973 # Next test confirms this.
8974 !! test
8975 Redirect to language (1) (T104918)
8976 !! options
8977 parsoid=wt2html,wt2wt,html2html
8978 !! wikitext
8979 #REDIRECT [[en:File:Wiki.png]]
8980 !! html/parsoid
8981 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8982 !! end
8983
8984 !! test
8985 Redirect to language (2) (T104918)
8986 !! wikitext
8987 #REDIRECT [[:en:File:Wiki.png]]
8988 !! html/parsoid
8989 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8990 !! end
8991
8992 !! test
8993 Redirect to interwiki (T104918)
8994 !! wikitext
8995 #REDIRECT [[meatball:File:Wiki.png]]
8996 !! html/parsoid
8997 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8998 !! end
8999
9000 !! test
9001 Non-English #REDIRECT
9002 !! options
9003 language=is
9004 !! wikitext
9005 #TILVÍSUN [[Main Page]]
9006 !! html/parsoid
9007 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9008 !! end
9009
9010 !! test
9011 Redirect syntax under text isn't considered a redirect
9012 !! wikitext
9013 some text
9014 #redirect [[Main Page]]
9015 !! html/parsoid
9016 <p>some text</p>
9017 <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>
9018 !! end
9019
9020 # FIXME: Should hoist the redirect to the top of the page and ensure there
9021 # is only one.
9022 !! test
9023 New redirect
9024 !! options
9025 parsoid=html2wt
9026 !! html/parsoid
9027 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9028 !! wikitext
9029 Foo
9030 #REDIRECT [[Foo]]
9031 !! end
9032
9033 ##
9034 ## XHTML tidiness
9035 ###
9036
9037 !! test
9038 <br> to <br />
9039 !! wikitext
9040 1<br>2<br />3
9041 !! html
9042 <p>1<br />2<br />3
9043 </p>
9044 !! end
9045
9046 !! test
9047 Broken br tag sanitization
9048 !! wikitext
9049 </br>
9050 !! html/php
9051 <p>&lt;/br&gt;
9052 </p>
9053 !! end
9054
9055 # TODO: Fix html2html mode (bug 51055)!
9056 !! test
9057 Parsoid: Broken br tag recognition
9058 !! options
9059 parsoid=wt2html
9060 !! wikitext
9061 </br>
9062
9063 <br/ >
9064 !! html+tidy
9065 <p><br /></p>
9066 <p><br /></p>
9067 !! end
9068
9069 !! test
9070 Incorrecly removing closing slashes from correctly formed XHTML
9071 !! wikitext
9072 <br style="clear:both;" />
9073 !! html
9074 <p><br style="clear:both;" />
9075 </p>
9076 !! end
9077
9078 !! test
9079 Failing to transform badly formed HTML into correct XHTML
9080 !! wikitext
9081 <br style="clear: left;">
9082 <br style="clear: right;">
9083 <br style="clear: both;">
9084 !! html
9085 <p><br style="clear: left;" />
9086 <br style="clear: right;" />
9087 <br style="clear: both;" />
9088 </p>
9089 !!end
9090
9091 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9092 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9093 !! test
9094 Handling html with a div self-closing tag
9095 !! wikitext
9096 <div title />
9097 <div title/>
9098 <div title/ >
9099 <div title=bar />
9100 <div title=bar/>
9101 <div title=bar/ >
9102 !! html/php
9103 <p>&lt;div title /&gt;
9104 &lt;div title/&gt;
9105 </p>
9106 <div>
9107 <p>&lt;div title=bar /&gt;
9108 &lt;div title=bar/&gt;
9109 </p>
9110 <div title="bar/"></div>
9111 </div>
9112
9113 !! html/parsoid
9114 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9115 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9116 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9117 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9118 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9119 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9120 !! end
9121
9122 !! test
9123 Handling html with a br self-closing tag
9124 !! wikitext
9125 <br title />
9126 <br title/>
9127 <br title/ >
9128 <br title=bar />
9129 <br title=bar/>
9130 <br title=bar/ >
9131 !! html/php
9132 <p><br title="" />
9133 <br title="" />
9134 <br />
9135 <br title="bar" />
9136 <br title="bar" />
9137 <br title="bar/" />
9138 </p>
9139 !! html/parsoid
9140 <p><br title="" />
9141 <br title="" />
9142 <br title="" />
9143 <br title="bar" />
9144 <br title="bar" />
9145 <br title="bar/" />
9146 </p>
9147 !! end
9148
9149 !! test
9150 Horizontal ruler (should it add that extra space?)
9151 !! wikitext
9152 <hr>
9153 <hr >
9154 foo <hr
9155 > bar
9156 !! html+tidy
9157 <hr />
9158 <hr />
9159 <p>foo</p>
9160 <hr />
9161 <p>bar</p>
9162 !! end
9163
9164 !! test
9165 Horizontal ruler -- 4+ dashes render hr
9166 !! wikitext
9167 ----
9168 !! html
9169 <hr />
9170
9171 !! end
9172
9173 !! test
9174 Horizontal ruler -- eats additional dashes on the same line
9175 !! wikitext
9176 ---------
9177 !! html
9178 <hr />
9179
9180 !! end
9181
9182 !! test
9183 Horizontal ruler -- does not collapse dashes on consecutive lines
9184 !! wikitext
9185 ----
9186 ----
9187 !! html
9188 <hr />
9189 <hr />
9190
9191 !! end
9192
9193 !! test
9194 Horizontal ruler -- <4 dashes render as plain text
9195 !! wikitext
9196 ---
9197 !! html
9198 <p>---
9199 </p>
9200 !! end
9201
9202 !! test
9203 Horizontal ruler -- Supports content following dashes on same line
9204 !! wikitext
9205 ---- Foo
9206 !! html
9207 <hr /> Foo
9208
9209 !! html+tidy
9210 <hr />
9211 <p>Foo</p>
9212 !! end
9213
9214 ###
9215 ### Block-level elements
9216 ###
9217 !! test
9218 Common list
9219 !! wikitext
9220 *Common list
9221 * item 2
9222 *item 3
9223 !! html
9224 <ul><li>Common list</li>
9225 <li> item 2</li>
9226 <li>item 3</li></ul>
9227
9228 !! end
9229
9230 !! test
9231 Numbered list
9232 !! wikitext
9233 #Numbered list
9234 #item 2
9235 # item 3
9236 !! html
9237 <ol><li>Numbered list</li>
9238 <li>item 2</li>
9239 <li> item 3</li></ol>
9240
9241 !! end
9242
9243 !! test
9244 Mixed list
9245 !! wikitext
9246 *Mixed list
9247 *# with numbers
9248 ** and bullets
9249 *# and numbers
9250 *bullets again
9251 **bullet level 2
9252 ***bullet level 3
9253 ***#Number on level 4
9254 **bullet level 2
9255 **#Number on level 3
9256 **#Number on level 3
9257 *#number level 2
9258 *Level 1
9259 *** Level 3
9260 #** Level 3, but ordered
9261 !! html
9262 <ul><li>Mixed list
9263 <ol><li> with numbers</li></ol>
9264 <ul><li> and bullets</li></ul>
9265 <ol><li> and numbers</li></ol></li>
9266 <li>bullets again
9267 <ul><li>bullet level 2
9268 <ul><li>bullet level 3
9269 <ol><li>Number on level 4</li></ol></li></ul></li>
9270 <li>bullet level 2
9271 <ol><li>Number on level 3</li>
9272 <li>Number on level 3</li></ol></li></ul>
9273 <ol><li>number level 2</li></ol></li>
9274 <li>Level 1
9275 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9276 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9277
9278 !! end
9279
9280 !! test
9281 1. Nested mixed wikitext and html list
9282 !! wikitext
9283 * hi
9284 * <ul><li>ho</li></ul>
9285 * hi
9286 ** ho
9287 !! html/php
9288 <ul><li> hi</li>
9289 <li> <ul><li>ho</li></ul></li>
9290 <li> hi
9291 <ul><li> ho</li></ul></li></ul>
9292
9293 !! html/parsoid
9294 <ul><li> hi</li>
9295 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9296 <li> hi
9297 <ul><li> ho</li></ul></li></ul>
9298 !! end
9299
9300 !! test
9301 2. Nested mixed wikitext and html list (incompatible)
9302 !! wikitext
9303 ; hi
9304 : {{echo|<li>ho</li>}}
9305 !! html/php
9306 <dl><dt> hi</dt>
9307 <dd> <li>ho</li></dd></dl>
9308
9309 !! html/parsoid
9310 <dl><dt> hi</dt>
9311 <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>
9312 !! end
9313
9314 !! test
9315 Nested lists 1
9316 !! wikitext
9317 *foo
9318 **bar
9319 !! html
9320 <ul><li>foo
9321 <ul><li>bar</li></ul></li></ul>
9322
9323 !! end
9324
9325 !! test
9326 Nested lists 2
9327 !! wikitext
9328 **foo
9329 *bar
9330 !! html
9331 <ul><li><ul><li>foo</li></ul></li>
9332 <li>bar</li></ul>
9333
9334 !! end
9335
9336 !! test
9337 Nested lists 3 (first element empty)
9338 !! wikitext
9339 *
9340 **bar
9341 !! html
9342 <ul><li>
9343 <ul><li>bar</li></ul></li></ul>
9344
9345 !! end
9346
9347 !! test
9348 Nested lists 4 (first element empty)
9349 !! wikitext
9350 **
9351 *bar
9352 !! html
9353 <ul><li><ul><li></li></ul></li>
9354 <li>bar</li></ul>
9355
9356 !! end
9357
9358 !! test
9359 Nested lists 5 (both elements empty)
9360 !! wikitext
9361 **
9362 *
9363 !! html
9364 <ul><li><ul><li></li></ul></li>
9365 <li></li></ul>
9366
9367 !! end
9368
9369 !! test
9370 Nested lists 6 (both elements empty)
9371 !! wikitext
9372 *
9373 **
9374 !! html
9375 <ul><li>
9376 <ul><li></li></ul></li></ul>
9377
9378 !! end
9379
9380 !! test
9381 Nested lists 7 (skip initial nesting levels)
9382 !! wikitext
9383 *** foo
9384 !! html
9385 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9386
9387 !! end
9388
9389 !! test
9390 Nested lists 8 (multiple nesting transitions)
9391 !! wikitext
9392 * foo
9393 *** bar
9394 ** baz
9395 * boo
9396 !! html
9397 <ul><li> foo
9398 <ul><li><ul><li> bar</li></ul></li>
9399 <li> baz</li></ul></li>
9400 <li> boo</li></ul>
9401
9402 !! end
9403
9404 !! test
9405 Nested lists 9 (extension interaction)
9406 !! options
9407 parsoid
9408 !! wikitext
9409 *<references />
9410 !! html/parsoid
9411 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9412 !! end
9413
9414 !! test
9415 1. Lists with start-of-line-transparent tokens before bullets: Comments
9416 !! wikitext
9417 *foo
9418 *<!--cmt-->bar
9419 <!--cmt-->*baz
9420 !! html
9421 <ul><li>foo</li>
9422 <li>bar</li>
9423 <li>baz</li></ul>
9424
9425 !! end
9426
9427 !! test
9428 2. Lists with start-of-line-transparent tokens before bullets: Template close
9429 !! wikitext
9430 *foo {{echo|bar
9431 }}*baz
9432 !! html
9433 <ul><li>foo bar</li>
9434 <li>baz</li></ul>
9435
9436 !! end
9437
9438 !! test
9439 List items are not parsed correctly following a <pre> block (bug 785)
9440 !! wikitext
9441 * <pre>foo</pre>
9442 * <pre>bar</pre>
9443 * zar
9444 !! html/php
9445 <ul><li> <pre>foo</pre></li>
9446 <li> <pre>bar</pre></li>
9447 <li> zar</li></ul>
9448
9449 !! html/parsoid
9450 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9451 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9452 <li> zar</li></ul>
9453 !! end
9454
9455 !! test
9456 List items from template
9457 !! wikitext
9458
9459 {{inner list}}
9460 * item 2
9461
9462 * item 0
9463 {{inner list}}
9464 * item 2
9465
9466 * item 0
9467 * notSOL{{inner list}}
9468 * item 2
9469 !! html
9470 <ul><li> item 1</li>
9471 <li> item 2</li></ul>
9472 <ul><li> item 0</li>
9473 <li> item 1</li>
9474 <li> item 2</li></ul>
9475 <ul><li> item 0</li>
9476 <li> notSOL</li>
9477 <li> item 1</li>
9478 <li> item 2</li></ul>
9479
9480 !! end
9481
9482 !! test
9483 List interrupted by empty line or heading
9484 !! wikitext
9485 * foo
9486
9487 ** bar
9488 == A heading ==
9489 * Another list item
9490 !! html
9491 <ul><li> foo</li></ul>
9492 <ul><li><ul><li> bar</li></ul></li></ul>
9493 <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>
9494 <ul><li> Another list item</li></ul>
9495
9496 !!end
9497
9498 !!test
9499 Multiple list tags generated by templates
9500 !! wikitext
9501 {{echo|<li>}}a
9502 {{echo|<li>}}b
9503 {{echo|<li>}}c
9504 !! html
9505 <li>a
9506 <li>b
9507 <li>c</li>
9508 </li>
9509 </li>
9510
9511 !! html+tidy
9512 <ul>
9513 <li>a</li>
9514 <li>b</li>
9515 <li>c</li>
9516 </ul>
9517 !!end
9518
9519 !!test
9520 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9521 !! wikitext
9522 *a
9523 <!--This line will NOT split the list-->
9524 *b
9525 <!--This line will NOT split the list either-->
9526 *c
9527 <!--foo--> <!----> <!--This line NOT split the list either-->
9528 *d
9529 !! html
9530 <ul><li>a</li>
9531 <li>b</li>
9532 <li>c</li>
9533 <li>d</li></ul>
9534
9535 !!end
9536
9537 !!test
9538 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9539 !! wikitext
9540 *a
9541 <!--This line will NOT split the list-->
9542 *b
9543 <!--This line will NOT split the list either-->
9544 *c
9545 <!--foo--> <!----> <!--This line NOT split the list
9546 either-->
9547 *d
9548 !! html
9549 <ul><li>a</li>
9550 <li>b</li>
9551 <li>c</li>
9552 <li>d</li></ul>
9553
9554 !!end
9555
9556 !!test
9557 Test the li-hack
9558 (The PHP parser relies on Tidy for the hack)
9559 !!options
9560 parsoid=wt2html,wt2wt
9561 !! wikitext
9562 * foo
9563 * <li>li-hack
9564 * {{echo|<li>templated li-hack}}
9565 * <!--foo--> <li> unsupported li-hack with preceding comments
9566
9567 <ul>
9568 <li><li>not a li-hack
9569 </li>
9570 </ul>
9571 !! html+tidy
9572 <ul>
9573 <li>foo</li>
9574 <li>li-hack</li>
9575 <li>templated li-hack</li>
9576 <li>unsupported li-hack with preceding comments</li>
9577 </ul>
9578 <ul>
9579 <li>not a li-hack</li>
9580 </ul>
9581 !!end
9582
9583 !! test
9584 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9585 !! options
9586 parsoid
9587 !! wikitext
9588 # foo
9589 ## bar
9590 * foo
9591 ** bar
9592 : foo
9593 :: bar
9594 !! html
9595 <ol>
9596 <li> foo<ol>
9597 <li> bar</li>
9598 </ol></li>
9599 </ol><ul>
9600 <li> foo<ul>
9601 <li> bar</li>
9602 </ul></li>
9603 </ul><dl>
9604 <dd> foo<dl>
9605 <dd> bar</dd>
9606 </dl></dd>
9607 </dl>
9608 !! end
9609
9610 !! test
9611 Parsoid: Test of whitespace serialization with Templated bullets
9612 !! options
9613 parsoid
9614 !! wikitext
9615 * {{bullet}}
9616 !! html
9617 <ul>
9618 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9619 </ul>
9620 !! end
9621
9622 # ------------------------------------------------------------------------
9623 # The next set of tests are about Parsoid's ability to handle badly nested
9624 # tags (parse, minimize scope of fixup, and roundtrip back)
9625 # ------------------------------------------------------------------------
9626
9627 !! test
9628 Unbalanced closing block tags break a list
9629 (php parser relies on Tidy to fix up)
9630 !! wikitext
9631 <div>
9632 *a</div><div>
9633 *b</div>
9634 !! html+tidy
9635 <div>
9636 <ul>
9637 <li>a</li>
9638 </ul>
9639 </div>
9640 <div>
9641 <ul>
9642 <li>b</li>
9643 </ul>
9644 </div>
9645 !! end
9646
9647 # Parsoid fails this test, but it might be tricky to support properly.
9648 # See bug 68395.
9649 !! test
9650 Unbalanced closing non-block tags don't break a list
9651 (php parser relies on Tidy to fix up)
9652 !! wikitext
9653 <span>
9654 *a</span><span>
9655 *b</span>
9656 !! html/php+tidy
9657 <ul>
9658 <li><span>a</span></li>
9659 <li><span>b</span></li>
9660 </ul>
9661 !! html/parsoid
9662 <span>
9663 <ul>
9664 <li>a<span></span>
9665 </li>
9666 <li>b
9667 </li>
9668 </ul>
9669 </span>
9670 !! end
9671
9672 !! test
9673 Unclosed formatting tags that straddle lists are closed and reopened
9674 (php parser relies on Tidy to fix up)
9675 !! options
9676 parsoid=wt2html,wt2wt,html2html
9677 !! wikitext
9678 # <s> a
9679 # b </s>
9680 !! html/php+tidy
9681 <ol>
9682 <li><s>a</s></li>
9683 <li><s>b</s></li>
9684 </ol>
9685 !! html/parsoid
9686 <ol><li> <s> a</s></li>
9687 <li><s> b </s></li></ol>
9688 !! end
9689
9690 # See bug 68395.
9691 !!test
9692 1. List embedded in a formatting tag
9693 !! wikitext
9694 <small>
9695 * foo
9696 </small>
9697 !! html/php+tidy
9698 <ul>
9699 <li><small>foo</small></li>
9700 </ul>
9701 !! html/parsoid
9702 <small>
9703 <ul>
9704 <li> foo</li>
9705 </ul>
9706 </small>
9707 !!end
9708
9709 ## Ugly Parsoid output here
9710 ## Not sure what the right output is.
9711 !!test
9712 2. List embedded in a formatting tag
9713 !! wikitext
9714 <small>
9715 *a
9716 *b</small>
9717 !! html/php+tidy
9718 <ul>
9719 <li><small>a</small></li>
9720 <li><small>b</small></li>
9721 </ul>
9722 !! html/parsoid
9723 <small></small>
9724 <ul><small>
9725 <li>a</li>
9726 </small>
9727 <li><small>b</small></li>
9728 </ul>
9729 !!end
9730
9731 # Ugly Parsoid and PHP parser output here
9732 # Not sure if we want to make this a test!
9733 #
9734 ## !!test
9735 ## 3. Unclosed formatting tags in list elements
9736 ## !! wikitext
9737 ## *<small>a
9738 ## *<small>b
9739 ## !! html/php+tidy
9740 ## <ul>
9741 ## <li><small>a</small></li>
9742 ## <li><small><small>b</small></small></li>
9743 ## </ul>
9744 ## !! html/parsoid
9745 ## <ul>
9746 ## <li><small>a</small></li>
9747 ## <small>
9748 ## <li><small>b</small></li>
9749 ## </small></ul>
9750 ## !!end
9751
9752 # This is a bug in the PHP parser + tidy combination.
9753 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9754 # and then fostered out of the table by tidy.)
9755 # We believe the Parsoid output to be correct.
9756 !! test
9757 Table with missing opening <tr> tag
9758 !! options
9759 parsoid=wt2html,wt2wt
9760 !! wikitext
9761 <table>
9762 <td>foo</td>
9763 </tr>
9764 </table>
9765 !! html+tidy
9766 <table>
9767 <tr>
9768 <td>foo</td>
9769 </tr>
9770 </table>
9771 !! end
9772
9773 ###
9774 ### Magic Words
9775 ###
9776
9777 # Note that the current date is hard-coded as
9778 # 1970-01-01T00:02:03Z (a Thursday)
9779 # when running parser tests. The timezone is also fixed to GMT, so
9780 # local date will be identical to current date.
9781
9782 !! test
9783 Magic Word: {{CURRENTDAY}}
9784 !! wikitext
9785 {{CURRENTDAY}}
9786 !! html
9787 <p>1
9788 </p>
9789 !! end
9790
9791 !! test
9792 Magic Word: {{CURRENTDAY2}}
9793 !! wikitext
9794 {{CURRENTDAY2}}
9795 !! html
9796 <p>01
9797 </p>
9798 !! end
9799
9800 !! test
9801 Magic Word: {{CURRENTDAYNAME}}
9802 !! wikitext
9803 {{CURRENTDAYNAME}}
9804 !! html
9805 <p>Thursday
9806 </p>
9807 !! end
9808
9809 !! test
9810 Magic Word: {{CURRENTDOW}}
9811 !! wikitext
9812 {{CURRENTDOW}}
9813 !! html
9814 <p>4
9815 </p>
9816 !! end
9817
9818 !! test
9819 Magic Word: {{CURRENTMONTH}}
9820 !! wikitext
9821 {{CURRENTMONTH}}
9822 !! html
9823 <p>01
9824 </p>
9825 !! end
9826
9827 !! test
9828 Magic Word: {{CURRENTMONTH1}}
9829 !! wikitext
9830 {{CURRENTMONTH1}}
9831 !! html
9832 <p>1
9833 </p>
9834 !! end
9835
9836 !! test
9837 Magic Word: {{CURRENTMONTHABBREV}}
9838 !! wikitext
9839 {{CURRENTMONTHABBREV}}
9840 !! html
9841 <p>Jan
9842 </p>
9843 !! end
9844
9845 !! test
9846 Magic Word: {{CURRENTMONTHNAME}}
9847 !! wikitext
9848 {{CURRENTMONTHNAME}}
9849 !! html
9850 <p>January
9851 </p>
9852 !! end
9853
9854 !! test
9855 Magic Word: {{CURRENTMONTHNAMEGEN}}
9856 !! wikitext
9857 {{CURRENTMONTHNAMEGEN}}
9858 !! html
9859 <p>January
9860 </p>
9861 !! end
9862
9863 !! test
9864 Magic Word: {{CURRENTTIME}}
9865 !! wikitext
9866 {{CURRENTTIME}}
9867 !! html
9868 <p>00:02
9869 </p>
9870 !! end
9871
9872 !! test
9873 Magic Word: {{CURRENTHOUR}}
9874 !! wikitext
9875 {{CURRENTHOUR}}
9876 !! html
9877 <p>00
9878 </p>
9879 !! end
9880
9881 !! test
9882 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9883 !! wikitext
9884 {{CURRENTWEEK}}
9885 !! html
9886 <p>1
9887 </p>
9888 !! end
9889
9890 !! test
9891 Magic Word: {{CURRENTYEAR}}
9892 !! wikitext
9893 {{CURRENTYEAR}}
9894 !! html
9895 <p>1970
9896 </p>
9897 !! end
9898
9899 !! test
9900 Magic Word: {{CURRENTTIMESTAMP}}
9901 !! wikitext
9902 {{CURRENTTIMESTAMP}}
9903 !! html
9904 <p>19700101000203
9905 </p>
9906 !! end
9907
9908 !! test
9909 Magic Words LOCAL (UTC)
9910 !! wikitext
9911 * {{LOCALMONTH}}
9912 * {{LOCALMONTH1}}
9913 * {{LOCALMONTHNAME}}
9914 * {{LOCALMONTHNAMEGEN}}
9915 * {{LOCALMONTHABBREV}}
9916 * {{LOCALDAY}}
9917 * {{LOCALDAY2}}
9918 * {{LOCALDAYNAME}}
9919 * {{LOCALYEAR}}
9920 * {{LOCALTIME}}
9921 * {{LOCALHOUR}}
9922 * {{LOCALWEEK}}
9923 * {{LOCALDOW}}
9924 * {{LOCALTIMESTAMP}}
9925 !! html
9926 <ul><li> 01</li>
9927 <li> 1</li>
9928 <li> January</li>
9929 <li> January</li>
9930 <li> Jan</li>
9931 <li> 1</li>
9932 <li> 01</li>
9933 <li> Thursday</li>
9934 <li> 1970</li>
9935 <li> 00:02</li>
9936 <li> 00</li>
9937 <li> 1</li>
9938 <li> 4</li>
9939 <li> 19700101000203</li></ul>
9940
9941 !! end
9942
9943 !! test
9944 Magic Word: {{FULLPAGENAME}}
9945 !! options
9946 title=[[User:Ævar Arnfjörð Bjarmason]]
9947 !! wikitext
9948 {{FULLPAGENAME}}
9949 !! html
9950 <p>User:Ævar Arnfjörð Bjarmason
9951 </p>
9952 !! end
9953
9954 !! test
9955 Magic Word: {{FULLPAGENAMEE}}
9956 !! options
9957 title=[[User:Ævar Arnfjörð Bjarmason]]
9958 !! wikitext
9959 {{FULLPAGENAMEE}}
9960 !! html
9961 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9962 </p>
9963 !! end
9964
9965 !! test
9966 Magic Word: {{TALKSPACE}}
9967 !! options
9968 title=[[User:Ævar Arnfjörð Bjarmason]]
9969 !! wikitext
9970 {{TALKSPACE}}
9971 !! html
9972 <p>User talk
9973 </p>
9974 !! end
9975
9976 !! test
9977 Magic Word: {{TALKSPACE}}, same namespace
9978 !! options
9979 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9980 !! wikitext
9981 {{TALKSPACE}}
9982 !! html
9983 <p>User talk
9984 </p>
9985 !! end
9986
9987 !! test
9988 Magic Word: {{TALKSPACE}}, main namespace
9989 !! options
9990 title=[[Parser Test]]
9991 !! wikitext
9992 {{TALKSPACE}}
9993 !! html
9994 <p>Talk
9995 </p>
9996 !! end
9997
9998 !! test
9999 Magic Word: {{TALKSPACEE}}
10000 !! options
10001 title=[[User:Ævar Arnfjörð Bjarmason]]
10002 !! wikitext
10003 {{TALKSPACEE}}
10004 !! html
10005 <p>User_talk
10006 </p>
10007 !! end
10008
10009 !! test
10010 Magic Word: {{SUBJECTSPACE}}
10011 !! options
10012 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10013 !! wikitext
10014 {{SUBJECTSPACE}}
10015 !! html
10016 <p>User
10017 </p>
10018 !! end
10019
10020 !! test
10021 Magic Word: {{SUBJECTSPACE}}, same namespace
10022 !! options
10023 title=[[User:Ævar Arnfjörð Bjarmason]]
10024 !! wikitext
10025 {{SUBJECTSPACE}}
10026 !! html
10027 <p>User
10028 </p>
10029 !! end
10030
10031 !! test
10032 Magic Word: {{SUBJECTSPACE}}, main namespace
10033 !! options
10034 title=[[Parser Test]]
10035 !! wikitext
10036 {{SUBJECTSPACE}}
10037 !! html
10038
10039 !! end
10040
10041 !! test
10042 Magic Word: {{SUBJECTSPACEE}}
10043 !! options
10044 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10045 !! wikitext
10046 {{SUBJECTSPACEE}}
10047 !! html
10048 <p>User
10049 </p>
10050 !! end
10051
10052 !! test
10053 Magic Word: {{NAMESPACE}}
10054 !! options
10055 title=[[User:Ævar Arnfjörð Bjarmason]]
10056 !! wikitext
10057 {{NAMESPACE}}
10058 !! html
10059 <p>User
10060 </p>
10061 !! end
10062
10063 !! test
10064 Magic Word: {{NAMESPACEE}}
10065 !! options
10066 title=[[User:Ævar Arnfjörð Bjarmason]]
10067 !! wikitext
10068 {{NAMESPACEE}}
10069 !! html
10070 <p>User
10071 </p>
10072 !! end
10073
10074 !! test
10075 Magic Word: {{NAMESPACENUMBER}}
10076 !! options
10077 title=[[User:Ævar Arnfjörð Bjarmason]]
10078 !! wikitext
10079 {{NAMESPACENUMBER}}
10080 !! html
10081 <p>2
10082 </p>
10083 !! end
10084
10085 !! test
10086 Magic Word: {{SUBPAGENAME}}
10087 !! options
10088 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10089 !! wikitext
10090 {{SUBPAGENAME}}
10091 !! html
10092 <p>sub ö
10093 </p>
10094 !! end
10095
10096 !! test
10097 Magic Word: {{SUBPAGENAMEE}}
10098 !! options
10099 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10100 !! wikitext
10101 {{SUBPAGENAMEE}}
10102 !! html
10103 <p>sub_%C3%B6
10104 </p>
10105 !! end
10106
10107 !! test
10108 Magic Word: {{ROOTPAGENAME}}
10109 !! options
10110 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10111 !! wikitext
10112 {{ROOTPAGENAME}}
10113 !! html
10114 <p>Ævar Arnfjörð Bjarmason
10115 </p>
10116 !! end
10117
10118 !! test
10119 Magic Word: {{ROOTPAGENAMEE}}
10120 !! options
10121 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10122 !! wikitext
10123 {{ROOTPAGENAMEE}}
10124 !! html
10125 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10126 </p>
10127 !! end
10128
10129 !! test
10130 Magic Word: {{BASEPAGENAME}}
10131 !! options
10132 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10133 !! wikitext
10134 {{BASEPAGENAME}}
10135 !! html
10136 <p>Ævar Arnfjörð Bjarmason
10137 </p>
10138 !! end
10139
10140 !! test
10141 Magic Word: {{BASEPAGENAMEE}}
10142 !! options
10143 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10144 !! wikitext
10145 {{BASEPAGENAMEE}}
10146 !! html
10147 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10148 </p>
10149 !! end
10150
10151 !! test
10152 Magic Word: {{TALKPAGENAME}}
10153 !! options
10154 title=[[User:Ævar Arnfjörð Bjarmason]]
10155 !! wikitext
10156 {{TALKPAGENAME}}
10157 !! html
10158 <p>User talk:Ævar Arnfjörð Bjarmason
10159 </p>
10160 !! end
10161
10162 !! test
10163 Magic Word: {{TALKPAGENAMEE}}
10164 !! options
10165 title=[[User:Ævar Arnfjörð Bjarmason]]
10166 !! wikitext
10167 {{TALKPAGENAMEE}}
10168 !! html
10169 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10170 </p>
10171 !! end
10172
10173 !! test
10174 Magic Word: {{SUBJECTPAGENAME}}
10175 !! options
10176 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10177 !! wikitext
10178 {{SUBJECTPAGENAME}}
10179 !! html
10180 <p>User:Ævar Arnfjörð Bjarmason
10181 </p>
10182 !! end
10183
10184 !! test
10185 Magic Word: {{SUBJECTPAGENAMEE}}
10186 !! options
10187 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10188 !! wikitext
10189 {{SUBJECTPAGENAMEE}}
10190 !! html
10191 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10192 </p>
10193 !! end
10194
10195 !! test
10196 Magic Word: {{NUMBEROFFILES}}
10197 !! wikitext
10198 {{NUMBEROFFILES}}
10199 !! html
10200 <p>7
10201 </p>
10202 !! end
10203
10204 !! test
10205 Magic Word: {{PAGENAME}}
10206 !! options
10207 title=[[User:Ævar Arnfjörð Bjarmason]]
10208 !! wikitext
10209 {{PAGENAME}}
10210 !! html
10211 <p>Ævar Arnfjörð Bjarmason
10212 </p>
10213 !! end
10214
10215 !! test
10216 Magic Word: {{PAGENAME}} with metacharacters
10217 !! options
10218 title=[['foo & bar = baz']]
10219 !! wikitext
10220 ''{{PAGENAME}}''
10221 !! html/php
10222 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10223 </p>
10224 !! html+tidy
10225 <p><i>'foo &amp; bar = baz'</i></p>
10226 !! end
10227
10228 !! test
10229 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
10230 !! options
10231 title=[[*RFC 1234 http://example.com/]]
10232 !! wikitext
10233 {{PAGENAME}}
10234 !! html/php
10235 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10236 </p>
10237 !! html+tidy
10238 <p>*RFC 1234 http://example.com/</p>
10239 !! end
10240
10241 !! test
10242 Magic Word: {{PAGENAMEE}}
10243 !! options
10244 title=[[User:Ævar Arnfjörð Bjarmason]]
10245 !! wikitext
10246 {{PAGENAMEE}}
10247 !! html
10248 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10249 </p>
10250 !! end
10251
10252 !! test
10253 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10254 !! options
10255 title=[[*RFC 1234 http://example.com/]]
10256 !! wikitext
10257 {{PAGENAMEE}}
10258 !! html/php
10259 <p>&#42;RFC_1234_http&#58;//example.com/
10260 </p>
10261 !! html+tidy
10262 <p>*RFC_1234_http://example.com/</p>
10263 !! end
10264
10265 !! test
10266 Magic Word: {{REVISIONID}}
10267 !! wikitext
10268 {{REVISIONID}}
10269 !! html
10270 <p>1337
10271 </p>
10272 !! end
10273
10274 !! test
10275 Magic Word: {{SCRIPTPATH}}
10276 !! wikitext
10277 {{SCRIPTPATH}}
10278 !! html
10279
10280 !! end
10281
10282 !! test
10283 Magic Word: {{STYLEPATH}}
10284 !! wikitext
10285 {{STYLEPATH}}
10286 !! html
10287 <p>/skins
10288 </p>
10289 !! end
10290
10291 !! test
10292 Magic Word: {{SERVER}}
10293 !! wikitext
10294 {{SERVER}}
10295 !! html
10296 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10297 </p>
10298 !! end
10299
10300 !! test
10301 Magic Word: {{SERVERNAME}}
10302 !! wikitext
10303 {{SERVERNAME}}
10304 !! html
10305 <p>example.org
10306 </p>
10307 !! end
10308
10309 !! test
10310 Magic Word: {{SITENAME}}
10311 !! wikitext
10312 {{SITENAME}}
10313 !! html
10314 <p>MediaWiki
10315 </p>
10316 !! end
10317
10318 !! test
10319 Magic Word: {{PAGELANGUAGE}}
10320 !! options
10321 language=fr
10322 !! wikitext
10323 {{PAGELANGUAGE}}
10324 !! html
10325 <p>fr
10326 </p>
10327 !! end
10328
10329 !! test
10330 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10331 !! wikitext
10332 {{PAGELANGUAGE}}
10333 !! html
10334 <p>en
10335 </p>
10336 !! end
10337
10338 !! test
10339 Case-sensitive magic words, when cased differently, should just be template transclusions
10340 !! wikitext
10341 {{CurrentMonth}}
10342 {{currentday}}
10343 {{cURreNTweEK}}
10344 {{currentHour}}
10345 !! html
10346 <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>
10347 <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>
10348 <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>
10349 <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>
10350 </p>
10351 !! end
10352
10353 !! test
10354 Case-insensitive magic words should still work with weird casing.
10355 !! wikitext
10356 {{sErVeRNaMe}}
10357 {{LCFirst:AOEU}}
10358 {{ucFIRST:aoeu}}
10359 {{SERver}}
10360 !! html
10361 <p>example.org
10362 aOEU
10363 Aoeu
10364 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10365 </p>
10366 !! end
10367
10368 # From plwiki:PLOS_ONE
10369 !! test
10370 Parsoid: Page property magic word with magic word contents
10371 !! wikitext
10372 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10373 !! html/parsoid
10374 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
10375 !! end
10376
10377 !! test
10378 Parsoid: Template-generated DISPLAYTITLE
10379 !! wikitext
10380 {{{{echo|DISPLAYTITLE}}:Foo}}
10381 !! html/parsoid
10382 <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}}]}'/>
10383 !! end
10384
10385 !! test
10386 Namespace 1 {{ns:1}}
10387 !! wikitext
10388 {{ns:1}}
10389 !! html
10390 <p>Talk
10391 </p>
10392 !! end
10393
10394 !! test
10395 Namespace 1 {{ns:01}}
10396 !! wikitext
10397 {{ns:01}}
10398 !! html
10399 <p>Talk
10400 </p>
10401 !! end
10402
10403 !! test
10404 Namespace 0 {{ns:0}} (bug 4783)
10405 !! wikitext
10406 {{ns:0}}
10407 !! html
10408
10409 !! end
10410
10411 !! test
10412 Namespace 0 {{ns:00}} (bug 4783)
10413 !! wikitext
10414 {{ns:00}}
10415 !! html
10416
10417 !! end
10418
10419 !! test
10420 Namespace -1 {{ns:-1}}
10421 !! wikitext
10422 {{ns:-1}}
10423 !! html
10424 <p>Special
10425 </p>
10426 !! end
10427
10428 !! test
10429 Namespace User {{ns:User}}
10430 !! wikitext
10431 {{ns:User}}
10432 !! html
10433 <p>User
10434 </p>
10435 !! end
10436
10437 !! test
10438 Namespace User talk {{ns:User_talk}}
10439 !! wikitext
10440 {{ns:User_talk}}
10441 !! html
10442 <p>User talk
10443 </p>
10444 !! end
10445
10446 !! test
10447 Namespace User talk {{ns:uSeR tAlK}}
10448 !! wikitext
10449 {{ns:uSeR tAlK}}
10450 !! html
10451 <p>User talk
10452 </p>
10453 !! end
10454
10455 !! test
10456 Namespace File {{ns:File}}
10457 !! wikitext
10458 {{ns:File}}
10459 !! html
10460 <p>File
10461 </p>
10462 !! end
10463
10464 !! test
10465 Namespace File {{ns:Image}}
10466 !! wikitext
10467 {{ns:Image}}
10468 !! html
10469 <p>File
10470 </p>
10471 !! end
10472
10473 !! test
10474 Namespace (lang=de) Benutzer {{ns:User}}
10475 !! options
10476 language=de
10477 !! wikitext
10478 {{ns:User}}
10479 !! html
10480 <p>Benutzer
10481 </p>
10482 !! end
10483
10484 !! test
10485 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10486 !! options
10487 language=de
10488 !! wikitext
10489 {{ns:3}}
10490 !! html
10491 <p>Benutzer Diskussion
10492 </p>
10493 !! end
10494
10495 !! test
10496 Urlencode
10497 !! wikitext
10498 {{urlencode:hi world?!}}
10499 {{urlencode:hi world?!|WIKI}}
10500 {{urlencode:hi world?!|PATH}}
10501 {{urlencode:hi world?!|QUERY}}
10502 !! html/php
10503 <p>hi+world%3F%21
10504 hi_world%3F!
10505 hi%20world%3F%21
10506 hi+world%3F%21
10507 </p>
10508 !! end
10509
10510 !! test
10511 Magic Word: prioritize type info over data-parsoid
10512 !! options
10513 parsoid=html2wt
10514 !! html/parsoid
10515 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10516 !! wikitext
10517 __FORCETOC__
10518 !! end
10519
10520 !! test
10521 Magic Word: serialize on separate line (parsoid)
10522 !! options
10523 parsoid=wt2wt,html2wt
10524 !! wikitext
10525 foo
10526 __NOTOC__
10527 bar
10528 !! html/parsoid
10529 foo<meta property="mw:PageProp/notoc"/>bar
10530 !! end
10531
10532 !! test
10533 Magic Word: rt non-english wikis
10534 !! options
10535 parsoid=wt2wt
10536 language=de
10537 !! wikitext
10538 __NOEDITSECTION__
10539 !! html/parsoid
10540 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10541 !! end
10542
10543 !!test
10544 __proto__ is treated as normal wikitext (T105997)
10545 !!wikitext
10546 __proto__
10547 !!html
10548 <p>__proto__
10549 </p>
10550 !!end
10551
10552 ###
10553 ### Magic links
10554 ###
10555 !! test
10556 Magic links: internal link to RFC (bug 479)
10557 !! wikitext
10558 [[RFC 123]]
10559 !! html/php
10560 <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>
10561 </p>
10562 !! html/parsoid
10563 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10564 !! end
10565
10566 !! test
10567 Magic links: RFC (bug 479)
10568 !! wikitext
10569 RFC 822
10570 !! html/php
10571 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10572 </p>
10573 !! html/parsoid
10574 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10575 !! end
10576
10577 !! test
10578 Magic links: RFC (bug 65278)
10579 !! wikitext
10580 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10581 !! html/php
10582 <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.
10583 </p>
10584 !! html/parsoid
10585 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10586 !! end
10587
10588 !! test
10589 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10590 !! wikitext
10591 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10592 RFC
10593 822
10594 !! html/php
10595 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10596 RFC
10597 822
10598 </p>
10599 !! html/parsoid
10600 <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>
10601 RFC
10602 822</p>
10603 !! end
10604
10605 !! test
10606 Magic links: ISBN (bug 1937)
10607 !! wikitext
10608 ISBN 0-306-40615-2
10609 !! html/php
10610 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10611 </p>
10612 !! html/parsoid
10613 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10614 !! end
10615
10616 !! test
10617 Magic links: ISBN (bug 65278)
10618 !! wikitext
10619 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10620 !! html/php
10621 <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.
10622 </p>
10623 !! html/parsoid
10624 <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>
10625 !! end
10626
10627 !! test
10628 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10629 !! wikitext
10630 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10631 ISBN
10632 9780316098113
10633 ISBN 978
10634 0316098113
10635 !! html/php
10636 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10637 ISBN
10638 9780316098113
10639 ISBN 978
10640 0316098113
10641 </p>
10642 !! html/parsoid
10643 <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>
10644 ISBN
10645 9780316098113
10646 ISBN 978
10647 0316098113</p>
10648 !! end
10649
10650 !! test
10651 Magic links: PMID incorrectly converts space to underscore
10652 !! wikitext
10653 PMID 1234
10654 !! html/php
10655 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10656 </p>
10657 !! html/parsoid
10658 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10659 !! end
10660
10661 !! test
10662 Magic links: PMID (bug 65278)
10663 !! wikitext
10664 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10665 !! html/php
10666 <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.
10667 </p>
10668 !! html/parsoid
10669 <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>
10670 !! end
10671
10672 !! test
10673 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10674 !! wikitext
10675 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10676 PMID
10677 1234
10678 !! html/php
10679 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10680 PMID
10681 1234
10682 </p>
10683 !! html/parsoid
10684 <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>
10685 PMID
10686 1234</p>
10687 !! end
10688
10689 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10690 # since these are ExtLinkText, not MagicLinkText
10691 !! test
10692 Magic links: use appropriate serialization for "almost" magic links.
10693 !! wikitext
10694 X[[Special:BookSources/0978739256|foo]]
10695
10696 X[//tools.ietf.org/html/rfc1234 foo]
10697 !! html/php
10698 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10699 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10700 </p>
10701 !! html/parsoid
10702 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10703 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10704 !! end
10705
10706 !! test
10707 Magic links: All disabled (T47942)
10708 !! options
10709 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10710 !! wikitext
10711 ISBN 0-306-40615-2
10712 PMID 1234
10713 RFC 4321
10714 !! html/php
10715 <p>ISBN 0-306-40615-2
10716 PMID 1234
10717 RFC 4321
10718 </p>
10719 !! end
10720
10721 ###
10722 ### Templates
10723 ####
10724
10725 !! test
10726 Nonexistent template
10727 !! wikitext
10728 {{thistemplatedoesnotexist}}
10729 !! html
10730 <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>
10731 </p>
10732 !! end
10733
10734 !! test
10735 Template with invalid target containing tags
10736 !! wikitext
10737 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10738 !! html
10739 <p>{{a<b>b</b>|foo|a=b|a = b}}
10740 </p>
10741 !! end
10742
10743 !! test
10744 Template with invalid target containing unclosed tag
10745 !! wikitext
10746 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10747 !! html
10748 <p>{{a<b>|foo|a=b|a = b}}</b>
10749 </p>
10750 !! end
10751
10752 !! test
10753 Template with invalid target containing wikilink
10754 !! wikitext
10755 {{[[Main Page]]}}
10756 !! html/php
10757 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10758 </p>
10759 !! html/parsoid
10760 <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>
10761 !! end
10762
10763 !! test
10764 Template with just whitespace in it, bug #68421
10765 !! wikitext
10766 {{echo|{{ }}}}
10767 !! html/parsoid
10768 <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>
10769 !! end
10770
10771 !! article
10772 Template:test
10773 !! text
10774 This is a test template
10775 !! endarticle
10776
10777 !! test
10778 Simple template
10779 !! wikitext
10780 {{test}}
10781 !! html
10782 <p>This is a test template
10783 </p>
10784 !! end
10785
10786 !! test
10787 Template with explicit namespace
10788 !! wikitext
10789 {{Template:test}}
10790 !! html
10791 <p>This is a test template
10792 </p>
10793 !! end
10794
10795
10796 !! article
10797 Template:paramtest
10798 !! text
10799 This is a test template with parameter {{{param}}}
10800 !! endarticle
10801
10802 !! test
10803 Template parameter
10804 !! wikitext
10805 {{paramtest|param=foo}}
10806 !! html
10807 <p>This is a test template with parameter foo
10808 </p>
10809 !! end
10810
10811 !! article
10812 Template:paramtestnum
10813 !! text
10814 [[{{{1}}}|{{{2}}}]]
10815 !! endarticle
10816
10817 !! test
10818 Template unnamed parameter
10819 !! wikitext
10820 {{paramtestnum|Main Page|the main page}}
10821 !! html
10822 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10823 </p>
10824 !! end
10825
10826 !! article
10827 Template:templatesimple
10828 !! text
10829 (test)
10830 !! endarticle
10831
10832 !! article
10833 Template:templateredirect
10834 !! text
10835 #redirect [[Template:templatesimple]]
10836 !! endarticle
10837
10838 !! article
10839 Template:templateasargtestnum
10840 !! text
10841 {{{{{1}}}}}
10842 !! endarticle
10843
10844 !! article
10845 Template:templateasargtest
10846 !! text
10847 {{template{{{templ}}}}}
10848 !! endarticle
10849
10850 !! article
10851 Template:templateasargtest2
10852 !! text
10853 {{{{{templ}}}}}
10854 !! endarticle
10855
10856 !! test
10857 Template with template name as unnamed argument
10858 !! wikitext
10859 {{templateasargtestnum|templatesimple}}
10860 !! html
10861 <p>(test)
10862 </p>
10863 !! end
10864
10865 !! test
10866 Template with template name as argument
10867 !! wikitext
10868 {{templateasargtest|templ=simple}}
10869 !! html
10870 <p>(test)
10871 </p>
10872 !! end
10873
10874 !! test
10875 Template with template name as argument (2)
10876 !! wikitext
10877 {{templateasargtest2|templ=templatesimple}}
10878 !! html
10879 <p>(test)
10880 </p>
10881 !! end
10882
10883 !! article
10884 Template:templateasargtestdefault
10885 !! text
10886 {{{{{templ|templatesimple}}}}}
10887 !! endarticle
10888
10889 !! article
10890 Template:templa
10891 !! text
10892 '''templ'''
10893 !! endarticle
10894
10895 !! test
10896 Template with default value
10897 !! wikitext
10898 {{templateasargtestdefault}}
10899 !! html
10900 <p>(test)
10901 </p>
10902 !! end
10903
10904 !! test
10905 Template with default value (value set)
10906 !! wikitext
10907 {{templateasargtestdefault|templ=templa}}
10908 !! html
10909 <p><b>templ</b>
10910 </p>
10911 !! end
10912
10913 !! test
10914 Template redirect
10915 !! wikitext
10916 {{templateredirect}}
10917 !! html/php
10918 <p>(test)
10919 </p>
10920 !! html/parsoid
10921 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10922 !! end
10923
10924 !! test
10925 Template with argument in separate line
10926 !! wikitext
10927 {{ templateasargtest |
10928 templ = simple }}
10929 !! html
10930 <p>(test)
10931 </p>
10932 !! end
10933
10934 !! test
10935 Template with complex template as argument
10936 !! wikitext
10937 {{paramtest|
10938 param ={{ templateasargtest |
10939 templ = simple }}}}
10940 !! html
10941 <p>This is a test template with parameter (test)
10942 </p>
10943 !! end
10944
10945 !! test
10946 Template with thumb image (with link in description)
10947 !! wikitext
10948 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10949 !! html/php
10950 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>
10951
10952 !! html+tidy
10953 <p>This is a test template with parameter</p>
10954 <div class="thumb tright">
10955 <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>
10956 <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>
10957 </div>
10958 </div>
10959 !! html/parsoid
10960 <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>
10961 !! end
10962
10963 !! article
10964 Template:complextemplate
10965 !! text
10966 {{{1}}} {{paramtest|
10967 param ={{{param}}}}}
10968 !! endarticle
10969
10970 !! test
10971 Template with complex arguments
10972 !! wikitext
10973 {{complextemplate|
10974 param ={{ templateasargtest |
10975 templ = simple }}|[[Template:complextemplate|link]]}}
10976 !! html
10977 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10978 </p>
10979 !! end
10980
10981 !! test
10982 BUG 553: link with two variables in a piped link
10983 !! wikitext
10984 {|
10985 |[[{{{1}}}|{{{2}}}]]
10986 |}
10987 !! html/php
10988 <table>
10989 <tr>
10990 <td>[[{{{1}}}|{{{2}}}]]
10991 </td></tr></table>
10992
10993 !! html/parsoid
10994 <table>
10995 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{},"i":0}}]}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"2"},"params":{},"i":0}}]}'>{{{2}}}</span>]]</td></tr>
10996 </tbody></table>
10997 !! end
10998
10999 # See: T2553
11000 !! test
11001 Abort table cell attribute parsing on wikilink
11002 !! wikitext
11003 {|
11004 | testing [[one|two]] | three || four
11005 | testing one two | three || four
11006 | testing="[[one|two]]" | three || four
11007 |}
11008 !! html/php
11009 <table>
11010 <tr>
11011 <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>
11012 <td> four
11013 </td>
11014 <td> three </td>
11015 <td> four
11016 </td>
11017 <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>
11018 <td> four
11019 </td></tr></table>
11020
11021 !! html/parsoid
11022 <table>
11023 <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>
11024 <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>
11025 <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>
11026 </tbody></table>
11027 !! end
11028
11029 !! test
11030 Don't abort table cell attribute parsing if wikilink is found in template arg
11031 !! wikitext
11032 {|
11033 | Test {{#tag:ref|One two "[[three]]" four}}
11034 |}
11035 !! html/parsoid
11036 <table>
11037 <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>
11038 </tbody></table>
11039 !! end
11040
11041 !! test
11042 Magic variable as template parameter
11043 !! wikitext
11044 {{paramtest|param={{SITENAME}}}}
11045 !! html
11046 <p>This is a test template with parameter MediaWiki
11047 </p>
11048 !! end
11049
11050 !! article
11051 Template:linktest
11052 !! text
11053 [[{{{param}}}|link]]
11054 !! endarticle
11055
11056 !! test
11057 Template parameter as link source
11058 !! wikitext
11059 {{linktest|param=Main Page}}
11060 !! html
11061 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11062 </p>
11063 !! end
11064
11065 !!article
11066 Template:paramtest2
11067 !! text
11068 including another template, {{paramtest|param={{{arg}}}}}
11069 !! endarticle
11070
11071 !! test
11072 Template passing argument to another template
11073 !! wikitext
11074 {{paramtest2|arg='hmm'}}
11075 !! html
11076 <p>including another template, This is a test template with parameter 'hmm'
11077 </p>
11078 !! end
11079
11080 !! article
11081 Template:Linktest2
11082 !! text
11083 Main Page
11084 !! endarticle
11085
11086 !! test
11087 Template as link source
11088 !! wikitext
11089 [[{{linktest2}}]]
11090
11091 [[{{linktest2}}|Main Page]]
11092
11093 [[{{linktest2}}]]Page
11094 !! html
11095 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11096 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11097 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11098 </p>
11099 !! end
11100
11101
11102 !! article
11103 Template:loop1
11104 !! text
11105 {{loop2}}
11106 !! endarticle
11107
11108 !! article
11109 Template:loop2
11110 !! text
11111 {{loop1}}
11112 !! endarticle
11113
11114 !! test
11115 Template infinite loop
11116 !! wikitext
11117 {{loop1}}
11118 !! html
11119 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11120 </p>
11121 !! end
11122
11123 !! test
11124 Template from main namespace
11125 !! wikitext
11126 {{:Main Page}}
11127 !! html
11128 <p>blah blah
11129 </p>
11130 !! end
11131
11132 !! article
11133 Template:table
11134 !! text
11135 {|
11136 | 1 || 2
11137 |-
11138 | 3 || 4
11139 |}
11140 !! endarticle
11141
11142 !! test
11143 BUG 529: Template with table, not included at beginning of line
11144 !! wikitext
11145 foo {{table}}
11146 !! html
11147 <p>foo
11148 </p>
11149 <table>
11150 <tr>
11151 <td> 1 </td>
11152 <td> 2
11153 </td></tr>
11154 <tr>
11155 <td> 3 </td>
11156 <td> 4
11157 </td></tr></table>
11158
11159 !! end
11160
11161 !! test
11162 BUG 523: Template shouldn't eat newline (or add an extra one before table)
11163 !! wikitext
11164 foo
11165 {{table}}
11166 !! html
11167 <p>foo
11168 </p>
11169 <table>
11170 <tr>
11171 <td> 1 </td>
11172 <td> 2
11173 </td></tr>
11174 <tr>
11175 <td> 3 </td>
11176 <td> 4
11177 </td></tr></table>
11178
11179 !! end
11180
11181 !! test
11182 BUG 41: Template parameters shown as broken links
11183 !! wikitext
11184 {{{parameter}}}
11185 !! html
11186 <p>{{{parameter}}}
11187 </p>
11188 !! end
11189
11190 !! test
11191 Template with targets containing wikilinks
11192 !! wikitext
11193 {{[[foo]]}}
11194
11195 {{[[{{echo|foo}}]]}}
11196
11197 {{{{echo|[[foo}}]]}}
11198 !! html
11199 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11200 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11201 </p><p>{{[[foo}}]]
11202 </p>
11203 !! end
11204
11205 !! article
11206 Template:''
11207 !! text
11208 bar
11209 !! endarticle
11210
11211 !! test
11212 Templates: Double quotes as template target
11213 !! wikitext
11214 foo {{''}} baz
11215 !! html/php
11216 <p>foo bar baz
11217 </p>
11218 !! html/parsoid
11219 <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
11220 </p>
11221 !! end
11222
11223 ## This test is about making sure Parsoid's data-mw is well formed in the
11224 ## face of multiple templates with intersecting and overlapping ranges. The
11225 ## wikitext itself is wretched.
11226 !! test
11227 Templates with intersecting and overlapping ranges
11228 !! wikitext
11229 {|{{echo|
11230 <p>ha</p>}}
11231 {|{{echo|
11232 <p>ho</p>}}
11233 {{echo|{{!}}hi}}
11234 |}
11235 !! html/php+tidy
11236 <p>ha</p>
11237 <p>ho</p>
11238 <table>
11239 <tr>
11240 <td></td>
11241 </tr>
11242 <tr>
11243 <td>hi</td>
11244 </tr>
11245 </table>
11246 <table>
11247 <tr>
11248 <td></td>
11249 </tr>
11250 </table>
11251 !! html/parsoid
11252 <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":""}]]}'>
11253
11254 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11255
11256 <tbody><tr><td>hi</td></tr>
11257 </tbody></table>
11258 !! end
11259
11260 !! article
11261 Template:MSGNW test
11262 !! text
11263 ''None'' of '''this''' should be
11264 * interpreted
11265 but rather passed unmodified
11266 {{test}}
11267 <gallery>
11268 File:Foobar.jpg
11269 </gallery>
11270 <!-- comment -->
11271 !! endarticle
11272
11273 # hmm, fix this or just deprecate msgnw and document its behavior?
11274 !! test
11275 msgnw keyword
11276 !! wikitext
11277 {{msgnw:MSGNW test}}
11278 !! html/php
11279 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11280 &#42; interpreted
11281 &#32;but rather passed unmodified
11282 &#123;&#123;test&#125;&#125;
11283 &#60;gallery&#62;
11284 File:Foobar.jpg
11285 &#60;/gallery&#62;
11286 &#60;!-- comment --&#62;
11287 </p>
11288 !! end
11289
11290 !! test
11291 int keyword
11292 !! wikitext
11293 {{int:youhavenewmessages|lots of money|not!}}
11294 !! html
11295 <p>You have lots of money (not!).
11296 </p>
11297 !! end
11298
11299 !! test
11300 int keyword - non-existing message
11301 !! wikitext
11302 {{int:var}}
11303 !! html
11304 <p>⧼var⧽
11305 </p>
11306 !! end
11307
11308 !! article
11309 Template:Includes
11310 !! text
11311 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11312 !! endarticle
11313
11314 !! test
11315 <includeonly> and <noinclude> being included
11316 !! wikitext
11317 {{Includes}}
11318 !! html
11319 <p>Foobar
11320 </p>
11321 !! end
11322
11323 !! article
11324 Template:Includes2
11325 !! text
11326 <onlyinclude>Foo</onlyinclude>bar
11327 !! endarticle
11328
11329 !! test
11330 <onlyinclude> being included
11331 !! wikitext
11332 {{Includes2}}
11333 !! html
11334 <p>Foo
11335 </p>
11336 !! end
11337
11338
11339 !! article
11340 Template:Includes3
11341 !! text
11342 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11343 !! endarticle
11344
11345 !! test
11346 <onlyinclude> and <includeonly> being included
11347 !! wikitext
11348 {{Includes3}}
11349 !! html
11350 <p>Foo
11351 </p>
11352 !! end
11353
11354 !! test
11355 <includeonly> and <noinclude> on a page
11356 !! wikitext
11357 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11358 !! html
11359 <p>Foozar
11360 </p>
11361 !! end
11362
11363 !! test
11364 Un-closed <noinclude>
11365 !! wikitext
11366 <noinclude>
11367 !! html
11368 !! end
11369
11370 !! test
11371 <onlyinclude> on a page
11372 !! wikitext
11373 <onlyinclude>Foo</onlyinclude>bar
11374 !! html
11375 <p>Foobar
11376 </p>
11377 !! end
11378
11379 !! test
11380 Un-closed <onlyinclude>
11381 !! wikitext
11382 <onlyinclude>
11383 !! html
11384 !! end
11385
11386 !!test
11387 Self-closed noinclude, includeonly, onlyinclude tags
11388 !! wikitext
11389 <noinclude />
11390 <includeonly />
11391 <onlyinclude />
11392 !! html
11393 <p><br />
11394 </p>
11395 !!end
11396
11397 !!test
11398 Unbalanced includeonly and noinclude tags
11399 !! wikitext
11400 {|
11401 |a</noinclude>
11402 |b</noinclude></noinclude>
11403 |c</noinclude></includeonly>
11404 |d</includeonly></includeonly>
11405 |}
11406 !! html
11407 <table>
11408 <tr>
11409 <td>a
11410 </td>
11411 <td>b
11412 </td>
11413 <td>c&lt;/includeonly&gt;
11414 </td>
11415 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11416 </td></tr></table>
11417
11418 !!end
11419
11420 !! article
11421 Template:Includeonly section
11422 !! text
11423 <includeonly>
11424 ==Includeonly section==
11425 </includeonly>
11426 ==Section T-1==
11427 !!endarticle
11428
11429 !! test
11430 Bug 6563: Edit link generation for section shown by <includeonly>
11431 !! wikitext
11432 {{includeonly section}}
11433 !! html
11434 <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>
11435 <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>
11436
11437 !! end
11438
11439 # Uses same input as the contents of [[Template:Includeonly section]]
11440 !! test
11441 Bug 6563: Section extraction for section shown by <includeonly>
11442 !! options
11443 section=T-2
11444 !! wikitext
11445 <includeonly>
11446 ==Includeonly section==
11447 </includeonly>
11448 ==Section T-2==
11449 !! html
11450 ==Section T-2==
11451 !! end
11452
11453 !! test
11454 Bug 6563: Edit link generation for section suppressed by <includeonly>
11455 !! wikitext
11456 <includeonly>
11457 ==Includeonly section==
11458 </includeonly>
11459 ==Section 1==
11460 !! html
11461 <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>
11462
11463 !! end
11464
11465 !! test
11466 Bug 6563: Section extraction for section suppressed by <includeonly>
11467 !! options
11468 section=1
11469 !! wikitext
11470 <includeonly>
11471 ==Includeonly section==
11472 </includeonly>
11473 ==Section 1==
11474 !! html
11475 ==Section 1==
11476 !! end
11477
11478 !! test
11479 Un-closed <includeonly>
11480 !! wikitext
11481 <includeonly>
11482 !! html/php
11483 !! html/parsoid
11484 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11485 !! end
11486
11487 ## We used to, but no longer wt2wt this test since the default serializer
11488 ## will normalize the include directives to serialize on their own line.
11489 ## Selser will take care of preserving formatting in scenarios where they
11490 ## intermingled with other wikitext.
11491 !! test
11492 Includes and comments at SOL
11493 !! options
11494 parsoid=wt2html,html2html
11495 !! wikitext
11496 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11497
11498 <noinclude>
11499 some
11500 </noinclude>* stuff
11501 * here
11502
11503 <includeonly>can have stuff</includeonly>=== here ===
11504
11505 !! html/php
11506 <h2><span class="mw-headline" id="hu">hu</span></h2>
11507 <p>some
11508 </p>
11509 <ul><li> stuff</li>
11510 <li> here</li></ul>
11511 <h3><span class="mw-headline" id="here">here</span></h3>
11512
11513 !! html/parsoid
11514 <!-- 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>
11515
11516 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11517 <p>some</p>
11518 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11519 <li> here</li></ul>
11520
11521 <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>
11522
11523 !! end
11524
11525 # TODO: test with DOM fragment reuse!
11526 !! test
11527 Parsoid: DOM fragment reuse
11528 !! options
11529 parsoid=wt2wt,wt2html
11530 !! wikitext
11531 a{{echo|b<table></table>c}}d
11532
11533 a{{echo|b
11534 <table></table>
11535 c}}d
11536
11537 {{echo|a
11538
11539 <table></table>
11540
11541 b}}
11542 !! html
11543 <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>
11544
11545 <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">
11546 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11547 </span><p about="#mwt2">cd</p>
11548
11549 <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">
11550
11551 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11552
11553 </span><p about="#mwt3">b</p>
11554 !! end
11555
11556 !! test
11557 Parsoid: Merge double tds (T52603)
11558 !! options
11559 parsoid
11560 !! wikitext
11561 {|
11562 |{{echo|{{!}} foo}}
11563 |}
11564 !! html
11565 <table><tbody>
11566 <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>
11567 </tbody></table>
11568 !! end
11569
11570 !! test
11571 Parsoid: Merge double tds in nested transclusion content (T52603)
11572 !! options
11573 parsoid
11574 !! wikitext
11575 {{echo|<div>}}
11576 {|
11577 |{{echo|{{!}} foo}}
11578 |}
11579 {{echo|</div>}}
11580 !! html
11581 <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}}]}'>
11582 <table><tbody>
11583 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11584 </tbody></table>
11585 </div>
11586 !! end
11587
11588 ###
11589 ### <includeonly> and <noinclude> in attributes
11590 ###
11591 !!test
11592 0. includeonly around the entire attribute
11593 !! wikitext
11594 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11595 !! html
11596 <p><span id="v2">bar</span>
11597 </p>
11598 !!end
11599
11600 !!test
11601 1. includeonly in html attr key
11602 !! wikitext
11603 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11604 !! html
11605 <p><span id="foo">bar</span>
11606 </p>
11607 !!end
11608
11609 !!test
11610 2. includeonly in html attr value
11611 !! wikitext
11612 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11613 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11614 !! html
11615 <p><span id="v1">bar</span>
11616 <span id="v1">bar</span>
11617 </p>
11618 !!end
11619
11620 !!test
11621 3. includeonly in part of an attr value
11622 !! wikitext
11623 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11624 !! html
11625 <p><span style="color:red;">bar</span>
11626 </p>
11627 !!end
11628
11629 !!test
11630 4. includeonly in table attributes
11631 !! wikitext
11632 {|
11633 |- <noinclude>
11634 |-
11635 |a
11636 </noinclude>
11637 |- <includeonly>
11638 |-
11639 |b
11640 </includeonly>
11641 |}
11642 !! html
11643 <table>
11644
11645
11646 <tr>
11647 <td>a
11648 </td></tr>
11649 </table>
11650
11651 !!end
11652
11653 ###
11654 ### Token Stream Patcher tests
11655 ###
11656 ### These tests won't always pass wt2wt and other modes because
11657 ### on serialization, the table will be output on a new line.
11658 ### For now, we are blacklisting them, and using this to test selser.
11659 ###
11660
11661 !!test
11662 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11663 !!options
11664 parsoid=wt2html,wt2wt
11665 !!wikitext
11666 {{echo|}}{| width = '100%'
11667 |foo
11668 |}
11669 !!html/parsoid
11670 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11671 <tbody><tr><td>foo</td></tr>
11672 </tbody></table>
11673 !!end
11674
11675 ## We used to, but no longer wt2wt this test since the default serializer
11676 ## will normalize the include directives to serialize on their own line.
11677 ## Selser will take care of preserving formatting in scenarios where they
11678 ## intermingled with other wikitext.
11679 !!test
11680 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11681 !!options
11682 parsoid=wt2html
11683 !!wikitext
11684 <includeonly>a</includeonly>{| {{{b}}}
11685 |c
11686 |}
11687 !!html/parsoid
11688 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}' data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[31,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"b\"},\"params\":{},\"i\":0}}]}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
11689 <tbody><tr><td>c</td></tr>
11690 </tbody></table>
11691 !!end
11692
11693 !! test
11694 Table wikitext syntax outside wiki-tables
11695 !! wikitext
11696 a
11697 |+ not a caption
11698 ! not a table heading
11699 |- not a table row
11700 | not a table cell
11701 | class="foo bar" | baz
11702 b
11703 |}
11704 |-
11705 c
11706 !! html
11707 <p>a
11708 |+ not a caption
11709 ! not a table heading
11710 |- not a table row
11711 | not a table cell
11712 | class="foo bar" | baz
11713 b
11714 |}
11715 |-
11716 c
11717 </p>
11718 !! end
11719
11720 ###
11721 ### Testing parsing of templates where a template arg
11722 ### has the same name as the template itself.
11723 ###
11724
11725 !! article
11726 Template:quote
11727 !! text
11728 {{{quote|{{{1}}}}}}
11729 !! endarticle
11730
11731 !!test
11732 Templates: Template Name/Arg clash: 1. Use of positional param
11733 !! wikitext
11734 {{quote|foo}}
11735 !! html
11736 <p>foo
11737 </p>
11738 !!end
11739
11740 !!test
11741 Templates: Template Name/Arg clash: 2. Use of named param
11742 !! wikitext
11743 {{quote|quote=foo}}
11744 !! html
11745 <p>foo
11746 </p>
11747 !!end
11748
11749 !!test
11750 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11751 !! wikitext
11752 {{quote|quote}}
11753 !! html
11754 <p>quote
11755 </p>
11756 !!end
11757
11758 ###
11759 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11760 ###
11761
11762 !!test
11763 Templates: 1. Simple use
11764 !! wikitext
11765 {{echo|Foo}}
11766 !! html
11767 <p>Foo
11768 </p>
11769 !!end
11770
11771 !!test
11772 Templates: 2. Inside a block tag
11773 !! wikitext
11774 <div>{{echo|Foo}}</div>
11775 <blockquote>{{echo|Foo}}</blockquote>
11776 !! html
11777 <div>Foo</div>
11778 <blockquote>Foo</blockquote>
11779
11780 !! html+tidy
11781 <div>Foo</div>
11782 <blockquote>
11783 <p>Foo</p>
11784 </blockquote>
11785 !!end
11786
11787 !!test
11788 Templates: P-wrapping: 1a. Templates on consecutive lines
11789 !! wikitext
11790 {{echo|Foo}}
11791 {{echo|bar}}
11792 !! html
11793 <p>Foo
11794 bar
11795 </p>
11796 !!end
11797
11798 !!test
11799 Templates: P-wrapping: 1b. Templates on consecutive lines
11800 !! wikitext
11801 Foo
11802
11803 {{echo|bar}}
11804 {{echo|baz}}
11805 !! html
11806 <p>Foo
11807 </p><p>bar
11808 baz
11809 </p>
11810 !!end
11811
11812 !!test
11813 Templates: P-wrapping: 1c. Templates on consecutive lines
11814 !! wikitext
11815 {{echo|Foo}}
11816 {{echo|bar}} <div>baz</div>
11817 !! html
11818 <p>Foo
11819 </p>
11820 bar <div>baz</div>
11821
11822 !! html+tidy
11823 <p>Foo</p>
11824 <p>bar</p>
11825 <div>baz</div>
11826 !! end
11827
11828 !!test
11829 Templates: P-wrapping: 1d. Template preceded by comment-only line
11830 !!options
11831 parsoid
11832 !! wikitext
11833 <!-- foo -->
11834 {{echo|Bar}}
11835 !! html
11836 <!-- foo -->
11837
11838 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11839 !!end
11840
11841 !!test
11842 Templates: Inline Text: 1. Multiple template uses
11843 !! wikitext
11844 {{echo|Foo}}bar{{echo|baz}}
11845 !! html
11846 <p>Foobarbaz
11847 </p>
11848 !!end
11849
11850 !!test
11851 Templates: Inline Text: 2. Back-to-back template uses
11852 !! wikitext
11853 {{echo|Foo}}{{echo|bar}}
11854 !! html
11855 <p>Foobar
11856 </p>
11857 !!end
11858
11859 !!test
11860 Templates: Block Tags: 1. Multiple template uses
11861 !! wikitext
11862 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11863 !! html
11864 <div>Foo</div><div>bar</div><div>baz</div>
11865
11866 !!end
11867
11868 !!test
11869 Templates: Block Tags: 2. Back-to-back template uses
11870 !! wikitext
11871 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11872 !! html
11873 <div>Foo</div><div>bar</div>
11874
11875 !!end
11876
11877 # This is an edge case relating to paragraph wrapping.
11878 !!test
11879 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11880 !! wikitext
11881 {{echo|a
11882 b</p>}}
11883 !! html/parsoid
11884 <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
11885 b</p>
11886 !!end
11887
11888 !!test
11889 Templates: Links: 1. Simple example
11890 !! wikitext
11891 {{echo|[[Foo|bar]]}}
11892 !! html
11893 <p><a href="/wiki/Foo" title="Foo">bar</a>
11894 </p>
11895 !!end
11896
11897 !!test
11898 Templates: Links: 2. Generation of link href
11899 !! wikitext
11900 [[{{echo|Foo}}|bar]]
11901 !! html
11902 <p><a href="/wiki/Foo" title="Foo">bar</a>
11903 </p>
11904 !!end
11905
11906 !!test
11907 Templates: Links: 3. Generation of part of a link href
11908 !! wikitext
11909 [[Fo{{echo|o}}|bar]]
11910
11911 [[Foo{{echo|bar}}]]
11912
11913 [[Foo{{echo|bar}}baz]]
11914
11915 [[Foo{{echo|bar}}|bar]]
11916
11917 [[:Foo{{echo|bar}}]]
11918
11919 [[:Foo{{echo|bar}}|bar]]
11920 !! html
11921 <p><a href="/wiki/Foo" title="Foo">bar</a>
11922 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11923 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11924 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11925 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11926 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11927 </p>
11928 !!end
11929
11930 !!test
11931 Templates: Links: 4. Multiple templates generating link href
11932 !! wikitext
11933 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11934 !! html
11935 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11936 </p>
11937 !!end
11938
11939 !!test
11940 Templates: Links: 5. Generation of link text
11941 !! wikitext
11942 [[Foo|{{echo|bar}}]]
11943 !! html
11944 <p><a href="/wiki/Foo" title="Foo">bar</a>
11945 </p>
11946 !!end
11947
11948 !!test
11949 Templates: Links: 5. Nested templates (only outermost template should be marked)
11950 !! wikitext
11951 {{echo|[[{{echo|Foo}}|bar]]}}
11952 !! html
11953 <p><a href="/wiki/Foo" title="Foo">bar</a>
11954 </p>
11955 !!end
11956
11957 !!test
11958 Templates: HTML Tag: 1. Generation of HTML attr. key
11959 !! wikitext
11960 <div {{echo|style}}="color:red;">foo</div>
11961 !! html
11962 <div style="color:red;">foo</div>
11963
11964 !!end
11965
11966 !!test
11967 Templates: HTML Tag: 2. Generation of HTML attr. value
11968 !! wikitext
11969 <div style={{echo|'color:red;'}}>foo</div>
11970 !! html
11971 <div style="color:red;">foo</div>
11972
11973 !!end
11974
11975 !!test
11976 Templates: HTML Tag: 3. Generation of HTML attr key and value
11977 !! wikitext
11978 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11979 !! html
11980 <div style="color:red;">foo</div>
11981
11982 !!end
11983
11984 !!test
11985 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11986 !! wikitext
11987 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11988 !! html
11989 <div title="This is a long title with just one piece templated">foo</div>
11990
11991 !!end
11992
11993 !!test
11994 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11995 !! wikitext
11996 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11997 !! html
11998 <div title="This is a long title with just one piece templated">foo</div>
11999
12000 !!end
12001
12002 !!test
12003 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12004 !! wikitext
12005 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12006 !! html
12007 <div title="This is a long title with just one piece templated">foo</div>
12008
12009 !!end
12010
12011 # SSS FIXME: While it is great we added support for all this,
12012 # do we want to make this part of the spec? Maybe we want to
12013 # deprecate this kind of usage in the future?
12014 !!test
12015 Templates: HTML Tag: 7. Generation of partial attribute key string
12016 !! wikitext
12017 <div st{{echo|yle}}="color:red;">foo</div>
12018 !! html
12019 <div style="color:red;">foo</div>
12020
12021 !!end
12022
12023 !! test
12024 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12025 !! wikitext
12026 <div {{echo|1=id="v1"}}>bar</div>
12027 !! html
12028 <div id="v1">bar</div>
12029
12030 !!end
12031
12032 !! test
12033 Templates: HTML Tag: 9. Multiple template-generated attributes
12034 !! wikitext
12035 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12036 !! html
12037 <div id="v1" title="foo">bar</div>
12038
12039 !!end
12040
12041 !! test
12042 Templates: Support for templates generating attributes and content
12043 !! wikitext
12044 {| {{mixed_attr_content_template}}
12045 |-
12046 |bar
12047 |}
12048 !! html/php
12049 <table style="color:red;" title="T48811">
12050
12051 <tr>
12052 <td>foo
12053 </td></tr>
12054 <tr>
12055 <td>bar
12056 </td></tr></table>
12057
12058 !! html/parsoid
12059 <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|}"]}'>
12060 <tbody><tr>
12061 <td>foo</td></tr>
12062 <tr>
12063 <td>bar</td></tr>
12064 </tbody></table>
12065 !!end
12066
12067 !! test
12068 1. Entities and nowikis inside templated attributes should be handled correctly
12069 !! wikitext
12070 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12071 !! html/php
12072 <div style="background:#f9f9f9;">foo</div>
12073
12074 !! html/parsoid
12075 <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>
12076 !! end
12077
12078 !! test
12079 2. Entities and nowikis inside templated attributes should be handled correctly
12080 !! wikitext
12081 {|
12082 |{{table_attribs_3}}
12083 |}
12084 !! html/php
12085 <table>
12086 <tr>
12087 <td style="background:#f9f9f9;">Foo
12088 </td></tr></table>
12089
12090 !! html/parsoid
12091 <table>
12092 <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>
12093 </tbody></table>
12094 !! end
12095
12096 !! test
12097 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12098 !! wikitext
12099 {{tbl-start}}
12100 |{{table_attribs_3}}
12101 {{tbl-end}}
12102 !! html/php
12103 <table>
12104 <tr>
12105 <td style="background:#f9f9f9;">Foo
12106 </td></tr></table>
12107
12108 !! html/parsoid
12109 <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}}]}'>
12110 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12111 </tbody></table>
12112 !! end
12113
12114 # T107622
12115 !! test
12116 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12117 !! wikitext
12118 {|
12119 | {{table_attribs_6}} hi
12120 |}
12121 !! html/php
12122 <table>
12123 <tr>
12124 <td style="background: red;"> hi
12125 </td></tr></table>
12126
12127 !! html/parsoid
12128 <table>
12129 <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>
12130 </tbody></table>
12131 !! end
12132
12133 !!test
12134 Templates: HTML Tables: 1. Generating start of a HTML table
12135 !! wikitext
12136 {{echo|<table><tr><td>foo</td>}}</tr></table>
12137 !! html
12138 <table><tr><td>foo</td></tr></table>
12139
12140 !!end
12141
12142 !!test
12143 Templates: HTML Tables: 2a. Generating middle of a HTML table
12144 !! wikitext
12145 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12146 !! html
12147 <table><tr><td>foo</td></tr></table>
12148
12149 !!end
12150
12151 !!test
12152 Templates: HTML Tables: 2b. Generating middle of a HTML table
12153 !! wikitext
12154 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12155 !! html
12156 <table><tr><td>foo</td></tr></table>
12157
12158 !!end
12159
12160 !!test
12161 Templates: HTML Tables: 3. Generating end of a HTML table
12162 !! wikitext
12163 <table><tr>{{echo|<td>foo</td></tr></table>}}
12164 !! html
12165 <table><tr><td>foo</td></tr></table>
12166
12167 !!end
12168
12169 !!test
12170 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12171 !! wikitext
12172 {{echo|<table>}}<tr><td>foo</td></tr></table>
12173 !! html
12174 <table><tr><td>foo</td></tr></table>
12175
12176 !!end
12177
12178 !!test
12179 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12180 !! wikitext
12181 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12182 !! html
12183 <table><tr><td>foo</td></tr></table>
12184
12185 !!end
12186
12187 !!test
12188 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12189 !! wikitext
12190 <table><tr>{{echo|<td>}}foo</td></tr></table>
12191 !! html
12192 <table><tr><td>foo</td></tr></table>
12193
12194 !!end
12195
12196 !!test
12197 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12198 !! wikitext
12199 <table><tr><td>foo{{echo|</td>}}</tr></table>
12200 !! html
12201 <table><tr><td>foo</td></tr></table>
12202
12203 !!end
12204
12205 !!test
12206 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12207 !! wikitext
12208 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12209 !! html
12210 <table><tr><td>foo</td></tr></table>
12211
12212 !!end
12213
12214 !!test
12215 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12216 !! wikitext
12217 <table><tr><td>foo</td></tr>{{echo|</table>}}
12218 !! html
12219 <table><tr><td>foo</td></tr></table>
12220
12221 !!end
12222
12223 !!test
12224 Templates: HTML Tables: 5. Proper fostering of categories from inside
12225 !!options
12226 parsoid=wt2html,wt2wt
12227 !! wikitext
12228 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12229 <!--Two categories (Bug 50330)-->
12230 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12231 !! html
12232 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12233 <!--Two categories (Bug 50330)-->
12234 <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>
12235 !!end
12236
12237 !!test
12238 Templates: Wiki Tables: 1a. Fostering of entire template content
12239 !! wikitext
12240 {|
12241 {{echo|a}}
12242 |}
12243 !! html
12244 <table>
12245 a
12246 <tr><td></td></tr></table>
12247
12248 !! html+tidy
12249 <p>a</p>
12250 <table>
12251 <tr>
12252 <td></td>
12253 </tr>
12254 </table>
12255 !! end
12256
12257 !!test
12258 Templates: Wiki Tables: 1b. Fostering of entire template content
12259 !! wikitext
12260 {|
12261 {{echo|<div>}}
12262 foo
12263 {{echo|</div>}}
12264 |}
12265 !! html
12266 <table>
12267 <div>
12268 <p>foo
12269 </p>
12270 </div>
12271 <tr><td></td></tr></table>
12272
12273 !! html+tidy
12274 <div>
12275 <p>foo</p>
12276 </div>
12277 <table>
12278 <tr>
12279 <td></td>
12280 </tr>
12281 </table>
12282 !! end
12283
12284 !!test
12285 Templates: Wiki Tables: 2. Fostering of partial template content
12286 !! wikitext
12287 {|
12288 {{echo|a
12289 <div>b</div>}}
12290 |}
12291 !! html
12292 <table>
12293 a
12294 <div>b</div>
12295 <tr><td></td></tr></table>
12296
12297 !! html+tidy
12298 <p>a</p>
12299 <div>b</div>
12300 <table>
12301 <tr>
12302 <td></td>
12303 </tr>
12304 </table>
12305 !! end
12306
12307 !!test
12308 Templates: Wiki Tables: 3. td-content via multiple templates
12309 !! wikitext
12310 {|
12311 {{echo|{{pipe}}a}}{{echo|b}}
12312 |}
12313 !! html
12314 <table>
12315 <tr>
12316 <td>ab
12317 </td></tr></table>
12318
12319 !!end
12320
12321 !!test
12322 Templates: Wiki Tables: 4. Templated tags, no content
12323 !! wikitext
12324 {{tbl-start}}
12325 {{tbl-end}}
12326 !! html
12327 <table>
12328 <tr><td></td></tr></table>
12329
12330 !!end
12331
12332 !!test
12333 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12334 !! wikitext
12335 {{tbl-start}}
12336 |foo
12337 {{tbl-end}}
12338 !! html
12339 <table>
12340 <tr>
12341 <td>foo
12342 </td></tr></table>
12343
12344 !!end
12345
12346 !!test
12347 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12348 !! wikitext
12349 {{tbl-start}}
12350 {{!}}foo
12351 {{tbl-end}}
12352 !! html
12353 <table>
12354 <tr>
12355 <td>foo
12356 </td></tr></table>
12357
12358 !!end
12359
12360 ## This test case is very specific to Parsoid's internals
12361 ## and is hence only tested for Parsoid's code. Parsoid uses
12362 ## a <meta> marker tag for <ref> tags and they are expanded
12363 ## much later. We are verifying that this <meta> tag usage
12364 ## doesn't prevent foster parenting.
12365 !!test
12366 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12367 !!wikitext
12368 {{PartialTable}}<ref>foo</ref>
12369 |}
12370
12371 <references />
12372 !!html/parsoid
12373 <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">
12374 <tbody>
12375 </tbody></table>
12376
12377 <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>
12378 !!end
12379
12380 !! test
12381 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12382 !! wikitext
12383 {{echo|
12384 {{{!}}
12385 {{!}}-}}
12386 <onlyinclude>
12387 |foo
12388 </onlyinclude>
12389 {{!}}}
12390 !! html/parsoid
12391 <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{{!}}}"]}'>
12392 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12393 <tbody><tr>
12394
12395 <td>foo
12396 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12397 </tbody></table>
12398 !! end
12399
12400 !!test
12401 Templates: Lists: Multi-line list-items via templates
12402 !! wikitext
12403 *{{echo|a {{nonexistent|
12404 unused}}}}
12405 *{{echo|b {{nonexistent|
12406 unused}}}}
12407 !! html
12408 <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>
12409 <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>
12410
12411 !!end
12412
12413 !!test
12414 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12415 !! wikitext
12416 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12417 !! html
12418 <p><i>ab</i>c<i>d</i>e
12419 </p>
12420 !!end
12421
12422 !!test
12423 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12424 (PHP parser generates misnested html)
12425 !! wikitext
12426 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12427 !! html/parsoid
12428 <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>
12429 !!end
12430
12431 !!test
12432 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12433 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12434 !! options
12435 parsoid=wt2html,wt2wt
12436 !! wikitext
12437 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12438 !! html
12439 <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>
12440 <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>
12441 <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>
12442 !!end
12443
12444 !!test
12445 Templates: Ugly nesting: 4. Divs opened/closed across templates
12446 !! wikitext
12447 a<div>b{{echo|c</div>d}}e
12448 !! html
12449 a<div>bc</div>de
12450
12451 !! html+tidy
12452 <p>a</p>
12453 <div>bc</div>
12454 <p>de</p>
12455 !! end
12456
12457 !!test
12458 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12459 (Parsoid-centric)
12460 !! options
12461 parsoid
12462 !! wikitext
12463 {|
12464 |{{echo|foo</table>}}
12465 |bar
12466 |}
12467 !! html
12468 <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|}"]}'>
12469
12470 <tbody>
12471 <tr>
12472 <td>foo</td></tr></tbody></table><span about="#mwt1">
12473 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12474 |}</span>
12475 !!end
12476
12477 !!test
12478 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12479 (Parsoid-centric)
12480 !! options
12481 parsoid
12482 !! wikitext
12483 <table>
12484 <tr>
12485 <td>
12486 <table>
12487 <tr>
12488 <td>1. {{echo|foo </table>}}</td>
12489 <td> bar </td>
12490 <td>2. {{echo|baz </table>}}</td>
12491 </tr>
12492 <tr>
12493 <td>abc</td>
12494 </tr>
12495 </table>
12496 </td>
12497 </tr>
12498 <tr>
12499 <td>xyz</td>
12500 </tr>
12501 </table>
12502 !! html
12503 <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>"]}'>
12504 <tbody><tr>
12505 <td>
12506 <table>
12507 <tbody><tr>
12508 <td>1. foo </td></tr></tbody></table></td>
12509 <td> bar </td>
12510 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12511 </span><span about="#mwt2">
12512 </span><span about="#mwt2">
12513 </span><span about="#mwt2">abc</span><span about="#mwt2">
12514 </span><span about="#mwt2">
12515 </span><span about="#mwt2">
12516 </span><span about="#mwt2">
12517 </span><span about="#mwt2">
12518 </span><span about="#mwt2">
12519 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12520 </span><span about="#mwt2">
12521 </span>
12522 !!end
12523
12524 !! test
12525 Templates: Ugly templates: 3. newline-only template parameter
12526 !! wikitext
12527 foo {{echo|
12528 }}
12529 !! html
12530 <p>foo
12531 </p>
12532 !! end
12533
12534 # This looks like a bug: a single newline triggers p/br for some reason.
12535 !! test
12536 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12537 !! wikitext
12538 {{echo|
12539 }}
12540 !! html
12541 <p><br />
12542 </p>
12543 !! end
12544
12545 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12546 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12547 !! test
12548 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12549 !! wikitext
12550 {{echo|<table>}}
12551 {{echo|<div>foo}}
12552 {{echo|</table>}}
12553 !! html/parsoid
12554 <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
12555 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12556 </table>
12557 !! end
12558
12559 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12560 # that are "identical" and generate nesting cycles in the algorithm
12561 !! test
12562 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12563 !! wikitext
12564 {{echo|<table><tr><td><table>}}
12565 {{echo|<div>}}
12566 {{echo|</div>}}
12567 !! html/parsoid
12568 <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"}'>
12569 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12570 </table></td></tr></tbody></table>
12571 !! end
12572
12573 !! test
12574 Templates: Parameters substituted at the top-level
12575 !! wikitext
12576 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12577
12578 {{{foo|bar|baz}}}
12579 !! html/php
12580 <p><i>who</i> me? <b>never!</b>
12581 </p><p>bar
12582 </p>
12583 !! html/parsoid
12584 <p about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"&#39;&#39;who&#39;&#39; {{echo|me}}? &#39;&#39;&#39;never!&#39;&#39;&#39;"}},"i":0}}]}'><i>who</i> me? <b>never!</b></p>
12585
12586 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
12587 !! end
12588
12589 !!test
12590 Parser Functions: 1. Simple example
12591 !! wikitext
12592 {{uc:foo}}
12593 !! html
12594 <p>FOO
12595 </p>
12596 !!end
12597
12598 !!test
12599 Parser Functions: 2. Nested use (only outermost should be marked up)
12600 !! wikitext
12601 {{uc:{{lc:FOO}}}}
12602 !! html
12603 <p>FOO
12604 </p>
12605 !!end
12606
12607 ###
12608 ### Pre-save transform tests
12609 ###
12610 !! test
12611 pre-save transform: subst:
12612 !! options
12613 pst
12614 !! wikitext
12615 {{subst:test}}
12616 !! html/php
12617 This is a test template
12618 !! end
12619
12620 !! test
12621 pre-save transform: normal template
12622 !! options
12623 pst
12624 !! wikitext
12625 {{test}}
12626 !! html/php
12627 {{test}}
12628 !! end
12629
12630 !! test
12631 pre-save transform: nonexistent template
12632 !! options
12633 pst
12634 !! wikitext
12635 {{thistemplatedoesnotexist}}
12636 !! html/php
12637 {{thistemplatedoesnotexist}}
12638 !! end
12639
12640 !! test
12641 pre-save transform: subst magic variables
12642 !! options
12643 pst
12644 !! wikitext
12645 {{subst:SITENAME}}
12646 !! html/php
12647 MediaWiki
12648 !! end
12649
12650 # This is bug 89, which I fixed. -- wtm
12651 !! test
12652 pre-save transform: subst: templates with parameters
12653 !! options
12654 pst
12655 !! wikitext
12656 {{subst:paramtest|param="something else"}}
12657 !! html/php
12658 This is a test template with parameter "something else"
12659 !! end
12660
12661 !! article
12662 Template:nowikitest
12663 !! text
12664 <nowiki>'''not wiki'''</nowiki>
12665 !! endarticle
12666
12667 !! test
12668 pre-save transform: nowiki in subst (bug 1188)
12669 !! options
12670 pst
12671 !! wikitext
12672 {{subst:nowikitest}}
12673 !! html/php
12674 <nowiki>'''not wiki'''</nowiki>
12675 !! end
12676
12677 !! article
12678 Template:commenttest
12679 !! text
12680 This template has <!-- a comment --> in it.
12681 !! endarticle
12682
12683 !! test
12684 pre-save transform: comment in subst (bug 1936)
12685 !! options
12686 pst
12687 !! wikitext
12688 {{subst:commenttest}}
12689 !! html/php
12690 This template has <!-- a comment --> in it.
12691 !! end
12692
12693 !! test
12694 pre-save transform: unclosed tag
12695 !! options
12696 pst
12697 !! wikitext
12698 <nowiki>'''not wiki'''
12699 !! html/php
12700 <nowiki>'''not wiki'''
12701 !! end
12702
12703 !! test
12704 pre-save transform: mixed tag case
12705 !! options
12706 pst
12707 !! wikitext
12708 <NOwiki>'''not wiki'''</noWIKI>
12709 !! html/php
12710 <NOwiki>'''not wiki'''</noWIKI>
12711 !! end
12712
12713 !! test
12714 pre-save transform: unclosed comment in <nowiki>
12715 !! options
12716 pst
12717 !! wikitext
12718 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12719 !! html/php
12720 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12721 !!end
12722
12723 # Leading @ in this template definition works around a limitation
12724 # in parsoid's parserTests which otherwise strips the <span> from the
12725 # result (confusing it for a template wrapper)
12726 !! article
12727 Template:dangerous
12728 !!text
12729 @<span onmouseover="alert('crap')">Oh no</span>
12730 !!endarticle
12731
12732 !!test
12733 (confirming safety of fix for subst bug 1936)
12734 !! wikitext
12735 {{Template:dangerous}}
12736 !! html
12737 <p>@<span>Oh no</span>
12738 </p>
12739 !! end
12740
12741 !! test
12742 pre-save transform: comment containing gallery (bug 5024)
12743 !! options
12744 pst
12745 !! wikitext
12746 <!-- <gallery>data</gallery> -->
12747 !! html/php
12748 <!-- <gallery>data</gallery> -->
12749 !!end
12750
12751 !! test
12752 pre-save transform: comment containing extension
12753 !! options
12754 pst
12755 !! wikitext
12756 <!-- <tag>data</tag> -->
12757 !! html/php
12758 <!-- <tag>data</tag> -->
12759 !!end
12760
12761 !! test
12762 pre-save transform: comment containing nowiki
12763 !! options
12764 pst
12765 !! wikitext
12766 <!-- <nowiki>data</nowiki> -->
12767 !! html/php
12768 <!-- <nowiki>data</nowiki> -->
12769 !!end
12770
12771 !! test
12772 pre-save transform: <noinclude> in subst (bug 3298)
12773 !! options
12774 pst
12775 !! wikitext
12776 {{subst:Includes}}
12777 !! html/php
12778 Foobar
12779 !! end
12780
12781 !! test
12782 pre-save transform: <onlyinclude> in subst (bug 3298)
12783 !! options
12784 pst
12785 !! wikitext
12786 {{subst:Includes2}}
12787 !! html/php
12788 Foo
12789 !! end
12790
12791 !! article
12792 Template:SubstTest
12793 !!text
12794 {{<includeonly>subst:</includeonly>Includes}}
12795 !! endarticle
12796
12797 !! article
12798 Template:SafeSubstTest
12799 !! text
12800 {{<includeonly>safesubst:</includeonly>Includes}}
12801 !! endarticle
12802
12803 !! test
12804 bug 22297: safesubst: works during PST
12805 !! options
12806 pst
12807 !! wikitext
12808 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12809 !! html/php
12810 FoobarFoobar
12811 !! end
12812
12813 !! test
12814 bug 22297: safesubst: works during normal parse
12815 !! wikitext
12816 {{SafeSubstTest}}
12817 !! html
12818 <p>Foobar
12819 </p>
12820 !! end
12821
12822 !! test
12823 subst: does not work during normal parse
12824 !! wikitext
12825 {{SubstTest}}
12826 !! html
12827 <p>{{subst:Includes}}
12828 </p>
12829 !! end
12830
12831 !! test
12832 pre-save transform: context links ("pipe trick")
12833 !! options
12834 pst
12835 !! wikitext
12836 [[Article (context)|]]
12837 [[Bar:Article|]]
12838 [[:Bar:Article|]]
12839 [[Bar:Article (context)|]]
12840 [[:Bar:Article (context)|]]
12841 [[|Article]]
12842 [[|Article (context)]]
12843 [[Bar:X (Y) Z|]]
12844 [[:Bar:X (Y) Z|]]
12845 !! html/php
12846 [[Article (context)|Article]]
12847 [[Bar:Article|Article]]
12848 [[:Bar:Article|Article]]
12849 [[Bar:Article (context)|Article]]
12850 [[:Bar:Article (context)|Article]]
12851 [[Article]]
12852 [[Article (context)]]
12853 [[Bar:X (Y) Z|X (Y) Z]]
12854 [[:Bar:X (Y) Z|X (Y) Z]]
12855 !! end
12856
12857 !! test
12858 pre-save transform: context links ("pipe trick") with interwiki prefix
12859 !! options
12860 pst
12861 !! wikitext
12862 [[interwiki:Article|]]
12863 [[:interwiki:Article|]]
12864 [[interwiki:Bar:Article|]]
12865 [[:interwiki:Bar:Article|]]
12866 !! html/php
12867 [[interwiki:Article|Article]]
12868 [[:interwiki:Article|Article]]
12869 [[interwiki:Bar:Article|Bar:Article]]
12870 [[:interwiki:Bar:Article|Bar:Article]]
12871 !! end
12872
12873 !! test
12874 pre-save transform: context links ("pipe trick") with parens in title
12875 !! options
12876 pst title=[[Somearticle (context)]]
12877 !! wikitext
12878 [[|Article]]
12879 !! html/php
12880 [[Article (context)|Article]]
12881 !! end
12882
12883 !! test
12884 pre-save transform: context links ("pipe trick") with comma in title
12885 !! options
12886 pst title=[[Someplace, Somewhere]]
12887 !! wikitext
12888 [[|Otherplace]]
12889 [[Otherplace, Elsewhere|]]
12890 [[Otherplace, Elsewhere, Anywhere|]]
12891 !! html/php
12892 [[Otherplace, Somewhere|Otherplace]]
12893 [[Otherplace, Elsewhere|Otherplace]]
12894 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12895 !! end
12896
12897 !! test
12898 pre-save transform: context links ("pipe trick") with parens and comma
12899 !! options
12900 pst title=[[Someplace (IGNORED), Somewhere]]
12901 !! wikitext
12902 [[|Otherplace]]
12903 [[Otherplace (place), Elsewhere|]]
12904 !! html/php
12905 [[Otherplace, Somewhere|Otherplace]]
12906 [[Otherplace (place), Elsewhere|Otherplace]]
12907 !! end
12908
12909 !! test
12910 pre-save transform: context links ("pipe trick") with comma and parens
12911 !! options
12912 pst title=[[Who, me? (context)]]
12913 !! wikitext
12914 [[|Yes, you.]]
12915 [[Me, Myself, and I (1937 song)|]]
12916 !! html/php
12917 [[Yes, you. (context)|Yes, you.]]
12918 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12919 !! end
12920
12921 !! test
12922 pre-save transform: context links ("pipe trick") with namespace
12923 !! options
12924 pst title=[[Ns:Somearticle]]
12925 !! wikitext
12926 [[|Article]]
12927 !! html/php
12928 [[Ns:Article|Article]]
12929 !! end
12930
12931 !! test
12932 pre-save transform: context links ("pipe trick") with namespace and parens
12933 !! options
12934 pst title=[[Ns:Somearticle (context)]]
12935 !! wikitext
12936 [[|Article]]
12937 !! html/php
12938 [[Ns:Article (context)|Article]]
12939 !! end
12940
12941 !! test
12942 pre-save transform: context links ("pipe trick") with namespace and comma
12943 !! options
12944 pst title=[[Ns:Somearticle, Context, Whatever]]
12945 !! wikitext
12946 [[|Article]]
12947 !! html/php
12948 [[Ns:Article, Context, Whatever|Article]]
12949 !! end
12950
12951 !! test
12952 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12953 !! options
12954 pst title=[[Ns:Somearticle, Context (context)]]
12955 !! wikitext
12956 [[|Article]]
12957 !! html/php
12958 [[Ns:Article (context)|Article]]
12959 !! end
12960
12961 !! test
12962 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12963 !! options
12964 pst title=[[Ns:Somearticle (IGNORED), Context]]
12965 !! wikitext
12966 [[|Article]]
12967 !! html/php
12968 [[Ns:Article, Context|Article]]
12969 !! end
12970
12971 !! test
12972 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12973 !! options
12974 pst
12975 !! wikitext
12976 [[Article(context)|]]
12977 [[Bar:Article(context)|]]
12978 [[:Bar:Article(context)|]]
12979 [[|Article(context)]]
12980 [[Bar:X(Y)Z|]]
12981 [[:Bar:X(Y)Z|]]
12982 !! html/php
12983 [[Article(context)|Article]]
12984 [[Bar:Article(context)|Article]]
12985 [[:Bar:Article(context)|Article]]
12986 [[Article(context)]]
12987 [[Bar:X(Y)Z|X(Y)Z]]
12988 [[:Bar:X(Y)Z|X(Y)Z]]
12989 !! end
12990
12991 !! test
12992 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12993 !! options
12994 pst
12995 !! wikitext
12996 [[Article (context)|]]
12997 [[Bar:Article (context)|]]
12998 [[:Bar:Article (context)|]]
12999 [[|Article (context)]]
13000 [[Bar:X (Y) Z|]]
13001 [[:Bar:X (Y) Z|]]
13002 !! html/php
13003 [[Article (context)|Article]]
13004 [[Bar:Article (context)|Article]]
13005 [[:Bar:Article (context)|Article]]
13006 [[Article (context)]]
13007 [[Bar:X (Y) Z|X (Y) Z]]
13008 [[:Bar:X (Y) Z|X (Y) Z]]
13009 !! end
13010
13011 !! test
13012 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
13013 !! options
13014 pst
13015 !! wikitext
13016 [[Article(context)|]]
13017 [[Bar:Article(context)|]]
13018 [[:Bar:Article(context)|]]
13019 [[|Article(context)]]
13020 [[Bar:X(Y)Z|]]
13021 [[:Bar:X(Y)Z|]]
13022 !! html/php
13023 [[Article(context)|Article]]
13024 [[Bar:Article(context)|Article]]
13025 [[:Bar:Article(context)|Article]]
13026 [[Article(context)]]
13027 [[Bar:X(Y)Z|X(Y)Z]]
13028 [[:Bar:X(Y)Z|X(Y)Z]]
13029 !! end
13030
13031 !! test
13032 pre-save transform: context links ("pipe trick") with commas (bug 21660)
13033 !! options
13034 pst
13035 !! wikitext
13036 [[Article (context), context|]]
13037 [[Article (context),context|]]
13038 [[Bar:Article (context), context|]]
13039 [[Bar:Article (context),context|]]
13040 [[:Bar:Article (context), context|]]
13041 [[:Bar:Article (context),context|]]
13042 !! html/php
13043 [[Article (context), context|Article]]
13044 [[Article (context),context|Article]]
13045 [[Bar:Article (context), context|Article]]
13046 [[Bar:Article (context),context|Article]]
13047 [[:Bar:Article (context), context|Article]]
13048 [[:Bar:Article (context),context|Article]]
13049 !! end
13050
13051 !! test
13052 pre-save transform: trim trailing empty lines
13053 !! options
13054 pst
13055 !! wikitext
13056 Empty lines are trimmed
13057
13058
13059
13060
13061 !! html/php
13062 Empty lines are trimmed
13063 !! end
13064
13065 !! test
13066 pre-save transform: Signature expansion
13067 !! options
13068 pst
13069 !! wikitext
13070 * ~~~
13071 * <noinclude>~~~</noinclude>
13072 * <includeonly>~~~</includeonly>
13073 * <onlyinclude>~~~</onlyinclude>
13074 !! html/php
13075 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13076 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13077 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13078 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13079 !! end
13080
13081
13082 !! test
13083 pre-save transform: Signature expansion in nowiki tags (bug 93)
13084 !! options
13085 pst disabled
13086 !! wikitext
13087 Shall not expand:
13088
13089 <nowiki>~~~~</nowiki>
13090
13091 <includeonly><nowiki>~~~~</nowiki></includeonly>
13092
13093 <noinclude><nowiki>~~~~</nowiki></noinclude>
13094
13095 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13096
13097 {{subst:Foo}} shall be converted to FOO
13098
13099 As well as inside noinclude/onlyinclude
13100 <noinclude>{{subst:Foo}}</noinclude>
13101 <onlyinclude>{{subst:Foo}}</onlyinclude>
13102
13103 But not inside includeonly
13104 <includeonly>{{subst:Foo}}</includeonly>
13105 !! html/php
13106 Shall not expand:
13107
13108 <nowiki>~~~~</nowiki>
13109
13110 <includeonly><nowiki>~~~~</nowiki></includeonly>
13111
13112 <noinclude><nowiki>~~~~</nowiki></noinclude>
13113
13114 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13115
13116 FOO shall be converted to FOO
13117
13118 As well as inside noinclude/onlyinclude
13119 <noinclude>FOO</noinclude>
13120 <onlyinclude>FOO</onlyinclude>
13121
13122 But not inside includeonly
13123 <includeonly>{{subst:Foo}}</includeonly>
13124 !! end
13125
13126 !! test
13127 Parsoid: Recognize nowiki with trailing space in tags
13128 !! options
13129 parsoid=wt2html
13130 !! wikitext
13131 <nowiki ><div>[[foo]]</nowiki >
13132
13133 a<nowiki / >b
13134
13135 c<nowiki />d
13136
13137 e<nowiki/ >f
13138 !! html
13139 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13140 <p>ab</p>
13141 <p>cd</p>
13142 <p>ef</p>
13143 !! end
13144
13145 !! test
13146 Parsoid: Recognize nowiki with odd capitalization
13147 !! options
13148 parsoid=wt2html
13149 !! wikitext
13150 <noWikI ><div>[[foo]]</Nowiki >
13151 !! html
13152 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13153 !! end
13154
13155
13156 !! test
13157 Parsoid: Escape nowiki with trailing space in tags
13158 !! options
13159 parsoid=html2wt
13160 !! html/parsoid
13161 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13162 <p>a&lt;nowiki /&gt;b</p>
13163 <p>c&lt;nowiki/ &gt;d</p>
13164 !! wikitext
13165 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13166
13167 a&lt;nowiki /&gt;b
13168
13169 c&lt;nowiki/ &gt;d
13170 !! end
13171
13172 !! test
13173 Parsoid: Escape weird noWikI capitalizations
13174 !! options
13175 parsoid=html2wt
13176 !! html/parsoid
13177 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13178 !! wikitext
13179 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13180 !! end
13181
13182 ###
13183 ### Message transform tests
13184 ###
13185 !! test
13186 message transform: magic variables
13187 !! options
13188 msg
13189 !! wikitext
13190 {{SITENAME}}
13191 !! html
13192 MediaWiki
13193 !! end
13194
13195 !! test
13196 message transform: should not transform wiki markup
13197 !! options
13198 msg
13199 !! wikitext
13200 ''test''
13201 !! html
13202 ''test''
13203 !! end
13204
13205 !! test
13206 message transform: <noinclude> in transcluded template (bug 4926)
13207 !! options
13208 msg
13209 !! wikitext
13210 {{Includes}}
13211 !! html
13212 Foobar
13213 !! end
13214
13215 !! test
13216 message transform: <onlyinclude> in transcluded template (bug 4926)
13217 !! options
13218 msg
13219 !! wikitext
13220 {{Includes2}}
13221 !! html
13222 Foo
13223 !! end
13224
13225 !! test
13226 {{#special:}} page name, known
13227 !! options
13228 msg
13229 !! wikitext
13230 {{#special:Recentchanges}}
13231 !! html
13232 Special:RecentChanges
13233 !! end
13234
13235 !! test
13236 {{#special:}} page name with subpage, known
13237 !! options
13238 msg
13239 !! wikitext
13240 {{#special:Recentchanges/param}}
13241 !! html
13242 Special:RecentChanges/param
13243 !! end
13244
13245 !! test
13246 {{#special:}} page name, unknown
13247 !! options
13248 msg
13249 !! wikitext
13250 {{#special:foobar nonexistent}}
13251 !! html
13252 Special:Foobar nonexistent
13253 !! end
13254
13255 !! test
13256 {{#speciale:}} page name, known
13257 !! options
13258 msg
13259 !! wikitext
13260 {{#speciale:Recentchanges}}
13261 !! html
13262 Special:RecentChanges
13263 !! end
13264
13265 !! test
13266 {{#speciale:}} page name with subpage, known
13267 !! options
13268 msg
13269 !! wikitext
13270 {{#speciale:Recentchanges/param}}
13271 !! html
13272 Special:RecentChanges/param
13273 !! end
13274
13275 !! test
13276 {{#speciale:}} page name, unknown
13277 !! options
13278 msg
13279 !! wikitext
13280 {{#speciale:foobar nonexistent}}
13281 !! html
13282 Special:Foobar_nonexistent
13283 !! end
13284
13285 ###
13286 ### Images
13287 ###
13288 ### For Parsoid-specific tests, see
13289 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13290
13291 !! test
13292 Simple image
13293 !! options
13294 parsoid=wt2html,wt2wt,html2html
13295 !! wikitext
13296 [[Image:foobar.jpg]]
13297 !! html/php
13298 <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>
13299 </p>
13300 !! html/parsoid
13301 <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>
13302 !! end
13303
13304 !! test
13305 Simple image (using File: namespace, now canonical)
13306 !! wikitext
13307 [[File:Foobar.jpg]]
13308 !! html/php
13309 <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>
13310 </p>
13311 !! html/parsoid
13312 <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>
13313 !! end
13314
13315 !! test
13316 Right-aligned image
13317 !! wikitext
13318 [[File:Foobar.jpg|right]]
13319 !! html/php
13320 <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>
13321
13322 !! html/parsoid
13323 <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>
13324 !! end
13325
13326 !! test
13327 Image with caption
13328 !! wikitext
13329 [[File:Foobar.jpg|right|Caption text]]
13330 !! html/php
13331 <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>
13332
13333 !! html/parsoid
13334 <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>
13335 !! end
13336
13337 !! test
13338 Image with caption, bug 53312 #1
13339 !! wikitext
13340 [[File:Foobar.jpg|right|Caption page stuff]]
13341 !! html/php
13342 <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>
13343
13344 !! html/parsoid
13345 <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>
13346 !! end
13347
13348 !! test
13349 Image with caption, bug 53312 #2
13350 !! wikitext
13351 [[File:Foobar.jpg|right|Caption page=]]
13352 !! html/php
13353 <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>
13354
13355 !! html/parsoid
13356 <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>
13357 !! end
13358
13359 !! test
13360 Image with caption, bug 53312 #3
13361 !! wikitext
13362 [[File:Foobar.jpg|right|Caption page=stuff]]
13363 !! html/php
13364 <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>
13365
13366 !! html/parsoid
13367 <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>
13368 !! end
13369
13370 !! test
13371 Allow empty links in image captions (Bug 60753)
13372 !! options
13373 thumbsize=220
13374 !! wikitext
13375 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13376 [[]]
13377 [[Link2]]
13378 ]]
13379 !! html/php
13380 <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>
13381
13382 !! html/parsoid
13383 <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>
13384 [[]]
13385 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13386 </figcaption></figure>
13387 !! end
13388
13389 !! test
13390 Titles in unlinked images (T23454)
13391 !! wikitext
13392 [[File:Foobar.jpg|link=|stuff]]
13393 !! html/php
13394 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13395 </p>
13396 !! end
13397
13398 !! test
13399 Link with empty target
13400 !! wikitext
13401 [[]]
13402 !! html
13403 <p>[[]]
13404 </p>
13405 !! end
13406
13407 !! test
13408 Image with link trail
13409 !! wikitext
13410 Linktrails should not work for images: [[File:Foobar.jpg]]s
13411 !! html/php
13412 <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
13413 </p>
13414 !! html/parsoid
13415 <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>
13416 !! end
13417
13418 !! test
13419 Image with empty attribute
13420 !! options
13421 parsoid=wt2html,wt2wt,html2html
13422 !! wikitext
13423 [[File:Foobar.jpg|right||Caption text]]
13424 !! html/php
13425 <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>
13426
13427 !! html/parsoid
13428 <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>
13429 !! end
13430
13431 !! test
13432 1. Block image with individual attributes from templates
13433 !! wikitext
13434 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13435 !! html/php
13436 <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>
13437
13438 !! html/parsoid
13439 <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>
13440 !! end
13441
13442 !! test
13443 2. Block Image with individual attributes from templates
13444 !! wikitext
13445 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13446 !! html/php
13447 <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>
13448
13449 !! html/parsoid
13450 <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>
13451 !! end
13452
13453 !! test
13454 3. Inline image with individual attributes from templates
13455 !! wikitext
13456 [[File:Foobar.jpg|{{echo|50px}}]]
13457 !! html/php
13458 <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>
13459 </p>
13460 !! html/parsoid
13461 <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>
13462 !! end
13463
13464 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13465 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13466 !! test
13467 Image with multiple attributes from the same template
13468 !! wikitext
13469 [[File:Foobar.jpg|{{image_attribs}}]]
13470 !! html/php
13471 <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>
13472
13473 !! html/parsoid
13474 <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>
13475 !! end
13476
13477 !! test
13478 Image with link tails
13479 !! options
13480 thumbsize=220
13481 !! wikitext
13482 123[[File:Foobar.jpg]]456
13483 123[[File:Foobar.jpg|right]]456
13484 123[[File:Foobar.jpg|thumb]]456
13485 !! html/php
13486 <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
13487 </p>
13488 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
13489 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
13490
13491 !! html/php+tidy
13492 <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>
13493 <p>123</p>
13494 <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>
13495 <p>456 123</p>
13496 <div class="thumb tright">
13497 <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>
13498 <div class="thumbcaption">
13499 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13500 </div>
13501 </div>
13502 </div>
13503 <p>456</p>
13504 !! html/parsoid
13505 <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>
13506 <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>
13507 <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>
13508 !! end
13509
13510 !! test
13511 Image with multiple captions -- only last one is accepted
13512 !! wikitext
13513 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13514 !! html/php
13515 <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>
13516
13517 !! html/parsoid
13518 <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>
13519 !! end
13520
13521 !! test
13522 Image with multiple widths -- use last
13523 !! wikitext
13524 [[File:Foobar.jpg|200px|300px|caption]]
13525 !! html/php
13526 <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>
13527 </p>
13528 !! html/parsoid
13529 <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>
13530 !! end
13531
13532 !! test
13533 Image with multiple alignments -- use first (bug 48664)
13534 !! options
13535 thumbsize=220
13536 !! wikitext
13537 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13538
13539 [[File:Foobar.jpg|middle|text-top|caption]]
13540 !! html/php
13541 <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>
13542 <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>
13543 </p>
13544 !! html/parsoid
13545 <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>
13546 <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>
13547 !! end
13548
13549 !! test
13550 Image with width attribute at different positions
13551 !! wikitext
13552 [[File:Foobar.jpg|200px|right|Caption]]
13553 [[File:Foobar.jpg|right|200px|Caption]]
13554 [[File:Foobar.jpg|right|Caption|200px]]
13555 !! html/php
13556 <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>
13557 <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>
13558 <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>
13559
13560 !! html/parsoid
13561 <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>
13562 <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>
13563 <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>
13564 !! end
13565
13566 # a sad bit of backward-compatibility
13567 !! test
13568 Image with size specified with pxpx (bug 13500, 51628)
13569 !! options
13570 parsoid=wt2html,wt2wt,html2html
13571 !! wikitext
13572 [[File:Foobar.jpg|20pxpx]]
13573 [[File:Foobar.jpg|200x20pxpx]]
13574 !! html/php
13575 <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>
13576 <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>
13577 </p>
13578 !! html/parsoid
13579 <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>
13580 !! end
13581
13582 !! test
13583 Image with link parameter, wiki target
13584 !! wikitext
13585 [[File:Foobar.jpg|link=Main Page]]
13586 !! html/php
13587 <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>
13588 </p>
13589 !! html/parsoid
13590 <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>
13591 !! end
13592
13593 # parsoid bug 49293 (part 1)
13594 !! test
13595 Image with link parameter, URL target
13596 !! wikitext
13597 [[File:Foobar.jpg|link=http://example.com/]]
13598 !! html/php
13599 <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>
13600 </p>
13601 !! html/parsoid
13602 <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>
13603 !! end
13604
13605 # parsoid bug 49293 (part 2)
13606 !! test
13607 Image with link parameter, protocol-less URL target
13608 !! wikitext
13609 [[File:Foobar.jpg|link=//example.com/]]
13610 !! html/php
13611 <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>
13612 </p>
13613 !! html/parsoid
13614 <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>
13615 !! end
13616
13617 !! test
13618 Escaping non-block captions (T107435)
13619 !! options
13620 parsoid={
13621 "modes": ["wt2wt"],
13622 "changes": [
13623 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13624 ]
13625 }
13626 !! wikitext
13627 [[Image:Foobar.jpg|caption]]
13628 !! wikitext/edited
13629 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13630 !! end
13631
13632 # wgExternalLinkTarget not supported by Parsoid
13633 !! test
13634 Image with link parameter, wgExternalLinkTarget
13635 !! wikitext
13636 [[Image:foobar.jpg|link=http://example.com/]]
13637 !! config
13638 wgExternalLinkTarget='foobar'
13639 !! html/php
13640 <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>
13641 </p>
13642 !! end
13643
13644 !! test
13645 Image with link parameter, wgNoFollowLinks set to false
13646 !! wikitext
13647 [[Image:foobar.jpg|link=http://example.com/]]
13648 !! config
13649 wgNoFollowLinks=false
13650 !! html
13651 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13652 </p>
13653 !! end
13654
13655 !! test
13656 Image with link parameter, wgNoFollowDomainExceptions
13657 !! wikitext
13658 [[Image:foobar.jpg|link=http://example.com/]]
13659 !! config
13660 wgNoFollowDomainExceptions='example.com'
13661 !! html
13662 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13663 </p>
13664 !! end
13665
13666 # wgExternalLinkTarget not supported by Parsoid
13667 !! test
13668 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13669 !! wikitext
13670 [[Image:foobar.jpg|link=http://example.com/|Title]]
13671 !! config
13672 wgExternalLinkTarget='foobar'
13673 !! html/php
13674 <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>
13675 </p>
13676 !! end
13677
13678 !! test
13679 Image with empty link parameter
13680 !! wikitext
13681 [[File:Foobar.jpg|link=]]
13682 !! html/php
13683 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13684 </p>
13685 !! html/parsoid
13686 <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>
13687 !! end
13688
13689 !! test
13690 Image with link parameter (wiki target) and unnamed parameter
13691 !! wikitext
13692 [[File:Foobar.jpg|link=Main_Page|Title]]
13693 !! html/php
13694 <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>
13695 </p>
13696 !! html/parsoid
13697 <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>
13698 !! end
13699
13700 !! test
13701 Image with link parameter (URL target) and unnamed parameter
13702 !! wikitext
13703 [[File:Foobar.jpg|link=http://example.com/|Title]]
13704 !! html/php
13705 <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>
13706 </p>
13707 !! html/parsoid
13708 <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>
13709 !! end
13710
13711 !! test
13712 Thumbnail image with link parameter
13713 !! options
13714 thumbsize=220
13715 parsoid=wt2html,wt2wt,html2html
13716 !! wikitext
13717 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13718 !! html/php
13719 <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>
13720
13721 !! html/parsoid
13722 <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>
13723 !! end
13724
13725 !! test
13726 Manually-specified thumbnail image
13727 !! options
13728 thumbsize=220
13729 !! wikitext
13730 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13731 !! html/php
13732 <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>
13733
13734 !! html/parsoid
13735 <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>
13736 !! end
13737
13738 !! test
13739 Manually-specified thumbnail image with explicit link to wiki page
13740 !! options
13741 thumbsize=220
13742 parsoid=wt2html,wt2wt,html2html
13743 !! wikitext
13744 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13745 !! html/php
13746 <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>
13747
13748 !! html/parsoid
13749 <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>
13750 !! end
13751
13752 !! test
13753 Manually-specified thumbnail image with explicit link to url
13754 !! options
13755 thumbsize=220
13756 parsoid=wt2html,wt2wt,html2html
13757 !! wikitext
13758 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13759 !! html/php
13760 <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>
13761
13762 !! html/parsoid
13763 <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>
13764 !! end
13765
13766 !! test
13767 Manually-specified thumbnail image with explicit no link
13768 !! options
13769 thumbsize=220
13770 parsoid=wt2html,wt2wt,html2html
13771 !! wikitext
13772 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13773 !! html/php
13774 <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>
13775
13776 !! html/parsoid
13777 <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>
13778 !! end
13779
13780 !! test
13781 Manually-specified thumbnail image with explicit link and alt text
13782 !! options
13783 thumbsize=220
13784 parsoid=wt2html,wt2wt,html2html
13785 !! wikitext
13786 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13787 !! html/php
13788 <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>
13789
13790 !! html/parsoid
13791 <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>
13792 !! end
13793
13794 !! test
13795 Image with frame and link
13796 !! options
13797 parsoid=wt2html,wt2wt,html2html
13798 !! wikitext
13799 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13800 !! html/php
13801 <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>
13802
13803 !! html/parsoid
13804 <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>
13805 !! end
13806
13807 !! test
13808 Image with frame and link and explicit alt
13809 !! options
13810 parsoid=wt2html,wt2wt,html2html
13811 !! wikitext
13812 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13813 !! html/php
13814 <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>
13815
13816 !! html/parsoid
13817 <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>
13818 !! end
13819
13820 !! test
13821 Image with wiki markup in implicit alt
13822 !! wikitext
13823 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13824
13825 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13826 !! html/php
13827 <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>
13828 </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>
13829 </p>
13830 !! html/parsoid
13831 <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>
13832
13833 <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>
13834 !! end
13835
13836 !! test
13837 Alt image option should handle most kinds of wikitext without barfing
13838 !! wikitext
13839 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13840 !! html/php
13841 <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>
13842
13843 !! html/parsoid
13844 <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>
13845 !! end
13846
13847 ###################
13848 # Conflicting image format options.
13849 # First option specified should 'win'.
13850 # All three cases in each test should be identical.
13851
13852 !! test
13853 Image with 'frameless' first.
13854 !! options
13855 parsoid=wt2html,wt2wt,html2html
13856 !! wikitext
13857 [[File:Foobar.jpg|frameless|caption]]
13858
13859 [[File:Foobar.jpg|frameless|frame|caption]]
13860
13861 [[File:Foobar.jpg|frameless|thumb|caption]]
13862 !! html/php
13863 <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>
13864 </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>
13865 </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>
13866 </p>
13867 !! html/parsoid
13868 <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>
13869 <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>
13870 <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>
13871 !! end
13872
13873 !! test
13874 Image with 'frame' first.
13875 !! options
13876 parsoid=wt2html,wt2wt,html2html
13877 !! wikitext
13878 [[File:Foobar.jpg|frame|caption]]
13879 [[File:Foobar.jpg|frame|frameless|caption]]
13880 [[File:Foobar.jpg|frame|thumb|caption]]
13881 !! html/php
13882 <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>
13883 <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>
13884 <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>
13885
13886 !! html/parsoid
13887 <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>
13888 <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>
13889 <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>
13890 !! end
13891
13892 !! test
13893 Image with 'thumb' first.
13894 !! options
13895 parsoid=wt2html,wt2wt,html2html
13896 !! wikitext
13897 [[File:Foobar.jpg|thumb|caption]]
13898 [[File:Foobar.jpg|thumb|frameless|caption]]
13899 [[File:Foobar.jpg|thumb|frame|caption]]
13900 !! html/php
13901 <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>
13902 <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>
13903 <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>
13904
13905 !! html/parsoid
13906 <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>
13907 <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>
13908 <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>
13909 !! end
13910
13911 ###################
13912 # Image sizing.
13913 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13914 # and https://phabricator.wikimedia.org/T64258
13915 # Foobar has actual size of 1941x220
13916 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13917 # a scalable format.
13918 # 2. Framed images always ignore size options; always render at default size.
13919 # 3. "Unspecified format" and border are the only types which can be
13920 # enlarged.
13921
13922 !! test
13923 Image: "unspecified format" and border enlarge
13924 !! options
13925 parsoid=wt2html,wt2wt,html2html
13926 !! wikitext
13927 [[File:Foobar.jpg|2000px]]
13928
13929 [[File:Foobar.jpg|border|2000px]]
13930 !! html/php
13931 <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>
13932 </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>
13933 </p>
13934 !! html/parsoid
13935 <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>
13936 <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>
13937 !! end
13938
13939 !! test
13940 Image: "unspecified format" and border reduce
13941 !! options
13942 parsoid=wt2html,wt2wt,html2html
13943 !! wikitext
13944 [[File:Foobar.jpg|1000px]]
13945
13946 [[File:Foobar.jpg|border|1000px]]
13947 !! html/php
13948 <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>
13949 </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>
13950 </p>
13951 !! html/parsoid
13952 <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>
13953 <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>
13954 !! end
13955
13956 !! test
13957 Image: thumbs reduce
13958 !! options
13959 parsoid=wt2html,wt2wt,html2html
13960 !! wikitext
13961 [[File:Foobar.jpg|thumb|50px]]
13962 !! html/php
13963 <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>
13964
13965 !! html/parsoid
13966 <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>
13967 !! end
13968
13969 !! test
13970 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13971 !! options
13972 parsoid=wt2html,wt2wt,html2html
13973 !! wikitext
13974 [[File:Foobar.jpg|thumb|2000px]]
13975
13976 [[File:Foobar.svg|thumb|2000px]]
13977 !! html/php
13978 <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>
13979 <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>
13980
13981 !! html/parsoid
13982 <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>
13983 <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>
13984 !! end
13985
13986 !! test
13987 Image: frameless can reduce in size
13988 !! options
13989 parsoid=wt2html,wt2wt,html2html
13990 !! wikitext
13991 [[File:Foobar.jpg|frameless|50px]]
13992 !! html/php
13993 <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>
13994 </p>
13995 !! html/parsoid
13996 <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>
13997 !! end
13998
13999 !! test
14000 Image: bitmap frameless can't be enlarged past original size, but vector can
14001 !! options
14002 parsoid=wt2html,wt2wt,html2html
14003 !! wikitext
14004 [[File:Foobar.jpg|frameless|2000px]]
14005
14006 [[File:Foobar.svg|frameless|2000px]]
14007 !! html/php
14008 <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>
14009 </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>
14010 </p>
14011 !! html/parsoid
14012 <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>
14013 <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>
14014 !! end
14015
14016 !! test
14017 Image: framed images are always unscaled.
14018 !! options
14019 parsoid=wt2html,wt2wt,html2html
14020 !! wikitext
14021 [[File:Foobar.jpg|frame]]
14022
14023 [[File:Foobar.jpg|frame|50px]]
14024
14025 [[File:Foobar.jpg|frame|50x50px]]
14026
14027 [[File:Foobar.jpg|frame|2000px]]
14028 !! html/php
14029 <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>
14030 <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>
14031 <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>
14032 <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>
14033
14034 !! html/parsoid
14035 <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>
14036 <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>
14037 <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>
14038 <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>
14039 !! end
14040
14041 ###################
14042
14043 !! test
14044 Link to image page- image page normally doesn't exists, hence edit link
14045 Add test with existing image page
14046 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14047 !! wikitext
14048 [[:Image:test]]
14049 !! html
14050 <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>
14051 </p>
14052 !! end
14053
14054 !! test
14055 bug 18784 Link to non-existent image page with caption should use caption as link text
14056 !! wikitext
14057 [[:Image:test|caption]]
14058 !! html
14059 <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>
14060 </p>
14061 !! end
14062
14063 !! test
14064 Frameless image caption with a free URL
14065 !! wikitext
14066 [[File:Foobar.jpg|http://example.com]]
14067 !! html/php
14068 <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>
14069 </p>
14070 !! html/parsoid
14071 <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>
14072 !! end
14073
14074 !! test
14075 Thumbnail image caption with a free URL
14076 !! options
14077 thumbsize=220
14078 !! wikitext
14079 [[File:Foobar.jpg|thumb|http://example.com]]
14080 !! html/php
14081 <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>
14082
14083 !! html/parsoid
14084 <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>
14085 !! end
14086
14087 !! test
14088 Thumbnail image caption with a free URL and explicit alt
14089 !! options
14090 thumbsize=220
14091 parsoid=wt2html,wt2wt,html2html
14092 !! wikitext
14093 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14094 !! html/php
14095 <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>
14096
14097 !! html/parsoid
14098 <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>
14099 !! end
14100
14101 !! test
14102 SVG thumbnails with no language set
14103 !! options
14104 !! wikitext
14105 [[File:Foobar.svg|thumb|caption]]
14106 !! html/php
14107 <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>
14108
14109 !! html/parsoid
14110 <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>
14111 !! end
14112
14113 !! test
14114 SVG thumbnails with language de
14115 !! options
14116 parsoid=wt2html,wt2wt,html2html
14117 !! wikitext
14118 [[File:Foobar.svg|thumb|caption|lang=de]]
14119 !! html/php
14120 <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>
14121
14122 !! html/parsoid
14123 <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>
14124 !! end
14125
14126 !! test
14127 SVG thumbnails with invalid language code
14128 !! options
14129 parsoid=wt2html,wt2wt,html2html
14130 !! wikitext
14131 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14132 !! html/php
14133 <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>
14134
14135 !! html/parsoid
14136 <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>
14137 !! end
14138
14139 !! test
14140 BUG 1887: A ISBN with a thumbnail
14141 !! wikitext
14142 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14143 !! html/php
14144 <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>
14145
14146 !! html/parsoid
14147 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/1235467890" rel="mw:WikiLink">ISBN 1235467890</a></figcaption></figure>
14148 !! end
14149
14150 !! test
14151 BUG 1887: A RFC with a thumbnail
14152 !! wikitext
14153 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14154 !! html/php
14155 <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>
14156
14157 !! html/parsoid
14158 <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>
14159 !! end
14160
14161 !! test
14162 BUG 1887: A mailto link with a thumbnail
14163 !! wikitext
14164 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14165 !! html/php
14166 <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>
14167
14168 !! html/parsoid
14169 <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>
14170 !! end
14171
14172 # Pending resolution to bug 368
14173 !! test
14174 BUG 648: Frameless image caption with a link
14175 !! wikitext
14176 [[File:Foobar.jpg|text with a [[link]] in it]]
14177 !! html/php
14178 <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>
14179 </p>
14180 !! html/parsoid
14181 <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>
14182 !! end
14183
14184 !! test
14185 BUG 648: Frameless image caption with a link (suffix)
14186 !! wikitext
14187 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14188 !! html/php
14189 <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>
14190 </p>
14191 !! html/parsoid
14192 <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>
14193 !! end
14194
14195 !! test
14196 BUG 648: Frameless image caption with an interwiki link
14197 !! wikitext
14198 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14199 !! html/php
14200 <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>
14201 </p>
14202 !! html/parsoid
14203 <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>
14204 !! end
14205
14206 !! test
14207 BUG 648: Frameless image caption with a piped interwiki link
14208 !! wikitext
14209 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14210 !! html/php
14211 <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>
14212 </p>
14213 !! html/parsoid
14214 <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>
14215 !! end
14216
14217 !! test
14218 T107474: Frameless image caption with <nowiki>
14219 !! wikitext
14220 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14221 !! html/parsoid
14222 <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>
14223 !! end
14224
14225 !! test
14226 Escape HTML special chars in image alt text
14227 !! wikitext
14228 [[File:Foobar.jpg|& < > "]]
14229 !! html/php
14230 <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>
14231 </p>
14232 !! html/parsoid
14233 <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>
14234 !! end
14235
14236 !! test
14237 Escape HTML special chars in image alt text with LanguageConverter
14238 !! options
14239 language=zh
14240 !! wikitext
14241 [[File:Foobar.jpg|& < > "]]
14242 !! html/php
14243 <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>
14244 </p>
14245 !! html/parsoid
14246 <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>
14247 !! end
14248
14249 !! test
14250 Entities in file name and attributes
14251 !! wikitext
14252 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14253 !! html/php
14254 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14255 </p>
14256 !! html/parsoid
14257 <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>
14258 !! end
14259
14260 !! test
14261 BUG 499: Alt text should have &#1234;, not &amp;1234;
14262 !! wikitext
14263 [[File:Foobar.jpg|&#9792;]]
14264 !! html/php
14265 <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>
14266 </p>
14267 !! html/parsoid
14268 <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>
14269 !! end
14270
14271 !! test
14272 Broken image caption with link
14273 !! options
14274 parsoid=wt2html,wt2wt,html2html
14275 !! wikitext
14276 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14277 !! html/php
14278 <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.
14279 </p>
14280 !! html/parsoid
14281 <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>
14282 !! end
14283
14284 !! test
14285 Image caption containing another image
14286 !! wikitext
14287 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14288 !! html/php
14289 <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>
14290
14291 !! html/parsoid
14292 <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>
14293 !! end
14294
14295 !! test
14296 Image: caption containing a newline
14297 !! wikitext
14298 [[File:Foobar.jpg|This
14299 *is some text]]
14300 !! html/php
14301 <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>
14302 </p>
14303 !! html/parsoid
14304 <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>
14305 !!end
14306
14307 !!test
14308 Image: caption containing leading space
14309 (The leading space should not trigger nowiki escaping in wt2wt mode)
14310 !! wikitext
14311 [[File:Foobar.jpg|thumb| bar]]
14312 !! html/php
14313 <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>
14314
14315 !! html/parsoid
14316 <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>
14317 !!end
14318
14319 !! test
14320 Image: caption containing a table
14321 !! options
14322 parsoid=wt2html,wt2wt,html2html
14323 !! wikitext
14324 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14325 {|
14326 ! Foo !! Bar
14327 |-
14328 | Foo1 || Bar1
14329 |}
14330 and some more text.]]
14331 !! html/php
14332 <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>
14333
14334 !! html/parsoid
14335 <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
14336 <table>
14337 <tbody>
14338 <tr><th>Foo </th><th>Bar</th></tr>
14339 <tr>
14340 <td>Foo1 </td>
14341 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14342 !! end
14343
14344 !! test
14345 Bug 3090: External links other than http: in image captions
14346 !! wikitext
14347 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14348 !! html/php
14349 <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>
14350
14351 !! html/parsoid
14352 <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>
14353 !! end
14354
14355 !! test
14356 Custom class
14357 !! options
14358 parsoid=wt2html,wt2wt,html2html
14359 !! wikitext
14360 [[Image:foobar.jpg|a|class=b]]
14361 !! html/php
14362 <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>
14363 </p>
14364 !! html/parsoid
14365 <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>
14366 !! end
14367
14368 !! test
14369 Localized image handling (1).
14370 !! options
14371 parsoid=wt2html,wt2wt,html2html
14372 language=es
14373 !! wikitext
14374 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14375 !! html/php
14376 <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>
14377
14378 !! html/parsoid
14379 <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>
14380 !! end
14381
14382 !! test
14383 Localized image handling (2).
14384 !! options
14385 thumbsize=220
14386 parsoid=wt2html,wt2wt,html2html
14387 language=es
14388 !! wikitext
14389 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14390 !! html/php
14391 <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>
14392
14393 !! html/parsoid
14394 <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>
14395 !! end
14396
14397 !! test
14398 Localized image handling (3).
14399 !! options
14400 language=fa
14401 parsoid=html2wt
14402 !! html/parsoid
14403 <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>
14404 !! wikitext
14405 [[File:Foobar.jpg|بندانگشتی]]
14406 !! end
14407
14408 !! test
14409 "border", "frameless" and "class" attributes on an image.
14410 !! options
14411 thumbsize=220
14412 parsoid=wt2html,wt2wt,html2html
14413 !! wikitext
14414 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14415 !! html/php
14416 <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>
14417 </p>
14418 !! html/parsoid
14419 <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>
14420 !! end
14421
14422 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14423 !! test
14424 Invalid image attributes (bug 62500)
14425 !! options
14426 thumbsize=220
14427 parsoid=wt2html,wt2wt,html2html
14428 !! wikitext
14429 [[File:Foobar.jpg|thumb|float|left|caption]]
14430
14431 [[File:Foobar.jpg|thumb|righ|caption]]
14432
14433 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14434 !! html/php
14435 <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>
14436 <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>
14437 <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>
14438
14439 !! html/parsoid
14440 <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>
14441 <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>
14442 <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>
14443 !! end
14444
14445 !! article
14446 File:Barfoo.jpg
14447 !! text
14448 #REDIRECT [[File:Barfoo.jpg]]
14449 !! endarticle
14450
14451 # FIXME: Parsoid should run this test -- but we'd need to teach the
14452 # mockAPI about the redirected Barfoo.jpg image.
14453 !! test
14454 Redirected image
14455 !! wikitext
14456 [[Image:Barfoo.jpg]]
14457 !! html/php
14458 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14459 </p>
14460 !! end
14461
14462 !! test
14463 Missing image with uploads disabled
14464 !! options
14465 wgEnableUploads=0
14466 !! wikitext
14467 [[File:Foobaz.jpg]]
14468 !! html/php
14469 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14470 </p>
14471 !! html/parsoid
14472 <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>
14473 !! end
14474
14475 # Parsoid-specific testing for images
14476 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14477 # Currently imperfect due to a flaw in the Parsoid testrunner
14478 # Work in progress
14479 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14480 # image tests.
14481
14482 !! test
14483 Parsoid-specific image handling - simple image with size and middle alignment
14484 !! wikitext
14485 [[File:Foobar.jpg|middle|50px]]
14486 !! html/parsoid
14487 <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>
14488 !! end
14489
14490 !! test
14491 Parsoid-specific image handling - simple image with size, middle alignment,
14492 non-standard namespace alias
14493 !! options
14494 parsoid=wt2wt,wt2html,html2html
14495 !! wikitext
14496 [[Image:Foobar.jpg|middle|50px]]
14497 !! html/parsoid
14498 <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>
14499 !! end
14500
14501 !! test
14502 Parsoid-specific image handling - simple image with size and middle alignment
14503 (existing content)
14504 !! wikitext
14505 [[File:Foobar.jpg|50px|middle]]
14506 !! html/parsoid
14507 <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>
14508 !! end
14509
14510 !! test
14511 Parsoid-specific image handling - simple image with size and middle alignment
14512 and non-standard namespace name
14513 !! options
14514 parsoid=wt2html,wt2wt,html2html
14515 !! wikitext
14516 [[Image:Foobar.jpg|50px|middle]]
14517 !! html/parsoid
14518 <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>
14519 !! end
14520
14521 !! test
14522 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14523 !! wikitext
14524 [[File:Foobar.jpg|500x10px|baseline|caption]]
14525 !! html/parsoid
14526 <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>
14527 !! end
14528
14529 !! test
14530 Parsoid-specific image handling - simple image with border and size spec
14531 !! wikitext
14532 [[File:Foobar.jpg|50px|border|caption]]
14533 !! html/parsoid
14534 <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>
14535 !! end
14536
14537 !! test
14538 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14539 !! wikitext
14540 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14541 !! html/parsoid
14542 <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>
14543 !! end
14544
14545 !! test
14546 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14547 (existing content)
14548 !! wikitext
14549 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14550 !! html/parsoid
14551 <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>
14552 !! end
14553
14554 !! test
14555 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14556 !! wikitext
14557 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14558 !! html/parsoid
14559 <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>
14560 !! end
14561
14562 !! test
14563 Parsoid-specific image handling - thumbnail with specific size, halign,
14564 valign, and caption (existing content)
14565 !! wikitext
14566 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14567 !! html/parsoid
14568 <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>
14569 !! end
14570
14571 !! test
14572 Parsoid-specific image handling - framed image with specific size and caption
14573 (size is ignored)
14574 !! options
14575 parsoid=wt2html,wt2wt,html2html
14576 !! wikitext
14577 [[File:Foobar.jpg|frame|500x50px|caption]]
14578 !! html/parsoid
14579 <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>
14580 !! end
14581
14582 !! test
14583 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14584 (size is ignored)
14585 !! options
14586 parsoid=wt2html,wt2wt,html2html
14587 !! wikitext
14588 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14589 !! html/parsoid
14590 <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>
14591 !! end
14592
14593 !! test
14594 Parsoid-specific image handling - frameless image with specific size, border, and caption
14595 !! wikitext
14596 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14597 !! html/parsoid
14598 <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>
14599 !! end
14600
14601 !! test
14602 Parsoid-specific image handling - simple image with a formatted caption
14603 !! wikitext
14604 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14605 !! html/parsoid
14606 <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>
14607 !! end
14608
14609 !! test
14610 Parsoid-specific image handling - caption with a template in it
14611 !! wikitext
14612 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14613 !! html/parsoid
14614 <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>
14615 !! end
14616
14617 !! test
14618 Parsoid-specific image handling - caption with unbalanced tags in it
14619 !! options
14620 parsoid=wt2html,wt2wt,html2html
14621 !! wikitext
14622 foo
14623 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14624 bar
14625 !! html/parsoid
14626 <p>foo</p>
14627 <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>
14628 <p>bar</p>
14629 !! end
14630
14631 !! test
14632 Parsoid-specific image handling - empty caption (1)
14633 !! options
14634 parsoid=wt2html,wt2wt
14635 !! wikitext
14636 [[File:Foobar.jpg|thumb|]]
14637 !! html/parsoid
14638 <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>
14639 !! end
14640
14641 # empty captions don't get serialized unless we're in the "round trip" case
14642 !! test
14643 Parsoid-specific image handling - empty caption (2)
14644 !! options
14645 parsoid=html2wt
14646 !! html/parsoid
14647 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14648 <a href="./File:Foobar.jpg">
14649 <img resource="./File:Foobar.jpg"
14650 src="//example.com/images/3/3a/Foobar.jpg"
14651 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14652 height="25" width="220"/>
14653 </a>
14654 <figcaption></figcaption>
14655 </figure>
14656 !! wikitext
14657 [[File:Foobar.jpg|thumb]]
14658 !! end
14659
14660 !! test
14661 Parsoid-specific image handling - whitespace caption
14662 !! wikitext
14663 [[File:Foobar.jpg|thumb| ]]
14664 !! html/parsoid
14665 <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>
14666 !! end
14667
14668 !! test
14669 Parsoid-specific image handling - lang option
14670 !! wikitext
14671 foo
14672 [[File:Foobar.svg|lang=de|caption]]
14673 bar
14674 !! html/parsoid
14675 <p>foo
14676 <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>
14677 bar</p>
14678 !! end
14679
14680 ## Edge case bugs in Parsoid from T93580
14681 !! test
14682 T93580: 1. Templated <ref> inside block images
14683 !! wikitext
14684 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14685
14686 <references />
14687 !! html/parsoid
14688 <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>
14689
14690 <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>
14691 !! end
14692
14693 !! test
14694 T93580: 2. <ref> inside inline images
14695 !! wikitext
14696 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14697
14698 <references />
14699 !! html/parsoid
14700 <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>
14701
14702 <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>
14703 !! end
14704
14705 !! test
14706 T93580: 3. Templated <ref> inside inline images
14707 !! wikitext
14708 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14709
14710 <references />
14711 !! html/parsoid
14712 <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>
14713
14714 <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>
14715 !! end
14716
14717 ###
14718 ### Subpages
14719 ###
14720 !! article
14721 Subpage test/subpage
14722 !! text
14723 foo
14724 !! endarticle
14725
14726 !! test
14727 Subpage link
14728 !! options
14729 subpage title=[[Subpage test]]
14730 !! wikitext
14731 [[/subpage]]
14732 !! html
14733 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14734 </p>
14735 !! end
14736
14737 !! test
14738 Subpage noslash link
14739 !! options
14740 subpage title=[[Subpage test]]
14741 !! wikitext
14742 [[/subpage/]]
14743 !! html
14744 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14745 </p>
14746 !! end
14747
14748 !! article
14749 Subpage test/1/2/subpage
14750 !! text
14751 blah
14752 !! endarticle
14753
14754 !! test
14755 Relative subpage noslash link
14756 !! options
14757 parsoid=wt2wt,wt2html,html2html
14758 subpage title=[[Subpage test/1/2/3/4]]
14759 !! wikitext
14760 [[../../subpage/]]
14761
14762 [[../../subpage]]
14763 !! html/php
14764 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14765 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14766 </p>
14767 !! html/parsoid
14768 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14769 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14770 !! end
14771
14772 !! test
14773 Parsoid: dot-slash prefixed wikilinks
14774 !! wikitext
14775 [[./foo]]
14776
14777 [[././bar]]
14778
14779 [[././baz/]]
14780 !! html/php
14781 <p>[[./foo]]
14782 </p><p>[[././bar]]
14783 </p><p>[[././baz/]]
14784 </p>
14785 !! html/parsoid
14786 <p>[[./foo]]
14787 </p><p>[[././bar]]
14788 </p><p>[[././baz/]]
14789 </p>
14790 !! end
14791
14792 !! test
14793 Render invalid page names as plain text (bug 51090)
14794 !! wikitext
14795 [[./../foo|bar]]
14796 [[foo�|bar]]
14797 [[foo/.|bar]]
14798 [[foo/..|bar]]
14799 [[foo~~~bar]]
14800 [[foo>bar]]
14801 [[foo[bar]]
14802 [[.]]
14803 [[..]]
14804 [[foo././bar]]
14805
14806 [[{{echo|./../foo}}|bar]]
14807 [[{{echo|foo/.}}|bar]]
14808 [[{{echo|foo/..}}|bar]]
14809 [[{{echo|foo~~~~bar}}]]
14810 [[{{echo|foo>bar}}]]
14811 [[{{echo|foo././bar}}]]
14812 [[{{echo|foo{bar}}]]
14813 [[{{echo|foo}bar}}]]
14814 [[{{echo|foo[bar}}]]
14815 [[{{echo|foo]bar}}]]
14816 [[{{echo|foo<bar}}]]
14817 !!html/php
14818 <p>[[./../foo|bar]]
14819 [[foo�|bar]]
14820 [[foo/.|bar]]
14821 [[foo/..|bar]]
14822 [[foo~~~bar]]
14823 [[foo&gt;bar]]
14824 [[foo[bar]]
14825 [[.]]
14826 [[..]]
14827 [[foo././bar]]
14828 </p><p>[[./../foo|bar]]
14829 [[foo/.|bar]]
14830 [[foo/..|bar]]
14831 [[foo~~~~bar]]
14832 [[foo&gt;bar]]
14833 [[foo././bar]]
14834 [[foo{bar]]
14835 [[foo}bar]]
14836 [[foo[bar]]
14837 [[foo]bar]]
14838 [[foo&lt;bar]]
14839 </p>
14840 !!html/parsoid
14841 <p>[[./../foo|bar]]
14842 [[foo�|bar]]
14843 [[foo/.|bar]]
14844 [[foo/..|bar]]
14845 [[foo~~~bar]]
14846 [[foo>bar]]
14847 [[foo[bar]]
14848 [[.]]
14849 [[..]]
14850 [[foo././bar]]</p>
14851
14852 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14853 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14854 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14855 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14856 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14857 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14858 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14859 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14860 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14861 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14862 [[<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>
14863 !!end
14864
14865 !! test
14866 Disabled subpages
14867 !! wikitext
14868 [[/subpage]]
14869 !! html
14870 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14871 </p>
14872 !! end
14873
14874 !! test
14875 BUG 561: {{/Subpage}}
14876 !! options
14877 subpage title=[[Page]]
14878 !! wikitext
14879 {{/Subpage}}
14880 !! html
14881 <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>
14882 </p>
14883 !! end
14884
14885 ###
14886 ### Categories
14887 ###
14888 !! article
14889 Category:MediaWiki User's Guide
14890 !! text
14891 blah
14892 !! endarticle
14893
14894 !! test
14895 Link to category
14896 !! wikitext
14897 [[:Category:MediaWiki User's Guide]]
14898 !! html
14899 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14900 </p>
14901 !! end
14902
14903 !! test
14904 Simple category
14905 !! options
14906 cat
14907 !! wikitext
14908 [[Category:MediaWiki User's Guide]]
14909 !! html/php
14910 cat=MediaWiki_User's_Guide sort=
14911 !! html/parsoid
14912 <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"}}'/>
14913 !! end
14914
14915 !! test
14916 PAGESINCATEGORY invalid title fatal (r33546 fix)
14917 !! wikitext
14918 {{PAGESINCATEGORY:<bogus>}}
14919 !! html
14920 <p>0
14921 </p>
14922 !! end
14923
14924 !! test
14925 Category with different sort key
14926 !! options
14927 cat
14928 !! wikitext
14929 [[Category:MediaWiki User's Guide|Foo]]
14930 !! html/php
14931 cat=MediaWiki_User's_Guide sort=Foo
14932 !! html/parsoid
14933 <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"}}'/>
14934 !! end
14935
14936 !! test
14937 Category with identical sort key
14938 !! options
14939 cat
14940 !! wikitext
14941 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14942 !! html/php
14943 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
14944 !! html/parsoid
14945 <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"}}'/>
14946 !! end
14947
14948 !! test
14949 Category with empty sort key
14950 !! options
14951 cat
14952 pst
14953 !! wikitext
14954 [[Category:MediaWiki User's Guide|]]
14955 !! html/php
14956 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14957 !! end
14958
14959 !! test
14960 Category with empty sort key and parentheses
14961 !! options
14962 cat
14963 pst
14964 !! wikitext
14965 [[Category:Foo (bar)|]]
14966 !! html/php
14967 [[Category:Foo (bar)|Foo]]
14968 !! end
14969
14970 !! test
14971 Category with link tail
14972 !! options
14973 cat
14974 pst
14975 !! wikitext
14976 123[[Category:Foo]]456
14977 !! html/php
14978 123[[Category:Foo]]456
14979 !! end
14980
14981 !! test
14982 Category with template
14983 !! options
14984 cat
14985 pst
14986 !! wikitext
14987 [[Category:{{echo|Foo}}]]
14988 !! html/php
14989 [[Category:{{echo|Foo}}]]
14990 !! end
14991
14992 !! test
14993 Category with template in sort key
14994 !! options
14995 cat
14996 pst
14997 !! wikitext
14998 [[Category:Foo|{{echo|Bar}}]]
14999 !! html/php
15000 [[Category:Foo|{{echo|Bar}}]]
15001 !! end
15002
15003 !! test
15004 Category with template in sort key and title
15005 !! options
15006 cat
15007 pst
15008 !! wikitext
15009 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15010 !! html/php
15011 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15012 !! end
15013
15014 ## We used to, but no longer wt2wt this test since the default serializer
15015 ## will normalize all categories to serialize on their own line.
15016 ## This wikitext usage is going to be fairly uncommon in production and
15017 ## selser will take care of preserving formatting in those scenarios.
15018 !! test
15019 Category / paragraph interactions
15020 !! options
15021 parsoid=wt2html
15022 !! wikitext
15023 Foo [[Category:Baz]] Bar
15024
15025 Foo [[Category:Baz]]
15026 Bar
15027
15028 Foo
15029 [[Category:Baz]]
15030 Bar
15031
15032 Foo
15033 [[Category:Baz]] Bar
15034
15035 Foo
15036 [[Category:Baz]]
15037 [[Category:Baz]]
15038 [[Category:Baz]]
15039 Bar
15040
15041 [[Category:Baz]]
15042 [[Category:Baz]]
15043 [[Category:Baz]]
15044
15045 [[Category:Baz]]
15046 {{echo|[[Category:Baz]]}}
15047 [[Category:Baz]]
15048 !! html/php
15049 <p>Foo Bar
15050 </p><p>Foo
15051 Bar
15052 </p><p>Foo
15053 Bar
15054 </p><p>Foo Bar
15055 </p><p>Foo
15056 Bar
15057 </p>
15058 !! html/parsoid
15059 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15060 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15061 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15062 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15063 <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>
15064 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15065 !! end
15066
15067 ## We used to, but no longer wt2wt this test since the default serializer
15068 ## will normalize all categories to serialize on their own line.
15069 ## This wikitext usage is going to be fairly uncommon in production and
15070 ## selser will take care of preserving formatting in those scenarios.
15071 ##
15072 ## The whitespace on the empty line is part of the test. Please do not delete
15073 !! test
15074 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
15075 !! options
15076 parsoid=wt2html
15077 !! wikitext
15078 This
15079
15080 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15081
15082 {{echo|[[Category:Foo]] and so should this!}}
15083 !! html/php
15084 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15085 </p>
15086 !! html/parsoid
15087 <p>This
15088
15089 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15090
15091 <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>
15092 !! end
15093
15094 ## Parsoid will not try to wt2wt this while preserving newlines because
15095 ## it suppresses excess newlines within list items -- and we don't want to
15096 ## introduce a special case just for categories, which is, in reality somewhat
15097 ## odd behavior -- categories are unlikely to be used in list items like this
15098 ## in top-level pages and are only likely to show up in template-generated
15099 ## list items where this RT-ing is a non-issue.
15100 ##
15101 ## The whitespace on the empty line is part of the test. Please do not delete
15102 !! test
15103 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
15104 !! options
15105 parsoid=wt2html
15106 !! wikitext
15107 * This
15108
15109 [[Category:Foo]] and this should be part of the same list item
15110 * So should this
15111
15112 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15113 !! html
15114 <ul><li>This and this should be part of the same list item</li>
15115 <li>So should this and this should be part of the same list item</li></ul>
15116 !! html/parsoid
15117 <ul>
15118 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15119 <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>
15120 </ul>
15121 !! end
15122
15123 ## Newlines and categories that follow the last item of a list
15124 ## are treated differently because this (list followed by categories)
15125 ## is an extremely common pattern on wikis.
15126 !! test
15127 3. Categories and newlines: newline suppression for last list item should RT properly
15128 !! wikitext
15129 * a
15130 * b
15131
15132 [[Category:Foo]]
15133
15134 [[Category:Bar]]
15135 [[Category:Baz]]
15136 !! html/parsoid
15137 <ul><li> a</li>
15138 <li> b</li></ul>
15139
15140 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15141
15142 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15143 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15144 !! end
15145
15146 !! test
15147 4. Categories and newlines: newline suppression for last list item should RT properly
15148 !! wikitext
15149 * a
15150 **** b
15151
15152 [[Category:Foo]]
15153 !! html/parsoid
15154 <ul><li> a
15155 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15156
15157 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15158 !! end
15159
15160 ## only wt2html for this to make sure the algo only applies to the rightmost path
15161 !! test
15162 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15163 !! options
15164 parsoid=wt2html
15165 !! wikitext
15166 * a
15167 ** b
15168 [[Category:Foo]]
15169 * c
15170 ** d
15171 [[Category:Foo]]
15172 !! html/parsoid
15173 <ul><li> a
15174 <ul><li> b
15175 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15176 <li> c
15177 <ul><li> d</li></ul></li></ul>
15178 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15179 !! end
15180
15181 ## We used to, but no longer wt2wt this test since the default serializer
15182 ## will normalize all categories to serialize on their own line.
15183 ## This wikitext usage is going to be fairly uncommon in production and
15184 ## selser will take care of preserving formatting in those scenarios.
15185 !! test
15186 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15187 !! options
15188 parsoid=wt2html
15189 !! wikitext
15190 * a [[Category:Foo]]
15191 !! html/parsoid
15192 <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>
15193 !! end
15194
15195 # This test also demonstrates because of newline+category tunneling
15196 # through the list hander, template wrapping doesn't expand to the
15197 # containing list when the list item swallows the category.
15198 !! test
15199 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15200 !! wikitext
15201 * {{echo|a
15202 [[Category:Foo]]}}
15203 !! html/parsoid
15204 <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
15205 </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>
15206 !! end
15207
15208 !! test
15209 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15210 !! wikitext
15211 * a
15212
15213 {{echo|[[Category:Foo]]
15214 [[Category:Bar]]}}
15215 [[Category:Baz]]
15216 !! html/parsoid
15217 <ul><li> a</li></ul>
15218
15219 <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">
15220 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15221 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15222 !! end
15223
15224 !! test
15225 Category links with multiple namespaces
15226 !! wikitext
15227 [[Category:Project:Foo]]
15228 !! html/parsoid
15229 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15230 !! end
15231
15232 !! test
15233 Parsoid: Serialize link to category page with colon escape
15234 !! options
15235 parsoid
15236 !! wikitext
15237
15238 [[:Category:Foo]]
15239 [[:Category:Foo|Bar]]
15240 !! html
15241 <p>
15242 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15243 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15244 </p>
15245 !! end
15246
15247 # We used to, but no longer wt2wt this test since the default serializer
15248 # will normalize all categories to serialize on their own line.
15249 # This wikitext usage is going to be fairly uncommon in production and
15250 # selser will take care of preventing whitespace insertion if this
15251 # occurs in an article.
15252 #
15253 # html2html disabled for the same reason (whitespace insertion between
15254 # x and y).
15255 #
15256 # html2wt disabled because it localizes the "Category" namespace.
15257 !! test
15258 Link prefix/suffixes aren't applied to category links
15259 !! options
15260 parsoid=wt2html
15261 language=is
15262 !! wikitext
15263 x[[Category:Foo]]y
15264 !! html/php
15265 <p>xy
15266 </p>
15267 !! html/parsoid
15268 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15269 !! end
15270
15271 !! test
15272 Parsoid: Serialize link to file page with colon escape
15273 !! options
15274 parsoid
15275 !! wikitext
15276
15277 [[:File:Foo.png]]
15278 [[:File:Foo.png|Bar]]
15279 !! html
15280 <p>
15281 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15282 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15283 </p>
15284 !! end
15285
15286 !! test
15287 Parsoid: Serialize a genuine category link without colon escape
15288 !! options
15289 parsoid
15290 !! wikitext
15291 [[Category:Foo]]
15292 [[Category:Foo|Bar]]
15293 !! html
15294 <link rel="mw:PageProp/Category" href="./Category:Foo">
15295 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15296 !! end
15297
15298 !! test
15299 Normalize hrefs properly before testing for invalid link targets (bug 70894)
15300 !! options
15301 parsoid=html2wt
15302 !! html/parsoid
15303 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15304 !! wikitext
15305 [[Category:Toxine bactérienne]]
15306 !! end
15307
15308 !! test
15309 Parsoid: Defaultsort
15310 !! wikitext
15311 {{DEFAULTSORT:Foo}}
15312 !! html/parsoid
15313 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15314 !! end
15315
15316 !! test
15317 Parsoid: Defaultsort (template-generated)
15318 !! wikitext
15319 {{{{echo|DEFAULTSORT}}:Foo}}
15320 !! html/parsoid
15321 <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}}]}'/>
15322 !! end
15323
15324 ###
15325 ### Inter-language links
15326 ###
15327 !! test
15328 Interlanguage links
15329 !! options
15330 ill
15331 !! wikitext
15332 [[es:Alimento]]
15333 [[fr:Nourriture]]
15334 [[zh:食品]]
15335 !! html/php
15336 es:Alimento fr:Nourriture zh:食品
15337 !! html/parsoid
15338 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15339 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15340 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15341 !! end
15342
15343 !! test
15344 Duplicate interlanguage links (bug 24502)
15345 !! options
15346 ill
15347 !! wikitext
15348 [[es:1]]
15349 [[es:2]]
15350 [[fr:1]]
15351 [[fr:2]]
15352 !! html/php
15353 es:1 fr:1
15354 !! html/parsoid
15355 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15356 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15357 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15358 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15359 !! end
15360
15361 ###
15362 ### Sections
15363 ###
15364 !! test
15365 Basic section headings
15366 !! wikitext
15367 == Headline 1 ==
15368 Some text
15369
15370 ==Headline 2==
15371 More
15372 ===Smaller headline===
15373 Blah blah
15374 !! html
15375 <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>
15376 <p>Some text
15377 </p>
15378 <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>
15379 <p>More
15380 </p>
15381 <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>
15382 <p>Blah blah
15383 </p>
15384 !! end
15385
15386 !! test
15387 Section headings with TOC
15388 !! wikitext
15389 == Headline 1 ==
15390 === Subheadline 1 ===
15391 ===== Skipping a level =====
15392 ====== Skipping a level ======
15393
15394 == Headline 2 ==
15395 Some text
15396 ===Another headline===
15397 !! html
15398 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15399 <ul>
15400 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15401 <ul>
15402 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15403 <ul>
15404 <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>
15405 <ul>
15406 <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>
15407 </ul>
15408 </li>
15409 </ul>
15410 </li>
15411 </ul>
15412 </li>
15413 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15414 <ul>
15415 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15416 </ul>
15417 </li>
15418 </ul>
15419 </div>
15420
15421 <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>
15422 <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>
15423 <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>
15424 <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>
15425 <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>
15426 <p>Some text
15427 </p>
15428 <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>
15429
15430 !! end
15431
15432 !! test
15433 TOC anchors don't collide
15434 !! wikitext
15435 __FORCETOC__
15436 == Headline 2 ==
15437 == Headline ==
15438 == Headline 2 ==
15439 == Headline ==
15440 !! html/php
15441 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15442 <ul>
15443 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15444 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15445 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15446 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15447 </ul>
15448 </div>
15449
15450 <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>
15451 <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>
15452 <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>
15453 <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>
15454
15455 !! end
15456
15457 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15458 !! test
15459 Handling of sections up to level 6 and beyond
15460 !! wikitext
15461 = Level 1 Heading=
15462 == Level 2 Heading==
15463 === Level 3 Heading===
15464 ==== Level 4 Heading====
15465 ===== Level 5 Heading=====
15466 ====== Level 6 Heading======
15467 ======= Level 7 Heading=======
15468 ======== Level 8 Heading========
15469 ========= Level 9 Heading=========
15470 ========== Level 10 Heading==========
15471 !! html
15472 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15473 <ul>
15474 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15475 <ul>
15476 <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>
15477 <ul>
15478 <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>
15479 <ul>
15480 <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>
15481 <ul>
15482 <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>
15483 <ul>
15484 <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>
15485 <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>
15486 <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>
15487 <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>
15488 <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>
15489 </ul>
15490 </li>
15491 </ul>
15492 </li>
15493 </ul>
15494 </li>
15495 </ul>
15496 </li>
15497 </ul>
15498 </li>
15499 </ul>
15500 </div>
15501
15502 <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>
15503 <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>
15504 <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>
15505 <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>
15506 <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>
15507 <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>
15508 <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>
15509 <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>
15510 <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>
15511 <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>
15512
15513 !! end
15514
15515 !! test
15516 TOC regression (T11764)
15517 !! wikitext
15518 == title 1 ==
15519 === title 1.1 ===
15520 ==== title 1.1.1 ====
15521 === title 1.2 ===
15522 == title 2 ==
15523 === title 2.1 ===
15524 !! html
15525 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15526 <ul>
15527 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15528 <ul>
15529 <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>
15530 <ul>
15531 <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>
15532 </ul>
15533 </li>
15534 <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>
15535 </ul>
15536 </li>
15537 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15538 <ul>
15539 <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>
15540 </ul>
15541 </li>
15542 </ul>
15543 </div>
15544
15545 <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>
15546 <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>
15547 <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>
15548 <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>
15549 <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>
15550 <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>
15551
15552 !! end
15553
15554 !! test
15555 TOC for heading containing <span id="..."></span> (T96153)
15556 !! wikitext
15557 __FORCETOC__
15558 ==<span id="old-anchor"></span>New title==
15559 !! html/php
15560 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15561 <ul>
15562 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15563 </ul>
15564 </div>
15565
15566 <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>
15567
15568 !! end
15569
15570 !! test
15571 TOC with wgMaxTocLevel=3 (bug 6204)
15572 !! options
15573 wgMaxTocLevel=3
15574 !! wikitext
15575 == title 1 ==
15576 === title 1.1 ===
15577 ==== title 1.1.1 ====
15578 === title 1.2 ===
15579 == title 2 ==
15580 === title 2.1 ===
15581 !! html
15582 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15583 <ul>
15584 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15585 <ul>
15586 <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>
15587 <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>
15588 </ul>
15589 </li>
15590 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15591 <ul>
15592 <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>
15593 </ul>
15594 </li>
15595 </ul>
15596 </div>
15597
15598 <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>
15599 <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>
15600 <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>
15601 <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>
15602 <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>
15603 <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>
15604
15605 !! end
15606
15607 !! test
15608 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15609 !! options
15610 wgMaxTocLevel=3
15611 !! wikitext
15612 ==Section 1==
15613 ===Section 1.1===
15614 ====Section 1.1.1====
15615 ====Section 1.1.1.1====
15616 ==Section 2==
15617 !! html
15618 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15619 <ul>
15620 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15621 <ul>
15622 <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>
15623 </ul>
15624 </li>
15625 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15626 </ul>
15627 </div>
15628
15629 <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>
15630 <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>
15631 <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>
15632 <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>
15633 <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>
15634
15635 !! end
15636
15637
15638 !! test
15639 Resolving duplicate section names
15640 !! wikitext
15641 == Foo bar ==
15642 == Foo bar ==
15643 !! html
15644 <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>
15645 <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>
15646
15647 !! end
15648
15649 !! test
15650 Resolving duplicate section names with differing case (bug 10721)
15651 !! wikitext
15652 == Foo bar ==
15653 == Foo Bar ==
15654 !! html
15655 <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>
15656 <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>
15657
15658 !! end
15659
15660 !! article
15661 Template:sections
15662 !! text
15663 ===Section 1===
15664 ==Section 2==
15665 !! endarticle
15666
15667 !! test
15668 Template with sections, __NOTOC__
15669 !! wikitext
15670 __NOTOC__
15671 ==Section 0==
15672 {{sections}}
15673 ==Section 4==
15674 !! html
15675 <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>
15676 <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>
15677 <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>
15678 <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>
15679
15680 !! end
15681
15682 !! test
15683 __NOEDITSECTION__ keyword
15684 !! wikitext
15685 __NOEDITSECTION__
15686 ==Section 1==
15687 ==Section 2==
15688 !! html
15689 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15690 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15691
15692 !! end
15693
15694 !! test
15695 Link inside a section heading
15696 !! wikitext
15697 ==Section with a [[Main Page|link]] in it==
15698 !! html
15699 <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>
15700
15701 !! end
15702
15703 !! test
15704 TOC regression (T14077)
15705 !! wikitext
15706 __TOC__
15707 == title 1 ==
15708 === title 1.1 ===
15709 == title 2 ==
15710 !! html
15711 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15712 <ul>
15713 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15714 <ul>
15715 <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>
15716 </ul>
15717 </li>
15718 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15719 </ul>
15720 </div>
15721
15722 <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>
15723 <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>
15724 <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>
15725
15726 !! end
15727
15728 !! test
15729 BUG 1219 URL next to image (good)
15730 !! wikitext
15731 http://example.com [[File:Foobar.jpg]]
15732 !! html/php
15733 <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>
15734 </p>
15735 !! html/parsoid
15736 <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>
15737 !!end
15738
15739 !! test
15740 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15741 !! wikitext
15742 ===
15743 The line above must have a trailing space!
15744 === <!--
15745 --> <!-- -->
15746 But just in case it doesn't...
15747 !! html
15748 <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>
15749 <p>The line above must have a trailing space!
15750 </p>
15751 <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>
15752 <p>But just in case it doesn't...
15753 </p>
15754 !! end
15755
15756 !! test
15757 Header with special characters (bug 25462)
15758 !! wikitext
15759 The tooltips shall not show entities to the user (ie. be double escaped)
15760
15761 == text > text ==
15762 section 1
15763
15764 == text < text ==
15765 section 2
15766
15767 == text & text ==
15768 section 3
15769
15770 == text ' text ==
15771 section 4
15772
15773 == text " text ==
15774 section 5
15775 !! html
15776 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15777 </p>
15778 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15779 <ul>
15780 <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>
15781 <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>
15782 <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>
15783 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15784 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15785 </ul>
15786 </div>
15787
15788 <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>
15789 <p>section 1
15790 </p>
15791 <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>
15792 <p>section 2
15793 </p>
15794 <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>
15795 <p>section 3
15796 </p>
15797 <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>
15798 <p>section 4
15799 </p>
15800 <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>
15801 <p>section 5
15802 </p>
15803 !! end
15804
15805 !! test
15806 Header with space, plus and underscore as entity
15807 !! wikitext
15808 Id should not contain + for spaces
15809
15810 == Space between Text ==
15811 section 1
15812
15813 == Space-Entity&#32;between&#32;Text ==
15814 section 2
15815
15816 == Plus+between+Text ==
15817 section 3
15818
15819 == Plus-Entity&#43;between&#43;Text ==
15820 section 4
15821
15822 == Underscore_between_Text ==
15823 section 5
15824
15825 == Underscore-Entity&#95;between&#95;Text ==
15826 section 6
15827
15828 [[#Space between Text]]
15829 [[#Space-Entity&#32;between&#32;Text]]
15830 [[#Plus+between+Text]]
15831 [[#Plus-Entity&#43;between&#43;Text]]
15832 [[#Underscore_between_Text]]
15833 [[#Underscore-Entity&#95;between&#95;Text]]
15834 !! html
15835 <p>Id should not contain + for spaces
15836 </p>
15837 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15838 <ul>
15839 <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>
15840 <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>
15841 <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>
15842 <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>
15843 <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>
15844 <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>
15845 </ul>
15846 </div>
15847
15848 <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>
15849 <p>section 1
15850 </p>
15851 <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>
15852 <p>section 2
15853 </p>
15854 <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>
15855 <p>section 3
15856 </p>
15857 <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>
15858 <p>section 4
15859 </p>
15860 <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>
15861 <p>section 5
15862 </p>
15863 <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>
15864 <p>section 6
15865 </p><p><a href="#Space_between_Text">#Space between Text</a>
15866 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15867 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15868 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15869 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15870 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15871 </p>
15872 !! end
15873
15874 !! test
15875 Headers with excess '=' characters
15876 (Are similar tests necessary beyond the 1st level?)
15877 !! wikitext
15878 =foo==
15879 ==foo=
15880 =''italic'' heading==
15881 ==''italic'' heading=
15882 !! html
15883 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15884 <ul>
15885 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15886 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15887 <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>
15888 <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>
15889 </ul>
15890 </div>
15891
15892 <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>
15893 <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>
15894 <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>
15895 <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>
15896
15897 !! end
15898
15899 !! test
15900 HTML headers vs TOC (bug 23393)
15901 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15902 !! wikitext
15903 <h1>Header 1</h1>
15904 == Header 1.1 ==
15905 == Header 1.2 ==
15906
15907 <h1>Header 2
15908 </h1>
15909 == Header 2.1 ==
15910 == Header 2.2 ==
15911 __NOEDITSECTION__
15912 !! html
15913 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15914 <ul>
15915 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15916 <ul>
15917 <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>
15918 <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>
15919 </ul>
15920 </li>
15921 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15922 <ul>
15923 <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>
15924 <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>
15925 </ul>
15926 </li>
15927 </ul>
15928 </div>
15929
15930 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15931 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15932 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15933 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15934 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15935 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15936
15937 !! end
15938
15939 !! test
15940 Single-line or multiline-comments can follow headings
15941 !! options
15942 parsoid=wt2html,wt2wt
15943 !! wikitext
15944 ==foo==<!---->
15945 ==bar==<!--c1-->
15946 ==baz==<!--
15947 c2
15948 c3-->
15949 !! html
15950 <h2><span class="mw-headline" id="foo">foo</span></h2>
15951 <h2><span class="mw-headline" id="bar">bar</span></h2>
15952 <h2><span class="mw-headline" id="baz">baz</span></h2>
15953
15954 !! end
15955
15956 !! test
15957 BUG 1219 URL next to image (broken)
15958 !! wikitext
15959 http://example.com[[File:Foobar.jpg]]
15960 !! html/php
15961 <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>
15962 </p>
15963 !! html/parsoid
15964 <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>
15965 !!end
15966
15967 !! test
15968 Bug 1186 news: in the middle of text
15969 !! wikitext
15970 http://en.wikinews.org/wiki/Wikinews:Workplace
15971 !! html
15972 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15973 </p>
15974 !!end
15975
15976
15977 !! test
15978 Namespaced link must have a title
15979 !! wikitext
15980 [[Project:]]
15981 !! html
15982 <p>[[Project:]]
15983 </p>
15984 !!end
15985
15986 !! test
15987 Namespaced link must have a title (bad fragment version)
15988 !! wikitext
15989 [[Project:#fragment]]
15990 !! html
15991 <p>[[Project:#fragment]]
15992 </p>
15993 !!end
15994
15995
15996 ###
15997 ### HTML tags and HTML attributes
15998 ###
15999
16000 !! test
16001 div with no attributes
16002 !! wikitext
16003 <div>HTML rocks</div>
16004 !! html
16005 <div>HTML rocks</div>
16006
16007 !! end
16008
16009 !! test
16010 div with double-quoted attribute
16011 !! wikitext
16012 <div id="rock">HTML rocks</div>
16013 !! html
16014 <div id="rock">HTML rocks</div>
16015
16016 !! end
16017
16018 !! test
16019 div with single-quoted attribute
16020 !! wikitext
16021 <div id='rock'>HTML rocks</div>
16022 !! html
16023 <div id="rock">HTML rocks</div>
16024
16025 !! end
16026
16027 !! test
16028 div with unquoted attribute
16029 !! wikitext
16030 <div id=rock>HTML rocks</div>
16031 !! html
16032 <div id="rock">HTML rocks</div>
16033
16034 !! end
16035
16036 !! test
16037 div with illegal double attributes
16038 !! wikitext
16039 <div id="a" id="b">HTML rocks</div>
16040 !! html
16041 <div id="b">HTML rocks</div>
16042
16043 !!end
16044
16045 !! test
16046 div with empty attribute value, space before equals
16047 !! options
16048 parsoid=wt2html,html2html
16049 !! wikitext
16050 <div class =>HTML rocks</div>
16051 !! html/php
16052 <div class="">HTML rocks</div>
16053
16054 !! html/parsoid
16055 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16056 !! end
16057
16058 !! test
16059 div with multiple empty attribute values
16060 !! options
16061 parsoid=wt2html,html2html
16062 !! wikitext
16063 <div id= title=>HTML rocks</div>
16064 !! html/php
16065 <div id="title.3D">HTML rocks</div>
16066
16067 !! html/parsoid
16068 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16069 !! end
16070
16071 !! test
16072 table with multiple empty attribute values
16073 !! options
16074 parsoid=wt2html,html2html
16075 !! wikitext
16076 {| title= id=
16077 | hi
16078 |}
16079 !! html/php
16080 <table title="id=">
16081 <tr>
16082 <td> hi
16083 </td></tr></table>
16084
16085 !! html/parsoid
16086 <table title="id=">
16087 <tbody><tr><td> hi</td></tr>
16088 </tbody></table>
16089 !! end
16090
16091 !! test
16092 div with braces in attribute value
16093 !! wikitext
16094 <div title="{}">Foo</div>
16095 !! html/php
16096 <div title="&#123;&#125;">Foo</div>
16097
16098 !! html/parsoid
16099 <div title="{}">Foo</div>
16100 !! end
16101
16102 !! test
16103 div with empty attribute value, no space before equals
16104 !! options
16105 parsoid=wt2html,html2html
16106 !! wikitext
16107 <div class=>HTML rocks</div>
16108 !! html/php
16109 <div class="">HTML rocks</div>
16110
16111 !! html/parsoid
16112 <div class="">HTML rocks</div>
16113 !! end
16114
16115 !! test
16116 HTML multiple attributes correction
16117 !! wikitext
16118 <p class="error" class="awesome">Awesome!</p>
16119 !! html
16120 <p class="awesome">Awesome!</p>
16121
16122 !!end
16123
16124 !! test
16125 Table multiple attributes correction
16126 !! wikitext
16127 {|
16128 !+ class="error" class="awesome"| status
16129 |}
16130 !! html
16131 <table>
16132 <tr>
16133 <th class="awesome"> status
16134 </th></tr></table>
16135
16136 !!end
16137
16138 !! test
16139 DIV IN UPPERCASE
16140 !! wikitext
16141 <DIV ID="x">HTML ROCKS</DIV>
16142 !! html
16143 <div id="x">HTML ROCKS</div>
16144
16145 !!end
16146
16147 !! test
16148 Non-ASCII pseudo-tags are rendered as text
16149 !! wikitext
16150 <khyô>
16151 !! html
16152 <p>&lt;khyô&gt;
16153 </p>
16154 !! end
16155
16156 !! test
16157 Pseudo-tag with URL 'name' renders as url link
16158 !! wikitext
16159 <http://example.com/>
16160 !! html
16161 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16162 </p>
16163 !! end
16164
16165 !! test
16166 text with amp in the middle of nowhere
16167 !! wikitext
16168 Remember AT&T?
16169 !! html
16170 <p>Remember AT&amp;T?
16171 </p>
16172 !! end
16173
16174 !! test
16175 text with character entity: eacute
16176 !! wikitext
16177 I always thought &eacute; was a cute letter.
16178 !! html
16179 <p>I always thought &#233; was a cute letter.
16180 </p>
16181 !! html+tidy
16182 <p>I always thought é was a cute letter.</p>
16183 !! end
16184
16185 !! test
16186 text with entity-escaped character entity-like string: eacute
16187 !! wikitext
16188 I always thought &amp;eacute; was a cute letter.
16189 !! html
16190 <p>I always thought &amp;eacute; was a cute letter.
16191 </p>
16192 !! end
16193
16194 !! test
16195 text with undefined character entity: xacute
16196 !! wikitext
16197 I always thought &xacute; was a cute letter.
16198 !! html
16199 <p>I always thought &amp;xacute; was a cute letter.
16200 </p>
16201 !! end
16202
16203 !! test
16204 HTML5 tags
16205 !! wikitext
16206 <data value="5">five</data>
16207 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16208 <mark>This highlighted text</mark>
16209 !! html
16210 <p><data value="5">five</data>
16211 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16212 <mark>This highlighted text</mark>
16213 </p>
16214 !! end
16215
16216 !! test
16217 HTML tag with leading space is parsed as text
16218 !! wikitext
16219 < div>foo< /div>
16220 !! html
16221 <p>&lt; div&gt;foo&lt; /div&gt;
16222 </p>
16223 !! end
16224
16225 ###
16226 ### Nesting tests (see bug 41545, 50604, 51081)
16227 ###
16228
16229 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
16230 # Note that html2wt is considerably more difficult if we use <b> in
16231 # the test case, instead of <big>
16232 !! test
16233 Ensure that HTML adoption agency algorithm is properly implemented.
16234 !! wikitext
16235 <big>X<big>Y</big>Z</big>
16236 !! html
16237 <p><big>X<big>Y</big>Z</big>
16238 </p>
16239 !! end
16240
16241 # This was bug 41545 in the PHP parser.
16242 # Note that tidy doesn't handle this correctly.
16243 !! test
16244 Nesting of <kbd>
16245 !! wikitext
16246 <kbd>X<kbd>Y</kbd>Z</kbd>
16247 !! html
16248 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16249 </p>
16250 !! end
16251
16252 # The following cases were bug 51081 in the PHP parser.
16253 # Note that there are some other nestable tags (b, i, etc) which are
16254 # not covered; see bug 51081 for discussion.
16255
16256 # Note that tidy doesn't handle this correctly.
16257 !! test
16258 Nesting of <em>
16259 !! wikitext
16260 <em>X<em>Y</em>Z</em>
16261 !! html
16262 <p><em>X<em>Y</em>Z</em>
16263 </p>
16264 !! end
16265
16266 # Note that tidy doesn't handle this correctly.
16267 !! test
16268 Nesting of <strong>
16269 !! wikitext
16270 <strong>X<strong>Y</strong>Z</strong>
16271 !! html
16272 <p><strong>X<strong>Y</strong>Z</strong>
16273 </p>
16274 !! end
16275
16276 !! test
16277 Nesting of <q>
16278 !! wikitext
16279 <q>X<q>Y</q>Z</q>
16280 !! html+tidy
16281 <p><q>X<q>Y</q>Z</q></p>
16282 !! end
16283
16284 # Note that tidy doesn't handle this correctly.
16285 !! test
16286 Nesting of <ruby>
16287 !! wikitext
16288 <ruby>X<ruby>Y</ruby>Z</ruby>
16289 !! html
16290 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16291 </p>
16292 !! end
16293
16294 # Note that tidy doesn't handle this correctly.
16295 !! test
16296 Nesting of <bdo>
16297 !! wikitext
16298 <bdo>X<bdo>Y</bdo>Z</bdo>
16299 !! html
16300 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16301 </p>
16302 !! end
16303
16304
16305 ###
16306 ### Media links
16307 ###
16308
16309 !! test
16310 Media link
16311 !! wikitext
16312 [[Media:Foobar.jpg]]
16313 !! html
16314 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16315 </p>
16316 !! end
16317
16318 !! test
16319 Media link with text
16320 !! wikitext
16321 [[Media:Foobar.jpg|A neat file to look at]]
16322 !! html
16323 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16324 </p>
16325 !! end
16326
16327 # FIXME: this is still bad HTML tag nesting
16328 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16329 !! test
16330 Media link with nasty text
16331 !! wikitext
16332 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16333 !! html
16334 <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>
16335
16336 !! html+tidy
16337 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16338 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16339 !! end
16340
16341 !! test
16342 Media link to nonexistent file (bug 1702)
16343 !! wikitext
16344 [[Media:No such.jpg]]
16345 !! html
16346 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16347 </p>
16348 !! end
16349
16350 !! test
16351 Image link to nonexistent file (bug 1850 - good)
16352 !! wikitext
16353 [[File:No_such.jpg]]
16354 !! html/php
16355 <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>
16356 </p>
16357 !! html/parsoid
16358 <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>
16359 !! end
16360
16361 !! test
16362 :Image link to nonexistent file (bug 1850 - bad)
16363 !! wikitext
16364 [[:Image:No such.jpg]]
16365 !! html/php
16366 <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>
16367 </p>
16368 !! html/parsoid
16369 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16370 !! end
16371
16372
16373
16374 !! test
16375 Character reference normalization in link text (bug 1938)
16376 !! wikitext
16377 [[Main Page|this&that]]
16378 !! html
16379 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16380 </p>
16381 !!end
16382
16383 !! article
16384 אַ
16385 !! text
16386 Test for unicode normalization
16387
16388 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16389 !! endarticle
16390
16391 !! test
16392 (bug 19451) Links should refer to the normalized form.
16393 !! wikitext
16394 [[&#xFB2E;]]
16395 [[&#x5d0;&#x5b7;]]
16396 [[&#x5d0;ַ]]
16397 [[א&#x5b7;]]
16398 [[אַ]]
16399 !! html
16400 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16401 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16402 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16403 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16404 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16405 </p>
16406 !! end
16407
16408 !! test
16409 Empty attribute crash test (bug 2067)
16410 !! wikitext
16411 <font color="">foo</font>
16412 !! html
16413 <p><font color="">foo</font>
16414 </p>
16415 !! end
16416
16417 !! test
16418 Empty attribute crash test single-quotes (bug 2067)
16419 !! wikitext
16420 <font color=''>foo</font>
16421 !! html
16422 <p><font color="">foo</font>
16423 </p>
16424 !! end
16425
16426 !! test
16427 Attribute test: equals, then nothing
16428 !! options
16429 parsoid=wt2html,html2html
16430 !! wikitext
16431 <font color=>foo</font>
16432 !! html/php
16433 <p><font color="">foo</font>
16434 </p>
16435 !! html/parsoid
16436 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16437 !! end
16438
16439 !! test
16440 Attribute test: unquoted value
16441 !! options
16442 parsoid=wt2html,html2html
16443 !! wikitext
16444 <font color=x>foo</font>
16445 !! html/php
16446 <p><font color="x">foo</font>
16447 </p>
16448 !! html/parsoid
16449 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16450 !! end
16451
16452 !! test
16453 Attribute test: unquoted but illegal value (hash)
16454 !! wikitext
16455 <font color=#x>foo</font>
16456 !! html
16457 <p><font color="#x">foo</font>
16458 </p>
16459 !! end
16460
16461 # Parsoid does not serialize to empty attribute syntax,
16462 # so wt2wt and html2wt cases are skipped
16463 !! test
16464 Attribute test: no value (T54330)
16465 !! options
16466 parsoid=wt2html,html2html
16467 !! wikitext
16468 <font color>foo</font>
16469 !! html/php
16470 <p><font color="">foo</font>
16471 </p>
16472 !! html/parsoid
16473 <p><font color="">foo</font></p>
16474 !! end
16475
16476 !! test
16477 Bug 2095: link with three closing brackets
16478 !! wikitext
16479 [[Main Page]]]
16480 !! html/php
16481 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16482 </p>
16483 !! html/parsoid
16484 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16485 !! end
16486
16487 !! test
16488 Bug 2095: link with pipe and three closing brackets
16489 !! wikitext
16490 [[Main Page|link]]]
16491 !! html/php
16492 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16493 </p>
16494 !! html/parsoid
16495 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16496 !! end
16497
16498 !! test
16499 Bug 2095: link with pipe and three closing brackets, version 2
16500 !! wikitext
16501 [[Main Page|[http://example.com/]]]
16502 !! html/php
16503 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16504 </p>
16505 !! html/parsoid
16506 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16507 !! end
16508
16509
16510 ###
16511 ### Safety
16512 ###
16513
16514 !! article
16515 Template:Dangerous attribute
16516 !! text
16517 " onmouseover="alert(document.cookie)
16518 !! endarticle
16519
16520 !! article
16521 Template:Dangerous style attribute
16522 !! text
16523 border-size: expression(alert(document.cookie))
16524 !! endarticle
16525
16526 !! article
16527 Template:Div style
16528 !! text
16529 <div style="float: right; {{{1}}}">Magic div</div>
16530 !! endarticle
16531
16532 !! test
16533 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16534 !! wikitext
16535 <div title="{{test}}"></div>
16536 !! html/php
16537 <div title="This is a test template"></div>
16538
16539 !! html/parsoid
16540 <div title="This is a test template" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"This is a test template"},"sa":{"title":"{{test}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,20,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"test\",\"href\":\"./Template:Test\"},\"params\":{},\"i\":0}}]}&#39;>This is a test template&lt;/span>"}]]}'></div>
16541 !! end
16542
16543 # Parsoid has enough context to handle this case
16544 !! test
16545 Bug 2304: HTML attribute safety (dangerous template; 2309)
16546 !! wikitext
16547 <div title="{{dangerous attribute}}"></div>
16548 !! html/php
16549 <div title=""></div>
16550
16551 !! html/parsoid
16552 <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>
16553 !! end
16554
16555 !! test
16556 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16557 !! wikitext
16558 <div style="{{dangerous style attribute}}"></div>
16559 !! html/php
16560 <div style="/* insecure input */"></div>
16561
16562 !! html/parsoid
16563 <div style="/* insecure input */" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"{{dangerous style attribute}}"}}' data-mw='{"attribs":[[{"txt":"style"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,41,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous style attribute\",\"href\":\"./Template:Dangerous_style_attribute\"},\"params\":{},\"i\":0}}]}&#39;>border-size: expression(alert(document.cookie))&lt;/span>"}]]}'></div>
16564 !! end
16565
16566 !! test
16567 Bug 2304: HTML attribute safety (safe parameter; 2309)
16568 !! wikitext
16569 {{div style|width: 200px}}
16570 !! html/php
16571 <div style="float: right; width: 200px">Magic div</div>
16572
16573 !! html/parsoid
16574 <div style="float: right; width: 200px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","a":{"style":"float: right; width: 200px"},"sa":{"style":"float: right; {{{1}}}"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"div style","href":"./Template:Div_style"},"params":{"1":{"wt":"width: 200px"}},"i":0}}]}'>Magic div</div>
16575 !! end
16576
16577 !! test
16578 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16579 !! wikitext
16580 {{div style|width: expression(alert(document.cookie))}}
16581 !! html/php
16582 <div style="/* insecure input */">Magic div</div>
16583
16584 !! html/parsoid
16585 <div style="/* insecure input */" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"float: right; {{{1}}}"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"div style","href":"./Template:Div_style"},"params":{"1":{"wt":"width: expression(alert(document.cookie))"}},"i":0}}]}'>Magic div</div>
16586 !! end
16587
16588 ## Parsoid output here differs; needs investigation.
16589 !! test
16590 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16591 !! wikitext
16592 {{div style|"><script>alert(document.cookie)</script>}}
16593 !! html
16594 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16595
16596 !! end
16597
16598 ## Parsoid output here differs; needs investigation.
16599 !! test
16600 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16601 !! wikitext
16602 {{div style|" ><script>alert(document.cookie)</script>}}
16603 !! html
16604 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16605
16606 !! end
16607
16608 !! test
16609 Bug 2304: HTML attribute safety (link)
16610 !! wikitext
16611 <div title="[[Main Page]]"></div>
16612 !! html
16613 <div title="&#91;&#91;Main Page]]"></div>
16614
16615 !! end
16616
16617 !! test
16618 Bug 2304: HTML attribute safety (italics)
16619 !! wikitext
16620 <div title="''foobar''"></div>
16621 !! html
16622 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16623
16624 !! end
16625
16626 !! test
16627 Bug 2304: HTML attribute safety (bold)
16628 !! wikitext
16629 <div title="'''foobar'''"></div>
16630 !! html
16631 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16632
16633 !! end
16634
16635 !! test
16636 Bug 2304: HTML attribute safety (ISBN)
16637 !! wikitext
16638 <div title="ISBN 1234567890"></div>
16639 !! html
16640 <div title="&#73;SBN 1234567890"></div>
16641
16642 !! end
16643
16644 !! test
16645 Bug 2304: HTML attribute safety (RFC)
16646 !! wikitext
16647 <div title="RFC 1234"></div>
16648 !! html
16649 <div title="&#82;FC 1234"></div>
16650
16651 !! end
16652
16653 !! test
16654 Bug 2304: HTML attribute safety (PMID)
16655 !! wikitext
16656 <div title="PMID 1234567890"></div>
16657 !! html
16658 <div title="&#80;MID 1234567890"></div>
16659
16660 !! end
16661
16662 !! test
16663 Bug 2304: HTML attribute safety (web link)
16664 !! wikitext
16665 <div title="http://example.com/"></div>
16666 !! html
16667 <div title="http&#58;//example.com/"></div>
16668
16669 !! end
16670
16671 !! test
16672 Bug 2304: HTML attribute safety (named web link)
16673 !! wikitext
16674 <div title="[http://example.com/ link]"></div>
16675 !! html
16676 <div title="&#91;http&#58;//example.com/ link]"></div>
16677
16678 !! end
16679
16680 !! test
16681 Bug 3244: HTML attribute safety (extension; safe)
16682 !! wikitext
16683 <div style="<nowiki>background:blue</nowiki>"></div>
16684 !! html/php
16685 <div style="background:blue"></div>
16686
16687 !! html/parsoid
16688 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
16689 !! end
16690
16691 !! test
16692 Bug 3244: HTML attribute safety (extension; unsafe)
16693 !! wikitext
16694 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16695 !! html/php
16696 <div style="/* insecure input */"></div>
16697
16698 !! html/parsoid
16699 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"&lt;nowiki>border-left:expression(alert(document.cookie))&lt;/nowiki>"}}'></div>
16700 !! end
16701
16702 # More MSIE fun discovered by Tom Gilder
16703
16704 !! test
16705 MSIE CSS safety test: spurious slash
16706 !! wikitext
16707 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16708 !! html/php
16709 <div style="/* insecure input */">evil</div>
16710
16711 !! html/parsoid
16712 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:u\\rl(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
16713 !! end
16714
16715 !! test
16716 MSIE CSS safety test: hex code
16717 !! wikitext
16718 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16719 !! html/php
16720 <div style="/* insecure input */">evil</div>
16721
16722 !! html/parsoid
16723 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:u\\72l(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
16724 !! end
16725
16726 !! test
16727 MSIE CSS safety test: comment in url
16728 !! wikitext
16729 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16730 !! html/php
16731 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16732
16733 !! html/parsoid
16734 <div style="background-image:u rl(javascript:alert('boo'))" data-parsoid='{"stx":"html","a":{"style":"background-image:u rl(javascript:alert(&#39;boo&#39;))"},"sa":{"style":"background-image:u/**/rl(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
16735 !! end
16736
16737 !! test
16738 MSIE CSS safety test: comment in expression
16739 !! wikitext
16740 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16741 !! html/php
16742 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16743
16744 !! html/parsoid
16745 <div style="background-image:expres sion(alert('boo4'))" data-parsoid='{"stx":"html","a":{"style":"background-image:expres sion(alert(&#39;boo4&#39;))"},"sa":{"style":"background-image:expres/**/sion(alert(&#39;boo4&#39;))"}}'>evil4</div>
16746 !! end
16747
16748 !! test
16749 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16750 !! wikitext
16751 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16752 !! html/php
16753 <p style="/* invalid control char */">A</p>
16754
16755 !! html/parsoid
16756 <p style="/* invalid control char */" data-parsoid='{"stx":"html","a":{"style":"/* invalid control char */"},"sa":{"style":"font-size: 100px; background-image:url\\b(https://www.google.com/images/srpr/logo6w.png)"}}'>A</p>
16757 !! end
16758
16759 !! test
16760 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16761 !! wikitext
16762 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16763 <div style="top:EXPRESSION(alert())">B</div>
16764 !! html/php
16765 <p style="/* insecure input */">A</p>
16766 <div style="/* insecure input */">B</div>
16767
16768 !! html/parsoid
16769 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expression((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>A</p>
16770 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
16771 !! end
16772
16773 !! test
16774 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16775 !! wikitext
16776 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16777 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16778 !! html/php
16779 <div style="/* insecure input */">A</div>
16780 <p style="/* insecure input */">B</p>
16781
16782 !! html/parsoid
16783 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
16784 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expʀessɪoɴ((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>B</p>
16785 !! end
16786
16787 !! test
16788 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16789 !! wikitext
16790 <div style="background-image:url⁽javascript:alert())">A</div>
16791 <div style="background-image:url₍javascript:alert())">B</div>
16792 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16793 !! html/php
16794 <div style="/* insecure input */">A</div>
16795 <div style="/* insecure input */">B</div>
16796 <p style="/* insecure input */">C</p>
16797
16798 !! html/parsoid
16799 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
16800 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
16801 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expressioⁿ((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>C</p>
16802 !! end
16803
16804 !! test
16805 Opera -o-link CSS
16806 !! options
16807 parsoid=wt2html,html2html
16808 !! wikitext
16809 <div
16810 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;"
16811 style="-o-link:attr(title);-o-link-source:current">X</div>
16812 !! html/php
16813 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16814
16815 !! html/parsoid
16816 <div title="data:text/html,&lt;img src=1 onerror=alert(1)>" style="/* insecure input */" data-parsoid='{"stx":"html","a":{"title":"data:text/html,&lt;img src=1 onerror=alert(1)>","style":"/* insecure input */"},"sa":{"title":"&amp;#100;&amp;#97;&amp;#116;&amp;#97;&amp;#58;&amp;#116;&amp;#101;&amp;#120;&amp;#116;&amp;#47;&amp;#104;&amp;#116;&amp;#109;&amp;#108;&amp;#44;&amp;#60;&amp;#105;&amp;#109;&amp;#103;&amp;#32;&amp;#115;&amp;#114;&amp;#99;&amp;#61;&amp;#49;&amp;#32;&amp;#111;&amp;#110;&amp;#101;&amp;#114;&amp;#114;&amp;#111;&amp;#114;&amp;#61;&amp;#97;&amp;#108;&amp;#101;&amp;#114;&amp;#116;&amp;#40;&amp;#49;&amp;#41;&amp;#62;","style":"-o-link:attr(title);-o-link-source:current"}}'>X</div>
16817 !! end
16818
16819 !! test
16820 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16821 !! wikitext
16822 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16823 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16824 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16825 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16826 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16827 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16828 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16829 !! html/php
16830 <p style="/* insecure input */">A</p>
16831 <p style="/* insecure input */">B</p>
16832 <p style="/* insecure input */">C</p>
16833 <p style="/* insecure input */">D</p>
16834 <p style="/* insecure input */">E</p>
16835 <p style="/* insecure input */">F</p>
16836 <p style="/* insecure input */">G</p>
16837
16838 !! html/parsoid
16839 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expres〱ion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>A</p>
16840 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresゝion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>B</p>
16841 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>C</p>
16842 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresヽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>D</p>
16843 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>E</p>
16844 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹼion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>F</p>
16845 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>G</p>
16846 !! end
16847
16848 !! test
16849 Table attribute legitimate extension
16850 !! wikitext
16851 {|
16852 !+ style="<nowiki>color:blue</nowiki>"| status
16853 |}
16854 !! html
16855 <table>
16856 <tr>
16857 <th style="color:blue"> status
16858 </th></tr></table>
16859
16860 !!end
16861
16862 !! test
16863 Table attribute safety
16864 !! wikitext
16865 {|
16866 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16867 |}
16868 !! html
16869 <table>
16870 <tr>
16871 <th style="/* insecure input */"> status
16872 </th></tr></table>
16873
16874 !! end
16875
16876 !! test
16877 CSS line continuation 1
16878 !! wikitext
16879 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16880 !! html
16881 <div style="/* insecure input */"></div>
16882
16883 !! end
16884
16885 !! test
16886 CSS line continuation 2
16887 !! wikitext
16888 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16889 !! html
16890 <div style="/* invalid control char */"></div>
16891
16892 !! end
16893
16894 !! article
16895 Template:Identity
16896 !! text
16897 {{{1}}}
16898 !! endarticle
16899
16900 !! test
16901 Expansion of multi-line templates in attribute values (bug 6255)
16902 !! wikitext
16903 <div style="background: {{identity|#00FF00}}">-</div>
16904 !! html
16905 <div style="background: #00FF00">-</div>
16906
16907 !! end
16908
16909 !! test
16910 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16911 !! wikitext
16912 <div style="background:
16913 #00FF00">-</div>
16914 !! html/php
16915 <div style="background: #00FF00">-</div>
16916
16917 !! html/parsoid
16918 <div style="background:
16919 #00FF00">-</div>
16920 !! end
16921
16922 !! test
16923 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16924 !! wikitext
16925 <div style="background: &#10;#00FF00">-</div>
16926 !! html
16927 <div style="background: &#10;#00FF00">-</div>
16928
16929 !! end
16930
16931 !! test
16932 Tags which are hidden from Tidy cannot pass through the Sanitizer
16933 !! wikitext
16934 <mw:toc><script>alert();</script></mw:toc>
16935 !! html+tidy
16936 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
16937 !! end
16938
16939 ###
16940 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16941 ###
16942
16943 !! test
16944 Parser hook: empty input
16945 !! wikitext
16946 <tag></tag>
16947 !! html/php
16948 <pre>
16949 ''
16950 array (
16951 )
16952 </pre>
16953
16954 !! html/parsoid
16955 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16956 !! end
16957
16958 ## Don't expect parsoid to rt this form.
16959 !! test
16960 Parser hook: empty input using terminated empty elements
16961 !! options
16962 parsoid=wt2html,html2html
16963 !! wikitext
16964 <tag/>
16965 !! html/php
16966 <pre>
16967 NULL
16968 array (
16969 )
16970 </pre>
16971
16972 !! html/parsoid
16973 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16974 !! end
16975
16976 !! test
16977 Parser hook: empty input using terminated empty elements (space before)
16978 !! wikitext
16979 <tag />
16980 !! html/php
16981 <pre>
16982 NULL
16983 array (
16984 )
16985 </pre>
16986
16987 !! html/parsoid
16988 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16989 !! end
16990
16991 !! test
16992 Parser hook: basic input
16993 !! wikitext
16994 <tag>input</tag>
16995 !! html/php
16996 <pre>
16997 'input'
16998 array (
16999 )
17000 </pre>
17001
17002 !! html/parsoid
17003 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17004 !! end
17005
17006 ## Don't expect parsoid to rt this form.
17007 !! test
17008 Parser hook: case insensitive
17009 !! options
17010 parsoid=wt2html,html2html
17011 !! wikitext
17012 <TAG>input</TAG>
17013 !! html/php
17014 <pre>
17015 'input'
17016 array (
17017 )
17018 </pre>
17019
17020 !! html/parsoid
17021 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17022 !! end
17023
17024 ## Don't expect parsoid to rt this form.
17025 !! test
17026 Parser hook: case insensitive, redux
17027 !! options
17028 parsoid=wt2html,html2html
17029 !! wikitext
17030 <TaG>input</TAg>
17031 !! html/php
17032 <pre>
17033 'input'
17034 array (
17035 )
17036 </pre>
17037
17038 !! html/parsoid
17039 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17040 !! end
17041
17042 !! test
17043 Parser hook: nested tags
17044 !! wikitext
17045 <tag><tag></tag></tag>
17046 !! html/php
17047 <pre>
17048 '<tag>'
17049 array (
17050 )
17051 </pre>&lt;/tag&gt;
17052
17053 !! html/parsoid
17054 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
17055 !! end
17056
17057 !! test
17058 Parser hook: basic arguments
17059 !! wikitext
17060 <tag width="200" height="100" depth="50" square=""></tag>
17061 !! html/php
17062 <pre>
17063 ''
17064 array (
17065 'width' => '200',
17066 'height' => '100',
17067 'depth' => '50',
17068 'square' => '',
17069 )
17070 </pre>
17071
17072 !! html/parsoid
17073 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17074 !! end
17075
17076 ## Don't expect parsoid to rt this form.
17077 !! test
17078 Parser hook: basic arguments, variations
17079 !! options
17080 parsoid=wt2html,html2html
17081 !! wikitext
17082 <tag width=200 height = "100" depth = '50' square></tag>
17083 !! html/php
17084 <pre>
17085 ''
17086 array (
17087 'width' => '200',
17088 'height' => '100',
17089 'depth' => '50',
17090 'square' => '',
17091 )
17092 </pre>
17093
17094 !! html/parsoid
17095 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17096 !! end
17097
17098 !! test
17099 Parser hook: argument containing a forward slash (bug 5344)
17100 !! wikitext
17101 <tag filename="/tmp/bla"></tag>
17102 !! html/php
17103 <pre>
17104 ''
17105 array (
17106 'filename' => '/tmp/bla',
17107 )
17108 </pre>
17109
17110 !! html/parsoid
17111 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17112 !! end
17113
17114 ## Don't expect parsoid to rt this form.
17115 !! test
17116 Parser hook: empty input using terminated empty elements (bug 2374)
17117 !! options
17118 parsoid=wt2html,html2html
17119 !! wikitext
17120 <tag foo=bar/>text
17121 !! html/php
17122 <pre>
17123 NULL
17124 array (
17125 'foo' => 'bar',
17126 )
17127 </pre>text
17128
17129 !! html/parsoid
17130 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
17131 !! end
17132
17133 ## </tag> should be output literally since there is no matching tag that begins it
17134 ## Don't expect parsoid to rt this form.
17135 !! test
17136 Parser hook: basic arguments using terminated empty elements (bug 2374)
17137 !! options
17138 parsoid=wt2html
17139 !! wikitext
17140 <tag width=200 height = "100" depth = '50' square/>
17141 other stuff
17142 </tag>
17143 !! html/php
17144 <pre>
17145 NULL
17146 array (
17147 'width' => '200',
17148 'height' => '100',
17149 'depth' => '50',
17150 'square' => '',
17151 )
17152 </pre>
17153 <p>other stuff
17154 &lt;/tag&gt;
17155 </p>
17156 !! html/parsoid
17157 <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
17158 &lt;/tag></p>
17159 !! end
17160
17161 ## Don't expect parsoid to rt this form.
17162 !! test
17163 Parser hook: Don't allow unclosed extension tags
17164 !! options
17165 parsoid=wt2html
17166 !! wikitext
17167 test <tag>123
17168
17169 this is a '''test'''
17170 !! html/php
17171 <p>test &lt;tag&gt;123
17172 </p><p>this is a <b>test</b>
17173 </p>
17174 !! html/parsoid
17175 <p>test &lt;tag>123</p>
17176
17177 <p>this is a <b>test</b></p>
17178 !! end
17179
17180 ###
17181 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17182 ###
17183
17184 !! test
17185 Parser hook: static parser hook not inside a comment
17186 !! wikitext
17187 <statictag>hello, world</statictag>
17188
17189 <statictag action="flush" />
17190 !! html/php
17191 <p><br />
17192 hello, world
17193 </p>
17194 !! html/parsoid
17195 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17196 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17197 !! end
17198
17199 !! test
17200 Parser hook: static parser hook inside a comment
17201 !! wikitext
17202 <!-- <statictag>hello, world</statictag> -->
17203 <statictag action="flush" />
17204 !! html/php
17205 <p><br />
17206 </p>
17207 !! html/parsoid
17208 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17209 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17210 !! end
17211
17212 # Nested template calls; this case was broken by Parser.php rev 1.506,
17213 # since reverted.
17214
17215 !! article
17216 Template:One-parameter
17217 !! text
17218 (My parameter is: {{{1}}})
17219 !! endarticle
17220
17221 !! article
17222 Template:Map-one-parameter
17223 !! text
17224 {{{{{1}}}|{{{2}}}}}
17225 !! endarticle
17226
17227 !! test
17228 Nested template calls
17229 !! wikitext
17230 {{Map-one-parameter|One-parameter|param}}
17231 !! html
17232 <p>(My parameter is: param)
17233 </p>
17234 !! end
17235
17236
17237 ###
17238 ### Sanitizer
17239 ###
17240
17241 # HTML+Tidy effectively strips out the empty tags completely
17242 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17243 # which Tidy would have done for the PHP parser had there been content inside it.
17244 !! test
17245 Sanitizer: Closing of open tags
17246 !! wikitext
17247 <s></s><table></table>
17248 !! html
17249 <s></s><table></table>
17250
17251 !! html/parsoid
17252 <p><s></s></p><table></table>
17253 !! end
17254
17255 !! test
17256 Sanitizer: Closing of open but not closed tags
17257 !! wikitext
17258 <s>foo
17259 !! html
17260 <p><s>foo</s>
17261 </p>
17262 !! end
17263
17264 !! test
17265 Sanitizer: Closing of closed but not open tags
17266 !! options
17267 parsoid=wt2html
17268 !! wikitext
17269 </s>
17270 !! html/php+tidy
17271 !! html/parsoid
17272 !! end
17273
17274 !! test
17275 Sanitizer: Closing of closed but not open table tags
17276 !! options
17277 parsoid=wt2html
17278 !! wikitext
17279 Table not started</td></tr></table>
17280 !! html/php+tidy
17281 <p>Table not started</p>
17282 !! html/parsoid
17283 <p>Table not started</p>
17284 !! end
17285
17286 !! test
17287 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17288 !! wikitext
17289 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17290 !! html/php
17291 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17292 </p>
17293 !! html/parsoid
17294 <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>
17295 !! end
17296
17297 # In HTML5, the restrictions are that id must contain at least one character,
17298 # and must not contain any space characters.
17299 !! test
17300 Sanitizer: Validating the contents of the id attribute (bug 4515)
17301 !! options
17302 disabled
17303 !! wikitext
17304 <br id="" /><br id="a space" />
17305 !! html
17306 Something ...
17307 !! end
17308
17309 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17310 !! test
17311 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
17312 !! options
17313 disabled
17314 !! wikitext
17315 <br id="foo" /><br id="foo" />
17316 !! html
17317 Something need to be done. foo-2 ?
17318 !! end
17319
17320 !! test
17321 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17322 !! wikitext
17323 <div itemscope>
17324 <meta itemprop="hello" content="world">
17325 <meta http-equiv="refresh" content="5">
17326 <meta itemprop="hello" http-equiv="refresh" content="5">
17327 <link itemprop="hello" href="{{SERVER}}">
17328 <link rel="stylesheet" href="{{SERVER}}">
17329 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17330 </div>
17331 !! html
17332 <div itemscope="">
17333 <p> <meta itemprop="hello" content="world" />
17334 &lt;meta http-equiv="refresh" content="5"&gt;
17335 <meta itemprop="hello" content="5" />
17336 </p>
17337 <link itemprop="hello" href="http&#58;//example.org" />
17338 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17339 <link itemprop="hello" href="http&#58;//example.org" />
17340 </div>
17341
17342 !! end
17343
17344 !! test
17345 Language converter: output gets cut off unexpectedly (bug 5757)
17346 !! options
17347 language=zh
17348 !! wikitext
17349 this bit is safe: }-
17350
17351 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17352
17353 then we get cut off here: }-
17354
17355 all additional text is vanished
17356 !! html
17357 <p>this bit is safe: }-
17358 </p><p>but if we add a conversion instance: xxx
17359 </p><p>then we get cut off here: }-
17360 </p><p>all additional text is vanished
17361 </p>
17362 !! end
17363
17364 !! test
17365 Self closed html pairs (bug 5487)
17366 !! options
17367 !! wikitext
17368 <center><font id="bug" />Centered text</center>
17369 <div><font id="bug2" />In div text</div>
17370 !! html
17371 <center>&lt;font id="bug" /&gt;Centered text</center>
17372 <div>&lt;font id="bug2" /&gt;In div text</div>
17373
17374 !! end
17375
17376 #
17377 #
17378 #
17379
17380 !! test
17381 Punctuation: nbsp before exclamation
17382 !! wikitext
17383 C'est grave !
17384 !! html
17385 <p>C'est grave&#160;!
17386 </p>
17387 !! end
17388
17389 !! test
17390 Punctuation: CSS !important (bug 11874)
17391 !! wikitext
17392 <div style="width:50% !important">important</div>
17393 !! html
17394 <div style="width:50% !important">important</div>
17395
17396 !!end
17397
17398 !! test
17399 Punctuation: CSS ! important (bug 11874; with space after)
17400 !! wikitext
17401 <div style="width:50% ! important">important</div>
17402 !! html
17403 <div style="width:50% ! important">important</div>
17404
17405 !!end
17406
17407 !! test
17408 HTML bullet list, closed tags (bug 5497)
17409 !! wikitext
17410 <ul>
17411 <li>One</li>
17412 <li>Two</li>
17413 </ul>
17414 !! html/php
17415 <ul>
17416 <li>One</li>
17417 <li>Two</li>
17418 </ul>
17419
17420 !! html/parsoid
17421 <ul data-parsoid='{"stx":"html"}'>
17422 <li data-parsoid='{"stx":"html"}'>One</li>
17423 <li data-parsoid='{"stx":"html"}'>Two</li>
17424 </ul>
17425
17426 !! end
17427
17428 !! test
17429 HTML bullet list, unclosed tags (bug 5497)
17430 !! wikitext
17431 <ul>
17432 <li>One
17433 <li>Two
17434 </ul>
17435 !! html/php+tidy
17436 <ul>
17437 <li>One</li>
17438 <li>Two</li>
17439 </ul>
17440 !! html/parsoid
17441 <ul data-parsoid='{"stx":"html"}'>
17442 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17443 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17444 </ul>
17445
17446 !! end
17447
17448 !! test
17449 HTML ordered list, closed tags (bug 5497)
17450 !! wikitext
17451 <ol>
17452 <li>One</li>
17453 <li>Two</li>
17454 </ol>
17455 !! html/php
17456 <ol>
17457 <li>One</li>
17458 <li>Two</li>
17459 </ol>
17460
17461 !! html/parsoid
17462 <ol data-parsoid='{"stx":"html"}'>
17463 <li data-parsoid='{"stx":"html"}'>One</li>
17464 <li data-parsoid='{"stx":"html"}'>Two</li>
17465 </ol>
17466
17467 !! end
17468
17469 !! test
17470 HTML ordered list, unclosed tags (bug 5497)
17471 !! options
17472 !! wikitext
17473 <ol>
17474 <li>One
17475 <li>Two
17476 </ol>
17477 !! html/php+tidy
17478 <ol>
17479 <li>One</li>
17480 <li>Two</li>
17481 </ol>
17482 !! html/parsoid
17483 <ol data-parsoid='{"stx":"html"}'>
17484 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17485 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17486 </ol>
17487
17488 !! end
17489
17490 !! test
17491 HTML nested bullet list, closed tags (bug 5497)
17492 !! wikitext
17493 <ul>
17494 <li>One</li>
17495 <li>Two:
17496 <ul>
17497 <li>Sub-one</li>
17498 <li>Sub-two</li>
17499 </ul>
17500 </li>
17501 </ul>
17502 !! html/php
17503 <ul>
17504 <li>One</li>
17505 <li>Two:
17506 <ul>
17507 <li>Sub-one</li>
17508 <li>Sub-two</li>
17509 </ul>
17510 </li>
17511 </ul>
17512
17513 !! html/parsoid
17514 <ul data-parsoid='{"stx":"html"}'>
17515 <li data-parsoid='{"stx":"html"}'>One</li>
17516 <li data-parsoid='{"stx":"html"}'>Two:
17517 <ul data-parsoid='{"stx":"html"}'>
17518 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17519 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17520 </ul>
17521 </li>
17522 </ul>
17523 !! end
17524
17525 !! test
17526 HTML nested bullet list, open tags (bug 5497)
17527 !! wikitext
17528 <ul>
17529 <li>One
17530 <li>Two:
17531 <ul>
17532 <li>Sub-one
17533 <li>Sub-two
17534 </ul>
17535 </ul>
17536 !! html/php+tidy
17537 <ul>
17538 <li>One</li>
17539 <li>Two:
17540 <ul>
17541 <li>Sub-one</li>
17542 <li>Sub-two</li>
17543 </ul>
17544 </li>
17545 </ul>
17546 !! html/parsoid
17547 <ul>
17548 <li>One
17549 </li>
17550 <li>Two:
17551 <ul>
17552 <li>Sub-one
17553 </li>
17554 <li>Sub-two
17555 </li>
17556 </ul>
17557 </li>
17558 </ul>
17559
17560 !! end
17561
17562 !! test
17563 HTML nested ordered list, closed tags (bug 5497)
17564 !! wikitext
17565 <ol>
17566 <li>One</li>
17567 <li>Two:
17568 <ol>
17569 <li>Sub-one</li>
17570 <li>Sub-two</li>
17571 </ol>
17572 </li>
17573 </ol>
17574 !! html
17575 <ol>
17576 <li>One</li>
17577 <li>Two:
17578 <ol>
17579 <li>Sub-one</li>
17580 <li>Sub-two</li>
17581 </ol>
17582 </li>
17583 </ol>
17584
17585 !! end
17586
17587 !! test
17588 HTML nested ordered list, open tags (bug 5497)
17589 !! wikitext
17590 <ol>
17591 <li>One
17592 <li>Two:
17593 <ol>
17594 <li>Sub-one
17595 <li>Sub-two
17596 </ol>
17597 </ol>
17598 !! html/php
17599 <ol>
17600 <li>One
17601 <li>Two:
17602 <ol>
17603 <li>Sub-one
17604 <li>Sub-two
17605 </ol>
17606 </ol>
17607
17608 !! html/parsoid
17609 <ol>
17610 <li>One
17611 </li>
17612 <li>Two:
17613 <ol>
17614 <li>Sub-one
17615 </li>
17616 <li>Sub-two
17617 </li>
17618 </ol>
17619 </li>
17620 </ol>
17621
17622 !! end
17623
17624 !! test
17625 HTML ordered list item with parameters oddity
17626 !! wikitext
17627 <ol><li id="fragment">One</li>
17628 </ol>
17629 !! html
17630 <ol><li id="fragment">One</li>
17631 </ol>
17632
17633 !! end
17634
17635 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17636 !!test
17637 bug 5918: autonumbering
17638 !! wikitext
17639 [http://first/] [http://second] [ftp://ftp]
17640
17641 ftp://inlineftp
17642
17643 [mailto:enclosed@mail.tld With target]
17644
17645 [mailto:enclosed@mail.tld]
17646
17647 mailto:inline@mail.tld
17648 !! html/php
17649 <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>
17650 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17651 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17652 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17653 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17654 </p>
17655 !! html/parsoid
17656 <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>
17657 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17658 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17659 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17660 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17661 !! end
17662
17663
17664 #
17665 # Security and HTML correctness
17666 # From Nick Jenkins' fuzz testing
17667 #
17668
17669 !! test
17670 Fuzz testing: Parser13
17671 !! wikitext
17672 {|
17673 | http://a|
17674 !! html
17675 <table>
17676 <tr>
17677 <td>
17678 </td>
17679 </tr>
17680 </table>
17681
17682 !! end
17683
17684 !! test
17685 Fuzz testing: Parser14
17686 !! wikitext
17687 == onmouseover= ==
17688 http://__TOC__
17689 !! html
17690 <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>
17691 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17692 <ul>
17693 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17694 </ul>
17695 </div>
17696
17697
17698 !! html+tidy
17699 <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>
17700 <p>http://</p>
17701 <div id="toc" class="toc">
17702 <div id="toctitle">
17703 <h2>Contents</h2>
17704 </div>
17705 <ul>
17706 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17707 </ul>
17708 </div>
17709 <p></p>
17710 !! end
17711
17712 !! test
17713 Fuzz testing: Parser14-table
17714 !! options
17715 parsoid=wt2html,html2html
17716 !! wikitext
17717 ==a==
17718 {| STYLE=__TOC__
17719 !! html
17720 <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>
17721 <table style="&#95;_TOC&#95;_">
17722 <tr><td></td></tr>
17723 </table>
17724
17725 !! html+tidy
17726 <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>
17727 <table style="__TOC__">
17728 <tr>
17729 <td></td>
17730 </tr>
17731 </table>
17732 !! html/parsoid
17733 <h2>a</h2>
17734 <table style="__TOC__"></table>
17735 !! end
17736
17737 # Known to produce bogus xml (extra </td>)
17738 !! test
17739 Fuzz testing: Parser16
17740 !! wikitext
17741 {|
17742 !https://||||||
17743 !! html
17744 <table>
17745 <tr>
17746 <th>https://</th>
17747 <th></th>
17748 <th></th>
17749 <th>
17750 </td>
17751 </tr>
17752 </table>
17753
17754 !! html+tidy
17755 <table>
17756 <tr>
17757 <th>https://</th>
17758 <th></th>
17759 <th></th>
17760 <th></th>
17761 </tr>
17762 </table>
17763 !! end
17764
17765 !! test
17766 Fuzz testing: Parser21
17767 !! wikitext
17768 {|
17769 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17770 |
17771 !! html
17772 <table>
17773 <tr>
17774 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17775 </th>
17776 <td>
17777 </td>
17778 </tr>
17779 </table>
17780
17781 !! end
17782
17783 !! test
17784 Fuzz testing: Parser22
17785 !! wikitext
17786 http://===r:::https://b
17787
17788 {|
17789 !! html
17790 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17791 </p>
17792 <table>
17793 <tr><td></td></tr>
17794 </table>
17795
17796 !! end
17797
17798 # Known to produce bad XML for now
17799 !! test
17800 Fuzz testing: Parser24
17801 !! options
17802 parsoid=wt2html
17803 !! wikitext
17804 {|
17805 {{{|
17806 <u CLASS=
17807 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17808 <br style="onmouseover='alert(document.cookie);' " />
17809
17810 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17811 |
17812 !! html/php
17813 <table>
17814 {{{|
17815 <u class="&#124;">}}}} &gt;
17816 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17817
17818 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17819 <tr>
17820 <td></u>
17821 </td>
17822 </tr>
17823 </table>
17824
17825 !! html/parsoid
17826 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
17827 <u class="|" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":""},"autoInsertedEnd":true}' data-mw='{"attribs":[[{"txt":"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}","html":"{&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[21,79,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&amp;lt;noinclude>\"},\"params\":{},\"i\":0}}]}&#39;>{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}&lt;/span>}"},{"html":""}]]}'>
17828 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/></u></p><p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><u class="|" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":""},"autoInsertedEnd":true,"autoInsertedStart":true}' data-mw='{"attribs":[[{"txt":"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}","html":"{&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[21,79,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&amp;lt;noinclude>\"},\"params\":{},\"i\":0}}]}&#39;>{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}&lt;/span>}"},{"html":""}]]}'>MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p><table data-parsoid='{"autoInsertedEnd":true}'>
17829
17830
17831
17832 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
17833 !! end
17834
17835 # Note: the current result listed for this is not what the original one was,
17836 # but the original bug was JavaScript injection, which is fixed in any case.
17837 # It's not clear that the original result listed was any more correct than the
17838 # current one. Original result:
17839 # <p>{{{|
17840 # </p>
17841 # <li class="&#124;&#124;">
17842 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17843 !!test
17844 Fuzz testing: Parser25 (bug 6055)
17845 !! wikitext
17846 {{{
17847 |
17848 <LI CLASS=||
17849 >
17850 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17851 !! html/php
17852 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17853 </p>
17854 !! html/parsoid
17855 <span about="#mwt1" typeof="mw:Param" data-parsoid='{"pi":[[{"k":"1"},{"k":"2"},{"k":"3"}]]}' data-mw='{"parts":[{"templatearg":{"target":{"wt":"\n"},"params":{"1":{"wt":" \n&lt;LI CLASS="},"2":{"wt":""},"3":{"wt":"\n >\n"}},"i":0}},"blah\" onmouseover=\"alert(&#39;hello world&#39;);\" align=\"left\"&#39;&#39;&#39;MOVE MOUSE CURSOR OVER HERE"]}'>
17856 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
17857 !! end
17858
17859 !!test
17860 Fuzz testing: URL adjacent extension (with space, clean)
17861 !! wikitext
17862 http://example.com <nowiki>junk</nowiki>
17863 !! html/php
17864 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17865 </p>
17866 !! html/parsoid
17867 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17868 !! end
17869
17870 !!test
17871 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17872 !! wikitext
17873 http://example.com<nowiki>junk</nowiki>
17874 !! html/php
17875 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17876 </p>
17877 !! html/parsoid
17878 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17879 !! end
17880
17881 !!test
17882 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17883 !! wikitext
17884 http://example.com<pre>junk</pre>
17885 !! html/php
17886 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17887
17888 !! html/php+tidy
17889 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17890 <pre>
17891 junk
17892 </pre>
17893 !! html/parsoid
17894 <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>
17895 !!end
17896
17897 !!test
17898 Fuzz testing: image with bogus manual thumbnail
17899 !! wikitext
17900 [[Image:foobar.jpg|thumbnail= ]]
17901 !! html/php
17902 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17903
17904 !! html/parsoid
17905 <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>
17906 !!end
17907
17908 !! test
17909 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17910 !! wikitext
17911 <pre dir="&#10;"></pre>
17912 !! html
17913 <pre dir="&#10;"></pre>
17914
17915 !! end
17916
17917 !! test
17918 Parsing optional HTML elements (Bug 6171)
17919 !! options
17920 !! wikitext
17921 <table>
17922 <tr>
17923 <td> Some tabular data</td>
17924 <td> More tabular data ...
17925 <td> And yet som tabular data</td>
17926 </tr>
17927 </table>
17928 !! html
17929 <table>
17930 <tr>
17931 <td> Some tabular data</td>
17932 <td> More tabular data ...
17933 </td><td> And yet som tabular data</td>
17934 </tr>
17935 </table>
17936
17937 !! end
17938
17939 !! test
17940 Correct handling of <td>, <tr> (Bug 6171)
17941 !! options
17942 !! wikitext
17943 <table>
17944 <tr>
17945 <td> Some tabular data</td>
17946 <td> More tabular data ...</td>
17947 <td> And yet som tabular data</td>
17948 </tr>
17949 </table>
17950 !! html
17951 <table>
17952 <tr>
17953 <td> Some tabular data</td>
17954 <td> More tabular data ...</td>
17955 <td> And yet som tabular data</td>
17956 </tr>
17957 </table>
17958
17959 !! end
17960
17961
17962 !! test
17963 Parsing crashing regression (fr:JavaScript)
17964 !! wikitext
17965 </body></x>
17966 !! html
17967 <p>&lt;/body&gt;&lt;/x&gt;
17968 </p>
17969 !! end
17970
17971 !! test
17972 Inline wiki vs wiki block nesting
17973 !! wikitext
17974 '''Bold paragraph
17975
17976 New wiki paragraph
17977 !! html
17978 <p><b>Bold paragraph</b>
17979 </p><p>New wiki paragraph
17980 </p>
17981 !! end
17982
17983 # FIXME: The current php output is documented
17984 # and desired output is the parsoid target.
17985 !! test
17986 Inline HTML vs wiki block nesting
17987 !! wikitext
17988 <b>Bold paragraph
17989
17990 New wiki paragraph
17991 !! html/php
17992 <p><b>Bold paragraph
17993 </p><p>New wiki paragraph</b>
17994 </p>
17995 !! html/parsoid
17996 <p><b>Bold paragraph</b>
17997 </p><p>New wiki paragraph
17998 </p>
17999 !! end
18000
18001 # Original result was this:
18002 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
18003 # </p>
18004 # While that might be marginally more intuitive, maybe, the six-apostrophe
18005 # construct is clearly pathological and the result stated here (which is what
18006 # the parser actually does) is about as reasonable as anything.
18007 !!test
18008 Mixing markup for italics and bold
18009 !! options
18010 !! wikitext
18011 '''bold''''''bold''bolditalics'''''
18012 !! html
18013 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
18014 </p>
18015 !! end
18016
18017
18018 !! article
18019 Xyzzyx
18020 !! text
18021 Article for special page transclusion test
18022 !! endarticle
18023
18024 !! test
18025 Special page transclusion
18026 !! options
18027 !! wikitext
18028 {{Special:Prefixindex/Xyzzyx}}
18029 !! html
18030 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18031 </ul>
18032
18033 !! end
18034
18035 !! test
18036 Special page transclusion twice (bug 5021)
18037 !! options
18038 !! wikitext
18039 {{Special:Prefixindex/Xyzzyx}}
18040 {{Special:Prefixindex/Xyzzyx}}
18041 !! html
18042 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18043 </ul>
18044 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18045 </ul>
18046
18047 !! end
18048
18049 !! test
18050 Transclusion of default MediaWiki message
18051 !! wikitext
18052 {{MediaWiki:Mainpage}}
18053 !! html
18054 <p>Main Page
18055 </p>
18056 !! end
18057
18058 !! test
18059 Transclusion of nonexistent MediaWiki message
18060 !! wikitext
18061 {{MediaWiki:Mainpagexxx}}
18062 !! html
18063 <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>
18064 </p>
18065 !! end
18066
18067 !! test
18068 Transclusion of MediaWiki message with underscore
18069 !! wikitext
18070 {{MediaWiki:history_short}}
18071 !! html
18072 <p>History
18073 </p>
18074 !! end
18075
18076 !! test
18077 Transclusion of MediaWiki message with space
18078 !! wikitext
18079 {{MediaWiki:history short}}
18080 !! html
18081 <p>History
18082 </p>
18083 !! end
18084
18085 !! test
18086 Invalid header with following text
18087 !! wikitext
18088 = x = y
18089 !! html
18090 <p>= x = y
18091 </p>
18092 !! end
18093
18094
18095 !! test
18096 Section extraction test (section 0)
18097 !! options
18098 section=0
18099 !! wikitext
18100 start
18101 ==a==
18102 ===aa===
18103 ====aaa====
18104 ==b==
18105 ===ba===
18106 ===bb===
18107 ====bba====
18108 ===bc===
18109 ==c==
18110 ===ca===
18111 !! html/php
18112 start
18113 !! end
18114
18115 !! test
18116 Section extraction test (section 1)
18117 !! options
18118 section=1
18119 !! wikitext
18120 start
18121 ==a==
18122 ===aa===
18123 ====aaa====
18124 ==b==
18125 ===ba===
18126 ===bb===
18127 ====bba====
18128 ===bc===
18129 ==c==
18130 ===ca===
18131 !! html/php
18132 ==a==
18133 ===aa===
18134 ====aaa====
18135 !! end
18136
18137 !! test
18138 Section extraction test (section 2)
18139 !! options
18140 section=2
18141 !! wikitext
18142 start
18143 ==a==
18144 ===aa===
18145 ====aaa====
18146 ==b==
18147 ===ba===
18148 ===bb===
18149 ====bba====
18150 ===bc===
18151 ==c==
18152 ===ca===
18153 !! html/php
18154 ===aa===
18155 ====aaa====
18156 !! end
18157
18158 !! test
18159 Section extraction test (section 3)
18160 !! options
18161 section=3
18162 !! wikitext
18163 start
18164 ==a==
18165 ===aa===
18166 ====aaa====
18167 ==b==
18168 ===ba===
18169 ===bb===
18170 ====bba====
18171 ===bc===
18172 ==c==
18173 ===ca===
18174 !! html/php
18175 ====aaa====
18176 !! end
18177
18178 !! test
18179 Section extraction test (section 4)
18180 !! options
18181 section=4
18182 !! wikitext
18183 start
18184 ==a==
18185 ===aa===
18186 ====aaa====
18187 ==b==
18188 ===ba===
18189 ===bb===
18190 ====bba====
18191 ===bc===
18192 ==c==
18193 ===ca===
18194 !! html/php
18195 ==b==
18196 ===ba===
18197 ===bb===
18198 ====bba====
18199 ===bc===
18200 !! end
18201
18202 !! test
18203 Section extraction test (section 5)
18204 !! options
18205 section=5
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 ===ba===
18220 !! end
18221
18222 !! test
18223 Section extraction test (section 6)
18224 !! options
18225 section=6
18226 !! wikitext
18227 start
18228 ==a==
18229 ===aa===
18230 ====aaa====
18231 ==b==
18232 ===ba===
18233 ===bb===
18234 ====bba====
18235 ===bc===
18236 ==c==
18237 ===ca===
18238 !! html/php
18239 ===bb===
18240 ====bba====
18241 !! end
18242
18243 !! test
18244 Section extraction test (section 7)
18245 !! options
18246 section=7
18247 !! wikitext
18248 start
18249 ==a==
18250 ===aa===
18251 ====aaa====
18252 ==b==
18253 ===ba===
18254 ===bb===
18255 ====bba====
18256 ===bc===
18257 ==c==
18258 ===ca===
18259 !! html/php
18260 ====bba====
18261 !! end
18262
18263 !! test
18264 Section extraction test (section 8)
18265 !! options
18266 section=8
18267 !! wikitext
18268 start
18269 ==a==
18270 ===aa===
18271 ====aaa====
18272 ==b==
18273 ===ba===
18274 ===bb===
18275 ====bba====
18276 ===bc===
18277 ==c==
18278 ===ca===
18279 !! html/php
18280 ===bc===
18281 !! end
18282
18283 !! test
18284 Section extraction test (section 9)
18285 !! options
18286 section=9
18287 !! wikitext
18288 start
18289 ==a==
18290 ===aa===
18291 ====aaa====
18292 ==b==
18293 ===ba===
18294 ===bb===
18295 ====bba====
18296 ===bc===
18297 ==c==
18298 ===ca===
18299 !! html/php
18300 ==c==
18301 ===ca===
18302 !! end
18303
18304 !! test
18305 Section extraction test (section 10)
18306 !! options
18307 section=10
18308 !! wikitext
18309 start
18310 ==a==
18311 ===aa===
18312 ====aaa====
18313 ==b==
18314 ===ba===
18315 ===bb===
18316 ====bba====
18317 ===bc===
18318 ==c==
18319 ===ca===
18320 !! html/php
18321 ===ca===
18322 !! end
18323
18324 !! test
18325 Section extraction test (nonexistent section 11)
18326 !! options
18327 section=11
18328 !! wikitext
18329 start
18330 ==a==
18331 ===aa===
18332 ====aaa====
18333 ==b==
18334 ===ba===
18335 ===bb===
18336 ====bba====
18337 ===bc===
18338 ==c==
18339 ===ca===
18340 !! html/php
18341 !! end
18342
18343 !! test
18344 Section extraction test with bogus heading (section 1)
18345 !! options
18346 section=1
18347 !! wikitext
18348 ==a==
18349 ==bogus== not a legal section
18350 ==b==
18351 !! html/php
18352 ==a==
18353 ==bogus== not a legal section
18354 !! end
18355
18356 !! test
18357 Section extraction test with bogus heading (section 2)
18358 !! options
18359 section=2
18360 !! wikitext
18361 ==a==
18362 ==bogus== not a legal section
18363 ==b==
18364 !! html/php
18365 ==b==
18366 !! end
18367
18368 !! test
18369 Section extraction test with comment after heading (section 1)
18370 !! options
18371 section=1
18372 !! wikitext
18373 ==a==
18374 ==b== <!-- -->
18375 ==c==
18376 !! html/php
18377 ==a==
18378 !! end
18379
18380 !! test
18381 Section extraction test with comment after heading (section 2)
18382 !! options
18383 section=2
18384 !! wikitext
18385 ==a==
18386 ==b== <!-- -->
18387 ==c==
18388 !! html/php
18389 ==b== <!-- -->
18390 !! end
18391
18392 !! test
18393 Section extraction test with bogus <nowiki> heading (section 1)
18394 !! options
18395 section=1
18396 !! wikitext
18397 ==a==
18398 ==bogus== <nowiki>not a legal section</nowiki>
18399 ==b==
18400 !! html/php
18401 ==a==
18402 ==bogus== <nowiki>not a legal section</nowiki>
18403 !! end
18404
18405 !! test
18406 Section extraction test with bogus <nowiki> heading (section 2)
18407 !! options
18408 section=2
18409 !! wikitext
18410 ==a==
18411 ==bogus== <nowiki>not a legal section</nowiki>
18412 ==b==
18413 !! html/php
18414 ==b==
18415 !! end
18416
18417 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18418 # instead of respecting commented sections
18419 !! test
18420 Section extraction prefixed by comment (section 1)
18421 !! options
18422 section=1
18423 !! wikitext
18424 <!-- -->==sec1==
18425 ==sec2==
18426 !! html/php
18427 ==sec2==
18428 !!end
18429
18430 !! test
18431 Section extraction prefixed by comment (section 2)
18432 !! options
18433 section=2
18434 !! wikitext
18435 <!-- -->==sec1==
18436 ==sec2==
18437 !! html/php
18438
18439 !!end
18440
18441 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18442 # instead of respecting HTML-style headings
18443 !! test
18444 Section extraction, mixed wiki and html (section 1)
18445 !! options
18446 section=1
18447 !! wikitext
18448 <h2>unmarked</h2>
18449 unmarked
18450 ==1==
18451 one
18452 ==2==
18453 two
18454 !! html/php
18455 ==1==
18456 one
18457 !! end
18458
18459 !! test
18460 Section extraction, mixed wiki and html (section 2)
18461 !! options
18462 section=2
18463 !! wikitext
18464 <h2>unmarked</h2>
18465 unmarked
18466 ==1==
18467 one
18468 ==2==
18469 two
18470 !! html/php
18471 ==2==
18472 two
18473 !! end
18474
18475
18476 # Formerly testing for bug 3342
18477 !! test
18478 Section extraction, heading surrounded by <noinclude>
18479 !! options
18480 section=1
18481 !! wikitext
18482 <noinclude>==unmarked==</noinclude>
18483 ==marked==
18484 !! html/php
18485 ==marked==
18486 !!end
18487
18488 # Test behavior of bug 19910
18489 !! test
18490 Sectiion with all-equals
18491 !! options
18492 section=2
18493 !! wikitext
18494 ===
18495 The line above must have a trailing space
18496 === <!--
18497 --> <!-- -->
18498 But just in case it doesn't...
18499 !! html/php
18500 === <!--
18501 --> <!-- -->
18502 But just in case it doesn't...
18503 !! end
18504
18505 !! test
18506 Section replacement test (section 0)
18507 !! options
18508 replace=0,"xxx"
18509 !! wikitext
18510 start
18511 ==a==
18512 ===aa===
18513 ====aaa====
18514 ==b==
18515 ===ba===
18516 ===bb===
18517 ====bba====
18518 ===bc===
18519 ==c==
18520 ===ca===
18521 !! html/php
18522 xxx
18523
18524 ==a==
18525 ===aa===
18526 ====aaa====
18527 ==b==
18528 ===ba===
18529 ===bb===
18530 ====bba====
18531 ===bc===
18532 ==c==
18533 ===ca===
18534 !! end
18535
18536 !! test
18537 Section replacement test (section 1)
18538 !! options
18539 replace=1,"xxx"
18540 !! wikitext
18541 start
18542 ==a==
18543 ===aa===
18544 ====aaa====
18545 ==b==
18546 ===ba===
18547 ===bb===
18548 ====bba====
18549 ===bc===
18550 ==c==
18551 ===ca===
18552 !! html/php
18553 start
18554 xxx
18555
18556 ==b==
18557 ===ba===
18558 ===bb===
18559 ====bba====
18560 ===bc===
18561 ==c==
18562 ===ca===
18563 !! end
18564
18565 !! test
18566 Section replacement test (section 2)
18567 !! options
18568 replace=2,"xxx"
18569 !! wikitext
18570 start
18571 ==a==
18572 ===aa===
18573 ====aaa====
18574 ==b==
18575 ===ba===
18576 ===bb===
18577 ====bba====
18578 ===bc===
18579 ==c==
18580 ===ca===
18581 !! html/php
18582 start
18583 ==a==
18584 xxx
18585
18586 ==b==
18587 ===ba===
18588 ===bb===
18589 ====bba====
18590 ===bc===
18591 ==c==
18592 ===ca===
18593 !! end
18594
18595 !! test
18596 Section replacement test (section 3)
18597 !! options
18598 replace=3,"xxx"
18599 !! wikitext
18600 start
18601 ==a==
18602 ===aa===
18603 ====aaa====
18604 ==b==
18605 ===ba===
18606 ===bb===
18607 ====bba====
18608 ===bc===
18609 ==c==
18610 ===ca===
18611 !! html/php
18612 start
18613 ==a==
18614 ===aa===
18615 xxx
18616
18617 ==b==
18618 ===ba===
18619 ===bb===
18620 ====bba====
18621 ===bc===
18622 ==c==
18623 ===ca===
18624 !! end
18625
18626 !! test
18627 Section replacement test (section 4)
18628 !! options
18629 replace=4,"xxx"
18630 !! wikitext
18631 start
18632 ==a==
18633 ===aa===
18634 ====aaa====
18635 ==b==
18636 ===ba===
18637 ===bb===
18638 ====bba====
18639 ===bc===
18640 ==c==
18641 ===ca===
18642 !! html/php
18643 start
18644 ==a==
18645 ===aa===
18646 ====aaa====
18647 xxx
18648
18649 ==c==
18650 ===ca===
18651 !! end
18652
18653 !! test
18654 Section replacement test (section 5)
18655 !! options
18656 replace=5,"xxx"
18657 !! wikitext
18658 start
18659 ==a==
18660 ===aa===
18661 ====aaa====
18662 ==b==
18663 ===ba===
18664 ===bb===
18665 ====bba====
18666 ===bc===
18667 ==c==
18668 ===ca===
18669 !! html/php
18670 start
18671 ==a==
18672 ===aa===
18673 ====aaa====
18674 ==b==
18675 xxx
18676
18677 ===bb===
18678 ====bba====
18679 ===bc===
18680 ==c==
18681 ===ca===
18682 !! end
18683
18684 !! test
18685 Section replacement test (section 6)
18686 !! options
18687 replace=6,"xxx"
18688 !! wikitext
18689 start
18690 ==a==
18691 ===aa===
18692 ====aaa====
18693 ==b==
18694 ===ba===
18695 ===bb===
18696 ====bba====
18697 ===bc===
18698 ==c==
18699 ===ca===
18700 !! html/php
18701 start
18702 ==a==
18703 ===aa===
18704 ====aaa====
18705 ==b==
18706 ===ba===
18707 xxx
18708
18709 ===bc===
18710 ==c==
18711 ===ca===
18712 !! end
18713
18714 !! test
18715 Section replacement test (section 7)
18716 !! options
18717 replace=7,"xxx"
18718 !! wikitext
18719 start
18720 ==a==
18721 ===aa===
18722 ====aaa====
18723 ==b==
18724 ===ba===
18725 ===bb===
18726 ====bba====
18727 ===bc===
18728 ==c==
18729 ===ca===
18730 !! html/php
18731 start
18732 ==a==
18733 ===aa===
18734 ====aaa====
18735 ==b==
18736 ===ba===
18737 ===bb===
18738 xxx
18739
18740 ===bc===
18741 ==c==
18742 ===ca===
18743 !! end
18744
18745 !! test
18746 Section replacement test (section 8)
18747 !! options
18748 replace=8,"xxx"
18749 !! wikitext
18750 start
18751 ==a==
18752 ===aa===
18753 ====aaa====
18754 ==b==
18755 ===ba===
18756 ===bb===
18757 ====bba====
18758 ===bc===
18759 ==c==
18760 ===ca===
18761 !! html/php
18762 start
18763 ==a==
18764 ===aa===
18765 ====aaa====
18766 ==b==
18767 ===ba===
18768 ===bb===
18769 ====bba====
18770 xxx
18771
18772 ==c==
18773 ===ca===
18774 !!end
18775
18776 !! test
18777 Section replacement test (section 9)
18778 !! options
18779 replace=9,"xxx"
18780 !! wikitext
18781 start
18782 ==a==
18783 ===aa===
18784 ====aaa====
18785 ==b==
18786 ===ba===
18787 ===bb===
18788 ====bba====
18789 ===bc===
18790 ==c==
18791 ===ca===
18792 !! html/php
18793 start
18794 ==a==
18795 ===aa===
18796 ====aaa====
18797 ==b==
18798 ===ba===
18799 ===bb===
18800 ====bba====
18801 ===bc===
18802 xxx
18803 !! end
18804
18805 !! test
18806 Section replacement test (section 10)
18807 !! options
18808 replace=10,"xxx"
18809 !! wikitext
18810 start
18811 ==a==
18812 ===aa===
18813 ====aaa====
18814 ==b==
18815 ===ba===
18816 ===bb===
18817 ====bba====
18818 ===bc===
18819 ==c==
18820 ===ca===
18821 !! html/php
18822 start
18823 ==a==
18824 ===aa===
18825 ====aaa====
18826 ==b==
18827 ===ba===
18828 ===bb===
18829 ====bba====
18830 ===bc===
18831 ==c==
18832 xxx
18833 !! end
18834
18835 !! test
18836 Section replacement test with initial whitespace (bug 13728)
18837 !! options
18838 replace=2,"xxx"
18839 !! wikitext
18840 Preformatted initial line
18841 ==a==
18842 ===a===
18843 !! html/php
18844 Preformatted initial line
18845 ==a==
18846 xxx
18847 !! end
18848
18849
18850 !! test
18851 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18852 !! options
18853 section=1
18854 !! wikitext
18855 ==a==
18856 a
18857 !! html/php
18858 ==a==
18859 a
18860 !! end
18861
18862 !! test
18863 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18864 !! options
18865 section=1
18866 !! wikitext
18867 ==a==
18868 a
18869 !! html/php
18870 ==a==
18871 a
18872 !! end
18873
18874
18875 !! test
18876 Section extraction, <pre> around bogus header (bug 10309)
18877 !! options
18878 section=2
18879 !! wikitext
18880 == Section One ==
18881 <pre>
18882 =======
18883 </pre>
18884
18885 == Section Two ==
18886 stuff
18887 !! html/php
18888 == Section Two ==
18889 stuff
18890 !! end
18891
18892 !! test
18893 Section replacement, <pre> around bogus header (bug 10309)
18894 !! options
18895 replace=2,"xxx"
18896 !! wikitext
18897 == Section One ==
18898 <pre>
18899 =======
18900 </pre>
18901
18902 == Section Two ==
18903 stuff
18904 !! html/php
18905 == Section One ==
18906 <pre>
18907 =======
18908 </pre>
18909
18910 xxx
18911 !! end
18912
18913 !! test
18914 Handling of &#x0A; in URLs
18915 !! wikitext
18916 ** irc://&#x0A;a
18917 !! html/php
18918 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18919
18920 !! html/parsoid
18921 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa" data-parsoid='{"stx":"url","a":{"href":"irc://%0Aa"},"sa":{"href":"irc://&amp;#x0A;a"}}'>irc://%0Aa</a></li></ul></li></ul>
18922 !! end
18923
18924 !! test
18925 Handling of %0A in URLs
18926 !! wikitext
18927 ** irc://%0Aa
18928 !! html/php
18929 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18930
18931 !! html/parsoid
18932 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18933 !! end
18934
18935 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18936 !! test
18937 5 quotes, code coverage +1 line
18938 !! options
18939 parsoid=wt2html
18940 !! wikitext
18941 '''''
18942 !! html/php
18943 !! html/parsoid
18944 <p><b><i></i></b></p>
18945 !! end
18946
18947 # same html as previous, but wikitext adjusted to match parsoid html2wt
18948 # note that wt2html and html2html will put the <i> before the <b>
18949 !! test
18950 5 quotes, code coverage +1 line w/ nowiki (1)
18951 !! options
18952 parsoid=wt2wt,html2wt
18953 !! wikitext
18954 '''''<nowiki/>'''''
18955 !! html/php
18956 <p><i></i>
18957 </p>
18958 !! html/parsoid
18959 <p><b><i></i></b></p>
18960 !! end
18961
18962 # same as previous, just swapping the <i> and <b>
18963 !! test
18964 5 quotes, code coverage +1 line w/ nowiki (2)
18965 !! wikitext
18966 '''''<nowiki/>'''''
18967 !! html/php
18968 <p><i></i>
18969 </p>
18970 !! html/parsoid
18971 <p><i><b></b></i></p>
18972 !! end
18973
18974 !! test
18975 Special:Search page linking.
18976 !! wikitext
18977 {{Special:search}}
18978 !! html
18979 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18980 </p>
18981 !! end
18982
18983 !! test
18984 {{!}} is a magic word
18985 !! wikitext
18986 {{!}} is a magic word there and {{!}} is still a magic word here
18987 | is not a magic word here but {{!}} is still a magic word here
18988 !! html/php
18989 <p>| is a magic word there and | is still a magic word here
18990 | is not a magic word here but | is still a magic word here
18991 </p>
18992 !! html/parsoid
18993 <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
18994 | 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>
18995
18996 !! end
18997
18998 !! test
18999 Say the magic word
19000 !! options
19001 title=[[Parser test]]
19002 !! wikitext
19003 * {{PAGENAME}}
19004 * {{PAGENAMEE}}
19005 * {{FULLPAGENAME}}
19006 * {{FULLPAGENAMEE}}
19007 * {{BASEPAGENAME}}
19008 * {{BASEPAGENAMEE}}
19009 * {{SUBPAGENAME}}
19010 * {{SUBPAGENAMEE}}
19011 * {{ROOTPAGENAME}}
19012 * {{ROOTPAGENAMEE}}
19013 * {{TALKPAGENAME}}
19014 * {{TALKPAGENAMEE}}
19015 * {{SUBJECTPAGENAME}}
19016 * {{SUBJECTPAGENAMEE}}
19017 * {{NAMESPACEE}}
19018 * {{NAMESPACE}}
19019 * {{NAMESPACENUMBER}}
19020 * {{TALKSPACE}}
19021 * {{TALKSPACEE}}
19022 * {{SUBJECTSPACE}}
19023 * {{SUBJECTSPACEE}}
19024 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
19025 !! html
19026 <ul><li> Parser test</li>
19027 <li> Parser_test</li>
19028 <li> Parser test</li>
19029 <li> Parser_test</li>
19030 <li> Parser test</li>
19031 <li> Parser_test</li>
19032 <li> Parser test</li>
19033 <li> Parser_test</li>
19034 <li> Parser test</li>
19035 <li> Parser_test</li>
19036 <li> Talk:Parser test</li>
19037 <li> Talk:Parser_test</li>
19038 <li> Parser test</li>
19039 <li> Parser_test</li>
19040 <li> </li>
19041 <li> </li>
19042 <li> 0</li>
19043 <li> Talk</li>
19044 <li> Talk</li>
19045 <li> </li>
19046 <li> </li>
19047 <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>
19048
19049 !! end
19050 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
19051
19052 ## Parsoid thinks the "centre" here is a property, not a caption.
19053 !! test
19054 Gallery
19055 !! options
19056 parsoid={
19057 "modes": ["wt2html"],
19058 "nativeGallery": true
19059 }
19060 !! wikitext
19061 <gallery>
19062 image1.png |
19063 image2.gif|||||
19064
19065 image3|
19066 image4 |300px| centre
19067 image5.svg| http://///////
19068 [[x|xx]]]]
19069 * image6
19070 </gallery>
19071 !! html/php
19072 <ul class="gallery mw-gallery-traditional">
19073 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19074 <div class="thumb" style="height: 150px;">Image1.png</div>
19075 <div class="gallerytext">
19076 </div>
19077 </div></li>
19078 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19079 <div class="thumb" style="height: 150px;">Image2.gif</div>
19080 <div class="gallerytext">
19081 </div>
19082 </div></li>
19083 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19084 <div class="thumb" style="height: 150px;">Image3</div>
19085 <div class="gallerytext">
19086 </div>
19087 </div></li>
19088 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19089 <div class="thumb" style="height: 150px;">Image4</div>
19090 <div class="gallerytext">
19091 <pre>centre
19092 </pre>
19093 </div>
19094 </div></li>
19095 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19096 <div class="thumb" style="height: 150px;">Image5.svg</div>
19097 <div class="gallerytext">
19098 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
19099 </p>
19100 </div>
19101 </div></li>
19102 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19103 <div class="thumb" style="height: 150px;">* image6</div>
19104 <div class="gallerytext">
19105 </div>
19106 </div></li>
19107 </ul>
19108
19109 !! html/parsoid
19110 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19111 <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>
19112 <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>
19113 <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>
19114 <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>
19115 <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>
19116 <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>
19117 </ul>
19118 !! end
19119
19120 !! test
19121 Gallery (with options, html)
19122 !! options
19123 parsoid={
19124 "modes": ["wt2html", "html2html"],
19125 "nativeGallery": true
19126 }
19127 !! wikitext
19128 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19129 File:Nonexistent.jpg|caption
19130 File:Nonexistent.jpg
19131 image:foobar.jpg|some '''caption''' [[Main Page]]
19132 image:foobar.jpg
19133 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19134 </gallery>
19135 !! html/php
19136 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19137 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19138 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19139 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19140 <div class="gallerytext">
19141 <p>caption
19142 </p>
19143 </div>
19144 </div></li>
19145 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19146 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19147 <div class="gallerytext">
19148 </div>
19149 </div></li>
19150 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19151 <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>
19152 <div class="gallerytext">
19153 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19154 </p>
19155 </div>
19156 </div></li>
19157 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19158 <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>
19159 <div class="gallerytext">
19160 </div>
19161 </div></li>
19162 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19163 <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>
19164 <div class="gallerytext">
19165 <p>blabla.
19166 </p>
19167 </div>
19168 </div></li>
19169 </ul>
19170
19171 !! html/parsoid
19172 <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":{}}'>
19173 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19174 <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>
19175 <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>
19176 <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>
19177 <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>
19178 <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>
19179 </ul>
19180 !! end
19181
19182 !! test
19183 Gallery (with options, extsrc)
19184 !! options
19185 parsoid={
19186 "nativeGallery": false
19187 }
19188 !! wikitext
19189 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19190 File:Nonexistent.jpg|caption
19191 File:Nonexistent.jpg
19192 image:foobar.jpg|some '''caption''' [[Main Page]]
19193 image:foobar.jpg
19194 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19195 </gallery>
19196 !! html/php
19197 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19198 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19199 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19200 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19201 <div class="gallerytext">
19202 <p>caption
19203 </p>
19204 </div>
19205 </div></li>
19206 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19207 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19208 <div class="gallerytext">
19209 </div>
19210 </div></li>
19211 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19212 <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>
19213 <div class="gallerytext">
19214 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19215 </p>
19216 </div>
19217 </div></li>
19218 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19219 <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>
19220 <div class="gallerytext">
19221 </div>
19222 </div></li>
19223 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19224 <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>
19225 <div class="gallerytext">
19226 <p>blabla.
19227 </p>
19228 </div>
19229 </div></li>
19230 </ul>
19231
19232 !! html/parsoid
19233 <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"}}'>
19234 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19235 <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>
19236 <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>
19237 <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>
19238 <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>
19239 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span 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>
19240 </ul>
19241 !! end
19242
19243 !! test
19244 Gallery with link that has fragment
19245 !! options
19246 parsoid={
19247 "modes": ["wt2html", "html2html"],
19248 "nativeGallery": true
19249 }
19250 !! wikitext
19251 <gallery>
19252 image:foobar.jpg|link=Main_Page
19253 image:foobar.jpg|link=Main_Page#section
19254 image:foobar.jpg|link=Main Page#section|caption
19255 </gallery>
19256 !! html/php
19257 <ul class="gallery mw-gallery-traditional">
19258 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19259 <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>
19260 <div class="gallerytext">
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/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>
19265 <div class="gallerytext">
19266 </div>
19267 </div></li>
19268 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19269 <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>
19270 <div class="gallerytext">
19271 <p>caption
19272 </p>
19273 </div>
19274 </div></li>
19275 </ul>
19276
19277 !! html/parsoid
19278 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19279 <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>
19280 <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>
19281 <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>
19282 </ul>
19283 !! end
19284
19285 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19286 !! test
19287 Gallery with template inside caption
19288 !! options
19289 parsoid={
19290 "nativeGallery": true
19291 }
19292 !! wikitext
19293 <gallery caption="{{echo|hi}}">
19294 File:Foobar.jpg|{{echo|ho}}
19295 </gallery>
19296 !! html/php
19297 <ul class="gallery mw-gallery-traditional">
19298 <li class='gallerycaption'>{{echo|hi}}</li>
19299 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19300 <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>
19301 <div class="gallerytext">
19302 <p>ho
19303 </p>
19304 </div>
19305 </div></li>
19306 </ul>
19307
19308 !! html/parsoid
19309 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19310 <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>
19311 <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>
19312 </ul>
19313 !! end
19314
19315 !! test
19316 Gallery with wikitext inside caption
19317 !! options
19318 parsoid={
19319 "nativeGallery": true
19320 }
19321 !! wikitext
19322 <gallery>
19323 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19324 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19325 </gallery>
19326 !! html/php
19327 <ul class="gallery mw-gallery-traditional">
19328 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19329 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
19330 <div class="gallerytext">
19331 <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>
19332 </p>
19333 </div>
19334 </div></li>
19335 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19336 <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>
19337 <div class="gallerytext">
19338 <p>This is a test template
19339 </p>
19340 </div>
19341 </div></li>
19342 </ul>
19343
19344 !! html/parsoid
19345 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19346 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./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>
19347 <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>
19348 </ul>
19349 !! end
19350
19351 !! test
19352 Gallery (with showfilename option)
19353 !! options
19354 parsoid={
19355 "nativeGallery": true
19356 }
19357 !! wikitext
19358 <gallery showfilename="">
19359 File:Nonexistent.jpg|caption
19360 File:Nonexistent.jpg
19361 File:Foobar.jpg|some '''caption''' [[Main Page]]
19362 File:Foobar.jpg
19363 </gallery>
19364 !! html/php
19365 <ul class="gallery mw-gallery-traditional">
19366 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19367 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19368 <div class="gallerytext">
19369 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19370 caption
19371 </p>
19372 </div>
19373 </div></li>
19374 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19375 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19376 <div class="gallerytext">
19377 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19378 </p>
19379 </div>
19380 </div></li>
19381 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19382 <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>
19383 <div class="gallerytext">
19384 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19385 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19386 </p>
19387 </div>
19388 </div></li>
19389 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19390 <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>
19391 <div class="gallerytext">
19392 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19393 </p>
19394 </div>
19395 </div></li>
19396 </ul>
19397
19398 !! html/parsoid
19399 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
19400 <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>
19401 <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>
19402 <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>
19403 <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>
19404 </ul>
19405 !! end
19406
19407 ## Should Parsoid be preserving these variations?
19408 !! test
19409 Gallery (with namespace-less filenames)
19410 !! options
19411 parsoid={
19412 "modes": ["wt2html", "html2html"],
19413 "nativeGallery": true
19414 }
19415 !! wikitext
19416 <gallery>
19417 File:Nonexistent.jpg
19418 Nonexistent.jpg
19419 image:foobar.jpg
19420 foobar.jpg
19421 </gallery>
19422 !! html/php
19423 <ul class="gallery mw-gallery-traditional">
19424 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19425 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19426 <div class="gallerytext">
19427 </div>
19428 </div></li>
19429 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19430 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19431 <div class="gallerytext">
19432 </div>
19433 </div></li>
19434 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19435 <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>
19436 <div class="gallerytext">
19437 </div>
19438 </div></li>
19439 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19440 <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>
19441 <div class="gallerytext">
19442 </div>
19443 </div></li>
19444 </ul>
19445
19446 !! html/parsoid
19447 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19448 <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>
19449 <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>
19450 <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>
19451 <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>
19452 </ul>
19453 !! end
19454
19455 !! test
19456 Gallery override link with WikiLink (T36852)
19457 !! options
19458 parsoid={
19459 "nativeGallery": true
19460 }
19461 !! wikitext
19462 <gallery>
19463 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
19464 </gallery>
19465 !! html/php
19466 <ul class="gallery mw-gallery-traditional">
19467 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19468 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
19469 <div class="gallerytext">
19470 </div>
19471 </div></li>
19472 </ul>
19473
19474 !! html/parsoid
19475 <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":{}}'>
19476 <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>
19477 </ul>
19478 !! end
19479
19480 !! test
19481 Gallery override link with absolute external link (T36852)
19482 !! options
19483 parsoid={
19484 "nativeGallery": true
19485 }
19486 !! wikitext
19487 <gallery>
19488 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
19489 </gallery>
19490 !! html/php
19491 <ul class="gallery mw-gallery-traditional">
19492 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19493 <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>
19494 <div class="gallerytext">
19495 </div>
19496 </div></li>
19497 </ul>
19498
19499 !! html/parsoid
19500 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19501 <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>
19502 </ul>
19503 !! end
19504
19505 !! test
19506 Gallery override link with absolute external link with LanguageConverter
19507 !! options
19508 language=zh
19509 !! input
19510 <gallery>
19511 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19512 </gallery>
19513 !! result
19514 <ul class="gallery mw-gallery-traditional">
19515 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19516 <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>
19517 <div class="gallerytext">
19518 <p>caption
19519 </p>
19520 </div>
19521 </div></li>
19522 </ul>
19523
19524 !! end
19525
19526 !! test
19527 Gallery override link with malicious javascript (T36852)
19528 !! options
19529 parsoid={
19530 "modes": ["wt2html", "html2html"],
19531 "nativeGallery": true
19532 }
19533 !! wikitext
19534 <gallery>
19535 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19536 </gallery>
19537 !! html/php
19538 <ul class="gallery mw-gallery-traditional">
19539 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19540 <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>
19541 <div class="gallerytext">
19542 </div>
19543 </div></li>
19544 </ul>
19545
19546 !! html/parsoid
19547 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19548 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./%22_onclick=%22alert('malicious_javascript_code!');"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"></div></li>
19549 </ul>
19550 !! end
19551
19552 !! test
19553 Gallery with invalid title as link (T45964)
19554 !! options
19555 parsoid={
19556 "modes": ["wt2html", "html2html"],
19557 "nativeGallery": true
19558 }
19559 !! wikitext
19560 <gallery>
19561 File:Foobar.jpg|link=<
19562 </gallery>
19563 !! html/php
19564 <ul class="gallery mw-gallery-traditional">
19565 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19566 <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>
19567 <div class="gallerytext">
19568 </div>
19569 </div></li>
19570 </ul>
19571
19572 !! html/parsoid
19573 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19574 <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>
19575 </ul>
19576 !! end
19577
19578 !! test
19579 Serialize gallery without attrs in data-mw
19580 !! options
19581 parsoid={
19582 "modes": ["html2wt"],
19583 "nativeGallery": true
19584 }
19585 !! html/parsoid
19586 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
19587 <li class="gallerycaption">123</li>
19588 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Test.png</span></div><div class="gallerytext"></div></li>
19589 </ul>
19590 !! wikitext
19591 <gallery caption="123">
19592 File:Test.png
19593 </gallery>
19594 !! end
19595
19596 !! test
19597 HTML Hex character encoding (spells the word "JavaScript")
19598 !! options
19599 parsoid=wt2html,wt2wt,html2html
19600 !! wikitext
19601 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19602 !! html/php
19603 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19604 </p>
19605 !! html/php+tidy
19606 <p>JavaScript</p>
19607 !! html/parsoid
19608 <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>
19609 !! end
19610
19611 !! test
19612 HTML Hex character encoding bogus encoding (bug 26437 regression check)
19613 !! wikitext
19614 &#xsee;&#XSEE;
19615 !! html/php
19616 <p>&amp;#xsee;&amp;#XSEE;
19617 </p>
19618 !! html/parsoid
19619 <p>&amp;#xsee;&amp;#XSEE;</p>
19620 !! end
19621
19622 !! test
19623 HTML Hex character encoding mixed case
19624 !! options
19625 parsoid=wt2html,wt2wt,html2html
19626 !! wikitext
19627 &#xEE;&#Xee;
19628 !! html/php
19629 <p>&#xee;&#xee;
19630 </p>
19631 !! html/php+tidy
19632 <p>îî</p>
19633 !! html/parsoid
19634 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19635 !! end
19636
19637 # See: https://www.w3.org/TR/html5/syntax.html#character-references
19638 # Note that U+000C (form feed) is not a valid XML character, so
19639 # it is banned even though allowed in HTML5.
19640 !! test
19641 Illegal character references (T106578)
19642 !! wikitext
19643 ; Null: &#00;
19644 ; FF: &#xC;
19645 ; CR: &#xD;
19646 ; Control (low): &#8;
19647 ; Control (high): &#x7F; &#x9F;
19648 ; Surrogate: &#xD83D;&#xDCA9;
19649 ; This is an okay astral character: &#x1F4A9;
19650 !! html+tidy
19651 <dl>
19652 <dt>Null</dt>
19653 <dd>&amp;#00;</dd>
19654 <dt>FF</dt>
19655 <dd>&amp;#xC;</dd>
19656 <dt>CR</dt>
19657 <dd>&amp;#xD;</dd>
19658 <dt>Control (low)</dt>
19659 <dd>&amp;#8;</dd>
19660 <dt>Control (high)</dt>
19661 <dd>&amp;#x7F; &amp;#x9F;</dd>
19662 <dt>Surrogate</dt>
19663 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19664 <dt>This is an okay astral character</dt>
19665 <dd>💩</dd>
19666 </dl>
19667 !! end
19668
19669 !! test
19670 __FORCETOC__ override
19671 !! wikitext
19672 __NEWSECTIONLINK__
19673 __FORCETOC__
19674 !! html/php
19675 <p><br />
19676 </p>
19677 !! end
19678
19679 !! test
19680 ISBN code coverage
19681 !! wikitext
19682 ISBN 978-0-1234-56&#x20;789
19683 !! html
19684 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19685 </p>
19686 !! html+tidy
19687 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19688 !! html/parsoid
19689 <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>
19690 !! end
19691
19692 !! test
19693 ISBN followed by 5 spaces
19694 !! wikitext
19695 ISBN
19696 !! html
19697 <p>ISBN
19698 </p>
19699 !! end
19700
19701 !! test
19702 Double ISBN
19703 !! wikitext
19704 ISBN ISBN 1234567890
19705 !! html/php
19706 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19707 </p>
19708 !! html/parsoid
19709 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19710 !! end
19711
19712 # Uppercase X and lowercase x as well
19713 !! test
19714 ISBN with an X
19715 !! wikitext
19716 ISBN 3-462-04561-X
19717 ISBN 3-462-04561-x
19718 ISBN 080442957X
19719 ISBN 080442957x
19720 ISBN 978080442957X
19721 ISBN 978080442957x
19722 !! html/php
19723 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19724 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19725 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19726 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19727 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19728 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19729 </p>
19730 !! html/parsoid
19731 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19732 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19733 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19734 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19735 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19736 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19737 !! end
19738
19739 !! test
19740 ISBN with empty prefix (parsoid test)
19741 !! wikitext
19742 ISBN 1234567890
19743 !! html/php
19744 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19745 </p>
19746 !! html/parsoid
19747 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19748 !! end
19749
19750 !! test
19751 Bug 22905: <abbr> followed by ISBN followed by </a>
19752 !! wikitext
19753 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19754 !! html/php
19755 <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>
19756 </p>
19757 !! html/parsoid
19758 <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>
19759 !! end
19760
19761 !! test
19762 Double RFC
19763 !! wikitext
19764 RFC RFC 1234
19765 !! html
19766 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19767 </p>
19768 !! end
19769
19770 !! test
19771 Double RFC with a wiki link
19772 !! wikitext
19773 RFC [[RFC 1234]]
19774 !! html
19775 <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>
19776 </p>
19777 !! end
19778
19779 !! test
19780 RFC code coverage
19781 !! wikitext
19782 RFC 983&#x20;987
19783 !! html
19784 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19785 </p>
19786 !! html+tidy
19787 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19788 !! end
19789
19790 !! test
19791 Centre-aligned image
19792 !! wikitext
19793 [[Image:foobar.jpg|centre]]
19794 !! html
19795 <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>
19796
19797 !!end
19798
19799 !! test
19800 None-aligned image
19801 !! wikitext
19802 [[Image:foobar.jpg|none]]
19803 !! html
19804 <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>
19805
19806 !!end
19807
19808 !! test
19809 Width + Height sized image (using px) (height is ignored)
19810 !! wikitext
19811 [[Image:foobar.jpg|640x480px]]
19812 !! html
19813 <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>
19814 </p>
19815 !!end
19816
19817 !! test
19818 Width-sized image (using px, no following whitespace)
19819 !! wikitext
19820 [[Image:foobar.jpg|640px]]
19821 !! html
19822 <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>
19823 </p>
19824 !!end
19825
19826 !! test
19827 Width-sized image (using px, with following whitespace - test regression from r39467)
19828 !! wikitext
19829 [[Image:foobar.jpg|640px ]]
19830 !! html
19831 <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>
19832 </p>
19833 !!end
19834
19835 !! test
19836 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19837 !! wikitext
19838 [[Image:foobar.jpg| 640px]]
19839 !! html
19840 <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>
19841 </p>
19842 !!end
19843
19844 !! test
19845 Image with page parameter
19846 !! options
19847 djvu
19848 !! wikitext
19849 [[File:LoremIpsum.djvu|page=2]]
19850 !! html/php
19851 <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>
19852 </p>
19853 !! html/parsoid
19854 <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>
19855 !! end
19856
19857 !! test
19858 Another italics / bold test
19859 !! wikitext
19860 ''' ''x'
19861 !! html
19862 <pre>'<i> </i>x'
19863 </pre>
19864 !!end
19865
19866 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19867 !! test
19868 dt/dd/dl test
19869 !! wikitext
19870 :;;;::
19871 !! html/php
19872 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19873
19874 !! html/parsoid
19875 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19876
19877 !!end
19878
19879 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19880 !! test
19881 Images with the "|" character in the comment
19882 !! wikitext
19883 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19884 !! html/php
19885 <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>
19886
19887 !! html/parsoid
19888 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>An <a rel="mw:ExtLink" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx" data-parsoid='{"a":{"href":"http://test/?param1=%7Cleft%7C&amp;param2=%7Cx"},"sa":{"href":"http://test/?param1=|left|&amp;param2=|x"}}'>external</a> URL</figcaption></figure>
19889 !! end
19890
19891 !! test
19892 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19893 !! wikitext
19894 <html><script>alert(1);</script></html>
19895 !! html
19896 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19897 </p>
19898 !! end
19899
19900 !! test
19901 HTML with raw HTML ($wgRawHtml==true)
19902 !! options
19903 wgRawHtml=1
19904 !! wikitext
19905 <html><script>alert(1);</script></html>
19906 !! html
19907 <p><script>alert(1);</script>
19908 </p>
19909 !! end
19910
19911 !! test
19912 Parents of subpages, one level up
19913 !! options
19914 subpage title=[[Subpage test/L1/L2/L3]]
19915 !! wikitext
19916 [[../|L2]]
19917 !! html
19918 <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>
19919 </p>
19920 !! end
19921
19922
19923 !! test
19924 Parents of subpages, one level up, not named
19925 !! options
19926 subpage title=[[Subpage test/L1/L2/L3]]
19927 !! wikitext
19928 [[../]]
19929 !! html
19930 <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>
19931 </p>
19932 !! end
19933
19934
19935
19936 !! test
19937 Parents of subpages, two levels up
19938 !! options
19939 subpage title=[[Subpage test/L1/L2/L3]]
19940 !! wikitext
19941 [[../../|L1]]2
19942
19943 [[../../|L1]]l
19944 !! html
19945 <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
19946 </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>
19947 </p>
19948 !! end
19949
19950 !! test
19951 Parents of subpages, two levels up, without trailing slash or name.
19952 !! options
19953 subpage title=[[Subpage test/L1/L2/L3]]
19954 !! wikitext
19955 [[../..]]
19956 !! html
19957 <p>[[../..]]
19958 </p>
19959 !! end
19960
19961 !! test
19962 Parents of subpages, two levels up, with lots of extra trailing slashes.
19963 !! options
19964 subpage title=[[Subpage test/L1/L2/L3]]
19965 !! wikitext
19966 [[../../////]]
19967 !! html
19968 <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>
19969 </p>
19970 !! end
19971
19972 !! article
19973 Subpage test/L1/L2/L3Sibling
19974 !! text
19975 Sibling article
19976 !! endarticle
19977
19978 !! test
19979 Transclusion of a sibling page (one level up)
19980 !! options
19981 subpage title=[[Subpage test/L1/L2/L3]]
19982 !! wikitext
19983 {{../L3Sibling}}
19984 !! html
19985 <p>Sibling article
19986 </p>
19987 !! end
19988
19989 !! test
19990 Transclusion of a child page
19991 !! options
19992 subpage title=[[Subpage test/L1/L2]]
19993 !! wikitext
19994 {{/L3Sibling}}
19995 !! html
19996 <p>Sibling article
19997 </p>
19998 !! end
19999
20000 # This is wt2html only in Parsoid because we add <nowiki>
20001 # because of {{..}} and we don't expect to fix that to
20002 # eliminate the nowikis selective for {{..}} markup.
20003 !! test
20004 Non-transclusion because of too many up levels
20005 !! options
20006 subpage title=[[Subpage test/L1/L2/L3]]
20007 parsoid=wt2html
20008 !! wikitext
20009 {{../../../../More than parent}}
20010 !! html/php
20011 <p>{{../../../../More than parent}}
20012 </p>
20013 !! html/parsoid
20014 <p>{{../../../../More than parent}}</p>
20015 !! end
20016
20017 !! test
20018 Definition list code coverage
20019 !! wikitext
20020 ; title : def
20021 ; title : def
20022 ;title: def
20023 !! html/php
20024 <dl><dt> title &#160;</dt>
20025 <dd> def</dd>
20026 <dt> title&#160;</dt>
20027 <dd> def</dd>
20028 <dt>title</dt>
20029 <dd> def</dd></dl>
20030
20031 !! html/parsoid
20032 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20033 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20034 <dt>title</dt><dd> def</dd></dl>
20035 !! end
20036
20037 !! test
20038 Don't fall for the self-closing div
20039 !! wikitext
20040 <div>hello world</div/>
20041 !! html
20042 <div>hello world</div>
20043
20044 !! end
20045
20046 !! test
20047 MSGNW magic word
20048 !! wikitext
20049 {{MSGNW:msg}}
20050 !! html/php
20051 <p>&#91;&#91;:Template:Msg&#93;&#93;
20052 </p>
20053 !! end
20054
20055 !! test
20056 RAW magic word
20057 !! wikitext
20058 {{RAW:QUERTY}}
20059 !! html
20060 <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>
20061 </p>
20062 !! end
20063
20064 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
20065 !! test
20066 Always escape literal '>' in output, not just after '<'
20067 !! wikitext
20068 ><>
20069 !! html
20070 <p>&gt;&lt;&gt;
20071 </p>
20072 !! end
20073
20074 !! test
20075 Template caching
20076 !! wikitext
20077 {{Test}}
20078 {{Test}}
20079 !! html
20080 <p>This is a test template
20081 This is a test template
20082 </p>
20083 !! end
20084
20085
20086 !! article
20087 MediaWiki:Fake
20088 !! text
20089 ==header==
20090 !! endarticle
20091
20092 !! test
20093 Inclusion of !userCanEdit() content
20094 !! wikitext
20095 {{MediaWiki:Fake}}
20096 !! html
20097 <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>
20098
20099 !! end
20100
20101
20102 !! test
20103 Out-of-order TOC heading levels
20104 !! wikitext
20105 ==2==
20106 ======6======
20107 ===3===
20108 =1=
20109 =====5=====
20110 ==2==
20111 !! html
20112 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20113 <ul>
20114 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
20115 <ul>
20116 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
20117 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
20118 </ul>
20119 </li>
20120 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
20121 <ul>
20122 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
20123 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
20124 </ul>
20125 </li>
20126 </ul>
20127 </div>
20128
20129 <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>
20130 <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>
20131 <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>
20132 <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>
20133 <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>
20134 <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>
20135
20136 !! end
20137
20138
20139 !! test
20140 ISBN with a dummy number
20141 !! wikitext
20142 ISBN ---
20143 !! html
20144 <p>ISBN ---
20145 </p>
20146 !! end
20147
20148
20149 !! test
20150 ISBN with space-delimited number
20151 !! wikitext
20152 ISBN 92 9017 032 8
20153 !! html
20154 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
20155 </p>
20156 !! end
20157
20158
20159 !! test
20160 ISBN with multiple spaces, no number
20161 !! wikitext
20162 ISBN foo
20163 !! html
20164 <p>ISBN foo
20165 </p>
20166 !! end
20167
20168
20169 !! test
20170 ISBN length
20171 !! wikitext
20172 ISBN 123456789
20173
20174 ISBN 1234567890
20175
20176 ISBN 12345678901
20177 !! html
20178 <p>ISBN 123456789
20179 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20180 </p><p>ISBN 12345678901
20181 </p>
20182 !! end
20183
20184
20185 !! test
20186 ISBN with trailing year (bug 8110)
20187 !! wikitext
20188 ISBN 1-234-56789-0 - 2006
20189
20190 ISBN 1 234 56789 0 - 2006
20191 !! html
20192 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
20193 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20194 </p>
20195 !! end
20196
20197
20198 !! test
20199 anchorencode
20200 !! wikitext
20201 {{anchorencode:foo bar©#%n}}
20202 !! html
20203 <p>foo_bar.C2.A9.23.25n
20204 </p>
20205 !! end
20206
20207 !! test
20208 anchorencode trims spaces
20209 !! wikitext
20210 {{anchorencode: __pretty__please__}}
20211 !! html
20212 <p>pretty_please
20213 </p>
20214 !! end
20215
20216 !! test
20217 anchorencode deals with links
20218 !! wikitext
20219 {{anchorencode: [[hello|world]] [[hi]]}}
20220 !! html
20221 <p>world_hi
20222 </p>
20223 !! end
20224
20225 !! test
20226 anchorencode deals with templates
20227 !! wikitext
20228 {{anchorencode: {{Foo}} }}
20229 !! html
20230 <p>FOO
20231 </p>
20232 !! end
20233
20234 !! test
20235 anchorencode encodes like the TOC generator: (bug 18431)
20236 !! wikitext
20237 === _ +:.3A%3A&&amp;]] ===
20238 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20239 __NOEDITSECTION__
20240 !! html
20241 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20242 <p>.2B:.3A.253A.26.26.5D.5D
20243 </p>
20244 !! end
20245
20246 !! test
20247 Bug 6200: blockquotes and paragraph formatting
20248 !! wikitext
20249 <blockquote>
20250 foo
20251 </blockquote>
20252
20253 bar
20254
20255 baz
20256 !! html
20257 <blockquote>
20258 <p>foo
20259 </p>
20260 </blockquote>
20261 <p>bar
20262 </p>
20263 <pre>baz
20264 </pre>
20265 !! end
20266
20267 !! test
20268 Bug 8293: Use of center tag ruins paragraph formatting
20269 !! wikitext
20270 <center>
20271 foo
20272 </center>
20273
20274 bar
20275
20276 baz
20277 !! html
20278 <center>
20279 <p>foo
20280 </p>
20281 </center>
20282 <p>bar
20283 </p>
20284 <pre>baz
20285 </pre>
20286 !! end
20287
20288 !!test
20289 Parsing of overlapping (improperly nested) inline html tags
20290 !! wikitext
20291 <span><s>x</span></s>
20292 !! html/php
20293 <p><span><s>x&lt;/span&gt;</s></span>
20294 </p>
20295 !! html/parsoid
20296 <p><span><s>x</s></span>
20297 </p>
20298 !!end
20299
20300 ###
20301 ### Language variants related tests
20302 ###
20303 !! test
20304 Self-link in language variants
20305 !! options
20306 title=[[Dunav]] language=sr
20307 !! wikitext
20308 Both [[Dunav]] and [[Дунав]] are names for this river.
20309 !! html
20310 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
20311 </p>
20312 !!end
20313
20314 !! article
20315 Дуна
20316 !! text
20317 content
20318 !! endarticle
20319
20320 !! test
20321 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
20322 !! options
20323 title=[[Duna]] language=sr
20324 !! wikitext
20325 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
20326 !! html
20327 <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.
20328 </p>
20329 !! end
20330
20331 !! test
20332 Link to a section of a variant of this title shouldn't be parsed as self-link
20333 !! options
20334 title=[[Duna]] language=sr
20335 !! wikitext
20336 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
20337 !! html
20338 <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.
20339 </p>
20340 !! end
20341
20342 !! test
20343 Link to pages in language variants
20344 !! options
20345 language=sr
20346 !! wikitext
20347 Main Page can be written as [[Маин Паге]]
20348 !! html
20349 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
20350 </p>
20351 !!end
20352
20353
20354 !! test
20355 Multiple links to pages in language variants
20356 !! options
20357 language=sr
20358 !! wikitext
20359 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
20360 !! html
20361 <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>.
20362 </p>
20363 !!end
20364
20365
20366 !! test
20367 Simple template in language variants
20368 !! options
20369 language=sr
20370 !! wikitext
20371 {{тест}}
20372 !! html
20373 <p>This is a test template
20374 </p>
20375 !! end
20376
20377
20378 !! test
20379 Template with explicit namespace in language variants
20380 !! options
20381 language=sr
20382 !! wikitext
20383 {{Template:тест}}
20384 !! html
20385 <p>This is a test template
20386 </p>
20387 !! end
20388
20389
20390 !! test
20391 Basic test for template parameter in language variants
20392 !! options
20393 language=sr
20394 !! wikitext
20395 {{парамтест|param=foo}}
20396 !! html
20397 <p>This is a test template with parameter foo
20398 </p>
20399 !! end
20400
20401 !! test
20402 Simple category in language variants
20403 !! options
20404 language=sr cat
20405 !! wikitext
20406 [[Category:МедиаWики Усер'с Гуиде]]
20407 !! html/php
20408 cat=МедиаWики_Усер'с_Гуиде sort=
20409 !! html/parsoid
20410 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
20411 !! end
20412
20413 !! article
20414 Category:分类
20415 !! text
20416 blah
20417 !! endarticle
20418
20419 !! article
20420 Category:分類
20421 !! text
20422 blah
20423 !! endarticle
20424
20425 ## We used to, but no longer wt2wt this test since the default serializer
20426 ## will normalize all categories to serialize on their own line.
20427 ## This wikitext usage is going to be fairly uncommon in production and
20428 ## selser will take care of preserving formatting in those scenarios.
20429 !! test
20430 Don't convert blue categorylinks to another variant (bug 33210)
20431 !! options
20432 cat
20433 language=zh
20434 parsoid=wt2html
20435 !! wikitext
20436 [[A]][[Category:分类]]
20437 !! html/php
20438 cat=分类 sort=
20439 !! html/parsoid
20440 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
20441 <link rel="mw:PageProp/Category" href="./Category:分类"/>
20442 !! end
20443
20444 !! test
20445 Stripping -{}- tags (language variants)
20446 !! options
20447 language=sr
20448 !! wikitext
20449 Latin proverb: -{Ne nuntium necare}-
20450 !! html
20451 <p>Latin proverb: Ne nuntium necare
20452 </p>
20453 !! end
20454
20455
20456 !! test
20457 Prevent conversion with -{}- tags (language variants)
20458 !! options
20459 language=sr variant=sr-ec
20460 !! wikitext
20461 Latinski: -{Ne nuntium necare}-
20462 !! html
20463 <p>Латински: Ne nuntium necare
20464 </p>
20465 !! end
20466
20467
20468 !! test
20469 Prevent conversion of text with -{}- tags (language variants)
20470 !! options
20471 language=sr variant=sr-ec
20472 !! wikitext
20473 Latinski: -{Ne nuntium necare}-
20474 !! html
20475 <p>Латински: Ne nuntium necare
20476 </p>
20477 !! end
20478
20479
20480 !! test
20481 Prevent conversion of links with -{}- tags (language variants)
20482 !! options
20483 language=sr variant=sr-ec
20484 !! wikitext
20485 -{[[Main Page]]}-
20486 !! html
20487 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20488 </p>
20489 !! end
20490
20491
20492 !! test
20493 -{}- tags within headlines (within html for parserConvert())
20494 !! options
20495 language=sr variant=sr-ec
20496 !! wikitext
20497 == -{Naslov}- ==
20498 !! html
20499 <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>
20500
20501 !! end
20502
20503
20504 !! test
20505 Explicit definition of language variant alternatives
20506 !! options
20507 language=zh variant=zh-tw
20508 !! wikitext
20509 -{zh:China;zh-tw:Taiwan}-, not China
20510 !! html
20511 <p>Taiwan, not China
20512 </p>
20513 !! end
20514
20515
20516 !! test
20517 Conversion around HTML tags
20518 !! options
20519 language=sr variant=sr-ec
20520 !! wikitext
20521 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
20522 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
20523 !! html
20524 <p>
20525 <span title="ЛаCтин">ски</span>
20526 </p>
20527 !! end
20528
20529
20530 !! test
20531 Explicit session-wise language variant mapping (A flag and - flag)
20532 !! options
20533 language=zh variant=zh-tw
20534 !! wikitext
20535 Taiwan is not China.
20536 But -{A|zh:China;zh-tw:Taiwan}- is China,
20537 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20538 and -{China}- is China.
20539 !! html
20540 <p>Taiwan is not China.
20541 But Taiwan is Taiwan,
20542 (This should be stripped!)
20543 and China is China.
20544 </p>
20545 !! end
20546
20547 !! test
20548 Explicit session-wise language variant mapping (H flag for hide)
20549 !! options
20550 language=zh variant=zh-tw
20551 !! wikitext
20552 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20553 Taiwan is China.
20554 !! html
20555 <p>(This should be stripped!)
20556 Taiwan is Taiwan.
20557 </p>
20558 !! end
20559
20560 !! test
20561 Adding explicit conversion rule for title (T flag)
20562 !! options
20563 language=zh variant=zh-tw showtitle
20564 !! wikitext
20565 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20566 !! html
20567 Taiwan
20568 <p>Should be stripped!
20569 </p>
20570 !! end
20571
20572 !! test
20573 Testing that changing the language variant here in the tests actually works
20574 !! options
20575 language=zh variant=zh showtitle
20576 !! wikitext
20577 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20578 !! html
20579 China
20580 <p>Should be stripped!
20581 </p>
20582 !! end
20583
20584 !! test
20585 Recursive conversion of alt and title attrs shouldn't clear converter state
20586 !! options
20587 language=zh variant=zh-cn showtitle
20588 !! wikitext
20589 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20590 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20591 !! html
20592 China
20593 <p>
20594 Should be stripped<span title="Exclamation">!</span>
20595 </p>
20596 !! end
20597
20598 !! test
20599 Bug 24072: more test on conversion rule for title
20600 !! options
20601 language=zh variant=zh-tw showtitle
20602 !! wikitext
20603 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20604 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20605 !! html
20606 Taiwan
20607 <p>This should be stripped!
20608 This won't take interferes with the title rule.
20609 </p>
20610 !! end
20611
20612 !! test
20613 Partly disable title conversion if variant == main language code
20614 !! options
20615 language=zh variant=zh title=[[ZH]] showtitle
20616 !! wikitext
20617 -{T|zh-cn:CN;zh-tw:TW}-
20618 !! html
20619 ZH
20620 <p>
20621 </p>
20622 !! end
20623
20624 !! test
20625 Partly disable title conversion if variant == main language code, more
20626 !! options
20627 language=zh variant=zh title=[[ZH]] showtitle
20628 !! wikitext
20629 -{T|TW}-
20630 !! html
20631 ZH
20632 <p>
20633 </p>
20634 !! end
20635
20636 !! test
20637 Raw output of variant escape tags (R flag)
20638 !! options
20639 language=zh variant=zh-tw
20640 !! wikitext
20641 Raw: -{R|zh:China;zh-tw:Taiwan}-
20642 !! html
20643 <p>Raw: zh:China;zh-tw:Taiwan
20644 </p>
20645 !! end
20646
20647 !! test
20648 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20649 !! options
20650 language=zh variant=zh-cn
20651 !! input
20652 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20653 !! result
20654 <p>0
20655 </p>
20656 !! end
20657
20658 !! test
20659 Conversion rules from [numeric-only string] to [something else] (T48634)
20660 !! options
20661 language=zh variant=zh-cn
20662 !! input
20663 -{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
20664 !! result
20665 <p>D12345EE12345
20666 </p>
20667 !! end
20668
20669 !! test
20670 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20671 !! options
20672 language=zh variant=zh-cn
20673 !! input
20674 -{H|zh-cn:foo;zh-tw:;}-foobar
20675 !! result
20676 <p>foobar
20677 </p>
20678 !! end
20679
20680 !! test
20681 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20682 !! options
20683 language=zh variant=zh-cn
20684 !! input
20685 -{H|=>zh-cn:foo;}-foobar
20686 !! result
20687 <p>foobar
20688 </p>
20689 !! end
20690
20691 !! test
20692 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20693 !! options
20694 language=zh variant=zh-cn
20695 !! input
20696 -{H|}-foobar
20697 !! result
20698 <p>foobar
20699 </p>
20700 !! end
20701
20702 !! test
20703 Nested using of manual convert syntax
20704 !! options
20705 language=zh variant=zh-hk
20706 !! wikitext
20707 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20708 !! html
20709 <p>Nested: Hello Hong Kong!
20710 </p>
20711 !! end
20712
20713 # Since Parsoid is starting to emit canonical wikitext for links,
20714 # [http://example.com http://example.com] will not RT back to that
20715 # form anymore.
20716 !! test
20717 HTML markups with conversion syntax in attribs, nested in other conversion blocks
20718 !! options
20719 language=zh variant=zh-cn
20720 !! wikitext
20721 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
20722 !! html
20723 <p><span title="X">A</span>
20724 </p>
20725 !! end
20726
20727 !! test
20728 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet)
20729 !! options
20730 language=zh variant=zh-cn disabled
20731 !! wikitext
20732 -{<span title="-{X}-">A</span>}-
20733 !! html
20734 <p><span title="X">A</span>
20735 </p>
20736 !! end
20737
20738 !! test
20739 Proper conversion of text in external links
20740 !! options
20741 language=sr variant=sr-ec
20742 parsoid=wt2html
20743 !! wikitext
20744 http://www.google.com
20745 gopher://www.google.com
20746 [http://www.google.com http://www.google.com]
20747 [gopher://www.google.com gopher://www.google.com]
20748 [https://www.google.com irc://www.google.com]
20749 [ftp://www.google.com www.google.com/ftp://dir]
20750 [//www.google.com www.google.com]
20751 !! html/php
20752 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20753 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20754 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20755 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20756 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20757 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20758 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20759 </p>
20760 !! html/parsoid
20761 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20762 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20763 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20764 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20765 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20766 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20767 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20768 !! end
20769
20770 !! test
20771 Do not convert roman numbers to language variants
20772 !! options
20773 language=sr variant=sr-ec
20774 !! wikitext
20775 Fridrih IV je car.
20776 !! html
20777 <p>Фридрих IV је цар.
20778 </p>
20779 !! end
20780
20781 !! test
20782 Unclosed language converter markup "-{"
20783 !! options
20784 language=sr
20785 !! wikitext
20786 -{T|hello
20787 !! html
20788 <p>-{T|hello
20789 </p>
20790 !! end
20791
20792 !! test
20793 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20794 !! options
20795 language=sr
20796 !! wikitext
20797 -{R|=&gt;}-
20798 !! html
20799 <p>=&gt;
20800 </p>
20801 !!end
20802
20803 !! test
20804 Don't break link parsing if language converter markup is in the caption.
20805 !! options
20806 language=sr variant=sr-ec
20807 !! wikitext
20808 [[Main Page|-{R|main page}-]]
20809 !! html
20810 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20811 </p>
20812 !! end
20813
20814 # FIXME: This test is currently broken in the PHP parser T153761
20815 !! test
20816 T146304: Don't break template parsing if language converter markup is in the parameter.
20817 !! options
20818 language=sr variant=sr-ec
20819 disabled
20820 !! wikitext
20821 {{echo|-{R|foo}-}}
20822 !! html/php
20823 <p>foo
20824 </p>
20825 !! end
20826
20827 !! test
20828 T146305: Don't break image parsing if language converter markup is in the caption.
20829 !! options
20830 language=sr
20831 !! wikitext
20832 [[File:Foobar.jpg|thumb|-{R|caption:}-]]
20833 !! html/php
20834 <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>
20835
20836 !! html/parsoid
20837 <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>
20838 !! end
20839
20840 !! test
20841 T146305: Don't break image parsing if nested language converter markup is in the caption.
20842 !! options
20843 language=zh variant=zh-cn
20844 !! wikitext
20845 [[File:Foobar.jpg|thumb|-{zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
20846 !! html/php
20847 <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>
20848
20849 !! html/parsoid
20850 <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>
20851 !! end
20852
20853 !! test
20854 Don't break gallery if language converter markup is inside.
20855 !! options
20856 language=zh
20857 !! wikitext
20858 <gallery>
20859 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
20860 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
20861 </gallery>
20862 !! html
20863 <ul class="gallery mw-gallery-traditional">
20864 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20865 <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>
20866 <div class="gallerytext">
20867 <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>
20868 </p>
20869 </div>
20870 </div></li>
20871 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20872 <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>
20873 <div class="gallerytext">
20874 <p>This is a test template
20875 </p>
20876 </div>
20877 </div></li>
20878 </ul>
20879
20880 !! end
20881
20882 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20883 !! test
20884 Don't break list handling if language converter markup is in the item.
20885 !! options
20886 language=zh variant=zh-cn
20887 !! wikitext
20888 ;-{zh-cn:AAA;zh-tw:BBB}-
20889 !! html/php
20890 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20891
20892 !! html/parsoid
20893 <dl><dt>AAA
20894 </dt></dl>
20895 !! end
20896
20897 !! test
20898 T153140: Don't break table handling if language converter markup is in the cell.
20899 !! options
20900 language=sr variant=sr-ec
20901 !! wikitext
20902 {|
20903 |-
20904 | -{R|B}-
20905 |}
20906 !! html/php
20907 <table>
20908
20909 <tr>
20910 <td> B
20911 </td></tr></table>
20912
20913 !! html/parsoid
20914 <table>
20915
20916 <tr>
20917 <td> B
20918 </td></tr></table>
20919
20920 !! end
20921
20922 !! test
20923 Bug 529: Uncovered bullet
20924 !! wikitext
20925 * Foo {{bullet}}
20926 !! html
20927 <ul><li> Foo </li>
20928 <li> Bar</li></ul>
20929
20930 !! end
20931
20932 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20933 # Templates in Wikipedia rely on this behavior, as tidy has always been
20934 # enabled there. These tests are normally run *without* tidy, so specify the
20935 # full output here.
20936 # To test realistic parsing behavior, apply a tidy-like transformation to both
20937 # the expected output and your parser's output.
20938 !! test
20939 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20940 !! wikitext
20941 ******* Foo {{bullet}}
20942 !! html
20943 <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>
20944 <li> Bar</li></ul>
20945
20946 !! end
20947
20948 !! test
20949 Bug 529: Uncovered table already at line-start
20950 !! wikitext
20951 x
20952
20953 {{table}}
20954 y
20955 !! html
20956 <p>x
20957 </p>
20958 <table>
20959 <tr>
20960 <td> 1 </td>
20961 <td> 2
20962 </td></tr>
20963 <tr>
20964 <td> 3 </td>
20965 <td> 4
20966 </td></tr></table>
20967 <p>y
20968 </p>
20969 !! end
20970
20971 !! test
20972 Bug 529: Uncovered bullet in parser function result
20973 !! wikitext
20974 * Foo {{lc:{{bullet}} }}
20975 !! html
20976 <ul><li> Foo </li>
20977 <li> bar</li></ul>
20978
20979 !! end
20980
20981 !! test
20982 Bug 5678: Double-parsed template argument
20983 !! wikitext
20984 {{lc:{{{1}}}|hello}}
20985 !! html
20986 <p>{{{1}}}
20987 </p>
20988 !! end
20989
20990 !! test
20991 Bug 5678: Double-parsed template invocation
20992 !! wikitext
20993 {{lc:{{paramtest {{!}} param = hello }} }}
20994 !! html
20995 <p>{{paramtest | param = hello }}
20996 </p>
20997 !! end
20998
20999 !! test
21000 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
21001 !! options
21002 language=cs
21003 title=[[Main Page]]
21004 !! wikitext
21005 {{PRVNÍVELKÉ:ěščř}}
21006 {{prvnívelké:ěščř}}
21007 {{PRVNÍMALÉ:ěščř}}
21008 {{prvnímalé:ěščř}}
21009 {{MALÁ:ěščř}}
21010 {{malá:ěščř}}
21011 {{VELKÁ:ěščř}}
21012 {{velká:ěščř}}
21013 !! html
21014 <p>Ěščř
21015 Ěščř
21016 ěščř
21017 ěščř
21018 ěščř
21019 ěščř
21020 ĚŠČŘ
21021 ĚŠČŘ
21022 </p>
21023 !! end
21024
21025 !! test
21026 Morwen/13: Unclosed link followed by heading
21027 !! wikitext
21028 [[link
21029 ==heading==
21030 !! html
21031 <p>[[link
21032 </p>
21033 <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>
21034
21035 !! end
21036
21037 !! test
21038 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
21039 !! wikitext
21040 {{foo|
21041 =heading=
21042 !! html
21043 <p>{{foo|
21044 </p>
21045 <h1><span class="mw-headline" id="heading">heading</span></h1>
21046
21047 !! end
21048
21049 !! test
21050 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
21051 !! wikitext
21052 {{foo|
21053 ==heading==
21054 !! html
21055 <p>{{foo|
21056 </p>
21057 <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>
21058
21059 !! end
21060
21061 !! test
21062 Tildes in comments
21063 !! options
21064 pst
21065 !! wikitext
21066 <!-- ~~~~ -->
21067 !! html/php
21068 <!-- ~~~~ -->
21069 !! end
21070
21071 !! test
21072 Paragraphs inside divs (no extra line breaks)
21073 !! wikitext
21074 <div>Line one
21075
21076 Line two</div>
21077 !! html
21078 <div>Line one
21079 Line two</div>
21080
21081 !! end
21082
21083 !! test
21084 Paragraphs inside divs (extra line break on open)
21085 !! wikitext
21086 <div>
21087 Line one
21088
21089 Line two</div>
21090 !! html
21091 <div>
21092 <p>Line one
21093 </p>
21094 Line two</div>
21095
21096 !! end
21097
21098 !! test
21099 Paragraphs inside divs (extra line break on close)
21100 !! wikitext
21101 <div>Line one
21102
21103 Line two
21104 </div>
21105 !! html
21106 <div>Line one
21107 <p>Line two
21108 </p>
21109 </div>
21110
21111 !! end
21112
21113 !! test
21114 Paragraphs inside divs (extra line break on open and close)
21115 !! wikitext
21116 <div>
21117 Line one
21118
21119 Line two
21120 </div>
21121 !! html
21122 <div>
21123 <p>Line one
21124 </p><p>Line two
21125 </p>
21126 </div>
21127
21128 !! end
21129
21130 !! test
21131 Nesting tags, paragraphs on lines which begin with <div>
21132 !! wikitext
21133 <div></div><strong>A
21134 B</strong>
21135 !! html/php+tidy
21136 <p><strong>A</strong></p>
21137 <p><strong>B</strong></p>
21138 !! html/parsoid
21139 <div></div>
21140 <p><strong>A
21141 B</strong>
21142 </p>
21143 !! end
21144
21145 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
21146 !! test
21147 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
21148 !! wikitext
21149 <blockquote>Line one
21150
21151 Line two</blockquote>
21152 !! html
21153 <blockquote>Line one
21154 Line two</blockquote>
21155
21156 !! html+tidy
21157 <blockquote>
21158 <p>Line one Line two</p>
21159 </blockquote>
21160 !! end
21161
21162 !! test
21163 Bug 6200: paragraphs inside blockquotes (extra line break on open)
21164 !! wikitext
21165 <blockquote>
21166 Line one
21167
21168 Line two</blockquote>
21169 !! html
21170 <blockquote>
21171 <p>Line one
21172 </p>
21173 Line two</blockquote>
21174
21175 !! html+tidy
21176 <blockquote>
21177 <p>Line one</p>
21178 Line two</blockquote>
21179 !! end
21180
21181 !! test
21182 Bug 6200: paragraphs inside blockquotes (extra line break on close)
21183 !! wikitext
21184 <blockquote>Line one
21185
21186 Line two
21187 </blockquote>
21188 !! html
21189 <blockquote>Line one
21190 <p>Line two
21191 </p>
21192 </blockquote>
21193
21194 !! html+tidy
21195 <blockquote>
21196 <p>Line one</p>
21197 <p>Line two</p>
21198 </blockquote>
21199 !! end
21200
21201 !! test
21202 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
21203 !! wikitext
21204 <blockquote>
21205 Line one
21206
21207 Line two
21208 </blockquote>
21209 !! html
21210 <blockquote>
21211 <p>Line one
21212 </p><p>Line two
21213 </p>
21214 </blockquote>
21215
21216 !! html+tidy
21217 <blockquote>
21218 <p>Line one</p>
21219 <p>Line two</p>
21220 </blockquote>
21221 !! end
21222
21223 !! test
21224 Paragraphs inside blockquotes/divs (no extra line breaks)
21225 !! wikitext
21226 <blockquote><div>Line one
21227
21228 Line two</div></blockquote>
21229 !! html
21230 <blockquote><div>Line one
21231 Line two</div></blockquote>
21232
21233 !! end
21234
21235 !! test
21236 Paragraphs inside blockquotes/divs (extra line break on open)
21237 !! wikitext
21238 <blockquote><div>
21239 Line one
21240
21241 Line two</div></blockquote>
21242 !! html
21243 <blockquote><div>
21244 <p>Line one
21245 </p>
21246 Line two</div></blockquote>
21247
21248 !! end
21249
21250 !! test
21251 Paragraphs inside blockquotes/divs (extra line break on close)
21252 !! wikitext
21253 <blockquote><div>Line one
21254
21255 Line two
21256 </div></blockquote>
21257 !! html
21258 <blockquote><div>Line one
21259 <p>Line two
21260 </p>
21261 </div></blockquote>
21262
21263 !! end
21264
21265 !! test
21266 Paragraphs inside blockquotes/divs (extra line break on open and close)
21267 !! wikitext
21268 <blockquote><div>
21269 Line one
21270
21271 Line two
21272 </div></blockquote>
21273 !! html
21274 <blockquote><div>
21275 <p>Line one
21276 </p><p>Line two
21277 </p>
21278 </div></blockquote>
21279
21280 !! end
21281
21282 !! test
21283 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
21284 !! options
21285 wgLinkHolderBatchSize=0
21286 !! wikitext
21287 [[meatball:1]]
21288 [[meatball:2]]
21289 [[meatball:3]]
21290 !! html
21291 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
21292 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
21293 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
21294 </p>
21295 !! end
21296
21297 !! test
21298 Free external link invading image caption
21299 !! wikitext
21300 [[Image:Foobar.jpg|thumb|http://x|hello]]
21301 !! html
21302 <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>
21303
21304 !! end
21305
21306 !! test
21307 Bug 15196: localised external link numbers
21308 !! options
21309 language=fa
21310 !! wikitext
21311 [http://en.wikipedia.org/]
21312 !! html/php
21313 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
21314 </p>
21315 !! html/parsoid
21316 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
21317 !! end
21318
21319 !! test
21320 Multibyte character in padleft
21321 !! wikitext
21322 {{padleft:-Hello|7|Æ}}
21323 !! html
21324 <p>Æ-Hello
21325 </p>
21326 !! end
21327
21328 !! test
21329 Multibyte character in padright
21330 !! wikitext
21331 {{padright:Hello-|7|Æ}}
21332 !! html
21333 <p>Hello-Æ
21334 </p>
21335 !! end
21336
21337 !!test
21338 formatdate parser function
21339 !! wikitext
21340 {{#formatdate:2009-03-24}}
21341 !! html
21342 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
21343 </p>
21344 !! end
21345
21346 !!test
21347 formatdate parser function, with default format
21348 !! wikitext
21349 {{#formatdate:2009-03-24|mdy}}
21350 !! html
21351 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
21352 </p>
21353 !! end
21354
21355 !! test
21356 Spacing of numbers in formatted dates
21357 !! wikitext
21358 {{#formatdate:January 15}}
21359 !! html
21360 <p><span class="mw-formatted-date" title="01-15">January 15</span>
21361 </p>
21362 !! end
21363
21364 !! test
21365 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
21366 !! options
21367 language=nl title=[[MediaWiki:Common.css]]
21368 !! wikitext
21369 {{#formatdate:2009-03-24|dmy}}
21370 !! html
21371 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
21372 </p>
21373 !! end
21374
21375 #
21376 #
21377 #
21378
21379 #
21380 # Edit comments
21381 #
21382
21383 !! test
21384 Edit comment with link
21385 !! options
21386 comment
21387 !! wikitext
21388 I like the [[Main Page]] a lot
21389 !! html/php
21390 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
21391 !!end
21392
21393 !! test
21394 Edit comment with link and link text
21395 !! options
21396 comment
21397 !! wikitext
21398 I like the [[Main Page|best pages]] a lot
21399 !! html/php
21400 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21401 !!end
21402
21403 !! test
21404 Edit comment with link and link text with suffix
21405 !! options
21406 comment
21407 !! wikitext
21408 I like the [[Main Page|best page]]s a lot
21409 !! html/php
21410 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21411 !!end
21412
21413 !! test
21414 Edit comment with section link (non-local, eg in history list)
21415 !! options
21416 comment title=[[Main Page]]
21417 !! wikitext
21418 /* External links */ removed bogus entries
21419 !! html/php
21420 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21421 !!end
21422
21423 !! test
21424 Edit comment with section link and text before it (non-local, eg in history list)
21425 !! options
21426 comment title=[[Main Page]]
21427 !! wikitext
21428 pre-comment text /* External links */ removed bogus entries
21429 !! html/php
21430 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>
21431 !!end
21432
21433 !! test
21434 Edit comment with section link (local, eg in diff view)
21435 !! options
21436 comment local title=[[Main Page]]
21437 !! wikitext
21438 /* External links */ removed bogus entries
21439 !! html/php
21440 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21441 !!end
21442
21443 !! test
21444 Edit comment with subpage link (bug 14080)
21445 !! options
21446 comment
21447 subpage
21448 title=[[Subpage test]]
21449 !! wikitext
21450 Poked at a [[/subpage]] here...
21451 !! html/php
21452 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
21453 !!end
21454
21455 !! test
21456 Edit comment with subpage link and link text (bug 14080)
21457 !! options
21458 comment
21459 subpage
21460 title=[[Subpage test]]
21461 !! wikitext
21462 Poked at a [[/subpage|neat little page]] here...
21463 !! html/php
21464 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
21465 !!end
21466
21467 !! test
21468 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
21469 !! options
21470 comment
21471 title=[[Subpage test]]
21472 !! wikitext
21473 Poked at a [[/subpage]] here...
21474 !! html/php
21475 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...
21476 !!end
21477
21478 !! test
21479 Edit comment with bare anchor link (local, as on diff)
21480 !! options
21481 comment
21482 local
21483 title=[[Main Page]]
21484 !! wikitext
21485 [[#section]]
21486 !! html/php
21487 <a href="#section">#section</a>
21488 !! end
21489
21490 !! test
21491 Edit comment with bare anchor link (non-local, as on history)
21492 !! options
21493 comment
21494 title=[[Main Page]]
21495 !! wikitext
21496 [[#section]]
21497 !! html/php
21498 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
21499 !! end
21500
21501 !! test
21502 Anchor starting with underscore
21503 !! options
21504 title=[[Foo]]
21505 !! wikitext
21506 [[#_ref|One]]
21507 !! html/php
21508 <p><a href="#_ref">One</a>
21509 </p>
21510 !! html/parsoid
21511 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
21512 !! end
21513
21514 !! test
21515 Id starting with underscore
21516 !! wikitext
21517 <div id="_ref"></div>
21518 !! html/*
21519 <div id="_ref"></div>
21520
21521 !! end
21522
21523 !! test
21524 Edit comment with link with more than one pipe (T99346)
21525 !! options
21526 comment
21527 !! wikitext
21528 [[Main Page|Many|pipes]]
21529 !! html/php
21530 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
21531 !! end
21532
21533 !! test
21534 Complex edit comment with link with more than one pipe (T99346)
21535 !! options
21536 comment
21537 !! wikitext
21538 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
21539 !! html/php
21540 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;
21541 !! end
21542
21543 !! test
21544 Space normalisation on autocomment (bug 22784)
21545 !! options
21546 comment
21547 title=[[Main Page]]
21548 !! wikitext
21549 /* __hello__world__ */
21550 !! html/php
21551 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
21552 !! end
21553
21554 !! test
21555 percent-encoding and + signs in comments (Bug 26410)
21556 !! options
21557 comment
21558 !! wikitext
21559 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
21560 !! html/php
21561 <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>
21562 !! end
21563
21564 # Parsoid doesn't support this yet: see bug 73581
21565 # but it *should* omit the 'src' attribute if the image is bad.
21566 # PHP side of tests was disabled in
21567 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
21568 # because of issues in the PHP parserTests infrastructure
21569 # (but the output below is indeed what the PHP side emits)
21570 !! test
21571 Bad images - basic functionality
21572 !! wikitext
21573 [[File:Bad.jpg]]
21574 !! DISABLED/html/php
21575 !! html/parsoid
21576 <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>
21577 !! end
21578
21579 !! test
21580 Bad images - bug 16039: text after bad image disappears
21581 !! wikitext
21582 Foo bar
21583 [[File:Bad.jpg]]
21584 Bar foo
21585 !! DISABLED/html/php
21586 <p>Foo bar
21587 </p><p>Bar foo
21588 </p>
21589 !! html/parsoid
21590 <p>Foo bar
21591 <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>
21592 Bar foo</p>
21593 !! end
21594
21595 !! test
21596 Verify that displaytitle works (bug #22501) no displaytitle
21597 !! options
21598 showtitle
21599 !! config
21600 wgAllowDisplayTitle=true
21601 wgRestrictDisplayTitle=false
21602 !! wikitext
21603 this is not the the title
21604 !! html/php
21605 Parser test
21606 <p>this is not the the title
21607 </p>
21608 !! end
21609
21610 !! test
21611 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
21612 !! options
21613 showtitle
21614 title=[[Screen]]
21615 !! config
21616 wgAllowDisplayTitle=true
21617 wgRestrictDisplayTitle=false
21618 !! wikitext
21619 this is not the the title
21620 {{DISPLAYTITLE:whatever}}
21621 !! html/php
21622 whatever
21623 <p>this is not the the title
21624 </p>
21625 !! end
21626
21627 !! test
21628 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
21629 !! options
21630 showtitle
21631 title=[[Screen]]
21632 !! config
21633 wgAllowDisplayTitle=true
21634 wgRestrictDisplayTitle=true
21635 !! wikitext
21636 this is not the the title
21637 {{DISPLAYTITLE:whatever}}
21638 !! html/php
21639 Screen
21640 <p>this is not the the title
21641 </p>
21642 !! end
21643
21644 !! test
21645 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
21646 !! options
21647 showtitle
21648 title=[[Screen]]
21649 !! config
21650 wgAllowDisplayTitle=true
21651 wgRestrictDisplayTitle=true
21652 !! wikitext
21653 this is not the the title
21654 {{DISPLAYTITLE:screen}}
21655 !! html/php
21656 screen
21657 <p>this is not the the title
21658 </p>
21659 !! end
21660
21661 !! test
21662 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
21663 !! options
21664 showtitle
21665 title=[[Screen]]
21666 !! config
21667 wgAllowDisplayTitle=false
21668 !! wikitext
21669 this is not the the title
21670 {{DISPLAYTITLE:screen}}
21671 !! html/php
21672 Screen
21673 <p>this is not the the title
21674 <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>
21675 </p>
21676 !! end
21677
21678 !! test
21679 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
21680 !! options
21681 showtitle
21682 title=[[Screen]]
21683 !! config
21684 wgAllowDisplayTitle=false
21685 !! wikitext
21686 this is not the the title
21687 !! html/php
21688 Screen
21689 <p>this is not the the title
21690 </p>
21691 !! end
21692
21693 !! test
21694 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
21695 !! options
21696 showtitle
21697 title=[[Screen]]
21698 !! config
21699 wgAllowDisplayTitle=true
21700 wgRestrictDisplayTitle=true
21701 !! wikitext
21702 this is not the the title
21703 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21704 !! html/php
21705 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21706 <p>this is not the the title
21707 </p>
21708 !! end
21709
21710 !! test
21711 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
21712 !! options
21713 showtitle
21714 title=[[Screen]]
21715 !! config
21716 wgAllowDisplayTitle=true
21717 wgRestrictDisplayTitle=true
21718 !! wikitext
21719 this is not the the title
21720 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21721 !! html/php
21722 <span style="color: red;">s</span>creen
21723 <p>this is not the the title
21724 </p>
21725 !! end
21726
21727 !! test
21728 Page status indicators: Empty name is invalid
21729 !! options
21730 showindicators
21731 !! wikitext
21732 <indicator name=" "></indicator>
21733 <indicator></indicator>
21734 !! html
21735 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21736 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21737 </p>
21738 !! end
21739
21740 !! test
21741 Page status indicators: Weird syntaxes that are okay
21742 !! options
21743 showindicators
21744 !! wikitext
21745 <indicator name="empty" />
21746 <indicator name="name"></indicator>
21747 !! html
21748 empty=
21749 name=
21750 <p><br />
21751 </p>
21752 !! end
21753
21754 !! test
21755 Page status indicators: Torture test
21756 !! options
21757 showindicators
21758 !! wikitext
21759 <indicator name="01">hello world</indicator>
21760 <indicator name="02">[[Main Page]]</indicator>
21761 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21762 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21763 <indicator name="05">* foo
21764 * bar</indicator>
21765 <indicator name="06"><nowiki>foo</nowiki></indicator>
21766 <indicator name="07"> Preformatted</indicator>
21767 <indicator name="08"><div>Broken tag</indicator>
21768 <indicator name="09">{| class=wikitable
21769 | cell
21770 |}</indicator>
21771 <indicator name="10">Two
21772
21773 paragraphs</indicator>
21774 !! html
21775 01=hello world
21776 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21777 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" />
21778 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>
21779 05=<ul><li> foo</li>
21780 <li> bar</li></ul>
21781
21782 06=foo
21783 07=<pre>Preformatted
21784 </pre>
21785 08=<div>Broken tag</div>
21786
21787 09=<table class="wikitable">
21788 <tr>
21789 <td> cell
21790 </td></tr></table>
21791
21792 10=<p>Two
21793 </p><p>paragraphs
21794 </p>
21795 <p><br />
21796 </p><p><br />
21797 </p><p><br />
21798 </p><p><br />
21799 </p><p><br />
21800 </p>
21801 !! end
21802
21803 !! test
21804 preload: check <noinclude> and <includeonly>
21805 !! options
21806 preload
21807 !! wikitext
21808 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21809 !! html/php
21810 Hello kind world.
21811 !! end
21812
21813 !! test
21814 preload: check <onlyinclude>
21815 !! options
21816 preload
21817 !! wikitext
21818 Goodbye <onlyinclude>Hello world</onlyinclude>
21819 !! html/php
21820 Hello world
21821 !! end
21822
21823 !! test
21824 preload: can pass tags through if we want to
21825 !! options
21826 preload
21827 !! wikitext
21828 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21829 !! html/php
21830 <includeonly>Hello world</includeonly>
21831 !! end
21832
21833 !! test
21834 preload: check that it doesn't try to do tricks
21835 !! options
21836 preload
21837 !! wikitext
21838 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21839 !! html/php
21840 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21841 !! end
21842
21843 !! test
21844 Play a bit with r67090 and bug 3158
21845 !! wikitext
21846 <div style="width:50% !important">&nbsp;</div>
21847 <div style="width:50%&nbsp;!important">&nbsp;</div>
21848 <div style="width:50%&#160;!important">&nbsp;</div>
21849 <div style="border : solid;">&nbsp;</div>
21850 !! html/php
21851 <div style="width:50% !important">&#160;</div>
21852 <div style="width:50% !important">&#160;</div>
21853 <div style="width:50% !important">&#160;</div>
21854 <div style="border&#160;: solid;">&#160;</div>
21855
21856 !! html/parsoid
21857 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21858 <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>
21859 <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>
21860 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21861
21862 !! end
21863
21864 !! test
21865 HTML5 data attributes
21866 !! wikitext
21867 <span data-foo="bar">Baz</span>
21868 <p data-abc-def_hij="">Quuz</p>
21869 !! html/php
21870 <p><span data-foo="bar">Baz</span>
21871 </p>
21872 <p data-abc-def_hij="">Quuz</p>
21873
21874 !! html/parsoid
21875 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21876 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21877 !! end
21878
21879 !! test
21880 Strip reserved data attributes
21881 !! wikitext
21882 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21883 !! html/php
21884 <div data-ok="fred">d</div>
21885
21886 !! html/parsoid
21887 <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>
21888 !! end
21889
21890 !! test
21891 percent-encoding and + signs in internal links (Bug 26410)
21892 !! wikitext
21893 [[User:+%]] [[Page+title%]]
21894 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21895 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21896 [[%33%45]] [[%33%45+]]
21897 !! html/php
21898 <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>
21899 <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>
21900 <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>
21901 <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>
21902 </p>
21903 !! html/parsoid
21904 <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>
21905 <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>
21906 <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>
21907 <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>
21908 !! end
21909
21910 !! test
21911 Special characters in embedded file links (bug 27679)
21912 !! wikitext
21913 [[File:Contains & ampersand.jpg]]
21914 [[File:Does not exist.jpg|Title with & ampersand]]
21915 !! html/php
21916 <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>
21917 <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>
21918 </p>
21919 !! html/parsoid
21920 <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>
21921 <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>
21922 !! end
21923
21924 !! test
21925 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21926 !! wikitext
21927 Text&apos;s been normalized?
21928 !! html
21929 <p>Text&#39;s been normalized?
21930 </p>
21931 !! end
21932
21933 !! test
21934 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21935 !! wikitext
21936 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21937 !! html
21938 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21939 </p>
21940 !! end
21941
21942 !! test
21943 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21944 !! wikitext
21945 [http://www.example.org/ ideograms]
21946 !! html
21947 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21948 </p>
21949 !! end
21950
21951 !! test
21952 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21953 !! wikitext
21954 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21955 !! html
21956 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21957 </p>
21958 !! end
21959
21960 !! article
21961 Mediawiki:loop1
21962 !! text
21963 {{Identical|A}}
21964 !! endarticle
21965
21966 !! article
21967 Mediawiki:loop2
21968 !! text
21969 {{Identical|B}}
21970 !! endarticle
21971
21972 !! article
21973 Template:Identical
21974 !! text
21975 {{int:loop1}}
21976 {{int:loop2}}
21977 !! endarticle
21978
21979 !! test
21980 Bug 31098 Template which includes system messages which includes the template
21981 !! wikitext
21982 {{Identical}}
21983 !! html
21984 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21985 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21986 </p>
21987 !! end
21988
21989 !! test
21990 Bug31490 Turkish: ucfirst 'blah'
21991 !! options
21992 language=tr
21993 !! wikitext
21994 {{ucfirst:blah}}
21995 !! html
21996 <p>Blah
21997 </p>
21998 !! end
21999
22000 !! test
22001 Bug31490 Turkish: ucfirst 'ix'
22002 !! options
22003 language=tr
22004 !! wikitext
22005 {{ucfirst:ix}}
22006 !! html
22007 <p>İx
22008 </p>
22009 !! end
22010
22011 !! test
22012 Bug31490 Turkish: lcfirst 'BLAH'
22013 !! options
22014 language=tr
22015 !! wikitext
22016 {{lcfirst:BLAH}}
22017 !! html
22018 <p>bLAH
22019 </p>
22020 !! end
22021
22022 !! test
22023 Bug31490 Turkish: ucfırst (with a dotless i)
22024 !! options
22025 language=tr
22026 !! wikitext
22027 {{ucfırst:blah}}
22028 !! html
22029 <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>
22030 </p>
22031 !! end
22032
22033 !! test
22034 Bug31490 ucfırst (with a dotless i) with English language
22035 !! options
22036 language=en
22037 !! wikitext
22038 {{ucfırst:blah}}
22039 !! html
22040 <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>
22041 </p>
22042 !! end
22043
22044 !! test
22045 Bug 26375: TOC with italics
22046 !! options
22047 title=[[Main Page]]
22048 !! wikitext
22049 __TOC__
22050 == ''Lost'' episodes ==
22051 !! html
22052 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22053 <ul>
22054 <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>
22055 </ul>
22056 </div>
22057
22058 <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>
22059
22060 !! end
22061
22062 !! test
22063 Bug 26375: TOC with bold
22064 !! options
22065 title=[[Main Page]]
22066 !! wikitext
22067 __TOC__
22068 == '''should be bold''' then normal text ==
22069 !! html
22070 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22071 <ul>
22072 <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>
22073 </ul>
22074 </div>
22075
22076 <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>
22077
22078 !! end
22079
22080 !! test
22081 Bug 33845: Headings become cursive in TOC when they contain an image
22082 !! options
22083 title=[[Main Page]]
22084 !! wikitext
22085 __TOC__
22086 == Image [[Image:foobar.jpg]] ==
22087 !! html
22088 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22089 <ul>
22090 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
22091 </ul>
22092 </div>
22093
22094 <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>
22095
22096 !! end
22097
22098 !! test
22099 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
22100 !! options
22101 title=[[Main Page]]
22102 !! wikitext
22103 __TOC__
22104 == <blockquote>Quote</blockquote> ==
22105 !! html
22106 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22107 <ul>
22108 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22109 </ul>
22110 </div>
22111
22112 <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>
22113
22114 !! html+tidy
22115 <p></p>
22116 <div id="toc" class="toc">
22117 <div id="toctitle">
22118 <h2>Contents</h2>
22119 </div>
22120 <ul>
22121 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22122 </ul>
22123 </div>
22124 <p></p>
22125 <h2><span class="mw-headline" id="Quote"></span></h2>
22126 <blockquote>
22127 <p><span class="mw-headline" id="Quote">Quote</span></p>
22128 </blockquote>
22129 <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>
22130 !! end
22131
22132 !! test
22133 Unclosed tags in TOC
22134 !! options
22135 title=[[Main Page]]
22136 !! wikitext
22137 __TOC__
22138 == Proof: 2 < 3 ==
22139 <small>Hanc marginis exiguitas non caperet.</small>
22140 QED
22141 !! html
22142 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22143 <ul>
22144 <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>
22145 </ul>
22146 </div>
22147
22148 <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>
22149 <p><small>Hanc marginis exiguitas non caperet.</small>
22150 QED
22151 </p>
22152 !! end
22153
22154 !! test
22155 Multiple tags in TOC
22156 !! wikitext
22157 __TOC__
22158 == <i>Foo</i> <b>Bar</b> ==
22159
22160 == <i>Foo</i> <blockquote>Bar</blockquote> ==
22161 !! html
22162 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22163 <ul>
22164 <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>
22165 <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>
22166 </ul>
22167 </div>
22168
22169 <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>
22170 <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>
22171
22172 !! html+tidy
22173 <p></p>
22174 <div id="toc" class="toc">
22175 <div id="toctitle">
22176 <h2>Contents</h2>
22177 </div>
22178 <ul>
22179 <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>
22180 <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>
22181 </ul>
22182 </div>
22183 <p></p>
22184 <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>
22185 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
22186 <blockquote>
22187 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
22188 </blockquote>
22189 <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>
22190 !! end
22191
22192 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
22193 # html5 tag parsing.
22194 !! test
22195 Tags with parameters in TOC
22196 !! options
22197 parsoid=wt2html
22198 !! wikitext
22199 __TOC__
22200 == <sup class="in-h2">Hello</sup> ==
22201
22202 == <sup class="a > b">Evilbye</sup> ==
22203 !! html/php
22204 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22205 <ul>
22206 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
22207 <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>
22208 </ul>
22209 </div>
22210
22211 <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>
22212 <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>
22213
22214 !! html/parsoid
22215 <meta property="mw:PageProp/toc" />
22216 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
22217
22218 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
22219 !! end
22220
22221 !! test
22222 span tags with directionality in TOC
22223 !! wikitext
22224 __TOC__
22225 == <span dir="ltr">C++</span> ==
22226
22227 == <span dir="rtl">זבנג!</span> ==
22228
22229 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
22230
22231 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
22232
22233 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
22234 !! html
22235 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22236 <ul>
22237 <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>
22238 <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>
22239 <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>
22240 <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>
22241 <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>
22242 </ul>
22243 </div>
22244
22245 <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>
22246 <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>
22247 <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>
22248 <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>
22249 <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>
22250
22251 !! end
22252
22253 !! test
22254 Bug 72884: bdi element in ToC
22255 !! wikitext
22256 __TOC__
22257 == <bdi>test</bdi> ==
22258 !! html
22259 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22260 <ul>
22261 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
22262 </ul>
22263 </div>
22264
22265 <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>
22266
22267 !! end
22268
22269 !! test
22270 T35715: s/strike element in ToC
22271 !! wikitext
22272 __TOC__
22273 == <s>test</s> test <strike>test</strike> ==
22274 !! html
22275 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22276 <ul>
22277 <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>
22278 </ul>
22279 </div>
22280
22281 <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>
22282
22283 !! end
22284
22285 # Note that the html output does not have the <p></p>, but the
22286 # html+tidy output *does*. This is because the empty <p></p> is
22287 # removed by the sanitizer, but only when tidy is *not* enabled (!).
22288 !! test
22289 Empty <p> tag in TOC, removed by Sanitizer (T92892)
22290 !! wikitext
22291 __TOC__
22292 == x ==
22293 !! html
22294 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22295 <ul>
22296 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22297 </ul>
22298 </div>
22299
22300 <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>
22301
22302 !! html+tidy
22303 <p></p>
22304 <div id="toc" class="toc">
22305 <div id="toctitle">
22306 <h2>Contents</h2>
22307 </div>
22308 <ul>
22309 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22310 </ul>
22311 </div>
22312 <p></p>
22313 <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>
22314 !! end
22315
22316 !! article
22317 MediaWiki:Bug32057
22318 !! text
22319 == {{int:headline_sample}} ==
22320 !! endarticle
22321
22322 !! test
22323 Bug 32057: Title needed when expanding <h> nodes.
22324 !! options
22325 title=[[Main Page]]
22326 !! wikitext
22327 {{int:Bug32057}}
22328 !! html
22329 <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>
22330
22331 !! end
22332
22333 !! test
22334 Strip marker in urlencode
22335 !! wikitext
22336 {{urlencode:x<nowiki/>y}}
22337 {{urlencode:x<nowiki/>y|wiki}}
22338 {{urlencode:x<nowiki/>y|path}}
22339 {{urlencode:x<pre id="one">two</pre>y}}
22340 !! html/php
22341 <p>xy
22342 xy
22343 xy
22344 xy
22345 </p>
22346 !! end
22347
22348 !! test
22349 Strip marker in lc
22350 !! wikitext
22351 {{lc:x<nowiki/>y}}
22352 !! html
22353 <p>xy
22354 </p>
22355 !! end
22356
22357 !! test
22358 Strip marker in uc
22359 !! wikitext
22360 {{uc:x<nowiki/>y}}
22361 !! html
22362 <p>XY
22363 </p>
22364 !! end
22365
22366 !! test
22367 Strip marker in formatNum
22368 !! wikitext
22369 {{formatnum:1<nowiki/>2}}
22370 {{formatnum:1<nowiki/>2|R}}
22371 !! html
22372 <p>12
22373 12
22374 </p>
22375 !! end
22376
22377 !! test
22378 Check noCommafy in formatNum
22379 !! options
22380 language=be-tarask
22381 !! wikitext
22382 {{formatnum:123456.78}}
22383 {{formatnum:123456.78|NOSEP}}
22384 !! html
22385 <p>123 456,78
22386 123456.78
22387 </p>
22388 !! end
22389
22390 !! test
22391 Wrong option for formatNum (bug 56199)
22392 !! wikitext
22393 {{formatnum:1,234.56|Random}}
22394 {{formatnum:1,234.56|EVERYTHING}}
22395 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
22396 !! html
22397 <p>1,234.56
22398 1,234.56
22399 1,234.56
22400 </p>
22401 !! end
22402
22403 !! test
22404 Strip marker in grammar
22405 !! options
22406 language=fi
22407 !! wikitext
22408 {{grammar:elative|foo<nowiki/>bar}}
22409 !! html
22410 <p>foobarista
22411 </p>
22412 !! end
22413
22414 !! test
22415 Strip marker in padleft
22416 !! wikitext
22417 {{padleft:|2|x<nowiki/>y}}
22418 !! html
22419 <p>xy
22420 </p>
22421 !! end
22422
22423 !! test
22424 Strip marker in padright
22425 !! wikitext
22426 {{padright:|2|x<nowiki/>y}}
22427 !! html
22428 <p>xy
22429 </p>
22430 !! end
22431
22432 !! test
22433 Strip marker in anchorencode
22434 !! wikitext
22435 {{anchorencode:x<nowiki/>y}}
22436 !! html
22437 <p>xy
22438 </p>
22439 !! end
22440
22441 !! test
22442 nowiki inside link inside heading (bug 18295)
22443 !! wikitext
22444 ==[[foo|x<nowiki>y</nowiki>z]]==
22445 !! html
22446 <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>
22447
22448 !! end
22449
22450 !! test
22451 new support for bdi element (bug 31817)
22452 !! wikitext
22453 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22454 !! html
22455 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22456
22457 !!end
22458
22459 !! test
22460 Ignore pipe between table row attributes
22461 !! wikitext
22462 {|
22463 | quux
22464 |- id=foo | style='color: red'
22465 | bar
22466 |}
22467 !! html
22468 <table>
22469 <tr>
22470 <td> quux
22471 </td></tr>
22472 <tr id="foo" style="color: red">
22473 <td> bar
22474 </td></tr></table>
22475
22476 !! end
22477
22478 !!test
22479 Gallery override link with WikiLink (bug 34852)
22480 !! wikitext
22481 <gallery>
22482 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
22483 </gallery>
22484 !! html
22485 <ul class="gallery mw-gallery-traditional">
22486 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22487 <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>
22488 <div class="gallerytext">
22489 <p>caption
22490 </p>
22491 </div>
22492 </div></li>
22493 </ul>
22494
22495 !! end
22496
22497 !!test
22498 Language parser function
22499 !! wikitext
22500 {{#language:ar}}
22501 !! html
22502 <p>العربية
22503 </p>
22504 !! end
22505
22506 !!test
22507 Padleft and padright as substr
22508 !! wikitext
22509 {{padleft:|3|abcde}}
22510 {{padright:|3|abcde}}
22511 !! html
22512 <p>abc
22513 abc
22514 </p>
22515 !! end
22516
22517 !!test
22518 Special parser function
22519 !! wikitext
22520 {{#special:RandomPage}}
22521 {{#special:BaDtItLe}}
22522 {{#special:Foobar}}
22523 !! html
22524 <p>Special:Random
22525 Special:Badtitle
22526 Special:Foobar
22527 </p>
22528 !! end
22529
22530 !!test
22531 Bug 34939 - Case insensitive link parsing ([HttP://])
22532 !! wikitext
22533 [HttP://MediaWiki.Org/]
22534 !! html/php
22535 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
22536 </p>
22537 !! html/parsoid
22538 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
22539 !! end
22540
22541 !!test
22542 Bug 34939 - Case insensitive link parsing ([HttP:// title])
22543 !! wikitext
22544 [HttP://MediaWiki.Org/ MediaWiki]
22545 !! html
22546 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22547 </p>
22548 !! end
22549
22550 !!test
22551 Bug 34939 - Case insensitive link parsing (HttP://)
22552 !! wikitext
22553 HttP://MediaWiki.Org/
22554 !! html/php
22555 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22556 </p>
22557 !! html/parsoid
22558 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22559 !! end
22560
22561 !!test
22562 Disable TOC
22563 !! options
22564 notoc
22565 !! wikitext
22566 Lead
22567 == Section 1 ==
22568 == Section 2 ==
22569 == Section 3 ==
22570 == Section 4 ==
22571 == Section 5 ==
22572 !! html
22573 <p>Lead
22574 </p>
22575
22576 <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>
22577 <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>
22578 <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>
22579 <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>
22580 <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>
22581
22582 !! end
22583
22584
22585 ###
22586 ### Parsoid-specific tests
22587 ### Parsoid-PHP parser incompatibilities
22588 ###
22589 !!test
22590 1. SOL-sensitive wikitext tokens as template-args
22591 !!options
22592 parsoid=wt2html,wt2wt
22593 !! wikitext
22594 {{echo|*a}}
22595 {{echo|#a}}
22596 {{echo|:a}}
22597 !! html
22598 <span about="#mwt1" typeof="mw:Transclusion">
22599 </span><ul about="#mwt1"><li>a</li>
22600 </ul>
22601 <span about="#mwt2" typeof="mw:Transclusion">
22602 </span><ol about="#mwt2"><li>a</li>
22603 </ol>
22604 <span about="#mwt3" typeof="mw:Transclusion">
22605 </span><dl about="#mwt3"><dd>a</dd>
22606 </dl>
22607 !!end
22608
22609 #### -----------------------------------------------------------------
22610 #### Parsoid-specific functionality tests
22611 #### -----------------------------------------------------------------
22612
22613 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
22614 # We know wt2wt will fail, but we expect selser to pass.
22615 # Due to the nature of our testing, wt2wt and selser tests will enter the
22616 # blacklist and we'll catch selser regressions based on changes to the
22617 # blacklist entries for selser tests.
22618 !! test
22619 1. Bad treebuilder fixup of formatting elt is cleaned up
22620 !! options
22621 parsoid=wt2html,wt2wt
22622 !! wikitext
22623 {|
22624 |
22625 <small>
22626 [[Image:Foobar.jpg|right|Test]]
22627 </small>
22628 |}
22629 !! html/parsoid
22630 <table>
22631 <tbody><tr><td>
22632 <small>
22633 <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>
22634 </small>
22635 </td></tr>
22636 </tbody></table>
22637 !! end
22638
22639 !! test
22640 2. Bad treebuilder fixup of formatting elt is cleaned up
22641 !! options
22642 parsoid=wt2html,wt2wt
22643 !! wikitext
22644 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22645
22646 <small>[[Image:Foobar.jpg|right|300px]]</small>
22647 !! html/parsoid
22648
22649 <p><b>foo</b></p>
22650 <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>
22651 <p><b>bar</b></p>
22652 <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>
22653 !! end
22654
22655 !! test
22656 3. Bad treebuilder fixup of formatting elt is cleaned up
22657 !! options
22658 parsoid=wt2html,wt2wt
22659 !! wikitext
22660 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22661 !! html/parsoid
22662 <p><small><b>foo</b></small></p>
22663 <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>
22664 <p><small><b>bar</b></small></p>
22665 !! end
22666
22667 !! test
22668 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22669 !! options
22670 parsoid=wt2html,wt2wt
22671 !! wikitext
22672 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22673 !! html/parsoid
22674 <p><b><small></small></b></p>
22675 <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>
22676 <p></p>
22677 !! end
22678
22679 #### ----------------------------------------------------------------
22680 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22681 #### tags. Parsoid's output for these tags differs from that of the
22682 #### PHP parser.
22683 #### ----------------------------------------------------------------
22684
22685 !!test
22686 Ref: 1. ref-location should be replaced with an index span
22687 !! wikitext
22688 A <ref>foo</ref>
22689 B <ref name="x">foo</ref>
22690 C <ref name="y" />
22691 <references />
22692 !! html/parsoid
22693 <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>
22694 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>
22695 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>
22696 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22697 <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>
22698 <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>
22699 <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>
22700 </ol>
22701 !!end
22702
22703 !!test
22704 Ref: 2. ref-tags with identical names should all get the same index
22705 !! wikitext
22706 A <ref name="x">foo</ref>
22707 B <ref name="x" />
22708 <references />
22709 !! html/parsoid
22710 <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>
22711 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>
22712 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22713 <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>
22714 </ol>
22715 !!end
22716
22717 !!test
22718 Ref: 3. spaces in ref-names should be ignored
22719 !! wikitext
22720 A <ref name="x">foo</ref>
22721 B <ref name=" x " />
22722 C <ref name= x />
22723 <references />
22724 !! html/parsoid
22725 <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>
22726 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>
22727 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>
22728 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22729 <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>
22730 </ol>
22731 !!end
22732
22733 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22734 !!test
22735 Ref: 4. 'constructor' should be accepted as a valid ref-name
22736 !! wikitext
22737 A <ref name="constructor">foo</ref>
22738 <references />
22739 !! html/parsoid
22740 <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>
22741 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22742 <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>
22743 </ol>
22744 !!end
22745
22746 !!test
22747 Ref: 5. body should accept generic wikitext
22748 !! wikitext
22749 A <ref>
22750 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22751 </ref>
22752
22753 <references />
22754 !! html/parsoid
22755 <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>
22756
22757 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22758 <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>
22759 </span></li>
22760 </ol>
22761 !!end
22762
22763 !!test
22764 Ref: 6. indent-pres should not be output in ref-body
22765 !! wikitext
22766 A <ref>
22767 foo
22768 bar
22769 baz
22770 </ref>
22771
22772 <references />
22773 !! html/parsoid
22774 <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>
22775
22776 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22777 <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
22778 bar
22779 baz
22780 </span></li>
22781 </ol>
22782 !!end
22783
22784 !!test
22785 Ref: 7. No p-wrapping in ref-body
22786 !! wikitext
22787 A <ref>
22788 foo
22789
22790 bar
22791
22792
22793 baz
22794
22795
22796
22797 booz
22798 </ref>
22799
22800 <references />
22801 !! html/parsoid
22802 <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>
22803
22804 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22805 <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
22806
22807 bar
22808
22809
22810 baz
22811
22812
22813
22814 booz
22815 </span></li>
22816 </ol>
22817 !!end
22818
22819 !!test
22820 Ref: 8. transclusion wikitext has lower precedence
22821 !! wikitext
22822 A <ref> foo {{echo|</ref> B C}}
22823
22824 <references />
22825 !! html/parsoid
22826 <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>
22827 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22828 <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>
22829 </ol>
22830 !!end
22831
22832 !!test
22833 Ref: 9. unclosed comments should not leak out of ref-body
22834 !! wikitext
22835 A <ref> foo <!--</ref> B C
22836 <references />
22837 !! html/parsoid
22838 <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>
22839 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22840 <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>
22841 </ol>
22842 !!end
22843
22844 !!test
22845 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22846 !! wikitext
22847 A <ref> <b> foo </ref> B C
22848
22849 <references />
22850 !! html/parsoid
22851 <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>
22852
22853
22854 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22855 <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>
22856 </ol>
22857 !!end
22858
22859 !!test
22860 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22861 !! wikitext
22862 A <ref>foo</ref> B
22863 C <ref>bar</ref> D
22864 <references />
22865 !! html/parsoid
22866 <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
22867 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>
22868 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22869 <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>
22870 <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>
22871 </ol>
22872 !!end
22873
22874 !!test
22875 Ref: 12. ref-tags act as trailing newline migration barrier
22876 !! wikitext
22877 <!--the newline at the end of this line moves out of the p tag-->a
22878
22879 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22880 <ref />
22881
22882 c
22883 <references />
22884 !! html/parsoid
22885 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22886
22887
22888 <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>
22889 <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>
22890
22891 <p>c</p>
22892 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22893 <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>
22894 <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>
22895 !!end
22896
22897 !!test
22898 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22899 !! wikitext
22900 <ref>foo</ref> A
22901 <ref>bar
22902 </ref> B
22903 <references />
22904 !! html/parsoid
22905 <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
22906 <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>
22907 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22908 <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>
22909 <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
22910 </span></li>
22911 </ol>
22912 !!end
22913
22914 ## Roundtripping fails because of nowiki'ing
22915 !! test
22916 Ref: 14. A nested ref-tag should be emitted as plain text
22917 !! options
22918 parsoid=wt2html
22919 !! wikitext
22920 <ref>foo <ref>bar</ref> baz</ref>
22921
22922 <references />
22923 !! html/parsoid
22924 <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>
22925
22926 <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>
22927 !! end
22928
22929 !!test
22930 Ref: 15. ref-tags with identical names should get identical indexes
22931 !! wikitext
22932 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22933 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22934
22935 <references />
22936 !! html/parsoid
22937 <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>
22938 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>
22939
22940 <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>
22941 </ol>
22942 !!end
22943
22944 ## We don't bother wt2wt-ing non-standard whitespace
22945 !!test
22946 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22947 !!options
22948 parsoid=wt2html
22949 !! wikitext
22950 A <ref >foo</ref >
22951
22952 <references />
22953 !! html/parsoid
22954 <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>
22955 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22956 <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>
22957 !!end
22958
22959 !!test
22960 Ref: 17. Generate valid HTML5 id/about attributes
22961 !!wikitext
22962 <ref name="a b">foo</ref>
22963 <ref name=":0">ve-created name</ref>
22964
22965 <references />
22966 !!html/parsoid
22967 <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>
22968 <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>
22969
22970 <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>
22971
22972 !!end
22973
22974 !!test
22975 Ref: 18. T58916: Extension attributes should be parsed as plain text
22976 !!wikitext
22977 <ref name="{{echo|a}}">foo</ref>
22978
22979 <references />
22980 !!html/parsoid
22981 <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>
22982 </p>
22983
22984 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22985 <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>
22986 </ol>
22987 !!end
22988
22989 !!test
22990 Ref: 19. ref-tags with identical name encodings should get identical indexes
22991 !! wikitext
22992 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22993
22994 <references />
22995 !! html/parsoid
22996 <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>
22997 </p>
22998 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22999 <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>
23000 </ol>
23001 !!end
23002
23003 !!test
23004 Ref: 20. ref-tags with identical names but different content should keep it
23005 !! wikitext
23006 A <ref name="foo">Foo one</ref>
23007 B <ref name="foo">Foo two</ref>
23008 C <ref name="foo" />
23009
23010 <references />
23011 !! html/parsoid
23012 <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>
23013 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>
23014 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>
23015
23016 <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>
23017 </ol>
23018 !!end
23019
23020 !!test
23021 References: 1. references tag without any refs should be handled properly
23022 !! wikitext
23023 <references />
23024 !! html/parsoid
23025 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
23026 !!end
23027
23028 !!test
23029 References: 2. references tag with group only outputs references from that group
23030 !! wikitext
23031 A <ref group="a">foo</ref>
23032 B <ref group="b">bar</ref>
23033 C <ref>baz</ref>
23034
23035 <references group="a" />
23036 <references />
23037 <references group="b" />
23038 !! html/parsoid
23039 <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>
23040 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>
23041 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>
23042
23043 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
23044 <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>
23045 </ol>
23046 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
23047 <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>
23048 </ol>
23049 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
23050 <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>
23051 </ol>
23052 !!end
23053
23054 !!test
23055 References: 3. ref list should be cleared after processing references
23056 !! wikitext
23057 A <ref>foo</ref>
23058
23059 <references />
23060
23061 B <ref>bar</ref>
23062
23063 <references />
23064 !! html/parsoid
23065 <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>
23066
23067 <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>
23068 </ol>
23069
23070 <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>
23071
23072 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
23073 <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>
23074 </ol>
23075 !!end
23076
23077 !!test
23078 References: 4. only referenced group should be cleared after processing references
23079 !! wikitext
23080 A <ref group="a">afoo</ref>
23081 B <ref>bfoo</ref>
23082
23083 <references group="a" />
23084
23085 C <ref>cfoo</ref>
23086
23087 <references />
23088 !! html/parsoid
23089 <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>
23090 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>
23091
23092 <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>
23093 </ol>
23094
23095 <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>
23096
23097 <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>
23098 </ol>
23099 !!end
23100
23101 ## Don't expect this to rt since we're dropping content
23102 !! test
23103 References: 5. ref tags in references should be processed while ignoring all other content
23104 !! options
23105 parsoid=wt2html,html2html
23106 !! wikitext
23107 A <ref name="a" />
23108 B <ref name="b">bar</ref>
23109
23110 <references>
23111 <ref name="a">foo</ref>
23112 This should just get lost.
23113 </references>
23114 !! html/parsoid
23115 <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>
23116 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>
23117
23118
23119 <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>
23120 </ol>
23121 !! end
23122
23123 !! test
23124 References: 6. <references /> from a transclusion
23125 !! wikitext
23126 <ref>Foo</ref> {{echo|<references />}}
23127 !! html/parsoid
23128 <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>
23129 </ol>
23130 !! end
23131
23132 !! test
23133 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
23134 !! wikitext
23135 A <ref>foo bar for a</ref>
23136 B <ref group="X" name="b" />
23137
23138 <references />
23139
23140 <references group="X">
23141 <ref name="b">foo</ref>
23142 </references>
23143 !! html/parsoid
23144 <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>
23145 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>
23146 </p>
23147
23148 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
23149 <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>
23150 </ol>
23151
23152 <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"}}'>
23153 <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>
23154 </ol>
23155 !! end
23156
23157 !! test
23158 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
23159 !! wikitext
23160 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
23161 <references />
23162 !! html/parsoid
23163 <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>
23164 <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>
23165 </ol>
23166 !!end
23167
23168 # This test only works in wt2html now as the <references /> are always generated
23169 # unless selser is active. Once T72722 is fixed, we should add a changes test
23170 # here to ensure that unrelated changes don't add the new <references />
23171 # when selser is active.
23172 !! test
23173 References: 9. Generate missing references list at the end
23174 !! wikitext
23175 A <ref>foo</ref>
23176 B <ref group="inexistent">bar</ref>
23177 !! html/parsoid
23178 <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>
23179 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
23180 <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>
23181 </ol>
23182 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
23183 <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>
23184 </ol>
23185 !! end
23186
23187 !! test
23188 References: 10. New <references/> shouldn't be added for unrelated edits.
23189 !! options
23190 parsoid={
23191 "modes": ["selser"],
23192 "changes": [["#x", "remove"]],
23193 "selser": "noauto"
23194 }
23195 !! wikitext
23196 Unrelated text<span id="x"> that's going to disappear</span>.
23197 A <ref>foo</ref>
23198 !! wikitext/edited
23199 Unrelated text.
23200 A <ref>foo</ref>
23201 !!end
23202
23203 !! test
23204 Entities in ref name
23205 !! wikitext
23206 <ref name="test &amp; me">hi</ref>
23207 <references />
23208 !! html/parsoid
23209 <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>
23210 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23211 <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>
23212 </ol>
23213 !! end
23214
23215 ## The output here may look funny, but it's what the php parser will do. The
23216 ## unclosed references tag becomes escaped text, and then a new references
23217 ## tag is auto-generated. The test is wt2html only because it roundtrips with
23218 ## nowiki tags, and the auto-generated references tag is only dropped in
23219 ## rtTestMode.
23220 !! test
23221 Generate references for unclosed references tag
23222 !! options
23223 parsoid=wt2html
23224 !! wikitext
23225 a<ref>foo</ref>
23226
23227 <references>
23228 !! html/parsoid
23229 <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>
23230
23231 <p>&lt;references></p>
23232 <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>
23233 !! end
23234
23235 !! test
23236 New reference serializes on its own line
23237 !! options
23238 parsoid=wt2wt,html2wt
23239 !! wikitext
23240 foo
23241 <references />
23242 !! html/parsoid
23243 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
23244 !! end
23245
23246 #### ----------------------------------------------------------------
23247 #### Parsoid-only testing of Parsoid's impl of LST
23248 #### Not implemented yet, see
23249 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
23250 #### ----------------------------------------------------------------
23251
23252 ## We still need to support serializing the older format while content is stored.
23253 !! test
23254 LST Sections: Backwards compatibility
23255 !! options
23256 parsoid={
23257 "suppressErrors": true,
23258 "modes": ["html2wt"]
23259 }
23260 !! wikitext
23261 <section begin="2011-05-16" />
23262 <section end="2014-04-10 (MW 1.23wmf22)" />
23263 !! html/parsoid
23264 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
23265 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
23266 !! end
23267
23268 ## The unconventional output is the result of `usePHPPreProcessor` being
23269 ## disabled in parserTests.js. This test is mainly just to show <section> is
23270 ## recognized as an extension tag w/o a native handler.
23271 !! test
23272 LST Sections: Newfangled approach
23273 !! options
23274 parsoid={ "suppressErrors": true }
23275 !! wikitext
23276 <section begin="2011-05-16" />
23277 <section end="2014-04-10 (MW 1.23wmf22)" />
23278 !! html/parsoid
23279 <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>
23280 <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>
23281 !! end
23282
23283 #--------- Test stripping of empty nodes in template content ----------
23284 !!test
23285 Empty LI and TR nodes should be stripped from template content
23286 !!wikitext
23287 {{EmptyLITest}}
23288 {{EmptyTRTest}}
23289 !!html/parsoid
23290 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
23291 <li>a</li>
23292 <li>b</li>
23293 </ul>
23294 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
23295 <tbody>
23296 <tr>
23297 <td>foo</td>
23298 </tr>
23299 <tr>
23300 <td>bar</td>
23301 </tr>
23302 </tbody>
23303 </table>
23304 !!end
23305
23306 !!test
23307 Empty LI and TR nodes should not be stripped from top-level content
23308 !!wikitext
23309 * a
23310 *
23311 * b
23312 {|
23313 |-
23314 |-
23315 |foo
23316 |}
23317 !!html/parsoid
23318 <ul>
23319 <li> a</li>
23320 <li></li>
23321 <li> b</li>
23322 </ul>
23323 <table>
23324 <tbody>
23325 <tr></tr>
23326 <tr>
23327 <td>foo</td>
23328 </tr>
23329 </tbody>
23330 </table>
23331 !!end
23332
23333 !!test
23334 Empty TR nodes should not be stripped if they have any attributes set
23335 !!wikitext
23336 {{EmptyTRWithHTMLAttrTest}}
23337 !!html/parsoid
23338 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
23339 <tr align="center"></tr>
23340 <tr><td>foo</td></tr>
23341 <tr align="center"></tr>
23342 <tr><td>bar</td></tr>
23343 </table>
23344 !!end
23345
23346 #### ----------------------------------------------------------------
23347 #### The following section of tests are primarily to test
23348 #### wikitext escaping capabilities of Parsoid. Given that
23349 #### escaping can be done any number of ways, the wikitext (input)
23350 #### is always adjusted to reflect how Parsoid adds nowiki
23351 #### escape tags.
23352 ####
23353 #### We are marking several tests as parsoid-only since the
23354 #### HTML in the result section is different from what the
23355 #### PHP parser generates for it.
23356 #### ----------------------------------------------------------------
23357
23358
23359 #### --------------- Headings ---------------
23360 #### 0. Unnested
23361 #### 1. Nested inside html <h1>=foo=</h1>
23362 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
23363 #### 3. Nested inside html with wikitext split by html tags
23364 #### 4. No escape needed
23365 #### 5. Empty headings <h1></h1>
23366 #### 6. Heading chars in SOL context
23367 #### ----------------------------------------
23368 !! test
23369 Headings: 0. Unnested
23370 !! options
23371 parsoid=html2wt
23372 !! html/parsoid
23373 <p>=foo=</p>
23374
23375 <p> =foo=
23376 <!--cmt-->
23377 =foo=</p>
23378
23379 <p>=foo<i>a</i>=</p>
23380 !! wikitext
23381 <nowiki>=foo=</nowiki>
23382
23383 <nowiki> </nowiki>=foo=
23384 <!--cmt-->
23385 <nowiki>=foo=</nowiki>
23386
23387 =foo''a''<nowiki>=</nowiki>
23388 !!end
23389
23390 # New headings and existing headings are handled differently
23391 !! test
23392 Headings: 1. Nested inside html
23393 !! options
23394 parsoid=html2wt
23395 !! html/parsoid
23396 <h1>=foo=</h1>
23397 <h2>=foo=</h2>
23398 <h3>=foo=</h3>
23399
23400 <h1 data-parsoid=''>=foo=</h1>
23401 <h2 data-parsoid=''>=foo=</h2>
23402 <h3 data-parsoid=''>=foo=</h3>
23403 <h4 data-parsoid=''>=foo=</h4>
23404 <h5 data-parsoid=''>=foo=</h5>
23405 <h6 data-parsoid=''>=foo=</h6>
23406 !! wikitext
23407 = =foo= =
23408
23409 == =foo= ==
23410
23411 === =foo= ===
23412
23413 =<nowiki>=foo=</nowiki>=
23414 ==<nowiki>=foo=</nowiki>==
23415 ===<nowiki>=foo=</nowiki>===
23416 ====<nowiki>=foo=</nowiki>====
23417 =====<nowiki>=foo=</nowiki>=====
23418 ======<nowiki>=foo=</nowiki>======
23419
23420 !!end
23421
23422 !! test
23423 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
23424 !! options
23425 parsoid=html2wt
23426 !! html/parsoid
23427 <h1>foo</h1>*bar
23428 <h1>foo</h1>=bar
23429 <h1>foo</h1>=bar=
23430 !! wikitext
23431 = foo =
23432 <nowiki>*</nowiki>bar
23433
23434 = foo =
23435 =bar
23436
23437 = foo =
23438 <nowiki>=bar=</nowiki>
23439 !!end
23440
23441 !! test
23442 Headings: 3. Nested inside html with wikitext split by html tags
23443 !! options
23444 parsoid=html2wt
23445 !! html/parsoid
23446 <h1>=<b>bold</b>foo=</h1>
23447 !! wikitext
23448 = ='''bold'''foo= =
23449 !!end
23450
23451 !! test
23452 Headings: 4a. No escaping needed (testing just h1 and h2)
23453 !! options
23454 parsoid=html2wt
23455 !! html/parsoid
23456 <h1>=foo</h1>
23457 <h1>foo=</h1>
23458 <h1> =foo= </h1>
23459 <h1>=foo= bar</h1>
23460 <h2>=foo</h2>
23461 <h2>foo=</h2>
23462 <h1>=</h1>
23463 <h1><i>=</i>foo=</h1>
23464 !! wikitext
23465 = =foo =
23466
23467 = foo= =
23468
23469 = =foo= =
23470
23471 = =foo= bar =
23472
23473 == =foo ==
23474
23475 == foo= ==
23476
23477 = = =
23478
23479 = ''=''foo= =
23480 !!end
23481
23482 !! test
23483 Headings: 4b. No escaping needed (inside p-tags)
23484 !! options
23485 parsoid=html2wt
23486 !! html/parsoid
23487 <p>===
23488 =foo= x
23489 =foo= <s></s>
23490 </p>
23491 !! wikitext
23492 ===
23493 =foo= x
23494 =foo= <s></s>
23495 !!end
23496
23497 !! test
23498 Headings: 5. Empty headings
23499 !! options
23500 parsoid=html2wt
23501 !! html/parsoid
23502 <h1 data-parsoid='{}'></h1>
23503
23504 <h2 data-parsoid='{}'></h2>
23505
23506 <h3 data-parsoid='{}'></h3>
23507
23508 <h4 data-parsoid='{}'></h4>
23509
23510 <h5 data-parsoid='{}'></h5>
23511
23512 <h6 data-parsoid='{}'></h6>
23513 !! wikitext
23514 =<nowiki/>=
23515
23516 ==<nowiki/>==
23517
23518 ===<nowiki/>===
23519
23520 ====<nowiki/>====
23521
23522 =====<nowiki/>=====
23523
23524 ======<nowiki/>======
23525 !!end
23526
23527 !! test
23528 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23529 !! options
23530 parsoid=html2wt
23531 !! html/parsoid
23532 <p>=a=</p>
23533
23534 <p>=a=</p>
23535
23536 <p>=a=</p>
23537 !! wikitext
23538 <nowiki>=a=</nowiki>
23539
23540 <nowiki>=a=</nowiki>
23541
23542 <nowiki>=a=</nowiki>
23543 !!end
23544
23545 !! test
23546 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23547 !! options
23548 parsoid=html2wt
23549 !! html/parsoid
23550 <p>=a=
23551 b</p>
23552
23553 <p>=a=
23554 b</p>
23555
23556 <p>=a=
23557 b</p>
23558 !! wikitext
23559 <nowiki>=a=</nowiki>
23560 b
23561
23562 <nowiki>=a=</nowiki>
23563 b
23564
23565 <nowiki>=a=</nowiki>
23566 b
23567 !!end
23568
23569 !! test
23570 Headings: 6c. Heading chars in SOL context (leading newline break)
23571 !! options
23572 parsoid=html2wt
23573 !! html/parsoid
23574 <p>a
23575 =b=</p>
23576 !! wikitext
23577 a
23578 <nowiki>=b=</nowiki>
23579 !!end
23580
23581 !! test
23582 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23583 !! options
23584 parsoid=html2wt
23585 !! html/parsoid
23586 <!--c0--><p>=a=</p>
23587
23588 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23589 !! wikitext
23590 <!--c0--><nowiki>=a=</nowiki>
23591
23592 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23593 !!end
23594
23595 !! test
23596 Headings: 6d. Heading chars in SOL context (No escaping needed)
23597 !! options
23598 parsoid=html2wt
23599 !! html/parsoid
23600 =a=<div>b</div>
23601 !! wikitext
23602 =a=<div>b</div>
23603 !!end
23604
23605 !! test
23606 Headings: 7. Insert a newline between new content and headings
23607 !! options
23608 parsoid=html2wt
23609 !! html/parsoid
23610 <h2>NEW</h2>
23611 <p>new</p>
23612 <h2 data-parsoid='{}'>A</h2>
23613 <p data-parsoid='{}'>a</p>
23614 !! wikitext
23615 == NEW ==
23616 new
23617
23618 ==A==
23619 a
23620
23621 !! end
23622
23623 #### --------------- Lists ---------------
23624 #### 0. Outside nests (*foo, etc.)
23625 #### 1. Nested inside html <ul><li>*foo</li></ul>
23626 #### 2. Inside definition lists
23627 #### 3. Only bullets at start should be escaped
23628 #### 4. No escapes needed
23629 #### 5. No unnecessary escapes
23630 #### 6. Escape bullets in SOL position
23631 #### 7. Escape bullets in a multi-line context
23632 #### ----------------------------------------
23633
23634 !! test
23635 Lists: 0. Outside nests
23636 !! options
23637 parsoid=html2wt
23638 !! html/parsoid
23639 <p>*foo</p>
23640
23641 <p>#foo</p>
23642
23643 <p>;Foo:bar</p>
23644 !! wikitext
23645 <nowiki>*</nowiki>foo
23646
23647 <nowiki>#</nowiki>foo
23648
23649 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23650 !!end
23651
23652 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23653 ## to test wikitext escaping, and insignificant whitespace diffs
23654 ## cause PHP parser tests to barf
23655 !! test
23656 Lists: 1. Nested inside html (No unnecessary escapes)
23657 !! options
23658 parsoid=html2wt
23659 !! html/parsoid
23660 <ul>
23661 <li>*foo</li>
23662 <li>#foo</li>
23663 <li>:foo</li>
23664 <li>;foo</li>
23665 <li data-parsoid='{}'>*foo</li>
23666 <li data-parsoid='{}'>#foo</li>
23667 <li data-parsoid='{}'>:foo</li>
23668 <li data-parsoid='{}'>;foo</li>
23669 </ul>
23670
23671 <ol>
23672 <li>*foo</li>
23673 <li>#foo</li>
23674 <li>:foo</li>
23675 <li>;foo</li>
23676 <li data-parsoid='{}'>*foo</li>
23677 <li data-parsoid='{}'>#foo</li>
23678 <li data-parsoid='{}'>:foo</li>
23679 <li data-parsoid='{}'>;foo</li>
23680 </ol>
23681 !! wikitext
23682 * *foo
23683 * #foo
23684 * :foo
23685 * ;foo
23686 *<nowiki>*foo</nowiki>
23687 *<nowiki>#foo</nowiki>
23688 *<nowiki>:foo</nowiki>
23689 *<nowiki>;foo</nowiki>
23690
23691 # *foo
23692 # #foo
23693 # :foo
23694 # ;foo
23695 #<nowiki>*foo</nowiki>
23696 #<nowiki>#foo</nowiki>
23697 #<nowiki>:foo</nowiki>
23698 #<nowiki>;foo</nowiki>
23699 !!end
23700
23701 !! test
23702 Lists: 2. Inside definition lists
23703 !! options
23704 parsoid=html2wt
23705 !! html/parsoid
23706 <dl><dt>;foo</dt></dl>
23707 <dl><dt>:foo</dt></dl>
23708 <dl><dt>:foo</dt>
23709 <dd>bar</dd></dl>
23710 <dl><dd>:foo</dd></dl>
23711 !! wikitext
23712 ; ;foo
23713
23714 ; <nowiki>:foo</nowiki>
23715
23716 ; <nowiki>:foo</nowiki>
23717 : bar
23718
23719 : :foo
23720 !!end
23721
23722 !! test
23723 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23724 !! options
23725 parsoid=html2wt
23726 !! html/parsoid
23727 <ul>
23728 <li>*foo*bar</li>
23729 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23730 </ul>
23731 !! wikitext
23732 * *foo*bar
23733 *<nowiki>*foo</nowiki>''it''*bar
23734 !!end
23735
23736 !! test
23737 Lists: 4. No escapes needed
23738 !! options
23739 parsoid=html2wt
23740 !! html/parsoid
23741 <ul>
23742 <li>foo*bar
23743 </li>
23744 </ul>
23745 <ul>
23746 <li><i>foo</i>*bar
23747 </li>
23748 </ul>
23749 <ul>
23750 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23751 </li>
23752 </ul>
23753 <ul>
23754 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23755 </li>
23756 </ul>
23757 !! wikitext
23758 *foo*bar
23759
23760 *''foo''*bar
23761
23762 *[[Foo]]: bar
23763
23764 *[[Foo]]*bar
23765 !!end
23766
23767 !! test
23768 Lists: 5. No unnecessary escapes
23769 !! options
23770 parsoid=html2wt
23771 !! html/parsoid
23772 <ul><li> bar <span>[[foo]]</span></li></ul>
23773 <ul><li> =bar <span>[[foo]]</span></li></ul>
23774 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23775 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23776 <ul><li> =bar <span>foo]]</span>=</li></ul>
23777 <ul><li> <s></s>: a</li></ul>
23778 <ul><li> <i>* foo</i></li></ul>
23779
23780 !! wikitext
23781 * bar <span><nowiki>[[foo]]</nowiki></span>
23782
23783 * =bar <span><nowiki>[[foo]]</nowiki></span>
23784
23785 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23786
23787 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23788
23789 * =bar <span>foo]]</span>=
23790
23791 * <s></s>: a
23792
23793 * ''* foo''
23794 !!end
23795
23796 !! test
23797 Lists: 6. Escape bullets in SOL position
23798 !! options
23799 parsoid=html2wt
23800 !! html/parsoid
23801 <p><!--cmt-->*foo</p>
23802 !! wikitext
23803 <!--cmt--><nowiki>*</nowiki>foo
23804 !!end
23805
23806 !! test
23807 Lists: 7. Escape bullets in a multi-line context
23808 !! options
23809 parsoid=html2wt
23810 !! html/parsoid
23811 <p>a
23812 *b
23813 </p>
23814 !! wikitext
23815 a
23816 <nowiki>*</nowiki>b
23817 !!end
23818
23819 !! test
23820 Lists: 8. Escape colons only if not present in tags
23821 !! options
23822 parsoid=html2wt
23823 !! html/parsoid
23824 <dl><dt>a:b<i>c:d</i></dt></dl>
23825 !! wikitext
23826 ; <nowiki>a:b</nowiki>''c:d''
23827 !! end
23828
23829 #### --------------- HRs ---------------
23830 #### 1. Single line
23831 #### -----------------------------------
23832
23833 !! test
23834 HRs: 1. Single line
23835 !! options
23836 parsoid=html2wt
23837 !! html/parsoid
23838 <hr />----
23839 <hr />=foo=
23840 <hr />*foo
23841 !! wikitext
23842 ----<nowiki>----</nowiki>
23843 ----=foo=
23844 ----*foo
23845 !! end
23846
23847 #### --------------- Tables ---------------
23848 #### 1a. Simple example
23849 #### 1b. No escaping needed (!foo)
23850 #### 1c. No escaping needed (|foo)
23851 #### 1d. No escaping needed (|}foo)
23852 ####
23853 #### 2a. Nested in td (<td>foo|bar</td>)
23854 #### 2b. Nested in td (<td>foo||bar</td>)
23855 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23856 ####
23857 #### 3a. Nested in th (<th>foo!bar</th>)
23858 #### 3b. Nested in th (<th>foo!!bar</th>)
23859 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23860 ####
23861 #### 4a. Escape -
23862 #### 4b. Escape +
23863 #### 4c. No escaping needed
23864 #### --------------------------------------
23865
23866 !! test
23867 Tables: 1a. Simple example
23868 !! options
23869 parsoid=html2wt
23870 !! html/parsoid
23871 <p>{|
23872 |}
23873 </p>
23874 !! wikitext
23875 <nowiki>{|</nowiki>
23876 |}
23877 !! end
23878
23879 !! test
23880 Tables: 1b. No escaping needed
23881 !! options
23882 parsoid=html2wt
23883 !! html/parsoid
23884 <p>!foo
23885 </p>
23886 !! wikitext
23887 !foo
23888 !! end
23889
23890 !! test
23891 Tables: 1c. No escaping needed
23892 !! options
23893 parsoid=html2wt
23894 !! html/parsoid
23895 <p>|foo
23896 </p>
23897 !! wikitext
23898 |foo
23899 !! end
23900
23901 !! test
23902 Tables: 1d. No escaping needed
23903 !! options
23904 parsoid=html2wt
23905 !! html/parsoid
23906 <p>|}foo
23907 </p>
23908 !! wikitext
23909 |}foo
23910 !! end
23911
23912 !! test
23913 Tables: 2a. Nested in td
23914 !! options
23915 parsoid=html2wt
23916 !! html/parsoid
23917 <table><tbody><tr>
23918 <td>foo|bar</td></tr>
23919 <tr><td>x<div>a|b</div></td>
23920 </tbody></table>
23921 !! wikitext
23922 {|
23923 |<nowiki>foo|bar</nowiki>
23924 |-
23925 |x<div><nowiki>a|b</nowiki></div>
23926 |}
23927 !! html/php+tidy
23928 <table>
23929 <tr>
23930 <td>foo|bar</td>
23931 </tr>
23932 <tr>
23933 <td>x
23934 <div>a|b</div>
23935 </td>
23936 </tr>
23937 </table>
23938 !! end
23939
23940 !! test
23941 Tables: 2b. Nested in td
23942 !! options
23943 parsoid=html2wt
23944 !! html/parsoid
23945 <table><tbody><tr>
23946 <td>foo||bar</td>
23947 <td>a<i>b||c</i></td>
23948 <td>a<i><div>b||c</div></i></td>
23949 </tr></tbody></table>
23950 !! wikitext
23951 {|
23952 |<nowiki>foo||bar</nowiki>
23953 |a''<nowiki>b||c</nowiki>''
23954 |a''<div><nowiki>b||c</nowiki></div>''
23955 |}
23956 !! html/php
23957 <table>
23958 <tr>
23959 <td>foo||bar
23960 </td>
23961 <td>a<i>b||c</i>
23962 </td>
23963 <td>a<i><div>b||c</div></i>
23964 </td></tr></table>
23965
23966 !! end
23967
23968 !! test
23969 Tables: 2c. Nested in td -- no escaping needed
23970 !! options
23971 parsoid=html2wt
23972 !! html/*
23973 <table>
23974 <tr>
23975 <td>foo!!bar
23976 </td></tr></table>
23977
23978 !! wikitext
23979 {|
23980 |foo!!bar
23981 |}
23982 !! end
23983
23984 !! test
23985 Tables: 3a. Nested in th
23986 !! options
23987 parsoid=html2wt
23988 !! html/*
23989 <table>
23990 <tr>
23991 <th>foo!bar
23992 </th></tr></table>
23993
23994 !! wikitext
23995 {|
23996 !foo!bar
23997 |}
23998 !! end
23999
24000 !! test
24001 Tables: 3b. Nested in th
24002 !! options
24003 parsoid=html2wt
24004 !! html/parsoid
24005 <table><tbody>
24006 <tr><th>foo!!bar</th>
24007 <th><i>foo|bar</i></th>
24008 <th><i>foo!!bar</i></th>
24009 <th><i><span>foo!!bar</span></i></th>
24010 </tr></tbody></table>
24011 !! wikitext
24012 {|
24013 !<nowiki>foo!!bar</nowiki>
24014 !''<nowiki>foo|bar</nowiki>''
24015 !''<nowiki>foo!!bar</nowiki>''
24016 !''<span><nowiki>foo!!bar</nowiki></span>''
24017 |}
24018 !! html/php
24019 <table>
24020 <tr>
24021 <th>foo!!bar
24022 </th>
24023 <th><i>foo|bar</i>
24024 </th>
24025 <th><i>foo!!bar</i>
24026 </th>
24027 <th><i><span>foo!!bar</span></i>
24028 </th></tr></table>
24029
24030 !! end
24031
24032 !! test
24033 Tables: 3c. Nested in th
24034 !! options
24035 parsoid=html2wt
24036 !! html/parsoid
24037 <table><tbody>
24038 <tr><th>foo||bar</th>
24039 <th><span typeof="mw:Nowiki">foo||bar</span></th>
24040 </tr></tbody></table>
24041 !! wikitext
24042 {|
24043 !<nowiki>foo||bar</nowiki>
24044 !<nowiki>foo||bar</nowiki>
24045 |}
24046 !! html/php
24047 <table>
24048 <tr>
24049 <th>foo||bar
24050 </th>
24051 <th>foo||bar
24052 </th></tr></table>
24053
24054 !! end
24055
24056 !! test
24057 Tables: 4a. Escape -
24058 !! options
24059 parsoid=html2wt
24060 !! html/*
24061 <table>
24062 <tr>
24063 <th>-bar
24064 </th></tr>
24065 <tr>
24066 <td>-bar
24067 </td></tr></table>
24068
24069 !! wikitext
24070 {|
24071 !-bar
24072 |-
24073 |<nowiki>-bar</nowiki>
24074 |}
24075 !! end
24076
24077 !! test
24078 Tables: 4b. Escape +
24079 !! options
24080 parsoid=html2wt
24081 !! html/*
24082 <table>
24083 <tr>
24084 <th>+bar
24085 </th></tr>
24086 <tr>
24087 <td>+bar
24088 </td></tr></table>
24089
24090 !! wikitext
24091 {|
24092 !+bar
24093 |-
24094 |<nowiki>+bar</nowiki>
24095 |}
24096 !! end
24097
24098 !! test
24099 Tables: 4c. No escaping needed
24100 !! options
24101 parsoid=html2wt
24102 !! html/parsoid
24103 <table><tbody>
24104 <tr><td>foo-bar</td><td>foo+bar</td></tr>
24105 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
24106 <tr><td>foo
24107 <p>bar|baz
24108 +bar
24109 -bar</p></td></tr>
24110 <tr><td>x
24111 <div>a|b</div></td>
24112 </tbody></table>
24113 !! wikitext
24114 {|
24115 |foo-bar
24116 |foo+bar
24117 |-
24118 |''foo''-bar
24119 |''foo''+bar
24120 |-
24121 |foo
24122 bar|baz
24123 +bar
24124 -bar
24125 |-
24126 |x
24127 <div>a|b</div>
24128 |}
24129 !! html/php
24130 <table>
24131 <tr>
24132 <td>foo-bar
24133 </td>
24134 <td>foo+bar
24135 </td></tr>
24136 <tr>
24137 <td><i>foo</i>-bar
24138 </td>
24139 <td><i>foo</i>+bar
24140 </td></tr>
24141 <tr>
24142 <td>foo
24143 <p>bar|baz
24144 +bar
24145 -bar
24146 </p>
24147 </td></tr>
24148 <tr>
24149 <td>x
24150 <div>a|b</div>
24151 </td></tr></table>
24152
24153 !! end
24154
24155 !! test
24156 Tables: 4d. No escaping needed
24157 !! options
24158 parsoid=html2wt
24159 !! html/parsoid
24160 <table>
24161 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
24162 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
24163 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
24164 </tbody></table>
24165 !! wikitext
24166 {|
24167 |[[Foo]]-bar
24168 ||+1
24169 ||-2
24170 |}
24171 !! html/php
24172 <table>
24173 <tr>
24174 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
24175 </td>
24176 <td>+1
24177 </td>
24178 <td>-2
24179 </td></tr></table>
24180
24181 !! end
24182
24183 !! test
24184 T97430: Don't emit empty nowiki pairs around marker meta tags
24185 !! options
24186 parsoid=html2wt
24187 !! html/parsoid
24188 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24189 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
24190 !! wikitext
24191 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24192 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
24193 !! end
24194
24195 !! test
24196 Unclosed xmlish element in table line shouldn't eat end delimiters
24197 !! options
24198 parsoid=html2wt
24199 !! html/parsoid
24200 <table>
24201 <tbody><tr><td> &lt;foo</td>
24202 <td> bar></td></tr>
24203 </tbody></table>
24204 !! wikitext
24205 {|
24206 | <foo
24207 | bar>
24208 |}
24209 !! html/php
24210 <table>
24211 <tr>
24212 <td> &lt;foo
24213 </td>
24214 <td> bar&gt;
24215 </td></tr></table>
24216
24217 !! end
24218
24219 #### --------------- Links ----------------
24220 #### 1. Quote marks in link text
24221 #### 2. Wikilinks: Escapes needed
24222 #### 3. Wikilinks: No escapes needed
24223 #### 4. Extlinks: Escapes needed
24224 #### 5. Extlinks: No escapes needed
24225 #### --------------------------------------
24226 !! test
24227 Links 1. WikiLinks: No escapes needed
24228 !! options
24229 parsoid=html2wt
24230 !! html/parsoid
24231 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
24232 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
24233 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
24234 !! wikitext
24235 [[Foo|Foo''boo'']]
24236 [[Foo|[Foobar]]]
24237 [[Foo|x [Foobar] x]]
24238 !! html/php
24239 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
24240 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
24241 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
24242 </p>
24243 !! end
24244
24245 !! test
24246 Links 2. WikiLinks: Escapes needed
24247 !! options
24248 parsoid=html2wt
24249 !! html/parsoid
24250 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
24251 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
24252 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
24253 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
24254 <a href="Foo" rel="mw:WikiLink">|Bar</a>
24255 <a href="Foo" rel="mw:WikiLink">]]bar</a>
24256 <a href="Foo" rel="mw:WikiLink">[[bar</a>
24257 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
24258 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
24259 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
24260 !! wikitext
24261 [[Foo|<nowiki>Foobar]</nowiki>]]
24262 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
24263 [[Foo|<nowiki>[[Bar]]</nowiki>]]
24264 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
24265 [[Foo|<nowiki>|Bar</nowiki>]]
24266 [[Foo|<nowiki>]]bar</nowiki>]]
24267 [[Foo|<nowiki>[[bar</nowiki>]]
24268 [[Foo|<nowiki>x [[ y</nowiki>]]
24269 [[Foo|<nowiki>x ]] y</nowiki>]]
24270 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
24271 !! html/php
24272 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
24273 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
24274 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
24275 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
24276 <a href="/wiki/Foo" title="Foo">|Bar</a>
24277 <a href="/wiki/Foo" title="Foo">]]bar</a>
24278 <a href="/wiki/Foo" title="Foo">[[bar</a>
24279 <a href="/wiki/Foo" title="Foo">x [[ y</a>
24280 <a href="/wiki/Foo" title="Foo">x ]] y</a>
24281 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
24282 </p>
24283 !! end
24284
24285 !! test
24286 Links 3. WikiLinks: No escapes needed
24287 !! options
24288 parsoid=html2wt
24289 !! html/parsoid
24290 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
24291 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
24292 !! wikitext
24293 [[Foo|[Foobar]]
24294 [[Foo|foo|bar]]
24295 !! html/php
24296 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
24297 <a href="/wiki/Foo" title="Foo">foo|bar</a>
24298 </p>
24299 !! end
24300
24301 !! test
24302 Links 4. ExtLinks: Escapes needed
24303 !! options
24304 parsoid=html2wt
24305 !! html/parsoid
24306 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
24307 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
24308 <p>[http://google.com]</p>
24309 <p>[http://google.com google]</p>
24310 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
24311 <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>
24312 !! wikitext
24313 [http://google.com <nowiki>[google]</nowiki>]
24314 [http://google.com <nowiki>google]</nowiki>]
24315
24316 <nowiki>[http://google.com]</nowiki>
24317
24318 <nowiki>[http://google.com google]</nowiki>
24319
24320 [http://google.com<nowiki>]</nowiki>
24321
24322 [{{echo|http://google.com}}<nowiki>]</nowiki>
24323 !! html/php
24324 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
24325 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
24326 </p><p>[http://google.com]
24327 </p><p>[http://google.com google]
24328 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24329 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24330 </p>
24331 !! end
24332
24333 !! test
24334 Links 5. ExtLinks: No escapes needed
24335 !! options
24336 parsoid=html2wt
24337 !! html/parsoid
24338 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
24339 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
24340 !! wikitext
24341 [http://google.com [google]
24342
24343 [[http://google.com]]
24344 !! html/php
24345 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
24346 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
24347 </p>
24348 !! end
24349
24350 !! test
24351 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
24352 !! options
24353 parsoid=html2wt
24354 !! html/parsoid
24355 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
24356 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
24357 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
24358 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
24359 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
24360 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
24361 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24362 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
24363 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24364 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
24365 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
24366 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
24367 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
24368 </p>
24369 !! wikitext
24370 x<nowiki/>http://example.com<nowiki/>y
24371 http://example.com<nowiki/>?x
24372 http://example.com<nowiki/>&x
24373 http://example.com<nowiki/>'x
24374 http://example.com<nowiki/>,x
24375 http://example.com<nowiki/>.x
24376 http://example.com<nowiki/>;x
24377 http://example.com<nowiki/>:x
24378 http://example.com<nowiki/>;x
24379 http://example.com<nowiki/>!x
24380 http://example.com<nowiki/>=x
24381 http://example.com<nowiki/>(x)
24382 http://example.com(x<nowiki/>)
24383 !! end
24384
24385 !! test
24386 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24387 !! options
24388 parsoid=html2wt
24389 !! html/parsoid
24390 <p>x
24391 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
24392 y
24393 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
24394 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
24395 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
24396 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
24397 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
24398 </p>
24399 !! wikitext
24400 x
24401 http://example.com
24402 y
24403 "http://example.com"
24404 (http://example.com)
24405 (http://example.com) foo
24406 http://example.com,
24407 http://example.com, foo
24408 !! html/php
24409 <p>x
24410 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
24411 y
24412 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
24413 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
24414 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
24415 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
24416 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
24417 </p>
24418 !! end
24419
24420 !! test
24421 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24422 !! options
24423 parsoid=html2wt
24424 !! html/parsoid
24425 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
24426 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
24427 !! wikitext
24428 http://example.com.,;:!?\
24429 -http://example.com:
24430 !! html/php
24431 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
24432 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
24433 </p>
24434 !! end
24435
24436 !! test
24437 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
24438 !! options
24439 parsoid=html2wt
24440 !! html/parsoid
24441 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
24442 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
24443 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
24444 !! wikitext
24445 RFC 123<nowiki/>4
24446 RFC 123<nowiki/>y
24447 X<nowiki/>RFC 123<nowiki/>y
24448 !! end
24449
24450 !! test
24451 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
24452 !! options
24453 parsoid=html2wt
24454 !! html/parsoid
24455 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24456 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24457 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24458 </p>
24459 !! wikitext
24460 RFC 123?foo
24461 RFC 123&foo
24462 -RFC 123-
24463 !! html/php
24464 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24465 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24466 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24467 </p>
24468 !! end
24469
24470 !! test
24471 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
24472 !! options
24473 parsoid=html2wt
24474 !! html/parsoid
24475 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24476 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24477 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24478 !! wikitext
24479 PMID 123<nowiki/>4
24480 PMID 123<nowiki/>y
24481 X<nowiki/>PMID 123<nowiki/>y
24482 !! end
24483
24484 !! test
24485 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
24486 !! options
24487 parsoid=html2wt
24488 !! html/parsoid
24489 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24490 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24491 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24492 </p>
24493 !! wikitext
24494 PMID 123?foo
24495 PMID 123&foo
24496 -PMID 123-
24497 !! html/php
24498 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24499 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24500 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24501 </p>
24502 !! end
24503
24504 !! test
24505 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
24506 !! options
24507 parsoid=html2wt
24508 !! html/parsoid
24509 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24510 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24511 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24512 </p>
24513 !! wikitext
24514 ISBN 1234567890<nowiki/>1
24515 ISBN 1234567890<nowiki/>x
24516 a<nowiki/>ISBN 1234567890<nowiki/>b
24517 !! end
24518
24519 !! test
24520 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
24521 !! options
24522 parsoid=html2wt
24523 !! html/parsoid
24524 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24525 !! wikitext
24526 -ISBN 1234567890's
24527 !! html/php
24528 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24529 </p>
24530 !! end
24531
24532 !! test
24533 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24534 !! options
24535 parsoid=html2wt
24536 !! html/*
24537 <p>this is not a link: http://example.com
24538 </p>
24539 !! wikitext
24540 this is not a link: <nowiki>http://example.com</nowiki>
24541 !! end
24542
24543 !! test
24544 Links 15. Link trails can't become link prefixes.
24545 !! options
24546 language=is
24547 parsoid=html2wt
24548 !! html/parsoid
24549 <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>
24550 !! wikitext
24551 [[Söfnuður]]-[[00]]
24552 !! html/php
24553 <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>
24554 </p>
24555 !! end
24556
24557 #### --------------- Quotes ---------------
24558 #### 1. Quotes inside <b> and <i>
24559 #### 2. Link fragments separated by <i> and <b> tags
24560 #### 3. Link fragments inside <i> and <b>
24561 #### 4. No escaping needed
24562 #### --------------------------------------
24563 !! test
24564 1a. Quotes inside <b> and <i>
24565 !! options
24566 parsoid=html2wt
24567 !! html/*
24568 <p><i>'foo'</i>
24569 <i>''foo''</i>
24570 <i>'''foo'''</i>
24571 <i>foo</i>'s
24572 <b>'foo'</b>
24573 <b>''foo''</b>
24574 <b>'''foo'''</b>
24575 <b>foo'<i>bar'</i>baz</b>
24576 <b>foo</b>'s
24577 '<i>foo</i>
24578 <i>foo</i>'
24579 <i>foo'</i>'
24580 '<i>foo</i>'
24581 '<b>foo</b>
24582 <b>foo</b>'
24583 '<b>foo</b>'
24584 <i>fools'<span> errand</span></i>
24585 <i><span>fool</span>'s errand</i>
24586 '<i>foo</i> bar '<i>baz</i>
24587 a|!*#-:;+-~[]{}b'<i>x</i>
24588 </p>
24589 !! wikitext
24590 ''<nowiki/>'foo'''
24591 ''<nowiki>''foo''</nowiki>''
24592 ''<nowiki>'''foo'''</nowiki>''
24593 ''foo''<nowiki/>'s
24594 '''<nowiki/>'foo''''
24595 '''<nowiki>''foo''</nowiki>'''
24596 '''<nowiki>'''foo'''</nowiki>'''
24597 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24598 '''foo'''<nowiki/>'s
24599 '''foo''
24600 ''foo''<nowiki/>'
24601 ''foo'''<nowiki/>'
24602 '''foo''<nowiki/>'
24603 ''''foo'''
24604 '''foo'''<nowiki/>'
24605 ''''foo'''<nowiki/>'
24606 ''fools'<span> errand</span>''
24607 ''<span>fool</span>'s errand''
24608 '<nowiki/>''foo'' bar '''baz''
24609 a|!*#-:;+-~[]{}b'''x''
24610 !! end
24611
24612 !! test
24613 1b. Quotes inside <b> and <i> with other tags on same line
24614 !! options
24615 parsoid=html2wt
24616 !! html/parsoid
24617 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24618 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24619 <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>
24620 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24621 '<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>
24622 '<i>foo</i> <div title="name">test</div>
24623 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24624 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24625 <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>
24626 </ol>
24627 !! wikitext
24628 '''a'' foo ''[[bar]]''
24629 ''a''' foo ''[[bar]]''
24630 ''a''' foo '''{{echo|[[bar]]}}'''
24631 [[foo]] x'''[[bar]]''
24632 '''foo'' <ref>test</ref>
24633 '''foo'' <div title="name">test</div>
24634 '''foo'' and <br> bar
24635 <references />
24636 !! end
24637
24638 !! test
24639 2. Link fragments separated by <i> and <b> tags
24640 !! options
24641 parsoid=html2wt
24642 !! html/parsoid
24643 <p>[[<i>foo</i>hello]]</p>
24644 <p>[[<b>foo</b>hello]]</p>
24645 !! wikitext
24646 [[''foo''<nowiki>hello]]</nowiki>
24647
24648 [['''foo'''<nowiki>hello]]</nowiki>
24649 !! end
24650
24651 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24652 # this is one of the shortcomings of this format
24653 !! test
24654 3. Link fragments inside <i> and <b>
24655 !! options
24656 parsoid=html2wt
24657 !! html/parsoid
24658 <p><i>[[foo</i>]]</p>
24659 <p><b>[[foo</b>]]</p>
24660 !! wikitext
24661 ''[[foo''<nowiki>]]</nowiki>
24662
24663 '''[[foo'''<nowiki>]]</nowiki>
24664 !! end
24665
24666 !! test
24667 4. No escaping needed
24668 !! options
24669 options=html2wt
24670 !! html/parsoid
24671 <p>'<span><i>bar</i></span>'
24672 '<span><b>bar</b></span>'
24673 'a:b'foo
24674 </p>
24675 !! wikitext
24676 '<span>''bar''</span>'
24677 '<span>'''bar'''</span>'
24678 'a:b'foo
24679 !! end
24680
24681 #### ----------- Paragraphs ---------------
24682 #### 1. No unnecessary escapes
24683 #### --------------------------------------
24684
24685 !! test
24686 1. No unnecessary escapes
24687 !! options
24688 parsoid=html2wt
24689 !! html/parsoid
24690 <p>bar <span>[[foo]]</span>
24691 </p><p>=bar <span>[[foo]]</span>
24692 </p><p>[[bar <span>[[foo]]</span>
24693 </p><p>]]bar <span>[[foo]]</span>
24694 </p><p>=bar <span>foo]]</span>=
24695 </p>
24696 !! wikitext
24697 bar <span><nowiki>[[foo]]</nowiki></span>
24698
24699 =bar <span><nowiki>[[foo]]</nowiki></span>
24700
24701 [[bar <span><nowiki>[[foo]]</nowiki></span>
24702
24703 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24704
24705 =bar <span>foo]]</span><nowiki>=</nowiki>
24706 !!end
24707
24708 #### ----------------------- PRE --------------------------
24709 #### 1. Leading whitespace in SOL context should be escaped
24710 #### ------------------------------------------------------
24711 !! test
24712 1. Leading whitespace in SOL context should be escaped
24713 !! options
24714 parsoid=html2wt
24715 !! html/parsoid
24716 <p> a</p>
24717
24718 <p> a</p>
24719
24720 <p> a(tab)</p>
24721
24722 <p> a
24723 <!--cmt-->
24724 a</p>
24725
24726 <p>a
24727 b</p>
24728
24729 <p>a
24730 b</p>
24731
24732 <p>a
24733 b</p>
24734 !! wikitext
24735 <nowiki> </nowiki>a
24736
24737 <nowiki> </nowiki> a
24738
24739 a(tab)
24740
24741 <nowiki> </nowiki> a
24742 <!--cmt-->
24743 <nowiki> </nowiki>a
24744
24745 a
24746 <nowiki> </nowiki>b
24747
24748 a
24749 b
24750
24751 a
24752 b
24753 !! html/php
24754 <p> a
24755 </p><p> a
24756 </p><p> a(tab)
24757 </p><p> a
24758 a
24759 </p><p>a
24760 b
24761 </p><p>a
24762 b
24763 </p><p>a
24764 b
24765 </p>
24766 !! end
24767
24768 !! test
24769 2. Leading whitespace in non-indent-pre contexts should not be escaped
24770 !! options
24771 parsoid=html2wt
24772 !! html/parsoid
24773 <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>
24774 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24775 <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>
24776 b</span></li>
24777 </ol>
24778 !! wikitext
24779 foo <ref>''a''
24780 b</ref>
24781 <references />
24782 !! end
24783
24784 !! test
24785 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24786 !! options
24787 parsoid=html2wt
24788 !! html/parsoid
24789 <blockquote>
24790 <p>
24791 a
24792 <span>b</span>
24793 c</p>
24794 </blockquote>
24795 !! wikitext
24796 <blockquote>
24797 a
24798 <span>b</span>
24799 c
24800 </blockquote>
24801 !! end
24802
24803 !! test
24804 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24805 !! options
24806 options=html2wt
24807 !! html/parsoid
24808 <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>
24809 !! wikitext
24810 [[File:Foobar.jpg|thumb|caption]]
24811 !! end
24812
24813 !! test
24814 5. Nowiki escaping should account for indent-pres
24815 !! options
24816 parsoid=html2wt
24817 !! html/parsoid
24818 <pre>==foo==</pre>
24819 !! wikitext
24820 ==foo==
24821 !! end
24822
24823 !!test
24824 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24825 !! options
24826 parsoid=html2wt
24827 !! html/parsoid
24828 <pre>
24829 * foo
24830 * bar
24831 </pre>
24832 !! wikitext
24833 * foo
24834 * bar
24835 !! end
24836
24837 #### --------------- Behavior Switches --------------------
24838
24839 !! test
24840 1. Valid behavior switches should be escaped
24841 !! options
24842 parsoid=html2wt
24843 !! html/parsoid
24844 __TOC__
24845 <i>__TOC__</i>
24846 !! wikitext
24847 <nowiki>__TOC__</nowiki>
24848 ''<nowiki>__TOC__</nowiki>''
24849 !! end
24850
24851 !! test
24852 2. Invalid behavior switches should not be escaped
24853 !! options
24854 parsoid=html2wt
24855 !! html/parsoid
24856 __TOO__
24857 __|__
24858 !! wikitext
24859 __TOO__
24860 __|__
24861 !! end
24862
24863 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24864 !! test
24865 Behavior switches should be SOL-transparent
24866 !! options
24867 parsoid=html2wt
24868 !! html/parsoid
24869 <meta property="mw:PageProp/toc" />
24870
24871 <!-- this one's bogus -->
24872 <pre>__TOO__</pre>
24873
24874 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24875
24876 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24877 !! wikitext
24878 __TOC__
24879
24880 <!-- this one's bogus -->
24881 __TOO__
24882
24883 __TOC__ foo
24884
24885 __TOC__
24886 bar
24887 !! end
24888
24889 #### --------------- HTML tags ---------------
24890 #### 1. a tags
24891 #### 2. other tags
24892 #### 3. multi-line html tag
24893 #### 4. extension tags
24894 #### -----------------------------------------
24895 !! test
24896 1. a tags
24897 !! options
24898 parsoid=html2wt
24899 !! html/parsoid
24900 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24901 !! wikitext
24902 <a href="http://google.com">google</a>
24903 !! end
24904
24905 !! test
24906 2. other tags
24907 !! options
24908 parsoid=html2wt
24909 !! html/parsoid
24910 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24911 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24912 <li> &lt;td&gt;</li></ul>
24913
24914 !! wikitext
24915 * <nowiki><div>foo</div></nowiki>
24916 * <nowiki><div style="color:red">foo</div></nowiki>
24917 * <nowiki><td></nowiki>
24918 !! end
24919
24920 !! test
24921 3. multi-line html tag
24922 !! options
24923 parsoid=html2wt
24924 !! html/parsoid
24925 <p>&lt;div
24926 &gt;foo&lt;/div
24927 &gt;
24928 </p>
24929 !! wikitext
24930 <nowiki><div
24931 >foo</div
24932 ></nowiki>
24933 !! end
24934
24935 !! test
24936 4. extension tags
24937 !! options
24938 parsoid=html2wt
24939 !! html/parsoid
24940 <p>&lt;ref&gt;foo&lt;/ref&gt;
24941 </p><p>&lt;ref&gt;bar
24942 </p><p>baz&lt;/ref&gt;
24943 </p>
24944 !! wikitext
24945 <nowiki><ref>foo</ref></nowiki>
24946
24947 <nowiki><ref>bar</nowiki>
24948
24949 baz<nowiki></ref></nowiki>
24950 !! end
24951
24952 #### --------------- Others ---------------
24953 !! test
24954 Escaping nowikis
24955 !! options
24956 parsoid=html2wt
24957 !! html/parsoid
24958 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24959 </p>
24960 !! wikitext
24961 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24962 !! end
24963
24964 ## The quote-char in the input is necessary for triggering the bug
24965 !! test
24966 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24967 !! options
24968 parsoid=html2wt
24969 !! html/parsoid
24970 <p>foo's bar :</p>
24971 !! wikitext
24972 foo's bar :
24973 !! end
24974
24975 #----------- End of wikitext escaping tests --------------
24976
24977 !! test
24978
24979 Tag-like HTML structures are passed through as text
24980 !! wikitext
24981 <x y>
24982
24983 <x.y>
24984
24985 <x-y>
24986
24987 1>2
24988
24989 x<y
24990
24991 a>b
24992
24993 1<d e>f
24994 !! html
24995 <p>&lt;x y&gt;
24996 </p><p>&lt;x.y&gt;
24997 </p><p>&lt;x-y&gt;
24998 </p><p>1&gt;2
24999 </p><p>x&lt;y
25000 </p><p>a&gt;b
25001 </p><p>1&lt;d e&gt;f
25002 </p>
25003 !! end
25004
25005 !! test
25006 HTML tag with necessary entities in attributes
25007 !! wikitext
25008 <span title="&amp;amp;">foo</span>
25009 !! html
25010 <p><span title="&amp;amp;">foo</span>
25011 </p>
25012 !! end
25013
25014 !! test
25015 HTML tag with 'unnecessary' entity encoding in attributes
25016 !! wikitext
25017 <span title="&amp;">foo</span>
25018 !! html
25019 <p><span title="&amp;">foo</span>
25020 </p>
25021 !! end
25022
25023 !! test
25024 HTML tag with broken attribute value quoting
25025 !! options
25026 parsoid=wt2html,html2html
25027 !! wikitext
25028 <span title="Hello world>Foo</span>
25029 !! html/php
25030 <p><span title="Hello world">Foo</span>
25031 </p>
25032 !! html/parsoid
25033 <p><span title="Hello world">Foo</span></p>
25034 !! end
25035
25036 !! test
25037 Self-closed tag with broken attribute value quoting
25038 !! options
25039 parsoid=wt2html,html2html
25040 !! wikitext
25041 <div title="Hello world />Foo
25042 !! html/php+tidy
25043 <div title="Hello world"></div>
25044 <p>Foo</p>
25045 !! html/parsoid
25046 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
25047 !! end
25048
25049 !! test
25050 Table with broken attribute value quoting
25051 !! options
25052 parsoid=wt2html,html2html
25053 !! wikitext
25054 {|
25055 | title="Hello world|Foo
25056 |}
25057 !! html/php
25058 <table>
25059 <tr>
25060 <td title="Hello world">Foo
25061 </td></tr></table>
25062
25063 !! html/parsoid
25064 <table>
25065 <tr>
25066 <td title="Hello world">Foo
25067 </td></tr></table>
25068
25069 !! end
25070
25071 !! test
25072 Table with broken attribute value quoting on consecutive lines
25073 !! options
25074 parsoid=wt2html,html2html
25075 !! wikitext
25076 {|
25077 | title="Hello world|Foo
25078 | style="color:red|Bar
25079 |}
25080 !! html/php
25081 <table>
25082 <tr>
25083 <td title="Hello world">Foo
25084 </td>
25085 <td style="color:red">Bar
25086 </td></tr></table>
25087
25088 !! html/parsoid
25089 <table><tbody>
25090 <tr>
25091 <td title="Hello world">Foo
25092 </td><td style="color: red">Bar
25093 </td></tr></tbody></table>
25094
25095 !! end
25096
25097 !!test
25098 Accept empty td cell attribute
25099 !! wikitext
25100 {|
25101 | align="center" | foo || |
25102 |}
25103 !! html
25104 <table>
25105 <tr>
25106 <td align="center"> foo </td>
25107 <td>
25108 </td></tr></table>
25109
25110 !!end
25111
25112 !!test
25113 Non-empty attributes in th-cells
25114 !! wikitext
25115 {|
25116 ! Foo !! style="color: red" | Bar
25117 |}
25118 !! html
25119 <table>
25120 <tr>
25121 <th> Foo </th>
25122 <th style="color: red"> Bar
25123 </th></tr></table>
25124
25125 !!end
25126
25127 !!test
25128 Accept empty attributes in th-cells
25129 !! wikitext
25130 {|
25131 !| foo !!| bar
25132 |}
25133 !! html
25134 <table>
25135 <tr>
25136 <th> foo </th>
25137 <th> bar
25138 </th></tr></table>
25139
25140 !!end
25141
25142 !!test
25143 Empty table rows go away
25144 !! wikitext
25145 {|
25146 | Hello
25147 | there
25148 |- class="foo"
25149 |-
25150 |}
25151 !! html
25152 <table>
25153 <tr>
25154 <td> Hello
25155 </td>
25156 <td> there
25157 </td></tr>
25158
25159 </table>
25160
25161 !! end
25162
25163 ###
25164 ### Parsoid-centric tests for testing RTing of inter-element separators
25165 ### Edge cases not tested by existing parser tests and specific to
25166 ### Parsoid-specific serialization strategies.
25167 ###
25168
25169 !!test
25170 RT-ed inter-element separators should be valid separators
25171 !! wikitext
25172 {|
25173 |- [[foo]]
25174 |}
25175 !! html/php
25176 <table>
25177
25178 </table>
25179
25180 !! html/parsoid
25181 <table>
25182 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
25183 </tbody></table>
25184 !!end
25185
25186 # Parsoid-only since PHP parser relies on Tidy for correct output
25187 !!test
25188 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
25189 !!options
25190 parsoid
25191 !! wikitext
25192 {|
25193 |<small>foo
25194 bar
25195 |}
25196
25197 {|
25198 |<small>foo<small>
25199 |}
25200 !! html
25201 <table>
25202 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
25203 <p>bar</p></small></td></tr>
25204 </tbody></table>
25205
25206 <table>
25207 <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>
25208 </tbody></table>
25209 !!end
25210
25211 # Note that the "style" attribute is really a template parameter here.
25212 # The = would have to be {{=}} if you wanted the literal.
25213 !!test
25214 Empty TD followed by TD with tpl-generated attribute
25215 !! wikitext
25216 {|
25217 |-
25218 |
25219 |{{echo|style='color:red'}}|foo
25220 |}
25221 !! html
25222 <table>
25223
25224 <tr>
25225 <td>
25226 </td>
25227 <td>foo
25228 </td></tr></table>
25229
25230 !!end
25231
25232 !!test
25233 Indented table with an empty td
25234 !! wikitext
25235 {|
25236 |-
25237 |
25238 |foo
25239 |}
25240 !! html
25241 <table>
25242
25243 <tr>
25244 <td>
25245 </td>
25246 <td>foo
25247 </td></tr></table>
25248
25249 !!end
25250
25251 ## We have some newline diffs RT-ing this edge case
25252 ## and it is not important enough -- we seem to be emitting
25253 ## at most 2 newlines after a </tr> and this is unrelated to
25254 ## the issue from T85627 that this is testing.
25255 !!test
25256 Indented table with blank lines in between (T85627)
25257 !! options
25258 parsoid=wt2html
25259 !! wikitext
25260 {|
25261 |foo
25262
25263
25264 |}
25265 !! html
25266 <table>
25267
25268 <tr>
25269 <td>foo
25270 </td></tr></table>
25271
25272 !!end
25273
25274 !!test
25275 Indented block & table
25276 !! wikitext
25277 <div>foo</div>
25278 {|
25279 |foo
25280 |}
25281 !! html/php
25282 <div>foo</div>
25283 <table>
25284 <tr>
25285 <td>foo
25286 </td></tr></table>
25287
25288 !! html/parsoid
25289 <div data-parsoid='{"stx":"html"}'>foo</div>
25290 <table><tbody>
25291 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
25292 </tbody></table>
25293 !!end
25294
25295 !! test
25296 Indent and comment before table row
25297 !! wikitext
25298 {|
25299 <!--hi-->|-
25300 | there
25301 |}
25302 !! html/php
25303 <table>
25304
25305 <tr>
25306 <td> there
25307 </td></tr></table>
25308
25309 !! html/parsoid
25310 <table>
25311 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
25312 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
25313 </tbody></table>
25314 !! end
25315
25316 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
25317 !!test
25318 Empty TR followed by a template-generated TR
25319 !!options
25320 parsoid
25321 !! wikitext
25322 {|
25323 |-
25324 {{echo|<tr><td>foo</td></tr>}}
25325 |}
25326 !! html
25327 <table>
25328 <tbody>
25329 <tr></tr>
25330 <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}}]}'>
25331 <td>foo</td></tr>
25332 </tbody></table>
25333 !!end
25334
25335 ## PHP and parsoid output differ for this, and since this is primarily
25336 ## for testing Parsoid's serializer, marking this Parsoid only
25337 !!test
25338 Empty TR followed by mixed-ws-comment line should RT correctly
25339 !!options
25340 parsoid
25341 !! wikitext
25342 {|
25343 |-
25344 <!--c-->
25345 |-
25346 <!--c--> <!--d-->
25347 |}
25348 !! html
25349 <table>
25350 <tbody>
25351 <tr></tr>
25352 <!--c-->
25353 <tr>
25354 <!--c--> </tr><!--d-->
25355 </tbody></table>
25356
25357 !!end
25358
25359 !!test
25360 Multi-line image caption generated by templates with/without trailing newlines
25361 !! wikitext
25362 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
25363 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
25364 !! html/parsoid
25365 <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>
25366 <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>
25367 !!end
25368
25369 !! test
25370 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
25371 !! options
25372 parsoid=html2wt
25373 !! html/parsoid
25374 <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>
25375
25376 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
25377 !! wikitext
25378 <includeonly>foo</includeonly>
25379 new para
25380
25381 [[Category:Foo]]
25382
25383 = new heading =
25384 !! end
25385
25386 ## PHP emits broken html for this, and since this is primarily
25387 ## a Parsoid serializer test, marking this Parsoid only
25388 !!test
25389 Improperly nested inline or quotes tags with whitespace in between
25390 !! wikitext
25391 <span> <s>x</span> </s>
25392 ''' ''x''' ''
25393 !! html/parsoid
25394 <p><span> <s>x</s></span><s> </s>
25395 <b> <i>x</i></b><i> </i>
25396 </p>
25397 !!end
25398
25399 !!test
25400 Encapsulate protected attributes from wt
25401 !! wikitext
25402 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
25403
25404 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
25405 | ok
25406 |}
25407 !! html/parsoid
25408 <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>
25409
25410 <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">
25411 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
25412 </tbody></table>
25413 !!end
25414
25415 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
25416 ## Having nested or stray pre tags results in the attempt to add duplicates,
25417 ## causing an assertion fail. This test tries to prevent that situation.
25418 !!test
25419 Ensure ParagraphWrapper can deal with stray closing pre tags
25420 !!options
25421 parsoid=wt2html
25422 !! wikitext
25423 plain text</pre>
25424 !! html/parsoid
25425 plain text
25426 !!end
25427
25428 !!test
25429 1. Ensure fostered text content is wrapped in element nodes
25430 !!options
25431 parsoid=wt2html
25432 !! wikitext
25433 <table>hi</table><table>ho</table>
25434 !! html/parsoid
25435 <p>hi</p>
25436 <table></table>
25437 <p>ho</p>
25438 <table></table>
25439 !!end
25440
25441 !!test
25442 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
25443 !!options
25444 parsoid=wt2html,wt2wt
25445 !! wikitext
25446 <table>
25447 <tr> || ||
25448 <td> a
25449 </table>
25450 !! html/parsoid
25451 <p> || ||
25452 </p><table>
25453 <tbody><tr><td> a</td></tr>
25454 </tbody></table>
25455 !!end
25456
25457 !!test
25458 Encapsulation properly handles null DSR information from foster box
25459 !!options
25460 parsoid=wt2html,wt2wt
25461 !! wikitext
25462 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25463 !! html/parsoid
25464 <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>
25465 !!end
25466
25467 !!test
25468 1. Encapsulate foster-parented transclusion content
25469 !!options
25470 parsoid=wt2wt,wt2html
25471 !! wikitext
25472 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25473 !! html/parsoid
25474 <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>
25475 <tbody>
25476 <tr>
25477 <td>bar</td>
25478 </tr>
25479 </tbody>
25480 </table>
25481 !!end
25482
25483 !!test
25484 2. Encapsulate foster-parented transclusion content
25485 !!options
25486 parsoid=wt2wt,wt2html
25487 !! wikitext
25488 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25489 !! html/parsoid
25490 <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>
25491 <table>
25492 <tbody>
25493 <tr>
25494 <td>bar</td>
25495 </tr>
25496 </tbody>
25497 </table>
25498 !!end
25499
25500 !!test
25501 3. Encapsulate foster-parented transclusion content
25502 !!options
25503 parsoid=wt2wt,wt2html
25504 !! wikitext
25505 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25506 !! html/parsoid
25507 <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;]}">
25508 <p>foo</p>
25509 </div>
25510 <table>
25511 <tbody>
25512 <tr>
25513 <td>bar</td>
25514 </tr>
25515 </tbody>
25516 </table>
25517 !!end
25518
25519 !!test
25520 4. Encapsulate foster-parented transclusion content
25521 !!options
25522 parsoid=wt2wt,wt2html
25523 !! wikitext
25524 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25525 !! html/parsoid
25526 <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;]}">
25527 <p>foo</p>
25528 </div>
25529 <table>
25530 <tbody>
25531 <tr>
25532 <td>bar</td>
25533 </tr>
25534 </tbody>
25535 </table>
25536 !!end
25537
25538 !!test
25539 5. Encapsulate foster-parented transclusion content
25540 !!options
25541 parsoid=wt2wt,wt2html
25542 !! wikitext
25543 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25544 !! html/parsoid
25545 <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>
25546 <table>
25547 <tbody>
25548 <tr>
25549 <td>
25550 <div>
25551 <p>foo</p>
25552 </div>
25553 </td>
25554 </tr>
25555 </tbody>
25556 </table>
25557 !!end
25558
25559 !!test
25560 6. Encapsulate foster-parented transclusion content
25561 !!options
25562 parsoid=wt2wt,wt2html
25563 !! wikitext
25564 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25565 !! html/parsoid
25566 <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>
25567 <table>
25568 <tbody>
25569 <tr>
25570 <td>
25571 <div>
25572 <p>foo</p>
25573 </div>
25574 </td>
25575 </tr>
25576 </tbody>
25577 </table>
25578 <p>ok</p>
25579 !!end
25580
25581 !!test
25582 7. Encapsulate foster-parented transclusion content
25583 !!options
25584 parsoid=wt2wt,wt2html
25585 !! wikitext
25586 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25587 !! html/parsoid
25588 <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>
25589 <table>
25590 <tbody>
25591 <tr>
25592 <td>bar</td>
25593 </tr>
25594 </tbody>
25595 </table>
25596 !!end
25597
25598 # Note that the wt is broken on purpose: the = should be {{=}} if you
25599 # don't want it to be a template parameter key.
25600 !!test
25601 8. Encapsulate foster-parented transclusion content
25602 !!options
25603 parsoid=wt2wt,wt2html
25604 !! wikitext
25605 {{echo|a
25606 }}{|{{echo|style='color:red'}}
25607 |-
25608 |b
25609 |}
25610 !! html/parsoid
25611 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25612 <span> </span>
25613 <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>
25614 <table>
25615 <tbody>
25616 <tr>
25617 <td>b</td>
25618 </tr>
25619 </tbody>
25620 </table>
25621 !!end
25622
25623 !!test
25624 9. Encapsulate foster-parented transclusion content
25625 !!options
25626 parsoid=wt2wt,wt2html
25627 !! wikitext
25628 <table>{{echo|hi</table>hello}}
25629 !! html/parsoid
25630 <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>
25631 !!end
25632
25633 !!test
25634 Table in fosterable position
25635 !!options
25636 parsoid=wt2html
25637 !! wikitext
25638 {{OpenTable}}
25639 <div>
25640 {|
25641 |}
25642 </div>
25643 |}
25644 !! html/parsoid
25645 <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">
25646 </span>
25647 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25648
25649 <table>
25650 </table>
25651 !!end
25652
25653 # Parsoid only for bug 64747
25654 !! test
25655 Properly encapsulate empty-content transclusions in fosterable positions
25656 !! wikitext
25657 <table>
25658 {{#if:|
25659 <td>foo</td>
25660 }}
25661 </table>
25662 !! html/parsoid
25663 <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"}]]}'>
25664
25665 </table>
25666 !! end
25667
25668 !! test
25669 Always encapsulate foster box when template range is expanded to table
25670 !! options
25671 parsoid=wt2wt
25672 !! wikitext
25673 {|
25674 hello
25675 {{OpenTable}}
25676 |}
25677 !! html/parsoid
25678
25679 !! end
25680
25681 !! test
25682 T115289: Unclosed table
25683 !! wikitext
25684 {{echo|<table>}}<!--c-->[[Category:Two]]
25685 !! html/parsoid
25686 <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>
25687 !! end
25688
25689 !! test
25690 T115289: Don't migrate newlines out of tables with fostered content
25691 !! wikitext
25692 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25693 !! html/parsoid
25694 <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>
25695 !! end
25696
25697 !! test
25698 T73074: More fostering fun
25699 !! wikitext
25700 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25701 !! html/parsoid
25702 <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>
25703 !! end
25704
25705 !!test
25706 Support <object> element with .data attribute
25707 !!options
25708 parsoid=html2wt
25709 !! html/parsoid
25710 <object data="test.swf"></object>
25711 !! wikitext
25712 <object data="test.swf"></object>
25713 !!end
25714
25715 !! test
25716 Don't block XML namespace declaration
25717 !! wikitext
25718 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25719 !! html/php
25720 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25721 </p>
25722 !! html/parsoid
25723 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25724 !! end
25725
25726 # -----------------------------------------------------------------
25727 # The following section of tests are primarily to spec requirements
25728 # around Parsoid's serialization (old, new, edited content)
25729 #
25730 # All these tests are marked Parsoid html2wt and html2html only
25731 # ----------------------------------------------------------------
25732
25733 !! test
25734 Ignore rel attribute in a-tags during serialization to url-links
25735 !! options
25736 parsoid=html2wt
25737 !! html/parsoid
25738 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25739 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25740 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25741 !! wikitext
25742 http://en.wikipedia.org/wiki/Foobar
25743 http://en.wikipedia.org/wiki/Foobar
25744 http://en.wikipedia.org/wiki/Foobar
25745 !! end
25746
25747 # 'mi' is a localinterwiki prefix as well as a language
25748 !! test
25749 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
25750 !! options
25751 parsoid=html2wt
25752 !! html/parsoid
25753 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25754 !! wikitext
25755 [[Foo]]
25756 !! end
25757
25758 # See T93839
25759 !! test
25760 New wikilinks should be serialized properly
25761 !! options
25762 parsoid=html2wt
25763 !! html/parsoid
25764 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25765 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25766 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25767 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25768 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25769 !! wikitext
25770 [[Foo]]
25771 [[Foo]]
25772 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25773 http://en.wikipedia.org/wiki/Foo
25774 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25775 !! end
25776
25777 !! test
25778 New wiki links (href variations)
25779 !! options
25780 parsoid=html2wt
25781 !! html/parsoid
25782 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25783 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25784 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25785 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25786 !! wikitext
25787 [[Foo_bar]]
25788 [[Foo_bar]]
25789 [[Foo_bar]]
25790 [[Toxine bactérienne]]
25791 !! end
25792
25793 !! test
25794 New wiki links (content string variations)
25795 !! options
25796 parsoid=html2wt
25797 !! html/parsoid
25798 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25799 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25800 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25801 !! wikitext
25802 [[Foo_bar]]
25803 [[Foo bar]]
25804 [[Foo_bar|./Foo_bar]]
25805 !! end
25806
25807 !! test
25808 New category links (href variations)
25809 !! options
25810 parsoid=html2wt
25811 !! html/parsoid
25812 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25813 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25814 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25815 !! wikitext
25816 [[Category:Toxine bactérienne]]
25817 [[Category:Toxine bactérienne]]
25818 [[Category:Toxine bactérienne]]
25819 !! end
25820
25821 !! test
25822 New sol transparent links don't need indent-pre nowiki protection
25823 !! options
25824 parsoid=html2wt
25825 language=de
25826 !! html/parsoid
25827 <link rel="mw:PageProp/redirect" href="./Main_Page">
25828 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25829 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25830 !! wikitext
25831 #WEITERLEITUNG [[Main Page]]
25832 <!-- this is good --> [[Category:Good]]
25833 <!-- this is great --> [[Kategorie:Great]]
25834 !! end
25835
25836 !! test
25837 New interlanguage links (href variations)
25838 !! options
25839 parsoid=html2wt
25840 !! html/parsoid
25841 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25842 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25843 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25844 !! wikitext
25845 [[es:Toxine bactérienne]]
25846 [[es:Toxine_bactérienne]]
25847 [[es:Toxine_bactérienne]]
25848 !! end
25849
25850 !! test
25851 Image: Modifying size of an image (1)
25852 !! options
25853 parsoid={
25854 "modes": ["wt2wt"],
25855 "changes": [
25856 ["img[height]", "attr", "height", "22"],
25857 ["img[width]", "attr", "width", "200"]
25858 ]
25859 }
25860 !! wikitext
25861 [[Image:Foobar.jpg|230x230px]]
25862 !! wikitext/edited
25863 [[Image:Foobar.jpg|200x200px]]
25864 !!end
25865
25866 !! test
25867 Image: Modifying size of an image (2)
25868 !! options
25869 parsoid={
25870 "modes": ["wt2wt"],
25871 "changes": [
25872 ["img[height]", "attr", "height", "100"],
25873 ["img[width]", "attr", "width", "500"]
25874 ]
25875 }
25876 !! wikitext
25877 [[Image:Foobar.jpg|230x230px]]
25878 !! wikitext/edited
25879 [[Image:Foobar.jpg|500x500px]]
25880 !!end
25881
25882 # Change in size is ignored so long as class='mw-default-size'
25883 !! test
25884 Image: Modifying size of an image (3)
25885 !! options
25886 parsoid={
25887 "modes": ["wt2wt"],
25888 "changes": [
25889 ["figure[class]", "removeClass", "mw-default-size"],
25890 ["figure img", "attr", "height", "19"],
25891 ["figure img", "attr", "width", "170"]
25892 ]
25893 }
25894 !! wikitext
25895 [[Image:Foobar.jpg|thumb]]
25896 !! wikitext/edited
25897 [[Image:Foobar.jpg|thumb|170x170px]]
25898 !!end
25899
25900 !! test
25901 Image: Modifying alignment of an image (bug 48665)
25902 !! options
25903 parsoid={
25904 "modes": ["wt2wt"],
25905 "changes": [
25906 ["figure[class]", "removeClass", "mw-halign-right"],
25907 ["figure[class]", "addClass", "mw-halign-left"]
25908 ]
25909 }
25910 !! wikitext
25911 [[Image:Foobar.jpg|thumb|caption|right]]
25912 !! wikitext/edited
25913 [[Image:Foobar.jpg|thumb|caption|left]]
25914 !! end
25915
25916 !! test
25917 Image: Modifying mw-default-size of an frameless image (bug 62805)
25918 !! options
25919 parsoid={
25920 "modes": ["wt2wt"],
25921 "changes": [
25922 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25923 ]
25924 }
25925 !! wikitext
25926 [[Image:Foobar.jpg|frameless|right]]
25927 !! wikitext/edited
25928 [[Image:Foobar.jpg|frameless|right|220x220px]]
25929 !! end
25930
25931 !! test
25932 Image: Modifying valign of an image (bug 49221)
25933 !! options
25934 parsoid={
25935 "modes": ["wt2wt"],
25936 "changes": [
25937 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25938 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25939 ]
25940 }
25941 !! wikitext
25942 [[File:Foobar.jpg|20px|middle]]
25943 !! wikitext/edited
25944 [[File:Foobar.jpg|20px|text-top]]
25945 !! end
25946
25947 !! test
25948 Image: Modifying alt attribute of an image (bug 56400)
25949 !! options
25950 parsoid={
25951 "modes": ["wt2wt"],
25952 "changes": [
25953 ["img[alt]", "attr", "alt", "some alternate edited text"]
25954 ]
25955 }
25956 !! wikitext
25957 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25958 !! wikitext/edited
25959 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25960 !!end
25961
25962 !! test
25963 Image: Modifying caption of an image
25964 !! options
25965 parsoid={
25966 "modes": ["wt2wt"],
25967 "changes": [
25968 ["figcaption", "text", "new caption"]
25969 ]
25970 }
25971 !! wikitext
25972 [[Image:Foobar.jpg|thumb|original caption]]
25973 !! wikitext/edited
25974 [[Image:Foobar.jpg|thumb|new caption]]
25975 !!end
25976
25977 !! test
25978 Image: empty alt attribute (bug 48924)
25979 !! options
25980 parsoid
25981 !! wikitext
25982 [[File:Foobar.jpg|thumb|alt=|bar]]
25983 !! html
25984 <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>
25985 !! end
25986
25987 !! test
25988 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25989 !! options
25990 parsoid=html2wt
25991 language=ar
25992 disabled
25993 !! html/parsoid
25994 <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>
25995 !! wikitext
25996 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25997 !! end
25998
25999 !! test
26000 Image: Block level image should have \n before and after
26001 !! wikitext
26002 123
26003 [[File:Foobar.jpg|right|thumb|150x150px]]
26004 456
26005 !! html/parsoid
26006 <p>123</p>
26007 <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>
26008 <p>456</p>
26009 !!end
26010
26011 !! test
26012 Image: New block level image should have \n before and after (existing content)
26013 !! wikitext
26014 123
26015 [[File:Foobar.jpg|right|thumb|150x150px]]
26016 456
26017 !! html/parsoid
26018 <p>123</p>
26019 <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>
26020 <p>456</p>
26021 !!end
26022
26023 !! test
26024 Image: upright option (parsoid)
26025 !! wikitext
26026 [[File:Foobar.jpg|thumb|upright|caption]]
26027 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
26028 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
26029 !! html/parsoid
26030 <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>
26031 <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>
26032 <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>
26033 !!end
26034
26035 !! test
26036 Image: upright option is ignored on inline and frame images (parsoid)
26037 !! wikitext
26038 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
26039 !! html/parsoid
26040 <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>
26041 !!end
26042
26043 !! test
26044 Image: from basic HTML (1)
26045 !! options
26046 parsoid=html2wt
26047 !! html/parsoid
26048 <span typeof="mw:Image">
26049 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
26050 </span>
26051 !! wikitext
26052 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
26053 !! end
26054
26055 !! test
26056 Image: from basic HTML (2)
26057 !! options
26058 parsoid=html2wt
26059 !! html/parsoid
26060 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
26061 !! wikitext
26062 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
26063 !! end
26064
26065 !! test
26066 Image: from basic HTML (3)
26067 !! options
26068 parsoid=html2wt
26069 !! html/parsoid
26070 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
26071 !! wikitext
26072 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
26073 !! end
26074
26075 !! test
26076 Image: from basic HTML (4)
26077 !! options
26078 parsoid=html2wt
26079 !! html/parsoid
26080 <img src="./File:Foobar.jpg">
26081 !! wikitext
26082 [[File:Foobar.jpg|link=]]
26083 !! end
26084
26085 !! test
26086 Image: Invalid title as link
26087 !! wikitext
26088 [[File:Foobar.jpg|link=<]]
26089 !! html/php
26090 <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>
26091 </p>
26092 !! html/parsoid
26093 <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>
26094 !! end
26095
26096 !! test
26097 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
26098 !! options
26099 parsoid=html2wt
26100 !! html/parsoid
26101 <ul>
26102 <li><p>foo</p></li>
26103 </ul>
26104 !! wikitext
26105 * foo
26106 !! end
26107
26108 !! test
26109 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
26110 !! options
26111 parsoid=html2wt
26112 !! html/parsoid
26113 <ul> <li>foo</li></ul>
26114 !! wikitext
26115 * foo
26116 !! end
26117
26118 !! test
26119 Don't strip leading whitespace when handling indent-pre suppressing tags
26120 !! options
26121 parsoid=html2wt
26122 !! html/parsoid
26123 <table>
26124 <tr><td> indented row</td></tr>
26125 </table>
26126 <blockquote><p>
26127 <b>This is very bold of you!</b>
26128 </p>
26129 <table><tr><td>
26130 indented cell (no pre-wrapping!)
26131 </td></tr></table>
26132 </blockquote>
26133 <p>foo</p>
26134 <div>bar</div>
26135 !! wikitext
26136 {|
26137 | indented row
26138 |}
26139 <blockquote>
26140 '''This is very bold of you!'''
26141
26142 {|
26143 |
26144 indented cell (no pre-wrapping!)
26145 |}
26146 </blockquote>
26147 foo
26148 <div>bar</div>
26149 !! end
26150
26151 !! test
26152 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
26153 !! options
26154 parsoid=html2wt
26155 !! html/parsoid
26156 <p>foo</p>
26157 <span>bar</span>
26158
26159 <span>foo2
26160 </span>bar2
26161
26162 <div>foo</div>
26163 <span>bar</span>
26164
26165 <div>
26166 <span>foo</span>
26167 </div>
26168 !! wikitext
26169 foo
26170
26171 <span>bar</span>
26172
26173 <span>foo2
26174 <nowiki> </nowiki></span>bar2
26175
26176 <div>foo</div>
26177 <nowiki> </nowiki><span>bar</span>
26178
26179 <div>
26180 <nowiki> </nowiki><span>foo</span>
26181 </div>
26182 !! end
26183
26184 !! test
26185 Lists: Dont insert newlines in a serialized list item.
26186 !! options
26187 parsoid=html2wt
26188 !! html/parsoid
26189 <ul><li>a<br>b</li><li>c</li></ul>
26190 !! wikitext
26191 * a<br>b
26192 * c
26193 !! end
26194
26195 !! test
26196 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
26197 !! options
26198 parsoid={
26199 "modes": ["html2wt"],
26200 "scrubWikitext": false
26201 }
26202 !! html/parsoid
26203 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26204 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26205
26206 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26207 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26208
26209 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
26210
26211 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26212 !! wikitext
26213 == hello there [[Category:A1]] ==
26214
26215 == [[Category:A2]] hi pal ==
26216
26217 == <!--foo--> [[Category:A3]] how goes it ==
26218
26219 == it goes well [[Category:A4]] <!--bar--> ==
26220
26221 ==howdy [[Category:A5]]==
26222
26223 == __TOC__ ok ==
26224 !! end
26225
26226 !! test
26227 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
26228 !! options
26229 parsoid={
26230 "modes": ["html2wt"],
26231 "scrubWikitext": true
26232 }
26233 !! html/parsoid
26234 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26235 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26236
26237 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26238 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26239
26240 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26241 !! wikitext
26242 == hello there ==
26243 [[Category:A1]]
26244 [[Category:A2]]
26245
26246 == hi pal ==
26247
26248 <!--foo--> [[Category:A3]]
26249
26250 == how goes it ==
26251
26252 == it goes well ==
26253 [[Category:A4]] <!--bar-->
26254
26255 __TOC__
26256
26257 == ok ==
26258 !! end
26259
26260 !! test
26261 Headings: Don't hoist metas that come from templates
26262 !! options
26263 parsoid={
26264 "modes": ["html2wt"],
26265 "scrubWikitext": true
26266 }
26267 !! html/parsoid
26268 <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>
26269 !! wikitext
26270 == {{echo|foo [[Category:Foo]]}} ==
26271 !! end
26272
26273 !! test
26274 Headings: Category in ref isn't hoisted
26275 !! options
26276 parsoid={
26277 "modes": ["html2wt"],
26278 "scrubWikitext": true
26279 }
26280 !! html/parsoid
26281 <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>
26282
26283 <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>
26284 !! wikitext
26285 == foo <ref>bar
26286 [[Category:Baz]] </ref> ==
26287
26288 <references />
26289 !! end
26290
26291 !! test
26292 Parsoid: Serialize positional parameters with = in them as named parameter
26293 !! options
26294 parsoid=html2wt
26295 !! html/parsoid
26296 <p about="#mwt1" typeof="mw:Transclusion"
26297 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
26298
26299 <p about="#mwt1" typeof="mw:Transclusion"
26300 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
26301
26302 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26303 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26304 <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>
26305 !! wikitext
26306 {{echo|1=f=oo}}
26307
26308 {{echo|1=f=oo|2=bar}}
26309
26310 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26311 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26312 {{echo|<nowiki>f=oo</nowiki>|bar}}
26313 !! end
26314
26315 !! test
26316 Parsoid: Serialize positional parameters with = in extlink as named parameter
26317 !! options
26318 parsoid=html2wt
26319 !! html/parsoid
26320 <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>
26321 !! wikitext
26322 {{echo|1=http://stuff?is=ok}}
26323 !! end
26324
26325 !! test
26326 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
26327 !! options
26328 parsoid=html2wt
26329 !! html/parsoid
26330 <div>a<p>b</p></div>
26331 <div>a
26332 <p>b</p></div>
26333 <div>
26334 a
26335 <p>b</p></div>
26336 !! wikitext
26337 <div>a
26338 b
26339 </div>
26340 <div>a
26341 b
26342 </div>
26343 <div>
26344 a
26345
26346 b
26347 </div>
26348 !! end
26349
26350 !! test
26351 Substrings resembling wikitext in hrefs should not get nowiki escapes
26352 !! options
26353 parsoid=html2wt
26354 !! html/parsoid
26355 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
26356 !! wikitext
26357 [[Foo''bar''baz]]
26358 !! end
26359
26360 !! test
26361 Enforce single-line context in the serializer
26362 !! options
26363 parsoid=html2wt
26364 !! html/parsoid
26365 <h2>testing
26366 123</h2>
26367
26368 <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">
26369 </span><span about="#mwt1">you</span> </h2>
26370
26371 <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>
26372
26373 <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
26374 there</span></li></ol>
26375
26376 <ul><li>asd
26377 sdf</li></ul>
26378
26379 <ul><li>foo
26380 bar
26381 baz</li>
26382 <li>foo <b>bar</b>
26383 baz</li></ul>
26384
26385 <dl><dt>hi
26386 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
26387 ho</dd></dl>
26388
26389 <dl><dd> <table>
26390 <tbody><tr><td> ha
26391 ha
26392 ha</td></tr>
26393 </tbody></table></dd></dl>
26394 !! wikitext
26395 == testing 123 ==
26396
26397 == hi {{bogus|there
26398 you}} ==
26399
26400 == foo <ref>hello
26401 there</ref> ==
26402
26403 <references />
26404
26405 * asd sdf
26406
26407 * foo bar baz
26408 * foo '''bar''' baz
26409
26410 ; hi ho : hi ho
26411
26412 : {|
26413 | ha
26414 ha
26415 ha
26416 |}
26417 !! end
26418
26419 !! test
26420 Serialize new placeholder space without spans
26421 !! options
26422 parsoid=html2wt
26423 !! html/parsoid
26424 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
26425
26426 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
26427
26428 <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>
26429 !! wikitext
26430 foo : bar
26431
26432 foo : bar
26433
26434 <ref>foo : bar</ref>ok
26435 !! end
26436
26437
26438 #-----------------------
26439 # Tag minimization tests
26440 #-----------------------
26441
26442 !! test
26443 1. I/B quote minimization: wikitext-only tags should be combined
26444 !! options
26445 parsoid=html2wt
26446 !! html/parsoid
26447 <p><i>A</i><i>B</i></p>
26448 <p><b>A</b><b>B</b></p>
26449 <p><i>A</i><b><i>B</i></b></p>
26450 <p><b>A</b><i><b>B</b></i></p>
26451 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
26452 <p><i><b>A</b></i><i><b>B</b></i></p>
26453 <p><i><b>A</b></i><b><i>B</i></b></p>
26454 <p><b><i>A</i></b><i><b>B</b></i></p>
26455 !! wikitext
26456 ''AB''
26457
26458 '''AB'''
26459
26460 ''A'''B'''''
26461
26462 '''A''B'''''
26463
26464 '''A''BC''D'''
26465
26466 '''''AB'''''
26467
26468 '''''AB'''''
26469
26470 '''''AB'''''
26471 !! end
26472
26473 !! test
26474 2. I/B quote minimization: wikitext and html tags should not be combined
26475 !! options
26476 parsoid=html2wt
26477 !! html/parsoid
26478 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26479 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26480 !! wikitext
26481 ''A''<i>B</i>
26482
26483 ''A''<nowiki/>'''<i>B</i>'''
26484 !! end
26485
26486 !! test
26487 3. I/B quote minimization: templated content stops minimization
26488 !! options
26489 parsoid=html2wt
26490 !! html/parsoid
26491 <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>
26492 <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>
26493 !! wikitext
26494 ''A''{{echo|''B''}}
26495
26496 ''A''{{echo|'''''B'''''}}
26497 !! end
26498
26499 !! test
26500 4. I/B quote minimization: new content should be mimimized with adjacent old content
26501 !! options
26502 parsoid=html2wt
26503 !! html/parsoid
26504 <p><i>A</i><i>B</i></p>
26505 <p><b>A</b><b>B</b></p>
26506 <p><i>A</i><b><i>B</i></b></p>
26507 !! wikitext
26508 ''AB''
26509
26510 '''AB'''
26511
26512 ''A'''B'''''
26513 !! end
26514
26515 !! test
26516 5a. Merge adjacent quote nodes if they've been edited
26517 !! options
26518 parsoid={
26519 "modes": ["wt2wt", "selser"],
26520 "changes": [
26521 ["p", "contents", "remove", ":contains('b')"]
26522 ]
26523 }
26524 !! wikitext
26525 ''a''b''c''
26526 !! wikitext/edited
26527 ''ac''
26528 !! end
26529
26530 !! test
26531 5b. Merge adjacent quote nodes if they've been edited
26532 !! options
26533 parsoid={
26534 "modes": ["wt2wt", "selser"],
26535 "changes": [
26536 ["#x", "remove"]
26537 ]
26538 }
26539 !! wikitext
26540 ''a''<span id="x">b</span>''c''
26541 !! wikitext/edited
26542 ''ac''
26543 !! end
26544
26545 !! test
26546 1. Merge adjacent link nodes as long as at least one element is new
26547 !! options
26548 parsoid={
26549 "modes": ["html2wt"],
26550 "scrubWikitext": true
26551 }
26552 !! html/parsoid
26553 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26554 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26555 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26556 !! wikitext
26557 [[Football]]
26558 [[Football]]
26559 [[Football|Foot]][[Football|ball]]
26560 !! end
26561
26562 !! test
26563 2. Merge adjacent link nodes and enable additional normalizations
26564 !! options
26565 parsoid={
26566 "modes": ["html2wt"],
26567 "scrubWikitext": true
26568 }
26569 !! html/parsoid
26570 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26571 !! wikitext
26572 [[Football|''Football'']]
26573 !! end
26574
26575 !! test
26576 3. Don't merge adjacent link nodes if scrubWikitext is false
26577 !! options
26578 parsoid={
26579 "modes": ["html2wt"],
26580 "scrubWikitext": false
26581 }
26582 !! html/parsoid
26583 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26584 !! wikitext
26585 [[Football|Foot]][[Football|ball]]
26586 !! end
26587
26588 #------------------------------
26589 # End of tag minimization tests
26590 #------------------------------
26591
26592 !!test
26593 Bug 54262: New entities
26594 !! options
26595 parsoid=html2wt
26596 !! html/parsoid
26597 <span typeof="mw:Entity">&nbsp;</span>
26598 !! wikitext
26599 &nbsp;
26600 !! end
26601
26602 ## Note that there is no wikitext output for 'unknownproperty' ##
26603 ## Unknown magic words are silently dropped ##
26604
26605 !! test
26606 Magic words
26607 !! options
26608 parsoid=html2wt
26609 !! html/parsoid
26610 <meta property='mw:PageProp/toc' />
26611 <meta property='mw:PageProp/notoc' />
26612 <meta property='mw:PageProp/forcetoc' />
26613 <meta property='mw:PageProp/index' />
26614 <meta property='mw:PageProp/noindex' />
26615 <meta property='mw:PageProp/nogallery' />
26616 <meta property='mw:PageProp/noeditsection' />
26617 <meta property='mw:PageProp/notitleconvert' />
26618 <meta property='mw:PageProp/nocontentconvert' />
26619 <meta property='mw:PageProp/unknownproperty' />
26620 !! wikitext
26621 __TOC__
26622 __NOTOC__
26623 __FORCETOC__
26624 __INDEX__
26625 __NOINDEX__
26626 __NOGALLERY__
26627 __NOEDITSECTION__
26628 __NOTITLECONVERT__
26629 __NOCONTENTCONVERT__
26630 !! end
26631
26632 !! test
26633 Consecutive <pre>s should not get merged
26634 !! options
26635 parsoid=html2wt,html2html
26636 !! html/parsoid
26637 <pre>a</pre><pre>b</pre>
26638
26639 <pre>c
26640 </pre><pre>
26641 d</pre>
26642
26643 <pre>e
26644
26645 </pre><pre>
26646
26647 f</pre>
26648 !! wikitext
26649 a
26650
26651 b
26652
26653 c
26654
26655 d
26656
26657 e
26658
26659
26660
26661 f
26662 !! end
26663
26664 !! test
26665 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26666 !! options
26667 parsoid=html2wt
26668 !! html/parsoid
26669 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26670 !! wikitext
26671 [[Special:BookSources/1234567890|ISBN 1234567895]]
26672 !! end
26673
26674 !! test
26675 Edited RFC links not serializable as RFC links should serialize as extlinks
26676 !! options
26677 parsoid=html2wt
26678 !! html/parsoid
26679 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26680 !! wikitext
26681 [//tools.ietf.org/html/rfc123 New RFC]
26682 !! end
26683
26684 !! test
26685 Edited PMID links not serializable as PMID links should serialize as extlinks
26686 !! options
26687 parsoid=html2wt
26688 !! html/parsoid
26689 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26690 !! wikitext
26691 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26692 !! end
26693
26694 !! test
26695 WTS of autolinks with trailing/surrounding context
26696 !! options
26697 parsoid=html2wt
26698 !! html/parsoid
26699 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26700 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26701 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26702 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26703 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26704 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26705 !! wikitext
26706 http://cscott.net'''foo'''
26707
26708 http://cscott.net<b>foo</b>
26709
26710 '''http://cscott.net'''
26711
26712 '''http://cscott.net '''
26713
26714 '''http://cscott.net<nowiki/>x'''
26715
26716 http://cscott.net<nowiki/>x
26717 !! end
26718
26719 !! test
26720 WTS of autolinks with nowikis (round-trip)
26721 !! wikitext
26722 x<nowiki/>http://cscott.net<nowiki/>x
26723 !! html/parsoid
26724 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26725 !! end
26726
26727 # this is the "easy" test because it leaves in place all the
26728 # data-parsoid information indicating this is an autolink
26729 !! test
26730 WTS of autolinks with escapes (editing)
26731 !! options
26732 parsoid={
26733 "modes": ["wt2wt"],
26734 "changes": [
26735 [ "meta", "remove" ]
26736 ]
26737 }
26738 !! wikitext
26739 x<nowiki/>http://cscott.net<nowiki/>x
26740 !! wikitext/edited
26741 x<nowiki/>http://cscott.net<nowiki/>x
26742 !! end
26743
26744 !! test
26745 WTS of edited autolink-like text (T103364)
26746 !! options
26747 parsoid={
26748 "modes": ["wt2wt"],
26749 "changes": [
26750 [ "span[typeof]", "removeAttr", "typeof" ]
26751 ]
26752 }
26753 !! wikitext
26754 Not a link: <nowiki>http://example.com</nowiki>.
26755 !! wikitext/edited
26756 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26757 !! end
26758
26759 !! test
26760 WTS of newly-authored autolink-like text (T103364)
26761 !! options
26762 parsoid=html2wt
26763 !! html/parsoid
26764 <p>http://example.com is not a link.</p>
26765 !! wikitext
26766 <nowiki>http://example.com</nowiki> is not a link.
26767 !! end
26768
26769 !! test
26770 WTS of autolink-like text after an autolink (T108563)
26771 !! options
26772 parsoid=html2wt
26773 !! html/parsoid
26774 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26775 !! wikitext
26776 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26777 !! end
26778
26779 !! test
26780 Magic links inside links (not autolinked)
26781 !! wikitext
26782 [[Foo|http://example.com]]
26783 [[Foo|RFC 1234]]
26784 [[Foo|PMID 1234]]
26785 [[Foo|ISBN 123456789x]]
26786
26787 [http://foo.com http://example.com]
26788 [http://foo.com RFC 1234]
26789 [http://foo.com PMID 1234]
26790 [http://foo.com ISBN 123456789x]
26791 !! html+tidy
26792 <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>
26793 <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>
26794 !! html/parsoid
26795 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26796 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26797 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26798 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26799
26800 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26801 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26802 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26803 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26804 !! end
26805
26806 !! test
26807 Magic links inside image captions (autolinked)
26808 !! wikitext
26809 [[File:Foobar.jpg|thumb|http://example.com]]
26810 [[File:Foobar.jpg|thumb|RFC 1234]]
26811 [[File:Foobar.jpg|thumb|PMID 1234]]
26812 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26813 !! html+tidy
26814 <div class="thumb tright">
26815 <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>
26816 <div class="thumbcaption">
26817 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26818 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26819 </div>
26820 </div>
26821 <div class="thumb tright">
26822 <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>
26823 <div class="thumbcaption">
26824 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26825 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26826 </div>
26827 </div>
26828 <div class="thumb tright">
26829 <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>
26830 <div class="thumbcaption">
26831 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26832 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26833 </div>
26834 </div>
26835 <div class="thumb tright">
26836 <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>
26837 <div class="thumbcaption">
26838 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26839 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26840 </div>
26841 </div>
26842 !! html/parsoid
26843 <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>
26844 <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>
26845 <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>
26846 <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>
26847 !! end
26848
26849 !! test
26850 WTS of magic word text (T109371)
26851 !! options
26852 parsoid=html2wt
26853 !! html/parsoid
26854 <p>RFC 1234</p>
26855 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26856 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26857 !! wikitext
26858 <nowiki>RFC 1234</nowiki>
26859
26860 [http://foo.com RFC 1234]
26861
26862 [[Foo|RFC 1234]]
26863 !! end
26864
26865 !! test
26866 Edited Redirect link should emit a non-piped wikitext link
26867 !! options
26868 parsoid=html2wt
26869 !! html/parsoid
26870 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26871 !! wikitext
26872 #REDIRECT [[Bar]]
26873 !! end
26874
26875 !! test
26876 T75121: Infer extension name from typeOf if data-mw is not present
26877 !! options
26878 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26879 !! html/parsoid
26880 <div typeOf="mw:Extension/foo"></div>
26881 !! wikitext
26882 <foo />
26883 !! end
26884
26885 # Note that the <p> wrapping isn't present in PHP parser output
26886 # The important thing for this test is that P-wrapping doesn't
26887 # interfere with the <nowiki> protection for leading - in <td>
26888 # (which isn't necessary for <th>).
26889 !! test
26890 T88318: p-wrapped dash in table.
26891 !! options
26892 parsoid=html2wt,wt2wt
26893 !! html/parsoid
26894 <table><tbody>
26895 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26896 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26897 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26898 </tbody></table>
26899 !! wikitext
26900 {|
26901 !-
26902 !-
26903 |-
26904 |<nowiki>-</nowiki>
26905 |<nowiki>- </nowiki>
26906 |-
26907 |<small>-</small>
26908 |<br>
26909 -
26910 |<br>
26911 -
26912 |}
26913 !! html/php+tidy
26914 <table>
26915 <tr>
26916 <th>-</th>
26917 <th>-</th>
26918 </tr>
26919 <tr>
26920 <td>-</td>
26921 <td>-</td>
26922 </tr>
26923 <tr>
26924 <td><small>-</small></td>
26925 <td><br />
26926 <p>-</p>
26927 </td>
26928 <td><br />
26929 <p>-</p>
26930 </td>
26931 </tr>
26932 </table>
26933 !! end
26934
26935 !! test
26936 T149209: WTS: Handle newlines in table cells properly
26937 !! options
26938 parsoid=html2wt
26939 !! html/parsoid
26940 <table>
26941 <tbody>
26942 <tr><td>a
26943 b
26944 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
26945 <tr><td><p>x</p>
26946 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
26947 </tbody></table>
26948 <table>
26949 <tbody>
26950 <tr><th>a
26951 b
26952 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
26953 <tr><th><p>x</h>
26954 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
26955 </tbody></table>
26956 !! wikitext
26957 {|
26958 |a
26959 b
26960 |c
26961 |-
26962 |x
26963 {{!}}y
26964 |}
26965 {|
26966 !a
26967 b
26968 !c
26969 |-
26970 !x
26971 !y
26972 |}
26973 !! end
26974
26975 !! test
26976 T149209: Selser: Handle newlines in table cells properly
26977 !! options
26978 parsoid={
26979 "modes": ["selser"],
26980 "changes": [
26981 [ "#h1", "html", "a\nb\n" ],
26982 [ "#h2", "html", "a\nb\n" ],
26983 [ "#c1", "html", "a\nb\n" ],
26984 [ "#c2", "html", "<p>a</p>" ],
26985 [ "#c3", "html", "<p>a</p>" ],
26986 [ "#c4", "html", "edit-me<p>a</p>" ]
26987 ]
26988 }
26989 !! wikitext
26990 {|
26991 ! id="h1" |edit-me!!1
26992 |-
26993 ! id="h2" |edit-me||2
26994 |-
26995 | id="c1" |edit-me||3
26996 |-
26997 | id="c2" |edit-me||4
26998 |-
26999 | id="c3" |edit-me||p||q||r
27000 |-
27001 | id="c4" |edit-me||p||q||r
27002 |}
27003 !! wikitext/edited
27004 {|
27005 ! id="h1" |a
27006 b
27007 !1
27008 |-
27009 ! id="h2" |a
27010 b
27011 !2
27012 |-
27013 | id="c1" |a
27014 b
27015 |3
27016 |-
27017 | id="c2" |a
27018 |4
27019 |-
27020 | id="c3" |a
27021 |p||q||r
27022 |-
27023 | id="c4" |edit-me
27024 a
27025 |p||q||r
27026 |}
27027 !! end
27028
27029 !! test
27030 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
27031 !! options
27032 parsoid=html2wt
27033 !! html/parsoid
27034 <table id='mwAb'>
27035 <td id='mwAc'>foo</td>
27036 <td id='serialize-this'>bar</td>
27037 </table>
27038 !! wikitext
27039 {|
27040 |foo
27041 | id="serialize-this" |bar
27042 |}
27043 !! end
27044
27045 !! test
27046 Parsoid-like element ids should not be serialized to wikitext unless shadowed
27047 !! options
27048 parsoid=html2wt
27049 !! html/parsoid
27050 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
27051 !! wikitext
27052 <div id="hello">ok</div>
27053 !! end
27054
27055 !! test
27056 WTS change modes
27057 !! options
27058 parsoid={
27059 "modes": ["wt2wt"],
27060 "changes": [
27061 [ "#xyz", "before", "<b>before</b> stuff " ],
27062 [ "#xyz", "after", " stuff <i>after</i>" ],
27063 [ "#xyz", "html", "x <b>y</b> z" ]
27064 ]
27065 }
27066 !! wikitext
27067 <span id="xyz">hello</span>
27068 !! wikitext/edited
27069 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
27070 !! end
27071
27072 !! test
27073 Never serialize a-tag as html, regardless of what data-parsoid has to say
27074 !! options
27075 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27076 !! html/parsoid
27077 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
27078 !! wikitext
27079 [[Foo]]
27080 !! end
27081
27082 ## SSS FIXME: This is broken output nevertheless.
27083 ## What might be a reasonable non-broken output for this?
27084 ## This is an edge case unlikely to be seen in production
27085 ## that I am not wasting more time on this right now.
27086 !! test
27087 Never serialize a-tag as html, no matter what attributes it has
27088 !! options
27089 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27090 !! html/parsoid
27091 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
27092 !! wikitext
27093 [http://boo.org http://boohoo.org]
27094 !! end
27095
27096 # Misnested is an indication that selser can reuse the source but these have
27097 # shown to sneak through on occasion. See T101768.
27098 # The original wikitext here is: [http://test.com [[one]] two three]
27099 !! test
27100 Strip span tags added to mark misnested links
27101 !! options
27102 parsoid=html2wt
27103 !! html/parsoid
27104 <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>
27105 !! wikitext
27106 [http://test.com][[one]] two three
27107 !! end
27108
27109 !! test
27110 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
27111 !! options
27112 parsoid=html2wt
27113 !! html/parsoid
27114 <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|}"]}'>
27115 <tbody><tr><td>d
27116 </td></tr>
27117 </tbody></table>
27118 !! wikitext
27119 {{echo|a}}
27120 {|{{echo|c
27121 {{!}}d
27122 }}
27123 |}
27124 !! end
27125
27126 ## This test verifies the presence and computation of this attribute indirectly
27127 ## by making an edit and ensuring that the serialization is correct (which it would be
27128 ## only if firstWikitextNode is properly set).
27129 !! test
27130 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
27131 !! options
27132 parsoid= {
27133 "modes": ["wt2wt"],
27134 "changes": [
27135 [ "div#x", "remove" ],
27136 [ "div", "before", "<div>new</div>" ]
27137 ]
27138 }
27139 !! wikitext
27140 <div id="x">foo</div>
27141 {|
27142 {{echo|<div>boo</div>
27143 {{!}}b}}
27144 |c
27145 |}
27146 !! wikitext/edited
27147
27148 <div>new</div>
27149 {|
27150 {{echo|<div>boo</div>
27151 {{!}}b}}
27152 |c
27153 |}
27154 !! end
27155
27156 # --------------------------------------------
27157 # Tests spec'ing wikitext serialization norms |
27158 # --------------------------------------------
27159
27160 !! test
27161 1. Categories should always be serialized on their own line
27162 !! options
27163 parsoid=html2wt
27164 !! html/parsoid
27165 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
27166 !! wikitext
27167 foo
27168 [[Category:Foo]]
27169 bar
27170 !! end
27171
27172 !! test
27173 2. Categories that are part of templates should not introduce a line break
27174 !! wikitext
27175 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
27176 !! html/parsoid
27177 <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>
27178 !! end
27179
27180 # Careful while editing these next 2 tests. There are \u200f characters
27181 # before and after the <link> tags in the HTML and following some
27182 # of the categories in wikitext
27183 # Do not remove these characters in edits.
27184 #
27185 # As part of the serialization, these bidi characters will get stripped.
27186 !! test
27187 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
27188 !! options
27189 parsoid={
27190 "modes": ["html2wt"],
27191 "scrubWikitext": true
27192 }
27193 !! html/parsoid
27194 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
27195 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
27196 !! wikitext
27197 [[קטגוריה:טקסים]]
27198 [[קטגוריה: שיטות משפט]]
27199 !! end
27200
27201 !! test
27202 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
27203 !! options
27204 parsoid={
27205 "modes": ["html2wt"],
27206 "scrubWikitext": true
27207 }
27208 !! html/parsoid
27209 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
27210 !! wikitext
27211 [[קטגוריה:טקסים]]
27212 ‏y
27213 !! end
27214
27215 !! test
27216 Lists: Add space after bullets
27217 !! options
27218 parsoid=html2wt
27219 !! html/parsoid
27220 <ul>
27221 <li>foo</li>
27222 <li> bar</li>
27223 <li><span> baz</span></li>
27224 </ul>
27225 !! wikitext
27226 * foo
27227 * bar
27228 * <span> baz</span>
27229 !! end
27230
27231 !! test
27232 1. Headings: Add space before/after == (T53744)
27233 !! options
27234 parsoid=html2wt
27235 !! html/parsoid
27236 <h2>foo</h2>
27237 <h2> bar</h2>
27238 <h2>baz </h2>
27239 <h2><span> baz</span></h2>
27240 !! wikitext
27241 == foo ==
27242
27243 == bar ==
27244
27245 == baz ==
27246
27247 == <span> baz</span> ==
27248 !! end
27249
27250 !! test
27251 2. Headings: Add space before/after == even after hoisted content
27252 !! options
27253 parsoid={
27254 "modes": ["html2wt"],
27255 "scrubWikitext": true
27256 }
27257 !! html/parsoid
27258 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
27259 !! wikitext
27260 [[Category:A2]]
27261
27262 == ok ==
27263 !! end
27264
27265 !! test
27266 1. Headings: suppress newly created empty headings
27267 !! options
27268 parsoid={
27269 "modes": ["html2wt"],
27270 "scrubWikitext": true
27271 }
27272 !! html/parsoid
27273 <h2></h2>
27274 !! wikitext
27275 !! end
27276
27277 !! test
27278 2. Headings: don't suppress empty headings if scrubWikitext is false
27279 !! options
27280 parsoid=html2wt
27281 !! html/parsoid
27282 <h2></h2>
27283 !! wikitext
27284 ==<nowiki/>==
27285 !! end
27286
27287 !! test
27288 3. Headings: suppress empty headings on edits
27289 !! options
27290 parsoid={
27291 "modes": ["selser"],
27292 "scrubWikitext": true,
27293 "changes": [
27294 [ "#x", "remove"]
27295 ]
27296 }
27297 !! wikitext
27298 ==<span id="x">foo</span>==
27299 !! wikitext/edited
27300 !! end
27301
27302 !! test
27303 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
27304 !! options
27305 parsoid={
27306 "modes": ["html2wt"],
27307 "scrubWikitext": true
27308 }
27309 !! html/parsoid
27310 <h2>foo<br/>bar</h2>
27311 <h2>foo <span><br/>bar</span> baz</h2>
27312 !! wikitext
27313 == foo bar ==
27314
27315 == foo <span> bar</span> baz ==
27316 !! end
27317
27318 !! test
27319 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
27320 !! options
27321 parsoid={
27322 "modes": ["html2wt"],
27323 "scrubWikitext": false
27324 }
27325 !! html/parsoid
27326 <h2>foo<br/>bar</h2>
27327 !! wikitext
27328 == foo<br> bar ==
27329 !! end
27330
27331 !! test
27332 1. WT Quote Tags: suppress newly created empty style tags
27333 !! options
27334 parsoid={
27335 "modes": ["html2wt"],
27336 "scrubWikitext": true
27337 }
27338 !! html/parsoid
27339 <i></i><b></b>
27340 !! wikitext
27341 !! end
27342
27343 !! test
27344 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
27345 !! options
27346 parsoid=html2wt
27347 !! html/parsoid
27348 <i></i><b></b>
27349 !! wikitext
27350 ''<nowiki/>'''''<nowiki/>'''
27351 !! end
27352
27353 !! test
27354 3. WT Quote Tags: suppress empty style tags on edits
27355 !! options
27356 parsoid={
27357 "modes": ["selser"],
27358 "scrubWikitext": true,
27359 "changes": [
27360 [ "#x", "remove"]
27361 ]
27362 }
27363 !! wikitext
27364 '''<span id="x">foo</span>'''
27365 !! wikitext/edited
27366 !! end
27367
27368 !! test
27369 1. Anchors: suppress newly created empty anchors
27370 !! options
27371 parsoid={
27372 "modes": ["html2wt"],
27373 "scrubWikitext": true
27374 }
27375 !! html/parsoid
27376 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27377 !! wikitext
27378 !! end
27379
27380 !! test
27381 2. Anchors: don't suppress empty anchors if scrubWikitext is false
27382 !! options
27383 parsoid={
27384 "modes": ["html2wt"],
27385 "scrubWikitext": false
27386 }
27387 !! html/parsoid
27388 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27389 !! wikitext
27390 [[Test|<nowiki/>]]
27391 !! end
27392
27393 !! test
27394 3. Anchors: suppress empty anchors on edits
27395 !! options
27396 parsoid={
27397 "modes": ["selser"],
27398 "scrubWikitext": true,
27399 "changes": [
27400 [ "#x", "remove"]
27401 ]
27402 }
27403 !! wikitext
27404 [[Test|<span id="x">foo</span>]]
27405 !! wikitext/edited
27406 !! end
27407
27408 !! test
27409 3a. Anchors: do not suppress numbered extlinks
27410 !! options
27411 parsoid={
27412 "modes": ["wt2wt"],
27413 "scrubWikitext": true
27414 }
27415 !! wikitext
27416 [http://foo.com]
27417 !! html/parsoid
27418 <a rel="mw:ExtLink" href="http://foo.com"></a>
27419 !! end
27420
27421 !! test
27422 3b. Anchors: do not suppress numbered extlinks
27423 !! options
27424 parsoid={
27425 "modes": ["wt2wt"],
27426 "scrubWikitext": true,
27427 "changes": [
27428 [ "#x", "remove"]
27429 ]
27430 }
27431 !! wikitext
27432 [http://foo.com <span id="x">foo</span>]
27433 !! wikitext/edited
27434 [http://foo.com]
27435 !! end
27436
27437 !!test
27438 Normalizations should be restricted to edited content
27439 !!options
27440 parsoid={
27441 "modes": ["selser"],
27442 "scrubWikitext": true,
27443 "changes": [
27444 [ "h1", "before", "<i></i>"]
27445 ]
27446 }
27447 !!wikitext
27448 a
27449 = =
27450 b
27451 !!wikitext/edited
27452 a
27453 = =
27454 b
27455 !!end
27456
27457 !! test
27458 1. Multiple normalizations (html2wt)
27459 !! options
27460 parsoid={
27461 "modes": ["html2wt"],
27462 "scrubWikitext": true
27463 }
27464 !! html
27465 <h2><i></i></h2>
27466 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27467 </a><b><i></i></b>x</p>
27468 !! wikitext
27469
27470 [[foo]]
27471 x
27472
27473 !! end
27474
27475 !! test
27476 2. Multiple normalizations (selser)
27477 !! options
27478 parsoid={
27479 "modes": ["selser"],
27480 "scrubWikitext": true,
27481 "changes": [
27482 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27483 ]
27484 }
27485 !! wikitext
27486 <span id="x">foo</span>
27487 !! wikitext/edited
27488 <span id="x">foo</span>
27489
27490 x
27491 !! end
27492
27493 !! test
27494 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27495 !! options
27496 parsoid={
27497 "modes": ["html2wt"],
27498 "scrubWikitext": true
27499 }
27500 !! html/parsoid
27501 <p> hi</p>
27502 <p> hello</p>
27503 !! wikitext
27504 hi
27505
27506 hello
27507 !! end
27508
27509 !! test
27510 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27511 !! options
27512 parsoid=html2wt
27513 !! html/parsoid
27514 <p> hi</p>
27515 <p> hello</p>
27516 !! wikitext
27517 <nowiki> </nowiki>hi
27518
27519 <nowiki> </nowiki> hello
27520 !! end
27521
27522 !! test
27523 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27524 !! options
27525 parsoid={
27526 "modes": ["html2wt"],
27527 "scrubWikitext": true
27528 }
27529 !! html/parsoid
27530 <p>Foo
27531 bar
27532 baz</p>
27533
27534 <table><tr><td>Foo
27535 bar
27536 baz bang</td></tr></table>
27537
27538 <p><!--boo--> foo
27539 bar</p>
27540
27541 <p> foo
27542 bar<span>boo</span></p>
27543 !! wikitext
27544 Foo
27545 bar
27546 baz
27547
27548 {|
27549 |Foo
27550 bar
27551 baz bang
27552 |}
27553
27554 <!--boo-->foo
27555 bar
27556
27557 foo
27558 bar<span>boo</span>
27559 !! end
27560
27561 !! test
27562 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27563 !! options
27564 parsoid={
27565 "modes": ["selser"],
27566 "scrubWikitext": true,
27567 "changes": [
27568 [ "p", "html", " a\n b" ]
27569 ]
27570 }
27571 !! wikitext
27572 xyz
27573 !! wikitext/edited
27574 a
27575 b
27576 !! end
27577
27578 !! test
27579 1. New links that end in spaces
27580 !! options
27581 parsoid={
27582 "modes": ["html2wt"],
27583 "scrubWikitext": false
27584 }
27585 !! html/parsoid
27586 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27587 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27588 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27589 !! wikitext
27590 [[Berlin ]]<nowiki/>is the capital of Germany.
27591
27592 [[Foo ]]'''bar'''
27593
27594 [[Boston ]] is a city.
27595 !! end
27596
27597 !! test
27598 2. New links that end in spaces
27599 !! options
27600 parsoid={
27601 "modes": ["html2wt"],
27602 "scrubWikitext": true
27603 }
27604 !! html/parsoid
27605 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27606 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27607 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27608 !! wikitext
27609 [[Berlin]] is the capital of Germany.
27610
27611 [[Foo]] '''bar'''
27612
27613 [[Boston]] is a city.
27614 !! end
27615
27616 !! test
27617 1. Table cells with escapable prefixes
27618 !! options
27619 parsoid={
27620 "modes": ["html2wt"],
27621 "scrubWikitext": false
27622 }
27623 !! html
27624 <table>
27625 <tr><td>a</td></tr>
27626 <tr><td>-</td></tr>
27627 <tr><td>+</td></tr>
27628 </table>
27629 !! wikitext
27630 {|
27631 |a
27632 |-
27633 |<nowiki>-</nowiki>
27634 |-
27635 |<nowiki>+</nowiki>
27636 |}
27637 !! end
27638
27639 !! test
27640 2. Table cells with escapable prefixes
27641 !! options
27642 parsoid={
27643 "modes": ["html2wt"],
27644 "scrubWikitext": true
27645 }
27646 !! html
27647 <table>
27648 <tr><td>a</td></tr>
27649 <tr><td>-</td></tr>
27650 <tr><td>+</td></tr>
27651 </table>
27652 !! wikitext
27653 {|
27654 |a
27655 |-
27656 | -
27657 |-
27658 | +
27659 |}
27660 !! end
27661
27662 !! test
27663 3a. Table cells with escapable prefixes after edits
27664 !! options
27665 parsoid={
27666 "modes": ["selser"],
27667 "scrubWikitext": true,
27668 "changes": [
27669 [ "table tbody tr:first-child td:first-child", "remove"]
27670 ]
27671 }
27672 !! wikitext
27673 {|
27674 |a||-
27675 |}
27676 !! wikitext/edited
27677 {|
27678 | -
27679 |}
27680 !! end
27681
27682 !! test
27683 3b. Table cells with escapable prefixes after edits
27684 !! options
27685 parsoid={
27686 "modes": ["selser"],
27687 "scrubWikitext": true,
27688 "changes": [
27689 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27690 [ "#x", "remove" ]
27691 ]
27692 }
27693 !! wikitext
27694 {|
27695 |pqr
27696 |<span id="x">foo</span>+
27697 |}
27698 !! wikitext/edited
27699 {|
27700 | -
27701 | +
27702 |}
27703 !! end
27704
27705 # FIXME: This test will fail because
27706 # normalization doesn't realize that the id attribute
27707 # will eliminate the escapable scenario
27708 !! test
27709 4a. Table cells without escapable prefixes after edits
27710 !! options
27711 parsoid={
27712 "modes": ["selser"],
27713 "scrubWikitext": true,
27714 "changes": [
27715 [ "#x", "html", "-" ]
27716 ]
27717 }
27718 !! wikitext
27719 {|
27720 | id="x" |abcd
27721 |}
27722 !! wikitext/edited
27723 {|
27724 | id="x" |-
27725 |}
27726 !! end
27727
27728 ## This tests normalizer's ability to discriminate between
27729 ## cells having identical content.
27730 !! test
27731 4b. Table cells without escapable prefixes after edits
27732 !! options
27733 parsoid={
27734 "modes": ["selser"],
27735 "scrubWikitext": true,
27736 "changes": [
27737 [ "td", "html", "-" ]
27738 ]
27739 }
27740 !! wikitext
27741 {|
27742 |a||b
27743 |}
27744 !! wikitext/edited
27745 {|
27746 | -||-
27747 |}
27748 !! end
27749
27750 ## This tests normalizer's ability to not be tripped by
27751 ## comments (and whitespace)
27752 !! test
27753 4c. Table cells without escapable prefixes after edits
27754 !! options
27755 parsoid={
27756 "modes": ["selser"],
27757 "scrubWikitext": true,
27758 "changes": [
27759 [ "table tbody tr td:first-child", "remove" ]
27760 ]
27761 }
27762 !! wikitext
27763 {|
27764 |-
27765 <!--foo--> |a||-
27766 |}
27767 !! wikitext/edited
27768 {|
27769 |-
27770 <!--foo--> | -
27771 |}
27772 !! end
27773
27774 ## This tests normalizer's ability to handle HTML cells
27775 !! test
27776 4d. Table cells without escapable prefixes after edits
27777 !! options
27778 parsoid={
27779 "modes": ["selser"],
27780 "scrubWikitext": true,
27781 "changes": [
27782 [ "td", "html", "-" ]
27783 ]
27784 }
27785 !! wikitext
27786 <table>
27787 <tr><td>a</td></tr>
27788 </table>
27789 !! wikitext/edited
27790 <table>
27791 <tr><td>-</td></tr>
27792 </table>
27793 !! end
27794
27795 ## T111151 Remove font elements without attributes
27796 !! test
27797 5a. font tags without attributes should be dropped in scrubWikitext mode
27798 !! options
27799 parsoid={
27800 "modes": ["html2wt"],
27801 "scrubWikitext": true
27802 }
27803 !! html
27804 <font>foo</font>
27805 <font><font>bar</font></font>
27806 <font class="x">boo</font>
27807 !! wikitext
27808 foo
27809 bar
27810 <font class="x">boo</font>
27811 !! end
27812
27813 !! test
27814 5b. font tags should not be dropped without scrubWikitext being enabled
27815 !! options
27816 parsoid={
27817 "modes": ["html2wt"],
27818 "scrubWikitext": false
27819 }
27820 !! html
27821 <font>foo</font>
27822 !! wikitext
27823 <font>foo</font>
27824 !! end
27825
27826 !! test
27827 Escape nowiki DOM elements
27828 !! options
27829 parsoid=html2wt
27830 !! html/parsoid
27831 <nowiki><i>foo</i></nowiki>
27832 !! wikitext
27833 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27834 !! end
27835
27836 # This is meant to be an interim fix while we go about figuring out
27837 # how to not introduce these trailing <nowiki/>s in the first place.
27838 !! test
27839 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27840 !! options
27841 parsoid=html2wt
27842 !! html/parsoid
27843 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27844 y</p>
27845 <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>
27846 <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>
27847 !! wikitext
27848 x
27849 y
27850
27851 {{echo|
27852 1 = <nowiki/>}}
27853
27854 {{echo|
27855 1 = <nowiki/>
27856 }}
27857 !! end
27858
27859 # ---------------------------------------------------
27860 # End of tests spec'ing wikitext serialization norms |
27861 # ---------------------------------------------------
27862
27863 # T104032
27864 !! test
27865 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27866 !! options
27867 parsoid=html2wt
27868 !! html/parsoid
27869 a<p>b</p>
27870 <b>c</b><p>d</p>
27871 <table><tr>
27872 <td>a<p>b</p></td>
27873 <td><b>c</b><p>d</p></td>
27874 </tr></table>
27875 !! wikitext
27876 a
27877
27878 b
27879
27880 '''c'''
27881
27882 d
27883 {|
27884 |a
27885 b
27886 |'''c'''
27887 d
27888 |}
27889 !! end
27890
27891 # -----------------------------------------------------------------
27892 # End of section for Parsoid-only html2wt tests for serialization
27893 # of new content
27894 # -----------------------------------------------------------------
27895
27896 # -----------------------------------------------------------------
27897 # The following section of tests are primarily to spec behavior of
27898 # the selective serializer. All these tests have manual selser
27899 # changes. The automated selser changes for all tests handle the
27900 # wide variation of changes, but these tests here capture specs
27901 # deterministically.
27902 # ----------------------------------------------------------------
27903
27904 ## T90517
27905 !! test
27906 Selser: New comments should not be lost
27907 !! options
27908 parsoid={
27909 "modes": ["selser"],
27910 "changes": [
27911 [ "#a", "after", "<!--c1-->" ],
27912 [ "#b", "before", "<!--c2-->" ]
27913 ]
27914 }
27915 !! wikitext
27916 <span id="a">a</span>
27917
27918 <span id="b">b</span>
27919 !! wikitext/edited
27920 <span id="a">a</span><!--c1-->
27921
27922 <!--c2--><span id="b">b</span>
27923 !! end
27924
27925 ## T89383
27926 !! test
27927 Selser: Check for validity of DSR before using it
27928 !! options
27929 parsoid={
27930 "modes": ["selser"],
27931 "changes": [
27932 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27933 ]
27934 }
27935 !! wikitext
27936 <span id="a">a</span>
27937 !! wikitext/edited
27938 {{DISPLAYTITLE:foo}}
27939 <span id="a">a</span>
27940 !! end
27941
27942 !! test
27943 1. DOMDiff: Changes to <ref> content should be looked up using id
27944 !! options
27945 parsoid={
27946 "modes": ["selser"],
27947 "changes": [
27948 ["#X", "after", "bar"],
27949 ["#Y", "after", "baz"]
27950 ]
27951 }
27952 !! wikitext
27953 X <ref><span id="X">foo</span></ref>
27954 Y <ref name="a" />
27955 <references>
27956 <ref name="a"><span id="Y">foo</span></ref>
27957 </references>
27958 !! wikitext/edited
27959 X <ref><span id="X">foo</span>bar</ref>
27960 Y <ref name="a" />
27961 <references>
27962 <ref name="a"><span id="Y">foo</span>baz</ref>
27963 </references>
27964 !! end
27965
27966 !! test
27967 2. DOMDiff: Changes to <ref> content should be looked up using id
27968 !! options
27969 parsoid={
27970 "modes": ["selser"],
27971 "changes": [
27972 ["#Z", "after", "bar"]
27973 ]
27974 }
27975 !! wikitext
27976 A <ref>foo bar for a</ref>
27977 B <ref group="X" name="b" />
27978
27979 <references />
27980
27981 <references group="X">
27982 <ref name="b"><span id="Z">foo</span></ref>
27983 </references>
27984 !! wikitext/edited
27985 A <ref>foo bar for a</ref>
27986 B <ref group="X" name="b" />
27987
27988 <references />
27989
27990 <references group="X">
27991 <ref name="b"><span id="Z">foo</span>bar</ref>
27992 </references>
27993 !! end
27994
27995 !! test
27996 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27997 !! options
27998 parsoid={
27999 "modes": ["selser"],
28000 "changes": [
28001 [ "div:first-child", "text", "bar" ]
28002 ]
28003 }
28004 !! wikitext
28005 <div style="{{1x|color:red;}}%">foo</div>
28006 !! wikitext/edited
28007 <div style="{{1x|color:red;}}%">bar</div>
28008 !! end
28009
28010 !! test
28011 Empty LI (T49673)
28012 !! wikitext
28013 * a
28014 *
28015 *
28016 * b
28017 !! html/php+tidy
28018 <ul>
28019 <li>a</li>
28020 <li class="mw-empty-elt"></li>
28021 <li class="mw-empty-elt"></li>
28022 <li>b</li>
28023 </ul>
28024 !! end
28025
28026 !! test
28027 Thumbnail output
28028 !! wikitext
28029 [[File:Thumb.png|thumb]]
28030 !! html/php+tidy
28031 <div class="thumb tright">
28032 <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>
28033 <div class="thumbcaption">
28034 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
28035 </div>
28036 </div>
28037 </div>
28038 !! end
28039
28040 !! test
28041 unclosed internal link XSS (T137264)
28042 !! wikitext
28043 [[#%3Cscript%3Ealert(1)%3C/script%3E|
28044 !! html/php
28045 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
28046 </p>
28047 !! html/parsoid
28048 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
28049 !! end