Merge "Protect -{...}- variant constructs in definition lists."
[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 subpage
8152 !! wikitext
8153 123
8154 !! html/php
8155 <p>123
8156 </p>
8157 !! html/parsoid
8158 <p>123</p>
8159 !! end
8160
8161 !! article
8162 User:Test/123
8163 !! text
8164 test 123
8165 !! endarticle
8166
8167 !! test
8168 Link to a subpage from a namespace other than main
8169 !! options
8170 title=[[User:Test]]
8171 subpage
8172 !! wikitext
8173 [[/123]]
8174 !! html/php
8175 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8176 </p>
8177 !! html/parsoid
8178 <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>
8179 !! end
8180
8181 !! test
8182 Ensure that transclusion titles are not url-decoded
8183 !! options
8184 subpage title=[[Test]]
8185 parsoid=wt2html
8186 !! wikitext
8187 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8188 !! html/php
8189 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8190 </p>
8191 !! html/parsoid
8192 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8193 !! end
8194
8195 !! test
8196 Purely hash wikilink
8197 !! options
8198 title=[[User:Test/123]]
8199 subpage
8200 !! wikitext
8201 [[#a|b]]
8202 !! html/php
8203 <p><a href="#a">b</a>
8204 </p>
8205 !! html/parsoid
8206 <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>
8207 !! end
8208
8209 !! test
8210 1. Interaction of linktrail and template encapsulation
8211 !! wikitext
8212 {{echo|[[Foo]]}}l
8213 !! html/parsoid
8214 <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>
8215 !! end
8216
8217 !! test
8218 2. Interaction of linktrail and template encapsulation
8219 !! options
8220 parsoid
8221 !! wikitext
8222 {{echo|Some [[Fool]]}}s
8223 !! html
8224 <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>
8225 !! end
8226
8227 !! test
8228 3. Interaction of linktrail and template encapsulation
8229 !! options
8230 parsoid
8231 !! wikitext
8232 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8233 !! html
8234 <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>
8235 !! end
8236
8237 !! article
8238 Söfnuður
8239 !! text
8240 Test.
8241 !! endarticle
8242
8243 !! test
8244 Internal link with is link prefix
8245 !! options
8246 language=is
8247 !! wikitext
8248 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8249 !! html
8250 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8251 </p>
8252 !! end
8253
8254 !! article
8255 Mótmælendatrú
8256 !! text
8257 Test.
8258 !! endarticle
8259
8260 !! test
8261 Internal link with is link trail and link prefix
8262 !! options
8263 language=is
8264 !! wikitext
8265 [[mótmælendatrú|xxx]]ar
8266 [[mótmælendatrú]]ar
8267 mótmælenda[[söfnuður]]
8268 mótmælenda[[söfnuður|söfnuðir]]
8269 mótmælenda[[söfnuður|söfnuðir]]xxx
8270 !! html
8271 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8272 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8273 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8274 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8275 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8276 </p>
8277 !! end
8278
8279 !! test
8280 Parsoid link trail escaping
8281 !! options
8282 parsoid=html2wt,html2html
8283 !! html/parsoid
8284 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8285 !! wikitext
8286 [[apple]]<nowiki/>s
8287 !! end
8288
8289 !! test
8290 Parsoid link prefix escaping
8291 !! options
8292 language=is
8293 parsoid=html2wt,html2html
8294 !! html/parsoid
8295 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8296 !! wikitext
8297 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8298 !! end
8299
8300 !! test
8301 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8302 !! wikitext
8303 [[Foo| bar]]
8304
8305 [[Foo| ''bar'']]
8306
8307 [http://wp.org foo]
8308
8309 [http://wp.org ''foo'']
8310 !! html
8311 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8312 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8313 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8314 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8315 </p>
8316 !! end
8317
8318 !! test
8319 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8320 !! wikitext
8321 [[Foo|{{echo|a}} b {{echo|c}}]]
8322 !! html/parsoid
8323 <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>
8324 !! end
8325
8326 !! test
8327 Link with angle bracket after anchor
8328 !! wikitext
8329 [[Foo#<bar>]]
8330 !! html/php
8331 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8332 </p>
8333 !! html/parsoid
8334 <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>
8335 !! end
8336
8337 ###
8338 ### Interwiki links (see maintenance/interwiki.sql)
8339 ###
8340
8341 !! test
8342 Inline interwiki link
8343 !! options
8344 parsoid=wt2html,wt2wt,html2html
8345 !! wikitext
8346 [[MeatBall:SoftSecurity]]
8347 !! html/php
8348 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8349 </p>
8350 !! html/parsoid
8351 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8352 !! end
8353
8354 !! test
8355 Inline interwiki link with empty title (bug 2372)
8356 !! options
8357 parsoid=wt2html,wt2wt,html2html
8358 !! wikitext
8359 [[MeatBall:]]
8360 !! html/php
8361 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8362 </p>
8363 !! html/parsoid
8364 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8365 !! end
8366
8367 !! test
8368 Interwiki link encoding conversion (bug 1636)
8369 !! wikitext
8370 *[[Wikipedia:ro:Olteni&#0355;a]]
8371 *[[Wikipedia:ro:Olteni&#355;a]]
8372 !! html
8373 <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>
8374 <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>
8375
8376 !! html+tidy
8377 <ul>
8378 <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>
8379 <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>
8380 </ul>
8381 !! end
8382
8383 !! test
8384 Interwiki link with fragment (bug 2130)
8385 !! wikitext
8386 [[MeatBall:SoftSecurity#foo]]
8387 !! html
8388 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8389 </p>
8390 !! end
8391
8392 !! test
8393 Link scenarios with escaped fragments
8394 !! wikitext
8395 [[#Is this great?]]
8396 [[Foo#Is this great?]]
8397 [[meatball:Foo#Is this great?]]
8398 !! html/php
8399 <p><a href="#Is_this_great.3F">#Is this great?</a>
8400 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8401 <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>
8402 </p>
8403 !! html/parsoid
8404 <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>
8405 <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>
8406 <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>
8407 !! end
8408
8409 # Ideally the wikipedia: prefix here should be proto-relative too
8410 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8411 # define the 'en' prefix, and originally the test used 'wikipedia',
8412 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8413 # article.
8414 !! test
8415 Different interwiki prefixes mapping to the same URL
8416 !! wikitext
8417 [[:en:Foo]]
8418
8419 [[:en:Foo|Foo]]
8420
8421 [[wikipedia:Foo]]
8422
8423 [[:wikipedia:Foo|Foo]]
8424
8425 [[wikipedia:en:Foo]]
8426
8427 [[:wikipedia:en:Foo]]
8428
8429 [[ wikiPEdia :Foo]]
8430 !! html/parsoid
8431 <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>
8432
8433 <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>
8434
8435 <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>
8436
8437 <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>
8438
8439 <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>
8440
8441 <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>
8442
8443 <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>
8444 !! end
8445
8446 !! test
8447 Interwiki links that cannot be represented in wiki syntax
8448 !! wikitext
8449 [[meatball:ok]]
8450 [[meatball:ok#foo|ok with fragment]]
8451 [[meatball:ok_as_well?|ok ending with ? mark]]
8452 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8453 [http://de.wikipedia.org/wiki/#foo is just fragment]
8454
8455 !! html/php
8456 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8457 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8458 <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>
8459 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8460 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8461 </p>
8462 !! html/parsoid
8463 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8464 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8465 <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>
8466 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8467 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8468 !! end
8469
8470 !! test
8471 Interwiki links: trail
8472 !! wikitext
8473 [[wikipedia:Foo|Ba]]r
8474 !! html/php
8475 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8476 </p>
8477 !! html/parsoid
8478 <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>
8479 !! end
8480
8481 !! test
8482 Local interwiki link
8483 !! options
8484 parsoid=wt2html,wt2wt,html2html
8485 !! wikitext
8486 [[local:Template:Foo]]
8487 !! html/php
8488 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8489 </p>
8490 !! html/parsoid
8491 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8492 !! end
8493
8494 # Parsoid does not mark self-links, by design.
8495 !! test
8496 Local interwiki link: self-link to current page
8497 !! options
8498 title=[[Main Page]]
8499 parsoid=wt2html,wt2wt,html2html
8500 !! wikitext
8501 [[local:Main Page]]
8502 !! html/php
8503 <p><strong class="selflink">local:Main Page</strong>
8504 </p>
8505 !! html/parsoid
8506 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8507 !! end
8508
8509 !! test
8510 Local interwiki link: prefix only (bug 64167)
8511 !! options
8512 parsoid=wt2html,wt2wt,html2html
8513 !! wikitext
8514 [[local:]]
8515 !! html/php
8516 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8517 </p>
8518 !! html/parsoid
8519 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8520 !! end
8521
8522 !! test
8523 Local interwiki link: with additional interwiki prefix (bug 61357)
8524 !! options
8525 parsoid=wt2html,wt2wt,html2html
8526 !! wikitext
8527 [[local:meatball:Hello]]
8528 !! html/php
8529 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8530 </p>
8531 !! html/parsoid
8532 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8533 !! end
8534
8535 !! test
8536 Multiple local interwiki link prefixes
8537 !! wikitext
8538 [[local:local:local:local:mi:local:Foo]]
8539 !! options
8540 parsoid=wt2html,wt2wt,html2html
8541 !! html/php
8542 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8543 </p>
8544 !! html/parsoid
8545 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8546 !! end
8547
8548 ###
8549 ### Interlanguage links
8550 ### Language links (so that searching for '### language' matches..)
8551 ###
8552
8553 !! test
8554 Interlanguage link
8555 !! wikitext
8556 Blah blah blah
8557 [[zh:Chinese]]
8558 !! html/php
8559 <p>Blah blah blah
8560 </p>
8561 !! html/parsoid
8562 <p>Blah blah blah</p>
8563 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8564 !! end
8565
8566 ## parsoid html2wt will lose the space variations
8567 !! test
8568 Interlanguage link with spacing
8569 !! options
8570 parsoid=wt2html,wt2wt,html2html
8571 !! wikitext
8572 Blah blah blah
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://zh.wikipedia.org/wiki/Chinese"/>
8580 !! end
8581
8582 !! test
8583 Double interlanguage link
8584 !! wikitext
8585 Blah blah blah
8586 [[es:Spanish]]
8587 [[zh:Chinese]]
8588 !! html/php
8589 <p>Blah blah blah
8590 </p>
8591 !! html/parsoid
8592 <p>Blah blah blah</p>
8593 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8594 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8595 !! end
8596
8597 ## parsoid html2wt will lose the space variations
8598 !! test
8599 Interlanguage link variations
8600 !! options
8601 parsoid=wt2html,wt2wt,html2html
8602 !! wikitext
8603 Blah blah blah
8604 [[ es :Spanish]]
8605 [[ ZH :Chinese]]
8606 [[es:Foo_bar]]
8607 !! html/php
8608 <p>Blah blah blah
8609 </p>
8610 !! html/parsoid
8611 <p>Blah blah blah</p>
8612 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8613 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8614 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8615 !! end
8616
8617 !! test
8618 Escaping of interlanguage links
8619 !! wikitext
8620 Blah blah blah
8621 [[:es:Spanish]]
8622 [[ : zh : Chinese ]]
8623 !! html/php
8624 <p>Blah blah blah
8625 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8626 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8627 </p>
8628 !! html/parsoid
8629 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8630 <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8631 !! end
8632
8633 ## parsoid html2wt will normalize the space to _
8634 !! test
8635 Space and question mark encoding in interlanguage links (T95473)
8636 !! options
8637 parsoid=wt2html,wt2wt,html2html
8638 !! wikitext
8639 Blah blah blah
8640 [[es:Foo bar?]]
8641 !! html/php
8642 <p>Blah blah blah
8643 </p>
8644 !! html/parsoid
8645 <p>Blah blah blah</p>
8646 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8647 !! end
8648
8649 !! test
8650 Interlanguage link, with prefix links
8651 !! options
8652 language=ln
8653 !! wikitext
8654 Blah blah blah
8655 [[zh:Chinese]]
8656 !! html/php
8657 <p>Blah blah blah
8658 </p>
8659 !! html/parsoid
8660 <p>Blah blah blah</p>
8661 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8662 !! end
8663
8664 !! test
8665 Double interlanguage link, with prefix links (bug 8897)
8666 !! options
8667 language=ln
8668 !! wikitext
8669 Blah blah blah
8670 [[es:Spanish]]
8671 [[zh:Chinese]]
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" href="http://es.wikipedia.org/wiki/Spanish"/>
8678 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8679 !! end
8680
8681 !! test
8682 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8683 !! wikitext
8684 Blah blah blah
8685 [[mul:Article]]
8686 !! html/php
8687 <p>Blah blah blah
8688 </p>
8689 !! html/parsoid
8690 <p>Blah blah blah</p>
8691 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
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 if $wgInterwikiMagic=false
8698 !! options
8699 wgInterwikiMagic=false
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 ## PHP parser tests script needs an update
8709 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8710 !! test
8711 Language links render as inline links in the Talk namespace
8712 !! options
8713 title=Talk:Foo
8714 parsoid=wt2html,wt2wt,html2html
8715 !! wikitext
8716 Blah blah blah
8717 [[zh:Chinese]]
8718 !! html/parsoid
8719 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8720 !! end
8721
8722 !! test
8723 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8724 !! options
8725 language=ln
8726 !! wikitext
8727 [[WW&nbsp;II]]
8728 !! html
8729 <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>
8730 </p>
8731 !! end
8732
8733 !! test
8734 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8735 !! options
8736 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8737 !! html/parsoid
8738 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8739 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8740 !! wikitext
8741 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8742
8743 He&amp;nbsp;llo He&amp;nbsp;llo
8744 !! html/php
8745 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8746 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8747 </p>
8748 !! end
8749
8750 # html2wt will fail because of title normalization without data-parsoid
8751 !! test
8752 Parsoid: handle constructor well
8753 !! options
8754 parsoid=wt2html,wt2wt
8755 !! wikitext
8756 [[constructor]]
8757
8758 [[constructor:foo]]
8759 !! html/php
8760 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8761 </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>
8762 </p>
8763 !! html/parsoid
8764 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8765
8766 <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>
8767 !! end
8768
8769 !! article
8770 ko:
8771 !! text
8772 Test.
8773 !! endarticle
8774
8775 # Note that `ko` isn't a known interlanguage prefix
8776 !! test
8777 Parsoid: recognize interlanguage links without a target page
8778 !! options
8779 ill
8780 !! wikitext
8781 [[es:]]
8782
8783 [[ko:]]
8784 !! html/php
8785 es:
8786 !! html/parsoid
8787 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8788
8789 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8790 !! end
8791
8792 # Note that `ko` isn't a known interwiki prefix
8793 !! test
8794 Parsoid: recognize interwiki links without a target page
8795 !! options
8796 parsoid=wt2html,wt2wt,html2html
8797 !! wikitext
8798 [[:es:]]
8799
8800 [[:ko:]]
8801 !! html/php
8802 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8803 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8804 </p>
8805 !! html/parsoid
8806 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8807 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8808 !! end
8809
8810 !! test
8811 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8812 !! wikitext
8813 [[mi:Foo]]
8814 !! html/php
8815 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8816 </p>
8817 !! html/parsoid
8818 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8819 !! end
8820
8821 !! test
8822 Interlanguage link with preceding local interwiki link (bug 68085)
8823 !! options
8824 parsoid=wt2html,wt2wt,html2html
8825 !! wikitext
8826 Blah blah blah
8827 [[local:es:Spanish]]
8828 !! html/php
8829 <p>Blah blah blah
8830 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8831 </p>
8832 !! html/parsoid
8833 <p>Blah blah blah
8834 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8835 !! end
8836
8837 !! test
8838 Looks like an interlanguage link, but is actually a local interwiki
8839 !! options
8840 parsoid=wt2html,wt2wt,html2html
8841 !! wikitext
8842 Blah blah blah
8843 [[mi:Template:Foo]]
8844 !! html/php
8845 <p>Blah blah blah
8846 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8847 </p>
8848 !! html/parsoid
8849 <p>Blah blah blah
8850 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8851 !! end
8852
8853 ###
8854 ### Redirects, Parsoid-only
8855 ###
8856
8857 !! test
8858 1. Simple redirect to page
8859 !! wikitext
8860 #REDIRECT [[Main Page]]
8861 !! html/parsoid
8862 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8863 !! end
8864
8865 !! test
8866 2. Other redirect variants
8867 !! wikitext
8868 #REDIRECT [[Main_Page]]
8869 !! html/parsoid
8870 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8871 !! end
8872
8873 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8874 # This tests the Parsoid bail-out code.
8875 !! test
8876 3. Other redirect variants
8877 !! wikitext
8878 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8879 !! html/parsoid
8880 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8881 !! end
8882
8883 !! test
8884 4. Redirect to a templated destination
8885 !! wikitext
8886 #REDIRECT [[{{echo|Foo}}bar]]
8887 !! html/parsoid
8888 <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"}]]}'/>
8889 !! end
8890
8891 !! test
8892 Empty redirect
8893 !! options
8894 parsoid=wt2html,wt2wt
8895 !! wikitext
8896 #REDIRECT [[]]
8897 !! html/parsoid
8898 <ol>
8899 <li>REDIRECT [[]]</li></ol>
8900 !! end
8901
8902 !! test
8903 Optional colon in #REDIRECT
8904 !! options
8905 # the colon is archaic syntax. we support it for wt2html, but we
8906 # don't care that it roundtrips back to the modern syntax.
8907 parsoid=wt2html,html2html
8908 !! wikitext
8909 #REDIRECT:[[Main Page]]
8910 !! html/parsoid
8911 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8912 !! end
8913
8914 !! test
8915 Whitespace in #REDIRECT with optional colon
8916 !! options
8917 # the colon and gratuitous whitespace is archaic syntax. we support
8918 # it for wt2html, but we don't care that it roundtrips back to the
8919 # modern syntax (without extra whitespace)
8920 parsoid=wt2html,html2html
8921 !! wikitext
8922
8923 #REDIRECT
8924 :
8925 [[Main Page]]
8926 !! html/parsoid
8927 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8928 !! end
8929
8930 !! test
8931 Piped link in #REDIRECT
8932 !! options
8933 # content after piped link is ignored. we support this syntax,
8934 # but don't care that the piped link is lost when we roundtrip this.
8935 parsoid=wt2html
8936 !! wikitext
8937 #REDIRECT [[Main Page|bar]]
8938 !! html/parsoid
8939 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8940 !! end
8941
8942 !! test
8943 Redirect to category (T104502)
8944 !! options
8945 parsoid=wt2html,wt2wt
8946 !! wikitext
8947 #REDIRECT [[Category:Foo]]
8948 !! html/parsoid
8949 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8950 !! end
8951
8952 !! test
8953 Redirect to category with URL encoding (T104502)
8954 !! options
8955 parsoid=wt2html
8956 !! wikitext
8957 #REDIRECT [[Category%3AFoo]]
8958 !! html/parsoid
8959 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8960 !! end
8961
8962 !! test
8963 Redirect to category page
8964 !! wikitext
8965 #REDIRECT [[:Category:Foo]]
8966 !! html/parsoid
8967 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8968 !! end
8969
8970 !! test
8971 Redirect to image page (1)
8972 !! wikitext
8973 #REDIRECT [[File:Wiki.png]]
8974 !! html/parsoid
8975 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8976 !! end
8977
8978 !! test
8979 Redirect to image page (2)
8980 !! wikitext
8981 #REDIRECT [[Image:Wiki.png]]
8982 !! html/parsoid
8983 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8984 !! end
8985
8986 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8987 # Next test confirms this.
8988 !! test
8989 Redirect to language (1) (T104918)
8990 !! options
8991 parsoid=wt2html,wt2wt,html2html
8992 !! wikitext
8993 #REDIRECT [[en:File:Wiki.png]]
8994 !! html/parsoid
8995 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8996 !! end
8997
8998 !! test
8999 Redirect to language (2) (T104918)
9000 !! wikitext
9001 #REDIRECT [[:en:File:Wiki.png]]
9002 !! html/parsoid
9003 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9004 !! end
9005
9006 !! test
9007 Redirect to interwiki (T104918)
9008 !! wikitext
9009 #REDIRECT [[meatball:File:Wiki.png]]
9010 !! html/parsoid
9011 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9012 !! end
9013
9014 !! test
9015 Non-English #REDIRECT
9016 !! options
9017 language=is
9018 !! wikitext
9019 #TILVÍSUN [[Main Page]]
9020 !! html/parsoid
9021 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9022 !! end
9023
9024 !! test
9025 Redirect syntax under text isn't considered a redirect
9026 !! wikitext
9027 some text
9028 #redirect [[Main Page]]
9029 !! html/parsoid
9030 <p>some text</p>
9031 <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>
9032 !! end
9033
9034 # FIXME: Should hoist the redirect to the top of the page and ensure there
9035 # is only one.
9036 !! test
9037 New redirect
9038 !! options
9039 parsoid=html2wt
9040 !! html/parsoid
9041 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9042 !! wikitext
9043 Foo
9044 #REDIRECT [[Foo]]
9045 !! end
9046
9047 ##
9048 ## XHTML tidiness
9049 ###
9050
9051 !! test
9052 <br> to <br />
9053 !! wikitext
9054 1<br>2<br />3
9055 !! html
9056 <p>1<br />2<br />3
9057 </p>
9058 !! end
9059
9060 !! test
9061 Broken br tag sanitization
9062 !! wikitext
9063 </br>
9064 !! html/php
9065 <p>&lt;/br&gt;
9066 </p>
9067 !! end
9068
9069 # TODO: Fix html2html mode (bug 51055)!
9070 !! test
9071 Parsoid: Broken br tag recognition
9072 !! options
9073 parsoid=wt2html
9074 !! wikitext
9075 </br>
9076
9077 <br/ >
9078 !! html+tidy
9079 <p><br /></p>
9080 <p><br /></p>
9081 !! end
9082
9083 !! test
9084 Incorrecly removing closing slashes from correctly formed XHTML
9085 !! wikitext
9086 <br style="clear:both;" />
9087 !! html
9088 <p><br style="clear:both;" />
9089 </p>
9090 !! end
9091
9092 !! test
9093 Failing to transform badly formed HTML into correct XHTML
9094 !! wikitext
9095 <br style="clear: left;">
9096 <br style="clear: right;">
9097 <br style="clear: both;">
9098 !! html
9099 <p><br style="clear: left;" />
9100 <br style="clear: right;" />
9101 <br style="clear: both;" />
9102 </p>
9103 !!end
9104
9105 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9106 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9107 !! test
9108 Handling html with a div self-closing tag
9109 !! wikitext
9110 <div title />
9111 <div title/>
9112 <div title/ >
9113 <div title=bar />
9114 <div title=bar/>
9115 <div title=bar/ >
9116 !! html/php
9117 <p>&lt;div title /&gt;
9118 &lt;div title/&gt;
9119 </p>
9120 <div>
9121 <p>&lt;div title=bar /&gt;
9122 &lt;div title=bar/&gt;
9123 </p>
9124 <div title="bar/"></div>
9125 </div>
9126
9127 !! html/parsoid
9128 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9129 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9130 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9131 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9132 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9133 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9134 !! end
9135
9136 !! test
9137 Handling html with a br self-closing tag
9138 !! wikitext
9139 <br title />
9140 <br title/>
9141 <br title/ >
9142 <br title=bar />
9143 <br title=bar/>
9144 <br title=bar/ >
9145 !! html/php
9146 <p><br title="" />
9147 <br title="" />
9148 <br />
9149 <br title="bar" />
9150 <br title="bar" />
9151 <br title="bar/" />
9152 </p>
9153 !! html/parsoid
9154 <p><br title="" />
9155 <br title="" />
9156 <br title="" />
9157 <br title="bar" />
9158 <br title="bar" />
9159 <br title="bar/" />
9160 </p>
9161 !! end
9162
9163 !! test
9164 Horizontal ruler (should it add that extra space?)
9165 !! wikitext
9166 <hr>
9167 <hr >
9168 foo <hr
9169 > bar
9170 !! html+tidy
9171 <hr />
9172 <hr />
9173 <p>foo</p>
9174 <hr />
9175 <p>bar</p>
9176 !! end
9177
9178 !! test
9179 Horizontal ruler -- 4+ dashes render hr
9180 !! wikitext
9181 ----
9182 !! html
9183 <hr />
9184
9185 !! end
9186
9187 !! test
9188 Horizontal ruler -- eats additional dashes on the same line
9189 !! wikitext
9190 ---------
9191 !! html
9192 <hr />
9193
9194 !! end
9195
9196 !! test
9197 Horizontal ruler -- does not collapse dashes on consecutive lines
9198 !! wikitext
9199 ----
9200 ----
9201 !! html
9202 <hr />
9203 <hr />
9204
9205 !! end
9206
9207 !! test
9208 Horizontal ruler -- <4 dashes render as plain text
9209 !! wikitext
9210 ---
9211 !! html
9212 <p>---
9213 </p>
9214 !! end
9215
9216 !! test
9217 Horizontal ruler -- Supports content following dashes on same line
9218 !! wikitext
9219 ---- Foo
9220 !! html
9221 <hr /> Foo
9222
9223 !! html+tidy
9224 <hr />
9225 <p>Foo</p>
9226 !! end
9227
9228 ###
9229 ### Block-level elements
9230 ###
9231 !! test
9232 Common list
9233 !! wikitext
9234 *Common list
9235 * item 2
9236 *item 3
9237 !! html
9238 <ul><li>Common list</li>
9239 <li> item 2</li>
9240 <li>item 3</li></ul>
9241
9242 !! end
9243
9244 !! test
9245 Numbered list
9246 !! wikitext
9247 #Numbered list
9248 #item 2
9249 # item 3
9250 !! html
9251 <ol><li>Numbered list</li>
9252 <li>item 2</li>
9253 <li> item 3</li></ol>
9254
9255 !! end
9256
9257 !! test
9258 Mixed list
9259 !! wikitext
9260 *Mixed list
9261 *# with numbers
9262 ** and bullets
9263 *# and numbers
9264 *bullets again
9265 **bullet level 2
9266 ***bullet level 3
9267 ***#Number on level 4
9268 **bullet level 2
9269 **#Number on level 3
9270 **#Number on level 3
9271 *#number level 2
9272 *Level 1
9273 *** Level 3
9274 #** Level 3, but ordered
9275 !! html
9276 <ul><li>Mixed list
9277 <ol><li> with numbers</li></ol>
9278 <ul><li> and bullets</li></ul>
9279 <ol><li> and numbers</li></ol></li>
9280 <li>bullets again
9281 <ul><li>bullet level 2
9282 <ul><li>bullet level 3
9283 <ol><li>Number on level 4</li></ol></li></ul></li>
9284 <li>bullet level 2
9285 <ol><li>Number on level 3</li>
9286 <li>Number on level 3</li></ol></li></ul>
9287 <ol><li>number level 2</li></ol></li>
9288 <li>Level 1
9289 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9290 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9291
9292 !! end
9293
9294 !! test
9295 1. Nested mixed wikitext and html list
9296 !! wikitext
9297 * hi
9298 * <ul><li>ho</li></ul>
9299 * hi
9300 ** ho
9301 !! html/php
9302 <ul><li> hi</li>
9303 <li> <ul><li>ho</li></ul></li>
9304 <li> hi
9305 <ul><li> ho</li></ul></li></ul>
9306
9307 !! html/parsoid
9308 <ul><li> hi</li>
9309 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9310 <li> hi
9311 <ul><li> ho</li></ul></li></ul>
9312 !! end
9313
9314 !! test
9315 2. Nested mixed wikitext and html list (incompatible)
9316 !! wikitext
9317 ; hi
9318 : {{echo|<li>ho</li>}}
9319 !! html/php
9320 <dl><dt> hi</dt>
9321 <dd> <li>ho</li></dd></dl>
9322
9323 !! html/parsoid
9324 <dl><dt> hi</dt>
9325 <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>
9326 !! end
9327
9328 !! test
9329 Nested lists 1
9330 !! wikitext
9331 *foo
9332 **bar
9333 !! html
9334 <ul><li>foo
9335 <ul><li>bar</li></ul></li></ul>
9336
9337 !! end
9338
9339 !! test
9340 Nested lists 2
9341 !! wikitext
9342 **foo
9343 *bar
9344 !! html
9345 <ul><li><ul><li>foo</li></ul></li>
9346 <li>bar</li></ul>
9347
9348 !! end
9349
9350 !! test
9351 Nested lists 3 (first element empty)
9352 !! wikitext
9353 *
9354 **bar
9355 !! html
9356 <ul><li>
9357 <ul><li>bar</li></ul></li></ul>
9358
9359 !! end
9360
9361 !! test
9362 Nested lists 4 (first element empty)
9363 !! wikitext
9364 **
9365 *bar
9366 !! html
9367 <ul><li><ul><li></li></ul></li>
9368 <li>bar</li></ul>
9369
9370 !! end
9371
9372 !! test
9373 Nested lists 5 (both elements empty)
9374 !! wikitext
9375 **
9376 *
9377 !! html
9378 <ul><li><ul><li></li></ul></li>
9379 <li></li></ul>
9380
9381 !! end
9382
9383 !! test
9384 Nested lists 6 (both elements empty)
9385 !! wikitext
9386 *
9387 **
9388 !! html
9389 <ul><li>
9390 <ul><li></li></ul></li></ul>
9391
9392 !! end
9393
9394 !! test
9395 Nested lists 7 (skip initial nesting levels)
9396 !! wikitext
9397 *** foo
9398 !! html
9399 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9400
9401 !! end
9402
9403 !! test
9404 Nested lists 8 (multiple nesting transitions)
9405 !! wikitext
9406 * foo
9407 *** bar
9408 ** baz
9409 * boo
9410 !! html
9411 <ul><li> foo
9412 <ul><li><ul><li> bar</li></ul></li>
9413 <li> baz</li></ul></li>
9414 <li> boo</li></ul>
9415
9416 !! end
9417
9418 !! test
9419 Nested lists 9 (extension interaction)
9420 !! options
9421 parsoid
9422 !! wikitext
9423 *<references />
9424 !! html/parsoid
9425 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9426 !! end
9427
9428 !! test
9429 1. Lists with start-of-line-transparent tokens before bullets: Comments
9430 !! wikitext
9431 *foo
9432 *<!--cmt-->bar
9433 <!--cmt-->*baz
9434 !! html
9435 <ul><li>foo</li>
9436 <li>bar</li>
9437 <li>baz</li></ul>
9438
9439 !! end
9440
9441 !! test
9442 2. Lists with start-of-line-transparent tokens before bullets: Template close
9443 !! wikitext
9444 *foo {{echo|bar
9445 }}*baz
9446 !! html
9447 <ul><li>foo bar</li>
9448 <li>baz</li></ul>
9449
9450 !! end
9451
9452 !! test
9453 List items are not parsed correctly following a <pre> block (bug 785)
9454 !! wikitext
9455 * <pre>foo</pre>
9456 * <pre>bar</pre>
9457 * zar
9458 !! html/php
9459 <ul><li> <pre>foo</pre></li>
9460 <li> <pre>bar</pre></li>
9461 <li> zar</li></ul>
9462
9463 !! html/parsoid
9464 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9465 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9466 <li> zar</li></ul>
9467 !! end
9468
9469 !! test
9470 List items from template
9471 !! wikitext
9472
9473 {{inner list}}
9474 * item 2
9475
9476 * item 0
9477 {{inner list}}
9478 * item 2
9479
9480 * item 0
9481 * notSOL{{inner list}}
9482 * item 2
9483 !! html
9484 <ul><li> item 1</li>
9485 <li> item 2</li></ul>
9486 <ul><li> item 0</li>
9487 <li> item 1</li>
9488 <li> item 2</li></ul>
9489 <ul><li> item 0</li>
9490 <li> notSOL</li>
9491 <li> item 1</li>
9492 <li> item 2</li></ul>
9493
9494 !! end
9495
9496 !! test
9497 List interrupted by empty line or heading
9498 !! wikitext
9499 * foo
9500
9501 ** bar
9502 == A heading ==
9503 * Another list item
9504 !! html
9505 <ul><li> foo</li></ul>
9506 <ul><li><ul><li> bar</li></ul></li></ul>
9507 <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>
9508 <ul><li> Another list item</li></ul>
9509
9510 !!end
9511
9512 !!test
9513 Multiple list tags generated by templates
9514 !! wikitext
9515 {{echo|<li>}}a
9516 {{echo|<li>}}b
9517 {{echo|<li>}}c
9518 !! html
9519 <li>a
9520 <li>b
9521 <li>c</li>
9522 </li>
9523 </li>
9524
9525 !! html+tidy
9526 <ul>
9527 <li>a</li>
9528 <li>b</li>
9529 <li>c</li>
9530 </ul>
9531 !!end
9532
9533 !!test
9534 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9535 !! wikitext
9536 *a
9537 <!--This line will NOT split the list-->
9538 *b
9539 <!--This line will NOT split the list either-->
9540 *c
9541 <!--foo--> <!----> <!--This line NOT split the list either-->
9542 *d
9543 !! html
9544 <ul><li>a</li>
9545 <li>b</li>
9546 <li>c</li>
9547 <li>d</li></ul>
9548
9549 !!end
9550
9551 !!test
9552 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9553 !! wikitext
9554 *a
9555 <!--This line will NOT split the list-->
9556 *b
9557 <!--This line will NOT split the list either-->
9558 *c
9559 <!--foo--> <!----> <!--This line NOT split the list
9560 either-->
9561 *d
9562 !! html
9563 <ul><li>a</li>
9564 <li>b</li>
9565 <li>c</li>
9566 <li>d</li></ul>
9567
9568 !!end
9569
9570 !!test
9571 Test the li-hack
9572 (The PHP parser relies on Tidy for the hack)
9573 !!options
9574 parsoid=wt2html,wt2wt
9575 !! wikitext
9576 * foo
9577 * <li>li-hack
9578 * {{echo|<li>templated li-hack}}
9579 * <!--foo--> <li> unsupported li-hack with preceding comments
9580
9581 <ul>
9582 <li><li>not a li-hack
9583 </li>
9584 </ul>
9585 !! html+tidy
9586 <ul>
9587 <li>foo</li>
9588 <li>li-hack</li>
9589 <li>templated li-hack</li>
9590 <li>unsupported li-hack with preceding comments</li>
9591 </ul>
9592 <ul>
9593 <li>not a li-hack</li>
9594 </ul>
9595 !!end
9596
9597 !! test
9598 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9599 !! options
9600 parsoid
9601 !! wikitext
9602 # foo
9603 ## bar
9604 * foo
9605 ** bar
9606 : foo
9607 :: bar
9608 !! html
9609 <ol>
9610 <li> foo<ol>
9611 <li> bar</li>
9612 </ol></li>
9613 </ol><ul>
9614 <li> foo<ul>
9615 <li> bar</li>
9616 </ul></li>
9617 </ul><dl>
9618 <dd> foo<dl>
9619 <dd> bar</dd>
9620 </dl></dd>
9621 </dl>
9622 !! end
9623
9624 !! test
9625 Parsoid: Test of whitespace serialization with Templated bullets
9626 !! options
9627 parsoid
9628 !! wikitext
9629 * {{bullet}}
9630 !! html
9631 <ul>
9632 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9633 </ul>
9634 !! end
9635
9636 # ------------------------------------------------------------------------
9637 # The next set of tests are about Parsoid's ability to handle badly nested
9638 # tags (parse, minimize scope of fixup, and roundtrip back)
9639 # ------------------------------------------------------------------------
9640
9641 !! test
9642 Unbalanced closing block tags break a list
9643 (php parser relies on Tidy to fix up)
9644 !! wikitext
9645 <div>
9646 *a</div><div>
9647 *b</div>
9648 !! html+tidy
9649 <div>
9650 <ul>
9651 <li>a</li>
9652 </ul>
9653 </div>
9654 <div>
9655 <ul>
9656 <li>b</li>
9657 </ul>
9658 </div>
9659 !! end
9660
9661 # Parsoid fails this test, but it might be tricky to support properly.
9662 # See bug 68395.
9663 !! test
9664 Unbalanced closing non-block tags don't break a list
9665 (php parser relies on Tidy to fix up)
9666 !! wikitext
9667 <span>
9668 *a</span><span>
9669 *b</span>
9670 !! html/php+tidy
9671 <ul>
9672 <li><span>a</span></li>
9673 <li><span>b</span></li>
9674 </ul>
9675 !! html/parsoid
9676 <span>
9677 <ul>
9678 <li>a<span></span>
9679 </li>
9680 <li>b
9681 </li>
9682 </ul>
9683 </span>
9684 !! end
9685
9686 !! test
9687 Unclosed formatting tags that straddle lists are closed and reopened
9688 (php parser relies on Tidy to fix up)
9689 !! options
9690 parsoid=wt2html,wt2wt,html2html
9691 !! wikitext
9692 # <s> a
9693 # b </s>
9694 !! html/php+tidy
9695 <ol>
9696 <li><s>a</s></li>
9697 <li><s>b</s></li>
9698 </ol>
9699 !! html/parsoid
9700 <ol><li> <s> a</s></li>
9701 <li><s> b </s></li></ol>
9702 !! end
9703
9704 # See bug 68395.
9705 !!test
9706 1. List embedded in a formatting tag
9707 !! wikitext
9708 <small>
9709 * foo
9710 </small>
9711 !! html/php+tidy
9712 <ul>
9713 <li><small>foo</small></li>
9714 </ul>
9715 !! html/parsoid
9716 <small>
9717 <ul>
9718 <li> foo</li>
9719 </ul>
9720 </small>
9721 !!end
9722
9723 ## Ugly Parsoid output here
9724 ## Not sure what the right output is.
9725 !!test
9726 2. List embedded in a formatting tag
9727 !! wikitext
9728 <small>
9729 *a
9730 *b</small>
9731 !! html/php+tidy
9732 <ul>
9733 <li><small>a</small></li>
9734 <li><small>b</small></li>
9735 </ul>
9736 !! html/parsoid
9737 <small></small>
9738 <ul><small>
9739 <li>a</li>
9740 </small>
9741 <li><small>b</small></li>
9742 </ul>
9743 !!end
9744
9745 # Ugly Parsoid and PHP parser output here
9746 # Not sure if we want to make this a test!
9747 #
9748 ## !!test
9749 ## 3. Unclosed formatting tags in list elements
9750 ## !! wikitext
9751 ## *<small>a
9752 ## *<small>b
9753 ## !! html/php+tidy
9754 ## <ul>
9755 ## <li><small>a</small></li>
9756 ## <li><small><small>b</small></small></li>
9757 ## </ul>
9758 ## !! html/parsoid
9759 ## <ul>
9760 ## <li><small>a</small></li>
9761 ## <small>
9762 ## <li><small>b</small></li>
9763 ## </small></ul>
9764 ## !!end
9765
9766 # This is a bug in the PHP parser + tidy combination.
9767 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9768 # and then fostered out of the table by tidy.)
9769 # We believe the Parsoid output to be correct.
9770 !! test
9771 Table with missing opening <tr> tag
9772 !! options
9773 parsoid=wt2html,wt2wt
9774 !! wikitext
9775 <table>
9776 <td>foo</td>
9777 </tr>
9778 </table>
9779 !! html+tidy
9780 <table>
9781 <tr>
9782 <td>foo</td>
9783 </tr>
9784 </table>
9785 !! end
9786
9787 ###
9788 ### Magic Words
9789 ###
9790
9791 # Note that the current date is hard-coded as
9792 # 1970-01-01T00:02:03Z (a Thursday)
9793 # when running parser tests. The timezone is also fixed to GMT, so
9794 # local date will be identical to current date.
9795
9796 !! test
9797 Magic Word: {{CURRENTDAY}}
9798 !! wikitext
9799 {{CURRENTDAY}}
9800 !! html
9801 <p>1
9802 </p>
9803 !! end
9804
9805 !! test
9806 Magic Word: {{CURRENTDAY2}}
9807 !! wikitext
9808 {{CURRENTDAY2}}
9809 !! html
9810 <p>01
9811 </p>
9812 !! end
9813
9814 !! test
9815 Magic Word: {{CURRENTDAYNAME}}
9816 !! wikitext
9817 {{CURRENTDAYNAME}}
9818 !! html
9819 <p>Thursday
9820 </p>
9821 !! end
9822
9823 !! test
9824 Magic Word: {{CURRENTDOW}}
9825 !! wikitext
9826 {{CURRENTDOW}}
9827 !! html
9828 <p>4
9829 </p>
9830 !! end
9831
9832 !! test
9833 Magic Word: {{CURRENTMONTH}}
9834 !! wikitext
9835 {{CURRENTMONTH}}
9836 !! html
9837 <p>01
9838 </p>
9839 !! end
9840
9841 !! test
9842 Magic Word: {{CURRENTMONTH1}}
9843 !! wikitext
9844 {{CURRENTMONTH1}}
9845 !! html
9846 <p>1
9847 </p>
9848 !! end
9849
9850 !! test
9851 Magic Word: {{CURRENTMONTHABBREV}}
9852 !! wikitext
9853 {{CURRENTMONTHABBREV}}
9854 !! html
9855 <p>Jan
9856 </p>
9857 !! end
9858
9859 !! test
9860 Magic Word: {{CURRENTMONTHNAME}}
9861 !! wikitext
9862 {{CURRENTMONTHNAME}}
9863 !! html
9864 <p>January
9865 </p>
9866 !! end
9867
9868 !! test
9869 Magic Word: {{CURRENTMONTHNAMEGEN}}
9870 !! wikitext
9871 {{CURRENTMONTHNAMEGEN}}
9872 !! html
9873 <p>January
9874 </p>
9875 !! end
9876
9877 !! test
9878 Magic Word: {{CURRENTTIME}}
9879 !! wikitext
9880 {{CURRENTTIME}}
9881 !! html
9882 <p>00:02
9883 </p>
9884 !! end
9885
9886 !! test
9887 Magic Word: {{CURRENTHOUR}}
9888 !! wikitext
9889 {{CURRENTHOUR}}
9890 !! html
9891 <p>00
9892 </p>
9893 !! end
9894
9895 !! test
9896 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9897 !! wikitext
9898 {{CURRENTWEEK}}
9899 !! html
9900 <p>1
9901 </p>
9902 !! end
9903
9904 !! test
9905 Magic Word: {{CURRENTYEAR}}
9906 !! wikitext
9907 {{CURRENTYEAR}}
9908 !! html
9909 <p>1970
9910 </p>
9911 !! end
9912
9913 !! test
9914 Magic Word: {{CURRENTTIMESTAMP}}
9915 !! wikitext
9916 {{CURRENTTIMESTAMP}}
9917 !! html
9918 <p>19700101000203
9919 </p>
9920 !! end
9921
9922 !! test
9923 Magic Words LOCAL (UTC)
9924 !! wikitext
9925 * {{LOCALMONTH}}
9926 * {{LOCALMONTH1}}
9927 * {{LOCALMONTHNAME}}
9928 * {{LOCALMONTHNAMEGEN}}
9929 * {{LOCALMONTHABBREV}}
9930 * {{LOCALDAY}}
9931 * {{LOCALDAY2}}
9932 * {{LOCALDAYNAME}}
9933 * {{LOCALYEAR}}
9934 * {{LOCALTIME}}
9935 * {{LOCALHOUR}}
9936 * {{LOCALWEEK}}
9937 * {{LOCALDOW}}
9938 * {{LOCALTIMESTAMP}}
9939 !! html
9940 <ul><li> 01</li>
9941 <li> 1</li>
9942 <li> January</li>
9943 <li> January</li>
9944 <li> Jan</li>
9945 <li> 1</li>
9946 <li> 01</li>
9947 <li> Thursday</li>
9948 <li> 1970</li>
9949 <li> 00:02</li>
9950 <li> 00</li>
9951 <li> 1</li>
9952 <li> 4</li>
9953 <li> 19700101000203</li></ul>
9954
9955 !! end
9956
9957 !! test
9958 Magic Word: {{FULLPAGENAME}}
9959 !! options
9960 title=[[User:Ævar Arnfjörð Bjarmason]]
9961 !! wikitext
9962 {{FULLPAGENAME}}
9963 !! html
9964 <p>User:Ævar Arnfjörð Bjarmason
9965 </p>
9966 !! end
9967
9968 !! test
9969 Magic Word: {{FULLPAGENAMEE}}
9970 !! options
9971 title=[[User:Ævar Arnfjörð Bjarmason]]
9972 !! wikitext
9973 {{FULLPAGENAMEE}}
9974 !! html
9975 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9976 </p>
9977 !! end
9978
9979 !! test
9980 Magic Word: {{TALKSPACE}}
9981 !! options
9982 title=[[User:Ævar Arnfjörð Bjarmason]]
9983 !! wikitext
9984 {{TALKSPACE}}
9985 !! html
9986 <p>User talk
9987 </p>
9988 !! end
9989
9990 !! test
9991 Magic Word: {{TALKSPACE}}, same namespace
9992 !! options
9993 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9994 !! wikitext
9995 {{TALKSPACE}}
9996 !! html
9997 <p>User talk
9998 </p>
9999 !! end
10000
10001 !! test
10002 Magic Word: {{TALKSPACE}}, main namespace
10003 !! options
10004 title=[[Parser Test]]
10005 !! wikitext
10006 {{TALKSPACE}}
10007 !! html
10008 <p>Talk
10009 </p>
10010 !! end
10011
10012 !! test
10013 Magic Word: {{TALKSPACEE}}
10014 !! options
10015 title=[[User:Ævar Arnfjörð Bjarmason]]
10016 !! wikitext
10017 {{TALKSPACEE}}
10018 !! html
10019 <p>User_talk
10020 </p>
10021 !! end
10022
10023 !! test
10024 Magic Word: {{SUBJECTSPACE}}
10025 !! options
10026 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10027 !! wikitext
10028 {{SUBJECTSPACE}}
10029 !! html
10030 <p>User
10031 </p>
10032 !! end
10033
10034 !! test
10035 Magic Word: {{SUBJECTSPACE}}, same namespace
10036 !! options
10037 title=[[User:Ævar Arnfjörð Bjarmason]]
10038 !! wikitext
10039 {{SUBJECTSPACE}}
10040 !! html
10041 <p>User
10042 </p>
10043 !! end
10044
10045 !! test
10046 Magic Word: {{SUBJECTSPACE}}, main namespace
10047 !! options
10048 title=[[Parser Test]]
10049 !! wikitext
10050 {{SUBJECTSPACE}}
10051 !! html
10052
10053 !! end
10054
10055 !! test
10056 Magic Word: {{SUBJECTSPACEE}}
10057 !! options
10058 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10059 !! wikitext
10060 {{SUBJECTSPACEE}}
10061 !! html
10062 <p>User
10063 </p>
10064 !! end
10065
10066 !! test
10067 Magic Word: {{NAMESPACE}}
10068 !! options
10069 title=[[User:Ævar Arnfjörð Bjarmason]]
10070 !! wikitext
10071 {{NAMESPACE}}
10072 !! html
10073 <p>User
10074 </p>
10075 !! end
10076
10077 !! test
10078 Magic Word: {{NAMESPACEE}}
10079 !! options
10080 title=[[User:Ævar Arnfjörð Bjarmason]]
10081 !! wikitext
10082 {{NAMESPACEE}}
10083 !! html
10084 <p>User
10085 </p>
10086 !! end
10087
10088 !! test
10089 Magic Word: {{NAMESPACENUMBER}}
10090 !! options
10091 title=[[User:Ævar Arnfjörð Bjarmason]]
10092 !! wikitext
10093 {{NAMESPACENUMBER}}
10094 !! html
10095 <p>2
10096 </p>
10097 !! end
10098
10099 !! test
10100 Magic Word: {{SUBPAGENAME}}
10101 !! options
10102 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10103 !! wikitext
10104 {{SUBPAGENAME}}
10105 !! html
10106 <p>sub ö
10107 </p>
10108 !! end
10109
10110 !! test
10111 Magic Word: {{SUBPAGENAMEE}}
10112 !! options
10113 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10114 !! wikitext
10115 {{SUBPAGENAMEE}}
10116 !! html
10117 <p>sub_%C3%B6
10118 </p>
10119 !! end
10120
10121 !! test
10122 Magic Word: {{ROOTPAGENAME}}
10123 !! options
10124 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10125 !! wikitext
10126 {{ROOTPAGENAME}}
10127 !! html
10128 <p>Ævar Arnfjörð Bjarmason
10129 </p>
10130 !! end
10131
10132 !! test
10133 Magic Word: {{ROOTPAGENAMEE}}
10134 !! options
10135 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10136 !! wikitext
10137 {{ROOTPAGENAMEE}}
10138 !! html
10139 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10140 </p>
10141 !! end
10142
10143 !! test
10144 Magic Word: {{BASEPAGENAME}}
10145 !! options
10146 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10147 !! wikitext
10148 {{BASEPAGENAME}}
10149 !! html
10150 <p>Ævar Arnfjörð Bjarmason
10151 </p>
10152 !! end
10153
10154 !! test
10155 Magic Word: {{BASEPAGENAMEE}}
10156 !! options
10157 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10158 !! wikitext
10159 {{BASEPAGENAMEE}}
10160 !! html
10161 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10162 </p>
10163 !! end
10164
10165 !! test
10166 Magic Word: {{TALKPAGENAME}}
10167 !! options
10168 title=[[User:Ævar Arnfjörð Bjarmason]]
10169 !! wikitext
10170 {{TALKPAGENAME}}
10171 !! html
10172 <p>User talk:Ævar Arnfjörð Bjarmason
10173 </p>
10174 !! end
10175
10176 !! test
10177 Magic Word: {{TALKPAGENAMEE}}
10178 !! options
10179 title=[[User:Ævar Arnfjörð Bjarmason]]
10180 !! wikitext
10181 {{TALKPAGENAMEE}}
10182 !! html
10183 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10184 </p>
10185 !! end
10186
10187 !! test
10188 Magic Word: {{SUBJECTPAGENAME}}
10189 !! options
10190 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10191 !! wikitext
10192 {{SUBJECTPAGENAME}}
10193 !! html
10194 <p>User:Ævar Arnfjörð Bjarmason
10195 </p>
10196 !! end
10197
10198 !! test
10199 Magic Word: {{SUBJECTPAGENAMEE}}
10200 !! options
10201 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10202 !! wikitext
10203 {{SUBJECTPAGENAMEE}}
10204 !! html
10205 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10206 </p>
10207 !! end
10208
10209 !! test
10210 Magic Word: {{NUMBEROFFILES}}
10211 !! wikitext
10212 {{NUMBEROFFILES}}
10213 !! html
10214 <p>7
10215 </p>
10216 !! end
10217
10218 !! test
10219 Magic Word: {{PAGENAME}}
10220 !! options
10221 title=[[User:Ævar Arnfjörð Bjarmason]]
10222 !! wikitext
10223 {{PAGENAME}}
10224 !! html
10225 <p>Ævar Arnfjörð Bjarmason
10226 </p>
10227 !! end
10228
10229 !! test
10230 Magic Word: {{PAGENAME}} with metacharacters
10231 !! options
10232 title=[['foo & bar = baz']]
10233 !! wikitext
10234 ''{{PAGENAME}}''
10235 !! html/php
10236 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10237 </p>
10238 !! html+tidy
10239 <p><i>'foo &amp; bar = baz'</i></p>
10240 !! end
10241
10242 !! test
10243 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
10244 !! options
10245 title=[[*RFC 1234 http://example.com/]]
10246 !! wikitext
10247 {{PAGENAME}}
10248 !! html/php
10249 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10250 </p>
10251 !! html+tidy
10252 <p>*RFC 1234 http://example.com/</p>
10253 !! end
10254
10255 !! test
10256 Magic Word: {{PAGENAMEE}}
10257 !! options
10258 title=[[User:Ævar Arnfjörð Bjarmason]]
10259 !! wikitext
10260 {{PAGENAMEE}}
10261 !! html
10262 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10263 </p>
10264 !! end
10265
10266 !! test
10267 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10268 !! options
10269 title=[[*RFC 1234 http://example.com/]]
10270 !! wikitext
10271 {{PAGENAMEE}}
10272 !! html/php
10273 <p>&#42;RFC_1234_http&#58;//example.com/
10274 </p>
10275 !! html+tidy
10276 <p>*RFC_1234_http://example.com/</p>
10277 !! end
10278
10279 !! test
10280 Magic Word: {{REVISIONID}}
10281 !! wikitext
10282 {{REVISIONID}}
10283 !! html
10284 <p>1337
10285 </p>
10286 !! end
10287
10288 !! test
10289 Magic Word: {{SCRIPTPATH}}
10290 !! wikitext
10291 {{SCRIPTPATH}}
10292 !! html
10293
10294 !! end
10295
10296 !! test
10297 Magic Word: {{STYLEPATH}}
10298 !! wikitext
10299 {{STYLEPATH}}
10300 !! html
10301 <p>/skins
10302 </p>
10303 !! end
10304
10305 !! test
10306 Magic Word: {{SERVER}}
10307 !! wikitext
10308 {{SERVER}}
10309 !! html
10310 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10311 </p>
10312 !! end
10313
10314 !! test
10315 Magic Word: {{SERVERNAME}}
10316 !! wikitext
10317 {{SERVERNAME}}
10318 !! html
10319 <p>example.org
10320 </p>
10321 !! end
10322
10323 !! test
10324 Magic Word: {{SITENAME}}
10325 !! wikitext
10326 {{SITENAME}}
10327 !! html
10328 <p>MediaWiki
10329 </p>
10330 !! end
10331
10332 !! test
10333 Magic Word: {{PAGELANGUAGE}}
10334 !! options
10335 language=fr
10336 !! wikitext
10337 {{PAGELANGUAGE}}
10338 !! html
10339 <p>fr
10340 </p>
10341 !! end
10342
10343 !! test
10344 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10345 !! wikitext
10346 {{PAGELANGUAGE}}
10347 !! html
10348 <p>en
10349 </p>
10350 !! end
10351
10352 !! test
10353 Case-sensitive magic words, when cased differently, should just be template transclusions
10354 !! wikitext
10355 {{CurrentMonth}}
10356 {{currentday}}
10357 {{cURreNTweEK}}
10358 {{currentHour}}
10359 !! html
10360 <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>
10361 <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>
10362 <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>
10363 <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>
10364 </p>
10365 !! end
10366
10367 !! test
10368 Case-insensitive magic words should still work with weird casing.
10369 !! wikitext
10370 {{sErVeRNaMe}}
10371 {{LCFirst:AOEU}}
10372 {{ucFIRST:aoeu}}
10373 {{SERver}}
10374 !! html
10375 <p>example.org
10376 aOEU
10377 Aoeu
10378 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10379 </p>
10380 !! end
10381
10382 # From plwiki:PLOS_ONE
10383 !! test
10384 Parsoid: Page property magic word with magic word contents
10385 !! wikitext
10386 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10387 !! html/parsoid
10388 <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>"}]]}'/>
10389 !! end
10390
10391 !! test
10392 Parsoid: Template-generated DISPLAYTITLE
10393 !! wikitext
10394 {{{{echo|DISPLAYTITLE}}:Foo}}
10395 !! html/parsoid
10396 <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}}]}'/>
10397 !! end
10398
10399 !! test
10400 Namespace 1 {{ns:1}}
10401 !! wikitext
10402 {{ns:1}}
10403 !! html
10404 <p>Talk
10405 </p>
10406 !! end
10407
10408 !! test
10409 Namespace 1 {{ns:01}}
10410 !! wikitext
10411 {{ns:01}}
10412 !! html
10413 <p>Talk
10414 </p>
10415 !! end
10416
10417 !! test
10418 Namespace 0 {{ns:0}} (bug 4783)
10419 !! wikitext
10420 {{ns:0}}
10421 !! html
10422
10423 !! end
10424
10425 !! test
10426 Namespace 0 {{ns:00}} (bug 4783)
10427 !! wikitext
10428 {{ns:00}}
10429 !! html
10430
10431 !! end
10432
10433 !! test
10434 Namespace -1 {{ns:-1}}
10435 !! wikitext
10436 {{ns:-1}}
10437 !! html
10438 <p>Special
10439 </p>
10440 !! end
10441
10442 !! test
10443 Namespace User {{ns:User}}
10444 !! wikitext
10445 {{ns:User}}
10446 !! html
10447 <p>User
10448 </p>
10449 !! end
10450
10451 !! test
10452 Namespace User talk {{ns:User_talk}}
10453 !! wikitext
10454 {{ns:User_talk}}
10455 !! html
10456 <p>User talk
10457 </p>
10458 !! end
10459
10460 !! test
10461 Namespace User talk {{ns:uSeR tAlK}}
10462 !! wikitext
10463 {{ns:uSeR tAlK}}
10464 !! html
10465 <p>User talk
10466 </p>
10467 !! end
10468
10469 !! test
10470 Namespace File {{ns:File}}
10471 !! wikitext
10472 {{ns:File}}
10473 !! html
10474 <p>File
10475 </p>
10476 !! end
10477
10478 !! test
10479 Namespace File {{ns:Image}}
10480 !! wikitext
10481 {{ns:Image}}
10482 !! html
10483 <p>File
10484 </p>
10485 !! end
10486
10487 !! test
10488 Namespace (lang=de) Benutzer {{ns:User}}
10489 !! options
10490 language=de
10491 !! wikitext
10492 {{ns:User}}
10493 !! html
10494 <p>Benutzer
10495 </p>
10496 !! end
10497
10498 !! test
10499 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10500 !! options
10501 language=de
10502 !! wikitext
10503 {{ns:3}}
10504 !! html
10505 <p>Benutzer Diskussion
10506 </p>
10507 !! end
10508
10509 !! test
10510 Urlencode
10511 !! wikitext
10512 {{urlencode:hi world?!}}
10513 {{urlencode:hi world?!|WIKI}}
10514 {{urlencode:hi world?!|PATH}}
10515 {{urlencode:hi world?!|QUERY}}
10516 !! html/php
10517 <p>hi+world%3F%21
10518 hi_world%3F!
10519 hi%20world%3F%21
10520 hi+world%3F%21
10521 </p>
10522 !! end
10523
10524 !! test
10525 Magic Word: prioritize type info over data-parsoid
10526 !! options
10527 parsoid=html2wt
10528 !! html/parsoid
10529 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10530 !! wikitext
10531 __FORCETOC__
10532 !! end
10533
10534 !! test
10535 Magic Word: serialize on separate line (parsoid)
10536 !! options
10537 parsoid=wt2wt,html2wt
10538 !! wikitext
10539 foo
10540 __NOTOC__
10541 bar
10542 !! html/parsoid
10543 foo<meta property="mw:PageProp/notoc"/>bar
10544 !! end
10545
10546 !! test
10547 Magic Word: rt non-english wikis
10548 !! options
10549 parsoid=wt2wt
10550 language=de
10551 !! wikitext
10552 __NOEDITSECTION__
10553 !! html/parsoid
10554 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10555 !! end
10556
10557 !!test
10558 __proto__ is treated as normal wikitext (T105997)
10559 !!wikitext
10560 __proto__
10561 !!html
10562 <p>__proto__
10563 </p>
10564 !!end
10565
10566 ###
10567 ### Magic links
10568 ###
10569 !! test
10570 Magic links: internal link to RFC (bug 479)
10571 !! wikitext
10572 [[RFC 123]]
10573 !! html/php
10574 <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>
10575 </p>
10576 !! html/parsoid
10577 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10578 !! end
10579
10580 !! test
10581 Magic links: RFC (bug 479)
10582 !! wikitext
10583 RFC 822
10584 !! html/php
10585 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10586 </p>
10587 !! html/parsoid
10588 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10589 !! end
10590
10591 !! test
10592 Magic links: RFC (bug 65278)
10593 !! wikitext
10594 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10595 !! html/php
10596 <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.
10597 </p>
10598 !! html/parsoid
10599 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10600 !! end
10601
10602 !! test
10603 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10604 !! wikitext
10605 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10606 RFC
10607 822
10608 !! html/php
10609 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10610 RFC
10611 822
10612 </p>
10613 !! html/parsoid
10614 <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>
10615 RFC
10616 822</p>
10617 !! end
10618
10619 !! test
10620 Magic links: ISBN (bug 1937)
10621 !! wikitext
10622 ISBN 0-306-40615-2
10623 !! html/php
10624 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10625 </p>
10626 !! html/parsoid
10627 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10628 !! end
10629
10630 !! test
10631 Magic links: ISBN (bug 65278)
10632 !! wikitext
10633 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10634 !! html/php
10635 <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.
10636 </p>
10637 !! html/parsoid
10638 <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>
10639 !! end
10640
10641 !! test
10642 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10643 !! wikitext
10644 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10645 ISBN
10646 9780316098113
10647 ISBN 978
10648 0316098113
10649 !! html/php
10650 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10651 ISBN
10652 9780316098113
10653 ISBN 978
10654 0316098113
10655 </p>
10656 !! html/parsoid
10657 <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>
10658 ISBN
10659 9780316098113
10660 ISBN 978
10661 0316098113</p>
10662 !! end
10663
10664 !! test
10665 Magic links: PMID incorrectly converts space to underscore
10666 !! wikitext
10667 PMID 1234
10668 !! html/php
10669 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10670 </p>
10671 !! html/parsoid
10672 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10673 !! end
10674
10675 !! test
10676 Magic links: PMID (bug 65278)
10677 !! wikitext
10678 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10679 !! html/php
10680 <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.
10681 </p>
10682 !! html/parsoid
10683 <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>
10684 !! end
10685
10686 !! test
10687 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10688 !! wikitext
10689 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10690 PMID
10691 1234
10692 !! html/php
10693 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10694 PMID
10695 1234
10696 </p>
10697 !! html/parsoid
10698 <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>
10699 PMID
10700 1234</p>
10701 !! end
10702
10703 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10704 # since these are ExtLinkText, not MagicLinkText
10705 !! test
10706 Magic links: use appropriate serialization for "almost" magic links.
10707 !! wikitext
10708 X[[Special:BookSources/0978739256|foo]]
10709
10710 X[//tools.ietf.org/html/rfc1234 foo]
10711 !! html/php
10712 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10713 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10714 </p>
10715 !! html/parsoid
10716 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10717 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10718 !! end
10719
10720 !! test
10721 Magic links: All disabled (T47942)
10722 !! options
10723 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10724 !! wikitext
10725 ISBN 0-306-40615-2
10726 PMID 1234
10727 RFC 4321
10728 !! html/php
10729 <p>ISBN 0-306-40615-2
10730 PMID 1234
10731 RFC 4321
10732 </p>
10733 !! end
10734
10735 ###
10736 ### Templates
10737 ####
10738
10739 !! test
10740 Nonexistent template
10741 !! wikitext
10742 {{thistemplatedoesnotexist}}
10743 !! html
10744 <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>
10745 </p>
10746 !! end
10747
10748 !! test
10749 Template with invalid target containing tags
10750 !! wikitext
10751 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10752 !! html
10753 <p>{{a<b>b</b>|foo|a=b|a = b}}
10754 </p>
10755 !! end
10756
10757 !! test
10758 Template with invalid target containing unclosed tag
10759 !! wikitext
10760 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10761 !! html
10762 <p>{{a<b>|foo|a=b|a = b}}</b>
10763 </p>
10764 !! end
10765
10766 !! test
10767 Template with invalid target containing wikilink
10768 !! wikitext
10769 {{[[Main Page]]}}
10770 !! html/php
10771 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10772 </p>
10773 !! html/parsoid
10774 <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>
10775 !! end
10776
10777 !! test
10778 Template with just whitespace in it, bug #68421
10779 !! wikitext
10780 {{echo|{{ }}}}
10781 !! html/parsoid
10782 <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>
10783 !! end
10784
10785 !! article
10786 Template:test
10787 !! text
10788 This is a test template
10789 !! endarticle
10790
10791 !! test
10792 Simple template
10793 !! wikitext
10794 {{test}}
10795 !! html
10796 <p>This is a test template
10797 </p>
10798 !! end
10799
10800 !! test
10801 Template with explicit namespace
10802 !! wikitext
10803 {{Template:test}}
10804 !! html
10805 <p>This is a test template
10806 </p>
10807 !! end
10808
10809
10810 !! article
10811 Template:paramtest
10812 !! text
10813 This is a test template with parameter {{{param}}}
10814 !! endarticle
10815
10816 !! test
10817 Template parameter
10818 !! wikitext
10819 {{paramtest|param=foo}}
10820 !! html
10821 <p>This is a test template with parameter foo
10822 </p>
10823 !! end
10824
10825 !! article
10826 Template:paramtestnum
10827 !! text
10828 [[{{{1}}}|{{{2}}}]]
10829 !! endarticle
10830
10831 !! test
10832 Template unnamed parameter
10833 !! wikitext
10834 {{paramtestnum|Main Page|the main page}}
10835 !! html
10836 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10837 </p>
10838 !! end
10839
10840 !! article
10841 Template:templatesimple
10842 !! text
10843 (test)
10844 !! endarticle
10845
10846 !! article
10847 Template:templateredirect
10848 !! text
10849 #redirect [[Template:templatesimple]]
10850 !! endarticle
10851
10852 !! article
10853 Template:templateasargtestnum
10854 !! text
10855 {{{{{1}}}}}
10856 !! endarticle
10857
10858 !! article
10859 Template:templateasargtest
10860 !! text
10861 {{template{{{templ}}}}}
10862 !! endarticle
10863
10864 !! article
10865 Template:templateasargtest2
10866 !! text
10867 {{{{{templ}}}}}
10868 !! endarticle
10869
10870 !! test
10871 Template with template name as unnamed argument
10872 !! wikitext
10873 {{templateasargtestnum|templatesimple}}
10874 !! html
10875 <p>(test)
10876 </p>
10877 !! end
10878
10879 !! test
10880 Template with template name as argument
10881 !! wikitext
10882 {{templateasargtest|templ=simple}}
10883 !! html
10884 <p>(test)
10885 </p>
10886 !! end
10887
10888 !! test
10889 Template with template name as argument (2)
10890 !! wikitext
10891 {{templateasargtest2|templ=templatesimple}}
10892 !! html
10893 <p>(test)
10894 </p>
10895 !! end
10896
10897 !! article
10898 Template:templateasargtestdefault
10899 !! text
10900 {{{{{templ|templatesimple}}}}}
10901 !! endarticle
10902
10903 !! article
10904 Template:templa
10905 !! text
10906 '''templ'''
10907 !! endarticle
10908
10909 !! test
10910 Template with default value
10911 !! wikitext
10912 {{templateasargtestdefault}}
10913 !! html
10914 <p>(test)
10915 </p>
10916 !! end
10917
10918 !! test
10919 Template with default value (value set)
10920 !! wikitext
10921 {{templateasargtestdefault|templ=templa}}
10922 !! html
10923 <p><b>templ</b>
10924 </p>
10925 !! end
10926
10927 !! test
10928 Template redirect
10929 !! wikitext
10930 {{templateredirect}}
10931 !! html/php
10932 <p>(test)
10933 </p>
10934 !! html/parsoid
10935 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10936 !! end
10937
10938 !! test
10939 Template with argument in separate line
10940 !! wikitext
10941 {{ templateasargtest |
10942 templ = simple }}
10943 !! html
10944 <p>(test)
10945 </p>
10946 !! end
10947
10948 !! test
10949 Template with complex template as argument
10950 !! wikitext
10951 {{paramtest|
10952 param ={{ templateasargtest |
10953 templ = simple }}}}
10954 !! html
10955 <p>This is a test template with parameter (test)
10956 </p>
10957 !! end
10958
10959 !! test
10960 Template with thumb image (with link in description)
10961 !! wikitext
10962 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10963 !! html/php
10964 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>
10965
10966 !! html+tidy
10967 <p>This is a test template with parameter</p>
10968 <div class="thumb tright">
10969 <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>
10970 <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>
10971 </div>
10972 </div>
10973 !! html/parsoid
10974 <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>
10975 !! end
10976
10977 !! article
10978 Template:complextemplate
10979 !! text
10980 {{{1}}} {{paramtest|
10981 param ={{{param}}}}}
10982 !! endarticle
10983
10984 !! test
10985 Template with complex arguments
10986 !! wikitext
10987 {{complextemplate|
10988 param ={{ templateasargtest |
10989 templ = simple }}|[[Template:complextemplate|link]]}}
10990 !! html
10991 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10992 </p>
10993 !! end
10994
10995 !! test
10996 BUG 553: link with two variables in a piped link
10997 !! wikitext
10998 {|
10999 |[[{{{1}}}|{{{2}}}]]
11000 |}
11001 !! html/php
11002 <table>
11003 <tr>
11004 <td>[[{{{1}}}|{{{2}}}]]
11005 </td></tr></table>
11006
11007 !! html/parsoid
11008 <table>
11009 <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>
11010 </tbody></table>
11011 !! end
11012
11013 # See: T2553
11014 !! test
11015 Abort table cell attribute parsing on wikilink
11016 !! wikitext
11017 {|
11018 | testing [[one|two]] | three || four
11019 | testing one two | three || four
11020 | testing="[[one|two]]" | three || four
11021 |}
11022 !! html/php
11023 <table>
11024 <tr>
11025 <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>
11026 <td> four
11027 </td>
11028 <td> three </td>
11029 <td> four
11030 </td>
11031 <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>
11032 <td> four
11033 </td></tr></table>
11034
11035 !! html/parsoid
11036 <table>
11037 <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>
11038 <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>
11039 <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>
11040 </tbody></table>
11041 !! end
11042
11043 !! test
11044 Don't abort table cell attribute parsing if wikilink is found in template arg
11045 !! wikitext
11046 {|
11047 | Test {{#tag:ref|One two "[[three]]" four}}
11048 |}
11049 !! html/parsoid
11050 <table>
11051 <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>
11052 </tbody></table>
11053 !! end
11054
11055 !! test
11056 Magic variable as template parameter
11057 !! wikitext
11058 {{paramtest|param={{SITENAME}}}}
11059 !! html
11060 <p>This is a test template with parameter MediaWiki
11061 </p>
11062 !! end
11063
11064 !! article
11065 Template:linktest
11066 !! text
11067 [[{{{param}}}|link]]
11068 !! endarticle
11069
11070 !! test
11071 Template parameter as link source
11072 !! wikitext
11073 {{linktest|param=Main Page}}
11074 !! html
11075 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11076 </p>
11077 !! end
11078
11079 !!article
11080 Template:paramtest2
11081 !! text
11082 including another template, {{paramtest|param={{{arg}}}}}
11083 !! endarticle
11084
11085 !! test
11086 Template passing argument to another template
11087 !! wikitext
11088 {{paramtest2|arg='hmm'}}
11089 !! html
11090 <p>including another template, This is a test template with parameter 'hmm'
11091 </p>
11092 !! end
11093
11094 !! article
11095 Template:Linktest2
11096 !! text
11097 Main Page
11098 !! endarticle
11099
11100 !! test
11101 Template as link source
11102 !! wikitext
11103 [[{{linktest2}}]]
11104
11105 [[{{linktest2}}|Main Page]]
11106
11107 [[{{linktest2}}]]Page
11108 !! html
11109 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11110 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11111 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11112 </p>
11113 !! end
11114
11115
11116 !! article
11117 Template:loop1
11118 !! text
11119 {{loop2}}
11120 !! endarticle
11121
11122 !! article
11123 Template:loop2
11124 !! text
11125 {{loop1}}
11126 !! endarticle
11127
11128 !! test
11129 Template infinite loop
11130 !! wikitext
11131 {{loop1}}
11132 !! html
11133 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11134 </p>
11135 !! end
11136
11137 !! test
11138 Template from main namespace
11139 !! wikitext
11140 {{:Main Page}}
11141 !! html
11142 <p>blah blah
11143 </p>
11144 !! end
11145
11146 !! article
11147 Template:table
11148 !! text
11149 {|
11150 | 1 || 2
11151 |-
11152 | 3 || 4
11153 |}
11154 !! endarticle
11155
11156 !! test
11157 BUG 529: Template with table, not included at beginning of line
11158 !! wikitext
11159 foo {{table}}
11160 !! html
11161 <p>foo
11162 </p>
11163 <table>
11164 <tr>
11165 <td> 1 </td>
11166 <td> 2
11167 </td></tr>
11168 <tr>
11169 <td> 3 </td>
11170 <td> 4
11171 </td></tr></table>
11172
11173 !! end
11174
11175 !! test
11176 BUG 523: Template shouldn't eat newline (or add an extra one before table)
11177 !! wikitext
11178 foo
11179 {{table}}
11180 !! html
11181 <p>foo
11182 </p>
11183 <table>
11184 <tr>
11185 <td> 1 </td>
11186 <td> 2
11187 </td></tr>
11188 <tr>
11189 <td> 3 </td>
11190 <td> 4
11191 </td></tr></table>
11192
11193 !! end
11194
11195 !! test
11196 BUG 41: Template parameters shown as broken links
11197 !! wikitext
11198 {{{parameter}}}
11199 !! html
11200 <p>{{{parameter}}}
11201 </p>
11202 !! end
11203
11204 !! test
11205 Template with targets containing wikilinks
11206 !! wikitext
11207 {{[[foo]]}}
11208
11209 {{[[{{echo|foo}}]]}}
11210
11211 {{{{echo|[[foo}}]]}}
11212 !! html
11213 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11214 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11215 </p><p>{{[[foo}}]]
11216 </p>
11217 !! end
11218
11219 !! article
11220 Template:''
11221 !! text
11222 bar
11223 !! endarticle
11224
11225 !! test
11226 Templates: Double quotes as template target
11227 !! wikitext
11228 foo {{''}} baz
11229 !! html/php
11230 <p>foo bar baz
11231 </p>
11232 !! html/parsoid
11233 <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
11234 </p>
11235 !! end
11236
11237 ## This test is about making sure Parsoid's data-mw is well formed in the
11238 ## face of multiple templates with intersecting and overlapping ranges. The
11239 ## wikitext itself is wretched.
11240 !! test
11241 Templates with intersecting and overlapping ranges
11242 !! wikitext
11243 {|{{echo|
11244 <p>ha</p>}}
11245 {|{{echo|
11246 <p>ho</p>}}
11247 {{echo|{{!}}hi}}
11248 |}
11249 !! html/php+tidy
11250 <p>ha</p>
11251 <p>ho</p>
11252 <table>
11253 <tr>
11254 <td></td>
11255 </tr>
11256 <tr>
11257 <td>hi</td>
11258 </tr>
11259 </table>
11260 <table>
11261 <tr>
11262 <td></td>
11263 </tr>
11264 </table>
11265 !! html/parsoid
11266 <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":""}]]}'>
11267
11268 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11269
11270 <tbody><tr><td>hi</td></tr>
11271 </tbody></table>
11272 !! end
11273
11274 !! article
11275 Template:MSGNW test
11276 !! text
11277 ''None'' of '''this''' should be
11278 * interpreted
11279 but rather passed unmodified
11280 {{test}}
11281 <gallery>
11282 File:Foobar.jpg
11283 </gallery>
11284 <!-- comment -->
11285 !! endarticle
11286
11287 # hmm, fix this or just deprecate msgnw and document its behavior?
11288 !! test
11289 msgnw keyword
11290 !! wikitext
11291 {{msgnw:MSGNW test}}
11292 !! html/php
11293 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11294 &#42; interpreted
11295 &#32;but rather passed unmodified
11296 &#123;&#123;test&#125;&#125;
11297 &#60;gallery&#62;
11298 File:Foobar.jpg
11299 &#60;/gallery&#62;
11300 &#60;!-- comment --&#62;
11301 </p>
11302 !! end
11303
11304 !! test
11305 int keyword
11306 !! wikitext
11307 {{int:youhavenewmessages|lots of money|not!}}
11308 !! html
11309 <p>You have lots of money (not!).
11310 </p>
11311 !! end
11312
11313 !! test
11314 int keyword - non-existing message
11315 !! wikitext
11316 {{int:var}}
11317 !! html
11318 <p>⧼var⧽
11319 </p>
11320 !! end
11321
11322 !! article
11323 Template:Includes
11324 !! text
11325 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11326 !! endarticle
11327
11328 !! test
11329 <includeonly> and <noinclude> being included
11330 !! wikitext
11331 {{Includes}}
11332 !! html
11333 <p>Foobar
11334 </p>
11335 !! end
11336
11337 !! article
11338 Template:Includes2
11339 !! text
11340 <onlyinclude>Foo</onlyinclude>bar
11341 !! endarticle
11342
11343 !! test
11344 <onlyinclude> being included
11345 !! wikitext
11346 {{Includes2}}
11347 !! html
11348 <p>Foo
11349 </p>
11350 !! end
11351
11352
11353 !! article
11354 Template:Includes3
11355 !! text
11356 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11357 !! endarticle
11358
11359 !! test
11360 <onlyinclude> and <includeonly> being included
11361 !! wikitext
11362 {{Includes3}}
11363 !! html
11364 <p>Foo
11365 </p>
11366 !! end
11367
11368 !! test
11369 <includeonly> and <noinclude> on a page
11370 !! wikitext
11371 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11372 !! html
11373 <p>Foozar
11374 </p>
11375 !! end
11376
11377 !! test
11378 Un-closed <noinclude>
11379 !! wikitext
11380 <noinclude>
11381 !! html
11382 !! end
11383
11384 !! test
11385 <onlyinclude> on a page
11386 !! wikitext
11387 <onlyinclude>Foo</onlyinclude>bar
11388 !! html
11389 <p>Foobar
11390 </p>
11391 !! end
11392
11393 !! test
11394 Un-closed <onlyinclude>
11395 !! wikitext
11396 <onlyinclude>
11397 !! html
11398 !! end
11399
11400 !!test
11401 Self-closed noinclude, includeonly, onlyinclude tags
11402 !! wikitext
11403 <noinclude />
11404 <includeonly />
11405 <onlyinclude />
11406 !! html
11407 <p><br />
11408 </p>
11409 !!end
11410
11411 !!test
11412 Unbalanced includeonly and noinclude tags
11413 !! wikitext
11414 {|
11415 |a</noinclude>
11416 |b</noinclude></noinclude>
11417 |c</noinclude></includeonly>
11418 |d</includeonly></includeonly>
11419 |}
11420 !! html
11421 <table>
11422 <tr>
11423 <td>a
11424 </td>
11425 <td>b
11426 </td>
11427 <td>c&lt;/includeonly&gt;
11428 </td>
11429 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11430 </td></tr></table>
11431
11432 !!end
11433
11434 !! article
11435 Template:Includeonly section
11436 !! text
11437 <includeonly>
11438 ==Includeonly section==
11439 </includeonly>
11440 ==Section T-1==
11441 !!endarticle
11442
11443 !! test
11444 Bug 6563: Edit link generation for section shown by <includeonly>
11445 !! wikitext
11446 {{includeonly section}}
11447 !! html
11448 <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>
11449 <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>
11450
11451 !! end
11452
11453 # Uses same input as the contents of [[Template:Includeonly section]]
11454 !! test
11455 Bug 6563: Section extraction for section shown by <includeonly>
11456 !! options
11457 section=T-2
11458 !! wikitext
11459 <includeonly>
11460 ==Includeonly section==
11461 </includeonly>
11462 ==Section T-2==
11463 !! html
11464 ==Section T-2==
11465 !! end
11466
11467 !! test
11468 Bug 6563: Edit link generation for section suppressed by <includeonly>
11469 !! wikitext
11470 <includeonly>
11471 ==Includeonly section==
11472 </includeonly>
11473 ==Section 1==
11474 !! html
11475 <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>
11476
11477 !! end
11478
11479 !! test
11480 Bug 6563: Section extraction for section suppressed by <includeonly>
11481 !! options
11482 section=1
11483 !! wikitext
11484 <includeonly>
11485 ==Includeonly section==
11486 </includeonly>
11487 ==Section 1==
11488 !! html
11489 ==Section 1==
11490 !! end
11491
11492 !! test
11493 Un-closed <includeonly>
11494 !! wikitext
11495 <includeonly>
11496 !! html/php
11497 !! html/parsoid
11498 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11499 !! end
11500
11501 ## We used to, but no longer wt2wt this test since the default serializer
11502 ## will normalize the include directives to serialize on their own line.
11503 ## Selser will take care of preserving formatting in scenarios where they
11504 ## intermingled with other wikitext.
11505 !! test
11506 Includes and comments at SOL
11507 !! options
11508 parsoid=wt2html,html2html
11509 !! wikitext
11510 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11511
11512 <noinclude>
11513 some
11514 </noinclude>* stuff
11515 * here
11516
11517 <includeonly>can have stuff</includeonly>=== here ===
11518
11519 !! html/php
11520 <h2><span class="mw-headline" id="hu">hu</span></h2>
11521 <p>some
11522 </p>
11523 <ul><li> stuff</li>
11524 <li> here</li></ul>
11525 <h3><span class="mw-headline" id="here">here</span></h3>
11526
11527 !! html/parsoid
11528 <!-- 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>
11529
11530 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11531 <p>some</p>
11532 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11533 <li> here</li></ul>
11534
11535 <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>
11536
11537 !! end
11538
11539 # TODO: test with DOM fragment reuse!
11540 !! test
11541 Parsoid: DOM fragment reuse
11542 !! options
11543 parsoid=wt2wt,wt2html
11544 !! wikitext
11545 a{{echo|b<table></table>c}}d
11546
11547 a{{echo|b
11548 <table></table>
11549 c}}d
11550
11551 {{echo|a
11552
11553 <table></table>
11554
11555 b}}
11556 !! html
11557 <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>
11558
11559 <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">
11560 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11561 </span><p about="#mwt2">cd</p>
11562
11563 <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">
11564
11565 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11566
11567 </span><p about="#mwt3">b</p>
11568 !! end
11569
11570 !! test
11571 Parsoid: Merge double tds (T52603)
11572 !! options
11573 parsoid
11574 !! wikitext
11575 {|
11576 |{{echo|{{!}} foo}}
11577 |}
11578 !! html
11579 <table><tbody>
11580 <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>
11581 </tbody></table>
11582 !! end
11583
11584 !! test
11585 Parsoid: Merge double tds in nested transclusion content (T52603)
11586 !! options
11587 parsoid
11588 !! wikitext
11589 {{echo|<div>}}
11590 {|
11591 |{{echo|{{!}} foo}}
11592 |}
11593 {{echo|</div>}}
11594 !! html
11595 <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}}]}'>
11596 <table><tbody>
11597 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11598 </tbody></table>
11599 </div>
11600 !! end
11601
11602 ###
11603 ### <includeonly> and <noinclude> in attributes
11604 ###
11605 !!test
11606 0. includeonly around the entire attribute
11607 !! wikitext
11608 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11609 !! html
11610 <p><span id="v2">bar</span>
11611 </p>
11612 !!end
11613
11614 !!test
11615 1. includeonly in html attr key
11616 !! wikitext
11617 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11618 !! html
11619 <p><span id="foo">bar</span>
11620 </p>
11621 !!end
11622
11623 !!test
11624 2. includeonly in html attr value
11625 !! wikitext
11626 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11627 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11628 !! html
11629 <p><span id="v1">bar</span>
11630 <span id="v1">bar</span>
11631 </p>
11632 !!end
11633
11634 !!test
11635 3. includeonly in part of an attr value
11636 !! wikitext
11637 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11638 !! html
11639 <p><span style="color:red;">bar</span>
11640 </p>
11641 !!end
11642
11643 !!test
11644 4. includeonly in table attributes
11645 !! wikitext
11646 {|
11647 |- <noinclude>
11648 |-
11649 |a
11650 </noinclude>
11651 |- <includeonly>
11652 |-
11653 |b
11654 </includeonly>
11655 |}
11656 !! html
11657 <table>
11658
11659
11660 <tr>
11661 <td>a
11662 </td></tr>
11663 </table>
11664
11665 !!end
11666
11667 ###
11668 ### Token Stream Patcher tests
11669 ###
11670 ### These tests won't always pass wt2wt and other modes because
11671 ### on serialization, the table will be output on a new line.
11672 ### For now, we are blacklisting them, and using this to test selser.
11673 ###
11674
11675 !!test
11676 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11677 !!options
11678 parsoid=wt2html,wt2wt
11679 !!wikitext
11680 {{echo|}}{| width = '100%'
11681 |foo
11682 |}
11683 !!html/parsoid
11684 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11685 <tbody><tr><td>foo</td></tr>
11686 </tbody></table>
11687 !!end
11688
11689 ## We used to, but no longer wt2wt this test since the default serializer
11690 ## will normalize the include directives to serialize on their own line.
11691 ## Selser will take care of preserving formatting in scenarios where they
11692 ## intermingled with other wikitext.
11693 !!test
11694 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11695 !!options
11696 parsoid=wt2html
11697 !!wikitext
11698 <includeonly>a</includeonly>{| {{{b}}}
11699 |c
11700 |}
11701 !!html/parsoid
11702 <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":""}]]}'>
11703 <tbody><tr><td>c</td></tr>
11704 </tbody></table>
11705 !!end
11706
11707 !! test
11708 Table wikitext syntax outside wiki-tables
11709 !! wikitext
11710 a
11711 |+ not a caption
11712 ! not a table heading
11713 |- not a table row
11714 | not a table cell
11715 | class="foo bar" | baz
11716 b
11717 |}
11718 |-
11719 c
11720 !! html
11721 <p>a
11722 |+ not a caption
11723 ! not a table heading
11724 |- not a table row
11725 | not a table cell
11726 | class="foo bar" | baz
11727 b
11728 |}
11729 |-
11730 c
11731 </p>
11732 !! end
11733
11734 ###
11735 ### Testing parsing of templates where a template arg
11736 ### has the same name as the template itself.
11737 ###
11738
11739 !! article
11740 Template:quote
11741 !! text
11742 {{{quote|{{{1}}}}}}
11743 !! endarticle
11744
11745 !!test
11746 Templates: Template Name/Arg clash: 1. Use of positional param
11747 !! wikitext
11748 {{quote|foo}}
11749 !! html
11750 <p>foo
11751 </p>
11752 !!end
11753
11754 !!test
11755 Templates: Template Name/Arg clash: 2. Use of named param
11756 !! wikitext
11757 {{quote|quote=foo}}
11758 !! html
11759 <p>foo
11760 </p>
11761 !!end
11762
11763 !!test
11764 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11765 !! wikitext
11766 {{quote|quote}}
11767 !! html
11768 <p>quote
11769 </p>
11770 !!end
11771
11772 ###
11773 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11774 ###
11775
11776 !!test
11777 Templates: 1. Simple use
11778 !! wikitext
11779 {{echo|Foo}}
11780 !! html
11781 <p>Foo
11782 </p>
11783 !!end
11784
11785 !!test
11786 Templates: 2. Inside a block tag
11787 !! wikitext
11788 <div>{{echo|Foo}}</div>
11789 <blockquote>{{echo|Foo}}</blockquote>
11790 !! html
11791 <div>Foo</div>
11792 <blockquote>Foo</blockquote>
11793
11794 !! html+tidy
11795 <div>Foo</div>
11796 <blockquote>
11797 <p>Foo</p>
11798 </blockquote>
11799 !!end
11800
11801 !!test
11802 Templates: P-wrapping: 1a. Templates on consecutive lines
11803 !! wikitext
11804 {{echo|Foo}}
11805 {{echo|bar}}
11806 !! html
11807 <p>Foo
11808 bar
11809 </p>
11810 !!end
11811
11812 !!test
11813 Templates: P-wrapping: 1b. Templates on consecutive lines
11814 !! wikitext
11815 Foo
11816
11817 {{echo|bar}}
11818 {{echo|baz}}
11819 !! html
11820 <p>Foo
11821 </p><p>bar
11822 baz
11823 </p>
11824 !!end
11825
11826 !!test
11827 Templates: P-wrapping: 1c. Templates on consecutive lines
11828 !! wikitext
11829 {{echo|Foo}}
11830 {{echo|bar}} <div>baz</div>
11831 !! html
11832 <p>Foo
11833 </p>
11834 bar <div>baz</div>
11835
11836 !! html+tidy
11837 <p>Foo</p>
11838 <p>bar</p>
11839 <div>baz</div>
11840 !! end
11841
11842 !!test
11843 Templates: P-wrapping: 1d. Template preceded by comment-only line
11844 !!options
11845 parsoid
11846 !! wikitext
11847 <!-- foo -->
11848 {{echo|Bar}}
11849 !! html
11850 <!-- foo -->
11851
11852 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11853 !!end
11854
11855 !!test
11856 Templates: Inline Text: 1. Multiple template uses
11857 !! wikitext
11858 {{echo|Foo}}bar{{echo|baz}}
11859 !! html
11860 <p>Foobarbaz
11861 </p>
11862 !!end
11863
11864 !!test
11865 Templates: Inline Text: 2. Back-to-back template uses
11866 !! wikitext
11867 {{echo|Foo}}{{echo|bar}}
11868 !! html
11869 <p>Foobar
11870 </p>
11871 !!end
11872
11873 !!test
11874 Templates: Block Tags: 1. Multiple template uses
11875 !! wikitext
11876 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11877 !! html
11878 <div>Foo</div><div>bar</div><div>baz</div>
11879
11880 !!end
11881
11882 !!test
11883 Templates: Block Tags: 2. Back-to-back template uses
11884 !! wikitext
11885 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11886 !! html
11887 <div>Foo</div><div>bar</div>
11888
11889 !!end
11890
11891 # This is an edge case relating to paragraph wrapping.
11892 !!test
11893 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11894 !! wikitext
11895 {{echo|a
11896 b</p>}}
11897 !! html/parsoid
11898 <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
11899 b</p>
11900 !!end
11901
11902 !!test
11903 Templates: Links: 1. Simple example
11904 !! wikitext
11905 {{echo|[[Foo|bar]]}}
11906 !! html
11907 <p><a href="/wiki/Foo" title="Foo">bar</a>
11908 </p>
11909 !!end
11910
11911 !!test
11912 Templates: Links: 2. Generation of link href
11913 !! wikitext
11914 [[{{echo|Foo}}|bar]]
11915 !! html
11916 <p><a href="/wiki/Foo" title="Foo">bar</a>
11917 </p>
11918 !!end
11919
11920 !!test
11921 Templates: Links: 3. Generation of part of a link href
11922 !! wikitext
11923 [[Fo{{echo|o}}|bar]]
11924
11925 [[Foo{{echo|bar}}]]
11926
11927 [[Foo{{echo|bar}}baz]]
11928
11929 [[Foo{{echo|bar}}|bar]]
11930
11931 [[:Foo{{echo|bar}}]]
11932
11933 [[:Foo{{echo|bar}}|bar]]
11934 !! html
11935 <p><a href="/wiki/Foo" title="Foo">bar</a>
11936 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11937 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11938 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11939 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11940 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11941 </p>
11942 !!end
11943
11944 !!test
11945 Templates: Links: 4. Multiple templates generating link href
11946 !! wikitext
11947 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11948 !! html
11949 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11950 </p>
11951 !!end
11952
11953 !!test
11954 Templates: Links: 5. Generation of link text
11955 !! wikitext
11956 [[Foo|{{echo|bar}}]]
11957 !! html
11958 <p><a href="/wiki/Foo" title="Foo">bar</a>
11959 </p>
11960 !!end
11961
11962 !!test
11963 Templates: Links: 5. Nested templates (only outermost template should be marked)
11964 !! wikitext
11965 {{echo|[[{{echo|Foo}}|bar]]}}
11966 !! html
11967 <p><a href="/wiki/Foo" title="Foo">bar</a>
11968 </p>
11969 !!end
11970
11971 !!test
11972 Templates: HTML Tag: 1. Generation of HTML attr. key
11973 !! wikitext
11974 <div {{echo|style}}="color:red;">foo</div>
11975 !! html
11976 <div style="color:red;">foo</div>
11977
11978 !!end
11979
11980 !!test
11981 Templates: HTML Tag: 2. Generation of HTML attr. value
11982 !! wikitext
11983 <div style={{echo|'color:red;'}}>foo</div>
11984 !! html
11985 <div style="color:red;">foo</div>
11986
11987 !!end
11988
11989 !!test
11990 Templates: HTML Tag: 3. Generation of HTML attr key and value
11991 !! wikitext
11992 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11993 !! html
11994 <div style="color:red;">foo</div>
11995
11996 !!end
11997
11998 !!test
11999 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12000 !! wikitext
12001 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12002 !! html
12003 <div title="This is a long title with just one piece templated">foo</div>
12004
12005 !!end
12006
12007 !!test
12008 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12009 !! wikitext
12010 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12011 !! html
12012 <div title="This is a long title with just one piece templated">foo</div>
12013
12014 !!end
12015
12016 !!test
12017 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12018 !! wikitext
12019 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12020 !! html
12021 <div title="This is a long title with just one piece templated">foo</div>
12022
12023 !!end
12024
12025 # SSS FIXME: While it is great we added support for all this,
12026 # do we want to make this part of the spec? Maybe we want to
12027 # deprecate this kind of usage in the future?
12028 !!test
12029 Templates: HTML Tag: 7. Generation of partial attribute key string
12030 !! wikitext
12031 <div st{{echo|yle}}="color:red;">foo</div>
12032 !! html
12033 <div style="color:red;">foo</div>
12034
12035 !!end
12036
12037 !! test
12038 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12039 !! wikitext
12040 <div {{echo|1=id="v1"}}>bar</div>
12041 !! html
12042 <div id="v1">bar</div>
12043
12044 !!end
12045
12046 !! test
12047 Templates: HTML Tag: 9. Multiple template-generated attributes
12048 !! wikitext
12049 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12050 !! html
12051 <div id="v1" title="foo">bar</div>
12052
12053 !!end
12054
12055 !! test
12056 Templates: Support for templates generating attributes and content
12057 !! wikitext
12058 {| {{mixed_attr_content_template}}
12059 |-
12060 |bar
12061 |}
12062 !! html/php
12063 <table style="color:red;" title="T48811">
12064
12065 <tr>
12066 <td>foo
12067 </td></tr>
12068 <tr>
12069 <td>bar
12070 </td></tr></table>
12071
12072 !! html/parsoid
12073 <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|}"]}'>
12074 <tbody><tr>
12075 <td>foo</td></tr>
12076 <tr>
12077 <td>bar</td></tr>
12078 </tbody></table>
12079 !!end
12080
12081 !! test
12082 1. Entities and nowikis inside templated attributes should be handled correctly
12083 !! wikitext
12084 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12085 !! html/php
12086 <div style="background:#f9f9f9;">foo</div>
12087
12088 !! html/parsoid
12089 <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>
12090 !! end
12091
12092 !! test
12093 2. Entities and nowikis inside templated attributes should be handled correctly
12094 !! wikitext
12095 {|
12096 |{{table_attribs_3}}
12097 |}
12098 !! html/php
12099 <table>
12100 <tr>
12101 <td style="background:#f9f9f9;">Foo
12102 </td></tr></table>
12103
12104 !! html/parsoid
12105 <table>
12106 <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>
12107 </tbody></table>
12108 !! end
12109
12110 !! test
12111 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12112 !! wikitext
12113 {{tbl-start}}
12114 |{{table_attribs_3}}
12115 {{tbl-end}}
12116 !! html/php
12117 <table>
12118 <tr>
12119 <td style="background:#f9f9f9;">Foo
12120 </td></tr></table>
12121
12122 !! html/parsoid
12123 <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}}]}'>
12124 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12125 </tbody></table>
12126 !! end
12127
12128 # T107622
12129 !! test
12130 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12131 !! wikitext
12132 {|
12133 | {{table_attribs_6}} hi
12134 |}
12135 !! html/php
12136 <table>
12137 <tr>
12138 <td style="background: red;"> hi
12139 </td></tr></table>
12140
12141 !! html/parsoid
12142 <table>
12143 <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>
12144 </tbody></table>
12145 !! end
12146
12147 !!test
12148 Templates: HTML Tables: 1. Generating start of a HTML table
12149 !! wikitext
12150 {{echo|<table><tr><td>foo</td>}}</tr></table>
12151 !! html
12152 <table><tr><td>foo</td></tr></table>
12153
12154 !!end
12155
12156 !!test
12157 Templates: HTML Tables: 2a. Generating middle of a HTML table
12158 !! wikitext
12159 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12160 !! html
12161 <table><tr><td>foo</td></tr></table>
12162
12163 !!end
12164
12165 !!test
12166 Templates: HTML Tables: 2b. Generating middle of a HTML table
12167 !! wikitext
12168 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12169 !! html
12170 <table><tr><td>foo</td></tr></table>
12171
12172 !!end
12173
12174 !!test
12175 Templates: HTML Tables: 3. Generating end of a HTML table
12176 !! wikitext
12177 <table><tr>{{echo|<td>foo</td></tr></table>}}
12178 !! html
12179 <table><tr><td>foo</td></tr></table>
12180
12181 !!end
12182
12183 !!test
12184 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12185 !! wikitext
12186 {{echo|<table>}}<tr><td>foo</td></tr></table>
12187 !! html
12188 <table><tr><td>foo</td></tr></table>
12189
12190 !!end
12191
12192 !!test
12193 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12194 !! wikitext
12195 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12196 !! html
12197 <table><tr><td>foo</td></tr></table>
12198
12199 !!end
12200
12201 !!test
12202 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12203 !! wikitext
12204 <table><tr>{{echo|<td>}}foo</td></tr></table>
12205 !! html
12206 <table><tr><td>foo</td></tr></table>
12207
12208 !!end
12209
12210 !!test
12211 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12212 !! wikitext
12213 <table><tr><td>foo{{echo|</td>}}</tr></table>
12214 !! html
12215 <table><tr><td>foo</td></tr></table>
12216
12217 !!end
12218
12219 !!test
12220 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12221 !! wikitext
12222 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12223 !! html
12224 <table><tr><td>foo</td></tr></table>
12225
12226 !!end
12227
12228 !!test
12229 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12230 !! wikitext
12231 <table><tr><td>foo</td></tr>{{echo|</table>}}
12232 !! html
12233 <table><tr><td>foo</td></tr></table>
12234
12235 !!end
12236
12237 !!test
12238 Templates: HTML Tables: 5. Proper fostering of categories from inside
12239 !!options
12240 parsoid=wt2html,wt2wt
12241 !! wikitext
12242 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12243 <!--Two categories (Bug 50330)-->
12244 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12245 !! html
12246 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12247 <!--Two categories (Bug 50330)-->
12248 <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>
12249 !!end
12250
12251 !!test
12252 Templates: Wiki Tables: 1a. Fostering of entire template content
12253 !! wikitext
12254 {|
12255 {{echo|a}}
12256 |}
12257 !! html
12258 <table>
12259 a
12260 <tr><td></td></tr></table>
12261
12262 !! html+tidy
12263 <p>a</p>
12264 <table>
12265 <tr>
12266 <td></td>
12267 </tr>
12268 </table>
12269 !! end
12270
12271 !!test
12272 Templates: Wiki Tables: 1b. Fostering of entire template content
12273 !! wikitext
12274 {|
12275 {{echo|<div>}}
12276 foo
12277 {{echo|</div>}}
12278 |}
12279 !! html
12280 <table>
12281 <div>
12282 <p>foo
12283 </p>
12284 </div>
12285 <tr><td></td></tr></table>
12286
12287 !! html+tidy
12288 <div>
12289 <p>foo</p>
12290 </div>
12291 <table>
12292 <tr>
12293 <td></td>
12294 </tr>
12295 </table>
12296 !! end
12297
12298 !!test
12299 Templates: Wiki Tables: 2. Fostering of partial template content
12300 !! wikitext
12301 {|
12302 {{echo|a
12303 <div>b</div>}}
12304 |}
12305 !! html
12306 <table>
12307 a
12308 <div>b</div>
12309 <tr><td></td></tr></table>
12310
12311 !! html+tidy
12312 <p>a</p>
12313 <div>b</div>
12314 <table>
12315 <tr>
12316 <td></td>
12317 </tr>
12318 </table>
12319 !! end
12320
12321 !!test
12322 Templates: Wiki Tables: 3. td-content via multiple templates
12323 !! wikitext
12324 {|
12325 {{echo|{{pipe}}a}}{{echo|b}}
12326 |}
12327 !! html
12328 <table>
12329 <tr>
12330 <td>ab
12331 </td></tr></table>
12332
12333 !!end
12334
12335 !!test
12336 Templates: Wiki Tables: 4. Templated tags, no content
12337 !! wikitext
12338 {{tbl-start}}
12339 {{tbl-end}}
12340 !! html
12341 <table>
12342 <tr><td></td></tr></table>
12343
12344 !!end
12345
12346 !!test
12347 Templates: Wiki Tables: 5. Templated tags, regular 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 !!test
12361 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12362 !! wikitext
12363 {{tbl-start}}
12364 {{!}}foo
12365 {{tbl-end}}
12366 !! html
12367 <table>
12368 <tr>
12369 <td>foo
12370 </td></tr></table>
12371
12372 !!end
12373
12374 ## This test case is very specific to Parsoid's internals
12375 ## and is hence only tested for Parsoid's code. Parsoid uses
12376 ## a <meta> marker tag for <ref> tags and they are expanded
12377 ## much later. We are verifying that this <meta> tag usage
12378 ## doesn't prevent foster parenting.
12379 !!test
12380 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12381 !!wikitext
12382 {{PartialTable}}<ref>foo</ref>
12383 |}
12384
12385 <references />
12386 !!html/parsoid
12387 <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">
12388 <tbody>
12389 </tbody></table>
12390
12391 <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>
12392 !!end
12393
12394 !! test
12395 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12396 !! wikitext
12397 {{echo|
12398 {{{!}}
12399 {{!}}-}}
12400 <onlyinclude>
12401 |foo
12402 </onlyinclude>
12403 {{!}}}
12404 !! html/parsoid
12405 <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{{!}}}"]}'>
12406 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12407 <tbody><tr>
12408
12409 <td>foo
12410 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12411 </tbody></table>
12412 !! end
12413
12414 !!test
12415 Templates: Lists: Multi-line list-items via templates
12416 !! wikitext
12417 *{{echo|a {{nonexistent|
12418 unused}}}}
12419 *{{echo|b {{nonexistent|
12420 unused}}}}
12421 !! html
12422 <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>
12423 <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>
12424
12425 !!end
12426
12427 !!test
12428 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12429 !! wikitext
12430 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12431 !! html
12432 <p><i>ab</i>c<i>d</i>e
12433 </p>
12434 !!end
12435
12436 !!test
12437 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12438 (PHP parser generates misnested html)
12439 !! wikitext
12440 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12441 !! html/parsoid
12442 <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>
12443 !!end
12444
12445 !!test
12446 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12447 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12448 !! options
12449 parsoid=wt2html,wt2wt
12450 !! wikitext
12451 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12452 !! html
12453 <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>
12454 <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>
12455 <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>
12456 !!end
12457
12458 !!test
12459 Templates: Ugly nesting: 4. Divs opened/closed across templates
12460 !! wikitext
12461 a<div>b{{echo|c</div>d}}e
12462 !! html
12463 a<div>bc</div>de
12464
12465 !! html+tidy
12466 <p>a</p>
12467 <div>bc</div>
12468 <p>de</p>
12469 !! end
12470
12471 !!test
12472 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12473 (Parsoid-centric)
12474 !! options
12475 parsoid
12476 !! wikitext
12477 {|
12478 |{{echo|foo</table>}}
12479 |bar
12480 |}
12481 !! html
12482 <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|}"]}'>
12483
12484 <tbody>
12485 <tr>
12486 <td>foo</td></tr></tbody></table><span about="#mwt1">
12487 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12488 |}</span>
12489 !!end
12490
12491 !!test
12492 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12493 (Parsoid-centric)
12494 !! options
12495 parsoid
12496 !! wikitext
12497 <table>
12498 <tr>
12499 <td>
12500 <table>
12501 <tr>
12502 <td>1. {{echo|foo </table>}}</td>
12503 <td> bar </td>
12504 <td>2. {{echo|baz </table>}}</td>
12505 </tr>
12506 <tr>
12507 <td>abc</td>
12508 </tr>
12509 </table>
12510 </td>
12511 </tr>
12512 <tr>
12513 <td>xyz</td>
12514 </tr>
12515 </table>
12516 !! html
12517 <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>"]}'>
12518 <tbody><tr>
12519 <td>
12520 <table>
12521 <tbody><tr>
12522 <td>1. foo </td></tr></tbody></table></td>
12523 <td> bar </td>
12524 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12525 </span><span about="#mwt2">
12526 </span><span about="#mwt2">
12527 </span><span about="#mwt2">abc</span><span about="#mwt2">
12528 </span><span about="#mwt2">
12529 </span><span about="#mwt2">
12530 </span><span about="#mwt2">
12531 </span><span about="#mwt2">
12532 </span><span about="#mwt2">
12533 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12534 </span><span about="#mwt2">
12535 </span>
12536 !!end
12537
12538 !! test
12539 Templates: Ugly templates: 3. newline-only template parameter
12540 !! wikitext
12541 foo {{echo|
12542 }}
12543 !! html
12544 <p>foo
12545 </p>
12546 !! end
12547
12548 # This looks like a bug: a single newline triggers p/br for some reason.
12549 !! test
12550 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12551 !! wikitext
12552 {{echo|
12553 }}
12554 !! html
12555 <p><br />
12556 </p>
12557 !! end
12558
12559 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12560 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12561 !! test
12562 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12563 !! wikitext
12564 {{echo|<table>}}
12565 {{echo|<div>foo}}
12566 {{echo|</table>}}
12567 !! html/parsoid
12568 <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
12569 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12570 </table>
12571 !! end
12572
12573 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12574 # that are "identical" and generate nesting cycles in the algorithm
12575 !! test
12576 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12577 !! wikitext
12578 {{echo|<table><tr><td><table>}}
12579 {{echo|<div>}}
12580 {{echo|</div>}}
12581 !! html/parsoid
12582 <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"}'>
12583 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12584 </table></td></tr></tbody></table>
12585 !! end
12586
12587 !! test
12588 Templates: Parameters substituted at the top-level
12589 !! wikitext
12590 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12591
12592 {{{foo|bar|baz}}}
12593 !! html/php
12594 <p><i>who</i> me? <b>never!</b>
12595 </p><p>bar
12596 </p>
12597 !! html/parsoid
12598 <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>
12599
12600 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
12601 !! end
12602
12603 !!test
12604 Parser Functions: 1. Simple example
12605 !! wikitext
12606 {{uc:foo}}
12607 !! html
12608 <p>FOO
12609 </p>
12610 !!end
12611
12612 !!test
12613 Parser Functions: 2. Nested use (only outermost should be marked up)
12614 !! wikitext
12615 {{uc:{{lc:FOO}}}}
12616 !! html
12617 <p>FOO
12618 </p>
12619 !!end
12620
12621 ###
12622 ### Pre-save transform tests
12623 ###
12624 !! test
12625 pre-save transform: subst:
12626 !! options
12627 pst
12628 !! wikitext
12629 {{subst:test}}
12630 !! html/php
12631 This is a test template
12632 !! end
12633
12634 !! test
12635 pre-save transform: normal template
12636 !! options
12637 pst
12638 !! wikitext
12639 {{test}}
12640 !! html/php
12641 {{test}}
12642 !! end
12643
12644 !! test
12645 pre-save transform: nonexistent template
12646 !! options
12647 pst
12648 !! wikitext
12649 {{thistemplatedoesnotexist}}
12650 !! html/php
12651 {{thistemplatedoesnotexist}}
12652 !! end
12653
12654 !! test
12655 pre-save transform: subst magic variables
12656 !! options
12657 pst
12658 !! wikitext
12659 {{subst:SITENAME}}
12660 !! html/php
12661 MediaWiki
12662 !! end
12663
12664 # This is bug 89, which I fixed. -- wtm
12665 !! test
12666 pre-save transform: subst: templates with parameters
12667 !! options
12668 pst
12669 !! wikitext
12670 {{subst:paramtest|param="something else"}}
12671 !! html/php
12672 This is a test template with parameter "something else"
12673 !! end
12674
12675 !! article
12676 Template:nowikitest
12677 !! text
12678 <nowiki>'''not wiki'''</nowiki>
12679 !! endarticle
12680
12681 !! test
12682 pre-save transform: nowiki in subst (bug 1188)
12683 !! options
12684 pst
12685 !! wikitext
12686 {{subst:nowikitest}}
12687 !! html/php
12688 <nowiki>'''not wiki'''</nowiki>
12689 !! end
12690
12691 !! article
12692 Template:commenttest
12693 !! text
12694 This template has <!-- a comment --> in it.
12695 !! endarticle
12696
12697 !! test
12698 pre-save transform: comment in subst (bug 1936)
12699 !! options
12700 pst
12701 !! wikitext
12702 {{subst:commenttest}}
12703 !! html/php
12704 This template has <!-- a comment --> in it.
12705 !! end
12706
12707 !! test
12708 pre-save transform: unclosed tag
12709 !! options
12710 pst
12711 !! wikitext
12712 <nowiki>'''not wiki'''
12713 !! html/php
12714 <nowiki>'''not wiki'''
12715 !! end
12716
12717 !! test
12718 pre-save transform: mixed tag case
12719 !! options
12720 pst
12721 !! wikitext
12722 <NOwiki>'''not wiki'''</noWIKI>
12723 !! html/php
12724 <NOwiki>'''not wiki'''</noWIKI>
12725 !! end
12726
12727 !! test
12728 pre-save transform: unclosed comment in <nowiki>
12729 !! options
12730 pst
12731 !! wikitext
12732 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12733 !! html/php
12734 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12735 !!end
12736
12737 # Leading @ in this template definition works around a limitation
12738 # in parsoid's parserTests which otherwise strips the <span> from the
12739 # result (confusing it for a template wrapper)
12740 !! article
12741 Template:dangerous
12742 !!text
12743 @<span onmouseover="alert('crap')">Oh no</span>
12744 !!endarticle
12745
12746 !!test
12747 (confirming safety of fix for subst bug 1936)
12748 !! wikitext
12749 {{Template:dangerous}}
12750 !! html
12751 <p>@<span>Oh no</span>
12752 </p>
12753 !! end
12754
12755 !! test
12756 pre-save transform: comment containing gallery (bug 5024)
12757 !! options
12758 pst
12759 !! wikitext
12760 <!-- <gallery>data</gallery> -->
12761 !! html/php
12762 <!-- <gallery>data</gallery> -->
12763 !!end
12764
12765 !! test
12766 pre-save transform: comment containing extension
12767 !! options
12768 pst
12769 !! wikitext
12770 <!-- <tag>data</tag> -->
12771 !! html/php
12772 <!-- <tag>data</tag> -->
12773 !!end
12774
12775 !! test
12776 pre-save transform: comment containing nowiki
12777 !! options
12778 pst
12779 !! wikitext
12780 <!-- <nowiki>data</nowiki> -->
12781 !! html/php
12782 <!-- <nowiki>data</nowiki> -->
12783 !!end
12784
12785 !! test
12786 pre-save transform: <noinclude> in subst (bug 3298)
12787 !! options
12788 pst
12789 !! wikitext
12790 {{subst:Includes}}
12791 !! html/php
12792 Foobar
12793 !! end
12794
12795 !! test
12796 pre-save transform: <onlyinclude> in subst (bug 3298)
12797 !! options
12798 pst
12799 !! wikitext
12800 {{subst:Includes2}}
12801 !! html/php
12802 Foo
12803 !! end
12804
12805 !! article
12806 Template:SubstTest
12807 !!text
12808 {{<includeonly>subst:</includeonly>Includes}}
12809 !! endarticle
12810
12811 !! article
12812 Template:SafeSubstTest
12813 !! text
12814 {{<includeonly>safesubst:</includeonly>Includes}}
12815 !! endarticle
12816
12817 !! test
12818 bug 22297: safesubst: works during PST
12819 !! options
12820 pst
12821 !! wikitext
12822 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12823 !! html/php
12824 FoobarFoobar
12825 !! end
12826
12827 !! test
12828 bug 22297: safesubst: works during normal parse
12829 !! wikitext
12830 {{SafeSubstTest}}
12831 !! html
12832 <p>Foobar
12833 </p>
12834 !! end
12835
12836 !! test
12837 subst: does not work during normal parse
12838 !! wikitext
12839 {{SubstTest}}
12840 !! html
12841 <p>{{subst:Includes}}
12842 </p>
12843 !! end
12844
12845 !! test
12846 pre-save transform: context links ("pipe trick")
12847 !! options
12848 pst
12849 !! wikitext
12850 [[Article (context)|]]
12851 [[Bar:Article|]]
12852 [[:Bar:Article|]]
12853 [[Bar:Article (context)|]]
12854 [[:Bar:Article (context)|]]
12855 [[|Article]]
12856 [[|Article (context)]]
12857 [[Bar:X (Y) Z|]]
12858 [[:Bar:X (Y) Z|]]
12859 !! html/php
12860 [[Article (context)|Article]]
12861 [[Bar:Article|Article]]
12862 [[:Bar:Article|Article]]
12863 [[Bar:Article (context)|Article]]
12864 [[:Bar:Article (context)|Article]]
12865 [[Article]]
12866 [[Article (context)]]
12867 [[Bar:X (Y) Z|X (Y) Z]]
12868 [[:Bar:X (Y) Z|X (Y) Z]]
12869 !! end
12870
12871 !! test
12872 pre-save transform: context links ("pipe trick") with interwiki prefix
12873 !! options
12874 pst
12875 !! wikitext
12876 [[interwiki:Article|]]
12877 [[:interwiki:Article|]]
12878 [[interwiki:Bar:Article|]]
12879 [[:interwiki:Bar:Article|]]
12880 !! html/php
12881 [[interwiki:Article|Article]]
12882 [[:interwiki:Article|Article]]
12883 [[interwiki:Bar:Article|Bar:Article]]
12884 [[:interwiki:Bar:Article|Bar:Article]]
12885 !! end
12886
12887 !! test
12888 pre-save transform: context links ("pipe trick") with parens in title
12889 !! options
12890 pst title=[[Somearticle (context)]]
12891 !! wikitext
12892 [[|Article]]
12893 !! html/php
12894 [[Article (context)|Article]]
12895 !! end
12896
12897 !! test
12898 pre-save transform: context links ("pipe trick") with comma in title
12899 !! options
12900 pst title=[[Someplace, Somewhere]]
12901 !! wikitext
12902 [[|Otherplace]]
12903 [[Otherplace, Elsewhere|]]
12904 [[Otherplace, Elsewhere, Anywhere|]]
12905 !! html/php
12906 [[Otherplace, Somewhere|Otherplace]]
12907 [[Otherplace, Elsewhere|Otherplace]]
12908 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12909 !! end
12910
12911 !! test
12912 pre-save transform: context links ("pipe trick") with parens and comma
12913 !! options
12914 pst title=[[Someplace (IGNORED), Somewhere]]
12915 !! wikitext
12916 [[|Otherplace]]
12917 [[Otherplace (place), Elsewhere|]]
12918 !! html/php
12919 [[Otherplace, Somewhere|Otherplace]]
12920 [[Otherplace (place), Elsewhere|Otherplace]]
12921 !! end
12922
12923 !! test
12924 pre-save transform: context links ("pipe trick") with comma and parens
12925 !! options
12926 pst title=[[Who, me? (context)]]
12927 !! wikitext
12928 [[|Yes, you.]]
12929 [[Me, Myself, and I (1937 song)|]]
12930 !! html/php
12931 [[Yes, you. (context)|Yes, you.]]
12932 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12933 !! end
12934
12935 !! test
12936 pre-save transform: context links ("pipe trick") with namespace
12937 !! options
12938 pst title=[[Ns:Somearticle]]
12939 !! wikitext
12940 [[|Article]]
12941 !! html/php
12942 [[Ns:Article|Article]]
12943 !! end
12944
12945 !! test
12946 pre-save transform: context links ("pipe trick") with namespace and parens
12947 !! options
12948 pst title=[[Ns:Somearticle (context)]]
12949 !! wikitext
12950 [[|Article]]
12951 !! html/php
12952 [[Ns:Article (context)|Article]]
12953 !! end
12954
12955 !! test
12956 pre-save transform: context links ("pipe trick") with namespace and comma
12957 !! options
12958 pst title=[[Ns:Somearticle, Context, Whatever]]
12959 !! wikitext
12960 [[|Article]]
12961 !! html/php
12962 [[Ns:Article, Context, Whatever|Article]]
12963 !! end
12964
12965 !! test
12966 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12967 !! options
12968 pst title=[[Ns:Somearticle, Context (context)]]
12969 !! wikitext
12970 [[|Article]]
12971 !! html/php
12972 [[Ns:Article (context)|Article]]
12973 !! end
12974
12975 !! test
12976 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12977 !! options
12978 pst title=[[Ns:Somearticle (IGNORED), Context]]
12979 !! wikitext
12980 [[|Article]]
12981 !! html/php
12982 [[Ns:Article, Context|Article]]
12983 !! end
12984
12985 !! test
12986 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12987 !! options
12988 pst
12989 !! wikitext
12990 [[Article(context)|]]
12991 [[Bar:Article(context)|]]
12992 [[:Bar:Article(context)|]]
12993 [[|Article(context)]]
12994 [[Bar:X(Y)Z|]]
12995 [[:Bar:X(Y)Z|]]
12996 !! html/php
12997 [[Article(context)|Article]]
12998 [[Bar:Article(context)|Article]]
12999 [[:Bar:Article(context)|Article]]
13000 [[Article(context)]]
13001 [[Bar:X(Y)Z|X(Y)Z]]
13002 [[:Bar:X(Y)Z|X(Y)Z]]
13003 !! end
13004
13005 !! test
13006 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
13007 !! options
13008 pst
13009 !! wikitext
13010 [[Article (context)|]]
13011 [[Bar:Article (context)|]]
13012 [[:Bar:Article (context)|]]
13013 [[|Article (context)]]
13014 [[Bar:X (Y) Z|]]
13015 [[:Bar:X (Y) Z|]]
13016 !! html/php
13017 [[Article (context)|Article]]
13018 [[Bar:Article (context)|Article]]
13019 [[:Bar:Article (context)|Article]]
13020 [[Article (context)]]
13021 [[Bar:X (Y) Z|X (Y) Z]]
13022 [[:Bar:X (Y) Z|X (Y) Z]]
13023 !! end
13024
13025 !! test
13026 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
13027 !! options
13028 pst
13029 !! wikitext
13030 [[Article(context)|]]
13031 [[Bar:Article(context)|]]
13032 [[:Bar:Article(context)|]]
13033 [[|Article(context)]]
13034 [[Bar:X(Y)Z|]]
13035 [[:Bar:X(Y)Z|]]
13036 !! html/php
13037 [[Article(context)|Article]]
13038 [[Bar:Article(context)|Article]]
13039 [[:Bar:Article(context)|Article]]
13040 [[Article(context)]]
13041 [[Bar:X(Y)Z|X(Y)Z]]
13042 [[:Bar:X(Y)Z|X(Y)Z]]
13043 !! end
13044
13045 !! test
13046 pre-save transform: context links ("pipe trick") with commas (bug 21660)
13047 !! options
13048 pst
13049 !! wikitext
13050 [[Article (context), context|]]
13051 [[Article (context),context|]]
13052 [[Bar:Article (context), context|]]
13053 [[Bar:Article (context),context|]]
13054 [[:Bar:Article (context), context|]]
13055 [[:Bar:Article (context),context|]]
13056 !! html/php
13057 [[Article (context), context|Article]]
13058 [[Article (context),context|Article]]
13059 [[Bar:Article (context), context|Article]]
13060 [[Bar:Article (context),context|Article]]
13061 [[:Bar:Article (context), context|Article]]
13062 [[:Bar:Article (context),context|Article]]
13063 !! end
13064
13065 !! test
13066 pre-save transform: trim trailing empty lines
13067 !! options
13068 pst
13069 !! wikitext
13070 Empty lines are trimmed
13071
13072
13073
13074
13075 !! html/php
13076 Empty lines are trimmed
13077 !! end
13078
13079 !! test
13080 pre-save transform: Signature expansion
13081 !! options
13082 pst
13083 !! wikitext
13084 * ~~~
13085 * <noinclude>~~~</noinclude>
13086 * <includeonly>~~~</includeonly>
13087 * <onlyinclude>~~~</onlyinclude>
13088 !! html/php
13089 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13090 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13091 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13092 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13093 !! end
13094
13095
13096 !! test
13097 pre-save transform: Signature expansion in nowiki tags (bug 93)
13098 !! options
13099 pst disabled
13100 !! wikitext
13101 Shall not expand:
13102
13103 <nowiki>~~~~</nowiki>
13104
13105 <includeonly><nowiki>~~~~</nowiki></includeonly>
13106
13107 <noinclude><nowiki>~~~~</nowiki></noinclude>
13108
13109 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13110
13111 {{subst:Foo}} shall be converted to FOO
13112
13113 As well as inside noinclude/onlyinclude
13114 <noinclude>{{subst:Foo}}</noinclude>
13115 <onlyinclude>{{subst:Foo}}</onlyinclude>
13116
13117 But not inside includeonly
13118 <includeonly>{{subst:Foo}}</includeonly>
13119 !! html/php
13120 Shall not expand:
13121
13122 <nowiki>~~~~</nowiki>
13123
13124 <includeonly><nowiki>~~~~</nowiki></includeonly>
13125
13126 <noinclude><nowiki>~~~~</nowiki></noinclude>
13127
13128 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13129
13130 FOO shall be converted to FOO
13131
13132 As well as inside noinclude/onlyinclude
13133 <noinclude>FOO</noinclude>
13134 <onlyinclude>FOO</onlyinclude>
13135
13136 But not inside includeonly
13137 <includeonly>{{subst:Foo}}</includeonly>
13138 !! end
13139
13140 !! test
13141 Parsoid: Recognize nowiki with trailing space in tags
13142 !! options
13143 parsoid=wt2html
13144 !! wikitext
13145 <nowiki ><div>[[foo]]</nowiki >
13146
13147 a<nowiki / >b
13148
13149 c<nowiki />d
13150
13151 e<nowiki/ >f
13152 !! html
13153 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13154 <p>ab</p>
13155 <p>cd</p>
13156 <p>ef</p>
13157 !! end
13158
13159 !! test
13160 Parsoid: Recognize nowiki with odd capitalization
13161 !! options
13162 parsoid=wt2html
13163 !! wikitext
13164 <noWikI ><div>[[foo]]</Nowiki >
13165 !! html
13166 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13167 !! end
13168
13169
13170 !! test
13171 Parsoid: Escape nowiki with trailing space in tags
13172 !! options
13173 parsoid=html2wt
13174 !! html/parsoid
13175 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13176 <p>a&lt;nowiki /&gt;b</p>
13177 <p>c&lt;nowiki/ &gt;d</p>
13178 !! wikitext
13179 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13180
13181 a&lt;nowiki /&gt;b
13182
13183 c&lt;nowiki/ &gt;d
13184 !! end
13185
13186 !! test
13187 Parsoid: Escape weird noWikI capitalizations
13188 !! options
13189 parsoid=html2wt
13190 !! html/parsoid
13191 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13192 !! wikitext
13193 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13194 !! end
13195
13196 ###
13197 ### Message transform tests
13198 ###
13199 !! test
13200 message transform: magic variables
13201 !! options
13202 msg
13203 !! wikitext
13204 {{SITENAME}}
13205 !! html
13206 MediaWiki
13207 !! end
13208
13209 !! test
13210 message transform: should not transform wiki markup
13211 !! options
13212 msg
13213 !! wikitext
13214 ''test''
13215 !! html
13216 ''test''
13217 !! end
13218
13219 !! test
13220 message transform: <noinclude> in transcluded template (bug 4926)
13221 !! options
13222 msg
13223 !! wikitext
13224 {{Includes}}
13225 !! html
13226 Foobar
13227 !! end
13228
13229 !! test
13230 message transform: <onlyinclude> in transcluded template (bug 4926)
13231 !! options
13232 msg
13233 !! wikitext
13234 {{Includes2}}
13235 !! html
13236 Foo
13237 !! end
13238
13239 !! test
13240 {{#special:}} page name, known
13241 !! options
13242 msg
13243 !! wikitext
13244 {{#special:Recentchanges}}
13245 !! html
13246 Special:RecentChanges
13247 !! end
13248
13249 !! test
13250 {{#special:}} page name with subpage, known
13251 !! options
13252 msg
13253 !! wikitext
13254 {{#special:Recentchanges/param}}
13255 !! html
13256 Special:RecentChanges/param
13257 !! end
13258
13259 !! test
13260 {{#special:}} page name, unknown
13261 !! options
13262 msg
13263 !! wikitext
13264 {{#special:foobar nonexistent}}
13265 !! html
13266 Special:Foobar nonexistent
13267 !! end
13268
13269 !! test
13270 {{#speciale:}} page name, known
13271 !! options
13272 msg
13273 !! wikitext
13274 {{#speciale:Recentchanges}}
13275 !! html
13276 Special:RecentChanges
13277 !! end
13278
13279 !! test
13280 {{#speciale:}} page name with subpage, known
13281 !! options
13282 msg
13283 !! wikitext
13284 {{#speciale:Recentchanges/param}}
13285 !! html
13286 Special:RecentChanges/param
13287 !! end
13288
13289 !! test
13290 {{#speciale:}} page name, unknown
13291 !! options
13292 msg
13293 !! wikitext
13294 {{#speciale:foobar nonexistent}}
13295 !! html
13296 Special:Foobar_nonexistent
13297 !! end
13298
13299 ###
13300 ### Images
13301 ###
13302 ### For Parsoid-specific tests, see
13303 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13304
13305 !! test
13306 Simple image
13307 !! options
13308 parsoid=wt2html,wt2wt,html2html
13309 !! wikitext
13310 [[Image:foobar.jpg]]
13311 !! html/php
13312 <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>
13313 </p>
13314 !! html/parsoid
13315 <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>
13316 !! end
13317
13318 !! test
13319 Simple image (using File: namespace, now canonical)
13320 !! wikitext
13321 [[File:Foobar.jpg]]
13322 !! html/php
13323 <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>
13324 </p>
13325 !! html/parsoid
13326 <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>
13327 !! end
13328
13329 !! test
13330 Right-aligned image
13331 !! wikitext
13332 [[File:Foobar.jpg|right]]
13333 !! html/php
13334 <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>
13335
13336 !! html/parsoid
13337 <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>
13338 !! end
13339
13340 !! test
13341 Image with caption
13342 !! wikitext
13343 [[File:Foobar.jpg|right|Caption text]]
13344 !! html/php
13345 <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>
13346
13347 !! html/parsoid
13348 <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>
13349 !! end
13350
13351 !! test
13352 Image with caption, bug 53312 #1
13353 !! wikitext
13354 [[File:Foobar.jpg|right|Caption page stuff]]
13355 !! html/php
13356 <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>
13357
13358 !! html/parsoid
13359 <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>
13360 !! end
13361
13362 !! test
13363 Image with caption, bug 53312 #2
13364 !! wikitext
13365 [[File:Foobar.jpg|right|Caption page=]]
13366 !! html/php
13367 <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>
13368
13369 !! html/parsoid
13370 <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>
13371 !! end
13372
13373 !! test
13374 Image with caption, bug 53312 #3
13375 !! wikitext
13376 [[File:Foobar.jpg|right|Caption page=stuff]]
13377 !! html/php
13378 <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>
13379
13380 !! html/parsoid
13381 <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>
13382 !! end
13383
13384 !! test
13385 Allow empty links in image captions (Bug 60753)
13386 !! options
13387 thumbsize=220
13388 !! wikitext
13389 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13390 [[]]
13391 [[Link2]]
13392 ]]
13393 !! html/php
13394 <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>
13395
13396 !! html/parsoid
13397 <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>
13398 [[]]
13399 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13400 </figcaption></figure>
13401 !! end
13402
13403 !! test
13404 Titles in unlinked images (T23454)
13405 !! wikitext
13406 [[File:Foobar.jpg|link=|stuff]]
13407 !! html/php
13408 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13409 </p>
13410 !! end
13411
13412 !! test
13413 Link with empty target
13414 !! wikitext
13415 [[]]
13416 !! html
13417 <p>[[]]
13418 </p>
13419 !! end
13420
13421 !! test
13422 Image with link trail
13423 !! wikitext
13424 Linktrails should not work for images: [[File:Foobar.jpg]]s
13425 !! html/php
13426 <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
13427 </p>
13428 !! html/parsoid
13429 <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>
13430 !! end
13431
13432 !! test
13433 Image with empty attribute
13434 !! options
13435 parsoid=wt2html,wt2wt,html2html
13436 !! wikitext
13437 [[File:Foobar.jpg|right||Caption text]]
13438 !! html/php
13439 <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>
13440
13441 !! html/parsoid
13442 <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>
13443 !! end
13444
13445 !! test
13446 1. Block image with individual attributes from templates
13447 !! wikitext
13448 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13449 !! html/php
13450 <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>
13451
13452 !! html/parsoid
13453 <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>
13454 !! end
13455
13456 !! test
13457 2. Block Image with individual attributes from templates
13458 !! wikitext
13459 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13460 !! html/php
13461 <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>
13462
13463 !! html/parsoid
13464 <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>
13465 !! end
13466
13467 !! test
13468 3. Inline image with individual attributes from templates
13469 !! wikitext
13470 [[File:Foobar.jpg|{{echo|50px}}]]
13471 !! html/php
13472 <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>
13473 </p>
13474 !! html/parsoid
13475 <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>
13476 !! end
13477
13478 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13479 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13480 !! test
13481 Image with multiple attributes from the same template
13482 !! wikitext
13483 [[File:Foobar.jpg|{{image_attribs}}]]
13484 !! html/php
13485 <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>
13486
13487 !! html/parsoid
13488 <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>
13489 !! end
13490
13491 !! test
13492 Image with link tails
13493 !! options
13494 thumbsize=220
13495 !! wikitext
13496 123[[File:Foobar.jpg]]456
13497 123[[File:Foobar.jpg|right]]456
13498 123[[File:Foobar.jpg|thumb]]456
13499 !! html/php
13500 <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
13501 </p>
13502 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
13503 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
13504
13505 !! html/php+tidy
13506 <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>
13507 <p>123</p>
13508 <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>
13509 <p>456 123</p>
13510 <div class="thumb tright">
13511 <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>
13512 <div class="thumbcaption">
13513 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13514 </div>
13515 </div>
13516 </div>
13517 <p>456</p>
13518 !! html/parsoid
13519 <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>
13520 <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>
13521 <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>
13522 !! end
13523
13524 !! test
13525 Image with multiple captions -- only last one is accepted
13526 !! wikitext
13527 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13528 !! html/php
13529 <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>
13530
13531 !! html/parsoid
13532 <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>
13533 !! end
13534
13535 !! test
13536 Image with multiple widths -- use last
13537 !! wikitext
13538 [[File:Foobar.jpg|200px|300px|caption]]
13539 !! html/php
13540 <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>
13541 </p>
13542 !! html/parsoid
13543 <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>
13544 !! end
13545
13546 !! test
13547 Image with multiple alignments -- use first (bug 48664)
13548 !! options
13549 thumbsize=220
13550 !! wikitext
13551 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13552
13553 [[File:Foobar.jpg|middle|text-top|caption]]
13554 !! html/php
13555 <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>
13556 <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>
13557 </p>
13558 !! html/parsoid
13559 <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>
13560 <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>
13561 !! end
13562
13563 !! test
13564 Image with width attribute at different positions
13565 !! wikitext
13566 [[File:Foobar.jpg|200px|right|Caption]]
13567 [[File:Foobar.jpg|right|200px|Caption]]
13568 [[File:Foobar.jpg|right|Caption|200px]]
13569 !! html/php
13570 <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>
13571 <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>
13572 <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>
13573
13574 !! html/parsoid
13575 <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>
13576 <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>
13577 <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>
13578 !! end
13579
13580 # a sad bit of backward-compatibility
13581 !! test
13582 Image with size specified with pxpx (bug 13500, 51628)
13583 !! options
13584 parsoid=wt2html,wt2wt,html2html
13585 !! wikitext
13586 [[File:Foobar.jpg|20pxpx]]
13587 [[File:Foobar.jpg|200x20pxpx]]
13588 !! html/php
13589 <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>
13590 <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>
13591 </p>
13592 !! html/parsoid
13593 <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>
13594 !! end
13595
13596 !! test
13597 Image with link parameter, wiki target
13598 !! wikitext
13599 [[File:Foobar.jpg|link=Main Page]]
13600 !! html/php
13601 <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>
13602 </p>
13603 !! html/parsoid
13604 <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>
13605 !! end
13606
13607 # parsoid bug 49293 (part 1)
13608 !! test
13609 Image with link parameter, URL target
13610 !! wikitext
13611 [[File:Foobar.jpg|link=http://example.com/]]
13612 !! html/php
13613 <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>
13614 </p>
13615 !! html/parsoid
13616 <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>
13617 !! end
13618
13619 # parsoid bug 49293 (part 2)
13620 !! test
13621 Image with link parameter, protocol-less URL target
13622 !! wikitext
13623 [[File:Foobar.jpg|link=//example.com/]]
13624 !! html/php
13625 <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>
13626 </p>
13627 !! html/parsoid
13628 <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>
13629 !! end
13630
13631 !! test
13632 Escaping non-block captions (T107435)
13633 !! options
13634 parsoid={
13635 "modes": ["wt2wt"],
13636 "changes": [
13637 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13638 ]
13639 }
13640 !! wikitext
13641 [[Image:Foobar.jpg|caption]]
13642 !! wikitext/edited
13643 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13644 !! end
13645
13646 # wgExternalLinkTarget not supported by Parsoid
13647 !! test
13648 Image with link parameter, wgExternalLinkTarget
13649 !! wikitext
13650 [[Image:foobar.jpg|link=http://example.com/]]
13651 !! config
13652 wgExternalLinkTarget='foobar'
13653 !! html/php
13654 <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>
13655 </p>
13656 !! end
13657
13658 !! test
13659 Image with link parameter, wgNoFollowLinks set to false
13660 !! wikitext
13661 [[Image:foobar.jpg|link=http://example.com/]]
13662 !! config
13663 wgNoFollowLinks=false
13664 !! html
13665 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13666 </p>
13667 !! end
13668
13669 !! test
13670 Image with link parameter, wgNoFollowDomainExceptions
13671 !! wikitext
13672 [[Image:foobar.jpg|link=http://example.com/]]
13673 !! config
13674 wgNoFollowDomainExceptions='example.com'
13675 !! html
13676 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13677 </p>
13678 !! end
13679
13680 # wgExternalLinkTarget not supported by Parsoid
13681 !! test
13682 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13683 !! wikitext
13684 [[Image:foobar.jpg|link=http://example.com/|Title]]
13685 !! config
13686 wgExternalLinkTarget='foobar'
13687 !! html/php
13688 <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>
13689 </p>
13690 !! end
13691
13692 !! test
13693 Image with empty link parameter
13694 !! wikitext
13695 [[File:Foobar.jpg|link=]]
13696 !! html/php
13697 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13698 </p>
13699 !! html/parsoid
13700 <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>
13701 !! end
13702
13703 !! test
13704 Image with link parameter (wiki target) and unnamed parameter
13705 !! wikitext
13706 [[File:Foobar.jpg|link=Main_Page|Title]]
13707 !! html/php
13708 <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>
13709 </p>
13710 !! html/parsoid
13711 <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>
13712 !! end
13713
13714 !! test
13715 Image with link parameter (URL target) and unnamed parameter
13716 !! wikitext
13717 [[File:Foobar.jpg|link=http://example.com/|Title]]
13718 !! html/php
13719 <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>
13720 </p>
13721 !! html/parsoid
13722 <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>
13723 !! end
13724
13725 !! test
13726 Thumbnail image with link parameter
13727 !! options
13728 thumbsize=220
13729 parsoid=wt2html,wt2wt,html2html
13730 !! wikitext
13731 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13732 !! html/php
13733 <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>
13734
13735 !! html/parsoid
13736 <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>
13737 !! end
13738
13739 !! test
13740 Manually-specified thumbnail image
13741 !! options
13742 thumbsize=220
13743 !! wikitext
13744 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13745 !! html/php
13746 <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>
13747
13748 !! html/parsoid
13749 <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>
13750 !! end
13751
13752 !! test
13753 Manually-specified thumbnail image with explicit link to wiki page
13754 !! options
13755 thumbsize=220
13756 parsoid=wt2html,wt2wt,html2html
13757 !! wikitext
13758 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13759 !! html/php
13760 <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>
13761
13762 !! html/parsoid
13763 <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>
13764 !! end
13765
13766 !! test
13767 Manually-specified thumbnail image with explicit link to url
13768 !! options
13769 thumbsize=220
13770 parsoid=wt2html,wt2wt,html2html
13771 !! wikitext
13772 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13773 !! html/php
13774 <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>
13775
13776 !! html/parsoid
13777 <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>
13778 !! end
13779
13780 !! test
13781 Manually-specified thumbnail image with explicit no link
13782 !! options
13783 thumbsize=220
13784 parsoid=wt2html,wt2wt,html2html
13785 !! wikitext
13786 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13787 !! html/php
13788 <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>
13789
13790 !! html/parsoid
13791 <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>
13792 !! end
13793
13794 !! test
13795 Manually-specified thumbnail image with explicit link and alt text
13796 !! options
13797 thumbsize=220
13798 parsoid=wt2html,wt2wt,html2html
13799 !! wikitext
13800 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13801 !! html/php
13802 <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>
13803
13804 !! html/parsoid
13805 <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>
13806 !! end
13807
13808 !! test
13809 Image with frame and link
13810 !! options
13811 parsoid=wt2html,wt2wt,html2html
13812 !! wikitext
13813 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13814 !! html/php
13815 <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>
13816
13817 !! html/parsoid
13818 <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>
13819 !! end
13820
13821 !! test
13822 Image with frame and link and explicit alt
13823 !! options
13824 parsoid=wt2html,wt2wt,html2html
13825 !! wikitext
13826 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13827 !! html/php
13828 <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>
13829
13830 !! html/parsoid
13831 <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>
13832 !! end
13833
13834 !! test
13835 Image with wiki markup in implicit alt
13836 !! wikitext
13837 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13838
13839 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13840 !! html/php
13841 <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>
13842 </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>
13843 </p>
13844 !! html/parsoid
13845 <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>
13846
13847 <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>
13848 !! end
13849
13850 !! test
13851 Alt image option should handle most kinds of wikitext without barfing
13852 !! wikitext
13853 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13854 !! html/php
13855 <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>
13856
13857 !! html/parsoid
13858 <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>
13859 !! end
13860
13861 ###################
13862 # Conflicting image format options.
13863 # First option specified should 'win'.
13864 # All three cases in each test should be identical.
13865
13866 !! test
13867 Image with 'frameless' first.
13868 !! options
13869 parsoid=wt2html,wt2wt,html2html
13870 !! wikitext
13871 [[File:Foobar.jpg|frameless|caption]]
13872
13873 [[File:Foobar.jpg|frameless|frame|caption]]
13874
13875 [[File:Foobar.jpg|frameless|thumb|caption]]
13876 !! html/php
13877 <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>
13878 </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>
13879 </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>
13880 </p>
13881 !! html/parsoid
13882 <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>
13883 <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>
13884 <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>
13885 !! end
13886
13887 !! test
13888 Image with 'frame' first.
13889 !! options
13890 parsoid=wt2html,wt2wt,html2html
13891 !! wikitext
13892 [[File:Foobar.jpg|frame|caption]]
13893 [[File:Foobar.jpg|frame|frameless|caption]]
13894 [[File:Foobar.jpg|frame|thumb|caption]]
13895 !! html/php
13896 <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>
13897 <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>
13898 <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>
13899
13900 !! html/parsoid
13901 <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>
13902 <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>
13903 <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>
13904 !! end
13905
13906 !! test
13907 Image with 'thumb' first.
13908 !! options
13909 parsoid=wt2html,wt2wt,html2html
13910 !! wikitext
13911 [[File:Foobar.jpg|thumb|caption]]
13912 [[File:Foobar.jpg|thumb|frameless|caption]]
13913 [[File:Foobar.jpg|thumb|frame|caption]]
13914 !! html/php
13915 <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>
13916 <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>
13917 <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>
13918
13919 !! html/parsoid
13920 <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>
13921 <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>
13922 <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>
13923 !! end
13924
13925 ###################
13926 # Image sizing.
13927 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13928 # and https://phabricator.wikimedia.org/T64258
13929 # Foobar has actual size of 1941x220
13930 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13931 # a scalable format.
13932 # 2. Framed images always ignore size options; always render at default size.
13933 # 3. "Unspecified format" and border are the only types which can be
13934 # enlarged.
13935
13936 !! test
13937 Image: "unspecified format" and border enlarge
13938 !! options
13939 parsoid=wt2html,wt2wt,html2html
13940 !! wikitext
13941 [[File:Foobar.jpg|2000px]]
13942
13943 [[File:Foobar.jpg|border|2000px]]
13944 !! html/php
13945 <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>
13946 </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>
13947 </p>
13948 !! html/parsoid
13949 <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>
13950 <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>
13951 !! end
13952
13953 !! test
13954 Image: "unspecified format" and border reduce
13955 !! options
13956 parsoid=wt2html,wt2wt,html2html
13957 !! wikitext
13958 [[File:Foobar.jpg|1000px]]
13959
13960 [[File:Foobar.jpg|border|1000px]]
13961 !! html/php
13962 <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>
13963 </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>
13964 </p>
13965 !! html/parsoid
13966 <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>
13967 <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>
13968 !! end
13969
13970 !! test
13971 Image: thumbs reduce
13972 !! options
13973 parsoid=wt2html,wt2wt,html2html
13974 !! wikitext
13975 [[File:Foobar.jpg|thumb|50px]]
13976 !! html/php
13977 <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>
13978
13979 !! html/parsoid
13980 <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>
13981 !! end
13982
13983 !! test
13984 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13985 !! options
13986 parsoid=wt2html,wt2wt,html2html
13987 !! wikitext
13988 [[File:Foobar.jpg|thumb|2000px]]
13989
13990 [[File:Foobar.svg|thumb|2000px]]
13991 !! html/php
13992 <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>
13993 <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>
13994
13995 !! html/parsoid
13996 <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>
13997 <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>
13998 !! end
13999
14000 !! test
14001 Image: frameless can reduce in size
14002 !! options
14003 parsoid=wt2html,wt2wt,html2html
14004 !! wikitext
14005 [[File:Foobar.jpg|frameless|50px]]
14006 !! html/php
14007 <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>
14008 </p>
14009 !! html/parsoid
14010 <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>
14011 !! end
14012
14013 !! test
14014 Image: bitmap frameless can't be enlarged past original size, but vector can
14015 !! options
14016 parsoid=wt2html,wt2wt,html2html
14017 !! wikitext
14018 [[File:Foobar.jpg|frameless|2000px]]
14019
14020 [[File:Foobar.svg|frameless|2000px]]
14021 !! html/php
14022 <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>
14023 </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>
14024 </p>
14025 !! html/parsoid
14026 <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>
14027 <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>
14028 !! end
14029
14030 !! test
14031 Image: framed images are always unscaled.
14032 !! options
14033 parsoid=wt2html,wt2wt,html2html
14034 !! wikitext
14035 [[File:Foobar.jpg|frame]]
14036
14037 [[File:Foobar.jpg|frame|50px]]
14038
14039 [[File:Foobar.jpg|frame|50x50px]]
14040
14041 [[File:Foobar.jpg|frame|2000px]]
14042 !! html/php
14043 <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>
14044 <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>
14045 <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>
14046 <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>
14047
14048 !! html/parsoid
14049 <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>
14050 <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>
14051 <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>
14052 <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>
14053 !! end
14054
14055 ###################
14056
14057 !! test
14058 Link to image page- image page normally doesn't exists, hence edit link
14059 Add test with existing image page
14060 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14061 !! wikitext
14062 [[:Image:test]]
14063 !! html
14064 <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>
14065 </p>
14066 !! end
14067
14068 !! test
14069 bug 18784 Link to non-existent image page with caption should use caption as link text
14070 !! wikitext
14071 [[:Image:test|caption]]
14072 !! html
14073 <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>
14074 </p>
14075 !! end
14076
14077 !! test
14078 Frameless image caption with a free URL
14079 !! wikitext
14080 [[File:Foobar.jpg|http://example.com]]
14081 !! html/php
14082 <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>
14083 </p>
14084 !! html/parsoid
14085 <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>
14086 !! end
14087
14088 !! test
14089 Thumbnail image caption with a free URL
14090 !! options
14091 thumbsize=220
14092 !! wikitext
14093 [[File:Foobar.jpg|thumb|http://example.com]]
14094 !! html/php
14095 <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>
14096
14097 !! html/parsoid
14098 <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>
14099 !! end
14100
14101 !! test
14102 Thumbnail image caption with a free URL and explicit alt
14103 !! options
14104 thumbsize=220
14105 parsoid=wt2html,wt2wt,html2html
14106 !! wikitext
14107 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14108 !! html/php
14109 <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>
14110
14111 !! html/parsoid
14112 <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>
14113 !! end
14114
14115 !! test
14116 SVG thumbnails with no language set
14117 !! options
14118 !! wikitext
14119 [[File:Foobar.svg|thumb|caption]]
14120 !! html/php
14121 <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>
14122
14123 !! html/parsoid
14124 <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>
14125 !! end
14126
14127 !! test
14128 SVG thumbnails with language de
14129 !! options
14130 parsoid=wt2html,wt2wt,html2html
14131 !! wikitext
14132 [[File:Foobar.svg|thumb|caption|lang=de]]
14133 !! html/php
14134 <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>
14135
14136 !! html/parsoid
14137 <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>
14138 !! end
14139
14140 !! test
14141 SVG thumbnails with invalid language code
14142 !! options
14143 parsoid=wt2html,wt2wt,html2html
14144 !! wikitext
14145 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14146 !! html/php
14147 <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>
14148
14149 !! html/parsoid
14150 <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>
14151 !! end
14152
14153 !! test
14154 BUG 1887: A ISBN with a thumbnail
14155 !! wikitext
14156 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14157 !! html/php
14158 <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>
14159
14160 !! html/parsoid
14161 <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>
14162 !! end
14163
14164 !! test
14165 BUG 1887: A RFC with a thumbnail
14166 !! wikitext
14167 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14168 !! html/php
14169 <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>
14170
14171 !! html/parsoid
14172 <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>
14173 !! end
14174
14175 !! test
14176 BUG 1887: A mailto link with a thumbnail
14177 !! wikitext
14178 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14179 !! html/php
14180 <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>
14181
14182 !! html/parsoid
14183 <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>
14184 !! end
14185
14186 # Pending resolution to bug 368
14187 !! test
14188 BUG 648: Frameless image caption with a link
14189 !! wikitext
14190 [[File:Foobar.jpg|text with a [[link]] in it]]
14191 !! html/php
14192 <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>
14193 </p>
14194 !! html/parsoid
14195 <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>
14196 !! end
14197
14198 !! test
14199 BUG 648: Frameless image caption with a link (suffix)
14200 !! wikitext
14201 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14202 !! html/php
14203 <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>
14204 </p>
14205 !! html/parsoid
14206 <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>
14207 !! end
14208
14209 !! test
14210 BUG 648: Frameless image caption with an interwiki link
14211 !! wikitext
14212 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14213 !! html/php
14214 <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>
14215 </p>
14216 !! html/parsoid
14217 <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>
14218 !! end
14219
14220 !! test
14221 BUG 648: Frameless image caption with a piped interwiki link
14222 !! wikitext
14223 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14224 !! html/php
14225 <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>
14226 </p>
14227 !! html/parsoid
14228 <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>
14229 !! end
14230
14231 !! test
14232 T107474: Frameless image caption with <nowiki>
14233 !! wikitext
14234 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14235 !! html/parsoid
14236 <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>
14237 !! end
14238
14239 !! test
14240 Escape HTML special chars in image alt text
14241 !! wikitext
14242 [[File:Foobar.jpg|& < > "]]
14243 !! html/php
14244 <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>
14245 </p>
14246 !! html/parsoid
14247 <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>
14248 !! end
14249
14250 !! test
14251 Escape HTML special chars in image alt text with LanguageConverter
14252 !! options
14253 language=zh
14254 !! wikitext
14255 [[File:Foobar.jpg|& < > "]]
14256 !! html/php
14257 <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>
14258 </p>
14259 !! html/parsoid
14260 <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>
14261 !! end
14262
14263 !! test
14264 Entities in file name and attributes
14265 !! wikitext
14266 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14267 !! html/php
14268 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14269 </p>
14270 !! html/parsoid
14271 <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>
14272 !! end
14273
14274 !! test
14275 BUG 499: Alt text should have &#1234;, not &amp;1234;
14276 !! wikitext
14277 [[File:Foobar.jpg|&#9792;]]
14278 !! html/php
14279 <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>
14280 </p>
14281 !! html/parsoid
14282 <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>
14283 !! end
14284
14285 !! test
14286 Broken image caption with link
14287 !! options
14288 parsoid=wt2html,wt2wt,html2html
14289 !! wikitext
14290 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14291 !! html/php
14292 <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.
14293 </p>
14294 !! html/parsoid
14295 <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>
14296 !! end
14297
14298 !! test
14299 Image caption containing another image
14300 !! wikitext
14301 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14302 !! html/php
14303 <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>
14304
14305 !! html/parsoid
14306 <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>
14307 !! end
14308
14309 !! test
14310 Image: caption containing a newline
14311 !! wikitext
14312 [[File:Foobar.jpg|This
14313 *is some text]]
14314 !! html/php
14315 <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>
14316 </p>
14317 !! html/parsoid
14318 <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>
14319 !!end
14320
14321 !!test
14322 Image: caption containing leading space
14323 (The leading space should not trigger nowiki escaping in wt2wt mode)
14324 !! wikitext
14325 [[File:Foobar.jpg|thumb| bar]]
14326 !! html/php
14327 <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>
14328
14329 !! html/parsoid
14330 <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>
14331 !!end
14332
14333 !! test
14334 Image: caption containing a table
14335 !! options
14336 parsoid=wt2html,wt2wt,html2html
14337 !! wikitext
14338 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14339 {|
14340 ! Foo !! Bar
14341 |-
14342 | Foo1 || Bar1
14343 |}
14344 and some more text.]]
14345 !! html/php
14346 <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>
14347
14348 !! html/parsoid
14349 <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
14350 <table>
14351 <tbody>
14352 <tr><th>Foo </th><th>Bar</th></tr>
14353 <tr>
14354 <td>Foo1 </td>
14355 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14356 !! end
14357
14358 !! test
14359 Bug 3090: External links other than http: in image captions
14360 !! wikitext
14361 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14362 !! html/php
14363 <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>
14364
14365 !! html/parsoid
14366 <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>
14367 !! end
14368
14369 !! test
14370 Custom class
14371 !! options
14372 parsoid=wt2html,wt2wt,html2html
14373 !! wikitext
14374 [[Image:foobar.jpg|a|class=b]]
14375 !! html/php
14376 <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>
14377 </p>
14378 !! html/parsoid
14379 <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>
14380 !! end
14381
14382 !! test
14383 Localized image handling (1).
14384 !! options
14385 parsoid=wt2html,wt2wt,html2html
14386 language=es
14387 !! wikitext
14388 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14389 !! html/php
14390 <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>
14391
14392 !! html/parsoid
14393 <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>
14394 !! end
14395
14396 !! test
14397 Localized image handling (2).
14398 !! options
14399 thumbsize=220
14400 parsoid=wt2html,wt2wt,html2html
14401 language=es
14402 !! wikitext
14403 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14404 !! html/php
14405 <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>
14406
14407 !! html/parsoid
14408 <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>
14409 !! end
14410
14411 !! test
14412 Localized image handling (3).
14413 !! options
14414 language=fa
14415 parsoid=html2wt
14416 !! html/parsoid
14417 <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>
14418 !! wikitext
14419 [[File:Foobar.jpg|بندانگشتی]]
14420 !! end
14421
14422 !! test
14423 "border", "frameless" and "class" attributes on an image.
14424 !! options
14425 thumbsize=220
14426 parsoid=wt2html,wt2wt,html2html
14427 !! wikitext
14428 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14429 !! html/php
14430 <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>
14431 </p>
14432 !! html/parsoid
14433 <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>
14434 !! end
14435
14436 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14437 !! test
14438 Invalid image attributes (bug 62500)
14439 !! options
14440 thumbsize=220
14441 parsoid=wt2html,wt2wt,html2html
14442 !! wikitext
14443 [[File:Foobar.jpg|thumb|float|left|caption]]
14444
14445 [[File:Foobar.jpg|thumb|righ|caption]]
14446
14447 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14448 !! html/php
14449 <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>
14450 <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>
14451 <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>
14452
14453 !! html/parsoid
14454 <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>
14455 <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>
14456 <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>
14457 !! end
14458
14459 !! article
14460 File:Barfoo.jpg
14461 !! text
14462 #REDIRECT [[File:Barfoo.jpg]]
14463 !! endarticle
14464
14465 # FIXME: Parsoid should run this test -- but we'd need to teach the
14466 # mockAPI about the redirected Barfoo.jpg image.
14467 !! test
14468 Redirected image
14469 !! wikitext
14470 [[Image:Barfoo.jpg]]
14471 !! html/php
14472 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14473 </p>
14474 !! end
14475
14476 !! test
14477 Missing image with uploads disabled
14478 !! options
14479 wgEnableUploads=0
14480 !! wikitext
14481 [[File:Foobaz.jpg]]
14482 !! html/php
14483 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14484 </p>
14485 !! html/parsoid
14486 <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>
14487 !! end
14488
14489 # Parsoid-specific testing for images
14490 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14491 # Currently imperfect due to a flaw in the Parsoid testrunner
14492 # Work in progress
14493 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14494 # image tests.
14495
14496 !! test
14497 Parsoid-specific image handling - simple image with size and middle alignment
14498 !! wikitext
14499 [[File:Foobar.jpg|middle|50px]]
14500 !! html/parsoid
14501 <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>
14502 !! end
14503
14504 !! test
14505 Parsoid-specific image handling - simple image with size, middle alignment,
14506 non-standard namespace alias
14507 !! options
14508 parsoid=wt2wt,wt2html,html2html
14509 !! wikitext
14510 [[Image:Foobar.jpg|middle|50px]]
14511 !! html/parsoid
14512 <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>
14513 !! end
14514
14515 !! test
14516 Parsoid-specific image handling - simple image with size and middle alignment
14517 (existing content)
14518 !! wikitext
14519 [[File:Foobar.jpg|50px|middle]]
14520 !! html/parsoid
14521 <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>
14522 !! end
14523
14524 !! test
14525 Parsoid-specific image handling - simple image with size and middle alignment
14526 and non-standard namespace name
14527 !! options
14528 parsoid=wt2html,wt2wt,html2html
14529 !! wikitext
14530 [[Image:Foobar.jpg|50px|middle]]
14531 !! html/parsoid
14532 <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>
14533 !! end
14534
14535 !! test
14536 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14537 !! wikitext
14538 [[File:Foobar.jpg|500x10px|baseline|caption]]
14539 !! html/parsoid
14540 <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>
14541 !! end
14542
14543 !! test
14544 Parsoid-specific image handling - simple image with border and size spec
14545 !! wikitext
14546 [[File:Foobar.jpg|50px|border|caption]]
14547 !! html/parsoid
14548 <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>
14549 !! end
14550
14551 !! test
14552 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14553 !! wikitext
14554 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14555 !! html/parsoid
14556 <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>
14557 !! end
14558
14559 !! test
14560 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14561 (existing content)
14562 !! wikitext
14563 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14564 !! html/parsoid
14565 <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>
14566 !! end
14567
14568 !! test
14569 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14570 !! wikitext
14571 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14572 !! html/parsoid
14573 <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>
14574 !! end
14575
14576 !! test
14577 Parsoid-specific image handling - thumbnail with specific size, halign,
14578 valign, and caption (existing content)
14579 !! wikitext
14580 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14581 !! html/parsoid
14582 <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>
14583 !! end
14584
14585 !! test
14586 Parsoid-specific image handling - framed image with specific size and caption
14587 (size is ignored)
14588 !! options
14589 parsoid=wt2html,wt2wt,html2html
14590 !! wikitext
14591 [[File:Foobar.jpg|frame|500x50px|caption]]
14592 !! html/parsoid
14593 <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>
14594 !! end
14595
14596 !! test
14597 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14598 (size is ignored)
14599 !! options
14600 parsoid=wt2html,wt2wt,html2html
14601 !! wikitext
14602 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14603 !! html/parsoid
14604 <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>
14605 !! end
14606
14607 !! test
14608 Parsoid-specific image handling - frameless image with specific size, border, and caption
14609 !! wikitext
14610 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14611 !! html/parsoid
14612 <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>
14613 !! end
14614
14615 !! test
14616 Parsoid-specific image handling - simple image with a formatted caption
14617 !! wikitext
14618 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14619 !! html/parsoid
14620 <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>
14621 !! end
14622
14623 !! test
14624 Parsoid-specific image handling - caption with a template in it
14625 !! wikitext
14626 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14627 !! html/parsoid
14628 <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>
14629 !! end
14630
14631 !! test
14632 Parsoid-specific image handling - caption with unbalanced tags in it
14633 !! options
14634 parsoid=wt2html,wt2wt,html2html
14635 !! wikitext
14636 foo
14637 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14638 bar
14639 !! html/parsoid
14640 <p>foo</p>
14641 <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>
14642 <p>bar</p>
14643 !! end
14644
14645 !! test
14646 Parsoid-specific image handling - empty caption (1)
14647 !! options
14648 parsoid=wt2html,wt2wt
14649 !! wikitext
14650 [[File:Foobar.jpg|thumb|]]
14651 !! html/parsoid
14652 <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>
14653 !! end
14654
14655 # empty captions don't get serialized unless we're in the "round trip" case
14656 !! test
14657 Parsoid-specific image handling - empty caption (2)
14658 !! options
14659 parsoid=html2wt
14660 !! html/parsoid
14661 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14662 <a href="./File:Foobar.jpg">
14663 <img resource="./File:Foobar.jpg"
14664 src="//example.com/images/3/3a/Foobar.jpg"
14665 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14666 height="25" width="220"/>
14667 </a>
14668 <figcaption></figcaption>
14669 </figure>
14670 !! wikitext
14671 [[File:Foobar.jpg|thumb]]
14672 !! end
14673
14674 !! test
14675 Parsoid-specific image handling - whitespace caption
14676 !! wikitext
14677 [[File:Foobar.jpg|thumb| ]]
14678 !! html/parsoid
14679 <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>
14680 !! end
14681
14682 !! test
14683 Parsoid-specific image handling - lang option
14684 !! wikitext
14685 foo
14686 [[File:Foobar.svg|lang=de|caption]]
14687 bar
14688 !! html/parsoid
14689 <p>foo
14690 <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>
14691 bar</p>
14692 !! end
14693
14694 ## Edge case bugs in Parsoid from T93580
14695 !! test
14696 T93580: 1. Templated <ref> inside block images
14697 !! wikitext
14698 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14699
14700 <references />
14701 !! html/parsoid
14702 <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>
14703
14704 <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>
14705 !! end
14706
14707 !! test
14708 T93580: 2. <ref> inside inline images
14709 !! wikitext
14710 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14711
14712 <references />
14713 !! html/parsoid
14714 <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>
14715
14716 <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>
14717 !! end
14718
14719 !! test
14720 T93580: 3. Templated <ref> inside inline images
14721 !! wikitext
14722 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14723
14724 <references />
14725 !! html/parsoid
14726 <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>
14727
14728 <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>
14729 !! end
14730
14731 ###
14732 ### Subpages
14733 ###
14734 !! article
14735 Subpage test/subpage
14736 !! text
14737 foo
14738 !! endarticle
14739
14740 !! test
14741 Subpage link
14742 !! options
14743 subpage title=[[Subpage test]]
14744 !! wikitext
14745 [[/subpage]]
14746 !! html
14747 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14748 </p>
14749 !! end
14750
14751 !! test
14752 Subpage noslash link
14753 !! options
14754 subpage title=[[Subpage test]]
14755 !! wikitext
14756 [[/subpage/]]
14757 !! html
14758 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14759 </p>
14760 !! end
14761
14762 !! article
14763 Subpage test/1/2/subpage
14764 !! text
14765 blah
14766 !! endarticle
14767
14768 !! test
14769 Relative subpage noslash link
14770 !! options
14771 parsoid=wt2wt,wt2html,html2html
14772 subpage title=[[Subpage test/1/2/3/4]]
14773 !! wikitext
14774 [[../../subpage/]]
14775
14776 [[../../subpage]]
14777 !! html/php
14778 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14779 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14780 </p>
14781 !! html/parsoid
14782 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14783 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14784 !! end
14785
14786 !! test
14787 Parsoid: dot-slash prefixed wikilinks
14788 !! wikitext
14789 [[./foo]]
14790
14791 [[././bar]]
14792
14793 [[././baz/]]
14794 !! html/php
14795 <p>[[./foo]]
14796 </p><p>[[././bar]]
14797 </p><p>[[././baz/]]
14798 </p>
14799 !! html/parsoid
14800 <p>[[./foo]]
14801 </p><p>[[././bar]]
14802 </p><p>[[././baz/]]
14803 </p>
14804 !! end
14805
14806 !! test
14807 Render invalid page names as plain text (bug 51090)
14808 !! wikitext
14809 [[./../foo|bar]]
14810 [[foo�|bar]]
14811 [[foo/.|bar]]
14812 [[foo/..|bar]]
14813 [[foo~~~bar]]
14814 [[foo>bar]]
14815 [[foo[bar]]
14816 [[.]]
14817 [[..]]
14818 [[foo././bar]]
14819
14820 [[{{echo|./../foo}}|bar]]
14821 [[{{echo|foo/.}}|bar]]
14822 [[{{echo|foo/..}}|bar]]
14823 [[{{echo|foo~~~~bar}}]]
14824 [[{{echo|foo>bar}}]]
14825 [[{{echo|foo././bar}}]]
14826 [[{{echo|foo{bar}}]]
14827 [[{{echo|foo}bar}}]]
14828 [[{{echo|foo[bar}}]]
14829 [[{{echo|foo]bar}}]]
14830 [[{{echo|foo<bar}}]]
14831 !!html/php
14832 <p>[[./../foo|bar]]
14833 [[foo�|bar]]
14834 [[foo/.|bar]]
14835 [[foo/..|bar]]
14836 [[foo~~~bar]]
14837 [[foo&gt;bar]]
14838 [[foo[bar]]
14839 [[.]]
14840 [[..]]
14841 [[foo././bar]]
14842 </p><p>[[./../foo|bar]]
14843 [[foo/.|bar]]
14844 [[foo/..|bar]]
14845 [[foo~~~~bar]]
14846 [[foo&gt;bar]]
14847 [[foo././bar]]
14848 [[foo{bar]]
14849 [[foo}bar]]
14850 [[foo[bar]]
14851 [[foo]bar]]
14852 [[foo&lt;bar]]
14853 </p>
14854 !!html/parsoid
14855 <p>[[./../foo|bar]]
14856 [[foo�|bar]]
14857 [[foo/.|bar]]
14858 [[foo/..|bar]]
14859 [[foo~~~bar]]
14860 [[foo>bar]]
14861 [[foo[bar]]
14862 [[.]]
14863 [[..]]
14864 [[foo././bar]]</p>
14865
14866 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14867 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14868 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14869 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14870 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14871 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14872 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14873 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14874 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14875 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14876 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;bar"}},"i":0}}]}'>foo&lt;bar</span>]]</p>
14877 !!end
14878
14879 !! test
14880 Disabled subpages
14881 !! wikitext
14882 [[/subpage]]
14883 !! html
14884 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14885 </p>
14886 !! end
14887
14888 !! test
14889 BUG 561: {{/Subpage}}
14890 !! options
14891 subpage title=[[Page]]
14892 !! wikitext
14893 {{/Subpage}}
14894 !! html
14895 <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>
14896 </p>
14897 !! end
14898
14899 ###
14900 ### Categories
14901 ###
14902 !! article
14903 Category:MediaWiki User's Guide
14904 !! text
14905 blah
14906 !! endarticle
14907
14908 !! test
14909 Link to category
14910 !! wikitext
14911 [[:Category:MediaWiki User's Guide]]
14912 !! html
14913 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14914 </p>
14915 !! end
14916
14917 !! test
14918 Simple category
14919 !! options
14920 cat
14921 !! wikitext
14922 [[Category:MediaWiki User's Guide]]
14923 !! html/php
14924 cat=MediaWiki_User's_Guide sort=
14925 !! html/parsoid
14926 <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"}}'/>
14927 !! end
14928
14929 !! test
14930 PAGESINCATEGORY invalid title fatal (r33546 fix)
14931 !! wikitext
14932 {{PAGESINCATEGORY:<bogus>}}
14933 !! html
14934 <p>0
14935 </p>
14936 !! end
14937
14938 !! test
14939 Category with different sort key
14940 !! options
14941 cat
14942 !! wikitext
14943 [[Category:MediaWiki User's Guide|Foo]]
14944 !! html/php
14945 cat=MediaWiki_User's_Guide sort=Foo
14946 !! html/parsoid
14947 <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"}}'/>
14948 !! end
14949
14950 !! test
14951 Category with identical sort key
14952 !! options
14953 cat
14954 !! wikitext
14955 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14956 !! html/php
14957 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
14958 !! html/parsoid
14959 <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"}}'/>
14960 !! end
14961
14962 !! test
14963 Category with empty sort key
14964 !! options
14965 cat
14966 pst
14967 !! wikitext
14968 [[Category:MediaWiki User's Guide|]]
14969 !! html/php
14970 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14971 !! end
14972
14973 !! test
14974 Category with empty sort key and parentheses
14975 !! options
14976 cat
14977 pst
14978 !! wikitext
14979 [[Category:Foo (bar)|]]
14980 !! html/php
14981 [[Category:Foo (bar)|Foo]]
14982 !! end
14983
14984 !! test
14985 Category with link tail
14986 !! options
14987 cat
14988 pst
14989 !! wikitext
14990 123[[Category:Foo]]456
14991 !! html/php
14992 123[[Category:Foo]]456
14993 !! end
14994
14995 !! test
14996 Category with template
14997 !! options
14998 cat
14999 pst
15000 !! wikitext
15001 [[Category:{{echo|Foo}}]]
15002 !! html/php
15003 [[Category:{{echo|Foo}}]]
15004 !! end
15005
15006 !! test
15007 Category with template in sort key
15008 !! options
15009 cat
15010 pst
15011 !! wikitext
15012 [[Category:Foo|{{echo|Bar}}]]
15013 !! html/php
15014 [[Category:Foo|{{echo|Bar}}]]
15015 !! end
15016
15017 !! test
15018 Category with template in sort key and title
15019 !! options
15020 cat
15021 pst
15022 !! wikitext
15023 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15024 !! html/php
15025 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15026 !! end
15027
15028 ## We used to, but no longer wt2wt this test since the default serializer
15029 ## will normalize all categories to serialize on their own line.
15030 ## This wikitext usage is going to be fairly uncommon in production and
15031 ## selser will take care of preserving formatting in those scenarios.
15032 !! test
15033 Category / paragraph interactions
15034 !! options
15035 parsoid=wt2html
15036 !! wikitext
15037 Foo [[Category:Baz]] Bar
15038
15039 Foo [[Category:Baz]]
15040 Bar
15041
15042 Foo
15043 [[Category:Baz]]
15044 Bar
15045
15046 Foo
15047 [[Category:Baz]] Bar
15048
15049 Foo
15050 [[Category:Baz]]
15051 [[Category:Baz]]
15052 [[Category:Baz]]
15053 Bar
15054
15055 [[Category:Baz]]
15056 [[Category:Baz]]
15057 [[Category:Baz]]
15058
15059 [[Category:Baz]]
15060 {{echo|[[Category:Baz]]}}
15061 [[Category:Baz]]
15062 !! html/php
15063 <p>Foo Bar
15064 </p><p>Foo
15065 Bar
15066 </p><p>Foo
15067 Bar
15068 </p><p>Foo Bar
15069 </p><p>Foo
15070 Bar
15071 </p>
15072 !! html/parsoid
15073 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15074 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15075 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15076 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15077 <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>
15078 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15079 !! end
15080
15081 ## We used to, but no longer wt2wt this test since the default serializer
15082 ## will normalize all categories to serialize on their own line.
15083 ## This wikitext usage is going to be fairly uncommon in production and
15084 ## selser will take care of preserving formatting in those scenarios.
15085 ##
15086 ## The whitespace on the empty line is part of the test. Please do not delete
15087 !! test
15088 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
15089 !! options
15090 parsoid=wt2html
15091 !! wikitext
15092 This
15093
15094 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15095
15096 {{echo|[[Category:Foo]] and so should this!}}
15097 !! html/php
15098 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15099 </p>
15100 !! html/parsoid
15101 <p>This
15102
15103 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15104
15105 <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>
15106 !! end
15107
15108 ## Parsoid will not try to wt2wt this while preserving newlines because
15109 ## it suppresses excess newlines within list items -- and we don't want to
15110 ## introduce a special case just for categories, which is, in reality somewhat
15111 ## odd behavior -- categories are unlikely to be used in list items like this
15112 ## in top-level pages and are only likely to show up in template-generated
15113 ## list items where this RT-ing is a non-issue.
15114 ##
15115 ## The whitespace on the empty line is part of the test. Please do not delete
15116 !! test
15117 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
15118 !! options
15119 parsoid=wt2html
15120 !! wikitext
15121 * This
15122
15123 [[Category:Foo]] and this should be part of the same list item
15124 * So should this
15125
15126 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15127 !! html
15128 <ul><li>This and this should be part of the same list item</li>
15129 <li>So should this and this should be part of the same list item</li></ul>
15130 !! html/parsoid
15131 <ul>
15132 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15133 <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>
15134 </ul>
15135 !! end
15136
15137 ## Newlines and categories that follow the last item of a list
15138 ## are treated differently because this (list followed by categories)
15139 ## is an extremely common pattern on wikis.
15140 !! test
15141 3. Categories and newlines: newline suppression for last list item should RT properly
15142 !! wikitext
15143 * a
15144 * b
15145
15146 [[Category:Foo]]
15147
15148 [[Category:Bar]]
15149 [[Category:Baz]]
15150 !! html/parsoid
15151 <ul><li> a</li>
15152 <li> b</li></ul>
15153
15154 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15155
15156 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15157 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15158 !! end
15159
15160 !! test
15161 4. Categories and newlines: newline suppression for last list item should RT properly
15162 !! wikitext
15163 * a
15164 **** b
15165
15166 [[Category:Foo]]
15167 !! html/parsoid
15168 <ul><li> a
15169 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15170
15171 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15172 !! end
15173
15174 ## only wt2html for this to make sure the algo only applies to the rightmost path
15175 !! test
15176 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15177 !! options
15178 parsoid=wt2html
15179 !! wikitext
15180 * a
15181 ** b
15182 [[Category:Foo]]
15183 * c
15184 ** d
15185 [[Category:Foo]]
15186 !! html/parsoid
15187 <ul><li> a
15188 <ul><li> b
15189 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15190 <li> c
15191 <ul><li> d</li></ul></li></ul>
15192 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15193 !! end
15194
15195 ## We used to, but no longer wt2wt this test since the default serializer
15196 ## will normalize all categories to serialize on their own line.
15197 ## This wikitext usage is going to be fairly uncommon in production and
15198 ## selser will take care of preserving formatting in those scenarios.
15199 !! test
15200 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15201 !! options
15202 parsoid=wt2html
15203 !! wikitext
15204 * a [[Category:Foo]]
15205 !! html/parsoid
15206 <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>
15207 !! end
15208
15209 # This test also demonstrates because of newline+category tunneling
15210 # through the list hander, template wrapping doesn't expand to the
15211 # containing list when the list item swallows the category.
15212 !! test
15213 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15214 !! wikitext
15215 * {{echo|a
15216 [[Category:Foo]]}}
15217 !! html/parsoid
15218 <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
15219 </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>
15220 !! end
15221
15222 !! test
15223 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15224 !! wikitext
15225 * a
15226
15227 {{echo|[[Category:Foo]]
15228 [[Category:Bar]]}}
15229 [[Category:Baz]]
15230 !! html/parsoid
15231 <ul><li> a</li></ul>
15232
15233 <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">
15234 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15235 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15236 !! end
15237
15238 !! test
15239 Category links with multiple namespaces
15240 !! wikitext
15241 [[Category:Project:Foo]]
15242 !! html/parsoid
15243 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15244 !! end
15245
15246 !! test
15247 Parsoid: Serialize link to category page with colon escape
15248 !! options
15249 parsoid
15250 !! wikitext
15251
15252 [[:Category:Foo]]
15253 [[:Category:Foo|Bar]]
15254 !! html
15255 <p>
15256 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15257 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15258 </p>
15259 !! end
15260
15261 # We used to, but no longer wt2wt this test since the default serializer
15262 # will normalize all categories to serialize on their own line.
15263 # This wikitext usage is going to be fairly uncommon in production and
15264 # selser will take care of preventing whitespace insertion if this
15265 # occurs in an article.
15266 #
15267 # html2html disabled for the same reason (whitespace insertion between
15268 # x and y).
15269 #
15270 # html2wt disabled because it localizes the "Category" namespace.
15271 !! test
15272 Link prefix/suffixes aren't applied to category links
15273 !! options
15274 parsoid=wt2html
15275 language=is
15276 !! wikitext
15277 x[[Category:Foo]]y
15278 !! html/php
15279 <p>xy
15280 </p>
15281 !! html/parsoid
15282 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15283 !! end
15284
15285 !! test
15286 Parsoid: Serialize link to file page with colon escape
15287 !! options
15288 parsoid
15289 !! wikitext
15290
15291 [[:File:Foo.png]]
15292 [[:File:Foo.png|Bar]]
15293 !! html
15294 <p>
15295 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15296 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15297 </p>
15298 !! end
15299
15300 !! test
15301 Parsoid: Serialize a genuine category link without colon escape
15302 !! options
15303 parsoid
15304 !! wikitext
15305 [[Category:Foo]]
15306 [[Category:Foo|Bar]]
15307 !! html
15308 <link rel="mw:PageProp/Category" href="./Category:Foo">
15309 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15310 !! end
15311
15312 !! test
15313 Normalize hrefs properly before testing for invalid link targets (bug 70894)
15314 !! options
15315 parsoid=html2wt
15316 !! html/parsoid
15317 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15318 !! wikitext
15319 [[Category:Toxine bactérienne]]
15320 !! end
15321
15322 !! test
15323 Parsoid: Defaultsort
15324 !! wikitext
15325 {{DEFAULTSORT:Foo}}
15326 !! html/parsoid
15327 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15328 !! end
15329
15330 !! test
15331 Parsoid: Defaultsort (template-generated)
15332 !! wikitext
15333 {{{{echo|DEFAULTSORT}}:Foo}}
15334 !! html/parsoid
15335 <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}}]}'/>
15336 !! end
15337
15338 ###
15339 ### Inter-language links
15340 ###
15341 !! test
15342 Interlanguage links
15343 !! options
15344 ill
15345 !! wikitext
15346 [[es:Alimento]]
15347 [[fr:Nourriture]]
15348 [[zh:食品]]
15349 !! html/php
15350 es:Alimento fr:Nourriture zh:食品
15351 !! html/parsoid
15352 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15353 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15354 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15355 !! end
15356
15357 !! test
15358 Duplicate interlanguage links (bug 24502)
15359 !! options
15360 ill
15361 !! wikitext
15362 [[es:1]]
15363 [[es:2]]
15364 [[fr:1]]
15365 [[fr:2]]
15366 !! html/php
15367 es:1 fr:1
15368 !! html/parsoid
15369 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15370 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15371 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15372 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15373 !! end
15374
15375 ###
15376 ### Sections
15377 ###
15378 !! test
15379 Basic section headings
15380 !! wikitext
15381 == Headline 1 ==
15382 Some text
15383
15384 ==Headline 2==
15385 More
15386 ===Smaller headline===
15387 Blah blah
15388 !! html
15389 <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>
15390 <p>Some text
15391 </p>
15392 <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>
15393 <p>More
15394 </p>
15395 <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>
15396 <p>Blah blah
15397 </p>
15398 !! end
15399
15400 !! test
15401 Section headings with TOC
15402 !! wikitext
15403 == Headline 1 ==
15404 === Subheadline 1 ===
15405 ===== Skipping a level =====
15406 ====== Skipping a level ======
15407
15408 == Headline 2 ==
15409 Some text
15410 ===Another headline===
15411 !! html
15412 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15413 <ul>
15414 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15415 <ul>
15416 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15417 <ul>
15418 <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>
15419 <ul>
15420 <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>
15421 </ul>
15422 </li>
15423 </ul>
15424 </li>
15425 </ul>
15426 </li>
15427 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15428 <ul>
15429 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15430 </ul>
15431 </li>
15432 </ul>
15433 </div>
15434
15435 <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>
15436 <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>
15437 <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>
15438 <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>
15439 <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>
15440 <p>Some text
15441 </p>
15442 <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>
15443
15444 !! end
15445
15446 !! test
15447 TOC anchors don't collide
15448 !! wikitext
15449 __FORCETOC__
15450 == Headline 2 ==
15451 == Headline ==
15452 == Headline 2 ==
15453 == Headline ==
15454 !! html/php
15455 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15456 <ul>
15457 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15458 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15459 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15460 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15461 </ul>
15462 </div>
15463
15464 <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>
15465 <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>
15466 <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>
15467 <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>
15468
15469 !! end
15470
15471 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15472 !! test
15473 Handling of sections up to level 6 and beyond
15474 !! wikitext
15475 = Level 1 Heading=
15476 == Level 2 Heading==
15477 === Level 3 Heading===
15478 ==== Level 4 Heading====
15479 ===== Level 5 Heading=====
15480 ====== Level 6 Heading======
15481 ======= Level 7 Heading=======
15482 ======== Level 8 Heading========
15483 ========= Level 9 Heading=========
15484 ========== Level 10 Heading==========
15485 !! html
15486 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15487 <ul>
15488 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15489 <ul>
15490 <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>
15491 <ul>
15492 <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>
15493 <ul>
15494 <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>
15495 <ul>
15496 <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>
15497 <ul>
15498 <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>
15499 <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>
15500 <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>
15501 <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>
15502 <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>
15503 </ul>
15504 </li>
15505 </ul>
15506 </li>
15507 </ul>
15508 </li>
15509 </ul>
15510 </li>
15511 </ul>
15512 </li>
15513 </ul>
15514 </div>
15515
15516 <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>
15517 <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>
15518 <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>
15519 <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>
15520 <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>
15521 <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>
15522 <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>
15523 <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>
15524 <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>
15525 <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>
15526
15527 !! end
15528
15529 !! test
15530 TOC regression (T11764)
15531 !! wikitext
15532 == title 1 ==
15533 === title 1.1 ===
15534 ==== title 1.1.1 ====
15535 === title 1.2 ===
15536 == title 2 ==
15537 === title 2.1 ===
15538 !! html
15539 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15540 <ul>
15541 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15542 <ul>
15543 <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>
15544 <ul>
15545 <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>
15546 </ul>
15547 </li>
15548 <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>
15549 </ul>
15550 </li>
15551 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15552 <ul>
15553 <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>
15554 </ul>
15555 </li>
15556 </ul>
15557 </div>
15558
15559 <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>
15560 <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>
15561 <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>
15562 <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>
15563 <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>
15564 <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>
15565
15566 !! end
15567
15568 !! test
15569 TOC for heading containing <span id="..."></span> (T96153)
15570 !! wikitext
15571 __FORCETOC__
15572 ==<span id="old-anchor"></span>New title==
15573 !! html/php
15574 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15575 <ul>
15576 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15577 </ul>
15578 </div>
15579
15580 <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>
15581
15582 !! end
15583
15584 !! test
15585 TOC with wgMaxTocLevel=3 (bug 6204)
15586 !! options
15587 wgMaxTocLevel=3
15588 !! wikitext
15589 == title 1 ==
15590 === title 1.1 ===
15591 ==== title 1.1.1 ====
15592 === title 1.2 ===
15593 == title 2 ==
15594 === title 2.1 ===
15595 !! html
15596 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15597 <ul>
15598 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15599 <ul>
15600 <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>
15601 <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>
15602 </ul>
15603 </li>
15604 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15605 <ul>
15606 <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>
15607 </ul>
15608 </li>
15609 </ul>
15610 </div>
15611
15612 <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>
15613 <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>
15614 <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>
15615 <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>
15616 <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>
15617 <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>
15618
15619 !! end
15620
15621 !! test
15622 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15623 !! options
15624 wgMaxTocLevel=3
15625 !! wikitext
15626 ==Section 1==
15627 ===Section 1.1===
15628 ====Section 1.1.1====
15629 ====Section 1.1.1.1====
15630 ==Section 2==
15631 !! html
15632 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15633 <ul>
15634 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15635 <ul>
15636 <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>
15637 </ul>
15638 </li>
15639 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15640 </ul>
15641 </div>
15642
15643 <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>
15644 <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>
15645 <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>
15646 <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>
15647 <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>
15648
15649 !! end
15650
15651
15652 !! test
15653 Resolving duplicate section names
15654 !! wikitext
15655 == Foo bar ==
15656 == Foo bar ==
15657 !! html
15658 <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>
15659 <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>
15660
15661 !! end
15662
15663 !! test
15664 Resolving duplicate section names with differing case (bug 10721)
15665 !! wikitext
15666 == Foo bar ==
15667 == Foo Bar ==
15668 !! html
15669 <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>
15670 <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>
15671
15672 !! end
15673
15674 !! article
15675 Template:sections
15676 !! text
15677 ===Section 1===
15678 ==Section 2==
15679 !! endarticle
15680
15681 !! test
15682 Template with sections, __NOTOC__
15683 !! wikitext
15684 __NOTOC__
15685 ==Section 0==
15686 {{sections}}
15687 ==Section 4==
15688 !! html
15689 <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>
15690 <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>
15691 <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>
15692 <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>
15693
15694 !! end
15695
15696 !! test
15697 __NOEDITSECTION__ keyword
15698 !! wikitext
15699 __NOEDITSECTION__
15700 ==Section 1==
15701 ==Section 2==
15702 !! html
15703 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15704 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15705
15706 !! end
15707
15708 !! test
15709 Link inside a section heading
15710 !! wikitext
15711 ==Section with a [[Main Page|link]] in it==
15712 !! html
15713 <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>
15714
15715 !! end
15716
15717 !! test
15718 TOC regression (T14077)
15719 !! wikitext
15720 __TOC__
15721 == title 1 ==
15722 === title 1.1 ===
15723 == title 2 ==
15724 !! html
15725 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15726 <ul>
15727 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15728 <ul>
15729 <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>
15730 </ul>
15731 </li>
15732 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15733 </ul>
15734 </div>
15735
15736 <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>
15737 <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>
15738 <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>
15739
15740 !! end
15741
15742 !! test
15743 BUG 1219 URL next to image (good)
15744 !! wikitext
15745 http://example.com [[File:Foobar.jpg]]
15746 !! html/php
15747 <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>
15748 </p>
15749 !! html/parsoid
15750 <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>
15751 !!end
15752
15753 !! test
15754 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15755 !! wikitext
15756 ===
15757 The line above must have a trailing space!
15758 === <!--
15759 --> <!-- -->
15760 But just in case it doesn't...
15761 !! html
15762 <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>
15763 <p>The line above must have a trailing space!
15764 </p>
15765 <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>
15766 <p>But just in case it doesn't...
15767 </p>
15768 !! end
15769
15770 !! test
15771 Header with special characters (bug 25462)
15772 !! wikitext
15773 The tooltips shall not show entities to the user (ie. be double escaped)
15774
15775 == text > text ==
15776 section 1
15777
15778 == text < text ==
15779 section 2
15780
15781 == text & text ==
15782 section 3
15783
15784 == text ' text ==
15785 section 4
15786
15787 == text " text ==
15788 section 5
15789 !! html
15790 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15791 </p>
15792 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15793 <ul>
15794 <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>
15795 <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>
15796 <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>
15797 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15798 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15799 </ul>
15800 </div>
15801
15802 <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>
15803 <p>section 1
15804 </p>
15805 <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>
15806 <p>section 2
15807 </p>
15808 <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>
15809 <p>section 3
15810 </p>
15811 <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>
15812 <p>section 4
15813 </p>
15814 <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>
15815 <p>section 5
15816 </p>
15817 !! end
15818
15819 !! test
15820 Header with space, plus and underscore as entity
15821 !! wikitext
15822 Id should not contain + for spaces
15823
15824 == Space between Text ==
15825 section 1
15826
15827 == Space-Entity&#32;between&#32;Text ==
15828 section 2
15829
15830 == Plus+between+Text ==
15831 section 3
15832
15833 == Plus-Entity&#43;between&#43;Text ==
15834 section 4
15835
15836 == Underscore_between_Text ==
15837 section 5
15838
15839 == Underscore-Entity&#95;between&#95;Text ==
15840 section 6
15841
15842 [[#Space between Text]]
15843 [[#Space-Entity&#32;between&#32;Text]]
15844 [[#Plus+between+Text]]
15845 [[#Plus-Entity&#43;between&#43;Text]]
15846 [[#Underscore_between_Text]]
15847 [[#Underscore-Entity&#95;between&#95;Text]]
15848 !! html
15849 <p>Id should not contain + for spaces
15850 </p>
15851 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15852 <ul>
15853 <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>
15854 <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>
15855 <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>
15856 <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>
15857 <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>
15858 <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>
15859 </ul>
15860 </div>
15861
15862 <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>
15863 <p>section 1
15864 </p>
15865 <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>
15866 <p>section 2
15867 </p>
15868 <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>
15869 <p>section 3
15870 </p>
15871 <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>
15872 <p>section 4
15873 </p>
15874 <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>
15875 <p>section 5
15876 </p>
15877 <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>
15878 <p>section 6
15879 </p><p><a href="#Space_between_Text">#Space between Text</a>
15880 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15881 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15882 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15883 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15884 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15885 </p>
15886 !! end
15887
15888 !! test
15889 Headers with excess '=' characters
15890 (Are similar tests necessary beyond the 1st level?)
15891 !! wikitext
15892 =foo==
15893 ==foo=
15894 =''italic'' heading==
15895 ==''italic'' heading=
15896 !! html
15897 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15898 <ul>
15899 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15900 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15901 <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>
15902 <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>
15903 </ul>
15904 </div>
15905
15906 <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>
15907 <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>
15908 <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>
15909 <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>
15910
15911 !! end
15912
15913 !! test
15914 HTML headers vs TOC (bug 23393)
15915 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15916 !! wikitext
15917 <h1>Header 1</h1>
15918 == Header 1.1 ==
15919 == Header 1.2 ==
15920
15921 <h1>Header 2
15922 </h1>
15923 == Header 2.1 ==
15924 == Header 2.2 ==
15925 __NOEDITSECTION__
15926 !! html
15927 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15928 <ul>
15929 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15930 <ul>
15931 <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>
15932 <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>
15933 </ul>
15934 </li>
15935 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15936 <ul>
15937 <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>
15938 <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>
15939 </ul>
15940 </li>
15941 </ul>
15942 </div>
15943
15944 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15945 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15946 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15947 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15948 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15949 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15950
15951 !! end
15952
15953 !! test
15954 Single-line or multiline-comments can follow headings
15955 !! options
15956 parsoid=wt2html,wt2wt
15957 !! wikitext
15958 ==foo==<!---->
15959 ==bar==<!--c1-->
15960 ==baz==<!--
15961 c2
15962 c3-->
15963 !! html
15964 <h2><span class="mw-headline" id="foo">foo</span></h2>
15965 <h2><span class="mw-headline" id="bar">bar</span></h2>
15966 <h2><span class="mw-headline" id="baz">baz</span></h2>
15967
15968 !! end
15969
15970 !! test
15971 BUG 1219 URL next to image (broken)
15972 !! wikitext
15973 http://example.com[[File:Foobar.jpg]]
15974 !! html/php
15975 <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>
15976 </p>
15977 !! html/parsoid
15978 <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>
15979 !!end
15980
15981 !! test
15982 Bug 1186 news: in the middle of text
15983 !! wikitext
15984 http://en.wikinews.org/wiki/Wikinews:Workplace
15985 !! html
15986 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15987 </p>
15988 !!end
15989
15990
15991 !! test
15992 Namespaced link must have a title
15993 !! wikitext
15994 [[Project:]]
15995 !! html
15996 <p>[[Project:]]
15997 </p>
15998 !!end
15999
16000 !! test
16001 Namespaced link must have a title (bad fragment version)
16002 !! wikitext
16003 [[Project:#fragment]]
16004 !! html
16005 <p>[[Project:#fragment]]
16006 </p>
16007 !!end
16008
16009
16010 ###
16011 ### HTML tags and HTML attributes
16012 ###
16013
16014 !! test
16015 div with no attributes
16016 !! wikitext
16017 <div>HTML rocks</div>
16018 !! html
16019 <div>HTML rocks</div>
16020
16021 !! end
16022
16023 !! test
16024 div with double-quoted attribute
16025 !! wikitext
16026 <div id="rock">HTML rocks</div>
16027 !! html
16028 <div id="rock">HTML rocks</div>
16029
16030 !! end
16031
16032 !! test
16033 div with single-quoted attribute
16034 !! wikitext
16035 <div id='rock'>HTML rocks</div>
16036 !! html
16037 <div id="rock">HTML rocks</div>
16038
16039 !! end
16040
16041 !! test
16042 div with unquoted attribute
16043 !! wikitext
16044 <div id=rock>HTML rocks</div>
16045 !! html
16046 <div id="rock">HTML rocks</div>
16047
16048 !! end
16049
16050 !! test
16051 div with illegal double attributes
16052 !! wikitext
16053 <div id="a" id="b">HTML rocks</div>
16054 !! html
16055 <div id="b">HTML rocks</div>
16056
16057 !!end
16058
16059 !! test
16060 div with empty attribute value, space before equals
16061 !! options
16062 parsoid=wt2html,html2html
16063 !! wikitext
16064 <div class =>HTML rocks</div>
16065 !! html/php
16066 <div class="">HTML rocks</div>
16067
16068 !! html/parsoid
16069 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16070 !! end
16071
16072 !! test
16073 div with multiple empty attribute values
16074 !! options
16075 parsoid=wt2html,html2html
16076 !! wikitext
16077 <div id= title=>HTML rocks</div>
16078 !! html/php
16079 <div id="title.3D">HTML rocks</div>
16080
16081 !! html/parsoid
16082 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16083 !! end
16084
16085 !! test
16086 table with multiple empty attribute values
16087 !! options
16088 parsoid=wt2html,html2html
16089 !! wikitext
16090 {| title= id=
16091 | hi
16092 |}
16093 !! html/php
16094 <table title="id=">
16095 <tr>
16096 <td> hi
16097 </td></tr></table>
16098
16099 !! html/parsoid
16100 <table title="id=">
16101 <tbody><tr><td> hi</td></tr>
16102 </tbody></table>
16103 !! end
16104
16105 !! test
16106 div with braces in attribute value
16107 !! wikitext
16108 <div title="{}">Foo</div>
16109 !! html/php
16110 <div title="&#123;&#125;">Foo</div>
16111
16112 !! html/parsoid
16113 <div title="{}">Foo</div>
16114 !! end
16115
16116 !! test
16117 div with empty attribute value, no space before equals
16118 !! options
16119 parsoid=wt2html,html2html
16120 !! wikitext
16121 <div class=>HTML rocks</div>
16122 !! html/php
16123 <div class="">HTML rocks</div>
16124
16125 !! html/parsoid
16126 <div class="">HTML rocks</div>
16127 !! end
16128
16129 !! test
16130 HTML multiple attributes correction
16131 !! wikitext
16132 <p class="error" class="awesome">Awesome!</p>
16133 !! html
16134 <p class="awesome">Awesome!</p>
16135
16136 !!end
16137
16138 !! test
16139 Table multiple attributes correction
16140 !! wikitext
16141 {|
16142 !+ class="error" class="awesome"| status
16143 |}
16144 !! html
16145 <table>
16146 <tr>
16147 <th class="awesome"> status
16148 </th></tr></table>
16149
16150 !!end
16151
16152 !! test
16153 DIV IN UPPERCASE
16154 !! wikitext
16155 <DIV ID="x">HTML ROCKS</DIV>
16156 !! html
16157 <div id="x">HTML ROCKS</div>
16158
16159 !!end
16160
16161 !! test
16162 Non-ASCII pseudo-tags are rendered as text
16163 !! wikitext
16164 <khyô>
16165 !! html
16166 <p>&lt;khyô&gt;
16167 </p>
16168 !! end
16169
16170 !! test
16171 Pseudo-tag with URL 'name' renders as url link
16172 !! wikitext
16173 <http://example.com/>
16174 !! html
16175 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16176 </p>
16177 !! end
16178
16179 !! test
16180 text with amp in the middle of nowhere
16181 !! wikitext
16182 Remember AT&T?
16183 !! html
16184 <p>Remember AT&amp;T?
16185 </p>
16186 !! end
16187
16188 !! test
16189 text with character entity: eacute
16190 !! wikitext
16191 I always thought &eacute; was a cute letter.
16192 !! html
16193 <p>I always thought &#233; was a cute letter.
16194 </p>
16195 !! html+tidy
16196 <p>I always thought é was a cute letter.</p>
16197 !! end
16198
16199 !! test
16200 text with entity-escaped character entity-like string: eacute
16201 !! wikitext
16202 I always thought &amp;eacute; was a cute letter.
16203 !! html
16204 <p>I always thought &amp;eacute; was a cute letter.
16205 </p>
16206 !! end
16207
16208 !! test
16209 text with undefined character entity: xacute
16210 !! wikitext
16211 I always thought &xacute; was a cute letter.
16212 !! html
16213 <p>I always thought &amp;xacute; was a cute letter.
16214 </p>
16215 !! end
16216
16217 !! test
16218 HTML5 tags
16219 !! wikitext
16220 <data value="5">five</data>
16221 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16222 <mark>This highlighted text</mark>
16223 !! html
16224 <p><data value="5">five</data>
16225 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16226 <mark>This highlighted text</mark>
16227 </p>
16228 !! end
16229
16230 !! test
16231 HTML tag with leading space is parsed as text
16232 !! wikitext
16233 < div>foo< /div>
16234 !! html
16235 <p>&lt; div&gt;foo&lt; /div&gt;
16236 </p>
16237 !! end
16238
16239 ###
16240 ### Nesting tests (see bug 41545, 50604, 51081)
16241 ###
16242
16243 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
16244 # Note that html2wt is considerably more difficult if we use <b> in
16245 # the test case, instead of <small>
16246 !! test
16247 Ensure that HTML adoption agency algorithm is properly implemented.
16248 !! wikitext
16249 <small>X<small>Y</small>Z</small>
16250 !! html
16251 <p><small>X<small>Y</small>Z</small>
16252 </p>
16253 !! end
16254
16255 # This was bug 41545 in the PHP parser.
16256 # Note that tidy doesn't handle this correctly.
16257 !! test
16258 Nesting of <kbd>
16259 !! wikitext
16260 <kbd>X<kbd>Y</kbd>Z</kbd>
16261 !! html
16262 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16263 </p>
16264 !! end
16265
16266 # The following cases were bug 51081 in the PHP parser.
16267 # Note that there are some other nestable tags (b, i, etc) which are
16268 # not covered; see bug 51081 for discussion.
16269
16270 # Note that tidy doesn't handle this correctly.
16271 !! test
16272 Nesting of <em>
16273 !! wikitext
16274 <em>X<em>Y</em>Z</em>
16275 !! html
16276 <p><em>X<em>Y</em>Z</em>
16277 </p>
16278 !! end
16279
16280 # Note that tidy doesn't handle this correctly.
16281 !! test
16282 Nesting of <strong>
16283 !! wikitext
16284 <strong>X<strong>Y</strong>Z</strong>
16285 !! html
16286 <p><strong>X<strong>Y</strong>Z</strong>
16287 </p>
16288 !! end
16289
16290 !! test
16291 Nesting of <q>
16292 !! wikitext
16293 <q>X<q>Y</q>Z</q>
16294 !! html+tidy
16295 <p><q>X<q>Y</q>Z</q></p>
16296 !! end
16297
16298 # Note that tidy doesn't handle this correctly.
16299 !! test
16300 Nesting of <ruby>
16301 !! wikitext
16302 <ruby>X<ruby>Y</ruby>Z</ruby>
16303 !! html
16304 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16305 </p>
16306 !! end
16307
16308 # Note that tidy doesn't handle this correctly.
16309 !! test
16310 Nesting of <bdo>
16311 !! wikitext
16312 <bdo>X<bdo>Y</bdo>Z</bdo>
16313 !! html
16314 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16315 </p>
16316 !! end
16317
16318
16319 ###
16320 ### Media links
16321 ###
16322
16323 !! test
16324 Media link
16325 !! wikitext
16326 [[Media:Foobar.jpg]]
16327 !! html
16328 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16329 </p>
16330 !! end
16331
16332 !! test
16333 Media link with text
16334 !! wikitext
16335 [[Media:Foobar.jpg|A neat file to look at]]
16336 !! html
16337 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16338 </p>
16339 !! end
16340
16341 # FIXME: this is still bad HTML tag nesting
16342 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16343 !! test
16344 Media link with nasty text
16345 !! wikitext
16346 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16347 !! html
16348 <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>
16349
16350 !! html+tidy
16351 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16352 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16353 !! end
16354
16355 !! test
16356 Media link to nonexistent file (bug 1702)
16357 !! wikitext
16358 [[Media:No such.jpg]]
16359 !! html
16360 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16361 </p>
16362 !! end
16363
16364 !! test
16365 Image link to nonexistent file (bug 1850 - good)
16366 !! wikitext
16367 [[File:No_such.jpg]]
16368 !! html/php
16369 <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>
16370 </p>
16371 !! html/parsoid
16372 <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>
16373 !! end
16374
16375 !! test
16376 :Image link to nonexistent file (bug 1850 - bad)
16377 !! wikitext
16378 [[:Image:No such.jpg]]
16379 !! html/php
16380 <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>
16381 </p>
16382 !! html/parsoid
16383 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16384 !! end
16385
16386
16387
16388 !! test
16389 Character reference normalization in link text (bug 1938)
16390 !! wikitext
16391 [[Main Page|this&that]]
16392 !! html
16393 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16394 </p>
16395 !!end
16396
16397 !! article
16398 אַ
16399 !! text
16400 Test for unicode normalization
16401
16402 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16403 !! endarticle
16404
16405 !! test
16406 (bug 19451) Links should refer to the normalized form.
16407 !! wikitext
16408 [[&#xFB2E;]]
16409 [[&#x5d0;&#x5b7;]]
16410 [[&#x5d0;ַ]]
16411 [[א&#x5b7;]]
16412 [[אַ]]
16413 !! html
16414 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16415 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16416 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16417 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16418 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16419 </p>
16420 !! end
16421
16422 !! test
16423 Empty attribute crash test (bug 2067)
16424 !! wikitext
16425 <font color="">foo</font>
16426 !! html
16427 <p><font color="">foo</font>
16428 </p>
16429 !! end
16430
16431 !! test
16432 Empty attribute crash test single-quotes (bug 2067)
16433 !! wikitext
16434 <font color=''>foo</font>
16435 !! html
16436 <p><font color="">foo</font>
16437 </p>
16438 !! end
16439
16440 !! test
16441 Attribute test: equals, then nothing
16442 !! options
16443 parsoid=wt2html,html2html
16444 !! wikitext
16445 <font color=>foo</font>
16446 !! html/php
16447 <p><font color="">foo</font>
16448 </p>
16449 !! html/parsoid
16450 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16451 !! end
16452
16453 !! test
16454 Attribute test: unquoted value
16455 !! options
16456 parsoid=wt2html,html2html
16457 !! wikitext
16458 <font color=x>foo</font>
16459 !! html/php
16460 <p><font color="x">foo</font>
16461 </p>
16462 !! html/parsoid
16463 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16464 !! end
16465
16466 !! test
16467 Attribute test: unquoted but illegal value (hash)
16468 !! wikitext
16469 <font color=#x>foo</font>
16470 !! html
16471 <p><font color="#x">foo</font>
16472 </p>
16473 !! end
16474
16475 # Parsoid does not serialize to empty attribute syntax,
16476 # so wt2wt and html2wt cases are skipped
16477 !! test
16478 Attribute test: no value (T54330)
16479 !! options
16480 parsoid=wt2html,html2html
16481 !! wikitext
16482 <font color>foo</font>
16483 !! html/php
16484 <p><font color="">foo</font>
16485 </p>
16486 !! html/parsoid
16487 <p><font color="">foo</font></p>
16488 !! end
16489
16490 !! test
16491 Bug 2095: link with three closing brackets
16492 !! wikitext
16493 [[Main Page]]]
16494 !! html/php
16495 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16496 </p>
16497 !! html/parsoid
16498 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16499 !! end
16500
16501 !! test
16502 Bug 2095: link with pipe and three closing brackets
16503 !! wikitext
16504 [[Main Page|link]]]
16505 !! html/php
16506 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16507 </p>
16508 !! html/parsoid
16509 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16510 !! end
16511
16512 !! test
16513 Bug 2095: link with pipe and three closing brackets, version 2
16514 !! wikitext
16515 [[Main Page|[http://example.com/]]]
16516 !! html/php
16517 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16518 </p>
16519 !! html/parsoid
16520 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16521 !! end
16522
16523
16524 ###
16525 ### Safety
16526 ###
16527
16528 !! article
16529 Template:Dangerous attribute
16530 !! text
16531 " onmouseover="alert(document.cookie)
16532 !! endarticle
16533
16534 !! article
16535 Template:Dangerous style attribute
16536 !! text
16537 border-size: expression(alert(document.cookie))
16538 !! endarticle
16539
16540 !! article
16541 Template:Div style
16542 !! text
16543 <div style="float: right; {{{1}}}">Magic div</div>
16544 !! endarticle
16545
16546 !! test
16547 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16548 !! wikitext
16549 <div title="{{test}}"></div>
16550 !! html/php
16551 <div title="This is a test template"></div>
16552
16553 !! html/parsoid
16554 <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>
16555 !! end
16556
16557 # Parsoid has enough context to handle this case
16558 !! test
16559 Bug 2304: HTML attribute safety (dangerous template; 2309)
16560 !! wikitext
16561 <div title="{{dangerous attribute}}"></div>
16562 !! html/php
16563 <div title=""></div>
16564
16565 !! html/parsoid
16566 <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>
16567 !! end
16568
16569 !! test
16570 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16571 !! wikitext
16572 <div style="{{dangerous style attribute}}"></div>
16573 !! html/php
16574 <div style="/* insecure input */"></div>
16575
16576 !! html/parsoid
16577 <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>
16578 !! end
16579
16580 !! test
16581 Bug 2304: HTML attribute safety (safe parameter; 2309)
16582 !! wikitext
16583 {{div style|width: 200px}}
16584 !! html/php
16585 <div style="float: right; width: 200px">Magic div</div>
16586
16587 !! html/parsoid
16588 <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>
16589 !! end
16590
16591 !! test
16592 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16593 !! wikitext
16594 {{div style|width: expression(alert(document.cookie))}}
16595 !! html/php
16596 <div style="/* insecure input */">Magic div</div>
16597
16598 !! html/parsoid
16599 <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>
16600 !! end
16601
16602 ## Parsoid output here differs; needs investigation.
16603 !! test
16604 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16605 !! wikitext
16606 {{div style|"><script>alert(document.cookie)</script>}}
16607 !! html
16608 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16609
16610 !! end
16611
16612 ## Parsoid output here differs; needs investigation.
16613 !! test
16614 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16615 !! wikitext
16616 {{div style|" ><script>alert(document.cookie)</script>}}
16617 !! html
16618 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16619
16620 !! end
16621
16622 !! test
16623 Bug 2304: HTML attribute safety (link)
16624 !! wikitext
16625 <div title="[[Main Page]]"></div>
16626 !! html
16627 <div title="&#91;&#91;Main Page]]"></div>
16628
16629 !! end
16630
16631 !! test
16632 Bug 2304: HTML attribute safety (italics)
16633 !! wikitext
16634 <div title="''foobar''"></div>
16635 !! html
16636 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16637
16638 !! end
16639
16640 !! test
16641 Bug 2304: HTML attribute safety (bold)
16642 !! wikitext
16643 <div title="'''foobar'''"></div>
16644 !! html
16645 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16646
16647 !! end
16648
16649 !! test
16650 Bug 2304: HTML attribute safety (ISBN)
16651 !! wikitext
16652 <div title="ISBN 1234567890"></div>
16653 !! html
16654 <div title="&#73;SBN 1234567890"></div>
16655
16656 !! end
16657
16658 !! test
16659 Bug 2304: HTML attribute safety (RFC)
16660 !! wikitext
16661 <div title="RFC 1234"></div>
16662 !! html
16663 <div title="&#82;FC 1234"></div>
16664
16665 !! end
16666
16667 !! test
16668 Bug 2304: HTML attribute safety (PMID)
16669 !! wikitext
16670 <div title="PMID 1234567890"></div>
16671 !! html
16672 <div title="&#80;MID 1234567890"></div>
16673
16674 !! end
16675
16676 !! test
16677 Bug 2304: HTML attribute safety (web link)
16678 !! wikitext
16679 <div title="http://example.com/"></div>
16680 !! html
16681 <div title="http&#58;//example.com/"></div>
16682
16683 !! end
16684
16685 !! test
16686 Bug 2304: HTML attribute safety (named web link)
16687 !! wikitext
16688 <div title="[http://example.com/ link]"></div>
16689 !! html
16690 <div title="&#91;http&#58;//example.com/ link]"></div>
16691
16692 !! end
16693
16694 !! test
16695 Bug 3244: HTML attribute safety (extension; safe)
16696 !! wikitext
16697 <div style="<nowiki>background:blue</nowiki>"></div>
16698 !! html/php
16699 <div style="background:blue"></div>
16700
16701 !! html/parsoid
16702 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
16703 !! end
16704
16705 !! test
16706 Bug 3244: HTML attribute safety (extension; unsafe)
16707 !! wikitext
16708 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16709 !! html/php
16710 <div style="/* insecure input */"></div>
16711
16712 !! html/parsoid
16713 <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>
16714 !! end
16715
16716 # More MSIE fun discovered by Tom Gilder
16717
16718 !! test
16719 MSIE CSS safety test: spurious slash
16720 !! wikitext
16721 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16722 !! html/php
16723 <div style="/* insecure input */">evil</div>
16724
16725 !! html/parsoid
16726 <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>
16727 !! end
16728
16729 !! test
16730 MSIE CSS safety test: hex code
16731 !! wikitext
16732 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16733 !! html/php
16734 <div style="/* insecure input */">evil</div>
16735
16736 !! html/parsoid
16737 <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>
16738 !! end
16739
16740 !! test
16741 MSIE CSS safety test: comment in url
16742 !! wikitext
16743 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16744 !! html/php
16745 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16746
16747 !! html/parsoid
16748 <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>
16749 !! end
16750
16751 !! test
16752 MSIE CSS safety test: comment in expression
16753 !! wikitext
16754 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16755 !! html/php
16756 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16757
16758 !! html/parsoid
16759 <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>
16760 !! end
16761
16762 !! test
16763 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16764 !! wikitext
16765 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16766 !! html/php
16767 <p style="/* invalid control char */">A</p>
16768
16769 !! html/parsoid
16770 <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>
16771 !! end
16772
16773 !! test
16774 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16775 !! wikitext
16776 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16777 <div style="top:EXPRESSION(alert())">B</div>
16778 !! html/php
16779 <p style="/* insecure input */">A</p>
16780 <div style="/* insecure input */">B</div>
16781
16782 !! html/parsoid
16783 <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>
16784 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
16785 !! end
16786
16787 !! test
16788 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16789 !! wikitext
16790 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16791 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16792 !! html/php
16793 <div style="/* insecure input */">A</div>
16794 <p style="/* insecure input */">B</p>
16795
16796 !! html/parsoid
16797 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
16798 <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>
16799 !! end
16800
16801 !! test
16802 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16803 !! wikitext
16804 <div style="background-image:url⁽javascript:alert())">A</div>
16805 <div style="background-image:url₍javascript:alert())">B</div>
16806 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16807 !! html/php
16808 <div style="/* insecure input */">A</div>
16809 <div style="/* insecure input */">B</div>
16810 <p style="/* insecure input */">C</p>
16811
16812 !! html/parsoid
16813 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
16814 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
16815 <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>
16816 !! end
16817
16818 !! test
16819 Opera -o-link CSS
16820 !! options
16821 parsoid=wt2html,html2html
16822 !! wikitext
16823 <div
16824 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;"
16825 style="-o-link:attr(title);-o-link-source:current">X</div>
16826 !! html/php
16827 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16828
16829 !! html/parsoid
16830 <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>
16831 !! end
16832
16833 !! test
16834 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16835 !! wikitext
16836 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16837 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16838 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16839 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16840 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16841 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16842 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16843 !! html/php
16844 <p style="/* insecure input */">A</p>
16845 <p style="/* insecure input */">B</p>
16846 <p style="/* insecure input */">C</p>
16847 <p style="/* insecure input */">D</p>
16848 <p style="/* insecure input */">E</p>
16849 <p style="/* insecure input */">F</p>
16850 <p style="/* insecure input */">G</p>
16851
16852 !! html/parsoid
16853 <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>
16854 <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>
16855 <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>
16856 <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>
16857 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>E</p>
16858 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹼion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>F</p>
16859 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>G</p>
16860 !! end
16861
16862 !! test
16863 Table attribute legitimate extension
16864 !! wikitext
16865 {|
16866 !+ style="<nowiki>color:blue</nowiki>"| status
16867 |}
16868 !! html
16869 <table>
16870 <tr>
16871 <th style="color:blue"> status
16872 </th></tr></table>
16873
16874 !!end
16875
16876 !! test
16877 Table attribute safety
16878 !! wikitext
16879 {|
16880 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16881 |}
16882 !! html
16883 <table>
16884 <tr>
16885 <th style="/* insecure input */"> status
16886 </th></tr></table>
16887
16888 !! end
16889
16890 !! test
16891 CSS line continuation 1
16892 !! wikitext
16893 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16894 !! html
16895 <div style="/* insecure input */"></div>
16896
16897 !! end
16898
16899 !! test
16900 CSS line continuation 2
16901 !! wikitext
16902 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16903 !! html
16904 <div style="/* invalid control char */"></div>
16905
16906 !! end
16907
16908 !! article
16909 Template:Identity
16910 !! text
16911 {{{1}}}
16912 !! endarticle
16913
16914 !! test
16915 Expansion of multi-line templates in attribute values (bug 6255)
16916 !! wikitext
16917 <div style="background: {{identity|#00FF00}}">-</div>
16918 !! html
16919 <div style="background: #00FF00">-</div>
16920
16921 !! end
16922
16923 !! test
16924 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16925 !! wikitext
16926 <div style="background:
16927 #00FF00">-</div>
16928 !! html/php
16929 <div style="background: #00FF00">-</div>
16930
16931 !! html/parsoid
16932 <div style="background:
16933 #00FF00">-</div>
16934 !! end
16935
16936 !! test
16937 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16938 !! wikitext
16939 <div style="background: &#10;#00FF00">-</div>
16940 !! html
16941 <div style="background: &#10;#00FF00">-</div>
16942
16943 !! end
16944
16945 !! test
16946 Tags which are hidden from Tidy cannot pass through the Sanitizer
16947 !! wikitext
16948 <mw:toc><script>alert();</script></mw:toc>
16949 !! html+tidy
16950 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
16951 !! end
16952
16953 ###
16954 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16955 ###
16956
16957 !! test
16958 Parser hook: empty input
16959 !! wikitext
16960 <tag></tag>
16961 !! html/php
16962 <pre>
16963 ''
16964 array (
16965 )
16966 </pre>
16967
16968 !! html/parsoid
16969 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16970 !! end
16971
16972 ## Don't expect parsoid to rt this form.
16973 !! test
16974 Parser hook: empty input using terminated empty elements
16975 !! options
16976 parsoid=wt2html,html2html
16977 !! wikitext
16978 <tag/>
16979 !! html/php
16980 <pre>
16981 NULL
16982 array (
16983 )
16984 </pre>
16985
16986 !! html/parsoid
16987 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16988 !! end
16989
16990 !! test
16991 Parser hook: empty input using terminated empty elements (space before)
16992 !! wikitext
16993 <tag />
16994 !! html/php
16995 <pre>
16996 NULL
16997 array (
16998 )
16999 </pre>
17000
17001 !! html/parsoid
17002 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17003 !! end
17004
17005 !! test
17006 Parser hook: basic input
17007 !! wikitext
17008 <tag>input</tag>
17009 !! html/php
17010 <pre>
17011 'input'
17012 array (
17013 )
17014 </pre>
17015
17016 !! html/parsoid
17017 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17018 !! end
17019
17020 ## Don't expect parsoid to rt this form.
17021 !! test
17022 Parser hook: case insensitive
17023 !! options
17024 parsoid=wt2html,html2html
17025 !! wikitext
17026 <TAG>input</TAG>
17027 !! html/php
17028 <pre>
17029 'input'
17030 array (
17031 )
17032 </pre>
17033
17034 !! html/parsoid
17035 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17036 !! end
17037
17038 ## Don't expect parsoid to rt this form.
17039 !! test
17040 Parser hook: case insensitive, redux
17041 !! options
17042 parsoid=wt2html,html2html
17043 !! wikitext
17044 <TaG>input</TAg>
17045 !! html/php
17046 <pre>
17047 'input'
17048 array (
17049 )
17050 </pre>
17051
17052 !! html/parsoid
17053 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17054 !! end
17055
17056 !! test
17057 Parser hook: nested tags
17058 !! wikitext
17059 <tag><tag></tag></tag>
17060 !! html/php
17061 <pre>
17062 '<tag>'
17063 array (
17064 )
17065 </pre>&lt;/tag&gt;
17066
17067 !! html/parsoid
17068 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
17069 !! end
17070
17071 !! test
17072 Parser hook: basic arguments
17073 !! wikitext
17074 <tag width="200" height="100" depth="50" square=""></tag>
17075 !! html/php
17076 <pre>
17077 ''
17078 array (
17079 'width' => '200',
17080 'height' => '100',
17081 'depth' => '50',
17082 'square' => '',
17083 )
17084 </pre>
17085
17086 !! html/parsoid
17087 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17088 !! end
17089
17090 ## Don't expect parsoid to rt this form.
17091 !! test
17092 Parser hook: basic arguments, variations
17093 !! options
17094 parsoid=wt2html,html2html
17095 !! wikitext
17096 <tag width=200 height = "100" depth = '50' square></tag>
17097 !! html/php
17098 <pre>
17099 ''
17100 array (
17101 'width' => '200',
17102 'height' => '100',
17103 'depth' => '50',
17104 'square' => '',
17105 )
17106 </pre>
17107
17108 !! html/parsoid
17109 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17110 !! end
17111
17112 !! test
17113 Parser hook: argument containing a forward slash (bug 5344)
17114 !! wikitext
17115 <tag filename="/tmp/bla"></tag>
17116 !! html/php
17117 <pre>
17118 ''
17119 array (
17120 'filename' => '/tmp/bla',
17121 )
17122 </pre>
17123
17124 !! html/parsoid
17125 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17126 !! end
17127
17128 ## Don't expect parsoid to rt this form.
17129 !! test
17130 Parser hook: empty input using terminated empty elements (bug 2374)
17131 !! options
17132 parsoid=wt2html,html2html
17133 !! wikitext
17134 <tag foo=bar/>text
17135 !! html/php
17136 <pre>
17137 NULL
17138 array (
17139 'foo' => 'bar',
17140 )
17141 </pre>text
17142
17143 !! html/parsoid
17144 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
17145 !! end
17146
17147 ## </tag> should be output literally since there is no matching tag that begins it
17148 ## Don't expect parsoid to rt this form.
17149 !! test
17150 Parser hook: basic arguments using terminated empty elements (bug 2374)
17151 !! options
17152 parsoid=wt2html
17153 !! wikitext
17154 <tag width=200 height = "100" depth = '50' square/>
17155 other stuff
17156 </tag>
17157 !! html/php
17158 <pre>
17159 NULL
17160 array (
17161 'width' => '200',
17162 'height' => '100',
17163 'depth' => '50',
17164 'square' => '',
17165 )
17166 </pre>
17167 <p>other stuff
17168 &lt;/tag&gt;
17169 </p>
17170 !! html/parsoid
17171 <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
17172 &lt;/tag></p>
17173 !! end
17174
17175 ## Don't expect parsoid to rt this form.
17176 !! test
17177 Parser hook: Don't allow unclosed extension tags
17178 !! options
17179 parsoid=wt2html
17180 !! wikitext
17181 test <tag>123
17182
17183 this is a '''test'''
17184 !! html/php
17185 <p>test &lt;tag&gt;123
17186 </p><p>this is a <b>test</b>
17187 </p>
17188 !! html/parsoid
17189 <p>test &lt;tag>123</p>
17190
17191 <p>this is a <b>test</b></p>
17192 !! end
17193
17194 ###
17195 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17196 ###
17197
17198 !! test
17199 Parser hook: static parser hook not inside a comment
17200 !! wikitext
17201 <statictag>hello, world</statictag>
17202
17203 <statictag action="flush" />
17204 !! html/php
17205 <p><br />
17206 hello, world
17207 </p>
17208 !! html/parsoid
17209 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17210 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17211 !! end
17212
17213 !! test
17214 Parser hook: static parser hook inside a comment
17215 !! wikitext
17216 <!-- <statictag>hello, world</statictag> -->
17217 <statictag action="flush" />
17218 !! html/php
17219 <p><br />
17220 </p>
17221 !! html/parsoid
17222 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17223 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17224 !! end
17225
17226 # Nested template calls; this case was broken by Parser.php rev 1.506,
17227 # since reverted.
17228
17229 !! article
17230 Template:One-parameter
17231 !! text
17232 (My parameter is: {{{1}}})
17233 !! endarticle
17234
17235 !! article
17236 Template:Map-one-parameter
17237 !! text
17238 {{{{{1}}}|{{{2}}}}}
17239 !! endarticle
17240
17241 !! test
17242 Nested template calls
17243 !! wikitext
17244 {{Map-one-parameter|One-parameter|param}}
17245 !! html
17246 <p>(My parameter is: param)
17247 </p>
17248 !! end
17249
17250
17251 ###
17252 ### Sanitizer
17253 ###
17254
17255 # HTML+Tidy effectively strips out the empty tags completely
17256 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17257 # which Tidy would have done for the PHP parser had there been content inside it.
17258 !! test
17259 Sanitizer: Closing of open tags
17260 !! wikitext
17261 <s></s><table></table>
17262 !! html
17263 <s></s><table></table>
17264
17265 !! html/parsoid
17266 <p><s></s></p><table></table>
17267 !! end
17268
17269 !! test
17270 Sanitizer: Closing of open but not closed tags
17271 !! wikitext
17272 <s>foo
17273 !! html
17274 <p><s>foo</s>
17275 </p>
17276 !! end
17277
17278 !! test
17279 Sanitizer: Closing of closed but not open tags
17280 !! options
17281 parsoid=wt2html
17282 !! wikitext
17283 </s>
17284 !! html/php+tidy
17285 !! html/parsoid
17286 !! end
17287
17288 !! test
17289 Sanitizer: Closing of closed but not open table tags
17290 !! options
17291 parsoid=wt2html
17292 !! wikitext
17293 Table not started</td></tr></table>
17294 !! html/php+tidy
17295 <p>Table not started</p>
17296 !! html/parsoid
17297 <p>Table not started</p>
17298 !! end
17299
17300 !! test
17301 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17302 !! wikitext
17303 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17304 !! html/php
17305 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17306 </p>
17307 !! html/parsoid
17308 <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>
17309 !! end
17310
17311 # In HTML5, the restrictions are that id must contain at least one character,
17312 # and must not contain any space characters.
17313 !! test
17314 Sanitizer: Validating the contents of the id attribute (bug 4515)
17315 !! options
17316 disabled
17317 !! wikitext
17318 <br id="" /><br id="a space" />
17319 !! html
17320 Something ...
17321 !! end
17322
17323 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17324 !! test
17325 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
17326 !! options
17327 disabled
17328 !! wikitext
17329 <br id="foo" /><br id="foo" />
17330 !! html
17331 Something need to be done. foo-2 ?
17332 !! end
17333
17334 !! test
17335 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17336 !! wikitext
17337 <div itemscope>
17338 <meta itemprop="hello" content="world">
17339 <meta http-equiv="refresh" content="5">
17340 <meta itemprop="hello" http-equiv="refresh" content="5">
17341 <link itemprop="hello" href="{{SERVER}}">
17342 <link rel="stylesheet" href="{{SERVER}}">
17343 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17344 </div>
17345 !! html
17346 <div itemscope="">
17347 <p> <meta itemprop="hello" content="world" />
17348 &lt;meta http-equiv="refresh" content="5"&gt;
17349 <meta itemprop="hello" content="5" />
17350 </p>
17351 <link itemprop="hello" href="http&#58;//example.org" />
17352 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17353 <link itemprop="hello" href="http&#58;//example.org" />
17354 </div>
17355
17356 !! end
17357
17358 !! test
17359 Language converter: output gets cut off unexpectedly (bug 5757)
17360 !! options
17361 language=zh
17362 !! wikitext
17363 this bit is safe: }-
17364
17365 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17366
17367 then we get cut off here: }-
17368
17369 all additional text is vanished
17370 !! html
17371 <p>this bit is safe: }-
17372 </p><p>but if we add a conversion instance: xxx
17373 </p><p>then we get cut off here: }-
17374 </p><p>all additional text is vanished
17375 </p>
17376 !! end
17377
17378 !! test
17379 Self closed html pairs (bug 5487)
17380 !! options
17381 !! wikitext
17382 <center><font id="bug" />Centered text</center>
17383 <div><font id="bug2" />In div text</div>
17384 !! html
17385 <center>&lt;font id="bug" /&gt;Centered text</center>
17386 <div>&lt;font id="bug2" /&gt;In div text</div>
17387
17388 !! end
17389
17390 #
17391 #
17392 #
17393
17394 !! test
17395 Punctuation: nbsp before exclamation
17396 !! wikitext
17397 C'est grave !
17398 !! html
17399 <p>C'est grave&#160;!
17400 </p>
17401 !! end
17402
17403 !! test
17404 Punctuation: CSS !important (bug 11874)
17405 !! wikitext
17406 <div style="width:50% !important">important</div>
17407 !! html
17408 <div style="width:50% !important">important</div>
17409
17410 !!end
17411
17412 !! test
17413 Punctuation: CSS ! important (bug 11874; with space after)
17414 !! wikitext
17415 <div style="width:50% ! important">important</div>
17416 !! html
17417 <div style="width:50% ! important">important</div>
17418
17419 !!end
17420
17421 !! test
17422 HTML bullet list, closed tags (bug 5497)
17423 !! wikitext
17424 <ul>
17425 <li>One</li>
17426 <li>Two</li>
17427 </ul>
17428 !! html/php
17429 <ul>
17430 <li>One</li>
17431 <li>Two</li>
17432 </ul>
17433
17434 !! html/parsoid
17435 <ul data-parsoid='{"stx":"html"}'>
17436 <li data-parsoid='{"stx":"html"}'>One</li>
17437 <li data-parsoid='{"stx":"html"}'>Two</li>
17438 </ul>
17439
17440 !! end
17441
17442 !! test
17443 HTML bullet list, unclosed tags (bug 5497)
17444 !! wikitext
17445 <ul>
17446 <li>One
17447 <li>Two
17448 </ul>
17449 !! html/php+tidy
17450 <ul>
17451 <li>One</li>
17452 <li>Two</li>
17453 </ul>
17454 !! html/parsoid
17455 <ul data-parsoid='{"stx":"html"}'>
17456 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17457 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17458 </ul>
17459
17460 !! end
17461
17462 !! test
17463 HTML ordered list, closed tags (bug 5497)
17464 !! wikitext
17465 <ol>
17466 <li>One</li>
17467 <li>Two</li>
17468 </ol>
17469 !! html/php
17470 <ol>
17471 <li>One</li>
17472 <li>Two</li>
17473 </ol>
17474
17475 !! html/parsoid
17476 <ol data-parsoid='{"stx":"html"}'>
17477 <li data-parsoid='{"stx":"html"}'>One</li>
17478 <li data-parsoid='{"stx":"html"}'>Two</li>
17479 </ol>
17480
17481 !! end
17482
17483 !! test
17484 HTML ordered list, unclosed tags (bug 5497)
17485 !! options
17486 !! wikitext
17487 <ol>
17488 <li>One
17489 <li>Two
17490 </ol>
17491 !! html/php+tidy
17492 <ol>
17493 <li>One</li>
17494 <li>Two</li>
17495 </ol>
17496 !! html/parsoid
17497 <ol data-parsoid='{"stx":"html"}'>
17498 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17499 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17500 </ol>
17501
17502 !! end
17503
17504 !! test
17505 HTML nested bullet list, closed tags (bug 5497)
17506 !! wikitext
17507 <ul>
17508 <li>One</li>
17509 <li>Two:
17510 <ul>
17511 <li>Sub-one</li>
17512 <li>Sub-two</li>
17513 </ul>
17514 </li>
17515 </ul>
17516 !! html/php
17517 <ul>
17518 <li>One</li>
17519 <li>Two:
17520 <ul>
17521 <li>Sub-one</li>
17522 <li>Sub-two</li>
17523 </ul>
17524 </li>
17525 </ul>
17526
17527 !! html/parsoid
17528 <ul data-parsoid='{"stx":"html"}'>
17529 <li data-parsoid='{"stx":"html"}'>One</li>
17530 <li data-parsoid='{"stx":"html"}'>Two:
17531 <ul data-parsoid='{"stx":"html"}'>
17532 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17533 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17534 </ul>
17535 </li>
17536 </ul>
17537 !! end
17538
17539 !! test
17540 HTML nested bullet list, open tags (bug 5497)
17541 !! wikitext
17542 <ul>
17543 <li>One
17544 <li>Two:
17545 <ul>
17546 <li>Sub-one
17547 <li>Sub-two
17548 </ul>
17549 </ul>
17550 !! html/php+tidy
17551 <ul>
17552 <li>One</li>
17553 <li>Two:
17554 <ul>
17555 <li>Sub-one</li>
17556 <li>Sub-two</li>
17557 </ul>
17558 </li>
17559 </ul>
17560 !! html/parsoid
17561 <ul>
17562 <li>One
17563 </li>
17564 <li>Two:
17565 <ul>
17566 <li>Sub-one
17567 </li>
17568 <li>Sub-two
17569 </li>
17570 </ul>
17571 </li>
17572 </ul>
17573
17574 !! end
17575
17576 !! test
17577 HTML nested ordered list, closed tags (bug 5497)
17578 !! wikitext
17579 <ol>
17580 <li>One</li>
17581 <li>Two:
17582 <ol>
17583 <li>Sub-one</li>
17584 <li>Sub-two</li>
17585 </ol>
17586 </li>
17587 </ol>
17588 !! html
17589 <ol>
17590 <li>One</li>
17591 <li>Two:
17592 <ol>
17593 <li>Sub-one</li>
17594 <li>Sub-two</li>
17595 </ol>
17596 </li>
17597 </ol>
17598
17599 !! end
17600
17601 !! test
17602 HTML nested ordered list, open tags (bug 5497)
17603 !! wikitext
17604 <ol>
17605 <li>One
17606 <li>Two:
17607 <ol>
17608 <li>Sub-one
17609 <li>Sub-two
17610 </ol>
17611 </ol>
17612 !! html/php
17613 <ol>
17614 <li>One
17615 <li>Two:
17616 <ol>
17617 <li>Sub-one
17618 <li>Sub-two
17619 </ol>
17620 </ol>
17621
17622 !! html/parsoid
17623 <ol>
17624 <li>One
17625 </li>
17626 <li>Two:
17627 <ol>
17628 <li>Sub-one
17629 </li>
17630 <li>Sub-two
17631 </li>
17632 </ol>
17633 </li>
17634 </ol>
17635
17636 !! end
17637
17638 !! test
17639 HTML ordered list item with parameters oddity
17640 !! wikitext
17641 <ol><li id="fragment">One</li>
17642 </ol>
17643 !! html
17644 <ol><li id="fragment">One</li>
17645 </ol>
17646
17647 !! end
17648
17649 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17650 !!test
17651 bug 5918: autonumbering
17652 !! wikitext
17653 [http://first/] [http://second] [ftp://ftp]
17654
17655 ftp://inlineftp
17656
17657 [mailto:enclosed@mail.tld With target]
17658
17659 [mailto:enclosed@mail.tld]
17660
17661 mailto:inline@mail.tld
17662 !! html/php
17663 <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>
17664 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17665 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17666 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17667 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17668 </p>
17669 !! html/parsoid
17670 <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>
17671 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17672 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17673 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17674 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17675 !! end
17676
17677
17678 #
17679 # Security and HTML correctness
17680 # From Nick Jenkins' fuzz testing
17681 #
17682
17683 !! test
17684 Fuzz testing: Parser13
17685 !! wikitext
17686 {|
17687 | http://a|
17688 !! html
17689 <table>
17690 <tr>
17691 <td>
17692 </td>
17693 </tr>
17694 </table>
17695
17696 !! end
17697
17698 !! test
17699 Fuzz testing: Parser14
17700 !! wikitext
17701 == onmouseover= ==
17702 http://__TOC__
17703 !! html
17704 <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>
17705 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17706 <ul>
17707 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17708 </ul>
17709 </div>
17710
17711
17712 !! html+tidy
17713 <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>
17714 <p>http://</p>
17715 <div id="toc" class="toc">
17716 <div id="toctitle">
17717 <h2>Contents</h2>
17718 </div>
17719 <ul>
17720 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17721 </ul>
17722 </div>
17723 <p></p>
17724 !! end
17725
17726 !! test
17727 Fuzz testing: Parser14-table
17728 !! options
17729 parsoid=wt2html,html2html
17730 !! wikitext
17731 ==a==
17732 {| STYLE=__TOC__
17733 !! html
17734 <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>
17735 <table style="&#95;_TOC&#95;_">
17736 <tr><td></td></tr>
17737 </table>
17738
17739 !! html+tidy
17740 <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>
17741 <table style="__TOC__">
17742 <tr>
17743 <td></td>
17744 </tr>
17745 </table>
17746 !! html/parsoid
17747 <h2>a</h2>
17748 <table style="__TOC__"></table>
17749 !! end
17750
17751 # Known to produce bogus xml (extra </td>)
17752 !! test
17753 Fuzz testing: Parser16
17754 !! wikitext
17755 {|
17756 !https://||||||
17757 !! html
17758 <table>
17759 <tr>
17760 <th>https://</th>
17761 <th></th>
17762 <th></th>
17763 <th>
17764 </td>
17765 </tr>
17766 </table>
17767
17768 !! html+tidy
17769 <table>
17770 <tr>
17771 <th>https://</th>
17772 <th></th>
17773 <th></th>
17774 <th></th>
17775 </tr>
17776 </table>
17777 !! end
17778
17779 !! test
17780 Fuzz testing: Parser21
17781 !! wikitext
17782 {|
17783 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17784 |
17785 !! html
17786 <table>
17787 <tr>
17788 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17789 </th>
17790 <td>
17791 </td>
17792 </tr>
17793 </table>
17794
17795 !! end
17796
17797 !! test
17798 Fuzz testing: Parser22
17799 !! wikitext
17800 http://===r:::https://b
17801
17802 {|
17803 !! html
17804 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17805 </p>
17806 <table>
17807 <tr><td></td></tr>
17808 </table>
17809
17810 !! end
17811
17812 # Known to produce bad XML for now
17813 !! test
17814 Fuzz testing: Parser24
17815 !! options
17816 parsoid=wt2html
17817 !! wikitext
17818 {|
17819 {{{|
17820 <u CLASS=
17821 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17822 <br style="onmouseover='alert(document.cookie);' " />
17823
17824 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17825 |
17826 !! html/php
17827 <table>
17828 {{{|
17829 <u class="&#124;">}}}} &gt;
17830 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17831
17832 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17833 <tr>
17834 <td></u>
17835 </td>
17836 </tr>
17837 </table>
17838
17839 !! html/parsoid
17840 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
17841 <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":""}]]}'>
17842 <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}'>
17843
17844
17845
17846 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
17847 !! end
17848
17849 # Note: the current result listed for this is not what the original one was,
17850 # but the original bug was JavaScript injection, which is fixed in any case.
17851 # It's not clear that the original result listed was any more correct than the
17852 # current one. Original result:
17853 # <p>{{{|
17854 # </p>
17855 # <li class="&#124;&#124;">
17856 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17857 !!test
17858 Fuzz testing: Parser25 (bug 6055)
17859 !! wikitext
17860 {{{
17861 |
17862 <LI CLASS=||
17863 >
17864 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17865 !! html/php
17866 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17867 </p>
17868 !! html/parsoid
17869 <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"]}'>
17870 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
17871 !! end
17872
17873 !!test
17874 Fuzz testing: URL adjacent extension (with space, clean)
17875 !! wikitext
17876 http://example.com <nowiki>junk</nowiki>
17877 !! html/php
17878 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17879 </p>
17880 !! html/parsoid
17881 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17882 !! end
17883
17884 !!test
17885 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17886 !! wikitext
17887 http://example.com<nowiki>junk</nowiki>
17888 !! html/php
17889 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17890 </p>
17891 !! html/parsoid
17892 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17893 !! end
17894
17895 !!test
17896 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17897 !! wikitext
17898 http://example.com<pre>junk</pre>
17899 !! html/php
17900 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17901
17902 !! html/php+tidy
17903 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17904 <pre>
17905 junk
17906 </pre>
17907 !! html/parsoid
17908 <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>
17909 !!end
17910
17911 !!test
17912 Fuzz testing: image with bogus manual thumbnail
17913 !! wikitext
17914 [[Image:foobar.jpg|thumbnail= ]]
17915 !! html/php
17916 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17917
17918 !! html/parsoid
17919 <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>
17920 !!end
17921
17922 !! test
17923 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17924 !! wikitext
17925 <pre dir="&#10;"></pre>
17926 !! html
17927 <pre dir="&#10;"></pre>
17928
17929 !! end
17930
17931 !! test
17932 Parsing optional HTML elements (Bug 6171)
17933 !! options
17934 !! wikitext
17935 <table>
17936 <tr>
17937 <td> Some tabular data</td>
17938 <td> More tabular data ...
17939 <td> And yet som tabular data</td>
17940 </tr>
17941 </table>
17942 !! html
17943 <table>
17944 <tr>
17945 <td> Some tabular data</td>
17946 <td> More tabular data ...
17947 </td><td> And yet som tabular data</td>
17948 </tr>
17949 </table>
17950
17951 !! end
17952
17953 !! test
17954 Correct handling of <td>, <tr> (Bug 6171)
17955 !! options
17956 !! wikitext
17957 <table>
17958 <tr>
17959 <td> Some tabular data</td>
17960 <td> More tabular data ...</td>
17961 <td> And yet som tabular data</td>
17962 </tr>
17963 </table>
17964 !! html
17965 <table>
17966 <tr>
17967 <td> Some tabular data</td>
17968 <td> More tabular data ...</td>
17969 <td> And yet som tabular data</td>
17970 </tr>
17971 </table>
17972
17973 !! end
17974
17975
17976 !! test
17977 Parsing crashing regression (fr:JavaScript)
17978 !! wikitext
17979 </body></x>
17980 !! html
17981 <p>&lt;/body&gt;&lt;/x&gt;
17982 </p>
17983 !! end
17984
17985 !! test
17986 Inline wiki vs wiki block nesting
17987 !! wikitext
17988 '''Bold paragraph
17989
17990 New wiki paragraph
17991 !! html
17992 <p><b>Bold paragraph</b>
17993 </p><p>New wiki paragraph
17994 </p>
17995 !! end
17996
17997 # FIXME: The current php output is documented
17998 # and desired output is the parsoid target.
17999 !! test
18000 Inline HTML vs wiki block nesting
18001 !! wikitext
18002 <b>Bold paragraph
18003
18004 New wiki paragraph
18005 !! html/php
18006 <p><b>Bold paragraph
18007 </p><p>New wiki paragraph</b>
18008 </p>
18009 !! html/parsoid
18010 <p><b>Bold paragraph</b>
18011 </p><p>New wiki paragraph
18012 </p>
18013 !! end
18014
18015 # Original result was this:
18016 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
18017 # </p>
18018 # While that might be marginally more intuitive, maybe, the six-apostrophe
18019 # construct is clearly pathological and the result stated here (which is what
18020 # the parser actually does) is about as reasonable as anything.
18021 !!test
18022 Mixing markup for italics and bold
18023 !! options
18024 !! wikitext
18025 '''bold''''''bold''bolditalics'''''
18026 !! html
18027 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
18028 </p>
18029 !! end
18030
18031
18032 !! article
18033 Xyzzyx
18034 !! text
18035 Article for special page transclusion test
18036 !! endarticle
18037
18038 !! test
18039 Special page transclusion
18040 !! options
18041 !! wikitext
18042 {{Special:Prefixindex/Xyzzyx}}
18043 !! html
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 Special page transclusion twice (bug 5021)
18051 !! options
18052 !! wikitext
18053 {{Special:Prefixindex/Xyzzyx}}
18054 {{Special:Prefixindex/Xyzzyx}}
18055 !! html
18056 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18057 </ul>
18058 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18059 </ul>
18060
18061 !! end
18062
18063 !! test
18064 Transclusion of default MediaWiki message
18065 !! wikitext
18066 {{MediaWiki:Mainpage}}
18067 !! html
18068 <p>Main Page
18069 </p>
18070 !! end
18071
18072 !! test
18073 Transclusion of nonexistent MediaWiki message
18074 !! wikitext
18075 {{MediaWiki:Mainpagexxx}}
18076 !! html
18077 <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>
18078 </p>
18079 !! end
18080
18081 !! test
18082 Transclusion of MediaWiki message with underscore
18083 !! wikitext
18084 {{MediaWiki:history_short}}
18085 !! html
18086 <p>History
18087 </p>
18088 !! end
18089
18090 !! test
18091 Transclusion of MediaWiki message with space
18092 !! wikitext
18093 {{MediaWiki:history short}}
18094 !! html
18095 <p>History
18096 </p>
18097 !! end
18098
18099 !! test
18100 Invalid header with following text
18101 !! wikitext
18102 = x = y
18103 !! html
18104 <p>= x = y
18105 </p>
18106 !! end
18107
18108
18109 !! test
18110 Section extraction test (section 0)
18111 !! options
18112 section=0
18113 !! wikitext
18114 start
18115 ==a==
18116 ===aa===
18117 ====aaa====
18118 ==b==
18119 ===ba===
18120 ===bb===
18121 ====bba====
18122 ===bc===
18123 ==c==
18124 ===ca===
18125 !! html/php
18126 start
18127 !! end
18128
18129 !! test
18130 Section extraction test (section 1)
18131 !! options
18132 section=1
18133 !! wikitext
18134 start
18135 ==a==
18136 ===aa===
18137 ====aaa====
18138 ==b==
18139 ===ba===
18140 ===bb===
18141 ====bba====
18142 ===bc===
18143 ==c==
18144 ===ca===
18145 !! html/php
18146 ==a==
18147 ===aa===
18148 ====aaa====
18149 !! end
18150
18151 !! test
18152 Section extraction test (section 2)
18153 !! options
18154 section=2
18155 !! wikitext
18156 start
18157 ==a==
18158 ===aa===
18159 ====aaa====
18160 ==b==
18161 ===ba===
18162 ===bb===
18163 ====bba====
18164 ===bc===
18165 ==c==
18166 ===ca===
18167 !! html/php
18168 ===aa===
18169 ====aaa====
18170 !! end
18171
18172 !! test
18173 Section extraction test (section 3)
18174 !! options
18175 section=3
18176 !! wikitext
18177 start
18178 ==a==
18179 ===aa===
18180 ====aaa====
18181 ==b==
18182 ===ba===
18183 ===bb===
18184 ====bba====
18185 ===bc===
18186 ==c==
18187 ===ca===
18188 !! html/php
18189 ====aaa====
18190 !! end
18191
18192 !! test
18193 Section extraction test (section 4)
18194 !! options
18195 section=4
18196 !! wikitext
18197 start
18198 ==a==
18199 ===aa===
18200 ====aaa====
18201 ==b==
18202 ===ba===
18203 ===bb===
18204 ====bba====
18205 ===bc===
18206 ==c==
18207 ===ca===
18208 !! html/php
18209 ==b==
18210 ===ba===
18211 ===bb===
18212 ====bba====
18213 ===bc===
18214 !! end
18215
18216 !! test
18217 Section extraction test (section 5)
18218 !! options
18219 section=5
18220 !! wikitext
18221 start
18222 ==a==
18223 ===aa===
18224 ====aaa====
18225 ==b==
18226 ===ba===
18227 ===bb===
18228 ====bba====
18229 ===bc===
18230 ==c==
18231 ===ca===
18232 !! html/php
18233 ===ba===
18234 !! end
18235
18236 !! test
18237 Section extraction test (section 6)
18238 !! options
18239 section=6
18240 !! wikitext
18241 start
18242 ==a==
18243 ===aa===
18244 ====aaa====
18245 ==b==
18246 ===ba===
18247 ===bb===
18248 ====bba====
18249 ===bc===
18250 ==c==
18251 ===ca===
18252 !! html/php
18253 ===bb===
18254 ====bba====
18255 !! end
18256
18257 !! test
18258 Section extraction test (section 7)
18259 !! options
18260 section=7
18261 !! wikitext
18262 start
18263 ==a==
18264 ===aa===
18265 ====aaa====
18266 ==b==
18267 ===ba===
18268 ===bb===
18269 ====bba====
18270 ===bc===
18271 ==c==
18272 ===ca===
18273 !! html/php
18274 ====bba====
18275 !! end
18276
18277 !! test
18278 Section extraction test (section 8)
18279 !! options
18280 section=8
18281 !! wikitext
18282 start
18283 ==a==
18284 ===aa===
18285 ====aaa====
18286 ==b==
18287 ===ba===
18288 ===bb===
18289 ====bba====
18290 ===bc===
18291 ==c==
18292 ===ca===
18293 !! html/php
18294 ===bc===
18295 !! end
18296
18297 !! test
18298 Section extraction test (section 9)
18299 !! options
18300 section=9
18301 !! wikitext
18302 start
18303 ==a==
18304 ===aa===
18305 ====aaa====
18306 ==b==
18307 ===ba===
18308 ===bb===
18309 ====bba====
18310 ===bc===
18311 ==c==
18312 ===ca===
18313 !! html/php
18314 ==c==
18315 ===ca===
18316 !! end
18317
18318 !! test
18319 Section extraction test (section 10)
18320 !! options
18321 section=10
18322 !! wikitext
18323 start
18324 ==a==
18325 ===aa===
18326 ====aaa====
18327 ==b==
18328 ===ba===
18329 ===bb===
18330 ====bba====
18331 ===bc===
18332 ==c==
18333 ===ca===
18334 !! html/php
18335 ===ca===
18336 !! end
18337
18338 !! test
18339 Section extraction test (nonexistent section 11)
18340 !! options
18341 section=11
18342 !! wikitext
18343 start
18344 ==a==
18345 ===aa===
18346 ====aaa====
18347 ==b==
18348 ===ba===
18349 ===bb===
18350 ====bba====
18351 ===bc===
18352 ==c==
18353 ===ca===
18354 !! html/php
18355 !! end
18356
18357 !! test
18358 Section extraction test with bogus heading (section 1)
18359 !! options
18360 section=1
18361 !! wikitext
18362 ==a==
18363 ==bogus== not a legal section
18364 ==b==
18365 !! html/php
18366 ==a==
18367 ==bogus== not a legal section
18368 !! end
18369
18370 !! test
18371 Section extraction test with bogus heading (section 2)
18372 !! options
18373 section=2
18374 !! wikitext
18375 ==a==
18376 ==bogus== not a legal section
18377 ==b==
18378 !! html/php
18379 ==b==
18380 !! end
18381
18382 !! test
18383 Section extraction test with comment after heading (section 1)
18384 !! options
18385 section=1
18386 !! wikitext
18387 ==a==
18388 ==b== <!-- -->
18389 ==c==
18390 !! html/php
18391 ==a==
18392 !! end
18393
18394 !! test
18395 Section extraction test with comment after heading (section 2)
18396 !! options
18397 section=2
18398 !! wikitext
18399 ==a==
18400 ==b== <!-- -->
18401 ==c==
18402 !! html/php
18403 ==b== <!-- -->
18404 !! end
18405
18406 !! test
18407 Section extraction test with bogus <nowiki> heading (section 1)
18408 !! options
18409 section=1
18410 !! wikitext
18411 ==a==
18412 ==bogus== <nowiki>not a legal section</nowiki>
18413 ==b==
18414 !! html/php
18415 ==a==
18416 ==bogus== <nowiki>not a legal section</nowiki>
18417 !! end
18418
18419 !! test
18420 Section extraction test with bogus <nowiki> heading (section 2)
18421 !! options
18422 section=2
18423 !! wikitext
18424 ==a==
18425 ==bogus== <nowiki>not a legal section</nowiki>
18426 ==b==
18427 !! html/php
18428 ==b==
18429 !! end
18430
18431 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18432 # instead of respecting commented sections
18433 !! test
18434 Section extraction prefixed by comment (section 1)
18435 !! options
18436 section=1
18437 !! wikitext
18438 <!-- -->==sec1==
18439 ==sec2==
18440 !! html/php
18441 ==sec2==
18442 !!end
18443
18444 !! test
18445 Section extraction prefixed by comment (section 2)
18446 !! options
18447 section=2
18448 !! wikitext
18449 <!-- -->==sec1==
18450 ==sec2==
18451 !! html/php
18452
18453 !!end
18454
18455 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18456 # instead of respecting HTML-style headings
18457 !! test
18458 Section extraction, mixed wiki and html (section 1)
18459 !! options
18460 section=1
18461 !! wikitext
18462 <h2>unmarked</h2>
18463 unmarked
18464 ==1==
18465 one
18466 ==2==
18467 two
18468 !! html/php
18469 ==1==
18470 one
18471 !! end
18472
18473 !! test
18474 Section extraction, mixed wiki and html (section 2)
18475 !! options
18476 section=2
18477 !! wikitext
18478 <h2>unmarked</h2>
18479 unmarked
18480 ==1==
18481 one
18482 ==2==
18483 two
18484 !! html/php
18485 ==2==
18486 two
18487 !! end
18488
18489
18490 # Formerly testing for bug 3342
18491 !! test
18492 Section extraction, heading surrounded by <noinclude>
18493 !! options
18494 section=1
18495 !! wikitext
18496 <noinclude>==unmarked==</noinclude>
18497 ==marked==
18498 !! html/php
18499 ==marked==
18500 !!end
18501
18502 # Test behavior of bug 19910
18503 !! test
18504 Sectiion with all-equals
18505 !! options
18506 section=2
18507 !! wikitext
18508 ===
18509 The line above must have a trailing space
18510 === <!--
18511 --> <!-- -->
18512 But just in case it doesn't...
18513 !! html/php
18514 === <!--
18515 --> <!-- -->
18516 But just in case it doesn't...
18517 !! end
18518
18519 !! test
18520 Section replacement test (section 0)
18521 !! options
18522 replace=0,"xxx"
18523 !! wikitext
18524 start
18525 ==a==
18526 ===aa===
18527 ====aaa====
18528 ==b==
18529 ===ba===
18530 ===bb===
18531 ====bba====
18532 ===bc===
18533 ==c==
18534 ===ca===
18535 !! html/php
18536 xxx
18537
18538 ==a==
18539 ===aa===
18540 ====aaa====
18541 ==b==
18542 ===ba===
18543 ===bb===
18544 ====bba====
18545 ===bc===
18546 ==c==
18547 ===ca===
18548 !! end
18549
18550 !! test
18551 Section replacement test (section 1)
18552 !! options
18553 replace=1,"xxx"
18554 !! wikitext
18555 start
18556 ==a==
18557 ===aa===
18558 ====aaa====
18559 ==b==
18560 ===ba===
18561 ===bb===
18562 ====bba====
18563 ===bc===
18564 ==c==
18565 ===ca===
18566 !! html/php
18567 start
18568 xxx
18569
18570 ==b==
18571 ===ba===
18572 ===bb===
18573 ====bba====
18574 ===bc===
18575 ==c==
18576 ===ca===
18577 !! end
18578
18579 !! test
18580 Section replacement test (section 2)
18581 !! options
18582 replace=2,"xxx"
18583 !! wikitext
18584 start
18585 ==a==
18586 ===aa===
18587 ====aaa====
18588 ==b==
18589 ===ba===
18590 ===bb===
18591 ====bba====
18592 ===bc===
18593 ==c==
18594 ===ca===
18595 !! html/php
18596 start
18597 ==a==
18598 xxx
18599
18600 ==b==
18601 ===ba===
18602 ===bb===
18603 ====bba====
18604 ===bc===
18605 ==c==
18606 ===ca===
18607 !! end
18608
18609 !! test
18610 Section replacement test (section 3)
18611 !! options
18612 replace=3,"xxx"
18613 !! wikitext
18614 start
18615 ==a==
18616 ===aa===
18617 ====aaa====
18618 ==b==
18619 ===ba===
18620 ===bb===
18621 ====bba====
18622 ===bc===
18623 ==c==
18624 ===ca===
18625 !! html/php
18626 start
18627 ==a==
18628 ===aa===
18629 xxx
18630
18631 ==b==
18632 ===ba===
18633 ===bb===
18634 ====bba====
18635 ===bc===
18636 ==c==
18637 ===ca===
18638 !! end
18639
18640 !! test
18641 Section replacement test (section 4)
18642 !! options
18643 replace=4,"xxx"
18644 !! wikitext
18645 start
18646 ==a==
18647 ===aa===
18648 ====aaa====
18649 ==b==
18650 ===ba===
18651 ===bb===
18652 ====bba====
18653 ===bc===
18654 ==c==
18655 ===ca===
18656 !! html/php
18657 start
18658 ==a==
18659 ===aa===
18660 ====aaa====
18661 xxx
18662
18663 ==c==
18664 ===ca===
18665 !! end
18666
18667 !! test
18668 Section replacement test (section 5)
18669 !! options
18670 replace=5,"xxx"
18671 !! wikitext
18672 start
18673 ==a==
18674 ===aa===
18675 ====aaa====
18676 ==b==
18677 ===ba===
18678 ===bb===
18679 ====bba====
18680 ===bc===
18681 ==c==
18682 ===ca===
18683 !! html/php
18684 start
18685 ==a==
18686 ===aa===
18687 ====aaa====
18688 ==b==
18689 xxx
18690
18691 ===bb===
18692 ====bba====
18693 ===bc===
18694 ==c==
18695 ===ca===
18696 !! end
18697
18698 !! test
18699 Section replacement test (section 6)
18700 !! options
18701 replace=6,"xxx"
18702 !! wikitext
18703 start
18704 ==a==
18705 ===aa===
18706 ====aaa====
18707 ==b==
18708 ===ba===
18709 ===bb===
18710 ====bba====
18711 ===bc===
18712 ==c==
18713 ===ca===
18714 !! html/php
18715 start
18716 ==a==
18717 ===aa===
18718 ====aaa====
18719 ==b==
18720 ===ba===
18721 xxx
18722
18723 ===bc===
18724 ==c==
18725 ===ca===
18726 !! end
18727
18728 !! test
18729 Section replacement test (section 7)
18730 !! options
18731 replace=7,"xxx"
18732 !! wikitext
18733 start
18734 ==a==
18735 ===aa===
18736 ====aaa====
18737 ==b==
18738 ===ba===
18739 ===bb===
18740 ====bba====
18741 ===bc===
18742 ==c==
18743 ===ca===
18744 !! html/php
18745 start
18746 ==a==
18747 ===aa===
18748 ====aaa====
18749 ==b==
18750 ===ba===
18751 ===bb===
18752 xxx
18753
18754 ===bc===
18755 ==c==
18756 ===ca===
18757 !! end
18758
18759 !! test
18760 Section replacement test (section 8)
18761 !! options
18762 replace=8,"xxx"
18763 !! wikitext
18764 start
18765 ==a==
18766 ===aa===
18767 ====aaa====
18768 ==b==
18769 ===ba===
18770 ===bb===
18771 ====bba====
18772 ===bc===
18773 ==c==
18774 ===ca===
18775 !! html/php
18776 start
18777 ==a==
18778 ===aa===
18779 ====aaa====
18780 ==b==
18781 ===ba===
18782 ===bb===
18783 ====bba====
18784 xxx
18785
18786 ==c==
18787 ===ca===
18788 !!end
18789
18790 !! test
18791 Section replacement test (section 9)
18792 !! options
18793 replace=9,"xxx"
18794 !! wikitext
18795 start
18796 ==a==
18797 ===aa===
18798 ====aaa====
18799 ==b==
18800 ===ba===
18801 ===bb===
18802 ====bba====
18803 ===bc===
18804 ==c==
18805 ===ca===
18806 !! html/php
18807 start
18808 ==a==
18809 ===aa===
18810 ====aaa====
18811 ==b==
18812 ===ba===
18813 ===bb===
18814 ====bba====
18815 ===bc===
18816 xxx
18817 !! end
18818
18819 !! test
18820 Section replacement test (section 10)
18821 !! options
18822 replace=10,"xxx"
18823 !! wikitext
18824 start
18825 ==a==
18826 ===aa===
18827 ====aaa====
18828 ==b==
18829 ===ba===
18830 ===bb===
18831 ====bba====
18832 ===bc===
18833 ==c==
18834 ===ca===
18835 !! html/php
18836 start
18837 ==a==
18838 ===aa===
18839 ====aaa====
18840 ==b==
18841 ===ba===
18842 ===bb===
18843 ====bba====
18844 ===bc===
18845 ==c==
18846 xxx
18847 !! end
18848
18849 !! test
18850 Section replacement test with initial whitespace (bug 13728)
18851 !! options
18852 replace=2,"xxx"
18853 !! wikitext
18854 Preformatted initial line
18855 ==a==
18856 ===a===
18857 !! html/php
18858 Preformatted initial line
18859 ==a==
18860 xxx
18861 !! end
18862
18863
18864 !! test
18865 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18866 !! options
18867 section=1
18868 !! wikitext
18869 ==a==
18870 a
18871 !! html/php
18872 ==a==
18873 a
18874 !! end
18875
18876 !! test
18877 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18878 !! options
18879 section=1
18880 !! wikitext
18881 ==a==
18882 a
18883 !! html/php
18884 ==a==
18885 a
18886 !! end
18887
18888
18889 !! test
18890 Section extraction, <pre> around bogus header (bug 10309)
18891 !! options
18892 section=2
18893 !! wikitext
18894 == Section One ==
18895 <pre>
18896 =======
18897 </pre>
18898
18899 == Section Two ==
18900 stuff
18901 !! html/php
18902 == Section Two ==
18903 stuff
18904 !! end
18905
18906 !! test
18907 Section replacement, <pre> around bogus header (bug 10309)
18908 !! options
18909 replace=2,"xxx"
18910 !! wikitext
18911 == Section One ==
18912 <pre>
18913 =======
18914 </pre>
18915
18916 == Section Two ==
18917 stuff
18918 !! html/php
18919 == Section One ==
18920 <pre>
18921 =======
18922 </pre>
18923
18924 xxx
18925 !! end
18926
18927 !! test
18928 Handling of &#x0A; in URLs
18929 !! wikitext
18930 ** irc://&#x0A;a
18931 !! html/php
18932 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18933
18934 !! html/parsoid
18935 <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>
18936 !! end
18937
18938 !! test
18939 Handling of %0A in URLs
18940 !! wikitext
18941 ** irc://%0Aa
18942 !! html/php
18943 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18944
18945 !! html/parsoid
18946 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18947 !! end
18948
18949 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18950 !! test
18951 5 quotes, code coverage +1 line
18952 !! options
18953 parsoid=wt2html
18954 !! wikitext
18955 '''''
18956 !! html/php
18957 !! html/parsoid
18958 <p><b><i></i></b></p>
18959 !! end
18960
18961 # same html as previous, but wikitext adjusted to match parsoid html2wt
18962 # note that wt2html and html2html will put the <i> before the <b>
18963 !! test
18964 5 quotes, code coverage +1 line w/ nowiki (1)
18965 !! options
18966 parsoid=wt2wt,html2wt
18967 !! wikitext
18968 '''''<nowiki/>'''''
18969 !! html/php
18970 <p><i></i>
18971 </p>
18972 !! html/parsoid
18973 <p><b><i></i></b></p>
18974 !! end
18975
18976 # same as previous, just swapping the <i> and <b>
18977 !! test
18978 5 quotes, code coverage +1 line w/ nowiki (2)
18979 !! wikitext
18980 '''''<nowiki/>'''''
18981 !! html/php
18982 <p><i></i>
18983 </p>
18984 !! html/parsoid
18985 <p><i><b></b></i></p>
18986 !! end
18987
18988 !! test
18989 Special:Search page linking.
18990 !! wikitext
18991 {{Special:search}}
18992 !! html
18993 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18994 </p>
18995 !! end
18996
18997 !! test
18998 {{!}} is a magic word
18999 !! wikitext
19000 {{!}} is a magic word there and {{!}} is still a magic word here
19001 | is not a magic word here but {{!}} is still a magic word here
19002 !! html/php
19003 <p>| is a magic word there and | is still a magic word here
19004 | is not a magic word here but | is still a magic word here
19005 </p>
19006 !! html/parsoid
19007 <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
19008 | 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>
19009
19010 !! end
19011
19012 !! test
19013 Say the magic word
19014 !! options
19015 title=[[Parser test]]
19016 !! wikitext
19017 * {{PAGENAME}}
19018 * {{PAGENAMEE}}
19019 * {{FULLPAGENAME}}
19020 * {{FULLPAGENAMEE}}
19021 * {{BASEPAGENAME}}
19022 * {{BASEPAGENAMEE}}
19023 * {{SUBPAGENAME}}
19024 * {{SUBPAGENAMEE}}
19025 * {{ROOTPAGENAME}}
19026 * {{ROOTPAGENAMEE}}
19027 * {{TALKPAGENAME}}
19028 * {{TALKPAGENAMEE}}
19029 * {{SUBJECTPAGENAME}}
19030 * {{SUBJECTPAGENAMEE}}
19031 * {{NAMESPACEE}}
19032 * {{NAMESPACE}}
19033 * {{NAMESPACENUMBER}}
19034 * {{TALKSPACE}}
19035 * {{TALKSPACEE}}
19036 * {{SUBJECTSPACE}}
19037 * {{SUBJECTSPACEE}}
19038 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
19039 !! html
19040 <ul><li> Parser test</li>
19041 <li> Parser_test</li>
19042 <li> Parser test</li>
19043 <li> Parser_test</li>
19044 <li> Parser test</li>
19045 <li> Parser_test</li>
19046 <li> Parser test</li>
19047 <li> Parser_test</li>
19048 <li> Parser test</li>
19049 <li> Parser_test</li>
19050 <li> Talk:Parser test</li>
19051 <li> Talk:Parser_test</li>
19052 <li> Parser test</li>
19053 <li> Parser_test</li>
19054 <li> </li>
19055 <li> </li>
19056 <li> 0</li>
19057 <li> Talk</li>
19058 <li> Talk</li>
19059 <li> </li>
19060 <li> </li>
19061 <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>
19062
19063 !! end
19064 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
19065
19066 ## Parsoid thinks the "centre" here is a property, not a caption.
19067 !! test
19068 Gallery
19069 !! options
19070 parsoid={
19071 "modes": ["wt2html"],
19072 "nativeGallery": true
19073 }
19074 !! wikitext
19075 <gallery>
19076 image1.png |
19077 image2.gif|||||
19078
19079 image3|
19080 image4 |300px| centre
19081 image5.svg| http://///////
19082 [[x|xx]]]]
19083 * image6
19084 </gallery>
19085 !! html/php
19086 <ul class="gallery mw-gallery-traditional">
19087 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19088 <div class="thumb" style="height: 150px;">Image1.png</div>
19089 <div class="gallerytext">
19090 </div>
19091 </div></li>
19092 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19093 <div class="thumb" style="height: 150px;">Image2.gif</div>
19094 <div class="gallerytext">
19095 </div>
19096 </div></li>
19097 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19098 <div class="thumb" style="height: 150px;">Image3</div>
19099 <div class="gallerytext">
19100 </div>
19101 </div></li>
19102 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19103 <div class="thumb" style="height: 150px;">Image4</div>
19104 <div class="gallerytext">
19105 <pre>centre
19106 </pre>
19107 </div>
19108 </div></li>
19109 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19110 <div class="thumb" style="height: 150px;">Image5.svg</div>
19111 <div class="gallerytext">
19112 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
19113 </p>
19114 </div>
19115 </div></li>
19116 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19117 <div class="thumb" style="height: 150px;">* image6</div>
19118 <div class="gallerytext">
19119 </div>
19120 </div></li>
19121 </ul>
19122
19123 !! html/parsoid
19124 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19125 <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>
19126 <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>
19127 <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>
19128 <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>
19129 <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>
19130 <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>
19131 </ul>
19132 !! end
19133
19134 !! test
19135 Gallery (with options, html)
19136 !! options
19137 parsoid={
19138 "modes": ["wt2html", "html2html"],
19139 "nativeGallery": true
19140 }
19141 !! wikitext
19142 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19143 File:Nonexistent.jpg|caption
19144 File:Nonexistent.jpg
19145 image:foobar.jpg|some '''caption''' [[Main Page]]
19146 image:foobar.jpg
19147 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19148 </gallery>
19149 !! html/php
19150 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19151 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19152 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19153 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19154 <div class="gallerytext">
19155 <p>caption
19156 </p>
19157 </div>
19158 </div></li>
19159 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19160 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19161 <div class="gallerytext">
19162 </div>
19163 </div></li>
19164 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19165 <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>
19166 <div class="gallerytext">
19167 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19168 </p>
19169 </div>
19170 </div></li>
19171 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19172 <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>
19173 <div class="gallerytext">
19174 </div>
19175 </div></li>
19176 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19177 <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>
19178 <div class="gallerytext">
19179 <p>blabla.
19180 </p>
19181 </div>
19182 </div></li>
19183 </ul>
19184
19185 !! html/parsoid
19186 <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":{}}'>
19187 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19188 <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>
19189 <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>
19190 <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>
19191 <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>
19192 <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>
19193 </ul>
19194 !! end
19195
19196 !! test
19197 Gallery (with options, extsrc)
19198 !! options
19199 parsoid={
19200 "nativeGallery": false
19201 }
19202 !! wikitext
19203 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19204 File:Nonexistent.jpg|caption
19205 File:Nonexistent.jpg
19206 image:foobar.jpg|some '''caption''' [[Main Page]]
19207 image:foobar.jpg
19208 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19209 </gallery>
19210 !! html/php
19211 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19212 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19213 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19214 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19215 <div class="gallerytext">
19216 <p>caption
19217 </p>
19218 </div>
19219 </div></li>
19220 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19221 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19222 <div class="gallerytext">
19223 </div>
19224 </div></li>
19225 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19226 <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>
19227 <div class="gallerytext">
19228 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19229 </p>
19230 </div>
19231 </div></li>
19232 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19233 <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>
19234 <div class="gallerytext">
19235 </div>
19236 </div></li>
19237 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19238 <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>
19239 <div class="gallerytext">
19240 <p>blabla.
19241 </p>
19242 </div>
19243 </div></li>
19244 </ul>
19245
19246 !! html/parsoid
19247 <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"}}'>
19248 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19249 <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>
19250 <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>
19251 <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>
19252 <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>
19253 <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>
19254 </ul>
19255 !! end
19256
19257 !! test
19258 Gallery with link that has fragment
19259 !! options
19260 parsoid={
19261 "modes": ["wt2html", "html2html"],
19262 "nativeGallery": true
19263 }
19264 !! wikitext
19265 <gallery>
19266 image:foobar.jpg|link=Main_Page
19267 image:foobar.jpg|link=Main_Page#section
19268 image:foobar.jpg|link=Main Page#section|caption
19269 </gallery>
19270 !! html/php
19271 <ul class="gallery mw-gallery-traditional">
19272 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19273 <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>
19274 <div class="gallerytext">
19275 </div>
19276 </div></li>
19277 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19278 <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>
19279 <div class="gallerytext">
19280 </div>
19281 </div></li>
19282 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19283 <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>
19284 <div class="gallerytext">
19285 <p>caption
19286 </p>
19287 </div>
19288 </div></li>
19289 </ul>
19290
19291 !! html/parsoid
19292 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19293 <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>
19294 <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>
19295 <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>
19296 </ul>
19297 !! end
19298
19299 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19300 !! test
19301 Gallery with template inside caption
19302 !! options
19303 parsoid={
19304 "nativeGallery": true
19305 }
19306 !! wikitext
19307 <gallery caption="{{echo|hi}}">
19308 File:Foobar.jpg|{{echo|ho}}
19309 </gallery>
19310 !! html/php
19311 <ul class="gallery mw-gallery-traditional">
19312 <li class='gallerycaption'>{{echo|hi}}</li>
19313 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19314 <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>
19315 <div class="gallerytext">
19316 <p>ho
19317 </p>
19318 </div>
19319 </div></li>
19320 </ul>
19321
19322 !! html/parsoid
19323 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19324 <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>
19325 <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>
19326 </ul>
19327 !! end
19328
19329 !! test
19330 Gallery with wikitext inside caption
19331 !! options
19332 parsoid={
19333 "nativeGallery": true
19334 }
19335 !! wikitext
19336 <gallery>
19337 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19338 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19339 </gallery>
19340 !! html/php
19341 <ul class="gallery mw-gallery-traditional">
19342 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19343 <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>
19344 <div class="gallerytext">
19345 <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>
19346 </p>
19347 </div>
19348 </div></li>
19349 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19350 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
19351 <div class="gallerytext">
19352 <p>This is a test template
19353 </p>
19354 </div>
19355 </div></li>
19356 </ul>
19357
19358 !! html/parsoid
19359 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19360 <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>
19361 <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>
19362 </ul>
19363 !! end
19364
19365 !! test
19366 Gallery (with showfilename option)
19367 !! options
19368 parsoid={
19369 "nativeGallery": true
19370 }
19371 !! wikitext
19372 <gallery showfilename="">
19373 File:Nonexistent.jpg|caption
19374 File:Nonexistent.jpg
19375 File:Foobar.jpg|some '''caption''' [[Main Page]]
19376 File:Foobar.jpg
19377 </gallery>
19378 !! html/php
19379 <ul class="gallery mw-gallery-traditional">
19380 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19381 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19382 <div class="gallerytext">
19383 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19384 caption
19385 </p>
19386 </div>
19387 </div></li>
19388 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19389 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19390 <div class="gallerytext">
19391 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19392 </p>
19393 </div>
19394 </div></li>
19395 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19396 <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>
19397 <div class="gallerytext">
19398 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19399 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19400 </p>
19401 </div>
19402 </div></li>
19403 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19404 <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>
19405 <div class="gallerytext">
19406 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19407 </p>
19408 </div>
19409 </div></li>
19410 </ul>
19411
19412 !! html/parsoid
19413 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
19414 <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>
19415 <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>
19416 <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>
19417 <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>
19418 </ul>
19419 !! end
19420
19421 ## Should Parsoid be preserving these variations?
19422 !! test
19423 Gallery (with namespace-less filenames)
19424 !! options
19425 parsoid={
19426 "modes": ["wt2html", "html2html"],
19427 "nativeGallery": true
19428 }
19429 !! wikitext
19430 <gallery>
19431 File:Nonexistent.jpg
19432 Nonexistent.jpg
19433 image:foobar.jpg
19434 foobar.jpg
19435 </gallery>
19436 !! html/php
19437 <ul class="gallery mw-gallery-traditional">
19438 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19439 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19440 <div class="gallerytext">
19441 </div>
19442 </div></li>
19443 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19444 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19445 <div class="gallerytext">
19446 </div>
19447 </div></li>
19448 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19449 <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>
19450 <div class="gallerytext">
19451 </div>
19452 </div></li>
19453 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19454 <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>
19455 <div class="gallerytext">
19456 </div>
19457 </div></li>
19458 </ul>
19459
19460 !! html/parsoid
19461 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19462 <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>
19463 <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>
19464 <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>
19465 <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>
19466 </ul>
19467 !! end
19468
19469 !! test
19470 Gallery override link with WikiLink (T36852)
19471 !! options
19472 parsoid={
19473 "nativeGallery": true
19474 }
19475 !! wikitext
19476 <gallery>
19477 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
19478 </gallery>
19479 !! html/php
19480 <ul class="gallery mw-gallery-traditional">
19481 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19482 <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>
19483 <div class="gallerytext">
19484 </div>
19485 </div></li>
19486 </ul>
19487
19488 !! html/parsoid
19489 <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":{}}'>
19490 <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>
19491 </ul>
19492 !! end
19493
19494 !! test
19495 Gallery override link with absolute external link (T36852)
19496 !! options
19497 parsoid={
19498 "nativeGallery": true
19499 }
19500 !! wikitext
19501 <gallery>
19502 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
19503 </gallery>
19504 !! html/php
19505 <ul class="gallery mw-gallery-traditional">
19506 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19507 <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>
19508 <div class="gallerytext">
19509 </div>
19510 </div></li>
19511 </ul>
19512
19513 !! html/parsoid
19514 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19515 <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>
19516 </ul>
19517 !! end
19518
19519 !! test
19520 Gallery override link with absolute external link with LanguageConverter
19521 !! options
19522 language=zh
19523 !! input
19524 <gallery>
19525 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19526 </gallery>
19527 !! result
19528 <ul class="gallery mw-gallery-traditional">
19529 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19530 <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>
19531 <div class="gallerytext">
19532 <p>caption
19533 </p>
19534 </div>
19535 </div></li>
19536 </ul>
19537
19538 !! end
19539
19540 !! test
19541 Gallery override link with malicious javascript (T36852)
19542 !! options
19543 parsoid={
19544 "modes": ["wt2html", "html2html"],
19545 "nativeGallery": true
19546 }
19547 !! wikitext
19548 <gallery>
19549 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19550 </gallery>
19551 !! html/php
19552 <ul class="gallery mw-gallery-traditional">
19553 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19554 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%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>
19555 <div class="gallerytext">
19556 </div>
19557 </div></li>
19558 </ul>
19559
19560 !! html/parsoid
19561 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19562 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./%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>
19563 </ul>
19564 !! end
19565
19566 !! test
19567 Gallery with invalid title as link (T45964)
19568 !! options
19569 parsoid={
19570 "modes": ["wt2html", "html2html"],
19571 "nativeGallery": true
19572 }
19573 !! wikitext
19574 <gallery>
19575 File:Foobar.jpg|link=<
19576 </gallery>
19577 !! html/php
19578 <ul class="gallery mw-gallery-traditional">
19579 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19580 <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>
19581 <div class="gallerytext">
19582 </div>
19583 </div></li>
19584 </ul>
19585
19586 !! html/parsoid
19587 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
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 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>
19589 </ul>
19590 !! end
19591
19592 !! test
19593 Serialize gallery without attrs in data-mw
19594 !! options
19595 parsoid={
19596 "modes": ["html2wt"],
19597 "nativeGallery": true
19598 }
19599 !! html/parsoid
19600 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
19601 <li class="gallerycaption">123</li>
19602 <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>
19603 </ul>
19604 !! wikitext
19605 <gallery caption="123">
19606 File:Test.png
19607 </gallery>
19608 !! end
19609
19610 !! test
19611 HTML Hex character encoding (spells the word "JavaScript")
19612 !! options
19613 parsoid=wt2html,wt2wt,html2html
19614 !! wikitext
19615 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19616 !! html/php
19617 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19618 </p>
19619 !! html/php+tidy
19620 <p>JavaScript</p>
19621 !! html/parsoid
19622 <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>
19623 !! end
19624
19625 !! test
19626 HTML Hex character encoding bogus encoding (bug 26437 regression check)
19627 !! wikitext
19628 &#xsee;&#XSEE;
19629 !! html/php
19630 <p>&amp;#xsee;&amp;#XSEE;
19631 </p>
19632 !! html/parsoid
19633 <p>&amp;#xsee;&amp;#XSEE;</p>
19634 !! end
19635
19636 !! test
19637 HTML Hex character encoding mixed case
19638 !! options
19639 parsoid=wt2html,wt2wt,html2html
19640 !! wikitext
19641 &#xEE;&#Xee;
19642 !! html/php
19643 <p>&#xee;&#xee;
19644 </p>
19645 !! html/php+tidy
19646 <p>îî</p>
19647 !! html/parsoid
19648 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19649 !! end
19650
19651 # See: https://www.w3.org/TR/html5/syntax.html#character-references
19652 # Note that U+000C (form feed) is not a valid XML character, so
19653 # it is banned even though allowed in HTML5.
19654 !! test
19655 Illegal character references (T106578)
19656 !! wikitext
19657 ; Null: &#00;
19658 ; FF: &#xC;
19659 ; CR: &#xD;
19660 ; Control (low): &#8;
19661 ; Control (high): &#x7F; &#x9F;
19662 ; Surrogate: &#xD83D;&#xDCA9;
19663 ; This is an okay astral character: &#x1F4A9;
19664 !! html+tidy
19665 <dl>
19666 <dt>Null</dt>
19667 <dd>&amp;#00;</dd>
19668 <dt>FF</dt>
19669 <dd>&amp;#xC;</dd>
19670 <dt>CR</dt>
19671 <dd>&amp;#xD;</dd>
19672 <dt>Control (low)</dt>
19673 <dd>&amp;#8;</dd>
19674 <dt>Control (high)</dt>
19675 <dd>&amp;#x7F; &amp;#x9F;</dd>
19676 <dt>Surrogate</dt>
19677 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19678 <dt>This is an okay astral character</dt>
19679 <dd>💩</dd>
19680 </dl>
19681 !! end
19682
19683 !! test
19684 __FORCETOC__ override
19685 !! wikitext
19686 __NEWSECTIONLINK__
19687 __FORCETOC__
19688 !! html/php
19689 <p><br />
19690 </p>
19691 !! end
19692
19693 !! test
19694 ISBN code coverage
19695 !! wikitext
19696 ISBN 978-0-1234-56&#x20;789
19697 !! html
19698 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19699 </p>
19700 !! html+tidy
19701 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19702 !! html/parsoid
19703 <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>
19704 !! end
19705
19706 !! test
19707 ISBN followed by 5 spaces
19708 !! wikitext
19709 ISBN
19710 !! html
19711 <p>ISBN
19712 </p>
19713 !! end
19714
19715 !! test
19716 Double ISBN
19717 !! wikitext
19718 ISBN ISBN 1234567890
19719 !! html/php
19720 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19721 </p>
19722 !! html/parsoid
19723 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19724 !! end
19725
19726 # Uppercase X and lowercase x as well
19727 !! test
19728 ISBN with an X
19729 !! wikitext
19730 ISBN 3-462-04561-X
19731 ISBN 3-462-04561-x
19732 ISBN 080442957X
19733 ISBN 080442957x
19734 ISBN 978080442957X
19735 ISBN 978080442957x
19736 !! html/php
19737 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19738 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19739 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19740 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19741 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19742 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19743 </p>
19744 !! html/parsoid
19745 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19746 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19747 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19748 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19749 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19750 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19751 !! end
19752
19753 !! test
19754 ISBN with empty prefix (parsoid test)
19755 !! wikitext
19756 ISBN 1234567890
19757 !! html/php
19758 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19759 </p>
19760 !! html/parsoid
19761 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19762 !! end
19763
19764 !! test
19765 Bug 22905: <abbr> followed by ISBN followed by </a>
19766 !! wikitext
19767 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19768 !! html/php
19769 <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>
19770 </p>
19771 !! html/parsoid
19772 <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>
19773 !! end
19774
19775 !! test
19776 Double RFC
19777 !! wikitext
19778 RFC RFC 1234
19779 !! html
19780 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19781 </p>
19782 !! end
19783
19784 !! test
19785 Double RFC with a wiki link
19786 !! wikitext
19787 RFC [[RFC 1234]]
19788 !! html
19789 <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>
19790 </p>
19791 !! end
19792
19793 !! test
19794 RFC code coverage
19795 !! wikitext
19796 RFC 983&#x20;987
19797 !! html
19798 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19799 </p>
19800 !! html+tidy
19801 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19802 !! end
19803
19804 !! test
19805 Centre-aligned image
19806 !! wikitext
19807 [[Image:foobar.jpg|centre]]
19808 !! html
19809 <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>
19810
19811 !!end
19812
19813 !! test
19814 None-aligned image
19815 !! wikitext
19816 [[Image:foobar.jpg|none]]
19817 !! html
19818 <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>
19819
19820 !!end
19821
19822 !! test
19823 Width + Height sized image (using px) (height is ignored)
19824 !! wikitext
19825 [[Image:foobar.jpg|640x480px]]
19826 !! html
19827 <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>
19828 </p>
19829 !!end
19830
19831 !! test
19832 Width-sized image (using px, no following whitespace)
19833 !! wikitext
19834 [[Image:foobar.jpg|640px]]
19835 !! html
19836 <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>
19837 </p>
19838 !!end
19839
19840 !! test
19841 Width-sized image (using px, with following whitespace - test regression from r39467)
19842 !! wikitext
19843 [[Image:foobar.jpg|640px ]]
19844 !! html
19845 <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>
19846 </p>
19847 !!end
19848
19849 !! test
19850 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19851 !! wikitext
19852 [[Image:foobar.jpg| 640px]]
19853 !! html
19854 <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>
19855 </p>
19856 !!end
19857
19858 !! test
19859 Image with page parameter
19860 !! options
19861 djvu
19862 !! wikitext
19863 [[File:LoremIpsum.djvu|page=2]]
19864 !! html/php
19865 <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>
19866 </p>
19867 !! html/parsoid
19868 <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>
19869 !! end
19870
19871 !! test
19872 Another italics / bold test
19873 !! wikitext
19874 ''' ''x'
19875 !! html
19876 <pre>'<i> </i>x'
19877 </pre>
19878 !!end
19879
19880 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19881 !! test
19882 dt/dd/dl test
19883 !! wikitext
19884 :;;;::
19885 !! html/php
19886 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19887
19888 !! html/parsoid
19889 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19890
19891 !!end
19892
19893 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19894 !! test
19895 Images with the "|" character in the comment
19896 !! wikitext
19897 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19898 !! html/php
19899 <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>
19900
19901 !! html/parsoid
19902 <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>
19903 !! end
19904
19905 !! test
19906 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19907 !! wikitext
19908 <html><script>alert(1);</script></html>
19909 !! html
19910 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19911 </p>
19912 !! end
19913
19914 !! test
19915 HTML with raw HTML ($wgRawHtml==true)
19916 !! options
19917 wgRawHtml=1
19918 !! wikitext
19919 <html><script>alert(1);</script></html>
19920 !! html
19921 <p><script>alert(1);</script>
19922 </p>
19923 !! end
19924
19925 !! test
19926 Parents of subpages, one level up
19927 !! options
19928 subpage title=[[Subpage test/L1/L2/L3]]
19929 !! wikitext
19930 [[../|L2]]
19931 !! html
19932 <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>
19933 </p>
19934 !! end
19935
19936
19937 !! test
19938 Parents of subpages, one level up, not named
19939 !! options
19940 subpage title=[[Subpage test/L1/L2/L3]]
19941 !! wikitext
19942 [[../]]
19943 !! html
19944 <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>
19945 </p>
19946 !! end
19947
19948
19949
19950 !! test
19951 Parents of subpages, two levels up
19952 !! options
19953 subpage title=[[Subpage test/L1/L2/L3]]
19954 !! wikitext
19955 [[../../|L1]]2
19956
19957 [[../../|L1]]l
19958 !! html
19959 <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
19960 </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>
19961 </p>
19962 !! end
19963
19964 !! test
19965 Parents of subpages, two levels up, without trailing slash or name.
19966 !! options
19967 subpage title=[[Subpage test/L1/L2/L3]]
19968 !! wikitext
19969 [[../..]]
19970 !! html
19971 <p>[[../..]]
19972 </p>
19973 !! end
19974
19975 !! test
19976 Parents of subpages, two levels up, with lots of extra trailing slashes.
19977 !! options
19978 subpage title=[[Subpage test/L1/L2/L3]]
19979 !! wikitext
19980 [[../../////]]
19981 !! html
19982 <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>
19983 </p>
19984 !! end
19985
19986 !! article
19987 Subpage test/L1/L2/L3Sibling
19988 !! text
19989 Sibling article
19990 !! endarticle
19991
19992 !! test
19993 Transclusion of a sibling page (one level up)
19994 !! options
19995 subpage title=[[Subpage test/L1/L2/L3]]
19996 !! wikitext
19997 {{../L3Sibling}}
19998 !! html
19999 <p>Sibling article
20000 </p>
20001 !! end
20002
20003 !! test
20004 Transclusion of a child page
20005 !! options
20006 subpage title=[[Subpage test/L1/L2]]
20007 !! wikitext
20008 {{/L3Sibling}}
20009 !! html
20010 <p>Sibling article
20011 </p>
20012 !! end
20013
20014 # This is wt2html only in Parsoid because we add <nowiki>
20015 # because of {{..}} and we don't expect to fix that to
20016 # eliminate the nowikis selective for {{..}} markup.
20017 !! test
20018 Non-transclusion because of too many up levels
20019 !! options
20020 subpage title=[[Subpage test/L1/L2/L3]]
20021 parsoid=wt2html
20022 !! wikitext
20023 {{../../../../More than parent}}
20024 !! html/php
20025 <p>{{../../../../More than parent}}
20026 </p>
20027 !! html/parsoid
20028 <p>{{../../../../More than parent}}</p>
20029 !! end
20030
20031 !! test
20032 Definition list code coverage
20033 !! wikitext
20034 ; title : def
20035 ; title : def
20036 ;title: def
20037 !! html/php
20038 <dl><dt> title &#160;</dt>
20039 <dd> def</dd>
20040 <dt> title&#160;</dt>
20041 <dd> def</dd>
20042 <dt>title</dt>
20043 <dd> def</dd></dl>
20044
20045 !! html/parsoid
20046 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20047 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
20048 <dt>title</dt><dd> def</dd></dl>
20049 !! end
20050
20051 !! test
20052 Don't fall for the self-closing div
20053 !! wikitext
20054 <div>hello world</div/>
20055 !! html
20056 <div>hello world</div>
20057
20058 !! end
20059
20060 !! test
20061 MSGNW magic word
20062 !! wikitext
20063 {{MSGNW:msg}}
20064 !! html/php
20065 <p>&#91;&#91;:Template:Msg&#93;&#93;
20066 </p>
20067 !! end
20068
20069 !! test
20070 RAW magic word
20071 !! wikitext
20072 {{RAW:QUERTY}}
20073 !! html
20074 <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>
20075 </p>
20076 !! end
20077
20078 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
20079 !! test
20080 Always escape literal '>' in output, not just after '<'
20081 !! wikitext
20082 ><>
20083 !! html
20084 <p>&gt;&lt;&gt;
20085 </p>
20086 !! end
20087
20088 !! test
20089 Template caching
20090 !! wikitext
20091 {{Test}}
20092 {{Test}}
20093 !! html
20094 <p>This is a test template
20095 This is a test template
20096 </p>
20097 !! end
20098
20099
20100 !! article
20101 MediaWiki:Fake
20102 !! text
20103 ==header==
20104 !! endarticle
20105
20106 !! test
20107 Inclusion of !userCanEdit() content
20108 !! wikitext
20109 {{MediaWiki:Fake}}
20110 !! html
20111 <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>
20112
20113 !! end
20114
20115
20116 !! test
20117 Out-of-order TOC heading levels
20118 !! wikitext
20119 ==2==
20120 ======6======
20121 ===3===
20122 =1=
20123 =====5=====
20124 ==2==
20125 !! html
20126 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20127 <ul>
20128 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
20129 <ul>
20130 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
20131 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
20132 </ul>
20133 </li>
20134 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
20135 <ul>
20136 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
20137 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
20138 </ul>
20139 </li>
20140 </ul>
20141 </div>
20142
20143 <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>
20144 <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>
20145 <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>
20146 <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>
20147 <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>
20148 <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>
20149
20150 !! end
20151
20152
20153 !! test
20154 ISBN with a dummy number
20155 !! wikitext
20156 ISBN ---
20157 !! html
20158 <p>ISBN ---
20159 </p>
20160 !! end
20161
20162
20163 !! test
20164 ISBN with space-delimited number
20165 !! wikitext
20166 ISBN 92 9017 032 8
20167 !! html
20168 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
20169 </p>
20170 !! end
20171
20172
20173 !! test
20174 ISBN with multiple spaces, no number
20175 !! wikitext
20176 ISBN foo
20177 !! html
20178 <p>ISBN foo
20179 </p>
20180 !! end
20181
20182
20183 !! test
20184 ISBN length
20185 !! wikitext
20186 ISBN 123456789
20187
20188 ISBN 1234567890
20189
20190 ISBN 12345678901
20191 !! html
20192 <p>ISBN 123456789
20193 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20194 </p><p>ISBN 12345678901
20195 </p>
20196 !! end
20197
20198
20199 !! test
20200 ISBN with trailing year (bug 8110)
20201 !! wikitext
20202 ISBN 1-234-56789-0 - 2006
20203
20204 ISBN 1 234 56789 0 - 2006
20205 !! html
20206 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
20207 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20208 </p>
20209 !! end
20210
20211
20212 !! test
20213 anchorencode
20214 !! wikitext
20215 {{anchorencode:foo bar©#%n}}
20216 !! html
20217 <p>foo_bar.C2.A9.23.25n
20218 </p>
20219 !! end
20220
20221 !! test
20222 anchorencode trims spaces
20223 !! wikitext
20224 {{anchorencode: __pretty__please__}}
20225 !! html
20226 <p>pretty_please
20227 </p>
20228 !! end
20229
20230 !! test
20231 anchorencode deals with links
20232 !! wikitext
20233 {{anchorencode: [[hello|world]] [[hi]]}}
20234 !! html
20235 <p>world_hi
20236 </p>
20237 !! end
20238
20239 !! test
20240 anchorencode deals with templates
20241 !! wikitext
20242 {{anchorencode: {{Foo}} }}
20243 !! html
20244 <p>FOO
20245 </p>
20246 !! end
20247
20248 !! test
20249 anchorencode encodes like the TOC generator: (bug 18431)
20250 !! wikitext
20251 === _ +:.3A%3A&&amp;]] ===
20252 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20253 __NOEDITSECTION__
20254 !! html
20255 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20256 <p>.2B:.3A.253A.26.26.5D.5D
20257 </p>
20258 !! end
20259
20260 !! test
20261 Bug 6200: blockquotes and paragraph formatting
20262 !! wikitext
20263 <blockquote>
20264 foo
20265 </blockquote>
20266
20267 bar
20268
20269 baz
20270 !! html
20271 <blockquote>
20272 <p>foo
20273 </p>
20274 </blockquote>
20275 <p>bar
20276 </p>
20277 <pre>baz
20278 </pre>
20279 !! end
20280
20281 !! test
20282 Bug 8293: Use of center tag ruins paragraph formatting
20283 !! wikitext
20284 <center>
20285 foo
20286 </center>
20287
20288 bar
20289
20290 baz
20291 !! html
20292 <center>
20293 <p>foo
20294 </p>
20295 </center>
20296 <p>bar
20297 </p>
20298 <pre>baz
20299 </pre>
20300 !! end
20301
20302 !!test
20303 Parsing of overlapping (improperly nested) inline html tags
20304 !! wikitext
20305 <span><s>x</span></s>
20306 !! html/php
20307 <p><span><s>x&lt;/span&gt;</s></span>
20308 </p>
20309 !! html/parsoid
20310 <p><span><s>x</s></span>
20311 </p>
20312 !!end
20313
20314 ###
20315 ### Language variants related tests
20316 ###
20317 !! test
20318 Self-link in language variants
20319 !! options
20320 title=[[Dunav]] language=sr
20321 !! wikitext
20322 Both [[Dunav]] and [[Дунав]] are names for this river.
20323 !! html
20324 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
20325 </p>
20326 !!end
20327
20328 !! article
20329 Дуна
20330 !! text
20331 content
20332 !! endarticle
20333
20334 !! test
20335 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
20336 !! options
20337 title=[[Duna]] language=sr
20338 !! wikitext
20339 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
20340 !! html
20341 <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.
20342 </p>
20343 !! end
20344
20345 !! test
20346 Link to a section of a variant of this title shouldn't be parsed as self-link
20347 !! options
20348 title=[[Duna]] language=sr
20349 !! wikitext
20350 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
20351 !! html
20352 <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.
20353 </p>
20354 !! end
20355
20356 !! test
20357 Link to pages in language variants
20358 !! options
20359 language=sr
20360 !! wikitext
20361 Main Page can be written as [[Маин Паге]]
20362 !! html
20363 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
20364 </p>
20365 !!end
20366
20367
20368 !! test
20369 Multiple links to pages in language variants
20370 !! options
20371 language=sr
20372 !! wikitext
20373 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
20374 !! html
20375 <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>.
20376 </p>
20377 !!end
20378
20379
20380 !! test
20381 Simple template in language variants
20382 !! options
20383 language=sr
20384 !! wikitext
20385 {{тест}}
20386 !! html
20387 <p>This is a test template
20388 </p>
20389 !! end
20390
20391
20392 !! test
20393 Template with explicit namespace in language variants
20394 !! options
20395 language=sr
20396 !! wikitext
20397 {{Template:тест}}
20398 !! html
20399 <p>This is a test template
20400 </p>
20401 !! end
20402
20403
20404 !! test
20405 Basic test for template parameter in language variants
20406 !! options
20407 language=sr
20408 !! wikitext
20409 {{парамтест|param=foo}}
20410 !! html
20411 <p>This is a test template with parameter foo
20412 </p>
20413 !! end
20414
20415 !! test
20416 Simple category in language variants
20417 !! options
20418 language=sr cat
20419 !! wikitext
20420 [[Category:МедиаWики Усер'с Гуиде]]
20421 !! html/php
20422 cat=МедиаWики_Усер'с_Гуиде sort=
20423 !! html/parsoid
20424 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
20425 !! end
20426
20427 !! article
20428 Category:分类
20429 !! text
20430 blah
20431 !! endarticle
20432
20433 !! article
20434 Category:分類
20435 !! text
20436 blah
20437 !! endarticle
20438
20439 ## We used to, but no longer wt2wt this test since the default serializer
20440 ## will normalize all categories to serialize on their own line.
20441 ## This wikitext usage is going to be fairly uncommon in production and
20442 ## selser will take care of preserving formatting in those scenarios.
20443 !! test
20444 Don't convert blue categorylinks to another variant (bug 33210)
20445 !! options
20446 cat
20447 language=zh
20448 parsoid=wt2html
20449 !! wikitext
20450 [[A]][[Category:分类]]
20451 !! html/php
20452 cat=分类 sort=
20453 !! html/parsoid
20454 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
20455 <link rel="mw:PageProp/Category" href="./Category:分类"/>
20456 !! end
20457
20458 !! test
20459 Stripping -{}- tags (language variants)
20460 !! options
20461 language=sr
20462 !! wikitext
20463 Latin proverb: -{Ne nuntium necare}-
20464 !! html
20465 <p>Latin proverb: Ne nuntium necare
20466 </p>
20467 !! end
20468
20469
20470 !! test
20471 Prevent conversion with -{}- tags (language variants)
20472 !! options
20473 language=sr variant=sr-ec
20474 !! wikitext
20475 Latinski: -{Ne nuntium necare}-
20476 !! html
20477 <p>Латински: Ne nuntium necare
20478 </p>
20479 !! end
20480
20481
20482 !! test
20483 Prevent conversion of text with -{}- tags (language variants)
20484 !! options
20485 language=sr variant=sr-ec
20486 !! wikitext
20487 Latinski: -{Ne nuntium necare}-
20488 !! html
20489 <p>Латински: Ne nuntium necare
20490 </p>
20491 !! end
20492
20493
20494 !! test
20495 Prevent conversion of links with -{}- tags (language variants)
20496 !! options
20497 language=sr variant=sr-ec
20498 !! wikitext
20499 -{[[Main Page]]}-
20500 !! html
20501 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20502 </p>
20503 !! end
20504
20505
20506 !! test
20507 -{}- tags within headlines (within html for parserConvert())
20508 !! options
20509 language=sr variant=sr-ec
20510 !! wikitext
20511 == -{Naslov}- ==
20512 !! html
20513 <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>
20514
20515 !! end
20516
20517
20518 !! test
20519 Explicit definition of language variant alternatives
20520 !! options
20521 language=zh variant=zh-tw
20522 !! wikitext
20523 -{zh:China;zh-tw:Taiwan}-, not China
20524 !! html
20525 <p>Taiwan, not China
20526 </p>
20527 !! end
20528
20529
20530 !! test
20531 Conversion around HTML tags
20532 !! options
20533 language=sr variant=sr-ec
20534 !! wikitext
20535 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
20536 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
20537 !! html
20538 <p>
20539 <span title="ЛаCтин">ски</span>
20540 </p>
20541 !! end
20542
20543
20544 !! test
20545 Explicit session-wise language variant mapping (A flag and - flag)
20546 !! options
20547 language=zh variant=zh-tw
20548 !! wikitext
20549 Taiwan is not China.
20550 But -{A|zh:China;zh-tw:Taiwan}- is China,
20551 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20552 and -{China}- is China.
20553 !! html
20554 <p>Taiwan is not China.
20555 But Taiwan is Taiwan,
20556 (This should be stripped!)
20557 and China is China.
20558 </p>
20559 !! end
20560
20561 !! test
20562 Explicit session-wise language variant mapping (H flag for hide)
20563 !! options
20564 language=zh variant=zh-tw
20565 !! wikitext
20566 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20567 Taiwan is China.
20568 !! html
20569 <p>(This should be stripped!)
20570 Taiwan is Taiwan.
20571 </p>
20572 !! end
20573
20574 !! test
20575 Adding explicit conversion rule for title (T flag)
20576 !! options
20577 language=zh variant=zh-tw showtitle
20578 !! wikitext
20579 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20580 !! html
20581 Taiwan
20582 <p>Should be stripped!
20583 </p>
20584 !! end
20585
20586 !! test
20587 Testing that changing the language variant here in the tests actually works
20588 !! options
20589 language=zh variant=zh showtitle
20590 !! wikitext
20591 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20592 !! html
20593 China
20594 <p>Should be stripped!
20595 </p>
20596 !! end
20597
20598 !! test
20599 Recursive conversion of alt and title attrs shouldn't clear converter state
20600 !! options
20601 language=zh variant=zh-cn showtitle
20602 !! wikitext
20603 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20604 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20605 !! html
20606 China
20607 <p>
20608 Should be stripped<span title="Exclamation">!</span>
20609 </p>
20610 !! end
20611
20612 !! test
20613 Bug 24072: more test on conversion rule for title
20614 !! options
20615 language=zh variant=zh-tw showtitle
20616 !! wikitext
20617 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20618 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20619 !! html
20620 Taiwan
20621 <p>This should be stripped!
20622 This won't take interferes with the title rule.
20623 </p>
20624 !! end
20625
20626 !! test
20627 Partly disable title conversion if variant == main language code
20628 !! options
20629 language=zh variant=zh title=[[ZH]] showtitle
20630 !! wikitext
20631 -{T|zh-cn:CN;zh-tw:TW}-
20632 !! html
20633 ZH
20634 <p>
20635 </p>
20636 !! end
20637
20638 !! test
20639 Partly disable title conversion if variant == main language code, more
20640 !! options
20641 language=zh variant=zh title=[[ZH]] showtitle
20642 !! wikitext
20643 -{T|TW}-
20644 !! html
20645 ZH
20646 <p>
20647 </p>
20648 !! end
20649
20650 !! test
20651 Raw output of variant escape tags (R flag)
20652 !! options
20653 language=zh variant=zh-tw
20654 !! wikitext
20655 Raw: -{R|zh:China;zh-tw:Taiwan}-
20656 !! html
20657 <p>Raw: zh:China;zh-tw:Taiwan
20658 </p>
20659 !! end
20660
20661 !! test
20662 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20663 !! options
20664 language=zh variant=zh-cn
20665 !! input
20666 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20667 !! result
20668 <p>0
20669 </p>
20670 !! end
20671
20672 !! test
20673 Conversion rules from [numeric-only string] to [something else] (T48634)
20674 !! options
20675 language=zh variant=zh-cn
20676 !! input
20677 -{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
20678 !! result
20679 <p>D12345EE12345
20680 </p>
20681 !! end
20682
20683 !! test
20684 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20685 !! options
20686 language=zh variant=zh-cn
20687 !! input
20688 -{H|zh-cn:foo;zh-tw:;}-foobar
20689 !! result
20690 <p>foobar
20691 </p>
20692 !! end
20693
20694 !! test
20695 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20696 !! options
20697 language=zh variant=zh-cn
20698 !! input
20699 -{H|=>zh-cn:foo;}-foobar
20700 !! result
20701 <p>foobar
20702 </p>
20703 !! end
20704
20705 !! test
20706 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20707 !! options
20708 language=zh variant=zh-cn
20709 !! input
20710 -{H|}-foobar
20711 !! result
20712 <p>foobar
20713 </p>
20714 !! end
20715
20716 !! test
20717 Nested using of manual convert syntax
20718 !! options
20719 language=zh variant=zh-hk
20720 !! wikitext
20721 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20722 !! html
20723 <p>Nested: Hello Hong Kong!
20724 </p>
20725 !! end
20726
20727 # Since Parsoid is starting to emit canonical wikitext for links,
20728 # [http://example.com http://example.com] will not RT back to that
20729 # form anymore.
20730 !! test
20731 HTML markups with conversion syntax in attribs, nested in other conversion blocks
20732 !! options
20733 language=zh variant=zh-cn
20734 !! wikitext
20735 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
20736 !! html
20737 <p><span title="X">A</span>
20738 </p>
20739 !! end
20740
20741 !! test
20742 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet)
20743 !! options
20744 language=zh variant=zh-cn disabled
20745 !! wikitext
20746 -{<span title="-{X}-">A</span>}-
20747 !! html
20748 <p><span title="X">A</span>
20749 </p>
20750 !! end
20751
20752 !! test
20753 Proper conversion of text in external links
20754 !! options
20755 language=sr variant=sr-ec
20756 parsoid=wt2html
20757 !! wikitext
20758 http://www.google.com
20759 gopher://www.google.com
20760 [http://www.google.com http://www.google.com]
20761 [gopher://www.google.com gopher://www.google.com]
20762 [https://www.google.com irc://www.google.com]
20763 [ftp://www.google.com www.google.com/ftp://dir]
20764 [//www.google.com www.google.com]
20765 !! html/php
20766 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20767 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20768 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20769 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20770 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20771 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20772 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20773 </p>
20774 !! html/parsoid
20775 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20776 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20777 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20778 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20779 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20780 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20781 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20782 !! end
20783
20784 !! test
20785 Do not convert roman numbers to language variants
20786 !! options
20787 language=sr variant=sr-ec
20788 !! wikitext
20789 Fridrih IV je car.
20790 !! html
20791 <p>Фридрих IV је цар.
20792 </p>
20793 !! end
20794
20795 !! test
20796 Unclosed language converter markup "-{"
20797 !! options
20798 language=sr
20799 !! wikitext
20800 -{T|hello
20801 !! html
20802 <p>-{T|hello
20803 </p>
20804 !! end
20805
20806 !! test
20807 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20808 !! options
20809 language=sr
20810 !! wikitext
20811 -{R|=&gt;}-
20812 !! html
20813 <p>=&gt;
20814 </p>
20815 !!end
20816
20817 !! test
20818 Don't break link parsing if language converter markup is in the caption.
20819 !! options
20820 language=sr variant=sr-ec
20821 !! wikitext
20822 [[Main Page|-{R|main page}-]]
20823 !! html
20824 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20825 </p>
20826 !! end
20827
20828 # FIXME: This test is currently broken in the PHP parser T153761
20829 !! test
20830 T146304: Don't break template parsing if language converter markup is in the parameter.
20831 !! options
20832 language=sr variant=sr-ec
20833 disabled
20834 !! wikitext
20835 {{echo|-{R|foo}-}}
20836 !! html/php
20837 <p>foo
20838 </p>
20839 !! end
20840
20841 !! test
20842 T146305: Don't break image parsing if language converter markup is in the caption.
20843 !! options
20844 language=sr
20845 !! wikitext
20846 [[File:Foobar.jpg|thumb|-{R|caption:}-]]
20847 !! html/php
20848 <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>
20849
20850 !! html/parsoid
20851 <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>
20852 !! end
20853
20854 !! test
20855 T146305: Don't break image parsing if nested language converter markup is in the caption.
20856 !! options
20857 language=zh variant=zh-cn
20858 !! wikitext
20859 [[File:Foobar.jpg|thumb|-{zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
20860 !! html/php
20861 <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>
20862
20863 !! html/parsoid
20864 <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>
20865 !! end
20866
20867 !! test
20868 Don't break gallery if language converter markup is inside.
20869 !! options
20870 language=zh
20871 !! wikitext
20872 <gallery>
20873 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
20874 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
20875 </gallery>
20876 !! html
20877 <ul class="gallery mw-gallery-traditional">
20878 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20879 <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>
20880 <div class="gallerytext">
20881 <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>
20882 </p>
20883 </div>
20884 </div></li>
20885 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20886 <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>
20887 <div class="gallerytext">
20888 <p>This is a test template
20889 </p>
20890 </div>
20891 </div></li>
20892 </ul>
20893
20894 !! end
20895
20896 !! test
20897 T153135: Don't break list handling if language converter markup is in the item.
20898 !! options
20899 language=zh variant=zh-cn
20900 !! wikitext
20901 ;-{zh-cn:AAA;zh-tw:BBB}-
20902 ;-{R|foo:bar}-
20903 !! html/php
20904 <dl><dt>AAA</dt>
20905 <dt>foo:bar</dt></dl>
20906
20907 !! html/parsoid
20908 <dl>
20909 <dt><span typeof="mw:LanguageVariant" data-mw='{"bidir":[{"l":"zh-cn","t":"AAA"},{"l":"zh-tw","t":"BBB"}],"show":true}'></span></dt>
20910 <dt><span typeof="mw:LanguageVariant" data-mw='{"disabled":true,"show":true,"text":"foo:bar"}'></span></dt>
20911 </dl>
20912 !! end
20913
20914 // Note that parsoid does not protect colons unless language converter
20915 // markup is properly nested, because it is a backtracking parser.
20916 !! test
20917 T153135: Unclosed markup in definition list (code coverage)
20918 !! options
20919 language=zh variant=zh-cn
20920 !! wikitext
20921 ;<b>foo:bar
20922 ;-{zh-cn:AAA
20923 !! html/php
20924 <dl><dt><b>foo:bar</dt>
20925 <dt>-{zh-cn:AAA</b></dt></dl>
20926
20927 !! html/parsoid
20928 <dl>
20929 <dt><b>foo:bar</b></dt>
20930 <b>
20931 <dt>-{zh-cn</dt>
20932 <dd>AAA</dd>
20933 </b></dl>
20934 !! end
20935
20936 !! test
20937 T153135: Nested language converter markup in definition list (code coverage)
20938 !! options
20939 language=zh variant=zh-cn
20940 !! wikitext
20941 ;-{zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
20942 !! html/php
20943 <dl><dt>AAA foo:bar bat:baz</dt>
20944 <dd>def</dd></dl>
20945
20946 !! html/parsoid
20947 <dl>
20948 <dt><span typeof="mw:LanguageVariant" data-mw='{"bidir":[{"l":"zh-cn","t":"AAA &lt;span typeof=\"mw:LanguageVariant\" data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[13,32,null,2]}&#39; data-mw=&#39;{\"filter\":[\"zh-hans\"],\"text\":\"bar\"}&#39;>&lt;/span> &lt;span typeof=\"mw:LanguageVariant\" data-parsoid=&#39;{\"fl\":[\"R\"],\"dsr\":[33,46,null,2]}&#39; data-mw=&#39;{\"disabled\":true,\"show\":true,\"text\":\"bat:baz\"}&#39;>&lt;/span>"}],"show":true}'></span></dt>
20949 <dd>def</dd>
20950 </dl>
20951 !! end
20952
20953 !! test
20954 T153140: Don't break table handling if language converter markup is in the cell.
20955 !! options
20956 language=sr variant=sr-ec
20957 !! wikitext
20958 {|
20959 |-
20960 | -{R|B}-
20961 |}
20962 !! html/php
20963 <table>
20964
20965 <tr>
20966 <td> B
20967 </td></tr></table>
20968
20969 !! html/parsoid
20970 <table>
20971
20972 <tr>
20973 <td> B
20974 </td></tr></table>
20975
20976 !! end
20977
20978 !! test
20979 Bug 529: Uncovered bullet
20980 !! wikitext
20981 * Foo {{bullet}}
20982 !! html
20983 <ul><li> Foo </li>
20984 <li> Bar</li></ul>
20985
20986 !! end
20987
20988 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20989 # Templates in Wikipedia rely on this behavior, as tidy has always been
20990 # enabled there. These tests are normally run *without* tidy, so specify the
20991 # full output here.
20992 # To test realistic parsing behavior, apply a tidy-like transformation to both
20993 # the expected output and your parser's output.
20994 !! test
20995 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20996 !! wikitext
20997 ******* Foo {{bullet}}
20998 !! html
20999 <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>
21000 <li> Bar</li></ul>
21001
21002 !! end
21003
21004 !! test
21005 Bug 529: Uncovered table already at line-start
21006 !! wikitext
21007 x
21008
21009 {{table}}
21010 y
21011 !! html
21012 <p>x
21013 </p>
21014 <table>
21015 <tr>
21016 <td> 1 </td>
21017 <td> 2
21018 </td></tr>
21019 <tr>
21020 <td> 3 </td>
21021 <td> 4
21022 </td></tr></table>
21023 <p>y
21024 </p>
21025 !! end
21026
21027 !! test
21028 Bug 529: Uncovered bullet in parser function result
21029 !! wikitext
21030 * Foo {{lc:{{bullet}} }}
21031 !! html
21032 <ul><li> Foo </li>
21033 <li> bar</li></ul>
21034
21035 !! end
21036
21037 !! test
21038 Bug 5678: Double-parsed template argument
21039 !! wikitext
21040 {{lc:{{{1}}}|hello}}
21041 !! html
21042 <p>{{{1}}}
21043 </p>
21044 !! end
21045
21046 !! test
21047 Bug 5678: Double-parsed template invocation
21048 !! wikitext
21049 {{lc:{{paramtest {{!}} param = hello }} }}
21050 !! html
21051 <p>{{paramtest | param = hello }}
21052 </p>
21053 !! end
21054
21055 !! test
21056 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
21057 !! options
21058 language=cs
21059 title=[[Main Page]]
21060 !! wikitext
21061 {{PRVNÍVELKÉ:ěščř}}
21062 {{prvnívelké:ěščř}}
21063 {{PRVNÍMALÉ:ěščř}}
21064 {{prvnímalé:ěščř}}
21065 {{MALÁ:ěščř}}
21066 {{malá:ěščř}}
21067 {{VELKÁ:ěščř}}
21068 {{velká:ěščř}}
21069 !! html
21070 <p>Ěščř
21071 Ěščř
21072 ěščř
21073 ěščř
21074 ěščř
21075 ěščř
21076 ĚŠČŘ
21077 ĚŠČŘ
21078 </p>
21079 !! end
21080
21081 !! test
21082 Morwen/13: Unclosed link followed by heading
21083 !! wikitext
21084 [[link
21085 ==heading==
21086 !! html
21087 <p>[[link
21088 </p>
21089 <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>
21090
21091 !! end
21092
21093 !! test
21094 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
21095 !! wikitext
21096 {{foo|
21097 =heading=
21098 !! html
21099 <p>{{foo|
21100 </p>
21101 <h1><span class="mw-headline" id="heading">heading</span></h1>
21102
21103 !! end
21104
21105 !! test
21106 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
21107 !! wikitext
21108 {{foo|
21109 ==heading==
21110 !! html
21111 <p>{{foo|
21112 </p>
21113 <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>
21114
21115 !! end
21116
21117 !! test
21118 Tildes in comments
21119 !! options
21120 pst
21121 !! wikitext
21122 <!-- ~~~~ -->
21123 !! html/php
21124 <!-- ~~~~ -->
21125 !! end
21126
21127 !! test
21128 Paragraphs inside divs (no extra line breaks)
21129 !! wikitext
21130 <div>Line one
21131
21132 Line two</div>
21133 !! html
21134 <div>Line one
21135 Line two</div>
21136
21137 !! end
21138
21139 !! test
21140 Paragraphs inside divs (extra line break on open)
21141 !! wikitext
21142 <div>
21143 Line one
21144
21145 Line two</div>
21146 !! html
21147 <div>
21148 <p>Line one
21149 </p>
21150 Line two</div>
21151
21152 !! end
21153
21154 !! test
21155 Paragraphs inside divs (extra line break on close)
21156 !! wikitext
21157 <div>Line one
21158
21159 Line two
21160 </div>
21161 !! html
21162 <div>Line one
21163 <p>Line two
21164 </p>
21165 </div>
21166
21167 !! end
21168
21169 !! test
21170 Paragraphs inside divs (extra line break on open and close)
21171 !! wikitext
21172 <div>
21173 Line one
21174
21175 Line two
21176 </div>
21177 !! html
21178 <div>
21179 <p>Line one
21180 </p><p>Line two
21181 </p>
21182 </div>
21183
21184 !! end
21185
21186 !! test
21187 Nesting tags, paragraphs on lines which begin with <div>
21188 !! wikitext
21189 <div></div><strong>A
21190 B</strong>
21191 !! html/php+tidy
21192 <p><strong>A</strong></p>
21193 <p><strong>B</strong></p>
21194 !! html/parsoid
21195 <div></div>
21196 <p><strong>A
21197 B</strong>
21198 </p>
21199 !! end
21200
21201 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
21202 !! test
21203 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
21204 !! wikitext
21205 <blockquote>Line one
21206
21207 Line two</blockquote>
21208 !! html
21209 <blockquote>Line one
21210 Line two</blockquote>
21211
21212 !! html+tidy
21213 <blockquote>
21214 <p>Line one Line two</p>
21215 </blockquote>
21216 !! end
21217
21218 !! test
21219 Bug 6200: paragraphs inside blockquotes (extra line break on open)
21220 !! wikitext
21221 <blockquote>
21222 Line one
21223
21224 Line two</blockquote>
21225 !! html
21226 <blockquote>
21227 <p>Line one
21228 </p>
21229 Line two</blockquote>
21230
21231 !! html+tidy
21232 <blockquote>
21233 <p>Line one</p>
21234 Line two</blockquote>
21235 !! end
21236
21237 !! test
21238 Bug 6200: paragraphs inside blockquotes (extra line break on close)
21239 !! wikitext
21240 <blockquote>Line one
21241
21242 Line two
21243 </blockquote>
21244 !! html
21245 <blockquote>Line one
21246 <p>Line two
21247 </p>
21248 </blockquote>
21249
21250 !! html+tidy
21251 <blockquote>
21252 <p>Line one</p>
21253 <p>Line two</p>
21254 </blockquote>
21255 !! end
21256
21257 !! test
21258 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
21259 !! wikitext
21260 <blockquote>
21261 Line one
21262
21263 Line two
21264 </blockquote>
21265 !! html
21266 <blockquote>
21267 <p>Line one
21268 </p><p>Line two
21269 </p>
21270 </blockquote>
21271
21272 !! html+tidy
21273 <blockquote>
21274 <p>Line one</p>
21275 <p>Line two</p>
21276 </blockquote>
21277 !! end
21278
21279 !! test
21280 Paragraphs inside blockquotes/divs (no extra line breaks)
21281 !! wikitext
21282 <blockquote><div>Line one
21283
21284 Line two</div></blockquote>
21285 !! html
21286 <blockquote><div>Line one
21287 Line two</div></blockquote>
21288
21289 !! end
21290
21291 !! test
21292 Paragraphs inside blockquotes/divs (extra line break on open)
21293 !! wikitext
21294 <blockquote><div>
21295 Line one
21296
21297 Line two</div></blockquote>
21298 !! html
21299 <blockquote><div>
21300 <p>Line one
21301 </p>
21302 Line two</div></blockquote>
21303
21304 !! end
21305
21306 !! test
21307 Paragraphs inside blockquotes/divs (extra line break on close)
21308 !! wikitext
21309 <blockquote><div>Line one
21310
21311 Line two
21312 </div></blockquote>
21313 !! html
21314 <blockquote><div>Line one
21315 <p>Line two
21316 </p>
21317 </div></blockquote>
21318
21319 !! end
21320
21321 !! test
21322 Paragraphs inside blockquotes/divs (extra line break on open and close)
21323 !! wikitext
21324 <blockquote><div>
21325 Line one
21326
21327 Line two
21328 </div></blockquote>
21329 !! html
21330 <blockquote><div>
21331 <p>Line one
21332 </p><p>Line two
21333 </p>
21334 </div></blockquote>
21335
21336 !! end
21337
21338 !! test
21339 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
21340 !! options
21341 wgLinkHolderBatchSize=0
21342 !! wikitext
21343 [[meatball:1]]
21344 [[meatball:2]]
21345 [[meatball:3]]
21346 !! html
21347 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
21348 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
21349 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
21350 </p>
21351 !! end
21352
21353 !! test
21354 Free external link invading image caption
21355 !! wikitext
21356 [[Image:Foobar.jpg|thumb|http://x|hello]]
21357 !! html
21358 <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>
21359
21360 !! end
21361
21362 !! test
21363 Bug 15196: localised external link numbers
21364 !! options
21365 language=fa
21366 !! wikitext
21367 [http://en.wikipedia.org/]
21368 !! html/php
21369 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
21370 </p>
21371 !! html/parsoid
21372 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
21373 !! end
21374
21375 !! test
21376 Multibyte character in padleft
21377 !! wikitext
21378 {{padleft:-Hello|7|Æ}}
21379 !! html
21380 <p>Æ-Hello
21381 </p>
21382 !! end
21383
21384 !! test
21385 Multibyte character in padright
21386 !! wikitext
21387 {{padright:Hello-|7|Æ}}
21388 !! html
21389 <p>Hello-Æ
21390 </p>
21391 !! end
21392
21393 !!test
21394 formatdate parser function
21395 !! wikitext
21396 {{#formatdate:2009-03-24}}
21397 !! html
21398 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
21399 </p>
21400 !! end
21401
21402 !!test
21403 formatdate parser function, with default format
21404 !! wikitext
21405 {{#formatdate:2009-03-24|mdy}}
21406 !! html
21407 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
21408 </p>
21409 !! end
21410
21411 !! test
21412 Spacing of numbers in formatted dates
21413 !! wikitext
21414 {{#formatdate:January 15}}
21415 !! html
21416 <p><span class="mw-formatted-date" title="01-15">January 15</span>
21417 </p>
21418 !! end
21419
21420 !! test
21421 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
21422 !! options
21423 language=nl title=[[MediaWiki:Common.css]]
21424 !! wikitext
21425 {{#formatdate:2009-03-24|dmy}}
21426 !! html
21427 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
21428 </p>
21429 !! end
21430
21431 #
21432 #
21433 #
21434
21435 #
21436 # Edit comments
21437 #
21438
21439 !! test
21440 Edit comment with link
21441 !! options
21442 comment
21443 !! wikitext
21444 I like the [[Main Page]] a lot
21445 !! html/php
21446 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
21447 !!end
21448
21449 !! test
21450 Edit comment with link and link text
21451 !! options
21452 comment
21453 !! wikitext
21454 I like the [[Main Page|best pages]] a lot
21455 !! html/php
21456 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21457 !!end
21458
21459 !! test
21460 Edit comment with link and link text with suffix
21461 !! options
21462 comment
21463 !! wikitext
21464 I like the [[Main Page|best page]]s a lot
21465 !! html/php
21466 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21467 !!end
21468
21469 !! test
21470 Edit comment with section link (non-local, eg in history list)
21471 !! options
21472 comment title=[[Main Page]]
21473 !! wikitext
21474 /* External links */ removed bogus entries
21475 !! html/php
21476 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21477 !!end
21478
21479 !! test
21480 Edit comment with section link and text before it (non-local, eg in history list)
21481 !! options
21482 comment title=[[Main Page]]
21483 !! wikitext
21484 pre-comment text /* External links */ removed bogus entries
21485 !! html/php
21486 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>
21487 !!end
21488
21489 !! test
21490 Edit comment with section link (local, eg in diff view)
21491 !! options
21492 comment local title=[[Main Page]]
21493 !! wikitext
21494 /* External links */ removed bogus entries
21495 !! html/php
21496 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21497 !!end
21498
21499 !! test
21500 Edit comment with subpage link (bug 14080)
21501 !! options
21502 comment
21503 subpage
21504 title=[[Subpage test]]
21505 !! wikitext
21506 Poked at a [[/subpage]] here...
21507 !! html/php
21508 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
21509 !!end
21510
21511 !! test
21512 Edit comment with subpage link and link text (bug 14080)
21513 !! options
21514 comment
21515 subpage
21516 title=[[Subpage test]]
21517 !! wikitext
21518 Poked at a [[/subpage|neat little page]] here...
21519 !! html/php
21520 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
21521 !!end
21522
21523 !! test
21524 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
21525 !! options
21526 comment
21527 title=[[Subpage test]]
21528 !! wikitext
21529 Poked at a [[/subpage]] here...
21530 !! html/php
21531 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...
21532 !!end
21533
21534 !! test
21535 Edit comment with bare anchor link (local, as on diff)
21536 !! options
21537 comment
21538 local
21539 title=[[Main Page]]
21540 !! wikitext
21541 [[#section]]
21542 !! html/php
21543 <a href="#section">#section</a>
21544 !! end
21545
21546 !! test
21547 Edit comment with bare anchor link (non-local, as on history)
21548 !! options
21549 comment
21550 title=[[Main Page]]
21551 !! wikitext
21552 [[#section]]
21553 !! html/php
21554 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
21555 !! end
21556
21557 !! test
21558 Anchor starting with underscore
21559 !! options
21560 title=[[Foo]]
21561 !! wikitext
21562 [[#_ref|One]]
21563 !! html/php
21564 <p><a href="#_ref">One</a>
21565 </p>
21566 !! html/parsoid
21567 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
21568 !! end
21569
21570 !! test
21571 Id starting with underscore
21572 !! wikitext
21573 <div id="_ref"></div>
21574 !! html/*
21575 <div id="_ref"></div>
21576
21577 !! end
21578
21579 !! test
21580 Edit comment with link with more than one pipe (T99346)
21581 !! options
21582 comment
21583 !! wikitext
21584 [[Main Page|Many|pipes]]
21585 !! html/php
21586 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
21587 !! end
21588
21589 !! test
21590 Complex edit comment with link with more than one pipe (T99346)
21591 !! options
21592 comment
21593 !! wikitext
21594 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
21595 !! html/php
21596 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;
21597 !! end
21598
21599 !! test
21600 Space normalisation on autocomment (bug 22784)
21601 !! options
21602 comment
21603 title=[[Main Page]]
21604 !! wikitext
21605 /* __hello__world__ */
21606 !! html/php
21607 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
21608 !! end
21609
21610 !! test
21611 percent-encoding and + signs in comments (Bug 26410)
21612 !! options
21613 comment
21614 !! wikitext
21615 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
21616 !! html/php
21617 <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>
21618 !! end
21619
21620 # Parsoid doesn't support this yet: see bug 73581
21621 # but it *should* omit the 'src' attribute if the image is bad.
21622 # PHP side of tests was disabled in
21623 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
21624 # because of issues in the PHP parserTests infrastructure
21625 # (but the output below is indeed what the PHP side emits)
21626 !! test
21627 Bad images - basic functionality
21628 !! wikitext
21629 [[File:Bad.jpg]]
21630 !! DISABLED/html/php
21631 !! html/parsoid
21632 <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>
21633 !! end
21634
21635 !! test
21636 Bad images - bug 16039: text after bad image disappears
21637 !! wikitext
21638 Foo bar
21639 [[File:Bad.jpg]]
21640 Bar foo
21641 !! DISABLED/html/php
21642 <p>Foo bar
21643 </p><p>Bar foo
21644 </p>
21645 !! html/parsoid
21646 <p>Foo bar
21647 <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>
21648 Bar foo</p>
21649 !! end
21650
21651 !! test
21652 Verify that displaytitle works (bug #22501) no displaytitle
21653 !! options
21654 showtitle
21655 !! config
21656 wgAllowDisplayTitle=true
21657 wgRestrictDisplayTitle=false
21658 !! wikitext
21659 this is not the the title
21660 !! html/php
21661 Parser test
21662 <p>this is not the the title
21663 </p>
21664 !! end
21665
21666 !! test
21667 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
21668 !! options
21669 showtitle
21670 title=[[Screen]]
21671 !! config
21672 wgAllowDisplayTitle=true
21673 wgRestrictDisplayTitle=false
21674 !! wikitext
21675 this is not the the title
21676 {{DISPLAYTITLE:whatever}}
21677 !! html/php
21678 whatever
21679 <p>this is not the the title
21680 </p>
21681 !! end
21682
21683 !! test
21684 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
21685 !! options
21686 showtitle
21687 title=[[Screen]]
21688 !! config
21689 wgAllowDisplayTitle=true
21690 wgRestrictDisplayTitle=true
21691 !! wikitext
21692 this is not the the title
21693 {{DISPLAYTITLE:whatever}}
21694 !! html/php
21695 Screen
21696 <p>this is not the the title
21697 </p>
21698 !! end
21699
21700 !! test
21701 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
21702 !! options
21703 showtitle
21704 title=[[Screen]]
21705 !! config
21706 wgAllowDisplayTitle=true
21707 wgRestrictDisplayTitle=true
21708 !! wikitext
21709 this is not the the title
21710 {{DISPLAYTITLE:screen}}
21711 !! html/php
21712 screen
21713 <p>this is not the the title
21714 </p>
21715 !! end
21716
21717 !! test
21718 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
21719 !! options
21720 showtitle
21721 title=[[Screen]]
21722 !! config
21723 wgAllowDisplayTitle=false
21724 !! wikitext
21725 this is not the the title
21726 {{DISPLAYTITLE:screen}}
21727 !! html/php
21728 Screen
21729 <p>this is not the the title
21730 <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>
21731 </p>
21732 !! end
21733
21734 !! test
21735 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
21736 !! options
21737 showtitle
21738 title=[[Screen]]
21739 !! config
21740 wgAllowDisplayTitle=false
21741 !! wikitext
21742 this is not the the title
21743 !! html/php
21744 Screen
21745 <p>this is not the the title
21746 </p>
21747 !! end
21748
21749 !! test
21750 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
21751 !! options
21752 showtitle
21753 title=[[Screen]]
21754 !! config
21755 wgAllowDisplayTitle=true
21756 wgRestrictDisplayTitle=true
21757 !! wikitext
21758 this is not the the title
21759 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21760 !! html/php
21761 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21762 <p>this is not the the title
21763 </p>
21764 !! end
21765
21766 !! test
21767 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
21768 !! options
21769 showtitle
21770 title=[[Screen]]
21771 !! config
21772 wgAllowDisplayTitle=true
21773 wgRestrictDisplayTitle=true
21774 !! wikitext
21775 this is not the the title
21776 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21777 !! html/php
21778 <span style="color: red;">s</span>creen
21779 <p>this is not the the title
21780 </p>
21781 !! end
21782
21783 !! test
21784 Page status indicators: Empty name is invalid
21785 !! options
21786 showindicators
21787 !! wikitext
21788 <indicator name=" "></indicator>
21789 <indicator></indicator>
21790 !! html
21791 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21792 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21793 </p>
21794 !! end
21795
21796 !! test
21797 Page status indicators: Weird syntaxes that are okay
21798 !! options
21799 showindicators
21800 !! wikitext
21801 <indicator name="empty" />
21802 <indicator name="name"></indicator>
21803 !! html
21804 empty=
21805 name=
21806 <p><br />
21807 </p>
21808 !! end
21809
21810 !! test
21811 Page status indicators: Torture test
21812 !! options
21813 showindicators
21814 !! wikitext
21815 <indicator name="01">hello world</indicator>
21816 <indicator name="02">[[Main Page]]</indicator>
21817 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21818 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21819 <indicator name="05">* foo
21820 * bar</indicator>
21821 <indicator name="06"><nowiki>foo</nowiki></indicator>
21822 <indicator name="07"> Preformatted</indicator>
21823 <indicator name="08"><div>Broken tag</indicator>
21824 <indicator name="09">{| class=wikitable
21825 | cell
21826 |}</indicator>
21827 <indicator name="10">Two
21828
21829 paragraphs</indicator>
21830 !! html
21831 01=hello world
21832 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21833 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" />
21834 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>
21835 05=<ul><li> foo</li>
21836 <li> bar</li></ul>
21837
21838 06=foo
21839 07=<pre>Preformatted
21840 </pre>
21841 08=<div>Broken tag</div>
21842
21843 09=<table class="wikitable">
21844 <tr>
21845 <td> cell
21846 </td></tr></table>
21847
21848 10=<p>Two
21849 </p><p>paragraphs
21850 </p>
21851 <p><br />
21852 </p><p><br />
21853 </p><p><br />
21854 </p><p><br />
21855 </p><p><br />
21856 </p>
21857 !! end
21858
21859 !! test
21860 preload: check <noinclude> and <includeonly>
21861 !! options
21862 preload
21863 !! wikitext
21864 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21865 !! html/php
21866 Hello kind world.
21867 !! end
21868
21869 !! test
21870 preload: check <onlyinclude>
21871 !! options
21872 preload
21873 !! wikitext
21874 Goodbye <onlyinclude>Hello world</onlyinclude>
21875 !! html/php
21876 Hello world
21877 !! end
21878
21879 !! test
21880 preload: can pass tags through if we want to
21881 !! options
21882 preload
21883 !! wikitext
21884 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21885 !! html/php
21886 <includeonly>Hello world</includeonly>
21887 !! end
21888
21889 !! test
21890 preload: check that it doesn't try to do tricks
21891 !! options
21892 preload
21893 !! wikitext
21894 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21895 !! html/php
21896 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21897 !! end
21898
21899 !! test
21900 Play a bit with r67090 and bug 3158
21901 !! wikitext
21902 <div style="width:50% !important">&nbsp;</div>
21903 <div style="width:50%&nbsp;!important">&nbsp;</div>
21904 <div style="width:50%&#160;!important">&nbsp;</div>
21905 <div style="border : solid;">&nbsp;</div>
21906 !! html/php
21907 <div style="width:50% !important">&#160;</div>
21908 <div style="width:50% !important">&#160;</div>
21909 <div style="width:50% !important">&#160;</div>
21910 <div style="border&#160;: solid;">&#160;</div>
21911
21912 !! html/parsoid
21913 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21914 <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>
21915 <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>
21916 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21917
21918 !! end
21919
21920 !! test
21921 HTML5 data attributes
21922 !! wikitext
21923 <span data-foo="bar">Baz</span>
21924 <p data-abc-def_hij="">Quuz</p>
21925 !! html/php
21926 <p><span data-foo="bar">Baz</span>
21927 </p>
21928 <p data-abc-def_hij="">Quuz</p>
21929
21930 !! html/parsoid
21931 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21932 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21933 !! end
21934
21935 !! test
21936 Strip reserved data attributes
21937 !! wikitext
21938 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21939 !! html/php
21940 <div data-ok="fred">d</div>
21941
21942 !! html/parsoid
21943 <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>
21944 !! end
21945
21946 !! test
21947 percent-encoding and + signs in internal links (Bug 26410)
21948 !! wikitext
21949 [[User:+%]] [[Page+title%]]
21950 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21951 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21952 [[%33%45]] [[%33%45+]]
21953 !! html/php
21954 <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>
21955 <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>
21956 <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>
21957 <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>
21958 </p>
21959 !! html/parsoid
21960 <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>
21961 <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>
21962 <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>
21963 <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>
21964 !! end
21965
21966 !! test
21967 Special characters in embedded file links (bug 27679)
21968 !! wikitext
21969 [[File:Contains & ampersand.jpg]]
21970 [[File:Does not exist.jpg|Title with & ampersand]]
21971 !! html/php
21972 <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>
21973 <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>
21974 </p>
21975 !! html/parsoid
21976 <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>
21977 <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>
21978 !! end
21979
21980 !! test
21981 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21982 !! wikitext
21983 Text&apos;s been normalized?
21984 !! html
21985 <p>Text&#39;s been normalized?
21986 </p>
21987 !! end
21988
21989 !! test
21990 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21991 !! wikitext
21992 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21993 !! html
21994 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21995 </p>
21996 !! end
21997
21998 !! test
21999 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
22000 !! wikitext
22001 [http://www.example.org/ ideograms]
22002 !! html
22003 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
22004 </p>
22005 !! end
22006
22007 !! test
22008 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
22009 !! wikitext
22010 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
22011 !! html
22012 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
22013 </p>
22014 !! end
22015
22016 !! article
22017 Mediawiki:loop1
22018 !! text
22019 {{Identical|A}}
22020 !! endarticle
22021
22022 !! article
22023 Mediawiki:loop2
22024 !! text
22025 {{Identical|B}}
22026 !! endarticle
22027
22028 !! article
22029 Template:Identical
22030 !! text
22031 {{int:loop1}}
22032 {{int:loop2}}
22033 !! endarticle
22034
22035 !! test
22036 Bug 31098 Template which includes system messages which includes the template
22037 !! wikitext
22038 {{Identical}}
22039 !! html
22040 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22041 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
22042 </p>
22043 !! end
22044
22045 !! test
22046 Bug31490 Turkish: ucfirst 'blah'
22047 !! options
22048 language=tr
22049 !! wikitext
22050 {{ucfirst:blah}}
22051 !! html
22052 <p>Blah
22053 </p>
22054 !! end
22055
22056 !! test
22057 Bug31490 Turkish: ucfirst 'ix'
22058 !! options
22059 language=tr
22060 !! wikitext
22061 {{ucfirst:ix}}
22062 !! html
22063 <p>İx
22064 </p>
22065 !! end
22066
22067 !! test
22068 Bug31490 Turkish: lcfirst 'BLAH'
22069 !! options
22070 language=tr
22071 !! wikitext
22072 {{lcfirst:BLAH}}
22073 !! html
22074 <p>bLAH
22075 </p>
22076 !! end
22077
22078 !! test
22079 Bug31490 Turkish: ucfırst (with a dotless i)
22080 !! options
22081 language=tr
22082 !! wikitext
22083 {{ucfırst:blah}}
22084 !! html
22085 <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>
22086 </p>
22087 !! end
22088
22089 !! test
22090 Bug31490 ucfırst (with a dotless i) with English language
22091 !! options
22092 language=en
22093 !! wikitext
22094 {{ucfırst:blah}}
22095 !! html
22096 <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>
22097 </p>
22098 !! end
22099
22100 !! test
22101 Bug 26375: TOC with italics
22102 !! options
22103 title=[[Main Page]]
22104 !! wikitext
22105 __TOC__
22106 == ''Lost'' episodes ==
22107 !! html
22108 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22109 <ul>
22110 <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>
22111 </ul>
22112 </div>
22113
22114 <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>
22115
22116 !! end
22117
22118 !! test
22119 Bug 26375: TOC with bold
22120 !! options
22121 title=[[Main Page]]
22122 !! wikitext
22123 __TOC__
22124 == '''should be bold''' then normal text ==
22125 !! html
22126 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22127 <ul>
22128 <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>
22129 </ul>
22130 </div>
22131
22132 <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>
22133
22134 !! end
22135
22136 !! test
22137 Bug 33845: Headings become cursive in TOC when they contain an image
22138 !! options
22139 title=[[Main Page]]
22140 !! wikitext
22141 __TOC__
22142 == Image [[Image:foobar.jpg]] ==
22143 !! html
22144 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22145 <ul>
22146 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
22147 </ul>
22148 </div>
22149
22150 <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>
22151
22152 !! end
22153
22154 !! test
22155 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
22156 !! options
22157 title=[[Main Page]]
22158 !! wikitext
22159 __TOC__
22160 == <blockquote>Quote</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="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22165 </ul>
22166 </div>
22167
22168 <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>
22169
22170 !! html+tidy
22171 <p></p>
22172 <div id="toc" class="toc">
22173 <div id="toctitle">
22174 <h2>Contents</h2>
22175 </div>
22176 <ul>
22177 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22178 </ul>
22179 </div>
22180 <p></p>
22181 <h2><span class="mw-headline" id="Quote"></span></h2>
22182 <blockquote>
22183 <p><span class="mw-headline" id="Quote">Quote</span></p>
22184 </blockquote>
22185 <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>
22186 !! end
22187
22188 !! test
22189 Unclosed tags in TOC
22190 !! options
22191 title=[[Main Page]]
22192 !! wikitext
22193 __TOC__
22194 == Proof: 2 < 3 ==
22195 <small>Hanc marginis exiguitas non caperet.</small>
22196 QED
22197 !! html
22198 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22199 <ul>
22200 <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>
22201 </ul>
22202 </div>
22203
22204 <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>
22205 <p><small>Hanc marginis exiguitas non caperet.</small>
22206 QED
22207 </p>
22208 !! end
22209
22210 !! test
22211 Multiple tags in TOC
22212 !! wikitext
22213 __TOC__
22214 == <i>Foo</i> <b>Bar</b> ==
22215
22216 == <i>Foo</i> <blockquote>Bar</blockquote> ==
22217 !! html
22218 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22219 <ul>
22220 <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>
22221 <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>
22222 </ul>
22223 </div>
22224
22225 <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>
22226 <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>
22227
22228 !! html+tidy
22229 <p></p>
22230 <div id="toc" class="toc">
22231 <div id="toctitle">
22232 <h2>Contents</h2>
22233 </div>
22234 <ul>
22235 <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>
22236 <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>
22237 </ul>
22238 </div>
22239 <p></p>
22240 <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>
22241 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
22242 <blockquote>
22243 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
22244 </blockquote>
22245 <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>
22246 !! end
22247
22248 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
22249 # html5 tag parsing.
22250 !! test
22251 Tags with parameters in TOC
22252 !! options
22253 parsoid=wt2html
22254 !! wikitext
22255 __TOC__
22256 == <sup class="in-h2">Hello</sup> ==
22257
22258 == <sup class="a > b">Evilbye</sup> ==
22259 !! html/php
22260 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22261 <ul>
22262 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
22263 <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>
22264 </ul>
22265 </div>
22266
22267 <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>
22268 <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>
22269
22270 !! html/parsoid
22271 <meta property="mw:PageProp/toc" />
22272 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
22273
22274 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
22275 !! end
22276
22277 !! test
22278 span tags with directionality in TOC
22279 !! wikitext
22280 __TOC__
22281 == <span dir="ltr">C++</span> ==
22282
22283 == <span dir="rtl">זבנג!</span> ==
22284
22285 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
22286
22287 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
22288
22289 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
22290 !! html
22291 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22292 <ul>
22293 <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>
22294 <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>
22295 <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>
22296 <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>
22297 <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>
22298 </ul>
22299 </div>
22300
22301 <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>
22302 <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>
22303 <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>
22304 <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>
22305 <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>
22306
22307 !! end
22308
22309 !! test
22310 Bug 72884: bdi element in ToC
22311 !! wikitext
22312 __TOC__
22313 == <bdi>test</bdi> ==
22314 !! html
22315 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22316 <ul>
22317 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
22318 </ul>
22319 </div>
22320
22321 <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>
22322
22323 !! end
22324
22325 !! test
22326 T35715: s/strike element in ToC
22327 !! wikitext
22328 __TOC__
22329 == <s>test</s> test <strike>test</strike> ==
22330 !! html
22331 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22332 <ul>
22333 <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>
22334 </ul>
22335 </div>
22336
22337 <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>
22338
22339 !! end
22340
22341 # Note that the html output does not have the <p></p>, but the
22342 # html+tidy output *does*. This is because the empty <p></p> is
22343 # removed by the sanitizer, but only when tidy is *not* enabled (!).
22344 !! test
22345 Empty <p> tag in TOC, removed by Sanitizer (T92892)
22346 !! wikitext
22347 __TOC__
22348 == x ==
22349 !! html
22350 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22351 <ul>
22352 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22353 </ul>
22354 </div>
22355
22356 <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>
22357
22358 !! html+tidy
22359 <p></p>
22360 <div id="toc" class="toc">
22361 <div id="toctitle">
22362 <h2>Contents</h2>
22363 </div>
22364 <ul>
22365 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22366 </ul>
22367 </div>
22368 <p></p>
22369 <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>
22370 !! end
22371
22372 !! article
22373 MediaWiki:Bug32057
22374 !! text
22375 == {{int:headline_sample}} ==
22376 !! endarticle
22377
22378 !! test
22379 Bug 32057: Title needed when expanding <h> nodes.
22380 !! options
22381 title=[[Main Page]]
22382 !! wikitext
22383 {{int:Bug32057}}
22384 !! html
22385 <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>
22386
22387 !! end
22388
22389 !! test
22390 Strip marker in urlencode
22391 !! wikitext
22392 {{urlencode:x<nowiki/>y}}
22393 {{urlencode:x<nowiki/>y|wiki}}
22394 {{urlencode:x<nowiki/>y|path}}
22395 {{urlencode:x<pre id="one">two</pre>y}}
22396 !! html/php
22397 <p>xy
22398 xy
22399 xy
22400 xy
22401 </p>
22402 !! end
22403
22404 !! test
22405 Strip marker in lc
22406 !! wikitext
22407 {{lc:x<nowiki/>y}}
22408 !! html
22409 <p>xy
22410 </p>
22411 !! end
22412
22413 !! test
22414 Strip marker in uc
22415 !! wikitext
22416 {{uc:x<nowiki/>y}}
22417 !! html
22418 <p>XY
22419 </p>
22420 !! end
22421
22422 !! test
22423 Strip marker in formatNum
22424 !! wikitext
22425 {{formatnum:1<nowiki/>2}}
22426 {{formatnum:1<nowiki/>2|R}}
22427 !! html
22428 <p>12
22429 12
22430 </p>
22431 !! end
22432
22433 !! test
22434 Check noCommafy in formatNum
22435 !! options
22436 language=be-tarask
22437 !! wikitext
22438 {{formatnum:123456.78}}
22439 {{formatnum:123456.78|NOSEP}}
22440 !! html
22441 <p>123 456,78
22442 123456.78
22443 </p>
22444 !! end
22445
22446 !! test
22447 Wrong option for formatNum (bug 56199)
22448 !! wikitext
22449 {{formatnum:1,234.56|Random}}
22450 {{formatnum:1,234.56|EVERYTHING}}
22451 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
22452 !! html
22453 <p>1,234.56
22454 1,234.56
22455 1,234.56
22456 </p>
22457 !! end
22458
22459 !! test
22460 Strip marker in grammar
22461 !! options
22462 language=fi
22463 !! wikitext
22464 {{grammar:elative|foo<nowiki/>bar}}
22465 !! html
22466 <p>foobarista
22467 </p>
22468 !! end
22469
22470 !! test
22471 Strip marker in padleft
22472 !! wikitext
22473 {{padleft:|2|x<nowiki/>y}}
22474 !! html
22475 <p>xy
22476 </p>
22477 !! end
22478
22479 !! test
22480 Strip marker in padright
22481 !! wikitext
22482 {{padright:|2|x<nowiki/>y}}
22483 !! html
22484 <p>xy
22485 </p>
22486 !! end
22487
22488 !! test
22489 Strip marker in anchorencode
22490 !! wikitext
22491 {{anchorencode:x<nowiki/>y}}
22492 !! html
22493 <p>xy
22494 </p>
22495 !! end
22496
22497 !! test
22498 nowiki inside link inside heading (bug 18295)
22499 !! wikitext
22500 ==[[foo|x<nowiki>y</nowiki>z]]==
22501 !! html
22502 <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>
22503
22504 !! end
22505
22506 !! test
22507 new support for bdi element (bug 31817)
22508 !! wikitext
22509 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22510 !! html
22511 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22512
22513 !!end
22514
22515 !! test
22516 Ignore pipe between table row attributes
22517 !! wikitext
22518 {|
22519 | quux
22520 |- id=foo | style='color: red'
22521 | bar
22522 |}
22523 !! html
22524 <table>
22525 <tr>
22526 <td> quux
22527 </td></tr>
22528 <tr id="foo" style="color: red">
22529 <td> bar
22530 </td></tr></table>
22531
22532 !! end
22533
22534 !!test
22535 Gallery override link with WikiLink (bug 34852)
22536 !! wikitext
22537 <gallery>
22538 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
22539 </gallery>
22540 !! html
22541 <ul class="gallery mw-gallery-traditional">
22542 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22543 <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>
22544 <div class="gallerytext">
22545 <p>caption
22546 </p>
22547 </div>
22548 </div></li>
22549 </ul>
22550
22551 !! end
22552
22553 !!test
22554 Language parser function
22555 !! wikitext
22556 {{#language:ar}}
22557 !! html
22558 <p>العربية
22559 </p>
22560 !! end
22561
22562 !!test
22563 Padleft and padright as substr
22564 !! wikitext
22565 {{padleft:|3|abcde}}
22566 {{padright:|3|abcde}}
22567 !! html
22568 <p>abc
22569 abc
22570 </p>
22571 !! end
22572
22573 !!test
22574 Special parser function
22575 !! wikitext
22576 {{#special:RandomPage}}
22577 {{#special:BaDtItLe}}
22578 {{#special:Foobar}}
22579 !! html
22580 <p>Special:Random
22581 Special:Badtitle
22582 Special:Foobar
22583 </p>
22584 !! end
22585
22586 !!test
22587 Bug 34939 - Case insensitive link parsing ([HttP://])
22588 !! wikitext
22589 [HttP://MediaWiki.Org/]
22590 !! html/php
22591 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
22592 </p>
22593 !! html/parsoid
22594 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
22595 !! end
22596
22597 !!test
22598 Bug 34939 - Case insensitive link parsing ([HttP:// title])
22599 !! wikitext
22600 [HttP://MediaWiki.Org/ MediaWiki]
22601 !! html
22602 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22603 </p>
22604 !! end
22605
22606 !!test
22607 Bug 34939 - Case insensitive link parsing (HttP://)
22608 !! wikitext
22609 HttP://MediaWiki.Org/
22610 !! html/php
22611 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22612 </p>
22613 !! html/parsoid
22614 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22615 !! end
22616
22617 !!test
22618 Disable TOC
22619 !! options
22620 notoc
22621 !! wikitext
22622 Lead
22623 == Section 1 ==
22624 == Section 2 ==
22625 == Section 3 ==
22626 == Section 4 ==
22627 == Section 5 ==
22628 !! html
22629 <p>Lead
22630 </p>
22631
22632 <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>
22633 <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>
22634 <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>
22635 <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>
22636 <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>
22637
22638 !! end
22639
22640
22641 ###
22642 ### Parsoid-specific tests
22643 ### Parsoid-PHP parser incompatibilities
22644 ###
22645 !!test
22646 1. SOL-sensitive wikitext tokens as template-args
22647 !!options
22648 parsoid=wt2html,wt2wt
22649 !! wikitext
22650 {{echo|*a}}
22651 {{echo|#a}}
22652 {{echo|:a}}
22653 !! html
22654 <span about="#mwt1" typeof="mw:Transclusion">
22655 </span><ul about="#mwt1"><li>a</li>
22656 </ul>
22657 <span about="#mwt2" typeof="mw:Transclusion">
22658 </span><ol about="#mwt2"><li>a</li>
22659 </ol>
22660 <span about="#mwt3" typeof="mw:Transclusion">
22661 </span><dl about="#mwt3"><dd>a</dd>
22662 </dl>
22663 !!end
22664
22665 #### -----------------------------------------------------------------
22666 #### Parsoid-specific functionality tests
22667 #### -----------------------------------------------------------------
22668
22669 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
22670 # We know wt2wt will fail, but we expect selser to pass.
22671 # Due to the nature of our testing, wt2wt and selser tests will enter the
22672 # blacklist and we'll catch selser regressions based on changes to the
22673 # blacklist entries for selser tests.
22674 !! test
22675 1. Bad treebuilder fixup of formatting elt is cleaned up
22676 !! options
22677 parsoid=wt2html,wt2wt
22678 !! wikitext
22679 {|
22680 |
22681 <small>
22682 [[Image:Foobar.jpg|right|Test]]
22683 </small>
22684 |}
22685 !! html/parsoid
22686 <table>
22687 <tbody><tr><td>
22688 <small>
22689 <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>
22690 </small>
22691 </td></tr>
22692 </tbody></table>
22693 !! end
22694
22695 !! test
22696 2. Bad treebuilder fixup of formatting elt is cleaned up
22697 !! options
22698 parsoid=wt2html,wt2wt
22699 !! wikitext
22700 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22701
22702 <small>[[Image:Foobar.jpg|right|300px]]</small>
22703 !! html/parsoid
22704
22705 <p><b>foo</b></p>
22706 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><b>caption</b></figcaption></figure>
22707 <p><b>bar</b></p>
22708 <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>
22709 !! end
22710
22711 !! test
22712 3. Bad treebuilder fixup of formatting elt is cleaned up
22713 !! options
22714 parsoid=wt2html,wt2wt
22715 !! wikitext
22716 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22717 !! html/parsoid
22718 <p><small><b>foo</b></small></p>
22719 <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>
22720 <p><small><b>bar</b></small></p>
22721 !! end
22722
22723 !! test
22724 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22725 !! options
22726 parsoid=wt2html,wt2wt
22727 !! wikitext
22728 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22729 !! html/parsoid
22730 <p><b><small></small></b></p>
22731 <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>
22732 <p></p>
22733 !! end
22734
22735 #### ----------------------------------------------------------------
22736 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22737 #### tags. Parsoid's output for these tags differs from that of the
22738 #### PHP parser.
22739 #### ----------------------------------------------------------------
22740
22741 !!test
22742 Ref: 1. ref-location should be replaced with an index span
22743 !! wikitext
22744 A <ref>foo</ref>
22745 B <ref name="x">foo</ref>
22746 C <ref name="y" />
22747 <references />
22748 !! html/parsoid
22749 <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>
22750 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>
22751 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>
22752 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22753 <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>
22754 <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>
22755 <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>
22756 </ol>
22757 !!end
22758
22759 !!test
22760 Ref: 2. ref-tags with identical names should all get the same index
22761 !! wikitext
22762 A <ref name="x">foo</ref>
22763 B <ref name="x" />
22764 <references />
22765 !! html/parsoid
22766 <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>
22767 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>
22768 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22769 <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>
22770 </ol>
22771 !!end
22772
22773 !!test
22774 Ref: 3. spaces in ref-names should be ignored
22775 !! wikitext
22776 A <ref name="x">foo</ref>
22777 B <ref name=" x " />
22778 C <ref name= x />
22779 <references />
22780 !! html/parsoid
22781 <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>
22782 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>
22783 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>
22784 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22785 <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>
22786 </ol>
22787 !!end
22788
22789 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22790 !!test
22791 Ref: 4. 'constructor' should be accepted as a valid ref-name
22792 !! wikitext
22793 A <ref name="constructor">foo</ref>
22794 <references />
22795 !! html/parsoid
22796 <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>
22797 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22798 <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>
22799 </ol>
22800 !!end
22801
22802 !!test
22803 Ref: 5. body should accept generic wikitext
22804 !! wikitext
22805 A <ref>
22806 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22807 </ref>
22808
22809 <references />
22810 !! html/parsoid
22811 <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>
22812
22813 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22814 <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>
22815 </span></li>
22816 </ol>
22817 !!end
22818
22819 !!test
22820 Ref: 6. indent-pres should not be output in ref-body
22821 !! wikitext
22822 A <ref>
22823 foo
22824 bar
22825 baz
22826 </ref>
22827
22828 <references />
22829 !! html/parsoid
22830 <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>
22831
22832 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22833 <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
22834 bar
22835 baz
22836 </span></li>
22837 </ol>
22838 !!end
22839
22840 !!test
22841 Ref: 7. No p-wrapping in ref-body
22842 !! wikitext
22843 A <ref>
22844 foo
22845
22846 bar
22847
22848
22849 baz
22850
22851
22852
22853 booz
22854 </ref>
22855
22856 <references />
22857 !! html/parsoid
22858 <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>
22859
22860 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22861 <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
22862
22863 bar
22864
22865
22866 baz
22867
22868
22869
22870 booz
22871 </span></li>
22872 </ol>
22873 !!end
22874
22875 !!test
22876 Ref: 8. transclusion wikitext has lower precedence
22877 !! wikitext
22878 A <ref> foo {{echo|</ref> B C}}
22879
22880 <references />
22881 !! html/parsoid
22882 <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>
22883 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22884 <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>
22885 </ol>
22886 !!end
22887
22888 !!test
22889 Ref: 9. unclosed comments should not leak out of ref-body
22890 !! wikitext
22891 A <ref> foo <!--</ref> B C
22892 <references />
22893 !! html/parsoid
22894 <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>
22895 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22896 <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>
22897 </ol>
22898 !!end
22899
22900 !!test
22901 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22902 !! wikitext
22903 A <ref> <b> foo </ref> B C
22904
22905 <references />
22906 !! html/parsoid
22907 <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>
22908
22909
22910 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22911 <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>
22912 </ol>
22913 !!end
22914
22915 !!test
22916 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22917 !! wikitext
22918 A <ref>foo</ref> B
22919 C <ref>bar</ref> D
22920 <references />
22921 !! html/parsoid
22922 <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
22923 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>
22924 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22925 <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>
22926 <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>
22927 </ol>
22928 !!end
22929
22930 !!test
22931 Ref: 12. ref-tags act as trailing newline migration barrier
22932 !! wikitext
22933 <!--the newline at the end of this line moves out of the p tag-->a
22934
22935 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22936 <ref />
22937
22938 c
22939 <references />
22940 !! html/parsoid
22941 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22942
22943
22944 <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>
22945 <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>
22946
22947 <p>c</p>
22948 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22949 <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>
22950 <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>
22951 !!end
22952
22953 !!test
22954 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22955 !! wikitext
22956 <ref>foo</ref> A
22957 <ref>bar
22958 </ref> B
22959 <references />
22960 !! html/parsoid
22961 <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
22962 <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>
22963 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22964 <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>
22965 <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
22966 </span></li>
22967 </ol>
22968 !!end
22969
22970 ## Roundtripping fails because of nowiki'ing
22971 !! test
22972 Ref: 14. A nested ref-tag should be emitted as plain text
22973 !! options
22974 parsoid=wt2html
22975 !! wikitext
22976 <ref>foo <ref>bar</ref> baz</ref>
22977
22978 <references />
22979 !! html/parsoid
22980 <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>
22981
22982 <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>
22983 !! end
22984
22985 !!test
22986 Ref: 15. ref-tags with identical names should get identical indexes
22987 !! wikitext
22988 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22989 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22990
22991 <references />
22992 !! html/parsoid
22993 <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>
22994 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>
22995
22996 <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>
22997 </ol>
22998 !!end
22999
23000 ## We don't bother wt2wt-ing non-standard whitespace
23001 !!test
23002 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
23003 !!options
23004 parsoid=wt2html
23005 !! wikitext
23006 A <ref >foo</ref >
23007
23008 <references />
23009 !! html/parsoid
23010 <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>
23011 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23012 <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>
23013 !!end
23014
23015 !!test
23016 Ref: 17. Generate valid HTML5 id/about attributes
23017 !!wikitext
23018 <ref name="a b">foo</ref>
23019 <ref name=":0">ve-created name</ref>
23020
23021 <references />
23022 !!html/parsoid
23023 <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>
23024 <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>
23025
23026 <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>
23027
23028 !!end
23029
23030 !!test
23031 Ref: 18. T58916: Extension attributes should be parsed as plain text
23032 !!wikitext
23033 <ref name="{{echo|a}}">foo</ref>
23034
23035 <references />
23036 !!html/parsoid
23037 <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>
23038 </p>
23039
23040 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23041 <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>
23042 </ol>
23043 !!end
23044
23045 !!test
23046 Ref: 19. ref-tags with identical name encodings should get identical indexes
23047 !! wikitext
23048 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
23049
23050 <references />
23051 !! html/parsoid
23052 <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>
23053 </p>
23054 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
23055 <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>
23056 </ol>
23057 !!end
23058
23059 !!test
23060 Ref: 20. ref-tags with identical names but different content should keep it
23061 !! wikitext
23062 A <ref name="foo">Foo one</ref>
23063 B <ref name="foo">Foo two</ref>
23064 C <ref name="foo" />
23065
23066 <references />
23067 !! html/parsoid
23068 <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>
23069 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>
23070 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>
23071
23072 <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>
23073 </ol>
23074 !!end
23075
23076 !!test
23077 References: 1. references tag without any refs should be handled properly
23078 !! wikitext
23079 <references />
23080 !! html/parsoid
23081 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
23082 !!end
23083
23084 !!test
23085 References: 2. references tag with group only outputs references from that group
23086 !! wikitext
23087 A <ref group="a">foo</ref>
23088 B <ref group="b">bar</ref>
23089 C <ref>baz</ref>
23090
23091 <references group="a" />
23092 <references />
23093 <references group="b" />
23094 !! html/parsoid
23095 <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>
23096 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>
23097 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>
23098
23099 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
23100 <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>
23101 </ol>
23102 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
23103 <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>
23104 </ol>
23105 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
23106 <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>
23107 </ol>
23108 !!end
23109
23110 !!test
23111 References: 3. ref list should be cleared after processing references
23112 !! wikitext
23113 A <ref>foo</ref>
23114
23115 <references />
23116
23117 B <ref>bar</ref>
23118
23119 <references />
23120 !! html/parsoid
23121 <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>
23122
23123 <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>
23124 </ol>
23125
23126 <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>
23127
23128 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
23129 <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>
23130 </ol>
23131 !!end
23132
23133 !!test
23134 References: 4. only referenced group should be cleared after processing references
23135 !! wikitext
23136 A <ref group="a">afoo</ref>
23137 B <ref>bfoo</ref>
23138
23139 <references group="a" />
23140
23141 C <ref>cfoo</ref>
23142
23143 <references />
23144 !! html/parsoid
23145 <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>
23146 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>
23147
23148 <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>
23149 </ol>
23150
23151 <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>
23152
23153 <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>
23154 </ol>
23155 !!end
23156
23157 ## Don't expect this to rt since we're dropping content
23158 !! test
23159 References: 5. ref tags in references should be processed while ignoring all other content
23160 !! options
23161 parsoid=wt2html,html2html
23162 !! wikitext
23163 A <ref name="a" />
23164 B <ref name="b">bar</ref>
23165
23166 <references>
23167 <ref name="a">foo</ref>
23168 This should just get lost.
23169 </references>
23170 !! html/parsoid
23171 <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>
23172 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>
23173
23174
23175 <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>
23176 </ol>
23177 !! end
23178
23179 !! test
23180 References: 6. <references /> from a transclusion
23181 !! wikitext
23182 <ref>Foo</ref> {{echo|<references />}}
23183 !! html/parsoid
23184 <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>
23185 </ol>
23186 !! end
23187
23188 !! test
23189 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
23190 !! wikitext
23191 A <ref>foo bar for a</ref>
23192 B <ref group="X" name="b" />
23193
23194 <references />
23195
23196 <references group="X">
23197 <ref name="b">foo</ref>
23198 </references>
23199 !! html/parsoid
23200 <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>
23201 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>
23202 </p>
23203
23204 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
23205 <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>
23206 </ol>
23207
23208 <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"}}'>
23209 <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>
23210 </ol>
23211 !! end
23212
23213 !! test
23214 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
23215 !! wikitext
23216 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
23217 <references />
23218 !! html/parsoid
23219 <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>
23220 <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>
23221 </ol>
23222 !!end
23223
23224 # This test only works in wt2html now as the <references /> are always generated
23225 # unless selser is active. Once T72722 is fixed, we should add a changes test
23226 # here to ensure that unrelated changes don't add the new <references />
23227 # when selser is active.
23228 !! test
23229 References: 9. Generate missing references list at the end
23230 !! wikitext
23231 A <ref>foo</ref>
23232 B <ref group="inexistent">bar</ref>
23233 !! html/parsoid
23234 <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>
23235 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
23236 <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>
23237 </ol>
23238 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
23239 <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>
23240 </ol>
23241 !! end
23242
23243 !! test
23244 References: 10. New <references/> shouldn't be added for unrelated edits.
23245 !! options
23246 parsoid={
23247 "modes": ["selser"],
23248 "changes": [["#x", "remove"]],
23249 "selser": "noauto"
23250 }
23251 !! wikitext
23252 Unrelated text<span id="x"> that's going to disappear</span>.
23253 A <ref>foo</ref>
23254 !! wikitext/edited
23255 Unrelated text.
23256 A <ref>foo</ref>
23257 !!end
23258
23259 !! test
23260 Entities in ref name
23261 !! wikitext
23262 <ref name="test &amp; me">hi</ref>
23263 <references />
23264 !! html/parsoid
23265 <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>
23266 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23267 <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>
23268 </ol>
23269 !! end
23270
23271 ## The output here may look funny, but it's what the php parser will do. The
23272 ## unclosed references tag becomes escaped text, and then a new references
23273 ## tag is auto-generated. The test is wt2html only because it roundtrips with
23274 ## nowiki tags, and the auto-generated references tag is only dropped in
23275 ## rtTestMode.
23276 !! test
23277 Generate references for unclosed references tag
23278 !! options
23279 parsoid=wt2html
23280 !! wikitext
23281 a<ref>foo</ref>
23282
23283 <references>
23284 !! html/parsoid
23285 <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>
23286
23287 <p>&lt;references></p>
23288 <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>
23289 !! end
23290
23291 !! test
23292 New reference serializes on its own line
23293 !! options
23294 parsoid=wt2wt,html2wt
23295 !! wikitext
23296 foo
23297 <references />
23298 !! html/parsoid
23299 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
23300 !! end
23301
23302 #### ----------------------------------------------------------------
23303 #### Parsoid-only testing of Parsoid's impl of LST
23304 #### Not implemented yet, see
23305 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
23306 #### ----------------------------------------------------------------
23307
23308 ## We still need to support serializing the older format while content is stored.
23309 !! test
23310 LST Sections: Backwards compatibility
23311 !! options
23312 parsoid={
23313 "suppressErrors": true,
23314 "modes": ["html2wt"]
23315 }
23316 !! wikitext
23317 <section begin="2011-05-16" />
23318 <section end="2014-04-10 (MW 1.23wmf22)" />
23319 !! html/parsoid
23320 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
23321 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
23322 !! end
23323
23324 ## The unconventional output is the result of `usePHPPreProcessor` being
23325 ## disabled in parserTests.js. This test is mainly just to show <section> is
23326 ## recognized as an extension tag w/o a native handler.
23327 !! test
23328 LST Sections: Newfangled approach
23329 !! options
23330 parsoid={ "suppressErrors": true }
23331 !! wikitext
23332 <section begin="2011-05-16" />
23333 <section end="2014-04-10 (MW 1.23wmf22)" />
23334 !! html/parsoid
23335 <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>
23336 <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>
23337 !! end
23338
23339 #--------- Test stripping of empty nodes in template content ----------
23340 !!test
23341 Empty LI and TR nodes should be stripped from template content
23342 !!wikitext
23343 {{EmptyLITest}}
23344 {{EmptyTRTest}}
23345 !!html/parsoid
23346 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
23347 <li>a</li>
23348 <li>b</li>
23349 </ul>
23350 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
23351 <tbody>
23352 <tr>
23353 <td>foo</td>
23354 </tr>
23355 <tr>
23356 <td>bar</td>
23357 </tr>
23358 </tbody>
23359 </table>
23360 !!end
23361
23362 !!test
23363 Empty LI and TR nodes should not be stripped from top-level content
23364 !!wikitext
23365 * a
23366 *
23367 * b
23368 {|
23369 |-
23370 |-
23371 |foo
23372 |}
23373 !!html/parsoid
23374 <ul>
23375 <li> a</li>
23376 <li></li>
23377 <li> b</li>
23378 </ul>
23379 <table>
23380 <tbody>
23381 <tr></tr>
23382 <tr>
23383 <td>foo</td>
23384 </tr>
23385 </tbody>
23386 </table>
23387 !!end
23388
23389 !!test
23390 Empty TR nodes should not be stripped if they have any attributes set
23391 !!wikitext
23392 {{EmptyTRWithHTMLAttrTest}}
23393 !!html/parsoid
23394 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
23395 <tr align="center"></tr>
23396 <tr><td>foo</td></tr>
23397 <tr align="center"></tr>
23398 <tr><td>bar</td></tr>
23399 </table>
23400 !!end
23401
23402 #### ----------------------------------------------------------------
23403 #### The following section of tests are primarily to test
23404 #### wikitext escaping capabilities of Parsoid. Given that
23405 #### escaping can be done any number of ways, the wikitext (input)
23406 #### is always adjusted to reflect how Parsoid adds nowiki
23407 #### escape tags.
23408 ####
23409 #### We are marking several tests as parsoid-only since the
23410 #### HTML in the result section is different from what the
23411 #### PHP parser generates for it.
23412 #### ----------------------------------------------------------------
23413
23414
23415 #### --------------- Headings ---------------
23416 #### 0. Unnested
23417 #### 1. Nested inside html <h1>=foo=</h1>
23418 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
23419 #### 3. Nested inside html with wikitext split by html tags
23420 #### 4. No escape needed
23421 #### 5. Empty headings <h1></h1>
23422 #### 6. Heading chars in SOL context
23423 #### ----------------------------------------
23424 !! test
23425 Headings: 0. Unnested
23426 !! options
23427 parsoid=html2wt
23428 !! html/parsoid
23429 <p>=foo=</p>
23430
23431 <p> =foo=
23432 <!--cmt-->
23433 =foo=</p>
23434
23435 <p>=foo<i>a</i>=</p>
23436 !! wikitext
23437 <nowiki>=foo=</nowiki>
23438
23439 <nowiki> </nowiki>=foo=
23440 <!--cmt-->
23441 <nowiki>=foo=</nowiki>
23442
23443 =foo''a''<nowiki>=</nowiki>
23444 !!end
23445
23446 # New headings and existing headings are handled differently
23447 !! test
23448 Headings: 1. Nested inside html
23449 !! options
23450 parsoid=html2wt
23451 !! html/parsoid
23452 <h1>=foo=</h1>
23453 <h2>=foo=</h2>
23454 <h3>=foo=</h3>
23455
23456 <h1 data-parsoid=''>=foo=</h1>
23457 <h2 data-parsoid=''>=foo=</h2>
23458 <h3 data-parsoid=''>=foo=</h3>
23459 <h4 data-parsoid=''>=foo=</h4>
23460 <h5 data-parsoid=''>=foo=</h5>
23461 <h6 data-parsoid=''>=foo=</h6>
23462 !! wikitext
23463 = =foo= =
23464
23465 == =foo= ==
23466
23467 === =foo= ===
23468
23469 =<nowiki>=foo=</nowiki>=
23470 ==<nowiki>=foo=</nowiki>==
23471 ===<nowiki>=foo=</nowiki>===
23472 ====<nowiki>=foo=</nowiki>====
23473 =====<nowiki>=foo=</nowiki>=====
23474 ======<nowiki>=foo=</nowiki>======
23475
23476 !!end
23477
23478 !! test
23479 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
23480 !! options
23481 parsoid=html2wt
23482 !! html/parsoid
23483 <h1>foo</h1>*bar
23484 <h1>foo</h1>=bar
23485 <h1>foo</h1>=bar=
23486 !! wikitext
23487 = foo =
23488 <nowiki>*</nowiki>bar
23489
23490 = foo =
23491 =bar
23492
23493 = foo =
23494 <nowiki>=bar=</nowiki>
23495 !!end
23496
23497 !! test
23498 Headings: 3. Nested inside html with wikitext split by html tags
23499 !! options
23500 parsoid=html2wt
23501 !! html/parsoid
23502 <h1>=<b>bold</b>foo=</h1>
23503 !! wikitext
23504 = ='''bold'''foo= =
23505 !!end
23506
23507 !! test
23508 Headings: 4a. No escaping needed (testing just h1 and h2)
23509 !! options
23510 parsoid=html2wt
23511 !! html/parsoid
23512 <h1>=foo</h1>
23513 <h1>foo=</h1>
23514 <h1> =foo= </h1>
23515 <h1>=foo= bar</h1>
23516 <h2>=foo</h2>
23517 <h2>foo=</h2>
23518 <h1>=</h1>
23519 <h1><i>=</i>foo=</h1>
23520 !! wikitext
23521 = =foo =
23522
23523 = foo= =
23524
23525 = =foo= =
23526
23527 = =foo= bar =
23528
23529 == =foo ==
23530
23531 == foo= ==
23532
23533 = = =
23534
23535 = ''=''foo= =
23536 !!end
23537
23538 !! test
23539 Headings: 4b. No escaping needed (inside p-tags)
23540 !! options
23541 parsoid=html2wt
23542 !! html/parsoid
23543 <p>===
23544 =foo= x
23545 =foo= <s></s>
23546 </p>
23547 !! wikitext
23548 ===
23549 =foo= x
23550 =foo= <s></s>
23551 !!end
23552
23553 !! test
23554 Headings: 5. Empty headings
23555 !! options
23556 parsoid=html2wt
23557 !! html/parsoid
23558 <h1 data-parsoid='{}'></h1>
23559
23560 <h2 data-parsoid='{}'></h2>
23561
23562 <h3 data-parsoid='{}'></h3>
23563
23564 <h4 data-parsoid='{}'></h4>
23565
23566 <h5 data-parsoid='{}'></h5>
23567
23568 <h6 data-parsoid='{}'></h6>
23569 !! wikitext
23570 =<nowiki/>=
23571
23572 ==<nowiki/>==
23573
23574 ===<nowiki/>===
23575
23576 ====<nowiki/>====
23577
23578 =====<nowiki/>=====
23579
23580 ======<nowiki/>======
23581 !!end
23582
23583 !! test
23584 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23585 !! options
23586 parsoid=html2wt
23587 !! html/parsoid
23588 <p>=a=</p>
23589
23590 <p>=a=</p>
23591
23592 <p>=a=</p>
23593 !! wikitext
23594 <nowiki>=a=</nowiki>
23595
23596 <nowiki>=a=</nowiki>
23597
23598 <nowiki>=a=</nowiki>
23599 !!end
23600
23601 !! test
23602 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23603 !! options
23604 parsoid=html2wt
23605 !! html/parsoid
23606 <p>=a=
23607 b</p>
23608
23609 <p>=a=
23610 b</p>
23611
23612 <p>=a=
23613 b</p>
23614 !! wikitext
23615 <nowiki>=a=</nowiki>
23616 b
23617
23618 <nowiki>=a=</nowiki>
23619 b
23620
23621 <nowiki>=a=</nowiki>
23622 b
23623 !!end
23624
23625 !! test
23626 Headings: 6c. Heading chars in SOL context (leading newline break)
23627 !! options
23628 parsoid=html2wt
23629 !! html/parsoid
23630 <p>a
23631 =b=</p>
23632 !! wikitext
23633 a
23634 <nowiki>=b=</nowiki>
23635 !!end
23636
23637 !! test
23638 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23639 !! options
23640 parsoid=html2wt
23641 !! html/parsoid
23642 <!--c0--><p>=a=</p>
23643
23644 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23645 !! wikitext
23646 <!--c0--><nowiki>=a=</nowiki>
23647
23648 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23649 !!end
23650
23651 !! test
23652 Headings: 6d. Heading chars in SOL context (No escaping needed)
23653 !! options
23654 parsoid=html2wt
23655 !! html/parsoid
23656 =a=<div>b</div>
23657 !! wikitext
23658 =a=<div>b</div>
23659 !!end
23660
23661 !! test
23662 Headings: 7. Insert a newline between new content and headings
23663 !! options
23664 parsoid=html2wt
23665 !! html/parsoid
23666 <h2>NEW</h2>
23667 <p>new</p>
23668 <h2 data-parsoid='{}'>A</h2>
23669 <p data-parsoid='{}'>a</p>
23670 !! wikitext
23671 == NEW ==
23672 new
23673
23674 ==A==
23675 a
23676
23677 !! end
23678
23679 #### --------------- Lists ---------------
23680 #### 0. Outside nests (*foo, etc.)
23681 #### 1. Nested inside html <ul><li>*foo</li></ul>
23682 #### 2. Inside definition lists
23683 #### 3. Only bullets at start should be escaped
23684 #### 4. No escapes needed
23685 #### 5. No unnecessary escapes
23686 #### 6. Escape bullets in SOL position
23687 #### 7. Escape bullets in a multi-line context
23688 #### ----------------------------------------
23689
23690 !! test
23691 Lists: 0. Outside nests
23692 !! options
23693 parsoid=html2wt
23694 !! html/parsoid
23695 <p>*foo</p>
23696
23697 <p>#foo</p>
23698
23699 <p>;Foo:bar</p>
23700 !! wikitext
23701 <nowiki>*</nowiki>foo
23702
23703 <nowiki>#</nowiki>foo
23704
23705 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23706 !!end
23707
23708 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23709 ## to test wikitext escaping, and insignificant whitespace diffs
23710 ## cause PHP parser tests to barf
23711 !! test
23712 Lists: 1. Nested inside html (No unnecessary escapes)
23713 !! options
23714 parsoid=html2wt
23715 !! html/parsoid
23716 <ul>
23717 <li>*foo</li>
23718 <li>#foo</li>
23719 <li>:foo</li>
23720 <li>;foo</li>
23721 <li data-parsoid='{}'>*foo</li>
23722 <li data-parsoid='{}'>#foo</li>
23723 <li data-parsoid='{}'>:foo</li>
23724 <li data-parsoid='{}'>;foo</li>
23725 </ul>
23726
23727 <ol>
23728 <li>*foo</li>
23729 <li>#foo</li>
23730 <li>:foo</li>
23731 <li>;foo</li>
23732 <li data-parsoid='{}'>*foo</li>
23733 <li data-parsoid='{}'>#foo</li>
23734 <li data-parsoid='{}'>:foo</li>
23735 <li data-parsoid='{}'>;foo</li>
23736 </ol>
23737 !! wikitext
23738 * *foo
23739 * #foo
23740 * :foo
23741 * ;foo
23742 *<nowiki>*foo</nowiki>
23743 *<nowiki>#foo</nowiki>
23744 *<nowiki>:foo</nowiki>
23745 *<nowiki>;foo</nowiki>
23746
23747 # *foo
23748 # #foo
23749 # :foo
23750 # ;foo
23751 #<nowiki>*foo</nowiki>
23752 #<nowiki>#foo</nowiki>
23753 #<nowiki>:foo</nowiki>
23754 #<nowiki>;foo</nowiki>
23755 !!end
23756
23757 !! test
23758 Lists: 2. Inside definition lists
23759 !! options
23760 parsoid=html2wt
23761 !! html/parsoid
23762 <dl><dt>;foo</dt></dl>
23763 <dl><dt>:foo</dt></dl>
23764 <dl><dt>:foo</dt>
23765 <dd>bar</dd></dl>
23766 <dl><dd>:foo</dd></dl>
23767 !! wikitext
23768 ; ;foo
23769
23770 ; <nowiki>:foo</nowiki>
23771
23772 ; <nowiki>:foo</nowiki>
23773 : bar
23774
23775 : :foo
23776 !!end
23777
23778 !! test
23779 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23780 !! options
23781 parsoid=html2wt
23782 !! html/parsoid
23783 <ul>
23784 <li>*foo*bar</li>
23785 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23786 </ul>
23787 !! wikitext
23788 * *foo*bar
23789 *<nowiki>*foo</nowiki>''it''*bar
23790 !!end
23791
23792 !! test
23793 Lists: 4. No escapes needed
23794 !! options
23795 parsoid=html2wt
23796 !! html/parsoid
23797 <ul>
23798 <li>foo*bar
23799 </li>
23800 </ul>
23801 <ul>
23802 <li><i>foo</i>*bar
23803 </li>
23804 </ul>
23805 <ul>
23806 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23807 </li>
23808 </ul>
23809 <ul>
23810 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23811 </li>
23812 </ul>
23813 !! wikitext
23814 *foo*bar
23815
23816 *''foo''*bar
23817
23818 *[[Foo]]: bar
23819
23820 *[[Foo]]*bar
23821 !!end
23822
23823 !! test
23824 Lists: 5. No unnecessary escapes
23825 !! options
23826 parsoid=html2wt
23827 !! html/parsoid
23828 <ul><li> bar <span>[[foo]]</span></li></ul>
23829 <ul><li> =bar <span>[[foo]]</span></li></ul>
23830 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23831 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23832 <ul><li> =bar <span>foo]]</span>=</li></ul>
23833 <ul><li> <s></s>: a</li></ul>
23834 <ul><li> <i>* foo</i></li></ul>
23835
23836 !! wikitext
23837 * bar <span><nowiki>[[foo]]</nowiki></span>
23838
23839 * =bar <span><nowiki>[[foo]]</nowiki></span>
23840
23841 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23842
23843 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23844
23845 * =bar <span>foo]]</span>=
23846
23847 * <s></s>: a
23848
23849 * ''* foo''
23850 !!end
23851
23852 !! test
23853 Lists: 6. Escape bullets in SOL position
23854 !! options
23855 parsoid=html2wt
23856 !! html/parsoid
23857 <p><!--cmt-->*foo</p>
23858 !! wikitext
23859 <!--cmt--><nowiki>*</nowiki>foo
23860 !!end
23861
23862 !! test
23863 Lists: 7. Escape bullets in a multi-line context
23864 !! options
23865 parsoid=html2wt
23866 !! html/parsoid
23867 <p>a
23868 *b
23869 </p>
23870 !! wikitext
23871 a
23872 <nowiki>*</nowiki>b
23873 !!end
23874
23875 !! test
23876 Lists: 8. Escape colons only if not present in tags
23877 !! options
23878 parsoid=html2wt
23879 !! html/parsoid
23880 <dl><dt>a:b<i>c:d</i></dt></dl>
23881 !! wikitext
23882 ; <nowiki>a:b</nowiki>''c:d''
23883 !! end
23884
23885 #### --------------- HRs ---------------
23886 #### 1. Single line
23887 #### -----------------------------------
23888
23889 !! test
23890 HRs: 1. Single line
23891 !! options
23892 parsoid=html2wt
23893 !! html/parsoid
23894 <hr />----
23895 <hr />=foo=
23896 <hr />*foo
23897 !! wikitext
23898 ----<nowiki>----</nowiki>
23899 ----=foo=
23900 ----*foo
23901 !! end
23902
23903 #### --------------- Tables ---------------
23904 #### 1a. Simple example
23905 #### 1b. No escaping needed (!foo)
23906 #### 1c. No escaping needed (|foo)
23907 #### 1d. No escaping needed (|}foo)
23908 ####
23909 #### 2a. Nested in td (<td>foo|bar</td>)
23910 #### 2b. Nested in td (<td>foo||bar</td>)
23911 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23912 ####
23913 #### 3a. Nested in th (<th>foo!bar</th>)
23914 #### 3b. Nested in th (<th>foo!!bar</th>)
23915 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23916 ####
23917 #### 4a. Escape -
23918 #### 4b. Escape +
23919 #### 4c. No escaping needed
23920 #### --------------------------------------
23921
23922 !! test
23923 Tables: 1a. Simple example
23924 !! options
23925 parsoid=html2wt
23926 !! html/parsoid
23927 <p>{|
23928 |}
23929 </p>
23930 !! wikitext
23931 <nowiki>{|</nowiki>
23932 |}
23933 !! end
23934
23935 !! test
23936 Tables: 1b. No escaping needed
23937 !! options
23938 parsoid=html2wt
23939 !! html/parsoid
23940 <p>!foo
23941 </p>
23942 !! wikitext
23943 !foo
23944 !! end
23945
23946 !! test
23947 Tables: 1c. No escaping needed
23948 !! options
23949 parsoid=html2wt
23950 !! html/parsoid
23951 <p>|foo
23952 </p>
23953 !! wikitext
23954 |foo
23955 !! end
23956
23957 !! test
23958 Tables: 1d. No escaping needed
23959 !! options
23960 parsoid=html2wt
23961 !! html/parsoid
23962 <p>|}foo
23963 </p>
23964 !! wikitext
23965 |}foo
23966 !! end
23967
23968 !! test
23969 Tables: 2a. Nested in td
23970 !! options
23971 parsoid=html2wt
23972 !! html/parsoid
23973 <table><tbody><tr>
23974 <td>foo|bar</td></tr>
23975 <tr><td>x<div>a|b</div></td>
23976 </tbody></table>
23977 !! wikitext
23978 {|
23979 |<nowiki>foo|bar</nowiki>
23980 |-
23981 |x<div><nowiki>a|b</nowiki></div>
23982 |}
23983 !! html/php+tidy
23984 <table>
23985 <tr>
23986 <td>foo|bar</td>
23987 </tr>
23988 <tr>
23989 <td>x
23990 <div>a|b</div>
23991 </td>
23992 </tr>
23993 </table>
23994 !! end
23995
23996 !! test
23997 Tables: 2b. Nested in td
23998 !! options
23999 parsoid=html2wt
24000 !! html/parsoid
24001 <table><tbody><tr>
24002 <td>foo||bar</td>
24003 <td>a<i>b||c</i></td>
24004 <td>a<i><div>b||c</div></i></td>
24005 </tr></tbody></table>
24006 !! wikitext
24007 {|
24008 |<nowiki>foo||bar</nowiki>
24009 |a''<nowiki>b||c</nowiki>''
24010 |a''<div><nowiki>b||c</nowiki></div>''
24011 |}
24012 !! html/php
24013 <table>
24014 <tr>
24015 <td>foo||bar
24016 </td>
24017 <td>a<i>b||c</i>
24018 </td>
24019 <td>a<i><div>b||c</div></i>
24020 </td></tr></table>
24021
24022 !! end
24023
24024 !! test
24025 Tables: 2c. Nested in td -- no escaping needed
24026 !! options
24027 parsoid=html2wt
24028 !! html/*
24029 <table>
24030 <tr>
24031 <td>foo!!bar
24032 </td></tr></table>
24033
24034 !! wikitext
24035 {|
24036 |foo!!bar
24037 |}
24038 !! end
24039
24040 !! test
24041 Tables: 3a. Nested in th
24042 !! options
24043 parsoid=html2wt
24044 !! html/*
24045 <table>
24046 <tr>
24047 <th>foo!bar
24048 </th></tr></table>
24049
24050 !! wikitext
24051 {|
24052 !foo!bar
24053 |}
24054 !! end
24055
24056 !! test
24057 Tables: 3b. Nested in th
24058 !! options
24059 parsoid=html2wt
24060 !! html/parsoid
24061 <table><tbody>
24062 <tr><th>foo!!bar</th>
24063 <th><i>foo|bar</i></th>
24064 <th><i>foo!!bar</i></th>
24065 <th><i><span>foo!!bar</span></i></th>
24066 </tr></tbody></table>
24067 !! wikitext
24068 {|
24069 !<nowiki>foo!!bar</nowiki>
24070 !''<nowiki>foo|bar</nowiki>''
24071 !''<nowiki>foo!!bar</nowiki>''
24072 !''<span><nowiki>foo!!bar</nowiki></span>''
24073 |}
24074 !! html/php
24075 <table>
24076 <tr>
24077 <th>foo!!bar
24078 </th>
24079 <th><i>foo|bar</i>
24080 </th>
24081 <th><i>foo!!bar</i>
24082 </th>
24083 <th><i><span>foo!!bar</span></i>
24084 </th></tr></table>
24085
24086 !! end
24087
24088 !! test
24089 Tables: 3c. Nested in th
24090 !! options
24091 parsoid=html2wt
24092 !! html/parsoid
24093 <table><tbody>
24094 <tr><th>foo||bar</th>
24095 <th><span typeof="mw:Nowiki">foo||bar</span></th>
24096 </tr></tbody></table>
24097 !! wikitext
24098 {|
24099 !<nowiki>foo||bar</nowiki>
24100 !<nowiki>foo||bar</nowiki>
24101 |}
24102 !! html/php
24103 <table>
24104 <tr>
24105 <th>foo||bar
24106 </th>
24107 <th>foo||bar
24108 </th></tr></table>
24109
24110 !! end
24111
24112 !! test
24113 Tables: 4a. Escape -
24114 !! options
24115 parsoid=html2wt
24116 !! html/*
24117 <table>
24118 <tr>
24119 <th>-bar
24120 </th></tr>
24121 <tr>
24122 <td>-bar
24123 </td></tr></table>
24124
24125 !! wikitext
24126 {|
24127 !-bar
24128 |-
24129 |<nowiki>-bar</nowiki>
24130 |}
24131 !! end
24132
24133 !! test
24134 Tables: 4b. Escape +
24135 !! options
24136 parsoid=html2wt
24137 !! html/*
24138 <table>
24139 <tr>
24140 <th>+bar
24141 </th></tr>
24142 <tr>
24143 <td>+bar
24144 </td></tr></table>
24145
24146 !! wikitext
24147 {|
24148 !+bar
24149 |-
24150 |<nowiki>+bar</nowiki>
24151 |}
24152 !! end
24153
24154 !! test
24155 Tables: 4c. No escaping needed
24156 !! options
24157 parsoid=html2wt
24158 !! html/parsoid
24159 <table><tbody>
24160 <tr><td>foo-bar</td><td>foo+bar</td></tr>
24161 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
24162 <tr><td>foo
24163 <p>bar|baz
24164 +bar
24165 -bar</p></td></tr>
24166 <tr><td>x
24167 <div>a|b</div></td>
24168 </tbody></table>
24169 !! wikitext
24170 {|
24171 |foo-bar
24172 |foo+bar
24173 |-
24174 |''foo''-bar
24175 |''foo''+bar
24176 |-
24177 |foo
24178 bar|baz
24179 +bar
24180 -bar
24181 |-
24182 |x
24183 <div>a|b</div>
24184 |}
24185 !! html/php
24186 <table>
24187 <tr>
24188 <td>foo-bar
24189 </td>
24190 <td>foo+bar
24191 </td></tr>
24192 <tr>
24193 <td><i>foo</i>-bar
24194 </td>
24195 <td><i>foo</i>+bar
24196 </td></tr>
24197 <tr>
24198 <td>foo
24199 <p>bar|baz
24200 +bar
24201 -bar
24202 </p>
24203 </td></tr>
24204 <tr>
24205 <td>x
24206 <div>a|b</div>
24207 </td></tr></table>
24208
24209 !! end
24210
24211 !! test
24212 Tables: 4d. No escaping needed
24213 !! options
24214 parsoid=html2wt
24215 !! html/parsoid
24216 <table>
24217 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
24218 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
24219 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
24220 </tbody></table>
24221 !! wikitext
24222 {|
24223 |[[Foo]]-bar
24224 ||+1
24225 ||-2
24226 |}
24227 !! html/php
24228 <table>
24229 <tr>
24230 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
24231 </td>
24232 <td>+1
24233 </td>
24234 <td>-2
24235 </td></tr></table>
24236
24237 !! end
24238
24239 !! test
24240 T97430: Don't emit empty nowiki pairs around marker meta tags
24241 !! options
24242 parsoid=html2wt
24243 !! html/parsoid
24244 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24245 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
24246 !! wikitext
24247 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24248 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
24249 !! end
24250
24251 !! test
24252 Unclosed xmlish element in table line shouldn't eat end delimiters
24253 !! options
24254 parsoid=html2wt
24255 !! html/parsoid
24256 <table>
24257 <tbody><tr><td> &lt;foo</td>
24258 <td> bar></td></tr>
24259 </tbody></table>
24260 !! wikitext
24261 {|
24262 | <foo
24263 | bar>
24264 |}
24265 !! html/php
24266 <table>
24267 <tr>
24268 <td> &lt;foo
24269 </td>
24270 <td> bar&gt;
24271 </td></tr></table>
24272
24273 !! end
24274
24275 #### --------------- Links ----------------
24276 #### 1. Quote marks in link text
24277 #### 2. Wikilinks: Escapes needed
24278 #### 3. Wikilinks: No escapes needed
24279 #### 4. Extlinks: Escapes needed
24280 #### 5. Extlinks: No escapes needed
24281 #### --------------------------------------
24282 !! test
24283 Links 1. WikiLinks: No escapes needed
24284 !! options
24285 parsoid=html2wt
24286 !! html/parsoid
24287 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
24288 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
24289 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
24290 !! wikitext
24291 [[Foo|Foo''boo'']]
24292 [[Foo|[Foobar]]]
24293 [[Foo|x [Foobar] x]]
24294 !! html/php
24295 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
24296 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
24297 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
24298 </p>
24299 !! end
24300
24301 !! test
24302 Links 2. WikiLinks: Escapes needed
24303 !! options
24304 parsoid=html2wt
24305 !! html/parsoid
24306 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
24307 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
24308 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
24309 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
24310 <a href="Foo" rel="mw:WikiLink">|Bar</a>
24311 <a href="Foo" rel="mw:WikiLink">]]bar</a>
24312 <a href="Foo" rel="mw:WikiLink">[[bar</a>
24313 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
24314 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
24315 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
24316 !! wikitext
24317 [[Foo|<nowiki>Foobar]</nowiki>]]
24318 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
24319 [[Foo|<nowiki>[[Bar]]</nowiki>]]
24320 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
24321 [[Foo|<nowiki>|Bar</nowiki>]]
24322 [[Foo|<nowiki>]]bar</nowiki>]]
24323 [[Foo|<nowiki>[[bar</nowiki>]]
24324 [[Foo|<nowiki>x [[ y</nowiki>]]
24325 [[Foo|<nowiki>x ]] y</nowiki>]]
24326 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
24327 !! html/php
24328 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
24329 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
24330 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
24331 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
24332 <a href="/wiki/Foo" title="Foo">|Bar</a>
24333 <a href="/wiki/Foo" title="Foo">]]bar</a>
24334 <a href="/wiki/Foo" title="Foo">[[bar</a>
24335 <a href="/wiki/Foo" title="Foo">x [[ y</a>
24336 <a href="/wiki/Foo" title="Foo">x ]] y</a>
24337 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
24338 </p>
24339 !! end
24340
24341 !! test
24342 Links 3. WikiLinks: No escapes needed
24343 !! options
24344 parsoid=html2wt
24345 !! html/parsoid
24346 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
24347 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
24348 !! wikitext
24349 [[Foo|[Foobar]]
24350 [[Foo|foo|bar]]
24351 !! html/php
24352 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
24353 <a href="/wiki/Foo" title="Foo">foo|bar</a>
24354 </p>
24355 !! end
24356
24357 !! test
24358 Links 4. ExtLinks: Escapes needed
24359 !! options
24360 parsoid=html2wt
24361 !! html/parsoid
24362 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
24363 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
24364 <p>[http://google.com]</p>
24365 <p>[http://google.com google]</p>
24366 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
24367 <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>
24368 !! wikitext
24369 [http://google.com <nowiki>[google]</nowiki>]
24370 [http://google.com <nowiki>google]</nowiki>]
24371
24372 <nowiki>[http://google.com]</nowiki>
24373
24374 <nowiki>[http://google.com google]</nowiki>
24375
24376 [http://google.com<nowiki>]</nowiki>
24377
24378 [{{echo|http://google.com}}<nowiki>]</nowiki>
24379 !! html/php
24380 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
24381 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
24382 </p><p>[http://google.com]
24383 </p><p>[http://google.com google]
24384 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24385 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24386 </p>
24387 !! end
24388
24389 !! test
24390 Links 5. ExtLinks: No escapes needed
24391 !! options
24392 parsoid=html2wt
24393 !! html/parsoid
24394 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
24395 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
24396 !! wikitext
24397 [http://google.com [google]
24398
24399 [[http://google.com]]
24400 !! html/php
24401 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
24402 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
24403 </p>
24404 !! end
24405
24406 !! test
24407 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
24408 !! options
24409 parsoid=html2wt
24410 !! html/parsoid
24411 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
24412 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
24413 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
24414 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
24415 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
24416 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
24417 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24418 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
24419 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24420 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
24421 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
24422 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
24423 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
24424 </p>
24425 !! wikitext
24426 x<nowiki/>http://example.com<nowiki/>y
24427 http://example.com<nowiki/>?x
24428 http://example.com<nowiki/>&x
24429 http://example.com<nowiki/>'x
24430 http://example.com<nowiki/>,x
24431 http://example.com<nowiki/>.x
24432 http://example.com<nowiki/>;x
24433 http://example.com<nowiki/>:x
24434 http://example.com<nowiki/>;x
24435 http://example.com<nowiki/>!x
24436 http://example.com<nowiki/>=x
24437 http://example.com<nowiki/>(x)
24438 http://example.com(x<nowiki/>)
24439 !! end
24440
24441 !! test
24442 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24443 !! options
24444 parsoid=html2wt
24445 !! html/parsoid
24446 <p>x
24447 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
24448 y
24449 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
24450 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
24451 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
24452 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
24453 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
24454 </p>
24455 !! wikitext
24456 x
24457 http://example.com
24458 y
24459 "http://example.com"
24460 (http://example.com)
24461 (http://example.com) foo
24462 http://example.com,
24463 http://example.com, foo
24464 !! html/php
24465 <p>x
24466 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
24467 y
24468 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
24469 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
24470 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
24471 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
24472 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
24473 </p>
24474 !! end
24475
24476 !! test
24477 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24478 !! options
24479 parsoid=html2wt
24480 !! html/parsoid
24481 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
24482 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
24483 !! wikitext
24484 http://example.com.,;:!?\
24485 -http://example.com:
24486 !! html/php
24487 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
24488 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
24489 </p>
24490 !! end
24491
24492 !! test
24493 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
24494 !! options
24495 parsoid=html2wt
24496 !! html/parsoid
24497 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
24498 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
24499 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
24500 !! wikitext
24501 RFC 123<nowiki/>4
24502 RFC 123<nowiki/>y
24503 X<nowiki/>RFC 123<nowiki/>y
24504 !! end
24505
24506 !! test
24507 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
24508 !! options
24509 parsoid=html2wt
24510 !! html/parsoid
24511 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24512 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24513 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24514 </p>
24515 !! wikitext
24516 RFC 123?foo
24517 RFC 123&foo
24518 -RFC 123-
24519 !! html/php
24520 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24521 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24522 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24523 </p>
24524 !! end
24525
24526 !! test
24527 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
24528 !! options
24529 parsoid=html2wt
24530 !! html/parsoid
24531 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24532 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24533 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24534 !! wikitext
24535 PMID 123<nowiki/>4
24536 PMID 123<nowiki/>y
24537 X<nowiki/>PMID 123<nowiki/>y
24538 !! end
24539
24540 !! test
24541 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
24542 !! options
24543 parsoid=html2wt
24544 !! html/parsoid
24545 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24546 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24547 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24548 </p>
24549 !! wikitext
24550 PMID 123?foo
24551 PMID 123&foo
24552 -PMID 123-
24553 !! html/php
24554 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24555 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24556 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24557 </p>
24558 !! end
24559
24560 !! test
24561 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
24562 !! options
24563 parsoid=html2wt
24564 !! html/parsoid
24565 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24566 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24567 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24568 </p>
24569 !! wikitext
24570 ISBN 1234567890<nowiki/>1
24571 ISBN 1234567890<nowiki/>x
24572 a<nowiki/>ISBN 1234567890<nowiki/>b
24573 !! end
24574
24575 !! test
24576 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
24577 !! options
24578 parsoid=html2wt
24579 !! html/parsoid
24580 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24581 !! wikitext
24582 -ISBN 1234567890's
24583 !! html/php
24584 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24585 </p>
24586 !! end
24587
24588 !! test
24589 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24590 !! options
24591 parsoid=html2wt
24592 !! html/*
24593 <p>this is not a link: http://example.com
24594 </p>
24595 !! wikitext
24596 this is not a link: <nowiki>http://example.com</nowiki>
24597 !! end
24598
24599 !! test
24600 Links 15. Link trails can't become link prefixes.
24601 !! options
24602 language=is
24603 parsoid=html2wt
24604 !! html/parsoid
24605 <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>
24606 !! wikitext
24607 [[Söfnuður]]-[[00]]
24608 !! html/php
24609 <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>
24610 </p>
24611 !! end
24612
24613 #### --------------- Quotes ---------------
24614 #### 1. Quotes inside <b> and <i>
24615 #### 2. Link fragments separated by <i> and <b> tags
24616 #### 3. Link fragments inside <i> and <b>
24617 #### 4. No escaping needed
24618 #### --------------------------------------
24619 !! test
24620 1a. Quotes inside <b> and <i>
24621 !! options
24622 parsoid=html2wt
24623 !! html/*
24624 <p><i>'foo'</i>
24625 <i>''foo''</i>
24626 <i>'''foo'''</i>
24627 <i>foo</i>'s
24628 <b>'foo'</b>
24629 <b>''foo''</b>
24630 <b>'''foo'''</b>
24631 <b>foo'<i>bar'</i>baz</b>
24632 <b>foo</b>'s
24633 '<i>foo</i>
24634 <i>foo</i>'
24635 <i>foo'</i>'
24636 '<i>foo</i>'
24637 '<b>foo</b>
24638 <b>foo</b>'
24639 '<b>foo</b>'
24640 <i>fools'<span> errand</span></i>
24641 <i><span>fool</span>'s errand</i>
24642 '<i>foo</i> bar '<i>baz</i>
24643 a|!*#-:;+-~[]{}b'<i>x</i>
24644 </p>
24645 !! wikitext
24646 ''<nowiki/>'foo'''
24647 ''<nowiki>''foo''</nowiki>''
24648 ''<nowiki>'''foo'''</nowiki>''
24649 ''foo''<nowiki/>'s
24650 '''<nowiki/>'foo''''
24651 '''<nowiki>''foo''</nowiki>'''
24652 '''<nowiki>'''foo'''</nowiki>'''
24653 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24654 '''foo'''<nowiki/>'s
24655 '''foo''
24656 ''foo''<nowiki/>'
24657 ''foo'''<nowiki/>'
24658 '''foo''<nowiki/>'
24659 ''''foo'''
24660 '''foo'''<nowiki/>'
24661 ''''foo'''<nowiki/>'
24662 ''fools'<span> errand</span>''
24663 ''<span>fool</span>'s errand''
24664 '<nowiki/>''foo'' bar '''baz''
24665 a|!*#-:;+-~[]{}b'''x''
24666 !! end
24667
24668 !! test
24669 1b. Quotes inside <b> and <i> with other tags on same line
24670 !! options
24671 parsoid=html2wt
24672 !! html/parsoid
24673 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24674 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24675 <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>
24676 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24677 '<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>
24678 '<i>foo</i> <div title="name">test</div>
24679 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24680 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24681 <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>
24682 </ol>
24683 !! wikitext
24684 '''a'' foo ''[[bar]]''
24685 ''a''' foo ''[[bar]]''
24686 ''a''' foo '''{{echo|[[bar]]}}'''
24687 [[foo]] x'''[[bar]]''
24688 '''foo'' <ref>test</ref>
24689 '''foo'' <div title="name">test</div>
24690 '''foo'' and <br> bar
24691 <references />
24692 !! end
24693
24694 !! test
24695 2. Link fragments separated by <i> and <b> tags
24696 !! options
24697 parsoid=html2wt
24698 !! html/parsoid
24699 <p>[[<i>foo</i>hello]]</p>
24700 <p>[[<b>foo</b>hello]]</p>
24701 !! wikitext
24702 [[''foo''<nowiki>hello]]</nowiki>
24703
24704 [['''foo'''<nowiki>hello]]</nowiki>
24705 !! end
24706
24707 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24708 # this is one of the shortcomings of this format
24709 !! test
24710 3. Link fragments inside <i> and <b>
24711 !! options
24712 parsoid=html2wt
24713 !! html/parsoid
24714 <p><i>[[foo</i>]]</p>
24715 <p><b>[[foo</b>]]</p>
24716 !! wikitext
24717 ''[[foo''<nowiki>]]</nowiki>
24718
24719 '''[[foo'''<nowiki>]]</nowiki>
24720 !! end
24721
24722 !! test
24723 4. No escaping needed
24724 !! options
24725 options=html2wt
24726 !! html/parsoid
24727 <p>'<span><i>bar</i></span>'
24728 '<span><b>bar</b></span>'
24729 'a:b'foo
24730 </p>
24731 !! wikitext
24732 '<span>''bar''</span>'
24733 '<span>'''bar'''</span>'
24734 'a:b'foo
24735 !! end
24736
24737 #### ----------- Paragraphs ---------------
24738 #### 1. No unnecessary escapes
24739 #### --------------------------------------
24740
24741 !! test
24742 1. No unnecessary escapes
24743 !! options
24744 parsoid=html2wt
24745 !! html/parsoid
24746 <p>bar <span>[[foo]]</span>
24747 </p><p>=bar <span>[[foo]]</span>
24748 </p><p>[[bar <span>[[foo]]</span>
24749 </p><p>]]bar <span>[[foo]]</span>
24750 </p><p>=bar <span>foo]]</span>=
24751 </p>
24752 !! wikitext
24753 bar <span><nowiki>[[foo]]</nowiki></span>
24754
24755 =bar <span><nowiki>[[foo]]</nowiki></span>
24756
24757 [[bar <span><nowiki>[[foo]]</nowiki></span>
24758
24759 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24760
24761 =bar <span>foo]]</span><nowiki>=</nowiki>
24762 !!end
24763
24764 #### ----------------------- PRE --------------------------
24765 #### 1. Leading whitespace in SOL context should be escaped
24766 #### ------------------------------------------------------
24767 !! test
24768 1. Leading whitespace in SOL context should be escaped
24769 !! options
24770 parsoid=html2wt
24771 !! html/parsoid
24772 <p> a</p>
24773
24774 <p> a</p>
24775
24776 <p> a(tab)</p>
24777
24778 <p> a
24779 <!--cmt-->
24780 a</p>
24781
24782 <p>a
24783 b</p>
24784
24785 <p>a
24786 b</p>
24787
24788 <p>a
24789 b</p>
24790 !! wikitext
24791 <nowiki> </nowiki>a
24792
24793 <nowiki> </nowiki> a
24794
24795 a(tab)
24796
24797 <nowiki> </nowiki> a
24798 <!--cmt-->
24799 <nowiki> </nowiki>a
24800
24801 a
24802 <nowiki> </nowiki>b
24803
24804 a
24805 b
24806
24807 a
24808 b
24809 !! html/php
24810 <p> a
24811 </p><p> a
24812 </p><p> a(tab)
24813 </p><p> a
24814 a
24815 </p><p>a
24816 b
24817 </p><p>a
24818 b
24819 </p><p>a
24820 b
24821 </p>
24822 !! end
24823
24824 !! test
24825 2. Leading whitespace in non-indent-pre contexts should not be escaped
24826 !! options
24827 parsoid=html2wt
24828 !! html/parsoid
24829 <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>
24830 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24831 <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>
24832 b</span></li>
24833 </ol>
24834 !! wikitext
24835 foo <ref>''a''
24836 b</ref>
24837 <references />
24838 !! end
24839
24840 !! test
24841 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24842 !! options
24843 parsoid=html2wt
24844 !! html/parsoid
24845 <blockquote>
24846 <p>
24847 a
24848 <span>b</span>
24849 c</p>
24850 </blockquote>
24851 !! wikitext
24852 <blockquote>
24853 a
24854 <span>b</span>
24855 c
24856 </blockquote>
24857 !! end
24858
24859 !! test
24860 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24861 !! options
24862 options=html2wt
24863 !! html/parsoid
24864 <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>
24865 !! wikitext
24866 [[File:Foobar.jpg|thumb|caption]]
24867 !! end
24868
24869 !! test
24870 5. Nowiki escaping should account for indent-pres
24871 !! options
24872 parsoid=html2wt
24873 !! html/parsoid
24874 <pre>==foo==</pre>
24875 !! wikitext
24876 ==foo==
24877 !! end
24878
24879 !!test
24880 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24881 !! options
24882 parsoid=html2wt
24883 !! html/parsoid
24884 <pre>
24885 * foo
24886 * bar
24887 </pre>
24888 !! wikitext
24889 * foo
24890 * bar
24891 !! end
24892
24893 #### --------------- Behavior Switches --------------------
24894
24895 !! test
24896 1. Valid behavior switches should be escaped
24897 !! options
24898 parsoid=html2wt
24899 !! html/parsoid
24900 __TOC__
24901 <i>__TOC__</i>
24902 !! wikitext
24903 <nowiki>__TOC__</nowiki>
24904 ''<nowiki>__TOC__</nowiki>''
24905 !! end
24906
24907 !! test
24908 2. Invalid behavior switches should not be escaped
24909 !! options
24910 parsoid=html2wt
24911 !! html/parsoid
24912 __TOO__
24913 __|__
24914 !! wikitext
24915 __TOO__
24916 __|__
24917 !! end
24918
24919 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24920 !! test
24921 Behavior switches should be SOL-transparent
24922 !! options
24923 parsoid=html2wt
24924 !! html/parsoid
24925 <meta property="mw:PageProp/toc" />
24926
24927 <!-- this one's bogus -->
24928 <pre>__TOO__</pre>
24929
24930 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24931
24932 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24933 !! wikitext
24934 __TOC__
24935
24936 <!-- this one's bogus -->
24937 __TOO__
24938
24939 __TOC__ foo
24940
24941 __TOC__
24942 bar
24943 !! end
24944
24945 #### --------------- HTML tags ---------------
24946 #### 1. a tags
24947 #### 2. other tags
24948 #### 3. multi-line html tag
24949 #### 4. extension tags
24950 #### -----------------------------------------
24951 !! test
24952 1. a tags
24953 !! options
24954 parsoid=html2wt
24955 !! html/parsoid
24956 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24957 !! wikitext
24958 <a href="http://google.com">google</a>
24959 !! end
24960
24961 !! test
24962 2. other tags
24963 !! options
24964 parsoid=html2wt
24965 !! html/parsoid
24966 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24967 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24968 <li> &lt;td&gt;</li></ul>
24969
24970 !! wikitext
24971 * <nowiki><div>foo</div></nowiki>
24972 * <nowiki><div style="color:red">foo</div></nowiki>
24973 * <nowiki><td></nowiki>
24974 !! end
24975
24976 !! test
24977 3. multi-line html tag
24978 !! options
24979 parsoid=html2wt
24980 !! html/parsoid
24981 <p>&lt;div
24982 &gt;foo&lt;/div
24983 &gt;
24984 </p>
24985 !! wikitext
24986 <nowiki><div
24987 >foo</div
24988 ></nowiki>
24989 !! end
24990
24991 !! test
24992 4. extension tags
24993 !! options
24994 parsoid=html2wt
24995 !! html/parsoid
24996 <p>&lt;ref&gt;foo&lt;/ref&gt;
24997 </p><p>&lt;ref&gt;bar
24998 </p><p>baz&lt;/ref&gt;
24999 </p>
25000 !! wikitext
25001 <nowiki><ref>foo</ref></nowiki>
25002
25003 <nowiki><ref>bar</nowiki>
25004
25005 baz<nowiki></ref></nowiki>
25006 !! end
25007
25008 #### --------------- Others ---------------
25009 !! test
25010 Escaping nowikis
25011 !! options
25012 parsoid=html2wt
25013 !! html/parsoid
25014 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
25015 </p>
25016 !! wikitext
25017 &lt;nowiki&gt;foo&lt;/nowiki&gt;
25018 !! end
25019
25020 ## The quote-char in the input is necessary for triggering the bug
25021 !! test
25022 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
25023 !! options
25024 parsoid=html2wt
25025 !! html/parsoid
25026 <p>foo's bar :</p>
25027 !! wikitext
25028 foo's bar :
25029 !! end
25030
25031 #----------- End of wikitext escaping tests --------------
25032
25033 !! test
25034
25035 Tag-like HTML structures are passed through as text
25036 !! wikitext
25037 <x y>
25038
25039 <x.y>
25040
25041 <x-y>
25042
25043 1>2
25044
25045 x<y
25046
25047 a>b
25048
25049 1<d e>f
25050 !! html
25051 <p>&lt;x y&gt;
25052 </p><p>&lt;x.y&gt;
25053 </p><p>&lt;x-y&gt;
25054 </p><p>1&gt;2
25055 </p><p>x&lt;y
25056 </p><p>a&gt;b
25057 </p><p>1&lt;d e&gt;f
25058 </p>
25059 !! end
25060
25061 !! test
25062 HTML tag with necessary entities in attributes
25063 !! wikitext
25064 <span title="&amp;amp;">foo</span>
25065 !! html
25066 <p><span title="&amp;amp;">foo</span>
25067 </p>
25068 !! end
25069
25070 !! test
25071 HTML tag with 'unnecessary' entity encoding in attributes
25072 !! wikitext
25073 <span title="&amp;">foo</span>
25074 !! html
25075 <p><span title="&amp;">foo</span>
25076 </p>
25077 !! end
25078
25079 !! test
25080 HTML tag with broken attribute value quoting
25081 !! options
25082 parsoid=wt2html,html2html
25083 !! wikitext
25084 <span title="Hello world>Foo</span>
25085 !! html/php
25086 <p><span title="Hello world">Foo</span>
25087 </p>
25088 !! html/parsoid
25089 <p><span title="Hello world">Foo</span></p>
25090 !! end
25091
25092 !! test
25093 Self-closed tag with broken attribute value quoting
25094 !! options
25095 parsoid=wt2html,html2html
25096 !! wikitext
25097 <div title="Hello world />Foo
25098 !! html/php+tidy
25099 <div title="Hello world"></div>
25100 <p>Foo</p>
25101 !! html/parsoid
25102 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
25103 !! end
25104
25105 !! test
25106 Table with broken attribute value quoting
25107 !! options
25108 parsoid=wt2html,html2html
25109 !! wikitext
25110 {|
25111 | title="Hello world|Foo
25112 |}
25113 !! html/php
25114 <table>
25115 <tr>
25116 <td title="Hello world">Foo
25117 </td></tr></table>
25118
25119 !! html/parsoid
25120 <table>
25121 <tr>
25122 <td title="Hello world">Foo
25123 </td></tr></table>
25124
25125 !! end
25126
25127 !! test
25128 Table with broken attribute value quoting on consecutive lines
25129 !! options
25130 parsoid=wt2html,html2html
25131 !! wikitext
25132 {|
25133 | title="Hello world|Foo
25134 | style="color:red|Bar
25135 |}
25136 !! html/php
25137 <table>
25138 <tr>
25139 <td title="Hello world">Foo
25140 </td>
25141 <td style="color:red">Bar
25142 </td></tr></table>
25143
25144 !! html/parsoid
25145 <table><tbody>
25146 <tr>
25147 <td title="Hello world">Foo
25148 </td><td style="color: red">Bar
25149 </td></tr></tbody></table>
25150
25151 !! end
25152
25153 !!test
25154 Accept empty td cell attribute
25155 !! wikitext
25156 {|
25157 | align="center" | foo || |
25158 |}
25159 !! html
25160 <table>
25161 <tr>
25162 <td align="center"> foo </td>
25163 <td>
25164 </td></tr></table>
25165
25166 !!end
25167
25168 !!test
25169 Non-empty attributes in th-cells
25170 !! wikitext
25171 {|
25172 ! Foo !! style="color: red" | Bar
25173 |}
25174 !! html
25175 <table>
25176 <tr>
25177 <th> Foo </th>
25178 <th style="color: red"> Bar
25179 </th></tr></table>
25180
25181 !!end
25182
25183 !!test
25184 Accept empty attributes in th-cells
25185 !! wikitext
25186 {|
25187 !| foo !!| bar
25188 |}
25189 !! html
25190 <table>
25191 <tr>
25192 <th> foo </th>
25193 <th> bar
25194 </th></tr></table>
25195
25196 !!end
25197
25198 !!test
25199 Empty table rows go away
25200 !! wikitext
25201 {|
25202 | Hello
25203 | there
25204 |- class="foo"
25205 |-
25206 |}
25207 !! html
25208 <table>
25209 <tr>
25210 <td> Hello
25211 </td>
25212 <td> there
25213 </td></tr>
25214
25215 </table>
25216
25217 !! end
25218
25219 ###
25220 ### Parsoid-centric tests for testing RTing of inter-element separators
25221 ### Edge cases not tested by existing parser tests and specific to
25222 ### Parsoid-specific serialization strategies.
25223 ###
25224
25225 !!test
25226 RT-ed inter-element separators should be valid separators
25227 !! wikitext
25228 {|
25229 |- [[foo]]
25230 |}
25231 !! html/php
25232 <table>
25233
25234 </table>
25235
25236 !! html/parsoid
25237 <table>
25238 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
25239 </tbody></table>
25240 !!end
25241
25242 # Parsoid-only since PHP parser relies on Tidy for correct output
25243 !!test
25244 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
25245 !!options
25246 parsoid
25247 !! wikitext
25248 {|
25249 |<small>foo
25250 bar
25251 |}
25252
25253 {|
25254 |<small>foo<small>
25255 |}
25256 !! html
25257 <table>
25258 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
25259 <p>bar</p></small></td></tr>
25260 </tbody></table>
25261
25262 <table>
25263 <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>
25264 </tbody></table>
25265 !!end
25266
25267 # Note that the "style" attribute is really a template parameter here.
25268 # The = would have to be {{=}} if you wanted the literal.
25269 !!test
25270 Empty TD followed by TD with tpl-generated attribute
25271 !! wikitext
25272 {|
25273 |-
25274 |
25275 |{{echo|style='color:red'}}|foo
25276 |}
25277 !! html
25278 <table>
25279
25280 <tr>
25281 <td>
25282 </td>
25283 <td>foo
25284 </td></tr></table>
25285
25286 !!end
25287
25288 !!test
25289 Indented table with an empty td
25290 !! wikitext
25291 {|
25292 |-
25293 |
25294 |foo
25295 |}
25296 !! html
25297 <table>
25298
25299 <tr>
25300 <td>
25301 </td>
25302 <td>foo
25303 </td></tr></table>
25304
25305 !!end
25306
25307 ## We have some newline diffs RT-ing this edge case
25308 ## and it is not important enough -- we seem to be emitting
25309 ## at most 2 newlines after a </tr> and this is unrelated to
25310 ## the issue from T85627 that this is testing.
25311 !!test
25312 Indented table with blank lines in between (T85627)
25313 !! options
25314 parsoid=wt2html
25315 !! wikitext
25316 {|
25317 |foo
25318
25319
25320 |}
25321 !! html
25322 <table>
25323
25324 <tr>
25325 <td>foo
25326 </td></tr></table>
25327
25328 !!end
25329
25330 !!test
25331 Indented block & table
25332 !! wikitext
25333 <div>foo</div>
25334 {|
25335 |foo
25336 |}
25337 !! html/php
25338 <div>foo</div>
25339 <table>
25340 <tr>
25341 <td>foo
25342 </td></tr></table>
25343
25344 !! html/parsoid
25345 <div data-parsoid='{"stx":"html"}'>foo</div>
25346 <table><tbody>
25347 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
25348 </tbody></table>
25349 !!end
25350
25351 !! test
25352 Indent and comment before table row
25353 !! wikitext
25354 {|
25355 <!--hi-->|-
25356 | there
25357 |}
25358 !! html/php
25359 <table>
25360
25361 <tr>
25362 <td> there
25363 </td></tr></table>
25364
25365 !! html/parsoid
25366 <table>
25367 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
25368 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
25369 </tbody></table>
25370 !! end
25371
25372 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
25373 !!test
25374 Empty TR followed by a template-generated TR
25375 !!options
25376 parsoid
25377 !! wikitext
25378 {|
25379 |-
25380 {{echo|<tr><td>foo</td></tr>}}
25381 |}
25382 !! html
25383 <table>
25384 <tbody>
25385 <tr></tr>
25386 <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}}]}'>
25387 <td>foo</td></tr>
25388 </tbody></table>
25389 !!end
25390
25391 ## PHP and parsoid output differ for this, and since this is primarily
25392 ## for testing Parsoid's serializer, marking this Parsoid only
25393 !!test
25394 Empty TR followed by mixed-ws-comment line should RT correctly
25395 !!options
25396 parsoid
25397 !! wikitext
25398 {|
25399 |-
25400 <!--c-->
25401 |-
25402 <!--c--> <!--d-->
25403 |}
25404 !! html
25405 <table>
25406 <tbody>
25407 <tr></tr>
25408 <!--c-->
25409 <tr>
25410 <!--c--> </tr><!--d-->
25411 </tbody></table>
25412
25413 !!end
25414
25415 !!test
25416 Multi-line image caption generated by templates with/without trailing newlines
25417 !! wikitext
25418 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
25419 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
25420 !! html/parsoid
25421 <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>
25422 <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>
25423 !!end
25424
25425 !! test
25426 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
25427 !! options
25428 parsoid=html2wt
25429 !! html/parsoid
25430 <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>
25431
25432 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
25433 !! wikitext
25434 <includeonly>foo</includeonly>
25435 new para
25436
25437 [[Category:Foo]]
25438
25439 = new heading =
25440 !! end
25441
25442 ## PHP emits broken html for this, and since this is primarily
25443 ## a Parsoid serializer test, marking this Parsoid only
25444 !!test
25445 Improperly nested inline or quotes tags with whitespace in between
25446 !! wikitext
25447 <span> <s>x</span> </s>
25448 ''' ''x''' ''
25449 !! html/parsoid
25450 <p><span> <s>x</s></span><s> </s>
25451 <b> <i>x</i></b><i> </i>
25452 </p>
25453 !!end
25454
25455 !!test
25456 Encapsulate protected attributes from wt
25457 !! wikitext
25458 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
25459
25460 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
25461 | ok
25462 |}
25463 !! html/parsoid
25464 <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>
25465
25466 <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">
25467 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
25468 </tbody></table>
25469 !!end
25470
25471 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
25472 ## Having nested or stray pre tags results in the attempt to add duplicates,
25473 ## causing an assertion fail. This test tries to prevent that situation.
25474 !!test
25475 Ensure ParagraphWrapper can deal with stray closing pre tags
25476 !!options
25477 parsoid=wt2html
25478 !! wikitext
25479 plain text</pre>
25480 !! html/parsoid
25481 plain text
25482 !!end
25483
25484 !!test
25485 1. Ensure fostered text content is wrapped in element nodes
25486 !!options
25487 parsoid=wt2html
25488 !! wikitext
25489 <table>hi</table><table>ho</table>
25490 !! html/parsoid
25491 <p>hi</p>
25492 <table></table>
25493 <p>ho</p>
25494 <table></table>
25495 !!end
25496
25497 !!test
25498 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
25499 !!options
25500 parsoid=wt2html,wt2wt
25501 !! wikitext
25502 <table>
25503 <tr> || ||
25504 <td> a
25505 </table>
25506 !! html/parsoid
25507 <p> || ||
25508 </p><table>
25509 <tbody><tr><td> a</td></tr>
25510 </tbody></table>
25511 !!end
25512
25513 !!test
25514 Encapsulation properly handles null DSR information from foster box
25515 !!options
25516 parsoid=wt2html,wt2wt
25517 !! wikitext
25518 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25519 !! html/parsoid
25520 <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>
25521 !!end
25522
25523 !!test
25524 1. Encapsulate foster-parented transclusion content
25525 !!options
25526 parsoid=wt2wt,wt2html
25527 !! wikitext
25528 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25529 !! html/parsoid
25530 <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>
25531 <tbody>
25532 <tr>
25533 <td>bar</td>
25534 </tr>
25535 </tbody>
25536 </table>
25537 !!end
25538
25539 !!test
25540 2. Encapsulate foster-parented transclusion content
25541 !!options
25542 parsoid=wt2wt,wt2html
25543 !! wikitext
25544 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25545 !! html/parsoid
25546 <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>
25547 <table>
25548 <tbody>
25549 <tr>
25550 <td>bar</td>
25551 </tr>
25552 </tbody>
25553 </table>
25554 !!end
25555
25556 !!test
25557 3. Encapsulate foster-parented transclusion content
25558 !!options
25559 parsoid=wt2wt,wt2html
25560 !! wikitext
25561 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25562 !! html/parsoid
25563 <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;]}">
25564 <p>foo</p>
25565 </div>
25566 <table>
25567 <tbody>
25568 <tr>
25569 <td>bar</td>
25570 </tr>
25571 </tbody>
25572 </table>
25573 !!end
25574
25575 !!test
25576 4. Encapsulate foster-parented transclusion content
25577 !!options
25578 parsoid=wt2wt,wt2html
25579 !! wikitext
25580 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25581 !! html/parsoid
25582 <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;]}">
25583 <p>foo</p>
25584 </div>
25585 <table>
25586 <tbody>
25587 <tr>
25588 <td>bar</td>
25589 </tr>
25590 </tbody>
25591 </table>
25592 !!end
25593
25594 !!test
25595 5. Encapsulate foster-parented transclusion content
25596 !!options
25597 parsoid=wt2wt,wt2html
25598 !! wikitext
25599 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25600 !! html/parsoid
25601 <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>
25602 <table>
25603 <tbody>
25604 <tr>
25605 <td>
25606 <div>
25607 <p>foo</p>
25608 </div>
25609 </td>
25610 </tr>
25611 </tbody>
25612 </table>
25613 !!end
25614
25615 !!test
25616 6. Encapsulate foster-parented transclusion content
25617 !!options
25618 parsoid=wt2wt,wt2html
25619 !! wikitext
25620 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25621 !! html/parsoid
25622 <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>
25623 <table>
25624 <tbody>
25625 <tr>
25626 <td>
25627 <div>
25628 <p>foo</p>
25629 </div>
25630 </td>
25631 </tr>
25632 </tbody>
25633 </table>
25634 <p>ok</p>
25635 !!end
25636
25637 !!test
25638 7. Encapsulate foster-parented transclusion content
25639 !!options
25640 parsoid=wt2wt,wt2html
25641 !! wikitext
25642 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25643 !! html/parsoid
25644 <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>
25645 <table>
25646 <tbody>
25647 <tr>
25648 <td>bar</td>
25649 </tr>
25650 </tbody>
25651 </table>
25652 !!end
25653
25654 # Note that the wt is broken on purpose: the = should be {{=}} if you
25655 # don't want it to be a template parameter key.
25656 !!test
25657 8. Encapsulate foster-parented transclusion content
25658 !!options
25659 parsoid=wt2wt,wt2html
25660 !! wikitext
25661 {{echo|a
25662 }}{|{{echo|style='color:red'}}
25663 |-
25664 |b
25665 |}
25666 !! html/parsoid
25667 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25668 <span> </span>
25669 <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>
25670 <table>
25671 <tbody>
25672 <tr>
25673 <td>b</td>
25674 </tr>
25675 </tbody>
25676 </table>
25677 !!end
25678
25679 !!test
25680 9. Encapsulate foster-parented transclusion content
25681 !!options
25682 parsoid=wt2wt,wt2html
25683 !! wikitext
25684 <table>{{echo|hi</table>hello}}
25685 !! html/parsoid
25686 <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>
25687 !!end
25688
25689 !!test
25690 Table in fosterable position
25691 !!options
25692 parsoid=wt2html
25693 !! wikitext
25694 {{OpenTable}}
25695 <div>
25696 {|
25697 |}
25698 </div>
25699 |}
25700 !! html/parsoid
25701 <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">
25702 </span>
25703 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25704
25705 <table>
25706 </table>
25707 !!end
25708
25709 # Parsoid only for bug 64747
25710 !! test
25711 Properly encapsulate empty-content transclusions in fosterable positions
25712 !! wikitext
25713 <table>
25714 {{#if:|
25715 <td>foo</td>
25716 }}
25717 </table>
25718 !! html/parsoid
25719 <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"}]]}'>
25720
25721 </table>
25722 !! end
25723
25724 !! test
25725 Always encapsulate foster box when template range is expanded to table
25726 !! options
25727 parsoid=wt2wt
25728 !! wikitext
25729 {|
25730 hello
25731 {{OpenTable}}
25732 |}
25733 !! html/parsoid
25734
25735 !! end
25736
25737 !! test
25738 T115289: Unclosed table
25739 !! wikitext
25740 {{echo|<table>}}<!--c-->[[Category:Two]]
25741 !! html/parsoid
25742 <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>
25743 !! end
25744
25745 !! test
25746 T115289: Don't migrate newlines out of tables with fostered content
25747 !! wikitext
25748 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25749 !! html/parsoid
25750 <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>
25751 !! end
25752
25753 !! test
25754 T73074: More fostering fun
25755 !! wikitext
25756 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25757 !! html/parsoid
25758 <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>
25759 !! end
25760
25761 !!test
25762 Support <object> element with .data attribute
25763 !!options
25764 parsoid=html2wt
25765 !! html/parsoid
25766 <object data="test.swf"></object>
25767 !! wikitext
25768 <object data="test.swf"></object>
25769 !!end
25770
25771 !! test
25772 Don't block XML namespace declaration
25773 !! wikitext
25774 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25775 !! html/php
25776 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25777 </p>
25778 !! html/parsoid
25779 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25780 !! end
25781
25782 # -----------------------------------------------------------------
25783 # The following section of tests are primarily to spec requirements
25784 # around Parsoid's serialization (old, new, edited content)
25785 #
25786 # All these tests are marked Parsoid html2wt and html2html only
25787 # ----------------------------------------------------------------
25788
25789 !! test
25790 Ignore rel attribute in a-tags during serialization to url-links
25791 !! options
25792 parsoid=html2wt
25793 !! html/parsoid
25794 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25795 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25796 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25797 !! wikitext
25798 http://en.wikipedia.org/wiki/Foobar
25799 http://en.wikipedia.org/wiki/Foobar
25800 http://en.wikipedia.org/wiki/Foobar
25801 !! end
25802
25803 # 'mi' is a localinterwiki prefix as well as a language
25804 !! test
25805 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
25806 !! options
25807 parsoid=html2wt
25808 !! html/parsoid
25809 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25810 !! wikitext
25811 [[Foo]]
25812 !! end
25813
25814 # See T93839
25815 !! test
25816 New wikilinks should be serialized properly
25817 !! options
25818 parsoid=html2wt
25819 !! html/parsoid
25820 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25821 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25822 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25823 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25824 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25825 !! wikitext
25826 [[Foo]]
25827 [[Foo]]
25828 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25829 http://en.wikipedia.org/wiki/Foo
25830 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25831 !! end
25832
25833 !! test
25834 New wiki links (href variations)
25835 !! options
25836 parsoid=html2wt
25837 !! html/parsoid
25838 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25839 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25840 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25841 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25842 !! wikitext
25843 [[Foo_bar]]
25844 [[Foo_bar]]
25845 [[Foo_bar]]
25846 [[Toxine bactérienne]]
25847 !! end
25848
25849 !! test
25850 New wiki links (content string variations)
25851 !! options
25852 parsoid=html2wt
25853 !! html/parsoid
25854 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25855 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25856 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25857 !! wikitext
25858 [[Foo_bar]]
25859 [[Foo bar]]
25860 [[Foo_bar|./Foo_bar]]
25861 !! end
25862
25863 !! test
25864 New category links (href variations)
25865 !! options
25866 parsoid=html2wt
25867 !! html/parsoid
25868 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25869 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25870 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25871 !! wikitext
25872 [[Category:Toxine bactérienne]]
25873 [[Category:Toxine bactérienne]]
25874 [[Category:Toxine bactérienne]]
25875 !! end
25876
25877 !! test
25878 New sol transparent links don't need indent-pre nowiki protection
25879 !! options
25880 parsoid=html2wt
25881 language=de
25882 !! html/parsoid
25883 <link rel="mw:PageProp/redirect" href="./Main_Page">
25884 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25885 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25886 !! wikitext
25887 #WEITERLEITUNG [[Main Page]]
25888 <!-- this is good --> [[Category:Good]]
25889 <!-- this is great --> [[Kategorie:Great]]
25890 !! end
25891
25892 !! test
25893 New interlanguage links (href variations)
25894 !! options
25895 parsoid=html2wt
25896 !! html/parsoid
25897 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25898 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25899 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25900 !! wikitext
25901 [[es:Toxine bactérienne]]
25902 [[es:Toxine_bactérienne]]
25903 [[es:Toxine_bactérienne]]
25904 !! end
25905
25906 !! test
25907 Image: Modifying size of an image (1)
25908 !! options
25909 parsoid={
25910 "modes": ["wt2wt"],
25911 "changes": [
25912 ["img[height]", "attr", "height", "22"],
25913 ["img[width]", "attr", "width", "200"]
25914 ]
25915 }
25916 !! wikitext
25917 [[Image:Foobar.jpg|230x230px]]
25918 !! wikitext/edited
25919 [[Image:Foobar.jpg|200x200px]]
25920 !!end
25921
25922 !! test
25923 Image: Modifying size of an image (2)
25924 !! options
25925 parsoid={
25926 "modes": ["wt2wt"],
25927 "changes": [
25928 ["img[height]", "attr", "height", "100"],
25929 ["img[width]", "attr", "width", "500"]
25930 ]
25931 }
25932 !! wikitext
25933 [[Image:Foobar.jpg|230x230px]]
25934 !! wikitext/edited
25935 [[Image:Foobar.jpg|500x500px]]
25936 !!end
25937
25938 # Change in size is ignored so long as class='mw-default-size'
25939 !! test
25940 Image: Modifying size of an image (3)
25941 !! options
25942 parsoid={
25943 "modes": ["wt2wt"],
25944 "changes": [
25945 ["figure[class]", "removeClass", "mw-default-size"],
25946 ["figure img", "attr", "height", "19"],
25947 ["figure img", "attr", "width", "170"]
25948 ]
25949 }
25950 !! wikitext
25951 [[Image:Foobar.jpg|thumb]]
25952 !! wikitext/edited
25953 [[Image:Foobar.jpg|thumb|170x170px]]
25954 !!end
25955
25956 !! test
25957 Image: Modifying alignment of an image (bug 48665)
25958 !! options
25959 parsoid={
25960 "modes": ["wt2wt"],
25961 "changes": [
25962 ["figure[class]", "removeClass", "mw-halign-right"],
25963 ["figure[class]", "addClass", "mw-halign-left"]
25964 ]
25965 }
25966 !! wikitext
25967 [[Image:Foobar.jpg|thumb|caption|right]]
25968 !! wikitext/edited
25969 [[Image:Foobar.jpg|thumb|caption|left]]
25970 !! end
25971
25972 !! test
25973 Image: Modifying mw-default-size of an frameless image (bug 62805)
25974 !! options
25975 parsoid={
25976 "modes": ["wt2wt"],
25977 "changes": [
25978 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25979 ]
25980 }
25981 !! wikitext
25982 [[Image:Foobar.jpg|frameless|right]]
25983 !! wikitext/edited
25984 [[Image:Foobar.jpg|frameless|right|220x220px]]
25985 !! end
25986
25987 !! test
25988 Image: Modifying valign of an image (bug 49221)
25989 !! options
25990 parsoid={
25991 "modes": ["wt2wt"],
25992 "changes": [
25993 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25994 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25995 ]
25996 }
25997 !! wikitext
25998 [[File:Foobar.jpg|20px|middle]]
25999 !! wikitext/edited
26000 [[File:Foobar.jpg|20px|text-top]]
26001 !! end
26002
26003 !! test
26004 Image: Modifying alt attribute of an image (bug 56400)
26005 !! options
26006 parsoid={
26007 "modes": ["wt2wt"],
26008 "changes": [
26009 ["img[alt]", "attr", "alt", "some alternate edited text"]
26010 ]
26011 }
26012 !! wikitext
26013 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
26014 !! wikitext/edited
26015 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
26016 !!end
26017
26018 !! test
26019 Image: Modifying caption of an image
26020 !! options
26021 parsoid={
26022 "modes": ["wt2wt"],
26023 "changes": [
26024 ["figcaption", "text", "new caption"]
26025 ]
26026 }
26027 !! wikitext
26028 [[Image:Foobar.jpg|thumb|original caption]]
26029 !! wikitext/edited
26030 [[Image:Foobar.jpg|thumb|new caption]]
26031 !!end
26032
26033 !! test
26034 Image: empty alt attribute (bug 48924)
26035 !! options
26036 parsoid
26037 !! wikitext
26038 [[File:Foobar.jpg|thumb|alt=|bar]]
26039 !! html
26040 <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>
26041 !! end
26042
26043 !! test
26044 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
26045 !! options
26046 parsoid=html2wt
26047 language=ar
26048 disabled
26049 !! html/parsoid
26050 <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>
26051 !! wikitext
26052 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
26053 !! end
26054
26055 !! test
26056 Image: Block level image should have \n before and after
26057 !! wikitext
26058 123
26059 [[File:Foobar.jpg|right|thumb|150x150px]]
26060 456
26061 !! html/parsoid
26062 <p>123</p>
26063 <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>
26064 <p>456</p>
26065 !!end
26066
26067 !! test
26068 Image: New block level image should have \n before and after (existing content)
26069 !! wikitext
26070 123
26071 [[File:Foobar.jpg|right|thumb|150x150px]]
26072 456
26073 !! html/parsoid
26074 <p>123</p>
26075 <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>
26076 <p>456</p>
26077 !!end
26078
26079 !! test
26080 Image: upright option (parsoid)
26081 !! wikitext
26082 [[File:Foobar.jpg|thumb|upright|caption]]
26083 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
26084 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
26085 !! html/parsoid
26086 <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>
26087 <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>
26088 <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>
26089 !!end
26090
26091 !! test
26092 Image: upright option is ignored on inline and frame images (parsoid)
26093 !! wikitext
26094 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
26095 !! html/parsoid
26096 <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>
26097 !!end
26098
26099 !! test
26100 Image: from basic HTML (1)
26101 !! options
26102 parsoid=html2wt
26103 !! html/parsoid
26104 <span typeof="mw:Image">
26105 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
26106 </span>
26107 !! wikitext
26108 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
26109 !! end
26110
26111 !! test
26112 Image: from basic HTML (2)
26113 !! options
26114 parsoid=html2wt
26115 !! html/parsoid
26116 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
26117 !! wikitext
26118 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
26119 !! end
26120
26121 !! test
26122 Image: from basic HTML (3)
26123 !! options
26124 parsoid=html2wt
26125 !! html/parsoid
26126 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
26127 !! wikitext
26128 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
26129 !! end
26130
26131 !! test
26132 Image: from basic HTML (4)
26133 !! options
26134 parsoid=html2wt
26135 !! html/parsoid
26136 <img src="./File:Foobar.jpg">
26137 !! wikitext
26138 [[File:Foobar.jpg|link=]]
26139 !! end
26140
26141 !! test
26142 Image: Invalid title as link
26143 !! wikitext
26144 [[File:Foobar.jpg|link=<]]
26145 !! html/php
26146 <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>
26147 </p>
26148 !! html/parsoid
26149 <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>
26150 !! end
26151
26152 !! test
26153 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
26154 !! options
26155 parsoid=html2wt
26156 !! html/parsoid
26157 <ul>
26158 <li><p>foo</p></li>
26159 </ul>
26160 !! wikitext
26161 * foo
26162 !! end
26163
26164 !! test
26165 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
26166 !! options
26167 parsoid=html2wt
26168 !! html/parsoid
26169 <ul> <li>foo</li></ul>
26170 !! wikitext
26171 * foo
26172 !! end
26173
26174 !! test
26175 Don't strip leading whitespace when handling indent-pre suppressing tags
26176 !! options
26177 parsoid=html2wt
26178 !! html/parsoid
26179 <table>
26180 <tr><td> indented row</td></tr>
26181 </table>
26182 <blockquote><p>
26183 <b>This is very bold of you!</b>
26184 </p>
26185 <table><tr><td>
26186 indented cell (no pre-wrapping!)
26187 </td></tr></table>
26188 </blockquote>
26189 <p>foo</p>
26190 <div>bar</div>
26191 !! wikitext
26192 {|
26193 | indented row
26194 |}
26195 <blockquote>
26196 '''This is very bold of you!'''
26197
26198 {|
26199 |
26200 indented cell (no pre-wrapping!)
26201 |}
26202 </blockquote>
26203 foo
26204 <div>bar</div>
26205 !! end
26206
26207 !! test
26208 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
26209 !! options
26210 parsoid=html2wt
26211 !! html/parsoid
26212 <p>foo</p>
26213 <span>bar</span>
26214
26215 <span>foo2
26216 </span>bar2
26217
26218 <div>foo</div>
26219 <span>bar</span>
26220
26221 <div>
26222 <span>foo</span>
26223 </div>
26224 !! wikitext
26225 foo
26226
26227 <span>bar</span>
26228
26229 <span>foo2
26230 <nowiki> </nowiki></span>bar2
26231
26232 <div>foo</div>
26233 <nowiki> </nowiki><span>bar</span>
26234
26235 <div>
26236 <nowiki> </nowiki><span>foo</span>
26237 </div>
26238 !! end
26239
26240 !! test
26241 Lists: Dont insert newlines in a serialized list item.
26242 !! options
26243 parsoid=html2wt
26244 !! html/parsoid
26245 <ul><li>a<br>b</li><li>c</li></ul>
26246 !! wikitext
26247 * a<br>b
26248 * c
26249 !! end
26250
26251 !! test
26252 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
26253 !! options
26254 parsoid={
26255 "modes": ["html2wt"],
26256 "scrubWikitext": false
26257 }
26258 !! html/parsoid
26259 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26260 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26261
26262 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26263 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26264
26265 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
26266
26267 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26268 !! wikitext
26269 == hello there [[Category:A1]] ==
26270
26271 == [[Category:A2]] hi pal ==
26272
26273 == <!--foo--> [[Category:A3]] how goes it ==
26274
26275 == it goes well [[Category:A4]] <!--bar--> ==
26276
26277 ==howdy [[Category:A5]]==
26278
26279 == __TOC__ ok ==
26280 !! end
26281
26282 !! test
26283 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
26284 !! options
26285 parsoid={
26286 "modes": ["html2wt"],
26287 "scrubWikitext": true
26288 }
26289 !! html/parsoid
26290 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26291 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26292
26293 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26294 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26295
26296 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26297 !! wikitext
26298 == hello there ==
26299 [[Category:A1]]
26300 [[Category:A2]]
26301
26302 == hi pal ==
26303
26304 <!--foo--> [[Category:A3]]
26305
26306 == how goes it ==
26307
26308 == it goes well ==
26309 [[Category:A4]] <!--bar-->
26310
26311 __TOC__
26312
26313 == ok ==
26314 !! end
26315
26316 !! test
26317 Headings: Don't hoist metas that come from templates
26318 !! options
26319 parsoid={
26320 "modes": ["html2wt"],
26321 "scrubWikitext": true
26322 }
26323 !! html/parsoid
26324 <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>
26325 !! wikitext
26326 == {{echo|foo [[Category:Foo]]}} ==
26327 !! end
26328
26329 !! test
26330 Headings: Category in ref isn't hoisted
26331 !! options
26332 parsoid={
26333 "modes": ["html2wt"],
26334 "scrubWikitext": true
26335 }
26336 !! html/parsoid
26337 <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>
26338
26339 <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>
26340 !! wikitext
26341 == foo <ref>bar
26342 [[Category:Baz]] </ref> ==
26343
26344 <references />
26345 !! end
26346
26347 !! test
26348 Parsoid: Serialize positional parameters with = in them as named parameter
26349 !! options
26350 parsoid=html2wt
26351 !! html/parsoid
26352 <p about="#mwt1" typeof="mw:Transclusion"
26353 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
26354
26355 <p about="#mwt1" typeof="mw:Transclusion"
26356 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
26357
26358 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26359 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26360 <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>
26361 !! wikitext
26362 {{echo|1=f=oo}}
26363
26364 {{echo|1=f=oo|2=bar}}
26365
26366 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26367 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26368 {{echo|<nowiki>f=oo</nowiki>|bar}}
26369 !! end
26370
26371 !! test
26372 Parsoid: Serialize positional parameters with = in extlink as named parameter
26373 !! options
26374 parsoid=html2wt
26375 !! html/parsoid
26376 <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>
26377 !! wikitext
26378 {{echo|1=http://stuff?is=ok}}
26379 !! end
26380
26381 !! test
26382 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
26383 !! options
26384 parsoid=html2wt
26385 !! html/parsoid
26386 <div>a<p>b</p></div>
26387 <div>a
26388 <p>b</p></div>
26389 <div>
26390 a
26391 <p>b</p></div>
26392 !! wikitext
26393 <div>a
26394 b
26395 </div>
26396 <div>a
26397 b
26398 </div>
26399 <div>
26400 a
26401
26402 b
26403 </div>
26404 !! end
26405
26406 !! test
26407 Substrings resembling wikitext in hrefs should not get nowiki escapes
26408 !! options
26409 parsoid=html2wt
26410 !! html/parsoid
26411 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
26412 !! wikitext
26413 [[Foo''bar''baz]]
26414 !! end
26415
26416 !! test
26417 Enforce single-line context in the serializer
26418 !! options
26419 parsoid=html2wt
26420 !! html/parsoid
26421 <h2>testing
26422 123</h2>
26423
26424 <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">
26425 </span><span about="#mwt1">you</span> </h2>
26426
26427 <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>
26428
26429 <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
26430 there</span></li></ol>
26431
26432 <ul><li>asd
26433 sdf</li></ul>
26434
26435 <ul><li>foo
26436 bar
26437 baz</li>
26438 <li>foo <b>bar</b>
26439 baz</li></ul>
26440
26441 <dl><dt>hi
26442 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
26443 ho</dd></dl>
26444
26445 <dl><dd> <table>
26446 <tbody><tr><td> ha
26447 ha
26448 ha</td></tr>
26449 </tbody></table></dd></dl>
26450 !! wikitext
26451 == testing 123 ==
26452
26453 == hi {{bogus|there
26454 you}} ==
26455
26456 == foo <ref>hello
26457 there</ref> ==
26458
26459 <references />
26460
26461 * asd sdf
26462
26463 * foo bar baz
26464 * foo '''bar''' baz
26465
26466 ; hi ho : hi ho
26467
26468 : {|
26469 | ha
26470 ha
26471 ha
26472 |}
26473 !! end
26474
26475 !! test
26476 Serialize new placeholder space without spans
26477 !! options
26478 parsoid=html2wt
26479 !! html/parsoid
26480 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
26481
26482 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
26483
26484 <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>
26485 !! wikitext
26486 foo : bar
26487
26488 foo : bar
26489
26490 <ref>foo : bar</ref>ok
26491 !! end
26492
26493
26494 #-----------------------
26495 # Tag minimization tests
26496 #-----------------------
26497
26498 !! test
26499 1. I/B quote minimization: wikitext-only tags should be combined
26500 !! options
26501 parsoid=html2wt
26502 !! html/parsoid
26503 <p><i>A</i><i>B</i></p>
26504 <p><b>A</b><b>B</b></p>
26505 <p><i>A</i><b><i>B</i></b></p>
26506 <p><b>A</b><i><b>B</b></i></p>
26507 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
26508 <p><i><b>A</b></i><i><b>B</b></i></p>
26509 <p><i><b>A</b></i><b><i>B</i></b></p>
26510 <p><b><i>A</i></b><i><b>B</b></i></p>
26511 !! wikitext
26512 ''AB''
26513
26514 '''AB'''
26515
26516 ''A'''B'''''
26517
26518 '''A''B'''''
26519
26520 '''A''BC''D'''
26521
26522 '''''AB'''''
26523
26524 '''''AB'''''
26525
26526 '''''AB'''''
26527 !! end
26528
26529 !! test
26530 2. I/B quote minimization: wikitext and html tags should not be combined
26531 !! options
26532 parsoid=html2wt
26533 !! html/parsoid
26534 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26535 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26536 !! wikitext
26537 ''A''<i>B</i>
26538
26539 ''A''<nowiki/>'''<i>B</i>'''
26540 !! end
26541
26542 !! test
26543 3. I/B quote minimization: templated content stops minimization
26544 !! options
26545 parsoid=html2wt
26546 !! html/parsoid
26547 <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>
26548 <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>
26549 !! wikitext
26550 ''A''{{echo|''B''}}
26551
26552 ''A''{{echo|'''''B'''''}}
26553 !! end
26554
26555 !! test
26556 4. I/B quote minimization: new content should be mimimized with adjacent old content
26557 !! options
26558 parsoid=html2wt
26559 !! html/parsoid
26560 <p><i>A</i><i>B</i></p>
26561 <p><b>A</b><b>B</b></p>
26562 <p><i>A</i><b><i>B</i></b></p>
26563 !! wikitext
26564 ''AB''
26565
26566 '''AB'''
26567
26568 ''A'''B'''''
26569 !! end
26570
26571 !! test
26572 5a. Merge adjacent quote nodes if they've been edited
26573 !! options
26574 parsoid={
26575 "modes": ["wt2wt", "selser"],
26576 "changes": [
26577 ["p", "contents", "remove", ":contains('b')"]
26578 ]
26579 }
26580 !! wikitext
26581 ''a''b''c''
26582 !! wikitext/edited
26583 ''ac''
26584 !! end
26585
26586 !! test
26587 5b. Merge adjacent quote nodes if they've been edited
26588 !! options
26589 parsoid={
26590 "modes": ["wt2wt", "selser"],
26591 "changes": [
26592 ["#x", "remove"]
26593 ]
26594 }
26595 !! wikitext
26596 ''a''<span id="x">b</span>''c''
26597 !! wikitext/edited
26598 ''ac''
26599 !! end
26600
26601 !! test
26602 1. Merge adjacent link nodes as long as at least one element is new
26603 !! options
26604 parsoid={
26605 "modes": ["html2wt"],
26606 "scrubWikitext": true
26607 }
26608 !! html/parsoid
26609 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26610 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26611 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26612 !! wikitext
26613 [[Football]]
26614 [[Football]]
26615 [[Football|Foot]][[Football|ball]]
26616 !! end
26617
26618 !! test
26619 2. Merge adjacent link nodes and enable additional normalizations
26620 !! options
26621 parsoid={
26622 "modes": ["html2wt"],
26623 "scrubWikitext": true
26624 }
26625 !! html/parsoid
26626 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26627 !! wikitext
26628 [[Football|''Football'']]
26629 !! end
26630
26631 !! test
26632 3. Don't merge adjacent link nodes if scrubWikitext is false
26633 !! options
26634 parsoid={
26635 "modes": ["html2wt"],
26636 "scrubWikitext": false
26637 }
26638 !! html/parsoid
26639 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26640 !! wikitext
26641 [[Football|Foot]][[Football|ball]]
26642 !! end
26643
26644 #------------------------------
26645 # End of tag minimization tests
26646 #------------------------------
26647
26648 !!test
26649 Bug 54262: New entities
26650 !! options
26651 parsoid=html2wt
26652 !! html/parsoid
26653 <span typeof="mw:Entity">&nbsp;</span>
26654 !! wikitext
26655 &nbsp;
26656 !! end
26657
26658 ## Note that there is no wikitext output for 'unknownproperty' ##
26659 ## Unknown magic words are silently dropped ##
26660
26661 !! test
26662 Magic words
26663 !! options
26664 parsoid=html2wt
26665 !! html/parsoid
26666 <meta property='mw:PageProp/toc' />
26667 <meta property='mw:PageProp/notoc' />
26668 <meta property='mw:PageProp/forcetoc' />
26669 <meta property='mw:PageProp/index' />
26670 <meta property='mw:PageProp/noindex' />
26671 <meta property='mw:PageProp/nogallery' />
26672 <meta property='mw:PageProp/noeditsection' />
26673 <meta property='mw:PageProp/notitleconvert' />
26674 <meta property='mw:PageProp/nocontentconvert' />
26675 <meta property='mw:PageProp/unknownproperty' />
26676 !! wikitext
26677 __TOC__
26678 __NOTOC__
26679 __FORCETOC__
26680 __INDEX__
26681 __NOINDEX__
26682 __NOGALLERY__
26683 __NOEDITSECTION__
26684 __NOTITLECONVERT__
26685 __NOCONTENTCONVERT__
26686 !! end
26687
26688 !! test
26689 Consecutive <pre>s should not get merged
26690 !! options
26691 parsoid=html2wt,html2html
26692 !! html/parsoid
26693 <pre>a</pre><pre>b</pre>
26694
26695 <pre>c
26696 </pre><pre>
26697 d</pre>
26698
26699 <pre>e
26700
26701 </pre><pre>
26702
26703 f</pre>
26704 !! wikitext
26705 a
26706
26707 b
26708
26709 c
26710
26711 d
26712
26713 e
26714
26715
26716
26717 f
26718 !! end
26719
26720 !! test
26721 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26722 !! options
26723 parsoid=html2wt
26724 !! html/parsoid
26725 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26726 !! wikitext
26727 [[Special:BookSources/1234567890|ISBN 1234567895]]
26728 !! end
26729
26730 !! test
26731 Edited RFC links not serializable as RFC links should serialize as extlinks
26732 !! options
26733 parsoid=html2wt
26734 !! html/parsoid
26735 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26736 !! wikitext
26737 [//tools.ietf.org/html/rfc123 New RFC]
26738 !! end
26739
26740 !! test
26741 Edited PMID links not serializable as PMID links should serialize as extlinks
26742 !! options
26743 parsoid=html2wt
26744 !! html/parsoid
26745 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26746 !! wikitext
26747 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26748 !! end
26749
26750 !! test
26751 WTS of autolinks with trailing/surrounding context
26752 !! options
26753 parsoid=html2wt
26754 !! html/parsoid
26755 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26756 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26757 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26758 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26759 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26760 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26761 !! wikitext
26762 http://cscott.net'''foo'''
26763
26764 http://cscott.net<b>foo</b>
26765
26766 '''http://cscott.net'''
26767
26768 '''http://cscott.net '''
26769
26770 '''http://cscott.net<nowiki/>x'''
26771
26772 http://cscott.net<nowiki/>x
26773 !! end
26774
26775 !! test
26776 WTS of autolinks with nowikis (round-trip)
26777 !! wikitext
26778 x<nowiki/>http://cscott.net<nowiki/>x
26779 !! html/parsoid
26780 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26781 !! end
26782
26783 # this is the "easy" test because it leaves in place all the
26784 # data-parsoid information indicating this is an autolink
26785 !! test
26786 WTS of autolinks with escapes (editing)
26787 !! options
26788 parsoid={
26789 "modes": ["wt2wt"],
26790 "changes": [
26791 [ "meta", "remove" ]
26792 ]
26793 }
26794 !! wikitext
26795 x<nowiki/>http://cscott.net<nowiki/>x
26796 !! wikitext/edited
26797 x<nowiki/>http://cscott.net<nowiki/>x
26798 !! end
26799
26800 !! test
26801 WTS of edited autolink-like text (T103364)
26802 !! options
26803 parsoid={
26804 "modes": ["wt2wt"],
26805 "changes": [
26806 [ "span[typeof]", "removeAttr", "typeof" ]
26807 ]
26808 }
26809 !! wikitext
26810 Not a link: <nowiki>http://example.com</nowiki>.
26811 !! wikitext/edited
26812 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26813 !! end
26814
26815 !! test
26816 WTS of newly-authored autolink-like text (T103364)
26817 !! options
26818 parsoid=html2wt
26819 !! html/parsoid
26820 <p>http://example.com is not a link.</p>
26821 !! wikitext
26822 <nowiki>http://example.com</nowiki> is not a link.
26823 !! end
26824
26825 !! test
26826 WTS of autolink-like text after an autolink (T108563)
26827 !! options
26828 parsoid=html2wt
26829 !! html/parsoid
26830 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26831 !! wikitext
26832 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26833 !! end
26834
26835 !! test
26836 Magic links inside links (not autolinked)
26837 !! wikitext
26838 [[Foo|http://example.com]]
26839 [[Foo|RFC 1234]]
26840 [[Foo|PMID 1234]]
26841 [[Foo|ISBN 123456789x]]
26842
26843 [http://foo.com http://example.com]
26844 [http://foo.com RFC 1234]
26845 [http://foo.com PMID 1234]
26846 [http://foo.com ISBN 123456789x]
26847 !! html+tidy
26848 <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>
26849 <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>
26850 !! html/parsoid
26851 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26852 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26853 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26854 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26855
26856 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26857 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26858 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26859 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26860 !! end
26861
26862 !! test
26863 Magic links inside image captions (autolinked)
26864 !! wikitext
26865 [[File:Foobar.jpg|thumb|http://example.com]]
26866 [[File:Foobar.jpg|thumb|RFC 1234]]
26867 [[File:Foobar.jpg|thumb|PMID 1234]]
26868 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26869 !! html+tidy
26870 <div class="thumb tright">
26871 <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>
26872 <div class="thumbcaption">
26873 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26874 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26875 </div>
26876 </div>
26877 <div class="thumb tright">
26878 <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>
26879 <div class="thumbcaption">
26880 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26881 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26882 </div>
26883 </div>
26884 <div class="thumb tright">
26885 <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>
26886 <div class="thumbcaption">
26887 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26888 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26889 </div>
26890 </div>
26891 <div class="thumb tright">
26892 <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>
26893 <div class="thumbcaption">
26894 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26895 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26896 </div>
26897 </div>
26898 !! html/parsoid
26899 <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>
26900 <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>
26901 <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>
26902 <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>
26903 !! end
26904
26905 !! test
26906 WTS of magic word text (T109371)
26907 !! options
26908 parsoid=html2wt
26909 !! html/parsoid
26910 <p>RFC 1234</p>
26911 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26912 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26913 !! wikitext
26914 <nowiki>RFC 1234</nowiki>
26915
26916 [http://foo.com RFC 1234]
26917
26918 [[Foo|RFC 1234]]
26919 !! end
26920
26921 !! test
26922 Edited Redirect link should emit a non-piped wikitext link
26923 !! options
26924 parsoid=html2wt
26925 !! html/parsoid
26926 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26927 !! wikitext
26928 #REDIRECT [[Bar]]
26929 !! end
26930
26931 !! test
26932 T75121: Infer extension name from typeOf if data-mw is not present
26933 !! options
26934 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26935 !! html/parsoid
26936 <div typeOf="mw:Extension/foo"></div>
26937 !! wikitext
26938 <foo />
26939 !! end
26940
26941 # Note that the <p> wrapping isn't present in PHP parser output
26942 # The important thing for this test is that P-wrapping doesn't
26943 # interfere with the <nowiki> protection for leading - in <td>
26944 # (which isn't necessary for <th>).
26945 !! test
26946 T88318: p-wrapped dash in table.
26947 !! options
26948 parsoid=html2wt,wt2wt
26949 !! html/parsoid
26950 <table><tbody>
26951 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26952 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26953 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26954 </tbody></table>
26955 !! wikitext
26956 {|
26957 !-
26958 !-
26959 |-
26960 |<nowiki>-</nowiki>
26961 |<nowiki>- </nowiki>
26962 |-
26963 |<small>-</small>
26964 |<br>
26965 -
26966 |<br>
26967 -
26968 |}
26969 !! html/php+tidy
26970 <table>
26971 <tr>
26972 <th>-</th>
26973 <th>-</th>
26974 </tr>
26975 <tr>
26976 <td>-</td>
26977 <td>-</td>
26978 </tr>
26979 <tr>
26980 <td><small>-</small></td>
26981 <td><br />
26982 <p>-</p>
26983 </td>
26984 <td><br />
26985 <p>-</p>
26986 </td>
26987 </tr>
26988 </table>
26989 !! end
26990
26991 !! test
26992 T149209: WTS: Handle newlines in table cells properly
26993 !! options
26994 parsoid=html2wt
26995 !! html/parsoid
26996 <table>
26997 <tbody>
26998 <tr><td>a
26999 b
27000 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
27001 <tr><td><p>x</p>
27002 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
27003 </tbody></table>
27004 <table>
27005 <tbody>
27006 <tr><th>a
27007 b
27008 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
27009 <tr><th><p>x</h>
27010 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
27011 </tbody></table>
27012 !! wikitext
27013 {|
27014 |a
27015 b
27016 |c
27017 |-
27018 |x
27019 {{!}}y
27020 |}
27021 {|
27022 !a
27023 b
27024 !c
27025 |-
27026 !x
27027 !y
27028 |}
27029 !! end
27030
27031 !! test
27032 T149209: Selser: Handle newlines in table cells properly
27033 !! options
27034 parsoid={
27035 "modes": ["selser"],
27036 "changes": [
27037 [ "#h1", "html", "a\nb\n" ],
27038 [ "#h2", "html", "a\nb\n" ],
27039 [ "#c1", "html", "a\nb\n" ],
27040 [ "#c2", "html", "<p>a</p>" ],
27041 [ "#c3", "html", "<p>a</p>" ],
27042 [ "#c4", "html", "edit-me<p>a</p>" ]
27043 ]
27044 }
27045 !! wikitext
27046 {|
27047 ! id="h1" |edit-me!!1
27048 |-
27049 ! id="h2" |edit-me||2
27050 |-
27051 | id="c1" |edit-me||3
27052 |-
27053 | id="c2" |edit-me||4
27054 |-
27055 | id="c3" |edit-me||p||q||r
27056 |-
27057 | id="c4" |edit-me||p||q||r
27058 |}
27059 !! wikitext/edited
27060 {|
27061 ! id="h1" |a
27062 b
27063 !1
27064 |-
27065 ! id="h2" |a
27066 b
27067 !2
27068 |-
27069 | id="c1" |a
27070 b
27071 |3
27072 |-
27073 | id="c2" |a
27074 |4
27075 |-
27076 | id="c3" |a
27077 |p||q||r
27078 |-
27079 | id="c4" |edit-me
27080 a
27081 |p||q||r
27082 |}
27083 !! end
27084
27085 !! test
27086 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
27087 !! options
27088 parsoid=html2wt
27089 !! html/parsoid
27090 <table id='mwAb'>
27091 <td id='mwAc'>foo</td>
27092 <td id='serialize-this'>bar</td>
27093 </table>
27094 !! wikitext
27095 {|
27096 |foo
27097 | id="serialize-this" |bar
27098 |}
27099 !! end
27100
27101 !! test
27102 Parsoid-like element ids should not be serialized to wikitext unless shadowed
27103 !! options
27104 parsoid=html2wt
27105 !! html/parsoid
27106 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
27107 !! wikitext
27108 <div id="hello">ok</div>
27109 !! end
27110
27111 !! test
27112 WTS change modes
27113 !! options
27114 parsoid={
27115 "modes": ["wt2wt"],
27116 "changes": [
27117 [ "#xyz", "before", "<b>before</b> stuff " ],
27118 [ "#xyz", "after", " stuff <i>after</i>" ],
27119 [ "#xyz", "html", "x <b>y</b> z" ]
27120 ]
27121 }
27122 !! wikitext
27123 <span id="xyz">hello</span>
27124 !! wikitext/edited
27125 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
27126 !! end
27127
27128 !! test
27129 Never serialize a-tag as html, regardless of what data-parsoid has to say
27130 !! options
27131 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27132 !! html/parsoid
27133 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
27134 !! wikitext
27135 [[Foo]]
27136 !! end
27137
27138 ## SSS FIXME: This is broken output nevertheless.
27139 ## What might be a reasonable non-broken output for this?
27140 ## This is an edge case unlikely to be seen in production
27141 ## that I am not wasting more time on this right now.
27142 !! test
27143 Never serialize a-tag as html, no matter what attributes it has
27144 !! options
27145 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27146 !! html/parsoid
27147 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
27148 !! wikitext
27149 [http://boo.org http://boohoo.org]
27150 !! end
27151
27152 # Misnested is an indication that selser can reuse the source but these have
27153 # shown to sneak through on occasion. See T101768.
27154 # The original wikitext here is: [http://test.com [[one]] two three]
27155 !! test
27156 Strip span tags added to mark misnested links
27157 !! options
27158 parsoid=html2wt
27159 !! html/parsoid
27160 <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>
27161 !! wikitext
27162 [http://test.com][[one]] two three
27163 !! end
27164
27165 !! test
27166 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
27167 !! options
27168 parsoid=html2wt
27169 !! html/parsoid
27170 <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|}"]}'>
27171 <tbody><tr><td>d
27172 </td></tr>
27173 </tbody></table>
27174 !! wikitext
27175 {{echo|a}}
27176 {|{{echo|c
27177 {{!}}d
27178 }}
27179 |}
27180 !! end
27181
27182 ## This test verifies the presence and computation of this attribute indirectly
27183 ## by making an edit and ensuring that the serialization is correct (which it would be
27184 ## only if firstWikitextNode is properly set).
27185 !! test
27186 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
27187 !! options
27188 parsoid= {
27189 "modes": ["wt2wt"],
27190 "changes": [
27191 [ "div#x", "remove" ],
27192 [ "div", "before", "<div>new</div>" ]
27193 ]
27194 }
27195 !! wikitext
27196 <div id="x">foo</div>
27197 {|
27198 {{echo|<div>boo</div>
27199 {{!}}b}}
27200 |c
27201 |}
27202 !! wikitext/edited
27203
27204 <div>new</div>
27205 {|
27206 {{echo|<div>boo</div>
27207 {{!}}b}}
27208 |c
27209 |}
27210 !! end
27211
27212 # --------------------------------------------
27213 # Tests spec'ing wikitext serialization norms |
27214 # --------------------------------------------
27215
27216 !! test
27217 1. Categories should always be serialized on their own line
27218 !! options
27219 parsoid=html2wt
27220 !! html/parsoid
27221 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
27222 !! wikitext
27223 foo
27224 [[Category:Foo]]
27225 bar
27226 !! end
27227
27228 !! test
27229 2. Categories that are part of templates should not introduce a line break
27230 !! wikitext
27231 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
27232 !! html/parsoid
27233 <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>
27234 !! end
27235
27236 # Careful while editing these next 2 tests. There are \u200f characters
27237 # before and after the <link> tags in the HTML and following some
27238 # of the categories in wikitext
27239 # Do not remove these characters in edits.
27240 #
27241 # As part of the serialization, these bidi characters will get stripped.
27242 !! test
27243 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
27244 !! options
27245 parsoid={
27246 "modes": ["html2wt"],
27247 "scrubWikitext": true
27248 }
27249 !! html/parsoid
27250 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
27251 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
27252 !! wikitext
27253 [[קטגוריה:טקסים]]
27254 [[קטגוריה: שיטות משפט]]
27255 !! end
27256
27257 !! test
27258 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
27259 !! options
27260 parsoid={
27261 "modes": ["html2wt"],
27262 "scrubWikitext": true
27263 }
27264 !! html/parsoid
27265 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
27266 !! wikitext
27267 [[קטגוריה:טקסים]]
27268 ‏y
27269 !! end
27270
27271 !! test
27272 Lists: Add space after bullets
27273 !! options
27274 parsoid=html2wt
27275 !! html/parsoid
27276 <ul>
27277 <li>foo</li>
27278 <li> bar</li>
27279 <li><span> baz</span></li>
27280 </ul>
27281 !! wikitext
27282 * foo
27283 * bar
27284 * <span> baz</span>
27285 !! end
27286
27287 !! test
27288 1. Headings: Add space before/after == (T53744)
27289 !! options
27290 parsoid=html2wt
27291 !! html/parsoid
27292 <h2>foo</h2>
27293 <h2> bar</h2>
27294 <h2>baz </h2>
27295 <h2><span> baz</span></h2>
27296 !! wikitext
27297 == foo ==
27298
27299 == bar ==
27300
27301 == baz ==
27302
27303 == <span> baz</span> ==
27304 !! end
27305
27306 !! test
27307 2. Headings: Add space before/after == even after hoisted content
27308 !! options
27309 parsoid={
27310 "modes": ["html2wt"],
27311 "scrubWikitext": true
27312 }
27313 !! html/parsoid
27314 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
27315 !! wikitext
27316 [[Category:A2]]
27317
27318 == ok ==
27319 !! end
27320
27321 !! test
27322 1. Headings: suppress newly created empty headings
27323 !! options
27324 parsoid={
27325 "modes": ["html2wt"],
27326 "scrubWikitext": true
27327 }
27328 !! html/parsoid
27329 <h2></h2>
27330 !! wikitext
27331 !! end
27332
27333 !! test
27334 2. Headings: don't suppress empty headings if scrubWikitext is false
27335 !! options
27336 parsoid=html2wt
27337 !! html/parsoid
27338 <h2></h2>
27339 !! wikitext
27340 ==<nowiki/>==
27341 !! end
27342
27343 !! test
27344 3. Headings: suppress empty headings on edits
27345 !! options
27346 parsoid={
27347 "modes": ["selser"],
27348 "scrubWikitext": true,
27349 "changes": [
27350 [ "#x", "remove"]
27351 ]
27352 }
27353 !! wikitext
27354 ==<span id="x">foo</span>==
27355 !! wikitext/edited
27356 !! end
27357
27358 !! test
27359 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
27360 !! options
27361 parsoid={
27362 "modes": ["html2wt"],
27363 "scrubWikitext": true
27364 }
27365 !! html/parsoid
27366 <h2>foo<br/>bar</h2>
27367 <h2>foo <span><br/>bar</span> baz</h2>
27368 !! wikitext
27369 == foo bar ==
27370
27371 == foo <span> bar</span> baz ==
27372 !! end
27373
27374 !! test
27375 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
27376 !! options
27377 parsoid={
27378 "modes": ["html2wt"],
27379 "scrubWikitext": false
27380 }
27381 !! html/parsoid
27382 <h2>foo<br/>bar</h2>
27383 !! wikitext
27384 == foo<br> bar ==
27385 !! end
27386
27387 !! test
27388 1. WT Quote Tags: suppress newly created empty style tags
27389 !! options
27390 parsoid={
27391 "modes": ["html2wt"],
27392 "scrubWikitext": true
27393 }
27394 !! html/parsoid
27395 <i></i><b></b>
27396 !! wikitext
27397 !! end
27398
27399 !! test
27400 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
27401 !! options
27402 parsoid=html2wt
27403 !! html/parsoid
27404 <i></i><b></b>
27405 !! wikitext
27406 ''<nowiki/>'''''<nowiki/>'''
27407 !! end
27408
27409 !! test
27410 3. WT Quote Tags: suppress empty style tags on edits
27411 !! options
27412 parsoid={
27413 "modes": ["selser"],
27414 "scrubWikitext": true,
27415 "changes": [
27416 [ "#x", "remove"]
27417 ]
27418 }
27419 !! wikitext
27420 '''<span id="x">foo</span>'''
27421 !! wikitext/edited
27422 !! end
27423
27424 !! test
27425 1. Anchors: suppress newly created empty anchors
27426 !! options
27427 parsoid={
27428 "modes": ["html2wt"],
27429 "scrubWikitext": true
27430 }
27431 !! html/parsoid
27432 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27433 !! wikitext
27434 !! end
27435
27436 !! test
27437 2. Anchors: don't suppress empty anchors if scrubWikitext is false
27438 !! options
27439 parsoid={
27440 "modes": ["html2wt"],
27441 "scrubWikitext": false
27442 }
27443 !! html/parsoid
27444 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27445 !! wikitext
27446 [[Test|<nowiki/>]]
27447 !! end
27448
27449 !! test
27450 3. Anchors: suppress empty anchors on edits
27451 !! options
27452 parsoid={
27453 "modes": ["selser"],
27454 "scrubWikitext": true,
27455 "changes": [
27456 [ "#x", "remove"]
27457 ]
27458 }
27459 !! wikitext
27460 [[Test|<span id="x">foo</span>]]
27461 !! wikitext/edited
27462 !! end
27463
27464 !! test
27465 3a. Anchors: do not suppress numbered extlinks
27466 !! options
27467 parsoid={
27468 "modes": ["wt2wt"],
27469 "scrubWikitext": true
27470 }
27471 !! wikitext
27472 [http://foo.com]
27473 !! html/parsoid
27474 <a rel="mw:ExtLink" href="http://foo.com"></a>
27475 !! end
27476
27477 !! test
27478 3b. Anchors: do not suppress numbered extlinks
27479 !! options
27480 parsoid={
27481 "modes": ["wt2wt"],
27482 "scrubWikitext": true,
27483 "changes": [
27484 [ "#x", "remove"]
27485 ]
27486 }
27487 !! wikitext
27488 [http://foo.com <span id="x">foo</span>]
27489 !! wikitext/edited
27490 [http://foo.com]
27491 !! end
27492
27493 !!test
27494 Normalizations should be restricted to edited content
27495 !!options
27496 parsoid={
27497 "modes": ["selser"],
27498 "scrubWikitext": true,
27499 "changes": [
27500 [ "h1", "before", "<i></i>"]
27501 ]
27502 }
27503 !!wikitext
27504 a
27505 = =
27506 b
27507 !!wikitext/edited
27508 a
27509 = =
27510 b
27511 !!end
27512
27513 !! test
27514 1. Multiple normalizations (html2wt)
27515 !! options
27516 parsoid={
27517 "modes": ["html2wt"],
27518 "scrubWikitext": true
27519 }
27520 !! html
27521 <h2><i></i></h2>
27522 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27523 </a><b><i></i></b>x</p>
27524 !! wikitext
27525
27526 [[foo]]
27527 x
27528
27529 !! end
27530
27531 !! test
27532 2. Multiple normalizations (selser)
27533 !! options
27534 parsoid={
27535 "modes": ["selser"],
27536 "scrubWikitext": true,
27537 "changes": [
27538 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27539 ]
27540 }
27541 !! wikitext
27542 <span id="x">foo</span>
27543 !! wikitext/edited
27544 <span id="x">foo</span>
27545
27546 x
27547 !! end
27548
27549 !! test
27550 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27551 !! options
27552 parsoid={
27553 "modes": ["html2wt"],
27554 "scrubWikitext": true
27555 }
27556 !! html/parsoid
27557 <p> hi</p>
27558 <p> hello</p>
27559 !! wikitext
27560 hi
27561
27562 hello
27563 !! end
27564
27565 !! test
27566 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27567 !! options
27568 parsoid=html2wt
27569 !! html/parsoid
27570 <p> hi</p>
27571 <p> hello</p>
27572 !! wikitext
27573 <nowiki> </nowiki>hi
27574
27575 <nowiki> </nowiki> hello
27576 !! end
27577
27578 !! test
27579 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27580 !! options
27581 parsoid={
27582 "modes": ["html2wt"],
27583 "scrubWikitext": true
27584 }
27585 !! html/parsoid
27586 <p>Foo
27587 bar
27588 baz</p>
27589
27590 <table><tr><td>Foo
27591 bar
27592 baz bang</td></tr></table>
27593
27594 <p><!--boo--> foo
27595 bar</p>
27596
27597 <p> foo
27598 bar<span>boo</span></p>
27599 !! wikitext
27600 Foo
27601 bar
27602 baz
27603
27604 {|
27605 |Foo
27606 bar
27607 baz bang
27608 |}
27609
27610 <!--boo-->foo
27611 bar
27612
27613 foo
27614 bar<span>boo</span>
27615 !! end
27616
27617 !! test
27618 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27619 !! options
27620 parsoid={
27621 "modes": ["selser"],
27622 "scrubWikitext": true,
27623 "changes": [
27624 [ "p", "html", " a\n b" ]
27625 ]
27626 }
27627 !! wikitext
27628 xyz
27629 !! wikitext/edited
27630 a
27631 b
27632 !! end
27633
27634 !! test
27635 1. New links that end in spaces
27636 !! options
27637 parsoid={
27638 "modes": ["html2wt"],
27639 "scrubWikitext": false
27640 }
27641 !! html/parsoid
27642 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27643 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27644 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27645 !! wikitext
27646 [[Berlin ]]<nowiki/>is the capital of Germany.
27647
27648 [[Foo ]]'''bar'''
27649
27650 [[Boston ]] is a city.
27651 !! end
27652
27653 !! test
27654 2. New links that end in spaces
27655 !! options
27656 parsoid={
27657 "modes": ["html2wt"],
27658 "scrubWikitext": true
27659 }
27660 !! html/parsoid
27661 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27662 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27663 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27664 !! wikitext
27665 [[Berlin]] is the capital of Germany.
27666
27667 [[Foo]] '''bar'''
27668
27669 [[Boston]] is a city.
27670 !! end
27671
27672 !! test
27673 1. Table cells with escapable prefixes
27674 !! options
27675 parsoid={
27676 "modes": ["html2wt"],
27677 "scrubWikitext": false
27678 }
27679 !! html
27680 <table>
27681 <tr><td>a</td></tr>
27682 <tr><td>-</td></tr>
27683 <tr><td>+</td></tr>
27684 </table>
27685 !! wikitext
27686 {|
27687 |a
27688 |-
27689 |<nowiki>-</nowiki>
27690 |-
27691 |<nowiki>+</nowiki>
27692 |}
27693 !! end
27694
27695 !! test
27696 2. Table cells with escapable prefixes
27697 !! options
27698 parsoid={
27699 "modes": ["html2wt"],
27700 "scrubWikitext": true
27701 }
27702 !! html
27703 <table>
27704 <tr><td>a</td></tr>
27705 <tr><td>-</td></tr>
27706 <tr><td>+</td></tr>
27707 </table>
27708 !! wikitext
27709 {|
27710 |a
27711 |-
27712 | -
27713 |-
27714 | +
27715 |}
27716 !! end
27717
27718 !! test
27719 3a. Table cells with escapable prefixes after edits
27720 !! options
27721 parsoid={
27722 "modes": ["selser"],
27723 "scrubWikitext": true,
27724 "changes": [
27725 [ "table tbody tr:first-child td:first-child", "remove"]
27726 ]
27727 }
27728 !! wikitext
27729 {|
27730 |a||-
27731 |}
27732 !! wikitext/edited
27733 {|
27734 | -
27735 |}
27736 !! end
27737
27738 !! test
27739 3b. Table cells with escapable prefixes after edits
27740 !! options
27741 parsoid={
27742 "modes": ["selser"],
27743 "scrubWikitext": true,
27744 "changes": [
27745 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27746 [ "#x", "remove" ]
27747 ]
27748 }
27749 !! wikitext
27750 {|
27751 |pqr
27752 |<span id="x">foo</span>+
27753 |}
27754 !! wikitext/edited
27755 {|
27756 | -
27757 | +
27758 |}
27759 !! end
27760
27761 # FIXME: This test will fail because
27762 # normalization doesn't realize that the id attribute
27763 # will eliminate the escapable scenario
27764 !! test
27765 4a. Table cells without escapable prefixes after edits
27766 !! options
27767 parsoid={
27768 "modes": ["selser"],
27769 "scrubWikitext": true,
27770 "changes": [
27771 [ "#x", "html", "-" ]
27772 ]
27773 }
27774 !! wikitext
27775 {|
27776 | id="x" |abcd
27777 |}
27778 !! wikitext/edited
27779 {|
27780 | id="x" |-
27781 |}
27782 !! end
27783
27784 ## This tests normalizer's ability to discriminate between
27785 ## cells having identical content.
27786 !! test
27787 4b. Table cells without escapable prefixes after edits
27788 !! options
27789 parsoid={
27790 "modes": ["selser"],
27791 "scrubWikitext": true,
27792 "changes": [
27793 [ "td", "html", "-" ]
27794 ]
27795 }
27796 !! wikitext
27797 {|
27798 |a||b
27799 |}
27800 !! wikitext/edited
27801 {|
27802 | -||-
27803 |}
27804 !! end
27805
27806 ## This tests normalizer's ability to not be tripped by
27807 ## comments (and whitespace)
27808 !! test
27809 4c. Table cells without escapable prefixes after edits
27810 !! options
27811 parsoid={
27812 "modes": ["selser"],
27813 "scrubWikitext": true,
27814 "changes": [
27815 [ "table tbody tr td:first-child", "remove" ]
27816 ]
27817 }
27818 !! wikitext
27819 {|
27820 |-
27821 <!--foo--> |a||-
27822 |}
27823 !! wikitext/edited
27824 {|
27825 |-
27826 <!--foo--> | -
27827 |}
27828 !! end
27829
27830 ## This tests normalizer's ability to handle HTML cells
27831 !! test
27832 4d. Table cells without escapable prefixes after edits
27833 !! options
27834 parsoid={
27835 "modes": ["selser"],
27836 "scrubWikitext": true,
27837 "changes": [
27838 [ "td", "html", "-" ]
27839 ]
27840 }
27841 !! wikitext
27842 <table>
27843 <tr><td>a</td></tr>
27844 </table>
27845 !! wikitext/edited
27846 <table>
27847 <tr><td>-</td></tr>
27848 </table>
27849 !! end
27850
27851 ## T111151 Remove font elements without attributes
27852 !! test
27853 5a. font tags without attributes should be dropped in scrubWikitext mode
27854 !! options
27855 parsoid={
27856 "modes": ["html2wt"],
27857 "scrubWikitext": true
27858 }
27859 !! html
27860 <font>foo</font>
27861 <font><font>bar</font></font>
27862 <font class="x">boo</font>
27863 !! wikitext
27864 foo
27865 bar
27866 <font class="x">boo</font>
27867 !! end
27868
27869 !! test
27870 5b. font tags should not be dropped without scrubWikitext being enabled
27871 !! options
27872 parsoid={
27873 "modes": ["html2wt"],
27874 "scrubWikitext": false
27875 }
27876 !! html
27877 <font>foo</font>
27878 !! wikitext
27879 <font>foo</font>
27880 !! end
27881
27882 !! test
27883 Escape nowiki DOM elements
27884 !! options
27885 parsoid=html2wt
27886 !! html/parsoid
27887 <nowiki><i>foo</i></nowiki>
27888 !! wikitext
27889 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27890 !! end
27891
27892 # This is meant to be an interim fix while we go about figuring out
27893 # how to not introduce these trailing <nowiki/>s in the first place.
27894 !! test
27895 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27896 !! options
27897 parsoid=html2wt
27898 !! html/parsoid
27899 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27900 y</p>
27901 <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>
27902 <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>
27903 !! wikitext
27904 x
27905 y
27906
27907 {{echo|
27908 1 = <nowiki/>}}
27909
27910 {{echo|
27911 1 = <nowiki/>
27912 }}
27913 !! end
27914
27915 # ---------------------------------------------------
27916 # End of tests spec'ing wikitext serialization norms |
27917 # ---------------------------------------------------
27918
27919 # T104032
27920 !! test
27921 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27922 !! options
27923 parsoid=html2wt
27924 !! html/parsoid
27925 a<p>b</p>
27926 <b>c</b><p>d</p>
27927 <table><tr>
27928 <td>a<p>b</p></td>
27929 <td><b>c</b><p>d</p></td>
27930 </tr></table>
27931 !! wikitext
27932 a
27933
27934 b
27935
27936 '''c'''
27937
27938 d
27939 {|
27940 |a
27941 b
27942 |'''c'''
27943 d
27944 |}
27945 !! end
27946
27947 # -----------------------------------------------------------------
27948 # End of section for Parsoid-only html2wt tests for serialization
27949 # of new content
27950 # -----------------------------------------------------------------
27951
27952 # -----------------------------------------------------------------
27953 # The following section of tests are primarily to spec behavior of
27954 # the selective serializer. All these tests have manual selser
27955 # changes. The automated selser changes for all tests handle the
27956 # wide variation of changes, but these tests here capture specs
27957 # deterministically.
27958 # ----------------------------------------------------------------
27959
27960 ## T90517
27961 !! test
27962 Selser: New comments should not be lost
27963 !! options
27964 parsoid={
27965 "modes": ["selser"],
27966 "changes": [
27967 [ "#a", "after", "<!--c1-->" ],
27968 [ "#b", "before", "<!--c2-->" ]
27969 ]
27970 }
27971 !! wikitext
27972 <span id="a">a</span>
27973
27974 <span id="b">b</span>
27975 !! wikitext/edited
27976 <span id="a">a</span><!--c1-->
27977
27978 <!--c2--><span id="b">b</span>
27979 !! end
27980
27981 ## T89383
27982 !! test
27983 Selser: Check for validity of DSR before using it
27984 !! options
27985 parsoid={
27986 "modes": ["selser"],
27987 "changes": [
27988 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27989 ]
27990 }
27991 !! wikitext
27992 <span id="a">a</span>
27993 !! wikitext/edited
27994 {{DISPLAYTITLE:foo}}
27995 <span id="a">a</span>
27996 !! end
27997
27998 !! test
27999 1. DOMDiff: Changes to <ref> content should be looked up using id
28000 !! options
28001 parsoid={
28002 "modes": ["selser"],
28003 "changes": [
28004 ["#X", "after", "bar"],
28005 ["#Y", "after", "baz"]
28006 ]
28007 }
28008 !! wikitext
28009 X <ref><span id="X">foo</span></ref>
28010 Y <ref name="a" />
28011 <references>
28012 <ref name="a"><span id="Y">foo</span></ref>
28013 </references>
28014 !! wikitext/edited
28015 X <ref><span id="X">foo</span>bar</ref>
28016 Y <ref name="a" />
28017 <references>
28018 <ref name="a"><span id="Y">foo</span>baz</ref>
28019 </references>
28020 !! end
28021
28022 !! test
28023 2. DOMDiff: Changes to <ref> content should be looked up using id
28024 !! options
28025 parsoid={
28026 "modes": ["selser"],
28027 "changes": [
28028 ["#Z", "after", "bar"]
28029 ]
28030 }
28031 !! wikitext
28032 A <ref>foo bar for a</ref>
28033 B <ref group="X" name="b" />
28034
28035 <references />
28036
28037 <references group="X">
28038 <ref name="b"><span id="Z">foo</span></ref>
28039 </references>
28040 !! wikitext/edited
28041 A <ref>foo bar for a</ref>
28042 B <ref group="X" name="b" />
28043
28044 <references />
28045
28046 <references group="X">
28047 <ref name="b"><span id="Z">foo</span>bar</ref>
28048 </references>
28049 !! end
28050
28051 !! test
28052 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
28053 !! options
28054 parsoid={
28055 "modes": ["selser"],
28056 "changes": [
28057 [ "div:first-child", "text", "bar" ]
28058 ]
28059 }
28060 !! wikitext
28061 <div style="{{1x|color:red;}}%">foo</div>
28062 !! wikitext/edited
28063 <div style="{{1x|color:red;}}%">bar</div>
28064 !! end
28065
28066 !! test
28067 Empty LI (T49673)
28068 !! wikitext
28069 * a
28070 *
28071 *
28072 * b
28073 !! html/php+tidy
28074 <ul>
28075 <li>a</li>
28076 <li class="mw-empty-elt"></li>
28077 <li class="mw-empty-elt"></li>
28078 <li>b</li>
28079 </ul>
28080 !! end
28081
28082 !! test
28083 Thumbnail output
28084 !! wikitext
28085 [[File:Thumb.png|thumb]]
28086 !! html/php+tidy
28087 <div class="thumb tright">
28088 <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>
28089 <div class="thumbcaption">
28090 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
28091 </div>
28092 </div>
28093 </div>
28094 !! end
28095
28096 !! test
28097 unclosed internal link XSS (T137264)
28098 !! wikitext
28099 [[#%3Cscript%3Ealert(1)%3C/script%3E|
28100 !! html/php
28101 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
28102 </p>
28103 !! html/parsoid
28104 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
28105 !! end