Added reason suggestion in block/delete/protect forms
[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 !! test
937 Italics and bold: multiple quote sequences: (2,4,2)
938 !! options
939 parsoid=wt2html
940 !! wikitext
941 ''foo''''bar''
942 !! html/*
943 <p><i>foo'<b>bar</b></i>
944 </p>
945 !!end
946
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
959 !! test
960 Italics and bold: multiple quote sequences: (2,4,3)
961 !! options
962 parsoid=wt2html
963 !! wikitext
964 ''foo''''bar'''
965 !! html/*
966 <p><i>foo'<b>bar</b></i>
967 </p>
968 !!end
969
970
971 # same html as previous, but wikitext adjusted to match parsoid html2wt
972 !! test
973 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
974 !! wikitext
975 ''foo'<nowiki/>'''bar'''''
976 !! html
977 <p><i>foo'<b>bar</b></i>
978 </p>
979 !! end
980
981
982 !! test
983 Italics and bold: multiple quote sequences: (2,4,4)
984 !! options
985 parsoid=wt2html
986 !! wikitext
987 ''foo''''bar''''
988 !! html/*
989 <p><i>foo'<b>bar'</b></i>
990 </p>
991 !!end
992
993
994 # same html as previous, but wikitext adjusted to match parsoid html2wt
995 !! test
996 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
997 !! wikitext
998 ''foo'<nowiki/>'''bar'<nowiki/>'''''
999 !! html
1000 <p><i>foo'<b>bar'</b></i>
1001 </p>
1002 !! end
1003
1004
1005 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1006 !! test
1007 Italics and bold: multiple quote sequences: (3,4,2)
1008 !! options
1009 parsoid=wt2html
1010 !! wikitext
1011 '''foo''''bar''
1012 !! html/php
1013 <p><b>foo'</b>bar
1014 </p>
1015 !! html/parsoid
1016 <p><b>foo'</b>bar<i></i>
1017 </p>
1018 !!end
1019
1020 # same html as previous, but wikitext adjusted to match parsoid html2wt
1021 !! test
1022 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1023 !! options
1024 parsoid
1025 !! wikitext
1026 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
1027 !! html/php
1028 <p><b>foo'</b>bar
1029 </p>
1030 !! html/parsoid
1031 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1032 </p>
1033 !! end
1034
1035
1036 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1037 !! test
1038 Italics and bold: multiple quote sequences: (3,4,3)
1039 !! options
1040 parsoid=wt2html
1041 !! wikitext
1042 '''foo''''bar'''
1043 !! html/php
1044 <p><b>foo'</b>bar
1045 </p>
1046 !! html/parsoid
1047 <p><b>foo'</b>bar<b></b>
1048 </p>
1049 !!end
1050
1051 # same html as previous, but wikitext adjusted to match parsoid html2wt
1052 !! test
1053 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1054 !! wikitext
1055 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1056 !! html/php
1057 <p><b>foo'</b>bar
1058 </p>
1059 !! html/parsoid
1060 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1061 </p>
1062 !! end
1063
1064 ###
1065 ### other quote tests
1066 ###
1067 !! test
1068 Italics and bold: other quote tests: (2,3,5)
1069 !! wikitext
1070 ''this is about '''foo's family'''''
1071 !! html
1072 <p><i>this is about <b>foo's family</b></i>
1073 </p>
1074 !!end
1075
1076
1077 !! test
1078 Italics and bold: other quote tests: (2,(3,3),2)
1079 !! wikitext
1080 ''this is about '''foo's''' family''
1081 !! html
1082 <p><i>this is about <b>foo's</b> family</i>
1083 </p>
1084 !!end
1085
1086
1087 !! test
1088 Italics and bold: other quote tests: (3,2,3,2)
1089 !! options
1090 parsoid=wt2html
1091 !! wikitext
1092 '''this is about ''foo'''s family''
1093 !! html/*
1094 <p><b>this is about <i>foo</i></b><i>s family</i>
1095 </p>
1096 !!end
1097
1098
1099 # same html as previous, but wikitext adjusted to match parsoid html2wt
1100 !! test
1101 Italics and bold: other quote tests: (3,2,3+2+2,2)
1102 !! wikitext
1103 '''this is about ''foo'''''<nowiki/>''s family''
1104 !! html
1105 <p><b>this is about <i>foo</i></b><i>s family</i>
1106 </p>
1107 !! end
1108
1109
1110 !! test
1111 Italics and bold: other quote tests: (3,2,3,3)
1112 !! wikitext
1113 '''this is about ''foo'''s family'''
1114 !! html/*
1115 <p>'<i>this is about </i>foo<b>s family</b>
1116 </p>
1117 !!end
1118
1119
1120 !! test
1121 Italics and bold: other quote tests: (3,(2,2),3)
1122 !! wikitext
1123 '''this is about ''foo's'' family'''
1124 !! html
1125 <p><b>this is about <i>foo's</i> family</b>
1126 </p>
1127 !!end
1128
1129
1130 !! test
1131 Italicized possessive
1132 !! wikitext
1133 The ''[[Main Page]]'''s talk page.
1134 !! html/php
1135 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1136 </p>
1137 !! html/parsoid
1138 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1139 !! end
1140
1141 !! test
1142 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1143 (Requires tidy for PHP parser output to be fixed up)
1144 !! options
1145 parsoid=wt2html,wt2wt
1146 !! wikitext
1147 {|
1148 !''a!!''b
1149 |''a||''b
1150 |}
1151 !! html/php+tidy
1152 <table>
1153 <tr>
1154 <th><i>a</i></th>
1155 <th><i>b</i></th>
1156 <td><i>a</i></td>
1157 <td><i>b</i></td>
1158 </tr>
1159 </table>
1160 !! html/parsoid
1161 <table>
1162 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1163 <td><i>a</i></td><td><i>b</i></td></tr>
1164 </tbody></table>
1165 !! end
1166
1167 ###
1168 ### Non-html5 tags
1169 ###
1170
1171 !! test
1172 Non-html5 tags should be accepted
1173 !! wikitext
1174 <center>''foo''</center>
1175 <big>''foo''</big>
1176 <font>''foo''</font>
1177 <strike>''foo''</strike>
1178 <tt>''foo''</tt>
1179 !! html
1180 <center><i>foo</i></center>
1181 <p><big><i>foo</i></big>
1182 <font><i>foo</i></font>
1183 <strike><i>foo</i></strike>
1184 <tt><i>foo</i></tt>
1185 </p>
1186 !! end
1187
1188 !! test
1189 <wbr> is valid wikitext (bug 52468)
1190 !! wikitext
1191 <wbr>
1192 !! html
1193 <p><wbr />
1194 </p>
1195 !! end
1196
1197 # <strike> is HTML4, <s> is HTML4/5.
1198 !! test
1199 <s> or <strike> for strikethrough
1200 !! wikitext
1201 <strike>strike</strike>
1202
1203 <s>s</s>
1204 !! html
1205 <p><strike>strike</strike>
1206 </p><p><s>s</s>
1207 </p>
1208 !! end
1209
1210 ## a not permitted
1211 ## i,b,br omitted
1212 !! test
1213 Text-level semantic html elements in wikitext
1214 !! wikitext
1215 <em>text</em>
1216 <strong>text</strong>
1217 <small>text</small>
1218 <s>text</s>
1219 <cite>text</cite>
1220 <q>text</q>
1221 <dfn>text</dfn>
1222 <abbr>text</abbr>
1223 <data>text</data>
1224 <time>text</time>
1225 <code>text</code>
1226 <var>text</var>
1227 <samp>text</samp>
1228 <kbd>text</kbd>
1229 <sub>text</sub>
1230 <u>text</u>
1231 <mark>text</mark>
1232 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1233 <bdi>text</bdi>
1234 <bdo>text</bdo>
1235 <span>text</span>
1236 <wbr />
1237 !! html
1238 <p><em>text</em>
1239 <strong>text</strong>
1240 <small>text</small>
1241 <s>text</s>
1242 <cite>text</cite>
1243 <q>text</q>
1244 <dfn>text</dfn>
1245 <abbr>text</abbr>
1246 <data>text</data>
1247 <time>text</time>
1248 <code>text</code>
1249 <var>text</var>
1250 <samp>text</samp>
1251 <kbd>text</kbd>
1252 <sub>text</sub>
1253 <u>text</u>
1254 <mark>text</mark>
1255 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1256 <bdi>text</bdi>
1257 <bdo>text</bdo>
1258 <span>text</span>
1259 <wbr />
1260 </p>
1261 !! end
1262
1263 # test cases taken from
1264 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1265 !! test
1266 Ruby markup (W3C-style)
1267 !! wikitext
1268 ; Mono-ruby for individual base characters
1269 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1270 ; Group ruby
1271 : <ruby>今日<rt>きょう</rt></ruby>
1272 ; Jukugo ruby
1273 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1274 ; Inline ruby
1275 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1276 ; Double-sided ruby
1277 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1278 <ruby>
1279 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1280 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1281 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1282 </ruby>
1283 !! html
1284 <dl><dt> Mono-ruby for individual base characters</dt>
1285 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1286 <dt> Group ruby</dt>
1287 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1288 <dt> Jukugo ruby</dt>
1289 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1290 <dt> Inline ruby</dt>
1291 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1292 <dt> Double-sided ruby</dt>
1293 <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>
1294 <p><ruby>
1295 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1296 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1297 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1298 </ruby>
1299 </p>
1300 !! end
1301
1302 # The next two test different paths in the sanitizer.
1303 !! test
1304 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1305 !! wikitext
1306 <blockquote|>a</blockquote>
1307
1308 <b→> doesn't terminate </b→>
1309
1310 <bä> doesn't terminate </bä>
1311
1312 <boo> doesn't terminate </boo>
1313
1314 <s.foo> doesn't terminate </s.foo>
1315
1316 <sub-ID#1>
1317 !! html
1318 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1319 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1320 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1321 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1322 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1323 </p><p>&lt;sub-ID#1&gt;
1324 </p>
1325 !! end
1326
1327 # There is a tidy bug here: https://sourceforge.net/p/tidy/bugs/946/
1328 # If the non-word-character tag made it through the sanitizer, tidy
1329 # would munge it up.
1330 !! test
1331 Non-word characters don't terminate tag names + tidy
1332 !! wikitext
1333 <blockquote|>a</blockquote>
1334
1335 <b→> doesn't terminate </b→>
1336
1337 <bä> doesn't terminate </bä>
1338
1339 <boo> doesn't terminate </boo>
1340
1341 <s.foo> doesn't terminate </s.foo>
1342
1343 <sub-ID#1>
1344 !! html+tidy
1345 <p>&lt;blockquote|&gt;a</p>
1346 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1347 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1348 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1349 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1350 <p>&lt;sub-ID#1&gt;</p>
1351 !! end
1352
1353 ###
1354 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1355 ### This checks that HTML5 tags (with non-word characters in the tag
1356 ### name) make it safely through the parser -- the Sanitizer will
1357 ### munge them later, as it should.
1358 ###
1359 !! test
1360 Non-word characters are valid in extension tags (T19663)
1361 !! wikitext
1362 <tåg>tåg</tåg>
1363 !! html/php
1364 <pre>
1365 'tåg'
1366 array (
1367 )
1368 </pre>
1369
1370 !! html/parsoid
1371 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1372 !! end
1373
1374 !! test
1375 Isolated close tags should be treated as literal text (bug 52760)
1376 !! options
1377 parsoid=wt2html
1378 !! wikitext
1379 </b>
1380
1381 <s.foo>s</s>
1382 !! html/php+tidy
1383 <p>&lt;s.foo&gt;s</p>
1384 !! html/parsoid
1385 <p>&lt;s.foo&gt;s</p>
1386 !! end
1387
1388 ###
1389 ### Special characters
1390 ###
1391
1392 !! test
1393 Bare pipe character (bug 52363)
1394 !! wikitext
1395 |
1396 !! html
1397 <p>|
1398 </p>
1399 !! end
1400
1401 !! test
1402 Bare pipe character from a template (bug 52363)
1403 !! wikitext
1404 {{pipe}}
1405 !! html
1406 <p>|
1407 </p>
1408 !! end
1409
1410 ###
1411 ### <nowiki> test cases
1412 ###
1413
1414 !! test
1415 <nowiki> unordered list
1416 !! wikitext
1417 <nowiki>* This is not an unordered list item.</nowiki>
1418 !! html/php
1419 <p>* This is not an unordered list item.
1420 </p>
1421 !! html/parsoid
1422 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1423 !! end
1424
1425 !! test
1426 <nowiki> spacing
1427 !! wikitext
1428 <nowiki>Lorem ipsum dolor
1429
1430 sed abit.
1431 sed nullum.
1432
1433 :and a colon
1434 </nowiki>
1435 !! html/php
1436 <p>Lorem ipsum dolor
1437
1438 sed abit.
1439 sed nullum.
1440
1441 :and a colon
1442
1443 </p>
1444 !! html/parsoid
1445 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1446
1447 sed abit.
1448 sed nullum.
1449
1450 :and a colon
1451 </span></p>
1452 !! end
1453
1454 !! test
1455 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1456 !! wikitext
1457 <nowiki><span class="error"></nowiki>
1458 !! html/php
1459 <p>&lt;span class="error"&gt;
1460 </p>
1461 !! html/parsoid
1462 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1463 !! end
1464
1465 !! test
1466 nowiki 3
1467 !! wikitext
1468 :There is not nowiki.
1469 :There is <nowiki>nowiki</nowiki>.
1470
1471 #There is not nowiki.
1472 #There is <nowiki>nowiki</nowiki>.
1473
1474 *There is not nowiki.
1475 *There is <nowiki>nowiki</nowiki>.
1476 !! html/php
1477 <dl><dd>There is not nowiki.</dd>
1478 <dd>There is nowiki.</dd></dl>
1479 <ol><li>There is not nowiki.</li>
1480 <li>There is nowiki.</li></ol>
1481 <ul><li>There is not nowiki.</li>
1482 <li>There is nowiki.</li></ul>
1483
1484 !! html/parsoid
1485 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1486 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1487
1488 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1489 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1490
1491 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1492 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1493 !! end
1494
1495 !! test
1496 Entities inside <nowiki>
1497 !! wikitext
1498 <nowiki>&lt;</nowiki>
1499 !! html
1500 <p>&lt;
1501 </p>
1502 !! end
1503
1504 !! test
1505 Entities inside template parameters
1506 !! wikitext
1507 {{echo|&ndash;}}
1508 !! html/php+tidy
1509 <p>–</p>
1510 !! html/parsoid
1511 <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>
1512 !! end
1513
1514 !! test
1515 Properly escape nowiki when combined with other wiki markup
1516 !! options
1517 parsoid=html2wt
1518 !! html/parsoid
1519 <p>* &lt;/nowiki&gt; tag</p>
1520 !! wikitext
1521 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1522 !! end
1523
1524 !! test
1525 T93824: Put escaped HTML tags inside nowiki
1526 !! options
1527 parsoid=html2wt
1528 !! html/parsoid
1529 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1530 !! wikitext
1531 <nowiki><h2>foo</h2></nowiki>
1532 !! end
1533
1534 !! test
1535 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1536 !! options
1537 parsoid=html2wt
1538 !! html/parsoid
1539 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1540 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1541 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1542 !! wikitext
1543 This text: L'[[Foo]]
1544 This text: L<nowiki>''</nowiki>[[Foo]]
1545 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1546 !! end
1547
1548 # This test fails because wikitext whitespace is not normalized before comparing.
1549 !! test
1550 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1551 !! options
1552 parsoid=html2wt
1553 !! html/parsoid
1554 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1555 </p>
1556 !! wikitext
1557 This text : L<nowiki>''</nowiki>[[Foo]]
1558 !! end
1559
1560 # This test and the next one are html2wt only as they test that incorrect wikitext
1561 # passed in template arguments gets escaped or wrapped in nowikis where required.
1562 !! test
1563 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1564 !! options
1565 parsoid=html2wt
1566 !! html/parsoid
1567 <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>
1568 <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>
1569 !! wikitext
1570 {{echo|foo{{!}}bar}}
1571 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1572 !! end
1573
1574 !! test
1575 T53961: Output correct nowikis in template arguments
1576 !! options
1577 parsoid=html2wt
1578 !! html/parsoid
1579 <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>
1580 <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>
1581 <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>
1582 <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>
1583 <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>
1584 !! wikitext
1585 {{echo|a [ b}}
1586 {{echo|<nowiki>a }} b</nowiki>}}
1587 {{echo|<nowiki>a [[ b</nowiki>}}
1588 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1589 {{echo|a <nowiki>}</nowiki>}}
1590 !! end
1591
1592 !! test
1593 Cases where "!!" needs nowiki protection
1594 !! options
1595 parsoid=html2wt
1596 !! html/parsoid
1597 <table>
1598 <tr><th>this needs protection !! here</th></tr>
1599 </table>
1600
1601 <table>
1602 <tr><th>this does not need
1603 protection !! here</th></tr>
1604 </table>
1605 !! wikitext
1606 {|
1607 !<nowiki>this needs protection !! here</nowiki>
1608 |}
1609
1610 {|
1611 !this does not need
1612 protection !! here
1613 |}
1614 !! end
1615
1616 ###
1617 ### Comments
1618 ###
1619 !! test
1620 Comments and Indent-Pre
1621 !! wikitext
1622 <!-- comment 1 --> asdf
1623
1624 <!-- comment 1 --> asdf
1625 <!-- comment 2 -->
1626
1627 <!-- comment 1 --> asdf
1628 <!-- comment 2 -->xyz
1629
1630 <!-- comment 1 --> asdf
1631 <!-- comment 2 --> xyz
1632 !! html
1633 <pre>asdf
1634 </pre>
1635 <pre>asdf
1636 </pre>
1637 <pre>asdf
1638 </pre>
1639 <p>xyz
1640 </p>
1641 <pre>asdf
1642 xyz
1643 </pre>
1644 !! end
1645
1646 !! test
1647 Comment test 2a
1648 !! wikitext
1649 asdf
1650 <!-- comment 1 -->
1651 jkl
1652 !! html
1653 <p>asdf
1654 jkl
1655 </p>
1656 !! end
1657
1658 !! test
1659 Comment test 2b
1660 !! wikitext
1661 asdf
1662 <!-- comment 1 -->
1663
1664 jkl
1665 !! html
1666 <p>asdf
1667 </p><p>jkl
1668 </p>
1669 !! end
1670
1671 !! test
1672 Comment test 3
1673 !! wikitext
1674 asdf
1675 <!-- comment 1 -->
1676 <!-- comment 2 -->
1677 jkl
1678 !! html
1679 <p>asdf
1680 jkl
1681 </p>
1682 !! end
1683
1684 !! test
1685 Comment test 4
1686 !! wikitext
1687 asdf<!-- comment 1 -->jkl
1688 !! html
1689 <p>asdfjkl
1690 </p>
1691 !! end
1692
1693 !! test
1694 Comment spacing
1695 !! wikitext
1696 a
1697 <!-- foo --> b <!-- bar -->
1698 c
1699 !! html
1700 <p>a
1701 </p>
1702 <pre> b
1703 </pre>
1704 <p>c
1705 </p>
1706 !! end
1707
1708 !! test
1709 Comment whitespace
1710 !! wikitext
1711 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1712 !! html
1713
1714 !! end
1715
1716 !! test
1717 Comment semantics and delimiters
1718 !! wikitext
1719 <!-- --><!----><!-----><!------>
1720 !! html/php
1721
1722 !! html/parsoid
1723 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1724 !! end
1725
1726 !! test
1727 Comment semantics and delimiters, redux
1728 !! wikitext
1729 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1730 -- foo -- funky huh? ... -->
1731 !! html/php
1732
1733 !! html/parsoid
1734 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1735 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1736 !! end
1737
1738 !! test
1739 Comment semantics and delimiters: directors cut
1740 !! wikitext
1741 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1742 everything starting with < followed by !-- until the first -- and > we see,
1743 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1744 -->-->
1745 !! html/php
1746 <p>--&gt;
1747 </p>
1748 !! html/parsoid
1749 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1750 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1751 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1752 --><p>--></p>
1753 !! end
1754
1755 !! test
1756 Comment semantics: nesting
1757 !! wikitext
1758 <!--<!-- no, we're not going to do anything fancy here -->-->
1759 !! html/php
1760 <p>--&gt;
1761 </p>
1762 !! html/parsoid
1763 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1764 !! end
1765
1766 # Parsoid closes the unclosed comment, even if it means a slight
1767 # round-trip diff.
1768 !! test
1769 Comment semantics: unclosed comment at end
1770 !! options
1771 parsoid=wt2html,html2html
1772 !! wikitext
1773 <!--This comment will run out to the end of the document
1774 !! html/php
1775
1776 !! html/parsoid
1777 <!--This comment will run out to the end of the document-->
1778 !! end
1779
1780 !! test
1781 Comment semantics: normalize comments to play nice with XML and browsers
1782 !! wikitext
1783 <!-- Browsers --!> think this is closed -->
1784 <!--> This would normally be text -->
1785 <!---> As would this -->
1786 <!-- XML doesn't like trailing dashes -------->
1787 <!-- Nor doubled hyphens -- anywhere in the data -->
1788 But this is not a comment.
1789 !! html/php
1790 <p>But this is not a comment.
1791 </p>
1792 !! html/parsoid
1793 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1794 <!--&#x3E; This would normally be text -->
1795 <!--&#x2D;&#x3E; As would this -->
1796 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1797 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1798 <p>But this is not a comment.</p>
1799 !! end
1800
1801 !! test
1802 Comment semantics: round-trip even text which contains encoded -->
1803 !! wikitext
1804 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1805 !! html/parsoid
1806 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1807 !! end
1808
1809 !! test
1810 Comment in template title
1811 !! wikitext
1812 {{f<!---->oo}}
1813 !! html
1814 <p>FOO
1815 </p>
1816 !! end
1817
1818 !! test
1819 Comment on its own line post-expand
1820 !! wikitext
1821 a
1822 {{blank}}<!---->
1823 b
1824 !! html
1825 <p>a
1826 </p><p>b
1827 </p>
1828 !! end
1829
1830 !! test
1831 Comment on its own line post-expand with non-significant whitespace
1832 !! wikitext
1833 a
1834 {{blank}} <!---->
1835 b
1836 !! html
1837 <p>a
1838 </p><p>b
1839 </p>
1840 !! end
1841
1842 !! test
1843 Multiple comments should still parse as SOL-transparent
1844 !! options
1845 parsoid=wt2html,wt2wt
1846 !! wikitext
1847 <!--c1-->*a
1848 <!--c2--><!--c3--><!--c4-->*b
1849 !! html/php
1850 <ul><li>a</li>
1851 <li>b</li></ul>
1852
1853 !! html/parsoid
1854 <!--c1--><ul>
1855 <li>a
1856 </li>
1857 <!--c2--><!--c3--><!--c4-->
1858 <li>b
1859 </li>
1860 </ul>
1861 !! end
1862
1863 ###
1864 ### paragraph wrapping tests
1865 ###
1866 !! test
1867 No block tags
1868 !! wikitext
1869 a
1870
1871 b
1872 !! html
1873 <p>a
1874 </p><p>b
1875 </p>
1876 !! end
1877
1878 !! test
1879 Block tag on one line (<div>)
1880 !! wikitext
1881 a <div>foo</div>
1882
1883 b
1884 !! html
1885 a <div>foo</div>
1886 <p>b
1887 </p>
1888 !! html+tidy
1889 <p>a</p>
1890 <div>foo</div>
1891 <p>b</p>
1892 !! end
1893
1894 !! test
1895 Block tag on one line (<blockquote>)
1896 !! wikitext
1897 a <blockquote>foo</blockquote>
1898
1899 b
1900 !! html
1901 a <blockquote>foo</blockquote>
1902 <p>b
1903 </p>
1904 !! html+tidy
1905 <p>a</p>
1906 <blockquote>
1907 <p>foo</p>
1908 </blockquote>
1909 <p>b</p>
1910 !! end
1911
1912 !! test
1913 Block tag on both lines (<div>)
1914 !! wikitext
1915 a <div>foo</div>
1916
1917 b <div>foo</div>
1918 !! html
1919 a <div>foo</div>
1920 b <div>foo</div>
1921
1922 !! html+tidy
1923 <p>a</p>
1924 <div>foo</div>
1925 <p>b</p>
1926 <div>foo</div>
1927 !! end
1928
1929 !! test
1930 Block tag on both lines (<blockquote>)
1931 !! wikitext
1932 a <blockquote>foo</blockquote>
1933
1934 b <blockquote>foo</blockquote>
1935 !! html
1936 a <blockquote>foo</blockquote>
1937 b <blockquote>foo</blockquote>
1938
1939 !! html+tidy
1940 <p>a</p>
1941 <blockquote>
1942 <p>foo</p>
1943 </blockquote>
1944 <p>b</p>
1945 <blockquote>
1946 <p>foo</p>
1947 </blockquote>
1948 !! end
1949
1950 !! test
1951 Multiple lines without block tags
1952 !! wikitext
1953 <div>foo</div> a
1954 b
1955 c
1956 d<!--foo--> e
1957 x <div>foo</div> z
1958 !! html
1959 <div>foo</div> a
1960 <p>b
1961 c
1962 d e
1963 </p>
1964 x <div>foo</div> z
1965
1966 !! html+tidy
1967 <div>foo</div>
1968 <p>a</p>
1969 <p>b c d e</p>
1970 <p>x</p>
1971 <div>foo</div>
1972 <p>z</p>
1973 !! end
1974
1975 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1976 # So, we have a separate section for Parsoid. We don't want
1977 # to mimic this stripping behavior in Parsoid. It affects
1978 # editing experience and also requires us to maintain additional
1979 # info for RT-ing.
1980 !! test
1981 Empty lines between lines with block tags
1982 !! wikitext
1983 <div></div>
1984
1985
1986 <div></div>a
1987
1988 b
1989 <div>a</div>b
1990
1991 <div>b</div>d
1992
1993
1994 <div>e</div>
1995 !! html
1996 <div></div>
1997 <p><br />
1998 </p>
1999 <div></div>a
2000 <p>b
2001 </p>
2002 <div>a</div>b
2003 <div>b</div>d
2004 <p><br />
2005 </p>
2006 <div>e</div>
2007
2008 !! html+tidy
2009 <p><br /></p>
2010 <p>a</p>
2011 <p>b</p>
2012 <div>a</div>
2013 <p>b</p>
2014 <div>b</div>
2015 <p>d</p>
2016 <p><br /></p>
2017 <div>e</div>
2018 !! html/parsoid
2019 <div data-parsoid='{"stx":"html"}'></div>
2020
2021 <p><br /></p>
2022 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2023
2024 <p>b</p>
2025 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2026
2027 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2028
2029 <p><br /></p>
2030 <div data-parsoid='{"stx":"html"}'>e</div>
2031 !! end
2032
2033 ## PHP parser emits output which is broken
2034 !! test
2035 Unclosed HTML p-tags should be handled properly
2036 !! wikitext
2037 <div><p>foo</div>
2038 a
2039
2040 b
2041 !! html/php+tidy
2042 <div>
2043 <p>foo</p>
2044 </div>
2045 <p>a</p>
2046 <p>b</p>
2047 !! html/parsoid
2048 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2049 <p>a</p>
2050 <p>b</p>
2051 !! end
2052
2053 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2054 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2055 ## them for now.
2056 !! test
2057 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2058 !! options
2059 parsoid=wt2html
2060 !! wikitext
2061 a [[Category:A1]] [[Category:A2]]
2062 [[Category:A3]]
2063 [[Category:A4]]
2064 !! html/parsoid
2065 <p>a</p>
2066 <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"/>
2067 !! end
2068
2069 !! test
2070 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2071 !! options
2072 parsoid=wt2html
2073 !! wikitext
2074 [[Category:A1]]a
2075 !! html/parsoid
2076 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2077 !! end
2078
2079 ###
2080 ### Preformatted text
2081 ###
2082 !! test
2083 Preformatted text
2084 !! wikitext
2085 This is some
2086 Preformatted text
2087 With ''italic''
2088 And '''bold'''
2089 And a [[Main Page|link]]
2090 !! html
2091 <pre>This is some
2092 Preformatted text
2093 With <i>italic</i>
2094 And <b>bold</b>
2095 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2096 </pre>
2097 !! end
2098
2099 !! test
2100 Tabs don't trigger preformatted text
2101 !! wikitext
2102 This is not
2103 preformatted text.
2104 This is preformatted text.
2105 So is this.
2106 !! html/php
2107 <p> This is not
2108 preformatted text.
2109 </p>
2110 <pre>This is preformatted text.
2111 So is this.
2112 </pre>
2113 !! html/parsoid
2114 <p> This is not
2115 preformatted text.</p>
2116 <pre>This is preformatted text.
2117 So is this.</pre>
2118 !! end
2119
2120 !! test
2121 Space before tab needs nowiki pre protection
2122 !! options
2123 parsoid=html2wt
2124 !! html/parsoid
2125 <p> a</p>
2126 !! wikitext
2127 <nowiki> </nowiki> a
2128 !! end
2129
2130 !! test
2131 Ident preformatting with inline content
2132 !! wikitext
2133 a
2134 ''b''
2135 !! html
2136 <pre>a
2137 <i>b</i>
2138 </pre>
2139 !! end
2140
2141 !! test
2142 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2143 !! wikitext
2144 <pre><nowiki>
2145 <b>
2146 <cite>
2147 <em>
2148 </nowiki></pre>
2149 !! html
2150 <pre>
2151 &lt;b&gt;
2152 &lt;cite&gt;
2153 &lt;em&gt;
2154 </pre>
2155
2156 !! end
2157
2158 !! test
2159 Regression with preformatted in <center>
2160 !! wikitext
2161 <center>
2162 Blah
2163 </center>
2164 !! html
2165 <center>
2166 <pre>Blah
2167 </pre>
2168 </center>
2169
2170 !! end
2171
2172 !! test
2173 Bug 52763: Preformatted in <blockquote>
2174 !! wikitext
2175 <blockquote>
2176 Blah
2177 {|
2178 |
2179 indented cell (no pre-wrapping!)
2180 |}
2181 </blockquote>
2182 !! html
2183 <blockquote>
2184 <p> Blah
2185 </p>
2186 <table>
2187 <tr>
2188 <td>
2189 <p> indented cell (no pre-wrapping!)
2190 </p>
2191 </td></tr></table>
2192 </blockquote>
2193
2194 !! end
2195
2196 !! test
2197 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2198 !! wikitext
2199 <blockquote>
2200 Foo
2201
2202 Bar
2203 </blockquote>
2204 !! html
2205 <blockquote>
2206 <p>Foo
2207 </p><p>Bar
2208 </p>
2209 </blockquote>
2210
2211 !! end
2212
2213 !! test
2214 Bug 15491: <ins>/<del> in blockquote
2215 !! wikitext
2216 <blockquote>
2217 Foo <del>bar</del> <ins>baz</ins> quux
2218 </blockquote>
2219 !! html
2220 <blockquote>
2221 <p>Foo <del>bar</del> <ins>baz</ins> quux
2222 </p>
2223 </blockquote>
2224
2225 !! end
2226
2227 # Note that the p-wrapping is newline sensitive, which could be
2228 # considered a bug: tidy will wrap only the 'Foo' in the example
2229 # below in a <p> tag. (see comment 23-25 of bug #6200)
2230 !! test
2231 Bug 15491: <ins>/<del> in blockquote (2)
2232 !! wikitext
2233 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2234 </blockquote>
2235 !! html
2236 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2237 </blockquote>
2238
2239 !! html+tidy
2240 <blockquote>
2241 <p>Foo</p>
2242 <del>bar</del> <ins>baz</ins> quux</blockquote>
2243 !! end
2244
2245 !! test
2246 <pre> with attributes (bug 3202)
2247 !! wikitext
2248 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2249 !! html
2250 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2251
2252 !! end
2253
2254 !! test
2255 <pre> with width attribute (bug 3202)
2256 !! wikitext
2257 <pre width="8">Narrow screen goodies</pre>
2258 !! html
2259 <pre width="8">Narrow screen goodies</pre>
2260
2261 !! end
2262
2263 !! test
2264 <pre> with forbidden attribute (bug 3202)
2265 !! wikitext
2266 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2267 !! html
2268 <pre width="8">Narrow screen goodies</pre>
2269
2270 !! end
2271
2272 !! test
2273 Entities inside <pre>
2274 !! wikitext
2275 <pre>&lt;</pre>
2276 !! html
2277 <pre>&lt;</pre>
2278
2279 !! end
2280
2281 !! test
2282 <pre> with forbidden attribute values (bug 3202)
2283 !! wikitext
2284 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2285 !! html
2286 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2287
2288 !! end
2289
2290 !! test
2291 <nowiki> inside <pre> (bug 13238)
2292 !! wikitext
2293 <pre>
2294 <nowiki>
2295 </pre>
2296 <pre>
2297 <nowiki></nowiki>
2298 </pre>
2299 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2300 !! html
2301 <pre>
2302 &lt;nowiki&gt;
2303 </pre>
2304 <pre>
2305
2306 </pre>
2307 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2308
2309 !! end
2310
2311 !! test
2312 <nowiki> inside of #tag:pre
2313 !! wikitext
2314 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2315 !! html/php
2316 <pre>Foo &#8594;bar</pre>
2317
2318 !! html/parsoid
2319 <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>
2320 !! end
2321
2322 !! test
2323 <nowiki> and <pre> preference (first one wins)
2324 !! wikitext
2325 <pre>
2326 <nowiki>
2327 </pre>
2328 </nowiki>
2329 </pre>
2330
2331 <nowiki>
2332 <pre>
2333 <nowiki>
2334 </pre>
2335 </nowiki>
2336 </pre>
2337
2338 !! html/php
2339 <pre>
2340 &lt;nowiki&gt;
2341 </pre>
2342 <p>&lt;/nowiki&gt;
2343 &lt;/pre&gt;
2344 </p><p>
2345 &lt;pre&gt;
2346 &lt;nowiki&gt;
2347 &lt;/pre&gt;
2348
2349 &lt;/pre&gt;
2350 </p>
2351 !! html/parsoid
2352 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2353 </pre>
2354 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2355 &lt;/pre></p>
2356
2357 <p><span typeof="mw:Nowiki">
2358 &lt;pre>
2359 &lt;nowiki>
2360 &lt;/pre>
2361 </span>
2362 &lt;/pre></p>
2363 !! end
2364
2365 !! test
2366 </pre> inside nowiki
2367 !! wikitext
2368 <nowiki></pre></nowiki>
2369 !! html
2370 <p>&lt;/pre&gt;
2371 </p>
2372 !! end
2373
2374 # Parsoid doesn't strip empty tags, like Tidy does.
2375 !! test
2376 Empty pre; pre inside other HTML tags (bug 54946)
2377 !! options
2378 parsoid=wt2html,wt2wt
2379 !! wikitext
2380 a
2381
2382 <div><pre>
2383 foo
2384 </pre></div>
2385 <pre></pre>
2386 !! html/php
2387 <p>a
2388 </p>
2389 <div><pre>
2390 foo
2391 </pre></div>
2392 <pre></pre>
2393
2394 !! html/php+tidy
2395 <p>a</p>
2396 <div>
2397 <pre>
2398 foo
2399 </pre></div>
2400 !! html/parsoid
2401 <p>a</p>
2402
2403 <div><pre>foo
2404 </pre></div>
2405 <pre></pre>
2406 !! end
2407
2408 !! test
2409 HTML pre followed by indent-pre
2410 !! wikitext
2411 <pre>foo</pre>
2412 bar
2413 !! html
2414 <pre>foo</pre>
2415 <pre>bar
2416 </pre>
2417 !! end
2418
2419 # Note that tidy removes the empty <p> tags from the start and end.
2420 # Parsoid does not, by design.
2421 !!test
2422 Block tag pre
2423 !! wikitext
2424 <p><pre>foo</pre></p>
2425 !! html/php+tidy
2426 <pre>
2427 foo
2428 </pre>
2429 !! html/parsoid
2430 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2431 !!end
2432
2433 !!test
2434 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2435 !! wikitext
2436 {{echo|}}
2437 !! html
2438
2439 !!end
2440
2441 !!test
2442 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2443 !! wikitext
2444 {{echo|
2445 foo}}
2446 !! html
2447 <p>foo
2448 </p>
2449 !!end
2450
2451 !! test
2452 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2453 !! wikitext
2454 {{echo|a
2455 b}}
2456 !! html
2457 <pre>a
2458 </pre>
2459 <p>b
2460 </p>
2461 !!end
2462
2463 !! test
2464 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2465 !! wikitext
2466 {{echo|a
2467 b
2468 c
2469 d
2470 e
2471 }}
2472 !! html
2473 <pre>a
2474 </pre>
2475 <p>b
2476 c
2477 </p>
2478 <pre>d
2479 </pre>
2480 <p>e
2481 </p>
2482 !!end
2483
2484 !!test
2485 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2486 !! wikitext
2487 {{echo| foo}}
2488
2489 {{echo| foo}}{{echo| bar}}
2490
2491 {{echo| foo}}
2492 {{echo| bar}}
2493
2494 {{echo|<!--cmt--> foo}}
2495
2496 <!--cmt-->{{echo| foo}}
2497
2498 {{echo|{{echo| }}bar}}
2499 !! html
2500 <pre>foo
2501 </pre>
2502 <pre>foo bar
2503 </pre>
2504 <pre>foo
2505 bar
2506 </pre>
2507 <pre>foo
2508 </pre>
2509 <pre>foo
2510 </pre>
2511 <pre>bar
2512 </pre>
2513 !!end
2514
2515 !! test
2516 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2517 !! wikitext
2518 {{echo| }}a
2519
2520 {{echo|
2521 }}a
2522
2523 {{echo|
2524 b}}
2525
2526 {{echo|a
2527 }}b
2528
2529 {{echo|a
2530 }} b
2531 !! html
2532 <pre>a
2533 </pre>
2534 <p><br />
2535 </p>
2536 <pre>a
2537 </pre>
2538 <p><br />
2539 </p>
2540 <pre>b
2541 </pre>
2542 <p>a
2543 </p>
2544 <pre>b
2545 </pre>
2546 <p>a
2547 </p>
2548 <pre>b
2549 </pre>
2550 !!end
2551
2552 !! test
2553 Pres with newline attributes
2554 !! wikitext
2555 <pre class="one
2556 two">hi</pre>
2557 !! html/php
2558 <pre class="one two">hi</pre>
2559
2560 !! html/parsoid
2561 <pre class="one
2562 two" data-parsoid='{"stx":"html"}'>hi</pre>
2563 !! end
2564
2565 !! test
2566 Things that look like <pre> tags aren't treated as such
2567 !! wikitext
2568 Barack Obama <President> of the United States
2569 <President></President>
2570 !! html
2571 <p>Barack Obama &lt;President&gt; of the United States
2572 &lt;President&gt;&lt;/President&gt;
2573 </p>
2574 !! end
2575
2576 !! test
2577 Handle broken pre-like tags (bug 64025)
2578 !! options
2579 parsoid=wt2html
2580 !! wikitext
2581 {{echo|<pre <pre>x</pre>}}
2582
2583 <table><pre </table>
2584 !! html/php
2585 <pre>x</pre>
2586 <table>&lt;pre </table>
2587
2588 !! html/php+tidy
2589 <pre>
2590 x
2591 </pre>
2592 <p>&lt;pre</p>
2593 !! html/parsoid
2594 <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>
2595
2596
2597 <p>&lt;pre </p>
2598
2599 <table></table>
2600 !! end
2601
2602 !! test
2603 Parsoid: handle pre with space after attribute
2604 !! options
2605 parsoid=wt2html
2606 !! wikitext
2607 <pre style="width:50%;" >{{echo|foo}}</pre>
2608 !! html/php
2609 <pre style="width:50%;">{{echo|foo}}</pre>
2610
2611 !! html/parsoid
2612 <pre style="width:50%;">{{echo|foo}}</pre>
2613 !! end
2614
2615 # TODO / maybe: fix wt2wt for this
2616 !! test
2617 Parsoid: Don't paragraph-wrap fosterable content
2618 !! options
2619 parsoid=wt2html
2620 !! wikitext
2621 {|
2622 <td></td>
2623 <td></td>
2624
2625
2626
2627 |}
2628 !! html
2629 <table>
2630
2631 <tbody>
2632 <tr>
2633 <td></td>
2634
2635 <td></td></tr>
2636
2637
2638
2639 </tbody></table>
2640 !! end
2641
2642 !! test
2643 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2644 !! options
2645 parsoid=wt2html
2646 !! wikitext
2647 {|
2648 <td>
2649 <td>
2650 </td>
2651
2652
2653
2654 |}
2655 !! html
2656 <table>
2657
2658 <tbody>
2659 <tr>
2660 <td></td>
2661
2662 <td>
2663 </td></tr>
2664
2665
2666
2667 </tbody></table>
2668 !! end
2669
2670
2671 #--------------------------------------------------------------------
2672 # Transclusion parameter whitespace stripping tests
2673 # Behavior is different for positional and named parameters
2674 #--------------------------------------------------------------------
2675 !! test
2676 Templates: Strip leading and trailing whitespace from named-param values
2677 !! wikitext
2678 {{echo|1= a }}
2679
2680 {{echo|1= {{echo|b}} }}
2681
2682 {{echo| 1 =
2683 c }}
2684
2685 {{echo| 1 =
2686 * d
2687 }}
2688 !! html
2689 <p>a
2690 </p><p>b
2691 </p><p>c
2692 </p>
2693 <ul><li> d</li></ul>
2694
2695 !! end
2696
2697 !! test
2698 Templates: Don't strip whitespace from positional-param values
2699 !! wikitext
2700 {{echo|a }}
2701
2702 {{echo|{{echo|b}} }}
2703
2704 {{echo| c
2705 }}
2706
2707 {{echo| {{echo|d}}
2708 }}
2709
2710 {{echo|
2711 e}}
2712
2713 {{echo|
2714 * f}}
2715
2716 {{echo|
2717 }}g
2718 !! html
2719 <p>a
2720 </p><p>b
2721 </p>
2722 <pre>c
2723 </pre>
2724 <p><br />
2725 </p>
2726 <pre>d
2727 </pre>
2728 <p><br />
2729 </p>
2730 <pre>e
2731 </pre>
2732 <p><br />
2733 </p>
2734 <ul><li> f</li></ul>
2735 <p><br />
2736 </p>
2737 <pre>g
2738 </pre>
2739 !! end
2740
2741 !! test
2742 Templates: Handle empty comment-and-ws-only lines correctly
2743 !! wikitext
2744 {{echo|foo
2745 <!--should be ignored-->
2746 <!--should be ignored as well-->
2747 bar}}
2748 !! html/php
2749 <p>foo
2750 bar
2751 </p>
2752 !! html/parsoid
2753 <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>
2754 !! end
2755
2756 !! test
2757 Templates: Handle comments in the target
2758 !! wikitext
2759 {{echo
2760 <!-- should be ignored -->
2761 |foo}}
2762
2763 {{echo
2764 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2765 |foo}}
2766
2767 {{echo<!-- should be ignored -->
2768 |foo}}
2769
2770 {{echo<!-- should be ignored -->|foo}}
2771
2772 {{<!-- should be ignored -->echo|foo}}
2773 !! html/php
2774 <p>foo
2775 </p><p>foo
2776 </p><p>foo
2777 </p><p>foo
2778 </p><p>foo
2779 </p>
2780 !! html/parsoid
2781 <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>
2782
2783 <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>
2784
2785 <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>
2786
2787 <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>
2788
2789 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2790 !!end
2791
2792 !! test
2793 Templates: Handle comments in parameter names (bug 67657)
2794 !! wikitext
2795 {{echo|1
2796 <!-- should be ignored -->
2797 =foo}}
2798
2799 {{echo|
2800 <!-- should be ignored -->
2801 1 = foo}}
2802
2803 {{echo|1<!-- should be ignored -->=foo}}
2804
2805 {{echo|<!-- should be ignored -->1=foo}}
2806 !! html/php
2807 <p>foo
2808 </p><p>foo
2809 </p><p>foo
2810 </p><p>foo
2811 </p>
2812 !! html/parsoid
2813 <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>
2814
2815 <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>
2816
2817 <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>
2818
2819 <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>
2820 !!end
2821
2822 !! test
2823 Templates: Other wikitext in parameter names (bug 67657)
2824 !! wikitext
2825 {{echo|''1''=foo}}
2826 !! html/php
2827 <p>{{{1}}}
2828 </p>
2829 !! html/parsoid
2830 <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>
2831 !!end
2832
2833 #--------------------------------------------------------------------
2834 # Transclusion parameter escaping tests
2835 #--------------------------------------------------------------------
2836 !! test
2837 Templates: Parsoid parameter escaping test 1
2838 !! wikitext
2839 {{echo|[foo]|{{echo|[bar]}}}}
2840 !! html/php+tidy
2841 <p>[foo]</p>
2842 !! html/parsoid
2843 <p about="#mwt1" typeof="mw:Transclusion"
2844 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2845 !! end
2846
2847 !! test
2848 Parsoid: Pipes in external links in template parameter
2849 !! wikitext
2850 {{echo|[{{echo|http://example.com}} link]}}
2851 !! html/php+tidy
2852 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2853 !! html/parsoid
2854 <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>
2855 !! end
2856
2857 !! test
2858 Parsoid: pipe in transclusion parameter
2859 !! wikitext
2860 {{echo|http://foo.com/a&#124;b}}
2861 !! html/php+tidy
2862 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2863 !! html/parsoid
2864 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2865 typeof="mw:Transclusion"
2866 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2867 !! end
2868
2869 !! test
2870 Parsoid: Pipe in external link target and content in template parameter
2871 !! options
2872 parsoid=html2wt,wt2wt
2873 !! wikitext
2874 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2875 !! html/php+tidy
2876 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2877 !! html/parsoid
2878 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2879 typeof="mw:Transclusion"
2880 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2881 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2882 !! end
2883
2884 !! test
2885 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2886 !! options
2887 parsoid
2888 !! wikitext
2889 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2890 !! html
2891 <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>
2892 !! end
2893
2894 !! test
2895 Templates: Don't escape already nowiki-escaped text in template parameters
2896 !! options
2897 parsoid=html2wt,wt2wt
2898 !! wikitext
2899 {{echo|foo<nowiki>|</nowiki>bar}}
2900 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2901 {{echo|<nowiki></nowiki>}}
2902 !! html/php+tidy
2903 <p>foo|bar &lt;div&gt;</p>
2904 !! html/parsoid
2905 <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>
2906 <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>
2907 <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>
2908 </p>
2909 !! end
2910
2911 ## Bug 52824
2912 !! test
2913 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2914 !! options
2915 parsoid=html2wt,wt2wt
2916 !! wikitext
2917 {{echo|{{echo|1=bar}}}}
2918 !! html/php+tidy
2919 <p>bar</p>
2920 !! html/parsoid
2921 <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>
2922 !! end
2923
2924 ## Bug 56733
2925 !! test
2926 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2927 !! wikitext
2928 {{echo|a : b}}
2929 !! html/php+tidy
2930 <p>a&#160;: b</p>
2931 !! html/parsoid
2932 <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>
2933 !! end
2934
2935 ## Bug T73412
2936 !! test
2937 Templates: Preserve blank parameter names
2938 !! wikitext
2939 {{echo|=foo}}
2940 !! html/php+tidy
2941 <p>{{{1}}}</p>
2942 !! html/parsoid
2943 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2944 !! end
2945
2946 !! test
2947 Templates: Preserve blank parameter names in other positions
2948 !! wikitext
2949 {{blank_param|bar|=foo}}
2950 !! html/php+tidy
2951 <p>bar foo</p>
2952 !! html/parsoid
2953 <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
2954 foo</p>
2955 !! end
2956
2957 ###
2958 ### Parsoid-centric tests for testing RT edge cases for pre
2959 ###
2960
2961 !!test
2962 1a. Indent-Pre and Comments
2963 !! wikitext
2964 a
2965 <!--a-->
2966 c
2967 !! html
2968 <pre>a
2969 </pre>
2970 <p>c
2971 </p>
2972 !!end
2973
2974 !!test
2975 1b. Indent-Pre and Comments
2976 !! wikitext
2977 a
2978 <!--a-->
2979 c
2980 !! html
2981 <pre>a
2982 </pre>
2983 <p>c
2984 </p>
2985 !!end
2986
2987 !!test
2988 1c. Indent-Pre and Comments
2989 !! wikitext
2990 <!--a--> a
2991
2992 <!--a--> a
2993 !! html
2994 <pre> a
2995 </pre>
2996 <pre> a
2997 </pre>
2998 !!end
2999
3000 !!test
3001 1d. Indent-Pre and Comments
3002 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3003 !! wikitext
3004 <!--a--> a
3005
3006 <!--b-->b
3007 !! html
3008 <pre>a
3009 </pre>
3010 <pre>b
3011 </pre>
3012 !!end
3013
3014 !!test
3015 2a. Indent-Pre and tables
3016 !! wikitext
3017 {|
3018 |-
3019 !h1!!h2
3020 |foo||bar
3021 |}
3022 !! html
3023 <table>
3024
3025 <tr>
3026 <th>h1</th>
3027 <th>h2
3028 </th>
3029 <td>foo</td>
3030 <td>bar
3031 </td></tr></table>
3032
3033 !!end
3034
3035 !!test
3036 2b. Indent-Pre and tables
3037 !! wikitext
3038 {|
3039 |-
3040 |foo
3041 |}
3042 !! html
3043 <table>
3044
3045 <tr>
3046 <td>foo
3047 </td></tr></table>
3048
3049 !!end
3050
3051 !!test
3052 2c. Indent-Pre and tables (bug 42252)
3053 !! wikitext
3054 {|
3055 |+ foo
3056 ! | bar
3057 |}
3058 !! html
3059 <table>
3060 <caption> foo
3061 </caption>
3062 <tr>
3063 <th> bar
3064 </th></tr></table>
3065
3066 !!end
3067
3068 !!test
3069 2d. Indent-Pre and tables
3070 !! wikitext
3071 a
3072 {|
3073 | b
3074 |}
3075 !! html/php
3076 <pre>a
3077 </pre>
3078 <table>
3079 <tr>
3080 <td> b
3081 </td></tr></table>
3082
3083 !! html/parsoid
3084 <pre>a</pre>
3085 <table>
3086 <tbody><tr><td> b</td></tr>
3087 </tbody></table>
3088 !!end
3089
3090 !!test
3091 2e. Indent-Pre and table-line syntax
3092 !! wikitext
3093 a
3094 | b
3095 | c
3096 !! html/php
3097 <pre>a
3098 | b
3099 | c
3100 </pre>
3101 !!end
3102
3103 !!test
3104 2f. Indent-pre started by table-line syntax
3105 !! wikitext
3106 a
3107 | b
3108 | c
3109 !! html/php
3110 <p>a
3111 </p>
3112 <pre>| b
3113 | c
3114 </pre>
3115 !! html/parsoid
3116 <p>a</p>
3117 <pre>
3118 | b
3119 | c</pre>
3120 !!end
3121
3122 !! test
3123 2g. Indented table markup mixed with indented pre content (proposed in bug 6200)
3124 !! wikitext
3125 <table>
3126 <tr>
3127 <td>
3128 Text that should be rendered preformatted
3129 </td>
3130 </tr>
3131 </table>
3132 !! html
3133 <table>
3134 <tr>
3135 <td>
3136 <pre>Text that should be rendered preformatted
3137 </pre>
3138 </td>
3139 </tr>
3140 </table>
3141
3142 !! end
3143
3144 !!test
3145 3a. Indent-Pre and block tags (single-line html)
3146 !! wikitext
3147 a <p> foo </p>
3148 b <div> foo </div>
3149 c <blockquote> foo </blockquote>
3150 <span> foo </span>
3151 !! html
3152 a <p> foo </p>
3153 b <div> foo </div>
3154 c <blockquote> foo </blockquote>
3155 <pre><span> foo </span>
3156 </pre>
3157 !! html/parsoid
3158 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3159 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3160 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3161 <pre><span> foo </span>
3162 </pre>
3163 !! html+tidy
3164 <p>a</p>
3165 <p>foo</p>
3166 <p>b</p>
3167 <div>foo</div>
3168 <p>c</p>
3169 <blockquote>
3170 <p>foo</p>
3171 </blockquote>
3172 <pre>
3173 <span> foo </span>
3174 </pre>
3175 !! end
3176
3177 !!test
3178 3b. Indent-Pre and block tags (multi-line html)
3179 !! wikitext
3180 a <span>foo</span>
3181 b <div> foo </div>
3182 !! html
3183 <pre>a <span>foo</span>
3184 </pre>
3185 b <div> foo </div>
3186
3187 !! html/parsoid
3188 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3189 b <div data-parsoid='{"stx":"html"}'> foo </div>
3190 !! html+tidy
3191 <pre>
3192 a <span>foo</span>
3193 </pre>
3194 <p>b</p>
3195 <div>foo</div>
3196 !!end
3197
3198 !!test
3199 3c. Indent-Pre and block tags (pre-content on separate line)
3200 !! wikitext
3201 <p>
3202 foo
3203 </p>
3204
3205 <div>
3206 foo
3207 </div>
3208
3209 <center>
3210 foo
3211 </center>
3212
3213 <blockquote>
3214 foo
3215 </blockquote>
3216
3217 <blockquote>
3218 <pre>
3219 foo
3220 </pre>
3221 </blockquote>
3222
3223 <table><tr><td>
3224 foo
3225 </td></tr></table>
3226
3227 <ul><li>
3228 foo
3229 </li></ul>
3230
3231 !! html
3232 <p>
3233 foo
3234 </p>
3235 <div>
3236 <pre>foo
3237 </pre>
3238 </div>
3239 <center>
3240 <pre>foo
3241 </pre>
3242 </center>
3243 <blockquote>
3244 <p> foo
3245 </p>
3246 </blockquote>
3247 <blockquote>
3248 <pre>
3249 foo
3250 </pre>
3251 </blockquote>
3252 <table><tr><td>
3253 <pre>foo
3254 </pre>
3255 </td></tr></table>
3256 <ul><li>
3257 foo
3258 </li></ul>
3259
3260 !!end
3261
3262 !! test
3263 4. Indent-Pre and extension tags
3264 !! wikitext
3265 a <tag />
3266 !! html/php
3267 a <pre>
3268 NULL
3269 array (
3270 )
3271 </pre>
3272
3273 !! html/parsoid
3274 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3275 !! end
3276
3277 !!test
3278 Render paragraphs when indent-pre is suppressed in blocklevels
3279 !! wikitext
3280 <blockquote>
3281 foo
3282
3283 bar
3284 </blockquote>
3285 !! html
3286 <blockquote>
3287 <p> foo
3288 </p><p> bar
3289 </p>
3290 </blockquote>
3291
3292 !!end
3293
3294 !!test
3295 4. Multiple spaces at start-of-line
3296 !! wikitext
3297 <p> foo </p>
3298 foo
3299 {|
3300 |foo
3301 |}
3302 !! html
3303 <p> foo </p>
3304 <pre> foo
3305 </pre>
3306 <table>
3307 <tr>
3308 <td>foo
3309 </td></tr></table>
3310
3311 !!end
3312
3313 ## NOTE: the leading white-space chars on empty line are significant
3314 !! test
3315 5a. White-space in indent-pre
3316 !! wikitext
3317 a<br />
3318
3319 b
3320 !! html
3321 <pre>a<br />
3322
3323 b
3324 </pre>
3325 !! end
3326
3327 ## NOTE: the leading white-space chars on empty line are significant
3328 !! test
3329 5b. White-space in indent-pre
3330 !! wikitext
3331 a
3332
3333 b
3334
3335
3336 c
3337 !! html
3338 <pre>a
3339
3340 b
3341
3342
3343 c
3344 </pre>
3345 !! end
3346
3347 !! test
3348 5c. White-space in indent-pre
3349 !! wikitext
3350 ''a''
3351 ''b''
3352 ''c''
3353 !! html
3354 <pre><i>a</i>
3355 <i>b</i>
3356 <i>c</i>
3357 </pre>
3358 !! end
3359
3360 !! test
3361 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3362 !! wikitext
3363 a
3364
3365 <!-- continue -->
3366 b
3367
3368 c
3369
3370 d
3371 !! html
3372 <pre>a
3373
3374 b
3375 </pre>
3376 <pre>c
3377
3378 </pre>
3379 <p>d
3380 </p>
3381 !! end
3382
3383 !! test
3384 7a. Indent-pre and category links
3385 !! options
3386 parsoid=wt2html,wt2wt
3387 !! wikitext
3388 [[Category:foo]] <!-- No pre-wrapping -->
3389 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3390 !! html/php+tidy
3391 !! html/parsoid
3392 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3393 <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 -->
3394 !! end
3395
3396 ## We used to, but no longer wt2wt this test since the default serializer
3397 ## will normalize all categories to serialize on their own line.
3398 ## This wikitext usage is going to be fairly uncommon in production and
3399 ## selser will take care of preserving formatting in those scenarios.
3400 !! test
3401 7b. Indent-pre and category links
3402 !! options
3403 parsoid=wt2html
3404 !! wikitext
3405 [[Category:foo]] a
3406 [[Category:foo]] {{echo|b}}
3407 !! html/parsoid
3408 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3409 <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>
3410 !! end
3411
3412 !! test
3413 Indent-Pre: Newlines in comments shouldn't affect sol state
3414 !! wikitext
3415 a <!--
3416 foo
3417 --> b
3418 !! html/php+tidy
3419 <p>a b</p>
3420 !! html/parsoid
3421 <p>a <!--
3422 foo
3423 --> b</p>
3424 !! end
3425
3426 ###
3427 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3428 ###
3429
3430 !!test
3431 HTML-pre: 1. embedded newlines
3432 !! wikitext
3433 <pre>foo</pre>
3434
3435 <pre>
3436 foo
3437 </pre>
3438
3439 <pre>
3440
3441 foo
3442 </pre>
3443
3444 <pre>
3445
3446
3447 foo
3448 </pre>
3449 !! html/php+tidy
3450 <pre>
3451 foo
3452 </pre>
3453 <pre>
3454 foo
3455 </pre>
3456 <pre>
3457
3458 foo
3459 </pre>
3460 <pre>
3461
3462
3463 foo
3464 </pre>
3465 !! html/parsoid
3466 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3467
3468 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3469 foo
3470 </pre>
3471
3472 <pre data-parsoid='{"stx":"html"}'>
3473
3474 foo
3475 </pre>
3476
3477 <pre data-parsoid='{"stx":"html"}'>
3478
3479
3480 foo
3481 </pre>
3482 !!end
3483
3484 !! test
3485 HTML-pre: big spaces
3486 !! wikitext
3487 <pre>
3488
3489
3490
3491
3492 haha
3493
3494
3495
3496
3497 haha
3498
3499
3500
3501
3502 </pre>
3503 !! html/php+tidy
3504 <pre>
3505
3506
3507
3508
3509 haha
3510
3511
3512
3513
3514 haha
3515
3516
3517
3518
3519 </pre>
3520 !! html/parsoid
3521 <pre data-parsoid='{"stx":"html"}'>
3522
3523
3524
3525
3526 haha
3527
3528
3529
3530
3531 haha
3532
3533
3534
3535
3536 </pre>
3537 !! end
3538
3539 !!test
3540 HTML-pre: 2: indented text
3541 !! wikitext
3542 <pre>
3543 foo
3544 </pre>
3545 !! html
3546 <pre>
3547 foo
3548 </pre>
3549
3550 !!end
3551
3552 !!test
3553 HTML-pre: 3: other wikitext
3554 !! wikitext
3555 <pre>
3556 * foo
3557 # bar
3558 = no-h =
3559 '' no-italic ''
3560 [[ NoLink ]]
3561 </pre>
3562 !! html/php
3563 <pre>
3564 * foo
3565 # bar
3566 = no-h =
3567 '' no-italic ''
3568 [[ NoLink ]]
3569 </pre>
3570
3571 !! html/parsoid
3572 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3573 # bar
3574 = no-h =
3575 '' no-italic ''
3576 [[ NoLink ]]
3577 </pre>
3578 !!end
3579
3580 ###
3581 ### Definition lists
3582 ###
3583 !! test
3584 Simple definition
3585 !! wikitext
3586 ; name : Definition
3587 !! html
3588 <dl><dt> name&#160;</dt>
3589 <dd> Definition</dd></dl>
3590
3591 !! end
3592
3593 !! test
3594 Definition list for indentation only
3595 !! wikitext
3596 : Indented text
3597 !! html
3598 <dl><dd> Indented text</dd></dl>
3599
3600 !! end
3601
3602 !! test
3603 Definition list with no space
3604 !! wikitext
3605 ;name:Definition
3606 !! html
3607 <dl><dt>name</dt>
3608 <dd>Definition</dd></dl>
3609
3610 !!end
3611
3612 !! test
3613 Definition list with URL link
3614 !! wikitext
3615 ; http://example.com/ : definition
3616 !! html
3617 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3618 <dd> definition</dd></dl>
3619
3620 !! end
3621
3622 !! test
3623 Definition list with bracketed URL link
3624 !! wikitext
3625 ;[http://www.example.com/ Example]:Something about it
3626 !! html
3627 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3628 <dd>Something about it</dd></dl>
3629
3630 !! end
3631
3632 !! test
3633 Definition list with wikilink containing colon
3634 !! wikitext
3635 ; [[Help:FAQ]]: The least-read page on Wikipedia
3636 !! html
3637 <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>
3638 <dd> The least-read page on Wikipedia</dd></dl>
3639
3640 !! end
3641
3642 # At Brion's and JeLuF's insistence... :)
3643 !! test
3644 Definition list with news link containing colon
3645 !! wikitext
3646 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3647 !! html/php
3648 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3649 <dd> This isn't even a real newsgroup!</dd></dl>
3650
3651 !! html/parsoid
3652 <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>
3653 !! end
3654
3655 !! test
3656 Malformed definition list with colon
3657 !! wikitext
3658 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3659 !! html
3660 <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>
3661
3662 !! end
3663
3664 !! test
3665 Definition lists: colon in external link text
3666 !! wikitext
3667 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3668 !! html
3669 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3670 <dd> OK, I made that up</dd></dl>
3671
3672 !! end
3673
3674 !! test
3675 Definition lists: colon in HTML attribute
3676 !! wikitext
3677 ;<b style="display: inline">bold</b>
3678 !! html
3679 <dl><dt><b style="display: inline">bold</b></dt></dl>
3680
3681 !! end
3682
3683 !! test
3684 Definition lists: self-closed tag
3685 !! wikitext
3686 ;one<br/>two : two-line fun
3687 !! html
3688 <dl><dt>one<br />two&#160;</dt>
3689 <dd> two-line fun</dd></dl>
3690
3691 !! end
3692
3693 !! test
3694 Bug 11748: Literal closing tags
3695 !! wikitext
3696 <dl>
3697 <dt>test 1</dt>
3698 <dd>test test test test test</dd>
3699 <dt>test 2</dt>
3700 <dd>test test test test test</dd>
3701 </dl>
3702 !! html
3703 <dl>
3704 <dt>test 1</dt>
3705 <dd>test test test test test</dd>
3706 <dt>test 2</dt>
3707 <dd>test test test test test</dd>
3708 </dl>
3709
3710 !! end
3711
3712 !! test
3713 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3714 !! wikitext
3715 <ul><li>
3716 ; term : description
3717 * unordered
3718 </li></ul>
3719 !! html
3720 <ul><li>
3721 <dl><dt> term&#160;</dt>
3722 <dd> description</dd></dl>
3723 <ul><li> unordered</li></ul>
3724 </li></ul>
3725
3726 !! end
3727
3728 !! test
3729 Definition list with empty definition and following paragraph
3730 !! wikitext
3731 ; term:
3732 Paragraph text
3733 !! html
3734 <dl><dt> term</dt>
3735 <dd></dd></dl>
3736 <p>Paragraph text
3737 </p>
3738 !! end
3739
3740 !! test
3741 Nested definition lists using html syntax
3742 !! wikitext
3743 <dl><dt>x</dt>
3744 <dd>a</dd>
3745 <dd>b</dd></dl>
3746 !! html
3747 <dl><dt>x</dt>
3748 <dd>a</dd>
3749 <dd>b</dd></dl>
3750
3751 !! end
3752
3753 !! test
3754 Definition Lists: No nesting: Multiple dd's
3755 !! wikitext
3756 ;x
3757 :a
3758 :b
3759 !! html
3760 <dl><dt>x</dt>
3761 <dd>a</dd>
3762 <dd>b</dd></dl>
3763
3764 !! end
3765
3766 !! test
3767 Definition Lists: Indentation: Regular
3768 !! wikitext
3769 :i1
3770 ::i2
3771 :::i3
3772 !! html
3773 <dl><dd>i1
3774 <dl><dd>i2
3775 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3776
3777 !! end
3778
3779 !! test
3780 Definition Lists: Indentation: Missing 1st level
3781 !! wikitext
3782 ::i2
3783 :::i3
3784 !! html
3785 <dl><dd><dl><dd>i2
3786 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3787
3788 !! end
3789
3790 !! test
3791 Definition Lists: Indentation: Multi-level indent
3792 !! wikitext
3793 :::i3
3794 !! html
3795 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3796
3797 !! end
3798
3799 !! test
3800 Definition Lists: Hacky use to indent tables
3801 !! wikitext
3802 ::{|
3803 |foo
3804 |bar
3805 |}
3806 this text
3807 should be left alone
3808 !! html
3809 <dl><dd><dl><dd><table>
3810 <tr>
3811 <td>foo
3812 </td>
3813 <td>bar
3814 </td></tr></table></dd></dl></dd></dl>
3815 <p>this text
3816 should be left alone
3817 </p>
3818 !! end
3819
3820 !! test
3821 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3822 !! wikitext
3823 <!-- foo -->
3824 ::{|
3825 |foo
3826 |bar
3827 |}<!-- bar -->
3828 this text
3829 should be left alone
3830 !! html/parsoid
3831 <!-- foo -->
3832 <dl><dd><dl><dd><table><tr>
3833 <td>foo</td>
3834 <td>bar</td>
3835 </tr></table><!-- bar --></dd></dl></dd></dl>
3836 <p>this text
3837 should be left alone</p>
3838 !! end
3839
3840 !! test
3841 Definition Lists: Hacky use to indent tables, with comment before table
3842 !! wikitext
3843 ::<!-- foo -->{|
3844 |foo
3845 |}
3846 !! html/parsoid
3847 <dl><dd><dl><dd><!-- foo --><table><tr>
3848 <td>foo</td>
3849 </tr></table></dd></dl></dd></dl>
3850 !! end
3851
3852 # The trailing whitespace in this test is to catch a regression in
3853 # Parsoid after T54473.
3854 !! test
3855 Definition Lists: Hacky use to indent tables (WS-insensitive)
3856 !! wikitext
3857 : {|
3858 |a
3859 |}
3860 !! html/php
3861 <dl><dd><table>
3862 <tr>
3863 <td>a
3864 </td></tr></table></dd></dl>
3865
3866 !! html/parsoid
3867 <dl><dd> <table>
3868 <tbody><tr><td>a</td></tr>
3869 </tbody></table> </dd></dl>
3870 !! end
3871
3872 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3873 ## as an empty dt item. It also ignores all but the last ";" when followed
3874 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3875 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3876 ## ";"s.
3877 ##
3878 ## Ex: ";;t2 ::d2" is transformed into:
3879 ##
3880 ## <dl>
3881 ## <dt>t2 </dt>
3882 ## <dd>
3883 ## <dl>
3884 ## <dt></dt>
3885 ## <dd>d2</dd>
3886 ## </dl>
3887 ## </dd>
3888 ## </dl>
3889 ##
3890 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3891 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3892 ##
3893 ## <dl>
3894 ## <dt>
3895 ## <dl>
3896 ## <dt>t2 </dt>
3897 ## <dd>:d2</dd>
3898 ## </dl>
3899 ## </dt>
3900 ## </dl>
3901 ##
3902 ## All Parsoid only definition list tests have this difference.
3903 ##
3904 ## See also: https://phabricator.wikimedia.org/T8569
3905 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3906
3907 !! test
3908 Table / list interaction: indented table with lists in table contents
3909 !! wikitext
3910 :{|
3911 |-
3912 | a
3913 * b
3914 |-
3915 | c
3916 * d
3917 |}
3918 !! html
3919 <dl><dd><table>
3920
3921 <tr>
3922 <td> a
3923 <ul><li> b</li></ul>
3924 </td></tr>
3925 <tr>
3926 <td> c
3927 <ul><li> d</li></ul>
3928 </td></tr></table></dd></dl>
3929
3930 !! end
3931
3932 !!test
3933 Table / list interaction: lists nested in tables nested in indented lists
3934 !! wikitext
3935 :{|
3936 |
3937 :a
3938 :b
3939 |
3940 *c
3941 *d
3942 |}
3943
3944 *e
3945 *f
3946 !! html
3947 <dl><dd><table>
3948 <tr>
3949 <td>
3950 <dl><dd>a</dd>
3951 <dd>b</dd></dl>
3952 </td>
3953 <td>
3954 <ul><li>c</li>
3955 <li>d</li></ul>
3956 </td></tr></table></dd></dl>
3957 <ul><li>e</li>
3958 <li>f</li></ul>
3959
3960 !!end
3961
3962 !! test
3963 Definition Lists: Nesting: Multi-level (Parsoid only)
3964 !! options
3965 parsoid
3966 !! wikitext
3967 ;t1 :d1
3968 ;;t2 ::d2
3969 ;;;t3 :::d3
3970 !! html
3971 <dl>
3972 <dt>t1 </dt>
3973 <dd>d1</dd>
3974 <dt>
3975 <dl>
3976 <dt>t2 </dt>
3977 <dd>:d2</dd>
3978 <dt>
3979 <dl>
3980 <dt>t3 </dt>
3981 <dd>::d3</dd>
3982 </dl>
3983 </dt>
3984 </dl>
3985 </dt>
3986 </dl>
3987
3988
3989 !! end
3990
3991
3992 !! test
3993 Definition Lists: Nesting: Test 2 (Parsoid only)
3994 !! wikitext
3995 ;t1
3996 ::d2
3997 !! html/php+tidy
3998 <dl>
3999 <dt>t1</dt>
4000 <dd>
4001 <dl>
4002 <dd>d2</dd>
4003 </dl>
4004 </dd>
4005 </dl>
4006 !! html/parsoid
4007 <dl>
4008 <dt>t1</dt>
4009 <dd>
4010 <dl>
4011 <dd>d2</dd>
4012 </dl>
4013 </dd>
4014 </dl>
4015
4016 !! end
4017
4018
4019 !! test
4020 Definition Lists: Nesting: Test 3 (Parsoid only)
4021 !! wikitext
4022 :;t1
4023 ::::d2
4024 !! html/php+tidy
4025 <dl>
4026 <dd>
4027 <dl>
4028 <dt>t1</dt>
4029 <dd>
4030 <dl>
4031 <dd>
4032 <dl>
4033 <dd>d2</dd>
4034 </dl>
4035 </dd>
4036 </dl>
4037 </dd>
4038 </dl>
4039 </dd>
4040 </dl>
4041 !! html/parsoid
4042 <dl>
4043 <dd>
4044 <dl>
4045 <dt>t1</dt>
4046 <dd>
4047 <dl>
4048 <dd>
4049 <dl>
4050 <dd>d2</dd>
4051 </dl>
4052 </dd>
4053 </dl>
4054 </dd>
4055 </dl>
4056 </dd>
4057 </dl>
4058
4059 !! end
4060
4061
4062 !! test
4063 Definition Lists: Nesting: Test 4
4064 !! wikitext
4065 ::;t3
4066 :::d3
4067 !! html
4068 <dl><dd><dl><dd><dl><dt>t3</dt>
4069 <dd>d3</dd></dl></dd></dl></dd></dl>
4070
4071 !! end
4072
4073
4074 ## The Parsoid team believes the following three test exposes a
4075 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4076 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4077 ## It also exposes a "misfeature" in tidy, which doesn't like
4078 ## <dl> tags with a single <dt> child; it converts the <dt> into
4079 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4080 !! test
4081 Definition Lists: Mixed Lists: Test 1
4082 !! wikitext
4083 :;* foo
4084 ::* bar
4085 :; baz
4086 !! html/php
4087 <dl><dd><dl><dt><ul><li> foo</li>
4088 <li> bar</li></ul></dt></dl>
4089 <dl><dt> baz</dt></dl></dd></dl>
4090
4091 !! html/php+tidy
4092 <dl>
4093 <dd>
4094 <dl>
4095 <dd>
4096 <ul>
4097 <li>foo</li>
4098 <li>bar</li>
4099 </ul>
4100 </dd>
4101 </dl>
4102 <dl>
4103 <dt>baz</dt>
4104 </dl>
4105 </dd>
4106 </dl>
4107 !! html/parsoid
4108 <dl>
4109 <dd><dl>
4110 <dt><ul>
4111 <li> foo
4112 </li>
4113 </ul></dt>
4114 <dd><ul>
4115 <li> bar
4116 </li>
4117 </ul></dd>
4118 <dt> baz</dt>
4119 </dl></dd>
4120 </dl>
4121 !! end
4122
4123 !! test
4124 Definition Lists: Mixed Lists: Test 2
4125 !! wikitext
4126 *: d1
4127 *: d2
4128 !! html
4129 <ul><li><dl><dd> d1</dd>
4130 <dd> d2</dd></dl></li></ul>
4131
4132 !! end
4133
4134
4135 !! test
4136 Definition Lists: Mixed Lists: Test 3
4137 !! wikitext
4138 *::: d1
4139 *::: d2
4140 !! html
4141 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4142 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4143
4144 !! end
4145
4146
4147 !! test
4148 Definition Lists: Mixed Lists: Test 4
4149 !! wikitext
4150 *;d1 :d2
4151 *;d3 :d4
4152 !! html
4153 <ul><li><dl><dt>d1&#160;</dt>
4154 <dd>d2</dd>
4155 <dt>d3&#160;</dt>
4156 <dd>d4</dd></dl></li></ul>
4157
4158 !! end
4159
4160
4161 !! test
4162 Definition Lists: Mixed Lists: Test 5
4163 !! wikitext
4164 *:d1
4165 *:: d2
4166 !! html
4167 <ul><li><dl><dd>d1
4168 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4169
4170 !! end
4171
4172
4173 !! test
4174 Definition Lists: Mixed Lists: Test 6
4175 !! wikitext
4176 #*:d1
4177 #*::: d3
4178 !! html
4179 <ol><li><ul><li><dl><dd>d1
4180 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4181
4182 !! end
4183
4184
4185 !! test
4186 Definition Lists: Mixed Lists: Test 7
4187 !! wikitext
4188 :* d1
4189 :* d2
4190 !! html
4191 <dl><dd><ul><li> d1</li>
4192 <li> d2</li></ul></dd></dl>
4193
4194 !! end
4195
4196
4197 !! test
4198 Definition Lists: Mixed Lists: Test 8
4199 !! wikitext
4200 :* d1
4201 ::* d2
4202 !! html
4203 <dl><dd><ul><li> d1</li></ul>
4204 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4205
4206 !! end
4207
4208
4209 !! test
4210 Definition Lists: Mixed Lists: Test 9
4211 !! wikitext
4212 *;foo :bar
4213 !! html
4214 <ul><li><dl><dt>foo&#160;</dt>
4215 <dd>bar</dd></dl></li></ul>
4216
4217 !! end
4218
4219
4220 !! test
4221 Definition Lists: Mixed Lists: Test 10
4222 !! wikitext
4223 *#;foo :bar
4224 !! html
4225 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4226 <dd>bar</dd></dl></li></ol></li></ul>
4227
4228 !! end
4229
4230 # The Parsoid team disagrees with the PHP parser's seemingly-random
4231 # rules regarding dd/dt on the next two tests. Parsoid is more
4232 # consistent, and recognizes the shared nesting and keeps the
4233 # still-open tags around until the nesting is complete.
4234 # (And tidy again converts <dt> to <dd> before 'bar'.)
4235
4236 !! test
4237 Definition Lists: Mixed Lists: Test 11
4238 !! wikitext
4239 *#*#;*;;foo :bar
4240 *#*#;boo :baz
4241 !! html/php
4242 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4243 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4244 <dl><dt>boo&#160;</dt>
4245 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4246
4247 !! html/php+tidy
4248 <ul>
4249 <li>
4250 <ol>
4251 <li>
4252 <ul>
4253 <li>
4254 <ol>
4255 <li>
4256 <dl>
4257 <dt>foo&#160;</dt>
4258 <dd>
4259 <ul>
4260 <li>
4261 <dl>
4262 <dd>
4263 <dl>
4264 <dt>bar</dt>
4265 </dl>
4266 </dd>
4267 </dl>
4268 </li>
4269 </ul>
4270 </dd>
4271 </dl>
4272 <dl>
4273 <dt>boo&#160;</dt>
4274 <dd>baz</dd>
4275 </dl>
4276 </li>
4277 </ol>
4278 </li>
4279 </ul>
4280 </li>
4281 </ol>
4282 </li>
4283 </ul>
4284 !! html/parsoid
4285 <ul>
4286 <li>
4287 <ol>
4288 <li>
4289 <ul>
4290 <li>
4291 <ol>
4292 <li>
4293 <dl>
4294 <dt>
4295 <ul>
4296 <li>
4297 <dl>
4298 <dt>
4299 <dl>
4300 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4301 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4302 </dl></dt>
4303 </dl></li>
4304 </ul></dt>
4305 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4306 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4307 </dl></li>
4308 </ol></li>
4309 </ul></li>
4310 </ol></li>
4311 </ul>
4312 !! end
4313
4314
4315 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4316 # From whitelist:
4317 # * The test is wrong, there are two colons where there should be :;
4318 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4319 !! test
4320 Definition Lists: Weird Ones: Test 1
4321 !! wikitext
4322 *#;*::;; foo : bar (who uses this?)
4323 !! html/php
4324 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4325 <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>
4326
4327 !! html/php+tidy
4328 <ul>
4329 <li>
4330 <ol>
4331 <li>
4332 <dl>
4333 <dt>foo&#160;</dt>
4334 <dd>
4335 <ul>
4336 <li>
4337 <dl>
4338 <dd>
4339 <dl>
4340 <dd>
4341 <dl>
4342 <dd>
4343 <dl>
4344 <dt>bar (who uses this?)</dt>
4345 </dl>
4346 </dd>
4347 </dl>
4348 </dd>
4349 </dl>
4350 </dd>
4351 </dl>
4352 </li>
4353 </ul>
4354 </dd>
4355 </dl>
4356 </li>
4357 </ol>
4358 </li>
4359 </ul>
4360 !! html/parsoid
4361 <ul>
4362 <li>
4363 <ol>
4364 <li>
4365 <dl>
4366 <dt>
4367 <ul>
4368 <li>
4369 <dl>
4370 <dd>
4371 <dl>
4372 <dd>
4373 <dl>
4374 <dt>
4375 <dl>
4376 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4377 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4378 </dl></dt>
4379 </dl></dd>
4380 </dl></dd>
4381 </dl></li>
4382 </ul></dt>
4383 </dl></li>
4384 </ol></li>
4385 </ul>
4386 !! end
4387
4388 !! test
4389 Definition Lists: colons occurring in tags
4390 !! wikitext
4391 ;a:b
4392 ;'''a:b'''
4393 ;<i>a:b</i>
4394 ;<span>a:b</span>
4395 ;<div>a:b</div>
4396 ;<div>a
4397 :b</div>
4398 ;{{echo|a:b}}
4399 ;{{echo|''a:b''}}
4400 ;;;''a:b''
4401 !! html+tidy
4402 <dl>
4403 <dt>a</dt>
4404 <dd>b</dd>
4405 <dt><b>a:b</b></dt>
4406 <dt><i>a:b</i></dt>
4407 <dt><span>a:b</span></dt>
4408 <dd>
4409 <div>a:b</div>
4410 </dd>
4411 <dd>
4412 <div>a
4413 <dl>
4414 <dd>b</dd>
4415 </dl>
4416 </div>
4417 </dd>
4418 <dt>a</dt>
4419 <dd>b</dd>
4420 <dt><i>a:b</i></dt>
4421 </dl>
4422 <dl>
4423 <dd>
4424 <dl>
4425 <dd>
4426 <dl>
4427 <dt><i>a:b</i></dt>
4428 </dl>
4429 </dd>
4430 </dl>
4431 </dd>
4432 </dl>
4433 !! html/parsoid
4434 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4435 <dt><b>a:b</b></dt>
4436 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4437 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4438 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4439 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4440 <dd>b</dd>
4441 <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>
4442 <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>
4443 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4444 !! end
4445
4446 !! test
4447 Definition Lists: colons and tables 1
4448 !! wikitext
4449 :{|
4450 | x
4451 |}
4452 :{|
4453 | y
4454 |}
4455 !! html
4456 <dl><dd><table>
4457 <tr>
4458 <td> x
4459 </td></tr></table></dd></dl>
4460 <dl><dd><table>
4461 <tr>
4462 <td> y
4463 </td></tr></table></dd></dl>
4464
4465 !! end
4466
4467 # Parsoid's output (as documented below) differs from php's in this case.
4468 # This is probably a bug. If we fixup parsoid to match php's output, the
4469 # above test should pass and the below test case can be removed. It is
4470 # unclear which output is more desirable.
4471
4472 !! test
4473 Definition Lists: colons and tables 2
4474 !! wikitext
4475 :{|
4476 | x
4477 |}
4478 :{|
4479 | y
4480 |}
4481 !! html/parsoid
4482 <dl><dd><table>
4483 <tr>
4484 <td> x
4485 </td></tr></table></dd>
4486 <dd><table>
4487 <tr>
4488 <td> y
4489 </td></tr></table></dd></dl>
4490 !! end
4491
4492 !! test
4493 Definition Lists: template interaction
4494 !! wikitext
4495 ::{{definition_list}}
4496
4497 :one
4498 ::{{definition_list}}
4499 :::two
4500 :::three
4501 ::four
4502 !! html/parsoid
4503 <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">
4504 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4505
4506 <dl><dd data-parsoid='{}'>one
4507 <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">
4508 </span><dd about="#mwt2">two
4509 <dl><dd>two</dd>
4510 <dd>three</dd></dl></dd>
4511 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4512 !! end
4513
4514
4515 ###
4516 ### External links
4517 ###
4518 !! test
4519 External links: non-bracketed
4520 !! wikitext
4521 Non-bracketed: http://example.com
4522 !! html
4523 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4524 </p>
4525 !! end
4526
4527 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4528 !! test
4529 External links: numbered
4530 !! wikitext
4531 Numbered: [http://example.com]
4532 Numbered: [http://example.net]
4533 Numbered: [http://example.com]
4534 !! html/php
4535 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4536 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4537 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4538 </p>
4539 !! html/parsoid
4540 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4541 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4542 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4543 !!end
4544
4545 !! test
4546 External links: specified text
4547 !! wikitext
4548 Specified text: [http://example.com link]
4549 !! html
4550 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4551 </p>
4552 !!end
4553
4554 !! test
4555 External links: trail
4556 !! wikitext
4557 Linktrails should not work for external links: [http://example.com link]s
4558 !! html
4559 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4560 </p>
4561 !! end
4562
4563 !! test
4564 External links: dollar sign in URL
4565 !! wikitext
4566 http://example.com/1$2345
4567 !! html
4568 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4569 </p>
4570 !! end
4571
4572 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4573 !! test
4574 External links: dollar sign in URL (autonumber)
4575 !! wikitext
4576 [http://example.com/1$2345]
4577 !! html/php
4578 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4579 </p>
4580 !! html/parsoid
4581 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4582 !!end
4583
4584 !! test
4585 External links: open square bracket forbidden in URL (bug 4377)
4586 !! options
4587 parsoid=wt2html,wt2wt,html2html
4588 !! wikitext
4589 http://example.com/1[2345
4590 !! html/php
4591 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4592 </p>
4593 !! html/parsoid
4594 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4595 !! end
4596
4597 !! test
4598 External links: open square bracket forbidden in URL (named) (bug 4377)
4599 !! options
4600 parsoid=wt2html,html2html
4601 !! wikitext
4602 [http://example.com/1[2345]
4603 !! html/php
4604 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4605 </p>
4606 !! html/parsoid
4607 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4608 !!end
4609
4610 # parsoid adds a space before the link name
4611 !! test
4612 External links: open square bracket forbidden in URL (named) (bug 4377)
4613 Parsoid variant.
4614 !! wikitext
4615 [http://example.com/1 [2345]
4616 !! html
4617 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4618 </p>
4619 !!end
4620
4621 !! test
4622 External links: nowiki in URL link text (bug 6230)
4623 !! wikitext
4624 [http://example.com/ <nowiki>''example site''</nowiki>]
4625 !! html
4626 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4627 </p>
4628 !! end
4629
4630 !! test
4631 External links: newline forbidden in text (bug 6230 regression check)
4632 !! wikitext
4633 [http://example.com/ first
4634 second]
4635 !! html
4636 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4637 second]
4638 </p>
4639 !!end
4640
4641 !! test
4642 External links: Pipe char between url and text
4643 !! wikitext
4644 [http://example.com | link]
4645 !! html
4646 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4647 </p>
4648 !!end
4649
4650 !! test
4651 External links: protocol-relative URL in brackets
4652 !! wikitext
4653 [//example.com/ Test]
4654 !! html
4655 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4656 </p>
4657 !! end
4658
4659 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4660 !! test
4661 External links: protocol-relative URL in brackets without text
4662 !! wikitext
4663 [//example.com]
4664 !! html/php
4665 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4666 </p>
4667 !! html/parsoid
4668 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4669 !! end
4670
4671 !! test
4672 External links: protocol-relative URL in free text is left alone
4673 !! wikitext
4674 //example.com/Foo
4675 !! html
4676 <p>//example.com/Foo
4677 </p>
4678 !!end
4679
4680 !! test
4681 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4682 !! wikitext
4683 foo//example.com/Foo
4684 !! html
4685 <p>foo//example.com/Foo
4686 </p>
4687 !! end
4688
4689 !! test
4690 External links: with no contents
4691 !! wikitext
4692 [http://en.wikipedia.org/wiki/Foo]
4693
4694 [[wikipedia:Foo|Bar]]
4695
4696 [[wikipedia:Foo|<span>Bar</span>]]
4697 !! html/php
4698 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4699 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4700 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4701 </p>
4702 !! html/parsoid
4703 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4704 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4705 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4706 !! end
4707
4708 !! test
4709 External links: Free with trailing punctuation
4710 !! wikitext
4711 http://example.com,
4712 http://example.com;
4713 http://example.com\
4714 http://example.com.
4715 http://example.com:
4716 http://example.com!
4717 http://example.com?
4718 http://example.com)
4719 http://example.com/url_with_(brackets)
4720 (http://example.com/url_without_brackets)
4721 http://example.com/url_with_entity&amp;
4722 http://example.com/url_with_entity&#x26;
4723 http://example.com/url_with_entity&#038;
4724 http://example.com/url_with_entity&nbsp;
4725 http://example.com/url_with_entity&#xA0;
4726 http://example.com/url_with_entity&#160;
4727 http://example.com/url_with_entity&lt;
4728 http://example.com/url_with_entity&#x3C;
4729 http://example.com/url_with_entity&#60;
4730 !! html/php
4731 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4732 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4733 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4734 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4735 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4736 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4737 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4738 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4739 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4740 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4741 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4742 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4743 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4744 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4745 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4746 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4747 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4748 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4749 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4750 </p>
4751 !! html/parsoid
4752 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4753 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4754 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4755 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4756 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4757 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4758 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4759 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4760 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4761 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4762 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4763 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4764 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4765 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4766 <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>
4767 <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>
4768 <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>
4769 <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>
4770 <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>
4771 !! end
4772
4773 !! test
4774 External links: tricky Parsoid html2html case
4775 !! options
4776 parsoid=wt2html,wt2wt,html2html
4777 !! wikitext
4778 http://example.com/url_with_entity&amp;amp;
4779 !! html/php
4780 <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>;
4781 </p>
4782 !! html/parsoid
4783 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4784 !! end
4785
4786 !! test
4787 External links: Free with trailing quotes (T113666)
4788 !! wikitext
4789 '''News:''' Stuff here
4790
4791 news:'a'b''c''d e
4792 !! html/php
4793 <p><b>News:</b> Stuff here
4794 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4795 </p>
4796 !! html/parsoid
4797 <p><b>News:</b> Stuff here</p>
4798 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4799 !! end
4800
4801 !! test
4802 External links: Lone protocols are never linked (T105697)
4803 !! wikitext
4804 http://
4805 http://;
4806 (http://)
4807 bitcoin:
4808 bitcoin:;
4809 (bitcoin:)
4810 !! html
4811 <p>http://
4812 http://;
4813 (http://)
4814 bitcoin:
4815 bitcoin:;
4816 (bitcoin:)
4817 </p>
4818 !! end
4819
4820 !! test
4821 External links: No preceding word characters allowed (bug 65278)
4822 !! wikitext
4823 NOPEhttp://example.com
4824 N0http://example.com
4825 ok:http://example.com
4826 ok-http://example.com
4827 !! html
4828 <p>NOPEhttp://example.com
4829 N0http://example.com
4830 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4831 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4832 </p>
4833 !! end
4834
4835 !! test
4836 External links: nofollow domain exception
4837 !! wikitext
4838 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4839 !! html
4840 <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>.
4841 </p>
4842 !!end
4843
4844 !! test
4845 External image
4846 !! wikitext
4847 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4848 !! html
4849 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4850 </p>
4851 !! end
4852
4853 !! test
4854 External image from https
4855 !! wikitext
4856 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4857 !! html
4858 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4859 </p>
4860 !! end
4861
4862 !! test
4863 External image (when not allowed)
4864 !! options
4865 wgAllowExternalImages=0
4866 !! wikitext
4867 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4868 !! html
4869 <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>
4870 </p>
4871 !! end
4872
4873 !! test
4874 Link to non-http image, no img tag
4875 !! wikitext
4876 Link to non-http image, no img tag: ftp://example.com/test.jpg
4877 !! html
4878 <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>
4879 </p>
4880 !! end
4881
4882 !! test
4883 External links: terminating separator
4884 !! wikitext
4885 Terminating separator: http://example.com/thing,
4886 !! html
4887 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4888 </p>
4889 !! end
4890
4891 !! test
4892 External links: intervening separator
4893 !! wikitext
4894 Intervening separator: http://example.com/1,2,3
4895 !! html
4896 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4897 </p>
4898 !! end
4899
4900 !! test
4901 External links: old bug with URL in query
4902 !! wikitext
4903 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4904 !! html
4905 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4906 </p>
4907 !! end
4908
4909 !! test
4910 External links: old URL-in-URL bug, mixed protocols
4911 !! wikitext
4912 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4913 !! html
4914 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4915 </p>
4916 !!end
4917
4918 # Since Parsoid is starting to emit canonical wikitext for links,
4919 # [http://example.com http://example.com] will not RT back to that
4920 # form anymore.
4921 !! test
4922 External links: URL in text
4923 !! options
4924 parsoid=wt2html
4925 !! wikitext
4926 URL in text: [http://example.com http://example.com]
4927 !! html/php
4928 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4929 </p>
4930 !! html/parsoid
4931 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4932 !! end
4933
4934 !! test
4935 External links: Clickable images
4936 !! wikitext
4937 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4938 !! html/php
4939 <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>
4940 </p>
4941 !! html/parsoid
4942 <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>
4943 !! end
4944
4945 !! test
4946 External links: raw ampersand
4947 !! wikitext
4948 Old &amp; use: http://x&y
4949 !! html
4950 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4951 </p>
4952 !! end
4953
4954 !! test
4955 External links: encoded ampersand
4956 !! wikitext
4957 Old &amp; use: http://x&amp;y
4958 !! html/php
4959 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4960 </p>
4961 !! html/parsoid
4962 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4963 !! end
4964
4965 !! test
4966 External links: encoded equals (bug 6102)
4967 !! wikitext
4968 http://example.com/?foo&#61;bar
4969 !! html/php
4970 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4971 </p>
4972 !! html/parsoid
4973 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4974 !! end
4975
4976 ##
4977 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4978 ## does it number them. As discussed in bug 53505, we can identify
4979 ## autonumbered links via CSS.
4980 ##
4981
4982 !! test
4983 External links: [raw ampersand]
4984 !! wikitext
4985 Old &amp; use: [http://x&y]
4986 !! html/php
4987 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4988 </p>
4989 !! html/parsoid
4990 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4991 !! end
4992
4993 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4994 # mode will return the [raw ampersand] wikitext
4995 !! test
4996 External links: [encoded ampersand]
4997 !! options
4998 parsoid=wt2html,wt2wt,html2html
4999 !! wikitext
5000 Old &amp; use: [http://x&amp;y]
5001 !! html/php
5002 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5003 </p>
5004 !! html/parsoid
5005 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5006 !! end
5007
5008 !! test
5009 External links: [raw equals]
5010 !! wikitext
5011 [http://example.com/?foo=bar]
5012 !! html/php
5013 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5014 </p>
5015 !! html/parsoid
5016 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5017 !! end
5018
5019 # note that parsoid html is identical to [raw equals] case; so html2wt
5020 # mode will return the [raw equals] wikitext
5021 !! test
5022 External links: [encoded equals] (bug 6102)
5023 !! options
5024 parsoid=wt2html,wt2wt,html2html
5025 !! wikitext
5026 [http://example.com/?foo&#61;bar]
5027 !! html/php
5028 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5029 </p>
5030 !! html/parsoid
5031 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5032 !! end
5033
5034 # xxx parsoid strips the IDN character, so the round-trip tests will
5035 # obviously fail and are disabled. --cscott
5036 !! test
5037 External links: [IDN ignored character reference in hostname; strip it right off]
5038 !! options
5039 parsoid=wt2html,wt2wt,html2html
5040 !! wikitext
5041 [http://e&zwnj;xample.com/]
5042 !! html/php
5043 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5044 </p>
5045 !! html/parsoid
5046 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5047 !! end
5048
5049 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5050 # Where an external link could easily circumvent the sanitization of the text of
5051 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5052 # test demands a higher standard. That's a bit strange.
5053 #
5054 # Example:
5055 #
5056 # http://e‌xample.com -> [http://example.com|http://example.com]
5057 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5058 #
5059 # The first example is sanitized, but the second is not. Any security benefits
5060 # from this production are trivial to circumvent. Either remove this test and
5061 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5062 # the test accordingly.
5063 #
5064 # All our love,
5065 # The Parsoid team.
5066 # xxx parsoid strips the IDN character, so the round-trip tests will
5067 # obviously fail and are disabled. --cscott
5068 !! test
5069 External links: IDN ignored character reference in hostname; strip it right off
5070 !! options
5071 parsoid=wt2html,html2html
5072 !! wikitext
5073 http://e&zwnj;xample.com/
5074 !! html/php
5075 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5076 </p>
5077 !! html/parsoid
5078 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5079 !! end
5080
5081 !! test
5082 External links: www.jpeg.org (bug 554)
5083 !! wikitext
5084 http://www.jpeg.org
5085 !! html
5086 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5087 </p>
5088 !! end
5089
5090 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5091 !! test
5092 External links: URL within URL (original bug 2)
5093 !! wikitext
5094 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5095 !! html/php
5096 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5097 </p>
5098 !! html/parsoid
5099 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5100 !! end
5101
5102 !! test
5103 BUG 361: URL inside bracketed URL
5104 !! wikitext
5105 [http://www.example.com/foo http://www.example.com/bar]
5106 !! html
5107 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5108 </p>
5109 !! end
5110
5111 !! test
5112 BUG 361: URL within URL, not bracketed
5113 !! wikitext
5114 http://www.example.com/foo?=http://www.example.com/bar
5115 !! html
5116 <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>
5117 </p>
5118 !! end
5119
5120 !! test
5121 BUG 289: ">"-token in URL-tail
5122 !! wikitext
5123 http://www.example.com/<hello>
5124 !! html
5125 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5126 </p>
5127 !!end
5128
5129 !! test
5130 BUG 289: literal ">"-token in URL-tail
5131 !! wikitext
5132 http://www.example.com/<b>html</b>
5133 !! html/php
5134 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5135 </p>
5136 !! html/parsoid
5137 <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>
5138 !! end
5139
5140 !! test
5141 BUG 289: ">"-token in bracketed URL
5142 !! wikitext
5143 [http://www.example.com/<hello> stuff]
5144 !! html
5145 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5146 </p>
5147 !!end
5148
5149 !! test
5150 BUG 289: literal ">"-token in bracketed URL
5151 !! wikitext
5152 [http://www.example.com/<b>html</b> stuff]
5153 !! html
5154 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5155 </p>
5156 !!end
5157
5158 !! test
5159 BUG 289: literal double quote at end of URL
5160 !! wikitext
5161 http://www.example.com/"hello"
5162 !! html
5163 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5164 </p>
5165 !!end
5166
5167 !! test
5168 BUG 289: literal double quote in bracketed URL
5169 !! wikitext
5170 [http://www.example.com/"hello" stuff]
5171 !! html
5172 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5173 </p>
5174 !!end
5175
5176 !! test
5177 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5178 !! wikitext
5179 [http://www.example.com test]
5180 !! html
5181 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5182 </p>
5183 !! end
5184
5185 !! test
5186 External links: link text with spaces
5187 !! wikitext
5188 [http://www.example.com a b c]
5189 [http://www.example.com ''a'' ''b'']
5190 !! html
5191 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5192 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5193 </p>
5194 !! end
5195
5196 !! test
5197 External links: wiki links within external link (Bug 3695)
5198 !! options
5199 parsoid=wt2html,html2html
5200 !! wikitext
5201 [http://example.com [[wikilink]] embedded in ext link]
5202 !! html/php
5203 <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>
5204 </p>
5205 !! html/parsoid
5206 <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>
5207 !! end
5208
5209 !! test
5210 BUG 787: Links with one slash after the url protocol are invalid
5211 !! wikitext
5212 http:/example.com
5213
5214 [http:/example.com title]
5215 !! html
5216 <p>http:/example.com
5217 </p><p>[http:/example.com title]
5218 </p>
5219 !! end
5220
5221 !! test
5222 Bracketed external links with template-generated invalid target
5223 !! wikitext
5224 [{{echo|http:/example.com}} title]
5225 !! html
5226 <p>[http:/example.com title]
5227 </p>
5228 !! end
5229
5230 !! test
5231 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5232 !! wikitext
5233 ''[http://example.com text'']
5234 [http://example.com '''text]'''
5235 ''Something [http://example.com in italic'']
5236 ''Something [http://example.com mixed''''', even bold]'''
5237 '''''Now [http://example.com both''''']
5238 !! html
5239 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5240 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5241 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5242 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5243 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5244 </p>
5245 !! end
5246
5247
5248 !! test
5249 Bug 4781: %26 in URL
5250 !! wikitext
5251 http://www.example.com/?title=AT%26T
5252 !! html/php
5253 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5254 </p>
5255 !! html/parsoid
5256 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5257 !! end
5258
5259 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5260 # % is actually legal in HTML5. Any change in output would need testing though.
5261 !! test
5262 Bug 4781, 5267: %25 in URL
5263 !! wikitext
5264 http://www.example.com/?title=100%25_Bran
5265 !! html/php
5266 <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>
5267 </p>
5268 !! html/parsoid
5269 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5270 !! end
5271
5272 !! test
5273 Bug 4781, 5267: %28, %29 in URL
5274 !! wikitext
5275 http://www.example.com/?title=Ben-Hur_%281959_film%29
5276 !! html/php
5277 <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>
5278 </p>
5279 !! html/parsoid
5280 <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>
5281 !! end
5282
5283
5284 !! test
5285 Bug 4781: %26 in autonumber URL
5286 !! wikitext
5287 [http://www.example.com/?title=AT%26T]
5288 !! html/php
5289 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5290 </p>
5291 !! html/parsoid
5292 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5293 !! end
5294
5295 !! test
5296 Bug 4781, 5267: %26 in autonumber URL
5297 !! wikitext
5298 [http://www.example.com/?title=100%25_Bran]
5299 !! html/php
5300 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5301 </p>
5302 !! html/parsoid
5303 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5304 !! end
5305
5306 !! test
5307 Bug 4781, 5267: %28, %29 in autonumber URL
5308 !! wikitext
5309 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5310 !! html/php
5311 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5312 </p>
5313 !! html/parsoid
5314 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5315 !! end
5316
5317
5318 !! test
5319 Bug 4781: %26 in bracketed URL
5320 !! wikitext
5321 [http://www.example.com/?title=AT%26T link]
5322 !! html/php
5323 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5324 </p>
5325 !! html/parsoid
5326 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5327 !! end
5328
5329 !! test
5330 Bug 4781, 5267: %25 in bracketed URL
5331 !! wikitext
5332 [http://www.example.com/?title=100%25_Bran link]
5333 !! html
5334 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5335 </p>
5336 !! end
5337
5338 !! test
5339 Bug 4781, 5267: %28, %29 in bracketed URL
5340 !! wikitext
5341 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5342 !! html/php
5343 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5344 </p>
5345 !! html/parsoid
5346 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5347 !! end
5348
5349 !! test
5350 External link containing a period in the anchor. (bug 63947)
5351 !! wikitext
5352 [//foo.org/bar#baz. bang]
5353
5354 [//foo.org/bar. bang]
5355 !! html/php
5356 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5357 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5358 </p>
5359 !! html/parsoid
5360 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5361 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5362 !! end
5363
5364 !! test
5365 External link containing a single quote. (bug 63947)
5366 !! wikitext
5367 [//foo.org/bar'baz]
5368
5369 [//foo.org/bar'baz bang]
5370 !! html/php
5371 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5372 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5373 </p>
5374 !! html/parsoid
5375 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5376 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5377 !! end
5378
5379 !! test
5380 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5381 !! wikitext
5382 Some [http://example.com/ pretty ''italics'' and stuff]!
5383 !! html
5384 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5385 </p>
5386 !! end
5387
5388 !! test
5389 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5390 !! wikitext
5391 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5392 !! html
5393 <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>
5394 </p>
5395 !! end
5396
5397 !! test
5398 External link containing double-single-quotes with no space separating the url from text in italics
5399 !! wikitext
5400 [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]].]
5401 !! html/php
5402 <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>
5403 </p>
5404 !! html/php+tidy
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> <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>
5406 !! html/parsoid
5407 <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>
5408 !! end
5409
5410 !! test
5411 External link with comments in link text
5412 !! wikitext
5413 [http://www.google.com Google <!-- comment -->]
5414 !! html/php
5415 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5416 </p>
5417 !! html/parsoid
5418 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5419 !! end
5420
5421 !! test
5422 External link to bare IPv4 address
5423 !! wikitext
5424 [http://192.168.0.1 Link]
5425 !! html/php
5426 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5427 </p>
5428 !! html/parsoid
5429 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5430 !! end
5431
5432 !! test
5433 URL-encoding in URL functions (single parameter)
5434 !! wikitext
5435 {{localurl:Some page|amp=&}}
5436 !! html
5437 <p>/index.php?title=Some_page&amp;amp=&amp;
5438 </p>
5439 !! end
5440
5441 !! test
5442 URL-encoding in URL functions (multiple parameters)
5443 !! wikitext
5444 {{localurl:Some page|q=?&amp=&}}
5445 !! html
5446 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5447 </p>
5448 !! end
5449
5450 !! test
5451 Brackets in urls
5452 !! wikitext
5453 http://example.com/index.php?foozoid%5B%5D=bar
5454
5455 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5456 !! html/php
5457 <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>
5458 </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>
5459 </p>
5460 !! html/parsoid
5461 <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>
5462
5463 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5464 !! end
5465
5466 !! test
5467 IPv6 urls, autolink format (T23261)
5468 !! wikitext
5469 http://[2404:130:0:1000::187:2]/index.php
5470
5471 Examples from RFC 2373, section 2.2:
5472 * http://[1080::8:800:200C:417A]/unicast
5473 * http://[FF01::101]/multicast
5474 * http://[::1]/loopback
5475 * http://[::]/unspecified
5476 * http://[::13.1.68.3]/ipv4compat
5477 * http://[::FFFF:129.144.52.38]/ipv4compat
5478
5479 Examples from RFC 2732, section 2:
5480 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5481 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5482 * http://[3ffe:2a00:100:7031::1]
5483 * http://[1080::8:800:200C:417A]/foo
5484 * http://[::192.9.5.5]/ipng
5485 * http://[::FFFF:129.144.52.38]:80/index.html
5486 * http://[2010:836B:4179::836B:4179]
5487
5488 !! html/php
5489 <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>
5490 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5491 </p>
5492 <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>
5493 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5494 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5495 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5496 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5497 <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>
5498 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5499 </p>
5500 <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>
5501 <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>
5502 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5503 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5504 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5505 <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>
5506 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5507
5508 !! html/parsoid
5509 <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>
5510
5511 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5512 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5513 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5514 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5515 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5516 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5517 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5518
5519 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5520 <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>
5521 <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>
5522 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5523 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5524 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5525 <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>
5526 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5527 !! end
5528
5529 !! test
5530 IPv6 urls, bracketed format (T23261)
5531 !! wikitext
5532 [http://[2404:130:0:1000::187:2]/index.php test]
5533
5534 Examples from RFC 2373, section 2.2:
5535 * [http://[1080::8:800:200C:417A] unicast]
5536 * [http://[FF01::101] multicast]
5537 * [http://[::1]/ loopback]
5538 * [http://[::] unspecified]
5539 * [http://[::13.1.68.3] ipv4compat]
5540 * [http://[::FFFF:129.144.52.38] ipv4compat]
5541
5542 Examples from RFC 2732, section 2:
5543 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5544 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5545 * [http://[3ffe:2a00:100:7031::1] 3]
5546 * [http://[1080::8:800:200C:417A]/foo 4]
5547 * [http://[::192.9.5.5]/ipng 5]
5548 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5549 * [http://[2010:836B:4179::836B:4179] 7]
5550
5551 !! html/php
5552 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5553 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5554 </p>
5555 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5556 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5557 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5558 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5559 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5560 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5561 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5562 </p>
5563 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5564 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5565 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5566 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5567 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5568 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5569 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5570
5571 !! html/parsoid
5572 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5573
5574 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5575 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5576 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5577 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5578 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5579 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5580 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5581
5582 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5583 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5584 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5585 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5586 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5587 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5588 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5589 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5590 !! end
5591
5592 !! test
5593 Non-extlinks in brackets
5594 !! wikitext
5595 [foo]
5596 [foo bar]
5597 [foo ''bar'']
5598 [fool's] errand
5599 [fool's errand]
5600 [{{echo|foo}}]
5601 [{{echo|foo}} bar]
5602 [{{echo|foo}} ''bar'']
5603 [{{echo|foo}}l's] errand
5604 [{{echo|foo}}l's errand]
5605 [url={{echo|foo}}]
5606 [url=http://example.com]
5607 [http:// bare protocols don't count]
5608 !! html/php
5609 <p>[foo]
5610 [foo bar]
5611 [foo <i>bar</i>]
5612 [fool's] errand
5613 [fool's errand]
5614 [foo]
5615 [foo bar]
5616 [foo <i>bar</i>]
5617 [fool's] errand
5618 [fool's errand]
5619 [url=foo]
5620 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5621 [http:// bare protocols don't count]
5622 </p>
5623 !! html/parsoid
5624 <p>[foo]
5625 [foo bar]
5626 [foo <i>bar</i>]
5627 [fool's] errand
5628 [fool's errand]
5629 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5630 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5631 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5632 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5633 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5634 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5635 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5636 [http:// bare protocols don't count]</p>
5637 !! end
5638
5639 !! test
5640 Percent encoding in external links
5641 !! wikitext
5642 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5643 !! html/php
5644 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5645 </p>
5646 !! html/parsoid
5647 <p><a rel="mw:ExtLink"
5648 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5649 !! end
5650
5651 !! test
5652 Use url link syntax for links where the content is equal the link target
5653 !! wikitext
5654 http://example.com
5655 !! html/php
5656 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5657 </p>
5658 !! html/parsoid
5659 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5660 !! end
5661
5662 !! test
5663 Parenthesis in external links, especially URL links
5664 !! wikitext
5665 http://example.com)
5666
5667 http://example.com/test)
5668
5669 http://example.com/(test)
5670
5671 http://example.com/((test)
5672
5673 (http://example.com/(test))
5674
5675 (http://example.com/(test)))))
5676
5677 http://example.com/a)b
5678
5679 [http://example.com) foo]
5680 !! html/php
5681 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5682 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5683 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5684 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</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/a)b">http://example.com/a)b</a>
5688 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5689 </p>
5690 !! html/parsoid
5691 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5692 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5693 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5694 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</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/a)b">http://example.com/a)b</a></p>
5698 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5699 !! end
5700
5701 !! test
5702 Parenthesis in external links, w/ transclusion or comment
5703 !! wikitext
5704 (http://example.com/{{echo|hi}})
5705
5706 (http://example.com<!-- hi -->)
5707 !! html/php
5708 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5709 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5710 </p>
5711 !! html/parsoid
5712 <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>
5713
5714 <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>
5715 !! end
5716
5717 !! test
5718 Serialize <a> tags with invalid link targets as plain text
5719 !! options
5720 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5721 !! html/parsoid
5722 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5723 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5724 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5725 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5726 !! wikitext
5727 text
5728 <nowiki>*</nowiki>text
5729 <nowiki>[[foo]]</nowiki>
5730 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5731 !! end
5732
5733 !! test
5734 mw:ExtLink -vs- mw:WikiLink (T94723)
5735 !! options
5736 parsoid=html2wt
5737 !! html/parsoid
5738 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5739 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5740 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5741 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5742 <p>
5743 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5744 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5745 </p>
5746 !! wikitext
5747 [[Foo|Bar]]
5748 [[Foo|Bar]]
5749 [[wikipedia:Foo|Bar]]
5750 [[wikipedia:Foo|Bar]]
5751
5752 [[wikipedia:European_Robin|European Robin]]
5753 [[wikipedia:European_Robin|European Robin]]
5754 !! end
5755
5756 !! test
5757 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5758 !! options
5759 parsoid=wt2wt
5760 !! wikitext
5761 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5762 !! html/parsoid
5763 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5764 !! end
5765
5766
5767 ###
5768 ### Quotes
5769 ###
5770
5771 !! test
5772 Quotes
5773 !! wikitext
5774 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5775
5776 Normal text. '''''Bold italic text.''''' Normal text.
5777 !! html
5778 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5779 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5780 </p>
5781 !! end
5782
5783
5784 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5785 # parser strips. The wikitext contains just the first half of the bold
5786 # quote pair.
5787 !! test
5788 Unclosed and unmatched quotes
5789 !! wikitext
5790 '''''Bold italic text '''with bold deactivated''' in between.'''''
5791
5792 '''''Bold italic text ''with italic deactivated'' in between.'''''
5793
5794 '''Bold text..
5795
5796 ..spanning two paragraphs (should not work).'''
5797
5798 '''Bold tag left open
5799
5800 ''Italic tag left open
5801
5802 Normal text.
5803
5804 <!-- Unmatching number of opening, closing tags: -->
5805 '''This year''''s election ''should'' beat '''last year''''s.
5806
5807 ''Tom'''s car is bigger than ''Susan'''s.
5808
5809 Plain ''italic'''s plain
5810 !! html/php
5811 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5812 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5813 </p><p><b>Bold text..</b>
5814 </p><p>..spanning two paragraphs (should not work).
5815 </p><p><b>Bold tag left open</b>
5816 </p><p><i>Italic tag left open</i>
5817 </p><p>Normal text.
5818 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5819 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5820 </p><p>Plain <i>italic'</i>s plain
5821 </p>
5822 !! html/parsoid
5823 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5824 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5825 </p><p><b>Bold text..</b>
5826 </p><p>..spanning two paragraphs (should not work).<b></b>
5827 </p><p><b>Bold tag left open</b>
5828 </p><p><i>Italic tag left open</i>
5829 </p><p>Normal text.
5830 </p>
5831 <!-- Unmatching number of opening, closing tags: -->
5832 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5833 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5834 </p><p>Plain <i>italic'</i>s plain
5835 </p>
5836 !! end
5837
5838 ###
5839 ### Tables
5840 ###
5841 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5842 ###
5843
5844 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5845 # is the bare minimum required by the spec, see:
5846 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5847 # Parsoid team replies: empty table tags are legal in HTML5
5848 !! test
5849 A table with no data.
5850 !! options
5851 parsoid=wt2html
5852 !! wikitext
5853 {||}
5854 !! html/php
5855
5856 !! html/parsoid
5857 <table></table>
5858
5859 !! end
5860
5861 !! test
5862 A table with stray table end tags on start tag line (wt2html)
5863 !! options
5864 parsoid=wt2html
5865 !! wikitext
5866 {|style="color: red;"|}
5867
5868 {|style="color: red;" |}
5869 |foo
5870 |}
5871
5872 {|style="color: red;"|} id="foo"
5873 |foo
5874 |}
5875
5876 {|style="color: red;" |} id="foo"
5877 |foo
5878 |}
5879 !! html
5880 <table style="color: red;"></table>
5881
5882 <table style="color: red;">
5883 <tbody><tr>
5884 <td>foo</td>
5885 </tr></tbody>
5886 </table>
5887
5888 <table style="color: red;" id="foo">
5889 <tbody><tr>
5890 <td>foo</td>
5891 </tr></tbody>
5892 </table>
5893
5894 <table style="color: red;" id="foo">
5895 <tbody><tr>
5896 <td>foo</td>
5897 </tr></tbody>
5898 </table>
5899
5900 !! end
5901
5902 !! test
5903 A table with no data (take 2)
5904 !! wikitext
5905 {|
5906 |}
5907 !! html/parsoid
5908 <table></table>
5909 !! end
5910
5911 # A table with nothing but a caption is invalid XHTML, we might want to render
5912 # this as <p>caption</p>
5913 # Parsoid team replies: table with only a caption is legal in HTML5
5914 !! test
5915 A table with nothing but a caption
5916 !! wikitext
5917 {|
5918 |+ caption
5919 |}
5920 !! html/php
5921 <table>
5922 <caption> caption
5923 </caption><tr><td></td></tr></table>
5924
5925 !! html/parsoid
5926 <table><caption> caption</caption></table>
5927 !! end
5928
5929 !! test
5930 A table with caption with default-spaced attributes and a table row
5931 !! wikitext
5932 {|
5933 |+ style="color: red;" | caption1
5934 |-
5935 | foo
5936 |}
5937 !! html
5938 <table>
5939 <caption style="color: red;"> caption1
5940 </caption>
5941 <tr>
5942 <td> foo
5943 </td></tr></table>
5944
5945 !! end
5946
5947 !! test
5948 A table with captions with non-default spaced attributes and a table row
5949 !! wikitext
5950 {|
5951 |+style="color: red;"|caption2
5952 |+ style="color: red;"| caption3
5953 |-
5954 | foo
5955 |}
5956 !! html
5957 <table>
5958 <caption style="color: red;">caption2
5959 </caption>
5960 <caption style="color: red;"> caption3
5961 </caption>
5962 <tr>
5963 <td> foo
5964 </td></tr></table>
5965
5966 !! end
5967
5968 !! test
5969 Table td-cell syntax variations
5970 !! wikitext
5971 {|
5972 | foo bar foo | baz
5973 | foo bar foo || baz
5974 | style='color:red;' | baz
5975 | style='color:red;' || baz
5976 |}
5977 !! html
5978 <table>
5979 <tr>
5980 <td> baz
5981 </td>
5982 <td> foo bar foo </td>
5983 <td> baz
5984 </td>
5985 <td style="color:red;"> baz
5986 </td>
5987 <td> style='color:red;' </td>
5988 <td> baz
5989 </td></tr></table>
5990
5991 !! end
5992
5993 !! test
5994 Simple table
5995 !! wikitext
5996 {|
5997 | 1 || 2
5998 |-
5999 | 3 || 4
6000 |}
6001 !! html
6002 <table>
6003 <tr>
6004 <td> 1 </td>
6005 <td> 2
6006 </td></tr>
6007 <tr>
6008 <td> 3 </td>
6009 <td> 4
6010 </td></tr></table>
6011
6012 !! end
6013
6014 !! test
6015 Simple table but with multiple dashes for row wikitext
6016 !! wikitext
6017 {|
6018 | foo
6019 |-----
6020 | bar
6021 |}
6022 !! html
6023 <table>
6024 <tr>
6025 <td> foo
6026 </td></tr>
6027 <tr>
6028 <td> bar
6029 </td></tr></table>
6030
6031 !! end
6032
6033 !! test
6034 Multiplication table
6035 !! wikitext
6036 {| border="1" cellpadding="2"
6037 |+Multiplication table
6038 |-
6039 ! &times; !! 1 !! 2 !! 3
6040 |-
6041 ! 1
6042 | 1 || 2 || 3
6043 |-
6044 ! 2
6045 | 2 || 4 || 6
6046 |-
6047 ! 3
6048 | 3 || 6 || 9
6049 |-
6050 ! 4
6051 | 4 || 8 || 12
6052 |-
6053 ! 5
6054 | 5 || 10 || 15
6055 |}
6056 !! html
6057 <table border="1" cellpadding="2">
6058 <caption>Multiplication table
6059 </caption>
6060 <tr>
6061 <th> &#215; </th>
6062 <th> 1 </th>
6063 <th> 2 </th>
6064 <th> 3
6065 </th></tr>
6066 <tr>
6067 <th> 1
6068 </th>
6069 <td> 1 </td>
6070 <td> 2 </td>
6071 <td> 3
6072 </td></tr>
6073 <tr>
6074 <th> 2
6075 </th>
6076 <td> 2 </td>
6077 <td> 4 </td>
6078 <td> 6
6079 </td></tr>
6080 <tr>
6081 <th> 3
6082 </th>
6083 <td> 3 </td>
6084 <td> 6 </td>
6085 <td> 9
6086 </td></tr>
6087 <tr>
6088 <th> 4
6089 </th>
6090 <td> 4 </td>
6091 <td> 8 </td>
6092 <td> 12
6093 </td></tr>
6094 <tr>
6095 <th> 5
6096 </th>
6097 <td> 5 </td>
6098 <td> 10 </td>
6099 <td> 15
6100 </td></tr></table>
6101
6102 !! end
6103
6104 !! test
6105 Accept "||" in table headings
6106 !! wikitext
6107 {|
6108 !h1 || h2
6109 |}
6110 !! html
6111 <table>
6112 <tr>
6113 <th>h1 </th>
6114 <th> h2
6115 </th></tr></table>
6116
6117 !! end
6118
6119 !! test
6120 Accept "!!" in table data
6121 !! wikitext
6122 {|
6123 | Foo!! ||
6124 |}
6125 !! html
6126 <table>
6127 <tr>
6128 <td> Foo!! </td>
6129 <td>
6130 </td></tr></table>
6131
6132 !! html/parsoid
6133 <table>
6134 <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>
6135 </tbody></table>
6136 !! end
6137
6138 !! test
6139 Accept "||" in indented table headings
6140 !! wikitext
6141 :{|
6142 !h1 || h2
6143 |}
6144 !! html
6145 <dl><dd><table>
6146 <tr>
6147 <th>h1 </th>
6148 <th> h2
6149 </th></tr></table></dd></dl>
6150
6151 !! end
6152
6153 !! test
6154 Accept "!!" in templates
6155 !! wikitext
6156 {|
6157 !a {{echo|b!!c}}
6158 |}
6159 !! html/php
6160 <table>
6161 <tr>
6162 <th>a b</th>
6163 <th>c
6164 </th></tr></table>
6165
6166 !! html/parsoid
6167 <table>
6168 <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>
6169 !! end
6170
6171 !! test
6172 Accept "!!" in table headings after newline
6173 !! wikitext
6174 {|
6175 !a
6176 b!!c
6177 |}
6178 !! html/php
6179 <table>
6180 <tr>
6181 <th>a
6182 <p>b!!c
6183 </p>
6184 </th></tr></table>
6185
6186 !! html/parsoid
6187 <table>
6188 <tbody><tr><th>a
6189 <p>b!!c</p></th></tr>
6190 </tbody></table>
6191 !! end
6192
6193 !! test
6194 Accept "!!" in table data of mixed wikitext / html syntax
6195 !! wikitext
6196 {|
6197 !a
6198 <tr><td>b!!c</td></tr>
6199 |}
6200 !! html+tidy
6201 <table>
6202 <tr>
6203 <th>a</th>
6204 </tr>
6205 <tr>
6206 <td>b!!c</td>
6207 </tr>
6208 </table>
6209 !! html/parsoid
6210 <table>
6211 <tbody><tr><th>a</th></tr>
6212 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6213 </tbody></table>
6214 !! end
6215
6216 !! test
6217 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6218 !! wikitext
6219 {|
6220 !| h1
6221 || a
6222 |}
6223 !! html
6224 <table>
6225 <tr>
6226 <th> h1
6227 </th>
6228 <td> a
6229 </td></tr></table>
6230
6231 !! end
6232
6233 !!test
6234 Accept "| !" at start of line in tables (ignore !-attribute)
6235 !! wikitext
6236 {|
6237 |-
6238 | !style="color:red" | bar
6239 |}
6240 !! html
6241 <table>
6242
6243 <tr>
6244 <td> bar
6245 </td></tr></table>
6246
6247 !!end
6248
6249 !!test
6250 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 +/-
6251 !! wikitext
6252 {|
6253 |-
6254 |style='color:red;'|+1
6255 |style='color:blue;'|-1
6256 |-
6257 | 1 || 2 || 3
6258 | 1 ||+2 ||-3
6259 |-
6260 | +1
6261 | -1
6262 |}
6263 !! html
6264 <table>
6265
6266 <tr>
6267 <td style="color:red;">+1
6268 </td>
6269 <td style="color:blue;">-1
6270 </td></tr>
6271 <tr>
6272 <td> 1 </td>
6273 <td> 2 </td>
6274 <td> 3
6275 </td>
6276 <td> 1 </td>
6277 <td>+2 </td>
6278 <td>-3
6279 </td></tr>
6280 <tr>
6281 <td> +1
6282 </td>
6283 <td> -1
6284 </td></tr></table>
6285
6286 !!end
6287
6288 !! test
6289 Table rowspan
6290 !! wikitext
6291 {| border=1
6292 | Cell 1, row 1
6293 |rowspan=2| Cell 2, row 1 (and 2)
6294 | Cell 3, row 1
6295 |-
6296 | Cell 1, row 2
6297 | Cell 3, row 2
6298 |}
6299 !! html
6300 <table border="1">
6301 <tr>
6302 <td> Cell 1, row 1
6303 </td>
6304 <td rowspan="2"> Cell 2, row 1 (and 2)
6305 </td>
6306 <td> Cell 3, row 1
6307 </td></tr>
6308 <tr>
6309 <td> Cell 1, row 2
6310 </td>
6311 <td> Cell 3, row 2
6312 </td></tr></table>
6313
6314 !! end
6315
6316 !! test
6317 Nested table
6318 !! wikitext
6319 {| border=1
6320 | &alpha;
6321 |
6322 {| bgcolor=#ABCDEF border=2
6323 |nested
6324 |-
6325 |table
6326 |}
6327 |the original table again
6328 |}
6329 !! html
6330 <table border="1">
6331 <tr>
6332 <td> &#945;
6333 </td>
6334 <td>
6335 <table bgcolor="#ABCDEF" border="2">
6336 <tr>
6337 <td>nested
6338 </td></tr>
6339 <tr>
6340 <td>table
6341 </td></tr></table>
6342 </td>
6343 <td>the original table again
6344 </td></tr></table>
6345
6346 !! end
6347
6348 !! test
6349 Invalid attributes in table cell (bug 1830)
6350 !! wikitext
6351 {|
6352 |Cell:|broken
6353 |}
6354 !! html
6355 <table>
6356 <tr>
6357 <td>broken
6358 </td></tr></table>
6359
6360 !! end
6361
6362 !! test
6363 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6364 !! wikitext
6365 {|
6366 | title="foo" |bar
6367 | title="foo<nowiki>|</nowiki>" |bar
6368 | title="foo<nowiki>|</nowiki>" bar
6369 |}
6370 !! html/php
6371 <table>
6372 <tr>
6373 <td title="foo">bar
6374 </td>
6375 <td title="foo&#124;">bar
6376 </td>
6377 <td> title="foo|" bar
6378 </td></tr></table>
6379
6380 !! html/parsoid
6381 <table>
6382 <tbody><tr><td title="foo">bar</td>
6383 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6384 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6385 </tbody></table>
6386 !! end
6387
6388 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6389 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6390 # *2wt modes will fail.
6391 !! test
6392 Table security: embedded pipes
6393 !! options
6394 parsoid=wt2html,html2html
6395 !! wikitext
6396 {|
6397 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6398 !! html/php
6399 <table>
6400 <tr>
6401 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6402 <td>]" onmouseover="alert(document.cookie)"&gt;test
6403 </td>
6404 </tr>
6405 </table>
6406
6407 !! html/parsoid
6408 <table><tbody>
6409 <tr>
6410 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6411 !! end
6412
6413 !! test
6414 Element attributes with double ! should not be broken up by <th>
6415 !! wikitext
6416 {|
6417 ! hi <div class="!!">ha</div> ho
6418 |}
6419 !! html/php
6420 <table>
6421 <tr>
6422 <th> hi <div class="!!">ha</div> ho
6423 </th></tr></table>
6424
6425 !! html/parsoid
6426 <table>
6427 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6428 </tbody></table>
6429 !! end
6430
6431 !! test
6432 ! and || in element attributes should not be parsed as <th>/<td>
6433 !! wikitext
6434 {|
6435 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6436 |}
6437 !! html/php
6438 <table>
6439 <tr>
6440 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6441 </td></tr></table>
6442
6443 !! html/parsoid
6444 <table>
6445 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6446 </tbody></table>
6447 !! end
6448
6449 # FIXME: The output seems broken. Filed as T110268.
6450 !! test
6451 ! and || in td attributes should not be parsed as <th>/<td>
6452 !! options
6453 parsoid=wt2html
6454 !! wikitext
6455 {|
6456 | style="color: red !important;" data-contrived="put this here ||" | foo
6457 |}
6458 !! html/php
6459 <table>
6460 <tr>
6461 <td> style="color: red !important;" data-contrived="put this here </td>
6462 <td> foo
6463 </td></tr></table>
6464
6465 !! html/parsoid
6466 <table>
6467 <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>
6468 </tbody></table>
6469 !! end
6470
6471 !! test
6472 Break on | in element attribute in template
6473 !! options
6474 parsoid=wt2html,html2html
6475 !! wikitext
6476 {{echo|1=<div class="hi|ho">ha</div>}}
6477 !! html/php
6478 <p>ho"&gt;ha&lt;/div&gt;
6479 </p>
6480 !! html/parsoid
6481 <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>
6482 !! end
6483
6484 !! test
6485 Break on | in element attribute name in template
6486 !! wikitext
6487 {{echo|<div cla|ss="hiho">ha</div>}}
6488 !! html/parsoid
6489 <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>
6490 !! end
6491
6492 !! test
6493 Don't break on | in extension attribute in template
6494 !! wikitext
6495 {{echo|<ref name="hi|ho">ha</ref>}}
6496
6497 <references />
6498 !! html/parsoid
6499 <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>
6500
6501 <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>
6502 !! end
6503
6504 ## We don't support roundtripping of these attributes in Parsoid.
6505 ## Selective serialization takes care of preventing dirty diffs.
6506 ## But, on edits, we dirty-diff the invalid attribute text.
6507 !! test
6508 Invalid text in table attributes should be discarded
6509 !! options
6510 parsoid=wt2html
6511 !! wikitext
6512 {| <span>boo</span> style='border:1px solid black'
6513 | <span>boo</span> style='color:blue' | 1
6514 |<span>boo</span> style='color:blue'| 2
6515 |}
6516 !! html/php
6517 <table style="border:1px solid black">
6518 <tr>
6519 <td style="color:blue"> 1
6520 </td>
6521 <td style="color:blue"> 2
6522 </td></tr></table>
6523
6524 !! html/parsoid
6525 <table style="border:1px solid black">
6526 <tr>
6527 <td style="color:blue"> 1</td>
6528 <td style="color:blue"> 2</td>
6529 </tr>
6530 </table>
6531 !! end
6532
6533 !! test
6534 Invalid text in table attributes should be preserved by selective serializer
6535 !! options
6536 parsoid={
6537 "modes": ["selser"],
6538 "changes": [
6539 ["td:first-child", "text", "abc"],
6540 ["td + td", "text", "xyz"]
6541 ]
6542 }
6543 !! wikitext
6544 {| <span>boo</span> style='border:1px solid black'
6545 | <span>boo</span> style='color:blue' | 1
6546 |<span>boo</span> style='color:blue'| 2
6547 |}
6548 !! wikitext/edited
6549 {| <span>boo</span> style='border:1px solid black'
6550 | <span>boo</span> style='color:blue' |abc
6551 |<span>boo</span> style='color:blue'|xyz
6552 |}
6553 !! end
6554
6555 !! test
6556 1. Template-generated table cell attributes and cell content
6557 !! wikitext
6558 {|
6559 |{{table_attribs}}
6560 | {{table_attribs}}
6561 || {{table_attribs_5}}
6562 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6563 |align=center {{table_attribs}}
6564 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6565 |}
6566 !! html
6567 <table>
6568 <tr>
6569 <td style="color:red;">Foo
6570 </td>
6571 <td style="color:red;">Foo
6572 </td>
6573 <td> style="color:red;"</td>
6574 <td>Bar
6575 </td>
6576 <td style="color:red;">Foo
6577 </td>
6578 <td align="center" style="color:red;">Foo
6579 </td>
6580 <td align="center" style="color:red;">Foo
6581 </td></tr></table>
6582
6583 !! end
6584
6585 !! test
6586 2. Template-generated table cell attributes and cell content
6587 !! wikitext
6588 {|
6589 |{{table_attribs_2}}
6590 |}
6591 !! html/php
6592 <table>
6593 <tr>
6594 <td style="color:red;">Foo
6595 </td>
6596 <td>Bar</td>
6597 <td>Baz
6598 </td></tr></table>
6599
6600 !! html/parsoid
6601 <table>
6602 <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>
6603 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6604 </tbody></table>
6605 !! end
6606
6607 !! test
6608 3. Template-generated table cell attributes and cell content
6609 !! wikitext
6610 {|
6611 !align=center {{table_header_cells}}
6612 |-
6613 |align=center {{table_cells}}
6614 |}
6615 !! html/php
6616 <table>
6617 <tr>
6618 <th align="center" style="color:red;">Foo</th>
6619 <th style="color:red;"><i>Bar</i></th>
6620 <th style="color:brown;"><i>Foo</i> and Baz
6621 </th></tr>
6622 <tr>
6623 <td align="center" style="color:red;">Foo</td>
6624 <td style="color:red;"><i>Bar</i></td>
6625 <td style="color:brown;"><i>Foo</i> and Baz
6626 </td></tr></table>
6627
6628 !! html/parsoid
6629 <table>
6630 <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>
6631 <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>
6632 </tbody></table>
6633 !! end
6634
6635 !! test
6636 4. Template-generated table cell attributes and cell content inside a templated table
6637 !! wikitext
6638 {{tbl-start}}
6639 !align=center {{table_header_cells}}
6640 |-
6641 |align=center {{table_cells}}
6642 {{tbl-end}}
6643 !! html/php
6644 <table>
6645 <tr>
6646 <th align="center" style="color:red;">Foo</th>
6647 <th style="color:red;"><i>Bar</i></th>
6648 <th style="color:brown;"><i>Foo</i> and Baz
6649 </th></tr>
6650 <tr>
6651 <td align="center" style="color:red;">Foo</td>
6652 <td style="color:red;"><i>Bar</i></td>
6653 <td style="color:brown;"><i>Foo</i> and Baz
6654 </td></tr></table>
6655
6656 !! html/parsoid
6657 <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}}]}'>
6658 <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>
6659 <tr>
6660 <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>
6661 </tbody></table>
6662 !! end
6663
6664 ## Edge case fix to prevent future regressions
6665 !! test
6666 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6667 !! wikitext
6668 {|
6669 |{{table_attribs_7}}
6670 |}
6671 <references />
6672 !! html/parsoid
6673 <table>
6674 <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>
6675 </tbody></table>
6676 <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>
6677 !! end
6678
6679 !! test
6680 Table with row followed by newlines and table heading
6681 !! options
6682 parsoid=wt2html,html2html
6683 !! wikitext
6684 {|
6685 |-
6686
6687 ! foo
6688 |}
6689 !! html/*
6690 <table>
6691
6692
6693 <tr>
6694 <th> foo
6695 </th></tr></table>
6696
6697 !! end
6698
6699 !! test
6700 Table with empty line following the start tag
6701 !! options
6702 parsoid=wt2html,html2html
6703 !! wikitext
6704 {|
6705
6706 |-
6707 | foo
6708 |}
6709 !! html/*
6710 <table>
6711
6712
6713 <tr>
6714 <td> foo
6715 </td></tr></table>
6716
6717 !! end
6718
6719 !! test
6720 Table attributes with empty value
6721 !! options
6722 parsoid=wt2html,html2html
6723 !! wikitext
6724 {|
6725 | style=| hello
6726 |}
6727 !! html/php
6728 <table>
6729 <tr>
6730 <td style=""> hello
6731 </td></tr></table>
6732
6733 !! html/parsoid
6734 <table>
6735 <tbody><tr><td style=""> hello</td></tr>
6736 </tbody></table>
6737 !! end
6738
6739 !! test
6740 Wikitext table with a lot of comments
6741 !! wikitext
6742 {|
6743 <!-- c0 -->
6744 | foo
6745 <!-- c1 -->
6746 |-<!-- c2 -->
6747 <!-- c3 -->
6748 |<!-- c4 -->
6749 <!-- c5 -->
6750 |}
6751 !! html
6752 <table>
6753 <tr>
6754 <td> foo
6755 </td></tr>
6756 <tr>
6757 <td>
6758 </td></tr></table>
6759
6760 !! end
6761
6762 !! test
6763 Wikitext table comments represented in parsoid dom
6764 !! wikitext
6765 {|<!--c1--><!--c2-->
6766 |-<!--c3-->
6767 | x
6768 |}
6769 !! html/php+tidy
6770 <table>
6771 <tr>
6772 <td>x</td>
6773 </tr>
6774 </table>
6775 !! html/parsoid
6776 <table><!--c1--><!--c2-->
6777 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6778 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6779 </tbody></table>
6780 !! end
6781
6782 !! test
6783 Wikitext table with double-line table cell
6784 !! wikitext
6785 {|
6786 |a
6787 b
6788 |}
6789 !! html
6790 <table>
6791 <tr>
6792 <td>a
6793 <p>b
6794 </p>
6795 </td></tr></table>
6796
6797 !! end
6798
6799 !! test
6800 Table cell with a single comment
6801 !! wikitext
6802 {|
6803 | <!-- c1 -->
6804 | a
6805 |}
6806 !! html
6807 <table>
6808 <tr>
6809 <td>
6810 </td>
6811 <td> a
6812 </td></tr></table>
6813
6814 !! end
6815
6816 !! test
6817 Table-cell after a comment-only-empty-line
6818 !! wikitext
6819 {|
6820 |a
6821 <!--c1-->
6822 <!--c2-->| b
6823 |}
6824 !! html
6825 <table>
6826 <tr>
6827 <td>a
6828 </td>
6829 <td> b
6830 </td></tr></table>
6831
6832 !! html/parsoid
6833 <table>
6834 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6835 <!--c1-->
6836 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6837 </tbody></table>
6838
6839 !! end
6840
6841 !! test
6842 Build table with {{!}}
6843 !! wikitext
6844 {{{!}} class="wikitable"
6845 ! header
6846 ! second header
6847 {{!}}- style="color:red;"
6848 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6849 {{!}}}
6850 !! html
6851 <table class="wikitable">
6852 <tr>
6853 <th> header
6854 </th>
6855 <th> second header
6856 </th></tr>
6857 <tr style="color:red;">
6858 <td> data </td>
6859 <td style="color:red;"> second data
6860 </td></tr></table>
6861
6862 !! end
6863
6864 !! test
6865 Build table with pipe as data
6866 !! wikitext
6867 {| class="wikitable"
6868 ! header
6869 ! second header
6870 |- style="color:red;"
6871 | data || style="color:red;" | second data
6872 |-
6873 | style="color:red;" | data with | || style="color:red;" | second data with |
6874 |-
6875 || data with | ||| second data with |
6876 |}
6877 !! html
6878 <table class="wikitable">
6879 <tr>
6880 <th> header
6881 </th>
6882 <th> second header
6883 </th></tr>
6884 <tr style="color:red;">
6885 <td> data </td>
6886 <td style="color:red;"> second data
6887 </td></tr>
6888 <tr>
6889 <td style="color:red;"> data with | </td>
6890 <td style="color:red;"> second data with |
6891 </td></tr>
6892 <tr>
6893 <td> data with | </td>
6894 <td> second data with |
6895 </td></tr></table>
6896
6897 !! end
6898
6899 !! test
6900 Build table with wikilink
6901 !! wikitext
6902 {| class="wikitable"
6903 ! header || second header
6904 |- style="color:red;"
6905 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6906 |-
6907 | data || second data [[Main Page|link|text with pipe]]
6908 |}
6909 !! html
6910 <table class="wikitable">
6911 <tr>
6912 <th> header </th>
6913 <th> second header
6914 </th></tr>
6915 <tr style="color:red;">
6916 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6917 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6918 </td></tr>
6919 <tr>
6920 <td> data </td>
6921 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6922 </td></tr></table>
6923
6924 !! end
6925
6926 # The expected HTML structure in this test is debatable. The PHP parser does
6927 # not parse this kind of table at all. The main focus for Parsoid is on
6928 # round-tripping, so this output is ok for now. TODO: revisit!
6929 !! test
6930 Wikitext table with html-syntax row
6931 !! wikitext
6932 {|
6933 |-
6934 <td>foo</td>
6935 |}
6936 !! html/parsoid
6937 <table>
6938 <tbody>
6939 <tr>
6940 <td>foo</td></tr></tbody></table>
6941 !! end
6942
6943 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6944 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6945 ## PHP parser, which tidy then compounds by fostering the content
6946 ## entirely out of the table. Parsoid recognizes the table context
6947 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6948 ## depends on PHP's treatment of broken table markup!
6949 !! test
6950 Implicit <td> after a |-
6951 !! options
6952 parsoid=wt2html,html2html
6953 !! wikitext
6954 {|
6955 |-
6956 a
6957 |}
6958 !! html/php
6959 <table>
6960
6961 a
6962 </table>
6963
6964 !! html/php+tidy
6965 <p>a</p>
6966 !! html/parsoid
6967 <table>
6968 <tr><td>a</td></tr>
6969 </table>
6970 !! end
6971
6972 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6973 !! test
6974 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6975 !! options
6976 parsoid=wt2html,html2html
6977 !! wikitext
6978 {|
6979 |-
6980 |
6981 a
6982 |-
6983 b
6984 |}
6985 !! html/php
6986 <table>
6987
6988 <tr>
6989 <td>
6990 <pre>a
6991 </pre>
6992 </td></tr>
6993 b
6994 </table>
6995
6996 !! html/php+tidy
6997 <p>b</p>
6998 <table>
6999 <tr>
7000 <td>
7001 <pre>
7002 a
7003 </pre></td>
7004 </tr>
7005 </table>
7006 !! html/parsoid
7007 <table>
7008 <tbody>
7009 <tr><td><pre>a</pre></td></tr>
7010 <tr><td> b</td></tr>
7011 </tbody>
7012 </table>
7013 !! end
7014
7015 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
7016 # Parsoid generates the missing <td>, so wt2wt won't succeed.
7017 !! test
7018 Lists should be recognized in an implicit <td> context
7019 !! options
7020 parsoid=wt2html,html2html
7021 !! wikitext
7022 {|
7023 |-
7024 *a
7025 |}
7026 !! html/php
7027 <table>
7028
7029 <ul><li>a</li></ul>
7030 </table>
7031
7032 !! html/php+tidy
7033 <ul>
7034 <li>a</li>
7035 </ul>
7036 !! html/parsoid
7037 <table>
7038 <tr>
7039 <td><ul>
7040 <li>a</li>
7041 </ul></td>
7042 </tr>
7043 </table>
7044 !! end
7045
7046 !! test
7047 Table cells not properly parsed in an implicit-td context
7048 !! wikitext
7049 {|
7050 |-
7051 {{table_attribs_4}} || a || b
7052 |}
7053 !! html/php+tidy
7054 <table>
7055 <tr>
7056 <td style="background-color:#DC241f;" width="10px"></td>
7057 <td>a</td>
7058 <td>b</td>
7059 </tr>
7060 </table>
7061 !! html/parsoid
7062 <table>
7063 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7064 <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>
7065 </tbody></table>
7066 !! end
7067
7068 !! test
7069 Parsoid: Round-trip tables directly followed by content (bug 51219)
7070 !! options
7071 parsoid=wt2html,wt2wt
7072 !! wikitext
7073 {|
7074 |foo
7075 |} bar
7076
7077 {|
7078 |baz
7079 |}<b>quux</b>
7080 !! html+tidy
7081 <table>
7082 <tr>
7083 <td>foo</td>
7084 </tr>
7085 </table>
7086 <p>bar</p>
7087 <table>
7088 <tr>
7089 <td>baz</td>
7090 </tr>
7091 </table>
7092 <p><b>quux</b></p>
7093 !! end
7094
7095 !! test
7096 Parsoid: Default to a newline after tables in new content (bug 51219)
7097 !! options
7098 parsoid=html2wt
7099 !! html/parsoid
7100 <table><tbody>
7101 <tr><td>foo</td></tr></tbody></table> bar
7102 <table><tbody>
7103 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7104 !! wikitext
7105 {|
7106 |foo
7107 |}
7108 <nowiki> </nowiki>bar
7109 {|
7110 |baz
7111 |}
7112 '''quux'''
7113 !! end
7114
7115 !! test
7116 Parsoid: newline inducing block nodes don't suppress <nowiki>
7117 !! options
7118 parsoid=html2wt
7119 !! html/parsoid
7120 a<h1>foo</h1>
7121 !! wikitext
7122 <nowiki> </nowiki>a
7123
7124 = foo =
7125 !! end
7126
7127 !! test
7128 Parsoid: Row-syntax table headings followed by comment & table cells
7129 !! options
7130 parsoid=wt2html,wt2wt
7131 !! wikitext
7132 {|
7133 ! foo || bar
7134 <!-- foo --> || baz || quux
7135 |}
7136 !! html/php
7137 <table>
7138 <tr>
7139 <th> foo </th>
7140 <th> bar
7141 </th>
7142 <td> baz </td>
7143 <td> quux
7144 </td></tr></table>
7145
7146 !! html/parsoid
7147 <table>
7148 <tbody><tr><th> foo </th><th> bar
7149 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7150 </tbody></table>
7151 !! end
7152
7153 !!test
7154 Parsoid: Recover better from broken table attributes
7155 !!options
7156 parsoid=wt2html
7157 !!wikitext
7158 {| class="foo
7159 | class="bar" |
7160 foo
7161 |}
7162 !!html/php+tidy
7163 <table class="foo">
7164 <tr>
7165 <td class="bar">
7166 <p>foo</p>
7167 </td>
7168 </tr>
7169 </table>
7170 !!html/parsoid
7171 <table class="foo">
7172 <tr>
7173 <td class="bar">
7174 <p>foo</p></td></tr>
7175 </tbody></table>
7176 !!end
7177
7178 !! test
7179 Tables: Digest broken attributes on table and tr tag
7180 !! options
7181 parsoid=wt2html
7182 !! wikitext
7183 {| || |} ++
7184 |- || || ++ --
7185 |- > [
7186 |}
7187 !! html
7188 <table>
7189 <tbody>
7190 <tr></tr>
7191 <tr></tr>
7192 </tbody></table>
7193 !! end
7194
7195 # T137406: Whitespace in the HTML
7196 !! test
7197 1. Generate correct wikitext for tables with thead/tbody/tfoot
7198 !! options
7199 parsoid=html2wt
7200 !! html/parsoid
7201 <table>
7202 <caption>Test</caption>
7203 <thead>
7204 <tr>
7205 <th>Month</th>
7206 <th>Savings</th>
7207 </tr>
7208 </thead>
7209 <tbody>
7210 <tr>
7211 <td>January</td>
7212 <td>$100</td>
7213 </tr>
7214 <tr>
7215 <td>February</td>
7216 <td>$80</td>
7217 </tr>
7218 </tbody>
7219 <tfoot>
7220 <tr>
7221 <td>Sum</td>
7222 <td>$180</td>
7223 </tr>
7224 </tfoot>
7225 </table>
7226 !! wikitext
7227 {|
7228 |+Test
7229 !Month
7230 !Savings
7231 |-
7232 |January
7233 |$100
7234 |-
7235 |February
7236 |$80
7237 |-
7238 |Sum
7239 |$180
7240 |}
7241 !! html/php+tidy
7242 <table>
7243 <caption>Test</caption>
7244 <tr>
7245 <th>Month</th>
7246 <th>Savings</th>
7247 </tr>
7248 <tr>
7249 <td>January</td>
7250 <td>$100</td>
7251 </tr>
7252 <tr>
7253 <td>February</td>
7254 <td>$80</td>
7255 </tr>
7256 <tr>
7257 <td>Sum</td>
7258 <td>$180</td>
7259 </tr>
7260 </table>
7261 !! end
7262
7263 # T137406: No whitespace in the HTML
7264 !! test
7265 2. Generate correct wikitext for tables with thead/tbody/tfoot
7266 !! options
7267 parsoid=html2wt
7268 !! html/parsoid
7269 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7270 !! wikitext
7271 {|
7272 !heading
7273 |-
7274 |foo
7275 |}
7276 !! end
7277
7278 !! test
7279 Testing serialization after deletion in references
7280 !! options
7281 parsoid={
7282 "modes": ["wt2wt"],
7283 "changes": [
7284 ["#x", "remove"]
7285 ]
7286 }
7287 !! wikitext
7288 hi <ref><div id="x">ho</div></ref>
7289
7290 <references />
7291 !! wikitext/edited
7292 hi <ref></ref>
7293
7294 <references />
7295 !! end
7296
7297 !!test
7298 Testing serialization after deletion of table cells
7299 !!options
7300 parsoid={
7301 "modes": ["wt2wt", "selser"],
7302 "changes": [
7303 ["#x", "remove"]
7304 ]
7305 }
7306 !!wikitext
7307 {|
7308 !h1 !!h2 !!h3
7309 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7310 |}
7311 !! wikitext/edited
7312 {|
7313 !h1 !!h2 !!h3
7314 |c2 |||c3
7315 |}
7316 !!end
7317
7318 !! test
7319 Testing selser after addition of new row before first row (T125419)
7320 !! options
7321 parsoid={
7322 "modes": ["wt2wt", "selser"],
7323 "changes": [
7324 [ "tr", "before", "<tr><td>X</td></tr>" ]
7325 ]
7326 }
7327 !! wikitext
7328 {|
7329 |a
7330 |}
7331 !! wikitext/edited
7332 {|
7333 |X
7334 |-
7335 |a
7336 |}
7337 !! end
7338
7339 !! test
7340 Serialize new table rows in a HTML table using HTML tags
7341 !! options
7342 parsoid={
7343 "modes": ["wt2wt", "selser"],
7344 "changes": [
7345 [ "tr", "before", "<tr><td>X</td></tr>" ]
7346 ]
7347 }
7348 !! wikitext
7349 <table><tr><td>a</td></tr></table>
7350 !! wikitext/edited
7351 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7352 !! end
7353
7354 !! test
7355 Serialize new table cells in a HTML row using HTML tags
7356 !! options
7357 parsoid={
7358 "modes": ["wt2wt", "selser"],
7359 "changes": [
7360 [ "td", "before", "<td>X</td>" ]
7361 ]
7362 }
7363 !! wikitext
7364 <table><tr><td>a</td></tr></table>
7365 !! wikitext/edited
7366 <table><tr><td>X</td><td>a</td></tr></table>
7367 !! end
7368
7369 !! test
7370 Wikitext tables can be nested inside HTML tables
7371 !! options
7372 parsoid=html2wt
7373 !! html
7374 <table data-parsoid='{"stx":"html"}'>
7375 <tr><td>
7376 <table>
7377 <tr><td>foo</td></tr>
7378 </table>
7379 </td></tr>
7380 </table>
7381 !! wikitext
7382 <table>
7383 <tr><td>
7384 {|
7385 |foo
7386 |}
7387 </td></tr>
7388 </table>
7389 !! end
7390
7391 !! test
7392 Serialize wikitext list items as HTML list items when embedded in a HTML list
7393 !! options
7394 parsoid=html2wt
7395 !! html
7396 <ul data-parsoid='{"stx": "html"}'>
7397 <li data-parsoid='{}'>a</li>
7398 <li>b</li>
7399 </ul>
7400 !! wikitext
7401 <ul>
7402 <li>a</li>
7403 <li>b</li>
7404 </ul>
7405 !! end
7406
7407 # SSS FIXME: Is this actually a good thing given the
7408 # odd nested list output that is generated by MW?
7409 # <ul><li>foo<ul>..</ul></li></ul> instead of
7410 # <ul><li>foo</li><ul>..</ul></ul>
7411 !! test
7412 Wikitext lists can be nested inside HTML lists
7413 !! options
7414 parsoid=html2wt
7415 !! html
7416 <ul data-parsoid='{"stx": "html"}'>
7417 <li data-parsoid='{"stx": "html"}'>a
7418 <ul><li>b</li></ul>
7419 </li>
7420 </ul>
7421
7422 <ul data-parsoid='{"stx": "html"}'>
7423 <li>x
7424 <ul><li>y</li></ul>
7425 </li>
7426 </ul>
7427 !! wikitext
7428 <ul>
7429 <li>a
7430 * b
7431 </li>
7432 </ul>
7433
7434 <ul>
7435 <li>x
7436 * y
7437 </li>
7438 </ul>
7439 !! end
7440
7441 ###
7442 ### Internal links
7443 ###
7444 !! test
7445 Plain link, capitalized
7446 !! wikitext
7447 [[Main Page]]
7448 !! html
7449 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7450 </p>
7451 !! end
7452
7453 !! test
7454 Plain link, uncapitalized
7455 !! wikitext
7456 [[main Page]]
7457 !! html
7458 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7459 </p>
7460 !! end
7461
7462 !! test
7463 Piped link
7464 !! wikitext
7465 [[Main Page|The Main Page]]
7466 !! html
7467 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7468 </p>
7469 !! end
7470
7471 !! test
7472 Piped link with comment in link text
7473 !! wikitext
7474 [[Main Page|The Main<!--front--> Page]]
7475 !! html
7476 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7477 </p>
7478 !! end
7479
7480 !! test
7481 Piped link with multiple pipe characters in link text
7482 !! wikitext
7483 [[Main Page||The|Main|Page|]]
7484 !! html/php
7485 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7486 </p>
7487 !! html/parsoid
7488 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7489 !! end
7490
7491 !! test
7492 Piped link with no link text
7493 !! wikitext
7494 [[Thomas Bek (bishop of St David's)|]]
7495 !! html/php
7496 <p>[[Thomas Bek (bishop of St David's)|]]
7497 </p>
7498 !! html/parsoid
7499 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7500 !! end
7501
7502 !! test
7503 Piped link with empty link text
7504 !! wikitext
7505 [[Main Page|<nowiki />]] - empty nowiki
7506 [[Main Page| ]] - empty space
7507 [[Main Page|&nbsp;]] - empty non breaking space
7508 !! html/php
7509 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7510 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7511 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7512 </p>
7513 !! html/parsoid
7514 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki />"}'/></a> - empty nowiki
7515 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7516 <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>
7517 !! end
7518
7519 !! test
7520 Broken link
7521 !! wikitext
7522 [[Zigzagzogzagzig]]
7523 !! html
7524 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7525 </p>
7526 !! end
7527
7528 !! test
7529 Broken link with fragment
7530 !! wikitext
7531 [[Zigzagzogzagzig#zug]]
7532 !! html
7533 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7534 </p>
7535 !! end
7536
7537 !! test
7538 Special page link with fragment
7539 !! wikitext
7540 [[Special:Version#anchor]]
7541 !! html
7542 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7543 </p>
7544 !! end
7545
7546 !! test
7547 Nonexistent special page link with fragment
7548 !! wikitext
7549 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7550 !! html
7551 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7552 </p>
7553 !! end
7554
7555 !! test
7556 Link with prefix
7557 !! wikitext
7558 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7559 !! html
7560 <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>
7561 </p>
7562 !! end
7563
7564 !! test
7565 Link with suffix
7566 !! wikitext
7567 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7568 !! html
7569 <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>!!!
7570 </p>
7571 !! end
7572
7573 !! article
7574 prefixed article
7575 !! text
7576 Some text
7577 !! endarticle
7578
7579 !! test
7580 Bug 43661: Piped links with identical prefixes
7581 !! wikitext
7582 [[prefixed article|prefixed articles with spaces]]
7583
7584 [[prefixed article|prefixed articlesaoeu]]
7585
7586 [[Main Page|Main Page test]]
7587 !! html
7588 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7589 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7590 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7591 </p>
7592 !! end
7593
7594
7595 !! test
7596 Link with HTML entity in suffix / tail
7597 !! wikitext
7598 [[Main Page]]&quot;, [[Main Page]]&#97;
7599 !! html/php
7600 <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;
7601 </p>
7602 !! html/parsoid
7603 <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>
7604 !! end
7605
7606 !! test
7607 Link with 3 brackets
7608 !! wikitext
7609 [[[Main Page]]]
7610 Foo [[[Main Page]]]
7611 !! html
7612 <p>[[[Main Page]]]
7613 Foo [[[Main Page]]]
7614 </p>
7615 !! end
7616
7617 !! test
7618 Link with 4 brackets
7619 !! wikitext
7620 [[[[Main Page]]]]
7621 !! html
7622 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7623 </p>
7624 !! end
7625
7626 !! test
7627 Piped link with 3 brackets
7628 !! wikitext
7629 [[[main page|the main page]]]
7630 !! html
7631 <p>[[[main page|the main page]]]
7632 </p>
7633 !! end
7634
7635 !! test
7636 Piped link with extlink-like text
7637 !! wikitext
7638 [[Main Page|[bar]]]
7639 [[Main Page|This is a [bar]]]
7640 !! html/php
7641 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7642 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7643 </p>
7644 !! html/parsoid
7645 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7646 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7647 !! end
7648
7649 !! test
7650 Link with multiple pipes
7651 !! wikitext
7652 [[Main Page|The|Main|Page]]
7653 !! html
7654 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7655 </p>
7656 !! end
7657
7658 !! test
7659 Anchor containing a #. (bug 63430)
7660 !! wikitext
7661 [[Main Page#And#Link]]
7662 !! html/php
7663 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7664 </p>
7665 !! html/parsoid
7666 <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>
7667 !! end
7668
7669 !! test
7670 Link to namespaces
7671 !! wikitext
7672 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7673 !! html
7674 <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>
7675 </p>
7676 !! end
7677
7678 !! test
7679 Link with space in namespace
7680 !! wikitext
7681 [[User talk:Foo bar]]
7682 !! html
7683 <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>
7684 </p>
7685 !! end
7686
7687 !! article
7688 MemoryAlpha:AlphaTest
7689 !! text
7690 This is an article in the MemoryAlpha namespace
7691 (which shadows the memoryalpha interwiki link).
7692 !! endarticle
7693
7694 !! test
7695 Namespace takes precedence over interwiki link (bug 51680)
7696 !! wikitext
7697 [[MemoryAlpha:AlphaTest]]
7698 !! html
7699 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7700 </p>
7701 !! end
7702
7703 # The previous test doesn't work correctly in html2*, due to not recognizing the
7704 # link as an internal one. This one checks for the correct behavior.
7705 !! test
7706 Link to namespace preferred over interwiki with correct rel attribute
7707 !! options
7708 parsoid=html2wt,html2html
7709 !! html/parsoid
7710 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7711 !! wikitext
7712 [[MemoryAlpha:AlphaTest]]
7713 !! end
7714
7715 !! test
7716 Piped link to namespace
7717 !! wikitext
7718 [[Meta:Disclaimers|The disclaimers]]
7719 !! html
7720 <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>
7721 </p>
7722 !! end
7723
7724 !! test
7725 Link containing }
7726 !! wikitext
7727 [[Usually caused by a typo (oops}]]
7728 !! html
7729 <p>[[Usually caused by a typo (oops}]]
7730 </p>
7731 !! end
7732
7733 !! article
7734 7% Solution
7735 !! text
7736 Just a test of an article title containing a percent.
7737 !! endarticle
7738
7739 !! test
7740 Link containing % (not as a hex sequence)
7741 !! wikitext
7742 [[7% Solution]]
7743 [[7% Solution|7%25 Solution]]
7744 !! html/php
7745 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7746 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7747 </p>
7748 !! html/parsoid
7749 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7750 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7751 !! end
7752
7753 # note that the parsoid HTML is identical to the previous test output,
7754 # so the previous test ensures that the html2wt mode will generate the
7755 # "not as a hex sequence" wikitext.
7756 !! test
7757 Link containing % as a single hex sequence interpreted to char
7758 !! options
7759 parsoid=wt2wt,wt2html,html2html
7760 !! wikitext
7761 [[7%25 Solution]]
7762 [[7%25 Solution|7%25 Solution]]
7763 !! html/php
7764 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7765 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7766 </p>
7767 !! html/parsoid
7768 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7769 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7770 !!end
7771
7772 !! test
7773 Link containing % as a double hex sequence interpreted to hex sequence
7774 !! wikitext
7775 [[7%2525 Solution]]
7776 !! html
7777 <p>[[7%2525 Solution]]
7778 </p>
7779 !!end
7780
7781 ## Example for such a section: == < ==
7782 !! test
7783 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7784 !! wikitext
7785 [[%23%3c]][[%23%3e]]
7786 !! html/php
7787 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7788 </p>
7789 !! html/parsoid
7790 <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>
7791 !! end
7792
7793 !! test
7794 Link containing "<#" and ">#" as a hex sequences
7795 !! wikitext
7796 [[%3c%23]][[%3e%23]]
7797 !! html
7798 <p>[[%3c%23]][[%3e%23]]
7799 </p>
7800 !! end
7801
7802 !! test
7803 Link containing an equals sign
7804 !! wikitext
7805 [[Special:BookSources/isbn=4-00-026157-6]]
7806 !! html/php
7807 <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>
7808 </p>
7809 !! html/parsoid
7810 <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>
7811 !! end
7812
7813 !! article
7814 Foo~bar
7815 !! text
7816 Just a test of an article title containing a tilde.
7817 !! endarticle
7818
7819 # note that links containing signatures, like [[Foo~~~~]], are
7820 # massaged by the pre-save transform (PST) and so the tildes are never
7821 # seen by the parser.
7822 !! test
7823 Link containing a tilde
7824 !! wikitext
7825 [[Foo~bar]]
7826 !! html/php
7827 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7828 </p>
7829 !! html/parsoid
7830 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7831 !! end
7832
7833 !! test
7834 Link containing double-single-quotes '' (bug 4598)
7835 !! wikitext
7836 [[Lista d''e paise d''o munno]]
7837 !! html/php
7838 <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>
7839 </p>
7840 !! html/parsoid
7841 <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>
7842 !! end
7843
7844 !! test
7845 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7846 !! wikitext
7847 Some [[Link|pretty ''italics'' and stuff]]!
7848 !! html/php
7849 <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>!
7850 </p>
7851 !! html/parsoid
7852 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7853 !! end
7854
7855 !! test
7856 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7857 !! wikitext
7858 ''Some [[Link|pretty ''italics'' and stuff]]!''
7859 !! html
7860 <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>
7861 </p>
7862 !! end
7863
7864 !! test
7865 Link with double quotes in title part (literal) and alternate part (interpreted)
7866 !! wikitext
7867 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7868
7869 [[''Pentecoste'']]
7870
7871 [[''Pentecoste''|Pentecoste]]
7872
7873 [[''Pentecoste''|''Pentecoste'']]
7874 !! html/php
7875 <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>
7876 </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>
7877 </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>
7878 </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>
7879 </p>
7880 !! html/parsoid
7881 <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>
7882 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7883 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7884 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7885 !! end
7886
7887 !! test
7888 Broken image links with HTML captions (bug 39700)
7889 !! wikitext
7890 [[File:Nonexistent|<script></script>]]
7891 [[File:Nonexistent|100x100px|<script></script>]]
7892 [[File:Nonexistent|&lt;]]
7893 [[File:Nonexistent|a<i>b</i>c]]
7894 !! html/php
7895 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7896 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7897 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7898 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7899 </p>
7900 !! html/parsoid
7901 <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>
7902 <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>
7903 <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>
7904 <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>
7905 !! end
7906
7907 !! test
7908 Plain link to URL
7909 !! wikitext
7910 [[http://www.example.com]]
7911 !! html/php
7912 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7913 </p>
7914 !! html/parsoid
7915 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7916 !! end
7917
7918 !! test
7919 Plain link to URL with link text
7920 !! wikitext
7921 [[http://www.example.com Link text]]
7922 !! html
7923 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7924 </p>
7925 !! end
7926
7927 !! test
7928 Plain link to protocol-relative URL
7929 !! wikitext
7930 [[//www.example.com]]
7931 !! html/php
7932 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7933 </p>
7934 !! html/parsoid
7935 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7936 !! end
7937
7938 !! test
7939 Plain link to protocol-relative URL with link text
7940 !! wikitext
7941 [[//www.example.com Link text]]
7942 !! html
7943 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7944 </p>
7945 !! end
7946
7947 !! test
7948 Plain link to page with question mark in title
7949 !! wikitext
7950 [[A?b]]
7951
7952 [[A?b|Baz]]
7953 !! html
7954 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7955 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7956 </p>
7957 !! end
7958
7959
7960 # I'm fairly sure the expected result here is wrong.
7961 # We want these to be URL links, not pseudo-pages with URLs for titles....
7962 # However the current output is also pretty screwy.
7963 #
7964 # ----
7965 # I'm changing it to match the current output--it arguably makes more
7966 # sense in the light of the test above. Old expected result was:
7967 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7968 #</p>
7969 # But I think this test is bordering on "garbage in, garbage out" anyway.
7970 # -- wtm
7971 !! test
7972 Piped link to URL
7973 !! wikitext
7974 Piped link to URL: [[http://www.example.com|an example URL]]
7975 !! html/php
7976 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7977 </p>
7978 !! html/parsoid
7979 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7980 !! end
7981
7982 !! test
7983 BUG 2: [[page|http://url/]] should link to page, not http://url/
7984 !! wikitext
7985 [[Main Page|http://url/]]
7986 !! html/php
7987 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7988 </p>
7989 !! html/parsoid
7990 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7991 !! end
7992
7993 # Parsoid does not mark self-links, by design.
7994 !! test
7995 BUG 337: Escaped self-links should be bold
7996 !! options
7997 title=[[Bug462]]
7998 !! wikitext
7999 [[Bu&#103;462]] [[Bug462]]
8000 !! html/php
8001 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
8002 </p>
8003 !! html/php+tidy
8004 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
8005 !! html/parsoid
8006 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8007 !! end
8008
8009 !! test
8010 Self-link to section should not be bold
8011 !! options
8012 title=[[Main Page]]
8013 !! wikitext
8014 [[Main Page#section]]
8015 !! html
8016 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8017 </p>
8018 !! end
8019
8020 !! article
8021 00
8022 !! text
8023 This is 00.
8024 !! endarticle
8025
8026 !!test
8027 Self-link to numeric title
8028 !!options
8029 title=[[0]]
8030 !! wikitext
8031 [[0]]
8032 !! html
8033 <p><strong class="selflink">0</strong>
8034 </p>
8035 !!end
8036
8037 !!test
8038 Link to numeric-equivalent title
8039 !!options
8040 title=[[0]]
8041 !! wikitext
8042 [[00]]
8043 !! html
8044 <p><a href="/wiki/00" title="00">00</a>
8045 </p>
8046 !!end
8047
8048 !! test
8049 <nowiki> inside a link
8050 !! wikitext
8051 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8052 !! html
8053 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8054 </p>
8055 !! end
8056
8057 !! test
8058 Non-breaking spaces in title
8059 !! wikitext
8060 [[&nbsp; Main &nbsp; Page &nbsp;]]
8061 !! html
8062 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8063 </p>
8064 !!end
8065
8066 !! test
8067 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
8068 !! options
8069 language=ca
8070 !! wikitext
8071 '''[[Main Page]]'''
8072 !! html
8073 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8074 </p>
8075 !! end
8076
8077 !! test
8078 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
8079 !! options
8080 language=ca
8081 !! wikitext
8082 ''[[Main Page]]''
8083 !! html
8084 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8085 </p>
8086 !! end
8087
8088 !! test
8089 Internal link with en linktrail: no apostrophes (bug 27473)
8090 !! options
8091 language=en
8092 !! wikitext
8093 [[Something]]'nice
8094 !! html
8095 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8096 </p>
8097 !! end
8098
8099 !! test
8100 Internal link with ca linktrail with apostrophes (bug 27473)
8101 !! options
8102 language=ca
8103 !! wikitext
8104 [[Something]]'nice
8105 !! html
8106 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8107 </p>
8108 !! end
8109
8110 !! test
8111 Internal link with kaa linktrail with apostrophes (bug 27473)
8112 !! options
8113 language=kaa
8114 !! wikitext
8115 [[Something]]'nice
8116 !! html
8117 <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>
8118 </p>
8119 !! end
8120
8121 !! test
8122 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
8123 !! wikitext
8124 [[User:Foo/Test/63636:Bar|Test]]
8125 !! html/php
8126 <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>
8127 </p>
8128 !! html/parsoid
8129 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8130 !! end
8131
8132 ## Mainly a sanity check for Parsoid
8133 !! test
8134 Handle title parsing for subpages
8135 !! options
8136 title=[[/123123]]
8137 !! wikitext
8138 123
8139 !! html/parsoid
8140 <p>123</p>
8141 !! end
8142
8143 ## FIXME: Add a working php section here
8144 !! test
8145 Link to a subpage from a namespace other than main
8146 !! options
8147 title=[[User:test]]
8148 !! wikitext
8149 [[/123]]
8150 !! html/parsoid
8151 <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>
8152 !! end
8153
8154 !! test
8155 Ensure that transclusion titles are not url-decoded
8156 !! options
8157 subpage title=[[Test]]
8158 parsoid=wt2html
8159 !! wikitext
8160 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8161 !! html/php
8162 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8163 </p>
8164 !! html/parsoid
8165 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8166 !! end
8167
8168 !! test
8169 Purely hash wikilink
8170 !! options
8171 title=[[User:test/123]]
8172 !! wikitext
8173 [[#a|b]]
8174 !! html/php
8175 <p><a href="#a">b</a>
8176 </p>
8177 !! html/parsoid
8178 <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>
8179 !! end
8180
8181 !! test
8182 1. Interaction of linktrail and template encapsulation
8183 !! options
8184 parsoid
8185 !! wikitext
8186 {{echo|[[Foo]]}}l
8187 !! html
8188 <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>
8189 !! end
8190
8191 !! test
8192 2. Interaction of linktrail and template encapsulation
8193 !! options
8194 parsoid
8195 !! wikitext
8196 {{echo|Some [[Fool]]}}s
8197 !! html
8198 <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>
8199 !! end
8200
8201 !! test
8202 3. Interaction of linktrail and template encapsulation
8203 !! options
8204 parsoid
8205 !! wikitext
8206 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8207 !! html
8208 <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>
8209 !! end
8210
8211 !! article
8212 Söfnuður
8213 !! text
8214 Test.
8215 !! endarticle
8216
8217 !! test
8218 Internal link with is link prefix
8219 !! options
8220 language=is
8221 !! wikitext
8222 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8223 !! html
8224 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8225 </p>
8226 !! end
8227
8228 !! article
8229 Mótmælendatrú
8230 !! text
8231 Test.
8232 !! endarticle
8233
8234 !! test
8235 Internal link with is link trail and link prefix
8236 !! options
8237 language=is
8238 !! wikitext
8239 [[mótmælendatrú|xxx]]ar
8240 [[mótmælendatrú]]ar
8241 mótmælenda[[söfnuður]]
8242 mótmælenda[[söfnuður|söfnuðir]]
8243 mótmælenda[[söfnuður|söfnuðir]]xxx
8244 !! html
8245 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8246 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8247 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8248 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8249 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8250 </p>
8251 !! end
8252
8253 !! test
8254 Parsoid link trail escaping
8255 !! options
8256 parsoid=html2wt,html2html
8257 !! html/parsoid
8258 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
8259 !! wikitext
8260 [[apple]]<nowiki/>s
8261 !! end
8262
8263 !! test
8264 Parsoid link prefix escaping
8265 !! options
8266 language=is
8267 parsoid=html2wt,html2html
8268 !! html/parsoid
8269 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
8270 !! wikitext
8271 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8272 !! end
8273
8274 !! test
8275 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8276 !! wikitext
8277 [[Foo| bar]]
8278
8279 [[Foo| ''bar'']]
8280
8281 [http://wp.org foo]
8282
8283 [http://wp.org ''foo'']
8284 !! html
8285 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8286 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8287 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8288 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8289 </p>
8290 !! end
8291
8292 !! test
8293 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8294 !! options
8295 parsoid
8296 !! wikitext
8297 [[Foo|{{echo|a}} b {{echo|c}}]]
8298 !! html
8299 <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>
8300 !! end
8301
8302 !! test
8303 Link with angle bracket after anchor
8304 !! wikitext
8305 [[Foo#<bar>]]
8306 !! html/php
8307 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8308 </p>
8309 !! html/parsoid
8310 <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>
8311 !! end
8312
8313 ###
8314 ### Interwiki links (see maintenance/interwiki.sql)
8315 ###
8316
8317 !! test
8318 Inline interwiki link
8319 !! options
8320 parsoid=wt2html,wt2wt,html2html
8321 !! wikitext
8322 [[MeatBall:SoftSecurity]]
8323 !! html/php
8324 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8325 </p>
8326 !! html/parsoid
8327 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8328 !! end
8329
8330 !! test
8331 Inline interwiki link with empty title (bug 2372)
8332 !! options
8333 parsoid=wt2html,wt2wt,html2html
8334 !! wikitext
8335 [[MeatBall:]]
8336 !! html/php
8337 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8338 </p>
8339 !! html/parsoid
8340 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8341 !! end
8342
8343 !! test
8344 Interwiki link encoding conversion (bug 1636)
8345 !! wikitext
8346 *[[Wikipedia:ro:Olteni&#0355;a]]
8347 *[[Wikipedia:ro:Olteni&#355;a]]
8348 !! html
8349 <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>
8350 <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>
8351
8352 !! html+tidy
8353 <ul>
8354 <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>
8355 <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>
8356 </ul>
8357 !! end
8358
8359 !! test
8360 Interwiki link with fragment (bug 2130)
8361 !! wikitext
8362 [[MeatBall:SoftSecurity#foo]]
8363 !! html
8364 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8365 </p>
8366 !! end
8367
8368 !! test
8369 Link scenarios with escaped fragments
8370 !! wikitext
8371 [[#Is this great?]]
8372 [[Foo#Is this great?]]
8373 [[meatball:Foo#Is this great?]]
8374 !! html/php
8375 <p><a href="#Is_this_great.3F">#Is this great?</a>
8376 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8377 <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>
8378 </p>
8379 !! html/parsoid
8380 <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>
8381 <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>
8382 <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>
8383 !! end
8384
8385 # Ideally the wikipedia: prefix here should be proto-relative too
8386 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8387 # define the 'en' prefix, and originally the test used 'wikipedia',
8388 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8389 # article.
8390 !! test
8391 Different interwiki prefixes mapping to the same URL
8392 !! wikitext
8393 [[:en:Foo]]
8394
8395 [[:en:Foo|Foo]]
8396
8397 [[wikipedia:Foo]]
8398
8399 [[:wikipedia:Foo|Foo]]
8400
8401 [[wikipedia:en:Foo]]
8402
8403 [[:wikipedia:en:Foo]]
8404
8405 [[ wikiPEdia :Foo]]
8406 !! html/parsoid
8407 <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>
8408
8409 <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>
8410
8411 <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>
8412
8413 <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>
8414
8415 <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>
8416
8417 <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>
8418
8419 <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>
8420 !! end
8421
8422 !! test
8423 Interwiki links that cannot be represented in wiki syntax
8424 !! wikitext
8425 [[meatball:ok]]
8426 [[meatball:ok#foo|ok with fragment]]
8427 [[meatball:ok_as_well?|ok ending with ? mark]]
8428 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8429 [http://de.wikipedia.org/wiki/#foo is just fragment]
8430
8431 !! html/php
8432 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8433 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8434 <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>
8435 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8436 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8437 </p>
8438 !! html/parsoid
8439 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8440 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8441 <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>
8442 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8443 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8444 !! end
8445
8446 !! test
8447 Interwiki links: trail
8448 !! wikitext
8449 [[wikipedia:Foo|Ba]]r
8450 !! html/php
8451 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8452 </p>
8453 !! html/parsoid
8454 <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>
8455 !! end
8456
8457 !! test
8458 Local interwiki link
8459 !! options
8460 parsoid=wt2html,wt2wt,html2html
8461 !! wikitext
8462 [[local:Template:Foo]]
8463 !! html/php
8464 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8465 </p>
8466 !! html/parsoid
8467 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8468 !! end
8469
8470 # Parsoid does not mark self-links, by design.
8471 !! test
8472 Local interwiki link: self-link to current page
8473 !! options
8474 title=[[Main Page]]
8475 parsoid=wt2html,wt2wt,html2html
8476 !! wikitext
8477 [[local:Main Page]]
8478 !! html/php
8479 <p><strong class="selflink">local:Main Page</strong>
8480 </p>
8481 !! html/parsoid
8482 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8483 !! end
8484
8485 !! test
8486 Local interwiki link: prefix only (bug 64167)
8487 !! options
8488 parsoid=wt2html,wt2wt,html2html
8489 !! wikitext
8490 [[local:]]
8491 !! html/php
8492 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8493 </p>
8494 !! html/parsoid
8495 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8496 !! end
8497
8498 !! test
8499 Local interwiki link: with additional interwiki prefix (bug 61357)
8500 !! options
8501 parsoid=wt2html,wt2wt,html2html
8502 !! wikitext
8503 [[local:meatball:Hello]]
8504 !! html/php
8505 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8506 </p>
8507 !! html/parsoid
8508 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8509 !! end
8510
8511 !! test
8512 Multiple local interwiki link prefixes
8513 !! wikitext
8514 [[local:local:local:local:mi:local:Foo]]
8515 !! options
8516 parsoid=wt2html,wt2wt,html2html
8517 !! html/php
8518 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8519 </p>
8520 !! html/parsoid
8521 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8522 !! end
8523
8524 ###
8525 ### Interlanguage links
8526 ### Language links (so that searching for '### language' matches..)
8527 ###
8528
8529 !! test
8530 Interlanguage link
8531 !! wikitext
8532 Blah blah blah
8533 [[zh:Chinese]]
8534 !! html/php
8535 <p>Blah blah blah
8536 </p>
8537 !! html/parsoid
8538 <p>Blah blah blah</p>
8539 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8540 !! end
8541
8542 ## parsoid html2wt will lose the space variations
8543 !! test
8544 Interlanguage link with spacing
8545 !! options
8546 parsoid=wt2html,wt2wt,html2html
8547 !! wikitext
8548 Blah blah blah
8549 [[ zh : Chinese ]]
8550 !! html/php
8551 <p>Blah blah blah
8552 </p>
8553 !! html/parsoid
8554 <p>Blah blah blah</p>
8555 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8556 !! end
8557
8558 !! test
8559 Double interlanguage link
8560 !! wikitext
8561 Blah blah blah
8562 [[es:Spanish]]
8563 [[zh:Chinese]]
8564 !! html/php
8565 <p>Blah blah blah
8566 </p>
8567 !! html/parsoid
8568 <p>Blah blah blah</p>
8569 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8570 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8571 !! end
8572
8573 ## parsoid html2wt will lose the space variations
8574 !! test
8575 Interlanguage link variations
8576 !! options
8577 parsoid=wt2html,wt2wt,html2html
8578 !! wikitext
8579 Blah blah blah
8580 [[ es :Spanish]]
8581 [[ ZH :Chinese]]
8582 [[es:Foo_bar]]
8583 !! html/php
8584 <p>Blah blah blah
8585 </p>
8586 !! html/parsoid
8587 <p>Blah blah blah</p>
8588 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8589 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8590 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8591 !! end
8592
8593 ## parsoid html2wt will normalize the space to _
8594 !! test
8595 Space and question mark encoding in interlanguage links (T95473)
8596 !! options
8597 parsoid=wt2html,wt2wt,html2html
8598 !! wikitext
8599 Blah blah blah
8600 [[es:Foo bar?]]
8601 !! html/php
8602 <p>Blah blah blah
8603 </p>
8604 !! html/parsoid
8605 <p>Blah blah blah</p>
8606 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8607 !! end
8608
8609 !! test
8610 Interlanguage link, with prefix links
8611 !! options
8612 language=ln
8613 !! wikitext
8614 Blah blah blah
8615 [[zh:Chinese]]
8616 !! html/php
8617 <p>Blah blah blah
8618 </p>
8619 !! html/parsoid
8620 <p>Blah blah blah</p>
8621 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8622 !! end
8623
8624 !! test
8625 Double interlanguage link, with prefix links (bug 8897)
8626 !! options
8627 language=ln
8628 !! wikitext
8629 Blah blah blah
8630 [[es:Spanish]]
8631 [[zh:Chinese]]
8632 !! html/php
8633 <p>Blah blah blah
8634 </p>
8635 !! html/parsoid
8636 <p>Blah blah blah</p>
8637 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8638 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8639 !! end
8640
8641 !! test
8642 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8643 !! wikitext
8644 Blah blah blah
8645 [[mul:Article]]
8646 !! html/php
8647 <p>Blah blah blah
8648 </p>
8649 !! html/parsoid
8650 <p>Blah blah blah</p>
8651 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8652 !! end
8653
8654 ## PHP parser tests script needs an update
8655 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8656 !! test
8657 Language links render as inline links if $wgInterwikiMagic=false
8658 !! options
8659 wgInterwikiMagic=false
8660 parsoid=wt2html,wt2wt,html2html
8661 !! wikitext
8662 Blah blah blah
8663 [[zh:Chinese]]
8664 !! html/parsoid
8665 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8666 !! end
8667
8668 ## PHP parser tests script needs an update
8669 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8670 !! test
8671 Language links render as inline links in the Talk namespace
8672 !! options
8673 title=Talk:Foo
8674 parsoid=wt2html,wt2wt,html2html
8675 !! wikitext
8676 Blah blah blah
8677 [[zh:Chinese]]
8678 !! html/parsoid
8679 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8680 !! end
8681
8682 !! test
8683 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8684 !! options
8685 language=ln
8686 !! wikitext
8687 [[WW&nbsp;II]]
8688 !! html
8689 <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>
8690 </p>
8691 !! end
8692
8693 !! test
8694 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8695 !! options
8696 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8697 !! html/parsoid
8698 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8699 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8700 !! wikitext
8701 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8702
8703 He&amp;nbsp;llo He&amp;nbsp;llo
8704 !! html/php
8705 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8706 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8707 </p>
8708 !! end
8709
8710 # html2wt will fail because of title normalization without data-parsoid
8711 !! test
8712 Parsoid: handle constructor well
8713 !! options
8714 parsoid=wt2html,wt2wt
8715 !! wikitext
8716 [[constructor]]
8717
8718 [[constructor:foo]]
8719 !! html/php
8720 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8721 </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>
8722 </p>
8723 !! html/parsoid
8724 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8725
8726 <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>
8727 !! end
8728
8729 !! article
8730 ko:
8731 !! text
8732 Test.
8733 !! endarticle
8734
8735 # Note that `ko` isn't a known interlanguage prefix
8736 !! test
8737 Parsoid: recognize interlanguage links without a target page
8738 !! options
8739 ill
8740 !! wikitext
8741 [[es:]]
8742
8743 [[ko:]]
8744 !! html/php
8745 es:
8746 !! html/parsoid
8747 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8748
8749 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8750 !! end
8751
8752 # Note that `ko` isn't a known interwiki prefix
8753 !! test
8754 Parsoid: recognize interwiki links without a target page
8755 !! options
8756 parsoid=wt2html,wt2wt,html2html
8757 !! wikitext
8758 [[:es:]]
8759
8760 [[:ko:]]
8761 !! html/php
8762 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8763 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8764 </p>
8765 !! html/parsoid
8766 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8767 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8768 !! end
8769
8770 !! test
8771 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8772 !! wikitext
8773 [[mi:Foo]]
8774 !! html/php
8775 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8776 </p>
8777 !! html/parsoid
8778 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8779 !! end
8780
8781 !! test
8782 Interlanguage link with preceding local interwiki link (bug 68085)
8783 !! options
8784 parsoid=wt2html,wt2wt,html2html
8785 !! wikitext
8786 Blah blah blah
8787 [[local:es:Spanish]]
8788 !! html/php
8789 <p>Blah blah blah
8790 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8791 </p>
8792 !! html/parsoid
8793 <p>Blah blah blah
8794 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8795 !! end
8796
8797 !! test
8798 Looks like an interlanguage link, but is actually a local interwiki
8799 !! options
8800 parsoid=wt2html,wt2wt,html2html
8801 !! wikitext
8802 Blah blah blah
8803 [[mi:Template:Foo]]
8804 !! html/php
8805 <p>Blah blah blah
8806 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8807 </p>
8808 !! html/parsoid
8809 <p>Blah blah blah
8810 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8811 !! end
8812
8813 ###
8814 ### Redirects, Parsoid-only
8815 ###
8816
8817 !! test
8818 1. Simple redirect to page
8819 !! wikitext
8820 #REDIRECT [[Main Page]]
8821 !! html/parsoid
8822 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8823 !! end
8824
8825 !! test
8826 2. Other redirect variants
8827 !! wikitext
8828 #REDIRECT [[Main_Page]]
8829 !! html/parsoid
8830 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8831 !! end
8832
8833 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8834 # This tests the Parsoid bail-out code.
8835 !! test
8836 3. Other redirect variants
8837 !! wikitext
8838 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8839 !! html/parsoid
8840 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8841 !! end
8842
8843 !! test
8844 4. Redirect to a templated destination
8845 !! wikitext
8846 #REDIRECT [[{{echo|Foo}}bar]]
8847 !! html/parsoid
8848 <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"}]]}'/>
8849 !! end
8850
8851 !! test
8852 Empty redirect
8853 !! options
8854 parsoid=wt2html,wt2wt
8855 !! wikitext
8856 #REDIRECT [[]]
8857 !! html/parsoid
8858 <ol>
8859 <li>REDIRECT [[]]</li></ol>
8860 !! end
8861
8862 !! test
8863 Optional colon in #REDIRECT
8864 !! options
8865 # the colon is archaic syntax. we support it for wt2html, but we
8866 # don't care that it roundtrips back to the modern syntax.
8867 parsoid=wt2html,html2html
8868 !! wikitext
8869 #REDIRECT:[[Main Page]]
8870 !! html/parsoid
8871 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8872 !! end
8873
8874 !! test
8875 Whitespace in #REDIRECT with optional colon
8876 !! options
8877 # the colon and gratuitous whitespace is archaic syntax. we support
8878 # it for wt2html, but we don't care that it roundtrips back to the
8879 # modern syntax (without extra whitespace)
8880 parsoid=wt2html,html2html
8881 !! wikitext
8882
8883 #REDIRECT
8884 :
8885 [[Main Page]]
8886 !! html/parsoid
8887 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8888 !! end
8889
8890 !! test
8891 Piped link in #REDIRECT
8892 !! options
8893 # content after piped link is ignored. we support this syntax,
8894 # but don't care that the piped link is lost when we roundtrip this.
8895 parsoid=wt2html
8896 !! wikitext
8897 #REDIRECT [[Main Page|bar]]
8898 !! html/parsoid
8899 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8900 !! end
8901
8902 !! test
8903 Redirect to category (T104502)
8904 !! options
8905 parsoid=wt2html,wt2wt
8906 !! wikitext
8907 #REDIRECT [[Category:Foo]]
8908 !! html/parsoid
8909 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8910 !! end
8911
8912 !! test
8913 Redirect to category with URL encoding (T104502)
8914 !! options
8915 parsoid=wt2html
8916 !! wikitext
8917 #REDIRECT [[Category%3AFoo]]
8918 !! html/parsoid
8919 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8920 !! end
8921
8922 !! test
8923 Redirect to category page
8924 !! wikitext
8925 #REDIRECT [[:Category:Foo]]
8926 !! html/parsoid
8927 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8928 !! end
8929
8930 !! test
8931 Redirect to image page (1)
8932 !! wikitext
8933 #REDIRECT [[File:Wiki.png]]
8934 !! html/parsoid
8935 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8936 !! end
8937
8938 !! test
8939 Redirect to image page (2)
8940 !! wikitext
8941 #REDIRECT [[Image:Wiki.png]]
8942 !! html/parsoid
8943 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8944 !! end
8945
8946 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8947 # Next test confirms this.
8948 !! test
8949 Redirect to language (1) (T104918)
8950 !! options
8951 parsoid=wt2html,wt2wt,html2html
8952 !! wikitext
8953 #REDIRECT [[en:File:Wiki.png]]
8954 !! html/parsoid
8955 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8956 !! end
8957
8958 !! test
8959 Redirect to language (2) (T104918)
8960 !! wikitext
8961 #REDIRECT [[:en:File:Wiki.png]]
8962 !! html/parsoid
8963 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8964 !! end
8965
8966 !! test
8967 Redirect to interwiki (T104918)
8968 !! wikitext
8969 #REDIRECT [[meatball:File:Wiki.png]]
8970 !! html/parsoid
8971 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8972 !! end
8973
8974 !! test
8975 Non-English #REDIRECT
8976 !! options
8977 language=is
8978 !! wikitext
8979 #TILVÍSUN [[Main Page]]
8980 !! html/parsoid
8981 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8982 !! end
8983
8984 !! test
8985 Redirect syntax under text isn't considered a redirect
8986 !! wikitext
8987 some text
8988 #redirect [[Main Page]]
8989 !! html/parsoid
8990 <p>some text</p>
8991 <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>
8992 !! end
8993
8994 # FIXME: Should hoist the redirect to the top of the page and ensure there
8995 # is only one.
8996 !! test
8997 New redirect
8998 !! options
8999 parsoid=html2wt
9000 !! html/parsoid
9001 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9002 !! wikitext
9003 Foo
9004 #REDIRECT [[Foo]]
9005 !! end
9006
9007 ##
9008 ## XHTML tidiness
9009 ###
9010
9011 !! test
9012 <br> to <br />
9013 !! wikitext
9014 1<br>2<br />3
9015 !! html
9016 <p>1<br />2<br />3
9017 </p>
9018 !! end
9019
9020 !! test
9021 Broken br tag sanitization
9022 !! wikitext
9023 </br>
9024 !! html/php
9025 <p>&lt;/br&gt;
9026 </p>
9027 !! end
9028
9029 # TODO: Fix html2html mode (bug 51055)!
9030 !! test
9031 Parsoid: Broken br tag recognition
9032 !! options
9033 parsoid=wt2html
9034 !! wikitext
9035 </br>
9036
9037 <br/ >
9038 !! html+tidy
9039 <p><br /></p>
9040 <p><br /></p>
9041 !! end
9042
9043 !! test
9044 Incorrecly removing closing slashes from correctly formed XHTML
9045 !! wikitext
9046 <br style="clear:both;" />
9047 !! html
9048 <p><br style="clear:both;" />
9049 </p>
9050 !! end
9051
9052 !! test
9053 Failing to transform badly formed HTML into correct XHTML
9054 !! wikitext
9055 <br style="clear: left;">
9056 <br style="clear: right;">
9057 <br style="clear: both;">
9058 !! html
9059 <p><br style="clear: left;" />
9060 <br style="clear: right;" />
9061 <br style="clear: both;" />
9062 </p>
9063 !!end
9064
9065 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9066 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9067 !! test
9068 Handling html with a div self-closing tag
9069 !! wikitext
9070 <div title />
9071 <div title/>
9072 <div title/ >
9073 <div title=bar />
9074 <div title=bar/>
9075 <div title=bar/ >
9076 !! html/php
9077 <p>&lt;div title /&gt;
9078 &lt;div title/&gt;
9079 </p>
9080 <div>
9081 <p>&lt;div title=bar /&gt;
9082 &lt;div title=bar/&gt;
9083 </p>
9084 <div title="bar/"></div>
9085 </div>
9086
9087 !! html/parsoid
9088 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9089 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9090 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9091 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9092 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9093 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9094 !! end
9095
9096 !! test
9097 Handling html with a br self-closing tag
9098 !! wikitext
9099 <br title />
9100 <br title/>
9101 <br title/ >
9102 <br title=bar />
9103 <br title=bar/>
9104 <br title=bar/ >
9105 !! html/php
9106 <p><br title="" />
9107 <br title="" />
9108 <br />
9109 <br title="bar" />
9110 <br title="bar" />
9111 <br title="bar/" />
9112 </p>
9113 !! html/parsoid
9114 <p><br title="" />
9115 <br title="" />
9116 <br title="" />
9117 <br title="bar" />
9118 <br title="bar" />
9119 <br title="bar/" />
9120 </p>
9121 !! end
9122
9123 !! test
9124 Horizontal ruler (should it add that extra space?)
9125 !! wikitext
9126 <hr>
9127 <hr >
9128 foo <hr
9129 > bar
9130 !! html+tidy
9131 <hr />
9132 <hr />
9133 <p>foo</p>
9134 <hr />
9135 <p>bar</p>
9136 !! end
9137
9138 !! test
9139 Horizontal ruler -- 4+ dashes render hr
9140 !! wikitext
9141 ----
9142 !! html
9143 <hr />
9144
9145 !! end
9146
9147 !! test
9148 Horizontal ruler -- eats additional dashes on the same line
9149 !! wikitext
9150 ---------
9151 !! html
9152 <hr />
9153
9154 !! end
9155
9156 !! test
9157 Horizontal ruler -- does not collapse dashes on consecutive lines
9158 !! wikitext
9159 ----
9160 ----
9161 !! html
9162 <hr />
9163 <hr />
9164
9165 !! end
9166
9167 !! test
9168 Horizontal ruler -- <4 dashes render as plain text
9169 !! wikitext
9170 ---
9171 !! html
9172 <p>---
9173 </p>
9174 !! end
9175
9176 !! test
9177 Horizontal ruler -- Supports content following dashes on same line
9178 !! wikitext
9179 ---- Foo
9180 !! html
9181 <hr /> Foo
9182
9183 !! html+tidy
9184 <hr />
9185 <p>Foo</p>
9186 !! end
9187
9188 ###
9189 ### Block-level elements
9190 ###
9191 !! test
9192 Common list
9193 !! wikitext
9194 *Common list
9195 * item 2
9196 *item 3
9197 !! html
9198 <ul><li>Common list</li>
9199 <li> item 2</li>
9200 <li>item 3</li></ul>
9201
9202 !! end
9203
9204 !! test
9205 Numbered list
9206 !! wikitext
9207 #Numbered list
9208 #item 2
9209 # item 3
9210 !! html
9211 <ol><li>Numbered list</li>
9212 <li>item 2</li>
9213 <li> item 3</li></ol>
9214
9215 !! end
9216
9217 !! test
9218 Mixed list
9219 !! wikitext
9220 *Mixed list
9221 *# with numbers
9222 ** and bullets
9223 *# and numbers
9224 *bullets again
9225 **bullet level 2
9226 ***bullet level 3
9227 ***#Number on level 4
9228 **bullet level 2
9229 **#Number on level 3
9230 **#Number on level 3
9231 *#number level 2
9232 *Level 1
9233 *** Level 3
9234 #** Level 3, but ordered
9235 !! html
9236 <ul><li>Mixed list
9237 <ol><li> with numbers</li></ol>
9238 <ul><li> and bullets</li></ul>
9239 <ol><li> and numbers</li></ol></li>
9240 <li>bullets again
9241 <ul><li>bullet level 2
9242 <ul><li>bullet level 3
9243 <ol><li>Number on level 4</li></ol></li></ul></li>
9244 <li>bullet level 2
9245 <ol><li>Number on level 3</li>
9246 <li>Number on level 3</li></ol></li></ul>
9247 <ol><li>number level 2</li></ol></li>
9248 <li>Level 1
9249 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9250 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9251
9252 !! end
9253
9254 !! test
9255 1. Nested mixed wikitext and html list
9256 !! wikitext
9257 * hi
9258 * <ul><li>ho</li></ul>
9259 * hi
9260 ** ho
9261 !! html/php
9262 <ul><li> hi</li>
9263 <li> <ul><li>ho</li></ul></li>
9264 <li> hi
9265 <ul><li> ho</li></ul></li></ul>
9266
9267 !! html/parsoid
9268 <ul><li> hi</li>
9269 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9270 <li> hi
9271 <ul><li> ho</li></ul></li></ul>
9272 !! end
9273
9274 !! test
9275 2. Nested mixed wikitext and html list (incompatible)
9276 !! wikitext
9277 ; hi
9278 : {{echo|<li>ho</li>}}
9279 !! html/php
9280 <dl><dt> hi</dt>
9281 <dd> <li>ho</li></dd></dl>
9282
9283 !! html/parsoid
9284 <dl><dt> hi</dt>
9285 <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>
9286 !! end
9287
9288 !! test
9289 Nested lists 1
9290 !! wikitext
9291 *foo
9292 **bar
9293 !! html
9294 <ul><li>foo
9295 <ul><li>bar</li></ul></li></ul>
9296
9297 !! end
9298
9299 !! test
9300 Nested lists 2
9301 !! wikitext
9302 **foo
9303 *bar
9304 !! html
9305 <ul><li><ul><li>foo</li></ul></li>
9306 <li>bar</li></ul>
9307
9308 !! end
9309
9310 !! test
9311 Nested lists 3 (first element empty)
9312 !! wikitext
9313 *
9314 **bar
9315 !! html
9316 <ul><li>
9317 <ul><li>bar</li></ul></li></ul>
9318
9319 !! end
9320
9321 !! test
9322 Nested lists 4 (first element empty)
9323 !! wikitext
9324 **
9325 *bar
9326 !! html
9327 <ul><li><ul><li></li></ul></li>
9328 <li>bar</li></ul>
9329
9330 !! end
9331
9332 !! test
9333 Nested lists 5 (both elements empty)
9334 !! wikitext
9335 **
9336 *
9337 !! html
9338 <ul><li><ul><li></li></ul></li>
9339 <li></li></ul>
9340
9341 !! end
9342
9343 !! test
9344 Nested lists 6 (both elements empty)
9345 !! wikitext
9346 *
9347 **
9348 !! html
9349 <ul><li>
9350 <ul><li></li></ul></li></ul>
9351
9352 !! end
9353
9354 !! test
9355 Nested lists 7 (skip initial nesting levels)
9356 !! wikitext
9357 *** foo
9358 !! html
9359 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9360
9361 !! end
9362
9363 !! test
9364 Nested lists 8 (multiple nesting transitions)
9365 !! wikitext
9366 * foo
9367 *** bar
9368 ** baz
9369 * boo
9370 !! html
9371 <ul><li> foo
9372 <ul><li><ul><li> bar</li></ul></li>
9373 <li> baz</li></ul></li>
9374 <li> boo</li></ul>
9375
9376 !! end
9377
9378 !! test
9379 Nested lists 9 (extension interaction)
9380 !! options
9381 parsoid
9382 !! wikitext
9383 *<references />
9384 !! html/parsoid
9385 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9386 !! end
9387
9388 !! test
9389 1. Lists with start-of-line-transparent tokens before bullets: Comments
9390 !! wikitext
9391 *foo
9392 *<!--cmt-->bar
9393 <!--cmt-->*baz
9394 !! html
9395 <ul><li>foo</li>
9396 <li>bar</li>
9397 <li>baz</li></ul>
9398
9399 !! end
9400
9401 !! test
9402 2. Lists with start-of-line-transparent tokens before bullets: Template close
9403 !! wikitext
9404 *foo {{echo|bar
9405 }}*baz
9406 !! html
9407 <ul><li>foo bar</li>
9408 <li>baz</li></ul>
9409
9410 !! end
9411
9412 !! test
9413 List items are not parsed correctly following a <pre> block (bug 785)
9414 !! wikitext
9415 * <pre>foo</pre>
9416 * <pre>bar</pre>
9417 * zar
9418 !! html/php
9419 <ul><li> <pre>foo</pre></li>
9420 <li> <pre>bar</pre></li>
9421 <li> zar</li></ul>
9422
9423 !! html/parsoid
9424 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9425 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9426 <li> zar</li></ul>
9427 !! end
9428
9429 !! test
9430 List items from template
9431 !! wikitext
9432
9433 {{inner list}}
9434 * item 2
9435
9436 * item 0
9437 {{inner list}}
9438 * item 2
9439
9440 * item 0
9441 * notSOL{{inner list}}
9442 * item 2
9443 !! html
9444 <ul><li> item 1</li>
9445 <li> item 2</li></ul>
9446 <ul><li> item 0</li>
9447 <li> item 1</li>
9448 <li> item 2</li></ul>
9449 <ul><li> item 0</li>
9450 <li> notSOL</li>
9451 <li> item 1</li>
9452 <li> item 2</li></ul>
9453
9454 !! end
9455
9456 !! test
9457 List interrupted by empty line or heading
9458 !! wikitext
9459 * foo
9460
9461 ** bar
9462 == A heading ==
9463 * Another list item
9464 !! html
9465 <ul><li> foo</li></ul>
9466 <ul><li><ul><li> bar</li></ul></li></ul>
9467 <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>
9468 <ul><li> Another list item</li></ul>
9469
9470 !!end
9471
9472 !!test
9473 Multiple list tags generated by templates
9474 !! wikitext
9475 {{echo|<li>}}a
9476 {{echo|<li>}}b
9477 {{echo|<li>}}c
9478 !! html
9479 <li>a
9480 <li>b
9481 <li>c</li>
9482 </li>
9483 </li>
9484
9485 !! html+tidy
9486 <ul>
9487 <li>a</li>
9488 <li>b</li>
9489 <li>c</li>
9490 </ul>
9491 !!end
9492
9493 !!test
9494 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9495 !! wikitext
9496 *a
9497 <!--This line will NOT split the list-->
9498 *b
9499 <!--This line will NOT split the list either-->
9500 *c
9501 <!--foo--> <!----> <!--This line NOT split the list either-->
9502 *d
9503 !! html
9504 <ul><li>a</li>
9505 <li>b</li>
9506 <li>c</li>
9507 <li>d</li></ul>
9508
9509 !!end
9510
9511 !!test
9512 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9513 !! wikitext
9514 *a
9515 <!--This line will NOT split the list-->
9516 *b
9517 <!--This line will NOT split the list either-->
9518 *c
9519 <!--foo--> <!----> <!--This line NOT split the list
9520 either-->
9521 *d
9522 !! html
9523 <ul><li>a</li>
9524 <li>b</li>
9525 <li>c</li>
9526 <li>d</li></ul>
9527
9528 !!end
9529
9530 !!test
9531 Test the li-hack
9532 (The PHP parser relies on Tidy for the hack)
9533 !!options
9534 parsoid=wt2html,wt2wt
9535 !! wikitext
9536 * foo
9537 * <li>li-hack
9538 * {{echo|<li>templated li-hack}}
9539 * <!--foo--> <li> unsupported li-hack with preceding comments
9540
9541 <ul>
9542 <li><li>not a li-hack
9543 </li>
9544 </ul>
9545 !! html+tidy
9546 <ul>
9547 <li>foo</li>
9548 <li>li-hack</li>
9549 <li>templated li-hack</li>
9550 <li>unsupported li-hack with preceding comments</li>
9551 </ul>
9552 <ul>
9553 <li>not a li-hack</li>
9554 </ul>
9555 !!end
9556
9557 !! test
9558 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9559 !! options
9560 parsoid
9561 !! wikitext
9562 # foo
9563 ## bar
9564 * foo
9565 ** bar
9566 : foo
9567 :: bar
9568 !! html
9569 <ol>
9570 <li> foo<ol>
9571 <li> bar</li>
9572 </ol></li>
9573 </ol><ul>
9574 <li> foo<ul>
9575 <li> bar</li>
9576 </ul></li>
9577 </ul><dl>
9578 <dd> foo<dl>
9579 <dd> bar</dd>
9580 </dl></dd>
9581 </dl>
9582 !! end
9583
9584 !! test
9585 Parsoid: Test of whitespace serialization with Templated bullets
9586 !! options
9587 parsoid
9588 !! wikitext
9589 * {{bullet}}
9590 !! html
9591 <ul>
9592 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9593 </ul>
9594 !! end
9595
9596 # ------------------------------------------------------------------------
9597 # The next set of tests are about Parsoid's ability to handle badly nested
9598 # tags (parse, minimize scope of fixup, and roundtrip back)
9599 # ------------------------------------------------------------------------
9600
9601 !! test
9602 Unbalanced closing block tags break a list
9603 (php parser relies on Tidy to fix up)
9604 !! wikitext
9605 <div>
9606 *a</div><div>
9607 *b</div>
9608 !! html+tidy
9609 <div>
9610 <ul>
9611 <li>a</li>
9612 </ul>
9613 </div>
9614 <div>
9615 <ul>
9616 <li>b</li>
9617 </ul>
9618 </div>
9619 !! end
9620
9621 # Parsoid fails this test, but it might be tricky to support properly.
9622 # See bug 68395.
9623 !! test
9624 Unbalanced closing non-block tags don't break a list
9625 (php parser relies on Tidy to fix up)
9626 !! wikitext
9627 <span>
9628 *a</span><span>
9629 *b</span>
9630 !! html/php+tidy
9631 <ul>
9632 <li><span>a</span></li>
9633 <li><span>b</span></li>
9634 </ul>
9635 !! html/parsoid
9636 <span>
9637 <ul>
9638 <li>a<span></span>
9639 </li>
9640 <li>b
9641 </li>
9642 </ul>
9643 </span>
9644 !! end
9645
9646 !! test
9647 Unclosed formatting tags that straddle lists are closed and reopened
9648 (php parser relies on Tidy to fix up)
9649 !! options
9650 parsoid=wt2html,wt2wt,html2html
9651 !! wikitext
9652 # <s> a
9653 # b </s>
9654 !! html/php+tidy
9655 <ol>
9656 <li><s>a</s></li>
9657 <li><s>b</s></li>
9658 </ol>
9659 !! html/parsoid
9660 <ol><li> <s> a</s></li>
9661 <li><s> b </s></li></ol>
9662 !! end
9663
9664 # See bug 68395.
9665 !!test
9666 1. List embedded in a formatting tag
9667 !! wikitext
9668 <small>
9669 * foo
9670 </small>
9671 !! html/php+tidy
9672 <ul>
9673 <li><small>foo</small></li>
9674 </ul>
9675 !! html/parsoid
9676 <small>
9677 <ul>
9678 <li> foo</li>
9679 </ul>
9680 </small>
9681 !!end
9682
9683 ## Ugly Parsoid output here
9684 ## Not sure what the right output is.
9685 !!test
9686 2. List embedded in a formatting tag
9687 !! wikitext
9688 <small>
9689 *a
9690 *b</small>
9691 !! html/php+tidy
9692 <ul>
9693 <li><small>a</small></li>
9694 <li><small>b</small></li>
9695 </ul>
9696 !! html/parsoid
9697 <small></small>
9698 <ul><small>
9699 <li>a</li>
9700 </small>
9701 <li><small>b</small></li>
9702 </ul>
9703 !!end
9704
9705 # Ugly Parsoid and PHP parser output here
9706 # Not sure if we want to make this a test!
9707 #
9708 ## !!test
9709 ## 3. Unclosed formatting tags in list elements
9710 ## !! wikitext
9711 ## *<small>a
9712 ## *<small>b
9713 ## !! html/php+tidy
9714 ## <ul>
9715 ## <li><small>a</small></li>
9716 ## <li><small><small>b</small></small></li>
9717 ## </ul>
9718 ## !! html/parsoid
9719 ## <ul>
9720 ## <li><small>a</small></li>
9721 ## <small>
9722 ## <li><small>b</small></li>
9723 ## </small></ul>
9724 ## !!end
9725
9726 # This is a bug in the PHP parser + tidy combination.
9727 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9728 # and then fostered out of the table by tidy.)
9729 # We believe the Parsoid output to be correct.
9730 !! test
9731 Table with missing opening <tr> tag
9732 !! options
9733 parsoid=wt2html,wt2wt
9734 !! wikitext
9735 <table>
9736 <td>foo</td>
9737 </tr>
9738 </table>
9739 !! html+tidy
9740 <table>
9741 <tr>
9742 <td>foo</td>
9743 </tr>
9744 </table>
9745 !! end
9746
9747 ###
9748 ### Magic Words
9749 ###
9750
9751 # Note that the current date is hard-coded as
9752 # 1970-01-01T00:02:03Z (a Thursday)
9753 # when running parser tests. The timezone is also fixed to GMT, so
9754 # local date will be identical to current date.
9755
9756 !! test
9757 Magic Word: {{CURRENTDAY}}
9758 !! wikitext
9759 {{CURRENTDAY}}
9760 !! html
9761 <p>1
9762 </p>
9763 !! end
9764
9765 !! test
9766 Magic Word: {{CURRENTDAY2}}
9767 !! wikitext
9768 {{CURRENTDAY2}}
9769 !! html
9770 <p>01
9771 </p>
9772 !! end
9773
9774 !! test
9775 Magic Word: {{CURRENTDAYNAME}}
9776 !! wikitext
9777 {{CURRENTDAYNAME}}
9778 !! html
9779 <p>Thursday
9780 </p>
9781 !! end
9782
9783 !! test
9784 Magic Word: {{CURRENTDOW}}
9785 !! wikitext
9786 {{CURRENTDOW}}
9787 !! html
9788 <p>4
9789 </p>
9790 !! end
9791
9792 !! test
9793 Magic Word: {{CURRENTMONTH}}
9794 !! wikitext
9795 {{CURRENTMONTH}}
9796 !! html
9797 <p>01
9798 </p>
9799 !! end
9800
9801 !! test
9802 Magic Word: {{CURRENTMONTH1}}
9803 !! wikitext
9804 {{CURRENTMONTH1}}
9805 !! html
9806 <p>1
9807 </p>
9808 !! end
9809
9810 !! test
9811 Magic Word: {{CURRENTMONTHABBREV}}
9812 !! wikitext
9813 {{CURRENTMONTHABBREV}}
9814 !! html
9815 <p>Jan
9816 </p>
9817 !! end
9818
9819 !! test
9820 Magic Word: {{CURRENTMONTHNAME}}
9821 !! wikitext
9822 {{CURRENTMONTHNAME}}
9823 !! html
9824 <p>January
9825 </p>
9826 !! end
9827
9828 !! test
9829 Magic Word: {{CURRENTMONTHNAMEGEN}}
9830 !! wikitext
9831 {{CURRENTMONTHNAMEGEN}}
9832 !! html
9833 <p>January
9834 </p>
9835 !! end
9836
9837 !! test
9838 Magic Word: {{CURRENTTIME}}
9839 !! wikitext
9840 {{CURRENTTIME}}
9841 !! html
9842 <p>00:02
9843 </p>
9844 !! end
9845
9846 !! test
9847 Magic Word: {{CURRENTHOUR}}
9848 !! wikitext
9849 {{CURRENTHOUR}}
9850 !! html
9851 <p>00
9852 </p>
9853 !! end
9854
9855 !! test
9856 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9857 !! wikitext
9858 {{CURRENTWEEK}}
9859 !! html
9860 <p>1
9861 </p>
9862 !! end
9863
9864 !! test
9865 Magic Word: {{CURRENTYEAR}}
9866 !! wikitext
9867 {{CURRENTYEAR}}
9868 !! html
9869 <p>1970
9870 </p>
9871 !! end
9872
9873 !! test
9874 Magic Word: {{CURRENTTIMESTAMP}}
9875 !! wikitext
9876 {{CURRENTTIMESTAMP}}
9877 !! html
9878 <p>19700101000203
9879 </p>
9880 !! end
9881
9882 !! test
9883 Magic Words LOCAL (UTC)
9884 !! wikitext
9885 * {{LOCALMONTH}}
9886 * {{LOCALMONTH1}}
9887 * {{LOCALMONTHNAME}}
9888 * {{LOCALMONTHNAMEGEN}}
9889 * {{LOCALMONTHABBREV}}
9890 * {{LOCALDAY}}
9891 * {{LOCALDAY2}}
9892 * {{LOCALDAYNAME}}
9893 * {{LOCALYEAR}}
9894 * {{LOCALTIME}}
9895 * {{LOCALHOUR}}
9896 * {{LOCALWEEK}}
9897 * {{LOCALDOW}}
9898 * {{LOCALTIMESTAMP}}
9899 !! html
9900 <ul><li> 01</li>
9901 <li> 1</li>
9902 <li> January</li>
9903 <li> January</li>
9904 <li> Jan</li>
9905 <li> 1</li>
9906 <li> 01</li>
9907 <li> Thursday</li>
9908 <li> 1970</li>
9909 <li> 00:02</li>
9910 <li> 00</li>
9911 <li> 1</li>
9912 <li> 4</li>
9913 <li> 19700101000203</li></ul>
9914
9915 !! end
9916
9917 !! test
9918 Magic Word: {{FULLPAGENAME}}
9919 !! options
9920 title=[[User:Ævar Arnfjörð Bjarmason]]
9921 !! wikitext
9922 {{FULLPAGENAME}}
9923 !! html
9924 <p>User:Ævar Arnfjörð Bjarmason
9925 </p>
9926 !! end
9927
9928 !! test
9929 Magic Word: {{FULLPAGENAMEE}}
9930 !! options
9931 title=[[User:Ævar Arnfjörð Bjarmason]]
9932 !! wikitext
9933 {{FULLPAGENAMEE}}
9934 !! html
9935 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9936 </p>
9937 !! end
9938
9939 !! test
9940 Magic Word: {{TALKSPACE}}
9941 !! options
9942 title=[[User:Ævar Arnfjörð Bjarmason]]
9943 !! wikitext
9944 {{TALKSPACE}}
9945 !! html
9946 <p>User talk
9947 </p>
9948 !! end
9949
9950 !! test
9951 Magic Word: {{TALKSPACE}}, same namespace
9952 !! options
9953 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9954 !! wikitext
9955 {{TALKSPACE}}
9956 !! html
9957 <p>User talk
9958 </p>
9959 !! end
9960
9961 !! test
9962 Magic Word: {{TALKSPACE}}, main namespace
9963 !! options
9964 title=[[Parser Test]]
9965 !! wikitext
9966 {{TALKSPACE}}
9967 !! html
9968 <p>Talk
9969 </p>
9970 !! end
9971
9972 !! test
9973 Magic Word: {{TALKSPACEE}}
9974 !! options
9975 title=[[User:Ævar Arnfjörð Bjarmason]]
9976 !! wikitext
9977 {{TALKSPACEE}}
9978 !! html
9979 <p>User_talk
9980 </p>
9981 !! end
9982
9983 !! test
9984 Magic Word: {{SUBJECTSPACE}}
9985 !! options
9986 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9987 !! wikitext
9988 {{SUBJECTSPACE}}
9989 !! html
9990 <p>User
9991 </p>
9992 !! end
9993
9994 !! test
9995 Magic Word: {{SUBJECTSPACE}}, same namespace
9996 !! options
9997 title=[[User:Ævar Arnfjörð Bjarmason]]
9998 !! wikitext
9999 {{SUBJECTSPACE}}
10000 !! html
10001 <p>User
10002 </p>
10003 !! end
10004
10005 !! test
10006 Magic Word: {{SUBJECTSPACE}}, main namespace
10007 !! options
10008 title=[[Parser Test]]
10009 !! wikitext
10010 {{SUBJECTSPACE}}
10011 !! html
10012
10013 !! end
10014
10015 !! test
10016 Magic Word: {{SUBJECTSPACEE}}
10017 !! options
10018 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10019 !! wikitext
10020 {{SUBJECTSPACEE}}
10021 !! html
10022 <p>User
10023 </p>
10024 !! end
10025
10026 !! test
10027 Magic Word: {{NAMESPACE}}
10028 !! options
10029 title=[[User:Ævar Arnfjörð Bjarmason]]
10030 !! wikitext
10031 {{NAMESPACE}}
10032 !! html
10033 <p>User
10034 </p>
10035 !! end
10036
10037 !! test
10038 Magic Word: {{NAMESPACEE}}
10039 !! options
10040 title=[[User:Ævar Arnfjörð Bjarmason]]
10041 !! wikitext
10042 {{NAMESPACEE}}
10043 !! html
10044 <p>User
10045 </p>
10046 !! end
10047
10048 !! test
10049 Magic Word: {{NAMESPACENUMBER}}
10050 !! options
10051 title=[[User:Ævar Arnfjörð Bjarmason]]
10052 !! wikitext
10053 {{NAMESPACENUMBER}}
10054 !! html
10055 <p>2
10056 </p>
10057 !! end
10058
10059 !! test
10060 Magic Word: {{SUBPAGENAME}}
10061 !! options
10062 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10063 !! wikitext
10064 {{SUBPAGENAME}}
10065 !! html
10066 <p>sub ö
10067 </p>
10068 !! end
10069
10070 !! test
10071 Magic Word: {{SUBPAGENAMEE}}
10072 !! options
10073 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10074 !! wikitext
10075 {{SUBPAGENAMEE}}
10076 !! html
10077 <p>sub_%C3%B6
10078 </p>
10079 !! end
10080
10081 !! test
10082 Magic Word: {{ROOTPAGENAME}}
10083 !! options
10084 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10085 !! wikitext
10086 {{ROOTPAGENAME}}
10087 !! html
10088 <p>Ævar Arnfjörð Bjarmason
10089 </p>
10090 !! end
10091
10092 !! test
10093 Magic Word: {{ROOTPAGENAMEE}}
10094 !! options
10095 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10096 !! wikitext
10097 {{ROOTPAGENAMEE}}
10098 !! html
10099 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10100 </p>
10101 !! end
10102
10103 !! test
10104 Magic Word: {{BASEPAGENAME}}
10105 !! options
10106 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10107 !! wikitext
10108 {{BASEPAGENAME}}
10109 !! html
10110 <p>Ævar Arnfjörð Bjarmason
10111 </p>
10112 !! end
10113
10114 !! test
10115 Magic Word: {{BASEPAGENAMEE}}
10116 !! options
10117 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10118 !! wikitext
10119 {{BASEPAGENAMEE}}
10120 !! html
10121 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10122 </p>
10123 !! end
10124
10125 !! test
10126 Magic Word: {{TALKPAGENAME}}
10127 !! options
10128 title=[[User:Ævar Arnfjörð Bjarmason]]
10129 !! wikitext
10130 {{TALKPAGENAME}}
10131 !! html
10132 <p>User talk:Ævar Arnfjörð Bjarmason
10133 </p>
10134 !! end
10135
10136 !! test
10137 Magic Word: {{TALKPAGENAMEE}}
10138 !! options
10139 title=[[User:Ævar Arnfjörð Bjarmason]]
10140 !! wikitext
10141 {{TALKPAGENAMEE}}
10142 !! html
10143 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10144 </p>
10145 !! end
10146
10147 !! test
10148 Magic Word: {{SUBJECTPAGENAME}}
10149 !! options
10150 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10151 !! wikitext
10152 {{SUBJECTPAGENAME}}
10153 !! html
10154 <p>User:Ævar Arnfjörð Bjarmason
10155 </p>
10156 !! end
10157
10158 !! test
10159 Magic Word: {{SUBJECTPAGENAMEE}}
10160 !! options
10161 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10162 !! wikitext
10163 {{SUBJECTPAGENAMEE}}
10164 !! html
10165 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10166 </p>
10167 !! end
10168
10169 !! test
10170 Magic Word: {{NUMBEROFFILES}}
10171 !! wikitext
10172 {{NUMBEROFFILES}}
10173 !! html
10174 <p>7
10175 </p>
10176 !! end
10177
10178 !! test
10179 Magic Word: {{PAGENAME}}
10180 !! options
10181 title=[[User:Ævar Arnfjörð Bjarmason]]
10182 !! wikitext
10183 {{PAGENAME}}
10184 !! html
10185 <p>Ævar Arnfjörð Bjarmason
10186 </p>
10187 !! end
10188
10189 !! test
10190 Magic Word: {{PAGENAME}} with metacharacters
10191 !! options
10192 title=[['foo & bar = baz']]
10193 !! wikitext
10194 ''{{PAGENAME}}''
10195 !! html/php
10196 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10197 </p>
10198 !! html+tidy
10199 <p><i>'foo &amp; bar = baz'</i></p>
10200 !! end
10201
10202 !! test
10203 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
10204 !! options
10205 title=[[*RFC 1234 http://example.com/]]
10206 !! wikitext
10207 {{PAGENAME}}
10208 !! html/php
10209 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10210 </p>
10211 !! html+tidy
10212 <p>*RFC 1234 http://example.com/</p>
10213 !! end
10214
10215 !! test
10216 Magic Word: {{PAGENAMEE}}
10217 !! options
10218 title=[[User:Ævar Arnfjörð Bjarmason]]
10219 !! wikitext
10220 {{PAGENAMEE}}
10221 !! html
10222 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10223 </p>
10224 !! end
10225
10226 !! test
10227 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10228 !! options
10229 title=[[*RFC 1234 http://example.com/]]
10230 !! wikitext
10231 {{PAGENAMEE}}
10232 !! html/php
10233 <p>&#42;RFC_1234_http&#58;//example.com/
10234 </p>
10235 !! html+tidy
10236 <p>*RFC_1234_http://example.com/</p>
10237 !! end
10238
10239 !! test
10240 Magic Word: {{REVISIONID}}
10241 !! wikitext
10242 {{REVISIONID}}
10243 !! html
10244 <p>1337
10245 </p>
10246 !! end
10247
10248 !! test
10249 Magic Word: {{SCRIPTPATH}}
10250 !! wikitext
10251 {{SCRIPTPATH}}
10252 !! html
10253
10254 !! end
10255
10256 !! test
10257 Magic Word: {{STYLEPATH}}
10258 !! wikitext
10259 {{STYLEPATH}}
10260 !! html
10261 <p>/skins
10262 </p>
10263 !! end
10264
10265 !! test
10266 Magic Word: {{SERVER}}
10267 !! wikitext
10268 {{SERVER}}
10269 !! html
10270 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10271 </p>
10272 !! end
10273
10274 !! test
10275 Magic Word: {{SERVERNAME}}
10276 !! wikitext
10277 {{SERVERNAME}}
10278 !! html
10279 <p>example.org
10280 </p>
10281 !! end
10282
10283 !! test
10284 Magic Word: {{SITENAME}}
10285 !! wikitext
10286 {{SITENAME}}
10287 !! html
10288 <p>MediaWiki
10289 </p>
10290 !! end
10291
10292 !! test
10293 Magic Word: {{PAGELANGUAGE}}
10294 !! options
10295 language=fr
10296 !! wikitext
10297 {{PAGELANGUAGE}}
10298 !! html
10299 <p>fr
10300 </p>
10301 !! end
10302
10303 !! test
10304 Case-sensitive magic words, when cased differently, should just be template transclusions
10305 !! wikitext
10306 {{CurrentMonth}}
10307 {{currentday}}
10308 {{cURreNTweEK}}
10309 {{currentHour}}
10310 !! html
10311 <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>
10312 <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>
10313 <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>
10314 <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>
10315 </p>
10316 !! end
10317
10318 !! test
10319 Case-insensitive magic words should still work with weird casing.
10320 !! wikitext
10321 {{sErVeRNaMe}}
10322 {{LCFirst:AOEU}}
10323 {{ucFIRST:aoeu}}
10324 {{SERver}}
10325 !! html
10326 <p>example.org
10327 aOEU
10328 Aoeu
10329 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10330 </p>
10331 !! end
10332
10333 # From plwiki:PLOS_ONE
10334 !! test
10335 Parsoid: Page property magic word with magic word contents
10336 !! wikitext
10337 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10338 !! html/parsoid
10339 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
10340 !! end
10341
10342 !! test
10343 Parsoid: Template-generated DISPLAYTITLE
10344 !! wikitext
10345 {{{{echo|DISPLAYTITLE}}:Foo}}
10346 !! html/parsoid
10347 <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}}]}'/>
10348 !! end
10349
10350 !! test
10351 Namespace 1 {{ns:1}}
10352 !! wikitext
10353 {{ns:1}}
10354 !! html
10355 <p>Talk
10356 </p>
10357 !! end
10358
10359 !! test
10360 Namespace 1 {{ns:01}}
10361 !! wikitext
10362 {{ns:01}}
10363 !! html
10364 <p>Talk
10365 </p>
10366 !! end
10367
10368 !! test
10369 Namespace 0 {{ns:0}} (bug 4783)
10370 !! wikitext
10371 {{ns:0}}
10372 !! html
10373
10374 !! end
10375
10376 !! test
10377 Namespace 0 {{ns:00}} (bug 4783)
10378 !! wikitext
10379 {{ns:00}}
10380 !! html
10381
10382 !! end
10383
10384 !! test
10385 Namespace -1 {{ns:-1}}
10386 !! wikitext
10387 {{ns:-1}}
10388 !! html
10389 <p>Special
10390 </p>
10391 !! end
10392
10393 !! test
10394 Namespace User {{ns:User}}
10395 !! wikitext
10396 {{ns:User}}
10397 !! html
10398 <p>User
10399 </p>
10400 !! end
10401
10402 !! test
10403 Namespace User talk {{ns:User_talk}}
10404 !! wikitext
10405 {{ns:User_talk}}
10406 !! html
10407 <p>User talk
10408 </p>
10409 !! end
10410
10411 !! test
10412 Namespace User talk {{ns:uSeR tAlK}}
10413 !! wikitext
10414 {{ns:uSeR tAlK}}
10415 !! html
10416 <p>User talk
10417 </p>
10418 !! end
10419
10420 !! test
10421 Namespace File {{ns:File}}
10422 !! wikitext
10423 {{ns:File}}
10424 !! html
10425 <p>File
10426 </p>
10427 !! end
10428
10429 !! test
10430 Namespace File {{ns:Image}}
10431 !! wikitext
10432 {{ns:Image}}
10433 !! html
10434 <p>File
10435 </p>
10436 !! end
10437
10438 !! test
10439 Namespace (lang=de) Benutzer {{ns:User}}
10440 !! options
10441 language=de
10442 !! wikitext
10443 {{ns:User}}
10444 !! html
10445 <p>Benutzer
10446 </p>
10447 !! end
10448
10449 !! test
10450 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10451 !! options
10452 language=de
10453 !! wikitext
10454 {{ns:3}}
10455 !! html
10456 <p>Benutzer Diskussion
10457 </p>
10458 !! end
10459
10460 !! test
10461 Urlencode
10462 !! wikitext
10463 {{urlencode:hi world?!}}
10464 {{urlencode:hi world?!|WIKI}}
10465 {{urlencode:hi world?!|PATH}}
10466 {{urlencode:hi world?!|QUERY}}
10467 !! html/php
10468 <p>hi+world%3F%21
10469 hi_world%3F!
10470 hi%20world%3F%21
10471 hi+world%3F%21
10472 </p>
10473 !! end
10474
10475 !! test
10476 Magic Word: prioritize type info over data-parsoid
10477 !! options
10478 parsoid=html2wt
10479 !! html/parsoid
10480 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10481 !! wikitext
10482 __FORCETOC__
10483 !! end
10484
10485 !! test
10486 Magic Word: serialize on separate line (parsoid)
10487 !! options
10488 parsoid=wt2wt,html2wt
10489 !! wikitext
10490 foo
10491 __NOTOC__
10492 bar
10493 !! html/parsoid
10494 foo<meta property="mw:PageProp/notoc"/>bar
10495 !! end
10496
10497 !! test
10498 Magic Word: rt non-english wikis
10499 !! options
10500 parsoid=wt2wt
10501 language=de
10502 !! wikitext
10503 __NOEDITSECTION__
10504 !! html/parsoid
10505 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10506 !! end
10507
10508 !!test
10509 __proto__ is treated as normal wikitext (T105997)
10510 !!wikitext
10511 __proto__
10512 !!html
10513 <p>__proto__
10514 </p>
10515 !!end
10516
10517 ###
10518 ### Magic links
10519 ###
10520 !! test
10521 Magic links: internal link to RFC (bug 479)
10522 !! wikitext
10523 [[RFC 123]]
10524 !! html/php
10525 <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>
10526 </p>
10527 !! html/parsoid
10528 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10529 !! end
10530
10531 !! test
10532 Magic links: RFC (bug 479)
10533 !! wikitext
10534 RFC 822
10535 !! html/php
10536 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10537 </p>
10538 !! html/parsoid
10539 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10540 !! end
10541
10542 !! test
10543 Magic links: RFC (bug 65278)
10544 !! wikitext
10545 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10546 !! html/php
10547 <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.
10548 </p>
10549 !! html/parsoid
10550 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10551 !! end
10552
10553 !! test
10554 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10555 !! wikitext
10556 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10557 RFC
10558 822
10559 !! html/php
10560 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10561 RFC
10562 822
10563 </p>
10564 !! html/parsoid
10565 <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>
10566 RFC
10567 822</p>
10568 !! end
10569
10570 !! test
10571 Magic links: ISBN (bug 1937)
10572 !! wikitext
10573 ISBN 0-306-40615-2
10574 !! html/php
10575 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10576 </p>
10577 !! html/parsoid
10578 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10579 !! end
10580
10581 !! test
10582 Magic links: ISBN (bug 65278)
10583 !! wikitext
10584 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10585 !! html/php
10586 <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.
10587 </p>
10588 !! html/parsoid
10589 <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>
10590 !! end
10591
10592 !! test
10593 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10594 !! wikitext
10595 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10596 ISBN
10597 9780316098113
10598 ISBN 978
10599 0316098113
10600 !! html/php
10601 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10602 ISBN
10603 9780316098113
10604 ISBN 978
10605 0316098113
10606 </p>
10607 !! html/parsoid
10608 <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>
10609 ISBN
10610 9780316098113
10611 ISBN 978
10612 0316098113</p>
10613 !! end
10614
10615 !! test
10616 Magic links: PMID incorrectly converts space to underscore
10617 !! wikitext
10618 PMID 1234
10619 !! html/php
10620 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10621 </p>
10622 !! html/parsoid
10623 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10624 !! end
10625
10626 !! test
10627 Magic links: PMID (bug 65278)
10628 !! wikitext
10629 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10630 !! html/php
10631 <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.
10632 </p>
10633 !! html/parsoid
10634 <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>
10635 !! end
10636
10637 !! test
10638 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10639 !! wikitext
10640 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10641 PMID
10642 1234
10643 !! html/php
10644 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10645 PMID
10646 1234
10647 </p>
10648 !! html/parsoid
10649 <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>
10650 PMID
10651 1234</p>
10652 !! end
10653
10654 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10655 # since these are ExtLinkText, not MagicLinkText
10656 !! test
10657 Magic links: use appropriate serialization for "almost" magic links.
10658 !! wikitext
10659 X[[Special:BookSources/0978739256|foo]]
10660
10661 X[//tools.ietf.org/html/rfc1234 foo]
10662 !! html/php
10663 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10664 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10665 </p>
10666 !! html/parsoid
10667 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10668 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10669 !! end
10670
10671 !! test
10672 Magic links: All disabled (T47942)
10673 !! options
10674 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10675 !! wikitext
10676 ISBN 0-306-40615-2
10677 PMID 1234
10678 RFC 4321
10679 !! html/php
10680 <p>ISBN 0-306-40615-2
10681 PMID 1234
10682 RFC 4321
10683 </p>
10684 !! end
10685
10686 ###
10687 ### Templates
10688 ####
10689
10690 !! test
10691 Nonexistent template
10692 !! wikitext
10693 {{thistemplatedoesnotexist}}
10694 !! html
10695 <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>
10696 </p>
10697 !! end
10698
10699 !! test
10700 Template with invalid target containing tags
10701 !! wikitext
10702 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10703 !! html
10704 <p>{{a<b>b</b>|foo|a=b|a = b}}
10705 </p>
10706 !! end
10707
10708 !! test
10709 Template with invalid target containing unclosed tag
10710 !! wikitext
10711 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10712 !! html
10713 <p>{{a<b>|foo|a=b|a = b}}</b>
10714 </p>
10715 !! end
10716
10717 !! test
10718 Template with invalid target containing wikilink
10719 !! wikitext
10720 {{[[Main Page]]}}
10721 !! html/php
10722 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10723 </p>
10724 !! html/parsoid
10725 <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>
10726 !! end
10727
10728 !! test
10729 Template with just whitespace in it, bug #68421
10730 !! wikitext
10731 {{echo|{{ }}}}
10732 !! html/parsoid
10733 <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>
10734 !! end
10735
10736 !! article
10737 Template:test
10738 !! text
10739 This is a test template
10740 !! endarticle
10741
10742 !! test
10743 Simple template
10744 !! wikitext
10745 {{test}}
10746 !! html
10747 <p>This is a test template
10748 </p>
10749 !! end
10750
10751 !! test
10752 Template with explicit namespace
10753 !! wikitext
10754 {{Template:test}}
10755 !! html
10756 <p>This is a test template
10757 </p>
10758 !! end
10759
10760
10761 !! article
10762 Template:paramtest
10763 !! text
10764 This is a test template with parameter {{{param}}}
10765 !! endarticle
10766
10767 !! test
10768 Template parameter
10769 !! wikitext
10770 {{paramtest|param=foo}}
10771 !! html
10772 <p>This is a test template with parameter foo
10773 </p>
10774 !! end
10775
10776 !! article
10777 Template:paramtestnum
10778 !! text
10779 [[{{{1}}}|{{{2}}}]]
10780 !! endarticle
10781
10782 !! test
10783 Template unnamed parameter
10784 !! wikitext
10785 {{paramtestnum|Main Page|the main page}}
10786 !! html
10787 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10788 </p>
10789 !! end
10790
10791 !! article
10792 Template:templatesimple
10793 !! text
10794 (test)
10795 !! endarticle
10796
10797 !! article
10798 Template:templateredirect
10799 !! text
10800 #redirect [[Template:templatesimple]]
10801 !! endarticle
10802
10803 !! article
10804 Template:templateasargtestnum
10805 !! text
10806 {{{{{1}}}}}
10807 !! endarticle
10808
10809 !! article
10810 Template:templateasargtest
10811 !! text
10812 {{template{{{templ}}}}}
10813 !! endarticle
10814
10815 !! article
10816 Template:templateasargtest2
10817 !! text
10818 {{{{{templ}}}}}
10819 !! endarticle
10820
10821 !! test
10822 Template with template name as unnamed argument
10823 !! wikitext
10824 {{templateasargtestnum|templatesimple}}
10825 !! html
10826 <p>(test)
10827 </p>
10828 !! end
10829
10830 !! test
10831 Template with template name as argument
10832 !! wikitext
10833 {{templateasargtest|templ=simple}}
10834 !! html
10835 <p>(test)
10836 </p>
10837 !! end
10838
10839 !! test
10840 Template with template name as argument (2)
10841 !! wikitext
10842 {{templateasargtest2|templ=templatesimple}}
10843 !! html
10844 <p>(test)
10845 </p>
10846 !! end
10847
10848 !! article
10849 Template:templateasargtestdefault
10850 !! text
10851 {{{{{templ|templatesimple}}}}}
10852 !! endarticle
10853
10854 !! article
10855 Template:templa
10856 !! text
10857 '''templ'''
10858 !! endarticle
10859
10860 !! test
10861 Template with default value
10862 !! wikitext
10863 {{templateasargtestdefault}}
10864 !! html
10865 <p>(test)
10866 </p>
10867 !! end
10868
10869 !! test
10870 Template with default value (value set)
10871 !! wikitext
10872 {{templateasargtestdefault|templ=templa}}
10873 !! html
10874 <p><b>templ</b>
10875 </p>
10876 !! end
10877
10878 !! test
10879 Template redirect
10880 !! wikitext
10881 {{templateredirect}}
10882 !! html/php
10883 <p>(test)
10884 </p>
10885 !! html/parsoid
10886 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10887 !! end
10888
10889 !! test
10890 Template with argument in separate line
10891 !! wikitext
10892 {{ templateasargtest |
10893 templ = simple }}
10894 !! html
10895 <p>(test)
10896 </p>
10897 !! end
10898
10899 !! test
10900 Template with complex template as argument
10901 !! wikitext
10902 {{paramtest|
10903 param ={{ templateasargtest |
10904 templ = simple }}}}
10905 !! html
10906 <p>This is a test template with parameter (test)
10907 </p>
10908 !! end
10909
10910 !! test
10911 Template with thumb image (with link in description)
10912 !! wikitext
10913 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10914 !! html/php
10915 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>
10916
10917 !! html+tidy
10918 <p>This is a test template with parameter</p>
10919 <div class="thumb tright">
10920 <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>
10921 <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>
10922 </div>
10923 </div>
10924 !! html/parsoid
10925 <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>
10926 !! end
10927
10928 !! article
10929 Template:complextemplate
10930 !! text
10931 {{{1}}} {{paramtest|
10932 param ={{{param}}}}}
10933 !! endarticle
10934
10935 !! test
10936 Template with complex arguments
10937 !! wikitext
10938 {{complextemplate|
10939 param ={{ templateasargtest |
10940 templ = simple }}|[[Template:complextemplate|link]]}}
10941 !! html
10942 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10943 </p>
10944 !! end
10945
10946 !! test
10947 BUG 553: link with two variables in a piped link
10948 !! wikitext
10949 {|
10950 |[[{{{1}}}|{{{2}}}]]
10951 |}
10952 !! html/php
10953 <table>
10954 <tr>
10955 <td>[[{{{1}}}|{{{2}}}]]
10956 </td></tr></table>
10957
10958 !! html/parsoid
10959 <table>
10960 <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>
10961 </tbody></table>
10962 !! end
10963
10964 # See: T2553
10965 !! test
10966 Abort table cell attribute parsing on wikilink
10967 !! wikitext
10968 {|
10969 | testing [[one|two]] | three || four
10970 | testing one two | three || four
10971 | testing="[[one|two]]" | three || four
10972 |}
10973 !! html/php
10974 <table>
10975 <tr>
10976 <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>
10977 <td> four
10978 </td>
10979 <td> three </td>
10980 <td> four
10981 </td>
10982 <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>
10983 <td> four
10984 </td></tr></table>
10985
10986 !! html/parsoid
10987 <table>
10988 <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>
10989 <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>
10990 <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>
10991 </tbody></table>
10992 !! end
10993
10994 !! test
10995 Don't abort table cell attribute parsing if wikilink is found in template arg
10996 !! wikitext
10997 {|
10998 | Test {{#tag:ref|One two "[[three]]" four}}
10999 |}
11000 !! html/parsoid
11001 <table>
11002 <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>
11003 </tbody></table>
11004 !! end
11005
11006 !! test
11007 Magic variable as template parameter
11008 !! wikitext
11009 {{paramtest|param={{SITENAME}}}}
11010 !! html
11011 <p>This is a test template with parameter MediaWiki
11012 </p>
11013 !! end
11014
11015 !! article
11016 Template:linktest
11017 !! text
11018 [[{{{param}}}|link]]
11019 !! endarticle
11020
11021 !! test
11022 Template parameter as link source
11023 !! wikitext
11024 {{linktest|param=Main Page}}
11025 !! html
11026 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11027 </p>
11028 !! end
11029
11030 !!article
11031 Template:paramtest2
11032 !! text
11033 including another template, {{paramtest|param={{{arg}}}}}
11034 !! endarticle
11035
11036 !! test
11037 Template passing argument to another template
11038 !! wikitext
11039 {{paramtest2|arg='hmm'}}
11040 !! html
11041 <p>including another template, This is a test template with parameter 'hmm'
11042 </p>
11043 !! end
11044
11045 !! article
11046 Template:Linktest2
11047 !! text
11048 Main Page
11049 !! endarticle
11050
11051 !! test
11052 Template as link source
11053 !! wikitext
11054 [[{{linktest2}}]]
11055
11056 [[{{linktest2}}|Main Page]]
11057
11058 [[{{linktest2}}]]Page
11059 !! html
11060 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11061 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11062 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11063 </p>
11064 !! end
11065
11066
11067 !! article
11068 Template:loop1
11069 !! text
11070 {{loop2}}
11071 !! endarticle
11072
11073 !! article
11074 Template:loop2
11075 !! text
11076 {{loop1}}
11077 !! endarticle
11078
11079 !! test
11080 Template infinite loop
11081 !! wikitext
11082 {{loop1}}
11083 !! html
11084 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11085 </p>
11086 !! end
11087
11088 !! test
11089 Template from main namespace
11090 !! wikitext
11091 {{:Main Page}}
11092 !! html
11093 <p>blah blah
11094 </p>
11095 !! end
11096
11097 !! article
11098 Template:table
11099 !! text
11100 {|
11101 | 1 || 2
11102 |-
11103 | 3 || 4
11104 |}
11105 !! endarticle
11106
11107 !! test
11108 BUG 529: Template with table, not included at beginning of line
11109 !! wikitext
11110 foo {{table}}
11111 !! html
11112 <p>foo
11113 </p>
11114 <table>
11115 <tr>
11116 <td> 1 </td>
11117 <td> 2
11118 </td></tr>
11119 <tr>
11120 <td> 3 </td>
11121 <td> 4
11122 </td></tr></table>
11123
11124 !! end
11125
11126 !! test
11127 BUG 523: Template shouldn't eat newline (or add an extra one before table)
11128 !! wikitext
11129 foo
11130 {{table}}
11131 !! html
11132 <p>foo
11133 </p>
11134 <table>
11135 <tr>
11136 <td> 1 </td>
11137 <td> 2
11138 </td></tr>
11139 <tr>
11140 <td> 3 </td>
11141 <td> 4
11142 </td></tr></table>
11143
11144 !! end
11145
11146 !! test
11147 BUG 41: Template parameters shown as broken links
11148 !! wikitext
11149 {{{parameter}}}
11150 !! html
11151 <p>{{{parameter}}}
11152 </p>
11153 !! end
11154
11155 !! test
11156 Template with targets containing wikilinks
11157 !! wikitext
11158 {{[[foo]]}}
11159
11160 {{[[{{echo|foo}}]]}}
11161
11162 {{{{echo|[[foo}}]]}}
11163 !! html
11164 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11165 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11166 </p><p>{{[[foo}}]]
11167 </p>
11168 !! end
11169
11170 !! article
11171 Template:''
11172 !! text
11173 bar
11174 !! endarticle
11175
11176 !! test
11177 Templates: Double quotes as template target
11178 !! wikitext
11179 foo {{''}} baz
11180 !! html/php
11181 <p>foo bar baz
11182 </p>
11183 !! html/parsoid
11184 <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
11185 </p>
11186 !! end
11187
11188 ## This test is about making sure Parsoid's data-mw is well formed in the
11189 ## face of multiple templates with intersecting and overlapping ranges. The
11190 ## wikitext itself is wretched.
11191 !! test
11192 Templates with intersecting and overlapping ranges
11193 !! wikitext
11194 {|{{echo|
11195 <p>ha</p>}}
11196 {|{{echo|
11197 <p>ho</p>}}
11198 {{echo|{{!}}hi}}
11199 |}
11200 !! html/php+tidy
11201 <p>ha</p>
11202 <p>ho</p>
11203 <table>
11204 <tr>
11205 <td></td>
11206 </tr>
11207 <tr>
11208 <td>hi</td>
11209 </tr>
11210 </table>
11211 <table>
11212 <tr>
11213 <td></td>
11214 </tr>
11215 </table>
11216 !! html/parsoid
11217 <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":""}]]}'>
11218
11219 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11220
11221 <tbody><tr><td>hi</td></tr>
11222 </tbody></table>
11223 !! end
11224
11225 !! article
11226 Template:MSGNW test
11227 !! text
11228 ''None'' of '''this''' should be
11229 * interpreted
11230 but rather passed unmodified
11231 {{test}}
11232 <gallery>
11233 File:Foobar.jpg
11234 </gallery>
11235 <!-- comment -->
11236 !! endarticle
11237
11238 # hmm, fix this or just deprecate msgnw and document its behavior?
11239 !! test
11240 msgnw keyword
11241 !! wikitext
11242 {{msgnw:MSGNW test}}
11243 !! html/php
11244 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11245 &#42; interpreted
11246 &#32;but rather passed unmodified
11247 &#123;&#123;test&#125;&#125;
11248 &#60;gallery&#62;
11249 File:Foobar.jpg
11250 &#60;/gallery&#62;
11251 &#60;!-- comment --&#62;
11252 </p>
11253 !! end
11254
11255 !! test
11256 int keyword
11257 !! wikitext
11258 {{int:youhavenewmessages|lots of money|not!}}
11259 !! html
11260 <p>You have lots of money (not!).
11261 </p>
11262 !! end
11263
11264 !! test
11265 int keyword - non-existing message
11266 !! wikitext
11267 {{int:var}}
11268 !! html
11269 <p>⧼var⧽
11270 </p>
11271 !! end
11272
11273 !! article
11274 Template:Includes
11275 !! text
11276 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11277 !! endarticle
11278
11279 !! test
11280 <includeonly> and <noinclude> being included
11281 !! wikitext
11282 {{Includes}}
11283 !! html
11284 <p>Foobar
11285 </p>
11286 !! end
11287
11288 !! article
11289 Template:Includes2
11290 !! text
11291 <onlyinclude>Foo</onlyinclude>bar
11292 !! endarticle
11293
11294 !! test
11295 <onlyinclude> being included
11296 !! wikitext
11297 {{Includes2}}
11298 !! html
11299 <p>Foo
11300 </p>
11301 !! end
11302
11303
11304 !! article
11305 Template:Includes3
11306 !! text
11307 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11308 !! endarticle
11309
11310 !! test
11311 <onlyinclude> and <includeonly> being included
11312 !! wikitext
11313 {{Includes3}}
11314 !! html
11315 <p>Foo
11316 </p>
11317 !! end
11318
11319 !! test
11320 <includeonly> and <noinclude> on a page
11321 !! wikitext
11322 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11323 !! html
11324 <p>Foozar
11325 </p>
11326 !! end
11327
11328 !! test
11329 Un-closed <noinclude>
11330 !! wikitext
11331 <noinclude>
11332 !! html
11333 !! end
11334
11335 !! test
11336 <onlyinclude> on a page
11337 !! wikitext
11338 <onlyinclude>Foo</onlyinclude>bar
11339 !! html
11340 <p>Foobar
11341 </p>
11342 !! end
11343
11344 !! test
11345 Un-closed <onlyinclude>
11346 !! wikitext
11347 <onlyinclude>
11348 !! html
11349 !! end
11350
11351 !!test
11352 Self-closed noinclude, includeonly, onlyinclude tags
11353 !! wikitext
11354 <noinclude />
11355 <includeonly />
11356 <onlyinclude />
11357 !! html
11358 <p><br />
11359 </p>
11360 !!end
11361
11362 !!test
11363 Unbalanced includeonly and noinclude tags
11364 !! wikitext
11365 {|
11366 |a</noinclude>
11367 |b</noinclude></noinclude>
11368 |c</noinclude></includeonly>
11369 |d</includeonly></includeonly>
11370 |}
11371 !! html
11372 <table>
11373 <tr>
11374 <td>a
11375 </td>
11376 <td>b
11377 </td>
11378 <td>c&lt;/includeonly&gt;
11379 </td>
11380 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11381 </td></tr></table>
11382
11383 !!end
11384
11385 !! article
11386 Template:Includeonly section
11387 !! text
11388 <includeonly>
11389 ==Includeonly section==
11390 </includeonly>
11391 ==Section T-1==
11392 !!endarticle
11393
11394 !! test
11395 Bug 6563: Edit link generation for section shown by <includeonly>
11396 !! wikitext
11397 {{includeonly section}}
11398 !! html
11399 <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>
11400 <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>
11401
11402 !! end
11403
11404 # Uses same input as the contents of [[Template:Includeonly section]]
11405 !! test
11406 Bug 6563: Section extraction for section shown by <includeonly>
11407 !! options
11408 section=T-2
11409 !! wikitext
11410 <includeonly>
11411 ==Includeonly section==
11412 </includeonly>
11413 ==Section T-2==
11414 !! html
11415 ==Section T-2==
11416 !! end
11417
11418 !! test
11419 Bug 6563: Edit link generation for section suppressed by <includeonly>
11420 !! wikitext
11421 <includeonly>
11422 ==Includeonly section==
11423 </includeonly>
11424 ==Section 1==
11425 !! html
11426 <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>
11427
11428 !! end
11429
11430 !! test
11431 Bug 6563: Section extraction for section suppressed by <includeonly>
11432 !! options
11433 section=1
11434 !! wikitext
11435 <includeonly>
11436 ==Includeonly section==
11437 </includeonly>
11438 ==Section 1==
11439 !! html
11440 ==Section 1==
11441 !! end
11442
11443 !! test
11444 Un-closed <includeonly>
11445 !! wikitext
11446 <includeonly>
11447 !! html/php
11448 !! html/parsoid
11449 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11450 !! end
11451
11452 ## We used to, but no longer wt2wt this test since the default serializer
11453 ## will normalize the include directives to serialize on their own line.
11454 ## Selser will take care of preserving formatting in scenarios where they
11455 ## intermingled with other wikitext.
11456 !! test
11457 Includes and comments at SOL
11458 !! options
11459 parsoid=wt2html,html2html
11460 !! wikitext
11461 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11462
11463 <noinclude>
11464 some
11465 </noinclude>* stuff
11466 * here
11467
11468 <includeonly>can have stuff</includeonly>=== here ===
11469
11470 !! html/php
11471 <h2><span class="mw-headline" id="hu">hu</span></h2>
11472 <p>some
11473 </p>
11474 <ul><li> stuff</li>
11475 <li> here</li></ul>
11476 <h3><span class="mw-headline" id="here">here</span></h3>
11477
11478 !! html/parsoid
11479 <!-- 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>
11480
11481 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11482 <p>some</p>
11483 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11484 <li> here</li></ul>
11485
11486 <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>
11487
11488 !! end
11489
11490 # TODO: test with DOM fragment reuse!
11491 !! test
11492 Parsoid: DOM fragment reuse
11493 !! options
11494 parsoid=wt2wt,wt2html
11495 !! wikitext
11496 a{{echo|b<table></table>c}}d
11497
11498 a{{echo|b
11499 <table></table>
11500 c}}d
11501
11502 {{echo|a
11503
11504 <table></table>
11505
11506 b}}
11507 !! html
11508 <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>
11509
11510 <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">
11511 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11512 </span><p about="#mwt2">cd</p>
11513
11514 <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">
11515
11516 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11517
11518 </span><p about="#mwt3">b</p>
11519 !! end
11520
11521 !! test
11522 Parsoid: Merge double tds (T52603)
11523 !! options
11524 parsoid
11525 !! wikitext
11526 {|
11527 |{{echo|{{!}} foo}}
11528 |}
11529 !! html
11530 <table><tbody>
11531 <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>
11532 </tbody></table>
11533 !! end
11534
11535 !! test
11536 Parsoid: Merge double tds in nested transclusion content (T52603)
11537 !! options
11538 parsoid
11539 !! wikitext
11540 {{echo|<div>}}
11541 {|
11542 |{{echo|{{!}} foo}}
11543 |}
11544 {{echo|</div>}}
11545 !! html
11546 <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}}]}'>
11547 <table><tbody>
11548 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11549 </tbody></table>
11550 </div>
11551 !! end
11552
11553 ###
11554 ### <includeonly> and <noinclude> in attributes
11555 ###
11556 !!test
11557 0. includeonly around the entire attribute
11558 !! wikitext
11559 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11560 !! html
11561 <p><span id="v2">bar</span>
11562 </p>
11563 !!end
11564
11565 !!test
11566 1. includeonly in html attr key
11567 !! wikitext
11568 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11569 !! html
11570 <p><span id="foo">bar</span>
11571 </p>
11572 !!end
11573
11574 !!test
11575 2. includeonly in html attr value
11576 !! wikitext
11577 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11578 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11579 !! html
11580 <p><span id="v1">bar</span>
11581 <span id="v1">bar</span>
11582 </p>
11583 !!end
11584
11585 !!test
11586 3. includeonly in part of an attr value
11587 !! wikitext
11588 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11589 !! html
11590 <p><span style="color:red;">bar</span>
11591 </p>
11592 !!end
11593
11594 !!test
11595 4. includeonly in table attributes
11596 !! wikitext
11597 {|
11598 |- <noinclude>
11599 |-
11600 |a
11601 </noinclude>
11602 |- <includeonly>
11603 |-
11604 |b
11605 </includeonly>
11606 |}
11607 !! html
11608 <table>
11609
11610
11611 <tr>
11612 <td>a
11613 </td></tr>
11614 </table>
11615
11616 !!end
11617
11618 ###
11619 ### Token Stream Patcher tests
11620 ###
11621 ### These tests won't always pass wt2wt and other modes because
11622 ### on serialization, the table will be output on a new line.
11623 ### For now, we are blacklisting them, and using this to test selser.
11624 ###
11625
11626 !!test
11627 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11628 !!options
11629 parsoid=wt2html,wt2wt
11630 !!wikitext
11631 {{echo|}}{| width = '100%'
11632 |foo
11633 |}
11634 !!html/parsoid
11635 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11636 <tbody><tr><td>foo</td></tr>
11637 </tbody></table>
11638 !!end
11639
11640 ## We used to, but no longer wt2wt this test since the default serializer
11641 ## will normalize the include directives to serialize on their own line.
11642 ## Selser will take care of preserving formatting in scenarios where they
11643 ## intermingled with other wikitext.
11644 !!test
11645 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11646 !!options
11647 parsoid=wt2html
11648 !!wikitext
11649 <includeonly>a</includeonly>{| {{{b}}}
11650 |c
11651 |}
11652 !!html/parsoid
11653 <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":""}]]}'>
11654 <tbody><tr><td>c</td></tr>
11655 </tbody></table>
11656 !!end
11657
11658 !! test
11659 Table wikitext syntax outside wiki-tables
11660 !! wikitext
11661 a
11662 |+ not a caption
11663 ! not a table heading
11664 |- not a table row
11665 | not a table cell
11666 | class="foo bar" | baz
11667 b
11668 |}
11669 |-
11670 c
11671 !! html
11672 <p>a
11673 |+ not a caption
11674 ! not a table heading
11675 |- not a table row
11676 | not a table cell
11677 | class="foo bar" | baz
11678 b
11679 |}
11680 |-
11681 c
11682 </p>
11683 !! end
11684
11685 ###
11686 ### Testing parsing of templates where a template arg
11687 ### has the same name as the template itself.
11688 ###
11689
11690 !! article
11691 Template:quote
11692 !! text
11693 {{{quote|{{{1}}}}}}
11694 !! endarticle
11695
11696 !!test
11697 Templates: Template Name/Arg clash: 1. Use of positional param
11698 !! wikitext
11699 {{quote|foo}}
11700 !! html
11701 <p>foo
11702 </p>
11703 !!end
11704
11705 !!test
11706 Templates: Template Name/Arg clash: 2. Use of named param
11707 !! wikitext
11708 {{quote|quote=foo}}
11709 !! html
11710 <p>foo
11711 </p>
11712 !!end
11713
11714 !!test
11715 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11716 !! wikitext
11717 {{quote|quote}}
11718 !! html
11719 <p>quote
11720 </p>
11721 !!end
11722
11723 ###
11724 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11725 ###
11726
11727 !!test
11728 Templates: 1. Simple use
11729 !! wikitext
11730 {{echo|Foo}}
11731 !! html
11732 <p>Foo
11733 </p>
11734 !!end
11735
11736 !!test
11737 Templates: 2. Inside a block tag
11738 !! wikitext
11739 <div>{{echo|Foo}}</div>
11740 <blockquote>{{echo|Foo}}</blockquote>
11741 !! html
11742 <div>Foo</div>
11743 <blockquote>Foo</blockquote>
11744
11745 !! html+tidy
11746 <div>Foo</div>
11747 <blockquote>
11748 <p>Foo</p>
11749 </blockquote>
11750 !!end
11751
11752 !!test
11753 Templates: P-wrapping: 1a. Templates on consecutive lines
11754 !! wikitext
11755 {{echo|Foo}}
11756 {{echo|bar}}
11757 !! html
11758 <p>Foo
11759 bar
11760 </p>
11761 !!end
11762
11763 !!test
11764 Templates: P-wrapping: 1b. Templates on consecutive lines
11765 !! wikitext
11766 Foo
11767
11768 {{echo|bar}}
11769 {{echo|baz}}
11770 !! html
11771 <p>Foo
11772 </p><p>bar
11773 baz
11774 </p>
11775 !!end
11776
11777 !!test
11778 Templates: P-wrapping: 1c. Templates on consecutive lines
11779 !! wikitext
11780 {{echo|Foo}}
11781 {{echo|bar}} <div>baz</div>
11782 !! html
11783 <p>Foo
11784 </p>
11785 bar <div>baz</div>
11786
11787 !! html+tidy
11788 <p>Foo</p>
11789 <p>bar</p>
11790 <div>baz</div>
11791 !! end
11792
11793 !!test
11794 Templates: P-wrapping: 1d. Template preceded by comment-only line
11795 !!options
11796 parsoid
11797 !! wikitext
11798 <!-- foo -->
11799 {{echo|Bar}}
11800 !! html
11801 <!-- foo -->
11802
11803 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11804 !!end
11805
11806 !!test
11807 Templates: Inline Text: 1. Multiple template uses
11808 !! wikitext
11809 {{echo|Foo}}bar{{echo|baz}}
11810 !! html
11811 <p>Foobarbaz
11812 </p>
11813 !!end
11814
11815 !!test
11816 Templates: Inline Text: 2. Back-to-back template uses
11817 !! wikitext
11818 {{echo|Foo}}{{echo|bar}}
11819 !! html
11820 <p>Foobar
11821 </p>
11822 !!end
11823
11824 !!test
11825 Templates: Block Tags: 1. Multiple template uses
11826 !! wikitext
11827 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11828 !! html
11829 <div>Foo</div><div>bar</div><div>baz</div>
11830
11831 !!end
11832
11833 !!test
11834 Templates: Block Tags: 2. Back-to-back template uses
11835 !! wikitext
11836 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11837 !! html
11838 <div>Foo</div><div>bar</div>
11839
11840 !!end
11841
11842 # This is an edge case relating to paragraph wrapping.
11843 !!test
11844 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11845 !! wikitext
11846 {{echo|a
11847 b</p>}}
11848 !! html/parsoid
11849 <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
11850 b</p>
11851 !!end
11852
11853 !!test
11854 Templates: Links: 1. Simple example
11855 !! wikitext
11856 {{echo|[[Foo|bar]]}}
11857 !! html
11858 <p><a href="/wiki/Foo" title="Foo">bar</a>
11859 </p>
11860 !!end
11861
11862 !!test
11863 Templates: Links: 2. Generation of link href
11864 !! wikitext
11865 [[{{echo|Foo}}|bar]]
11866 !! html
11867 <p><a href="/wiki/Foo" title="Foo">bar</a>
11868 </p>
11869 !!end
11870
11871 !!test
11872 Templates: Links: 3. Generation of part of a link href
11873 !! wikitext
11874 [[Fo{{echo|o}}|bar]]
11875
11876 [[Foo{{echo|bar}}]]
11877
11878 [[Foo{{echo|bar}}baz]]
11879
11880 [[Foo{{echo|bar}}|bar]]
11881
11882 [[:Foo{{echo|bar}}]]
11883
11884 [[:Foo{{echo|bar}}|bar]]
11885 !! html
11886 <p><a href="/wiki/Foo" title="Foo">bar</a>
11887 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11888 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11889 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11890 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11891 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11892 </p>
11893 !!end
11894
11895 !!test
11896 Templates: Links: 4. Multiple templates generating link href
11897 !! wikitext
11898 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11899 !! html
11900 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11901 </p>
11902 !!end
11903
11904 !!test
11905 Templates: Links: 5. Generation of link text
11906 !! wikitext
11907 [[Foo|{{echo|bar}}]]
11908 !! html
11909 <p><a href="/wiki/Foo" title="Foo">bar</a>
11910 </p>
11911 !!end
11912
11913 !!test
11914 Templates: Links: 5. Nested templates (only outermost template should be marked)
11915 !! wikitext
11916 {{echo|[[{{echo|Foo}}|bar]]}}
11917 !! html
11918 <p><a href="/wiki/Foo" title="Foo">bar</a>
11919 </p>
11920 !!end
11921
11922 !!test
11923 Templates: HTML Tag: 1. Generation of HTML attr. key
11924 !! wikitext
11925 <div {{echo|style}}="color:red;">foo</div>
11926 !! html
11927 <div style="color:red;">foo</div>
11928
11929 !!end
11930
11931 !!test
11932 Templates: HTML Tag: 2. Generation of HTML attr. value
11933 !! wikitext
11934 <div style={{echo|'color:red;'}}>foo</div>
11935 !! html
11936 <div style="color:red;">foo</div>
11937
11938 !!end
11939
11940 !!test
11941 Templates: HTML Tag: 3. Generation of HTML attr key and value
11942 !! wikitext
11943 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11944 !! html
11945 <div style="color:red;">foo</div>
11946
11947 !!end
11948
11949 !!test
11950 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11951 !! wikitext
11952 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11953 !! html
11954 <div title="This is a long title with just one piece templated">foo</div>
11955
11956 !!end
11957
11958 !!test
11959 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11960 !! wikitext
11961 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11962 !! html
11963 <div title="This is a long title with just one piece templated">foo</div>
11964
11965 !!end
11966
11967 !!test
11968 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11969 !! wikitext
11970 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11971 !! html
11972 <div title="This is a long title with just one piece templated">foo</div>
11973
11974 !!end
11975
11976 # SSS FIXME: While it is great we added support for all this,
11977 # do we want to make this part of the spec? Maybe we want to
11978 # deprecate this kind of usage in the future?
11979 !!test
11980 Templates: HTML Tag: 7. Generation of partial attribute key string
11981 !! wikitext
11982 <div st{{echo|yle}}="color:red;">foo</div>
11983 !! html
11984 <div style="color:red;">foo</div>
11985
11986 !!end
11987
11988 !! test
11989 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11990 !! wikitext
11991 <div {{echo|1=id="v1"}}>bar</div>
11992 !! html
11993 <div id="v1">bar</div>
11994
11995 !!end
11996
11997 !! test
11998 Templates: HTML Tag: 9. Multiple template-generated attributes
11999 !! wikitext
12000 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12001 !! html
12002 <div id="v1" title="foo">bar</div>
12003
12004 !!end
12005
12006 !! test
12007 Templates: Support for templates generating attributes and content
12008 !! wikitext
12009 {| {{mixed_attr_content_template}}
12010 |-
12011 |bar
12012 |}
12013 !! html/php
12014 <table style="color:red;" title="T48811">
12015
12016 <tr>
12017 <td>foo
12018 </td></tr>
12019 <tr>
12020 <td>bar
12021 </td></tr></table>
12022
12023 !! html/parsoid
12024 <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|}"]}'>
12025 <tbody><tr>
12026 <td>foo</td></tr>
12027 <tr>
12028 <td>bar</td></tr>
12029 </tbody></table>
12030 !!end
12031
12032 !! test
12033 1. Entities and nowikis inside templated attributes should be handled correctly
12034 !! wikitext
12035 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12036 !! html/php
12037 <div style="background:#f9f9f9;">foo</div>
12038
12039 !! html/parsoid
12040 <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>
12041 !! end
12042
12043 !! test
12044 2. Entities and nowikis inside templated attributes should be handled correctly
12045 !! wikitext
12046 {|
12047 |{{table_attribs_3}}
12048 |}
12049 !! html/php
12050 <table>
12051 <tr>
12052 <td style="background:#f9f9f9;">Foo
12053 </td></tr></table>
12054
12055 !! html/parsoid
12056 <table>
12057 <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>
12058 </tbody></table>
12059 !! end
12060
12061 !! test
12062 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12063 !! wikitext
12064 {{tbl-start}}
12065 |{{table_attribs_3}}
12066 {{tbl-end}}
12067 !! html/php
12068 <table>
12069 <tr>
12070 <td style="background:#f9f9f9;">Foo
12071 </td></tr></table>
12072
12073 !! html/parsoid
12074 <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}}]}'>
12075 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12076 </tbody></table>
12077 !! end
12078
12079 # T107622
12080 !! test
12081 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12082 !! wikitext
12083 {|
12084 | {{table_attribs_6}} hi
12085 |}
12086 !! html/php
12087 <table>
12088 <tr>
12089 <td style="background: red;"> hi
12090 </td></tr></table>
12091
12092 !! html/parsoid
12093 <table>
12094 <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>
12095 </tbody></table>
12096 !! end
12097
12098 !!test
12099 Templates: HTML Tables: 1. Generating start of a HTML table
12100 !! wikitext
12101 {{echo|<table><tr><td>foo</td>}}</tr></table>
12102 !! html
12103 <table><tr><td>foo</td></tr></table>
12104
12105 !!end
12106
12107 !!test
12108 Templates: HTML Tables: 2a. Generating middle of a HTML table
12109 !! wikitext
12110 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12111 !! html
12112 <table><tr><td>foo</td></tr></table>
12113
12114 !!end
12115
12116 !!test
12117 Templates: HTML Tables: 2b. Generating middle of a HTML table
12118 !! wikitext
12119 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12120 !! html
12121 <table><tr><td>foo</td></tr></table>
12122
12123 !!end
12124
12125 !!test
12126 Templates: HTML Tables: 3. Generating end of a HTML table
12127 !! wikitext
12128 <table><tr>{{echo|<td>foo</td></tr></table>}}
12129 !! html
12130 <table><tr><td>foo</td></tr></table>
12131
12132 !!end
12133
12134 !!test
12135 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12136 !! wikitext
12137 {{echo|<table>}}<tr><td>foo</td></tr></table>
12138 !! html
12139 <table><tr><td>foo</td></tr></table>
12140
12141 !!end
12142
12143 !!test
12144 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12145 !! wikitext
12146 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12147 !! html
12148 <table><tr><td>foo</td></tr></table>
12149
12150 !!end
12151
12152 !!test
12153 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12154 !! wikitext
12155 <table><tr>{{echo|<td>}}foo</td></tr></table>
12156 !! html
12157 <table><tr><td>foo</td></tr></table>
12158
12159 !!end
12160
12161 !!test
12162 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12163 !! wikitext
12164 <table><tr><td>foo{{echo|</td>}}</tr></table>
12165 !! html
12166 <table><tr><td>foo</td></tr></table>
12167
12168 !!end
12169
12170 !!test
12171 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12172 !! wikitext
12173 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12174 !! html
12175 <table><tr><td>foo</td></tr></table>
12176
12177 !!end
12178
12179 !!test
12180 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12181 !! wikitext
12182 <table><tr><td>foo</td></tr>{{echo|</table>}}
12183 !! html
12184 <table><tr><td>foo</td></tr></table>
12185
12186 !!end
12187
12188 !!test
12189 Templates: HTML Tables: 5. Proper fostering of categories from inside
12190 !!options
12191 parsoid=wt2html,wt2wt
12192 !! wikitext
12193 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12194 <!--Two categories (Bug 50330)-->
12195 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12196 !! html
12197 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12198 <!--Two categories (Bug 50330)-->
12199 <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>
12200 !!end
12201
12202 !!test
12203 Templates: Wiki Tables: 1a. Fostering of entire template content
12204 !! wikitext
12205 {|
12206 {{echo|a}}
12207 |}
12208 !! html
12209 <table>
12210 a
12211 <tr><td></td></tr></table>
12212
12213 !! html+tidy
12214 <p>a</p>
12215 <table>
12216 <tr>
12217 <td></td>
12218 </tr>
12219 </table>
12220 !! end
12221
12222 !!test
12223 Templates: Wiki Tables: 1b. Fostering of entire template content
12224 !! wikitext
12225 {|
12226 {{echo|<div>}}
12227 foo
12228 {{echo|</div>}}
12229 |}
12230 !! html
12231 <table>
12232 <div>
12233 <p>foo
12234 </p>
12235 </div>
12236 <tr><td></td></tr></table>
12237
12238 !! html+tidy
12239 <div>
12240 <p>foo</p>
12241 </div>
12242 <table>
12243 <tr>
12244 <td></td>
12245 </tr>
12246 </table>
12247 !! end
12248
12249 !!test
12250 Templates: Wiki Tables: 2. Fostering of partial template content
12251 !! wikitext
12252 {|
12253 {{echo|a
12254 <div>b</div>}}
12255 |}
12256 !! html
12257 <table>
12258 a
12259 <div>b</div>
12260 <tr><td></td></tr></table>
12261
12262 !! html+tidy
12263 <p>a</p>
12264 <div>b</div>
12265 <table>
12266 <tr>
12267 <td></td>
12268 </tr>
12269 </table>
12270 !! end
12271
12272 !!test
12273 Templates: Wiki Tables: 3. td-content via multiple templates
12274 !! wikitext
12275 {|
12276 {{echo|{{pipe}}a}}{{echo|b}}
12277 |}
12278 !! html
12279 <table>
12280 <tr>
12281 <td>ab
12282 </td></tr></table>
12283
12284 !!end
12285
12286 !!test
12287 Templates: Wiki Tables: 4. Templated tags, no content
12288 !! wikitext
12289 {{tbl-start}}
12290 {{tbl-end}}
12291 !! html
12292 <table>
12293 <tr><td></td></tr></table>
12294
12295 !!end
12296
12297 !!test
12298 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12299 !! wikitext
12300 {{tbl-start}}
12301 |foo
12302 {{tbl-end}}
12303 !! html
12304 <table>
12305 <tr>
12306 <td>foo
12307 </td></tr></table>
12308
12309 !!end
12310
12311 !!test
12312 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12313 !! wikitext
12314 {{tbl-start}}
12315 {{!}}foo
12316 {{tbl-end}}
12317 !! html
12318 <table>
12319 <tr>
12320 <td>foo
12321 </td></tr></table>
12322
12323 !!end
12324
12325 ## This test case is very specific to Parsoid's internals
12326 ## and is hence only tested for Parsoid's code. Parsoid uses
12327 ## a <meta> marker tag for <ref> tags and they are expanded
12328 ## much later. We are verifying that this <meta> tag usage
12329 ## doesn't prevent foster parenting.
12330 !!test
12331 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12332 !!wikitext
12333 {{PartialTable}}<ref>foo</ref>
12334 |}
12335
12336 <references />
12337 !!html/parsoid
12338 <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">
12339 <tbody>
12340 </tbody></table>
12341
12342 <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>
12343 !!end
12344
12345 !! test
12346 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12347 !! wikitext
12348 {{echo|
12349 {{{!}}
12350 {{!}}-}}
12351 <onlyinclude>
12352 |foo
12353 </onlyinclude>
12354 {{!}}}
12355 !! html/parsoid
12356 <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{{!}}}"]}'>
12357 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12358 <tbody><tr>
12359
12360 <td>foo
12361 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12362 </tbody></table>
12363 !! end
12364
12365 !!test
12366 Templates: Lists: Multi-line list-items via templates
12367 !! wikitext
12368 *{{echo|a {{nonexistent|
12369 unused}}}}
12370 *{{echo|b {{nonexistent|
12371 unused}}}}
12372 !! html
12373 <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>
12374 <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>
12375
12376 !!end
12377
12378 !!test
12379 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12380 !! wikitext
12381 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12382 !! html
12383 <p><i>ab</i>c<i>d</i>e
12384 </p>
12385 !!end
12386
12387 !!test
12388 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12389 (PHP parser generates misnested html)
12390 !! wikitext
12391 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12392 !! html/parsoid
12393 <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>
12394 !!end
12395
12396 !!test
12397 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12398 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12399 !! options
12400 parsoid=wt2html,wt2wt
12401 !! wikitext
12402 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12403 !! html
12404 <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>
12405 <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>
12406 <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>
12407 !!end
12408
12409 !!test
12410 Templates: Ugly nesting: 4. Divs opened/closed across templates
12411 !! wikitext
12412 a<div>b{{echo|c</div>d}}e
12413 !! html
12414 a<div>bc</div>de
12415
12416 !! html+tidy
12417 <p>a</p>
12418 <div>bc</div>
12419 <p>de</p>
12420 !! end
12421
12422 !!test
12423 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12424 (Parsoid-centric)
12425 !! options
12426 parsoid
12427 !! wikitext
12428 {|
12429 |{{echo|foo</table>}}
12430 |bar
12431 |}
12432 !! html
12433 <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|}"]}'>
12434
12435 <tbody>
12436 <tr>
12437 <td>foo</td></tr></tbody></table><span about="#mwt1">
12438 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12439 |}</span>
12440 !!end
12441
12442 !!test
12443 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12444 (Parsoid-centric)
12445 !! options
12446 parsoid
12447 !! wikitext
12448 <table>
12449 <tr>
12450 <td>
12451 <table>
12452 <tr>
12453 <td>1. {{echo|foo </table>}}</td>
12454 <td> bar </td>
12455 <td>2. {{echo|baz </table>}}</td>
12456 </tr>
12457 <tr>
12458 <td>abc</td>
12459 </tr>
12460 </table>
12461 </td>
12462 </tr>
12463 <tr>
12464 <td>xyz</td>
12465 </tr>
12466 </table>
12467 !! html
12468 <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>"]}'>
12469 <tbody><tr>
12470 <td>
12471 <table>
12472 <tbody><tr>
12473 <td>1. foo </td></tr></tbody></table></td>
12474 <td> bar </td>
12475 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12476 </span><span about="#mwt2">
12477 </span><span about="#mwt2">
12478 </span><span about="#mwt2">abc</span><span about="#mwt2">
12479 </span><span about="#mwt2">
12480 </span><span about="#mwt2">
12481 </span><span about="#mwt2">
12482 </span><span about="#mwt2">
12483 </span><span about="#mwt2">
12484 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12485 </span><span about="#mwt2">
12486 </span>
12487 !!end
12488
12489 !! test
12490 Templates: Ugly templates: 3. newline-only template parameter
12491 !! wikitext
12492 foo {{echo|
12493 }}
12494 !! html
12495 <p>foo
12496 </p>
12497 !! end
12498
12499 # This looks like a bug: a single newline triggers p/br for some reason.
12500 !! test
12501 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12502 !! wikitext
12503 {{echo|
12504 }}
12505 !! html
12506 <p><br />
12507 </p>
12508 !! end
12509
12510 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12511 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12512 !! test
12513 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12514 !! wikitext
12515 {{echo|<table>}}
12516 {{echo|<div>foo}}
12517 {{echo|</table>}}
12518 !! html/parsoid
12519 <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
12520 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12521 </table>
12522 !! end
12523
12524 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12525 # that are "identical" and generate nesting cycles in the algorithm
12526 !! test
12527 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12528 !! wikitext
12529 {{echo|<table><tr><td><table>}}
12530 {{echo|<div>}}
12531 {{echo|</div>}}
12532 !! html/parsoid
12533 <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"}'>
12534 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12535 </table></td></tr></tbody></table>
12536 !! end
12537
12538 !! test
12539 Templates: Parameters substituted at the top-level
12540 !! wikitext
12541 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12542
12543 {{{foo|bar|baz}}}
12544 !! html/php
12545 <p><i>who</i> me? <b>never!</b>
12546 </p><p>bar
12547 </p>
12548 !! html/parsoid
12549 <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>
12550
12551 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
12552 !! end
12553
12554 !!test
12555 Parser Functions: 1. Simple example
12556 !! wikitext
12557 {{uc:foo}}
12558 !! html
12559 <p>FOO
12560 </p>
12561 !!end
12562
12563 !!test
12564 Parser Functions: 2. Nested use (only outermost should be marked up)
12565 !! wikitext
12566 {{uc:{{lc:FOO}}}}
12567 !! html
12568 <p>FOO
12569 </p>
12570 !!end
12571
12572 ###
12573 ### Pre-save transform tests
12574 ###
12575 !! test
12576 pre-save transform: subst:
12577 !! options
12578 pst
12579 !! wikitext
12580 {{subst:test}}
12581 !! html/php
12582 This is a test template
12583 !! end
12584
12585 !! test
12586 pre-save transform: normal template
12587 !! options
12588 pst
12589 !! wikitext
12590 {{test}}
12591 !! html/php
12592 {{test}}
12593 !! end
12594
12595 !! test
12596 pre-save transform: nonexistent template
12597 !! options
12598 pst
12599 !! wikitext
12600 {{thistemplatedoesnotexist}}
12601 !! html/php
12602 {{thistemplatedoesnotexist}}
12603 !! end
12604
12605 !! test
12606 pre-save transform: subst magic variables
12607 !! options
12608 pst
12609 !! wikitext
12610 {{subst:SITENAME}}
12611 !! html/php
12612 MediaWiki
12613 !! end
12614
12615 # This is bug 89, which I fixed. -- wtm
12616 !! test
12617 pre-save transform: subst: templates with parameters
12618 !! options
12619 pst
12620 !! wikitext
12621 {{subst:paramtest|param="something else"}}
12622 !! html/php
12623 This is a test template with parameter "something else"
12624 !! end
12625
12626 !! article
12627 Template:nowikitest
12628 !! text
12629 <nowiki>'''not wiki'''</nowiki>
12630 !! endarticle
12631
12632 !! test
12633 pre-save transform: nowiki in subst (bug 1188)
12634 !! options
12635 pst
12636 !! wikitext
12637 {{subst:nowikitest}}
12638 !! html/php
12639 <nowiki>'''not wiki'''</nowiki>
12640 !! end
12641
12642 !! article
12643 Template:commenttest
12644 !! text
12645 This template has <!-- a comment --> in it.
12646 !! endarticle
12647
12648 !! test
12649 pre-save transform: comment in subst (bug 1936)
12650 !! options
12651 pst
12652 !! wikitext
12653 {{subst:commenttest}}
12654 !! html/php
12655 This template has <!-- a comment --> in it.
12656 !! end
12657
12658 !! test
12659 pre-save transform: unclosed tag
12660 !! options
12661 pst
12662 !! wikitext
12663 <nowiki>'''not wiki'''
12664 !! html/php
12665 <nowiki>'''not wiki'''
12666 !! end
12667
12668 !! test
12669 pre-save transform: mixed tag case
12670 !! options
12671 pst
12672 !! wikitext
12673 <NOwiki>'''not wiki'''</noWIKI>
12674 !! html/php
12675 <NOwiki>'''not wiki'''</noWIKI>
12676 !! end
12677
12678 !! test
12679 pre-save transform: unclosed comment in <nowiki>
12680 !! options
12681 pst
12682 !! wikitext
12683 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12684 !! html/php
12685 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12686 !!end
12687
12688 # Leading @ in this template definition works around a limitation
12689 # in parsoid's parserTests which otherwise strips the <span> from the
12690 # result (confusing it for a template wrapper)
12691 !! article
12692 Template:dangerous
12693 !!text
12694 @<span onmouseover="alert('crap')">Oh no</span>
12695 !!endarticle
12696
12697 !!test
12698 (confirming safety of fix for subst bug 1936)
12699 !! wikitext
12700 {{Template:dangerous}}
12701 !! html
12702 <p>@<span>Oh no</span>
12703 </p>
12704 !! end
12705
12706 !! test
12707 pre-save transform: comment containing gallery (bug 5024)
12708 !! options
12709 pst
12710 !! wikitext
12711 <!-- <gallery>data</gallery> -->
12712 !! html/php
12713 <!-- <gallery>data</gallery> -->
12714 !!end
12715
12716 !! test
12717 pre-save transform: comment containing extension
12718 !! options
12719 pst
12720 !! wikitext
12721 <!-- <tag>data</tag> -->
12722 !! html/php
12723 <!-- <tag>data</tag> -->
12724 !!end
12725
12726 !! test
12727 pre-save transform: comment containing nowiki
12728 !! options
12729 pst
12730 !! wikitext
12731 <!-- <nowiki>data</nowiki> -->
12732 !! html/php
12733 <!-- <nowiki>data</nowiki> -->
12734 !!end
12735
12736 !! test
12737 pre-save transform: <noinclude> in subst (bug 3298)
12738 !! options
12739 pst
12740 !! wikitext
12741 {{subst:Includes}}
12742 !! html/php
12743 Foobar
12744 !! end
12745
12746 !! test
12747 pre-save transform: <onlyinclude> in subst (bug 3298)
12748 !! options
12749 pst
12750 !! wikitext
12751 {{subst:Includes2}}
12752 !! html/php
12753 Foo
12754 !! end
12755
12756 !! article
12757 Template:SubstTest
12758 !!text
12759 {{<includeonly>subst:</includeonly>Includes}}
12760 !! endarticle
12761
12762 !! article
12763 Template:SafeSubstTest
12764 !! text
12765 {{<includeonly>safesubst:</includeonly>Includes}}
12766 !! endarticle
12767
12768 !! test
12769 bug 22297: safesubst: works during PST
12770 !! options
12771 pst
12772 !! wikitext
12773 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12774 !! html/php
12775 FoobarFoobar
12776 !! end
12777
12778 !! test
12779 bug 22297: safesubst: works during normal parse
12780 !! wikitext
12781 {{SafeSubstTest}}
12782 !! html
12783 <p>Foobar
12784 </p>
12785 !! end
12786
12787 !! test
12788 subst: does not work during normal parse
12789 !! wikitext
12790 {{SubstTest}}
12791 !! html
12792 <p>{{subst:Includes}}
12793 </p>
12794 !! end
12795
12796 !! test
12797 pre-save transform: context links ("pipe trick")
12798 !! options
12799 pst
12800 !! wikitext
12801 [[Article (context)|]]
12802 [[Bar:Article|]]
12803 [[:Bar:Article|]]
12804 [[Bar:Article (context)|]]
12805 [[:Bar:Article (context)|]]
12806 [[|Article]]
12807 [[|Article (context)]]
12808 [[Bar:X (Y) Z|]]
12809 [[:Bar:X (Y) Z|]]
12810 !! html/php
12811 [[Article (context)|Article]]
12812 [[Bar:Article|Article]]
12813 [[:Bar:Article|Article]]
12814 [[Bar:Article (context)|Article]]
12815 [[:Bar:Article (context)|Article]]
12816 [[Article]]
12817 [[Article (context)]]
12818 [[Bar:X (Y) Z|X (Y) Z]]
12819 [[:Bar:X (Y) Z|X (Y) Z]]
12820 !! end
12821
12822 !! test
12823 pre-save transform: context links ("pipe trick") with interwiki prefix
12824 !! options
12825 pst
12826 !! wikitext
12827 [[interwiki:Article|]]
12828 [[:interwiki:Article|]]
12829 [[interwiki:Bar:Article|]]
12830 [[:interwiki:Bar:Article|]]
12831 !! html/php
12832 [[interwiki:Article|Article]]
12833 [[:interwiki:Article|Article]]
12834 [[interwiki:Bar:Article|Bar:Article]]
12835 [[:interwiki:Bar:Article|Bar:Article]]
12836 !! end
12837
12838 !! test
12839 pre-save transform: context links ("pipe trick") with parens in title
12840 !! options
12841 pst title=[[Somearticle (context)]]
12842 !! wikitext
12843 [[|Article]]
12844 !! html/php
12845 [[Article (context)|Article]]
12846 !! end
12847
12848 !! test
12849 pre-save transform: context links ("pipe trick") with comma in title
12850 !! options
12851 pst title=[[Someplace, Somewhere]]
12852 !! wikitext
12853 [[|Otherplace]]
12854 [[Otherplace, Elsewhere|]]
12855 [[Otherplace, Elsewhere, Anywhere|]]
12856 !! html/php
12857 [[Otherplace, Somewhere|Otherplace]]
12858 [[Otherplace, Elsewhere|Otherplace]]
12859 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12860 !! end
12861
12862 !! test
12863 pre-save transform: context links ("pipe trick") with parens and comma
12864 !! options
12865 pst title=[[Someplace (IGNORED), Somewhere]]
12866 !! wikitext
12867 [[|Otherplace]]
12868 [[Otherplace (place), Elsewhere|]]
12869 !! html/php
12870 [[Otherplace, Somewhere|Otherplace]]
12871 [[Otherplace (place), Elsewhere|Otherplace]]
12872 !! end
12873
12874 !! test
12875 pre-save transform: context links ("pipe trick") with comma and parens
12876 !! options
12877 pst title=[[Who, me? (context)]]
12878 !! wikitext
12879 [[|Yes, you.]]
12880 [[Me, Myself, and I (1937 song)|]]
12881 !! html/php
12882 [[Yes, you. (context)|Yes, you.]]
12883 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12884 !! end
12885
12886 !! test
12887 pre-save transform: context links ("pipe trick") with namespace
12888 !! options
12889 pst title=[[Ns:Somearticle]]
12890 !! wikitext
12891 [[|Article]]
12892 !! html/php
12893 [[Ns:Article|Article]]
12894 !! end
12895
12896 !! test
12897 pre-save transform: context links ("pipe trick") with namespace and parens
12898 !! options
12899 pst title=[[Ns:Somearticle (context)]]
12900 !! wikitext
12901 [[|Article]]
12902 !! html/php
12903 [[Ns:Article (context)|Article]]
12904 !! end
12905
12906 !! test
12907 pre-save transform: context links ("pipe trick") with namespace and comma
12908 !! options
12909 pst title=[[Ns:Somearticle, Context, Whatever]]
12910 !! wikitext
12911 [[|Article]]
12912 !! html/php
12913 [[Ns:Article, Context, Whatever|Article]]
12914 !! end
12915
12916 !! test
12917 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12918 !! options
12919 pst title=[[Ns:Somearticle, Context (context)]]
12920 !! wikitext
12921 [[|Article]]
12922 !! html/php
12923 [[Ns:Article (context)|Article]]
12924 !! end
12925
12926 !! test
12927 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12928 !! options
12929 pst title=[[Ns:Somearticle (IGNORED), Context]]
12930 !! wikitext
12931 [[|Article]]
12932 !! html/php
12933 [[Ns:Article, Context|Article]]
12934 !! end
12935
12936 !! test
12937 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12938 !! options
12939 pst
12940 !! wikitext
12941 [[Article(context)|]]
12942 [[Bar:Article(context)|]]
12943 [[:Bar:Article(context)|]]
12944 [[|Article(context)]]
12945 [[Bar:X(Y)Z|]]
12946 [[:Bar:X(Y)Z|]]
12947 !! html/php
12948 [[Article(context)|Article]]
12949 [[Bar:Article(context)|Article]]
12950 [[:Bar:Article(context)|Article]]
12951 [[Article(context)]]
12952 [[Bar:X(Y)Z|X(Y)Z]]
12953 [[:Bar:X(Y)Z|X(Y)Z]]
12954 !! end
12955
12956 !! test
12957 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12958 !! options
12959 pst
12960 !! wikitext
12961 [[Article (context)|]]
12962 [[Bar:Article (context)|]]
12963 [[:Bar:Article (context)|]]
12964 [[|Article (context)]]
12965 [[Bar:X (Y) Z|]]
12966 [[:Bar:X (Y) Z|]]
12967 !! html/php
12968 [[Article (context)|Article]]
12969 [[Bar:Article (context)|Article]]
12970 [[:Bar:Article (context)|Article]]
12971 [[Article (context)]]
12972 [[Bar:X (Y) Z|X (Y) Z]]
12973 [[:Bar:X (Y) Z|X (Y) Z]]
12974 !! end
12975
12976 !! test
12977 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12978 !! options
12979 pst
12980 !! wikitext
12981 [[Article(context)|]]
12982 [[Bar:Article(context)|]]
12983 [[:Bar:Article(context)|]]
12984 [[|Article(context)]]
12985 [[Bar:X(Y)Z|]]
12986 [[:Bar:X(Y)Z|]]
12987 !! html/php
12988 [[Article(context)|Article]]
12989 [[Bar:Article(context)|Article]]
12990 [[:Bar:Article(context)|Article]]
12991 [[Article(context)]]
12992 [[Bar:X(Y)Z|X(Y)Z]]
12993 [[:Bar:X(Y)Z|X(Y)Z]]
12994 !! end
12995
12996 !! test
12997 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12998 !! options
12999 pst
13000 !! wikitext
13001 [[Article (context), context|]]
13002 [[Article (context),context|]]
13003 [[Bar:Article (context), context|]]
13004 [[Bar:Article (context),context|]]
13005 [[:Bar:Article (context), context|]]
13006 [[:Bar:Article (context),context|]]
13007 !! html/php
13008 [[Article (context), context|Article]]
13009 [[Article (context),context|Article]]
13010 [[Bar:Article (context), context|Article]]
13011 [[Bar:Article (context),context|Article]]
13012 [[:Bar:Article (context), context|Article]]
13013 [[:Bar:Article (context),context|Article]]
13014 !! end
13015
13016 !! test
13017 pre-save transform: trim trailing empty lines
13018 !! options
13019 pst
13020 !! wikitext
13021 Empty lines are trimmed
13022
13023
13024
13025
13026 !! html/php
13027 Empty lines are trimmed
13028 !! end
13029
13030 !! test
13031 pre-save transform: Signature expansion
13032 !! options
13033 pst
13034 !! wikitext
13035 * ~~~
13036 * <noinclude>~~~</noinclude>
13037 * <includeonly>~~~</includeonly>
13038 * <onlyinclude>~~~</onlyinclude>
13039 !! html/php
13040 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13041 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13042 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13043 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13044 !! end
13045
13046
13047 !! test
13048 pre-save transform: Signature expansion in nowiki tags (bug 93)
13049 !! options
13050 pst disabled
13051 !! wikitext
13052 Shall not expand:
13053
13054 <nowiki>~~~~</nowiki>
13055
13056 <includeonly><nowiki>~~~~</nowiki></includeonly>
13057
13058 <noinclude><nowiki>~~~~</nowiki></noinclude>
13059
13060 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13061
13062 {{subst:Foo}} shall be converted to FOO
13063
13064 As well as inside noinclude/onlyinclude
13065 <noinclude>{{subst:Foo}}</noinclude>
13066 <onlyinclude>{{subst:Foo}}</onlyinclude>
13067
13068 But not inside includeonly
13069 <includeonly>{{subst:Foo}}</includeonly>
13070 !! html/php
13071 Shall not expand:
13072
13073 <nowiki>~~~~</nowiki>
13074
13075 <includeonly><nowiki>~~~~</nowiki></includeonly>
13076
13077 <noinclude><nowiki>~~~~</nowiki></noinclude>
13078
13079 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13080
13081 FOO shall be converted to FOO
13082
13083 As well as inside noinclude/onlyinclude
13084 <noinclude>FOO</noinclude>
13085 <onlyinclude>FOO</onlyinclude>
13086
13087 But not inside includeonly
13088 <includeonly>{{subst:Foo}}</includeonly>
13089 !! end
13090
13091 !! test
13092 Parsoid: Recognize nowiki with trailing space in tags
13093 !! options
13094 parsoid=wt2html
13095 !! wikitext
13096 <nowiki ><div>[[foo]]</nowiki >
13097
13098 a<nowiki / >b
13099
13100 c<nowiki />d
13101
13102 e<nowiki/ >f
13103 !! html
13104 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13105 <p>ab</p>
13106 <p>cd</p>
13107 <p>ef</p>
13108 !! end
13109
13110 !! test
13111 Parsoid: Recognize nowiki with odd capitalization
13112 !! options
13113 parsoid=wt2html
13114 !! wikitext
13115 <noWikI ><div>[[foo]]</Nowiki >
13116 !! html
13117 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13118 !! end
13119
13120
13121 !! test
13122 Parsoid: Escape nowiki with trailing space in tags
13123 !! options
13124 parsoid=html2wt
13125 !! html/parsoid
13126 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13127 <p>a&lt;nowiki /&gt;b</p>
13128 <p>c&lt;nowiki/ &gt;d</p>
13129 !! wikitext
13130 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13131
13132 a&lt;nowiki /&gt;b
13133
13134 c&lt;nowiki/ &gt;d
13135 !! end
13136
13137 !! test
13138 Parsoid: Escape weird noWikI capitalizations
13139 !! options
13140 parsoid=html2wt
13141 !! html/parsoid
13142 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13143 !! wikitext
13144 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13145 !! end
13146
13147 ###
13148 ### Message transform tests
13149 ###
13150 !! test
13151 message transform: magic variables
13152 !! options
13153 msg
13154 !! wikitext
13155 {{SITENAME}}
13156 !! html
13157 MediaWiki
13158 !! end
13159
13160 !! test
13161 message transform: should not transform wiki markup
13162 !! options
13163 msg
13164 !! wikitext
13165 ''test''
13166 !! html
13167 ''test''
13168 !! end
13169
13170 !! test
13171 message transform: <noinclude> in transcluded template (bug 4926)
13172 !! options
13173 msg
13174 !! wikitext
13175 {{Includes}}
13176 !! html
13177 Foobar
13178 !! end
13179
13180 !! test
13181 message transform: <onlyinclude> in transcluded template (bug 4926)
13182 !! options
13183 msg
13184 !! wikitext
13185 {{Includes2}}
13186 !! html
13187 Foo
13188 !! end
13189
13190 !! test
13191 {{#special:}} page name, known
13192 !! options
13193 msg
13194 !! wikitext
13195 {{#special:Recentchanges}}
13196 !! html
13197 Special:RecentChanges
13198 !! end
13199
13200 !! test
13201 {{#special:}} page name with subpage, known
13202 !! options
13203 msg
13204 !! wikitext
13205 {{#special:Recentchanges/param}}
13206 !! html
13207 Special:RecentChanges/param
13208 !! end
13209
13210 !! test
13211 {{#special:}} page name, unknown
13212 !! options
13213 msg
13214 !! wikitext
13215 {{#special:foobar nonexistent}}
13216 !! html
13217 Special:Foobar nonexistent
13218 !! end
13219
13220 !! test
13221 {{#speciale:}} page name, known
13222 !! options
13223 msg
13224 !! wikitext
13225 {{#speciale:Recentchanges}}
13226 !! html
13227 Special:RecentChanges
13228 !! end
13229
13230 !! test
13231 {{#speciale:}} page name with subpage, known
13232 !! options
13233 msg
13234 !! wikitext
13235 {{#speciale:Recentchanges/param}}
13236 !! html
13237 Special:RecentChanges/param
13238 !! end
13239
13240 !! test
13241 {{#speciale:}} page name, unknown
13242 !! options
13243 msg
13244 !! wikitext
13245 {{#speciale:foobar nonexistent}}
13246 !! html
13247 Special:Foobar_nonexistent
13248 !! end
13249
13250 ###
13251 ### Images
13252 ###
13253 ### For Parsoid-specific tests, see
13254 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13255
13256 !! test
13257 Simple image
13258 !! options
13259 parsoid=wt2html,wt2wt,html2html
13260 !! wikitext
13261 [[Image:foobar.jpg]]
13262 !! html/php
13263 <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>
13264 </p>
13265 !! html/parsoid
13266 <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>
13267 !! end
13268
13269 !! test
13270 Simple image (using File: namespace, now canonical)
13271 !! wikitext
13272 [[File:Foobar.jpg]]
13273 !! html/php
13274 <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>
13275 </p>
13276 !! html/parsoid
13277 <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>
13278 !! end
13279
13280 !! test
13281 Right-aligned image
13282 !! wikitext
13283 [[File:Foobar.jpg|right]]
13284 !! html/php
13285 <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>
13286
13287 !! html/parsoid
13288 <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>
13289 !! end
13290
13291 !! test
13292 Image with caption
13293 !! wikitext
13294 [[File:Foobar.jpg|right|Caption text]]
13295 !! html/php
13296 <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>
13297
13298 !! html/parsoid
13299 <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>
13300 !! end
13301
13302 !! test
13303 Image with caption, bug 53312 #1
13304 !! wikitext
13305 [[File:Foobar.jpg|right|Caption page stuff]]
13306 !! html/php
13307 <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>
13308
13309 !! html/parsoid
13310 <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>
13311 !! end
13312
13313 !! test
13314 Image with caption, bug 53312 #2
13315 !! wikitext
13316 [[File:Foobar.jpg|right|Caption page=]]
13317 !! html/php
13318 <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>
13319
13320 !! html/parsoid
13321 <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>
13322 !! end
13323
13324 !! test
13325 Image with caption, bug 53312 #3
13326 !! wikitext
13327 [[File:Foobar.jpg|right|Caption page=stuff]]
13328 !! html/php
13329 <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>
13330
13331 !! html/parsoid
13332 <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>
13333 !! end
13334
13335 !! test
13336 Allow empty links in image captions (Bug 60753)
13337 !! options
13338 thumbsize=220
13339 !! wikitext
13340 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13341 [[]]
13342 [[Link2]]
13343 ]]
13344 !! html/php
13345 <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>
13346
13347 !! html/parsoid
13348 <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>
13349 [[]]
13350 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13351 </figcaption></figure>
13352 !! end
13353
13354 !! test
13355 Titles in unlinked images (T23454)
13356 !! wikitext
13357 [[File:Foobar.jpg|link=|stuff]]
13358 !! html/php
13359 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13360 </p>
13361 !! end
13362
13363 !! test
13364 Link with empty target
13365 !! wikitext
13366 [[]]
13367 !! html
13368 <p>[[]]
13369 </p>
13370 !! end
13371
13372 !! test
13373 Image with link trail
13374 !! wikitext
13375 Linktrails should not work for images: [[File:Foobar.jpg]]s
13376 !! html/php
13377 <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
13378 </p>
13379 !! html/parsoid
13380 <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>
13381 !! end
13382
13383 !! test
13384 Image with empty attribute
13385 !! options
13386 parsoid=wt2html,wt2wt,html2html
13387 !! wikitext
13388 [[File:Foobar.jpg|right||Caption text]]
13389 !! html/php
13390 <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>
13391
13392 !! html/parsoid
13393 <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>
13394 !! end
13395
13396 !! test
13397 1. Block image with individual attributes from templates
13398 !! wikitext
13399 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13400 !! html/php
13401 <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>
13402
13403 !! html/parsoid
13404 <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>
13405 !! end
13406
13407 !! test
13408 2. Block Image with individual attributes from templates
13409 !! wikitext
13410 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13411 !! html/php
13412 <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>
13413
13414 !! html/parsoid
13415 <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>
13416 !! end
13417
13418 !! test
13419 3. Inline image with individual attributes from templates
13420 !! wikitext
13421 [[File:Foobar.jpg|{{echo|50px}}]]
13422 !! html/php
13423 <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>
13424 </p>
13425 !! html/parsoid
13426 <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>
13427 !! end
13428
13429 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13430 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13431 !! test
13432 Image with multiple attributes from the same template
13433 !! wikitext
13434 [[File:Foobar.jpg|{{image_attribs}}]]
13435 !! html/php
13436 <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>
13437
13438 !! html/parsoid
13439 <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>
13440 !! end
13441
13442 !! test
13443 Image with link tails
13444 !! options
13445 thumbsize=220
13446 !! wikitext
13447 123[[File:Foobar.jpg]]456
13448 123[[File:Foobar.jpg|right]]456
13449 123[[File:Foobar.jpg|thumb]]456
13450 !! html/php
13451 <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
13452 </p>
13453 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
13454 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
13455
13456 !! html/php+tidy
13457 <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>
13458 <p>123</p>
13459 <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>
13460 <p>456 123</p>
13461 <div class="thumb tright">
13462 <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>
13463 <div class="thumbcaption">
13464 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13465 </div>
13466 </div>
13467 </div>
13468 <p>456</p>
13469 !! html/parsoid
13470 <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>
13471 <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>
13472 <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>
13473 !! end
13474
13475 !! test
13476 Image with multiple captions -- only last one is accepted
13477 !! wikitext
13478 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13479 !! html/php
13480 <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>
13481
13482 !! html/parsoid
13483 <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>
13484 !! end
13485
13486 !! test
13487 Image with multiple widths -- use last
13488 !! wikitext
13489 [[File:Foobar.jpg|200px|300px|caption]]
13490 !! html/php
13491 <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>
13492 </p>
13493 !! html/parsoid
13494 <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>
13495 !! end
13496
13497 !! test
13498 Image with multiple alignments -- use first (bug 48664)
13499 !! options
13500 thumbsize=220
13501 !! wikitext
13502 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13503
13504 [[File:Foobar.jpg|middle|text-top|caption]]
13505 !! html/php
13506 <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>
13507 <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>
13508 </p>
13509 !! html/parsoid
13510 <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>
13511 <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>
13512 !! end
13513
13514 !! test
13515 Image with width attribute at different positions
13516 !! wikitext
13517 [[File:Foobar.jpg|200px|right|Caption]]
13518 [[File:Foobar.jpg|right|200px|Caption]]
13519 [[File:Foobar.jpg|right|Caption|200px]]
13520 !! html/php
13521 <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>
13522 <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>
13523 <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>
13524
13525 !! html/parsoid
13526 <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>
13527 <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>
13528 <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>
13529 !! end
13530
13531 # a sad bit of backward-compatibility
13532 !! test
13533 Image with size specified with pxpx (bug 13500, 51628)
13534 !! options
13535 parsoid=wt2html,wt2wt,html2html
13536 !! wikitext
13537 [[File:Foobar.jpg|20pxpx]]
13538 [[File:Foobar.jpg|200x20pxpx]]
13539 !! html/php
13540 <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>
13541 <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>
13542 </p>
13543 !! html/parsoid
13544 <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>
13545 !! end
13546
13547 !! test
13548 Image with link parameter, wiki target
13549 !! wikitext
13550 [[File:Foobar.jpg|link=Main Page]]
13551 !! html/php
13552 <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>
13553 </p>
13554 !! html/parsoid
13555 <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>
13556 !! end
13557
13558 # parsoid bug 49293 (part 1)
13559 !! test
13560 Image with link parameter, URL target
13561 !! wikitext
13562 [[File:Foobar.jpg|link=http://example.com/]]
13563 !! html/php
13564 <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>
13565 </p>
13566 !! html/parsoid
13567 <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>
13568 !! end
13569
13570 # parsoid bug 49293 (part 2)
13571 !! test
13572 Image with link parameter, protocol-less URL target
13573 !! wikitext
13574 [[File:Foobar.jpg|link=//example.com/]]
13575 !! html/php
13576 <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>
13577 </p>
13578 !! html/parsoid
13579 <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>
13580 !! end
13581
13582 !! test
13583 Escaping non-block captions (T107435)
13584 !! options
13585 parsoid={
13586 "modes": ["wt2wt"],
13587 "changes": [
13588 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13589 ]
13590 }
13591 !! wikitext
13592 [[Image:Foobar.jpg|caption]]
13593 !! wikitext/edited
13594 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13595 !! end
13596
13597 # wgExternalLinkTarget not supported by Parsoid
13598 !! test
13599 Image with link parameter, wgExternalLinkTarget
13600 !! wikitext
13601 [[Image:foobar.jpg|link=http://example.com/]]
13602 !! config
13603 wgExternalLinkTarget='foobar'
13604 !! html/php
13605 <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>
13606 </p>
13607 !! end
13608
13609 !! test
13610 Image with link parameter, wgNoFollowLinks set to false
13611 !! wikitext
13612 [[Image:foobar.jpg|link=http://example.com/]]
13613 !! config
13614 wgNoFollowLinks=false
13615 !! html
13616 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13617 </p>
13618 !! end
13619
13620 !! test
13621 Image with link parameter, wgNoFollowDomainExceptions
13622 !! wikitext
13623 [[Image:foobar.jpg|link=http://example.com/]]
13624 !! config
13625 wgNoFollowDomainExceptions='example.com'
13626 !! html
13627 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13628 </p>
13629 !! end
13630
13631 # wgExternalLinkTarget not supported by Parsoid
13632 !! test
13633 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13634 !! wikitext
13635 [[Image:foobar.jpg|link=http://example.com/|Title]]
13636 !! config
13637 wgExternalLinkTarget='foobar'
13638 !! html/php
13639 <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>
13640 </p>
13641 !! end
13642
13643 !! test
13644 Image with empty link parameter
13645 !! wikitext
13646 [[File:Foobar.jpg|link=]]
13647 !! html/php
13648 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13649 </p>
13650 !! html/parsoid
13651 <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>
13652 !! end
13653
13654 !! test
13655 Image with link parameter (wiki target) and unnamed parameter
13656 !! wikitext
13657 [[File:Foobar.jpg|link=Main_Page|Title]]
13658 !! html/php
13659 <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>
13660 </p>
13661 !! html/parsoid
13662 <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>
13663 !! end
13664
13665 !! test
13666 Image with link parameter (URL target) and unnamed parameter
13667 !! wikitext
13668 [[File:Foobar.jpg|link=http://example.com/|Title]]
13669 !! html/php
13670 <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>
13671 </p>
13672 !! html/parsoid
13673 <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>
13674 !! end
13675
13676 !! test
13677 Thumbnail image with link parameter
13678 !! options
13679 thumbsize=220
13680 parsoid=wt2html,wt2wt,html2html
13681 !! wikitext
13682 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13683 !! html/php
13684 <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>
13685
13686 !! html/parsoid
13687 <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>
13688 !! end
13689
13690 !! test
13691 Manually-specified thumbnail image
13692 !! options
13693 thumbsize=220
13694 !! wikitext
13695 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13696 !! html/php
13697 <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>
13698
13699 !! html/parsoid
13700 <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>
13701 !! end
13702
13703 !! test
13704 Manually-specified thumbnail image with explicit link to wiki page
13705 !! options
13706 thumbsize=220
13707 parsoid=wt2html,wt2wt,html2html
13708 !! wikitext
13709 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13710 !! html/php
13711 <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>
13712
13713 !! html/parsoid
13714 <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>
13715 !! end
13716
13717 !! test
13718 Manually-specified thumbnail image with explicit link to url
13719 !! options
13720 thumbsize=220
13721 parsoid=wt2html,wt2wt,html2html
13722 !! wikitext
13723 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13724 !! html/php
13725 <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>
13726
13727 !! html/parsoid
13728 <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>
13729 !! end
13730
13731 !! test
13732 Manually-specified thumbnail image with explicit no link
13733 !! options
13734 thumbsize=220
13735 parsoid=wt2html,wt2wt,html2html
13736 !! wikitext
13737 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13738 !! html/php
13739 <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>
13740
13741 !! html/parsoid
13742 <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>
13743 !! end
13744
13745 !! test
13746 Manually-specified thumbnail image with explicit link and alt text
13747 !! options
13748 thumbsize=220
13749 parsoid=wt2html,wt2wt,html2html
13750 !! wikitext
13751 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13752 !! html/php
13753 <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>
13754
13755 !! html/parsoid
13756 <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>
13757 !! end
13758
13759 !! test
13760 Image with frame and link
13761 !! options
13762 parsoid=wt2html,wt2wt,html2html
13763 !! wikitext
13764 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13765 !! html/php
13766 <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>
13767
13768 !! html/parsoid
13769 <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>
13770 !! end
13771
13772 !! test
13773 Image with frame and link and explicit alt
13774 !! options
13775 parsoid=wt2html,wt2wt,html2html
13776 !! wikitext
13777 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13778 !! html/php
13779 <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>
13780
13781 !! html/parsoid
13782 <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>
13783 !! end
13784
13785 !! test
13786 Image with wiki markup in implicit alt
13787 !! wikitext
13788 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13789
13790 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13791 !! html/php
13792 <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>
13793 </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>
13794 </p>
13795 !! html/parsoid
13796 <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>
13797
13798 <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>
13799 !! end
13800
13801 !! test
13802 Alt image option should handle most kinds of wikitext without barfing
13803 !! wikitext
13804 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13805 !! html/php
13806 <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>
13807
13808 !! html/parsoid
13809 <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>
13810 !! end
13811
13812 ###################
13813 # Conflicting image format options.
13814 # First option specified should 'win'.
13815 # All three cases in each test should be identical.
13816
13817 !! test
13818 Image with 'frameless' first.
13819 !! options
13820 parsoid=wt2html,wt2wt,html2html
13821 !! wikitext
13822 [[File:Foobar.jpg|frameless|caption]]
13823
13824 [[File:Foobar.jpg|frameless|frame|caption]]
13825
13826 [[File:Foobar.jpg|frameless|thumb|caption]]
13827 !! html/php
13828 <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>
13829 </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>
13830 </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>
13831 </p>
13832 !! html/parsoid
13833 <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>
13834 <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>
13835 <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>
13836 !! end
13837
13838 !! test
13839 Image with 'frame' first.
13840 !! options
13841 parsoid=wt2html,wt2wt,html2html
13842 !! wikitext
13843 [[File:Foobar.jpg|frame|caption]]
13844 [[File:Foobar.jpg|frame|frameless|caption]]
13845 [[File:Foobar.jpg|frame|thumb|caption]]
13846 !! html/php
13847 <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>
13848 <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>
13849 <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>
13850
13851 !! html/parsoid
13852 <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>
13853 <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>
13854 <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>
13855 !! end
13856
13857 !! test
13858 Image with 'thumb' first.
13859 !! options
13860 parsoid=wt2html,wt2wt,html2html
13861 !! wikitext
13862 [[File:Foobar.jpg|thumb|caption]]
13863 [[File:Foobar.jpg|thumb|frameless|caption]]
13864 [[File:Foobar.jpg|thumb|frame|caption]]
13865 !! html/php
13866 <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>
13867 <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>
13868 <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>
13869
13870 !! html/parsoid
13871 <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>
13872 <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>
13873 <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>
13874 !! end
13875
13876 ###################
13877 # Image sizing.
13878 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13879 # and https://phabricator.wikimedia.org/T64258
13880 # Foobar has actual size of 1941x220
13881 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13882 # a scalable format.
13883 # 2. Framed images always ignore size options; always render at default size.
13884 # 3. "Unspecified format" and border are the only types which can be
13885 # enlarged.
13886
13887 !! test
13888 Image: "unspecified format" and border enlarge
13889 !! options
13890 parsoid=wt2html,wt2wt,html2html
13891 !! wikitext
13892 [[File:Foobar.jpg|2000px]]
13893
13894 [[File:Foobar.jpg|border|2000px]]
13895 !! html/php
13896 <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>
13897 </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>
13898 </p>
13899 !! html/parsoid
13900 <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>
13901 <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>
13902 !! end
13903
13904 !! test
13905 Image: "unspecified format" and border reduce
13906 !! options
13907 parsoid=wt2html,wt2wt,html2html
13908 !! wikitext
13909 [[File:Foobar.jpg|1000px]]
13910
13911 [[File:Foobar.jpg|border|1000px]]
13912 !! html/php
13913 <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>
13914 </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>
13915 </p>
13916 !! html/parsoid
13917 <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>
13918 <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>
13919 !! end
13920
13921 !! test
13922 Image: thumbs reduce
13923 !! options
13924 parsoid=wt2html,wt2wt,html2html
13925 !! wikitext
13926 [[File:Foobar.jpg|thumb|50px]]
13927 !! html/php
13928 <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>
13929
13930 !! html/parsoid
13931 <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>
13932 !! end
13933
13934 !! test
13935 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13936 !! options
13937 parsoid=wt2html,wt2wt,html2html
13938 !! wikitext
13939 [[File:Foobar.jpg|thumb|2000px]]
13940
13941 [[File:Foobar.svg|thumb|2000px]]
13942 !! html/php
13943 <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>
13944 <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>
13945
13946 !! html/parsoid
13947 <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>
13948 <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>
13949 !! end
13950
13951 !! test
13952 Image: frameless can reduce in size
13953 !! options
13954 parsoid=wt2html,wt2wt,html2html
13955 !! wikitext
13956 [[File:Foobar.jpg|frameless|50px]]
13957 !! html/php
13958 <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>
13959 </p>
13960 !! html/parsoid
13961 <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>
13962 !! end
13963
13964 !! test
13965 Image: bitmap frameless can't be enlarged past original size, but vector can
13966 !! options
13967 parsoid=wt2html,wt2wt,html2html
13968 !! wikitext
13969 [[File:Foobar.jpg|frameless|2000px]]
13970
13971 [[File:Foobar.svg|frameless|2000px]]
13972 !! html/php
13973 <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>
13974 </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>
13975 </p>
13976 !! html/parsoid
13977 <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>
13978 <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>
13979 !! end
13980
13981 !! test
13982 Image: framed images are always unscaled.
13983 !! options
13984 parsoid=wt2html,wt2wt,html2html
13985 !! wikitext
13986 [[File:Foobar.jpg|frame]]
13987
13988 [[File:Foobar.jpg|frame|50px]]
13989
13990 [[File:Foobar.jpg|frame|50x50px]]
13991
13992 [[File:Foobar.jpg|frame|2000px]]
13993 !! html/php
13994 <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>
13995 <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>
13996 <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>
13997 <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>
13998
13999 !! html/parsoid
14000 <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>
14001 <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>
14002 <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>
14003 <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>
14004 !! end
14005
14006 ###################
14007
14008 !! test
14009 Link to image page- image page normally doesn't exists, hence edit link
14010 Add test with existing image page
14011 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14012 !! wikitext
14013 [[:Image:test]]
14014 !! html
14015 <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>
14016 </p>
14017 !! end
14018
14019 !! test
14020 bug 18784 Link to non-existent image page with caption should use caption as link text
14021 !! wikitext
14022 [[:Image:test|caption]]
14023 !! html
14024 <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>
14025 </p>
14026 !! end
14027
14028 !! test
14029 Frameless image caption with a free URL
14030 !! wikitext
14031 [[File:Foobar.jpg|http://example.com]]
14032 !! html/php
14033 <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>
14034 </p>
14035 !! html/parsoid
14036 <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>
14037 !! end
14038
14039 !! test
14040 Thumbnail image caption with a free URL
14041 !! options
14042 thumbsize=220
14043 !! wikitext
14044 [[File:Foobar.jpg|thumb|http://example.com]]
14045 !! html/php
14046 <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>
14047
14048 !! html/parsoid
14049 <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>
14050 !! end
14051
14052 !! test
14053 Thumbnail image caption with a free URL and explicit alt
14054 !! options
14055 thumbsize=220
14056 parsoid=wt2html,wt2wt,html2html
14057 !! wikitext
14058 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14059 !! html/php
14060 <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>
14061
14062 !! html/parsoid
14063 <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>
14064 !! end
14065
14066 !! test
14067 SVG thumbnails with no language set
14068 !! options
14069 !! wikitext
14070 [[File:Foobar.svg|thumb|caption]]
14071 !! html/php
14072 <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>
14073
14074 !! html/parsoid
14075 <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>
14076 !! end
14077
14078 !! test
14079 SVG thumbnails with language de
14080 !! options
14081 parsoid=wt2html,wt2wt,html2html
14082 !! wikitext
14083 [[File:Foobar.svg|thumb|caption|lang=de]]
14084 !! html/php
14085 <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>
14086
14087 !! html/parsoid
14088 <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>
14089 !! end
14090
14091 !! test
14092 SVG thumbnails with invalid language code
14093 !! options
14094 parsoid=wt2html,wt2wt,html2html
14095 !! wikitext
14096 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14097 !! html/php
14098 <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>
14099
14100 !! html/parsoid
14101 <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>
14102 !! end
14103
14104 !! test
14105 BUG 1887: A ISBN with a thumbnail
14106 !! wikitext
14107 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14108 !! html/php
14109 <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>
14110
14111 !! html/parsoid
14112 <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>
14113 !! end
14114
14115 !! test
14116 BUG 1887: A RFC with a thumbnail
14117 !! wikitext
14118 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14119 !! html/php
14120 <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>
14121
14122 !! html/parsoid
14123 <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>
14124 !! end
14125
14126 !! test
14127 BUG 1887: A mailto link with a thumbnail
14128 !! wikitext
14129 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14130 !! html/php
14131 <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>
14132
14133 !! html/parsoid
14134 <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>
14135 !! end
14136
14137 # Pending resolution to bug 368
14138 !! test
14139 BUG 648: Frameless image caption with a link
14140 !! wikitext
14141 [[File:Foobar.jpg|text with a [[link]] in it]]
14142 !! html/php
14143 <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>
14144 </p>
14145 !! html/parsoid
14146 <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>
14147 !! end
14148
14149 !! test
14150 BUG 648: Frameless image caption with a link (suffix)
14151 !! wikitext
14152 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14153 !! html/php
14154 <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>
14155 </p>
14156 !! html/parsoid
14157 <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>
14158 !! end
14159
14160 !! test
14161 BUG 648: Frameless image caption with an interwiki link
14162 !! wikitext
14163 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14164 !! html/php
14165 <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>
14166 </p>
14167 !! html/parsoid
14168 <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>
14169 !! end
14170
14171 !! test
14172 BUG 648: Frameless image caption with a piped interwiki link
14173 !! wikitext
14174 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14175 !! html/php
14176 <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>
14177 </p>
14178 !! html/parsoid
14179 <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>
14180 !! end
14181
14182 !! test
14183 T107474: Frameless image caption with <nowiki>
14184 !! wikitext
14185 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14186 !! html/parsoid
14187 <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>
14188 !! end
14189
14190 !! test
14191 Escape HTML special chars in image alt text
14192 !! wikitext
14193 [[File:Foobar.jpg|& < > "]]
14194 !! html/php
14195 <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>
14196 </p>
14197 !! html/parsoid
14198 <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>
14199 !! end
14200
14201 !! test
14202 Escape HTML special chars in image alt text with LanguageConverter
14203 !! options
14204 language=zh
14205 !! wikitext
14206 [[File:Foobar.jpg|& < > "]]
14207 !! html/php
14208 <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>
14209 </p>
14210 !! html/parsoid
14211 <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>
14212 !! end
14213
14214 !! test
14215 Entities in file name and attributes
14216 !! wikitext
14217 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14218 !! html/php
14219 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14220 </p>
14221 !! html/parsoid
14222 <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>
14223 !! end
14224
14225 !! test
14226 BUG 499: Alt text should have &#1234;, not &amp;1234;
14227 !! wikitext
14228 [[File:Foobar.jpg|&#9792;]]
14229 !! html/php
14230 <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>
14231 </p>
14232 !! html/parsoid
14233 <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>
14234 !! end
14235
14236 !! test
14237 Broken image caption with link
14238 !! options
14239 parsoid=wt2html,wt2wt,html2html
14240 !! wikitext
14241 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14242 !! html/php
14243 <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.
14244 </p>
14245 !! html/parsoid
14246 <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>
14247 !! end
14248
14249 !! test
14250 Image caption containing another image
14251 !! wikitext
14252 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14253 !! html/php
14254 <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>
14255
14256 !! html/parsoid
14257 <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>
14258 !! end
14259
14260 !! test
14261 Image: caption containing a newline
14262 !! wikitext
14263 [[File:Foobar.jpg|This
14264 *is some text]]
14265 !! html/php
14266 <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>
14267 </p>
14268 !! html/parsoid
14269 <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>
14270 !!end
14271
14272 !!test
14273 Image: caption containing leading space
14274 (The leading space should not trigger nowiki escaping in wt2wt mode)
14275 !! wikitext
14276 [[File:Foobar.jpg|thumb| bar]]
14277 !! html/php
14278 <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>
14279
14280 !! html/parsoid
14281 <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>
14282 !!end
14283
14284 !! test
14285 Image: caption containing a table
14286 !! options
14287 parsoid=wt2html,wt2wt,html2html
14288 !! wikitext
14289 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14290 {|
14291 ! Foo !! Bar
14292 |-
14293 | Foo1 || Bar1
14294 |}
14295 and some more text.]]
14296 !! html/php
14297 <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>
14298
14299 !! html/parsoid
14300 <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
14301 <table>
14302 <tbody>
14303 <tr><th>Foo </th><th>Bar</th></tr>
14304 <tr>
14305 <td>Foo1 </td>
14306 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14307 !! end
14308
14309 !! test
14310 Bug 3090: External links other than http: in image captions
14311 !! wikitext
14312 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14313 !! html/php
14314 <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>
14315
14316 !! html/parsoid
14317 <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>
14318 !! end
14319
14320 !! test
14321 Custom class
14322 !! options
14323 parsoid=wt2html,wt2wt,html2html
14324 !! wikitext
14325 [[Image:foobar.jpg|a|class=b]]
14326 !! html/php
14327 <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>
14328 </p>
14329 !! html/parsoid
14330 <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>
14331 !! end
14332
14333 !! test
14334 Localized image handling (1).
14335 !! options
14336 parsoid=wt2html,wt2wt,html2html
14337 language=es
14338 !! wikitext
14339 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14340 !! html/php
14341 <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>
14342
14343 !! html/parsoid
14344 <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>
14345 !! end
14346
14347 !! test
14348 Localized image handling (2).
14349 !! options
14350 thumbsize=220
14351 parsoid=wt2html,wt2wt,html2html
14352 language=es
14353 !! wikitext
14354 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14355 !! html/php
14356 <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>
14357
14358 !! html/parsoid
14359 <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>
14360 !! end
14361
14362 !! test
14363 Localized image handling (3).
14364 !! options
14365 language=fa
14366 parsoid=html2wt
14367 !! html/parsoid
14368 <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>
14369 !! wikitext
14370 [[File:Foobar.jpg|بندانگشتی]]
14371 !! end
14372
14373 !! test
14374 "border", "frameless" and "class" attributes on an image.
14375 !! options
14376 thumbsize=220
14377 parsoid=wt2html,wt2wt,html2html
14378 !! wikitext
14379 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14380 !! html/php
14381 <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>
14382 </p>
14383 !! html/parsoid
14384 <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>
14385 !! end
14386
14387 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14388 !! test
14389 Invalid image attributes (bug 62500)
14390 !! options
14391 thumbsize=220
14392 parsoid=wt2html,wt2wt,html2html
14393 !! wikitext
14394 [[File:Foobar.jpg|thumb|float|left|caption]]
14395
14396 [[File:Foobar.jpg|thumb|righ|caption]]
14397
14398 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14399 !! html/php
14400 <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>
14401 <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>
14402 <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>
14403
14404 !! html/parsoid
14405 <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>
14406 <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>
14407 <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>
14408 !! end
14409
14410 !! article
14411 File:Barfoo.jpg
14412 !! text
14413 #REDIRECT [[File:Barfoo.jpg]]
14414 !! endarticle
14415
14416 # FIXME: Parsoid should run this test -- but we'd need to teach the
14417 # mockAPI about the redirected Barfoo.jpg image.
14418 !! test
14419 Redirected image
14420 !! wikitext
14421 [[Image:Barfoo.jpg]]
14422 !! html/php
14423 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14424 </p>
14425 !! end
14426
14427 !! test
14428 Missing image with uploads disabled
14429 !! options
14430 wgEnableUploads=0
14431 !! wikitext
14432 [[File:Foobaz.jpg]]
14433 !! html/php
14434 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14435 </p>
14436 !! html/parsoid
14437 <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>
14438 !! end
14439
14440 # Parsoid-specific testing for images
14441 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14442 # Currently imperfect due to a flaw in the Parsoid testrunner
14443 # Work in progress
14444 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14445 # image tests.
14446
14447 !! test
14448 Parsoid-specific image handling - simple image with size and middle alignment
14449 !! wikitext
14450 [[File:Foobar.jpg|middle|50px]]
14451 !! html/parsoid
14452 <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>
14453 !! end
14454
14455 !! test
14456 Parsoid-specific image handling - simple image with size, middle alignment,
14457 non-standard namespace alias
14458 !! options
14459 parsoid=wt2wt,wt2html,html2html
14460 !! wikitext
14461 [[Image:Foobar.jpg|middle|50px]]
14462 !! html/parsoid
14463 <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>
14464 !! end
14465
14466 !! test
14467 Parsoid-specific image handling - simple image with size and middle alignment
14468 (existing content)
14469 !! wikitext
14470 [[File:Foobar.jpg|50px|middle]]
14471 !! html/parsoid
14472 <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>
14473 !! end
14474
14475 !! test
14476 Parsoid-specific image handling - simple image with size and middle alignment
14477 and non-standard namespace name
14478 !! options
14479 parsoid=wt2html,wt2wt,html2html
14480 !! wikitext
14481 [[Image:Foobar.jpg|50px|middle]]
14482 !! html/parsoid
14483 <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>
14484 !! end
14485
14486 !! test
14487 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14488 !! wikitext
14489 [[File:Foobar.jpg|500x10px|baseline|caption]]
14490 !! html/parsoid
14491 <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>
14492 !! end
14493
14494 !! test
14495 Parsoid-specific image handling - simple image with border and size spec
14496 !! wikitext
14497 [[File:Foobar.jpg|50px|border|caption]]
14498 !! html/parsoid
14499 <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>
14500 !! end
14501
14502 !! test
14503 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14504 !! wikitext
14505 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14506 !! html/parsoid
14507 <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>
14508 !! end
14509
14510 !! test
14511 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14512 (existing content)
14513 !! wikitext
14514 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14515 !! html/parsoid
14516 <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>
14517 !! end
14518
14519 !! test
14520 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14521 !! wikitext
14522 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14523 !! html/parsoid
14524 <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>
14525 !! end
14526
14527 !! test
14528 Parsoid-specific image handling - thumbnail with specific size, halign,
14529 valign, and caption (existing content)
14530 !! wikitext
14531 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14532 !! html/parsoid
14533 <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>
14534 !! end
14535
14536 !! test
14537 Parsoid-specific image handling - framed image with specific size and caption
14538 (size is ignored)
14539 !! options
14540 parsoid=wt2html,wt2wt,html2html
14541 !! wikitext
14542 [[File:Foobar.jpg|frame|500x50px|caption]]
14543 !! html/parsoid
14544 <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>
14545 !! end
14546
14547 !! test
14548 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14549 (size is ignored)
14550 !! options
14551 parsoid=wt2html,wt2wt,html2html
14552 !! wikitext
14553 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14554 !! html/parsoid
14555 <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>
14556 !! end
14557
14558 !! test
14559 Parsoid-specific image handling - frameless image with specific size, border, and caption
14560 !! wikitext
14561 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14562 !! html/parsoid
14563 <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>
14564 !! end
14565
14566 !! test
14567 Parsoid-specific image handling - simple image with a formatted caption
14568 !! wikitext
14569 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14570 !! html/parsoid
14571 <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>
14572 !! end
14573
14574 !! test
14575 Parsoid-specific image handling - caption with a template in it
14576 !! wikitext
14577 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14578 !! html/parsoid
14579 <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>
14580 !! end
14581
14582 !! test
14583 Parsoid-specific image handling - caption with unbalanced tags in it
14584 !! options
14585 parsoid=wt2html,wt2wt,html2html
14586 !! wikitext
14587 foo
14588 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14589 bar
14590 !! html/parsoid
14591 <p>foo</p>
14592 <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>
14593 <p>bar</p>
14594 !! end
14595
14596 !! test
14597 Parsoid-specific image handling - empty caption (1)
14598 !! options
14599 parsoid=wt2html,wt2wt
14600 !! wikitext
14601 [[File:Foobar.jpg|thumb|]]
14602 !! html/parsoid
14603 <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>
14604 !! end
14605
14606 # empty captions don't get serialized unless we're in the "round trip" case
14607 !! test
14608 Parsoid-specific image handling - empty caption (2)
14609 !! options
14610 parsoid=html2wt
14611 !! html/parsoid
14612 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14613 <a href="./File:Foobar.jpg">
14614 <img resource="./File:Foobar.jpg"
14615 src="//example.com/images/3/3a/Foobar.jpg"
14616 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14617 height="25" width="220"/>
14618 </a>
14619 <figcaption></figcaption>
14620 </figure>
14621 !! wikitext
14622 [[File:Foobar.jpg|thumb]]
14623 !! end
14624
14625 !! test
14626 Parsoid-specific image handling - whitespace caption
14627 !! wikitext
14628 [[File:Foobar.jpg|thumb| ]]
14629 !! html/parsoid
14630 <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>
14631 !! end
14632
14633 !! test
14634 Parsoid-specific image handling - lang option
14635 !! wikitext
14636 foo
14637 [[File:Foobar.svg|lang=de|caption]]
14638 bar
14639 !! html/parsoid
14640 <p>foo
14641 <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>
14642 bar</p>
14643 !! end
14644
14645 ## Edge case bugs in Parsoid from T93580
14646 !! test
14647 T93580: 1. Templated <ref> inside block images
14648 !! wikitext
14649 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14650
14651 <references />
14652 !! html/parsoid
14653 <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>
14654
14655 <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>
14656 !! end
14657
14658 !! test
14659 T93580: 2. <ref> inside inline images
14660 !! wikitext
14661 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14662
14663 <references />
14664 !! html/parsoid
14665 <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>
14666
14667 <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>
14668 !! end
14669
14670 !! test
14671 T93580: 3. Templated <ref> inside inline images
14672 !! wikitext
14673 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14674
14675 <references />
14676 !! html/parsoid
14677 <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>
14678
14679 <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>
14680 !! end
14681
14682 ###
14683 ### Subpages
14684 ###
14685 !! article
14686 Subpage test/subpage
14687 !! text
14688 foo
14689 !! endarticle
14690
14691 !! test
14692 Subpage link
14693 !! options
14694 subpage title=[[Subpage test]]
14695 !! wikitext
14696 [[/subpage]]
14697 !! html
14698 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14699 </p>
14700 !! end
14701
14702 !! test
14703 Subpage noslash link
14704 !! options
14705 subpage title=[[Subpage test]]
14706 !! wikitext
14707 [[/subpage/]]
14708 !! html
14709 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14710 </p>
14711 !! end
14712
14713 !! article
14714 Subpage test/1/2/subpage
14715 !! text
14716 blah
14717 !! endarticle
14718
14719 !! test
14720 Relative subpage noslash link
14721 !! options
14722 parsoid=wt2wt,wt2html,html2html
14723 subpage title=[[Subpage test/1/2/3/4]]
14724 !! wikitext
14725 [[../../subpage/]]
14726
14727 [[../../subpage]]
14728 !! html/php
14729 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14730 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14731 </p>
14732 !! html/parsoid
14733 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14734 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14735 !! end
14736
14737 !! test
14738 Parsoid: dot-slash prefixed wikilinks
14739 !! wikitext
14740 [[./foo]]
14741
14742 [[././bar]]
14743
14744 [[././baz/]]
14745 !! html/php
14746 <p>[[./foo]]
14747 </p><p>[[././bar]]
14748 </p><p>[[././baz/]]
14749 </p>
14750 !! html/parsoid
14751 <p>[[./foo]]
14752 </p><p>[[././bar]]
14753 </p><p>[[././baz/]]
14754 </p>
14755 !! end
14756
14757 !! test
14758 Render invalid page names as plain text (bug 51090)
14759 !! wikitext
14760 [[./../foo|bar]]
14761 [[foo�|bar]]
14762 [[foo/.|bar]]
14763 [[foo/..|bar]]
14764 [[foo~~~bar]]
14765 [[foo>bar]]
14766 [[foo[bar]]
14767 [[.]]
14768 [[..]]
14769 [[foo././bar]]
14770
14771 [[{{echo|./../foo}}|bar]]
14772 [[{{echo|foo/.}}|bar]]
14773 [[{{echo|foo/..}}|bar]]
14774 [[{{echo|foo~~~~bar}}]]
14775 [[{{echo|foo>bar}}]]
14776 [[{{echo|foo././bar}}]]
14777 [[{{echo|foo{bar}}]]
14778 [[{{echo|foo}bar}}]]
14779 [[{{echo|foo[bar}}]]
14780 [[{{echo|foo]bar}}]]
14781 [[{{echo|foo<bar}}]]
14782 !!html/php
14783 <p>[[./../foo|bar]]
14784 [[foo�|bar]]
14785 [[foo/.|bar]]
14786 [[foo/..|bar]]
14787 [[foo~~~bar]]
14788 [[foo&gt;bar]]
14789 [[foo[bar]]
14790 [[.]]
14791 [[..]]
14792 [[foo././bar]]
14793 </p><p>[[./../foo|bar]]
14794 [[foo/.|bar]]
14795 [[foo/..|bar]]
14796 [[foo~~~~bar]]
14797 [[foo&gt;bar]]
14798 [[foo././bar]]
14799 [[foo{bar]]
14800 [[foo}bar]]
14801 [[foo[bar]]
14802 [[foo]bar]]
14803 [[foo&lt;bar]]
14804 </p>
14805 !!html/parsoid
14806 <p>[[./../foo|bar]]
14807 [[foo�|bar]]
14808 [[foo/.|bar]]
14809 [[foo/..|bar]]
14810 [[foo~~~bar]]
14811 [[foo>bar]]
14812 [[foo[bar]]
14813 [[.]]
14814 [[..]]
14815 [[foo././bar]]</p>
14816
14817 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14818 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14819 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14820 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14821 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14822 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14823 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14824 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14825 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14826 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14827 [[<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>
14828 !!end
14829
14830 !! test
14831 Disabled subpages
14832 !! wikitext
14833 [[/subpage]]
14834 !! html
14835 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14836 </p>
14837 !! end
14838
14839 !! test
14840 BUG 561: {{/Subpage}}
14841 !! options
14842 subpage title=[[Page]]
14843 !! wikitext
14844 {{/Subpage}}
14845 !! html
14846 <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>
14847 </p>
14848 !! end
14849
14850 ###
14851 ### Categories
14852 ###
14853 !! article
14854 Category:MediaWiki User's Guide
14855 !! text
14856 blah
14857 !! endarticle
14858
14859 !! test
14860 Link to category
14861 !! wikitext
14862 [[:Category:MediaWiki User's Guide]]
14863 !! html
14864 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14865 </p>
14866 !! end
14867
14868 !! test
14869 Simple category
14870 !! options
14871 cat
14872 !! wikitext
14873 [[Category:MediaWiki User's Guide]]
14874 !! html/php
14875 cat=MediaWiki_User's_Guide sort=
14876 !! html/parsoid
14877 <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"}}'/>
14878 !! end
14879
14880 !! test
14881 PAGESINCATEGORY invalid title fatal (r33546 fix)
14882 !! wikitext
14883 {{PAGESINCATEGORY:<bogus>}}
14884 !! html
14885 <p>0
14886 </p>
14887 !! end
14888
14889 !! test
14890 Category with different sort key
14891 !! options
14892 cat
14893 !! wikitext
14894 [[Category:MediaWiki User's Guide|Foo]]
14895 !! html/php
14896 cat=MediaWiki_User's_Guide sort=Foo
14897 !! html/parsoid
14898 <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"}}'/>
14899 !! end
14900
14901 !! test
14902 Category with identical sort key
14903 !! options
14904 cat
14905 !! wikitext
14906 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14907 !! html/php
14908 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
14909 !! html/parsoid
14910 <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"}}'/>
14911 !! end
14912
14913 !! test
14914 Category with empty sort key
14915 !! options
14916 cat
14917 pst
14918 !! wikitext
14919 [[Category:MediaWiki User's Guide|]]
14920 !! html/php
14921 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14922 !! end
14923
14924 !! test
14925 Category with empty sort key and parentheses
14926 !! options
14927 cat
14928 pst
14929 !! wikitext
14930 [[Category:Foo (bar)|]]
14931 !! html/php
14932 [[Category:Foo (bar)|Foo]]
14933 !! end
14934
14935 !! test
14936 Category with link tail
14937 !! options
14938 cat
14939 pst
14940 !! wikitext
14941 123[[Category:Foo]]456
14942 !! html/php
14943 123[[Category:Foo]]456
14944 !! end
14945
14946 !! test
14947 Category with template
14948 !! options
14949 cat
14950 pst
14951 !! wikitext
14952 [[Category:{{echo|Foo}}]]
14953 !! html/php
14954 [[Category:{{echo|Foo}}]]
14955 !! end
14956
14957 !! test
14958 Category with template in sort key
14959 !! options
14960 cat
14961 pst
14962 !! wikitext
14963 [[Category:Foo|{{echo|Bar}}]]
14964 !! html/php
14965 [[Category:Foo|{{echo|Bar}}]]
14966 !! end
14967
14968 !! test
14969 Category with template in sort key and title
14970 !! options
14971 cat
14972 pst
14973 !! wikitext
14974 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14975 !! html/php
14976 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14977 !! end
14978
14979 ## We used to, but no longer wt2wt this test since the default serializer
14980 ## will normalize all categories to serialize on their own line.
14981 ## This wikitext usage is going to be fairly uncommon in production and
14982 ## selser will take care of preserving formatting in those scenarios.
14983 !! test
14984 Category / paragraph interactions
14985 !! options
14986 parsoid=wt2html
14987 !! wikitext
14988 Foo [[Category:Baz]] Bar
14989
14990 Foo [[Category:Baz]]
14991 Bar
14992
14993 Foo
14994 [[Category:Baz]]
14995 Bar
14996
14997 Foo
14998 [[Category:Baz]] Bar
14999
15000 Foo
15001 [[Category:Baz]]
15002 [[Category:Baz]]
15003 [[Category:Baz]]
15004 Bar
15005
15006 [[Category:Baz]]
15007 [[Category:Baz]]
15008 [[Category:Baz]]
15009
15010 [[Category:Baz]]
15011 {{echo|[[Category:Baz]]}}
15012 [[Category:Baz]]
15013 !! html/php
15014 <p>Foo Bar
15015 </p><p>Foo
15016 Bar
15017 </p><p>Foo
15018 Bar
15019 </p><p>Foo Bar
15020 </p><p>Foo
15021 Bar
15022 </p>
15023 !! html/parsoid
15024 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
15025 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
15026 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
15027 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
15028 <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>
15029 <link rel="mw:PageProp/Category" href="Category:Baz"/>
15030 !! end
15031
15032 ## We used to, but no longer wt2wt this test since the default serializer
15033 ## will normalize all categories to serialize on their own line.
15034 ## This wikitext usage is going to be fairly uncommon in production and
15035 ## selser will take care of preserving formatting in those scenarios.
15036 ##
15037 ## The whitespace on the empty line is part of the test. Please do not delete
15038 !! test
15039 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
15040 !! options
15041 parsoid=wt2html
15042 !! wikitext
15043 This
15044
15045 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15046
15047 {{echo|[[Category:Foo]] and so should this!}}
15048 !! html/php
15049 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15050 </p>
15051 !! html/parsoid
15052 <p>This
15053
15054 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15055
15056 <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>
15057 !! end
15058
15059 ## Parsoid will not try to wt2wt this while preserving newlines because
15060 ## it suppresses excess newlines within list items -- and we don't want to
15061 ## introduce a special case just for categories, which is, in reality somewhat
15062 ## odd behavior -- categories are unlikely to be used in list items like this
15063 ## in top-level pages and are only likely to show up in template-generated
15064 ## list items where this RT-ing is a non-issue.
15065 ##
15066 ## The whitespace on the empty line is part of the test. Please do not delete
15067 !! test
15068 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
15069 !! options
15070 parsoid=wt2html
15071 !! wikitext
15072 * This
15073
15074 [[Category:Foo]] and this should be part of the same list item
15075 * So should this
15076
15077 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15078 !! html
15079 <ul><li>This and this should be part of the same list item</li>
15080 <li>So should this and this should be part of the same list item</li></ul>
15081 !! html/parsoid
15082 <ul>
15083 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15084 <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>
15085 </ul>
15086 !! end
15087
15088 ## Newlines and categories that follow the last item of a list
15089 ## are treated differently because this (list followed by categories)
15090 ## is an extremely common pattern on wikis.
15091 !! test
15092 3. Categories and newlines: newline suppression for last list item should RT properly
15093 !! wikitext
15094 * a
15095 * b
15096
15097 [[Category:Foo]]
15098
15099 [[Category:Bar]]
15100 [[Category:Baz]]
15101 !! html/parsoid
15102 <ul><li> a</li>
15103 <li> b</li></ul>
15104
15105 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15106
15107 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15108 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15109 !! end
15110
15111 !! test
15112 4. Categories and newlines: newline suppression for last list item should RT properly
15113 !! wikitext
15114 * a
15115 **** b
15116
15117 [[Category:Foo]]
15118 !! html/parsoid
15119 <ul><li> a
15120 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15121
15122 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15123 !! end
15124
15125 ## only wt2html for this to make sure the algo only applies to the rightmost path
15126 !! test
15127 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15128 !! options
15129 parsoid=wt2html
15130 !! wikitext
15131 * a
15132 ** b
15133 [[Category:Foo]]
15134 * c
15135 ** d
15136 [[Category:Foo]]
15137 !! html/parsoid
15138 <ul><li> a
15139 <ul><li> b
15140 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15141 <li> c
15142 <ul><li> d</li></ul></li></ul>
15143 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15144 !! end
15145
15146 ## We used to, but no longer wt2wt this test since the default serializer
15147 ## will normalize all categories to serialize on their own line.
15148 ## This wikitext usage is going to be fairly uncommon in production and
15149 ## selser will take care of preserving formatting in those scenarios.
15150 !! test
15151 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15152 !! options
15153 parsoid=wt2html
15154 !! wikitext
15155 * a [[Category:Foo]]
15156 !! html/parsoid
15157 <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>
15158 !! end
15159
15160 # This test also demonstrates because of newline+category tunneling
15161 # through the list hander, template wrapping doesn't expand to the
15162 # containing list when the list item swallows the category.
15163 !! test
15164 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15165 !! wikitext
15166 * {{echo|a
15167 [[Category:Foo]]}}
15168 !! html/parsoid
15169 <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
15170 </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>
15171 !! end
15172
15173 !! test
15174 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15175 !! wikitext
15176 * a
15177
15178 {{echo|[[Category:Foo]]
15179 [[Category:Bar]]}}
15180 [[Category:Baz]]
15181 !! html/parsoid
15182 <ul><li> a</li></ul>
15183
15184 <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">
15185 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15186 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15187 !! end
15188
15189 !! test
15190 Category links with multiple namespaces
15191 !! wikitext
15192 [[Category:Project:Foo]]
15193 !! html/parsoid
15194 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15195 !! end
15196
15197 !! test
15198 Parsoid: Serialize link to category page with colon escape
15199 !! options
15200 parsoid
15201 !! wikitext
15202
15203 [[:Category:Foo]]
15204 [[:Category:Foo|Bar]]
15205 !! html
15206 <p>
15207 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15208 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15209 </p>
15210 !! end
15211
15212 # We used to, but no longer wt2wt this test since the default serializer
15213 # will normalize all categories to serialize on their own line.
15214 # This wikitext usage is going to be fairly uncommon in production and
15215 # selser will take care of preventing whitespace insertion if this
15216 # occurs in an article.
15217 #
15218 # html2html disabled for the same reason (whitespace insertion between
15219 # x and y).
15220 #
15221 # html2wt disabled because it localizes the "Category" namespace.
15222 !! test
15223 Link prefix/suffixes aren't applied to category links
15224 !! options
15225 parsoid=wt2html
15226 language=is
15227 !! wikitext
15228 x[[Category:Foo]]y
15229 !! html/php
15230 <p>xy
15231 </p>
15232 !! html/parsoid
15233 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15234 !! end
15235
15236 !! test
15237 Parsoid: Serialize link to file page with colon escape
15238 !! options
15239 parsoid
15240 !! wikitext
15241
15242 [[:File:Foo.png]]
15243 [[:File:Foo.png|Bar]]
15244 !! html
15245 <p>
15246 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15247 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15248 </p>
15249 !! end
15250
15251 !! test
15252 Parsoid: Serialize a genuine category link without colon escape
15253 !! options
15254 parsoid
15255 !! wikitext
15256 [[Category:Foo]]
15257 [[Category:Foo|Bar]]
15258 !! html
15259 <link rel="mw:PageProp/Category" href="./Category:Foo">
15260 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15261 !! end
15262
15263 !! test
15264 Normalize hrefs properly before testing for invalid link targets (bug 70894)
15265 !! options
15266 parsoid=html2wt
15267 !! html/parsoid
15268 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15269 !! wikitext
15270 [[Category:Toxine bactérienne]]
15271 !! end
15272
15273 !! test
15274 Parsoid: Defaultsort
15275 !! wikitext
15276 {{DEFAULTSORT:Foo}}
15277 !! html/parsoid
15278 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15279 !! end
15280
15281 !! test
15282 Parsoid: Defaultsort (template-generated)
15283 !! wikitext
15284 {{{{echo|DEFAULTSORT}}:Foo}}
15285 !! html/parsoid
15286 <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}}]}'/>
15287 !! end
15288
15289 ###
15290 ### Inter-language links
15291 ###
15292 !! test
15293 Interlanguage links
15294 !! options
15295 ill
15296 !! wikitext
15297 [[es:Alimento]]
15298 [[fr:Nourriture]]
15299 [[zh:食品]]
15300 !! html/php
15301 es:Alimento fr:Nourriture zh:食品
15302 !! html/parsoid
15303 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15304 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15305 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15306 !! end
15307
15308 !! test
15309 Duplicate interlanguage links (bug 24502)
15310 !! options
15311 ill
15312 !! wikitext
15313 [[es:1]]
15314 [[es:2]]
15315 [[fr:1]]
15316 [[fr:2]]
15317 !! html/php
15318 es:1 fr:1
15319 !! html/parsoid
15320 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15321 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15322 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15323 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15324 !! end
15325
15326 ###
15327 ### Sections
15328 ###
15329 !! test
15330 Basic section headings
15331 !! wikitext
15332 == Headline 1 ==
15333 Some text
15334
15335 ==Headline 2==
15336 More
15337 ===Smaller headline===
15338 Blah blah
15339 !! html
15340 <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>
15341 <p>Some text
15342 </p>
15343 <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>
15344 <p>More
15345 </p>
15346 <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>
15347 <p>Blah blah
15348 </p>
15349 !! end
15350
15351 !! test
15352 Section headings with TOC
15353 !! wikitext
15354 == Headline 1 ==
15355 === Subheadline 1 ===
15356 ===== Skipping a level =====
15357 ====== Skipping a level ======
15358
15359 == Headline 2 ==
15360 Some text
15361 ===Another headline===
15362 !! html
15363 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15364 <ul>
15365 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15366 <ul>
15367 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15368 <ul>
15369 <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>
15370 <ul>
15371 <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>
15372 </ul>
15373 </li>
15374 </ul>
15375 </li>
15376 </ul>
15377 </li>
15378 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15379 <ul>
15380 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15381 </ul>
15382 </li>
15383 </ul>
15384 </div>
15385
15386 <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>
15387 <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>
15388 <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>
15389 <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>
15390 <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>
15391 <p>Some text
15392 </p>
15393 <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>
15394
15395 !! end
15396
15397 !! test
15398 TOC anchors don't collide
15399 !! wikitext
15400 __FORCETOC__
15401 == Headline 2 ==
15402 == Headline ==
15403 == Headline 2 ==
15404 == Headline ==
15405 !! html/php
15406 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15407 <ul>
15408 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15409 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15410 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15411 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15412 </ul>
15413 </div>
15414
15415 <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>
15416 <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>
15417 <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>
15418 <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>
15419
15420 !! end
15421
15422 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15423 !! test
15424 Handling of sections up to level 6 and beyond
15425 !! wikitext
15426 = Level 1 Heading=
15427 == Level 2 Heading==
15428 === Level 3 Heading===
15429 ==== Level 4 Heading====
15430 ===== Level 5 Heading=====
15431 ====== Level 6 Heading======
15432 ======= Level 7 Heading=======
15433 ======== Level 8 Heading========
15434 ========= Level 9 Heading=========
15435 ========== Level 10 Heading==========
15436 !! html
15437 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15438 <ul>
15439 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15440 <ul>
15441 <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>
15442 <ul>
15443 <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>
15444 <ul>
15445 <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>
15446 <ul>
15447 <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>
15448 <ul>
15449 <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>
15450 <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>
15451 <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>
15452 <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>
15453 <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>
15454 </ul>
15455 </li>
15456 </ul>
15457 </li>
15458 </ul>
15459 </li>
15460 </ul>
15461 </li>
15462 </ul>
15463 </li>
15464 </ul>
15465 </div>
15466
15467 <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>
15468 <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>
15469 <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>
15470 <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>
15471 <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>
15472 <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>
15473 <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>
15474 <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>
15475 <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>
15476 <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>
15477
15478 !! end
15479
15480 !! test
15481 TOC regression (T11764)
15482 !! wikitext
15483 == title 1 ==
15484 === title 1.1 ===
15485 ==== title 1.1.1 ====
15486 === title 1.2 ===
15487 == title 2 ==
15488 === title 2.1 ===
15489 !! html
15490 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15491 <ul>
15492 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15493 <ul>
15494 <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>
15495 <ul>
15496 <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>
15497 </ul>
15498 </li>
15499 <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>
15500 </ul>
15501 </li>
15502 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15503 <ul>
15504 <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>
15505 </ul>
15506 </li>
15507 </ul>
15508 </div>
15509
15510 <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>
15511 <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>
15512 <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>
15513 <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>
15514 <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>
15515 <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>
15516
15517 !! end
15518
15519 !! test
15520 TOC for heading containing <span id="..."></span> (T96153)
15521 !! wikitext
15522 __FORCETOC__
15523 ==<span id="old-anchor"></span>New title==
15524 !! html/php
15525 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15526 <ul>
15527 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15528 </ul>
15529 </div>
15530
15531 <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>
15532
15533 !! end
15534
15535 !! test
15536 TOC with wgMaxTocLevel=3 (bug 6204)
15537 !! options
15538 wgMaxTocLevel=3
15539 !! wikitext
15540 == title 1 ==
15541 === title 1.1 ===
15542 ==== title 1.1.1 ====
15543 === title 1.2 ===
15544 == title 2 ==
15545 === title 2.1 ===
15546 !! html
15547 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15548 <ul>
15549 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15550 <ul>
15551 <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>
15552 <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>
15553 </ul>
15554 </li>
15555 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15556 <ul>
15557 <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>
15558 </ul>
15559 </li>
15560 </ul>
15561 </div>
15562
15563 <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>
15564 <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>
15565 <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>
15566 <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>
15567 <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>
15568 <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>
15569
15570 !! end
15571
15572 !! test
15573 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15574 !! options
15575 wgMaxTocLevel=3
15576 !! wikitext
15577 ==Section 1==
15578 ===Section 1.1===
15579 ====Section 1.1.1====
15580 ====Section 1.1.1.1====
15581 ==Section 2==
15582 !! html
15583 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15584 <ul>
15585 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15586 <ul>
15587 <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>
15588 </ul>
15589 </li>
15590 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15591 </ul>
15592 </div>
15593
15594 <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>
15595 <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>
15596 <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>
15597 <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>
15598 <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>
15599
15600 !! end
15601
15602
15603 !! test
15604 Resolving duplicate section names
15605 !! wikitext
15606 == Foo bar ==
15607 == Foo bar ==
15608 !! html
15609 <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>
15610 <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>
15611
15612 !! end
15613
15614 !! test
15615 Resolving duplicate section names with differing case (bug 10721)
15616 !! wikitext
15617 == Foo bar ==
15618 == Foo Bar ==
15619 !! html
15620 <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>
15621 <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>
15622
15623 !! end
15624
15625 !! article
15626 Template:sections
15627 !! text
15628 ===Section 1===
15629 ==Section 2==
15630 !! endarticle
15631
15632 !! test
15633 Template with sections, __NOTOC__
15634 !! wikitext
15635 __NOTOC__
15636 ==Section 0==
15637 {{sections}}
15638 ==Section 4==
15639 !! html
15640 <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>
15641 <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>
15642 <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>
15643 <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>
15644
15645 !! end
15646
15647 !! test
15648 __NOEDITSECTION__ keyword
15649 !! wikitext
15650 __NOEDITSECTION__
15651 ==Section 1==
15652 ==Section 2==
15653 !! html
15654 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15655 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15656
15657 !! end
15658
15659 !! test
15660 Link inside a section heading
15661 !! wikitext
15662 ==Section with a [[Main Page|link]] in it==
15663 !! html
15664 <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>
15665
15666 !! end
15667
15668 !! test
15669 TOC regression (T14077)
15670 !! wikitext
15671 __TOC__
15672 == title 1 ==
15673 === title 1.1 ===
15674 == title 2 ==
15675 !! html
15676 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15677 <ul>
15678 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15679 <ul>
15680 <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>
15681 </ul>
15682 </li>
15683 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15684 </ul>
15685 </div>
15686
15687 <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>
15688 <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>
15689 <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>
15690
15691 !! end
15692
15693 !! test
15694 BUG 1219 URL next to image (good)
15695 !! wikitext
15696 http://example.com [[File:Foobar.jpg]]
15697 !! html/php
15698 <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>
15699 </p>
15700 !! html/parsoid
15701 <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>
15702 !!end
15703
15704 !! test
15705 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15706 !! wikitext
15707 ===
15708 The line above must have a trailing space!
15709 === <!--
15710 --> <!-- -->
15711 But just in case it doesn't...
15712 !! html
15713 <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>
15714 <p>The line above must have a trailing space!
15715 </p>
15716 <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>
15717 <p>But just in case it doesn't...
15718 </p>
15719 !! end
15720
15721 !! test
15722 Header with special characters (bug 25462)
15723 !! wikitext
15724 The tooltips shall not show entities to the user (ie. be double escaped)
15725
15726 == text > text ==
15727 section 1
15728
15729 == text < text ==
15730 section 2
15731
15732 == text & text ==
15733 section 3
15734
15735 == text ' text ==
15736 section 4
15737
15738 == text " text ==
15739 section 5
15740 !! html
15741 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15742 </p>
15743 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15744 <ul>
15745 <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>
15746 <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>
15747 <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>
15748 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15749 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15750 </ul>
15751 </div>
15752
15753 <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>
15754 <p>section 1
15755 </p>
15756 <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>
15757 <p>section 2
15758 </p>
15759 <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>
15760 <p>section 3
15761 </p>
15762 <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>
15763 <p>section 4
15764 </p>
15765 <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>
15766 <p>section 5
15767 </p>
15768 !! end
15769
15770 !! test
15771 Header with space, plus and underscore as entity
15772 !! wikitext
15773 Id should not contain + for spaces
15774
15775 == Space between Text ==
15776 section 1
15777
15778 == Space-Entity&#32;between&#32;Text ==
15779 section 2
15780
15781 == Plus+between+Text ==
15782 section 3
15783
15784 == Plus-Entity&#43;between&#43;Text ==
15785 section 4
15786
15787 == Underscore_between_Text ==
15788 section 5
15789
15790 == Underscore-Entity&#95;between&#95;Text ==
15791 section 6
15792
15793 [[#Space between Text]]
15794 [[#Space-Entity&#32;between&#32;Text]]
15795 [[#Plus+between+Text]]
15796 [[#Plus-Entity&#43;between&#43;Text]]
15797 [[#Underscore_between_Text]]
15798 [[#Underscore-Entity&#95;between&#95;Text]]
15799 !! html
15800 <p>Id should not contain + for spaces
15801 </p>
15802 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15803 <ul>
15804 <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>
15805 <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>
15806 <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>
15807 <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>
15808 <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>
15809 <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>
15810 </ul>
15811 </div>
15812
15813 <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>
15814 <p>section 1
15815 </p>
15816 <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>
15817 <p>section 2
15818 </p>
15819 <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>
15820 <p>section 3
15821 </p>
15822 <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>
15823 <p>section 4
15824 </p>
15825 <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>
15826 <p>section 5
15827 </p>
15828 <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>
15829 <p>section 6
15830 </p><p><a href="#Space_between_Text">#Space between Text</a>
15831 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15832 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15833 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15834 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15835 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15836 </p>
15837 !! end
15838
15839 !! test
15840 Headers with excess '=' characters
15841 (Are similar tests necessary beyond the 1st level?)
15842 !! wikitext
15843 =foo==
15844 ==foo=
15845 =''italic'' heading==
15846 ==''italic'' heading=
15847 !! html
15848 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15849 <ul>
15850 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15851 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15852 <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>
15853 <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>
15854 </ul>
15855 </div>
15856
15857 <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>
15858 <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>
15859 <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>
15860 <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>
15861
15862 !! end
15863
15864 !! test
15865 HTML headers vs TOC (bug 23393)
15866 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15867 !! wikitext
15868 <h1>Header 1</h1>
15869 == Header 1.1 ==
15870 == Header 1.2 ==
15871
15872 <h1>Header 2
15873 </h1>
15874 == Header 2.1 ==
15875 == Header 2.2 ==
15876 __NOEDITSECTION__
15877 !! html
15878 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15879 <ul>
15880 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15881 <ul>
15882 <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>
15883 <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>
15884 </ul>
15885 </li>
15886 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15887 <ul>
15888 <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>
15889 <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>
15890 </ul>
15891 </li>
15892 </ul>
15893 </div>
15894
15895 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15896 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15897 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15898 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15899 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15900 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15901
15902 !! end
15903
15904 !! test
15905 Single-line or multiline-comments can follow headings
15906 !! options
15907 parsoid=wt2html,wt2wt
15908 !! wikitext
15909 ==foo==<!---->
15910 ==bar==<!--c1-->
15911 ==baz==<!--
15912 c2
15913 c3-->
15914 !! html
15915 <h2><span class="mw-headline" id="foo">foo</span></h2>
15916 <h2><span class="mw-headline" id="bar">bar</span></h2>
15917 <h2><span class="mw-headline" id="baz">baz</span></h2>
15918
15919 !! end
15920
15921 !! test
15922 BUG 1219 URL next to image (broken)
15923 !! wikitext
15924 http://example.com[[File:Foobar.jpg]]
15925 !! html/php
15926 <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>
15927 </p>
15928 !! html/parsoid
15929 <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>
15930 !!end
15931
15932 !! test
15933 Bug 1186 news: in the middle of text
15934 !! wikitext
15935 http://en.wikinews.org/wiki/Wikinews:Workplace
15936 !! html
15937 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15938 </p>
15939 !!end
15940
15941
15942 !! test
15943 Namespaced link must have a title
15944 !! wikitext
15945 [[Project:]]
15946 !! html
15947 <p>[[Project:]]
15948 </p>
15949 !!end
15950
15951 !! test
15952 Namespaced link must have a title (bad fragment version)
15953 !! wikitext
15954 [[Project:#fragment]]
15955 !! html
15956 <p>[[Project:#fragment]]
15957 </p>
15958 !!end
15959
15960
15961 ###
15962 ### HTML tags and HTML attributes
15963 ###
15964
15965 !! test
15966 div with no attributes
15967 !! wikitext
15968 <div>HTML rocks</div>
15969 !! html
15970 <div>HTML rocks</div>
15971
15972 !! end
15973
15974 !! test
15975 div with double-quoted attribute
15976 !! wikitext
15977 <div id="rock">HTML rocks</div>
15978 !! html
15979 <div id="rock">HTML rocks</div>
15980
15981 !! end
15982
15983 !! test
15984 div with single-quoted attribute
15985 !! wikitext
15986 <div id='rock'>HTML rocks</div>
15987 !! html
15988 <div id="rock">HTML rocks</div>
15989
15990 !! end
15991
15992 !! test
15993 div with unquoted attribute
15994 !! wikitext
15995 <div id=rock>HTML rocks</div>
15996 !! html
15997 <div id="rock">HTML rocks</div>
15998
15999 !! end
16000
16001 !! test
16002 div with illegal double attributes
16003 !! wikitext
16004 <div id="a" id="b">HTML rocks</div>
16005 !! html
16006 <div id="b">HTML rocks</div>
16007
16008 !!end
16009
16010 !! test
16011 div with empty attribute value, space before equals
16012 !! options
16013 parsoid=wt2html,html2html
16014 !! wikitext
16015 <div class =>HTML rocks</div>
16016 !! html/php
16017 <div class="">HTML rocks</div>
16018
16019 !! html/parsoid
16020 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16021 !! end
16022
16023 !! test
16024 div with multiple empty attribute values
16025 !! options
16026 parsoid=wt2html,html2html
16027 !! wikitext
16028 <div id= title=>HTML rocks</div>
16029 !! html/php
16030 <div id="title.3D">HTML rocks</div>
16031
16032 !! html/parsoid
16033 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16034 !! end
16035
16036 !! test
16037 table with multiple empty attribute values
16038 !! options
16039 parsoid=wt2html,html2html
16040 !! wikitext
16041 {| title= id=
16042 | hi
16043 |}
16044 !! html/php
16045 <table title="id=">
16046 <tr>
16047 <td> hi
16048 </td></tr></table>
16049
16050 !! html/parsoid
16051 <table title="id=">
16052 <tbody><tr><td> hi</td></tr>
16053 </tbody></table>
16054 !! end
16055
16056 !! test
16057 div with braces in attribute value
16058 !! wikitext
16059 <div title="{}">Foo</div>
16060 !! html/php
16061 <div title="&#123;}">Foo</div>
16062
16063 !! html/parsoid
16064 <div title="{}">Foo</div>
16065 !! end
16066
16067 !! test
16068 div with empty attribute value, no space before equals
16069 !! options
16070 parsoid=wt2html,html2html
16071 !! wikitext
16072 <div class=>HTML rocks</div>
16073 !! html/php
16074 <div class="">HTML rocks</div>
16075
16076 !! html/parsoid
16077 <div class="">HTML rocks</div>
16078 !! end
16079
16080 !! test
16081 HTML multiple attributes correction
16082 !! wikitext
16083 <p class="error" class="awesome">Awesome!</p>
16084 !! html
16085 <p class="awesome">Awesome!</p>
16086
16087 !!end
16088
16089 !! test
16090 Table multiple attributes correction
16091 !! wikitext
16092 {|
16093 !+ class="error" class="awesome"| status
16094 |}
16095 !! html
16096 <table>
16097 <tr>
16098 <th class="awesome"> status
16099 </th></tr></table>
16100
16101 !!end
16102
16103 !! test
16104 DIV IN UPPERCASE
16105 !! wikitext
16106 <DIV ID="x">HTML ROCKS</DIV>
16107 !! html
16108 <div id="x">HTML ROCKS</div>
16109
16110 !!end
16111
16112 !! test
16113 Non-ASCII pseudo-tags are rendered as text
16114 !! wikitext
16115 <khyô>
16116 !! html
16117 <p>&lt;khyô&gt;
16118 </p>
16119 !! end
16120
16121 !! test
16122 Pseudo-tag with URL 'name' renders as url link
16123 !! wikitext
16124 <http://example.com/>
16125 !! html
16126 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16127 </p>
16128 !! end
16129
16130 !! test
16131 text with amp in the middle of nowhere
16132 !! wikitext
16133 Remember AT&T?
16134 !! html
16135 <p>Remember AT&amp;T?
16136 </p>
16137 !! end
16138
16139 !! test
16140 text with character entity: eacute
16141 !! wikitext
16142 I always thought &eacute; was a cute letter.
16143 !! html
16144 <p>I always thought &#233; was a cute letter.
16145 </p>
16146 !! html+tidy
16147 <p>I always thought é was a cute letter.</p>
16148 !! end
16149
16150 !! test
16151 text with entity-escaped character entity-like string: eacute
16152 !! wikitext
16153 I always thought &amp;eacute; was a cute letter.
16154 !! html
16155 <p>I always thought &amp;eacute; was a cute letter.
16156 </p>
16157 !! end
16158
16159 !! test
16160 text with undefined character entity: xacute
16161 !! wikitext
16162 I always thought &xacute; was a cute letter.
16163 !! html
16164 <p>I always thought &amp;xacute; was a cute letter.
16165 </p>
16166 !! end
16167
16168 !! test
16169 HTML5 tags
16170 !! wikitext
16171 <data value="5">five</data>
16172 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16173 <mark>This highlighted text</mark>
16174 !! html
16175 <p><data value="5">five</data>
16176 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16177 <mark>This highlighted text</mark>
16178 </p>
16179 !! end
16180
16181 !! test
16182 HTML tag with leading space is parsed as text
16183 !! wikitext
16184 < div>foo< /div>
16185 !! html
16186 <p>&lt; div&gt;foo&lt; /div&gt;
16187 </p>
16188 !! end
16189
16190 ###
16191 ### Nesting tests (see bug 41545, 50604, 51081)
16192 ###
16193
16194 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
16195 # Note that html2wt is considerably more difficult if we use <b> in
16196 # the test case, instead of <big>
16197 !! test
16198 Ensure that HTML adoption agency algorithm is properly implemented.
16199 !! wikitext
16200 <big>X<big>Y</big>Z</big>
16201 !! html
16202 <p><big>X<big>Y</big>Z</big>
16203 </p>
16204 !! end
16205
16206 # This was bug 41545 in the PHP parser.
16207 # Note that tidy doesn't handle this correctly.
16208 !! test
16209 Nesting of <kbd>
16210 !! wikitext
16211 <kbd>X<kbd>Y</kbd>Z</kbd>
16212 !! html
16213 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16214 </p>
16215 !! end
16216
16217 # The following cases were bug 51081 in the PHP parser.
16218 # Note that there are some other nestable tags (b, i, etc) which are
16219 # not covered; see bug 51081 for discussion.
16220
16221 # Note that tidy doesn't handle this correctly.
16222 !! test
16223 Nesting of <em>
16224 !! wikitext
16225 <em>X<em>Y</em>Z</em>
16226 !! html
16227 <p><em>X<em>Y</em>Z</em>
16228 </p>
16229 !! end
16230
16231 # Note that tidy doesn't handle this correctly.
16232 !! test
16233 Nesting of <strong>
16234 !! wikitext
16235 <strong>X<strong>Y</strong>Z</strong>
16236 !! html
16237 <p><strong>X<strong>Y</strong>Z</strong>
16238 </p>
16239 !! end
16240
16241 !! test
16242 Nesting of <q>
16243 !! wikitext
16244 <q>X<q>Y</q>Z</q>
16245 !! html+tidy
16246 <p><q>X<q>Y</q>Z</q></p>
16247 !! end
16248
16249 # Note that tidy doesn't handle this correctly.
16250 !! test
16251 Nesting of <ruby>
16252 !! wikitext
16253 <ruby>X<ruby>Y</ruby>Z</ruby>
16254 !! html
16255 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16256 </p>
16257 !! end
16258
16259 # Note that tidy doesn't handle this correctly.
16260 !! test
16261 Nesting of <bdo>
16262 !! wikitext
16263 <bdo>X<bdo>Y</bdo>Z</bdo>
16264 !! html
16265 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16266 </p>
16267 !! end
16268
16269
16270 ###
16271 ### Media links
16272 ###
16273
16274 !! test
16275 Media link
16276 !! wikitext
16277 [[Media:Foobar.jpg]]
16278 !! html
16279 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16280 </p>
16281 !! end
16282
16283 !! test
16284 Media link with text
16285 !! wikitext
16286 [[Media:Foobar.jpg|A neat file to look at]]
16287 !! html
16288 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16289 </p>
16290 !! end
16291
16292 # FIXME: this is still bad HTML tag nesting
16293 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16294 !! test
16295 Media link with nasty text
16296 !! wikitext
16297 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16298 !! html
16299 <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>
16300
16301 !! html+tidy
16302 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16303 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16304 !! end
16305
16306 !! test
16307 Media link to nonexistent file (bug 1702)
16308 !! wikitext
16309 [[Media:No such.jpg]]
16310 !! html
16311 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16312 </p>
16313 !! end
16314
16315 !! test
16316 Image link to nonexistent file (bug 1850 - good)
16317 !! wikitext
16318 [[File:No_such.jpg]]
16319 !! html/php
16320 <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>
16321 </p>
16322 !! html/parsoid
16323 <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>
16324 !! end
16325
16326 !! test
16327 :Image link to nonexistent file (bug 1850 - bad)
16328 !! wikitext
16329 [[:Image:No such.jpg]]
16330 !! html/php
16331 <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>
16332 </p>
16333 !! html/parsoid
16334 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16335 !! end
16336
16337
16338
16339 !! test
16340 Character reference normalization in link text (bug 1938)
16341 !! wikitext
16342 [[Main Page|this&that]]
16343 !! html
16344 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16345 </p>
16346 !!end
16347
16348 !! article
16349 אַ
16350 !! text
16351 Test for unicode normalization
16352
16353 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16354 !! endarticle
16355
16356 !! test
16357 (bug 19451) Links should refer to the normalized form.
16358 !! wikitext
16359 [[&#xFB2E;]]
16360 [[&#x5d0;&#x5b7;]]
16361 [[&#x5d0;ַ]]
16362 [[א&#x5b7;]]
16363 [[אַ]]
16364 !! html
16365 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16366 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16367 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16368 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16369 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16370 </p>
16371 !! end
16372
16373 !! test
16374 Empty attribute crash test (bug 2067)
16375 !! wikitext
16376 <font color="">foo</font>
16377 !! html
16378 <p><font color="">foo</font>
16379 </p>
16380 !! end
16381
16382 !! test
16383 Empty attribute crash test single-quotes (bug 2067)
16384 !! wikitext
16385 <font color=''>foo</font>
16386 !! html
16387 <p><font color="">foo</font>
16388 </p>
16389 !! end
16390
16391 !! test
16392 Attribute test: equals, then nothing
16393 !! options
16394 parsoid=wt2html,html2html
16395 !! wikitext
16396 <font color=>foo</font>
16397 !! html/php
16398 <p><font color="">foo</font>
16399 </p>
16400 !! html/parsoid
16401 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16402 !! end
16403
16404 !! test
16405 Attribute test: unquoted value
16406 !! options
16407 parsoid=wt2html,html2html
16408 !! wikitext
16409 <font color=x>foo</font>
16410 !! html/php
16411 <p><font color="x">foo</font>
16412 </p>
16413 !! html/parsoid
16414 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16415 !! end
16416
16417 !! test
16418 Attribute test: unquoted but illegal value (hash)
16419 !! wikitext
16420 <font color=#x>foo</font>
16421 !! html
16422 <p><font color="#x">foo</font>
16423 </p>
16424 !! end
16425
16426 # Parsoid does not serialize to empty attribute syntax,
16427 # so wt2wt and html2wt cases are skipped
16428 !! test
16429 Attribute test: no value (T54330)
16430 !! options
16431 parsoid=wt2html,html2html
16432 !! wikitext
16433 <font color>foo</font>
16434 !! html/php
16435 <p><font color="">foo</font>
16436 </p>
16437 !! html/parsoid
16438 <p><font color="">foo</font></p>
16439 !! end
16440
16441 !! test
16442 Bug 2095: link with three closing brackets
16443 !! wikitext
16444 [[Main Page]]]
16445 !! html/php
16446 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16447 </p>
16448 !! html/parsoid
16449 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16450 !! end
16451
16452 !! test
16453 Bug 2095: link with pipe and three closing brackets
16454 !! wikitext
16455 [[Main Page|link]]]
16456 !! html/php
16457 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16458 </p>
16459 !! html/parsoid
16460 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16461 !! end
16462
16463 !! test
16464 Bug 2095: link with pipe and three closing brackets, version 2
16465 !! wikitext
16466 [[Main Page|[http://example.com/]]]
16467 !! html/php
16468 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16469 </p>
16470 !! html/parsoid
16471 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16472 !! end
16473
16474
16475 ###
16476 ### Safety
16477 ###
16478
16479 !! article
16480 Template:Dangerous attribute
16481 !! text
16482 " onmouseover="alert(document.cookie)
16483 !! endarticle
16484
16485 !! article
16486 Template:Dangerous style attribute
16487 !! text
16488 border-size: expression(alert(document.cookie))
16489 !! endarticle
16490
16491 !! article
16492 Template:Div style
16493 !! text
16494 <div style="float: right; {{{1}}}">Magic div</div>
16495 !! endarticle
16496
16497 !! test
16498 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16499 !! wikitext
16500 <div title="{{test}}"></div>
16501 !! html
16502 <div title="This is a test template"></div>
16503
16504 !! end
16505
16506 # Parsoid has enough context to handle this case
16507 !! test
16508 Bug 2304: HTML attribute safety (dangerous template; 2309)
16509 !! wikitext
16510 <div title="{{dangerous attribute}}"></div>
16511 !! html/php
16512 <div title=""></div>
16513
16514 !! html/parsoid
16515 <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>
16516 !! end
16517
16518 !! test
16519 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16520 !! wikitext
16521 <div style="{{dangerous style attribute}}"></div>
16522 !! html
16523 <div style="/* insecure input */"></div>
16524
16525 !! end
16526
16527 !! test
16528 Bug 2304: HTML attribute safety (safe parameter; 2309)
16529 !! wikitext
16530 {{div style|width: 200px}}
16531 !! html
16532 <div style="float: right; width: 200px">Magic div</div>
16533
16534 !! end
16535
16536 !! test
16537 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16538 !! wikitext
16539 {{div style|width: expression(alert(document.cookie))}}
16540 !! html
16541 <div style="/* insecure input */">Magic div</div>
16542
16543 !! end
16544
16545 !! test
16546 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16547 !! wikitext
16548 {{div style|"><script>alert(document.cookie)</script>}}
16549 !! html
16550 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16551
16552 !! end
16553
16554 !! test
16555 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16556 !! wikitext
16557 {{div style|" ><script>alert(document.cookie)</script>}}
16558 !! html
16559 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16560
16561 !! end
16562
16563 !! test
16564 Bug 2304: HTML attribute safety (link)
16565 !! wikitext
16566 <div title="[[Main Page]]"></div>
16567 !! html
16568 <div title="&#91;&#91;Main Page]]"></div>
16569
16570 !! end
16571
16572 !! test
16573 Bug 2304: HTML attribute safety (italics)
16574 !! wikitext
16575 <div title="''foobar''"></div>
16576 !! html
16577 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16578
16579 !! end
16580
16581 !! test
16582 Bug 2304: HTML attribute safety (bold)
16583 !! wikitext
16584 <div title="'''foobar'''"></div>
16585 !! html
16586 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16587
16588 !! end
16589
16590
16591 !! test
16592 Bug 2304: HTML attribute safety (ISBN)
16593 !! wikitext
16594 <div title="ISBN 1234567890"></div>
16595 !! html
16596 <div title="&#73;SBN 1234567890"></div>
16597
16598 !! end
16599
16600 !! test
16601 Bug 2304: HTML attribute safety (RFC)
16602 !! wikitext
16603 <div title="RFC 1234"></div>
16604 !! html
16605 <div title="&#82;FC 1234"></div>
16606
16607 !! end
16608
16609 !! test
16610 Bug 2304: HTML attribute safety (PMID)
16611 !! wikitext
16612 <div title="PMID 1234567890"></div>
16613 !! html
16614 <div title="&#80;MID 1234567890"></div>
16615
16616 !! end
16617
16618 !! test
16619 Bug 2304: HTML attribute safety (web link)
16620 !! wikitext
16621 <div title="http://example.com/"></div>
16622 !! html
16623 <div title="http&#58;//example.com/"></div>
16624
16625 !! end
16626
16627 !! test
16628 Bug 2304: HTML attribute safety (named web link)
16629 !! wikitext
16630 <div title="[http://example.com/ link]"></div>
16631 !! html
16632 <div title="&#91;http&#58;//example.com/ link]"></div>
16633
16634 !! end
16635
16636 !! test
16637 Bug 3244: HTML attribute safety (extension; safe)
16638 !! wikitext
16639 <div style="<nowiki>background:blue</nowiki>"></div>
16640 !! html
16641 <div style="background:blue"></div>
16642
16643 !! end
16644
16645 !! test
16646 Bug 3244: HTML attribute safety (extension; unsafe)
16647 !! wikitext
16648 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16649 !! html
16650 <div style="/* insecure input */"></div>
16651
16652 !! end
16653
16654 # More MSIE fun discovered by Tom Gilder
16655
16656 !! test
16657 MSIE CSS safety test: spurious slash
16658 !! wikitext
16659 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16660 !! html
16661 <div style="/* insecure input */">evil</div>
16662
16663 !! end
16664
16665 !! test
16666 MSIE CSS safety test: hex code
16667 !! wikitext
16668 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16669 !! html
16670 <div style="/* insecure input */">evil</div>
16671
16672 !! end
16673
16674 !! test
16675 MSIE CSS safety test: comment in url
16676 !! wikitext
16677 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16678 !! html
16679 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16680
16681 !! end
16682
16683 !! test
16684 MSIE CSS safety test: comment in expression
16685 !! wikitext
16686 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16687 !! html
16688 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16689
16690 !! end
16691
16692 !! test
16693 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16694 !! wikitext
16695 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16696 !! html
16697 <p style="/* invalid control char */">A</p>
16698
16699 !! end
16700
16701 !! test
16702 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16703 !! wikitext
16704 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16705 <div style="top:EXPRESSION(alert())">B</div>
16706 !! html
16707 <p style="/* insecure input */">A</p>
16708 <div style="/* insecure input */">B</div>
16709
16710 !! end
16711
16712 !! test
16713 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16714 !! wikitext
16715 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16716 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16717 !! html
16718 <div style="/* insecure input */">A</div>
16719 <p style="/* insecure input */">B</p>
16720
16721 !! end
16722
16723 !! test
16724 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16725 !! wikitext
16726 <div style="background-image:url⁽javascript:alert())">A</div>
16727 <div style="background-image:url₍javascript:alert())">B</div>
16728 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16729 !! html
16730 <div style="/* insecure input */">A</div>
16731 <div style="/* insecure input */">B</div>
16732 <p style="/* insecure input */">C</p>
16733
16734 !! end
16735
16736 # FIXME: Parsoid fails to sanitize this! See T58846.
16737 !! test
16738 Opera -o-link CSS
16739 !! wikitext
16740 <div
16741 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;"
16742 style="-o-link:attr(title);-o-link-source:current">X</div>
16743 !! html
16744 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16745
16746 !! end
16747
16748 !! test
16749 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16750 !! wikitext
16751 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16752 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16753 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16754 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16755 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16756 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16757 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16758 !! html
16759 <p style="/* insecure input */">A</p>
16760 <p style="/* insecure input */">B</p>
16761 <p style="/* insecure input */">C</p>
16762 <p style="/* insecure input */">D</p>
16763 <p style="/* insecure input */">E</p>
16764 <p style="/* insecure input */">F</p>
16765 <p style="/* insecure input */">G</p>
16766
16767 !! end
16768
16769 !! test
16770 Table attribute legitimate extension
16771 !! wikitext
16772 {|
16773 !+ style="<nowiki>color:blue</nowiki>"| status
16774 |}
16775 !! html
16776 <table>
16777 <tr>
16778 <th style="color:blue"> status
16779 </th></tr></table>
16780
16781 !!end
16782
16783 !! test
16784 Table attribute safety
16785 !! wikitext
16786 {|
16787 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16788 |}
16789 !! html
16790 <table>
16791 <tr>
16792 <th style="/* insecure input */"> status
16793 </th></tr></table>
16794
16795 !! end
16796
16797 !! test
16798 CSS line continuation 1
16799 !! wikitext
16800 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16801 !! html
16802 <div style="/* insecure input */"></div>
16803
16804 !! end
16805
16806 !! test
16807 CSS line continuation 2
16808 !! wikitext
16809 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16810 !! html
16811 <div style="/* invalid control char */"></div>
16812
16813 !! end
16814
16815 !! article
16816 Template:Identity
16817 !! text
16818 {{{1}}}
16819 !! endarticle
16820
16821 !! test
16822 Expansion of multi-line templates in attribute values (bug 6255)
16823 !! wikitext
16824 <div style="background: {{identity|#00FF00}}">-</div>
16825 !! html
16826 <div style="background: #00FF00">-</div>
16827
16828 !! end
16829
16830
16831 !! test
16832 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16833 !! wikitext
16834 <div style="background:
16835 #00FF00">-</div>
16836 !! html/php
16837 <div style="background: #00FF00">-</div>
16838
16839 !! html/parsoid
16840 <div style="background:
16841 #00FF00">-</div>
16842 !! end
16843
16844 !! test
16845 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16846 !! wikitext
16847 <div style="background: &#10;#00FF00">-</div>
16848 !! html
16849 <div style="background: &#10;#00FF00">-</div>
16850
16851 !! end
16852
16853 !! test
16854 Tags which are hidden from Tidy cannot pass through the Sanitizer
16855 !! wikitext
16856 <mw:toc><script>alert();</script></mw:toc>
16857 !! html+tidy
16858 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
16859 !! end
16860
16861 ###
16862 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16863 ###
16864 !! test
16865 Parser hook: empty input
16866 !! wikitext
16867 <tag></tag>
16868 !! html/php
16869 <pre>
16870 ''
16871 array (
16872 )
16873 </pre>
16874
16875 !! html/parsoid
16876 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16877 !! end
16878
16879 ## Don't expect parsoid to rt this form.
16880 !! test
16881 Parser hook: empty input using terminated empty elements
16882 !! options
16883 parsoid=wt2html,html2html
16884 !! wikitext
16885 <tag/>
16886 !! html/php
16887 <pre>
16888 NULL
16889 array (
16890 )
16891 </pre>
16892
16893 !! html/parsoid
16894 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16895 !! end
16896
16897 !! test
16898 Parser hook: empty input using terminated empty elements (space before)
16899 !! wikitext
16900 <tag />
16901 !! html/php
16902 <pre>
16903 NULL
16904 array (
16905 )
16906 </pre>
16907
16908 !! html/parsoid
16909 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16910 !! end
16911
16912 !! test
16913 Parser hook: basic input
16914 !! wikitext
16915 <tag>input</tag>
16916 !! html/php
16917 <pre>
16918 'input'
16919 array (
16920 )
16921 </pre>
16922
16923 !! html/parsoid
16924 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16925 !! end
16926
16927 ## Don't expect parsoid to rt this form.
16928 !! test
16929 Parser hook: case insensitive
16930 !! options
16931 parsoid=wt2html,html2html
16932 !! wikitext
16933 <TAG>input</TAG>
16934 !! html/php
16935 <pre>
16936 'input'
16937 array (
16938 )
16939 </pre>
16940
16941 !! html/parsoid
16942 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16943 !! end
16944
16945 ## Don't expect parsoid to rt this form.
16946 !! test
16947 Parser hook: case insensitive, redux
16948 !! options
16949 parsoid=wt2html,html2html
16950 !! wikitext
16951 <TaG>input</TAg>
16952 !! html/php
16953 <pre>
16954 'input'
16955 array (
16956 )
16957 </pre>
16958
16959 !! html/parsoid
16960 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16961 !! end
16962
16963 !! test
16964 Parser hook: nested tags
16965 !! wikitext
16966 <tag><tag></tag></tag>
16967 !! html/php
16968 <pre>
16969 '<tag>'
16970 array (
16971 )
16972 </pre>&lt;/tag&gt;
16973
16974 !! html/parsoid
16975 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16976 !! end
16977
16978 !! test
16979 Parser hook: basic arguments
16980 !! wikitext
16981 <tag width="200" height="100" depth="50" square=""></tag>
16982 !! html/php
16983 <pre>
16984 ''
16985 array (
16986 'width' => '200',
16987 'height' => '100',
16988 'depth' => '50',
16989 'square' => '',
16990 )
16991 </pre>
16992
16993 !! html/parsoid
16994 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16995 !! end
16996
16997 ## Don't expect parsoid to rt this form.
16998 !! test
16999 Parser hook: basic arguments, variations
17000 !! options
17001 parsoid=wt2html,html2html
17002 !! wikitext
17003 <tag width=200 height = "100" depth = '50' square></tag>
17004 !! html/php
17005 <pre>
17006 ''
17007 array (
17008 'width' => '200',
17009 'height' => '100',
17010 'depth' => '50',
17011 'square' => '',
17012 )
17013 </pre>
17014
17015 !! html/parsoid
17016 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17017 !! end
17018
17019 !! test
17020 Parser hook: argument containing a forward slash (bug 5344)
17021 !! wikitext
17022 <tag filename="/tmp/bla"></tag>
17023 !! html/php
17024 <pre>
17025 ''
17026 array (
17027 'filename' => '/tmp/bla',
17028 )
17029 </pre>
17030
17031 !! html/parsoid
17032 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17033 !! end
17034
17035 ## Don't expect parsoid to rt this form.
17036 !! test
17037 Parser hook: empty input using terminated empty elements (bug 2374)
17038 !! options
17039 parsoid=wt2html,html2html
17040 !! wikitext
17041 <tag foo=bar/>text
17042 !! html/php
17043 <pre>
17044 NULL
17045 array (
17046 'foo' => 'bar',
17047 )
17048 </pre>text
17049
17050 !! html/parsoid
17051 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
17052 !! end
17053
17054 ## </tag> should be output literally since there is no matching tag that begins it
17055 ## Don't expect parsoid to rt this form.
17056 !! test
17057 Parser hook: basic arguments using terminated empty elements (bug 2374)
17058 !! options
17059 parsoid=wt2html
17060 !! wikitext
17061 <tag width=200 height = "100" depth = '50' square/>
17062 other stuff
17063 </tag>
17064 !! html/php
17065 <pre>
17066 NULL
17067 array (
17068 'width' => '200',
17069 'height' => '100',
17070 'depth' => '50',
17071 'square' => '',
17072 )
17073 </pre>
17074 <p>other stuff
17075 &lt;/tag&gt;
17076 </p>
17077 !! html/parsoid
17078 <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
17079 &lt;/tag></p>
17080 !! end
17081
17082 ## Don't expect parsoid to rt this form.
17083 !! test
17084 Parser hook: Don't allow unclosed extension tags
17085 !! options
17086 parsoid=wt2html
17087 !! wikitext
17088 test <tag>123
17089
17090 this is a '''test'''
17091 !! html/php
17092 <p>test &lt;tag&gt;123
17093 </p><p>this is a <b>test</b>
17094 </p>
17095 !! html/parsoid
17096 <p>test &lt;tag>123</p>
17097
17098 <p>this is a <b>test</b></p>
17099 !! end
17100
17101 ###
17102 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17103 ###
17104
17105 !! test
17106 Parser hook: static parser hook not inside a comment
17107 !! wikitext
17108 <statictag>hello, world</statictag>
17109
17110 <statictag action="flush" />
17111 !! html/php
17112 <p><br />
17113 hello, world
17114 </p>
17115 !! html/parsoid
17116 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17117 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17118 !! end
17119
17120 !! test
17121 Parser hook: static parser hook inside a comment
17122 !! wikitext
17123 <!-- <statictag>hello, world</statictag> -->
17124 <statictag action="flush" />
17125 !! html/php
17126 <p><br />
17127 </p>
17128 !! html/parsoid
17129 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17130 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17131 !! end
17132
17133 # Nested template calls; this case was broken by Parser.php rev 1.506,
17134 # since reverted.
17135
17136 !! article
17137 Template:One-parameter
17138 !! text
17139 (My parameter is: {{{1}}})
17140 !! endarticle
17141
17142 !! article
17143 Template:Map-one-parameter
17144 !! text
17145 {{{{{1}}}|{{{2}}}}}
17146 !! endarticle
17147
17148 !! test
17149 Nested template calls
17150 !! wikitext
17151 {{Map-one-parameter|One-parameter|param}}
17152 !! html
17153 <p>(My parameter is: param)
17154 </p>
17155 !! end
17156
17157
17158 ###
17159 ### Sanitizer
17160 ###
17161
17162 # HTML+Tidy effectively strips out the empty tags completely
17163 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17164 # which Tidy would have done for the PHP parser had there been content inside it.
17165 !! test
17166 Sanitizer: Closing of open tags
17167 !! wikitext
17168 <s></s><table></table>
17169 !! html
17170 <s></s><table></table>
17171
17172 !! html/parsoid
17173 <p><s></s></p><table></table>
17174 !! end
17175
17176 !! test
17177 Sanitizer: Closing of open but not closed tags
17178 !! wikitext
17179 <s>foo
17180 !! html
17181 <p><s>foo</s>
17182 </p>
17183 !! end
17184
17185 !! test
17186 Sanitizer: Closing of closed but not open tags
17187 !! options
17188 parsoid=wt2html
17189 !! wikitext
17190 </s>
17191 !! html/php+tidy
17192 !! html/parsoid
17193 !! end
17194
17195 !! test
17196 Sanitizer: Closing of closed but not open table tags
17197 !! options
17198 parsoid=wt2html
17199 !! wikitext
17200 Table not started</td></tr></table>
17201 !! html/php+tidy
17202 <p>Table not started</p>
17203 !! html/parsoid
17204 <p>Table not started</p>
17205 !! end
17206
17207 !! test
17208 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17209 !! wikitext
17210 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17211 !! html/php
17212 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17213 </p>
17214 !! html/parsoid
17215 <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>
17216 !! end
17217
17218 # In HTML5, the restrictions are that id must contain at least one character,
17219 # and must not contain any space characters.
17220 !! test
17221 Sanitizer: Validating the contents of the id attribute (bug 4515)
17222 !! options
17223 disabled
17224 !! wikitext
17225 <br id="" /><br id="a space" />
17226 !! html
17227 Something ...
17228 !! end
17229
17230 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17231 !! test
17232 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
17233 !! options
17234 disabled
17235 !! wikitext
17236 <br id="foo" /><br id="foo" />
17237 !! html
17238 Something need to be done. foo-2 ?
17239 !! end
17240
17241 !! test
17242 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17243 !! wikitext
17244 <div itemscope>
17245 <meta itemprop="hello" content="world">
17246 <meta http-equiv="refresh" content="5">
17247 <meta itemprop="hello" http-equiv="refresh" content="5">
17248 <link itemprop="hello" href="{{SERVER}}">
17249 <link rel="stylesheet" href="{{SERVER}}">
17250 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17251 </div>
17252 !! html
17253 <div itemscope="">
17254 <p> <meta itemprop="hello" content="world" />
17255 &lt;meta http-equiv="refresh" content="5"&gt;
17256 <meta itemprop="hello" content="5" />
17257 </p>
17258 <link itemprop="hello" href="http&#58;//example.org" />
17259 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17260 <link itemprop="hello" href="http&#58;//example.org" />
17261 </div>
17262
17263 !! end
17264
17265 !! test
17266 Language converter: output gets cut off unexpectedly (bug 5757)
17267 !! options
17268 language=zh
17269 !! wikitext
17270 this bit is safe: }-
17271
17272 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17273
17274 then we get cut off here: }-
17275
17276 all additional text is vanished
17277 !! html
17278 <p>this bit is safe: }-
17279 </p><p>but if we add a conversion instance: xxx
17280 </p><p>then we get cut off here: }-
17281 </p><p>all additional text is vanished
17282 </p>
17283 !! end
17284
17285 !! test
17286 Self closed html pairs (bug 5487)
17287 !! options
17288 !! wikitext
17289 <center><font id="bug" />Centered text</center>
17290 <div><font id="bug2" />In div text</div>
17291 !! html
17292 <center>&lt;font id="bug" /&gt;Centered text</center>
17293 <div>&lt;font id="bug2" /&gt;In div text</div>
17294
17295 !! end
17296
17297 #
17298 #
17299 #
17300
17301 !! test
17302 Punctuation: nbsp before exclamation
17303 !! wikitext
17304 C'est grave !
17305 !! html
17306 <p>C'est grave&#160;!
17307 </p>
17308 !! end
17309
17310 !! test
17311 Punctuation: CSS !important (bug 11874)
17312 !! wikitext
17313 <div style="width:50% !important">important</div>
17314 !! html
17315 <div style="width:50% !important">important</div>
17316
17317 !!end
17318
17319 !! test
17320 Punctuation: CSS ! important (bug 11874; with space after)
17321 !! wikitext
17322 <div style="width:50% ! important">important</div>
17323 !! html
17324 <div style="width:50% ! important">important</div>
17325
17326 !!end
17327
17328 !! test
17329 HTML bullet list, closed tags (bug 5497)
17330 !! wikitext
17331 <ul>
17332 <li>One</li>
17333 <li>Two</li>
17334 </ul>
17335 !! html/php
17336 <ul>
17337 <li>One</li>
17338 <li>Two</li>
17339 </ul>
17340
17341 !! html/parsoid
17342 <ul data-parsoid='{"stx":"html"}'>
17343 <li data-parsoid='{"stx":"html"}'>One</li>
17344 <li data-parsoid='{"stx":"html"}'>Two</li>
17345 </ul>
17346
17347 !! end
17348
17349 !! test
17350 HTML bullet list, unclosed tags (bug 5497)
17351 !! wikitext
17352 <ul>
17353 <li>One
17354 <li>Two
17355 </ul>
17356 !! html/php+tidy
17357 <ul>
17358 <li>One</li>
17359 <li>Two</li>
17360 </ul>
17361 !! html/parsoid
17362 <ul data-parsoid='{"stx":"html"}'>
17363 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17364 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17365 </ul>
17366
17367 !! end
17368
17369 !! test
17370 HTML ordered list, closed tags (bug 5497)
17371 !! wikitext
17372 <ol>
17373 <li>One</li>
17374 <li>Two</li>
17375 </ol>
17376 !! html/php
17377 <ol>
17378 <li>One</li>
17379 <li>Two</li>
17380 </ol>
17381
17382 !! html/parsoid
17383 <ol data-parsoid='{"stx":"html"}'>
17384 <li data-parsoid='{"stx":"html"}'>One</li>
17385 <li data-parsoid='{"stx":"html"}'>Two</li>
17386 </ol>
17387
17388 !! end
17389
17390 !! test
17391 HTML ordered list, unclosed tags (bug 5497)
17392 !! options
17393 !! wikitext
17394 <ol>
17395 <li>One
17396 <li>Two
17397 </ol>
17398 !! html/php+tidy
17399 <ol>
17400 <li>One</li>
17401 <li>Two</li>
17402 </ol>
17403 !! html/parsoid
17404 <ol data-parsoid='{"stx":"html"}'>
17405 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17406 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17407 </ol>
17408
17409 !! end
17410
17411 !! test
17412 HTML nested bullet list, closed tags (bug 5497)
17413 !! wikitext
17414 <ul>
17415 <li>One</li>
17416 <li>Two:
17417 <ul>
17418 <li>Sub-one</li>
17419 <li>Sub-two</li>
17420 </ul>
17421 </li>
17422 </ul>
17423 !! html/php
17424 <ul>
17425 <li>One</li>
17426 <li>Two:
17427 <ul>
17428 <li>Sub-one</li>
17429 <li>Sub-two</li>
17430 </ul>
17431 </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:
17438 <ul data-parsoid='{"stx":"html"}'>
17439 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17440 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17441 </ul>
17442 </li>
17443 </ul>
17444 !! end
17445
17446 !! test
17447 HTML nested bullet list, open tags (bug 5497)
17448 !! wikitext
17449 <ul>
17450 <li>One
17451 <li>Two:
17452 <ul>
17453 <li>Sub-one
17454 <li>Sub-two
17455 </ul>
17456 </ul>
17457 !! html/php+tidy
17458 <ul>
17459 <li>One</li>
17460 <li>Two:
17461 <ul>
17462 <li>Sub-one</li>
17463 <li>Sub-two</li>
17464 </ul>
17465 </li>
17466 </ul>
17467 !! html/parsoid
17468 <ul>
17469 <li>One
17470 </li>
17471 <li>Two:
17472 <ul>
17473 <li>Sub-one
17474 </li>
17475 <li>Sub-two
17476 </li>
17477 </ul>
17478 </li>
17479 </ul>
17480
17481 !! end
17482
17483 !! test
17484 HTML nested ordered list, closed tags (bug 5497)
17485 !! wikitext
17486 <ol>
17487 <li>One</li>
17488 <li>Two:
17489 <ol>
17490 <li>Sub-one</li>
17491 <li>Sub-two</li>
17492 </ol>
17493 </li>
17494 </ol>
17495 !! html
17496 <ol>
17497 <li>One</li>
17498 <li>Two:
17499 <ol>
17500 <li>Sub-one</li>
17501 <li>Sub-two</li>
17502 </ol>
17503 </li>
17504 </ol>
17505
17506 !! end
17507
17508 !! test
17509 HTML nested ordered list, open tags (bug 5497)
17510 !! wikitext
17511 <ol>
17512 <li>One
17513 <li>Two:
17514 <ol>
17515 <li>Sub-one
17516 <li>Sub-two
17517 </ol>
17518 </ol>
17519 !! html/php
17520 <ol>
17521 <li>One
17522 <li>Two:
17523 <ol>
17524 <li>Sub-one
17525 <li>Sub-two
17526 </ol>
17527 </ol>
17528
17529 !! html/parsoid
17530 <ol>
17531 <li>One
17532 </li>
17533 <li>Two:
17534 <ol>
17535 <li>Sub-one
17536 </li>
17537 <li>Sub-two
17538 </li>
17539 </ol>
17540 </li>
17541 </ol>
17542
17543 !! end
17544
17545 !! test
17546 HTML ordered list item with parameters oddity
17547 !! wikitext
17548 <ol><li id="fragment">One</li>
17549 </ol>
17550 !! html
17551 <ol><li id="fragment">One</li>
17552 </ol>
17553
17554 !! end
17555
17556 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17557 !!test
17558 bug 5918: autonumbering
17559 !! wikitext
17560 [http://first/] [http://second] [ftp://ftp]
17561
17562 ftp://inlineftp
17563
17564 [mailto:enclosed@mail.tld With target]
17565
17566 [mailto:enclosed@mail.tld]
17567
17568 mailto:inline@mail.tld
17569 !! html/php
17570 <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>
17571 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17572 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17573 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17574 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17575 </p>
17576 !! html/parsoid
17577 <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>
17578 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17579 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17580 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17581 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17582 !! end
17583
17584
17585 #
17586 # Security and HTML correctness
17587 # From Nick Jenkins' fuzz testing
17588 #
17589
17590 !! test
17591 Fuzz testing: Parser13
17592 !! wikitext
17593 {|
17594 | http://a|
17595 !! html
17596 <table>
17597 <tr>
17598 <td>
17599 </td>
17600 </tr>
17601 </table>
17602
17603 !! end
17604
17605 !! test
17606 Fuzz testing: Parser14
17607 !! wikitext
17608 == onmouseover= ==
17609 http://__TOC__
17610 !! html
17611 <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>
17612 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17613 <ul>
17614 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17615 </ul>
17616 </div>
17617
17618
17619 !! html+tidy
17620 <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>
17621 <p>http://</p>
17622 <div id="toc" class="toc">
17623 <div id="toctitle">
17624 <h2>Contents</h2>
17625 </div>
17626 <ul>
17627 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17628 </ul>
17629 </div>
17630 <p></p>
17631 !! end
17632
17633 !! test
17634 Fuzz testing: Parser14-table
17635 !! options
17636 parsoid=wt2html,html2html
17637 !! wikitext
17638 ==a==
17639 {| STYLE=__TOC__
17640 !! html
17641 <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>
17642 <table style="&#95;_TOC&#95;_">
17643 <tr><td></td></tr>
17644 </table>
17645
17646 !! html+tidy
17647 <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>
17648 <table style="__TOC__">
17649 <tr>
17650 <td></td>
17651 </tr>
17652 </table>
17653 !! html/parsoid
17654 <h2>a</h2>
17655 <table style="__TOC__"></table>
17656 !! end
17657
17658 # Known to produce bogus xml (extra </td>)
17659 !! test
17660 Fuzz testing: Parser16
17661 !! wikitext
17662 {|
17663 !https://||||||
17664 !! html
17665 <table>
17666 <tr>
17667 <th>https://</th>
17668 <th></th>
17669 <th></th>
17670 <th>
17671 </td>
17672 </tr>
17673 </table>
17674
17675 !! html+tidy
17676 <table>
17677 <tr>
17678 <th>https://</th>
17679 <th></th>
17680 <th></th>
17681 <th></th>
17682 </tr>
17683 </table>
17684 !! end
17685
17686 !! test
17687 Fuzz testing: Parser21
17688 !! wikitext
17689 {|
17690 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17691 |
17692 !! html
17693 <table>
17694 <tr>
17695 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17696 </th>
17697 <td>
17698 </td>
17699 </tr>
17700 </table>
17701
17702 !! end
17703
17704 !! test
17705 Fuzz testing: Parser22
17706 !! wikitext
17707 http://===r:::https://b
17708
17709 {|
17710 !! html
17711 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17712 </p>
17713 <table>
17714 <tr><td></td></tr>
17715 </table>
17716
17717 !! end
17718
17719 # Known to produce bad XML for now
17720 !! test
17721 Fuzz testing: Parser24
17722 !! options
17723 parsoid=wt2html
17724 !! wikitext
17725 {|
17726 {{{|
17727 <u CLASS=
17728 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17729 <br style="onmouseover='alert(document.cookie);' " />
17730
17731 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17732 |
17733 !! html/php
17734 <table>
17735 {{{|
17736 <u class="&#124;">}}}} &gt;
17737 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17738
17739 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17740 <tr>
17741 <td></u>
17742 </td>
17743 </tr>
17744 </table>
17745
17746 !! html/parsoid
17747 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
17748 <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":""}]]}'>
17749 <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}'>
17750
17751
17752
17753 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
17754 !! end
17755
17756 # Note: the current result listed for this is not what the original one was,
17757 # but the original bug was JavaScript injection, which is fixed in any case.
17758 # It's not clear that the original result listed was any more correct than the
17759 # current one. Original result:
17760 # <p>{{{|
17761 # </p>
17762 # <li class="&#124;&#124;">
17763 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17764 !!test
17765 Fuzz testing: Parser25 (bug 6055)
17766 !! wikitext
17767 {{{
17768 |
17769 <LI CLASS=||
17770 >
17771 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17772 !! html/php
17773 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17774 </p>
17775 !! html/parsoid
17776 <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"]}'>
17777 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
17778 !! end
17779
17780 !!test
17781 Fuzz testing: URL adjacent extension (with space, clean)
17782 !! wikitext
17783 http://example.com <nowiki>junk</nowiki>
17784 !! html/php
17785 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17786 </p>
17787 !! html/parsoid
17788 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17789 !! end
17790
17791 !!test
17792 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17793 !! wikitext
17794 http://example.com<nowiki>junk</nowiki>
17795 !! html/php
17796 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17797 </p>
17798 !! html/parsoid
17799 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17800 !! end
17801
17802 !!test
17803 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17804 !! wikitext
17805 http://example.com<pre>junk</pre>
17806 !! html/php
17807 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17808
17809 !! html/php+tidy
17810 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17811 <pre>
17812 junk
17813 </pre>
17814 !! html/parsoid
17815 <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>
17816 !!end
17817
17818 !!test
17819 Fuzz testing: image with bogus manual thumbnail
17820 !! wikitext
17821 [[Image:foobar.jpg|thumbnail= ]]
17822 !! html/php
17823 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17824
17825 !! html/parsoid
17826 <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>
17827 !!end
17828
17829 !! test
17830 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17831 !! wikitext
17832 <pre dir="&#10;"></pre>
17833 !! html
17834 <pre dir="&#10;"></pre>
17835
17836 !! end
17837
17838 !! test
17839 Parsing optional HTML elements (Bug 6171)
17840 !! options
17841 !! wikitext
17842 <table>
17843 <tr>
17844 <td> Some tabular data</td>
17845 <td> More tabular data ...
17846 <td> And yet som tabular data</td>
17847 </tr>
17848 </table>
17849 !! html
17850 <table>
17851 <tr>
17852 <td> Some tabular data</td>
17853 <td> More tabular data ...
17854 </td><td> And yet som tabular data</td>
17855 </tr>
17856 </table>
17857
17858 !! end
17859
17860 !! test
17861 Correct handling of <td>, <tr> (Bug 6171)
17862 !! options
17863 !! wikitext
17864 <table>
17865 <tr>
17866 <td> Some tabular data</td>
17867 <td> More tabular data ...</td>
17868 <td> And yet som tabular data</td>
17869 </tr>
17870 </table>
17871 !! html
17872 <table>
17873 <tr>
17874 <td> Some tabular data</td>
17875 <td> More tabular data ...</td>
17876 <td> And yet som tabular data</td>
17877 </tr>
17878 </table>
17879
17880 !! end
17881
17882
17883 !! test
17884 Parsing crashing regression (fr:JavaScript)
17885 !! wikitext
17886 </body></x>
17887 !! html
17888 <p>&lt;/body&gt;&lt;/x&gt;
17889 </p>
17890 !! end
17891
17892 !! test
17893 Inline wiki vs wiki block nesting
17894 !! wikitext
17895 '''Bold paragraph
17896
17897 New wiki paragraph
17898 !! html
17899 <p><b>Bold paragraph</b>
17900 </p><p>New wiki paragraph
17901 </p>
17902 !! end
17903
17904 # FIXME: The current php output is documented
17905 # and desired output is the parsoid target.
17906 !! test
17907 Inline HTML vs wiki block nesting
17908 !! wikitext
17909 <b>Bold paragraph
17910
17911 New wiki paragraph
17912 !! html/php
17913 <p><b>Bold paragraph
17914 </p><p>New wiki paragraph</b>
17915 </p>
17916 !! html/parsoid
17917 <p><b>Bold paragraph</b>
17918 </p><p>New wiki paragraph
17919 </p>
17920 !! end
17921
17922 # Original result was this:
17923 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17924 # </p>
17925 # While that might be marginally more intuitive, maybe, the six-apostrophe
17926 # construct is clearly pathological and the result stated here (which is what
17927 # the parser actually does) is about as reasonable as anything.
17928 !!test
17929 Mixing markup for italics and bold
17930 !! options
17931 !! wikitext
17932 '''bold''''''bold''bolditalics'''''
17933 !! html
17934 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17935 </p>
17936 !! end
17937
17938
17939 !! article
17940 Xyzzyx
17941 !! text
17942 Article for special page transclusion test
17943 !! endarticle
17944
17945 !! test
17946 Special page transclusion
17947 !! options
17948 !! wikitext
17949 {{Special:Prefixindex/Xyzzyx}}
17950 !! html
17951 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17952 </ul>
17953
17954 !! end
17955
17956 !! test
17957 Special page transclusion twice (bug 5021)
17958 !! options
17959 !! wikitext
17960 {{Special:Prefixindex/Xyzzyx}}
17961 {{Special:Prefixindex/Xyzzyx}}
17962 !! html
17963 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17964 </ul>
17965 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17966 </ul>
17967
17968 !! end
17969
17970 !! test
17971 Transclusion of default MediaWiki message
17972 !! wikitext
17973 {{MediaWiki:Mainpage}}
17974 !! html
17975 <p>Main Page
17976 </p>
17977 !! end
17978
17979 !! test
17980 Transclusion of nonexistent MediaWiki message
17981 !! wikitext
17982 {{MediaWiki:Mainpagexxx}}
17983 !! html
17984 <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>
17985 </p>
17986 !! end
17987
17988 !! test
17989 Transclusion of MediaWiki message with underscore
17990 !! wikitext
17991 {{MediaWiki:history_short}}
17992 !! html
17993 <p>History
17994 </p>
17995 !! end
17996
17997 !! test
17998 Transclusion of MediaWiki message with space
17999 !! wikitext
18000 {{MediaWiki:history short}}
18001 !! html
18002 <p>History
18003 </p>
18004 !! end
18005
18006 !! test
18007 Invalid header with following text
18008 !! wikitext
18009 = x = y
18010 !! html
18011 <p>= x = y
18012 </p>
18013 !! end
18014
18015
18016 !! test
18017 Section extraction test (section 0)
18018 !! options
18019 section=0
18020 !! wikitext
18021 start
18022 ==a==
18023 ===aa===
18024 ====aaa====
18025 ==b==
18026 ===ba===
18027 ===bb===
18028 ====bba====
18029 ===bc===
18030 ==c==
18031 ===ca===
18032 !! html/php
18033 start
18034 !! end
18035
18036 !! test
18037 Section extraction test (section 1)
18038 !! options
18039 section=1
18040 !! wikitext
18041 start
18042 ==a==
18043 ===aa===
18044 ====aaa====
18045 ==b==
18046 ===ba===
18047 ===bb===
18048 ====bba====
18049 ===bc===
18050 ==c==
18051 ===ca===
18052 !! html/php
18053 ==a==
18054 ===aa===
18055 ====aaa====
18056 !! end
18057
18058 !! test
18059 Section extraction test (section 2)
18060 !! options
18061 section=2
18062 !! wikitext
18063 start
18064 ==a==
18065 ===aa===
18066 ====aaa====
18067 ==b==
18068 ===ba===
18069 ===bb===
18070 ====bba====
18071 ===bc===
18072 ==c==
18073 ===ca===
18074 !! html/php
18075 ===aa===
18076 ====aaa====
18077 !! end
18078
18079 !! test
18080 Section extraction test (section 3)
18081 !! options
18082 section=3
18083 !! wikitext
18084 start
18085 ==a==
18086 ===aa===
18087 ====aaa====
18088 ==b==
18089 ===ba===
18090 ===bb===
18091 ====bba====
18092 ===bc===
18093 ==c==
18094 ===ca===
18095 !! html/php
18096 ====aaa====
18097 !! end
18098
18099 !! test
18100 Section extraction test (section 4)
18101 !! options
18102 section=4
18103 !! wikitext
18104 start
18105 ==a==
18106 ===aa===
18107 ====aaa====
18108 ==b==
18109 ===ba===
18110 ===bb===
18111 ====bba====
18112 ===bc===
18113 ==c==
18114 ===ca===
18115 !! html/php
18116 ==b==
18117 ===ba===
18118 ===bb===
18119 ====bba====
18120 ===bc===
18121 !! end
18122
18123 !! test
18124 Section extraction test (section 5)
18125 !! options
18126 section=5
18127 !! wikitext
18128 start
18129 ==a==
18130 ===aa===
18131 ====aaa====
18132 ==b==
18133 ===ba===
18134 ===bb===
18135 ====bba====
18136 ===bc===
18137 ==c==
18138 ===ca===
18139 !! html/php
18140 ===ba===
18141 !! end
18142
18143 !! test
18144 Section extraction test (section 6)
18145 !! options
18146 section=6
18147 !! wikitext
18148 start
18149 ==a==
18150 ===aa===
18151 ====aaa====
18152 ==b==
18153 ===ba===
18154 ===bb===
18155 ====bba====
18156 ===bc===
18157 ==c==
18158 ===ca===
18159 !! html/php
18160 ===bb===
18161 ====bba====
18162 !! end
18163
18164 !! test
18165 Section extraction test (section 7)
18166 !! options
18167 section=7
18168 !! wikitext
18169 start
18170 ==a==
18171 ===aa===
18172 ====aaa====
18173 ==b==
18174 ===ba===
18175 ===bb===
18176 ====bba====
18177 ===bc===
18178 ==c==
18179 ===ca===
18180 !! html/php
18181 ====bba====
18182 !! end
18183
18184 !! test
18185 Section extraction test (section 8)
18186 !! options
18187 section=8
18188 !! wikitext
18189 start
18190 ==a==
18191 ===aa===
18192 ====aaa====
18193 ==b==
18194 ===ba===
18195 ===bb===
18196 ====bba====
18197 ===bc===
18198 ==c==
18199 ===ca===
18200 !! html/php
18201 ===bc===
18202 !! end
18203
18204 !! test
18205 Section extraction test (section 9)
18206 !! options
18207 section=9
18208 !! wikitext
18209 start
18210 ==a==
18211 ===aa===
18212 ====aaa====
18213 ==b==
18214 ===ba===
18215 ===bb===
18216 ====bba====
18217 ===bc===
18218 ==c==
18219 ===ca===
18220 !! html/php
18221 ==c==
18222 ===ca===
18223 !! end
18224
18225 !! test
18226 Section extraction test (section 10)
18227 !! options
18228 section=10
18229 !! wikitext
18230 start
18231 ==a==
18232 ===aa===
18233 ====aaa====
18234 ==b==
18235 ===ba===
18236 ===bb===
18237 ====bba====
18238 ===bc===
18239 ==c==
18240 ===ca===
18241 !! html/php
18242 ===ca===
18243 !! end
18244
18245 !! test
18246 Section extraction test (nonexistent section 11)
18247 !! options
18248 section=11
18249 !! wikitext
18250 start
18251 ==a==
18252 ===aa===
18253 ====aaa====
18254 ==b==
18255 ===ba===
18256 ===bb===
18257 ====bba====
18258 ===bc===
18259 ==c==
18260 ===ca===
18261 !! html/php
18262 !! end
18263
18264 !! test
18265 Section extraction test with bogus heading (section 1)
18266 !! options
18267 section=1
18268 !! wikitext
18269 ==a==
18270 ==bogus== not a legal section
18271 ==b==
18272 !! html/php
18273 ==a==
18274 ==bogus== not a legal section
18275 !! end
18276
18277 !! test
18278 Section extraction test with bogus heading (section 2)
18279 !! options
18280 section=2
18281 !! wikitext
18282 ==a==
18283 ==bogus== not a legal section
18284 ==b==
18285 !! html/php
18286 ==b==
18287 !! end
18288
18289 !! test
18290 Section extraction test with comment after heading (section 1)
18291 !! options
18292 section=1
18293 !! wikitext
18294 ==a==
18295 ==b== <!-- -->
18296 ==c==
18297 !! html/php
18298 ==a==
18299 !! end
18300
18301 !! test
18302 Section extraction test with comment after heading (section 2)
18303 !! options
18304 section=2
18305 !! wikitext
18306 ==a==
18307 ==b== <!-- -->
18308 ==c==
18309 !! html/php
18310 ==b== <!-- -->
18311 !! end
18312
18313 !! test
18314 Section extraction test with bogus <nowiki> heading (section 1)
18315 !! options
18316 section=1
18317 !! wikitext
18318 ==a==
18319 ==bogus== <nowiki>not a legal section</nowiki>
18320 ==b==
18321 !! html/php
18322 ==a==
18323 ==bogus== <nowiki>not a legal section</nowiki>
18324 !! end
18325
18326 !! test
18327 Section extraction test with bogus <nowiki> heading (section 2)
18328 !! options
18329 section=2
18330 !! wikitext
18331 ==a==
18332 ==bogus== <nowiki>not a legal section</nowiki>
18333 ==b==
18334 !! html/php
18335 ==b==
18336 !! end
18337
18338 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18339 # instead of respecting commented sections
18340 !! test
18341 Section extraction prefixed by comment (section 1)
18342 !! options
18343 section=1
18344 !! wikitext
18345 <!-- -->==sec1==
18346 ==sec2==
18347 !! html/php
18348 ==sec2==
18349 !!end
18350
18351 !! test
18352 Section extraction prefixed by comment (section 2)
18353 !! options
18354 section=2
18355 !! wikitext
18356 <!-- -->==sec1==
18357 ==sec2==
18358 !! html/php
18359
18360 !!end
18361
18362 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18363 # instead of respecting HTML-style headings
18364 !! test
18365 Section extraction, mixed wiki and html (section 1)
18366 !! options
18367 section=1
18368 !! wikitext
18369 <h2>unmarked</h2>
18370 unmarked
18371 ==1==
18372 one
18373 ==2==
18374 two
18375 !! html/php
18376 ==1==
18377 one
18378 !! end
18379
18380 !! test
18381 Section extraction, mixed wiki and html (section 2)
18382 !! options
18383 section=2
18384 !! wikitext
18385 <h2>unmarked</h2>
18386 unmarked
18387 ==1==
18388 one
18389 ==2==
18390 two
18391 !! html/php
18392 ==2==
18393 two
18394 !! end
18395
18396
18397 # Formerly testing for bug 3342
18398 !! test
18399 Section extraction, heading surrounded by <noinclude>
18400 !! options
18401 section=1
18402 !! wikitext
18403 <noinclude>==unmarked==</noinclude>
18404 ==marked==
18405 !! html/php
18406 ==marked==
18407 !!end
18408
18409 # Test behavior of bug 19910
18410 !! test
18411 Sectiion with all-equals
18412 !! options
18413 section=2
18414 !! wikitext
18415 ===
18416 The line above must have a trailing space
18417 === <!--
18418 --> <!-- -->
18419 But just in case it doesn't...
18420 !! html/php
18421 === <!--
18422 --> <!-- -->
18423 But just in case it doesn't...
18424 !! end
18425
18426 !! test
18427 Section replacement test (section 0)
18428 !! options
18429 replace=0,"xxx"
18430 !! wikitext
18431 start
18432 ==a==
18433 ===aa===
18434 ====aaa====
18435 ==b==
18436 ===ba===
18437 ===bb===
18438 ====bba====
18439 ===bc===
18440 ==c==
18441 ===ca===
18442 !! html/php
18443 xxx
18444
18445 ==a==
18446 ===aa===
18447 ====aaa====
18448 ==b==
18449 ===ba===
18450 ===bb===
18451 ====bba====
18452 ===bc===
18453 ==c==
18454 ===ca===
18455 !! end
18456
18457 !! test
18458 Section replacement test (section 1)
18459 !! options
18460 replace=1,"xxx"
18461 !! wikitext
18462 start
18463 ==a==
18464 ===aa===
18465 ====aaa====
18466 ==b==
18467 ===ba===
18468 ===bb===
18469 ====bba====
18470 ===bc===
18471 ==c==
18472 ===ca===
18473 !! html/php
18474 start
18475 xxx
18476
18477 ==b==
18478 ===ba===
18479 ===bb===
18480 ====bba====
18481 ===bc===
18482 ==c==
18483 ===ca===
18484 !! end
18485
18486 !! test
18487 Section replacement test (section 2)
18488 !! options
18489 replace=2,"xxx"
18490 !! wikitext
18491 start
18492 ==a==
18493 ===aa===
18494 ====aaa====
18495 ==b==
18496 ===ba===
18497 ===bb===
18498 ====bba====
18499 ===bc===
18500 ==c==
18501 ===ca===
18502 !! html/php
18503 start
18504 ==a==
18505 xxx
18506
18507 ==b==
18508 ===ba===
18509 ===bb===
18510 ====bba====
18511 ===bc===
18512 ==c==
18513 ===ca===
18514 !! end
18515
18516 !! test
18517 Section replacement test (section 3)
18518 !! options
18519 replace=3,"xxx"
18520 !! wikitext
18521 start
18522 ==a==
18523 ===aa===
18524 ====aaa====
18525 ==b==
18526 ===ba===
18527 ===bb===
18528 ====bba====
18529 ===bc===
18530 ==c==
18531 ===ca===
18532 !! html/php
18533 start
18534 ==a==
18535 ===aa===
18536 xxx
18537
18538 ==b==
18539 ===ba===
18540 ===bb===
18541 ====bba====
18542 ===bc===
18543 ==c==
18544 ===ca===
18545 !! end
18546
18547 !! test
18548 Section replacement test (section 4)
18549 !! options
18550 replace=4,"xxx"
18551 !! wikitext
18552 start
18553 ==a==
18554 ===aa===
18555 ====aaa====
18556 ==b==
18557 ===ba===
18558 ===bb===
18559 ====bba====
18560 ===bc===
18561 ==c==
18562 ===ca===
18563 !! html/php
18564 start
18565 ==a==
18566 ===aa===
18567 ====aaa====
18568 xxx
18569
18570 ==c==
18571 ===ca===
18572 !! end
18573
18574 !! test
18575 Section replacement test (section 5)
18576 !! options
18577 replace=5,"xxx"
18578 !! wikitext
18579 start
18580 ==a==
18581 ===aa===
18582 ====aaa====
18583 ==b==
18584 ===ba===
18585 ===bb===
18586 ====bba====
18587 ===bc===
18588 ==c==
18589 ===ca===
18590 !! html/php
18591 start
18592 ==a==
18593 ===aa===
18594 ====aaa====
18595 ==b==
18596 xxx
18597
18598 ===bb===
18599 ====bba====
18600 ===bc===
18601 ==c==
18602 ===ca===
18603 !! end
18604
18605 !! test
18606 Section replacement test (section 6)
18607 !! options
18608 replace=6,"xxx"
18609 !! wikitext
18610 start
18611 ==a==
18612 ===aa===
18613 ====aaa====
18614 ==b==
18615 ===ba===
18616 ===bb===
18617 ====bba====
18618 ===bc===
18619 ==c==
18620 ===ca===
18621 !! html/php
18622 start
18623 ==a==
18624 ===aa===
18625 ====aaa====
18626 ==b==
18627 ===ba===
18628 xxx
18629
18630 ===bc===
18631 ==c==
18632 ===ca===
18633 !! end
18634
18635 !! test
18636 Section replacement test (section 7)
18637 !! options
18638 replace=7,"xxx"
18639 !! wikitext
18640 start
18641 ==a==
18642 ===aa===
18643 ====aaa====
18644 ==b==
18645 ===ba===
18646 ===bb===
18647 ====bba====
18648 ===bc===
18649 ==c==
18650 ===ca===
18651 !! html/php
18652 start
18653 ==a==
18654 ===aa===
18655 ====aaa====
18656 ==b==
18657 ===ba===
18658 ===bb===
18659 xxx
18660
18661 ===bc===
18662 ==c==
18663 ===ca===
18664 !! end
18665
18666 !! test
18667 Section replacement test (section 8)
18668 !! options
18669 replace=8,"xxx"
18670 !! wikitext
18671 start
18672 ==a==
18673 ===aa===
18674 ====aaa====
18675 ==b==
18676 ===ba===
18677 ===bb===
18678 ====bba====
18679 ===bc===
18680 ==c==
18681 ===ca===
18682 !! html/php
18683 start
18684 ==a==
18685 ===aa===
18686 ====aaa====
18687 ==b==
18688 ===ba===
18689 ===bb===
18690 ====bba====
18691 xxx
18692
18693 ==c==
18694 ===ca===
18695 !!end
18696
18697 !! test
18698 Section replacement test (section 9)
18699 !! options
18700 replace=9,"xxx"
18701 !! wikitext
18702 start
18703 ==a==
18704 ===aa===
18705 ====aaa====
18706 ==b==
18707 ===ba===
18708 ===bb===
18709 ====bba====
18710 ===bc===
18711 ==c==
18712 ===ca===
18713 !! html/php
18714 start
18715 ==a==
18716 ===aa===
18717 ====aaa====
18718 ==b==
18719 ===ba===
18720 ===bb===
18721 ====bba====
18722 ===bc===
18723 xxx
18724 !! end
18725
18726 !! test
18727 Section replacement test (section 10)
18728 !! options
18729 replace=10,"xxx"
18730 !! wikitext
18731 start
18732 ==a==
18733 ===aa===
18734 ====aaa====
18735 ==b==
18736 ===ba===
18737 ===bb===
18738 ====bba====
18739 ===bc===
18740 ==c==
18741 ===ca===
18742 !! html/php
18743 start
18744 ==a==
18745 ===aa===
18746 ====aaa====
18747 ==b==
18748 ===ba===
18749 ===bb===
18750 ====bba====
18751 ===bc===
18752 ==c==
18753 xxx
18754 !! end
18755
18756 !! test
18757 Section replacement test with initial whitespace (bug 13728)
18758 !! options
18759 replace=2,"xxx"
18760 !! wikitext
18761 Preformatted initial line
18762 ==a==
18763 ===a===
18764 !! html/php
18765 Preformatted initial line
18766 ==a==
18767 xxx
18768 !! end
18769
18770
18771 !! test
18772 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18773 !! options
18774 section=1
18775 !! wikitext
18776 ==a==
18777 a
18778 !! html/php
18779 ==a==
18780 a
18781 !! end
18782
18783 !! test
18784 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18785 !! options
18786 section=1
18787 !! wikitext
18788 ==a==
18789 a
18790 !! html/php
18791 ==a==
18792 a
18793 !! end
18794
18795
18796 !! test
18797 Section extraction, <pre> around bogus header (bug 10309)
18798 !! options
18799 section=2
18800 !! wikitext
18801 == Section One ==
18802 <pre>
18803 =======
18804 </pre>
18805
18806 == Section Two ==
18807 stuff
18808 !! html/php
18809 == Section Two ==
18810 stuff
18811 !! end
18812
18813 !! test
18814 Section replacement, <pre> around bogus header (bug 10309)
18815 !! options
18816 replace=2,"xxx"
18817 !! wikitext
18818 == Section One ==
18819 <pre>
18820 =======
18821 </pre>
18822
18823 == Section Two ==
18824 stuff
18825 !! html/php
18826 == Section One ==
18827 <pre>
18828 =======
18829 </pre>
18830
18831 xxx
18832 !! end
18833
18834
18835 !! test
18836 Handling of &#x0A; in URLs
18837 !! wikitext
18838 ** irc://&#x0A;a
18839 !! html/php
18840 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18841
18842 !! html/parsoid
18843 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18844 a">irc://
18845 a</a></li></ul></li></ul>
18846 !! end
18847
18848 !! test
18849 Handling of %0A in URLs
18850 !! wikitext
18851 ** irc://%0Aa
18852 !! html/php
18853 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18854
18855 !! html/parsoid
18856 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18857 !! end
18858
18859
18860 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18861 !! test
18862 5 quotes, code coverage +1 line
18863 !! options
18864 parsoid=wt2html
18865 !! wikitext
18866 '''''
18867 !! html/php
18868 !! html/parsoid
18869 <p><b><i></i></b></p>
18870 !! end
18871
18872 # same html as previous, but wikitext adjusted to match parsoid html2wt
18873 # note that wt2html and html2html will put the <i> before the <b>
18874 !! test
18875 5 quotes, code coverage +1 line w/ nowiki (1)
18876 !! options
18877 parsoid=wt2wt,html2wt
18878 !! wikitext
18879 '''''<nowiki/>'''''
18880 !! html/php
18881 <p><i></i>
18882 </p>
18883 !! html/parsoid
18884 <p><b><i></i></b></p>
18885 !! end
18886
18887 # same as previous, just swapping the <i> and <b>
18888 !! test
18889 5 quotes, code coverage +1 line w/ nowiki (2)
18890 !! wikitext
18891 '''''<nowiki/>'''''
18892 !! html/php
18893 <p><i></i>
18894 </p>
18895 !! html/parsoid
18896 <p><i><b></b></i></p>
18897 !! end
18898
18899 !! test
18900 Special:Search page linking.
18901 !! wikitext
18902 {{Special:search}}
18903 !! html
18904 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18905 </p>
18906 !! end
18907
18908 !! test
18909 {{!}} is a magic word
18910 !! wikitext
18911 {{!}} is a magic word there and {{!}} is still a magic word here
18912 | is not a magic word here but {{!}} is still a magic word here
18913 !! html/php
18914 <p>| is a magic word there and | is still a magic word here
18915 | is not a magic word here but | is still a magic word here
18916 </p>
18917 !! html/parsoid
18918 <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
18919 | 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>
18920
18921 !! end
18922
18923 !! test
18924 Say the magic word
18925 !! options
18926 title=[[Parser test]]
18927 !! wikitext
18928 * {{PAGENAME}}
18929 * {{PAGENAMEE}}
18930 * {{FULLPAGENAME}}
18931 * {{FULLPAGENAMEE}}
18932 * {{BASEPAGENAME}}
18933 * {{BASEPAGENAMEE}}
18934 * {{SUBPAGENAME}}
18935 * {{SUBPAGENAMEE}}
18936 * {{ROOTPAGENAME}}
18937 * {{ROOTPAGENAMEE}}
18938 * {{TALKPAGENAME}}
18939 * {{TALKPAGENAMEE}}
18940 * {{SUBJECTPAGENAME}}
18941 * {{SUBJECTPAGENAMEE}}
18942 * {{NAMESPACEE}}
18943 * {{NAMESPACE}}
18944 * {{NAMESPACENUMBER}}
18945 * {{TALKSPACE}}
18946 * {{TALKSPACEE}}
18947 * {{SUBJECTSPACE}}
18948 * {{SUBJECTSPACEE}}
18949 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18950 !! html
18951 <ul><li> Parser test</li>
18952 <li> Parser_test</li>
18953 <li> Parser test</li>
18954 <li> Parser_test</li>
18955 <li> Parser test</li>
18956 <li> Parser_test</li>
18957 <li> Parser test</li>
18958 <li> Parser_test</li>
18959 <li> Parser test</li>
18960 <li> Parser_test</li>
18961 <li> Talk:Parser test</li>
18962 <li> Talk:Parser_test</li>
18963 <li> Parser test</li>
18964 <li> Parser_test</li>
18965 <li> </li>
18966 <li> </li>
18967 <li> 0</li>
18968 <li> Talk</li>
18969 <li> Talk</li>
18970 <li> </li>
18971 <li> </li>
18972 <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>
18973
18974 !! end
18975 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18976
18977 ## Parsoid thinks the "centre" here is a property, not a caption.
18978 !! test
18979 Gallery
18980 !! options
18981 parsoid={
18982 "modes": ["wt2html"],
18983 "nativeGallery": true
18984 }
18985 !! wikitext
18986 <gallery>
18987 image1.png |
18988 image2.gif|||||
18989
18990 image3|
18991 image4 |300px| centre
18992 image5.svg| http://///////
18993 [[x|xx]]]]
18994 * image6
18995 </gallery>
18996 !! html/php
18997 <ul class="gallery mw-gallery-traditional">
18998 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18999 <div class="thumb" style="height: 150px;">Image1.png</div>
19000 <div class="gallerytext">
19001 </div>
19002 </div></li>
19003 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19004 <div class="thumb" style="height: 150px;">Image2.gif</div>
19005 <div class="gallerytext">
19006 </div>
19007 </div></li>
19008 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19009 <div class="thumb" style="height: 150px;">Image3</div>
19010 <div class="gallerytext">
19011 </div>
19012 </div></li>
19013 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19014 <div class="thumb" style="height: 150px;">Image4</div>
19015 <div class="gallerytext">
19016 <pre>centre
19017 </pre>
19018 </div>
19019 </div></li>
19020 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19021 <div class="thumb" style="height: 150px;">Image5.svg</div>
19022 <div class="gallerytext">
19023 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
19024 </p>
19025 </div>
19026 </div></li>
19027 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19028 <div class="thumb" style="height: 150px;">* image6</div>
19029 <div class="gallerytext">
19030 </div>
19031 </div></li>
19032 </ul>
19033
19034 !! html/parsoid
19035 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19036 <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>
19037 <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>
19038 <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>
19039 <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>
19040 <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>
19041 <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>
19042 </ul>
19043 !! end
19044
19045 !! test
19046 Gallery (with options, html)
19047 !! options
19048 parsoid={
19049 "modes": ["wt2html", "html2html"],
19050 "nativeGallery": true
19051 }
19052 !! wikitext
19053 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19054 File:Nonexistent.jpg|caption
19055 File:Nonexistent.jpg
19056 image:foobar.jpg|some '''caption''' [[Main Page]]
19057 image:foobar.jpg
19058 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19059 </gallery>
19060 !! html/php
19061 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19062 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19063 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19064 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19065 <div class="gallerytext">
19066 <p>caption
19067 </p>
19068 </div>
19069 </div></li>
19070 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19071 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19072 <div class="gallerytext">
19073 </div>
19074 </div></li>
19075 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19076 <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>
19077 <div class="gallerytext">
19078 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19079 </p>
19080 </div>
19081 </div></li>
19082 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19083 <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>
19084 <div class="gallerytext">
19085 </div>
19086 </div></li>
19087 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19088 <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>
19089 <div class="gallerytext">
19090 <p>blabla.
19091 </p>
19092 </div>
19093 </div></li>
19094 </ul>
19095
19096 !! html/parsoid
19097 <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":{}}'>
19098 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19099 <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>
19100 <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>
19101 <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>
19102 <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>
19103 <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>
19104 </ul>
19105 !! end
19106
19107 !! test
19108 Gallery (with options, extsrc)
19109 !! options
19110 parsoid={
19111 "nativeGallery": false
19112 }
19113 !! wikitext
19114 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19115 File:Nonexistent.jpg|caption
19116 File:Nonexistent.jpg
19117 image:foobar.jpg|some '''caption''' [[Main Page]]
19118 image:foobar.jpg
19119 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19120 </gallery>
19121 !! html/php
19122 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19123 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19124 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19125 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19126 <div class="gallerytext">
19127 <p>caption
19128 </p>
19129 </div>
19130 </div></li>
19131 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19132 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19133 <div class="gallerytext">
19134 </div>
19135 </div></li>
19136 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19137 <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>
19138 <div class="gallerytext">
19139 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19140 </p>
19141 </div>
19142 </div></li>
19143 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19144 <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>
19145 <div class="gallerytext">
19146 </div>
19147 </div></li>
19148 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19149 <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>
19150 <div class="gallerytext">
19151 <p>blabla.
19152 </p>
19153 </div>
19154 </div></li>
19155 </ul>
19156
19157 !! html/parsoid
19158 <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"}}'>
19159 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19160 <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>
19161 <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>
19162 <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>
19163 <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>
19164 <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>
19165 </ul>
19166 !! end
19167
19168 !! test
19169 Gallery with link that has fragment
19170 !! options
19171 parsoid={
19172 "modes": ["wt2html", "html2html"],
19173 "nativeGallery": true
19174 }
19175 !! wikitext
19176 <gallery>
19177 image:foobar.jpg|link=Main_Page
19178 image:foobar.jpg|link=Main_Page#section
19179 image:foobar.jpg|link=Main Page#section|caption
19180 </gallery>
19181 !! html/php
19182 <ul class="gallery mw-gallery-traditional">
19183 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19184 <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>
19185 <div class="gallerytext">
19186 </div>
19187 </div></li>
19188 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19189 <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>
19190 <div class="gallerytext">
19191 </div>
19192 </div></li>
19193 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19194 <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>
19195 <div class="gallerytext">
19196 <p>caption
19197 </p>
19198 </div>
19199 </div></li>
19200 </ul>
19201
19202 !! html/parsoid
19203 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19204 <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>
19205 <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>
19206 <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>
19207 </ul>
19208 !! end
19209
19210 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19211 !! test
19212 Gallery with template inside caption
19213 !! options
19214 parsoid={
19215 "nativeGallery": true
19216 }
19217 !! wikitext
19218 <gallery caption="{{echo|hi}}">
19219 File:Foobar.jpg|{{echo|ho}}
19220 </gallery>
19221 !! html/php
19222 <ul class="gallery mw-gallery-traditional">
19223 <li class='gallerycaption'>{{echo|hi}}</li>
19224 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19225 <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>
19226 <div class="gallerytext">
19227 <p>ho
19228 </p>
19229 </div>
19230 </div></li>
19231 </ul>
19232
19233 !! html/parsoid
19234 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19235 <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>
19236 <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>
19237 </ul>
19238 !! end
19239
19240 !! test
19241 Gallery with wikitext inside caption
19242 !! options
19243 parsoid={
19244 "nativeGallery": true
19245 }
19246 !! wikitext
19247 <gallery>
19248 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19249 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19250 </gallery>
19251 !! html/php
19252 <ul class="gallery mw-gallery-traditional">
19253 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19254 <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>
19255 <div class="gallerytext">
19256 <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>
19257 </p>
19258 </div>
19259 </div></li>
19260 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19261 <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>
19262 <div class="gallerytext">
19263 <p>This is a test template
19264 </p>
19265 </div>
19266 </div></li>
19267 </ul>
19268
19269 !! html/parsoid
19270 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19271 <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>
19272 <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>
19273 </ul>
19274 !! end
19275
19276 !! test
19277 Gallery (with showfilename option)
19278 !! options
19279 parsoid={
19280 "nativeGallery": true
19281 }
19282 !! wikitext
19283 <gallery showfilename="">
19284 File:Nonexistent.jpg|caption
19285 File:Nonexistent.jpg
19286 File:Foobar.jpg|some '''caption''' [[Main Page]]
19287 File:Foobar.jpg
19288 </gallery>
19289 !! html/php
19290 <ul class="gallery mw-gallery-traditional">
19291 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19292 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19293 <div class="gallerytext">
19294 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19295 caption
19296 </p>
19297 </div>
19298 </div></li>
19299 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19300 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19301 <div class="gallerytext">
19302 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19303 </p>
19304 </div>
19305 </div></li>
19306 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19307 <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>
19308 <div class="gallerytext">
19309 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19310 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19311 </p>
19312 </div>
19313 </div></li>
19314 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19315 <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>
19316 <div class="gallerytext">
19317 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19318 </p>
19319 </div>
19320 </div></li>
19321 </ul>
19322
19323 !! html/parsoid
19324 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
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 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>
19326 <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>
19327 <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>
19328 <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>
19329 </ul>
19330 !! end
19331
19332 ## Should Parsoid be preserving these variations?
19333 !! test
19334 Gallery (with namespace-less filenames)
19335 !! options
19336 parsoid={
19337 "modes": ["wt2html", "html2html"],
19338 "nativeGallery": true
19339 }
19340 !! wikitext
19341 <gallery>
19342 File:Nonexistent.jpg
19343 Nonexistent.jpg
19344 image:foobar.jpg
19345 foobar.jpg
19346 </gallery>
19347 !! html/php
19348 <ul class="gallery mw-gallery-traditional">
19349 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19350 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19351 <div class="gallerytext">
19352 </div>
19353 </div></li>
19354 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19355 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19356 <div class="gallerytext">
19357 </div>
19358 </div></li>
19359 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19360 <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>
19361 <div class="gallerytext">
19362 </div>
19363 </div></li>
19364 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19365 <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>
19366 <div class="gallerytext">
19367 </div>
19368 </div></li>
19369 </ul>
19370
19371 !! html/parsoid
19372 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19373 <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>
19374 <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>
19375 <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>
19376 <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>
19377 </ul>
19378 !! end
19379
19380 !! test
19381 Gallery override link with WikiLink (T36852)
19382 !! options
19383 parsoid={
19384 "nativeGallery": true
19385 }
19386 !! wikitext
19387 <gallery>
19388 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
19389 </gallery>
19390 !! html/php
19391 <ul class="gallery mw-gallery-traditional">
19392 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19393 <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>
19394 <div class="gallerytext">
19395 </div>
19396 </div></li>
19397 </ul>
19398
19399 !! html/parsoid
19400 <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":{}}'>
19401 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span 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>
19402 </ul>
19403 !! end
19404
19405 !! test
19406 Gallery override link with absolute external link (T36852)
19407 !! options
19408 parsoid={
19409 "nativeGallery": true
19410 }
19411 !! wikitext
19412 <gallery>
19413 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
19414 </gallery>
19415 !! html/php
19416 <ul class="gallery mw-gallery-traditional">
19417 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19418 <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>
19419 <div class="gallerytext">
19420 </div>
19421 </div></li>
19422 </ul>
19423
19424 !! html/parsoid
19425 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19426 <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>
19427 </ul>
19428 !! end
19429
19430 !! test
19431 Gallery override link with malicious javascript (T36852)
19432 !! options
19433 parsoid={
19434 "modes": ["wt2html", "html2html"],
19435 "nativeGallery": true
19436 }
19437 !! wikitext
19438 <gallery>
19439 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19440 </gallery>
19441 !! html/php
19442 <ul class="gallery mw-gallery-traditional">
19443 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19444 <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>
19445 <div class="gallerytext">
19446 </div>
19447 </div></li>
19448 </ul>
19449
19450 !! html/parsoid
19451 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19452 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./&quot;_onclick=&quot;alert('malicious_javascript_code!');"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"></div></li>
19453 </ul>
19454 !! end
19455
19456 !! test
19457 Gallery with invalid title as link (T45964)
19458 !! options
19459 parsoid={
19460 "modes": ["wt2html", "html2html"],
19461 "nativeGallery": true
19462 }
19463 !! wikitext
19464 <gallery>
19465 File:Foobar.jpg|link=<
19466 </gallery>
19467 !! html/php
19468 <ul class="gallery mw-gallery-traditional">
19469 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19470 <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>
19471 <div class="gallerytext">
19472 </div>
19473 </div></li>
19474 </ul>
19475
19476 !! html/parsoid
19477 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19478 <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>
19479 </ul>
19480 !! end
19481
19482 !! test
19483 HTML Hex character encoding (spells the word "JavaScript")
19484 !! options
19485 parsoid=wt2html,wt2wt,html2html
19486 !! wikitext
19487 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19488 !! html/php
19489 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19490 </p>
19491 !! html/php+tidy
19492 <p>JavaScript</p>
19493 !! html/parsoid
19494 <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>
19495 !! end
19496
19497 !! test
19498 HTML Hex character encoding bogus encoding (bug 26437 regression check)
19499 !! wikitext
19500 &#xsee;&#XSEE;
19501 !! html/php
19502 <p>&amp;#xsee;&amp;#XSEE;
19503 </p>
19504 !! html/parsoid
19505 <p>&amp;#xsee;&amp;#XSEE;</p>
19506 !! end
19507
19508 !! test
19509 HTML Hex character encoding mixed case
19510 !! options
19511 parsoid=wt2html,wt2wt,html2html
19512 !! wikitext
19513 &#xEE;&#Xee;
19514 !! html/php
19515 <p>&#xee;&#xee;
19516 </p>
19517 !! html/php+tidy
19518 <p>îî</p>
19519 !! html/parsoid
19520 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19521 !! end
19522
19523 # See: https://www.w3.org/TR/html5/syntax.html#character-references
19524 # Note that U+000C (form feed) is not a valid XML character, so
19525 # it is banned even though allowed in HTML5.
19526 !! test
19527 Illegal character references (T106578)
19528 !! wikitext
19529 ; Null: &#00;
19530 ; FF: &#xC;
19531 ; CR: &#xD;
19532 ; Control (low): &#8;
19533 ; Control (high): &#x7F; &#x9F;
19534 ; Surrogate: &#xD83D;&#xDCA9;
19535 ; This is an okay astral character: &#x1F4A9;
19536 !! html+tidy
19537 <dl>
19538 <dt>Null</dt>
19539 <dd>&amp;#00;</dd>
19540 <dt>FF</dt>
19541 <dd>&amp;#xC;</dd>
19542 <dt>CR</dt>
19543 <dd>&amp;#xD;</dd>
19544 <dt>Control (low)</dt>
19545 <dd>&amp;#8;</dd>
19546 <dt>Control (high)</dt>
19547 <dd>&amp;#x7F; &amp;#x9F;</dd>
19548 <dt>Surrogate</dt>
19549 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19550 <dt>This is an okay astral character</dt>
19551 <dd>💩</dd>
19552 </dl>
19553 !! end
19554
19555 !! test
19556 __FORCETOC__ override
19557 !! wikitext
19558 __NEWSECTIONLINK__
19559 __FORCETOC__
19560 !! html/php
19561 <p><br />
19562 </p>
19563 !! end
19564
19565 !! test
19566 ISBN code coverage
19567 !! wikitext
19568 ISBN 978-0-1234-56&#x20;789
19569 !! html
19570 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19571 </p>
19572 !! html+tidy
19573 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19574 !! html/parsoid
19575 <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>
19576 !! end
19577
19578 !! test
19579 ISBN followed by 5 spaces
19580 !! wikitext
19581 ISBN
19582 !! html
19583 <p>ISBN
19584 </p>
19585 !! end
19586
19587 !! test
19588 Double ISBN
19589 !! wikitext
19590 ISBN ISBN 1234567890
19591 !! html/php
19592 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19593 </p>
19594 !! html/parsoid
19595 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19596 !! end
19597
19598 # Uppercase X and lowercase x as well
19599 !! test
19600 ISBN with an X
19601 !! wikitext
19602 ISBN 3-462-04561-X
19603 ISBN 3-462-04561-x
19604 ISBN 080442957X
19605 ISBN 080442957x
19606 ISBN 978080442957X
19607 ISBN 978080442957x
19608 !! html/php
19609 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19610 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19611 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19612 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19613 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19614 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19615 </p>
19616 !! html/parsoid
19617 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19618 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19619 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19620 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19621 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19622 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19623 !! end
19624
19625 !! test
19626 ISBN with empty prefix (parsoid test)
19627 !! wikitext
19628 ISBN 1234567890
19629 !! html/php
19630 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19631 </p>
19632 !! html/parsoid
19633 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19634 !! end
19635
19636 !! test
19637 Bug 22905: <abbr> followed by ISBN followed by </a>
19638 !! wikitext
19639 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19640 !! html/php
19641 <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>
19642 </p>
19643 !! html/parsoid
19644 <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>
19645 !! end
19646
19647 !! test
19648 Double RFC
19649 !! wikitext
19650 RFC RFC 1234
19651 !! html
19652 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19653 </p>
19654 !! end
19655
19656 !! test
19657 Double RFC with a wiki link
19658 !! wikitext
19659 RFC [[RFC 1234]]
19660 !! html
19661 <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>
19662 </p>
19663 !! end
19664
19665 !! test
19666 RFC code coverage
19667 !! wikitext
19668 RFC 983&#x20;987
19669 !! html
19670 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19671 </p>
19672 !! html+tidy
19673 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19674 !! end
19675
19676 !! test
19677 Centre-aligned image
19678 !! wikitext
19679 [[Image:foobar.jpg|centre]]
19680 !! html
19681 <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>
19682
19683 !!end
19684
19685 !! test
19686 None-aligned image
19687 !! wikitext
19688 [[Image:foobar.jpg|none]]
19689 !! html
19690 <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>
19691
19692 !!end
19693
19694 !! test
19695 Width + Height sized image (using px) (height is ignored)
19696 !! wikitext
19697 [[Image:foobar.jpg|640x480px]]
19698 !! html
19699 <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>
19700 </p>
19701 !!end
19702
19703 !! test
19704 Width-sized image (using px, no following whitespace)
19705 !! wikitext
19706 [[Image:foobar.jpg|640px]]
19707 !! html
19708 <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>
19709 </p>
19710 !!end
19711
19712 !! test
19713 Width-sized image (using px, with following whitespace - test regression from r39467)
19714 !! wikitext
19715 [[Image:foobar.jpg|640px ]]
19716 !! html
19717 <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>
19718 </p>
19719 !!end
19720
19721 !! test
19722 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19723 !! wikitext
19724 [[Image:foobar.jpg| 640px]]
19725 !! html
19726 <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>
19727 </p>
19728 !!end
19729
19730 !! test
19731 Image with page parameter
19732 !! options
19733 djvu
19734 !! wikitext
19735 [[File:LoremIpsum.djvu|page=2]]
19736 !! html/php
19737 <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>
19738 </p>
19739 !! html/parsoid
19740 <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>
19741 !! end
19742
19743 !! test
19744 Another italics / bold test
19745 !! wikitext
19746 ''' ''x'
19747 !! html
19748 <pre>'<i> </i>x'
19749 </pre>
19750 !!end
19751
19752 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19753 !! test
19754 dt/dd/dl test
19755 !! wikitext
19756 :;;;::
19757 !! html/php
19758 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19759
19760 !! html/parsoid
19761 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19762
19763 !!end
19764
19765
19766 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19767 !! test
19768 Images with the "|" character in the comment
19769 !! wikitext
19770 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19771 !! html/php
19772 <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>
19773
19774 !! html/parsoid
19775 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>An <a rel="mw:ExtLink" href="http://test/?param1=|left|&amp;param2=|x">external</a> URL</figcaption></figure>
19776 !! end
19777
19778 !! test
19779 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19780 !! wikitext
19781 <html><script>alert(1);</script></html>
19782 !! html
19783 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19784 </p>
19785 !! end
19786
19787 !! test
19788 HTML with raw HTML ($wgRawHtml==true)
19789 !! options
19790 wgRawHtml=1
19791 !! wikitext
19792 <html><script>alert(1);</script></html>
19793 !! html
19794 <p><script>alert(1);</script>
19795 </p>
19796 !! end
19797
19798 !! test
19799 Parents of subpages, one level up
19800 !! options
19801 subpage title=[[Subpage test/L1/L2/L3]]
19802 !! wikitext
19803 [[../|L2]]
19804 !! html
19805 <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>
19806 </p>
19807 !! end
19808
19809
19810 !! test
19811 Parents of subpages, one level up, not named
19812 !! options
19813 subpage title=[[Subpage test/L1/L2/L3]]
19814 !! wikitext
19815 [[../]]
19816 !! html
19817 <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>
19818 </p>
19819 !! end
19820
19821
19822
19823 !! test
19824 Parents of subpages, two levels up
19825 !! options
19826 subpage title=[[Subpage test/L1/L2/L3]]
19827 !! wikitext
19828 [[../../|L1]]2
19829
19830 [[../../|L1]]l
19831 !! html
19832 <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
19833 </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>
19834 </p>
19835 !! end
19836
19837 !! test
19838 Parents of subpages, two levels up, without trailing slash or name.
19839 !! options
19840 subpage title=[[Subpage test/L1/L2/L3]]
19841 !! wikitext
19842 [[../..]]
19843 !! html
19844 <p>[[../..]]
19845 </p>
19846 !! end
19847
19848 !! test
19849 Parents of subpages, two levels up, with lots of extra trailing slashes.
19850 !! options
19851 subpage title=[[Subpage test/L1/L2/L3]]
19852 !! wikitext
19853 [[../../////]]
19854 !! html
19855 <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>
19856 </p>
19857 !! end
19858
19859 !! article
19860 Subpage test/L1/L2/L3Sibling
19861 !! text
19862 Sibling article
19863 !! endarticle
19864
19865 !! test
19866 Transclusion of a sibling page (one level up)
19867 !! options
19868 subpage title=[[Subpage test/L1/L2/L3]]
19869 !! wikitext
19870 {{../L3Sibling}}
19871 !! html
19872 <p>Sibling article
19873 </p>
19874 !! end
19875
19876 !! test
19877 Transclusion of a child page
19878 !! options
19879 subpage title=[[Subpage test/L1/L2]]
19880 !! wikitext
19881 {{/L3Sibling}}
19882 !! html
19883 <p>Sibling article
19884 </p>
19885 !! end
19886
19887 # This is wt2html only in Parsoid because we add <nowiki>
19888 # because of {{..}} and we don't expect to fix that to
19889 # eliminate the nowikis selective for {{..}} markup.
19890 !! test
19891 Non-transclusion because of too many up levels
19892 !! options
19893 subpage title=[[Subpage test/L1/L2/L3]]
19894 parsoid=wt2html
19895 !! wikitext
19896 {{../../../../More than parent}}
19897 !! html/php
19898 <p>{{../../../../More than parent}}
19899 </p>
19900 !! html/parsoid
19901 <p>{{../../../../More than parent}}</p>
19902 !! end
19903
19904 !! test
19905 Definition list code coverage
19906 !! wikitext
19907 ; title : def
19908 ; title : def
19909 ;title: def
19910 !! html/php
19911 <dl><dt> title &#160;</dt>
19912 <dd> def</dd>
19913 <dt> title&#160;</dt>
19914 <dd> def</dd>
19915 <dt>title</dt>
19916 <dd> def</dd></dl>
19917
19918 !! html/parsoid
19919 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19920 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19921 <dt>title</dt><dd> def</dd></dl>
19922 !! end
19923
19924 !! test
19925 Don't fall for the self-closing div
19926 !! wikitext
19927 <div>hello world</div/>
19928 !! html
19929 <div>hello world</div>
19930
19931 !! end
19932
19933 !! test
19934 MSGNW magic word
19935 !! wikitext
19936 {{MSGNW:msg}}
19937 !! html/php
19938 <p>&#91;&#91;:Template:Msg&#93;&#93;
19939 </p>
19940 !! end
19941
19942 !! test
19943 RAW magic word
19944 !! wikitext
19945 {{RAW:QUERTY}}
19946 !! html
19947 <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>
19948 </p>
19949 !! end
19950
19951 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19952 !! test
19953 Always escape literal '>' in output, not just after '<'
19954 !! wikitext
19955 ><>
19956 !! html
19957 <p>&gt;&lt;&gt;
19958 </p>
19959 !! end
19960
19961 !! test
19962 Template caching
19963 !! wikitext
19964 {{Test}}
19965 {{Test}}
19966 !! html
19967 <p>This is a test template
19968 This is a test template
19969 </p>
19970 !! end
19971
19972
19973 !! article
19974 MediaWiki:Fake
19975 !! text
19976 ==header==
19977 !! endarticle
19978
19979 !! test
19980 Inclusion of !userCanEdit() content
19981 !! wikitext
19982 {{MediaWiki:Fake}}
19983 !! html
19984 <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>
19985
19986 !! end
19987
19988
19989 !! test
19990 Out-of-order TOC heading levels
19991 !! wikitext
19992 ==2==
19993 ======6======
19994 ===3===
19995 =1=
19996 =====5=====
19997 ==2==
19998 !! html
19999 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20000 <ul>
20001 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
20002 <ul>
20003 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
20004 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
20005 </ul>
20006 </li>
20007 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
20008 <ul>
20009 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
20010 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
20011 </ul>
20012 </li>
20013 </ul>
20014 </div>
20015
20016 <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>
20017 <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>
20018 <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>
20019 <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>
20020 <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>
20021 <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>
20022
20023 !! end
20024
20025
20026 !! test
20027 ISBN with a dummy number
20028 !! wikitext
20029 ISBN ---
20030 !! html
20031 <p>ISBN ---
20032 </p>
20033 !! end
20034
20035
20036 !! test
20037 ISBN with space-delimited number
20038 !! wikitext
20039 ISBN 92 9017 032 8
20040 !! html
20041 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
20042 </p>
20043 !! end
20044
20045
20046 !! test
20047 ISBN with multiple spaces, no number
20048 !! wikitext
20049 ISBN foo
20050 !! html
20051 <p>ISBN foo
20052 </p>
20053 !! end
20054
20055
20056 !! test
20057 ISBN length
20058 !! wikitext
20059 ISBN 123456789
20060
20061 ISBN 1234567890
20062
20063 ISBN 12345678901
20064 !! html
20065 <p>ISBN 123456789
20066 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20067 </p><p>ISBN 12345678901
20068 </p>
20069 !! end
20070
20071
20072 !! test
20073 ISBN with trailing year (bug 8110)
20074 !! wikitext
20075 ISBN 1-234-56789-0 - 2006
20076
20077 ISBN 1 234 56789 0 - 2006
20078 !! html
20079 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
20080 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20081 </p>
20082 !! end
20083
20084
20085 !! test
20086 anchorencode
20087 !! wikitext
20088 {{anchorencode:foo bar©#%n}}
20089 !! html
20090 <p>foo_bar.C2.A9.23.25n
20091 </p>
20092 !! end
20093
20094 !! test
20095 anchorencode trims spaces
20096 !! wikitext
20097 {{anchorencode: __pretty__please__}}
20098 !! html
20099 <p>pretty_please
20100 </p>
20101 !! end
20102
20103 !! test
20104 anchorencode deals with links
20105 !! wikitext
20106 {{anchorencode: [[hello|world]] [[hi]]}}
20107 !! html
20108 <p>world_hi
20109 </p>
20110 !! end
20111
20112 !! test
20113 anchorencode deals with templates
20114 !! wikitext
20115 {{anchorencode: {{Foo}} }}
20116 !! html
20117 <p>FOO
20118 </p>
20119 !! end
20120
20121 !! test
20122 anchorencode encodes like the TOC generator: (bug 18431)
20123 !! wikitext
20124 === _ +:.3A%3A&&amp;]] ===
20125 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20126 __NOEDITSECTION__
20127 !! html
20128 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20129 <p>.2B:.3A.253A.26.26.5D.5D
20130 </p>
20131 !! end
20132
20133 !! test
20134 Bug 6200: blockquotes and paragraph formatting
20135 !! wikitext
20136 <blockquote>
20137 foo
20138 </blockquote>
20139
20140 bar
20141
20142 baz
20143 !! html
20144 <blockquote>
20145 <p>foo
20146 </p>
20147 </blockquote>
20148 <p>bar
20149 </p>
20150 <pre>baz
20151 </pre>
20152 !! end
20153
20154 !! test
20155 Bug 8293: Use of center tag ruins paragraph formatting
20156 !! wikitext
20157 <center>
20158 foo
20159 </center>
20160
20161 bar
20162
20163 baz
20164 !! html
20165 <center>
20166 <p>foo
20167 </p>
20168 </center>
20169 <p>bar
20170 </p>
20171 <pre>baz
20172 </pre>
20173 !! end
20174
20175 !!test
20176 Parsing of overlapping (improperly nested) inline html tags
20177 !! wikitext
20178 <span><s>x</span></s>
20179 !! html/php
20180 <p><span><s>x&lt;/span&gt;</s></span>
20181 </p>
20182 !! html/parsoid
20183 <p><span><s>x</s></span>
20184 </p>
20185 !!end
20186
20187 ###
20188 ### Language variants related tests
20189 ###
20190 !! test
20191 Self-link in language variants
20192 !! options
20193 title=[[Dunav]] language=sr
20194 !! wikitext
20195 Both [[Dunav]] and [[Дунав]] are names for this river.
20196 !! html
20197 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
20198 </p>
20199 !!end
20200
20201 !! article
20202 Дуна
20203 !! text
20204 content
20205 !! endarticle
20206
20207 !! test
20208 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
20209 !! options
20210 title=[[Duna]] language=sr
20211 !! wikitext
20212 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
20213 !! html
20214 <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.
20215 </p>
20216 !! end
20217
20218 !! test
20219 Link to a section of a variant of this title shouldn't be parsed as self-link
20220 !! options
20221 title=[[Duna]] language=sr
20222 !! wikitext
20223 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
20224 !! html
20225 <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.
20226 </p>
20227 !! end
20228
20229 !! test
20230 Link to pages in language variants
20231 !! options
20232 language=sr
20233 !! wikitext
20234 Main Page can be written as [[Маин Паге]]
20235 !! html
20236 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
20237 </p>
20238 !!end
20239
20240
20241 !! test
20242 Multiple links to pages in language variants
20243 !! options
20244 language=sr
20245 !! wikitext
20246 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
20247 !! html
20248 <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>.
20249 </p>
20250 !!end
20251
20252
20253 !! test
20254 Simple template in language variants
20255 !! options
20256 language=sr
20257 !! wikitext
20258 {{тест}}
20259 !! html
20260 <p>This is a test template
20261 </p>
20262 !! end
20263
20264
20265 !! test
20266 Template with explicit namespace in language variants
20267 !! options
20268 language=sr
20269 !! wikitext
20270 {{Template:тест}}
20271 !! html
20272 <p>This is a test template
20273 </p>
20274 !! end
20275
20276
20277 !! test
20278 Basic test for template parameter in language variants
20279 !! options
20280 language=sr
20281 !! wikitext
20282 {{парамтест|param=foo}}
20283 !! html
20284 <p>This is a test template with parameter foo
20285 </p>
20286 !! end
20287
20288 !! test
20289 Simple category in language variants
20290 !! options
20291 language=sr cat
20292 !! wikitext
20293 [[Category:МедиаWики Усер'с Гуиде]]
20294 !! html/php
20295 cat=МедиаWики_Усер'с_Гуиде sort=
20296 !! html/parsoid
20297 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
20298 !! end
20299
20300 !! article
20301 Category:分类
20302 !! text
20303 blah
20304 !! endarticle
20305
20306 !! article
20307 Category:分類
20308 !! text
20309 blah
20310 !! endarticle
20311
20312 ## We used to, but no longer wt2wt this test since the default serializer
20313 ## will normalize all categories to serialize on their own line.
20314 ## This wikitext usage is going to be fairly uncommon in production and
20315 ## selser will take care of preserving formatting in those scenarios.
20316 !! test
20317 Don't convert blue categorylinks to another variant (bug 33210)
20318 !! options
20319 cat
20320 language=zh
20321 parsoid=wt2html
20322 !! wikitext
20323 [[A]][[Category:分类]]
20324 !! html/php
20325 cat=分类 sort=
20326 !! html/parsoid
20327 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
20328 <link rel="mw:PageProp/Category" href="Category:分类"/>
20329 !! end
20330
20331 !! test
20332 Stripping -{}- tags (language variants)
20333 !! options
20334 language=sr
20335 !! wikitext
20336 Latin proverb: -{Ne nuntium necare}-
20337 !! html
20338 <p>Latin proverb: Ne nuntium necare
20339 </p>
20340 !! end
20341
20342
20343 !! test
20344 Prevent conversion with -{}- tags (language variants)
20345 !! options
20346 language=sr variant=sr-ec
20347 !! wikitext
20348 Latinski: -{Ne nuntium necare}-
20349 !! html
20350 <p>Латински: Ne nuntium necare
20351 </p>
20352 !! end
20353
20354
20355 !! test
20356 Prevent conversion of text with -{}- tags (language variants)
20357 !! options
20358 language=sr variant=sr-ec
20359 !! wikitext
20360 Latinski: -{Ne nuntium necare}-
20361 !! html
20362 <p>Латински: Ne nuntium necare
20363 </p>
20364 !! end
20365
20366
20367 !! test
20368 Prevent conversion of links with -{}- tags (language variants)
20369 !! options
20370 language=sr variant=sr-ec
20371 !! wikitext
20372 -{[[Main Page]]}-
20373 !! html
20374 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20375 </p>
20376 !! end
20377
20378
20379 !! test
20380 -{}- tags within headlines (within html for parserConvert())
20381 !! options
20382 language=sr variant=sr-ec
20383 !! wikitext
20384 == -{Naslov}- ==
20385 !! html
20386 <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>
20387
20388 !! end
20389
20390
20391 !! test
20392 Explicit definition of language variant alternatives
20393 !! options
20394 language=zh variant=zh-tw
20395 !! wikitext
20396 -{zh:China;zh-tw:Taiwan}-, not China
20397 !! html
20398 <p>Taiwan, not China
20399 </p>
20400 !! end
20401
20402
20403 !! test
20404 Conversion around HTML tags
20405 !! options
20406 language=sr variant=sr-ec
20407 !! wikitext
20408 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
20409 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
20410 !! html
20411 <p>
20412 <span title="ЛаCтин">ски</span>
20413 </p>
20414 !! end
20415
20416
20417 !! test
20418 Explicit session-wise language variant mapping (A flag and - flag)
20419 !! options
20420 language=zh variant=zh-tw
20421 !! wikitext
20422 Taiwan is not China.
20423 But -{A|zh:China;zh-tw:Taiwan}- is China,
20424 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20425 and -{China}- is China.
20426 !! html
20427 <p>Taiwan is not China.
20428 But Taiwan is Taiwan,
20429 (This should be stripped!)
20430 and China is China.
20431 </p>
20432 !! end
20433
20434 !! test
20435 Explicit session-wise language variant mapping (H flag for hide)
20436 !! options
20437 language=zh variant=zh-tw
20438 !! wikitext
20439 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20440 Taiwan is China.
20441 !! html
20442 <p>(This should be stripped!)
20443 Taiwan is Taiwan.
20444 </p>
20445 !! end
20446
20447 !! test
20448 Adding explicit conversion rule for title (T flag)
20449 !! options
20450 language=zh variant=zh-tw showtitle
20451 !! wikitext
20452 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20453 !! html
20454 Taiwan
20455 <p>Should be stripped!
20456 </p>
20457 !! end
20458
20459 !! test
20460 Testing that changing the language variant here in the tests actually works
20461 !! options
20462 language=zh variant=zh showtitle
20463 !! wikitext
20464 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20465 !! html
20466 China
20467 <p>Should be stripped!
20468 </p>
20469 !! end
20470
20471 !! test
20472 Recursive conversion of alt and title attrs shouldn't clear converter state
20473 !! options
20474 language=zh variant=zh-cn showtitle
20475 !! wikitext
20476 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20477 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20478 !! html
20479 China
20480 <p>
20481 Should be stripped<span title="Exclamation">!</span>
20482 </p>
20483 !! end
20484
20485 !! test
20486 Bug 24072: more test on conversion rule for title
20487 !! options
20488 language=zh variant=zh-tw showtitle
20489 !! wikitext
20490 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20491 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20492 !! html
20493 Taiwan
20494 <p>This should be stripped!
20495 This won't take interferes with the title rule.
20496 </p>
20497 !! end
20498
20499 !! test
20500 Partly disable title conversion if variant == main language code
20501 !! options
20502 language=zh variant=zh title=[[ZH]] showtitle
20503 !! wikitext
20504 -{T|zh-cn:CN;zh-tw:TW}-
20505 !! html
20506 ZH
20507 <p>
20508 </p>
20509 !! end
20510
20511 !! test
20512 Partly disable title conversion if variant == main language code, more
20513 !! options
20514 language=zh variant=zh title=[[ZH]] showtitle
20515 !! wikitext
20516 -{T|TW}-
20517 !! html
20518 ZH
20519 <p>
20520 </p>
20521 !! end
20522
20523 !! test
20524 Raw output of variant escape tags (R flag)
20525 !! options
20526 language=zh variant=zh-tw
20527 !! wikitext
20528 Raw: -{R|zh:China;zh-tw:Taiwan}-
20529 !! html
20530 <p>Raw: zh:China;zh-tw:Taiwan
20531 </p>
20532 !! end
20533
20534 !! test
20535 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20536 !! options
20537 language=zh variant=zh-cn
20538 !! input
20539 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20540 !! result
20541 <p>0
20542 </p>
20543 !! end
20544
20545 !! test
20546 Conversion rules from [numeric-only string] to [something else] (T48634)
20547 !! options
20548 language=zh variant=zh-cn
20549 !! input
20550 -{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
20551 !! result
20552 <p>D12345EE12345
20553 </p>
20554 !! end
20555
20556 !! test
20557 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20558 !! options
20559 language=zh variant=zh-cn
20560 !! input
20561 -{H|zh-cn:foo;zh-tw:;}-foobar
20562 !! result
20563 <p>foobar
20564 </p>
20565 !! end
20566
20567 !! test
20568 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20569 !! options
20570 language=zh variant=zh-cn
20571 !! input
20572 -{H|=>zh-cn:foo;}-foobar
20573 !! result
20574 <p>foobar
20575 </p>
20576 !! end
20577
20578 !! test
20579 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20580 !! options
20581 language=zh variant=zh-cn
20582 !! input
20583 -{H|}-foobar
20584 !! result
20585 <p>foobar
20586 </p>
20587 !! end
20588
20589 !! test
20590 Nested using of manual convert syntax
20591 !! options
20592 language=zh variant=zh-hk
20593 !! wikitext
20594 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20595 !! html
20596 <p>Nested: Hello Hong Kong!
20597 </p>
20598 !! end
20599
20600 # Since Parsoid is starting to emit canonical wikitext for links,
20601 # [http://example.com http://example.com] will not RT back to that
20602 # form anymore.
20603 !! test
20604 Proper conversion of text in external links
20605 !! options
20606 language=sr variant=sr-ec
20607 parsoid=wt2html
20608 !! wikitext
20609 http://www.google.com
20610 gopher://www.google.com
20611 [http://www.google.com http://www.google.com]
20612 [gopher://www.google.com gopher://www.google.com]
20613 [https://www.google.com irc://www.google.com]
20614 [ftp://www.google.com www.google.com/ftp://dir]
20615 [//www.google.com www.google.com]
20616 !! html/php
20617 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20618 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20619 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20620 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20621 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20622 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20623 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20624 </p>
20625 !! html/parsoid
20626 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20627 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20628 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20629 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20630 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20631 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20632 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20633 !! end
20634
20635 !! test
20636 Do not convert roman numbers to language variants
20637 !! options
20638 language=sr variant=sr-ec
20639 !! wikitext
20640 Fridrih IV je car.
20641 !! html
20642 <p>Фридрих IV је цар.
20643 </p>
20644 !! end
20645
20646 !! test
20647 Unclosed language converter markup "-{"
20648 !! options
20649 language=sr
20650 !! wikitext
20651 -{T|hello
20652 !! html
20653 <p>-{T|hello
20654 </p>
20655 !! end
20656
20657 !! test
20658 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20659 !! options
20660 language=sr
20661 !! wikitext
20662 -{R|=&gt;}-
20663 !! html
20664 <p>=&gt;
20665 </p>
20666 !!end
20667
20668 !! test
20669 Don't break link parsing if language converter markup is in the caption.
20670 !! options
20671 language=sr variant=sr-ec
20672 !! wikitext
20673 [[Main Page|-{R|main page}-]]
20674 !! html
20675 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20676 </p>
20677 !! end
20678
20679 # FIXME: This test is currently broken in the PHP parser T153761
20680 !! test
20681 T146304: Don't break template parsing if language converter markup is in the parameter.
20682 !! options
20683 language=sr variant=sr-ec
20684 disabled
20685 !! wikitext
20686 {{echo|-{R|foo}-}}
20687 !! html/php
20688 <p>foo
20689 </p>
20690 !! end
20691
20692 !! test
20693 T146305: Don't break image parsing if language converter markup is in the caption.
20694 !! options
20695 language=sr
20696 !! wikitext
20697 [[File:Foobar.jpg|thumb|-{R|caption:}-]]
20698 !! html/php
20699 <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>
20700
20701 !! html/parsoid
20702 <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>
20703 !! end
20704
20705 !! test
20706 T146305: Don't break image parsing if nested language converter markup is in the caption.
20707 !! options
20708 language=zh variant=zh-cn
20709 !! wikitext
20710 [[File:Foobar.jpg|thumb|-{zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
20711 !! html/php
20712 <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>
20713
20714 !! html/parsoid
20715 <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>
20716 !! end
20717
20718 !! test
20719 Don't break gallery if language converter markup is inside.
20720 !! options
20721 language=zh
20722 !! wikitext
20723 <gallery>
20724 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
20725 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
20726 </gallery>
20727 !! html
20728 <ul class="gallery mw-gallery-traditional">
20729 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20730 <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>
20731 <div class="gallerytext">
20732 <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>
20733 </p>
20734 </div>
20735 </div></li>
20736 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20737 <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>
20738 <div class="gallerytext">
20739 <p>This is a test template
20740 </p>
20741 </div>
20742 </div></li>
20743 </ul>
20744
20745 !! end
20746
20747 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20748 !! test
20749 Don't break list handling if language converter markup is in the item.
20750 !! options
20751 language=zh variant=zh-cn
20752 !! wikitext
20753 ;-{zh-cn:AAA;zh-tw:BBB}-
20754 !! html/php
20755 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20756
20757 !! html/parsoid
20758 <dl><dt>AAA
20759 </dt></dl>
20760 !! end
20761
20762 !! test
20763 T153140: Don't break table handling if language converter markup is in the cell.
20764 !! options
20765 language=sr variant=sr-ec
20766 !! wikitext
20767 {|
20768 |-
20769 | -{R|B}-
20770 |}
20771 !! html/php
20772 <table>
20773
20774 <tr>
20775 <td> B
20776 </td></tr></table>
20777
20778 !! html/parsoid
20779 <table>
20780
20781 <tr>
20782 <td> B
20783 </td></tr></table>
20784
20785 !! end
20786
20787 !! test
20788 Bug 529: Uncovered bullet
20789 !! wikitext
20790 * Foo {{bullet}}
20791 !! html
20792 <ul><li> Foo </li>
20793 <li> Bar</li></ul>
20794
20795 !! end
20796
20797 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20798 # Templates in Wikipedia rely on this behavior, as tidy has always been
20799 # enabled there. These tests are normally run *without* tidy, so specify the
20800 # full output here.
20801 # To test realistic parsing behavior, apply a tidy-like transformation to both
20802 # the expected output and your parser's output.
20803 !! test
20804 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20805 !! wikitext
20806 ******* Foo {{bullet}}
20807 !! html
20808 <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>
20809 <li> Bar</li></ul>
20810
20811 !! end
20812
20813 !! test
20814 Bug 529: Uncovered table already at line-start
20815 !! wikitext
20816 x
20817
20818 {{table}}
20819 y
20820 !! html
20821 <p>x
20822 </p>
20823 <table>
20824 <tr>
20825 <td> 1 </td>
20826 <td> 2
20827 </td></tr>
20828 <tr>
20829 <td> 3 </td>
20830 <td> 4
20831 </td></tr></table>
20832 <p>y
20833 </p>
20834 !! end
20835
20836 !! test
20837 Bug 529: Uncovered bullet in parser function result
20838 !! wikitext
20839 * Foo {{lc:{{bullet}} }}
20840 !! html
20841 <ul><li> Foo </li>
20842 <li> bar</li></ul>
20843
20844 !! end
20845
20846 !! test
20847 Bug 5678: Double-parsed template argument
20848 !! wikitext
20849 {{lc:{{{1}}}|hello}}
20850 !! html
20851 <p>{{{1}}}
20852 </p>
20853 !! end
20854
20855 !! test
20856 Bug 5678: Double-parsed template invocation
20857 !! wikitext
20858 {{lc:{{paramtest {{!}} param = hello }} }}
20859 !! html
20860 <p>{{paramtest | param = hello }}
20861 </p>
20862 !! end
20863
20864 !! test
20865 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20866 !! options
20867 language=cs
20868 title=[[Main Page]]
20869 !! wikitext
20870 {{PRVNÍVELKÉ:ěščř}}
20871 {{prvnívelké:ěščř}}
20872 {{PRVNÍMALÉ:ěščř}}
20873 {{prvnímalé:ěščř}}
20874 {{MALÁ:ěščř}}
20875 {{malá:ěščř}}
20876 {{VELKÁ:ěščř}}
20877 {{velká:ěščř}}
20878 !! html
20879 <p>Ěščř
20880 Ěščř
20881 ěščř
20882 ěščř
20883 ěščř
20884 ěščř
20885 ĚŠČŘ
20886 ĚŠČŘ
20887 </p>
20888 !! end
20889
20890 !! test
20891 Morwen/13: Unclosed link followed by heading
20892 !! wikitext
20893 [[link
20894 ==heading==
20895 !! html
20896 <p>[[link
20897 </p>
20898 <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>
20899
20900 !! end
20901
20902 !! test
20903 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20904 !! wikitext
20905 {{foo|
20906 =heading=
20907 !! html
20908 <p>{{foo|
20909 </p>
20910 <h1><span class="mw-headline" id="heading">heading</span></h1>
20911
20912 !! end
20913
20914 !! test
20915 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20916 !! wikitext
20917 {{foo|
20918 ==heading==
20919 !! html
20920 <p>{{foo|
20921 </p>
20922 <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>
20923
20924 !! end
20925
20926 !! test
20927 Tildes in comments
20928 !! options
20929 pst
20930 !! wikitext
20931 <!-- ~~~~ -->
20932 !! html/php
20933 <!-- ~~~~ -->
20934 !! end
20935
20936 !! test
20937 Paragraphs inside divs (no extra line breaks)
20938 !! wikitext
20939 <div>Line one
20940
20941 Line two</div>
20942 !! html
20943 <div>Line one
20944 Line two</div>
20945
20946 !! end
20947
20948 !! test
20949 Paragraphs inside divs (extra line break on open)
20950 !! wikitext
20951 <div>
20952 Line one
20953
20954 Line two</div>
20955 !! html
20956 <div>
20957 <p>Line one
20958 </p>
20959 Line two</div>
20960
20961 !! end
20962
20963 !! test
20964 Paragraphs inside divs (extra line break on close)
20965 !! wikitext
20966 <div>Line one
20967
20968 Line two
20969 </div>
20970 !! html
20971 <div>Line one
20972 <p>Line two
20973 </p>
20974 </div>
20975
20976 !! end
20977
20978 !! test
20979 Paragraphs inside divs (extra line break on open and close)
20980 !! wikitext
20981 <div>
20982 Line one
20983
20984 Line two
20985 </div>
20986 !! html
20987 <div>
20988 <p>Line one
20989 </p><p>Line two
20990 </p>
20991 </div>
20992
20993 !! end
20994
20995 !! test
20996 Nesting tags, paragraphs on lines which begin with <div>
20997 !! wikitext
20998 <div></div><strong>A
20999 B</strong>
21000 !! html/php+tidy
21001 <p><strong>A</strong></p>
21002 <p><strong>B</strong></p>
21003 !! html/parsoid
21004 <div></div>
21005 <p><strong>A
21006 B</strong>
21007 </p>
21008 !! end
21009
21010 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
21011 !! test
21012 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
21013 !! wikitext
21014 <blockquote>Line one
21015
21016 Line two</blockquote>
21017 !! html
21018 <blockquote>Line one
21019 Line two</blockquote>
21020
21021 !! html+tidy
21022 <blockquote>
21023 <p>Line one Line two</p>
21024 </blockquote>
21025 !! end
21026
21027 !! test
21028 Bug 6200: paragraphs inside blockquotes (extra line break on open)
21029 !! wikitext
21030 <blockquote>
21031 Line one
21032
21033 Line two</blockquote>
21034 !! html
21035 <blockquote>
21036 <p>Line one
21037 </p>
21038 Line two</blockquote>
21039
21040 !! html+tidy
21041 <blockquote>
21042 <p>Line one</p>
21043 Line two</blockquote>
21044 !! end
21045
21046 !! test
21047 Bug 6200: paragraphs inside blockquotes (extra line break on close)
21048 !! wikitext
21049 <blockquote>Line one
21050
21051 Line two
21052 </blockquote>
21053 !! html
21054 <blockquote>Line one
21055 <p>Line two
21056 </p>
21057 </blockquote>
21058
21059 !! html+tidy
21060 <blockquote>
21061 <p>Line one</p>
21062 <p>Line two</p>
21063 </blockquote>
21064 !! end
21065
21066 !! test
21067 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
21068 !! wikitext
21069 <blockquote>
21070 Line one
21071
21072 Line two
21073 </blockquote>
21074 !! html
21075 <blockquote>
21076 <p>Line one
21077 </p><p>Line two
21078 </p>
21079 </blockquote>
21080
21081 !! html+tidy
21082 <blockquote>
21083 <p>Line one</p>
21084 <p>Line two</p>
21085 </blockquote>
21086 !! end
21087
21088 !! test
21089 Paragraphs inside blockquotes/divs (no extra line breaks)
21090 !! wikitext
21091 <blockquote><div>Line one
21092
21093 Line two</div></blockquote>
21094 !! html
21095 <blockquote><div>Line one
21096 Line two</div></blockquote>
21097
21098 !! end
21099
21100 !! test
21101 Paragraphs inside blockquotes/divs (extra line break on open)
21102 !! wikitext
21103 <blockquote><div>
21104 Line one
21105
21106 Line two</div></blockquote>
21107 !! html
21108 <blockquote><div>
21109 <p>Line one
21110 </p>
21111 Line two</div></blockquote>
21112
21113 !! end
21114
21115 !! test
21116 Paragraphs inside blockquotes/divs (extra line break on close)
21117 !! wikitext
21118 <blockquote><div>Line one
21119
21120 Line two
21121 </div></blockquote>
21122 !! html
21123 <blockquote><div>Line one
21124 <p>Line two
21125 </p>
21126 </div></blockquote>
21127
21128 !! end
21129
21130 !! test
21131 Paragraphs inside blockquotes/divs (extra line break on open and close)
21132 !! wikitext
21133 <blockquote><div>
21134 Line one
21135
21136 Line two
21137 </div></blockquote>
21138 !! html
21139 <blockquote><div>
21140 <p>Line one
21141 </p><p>Line two
21142 </p>
21143 </div></blockquote>
21144
21145 !! end
21146
21147 !! test
21148 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
21149 !! options
21150 wgLinkHolderBatchSize=0
21151 !! wikitext
21152 [[meatball:1]]
21153 [[meatball:2]]
21154 [[meatball:3]]
21155 !! html
21156 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
21157 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
21158 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
21159 </p>
21160 !! end
21161
21162 !! test
21163 Free external link invading image caption
21164 !! wikitext
21165 [[Image:Foobar.jpg|thumb|http://x|hello]]
21166 !! html
21167 <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>
21168
21169 !! end
21170
21171 !! test
21172 Bug 15196: localised external link numbers
21173 !! options
21174 language=fa
21175 !! wikitext
21176 [http://en.wikipedia.org/]
21177 !! html/php
21178 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
21179 </p>
21180 !! html/parsoid
21181 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
21182 !! end
21183
21184 !! test
21185 Multibyte character in padleft
21186 !! wikitext
21187 {{padleft:-Hello|7|Æ}}
21188 !! html
21189 <p>Æ-Hello
21190 </p>
21191 !! end
21192
21193 !! test
21194 Multibyte character in padright
21195 !! wikitext
21196 {{padright:Hello-|7|Æ}}
21197 !! html
21198 <p>Hello-Æ
21199 </p>
21200 !! end
21201
21202 !!test
21203 formatdate parser function
21204 !! wikitext
21205 {{#formatdate:2009-03-24}}
21206 !! html
21207 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
21208 </p>
21209 !! end
21210
21211 !!test
21212 formatdate parser function, with default format
21213 !! wikitext
21214 {{#formatdate:2009-03-24|mdy}}
21215 !! html
21216 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
21217 </p>
21218 !! end
21219
21220 !! test
21221 Spacing of numbers in formatted dates
21222 !! wikitext
21223 {{#formatdate:January 15}}
21224 !! html
21225 <p><span class="mw-formatted-date" title="01-15">January 15</span>
21226 </p>
21227 !! end
21228
21229 !! test
21230 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
21231 !! options
21232 language=nl title=[[MediaWiki:Common.css]]
21233 !! wikitext
21234 {{#formatdate:2009-03-24|dmy}}
21235 !! html
21236 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
21237 </p>
21238 !! end
21239
21240 #
21241 #
21242 #
21243
21244 #
21245 # Edit comments
21246 #
21247
21248 !! test
21249 Edit comment with link
21250 !! options
21251 comment
21252 !! wikitext
21253 I like the [[Main Page]] a lot
21254 !! html/php
21255 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
21256 !!end
21257
21258 !! test
21259 Edit comment with link and link text
21260 !! options
21261 comment
21262 !! wikitext
21263 I like the [[Main Page|best pages]] a lot
21264 !! html/php
21265 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21266 !!end
21267
21268 !! test
21269 Edit comment with link and link text with suffix
21270 !! options
21271 comment
21272 !! wikitext
21273 I like the [[Main Page|best page]]s a lot
21274 !! html/php
21275 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21276 !!end
21277
21278 !! test
21279 Edit comment with section link (non-local, eg in history list)
21280 !! options
21281 comment title=[[Main Page]]
21282 !! wikitext
21283 /* External links */ removed bogus entries
21284 !! html/php
21285 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21286 !!end
21287
21288 !! test
21289 Edit comment with section link and text before it (non-local, eg in history list)
21290 !! options
21291 comment title=[[Main Page]]
21292 !! wikitext
21293 pre-comment text /* External links */ removed bogus entries
21294 !! html/php
21295 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>
21296 !!end
21297
21298 !! test
21299 Edit comment with section link (local, eg in diff view)
21300 !! options
21301 comment local title=[[Main Page]]
21302 !! wikitext
21303 /* External links */ removed bogus entries
21304 !! html/php
21305 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21306 !!end
21307
21308 !! test
21309 Edit comment with subpage link (bug 14080)
21310 !! options
21311 comment
21312 subpage
21313 title=[[Subpage test]]
21314 !! wikitext
21315 Poked at a [[/subpage]] here...
21316 !! html/php
21317 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
21318 !!end
21319
21320 !! test
21321 Edit comment with subpage link and link text (bug 14080)
21322 !! options
21323 comment
21324 subpage
21325 title=[[Subpage test]]
21326 !! wikitext
21327 Poked at a [[/subpage|neat little page]] here...
21328 !! html/php
21329 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
21330 !!end
21331
21332 !! test
21333 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
21334 !! options
21335 comment
21336 title=[[Subpage test]]
21337 !! wikitext
21338 Poked at a [[/subpage]] here...
21339 !! html/php
21340 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...
21341 !!end
21342
21343 !! test
21344 Edit comment with bare anchor link (local, as on diff)
21345 !! options
21346 comment
21347 local
21348 title=[[Main Page]]
21349 !! wikitext
21350 [[#section]]
21351 !! html/php
21352 <a href="#section">#section</a>
21353 !! end
21354
21355 !! test
21356 Edit comment with bare anchor link (non-local, as on history)
21357 !! options
21358 comment
21359 title=[[Main Page]]
21360 !! wikitext
21361 [[#section]]
21362 !! html/php
21363 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
21364 !! end
21365
21366 !! test
21367 Anchor starting with underscore
21368 !! options
21369 title=[[Foo]]
21370 !! wikitext
21371 [[#_ref|One]]
21372 !! html/php
21373 <p><a href="#_ref">One</a>
21374 </p>
21375 !! html/parsoid
21376 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
21377 !! end
21378
21379 !! test
21380 Id starting with underscore
21381 !! wikitext
21382 <div id="_ref"></div>
21383 !! html/*
21384 <div id="_ref"></div>
21385
21386 !! end
21387
21388 !! test
21389 Edit comment with link with more than one pipe (T99346)
21390 !! options
21391 comment
21392 !! wikitext
21393 [[Main Page|Many|pipes]]
21394 !! html/php
21395 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
21396 !! end
21397
21398 !! test
21399 Complex edit comment with link with more than one pipe (T99346)
21400 !! options
21401 comment
21402 !! wikitext
21403 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
21404 !! html/php
21405 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;
21406 !! end
21407
21408 !! test
21409 Space normalisation on autocomment (bug 22784)
21410 !! options
21411 comment
21412 title=[[Main Page]]
21413 !! wikitext
21414 /* __hello__world__ */
21415 !! html/php
21416 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
21417 !! end
21418
21419 !! test
21420 percent-encoding and + signs in comments (Bug 26410)
21421 !! options
21422 comment
21423 !! wikitext
21424 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
21425 !! html/php
21426 <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>
21427 !! end
21428
21429 # Parsoid doesn't support this yet: see bug 73581
21430 # but it *should* omit the 'src' attribute if the image is bad.
21431 # PHP side of tests was disabled in
21432 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
21433 # because of issues in the PHP parserTests infrastructure
21434 # (but the output below is indeed what the PHP side emits)
21435 !! test
21436 Bad images - basic functionality
21437 !! wikitext
21438 [[File:Bad.jpg]]
21439 !! DISABLED/html/php
21440 !! html/parsoid
21441 <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>
21442 !! end
21443
21444 !! test
21445 Bad images - bug 16039: text after bad image disappears
21446 !! wikitext
21447 Foo bar
21448 [[File:Bad.jpg]]
21449 Bar foo
21450 !! DISABLED/html/php
21451 <p>Foo bar
21452 </p><p>Bar foo
21453 </p>
21454 !! html/parsoid
21455 <p>Foo bar
21456 <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>
21457 Bar foo</p>
21458 !! end
21459
21460 !! test
21461 Verify that displaytitle works (bug #22501) no displaytitle
21462 !! options
21463 showtitle
21464 !! config
21465 wgAllowDisplayTitle=true
21466 wgRestrictDisplayTitle=false
21467 !! wikitext
21468 this is not the the title
21469 !! html/php
21470 Parser test
21471 <p>this is not the the title
21472 </p>
21473 !! end
21474
21475 !! test
21476 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
21477 !! options
21478 showtitle
21479 title=[[Screen]]
21480 !! config
21481 wgAllowDisplayTitle=true
21482 wgRestrictDisplayTitle=false
21483 !! wikitext
21484 this is not the the title
21485 {{DISPLAYTITLE:whatever}}
21486 !! html/php
21487 whatever
21488 <p>this is not the the title
21489 </p>
21490 !! end
21491
21492 !! test
21493 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
21494 !! options
21495 showtitle
21496 title=[[Screen]]
21497 !! config
21498 wgAllowDisplayTitle=true
21499 wgRestrictDisplayTitle=true
21500 !! wikitext
21501 this is not the the title
21502 {{DISPLAYTITLE:whatever}}
21503 !! html/php
21504 Screen
21505 <p>this is not the the title
21506 </p>
21507 !! end
21508
21509 !! test
21510 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
21511 !! options
21512 showtitle
21513 title=[[Screen]]
21514 !! config
21515 wgAllowDisplayTitle=true
21516 wgRestrictDisplayTitle=true
21517 !! wikitext
21518 this is not the the title
21519 {{DISPLAYTITLE:screen}}
21520 !! html/php
21521 screen
21522 <p>this is not the the title
21523 </p>
21524 !! end
21525
21526 !! test
21527 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
21528 !! options
21529 showtitle
21530 title=[[Screen]]
21531 !! config
21532 wgAllowDisplayTitle=false
21533 !! wikitext
21534 this is not the the title
21535 {{DISPLAYTITLE:screen}}
21536 !! html/php
21537 Screen
21538 <p>this is not the the title
21539 <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>
21540 </p>
21541 !! end
21542
21543 !! test
21544 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
21545 !! options
21546 showtitle
21547 title=[[Screen]]
21548 !! config
21549 wgAllowDisplayTitle=false
21550 !! wikitext
21551 this is not the the title
21552 !! html/php
21553 Screen
21554 <p>this is not the the title
21555 </p>
21556 !! end
21557
21558 !! test
21559 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
21560 !! options
21561 showtitle
21562 title=[[Screen]]
21563 !! config
21564 wgAllowDisplayTitle=true
21565 wgRestrictDisplayTitle=true
21566 !! wikitext
21567 this is not the the title
21568 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21569 !! html/php
21570 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21571 <p>this is not the the title
21572 </p>
21573 !! end
21574
21575 !! test
21576 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
21577 !! options
21578 showtitle
21579 title=[[Screen]]
21580 !! config
21581 wgAllowDisplayTitle=true
21582 wgRestrictDisplayTitle=true
21583 !! wikitext
21584 this is not the the title
21585 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21586 !! html/php
21587 <span style="color: red;">s</span>creen
21588 <p>this is not the the title
21589 </p>
21590 !! end
21591
21592 !! test
21593 Page status indicators: Empty name is invalid
21594 !! options
21595 showindicators
21596 !! wikitext
21597 <indicator name=" "></indicator>
21598 <indicator></indicator>
21599 !! html
21600 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21601 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21602 </p>
21603 !! end
21604
21605 !! test
21606 Page status indicators: Weird syntaxes that are okay
21607 !! options
21608 showindicators
21609 !! wikitext
21610 <indicator name="empty" />
21611 <indicator name="name"></indicator>
21612 !! html
21613 empty=
21614 name=
21615 <p><br />
21616 </p>
21617 !! end
21618
21619 !! test
21620 Page status indicators: Torture test
21621 !! options
21622 showindicators
21623 !! wikitext
21624 <indicator name="01">hello world</indicator>
21625 <indicator name="02">[[Main Page]]</indicator>
21626 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21627 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21628 <indicator name="05">* foo
21629 * bar</indicator>
21630 <indicator name="06"><nowiki>foo</nowiki></indicator>
21631 <indicator name="07"> Preformatted</indicator>
21632 <indicator name="08"><div>Broken tag</indicator>
21633 <indicator name="09">{| class=wikitable
21634 | cell
21635 |}</indicator>
21636 <indicator name="10">Two
21637
21638 paragraphs</indicator>
21639 !! html
21640 01=hello world
21641 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21642 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" />
21643 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>
21644 05=<ul><li> foo</li>
21645 <li> bar</li></ul>
21646
21647 06=foo
21648 07=<pre>Preformatted
21649 </pre>
21650 08=<div>Broken tag</div>
21651
21652 09=<table class="wikitable">
21653 <tr>
21654 <td> cell
21655 </td></tr></table>
21656
21657 10=<p>Two
21658 </p><p>paragraphs
21659 </p>
21660 <p><br />
21661 </p><p><br />
21662 </p><p><br />
21663 </p><p><br />
21664 </p><p><br />
21665 </p>
21666 !! end
21667
21668 !! test
21669 preload: check <noinclude> and <includeonly>
21670 !! options
21671 preload
21672 !! wikitext
21673 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21674 !! html/php
21675 Hello kind world.
21676 !! end
21677
21678 !! test
21679 preload: check <onlyinclude>
21680 !! options
21681 preload
21682 !! wikitext
21683 Goodbye <onlyinclude>Hello world</onlyinclude>
21684 !! html/php
21685 Hello world
21686 !! end
21687
21688 !! test
21689 preload: can pass tags through if we want to
21690 !! options
21691 preload
21692 !! wikitext
21693 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21694 !! html/php
21695 <includeonly>Hello world</includeonly>
21696 !! end
21697
21698 !! test
21699 preload: check that it doesn't try to do tricks
21700 !! options
21701 preload
21702 !! wikitext
21703 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21704 !! html/php
21705 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21706 !! end
21707
21708 !! test
21709 Play a bit with r67090 and bug 3158
21710 !! wikitext
21711 <div style="width:50% !important">&nbsp;</div>
21712 <div style="width:50%&nbsp;!important">&nbsp;</div>
21713 <div style="width:50%&#160;!important">&nbsp;</div>
21714 <div style="border : solid;">&nbsp;</div>
21715 !! html/php
21716 <div style="width:50% !important">&#160;</div>
21717 <div style="width:50% !important">&#160;</div>
21718 <div style="width:50% !important">&#160;</div>
21719 <div style="border&#160;: solid;">&#160;</div>
21720
21721 !! html/parsoid
21722 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21723 <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>
21724 <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>
21725 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21726
21727 !! end
21728
21729 !! test
21730 HTML5 data attributes
21731 !! wikitext
21732 <span data-foo="bar">Baz</span>
21733 <p data-abc-def_hij="">Quuz</p>
21734 !! html/php
21735 <p><span data-foo="bar">Baz</span>
21736 </p>
21737 <p data-abc-def_hij="">Quuz</p>
21738
21739 !! html/parsoid
21740 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21741 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21742 !! end
21743
21744 !! test
21745 Strip reserved data attributes
21746 !! wikitext
21747 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21748 !! html/php
21749 <div data-ok="fred">d</div>
21750
21751 !! html/parsoid
21752 <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>
21753 !! end
21754
21755 !! test
21756 percent-encoding and + signs in internal links (Bug 26410)
21757 !! wikitext
21758 [[User:+%]] [[Page+title%]]
21759 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21760 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21761 [[%33%45]] [[%33%45+]]
21762 !! html/php
21763 <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>
21764 <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>
21765 <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>
21766 <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>
21767 </p>
21768 !! html/parsoid
21769 <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>
21770 <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>
21771 <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>
21772 <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>
21773 !! end
21774
21775 !! test
21776 Special characters in embedded file links (bug 27679)
21777 !! wikitext
21778 [[File:Contains & ampersand.jpg]]
21779 [[File:Does not exist.jpg|Title with & ampersand]]
21780 !! html/php
21781 <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>
21782 <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>
21783 </p>
21784 !! html/parsoid
21785 <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>
21786 <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>
21787 !! end
21788
21789 !! test
21790 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21791 !! wikitext
21792 Text&apos;s been normalized?
21793 !! html
21794 <p>Text&#39;s been normalized?
21795 </p>
21796 !! end
21797
21798 !! test
21799 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21800 !! wikitext
21801 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21802 !! html
21803 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21804 </p>
21805 !! end
21806
21807 !! test
21808 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21809 !! wikitext
21810 [http://www.example.org/ ideograms]
21811 !! html
21812 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21813 </p>
21814 !! end
21815
21816 !! test
21817 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21818 !! wikitext
21819 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21820 !! html
21821 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21822 </p>
21823 !! end
21824
21825 !! article
21826 Mediawiki:loop1
21827 !! text
21828 {{Identical|A}}
21829 !! endarticle
21830
21831 !! article
21832 Mediawiki:loop2
21833 !! text
21834 {{Identical|B}}
21835 !! endarticle
21836
21837 !! article
21838 Template:Identical
21839 !! text
21840 {{int:loop1}}
21841 {{int:loop2}}
21842 !! endarticle
21843
21844 !! test
21845 Bug 31098 Template which includes system messages which includes the template
21846 !! wikitext
21847 {{Identical}}
21848 !! html
21849 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21850 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21851 </p>
21852 !! end
21853
21854 !! test
21855 Bug31490 Turkish: ucfirst 'blah'
21856 !! options
21857 language=tr
21858 !! wikitext
21859 {{ucfirst:blah}}
21860 !! html
21861 <p>Blah
21862 </p>
21863 !! end
21864
21865 !! test
21866 Bug31490 Turkish: ucfirst 'ix'
21867 !! options
21868 language=tr
21869 !! wikitext
21870 {{ucfirst:ix}}
21871 !! html
21872 <p>İx
21873 </p>
21874 !! end
21875
21876 !! test
21877 Bug31490 Turkish: lcfirst 'BLAH'
21878 !! options
21879 language=tr
21880 !! wikitext
21881 {{lcfirst:BLAH}}
21882 !! html
21883 <p>bLAH
21884 </p>
21885 !! end
21886
21887 !! test
21888 Bug31490 Turkish: ucfırst (with a dotless i)
21889 !! options
21890 language=tr
21891 !! wikitext
21892 {{ucfırst:blah}}
21893 !! html
21894 <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>
21895 </p>
21896 !! end
21897
21898 !! test
21899 Bug31490 ucfırst (with a dotless i) with English language
21900 !! options
21901 language=en
21902 !! wikitext
21903 {{ucfırst:blah}}
21904 !! html
21905 <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>
21906 </p>
21907 !! end
21908
21909 !! test
21910 Bug 26375: TOC with italics
21911 !! options
21912 title=[[Main Page]]
21913 !! wikitext
21914 __TOC__
21915 == ''Lost'' episodes ==
21916 !! html
21917 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21918 <ul>
21919 <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>
21920 </ul>
21921 </div>
21922
21923 <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>
21924
21925 !! end
21926
21927 !! test
21928 Bug 26375: TOC with bold
21929 !! options
21930 title=[[Main Page]]
21931 !! wikitext
21932 __TOC__
21933 == '''should be bold''' then normal text ==
21934 !! html
21935 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21936 <ul>
21937 <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>
21938 </ul>
21939 </div>
21940
21941 <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>
21942
21943 !! end
21944
21945 !! test
21946 Bug 33845: Headings become cursive in TOC when they contain an image
21947 !! options
21948 title=[[Main Page]]
21949 !! wikitext
21950 __TOC__
21951 == Image [[Image:foobar.jpg]] ==
21952 !! html
21953 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21954 <ul>
21955 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21956 </ul>
21957 </div>
21958
21959 <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>
21960
21961 !! end
21962
21963 !! test
21964 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21965 !! options
21966 title=[[Main Page]]
21967 !! wikitext
21968 __TOC__
21969 == <blockquote>Quote</blockquote> ==
21970 !! html
21971 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21972 <ul>
21973 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21974 </ul>
21975 </div>
21976
21977 <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>
21978
21979 !! html+tidy
21980 <p></p>
21981 <div id="toc" class="toc">
21982 <div id="toctitle">
21983 <h2>Contents</h2>
21984 </div>
21985 <ul>
21986 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21987 </ul>
21988 </div>
21989 <p></p>
21990 <h2><span class="mw-headline" id="Quote"></span></h2>
21991 <blockquote>
21992 <p><span class="mw-headline" id="Quote">Quote</span></p>
21993 </blockquote>
21994 <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>
21995 !! end
21996
21997 !! test
21998 Unclosed tags in TOC
21999 !! options
22000 title=[[Main Page]]
22001 !! wikitext
22002 __TOC__
22003 == Proof: 2 < 3 ==
22004 <small>Hanc marginis exiguitas non caperet.</small>
22005 QED
22006 !! html
22007 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22008 <ul>
22009 <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>
22010 </ul>
22011 </div>
22012
22013 <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>
22014 <p><small>Hanc marginis exiguitas non caperet.</small>
22015 QED
22016 </p>
22017 !! end
22018
22019 !! test
22020 Multiple tags in TOC
22021 !! wikitext
22022 __TOC__
22023 == <i>Foo</i> <b>Bar</b> ==
22024
22025 == <i>Foo</i> <blockquote>Bar</blockquote> ==
22026 !! html
22027 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22028 <ul>
22029 <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>
22030 <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>
22031 </ul>
22032 </div>
22033
22034 <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>
22035 <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>
22036
22037 !! html+tidy
22038 <p></p>
22039 <div id="toc" class="toc">
22040 <div id="toctitle">
22041 <h2>Contents</h2>
22042 </div>
22043 <ul>
22044 <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>
22045 <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>
22046 </ul>
22047 </div>
22048 <p></p>
22049 <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>
22050 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
22051 <blockquote>
22052 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
22053 </blockquote>
22054 <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>
22055 !! end
22056
22057 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
22058 # html5 tag parsing.
22059 !! test
22060 Tags with parameters in TOC
22061 !! options
22062 parsoid=wt2html
22063 !! wikitext
22064 __TOC__
22065 == <sup class="in-h2">Hello</sup> ==
22066
22067 == <sup class="a > b">Evilbye</sup> ==
22068 !! html/php
22069 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22070 <ul>
22071 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
22072 <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>
22073 </ul>
22074 </div>
22075
22076 <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>
22077 <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>
22078
22079 !! html/parsoid
22080 <meta property="mw:PageProp/toc" />
22081 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
22082
22083 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
22084 !! end
22085
22086 !! test
22087 span tags with directionality in TOC
22088 !! wikitext
22089 __TOC__
22090 == <span dir="ltr">C++</span> ==
22091
22092 == <span dir="rtl">זבנג!</span> ==
22093
22094 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
22095
22096 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
22097
22098 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
22099 !! html
22100 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22101 <ul>
22102 <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>
22103 <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>
22104 <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>
22105 <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>
22106 <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>
22107 </ul>
22108 </div>
22109
22110 <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>
22111 <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>
22112 <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>
22113 <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>
22114 <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>
22115
22116 !! end
22117
22118 !! test
22119 Bug 72884: bdi element in ToC
22120 !! wikitext
22121 __TOC__
22122 == <bdi>test</bdi> ==
22123 !! html
22124 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22125 <ul>
22126 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
22127 </ul>
22128 </div>
22129
22130 <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>
22131
22132 !! end
22133
22134 !! test
22135 T35715: s/strike element in ToC
22136 !! wikitext
22137 __TOC__
22138 == <s>test</s> test <strike>test</strike> ==
22139 !! html
22140 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22141 <ul>
22142 <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>
22143 </ul>
22144 </div>
22145
22146 <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>
22147
22148 !! end
22149
22150 # Note that the html output does not have the <p></p>, but the
22151 # html+tidy output *does*. This is because the empty <p></p> is
22152 # removed by the sanitizer, but only when tidy is *not* enabled (!).
22153 !! test
22154 Empty <p> tag in TOC, removed by Sanitizer (T92892)
22155 !! wikitext
22156 __TOC__
22157 == x ==
22158 !! html
22159 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22160 <ul>
22161 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22162 </ul>
22163 </div>
22164
22165 <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>
22166
22167 !! html+tidy
22168 <p></p>
22169 <div id="toc" class="toc">
22170 <div id="toctitle">
22171 <h2>Contents</h2>
22172 </div>
22173 <ul>
22174 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22175 </ul>
22176 </div>
22177 <p></p>
22178 <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>
22179 !! end
22180
22181 !! article
22182 MediaWiki:Bug32057
22183 !! text
22184 == {{int:headline_sample}} ==
22185 !! endarticle
22186
22187 !! test
22188 Bug 32057: Title needed when expanding <h> nodes.
22189 !! options
22190 title=[[Main Page]]
22191 !! wikitext
22192 {{int:Bug32057}}
22193 !! html
22194 <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>
22195
22196 !! end
22197
22198 !! test
22199 Strip marker in urlencode
22200 !! wikitext
22201 {{urlencode:x<nowiki/>y}}
22202 {{urlencode:x<nowiki/>y|wiki}}
22203 {{urlencode:x<nowiki/>y|path}}
22204 {{urlencode:x<pre id="one">two</pre>y}}
22205 !! html/php
22206 <p>xy
22207 xy
22208 xy
22209 xy
22210 </p>
22211 !! end
22212
22213 !! test
22214 Strip marker in lc
22215 !! wikitext
22216 {{lc:x<nowiki/>y}}
22217 !! html
22218 <p>xy
22219 </p>
22220 !! end
22221
22222 !! test
22223 Strip marker in uc
22224 !! wikitext
22225 {{uc:x<nowiki/>y}}
22226 !! html
22227 <p>XY
22228 </p>
22229 !! end
22230
22231 !! test
22232 Strip marker in formatNum
22233 !! wikitext
22234 {{formatnum:1<nowiki/>2}}
22235 {{formatnum:1<nowiki/>2|R}}
22236 !! html
22237 <p>12
22238 12
22239 </p>
22240 !! end
22241
22242 !! test
22243 Check noCommafy in formatNum
22244 !! options
22245 language=be-tarask
22246 !! wikitext
22247 {{formatnum:123456.78}}
22248 {{formatnum:123456.78|NOSEP}}
22249 !! html
22250 <p>123 456,78
22251 123456.78
22252 </p>
22253 !! end
22254
22255 !! test
22256 Wrong option for formatNum (bug 56199)
22257 !! wikitext
22258 {{formatnum:1,234.56|Random}}
22259 {{formatnum:1,234.56|EVERYTHING}}
22260 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
22261 !! html
22262 <p>1,234.56
22263 1,234.56
22264 1,234.56
22265 </p>
22266 !! end
22267
22268 !! test
22269 Strip marker in grammar
22270 !! options
22271 language=fi
22272 !! wikitext
22273 {{grammar:elative|foo<nowiki/>bar}}
22274 !! html
22275 <p>foobarista
22276 </p>
22277 !! end
22278
22279 !! test
22280 Strip marker in padleft
22281 !! wikitext
22282 {{padleft:|2|x<nowiki/>y}}
22283 !! html
22284 <p>xy
22285 </p>
22286 !! end
22287
22288 !! test
22289 Strip marker in padright
22290 !! wikitext
22291 {{padright:|2|x<nowiki/>y}}
22292 !! html
22293 <p>xy
22294 </p>
22295 !! end
22296
22297 !! test
22298 Strip marker in anchorencode
22299 !! wikitext
22300 {{anchorencode:x<nowiki/>y}}
22301 !! html
22302 <p>xy
22303 </p>
22304 !! end
22305
22306 !! test
22307 nowiki inside link inside heading (bug 18295)
22308 !! wikitext
22309 ==[[foo|x<nowiki>y</nowiki>z]]==
22310 !! html
22311 <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>
22312
22313 !! end
22314
22315 !! test
22316 new support for bdi element (bug 31817)
22317 !! wikitext
22318 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22319 !! html
22320 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22321
22322 !!end
22323
22324 !! test
22325 Ignore pipe between table row attributes
22326 !! wikitext
22327 {|
22328 | quux
22329 |- id=foo | style='color: red'
22330 | bar
22331 |}
22332 !! html
22333 <table>
22334 <tr>
22335 <td> quux
22336 </td></tr>
22337 <tr id="foo" style="color: red">
22338 <td> bar
22339 </td></tr></table>
22340
22341 !! end
22342
22343 !!test
22344 Gallery override link with WikiLink (bug 34852)
22345 !! wikitext
22346 <gallery>
22347 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
22348 </gallery>
22349 !! html
22350 <ul class="gallery mw-gallery-traditional">
22351 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22352 <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>
22353 <div class="gallerytext">
22354 <p>caption
22355 </p>
22356 </div>
22357 </div></li>
22358 </ul>
22359
22360 !! end
22361
22362 !!test
22363 Gallery override link with absolute external link (bug 34852)
22364 !! wikitext
22365 <gallery>
22366 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
22367 </gallery>
22368 !! html
22369 <ul class="gallery mw-gallery-traditional">
22370 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22371 <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>
22372 <div class="gallerytext">
22373 <p>caption
22374 </p>
22375 </div>
22376 </div></li>
22377 </ul>
22378
22379 !! end
22380
22381 !! test
22382 Gallery override link with absolute external link with LanguageConverter
22383 !! options
22384 language=zh
22385 !! input
22386 <gallery>
22387 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
22388 </gallery>
22389 !! result
22390 <ul class="gallery mw-gallery-traditional">
22391 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22392 <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>
22393 <div class="gallerytext">
22394 <p>caption
22395 </p>
22396 </div>
22397 </div></li>
22398 </ul>
22399
22400 !! end
22401
22402 !!test
22403 Gallery override link with malicious javascript (bug 34852)
22404 !! wikitext
22405 <gallery>
22406 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
22407 </gallery>
22408 !! html
22409 <ul class="gallery mw-gallery-traditional">
22410 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22411 <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>
22412 <div class="gallerytext">
22413 <p>caption
22414 </p>
22415 </div>
22416 </div></li>
22417 </ul>
22418
22419 !! end
22420
22421 !!test
22422 Gallery with invalid title as link (bug 43964)
22423 !! wikitext
22424 <gallery>
22425 File:foobar.jpg|link=<
22426 </gallery>
22427 !! html
22428 <ul class="gallery mw-gallery-traditional">
22429 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22430 <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>
22431 <div class="gallerytext">
22432 </div>
22433 </div></li>
22434 </ul>
22435
22436 !! end
22437
22438 !!test
22439 Language parser function
22440 !! wikitext
22441 {{#language:ar}}
22442 !! html
22443 <p>العربية
22444 </p>
22445 !! end
22446
22447 !!test
22448 Padleft and padright as substr
22449 !! wikitext
22450 {{padleft:|3|abcde}}
22451 {{padright:|3|abcde}}
22452 !! html
22453 <p>abc
22454 abc
22455 </p>
22456 !! end
22457
22458 !!test
22459 Special parser function
22460 !! wikitext
22461 {{#special:RandomPage}}
22462 {{#special:BaDtItLe}}
22463 {{#special:Foobar}}
22464 !! html
22465 <p>Special:Random
22466 Special:Badtitle
22467 Special:Foobar
22468 </p>
22469 !! end
22470
22471 !!test
22472 Bug 34939 - Case insensitive link parsing ([HttP://])
22473 !! wikitext
22474 [HttP://MediaWiki.Org/]
22475 !! html/php
22476 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
22477 </p>
22478 !! html/parsoid
22479 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
22480 !! end
22481
22482 !!test
22483 Bug 34939 - Case insensitive link parsing ([HttP:// title])
22484 !! wikitext
22485 [HttP://MediaWiki.Org/ MediaWiki]
22486 !! html
22487 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22488 </p>
22489 !! end
22490
22491 !!test
22492 Bug 34939 - Case insensitive link parsing (HttP://)
22493 !! wikitext
22494 HttP://MediaWiki.Org/
22495 !! html/php
22496 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22497 </p>
22498 !! html/parsoid
22499 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22500 !! end
22501
22502 !!test
22503 Disable TOC
22504 !! options
22505 notoc
22506 !! wikitext
22507 Lead
22508 == Section 1 ==
22509 == Section 2 ==
22510 == Section 3 ==
22511 == Section 4 ==
22512 == Section 5 ==
22513 !! html
22514 <p>Lead
22515 </p>
22516
22517 <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>
22518 <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>
22519 <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>
22520 <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>
22521 <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>
22522
22523 !! end
22524
22525
22526 ###
22527 ### Parsoid-specific tests
22528 ### Parsoid-PHP parser incompatibilities
22529 ###
22530 !!test
22531 1. SOL-sensitive wikitext tokens as template-args
22532 !!options
22533 parsoid=wt2html,wt2wt
22534 !! wikitext
22535 {{echo|*a}}
22536 {{echo|#a}}
22537 {{echo|:a}}
22538 !! html
22539 <span about="#mwt1" typeof="mw:Transclusion">
22540 </span><ul about="#mwt1"><li>a</li>
22541 </ul>
22542 <span about="#mwt2" typeof="mw:Transclusion">
22543 </span><ol about="#mwt2"><li>a</li>
22544 </ol>
22545 <span about="#mwt3" typeof="mw:Transclusion">
22546 </span><dl about="#mwt3"><dd>a</dd>
22547 </dl>
22548 !!end
22549
22550 #### -----------------------------------------------------------------
22551 #### Parsoid-specific functionality tests
22552 #### -----------------------------------------------------------------
22553
22554 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
22555 # We know wt2wt will fail, but we expect selser to pass.
22556 # Due to the nature of our testing, wt2wt and selser tests will enter the
22557 # blacklist and we'll catch selser regressions based on changes to the
22558 # blacklist entries for selser tests.
22559 !! test
22560 1. Bad treebuilder fixup of formatting elt is cleaned up
22561 !! options
22562 parsoid=wt2html,wt2wt
22563 !! wikitext
22564 {|
22565 |
22566 <small>
22567 [[Image:Foobar.jpg|right|Test]]
22568 </small>
22569 |}
22570 !! html/parsoid
22571 <table>
22572 <tbody><tr><td>
22573 <small>
22574 <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>
22575 </small>
22576 </td></tr>
22577 </tbody></table>
22578 !! end
22579
22580 !! test
22581 2. Bad treebuilder fixup of formatting elt is cleaned up
22582 !! options
22583 parsoid=wt2html,wt2wt
22584 !! wikitext
22585 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22586
22587 <small>[[Image:Foobar.jpg|right|300px]]</small>
22588 !! html/parsoid
22589
22590 <p><b>foo</b></p>
22591 <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>
22592 <p><b>bar</b></p>
22593 <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>
22594 !! end
22595
22596 !! test
22597 3. Bad treebuilder fixup of formatting elt is cleaned up
22598 !! options
22599 parsoid=wt2html,wt2wt
22600 !! wikitext
22601 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22602 !! html/parsoid
22603 <p><small><b>foo</b></small></p>
22604 <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>
22605 <p><small><b>bar</b></small></p>
22606 !! end
22607
22608 !! test
22609 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22610 !! options
22611 parsoid=wt2html,wt2wt
22612 !! wikitext
22613 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22614 !! html/parsoid
22615 <p><b><small></small></b></p>
22616 <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>
22617 <p></p>
22618 !! end
22619
22620 #### ----------------------------------------------------------------
22621 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22622 #### tags. Parsoid's output for these tags differs from that of the
22623 #### PHP parser.
22624 #### ----------------------------------------------------------------
22625
22626 !!test
22627 Ref: 1. ref-location should be replaced with an index span
22628 !! wikitext
22629 A <ref>foo</ref>
22630 B <ref name="x">foo</ref>
22631 C <ref name="y" />
22632 <references />
22633 !! html/parsoid
22634 <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>
22635 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>
22636 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>
22637 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22638 <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>
22639 <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>
22640 <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>
22641 </ol>
22642 !!end
22643
22644 !!test
22645 Ref: 2. ref-tags with identical names should all get the same index
22646 !! wikitext
22647 A <ref name="x">foo</ref>
22648 B <ref name="x" />
22649 <references />
22650 !! html/parsoid
22651 <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>
22652 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>
22653 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22654 <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>
22655 </ol>
22656 !!end
22657
22658 !!test
22659 Ref: 3. spaces in ref-names should be ignored
22660 !! wikitext
22661 A <ref name="x">foo</ref>
22662 B <ref name=" x " />
22663 C <ref name= x />
22664 <references />
22665 !! html/parsoid
22666 <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>
22667 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>
22668 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>
22669 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22670 <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>
22671 </ol>
22672 !!end
22673
22674 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22675 !!test
22676 Ref: 4. 'constructor' should be accepted as a valid ref-name
22677 !! wikitext
22678 A <ref name="constructor">foo</ref>
22679 <references />
22680 !! html/parsoid
22681 <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>
22682 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22683 <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>
22684 </ol>
22685 !!end
22686
22687 !!test
22688 Ref: 5. body should accept generic wikitext
22689 !! wikitext
22690 A <ref>
22691 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22692 </ref>
22693
22694 <references />
22695 !! html/parsoid
22696 <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>
22697
22698 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22699 <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>
22700 </span></li>
22701 </ol>
22702 !!end
22703
22704 !!test
22705 Ref: 6. indent-pres should not be output in ref-body
22706 !! wikitext
22707 A <ref>
22708 foo
22709 bar
22710 baz
22711 </ref>
22712
22713 <references />
22714 !! html/parsoid
22715 <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>
22716
22717 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22718 <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
22719 bar
22720 baz
22721 </span></li>
22722 </ol>
22723 !!end
22724
22725 !!test
22726 Ref: 7. No p-wrapping in ref-body
22727 !! wikitext
22728 A <ref>
22729 foo
22730
22731 bar
22732
22733
22734 baz
22735
22736
22737
22738 booz
22739 </ref>
22740
22741 <references />
22742 !! html/parsoid
22743 <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>
22744
22745 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22746 <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
22747
22748 bar
22749
22750
22751 baz
22752
22753
22754
22755 booz
22756 </span></li>
22757 </ol>
22758 !!end
22759
22760 !!test
22761 Ref: 8. transclusion wikitext has lower precedence
22762 !! wikitext
22763 A <ref> foo {{echo|</ref> B C}}
22764
22765 <references />
22766 !! html/parsoid
22767 <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>
22768 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22769 <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>
22770 </ol>
22771 !!end
22772
22773 !!test
22774 Ref: 9. unclosed comments should not leak out of ref-body
22775 !! wikitext
22776 A <ref> foo <!--</ref> B C
22777 <references />
22778 !! html/parsoid
22779 <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>
22780 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22781 <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>
22782 </ol>
22783 !!end
22784
22785 !!test
22786 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22787 !! wikitext
22788 A <ref> <b> foo </ref> B C
22789
22790 <references />
22791 !! html/parsoid
22792 <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>
22793
22794
22795 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22796 <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>
22797 </ol>
22798 !!end
22799
22800 !!test
22801 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22802 !! wikitext
22803 A <ref>foo</ref> B
22804 C <ref>bar</ref> D
22805 <references />
22806 !! html/parsoid
22807 <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
22808 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>
22809 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22810 <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>
22811 <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>
22812 </ol>
22813 !!end
22814
22815 !!test
22816 Ref: 12. ref-tags act as trailing newline migration barrier
22817 !! wikitext
22818 <!--the newline at the end of this line moves out of the p tag-->a
22819
22820 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22821 <ref />
22822
22823 c
22824 <references />
22825 !! html/parsoid
22826 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22827
22828
22829 <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>
22830 <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>
22831
22832 <p>c</p>
22833 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22834 <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>
22835 <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>
22836 !!end
22837
22838 !!test
22839 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22840 !! wikitext
22841 <ref>foo</ref> A
22842 <ref>bar
22843 </ref> B
22844 <references />
22845 !! html/parsoid
22846 <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
22847 <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>
22848 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22849 <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>
22850 <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
22851 </span></li>
22852 </ol>
22853 !!end
22854
22855 ## Roundtripping fails because of nowiki'ing
22856 !! test
22857 Ref: 14. A nested ref-tag should be emitted as plain text
22858 !! options
22859 parsoid=wt2html
22860 !! wikitext
22861 <ref>foo <ref>bar</ref> baz</ref>
22862
22863 <references />
22864 !! html/parsoid
22865 <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>
22866
22867 <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>
22868 !! end
22869
22870 !!test
22871 Ref: 15. ref-tags with identical names should get identical indexes
22872 !! wikitext
22873 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22874 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22875
22876 <references />
22877 !! html/parsoid
22878 <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>
22879 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>
22880
22881 <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>
22882 </ol>
22883 !!end
22884
22885 ## We don't bother wt2wt-ing non-standard whitespace
22886 !!test
22887 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22888 !!options
22889 parsoid=wt2html
22890 !! wikitext
22891 A <ref >foo</ref >
22892
22893 <references />
22894 !! html/parsoid
22895 <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>
22896 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22897 <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>
22898 !!end
22899
22900 !!test
22901 Ref: 17. Generate valid HTML5 id/about attributes
22902 !!wikitext
22903 <ref name="a b">foo</ref>
22904 <ref name=":0">ve-created name</ref>
22905
22906 <references />
22907 !!html/parsoid
22908 <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>
22909 <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>
22910
22911 <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>
22912
22913 !!end
22914
22915 !!test
22916 Ref: 18. T58916: Extension attributes should be parsed as plain text
22917 !!wikitext
22918 <ref name="{{echo|a}}">foo</ref>
22919
22920 <references />
22921 !!html/parsoid
22922 <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>
22923 </p>
22924
22925 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22926 <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>
22927 </ol>
22928 !!end
22929
22930 !!test
22931 Ref: 19. ref-tags with identical name encodings should get identical indexes
22932 !! wikitext
22933 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22934
22935 <references />
22936 !! html/parsoid
22937 <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>
22938 </p>
22939 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22940 <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>
22941 </ol>
22942 !!end
22943
22944 !!test
22945 Ref: 20. ref-tags with identical names but different content should keep it
22946 !! wikitext
22947 A <ref name="foo">Foo one</ref>
22948 B <ref name="foo">Foo two</ref>
22949 C <ref name="foo" />
22950
22951 <references />
22952 !! html/parsoid
22953 <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>
22954 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>
22955 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>
22956
22957 <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>
22958 </ol>
22959 !!end
22960
22961 !!test
22962 References: 1. references tag without any refs should be handled properly
22963 !! wikitext
22964 <references />
22965 !! html/parsoid
22966 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22967 !!end
22968
22969 !!test
22970 References: 2. references tag with group only outputs references from that group
22971 !! wikitext
22972 A <ref group="a">foo</ref>
22973 B <ref group="b">bar</ref>
22974 C <ref>baz</ref>
22975
22976 <references group="a" />
22977 <references />
22978 <references group="b" />
22979 !! html/parsoid
22980 <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>
22981 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>
22982 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>
22983
22984 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22985 <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>
22986 </ol>
22987 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22988 <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>
22989 </ol>
22990 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22991 <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>
22992 </ol>
22993 !!end
22994
22995 !!test
22996 References: 3. ref list should be cleared after processing references
22997 !! wikitext
22998 A <ref>foo</ref>
22999
23000 <references />
23001
23002 B <ref>bar</ref>
23003
23004 <references />
23005 !! html/parsoid
23006 <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>
23007
23008 <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>
23009 </ol>
23010
23011 <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>
23012
23013 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
23014 <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>
23015 </ol>
23016 !!end
23017
23018 !!test
23019 References: 4. only referenced group should be cleared after processing references
23020 !! wikitext
23021 A <ref group="a">afoo</ref>
23022 B <ref>bfoo</ref>
23023
23024 <references group="a" />
23025
23026 C <ref>cfoo</ref>
23027
23028 <references />
23029 !! html/parsoid
23030 <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>
23031 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>
23032
23033 <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>
23034 </ol>
23035
23036 <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>
23037
23038 <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>
23039 </ol>
23040 !!end
23041
23042 ## Don't expect this to rt since we're dropping content
23043 !! test
23044 References: 5. ref tags in references should be processed while ignoring all other content
23045 !! options
23046 parsoid=wt2html,html2html
23047 !! wikitext
23048 A <ref name="a" />
23049 B <ref name="b">bar</ref>
23050
23051 <references>
23052 <ref name="a">foo</ref>
23053 This should just get lost.
23054 </references>
23055 !! html/parsoid
23056 <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>
23057 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>
23058
23059
23060 <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>
23061 </ol>
23062 !! end
23063
23064 !! test
23065 References: 6. <references /> from a transclusion
23066 !! wikitext
23067 <ref>Foo</ref> {{echo|<references />}}
23068 !! html/parsoid
23069 <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>
23070 </ol>
23071 !! end
23072
23073 !! test
23074 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
23075 !! wikitext
23076 A <ref>foo bar for a</ref>
23077 B <ref group="X" name="b" />
23078
23079 <references />
23080
23081 <references group="X">
23082 <ref name="b">foo</ref>
23083 </references>
23084 !! html/parsoid
23085 <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>
23086 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>
23087 </p>
23088
23089 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
23090 <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>
23091 </ol>
23092
23093 <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"}}'>
23094 <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>
23095 </ol>
23096 !! end
23097
23098 !! test
23099 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
23100 !! wikitext
23101 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
23102 <references />
23103 !! html/parsoid
23104 <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>
23105 <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>
23106 </ol>
23107 !!end
23108
23109 # This test only works in wt2html now as the <references /> are always generated
23110 # unless selser is active. Once T72722 is fixed, we should add a changes test
23111 # here to ensure that unrelated changes don't add the new <references />
23112 # when selser is active.
23113 !! test
23114 References: 9. Generate missing references list at the end
23115 !! wikitext
23116 A <ref>foo</ref>
23117 B <ref group="inexistent">bar</ref>
23118 !! html/parsoid
23119 <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>
23120 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
23121 <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>
23122 </ol>
23123 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
23124 <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>
23125 </ol>
23126 !! end
23127
23128 !! test
23129 References: 10. New <references/> shouldn't be added for unrelated edits.
23130 !! options
23131 parsoid={
23132 "modes": ["selser"],
23133 "changes": [["#x", "remove"]],
23134 "selser": "noauto"
23135 }
23136 !! wikitext
23137 Unrelated text<span id="x"> that's going to disappear</span>.
23138 A <ref>foo</ref>
23139 !! wikitext/edited
23140 Unrelated text.
23141 A <ref>foo</ref>
23142 !!end
23143
23144 !! test
23145 Entities in ref name
23146 !! wikitext
23147 <ref name="test &amp; me">hi</ref>
23148 <references />
23149 !! html/parsoid
23150 <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>
23151 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23152 <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>
23153 </ol>
23154 !! end
23155
23156 ## The output here may look funny, but it's what the php parser will do. The
23157 ## unclosed references tag becomes escaped text, and then a new references
23158 ## tag is auto-generated. The test is wt2html only because it roundtrips with
23159 ## nowiki tags, and the auto-generated references tag is only dropped in
23160 ## rtTestMode.
23161 !! test
23162 Generate references for unclosed references tag
23163 !! options
23164 parsoid=wt2html
23165 !! wikitext
23166 a<ref>foo</ref>
23167
23168 <references>
23169 !! html/parsoid
23170 <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>
23171
23172 <p>&lt;references></p>
23173 <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>
23174 !! end
23175
23176 !! test
23177 New reference serializes on its own line
23178 !! options
23179 parsoid=wt2wt,html2wt
23180 !! wikitext
23181 foo
23182 <references />
23183 !! html/parsoid
23184 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
23185 !! end
23186
23187 #### ----------------------------------------------------------------
23188 #### Parsoid-only testing of Parsoid's impl of LST
23189 #### Not implemented yet, see
23190 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
23191 #### ----------------------------------------------------------------
23192
23193 ## We still need to support serializing the older format while content is stored.
23194 !! test
23195 LST Sections: Backwards compatibility
23196 !! options
23197 parsoid={
23198 "suppressErrors": true,
23199 "modes": ["html2wt"]
23200 }
23201 !! wikitext
23202 <section begin="2011-05-16" />
23203 <section end="2014-04-10 (MW 1.23wmf22)" />
23204 !! html/parsoid
23205 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
23206 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
23207 !! end
23208
23209 ## The unconventional output is the result of `usePHPPreProcessor` being
23210 ## disabled in parserTests.js. This test is mainly just to show <section> is
23211 ## recognized as an extension tag w/o a native handler.
23212 !! test
23213 LST Sections: Newfangled approach
23214 !! options
23215 parsoid={ "suppressErrors": true }
23216 !! wikitext
23217 <section begin="2011-05-16" />
23218 <section end="2014-04-10 (MW 1.23wmf22)" />
23219 !! html/parsoid
23220 <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>
23221 <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>
23222 !! end
23223
23224 #--------- Test stripping of empty nodes in template content ----------
23225 !!test
23226 Empty LI and TR nodes should be stripped from template content
23227 !!wikitext
23228 {{EmptyLITest}}
23229 {{EmptyTRTest}}
23230 !!html/parsoid
23231 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
23232 <li>a</li>
23233 <li>b</li>
23234 </ul>
23235 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
23236 <tbody>
23237 <tr>
23238 <td>foo</td>
23239 </tr>
23240 <tr>
23241 <td>bar</td>
23242 </tr>
23243 </tbody>
23244 </table>
23245 !!end
23246
23247 !!test
23248 Empty LI and TR nodes should not be stripped from top-level content
23249 !!wikitext
23250 * a
23251 *
23252 * b
23253 {|
23254 |-
23255 |-
23256 |foo
23257 |}
23258 !!html/parsoid
23259 <ul>
23260 <li> a</li>
23261 <li></li>
23262 <li> b</li>
23263 </ul>
23264 <table>
23265 <tbody>
23266 <tr></tr>
23267 <tr>
23268 <td>foo</td>
23269 </tr>
23270 </tbody>
23271 </table>
23272 !!end
23273
23274 !!test
23275 Empty TR nodes should not be stripped if they have any attributes set
23276 !!wikitext
23277 {{EmptyTRWithHTMLAttrTest}}
23278 !!html/parsoid
23279 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
23280 <tr align="center"></tr>
23281 <tr><td>foo</td></tr>
23282 <tr align="center"></tr>
23283 <tr><td>bar</td></tr>
23284 </table>
23285 !!end
23286
23287 #### ----------------------------------------------------------------
23288 #### The following section of tests are primarily to test
23289 #### wikitext escaping capabilities of Parsoid. Given that
23290 #### escaping can be done any number of ways, the wikitext (input)
23291 #### is always adjusted to reflect how Parsoid adds nowiki
23292 #### escape tags.
23293 ####
23294 #### We are marking several tests as parsoid-only since the
23295 #### HTML in the result section is different from what the
23296 #### PHP parser generates for it.
23297 #### ----------------------------------------------------------------
23298
23299
23300 #### --------------- Headings ---------------
23301 #### 0. Unnested
23302 #### 1. Nested inside html <h1>=foo=</h1>
23303 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
23304 #### 3. Nested inside html with wikitext split by html tags
23305 #### 4. No escape needed
23306 #### 5. Empty headings <h1></h1>
23307 #### 6. Heading chars in SOL context
23308 #### ----------------------------------------
23309 !! test
23310 Headings: 0. Unnested
23311 !! options
23312 parsoid=html2wt
23313 !! html/parsoid
23314 <p>=foo=</p>
23315
23316 <p> =foo=
23317 <!--cmt-->
23318 =foo=</p>
23319
23320 <p>=foo<i>a</i>=</p>
23321 !! wikitext
23322 <nowiki>=foo=</nowiki>
23323
23324 <nowiki> </nowiki>=foo=
23325 <!--cmt-->
23326 <nowiki>=foo=</nowiki>
23327
23328 =foo''a''<nowiki>=</nowiki>
23329 !!end
23330
23331 # New headings and existing headings are handled differently
23332 !! test
23333 Headings: 1. Nested inside html
23334 !! options
23335 parsoid=html2wt
23336 !! html/parsoid
23337 <h1>=foo=</h1>
23338 <h2>=foo=</h2>
23339 <h3>=foo=</h3>
23340
23341 <h1 data-parsoid=''>=foo=</h1>
23342 <h2 data-parsoid=''>=foo=</h2>
23343 <h3 data-parsoid=''>=foo=</h3>
23344 <h4 data-parsoid=''>=foo=</h4>
23345 <h5 data-parsoid=''>=foo=</h5>
23346 <h6 data-parsoid=''>=foo=</h6>
23347 !! wikitext
23348 = =foo= =
23349
23350 == =foo= ==
23351
23352 === =foo= ===
23353
23354 =<nowiki>=foo=</nowiki>=
23355 ==<nowiki>=foo=</nowiki>==
23356 ===<nowiki>=foo=</nowiki>===
23357 ====<nowiki>=foo=</nowiki>====
23358 =====<nowiki>=foo=</nowiki>=====
23359 ======<nowiki>=foo=</nowiki>======
23360
23361 !!end
23362
23363 !! test
23364 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
23365 !! options
23366 parsoid=html2wt
23367 !! html/parsoid
23368 <h1>foo</h1>*bar
23369 <h1>foo</h1>=bar
23370 <h1>foo</h1>=bar=
23371 !! wikitext
23372 = foo =
23373 <nowiki>*</nowiki>bar
23374
23375 = foo =
23376 =bar
23377
23378 = foo =
23379 <nowiki>=bar=</nowiki>
23380 !!end
23381
23382 !! test
23383 Headings: 3. Nested inside html with wikitext split by html tags
23384 !! options
23385 parsoid=html2wt
23386 !! html/parsoid
23387 <h1>=<b>bold</b>foo=</h1>
23388 !! wikitext
23389 = ='''bold'''foo= =
23390 !!end
23391
23392 !! test
23393 Headings: 4a. No escaping needed (testing just h1 and h2)
23394 !! options
23395 parsoid=html2wt
23396 !! html/parsoid
23397 <h1>=foo</h1>
23398 <h1>foo=</h1>
23399 <h1> =foo= </h1>
23400 <h1>=foo= bar</h1>
23401 <h2>=foo</h2>
23402 <h2>foo=</h2>
23403 <h1>=</h1>
23404 <h1><i>=</i>foo=</h1>
23405 !! wikitext
23406 = =foo =
23407
23408 = foo= =
23409
23410 = =foo= =
23411
23412 = =foo= bar =
23413
23414 == =foo ==
23415
23416 == foo= ==
23417
23418 = = =
23419
23420 = ''=''foo= =
23421 !!end
23422
23423 !! test
23424 Headings: 4b. No escaping needed (inside p-tags)
23425 !! options
23426 parsoid=html2wt
23427 !! html/parsoid
23428 <p>===
23429 =foo= x
23430 =foo= <s></s>
23431 </p>
23432 !! wikitext
23433 ===
23434 =foo= x
23435 =foo= <s></s>
23436 !!end
23437
23438 !! test
23439 Headings: 5. Empty headings
23440 !! options
23441 parsoid=html2wt
23442 !! html/parsoid
23443 <h1 data-parsoid='{}'></h1>
23444
23445 <h2 data-parsoid='{}'></h2>
23446
23447 <h3 data-parsoid='{}'></h3>
23448
23449 <h4 data-parsoid='{}'></h4>
23450
23451 <h5 data-parsoid='{}'></h5>
23452
23453 <h6 data-parsoid='{}'></h6>
23454 !! wikitext
23455 =<nowiki/>=
23456
23457 ==<nowiki/>==
23458
23459 ===<nowiki/>===
23460
23461 ====<nowiki/>====
23462
23463 =====<nowiki/>=====
23464
23465 ======<nowiki/>======
23466 !!end
23467
23468 !! test
23469 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23470 !! options
23471 parsoid=html2wt
23472 !! html/parsoid
23473 <p>=a=</p>
23474
23475 <p>=a=</p>
23476
23477 <p>=a=</p>
23478 !! wikitext
23479 <nowiki>=a=</nowiki>
23480
23481 <nowiki>=a=</nowiki>
23482
23483 <nowiki>=a=</nowiki>
23484 !!end
23485
23486 !! test
23487 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23488 !! options
23489 parsoid=html2wt
23490 !! html/parsoid
23491 <p>=a=
23492 b</p>
23493
23494 <p>=a=
23495 b</p>
23496
23497 <p>=a=
23498 b</p>
23499 !! wikitext
23500 <nowiki>=a=</nowiki>
23501 b
23502
23503 <nowiki>=a=</nowiki>
23504 b
23505
23506 <nowiki>=a=</nowiki>
23507 b
23508 !!end
23509
23510 !! test
23511 Headings: 6c. Heading chars in SOL context (leading newline break)
23512 !! options
23513 parsoid=html2wt
23514 !! html/parsoid
23515 <p>a
23516 =b=</p>
23517 !! wikitext
23518 a
23519 <nowiki>=b=</nowiki>
23520 !!end
23521
23522 !! test
23523 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23524 !! options
23525 parsoid=html2wt
23526 !! html/parsoid
23527 <!--c0--><p>=a=</p>
23528
23529 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23530 !! wikitext
23531 <!--c0--><nowiki>=a=</nowiki>
23532
23533 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23534 !!end
23535
23536 !! test
23537 Headings: 6d. Heading chars in SOL context (No escaping needed)
23538 !! options
23539 parsoid=html2wt
23540 !! html/parsoid
23541 =a=<div>b</div>
23542 !! wikitext
23543 =a=<div>b</div>
23544 !!end
23545
23546 !! test
23547 Headings: 7. Insert a newline between new content and headings
23548 !! options
23549 parsoid=html2wt
23550 !! html/parsoid
23551 <h2>NEW</h2>
23552 <p>new</p>
23553 <h2 data-parsoid='{}'>A</h2>
23554 <p data-parsoid='{}'>a</p>
23555 !! wikitext
23556 == NEW ==
23557 new
23558
23559 ==A==
23560 a
23561
23562 !! end
23563
23564 #### --------------- Lists ---------------
23565 #### 0. Outside nests (*foo, etc.)
23566 #### 1. Nested inside html <ul><li>*foo</li></ul>
23567 #### 2. Inside definition lists
23568 #### 3. Only bullets at start should be escaped
23569 #### 4. No escapes needed
23570 #### 5. No unnecessary escapes
23571 #### 6. Escape bullets in SOL position
23572 #### 7. Escape bullets in a multi-line context
23573 #### ----------------------------------------
23574
23575 !! test
23576 Lists: 0. Outside nests
23577 !! options
23578 parsoid=html2wt
23579 !! html/parsoid
23580 <p>*foo</p>
23581
23582 <p>#foo</p>
23583
23584 <p>;Foo:bar</p>
23585 !! wikitext
23586 <nowiki>*</nowiki>foo
23587
23588 <nowiki>#</nowiki>foo
23589
23590 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23591 !!end
23592
23593 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23594 ## to test wikitext escaping, and insignificant whitespace diffs
23595 ## cause PHP parser tests to barf
23596 !! test
23597 Lists: 1. Nested inside html (No unnecessary escapes)
23598 !! options
23599 parsoid=html2wt
23600 !! html/parsoid
23601 <ul>
23602 <li>*foo</li>
23603 <li>#foo</li>
23604 <li>:foo</li>
23605 <li>;foo</li>
23606 <li data-parsoid='{}'>*foo</li>
23607 <li data-parsoid='{}'>#foo</li>
23608 <li data-parsoid='{}'>:foo</li>
23609 <li data-parsoid='{}'>;foo</li>
23610 </ul>
23611
23612 <ol>
23613 <li>*foo</li>
23614 <li>#foo</li>
23615 <li>:foo</li>
23616 <li>;foo</li>
23617 <li data-parsoid='{}'>*foo</li>
23618 <li data-parsoid='{}'>#foo</li>
23619 <li data-parsoid='{}'>:foo</li>
23620 <li data-parsoid='{}'>;foo</li>
23621 </ol>
23622 !! wikitext
23623 * *foo
23624 * #foo
23625 * :foo
23626 * ;foo
23627 *<nowiki>*foo</nowiki>
23628 *<nowiki>#foo</nowiki>
23629 *<nowiki>:foo</nowiki>
23630 *<nowiki>;foo</nowiki>
23631
23632 # *foo
23633 # #foo
23634 # :foo
23635 # ;foo
23636 #<nowiki>*foo</nowiki>
23637 #<nowiki>#foo</nowiki>
23638 #<nowiki>:foo</nowiki>
23639 #<nowiki>;foo</nowiki>
23640 !!end
23641
23642 !! test
23643 Lists: 2. Inside definition lists
23644 !! options
23645 parsoid=html2wt
23646 !! html/parsoid
23647 <dl><dt>;foo</dt></dl>
23648 <dl><dt>:foo</dt></dl>
23649 <dl><dt>:foo</dt>
23650 <dd>bar</dd></dl>
23651 <dl><dd>:foo</dd></dl>
23652 !! wikitext
23653 ; ;foo
23654
23655 ; <nowiki>:foo</nowiki>
23656
23657 ; <nowiki>:foo</nowiki>
23658 : bar
23659
23660 : :foo
23661 !!end
23662
23663 !! test
23664 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23665 !! options
23666 parsoid=html2wt
23667 !! html/parsoid
23668 <ul>
23669 <li>*foo*bar</li>
23670 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23671 </ul>
23672 !! wikitext
23673 * *foo*bar
23674 *<nowiki>*foo</nowiki>''it''*bar
23675 !!end
23676
23677 !! test
23678 Lists: 4. No escapes needed
23679 !! options
23680 parsoid=html2wt
23681 !! html/parsoid
23682 <ul>
23683 <li>foo*bar
23684 </li>
23685 </ul>
23686 <ul>
23687 <li><i>foo</i>*bar
23688 </li>
23689 </ul>
23690 <ul>
23691 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23692 </li>
23693 </ul>
23694 <ul>
23695 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23696 </li>
23697 </ul>
23698 !! wikitext
23699 *foo*bar
23700
23701 *''foo''*bar
23702
23703 *[[Foo]]: bar
23704
23705 *[[Foo]]*bar
23706 !!end
23707
23708 !! test
23709 Lists: 5. No unnecessary escapes
23710 !! options
23711 parsoid=html2wt
23712 !! html/parsoid
23713 <ul><li> bar <span>[[foo]]</span></li></ul>
23714 <ul><li> =bar <span>[[foo]]</span></li></ul>
23715 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23716 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23717 <ul><li> =bar <span>foo]]</span>=</li></ul>
23718 <ul><li> <s></s>: a</li></ul>
23719 <ul><li> <i>* foo</i></li></ul>
23720
23721 !! wikitext
23722 * bar <span><nowiki>[[foo]]</nowiki></span>
23723
23724 * =bar <span><nowiki>[[foo]]</nowiki></span>
23725
23726 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23727
23728 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23729
23730 * =bar <span>foo]]</span>=
23731
23732 * <s></s>: a
23733
23734 * ''* foo''
23735 !!end
23736
23737 !! test
23738 Lists: 6. Escape bullets in SOL position
23739 !! options
23740 parsoid=html2wt
23741 !! html/parsoid
23742 <p><!--cmt-->*foo</p>
23743 !! wikitext
23744 <!--cmt--><nowiki>*</nowiki>foo
23745 !!end
23746
23747 !! test
23748 Lists: 7. Escape bullets in a multi-line context
23749 !! options
23750 parsoid=html2wt
23751 !! html/parsoid
23752 <p>a
23753 *b
23754 </p>
23755 !! wikitext
23756 a
23757 <nowiki>*</nowiki>b
23758 !!end
23759
23760 !! test
23761 Lists: 8. Escape colons only if not present in tags
23762 !! options
23763 parsoid=html2wt
23764 !! html/parsoid
23765 <dl><dt>a:b<i>c:d</i></dt></dl>
23766 !! wikitext
23767 ; <nowiki>a:b</nowiki>''c:d''
23768 !! end
23769
23770 #### --------------- HRs ---------------
23771 #### 1. Single line
23772 #### -----------------------------------
23773
23774 !! test
23775 HRs: 1. Single line
23776 !! options
23777 parsoid=html2wt
23778 !! html/parsoid
23779 <hr />----
23780 <hr />=foo=
23781 <hr />*foo
23782 !! wikitext
23783 ----<nowiki>----</nowiki>
23784 ----=foo=
23785 ----*foo
23786 !! end
23787
23788 #### --------------- Tables ---------------
23789 #### 1a. Simple example
23790 #### 1b. No escaping needed (!foo)
23791 #### 1c. No escaping needed (|foo)
23792 #### 1d. No escaping needed (|}foo)
23793 ####
23794 #### 2a. Nested in td (<td>foo|bar</td>)
23795 #### 2b. Nested in td (<td>foo||bar</td>)
23796 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23797 ####
23798 #### 3a. Nested in th (<th>foo!bar</th>)
23799 #### 3b. Nested in th (<th>foo!!bar</th>)
23800 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23801 ####
23802 #### 4a. Escape -
23803 #### 4b. Escape +
23804 #### 4c. No escaping needed
23805 #### --------------------------------------
23806
23807 !! test
23808 Tables: 1a. Simple example
23809 !! options
23810 parsoid=html2wt
23811 !! html/parsoid
23812 <p>{|
23813 |}
23814 </p>
23815 !! wikitext
23816 <nowiki>{|</nowiki>
23817 |}
23818 !! end
23819
23820 !! test
23821 Tables: 1b. No escaping needed
23822 !! options
23823 parsoid=html2wt
23824 !! html/parsoid
23825 <p>!foo
23826 </p>
23827 !! wikitext
23828 !foo
23829 !! end
23830
23831 !! test
23832 Tables: 1c. No escaping needed
23833 !! options
23834 parsoid=html2wt
23835 !! html/parsoid
23836 <p>|foo
23837 </p>
23838 !! wikitext
23839 |foo
23840 !! end
23841
23842 !! test
23843 Tables: 1d. No escaping needed
23844 !! options
23845 parsoid=html2wt
23846 !! html/parsoid
23847 <p>|}foo
23848 </p>
23849 !! wikitext
23850 |}foo
23851 !! end
23852
23853 !! test
23854 Tables: 2a. Nested in td
23855 !! options
23856 parsoid=html2wt
23857 !! html/parsoid
23858 <table><tbody><tr>
23859 <td>foo|bar</td></tr>
23860 <tr><td>x<div>a|b</div></td>
23861 </tbody></table>
23862 !! wikitext
23863 {|
23864 |<nowiki>foo|bar</nowiki>
23865 |-
23866 |x<div><nowiki>a|b</nowiki></div>
23867 |}
23868 !! html/php+tidy
23869 <table>
23870 <tr>
23871 <td>foo|bar</td>
23872 </tr>
23873 <tr>
23874 <td>x
23875 <div>a|b</div>
23876 </td>
23877 </tr>
23878 </table>
23879 !! end
23880
23881 !! test
23882 Tables: 2b. Nested in td
23883 !! options
23884 parsoid=html2wt
23885 !! html/parsoid
23886 <table><tbody><tr>
23887 <td>foo||bar</td>
23888 <td>a<i>b||c</i></td>
23889 <td>a<i><div>b||c</div></i></td>
23890 </tr></tbody></table>
23891 !! wikitext
23892 {|
23893 |<nowiki>foo||bar</nowiki>
23894 |a''<nowiki>b||c</nowiki>''
23895 |a''<div><nowiki>b||c</nowiki></div>''
23896 |}
23897 !! html/php
23898 <table>
23899 <tr>
23900 <td>foo||bar
23901 </td>
23902 <td>a<i>b||c</i>
23903 </td>
23904 <td>a<i><div>b||c</div></i>
23905 </td></tr></table>
23906
23907 !! end
23908
23909 !! test
23910 Tables: 2c. Nested in td -- no escaping needed
23911 !! options
23912 parsoid=html2wt
23913 !! html/*
23914 <table>
23915 <tr>
23916 <td>foo!!bar
23917 </td></tr></table>
23918
23919 !! wikitext
23920 {|
23921 |foo!!bar
23922 |}
23923 !! end
23924
23925 !! test
23926 Tables: 3a. Nested in th
23927 !! options
23928 parsoid=html2wt
23929 !! html/*
23930 <table>
23931 <tr>
23932 <th>foo!bar
23933 </th></tr></table>
23934
23935 !! wikitext
23936 {|
23937 !foo!bar
23938 |}
23939 !! end
23940
23941 !! test
23942 Tables: 3b. Nested in th
23943 !! options
23944 parsoid=html2wt
23945 !! html/parsoid
23946 <table><tbody>
23947 <tr><th>foo!!bar</th>
23948 <th><i>foo|bar</i></th>
23949 <th><i>foo!!bar</i></th>
23950 <th><i><span>foo!!bar</span></i></th>
23951 </tr></tbody></table>
23952 !! wikitext
23953 {|
23954 !<nowiki>foo!!bar</nowiki>
23955 !''<nowiki>foo|bar</nowiki>''
23956 !''<nowiki>foo!!bar</nowiki>''
23957 !''<span><nowiki>foo!!bar</nowiki></span>''
23958 |}
23959 !! html/php
23960 <table>
23961 <tr>
23962 <th>foo!!bar
23963 </th>
23964 <th><i>foo|bar</i>
23965 </th>
23966 <th><i>foo!!bar</i>
23967 </th>
23968 <th><i><span>foo!!bar</span></i>
23969 </th></tr></table>
23970
23971 !! end
23972
23973 !! test
23974 Tables: 3c. Nested in th
23975 !! options
23976 parsoid=html2wt
23977 !! html/parsoid
23978 <table><tbody>
23979 <tr><th>foo||bar</th>
23980 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23981 </tr></tbody></table>
23982 !! wikitext
23983 {|
23984 !<nowiki>foo||bar</nowiki>
23985 !<nowiki>foo||bar</nowiki>
23986 |}
23987 !! html/php
23988 <table>
23989 <tr>
23990 <th>foo||bar
23991 </th>
23992 <th>foo||bar
23993 </th></tr></table>
23994
23995 !! end
23996
23997 !! test
23998 Tables: 4a. Escape -
23999 !! options
24000 parsoid=html2wt
24001 !! html/*
24002 <table>
24003 <tr>
24004 <th>-bar
24005 </th></tr>
24006 <tr>
24007 <td>-bar
24008 </td></tr></table>
24009
24010 !! wikitext
24011 {|
24012 !-bar
24013 |-
24014 |<nowiki>-bar</nowiki>
24015 |}
24016 !! end
24017
24018 !! test
24019 Tables: 4b. Escape +
24020 !! options
24021 parsoid=html2wt
24022 !! html/*
24023 <table>
24024 <tr>
24025 <th>+bar
24026 </th></tr>
24027 <tr>
24028 <td>+bar
24029 </td></tr></table>
24030
24031 !! wikitext
24032 {|
24033 !+bar
24034 |-
24035 |<nowiki>+bar</nowiki>
24036 |}
24037 !! end
24038
24039 !! test
24040 Tables: 4c. No escaping needed
24041 !! options
24042 parsoid=html2wt
24043 !! html/parsoid
24044 <table><tbody>
24045 <tr><td>foo-bar</td><td>foo+bar</td></tr>
24046 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
24047 <tr><td>foo
24048 <p>bar|baz
24049 +bar
24050 -bar</p></td></tr>
24051 <tr><td>x
24052 <div>a|b</div></td>
24053 </tbody></table>
24054 !! wikitext
24055 {|
24056 |foo-bar
24057 |foo+bar
24058 |-
24059 |''foo''-bar
24060 |''foo''+bar
24061 |-
24062 |foo
24063 bar|baz
24064 +bar
24065 -bar
24066 |-
24067 |x
24068 <div>a|b</div>
24069 |}
24070 !! html/php
24071 <table>
24072 <tr>
24073 <td>foo-bar
24074 </td>
24075 <td>foo+bar
24076 </td></tr>
24077 <tr>
24078 <td><i>foo</i>-bar
24079 </td>
24080 <td><i>foo</i>+bar
24081 </td></tr>
24082 <tr>
24083 <td>foo
24084 <p>bar|baz
24085 +bar
24086 -bar
24087 </p>
24088 </td></tr>
24089 <tr>
24090 <td>x
24091 <div>a|b</div>
24092 </td></tr></table>
24093
24094 !! end
24095
24096 !! test
24097 Tables: 4d. No escaping needed
24098 !! options
24099 parsoid=html2wt
24100 !! html/parsoid
24101 <table>
24102 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
24103 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
24104 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
24105 </tbody></table>
24106 !! wikitext
24107 {|
24108 |[[Foo]]-bar
24109 ||+1
24110 ||-2
24111 |}
24112 !! html/php
24113 <table>
24114 <tr>
24115 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
24116 </td>
24117 <td>+1
24118 </td>
24119 <td>-2
24120 </td></tr></table>
24121
24122 !! end
24123
24124 !! test
24125 T97430: Don't emit empty nowiki pairs around marker meta tags
24126 !! options
24127 parsoid=html2wt
24128 !! html/parsoid
24129 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24130 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
24131 !! wikitext
24132 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24133 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
24134 !! end
24135
24136 !! test
24137 Unclosed xmlish element in table line shouldn't eat end delimiters
24138 !! options
24139 parsoid=html2wt
24140 !! html/parsoid
24141 <table>
24142 <tbody><tr><td> &lt;foo</td>
24143 <td> bar></td></tr>
24144 </tbody></table>
24145 !! wikitext
24146 {|
24147 | <foo
24148 | bar>
24149 |}
24150 !! html/php
24151 <table>
24152 <tr>
24153 <td> &lt;foo
24154 </td>
24155 <td> bar&gt;
24156 </td></tr></table>
24157
24158 !! end
24159
24160 #### --------------- Links ----------------
24161 #### 1. Quote marks in link text
24162 #### 2. Wikilinks: Escapes needed
24163 #### 3. Wikilinks: No escapes needed
24164 #### 4. Extlinks: Escapes needed
24165 #### 5. Extlinks: No escapes needed
24166 #### --------------------------------------
24167 !! test
24168 Links 1. WikiLinks: No escapes needed
24169 !! options
24170 parsoid=html2wt
24171 !! html/parsoid
24172 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
24173 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
24174 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
24175 !! wikitext
24176 [[Foo|Foo''boo'']]
24177 [[Foo|[Foobar]]]
24178 [[Foo|x [Foobar] x]]
24179 !! html/php
24180 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
24181 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
24182 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
24183 </p>
24184 !! end
24185
24186 !! test
24187 Links 2. WikiLinks: Escapes needed
24188 !! options
24189 parsoid=html2wt
24190 !! html/parsoid
24191 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
24192 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
24193 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
24194 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
24195 <a href="Foo" rel="mw:WikiLink">|Bar</a>
24196 <a href="Foo" rel="mw:WikiLink">]]bar</a>
24197 <a href="Foo" rel="mw:WikiLink">[[bar</a>
24198 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
24199 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
24200 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
24201 !! wikitext
24202 [[Foo|<nowiki>Foobar]</nowiki>]]
24203 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
24204 [[Foo|<nowiki>[[Bar]]</nowiki>]]
24205 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
24206 [[Foo|<nowiki>|Bar</nowiki>]]
24207 [[Foo|<nowiki>]]bar</nowiki>]]
24208 [[Foo|<nowiki>[[bar</nowiki>]]
24209 [[Foo|<nowiki>x [[ y</nowiki>]]
24210 [[Foo|<nowiki>x ]] y</nowiki>]]
24211 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
24212 !! html/php
24213 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
24214 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
24215 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
24216 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
24217 <a href="/wiki/Foo" title="Foo">|Bar</a>
24218 <a href="/wiki/Foo" title="Foo">]]bar</a>
24219 <a href="/wiki/Foo" title="Foo">[[bar</a>
24220 <a href="/wiki/Foo" title="Foo">x [[ y</a>
24221 <a href="/wiki/Foo" title="Foo">x ]] y</a>
24222 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
24223 </p>
24224 !! end
24225
24226 !! test
24227 Links 3. WikiLinks: No escapes needed
24228 !! options
24229 parsoid=html2wt
24230 !! html/parsoid
24231 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
24232 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
24233 !! wikitext
24234 [[Foo|[Foobar]]
24235 [[Foo|foo|bar]]
24236 !! html/php
24237 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
24238 <a href="/wiki/Foo" title="Foo">foo|bar</a>
24239 </p>
24240 !! end
24241
24242 !! test
24243 Links 4. ExtLinks: Escapes needed
24244 !! options
24245 parsoid=html2wt
24246 !! html/parsoid
24247 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
24248 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
24249 <p>[http://google.com]</p>
24250 <p>[http://google.com google]</p>
24251 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
24252 <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>
24253 !! wikitext
24254 [http://google.com <nowiki>[google]</nowiki>]
24255 [http://google.com <nowiki>google]</nowiki>]
24256
24257 <nowiki>[http://google.com]</nowiki>
24258
24259 <nowiki>[http://google.com google]</nowiki>
24260
24261 [http://google.com<nowiki>]</nowiki>
24262
24263 [{{echo|http://google.com}}<nowiki>]</nowiki>
24264 !! html/php
24265 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
24266 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
24267 </p><p>[http://google.com]
24268 </p><p>[http://google.com google]
24269 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24270 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24271 </p>
24272 !! end
24273
24274 !! test
24275 Links 5. ExtLinks: No escapes needed
24276 !! options
24277 parsoid=html2wt
24278 !! html/parsoid
24279 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
24280 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
24281 !! wikitext
24282 [http://google.com [google]
24283
24284 [[http://google.com]]
24285 !! html/php
24286 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
24287 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
24288 </p>
24289 !! end
24290
24291 !! test
24292 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
24293 !! options
24294 parsoid=html2wt
24295 !! html/parsoid
24296 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
24297 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
24298 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
24299 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
24300 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
24301 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
24302 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24303 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
24304 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24305 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
24306 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
24307 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
24308 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
24309 </p>
24310 !! wikitext
24311 x<nowiki/>http://example.com<nowiki/>y
24312 http://example.com<nowiki/>?x
24313 http://example.com<nowiki/>&x
24314 http://example.com<nowiki/>'x
24315 http://example.com<nowiki/>,x
24316 http://example.com<nowiki/>.x
24317 http://example.com<nowiki/>;x
24318 http://example.com<nowiki/>:x
24319 http://example.com<nowiki/>;x
24320 http://example.com<nowiki/>!x
24321 http://example.com<nowiki/>=x
24322 http://example.com<nowiki/>(x)
24323 http://example.com(x<nowiki/>)
24324 !! end
24325
24326 !! test
24327 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24328 !! options
24329 parsoid=html2wt
24330 !! html/parsoid
24331 <p>x
24332 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
24333 y
24334 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
24335 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
24336 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
24337 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
24338 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
24339 </p>
24340 !! wikitext
24341 x
24342 http://example.com
24343 y
24344 "http://example.com"
24345 (http://example.com)
24346 (http://example.com) foo
24347 http://example.com,
24348 http://example.com, foo
24349 !! html/php
24350 <p>x
24351 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
24352 y
24353 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
24354 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
24355 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
24356 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
24357 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
24358 </p>
24359 !! end
24360
24361 !! test
24362 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24363 !! options
24364 parsoid=html2wt
24365 !! html/parsoid
24366 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
24367 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
24368 !! wikitext
24369 http://example.com.,;:!?\
24370 -http://example.com:
24371 !! html/php
24372 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
24373 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
24374 </p>
24375 !! end
24376
24377 !! test
24378 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
24379 !! options
24380 parsoid=html2wt
24381 !! html/parsoid
24382 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
24383 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
24384 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
24385 !! wikitext
24386 RFC 123<nowiki/>4
24387 RFC 123<nowiki/>y
24388 X<nowiki/>RFC 123<nowiki/>y
24389 !! end
24390
24391 !! test
24392 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
24393 !! options
24394 parsoid=html2wt
24395 !! html/parsoid
24396 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24397 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24398 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24399 </p>
24400 !! wikitext
24401 RFC 123?foo
24402 RFC 123&foo
24403 -RFC 123-
24404 !! html/php
24405 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24406 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24407 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24408 </p>
24409 !! end
24410
24411 !! test
24412 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
24413 !! options
24414 parsoid=html2wt
24415 !! html/parsoid
24416 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24417 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24418 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24419 !! wikitext
24420 PMID 123<nowiki/>4
24421 PMID 123<nowiki/>y
24422 X<nowiki/>PMID 123<nowiki/>y
24423 !! end
24424
24425 !! test
24426 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
24427 !! options
24428 parsoid=html2wt
24429 !! html/parsoid
24430 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24431 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24432 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24433 </p>
24434 !! wikitext
24435 PMID 123?foo
24436 PMID 123&foo
24437 -PMID 123-
24438 !! html/php
24439 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24440 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24441 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24442 </p>
24443 !! end
24444
24445 !! test
24446 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
24447 !! options
24448 parsoid=html2wt
24449 !! html/parsoid
24450 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24451 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24452 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24453 </p>
24454 !! wikitext
24455 ISBN 1234567890<nowiki/>1
24456 ISBN 1234567890<nowiki/>x
24457 a<nowiki/>ISBN 1234567890<nowiki/>b
24458 !! end
24459
24460 !! test
24461 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
24462 !! options
24463 parsoid=html2wt
24464 !! html/parsoid
24465 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24466 !! wikitext
24467 -ISBN 1234567890's
24468 !! html/php
24469 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24470 </p>
24471 !! end
24472
24473 !! test
24474 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24475 !! options
24476 parsoid=html2wt
24477 !! html/*
24478 <p>this is not a link: http://example.com
24479 </p>
24480 !! wikitext
24481 this is not a link: <nowiki>http://example.com</nowiki>
24482 !! end
24483
24484 !! test
24485 Links 15. Link trails can't become link prefixes.
24486 !! options
24487 language=is
24488 parsoid=html2wt
24489 !! html/parsoid
24490 <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>
24491 !! wikitext
24492 [[Söfnuður]]-[[00]]
24493 !! html/php
24494 <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>
24495 </p>
24496 !! end
24497
24498 #### --------------- Quotes ---------------
24499 #### 1. Quotes inside <b> and <i>
24500 #### 2. Link fragments separated by <i> and <b> tags
24501 #### 3. Link fragments inside <i> and <b>
24502 #### 4. No escaping needed
24503 #### --------------------------------------
24504 !! test
24505 1a. Quotes inside <b> and <i>
24506 !! options
24507 parsoid=html2wt
24508 !! html/*
24509 <p><i>'foo'</i>
24510 <i>''foo''</i>
24511 <i>'''foo'''</i>
24512 <i>foo</i>'s
24513 <b>'foo'</b>
24514 <b>''foo''</b>
24515 <b>'''foo'''</b>
24516 <b>foo'<i>bar'</i>baz</b>
24517 <b>foo</b>'s
24518 '<i>foo</i>
24519 <i>foo</i>'
24520 <i>foo'</i>'
24521 '<i>foo</i>'
24522 '<b>foo</b>
24523 <b>foo</b>'
24524 '<b>foo</b>'
24525 <i>fools'<span> errand</span></i>
24526 <i><span>fool</span>'s errand</i>
24527 '<i>foo</i> bar '<i>baz</i>
24528 a|!*#-:;+-~[]{}b'<i>x</i>
24529 </p>
24530 !! wikitext
24531 ''<nowiki/>'foo'''
24532 ''<nowiki>''foo''</nowiki>''
24533 ''<nowiki>'''foo'''</nowiki>''
24534 ''foo''<nowiki/>'s
24535 '''<nowiki/>'foo''''
24536 '''<nowiki>''foo''</nowiki>'''
24537 '''<nowiki>'''foo'''</nowiki>'''
24538 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24539 '''foo'''<nowiki/>'s
24540 '''foo''
24541 ''foo''<nowiki/>'
24542 ''foo'''<nowiki/>'
24543 '''foo''<nowiki/>'
24544 ''''foo'''
24545 '''foo'''<nowiki/>'
24546 ''''foo'''<nowiki/>'
24547 ''fools'<span> errand</span>''
24548 ''<span>fool</span>'s errand''
24549 '<nowiki/>''foo'' bar '''baz''
24550 a|!*#-:;+-~[]{}b'''x''
24551 !! end
24552
24553 !! test
24554 1b. Quotes inside <b> and <i> with other tags on same line
24555 !! options
24556 parsoid=html2wt
24557 !! html/parsoid
24558 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24559 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24560 <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>
24561 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24562 '<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>
24563 '<i>foo</i> <div title="name">test</div>
24564 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24565 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24566 <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>
24567 </ol>
24568 !! wikitext
24569 '''a'' foo ''[[bar]]''
24570 ''a''' foo ''[[bar]]''
24571 ''a''' foo '''{{echo|[[bar]]}}'''
24572 [[foo]] x'''[[bar]]''
24573 '''foo'' <ref>test</ref>
24574 '''foo'' <div title="name">test</div>
24575 '''foo'' and <br> bar
24576 <references />
24577 !! end
24578
24579 !! test
24580 2. Link fragments separated by <i> and <b> tags
24581 !! options
24582 parsoid=html2wt
24583 !! html/parsoid
24584 <p>[[<i>foo</i>hello]]</p>
24585 <p>[[<b>foo</b>hello]]</p>
24586 !! wikitext
24587 [[''foo''<nowiki>hello]]</nowiki>
24588
24589 [['''foo'''<nowiki>hello]]</nowiki>
24590 !! end
24591
24592 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24593 # this is one of the shortcomings of this format
24594 !! test
24595 3. Link fragments inside <i> and <b>
24596 !! options
24597 parsoid=html2wt
24598 !! html/parsoid
24599 <p><i>[[foo</i>]]</p>
24600 <p><b>[[foo</b>]]</p>
24601 !! wikitext
24602 ''[[foo''<nowiki>]]</nowiki>
24603
24604 '''[[foo'''<nowiki>]]</nowiki>
24605 !! end
24606
24607 !! test
24608 4. No escaping needed
24609 !! options
24610 options=html2wt
24611 !! html/parsoid
24612 <p>'<span><i>bar</i></span>'
24613 '<span><b>bar</b></span>'
24614 'a:b'foo
24615 </p>
24616 !! wikitext
24617 '<span>''bar''</span>'
24618 '<span>'''bar'''</span>'
24619 'a:b'foo
24620 !! end
24621
24622 #### ----------- Paragraphs ---------------
24623 #### 1. No unnecessary escapes
24624 #### --------------------------------------
24625
24626 !! test
24627 1. No unnecessary escapes
24628 !! options
24629 parsoid=html2wt
24630 !! html/parsoid
24631 <p>bar <span>[[foo]]</span>
24632 </p><p>=bar <span>[[foo]]</span>
24633 </p><p>[[bar <span>[[foo]]</span>
24634 </p><p>]]bar <span>[[foo]]</span>
24635 </p><p>=bar <span>foo]]</span>=
24636 </p>
24637 !! wikitext
24638 bar <span><nowiki>[[foo]]</nowiki></span>
24639
24640 =bar <span><nowiki>[[foo]]</nowiki></span>
24641
24642 [[bar <span><nowiki>[[foo]]</nowiki></span>
24643
24644 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24645
24646 =bar <span>foo]]</span><nowiki>=</nowiki>
24647 !!end
24648
24649 #### ----------------------- PRE --------------------------
24650 #### 1. Leading whitespace in SOL context should be escaped
24651 #### ------------------------------------------------------
24652 !! test
24653 1. Leading whitespace in SOL context should be escaped
24654 !! options
24655 parsoid=html2wt
24656 !! html/parsoid
24657 <p> a</p>
24658
24659 <p> a</p>
24660
24661 <p> a(tab)</p>
24662
24663 <p> a
24664 <!--cmt-->
24665 a</p>
24666
24667 <p>a
24668 b</p>
24669
24670 <p>a
24671 b</p>
24672
24673 <p>a
24674 b</p>
24675 !! wikitext
24676 <nowiki> </nowiki>a
24677
24678 <nowiki> </nowiki> a
24679
24680 a(tab)
24681
24682 <nowiki> </nowiki> a
24683 <!--cmt-->
24684 <nowiki> </nowiki>a
24685
24686 a
24687 <nowiki> </nowiki>b
24688
24689 a
24690 b
24691
24692 a
24693 b
24694 !! html/php
24695 <p> a
24696 </p><p> a
24697 </p><p> a(tab)
24698 </p><p> a
24699 a
24700 </p><p>a
24701 b
24702 </p><p>a
24703 b
24704 </p><p>a
24705 b
24706 </p>
24707 !! end
24708
24709 !! test
24710 2. Leading whitespace in non-indent-pre contexts should not be escaped
24711 !! options
24712 parsoid=html2wt
24713 !! html/parsoid
24714 <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>
24715 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24716 <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>
24717 b</span></li>
24718 </ol>
24719 !! wikitext
24720 foo <ref>''a''
24721 b</ref>
24722 <references />
24723 !! end
24724
24725 !! test
24726 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24727 !! options
24728 parsoid=html2wt
24729 !! html/parsoid
24730 <blockquote>
24731 <p>
24732 a
24733 <span>b</span>
24734 c</p>
24735 </blockquote>
24736 !! wikitext
24737 <blockquote>
24738 a
24739 <span>b</span>
24740 c
24741 </blockquote>
24742 !! end
24743
24744 !! test
24745 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24746 !! options
24747 options=html2wt
24748 !! html/parsoid
24749 <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>
24750 !! wikitext
24751 [[File:Foobar.jpg|thumb|caption]]
24752 !! end
24753
24754 !! test
24755 5. Nowiki escaping should account for indent-pres
24756 !! options
24757 parsoid=html2wt
24758 !! html/parsoid
24759 <pre>==foo==</pre>
24760 !! wikitext
24761 ==foo==
24762 !! end
24763
24764 !!test
24765 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24766 !! options
24767 parsoid=html2wt
24768 !! html/parsoid
24769 <pre>
24770 * foo
24771 * bar
24772 </pre>
24773 !! wikitext
24774 * foo
24775 * bar
24776 !! end
24777
24778 #### --------------- Behavior Switches --------------------
24779
24780 !! test
24781 1. Valid behavior switches should be escaped
24782 !! options
24783 parsoid=html2wt
24784 !! html/parsoid
24785 __TOC__
24786 <i>__TOC__</i>
24787 !! wikitext
24788 <nowiki>__TOC__</nowiki>
24789 ''<nowiki>__TOC__</nowiki>''
24790 !! end
24791
24792 !! test
24793 2. Invalid behavior switches should not be escaped
24794 !! options
24795 parsoid=html2wt
24796 !! html/parsoid
24797 __TOO__
24798 __|__
24799 !! wikitext
24800 __TOO__
24801 __|__
24802 !! end
24803
24804 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24805 !! test
24806 Behavior switches should be SOL-transparent
24807 !! options
24808 parsoid=html2wt
24809 !! html/parsoid
24810 <meta property="mw:PageProp/toc" />
24811
24812 <!-- this one's bogus -->
24813 <pre>__TOO__</pre>
24814
24815 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24816
24817 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24818 !! wikitext
24819 __TOC__
24820
24821 <!-- this one's bogus -->
24822 __TOO__
24823
24824 __TOC__ foo
24825
24826 __TOC__
24827 bar
24828 !! end
24829
24830 #### --------------- HTML tags ---------------
24831 #### 1. a tags
24832 #### 2. other tags
24833 #### 3. multi-line html tag
24834 #### 4. extension tags
24835 #### -----------------------------------------
24836 !! test
24837 1. a tags
24838 !! options
24839 parsoid=html2wt
24840 !! html/parsoid
24841 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24842 !! wikitext
24843 <a href="http://google.com">google</a>
24844 !! end
24845
24846 !! test
24847 2. other tags
24848 !! options
24849 parsoid=html2wt
24850 !! html/parsoid
24851 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24852 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24853 <li> &lt;td&gt;</li></ul>
24854
24855 !! wikitext
24856 * <nowiki><div>foo</div></nowiki>
24857 * <nowiki><div style="color:red">foo</div></nowiki>
24858 * <nowiki><td></nowiki>
24859 !! end
24860
24861 !! test
24862 3. multi-line html tag
24863 !! options
24864 parsoid=html2wt
24865 !! html/parsoid
24866 <p>&lt;div
24867 &gt;foo&lt;/div
24868 &gt;
24869 </p>
24870 !! wikitext
24871 <nowiki><div
24872 >foo</div
24873 ></nowiki>
24874 !! end
24875
24876 !! test
24877 4. extension tags
24878 !! options
24879 parsoid=html2wt
24880 !! html/parsoid
24881 <p>&lt;ref&gt;foo&lt;/ref&gt;
24882 </p><p>&lt;ref&gt;bar
24883 </p><p>baz&lt;/ref&gt;
24884 </p>
24885 !! wikitext
24886 <nowiki><ref>foo</ref></nowiki>
24887
24888 <nowiki><ref>bar</nowiki>
24889
24890 baz<nowiki></ref></nowiki>
24891 !! end
24892
24893 #### --------------- Others ---------------
24894 !! test
24895 Escaping nowikis
24896 !! options
24897 parsoid=html2wt
24898 !! html/parsoid
24899 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24900 </p>
24901 !! wikitext
24902 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24903 !! end
24904
24905 ## The quote-char in the input is necessary for triggering the bug
24906 !! test
24907 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24908 !! options
24909 parsoid=html2wt
24910 !! html/parsoid
24911 <p>foo's bar :</p>
24912 !! wikitext
24913 foo's bar :
24914 !! end
24915
24916 #----------- End of wikitext escaping tests --------------
24917
24918 !! test
24919
24920 Tag-like HTML structures are passed through as text
24921 !! wikitext
24922 <x y>
24923
24924 <x.y>
24925
24926 <x-y>
24927
24928 1>2
24929
24930 x<y
24931
24932 a>b
24933
24934 1<d e>f
24935 !! html
24936 <p>&lt;x y&gt;
24937 </p><p>&lt;x.y&gt;
24938 </p><p>&lt;x-y&gt;
24939 </p><p>1&gt;2
24940 </p><p>x&lt;y
24941 </p><p>a&gt;b
24942 </p><p>1&lt;d e&gt;f
24943 </p>
24944 !! end
24945
24946 !! test
24947 HTML tag with necessary entities in attributes
24948 !! wikitext
24949 <span title="&amp;amp;">foo</span>
24950 !! html
24951 <p><span title="&amp;amp;">foo</span>
24952 </p>
24953 !! end
24954
24955 !! test
24956 HTML tag with 'unnecessary' entity encoding in attributes
24957 !! wikitext
24958 <span title="&amp;">foo</span>
24959 !! html
24960 <p><span title="&amp;">foo</span>
24961 </p>
24962 !! end
24963
24964 !! test
24965 HTML tag with broken attribute value quoting
24966 !! options
24967 parsoid=wt2html,html2html
24968 !! wikitext
24969 <span title="Hello world>Foo</span>
24970 !! html/php
24971 <p><span title="Hello world">Foo</span>
24972 </p>
24973 !! html/parsoid
24974 <p><span title="Hello world">Foo</span></p>
24975 !! end
24976
24977 !! test
24978 Self-closed tag with broken attribute value quoting
24979 !! options
24980 parsoid=wt2html,html2html
24981 !! wikitext
24982 <div title="Hello world />Foo
24983 !! html/php+tidy
24984 <div title="Hello world"></div>
24985 <p>Foo</p>
24986 !! html/parsoid
24987 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24988 !! end
24989
24990 !! test
24991 Table with broken attribute value quoting
24992 !! options
24993 parsoid=wt2html,html2html
24994 !! wikitext
24995 {|
24996 | title="Hello world|Foo
24997 |}
24998 !! html/php
24999 <table>
25000 <tr>
25001 <td title="Hello world">Foo
25002 </td></tr></table>
25003
25004 !! html/parsoid
25005 <table>
25006 <tr>
25007 <td title="Hello world">Foo
25008 </td></tr></table>
25009
25010 !! end
25011
25012 !! test
25013 Table with broken attribute value quoting on consecutive lines
25014 !! options
25015 parsoid=wt2html,html2html
25016 !! wikitext
25017 {|
25018 | title="Hello world|Foo
25019 | style="color:red|Bar
25020 |}
25021 !! html/php
25022 <table>
25023 <tr>
25024 <td title="Hello world">Foo
25025 </td>
25026 <td style="color:red">Bar
25027 </td></tr></table>
25028
25029 !! html/parsoid
25030 <table><tbody>
25031 <tr>
25032 <td title="Hello world">Foo
25033 </td><td style="color: red">Bar
25034 </td></tr></tbody></table>
25035
25036 !! end
25037
25038 !!test
25039 Accept empty td cell attribute
25040 !! wikitext
25041 {|
25042 | align="center" | foo || |
25043 |}
25044 !! html
25045 <table>
25046 <tr>
25047 <td align="center"> foo </td>
25048 <td>
25049 </td></tr></table>
25050
25051 !!end
25052
25053 !!test
25054 Non-empty attributes in th-cells
25055 !! wikitext
25056 {|
25057 ! Foo !! style="color: red" | Bar
25058 |}
25059 !! html
25060 <table>
25061 <tr>
25062 <th> Foo </th>
25063 <th style="color: red"> Bar
25064 </th></tr></table>
25065
25066 !!end
25067
25068 !!test
25069 Accept empty attributes in th-cells
25070 !! wikitext
25071 {|
25072 !| foo !!| bar
25073 |}
25074 !! html
25075 <table>
25076 <tr>
25077 <th> foo </th>
25078 <th> bar
25079 </th></tr></table>
25080
25081 !!end
25082
25083 !!test
25084 Empty table rows go away
25085 !! wikitext
25086 {|
25087 | Hello
25088 | there
25089 |- class="foo"
25090 |-
25091 |}
25092 !! html
25093 <table>
25094 <tr>
25095 <td> Hello
25096 </td>
25097 <td> there
25098 </td></tr>
25099
25100 </table>
25101
25102 !! end
25103
25104 ###
25105 ### Parsoid-centric tests for testing RTing of inter-element separators
25106 ### Edge cases not tested by existing parser tests and specific to
25107 ### Parsoid-specific serialization strategies.
25108 ###
25109
25110 !!test
25111 RT-ed inter-element separators should be valid separators
25112 !! wikitext
25113 {|
25114 |- [[foo]]
25115 |}
25116 !! html/php
25117 <table>
25118
25119 </table>
25120
25121 !! html/parsoid
25122 <table>
25123 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
25124 </tbody></table>
25125 !!end
25126
25127 # Parsoid-only since PHP parser relies on Tidy for correct output
25128 !!test
25129 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
25130 !!options
25131 parsoid
25132 !! wikitext
25133 {|
25134 |<small>foo
25135 bar
25136 |}
25137
25138 {|
25139 |<small>foo<small>
25140 |}
25141 !! html
25142 <table>
25143 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
25144 <p>bar</p></small></td></tr>
25145 </tbody></table>
25146
25147 <table>
25148 <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>
25149 </tbody></table>
25150 !!end
25151
25152 # Note that the "style" attribute is really a template parameter here.
25153 # The = would have to be {{=}} if you wanted the literal.
25154 !!test
25155 Empty TD followed by TD with tpl-generated attribute
25156 !! wikitext
25157 {|
25158 |-
25159 |
25160 |{{echo|style='color:red'}}|foo
25161 |}
25162 !! html
25163 <table>
25164
25165 <tr>
25166 <td>
25167 </td>
25168 <td>foo
25169 </td></tr></table>
25170
25171 !!end
25172
25173 !!test
25174 Indented table with an empty td
25175 !! wikitext
25176 {|
25177 |-
25178 |
25179 |foo
25180 |}
25181 !! html
25182 <table>
25183
25184 <tr>
25185 <td>
25186 </td>
25187 <td>foo
25188 </td></tr></table>
25189
25190 !!end
25191
25192 ## We have some newline diffs RT-ing this edge case
25193 ## and it is not important enough -- we seem to be emitting
25194 ## at most 2 newlines after a </tr> and this is unrelated to
25195 ## the issue from T85627 that this is testing.
25196 !!test
25197 Indented table with blank lines in between (T85627)
25198 !! options
25199 parsoid=wt2html
25200 !! wikitext
25201 {|
25202 |foo
25203
25204
25205 |}
25206 !! html
25207 <table>
25208
25209 <tr>
25210 <td>foo
25211 </td></tr></table>
25212
25213 !!end
25214
25215 !!test
25216 Indented block & table
25217 !! wikitext
25218 <div>foo</div>
25219 {|
25220 |foo
25221 |}
25222 !! html/php
25223 <div>foo</div>
25224 <table>
25225 <tr>
25226 <td>foo
25227 </td></tr></table>
25228
25229 !! html/parsoid
25230 <div data-parsoid='{"stx":"html"}'>foo</div>
25231 <table><tbody>
25232 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
25233 </tbody></table>
25234 !!end
25235
25236 !! test
25237 Indent and comment before table row
25238 !! wikitext
25239 {|
25240 <!--hi-->|-
25241 | there
25242 |}
25243 !! html/php
25244 <table>
25245
25246 <tr>
25247 <td> there
25248 </td></tr></table>
25249
25250 !! html/parsoid
25251 <table>
25252 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
25253 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
25254 </tbody></table>
25255 !! end
25256
25257 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
25258 !!test
25259 Empty TR followed by a template-generated TR
25260 !!options
25261 parsoid
25262 !! wikitext
25263 {|
25264 |-
25265 {{echo|<tr><td>foo</td></tr>}}
25266 |}
25267 !! html
25268 <table>
25269 <tbody>
25270 <tr></tr>
25271 <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}}]}'>
25272 <td>foo</td></tr>
25273 </tbody></table>
25274 !!end
25275
25276 ## PHP and parsoid output differ for this, and since this is primarily
25277 ## for testing Parsoid's serializer, marking this Parsoid only
25278 !!test
25279 Empty TR followed by mixed-ws-comment line should RT correctly
25280 !!options
25281 parsoid
25282 !! wikitext
25283 {|
25284 |-
25285 <!--c-->
25286 |-
25287 <!--c--> <!--d-->
25288 |}
25289 !! html
25290 <table>
25291 <tbody>
25292 <tr></tr>
25293 <!--c-->
25294 <tr>
25295 <!--c--> </tr><!--d-->
25296 </tbody></table>
25297
25298 !!end
25299
25300 !!test
25301 Multi-line image caption generated by templates with/without trailing newlines
25302 !! wikitext
25303 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
25304 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
25305 !! html/parsoid
25306 <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>
25307 <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>
25308 !!end
25309
25310 !! test
25311 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
25312 !! options
25313 parsoid=html2wt
25314 !! html/parsoid
25315 <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>
25316
25317 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
25318 !! wikitext
25319 <includeonly>foo</includeonly>
25320 new para
25321
25322 [[Category:Foo]]
25323
25324 = new heading =
25325 !! end
25326
25327 ## PHP emits broken html for this, and since this is primarily
25328 ## a Parsoid serializer test, marking this Parsoid only
25329 !!test
25330 Improperly nested inline or quotes tags with whitespace in between
25331 !! wikitext
25332 <span> <s>x</span> </s>
25333 ''' ''x''' ''
25334 !! html/parsoid
25335 <p><span> <s>x</s></span><s> </s>
25336 <b> <i>x</i></b><i> </i>
25337 </p>
25338 !!end
25339
25340 !!test
25341 Encapsulate protected attributes from wt
25342 !! wikitext
25343 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
25344
25345 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
25346 | ok
25347 |}
25348 !! html/parsoid
25349 <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>
25350
25351 <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">
25352 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
25353 </tbody></table>
25354 !!end
25355
25356 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
25357 ## Having nested or stray pre tags results in the attempt to add duplicates,
25358 ## causing an assertion fail. This test tries to prevent that situation.
25359 !!test
25360 Ensure ParagraphWrapper can deal with stray closing pre tags
25361 !!options
25362 parsoid=wt2html
25363 !! wikitext
25364 plain text</pre>
25365 !! html/parsoid
25366 plain text
25367 !!end
25368
25369 !!test
25370 1. Ensure fostered text content is wrapped in element nodes
25371 !!options
25372 parsoid=wt2html
25373 !! wikitext
25374 <table>hi</table><table>ho</table>
25375 !! html/parsoid
25376 <p>hi</p>
25377 <table></table>
25378 <p>ho</p>
25379 <table></table>
25380 !!end
25381
25382 !!test
25383 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
25384 !!options
25385 parsoid=wt2html,wt2wt
25386 !! wikitext
25387 <table>
25388 <tr> || ||
25389 <td> a
25390 </table>
25391 !! html/parsoid
25392 <p> || ||
25393 </p><table>
25394 <tbody><tr><td> a</td></tr>
25395 </tbody></table>
25396 !!end
25397
25398 !!test
25399 Encapsulation properly handles null DSR information from foster box
25400 !!options
25401 parsoid=wt2html,wt2wt
25402 !! wikitext
25403 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25404 !! html/parsoid
25405 <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>
25406 !!end
25407
25408 !!test
25409 1. Encapsulate foster-parented transclusion content
25410 !!options
25411 parsoid=wt2wt,wt2html
25412 !! wikitext
25413 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25414 !! html/parsoid
25415 <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>
25416 <tbody>
25417 <tr>
25418 <td>bar</td>
25419 </tr>
25420 </tbody>
25421 </table>
25422 !!end
25423
25424 !!test
25425 2. Encapsulate foster-parented transclusion content
25426 !!options
25427 parsoid=wt2wt,wt2html
25428 !! wikitext
25429 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25430 !! html/parsoid
25431 <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>
25432 <table>
25433 <tbody>
25434 <tr>
25435 <td>bar</td>
25436 </tr>
25437 </tbody>
25438 </table>
25439 !!end
25440
25441 !!test
25442 3. Encapsulate foster-parented transclusion content
25443 !!options
25444 parsoid=wt2wt,wt2html
25445 !! wikitext
25446 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25447 !! html/parsoid
25448 <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;]}">
25449 <p>foo</p>
25450 </div>
25451 <table>
25452 <tbody>
25453 <tr>
25454 <td>bar</td>
25455 </tr>
25456 </tbody>
25457 </table>
25458 !!end
25459
25460 !!test
25461 4. Encapsulate foster-parented transclusion content
25462 !!options
25463 parsoid=wt2wt,wt2html
25464 !! wikitext
25465 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25466 !! html/parsoid
25467 <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;]}">
25468 <p>foo</p>
25469 </div>
25470 <table>
25471 <tbody>
25472 <tr>
25473 <td>bar</td>
25474 </tr>
25475 </tbody>
25476 </table>
25477 !!end
25478
25479 !!test
25480 5. Encapsulate foster-parented transclusion content
25481 !!options
25482 parsoid=wt2wt,wt2html
25483 !! wikitext
25484 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25485 !! html/parsoid
25486 <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>
25487 <table>
25488 <tbody>
25489 <tr>
25490 <td>
25491 <div>
25492 <p>foo</p>
25493 </div>
25494 </td>
25495 </tr>
25496 </tbody>
25497 </table>
25498 !!end
25499
25500 !!test
25501 6. Encapsulate foster-parented transclusion content
25502 !!options
25503 parsoid=wt2wt,wt2html
25504 !! wikitext
25505 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25506 !! html/parsoid
25507 <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>
25508 <table>
25509 <tbody>
25510 <tr>
25511 <td>
25512 <div>
25513 <p>foo</p>
25514 </div>
25515 </td>
25516 </tr>
25517 </tbody>
25518 </table>
25519 <p>ok</p>
25520 !!end
25521
25522 !!test
25523 7. Encapsulate foster-parented transclusion content
25524 !!options
25525 parsoid=wt2wt,wt2html
25526 !! wikitext
25527 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25528 !! html/parsoid
25529 <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>
25530 <table>
25531 <tbody>
25532 <tr>
25533 <td>bar</td>
25534 </tr>
25535 </tbody>
25536 </table>
25537 !!end
25538
25539 # Note that the wt is broken on purpose: the = should be {{=}} if you
25540 # don't want it to be a template parameter key.
25541 !!test
25542 8. Encapsulate foster-parented transclusion content
25543 !!options
25544 parsoid=wt2wt,wt2html
25545 !! wikitext
25546 {{echo|a
25547 }}{|{{echo|style='color:red'}}
25548 |-
25549 |b
25550 |}
25551 !! html/parsoid
25552 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25553 <span> </span>
25554 <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>
25555 <table>
25556 <tbody>
25557 <tr>
25558 <td>b</td>
25559 </tr>
25560 </tbody>
25561 </table>
25562 !!end
25563
25564 !!test
25565 9. Encapsulate foster-parented transclusion content
25566 !!options
25567 parsoid=wt2wt,wt2html
25568 !! wikitext
25569 <table>{{echo|hi</table>hello}}
25570 !! html/parsoid
25571 <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>
25572 !!end
25573
25574 !!test
25575 Table in fosterable position
25576 !!options
25577 parsoid=wt2html
25578 !! wikitext
25579 {{OpenTable}}
25580 <div>
25581 {|
25582 |}
25583 </div>
25584 |}
25585 !! html/parsoid
25586 <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">
25587 </span>
25588 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25589
25590 <table>
25591 </table>
25592 !!end
25593
25594 # Parsoid only for bug 64747
25595 !! test
25596 Properly encapsulate empty-content transclusions in fosterable positions
25597 !! wikitext
25598 <table>
25599 {{#if:|
25600 <td>foo</td>
25601 }}
25602 </table>
25603 !! html/parsoid
25604 <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"}]]}'>
25605
25606 </table>
25607 !! end
25608
25609 !! test
25610 Always encapsulate foster box when template range is expanded to table
25611 !! options
25612 parsoid=wt2wt
25613 !! wikitext
25614 {|
25615 hello
25616 {{OpenTable}}
25617 |}
25618 !! html/parsoid
25619
25620 !! end
25621
25622 !! test
25623 T115289: Unclosed table
25624 !! wikitext
25625 {{echo|<table>}}<!--c-->[[Category:Two]]
25626 !! html/parsoid
25627 <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>
25628 !! end
25629
25630 !! test
25631 T115289: Don't migrate newlines out of tables with fostered content
25632 !! wikitext
25633 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25634 !! html/parsoid
25635 <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>
25636 !! end
25637
25638 !! test
25639 T73074: More fostering fun
25640 !! wikitext
25641 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25642 !! html/parsoid
25643 <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>
25644 !! end
25645
25646 !!test
25647 Support <object> element with .data attribute
25648 !!options
25649 parsoid=html2wt
25650 !! html/parsoid
25651 <object data="test.swf"></object>
25652 !! wikitext
25653 <object data="test.swf"></object>
25654 !!end
25655
25656 !! test
25657 Don't block XML namespace declaration
25658 !! wikitext
25659 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25660 !! html/php
25661 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25662 </p>
25663 !! html/parsoid
25664 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25665 !! end
25666
25667 # -----------------------------------------------------------------
25668 # The following section of tests are primarily to spec requirements
25669 # around Parsoid's serialization (old, new, edited content)
25670 #
25671 # All these tests are marked Parsoid html2wt and html2html only
25672 # ----------------------------------------------------------------
25673
25674 !! test
25675 Ignore rel attribute in a-tags during serialization to url-links
25676 !! options
25677 parsoid=html2wt
25678 !! html/parsoid
25679 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25680 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25681 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25682 !! wikitext
25683 http://en.wikipedia.org/wiki/Foobar
25684 http://en.wikipedia.org/wiki/Foobar
25685 http://en.wikipedia.org/wiki/Foobar
25686 !! end
25687
25688 # 'mi' is a localinterwiki prefix as well as a language
25689 !! test
25690 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
25691 !! options
25692 parsoid=html2wt
25693 !! html/parsoid
25694 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25695 !! wikitext
25696 [[Foo]]
25697 !! end
25698
25699 # See T93839
25700 !! test
25701 New wikilinks should be serialized properly
25702 !! options
25703 parsoid=html2wt
25704 !! html/parsoid
25705 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25706 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25707 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25708 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25709 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25710 !! wikitext
25711 [[Foo]]
25712 [[Foo]]
25713 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25714 http://en.wikipedia.org/wiki/Foo
25715 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25716 !! end
25717
25718 !! test
25719 New wiki links (href variations)
25720 !! options
25721 parsoid=html2wt
25722 !! html/parsoid
25723 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25724 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25725 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25726 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25727 !! wikitext
25728 [[Foo_bar]]
25729 [[Foo_bar]]
25730 [[Foo_bar]]
25731 [[Toxine bactérienne]]
25732 !! end
25733
25734 !! test
25735 New wiki links (content string variations)
25736 !! options
25737 parsoid=html2wt
25738 !! html/parsoid
25739 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25740 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25741 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25742 !! wikitext
25743 [[Foo_bar]]
25744 [[Foo bar]]
25745 [[Foo_bar|./Foo_bar]]
25746 !! end
25747
25748 !! test
25749 New category links (href variations)
25750 !! options
25751 parsoid=html2wt
25752 !! html/parsoid
25753 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25754 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25755 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25756 !! wikitext
25757 [[Category:Toxine bactérienne]]
25758 [[Category:Toxine bactérienne]]
25759 [[Category:Toxine bactérienne]]
25760 !! end
25761
25762 !! test
25763 New sol transparent links don't need indent-pre nowiki protection
25764 !! options
25765 parsoid=html2wt
25766 language=de
25767 !! html/parsoid
25768 <link rel="mw:PageProp/redirect" href="./Main_Page">
25769 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25770 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25771 !! wikitext
25772 #WEITERLEITUNG [[Main Page]]
25773 <!-- this is good --> [[Category:Good]]
25774 <!-- this is great --> [[Kategorie:Great]]
25775 !! end
25776
25777 !! test
25778 New interlanguage links (href variations)
25779 !! options
25780 parsoid=html2wt
25781 !! html/parsoid
25782 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25783 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25784 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25785 !! wikitext
25786 [[es:Toxine bactérienne]]
25787 [[es:Toxine_bactérienne]]
25788 [[es:Toxine_bactérienne]]
25789 !! end
25790
25791 !! test
25792 Image: Modifying size of an image (1)
25793 !! options
25794 parsoid={
25795 "modes": ["wt2wt"],
25796 "changes": [
25797 ["img[height]", "attr", "height", "22"],
25798 ["img[width]", "attr", "width", "200"]
25799 ]
25800 }
25801 !! wikitext
25802 [[Image:Foobar.jpg|230x230px]]
25803 !! wikitext/edited
25804 [[Image:Foobar.jpg|200x200px]]
25805 !!end
25806
25807 !! test
25808 Image: Modifying size of an image (2)
25809 !! options
25810 parsoid={
25811 "modes": ["wt2wt"],
25812 "changes": [
25813 ["img[height]", "attr", "height", "100"],
25814 ["img[width]", "attr", "width", "500"]
25815 ]
25816 }
25817 !! wikitext
25818 [[Image:Foobar.jpg|230x230px]]
25819 !! wikitext/edited
25820 [[Image:Foobar.jpg|500x500px]]
25821 !!end
25822
25823 # Change in size is ignored so long as class='mw-default-size'
25824 !! test
25825 Image: Modifying size of an image (3)
25826 !! options
25827 parsoid={
25828 "modes": ["wt2wt"],
25829 "changes": [
25830 ["figure[class]", "removeClass", "mw-default-size"],
25831 ["figure img", "attr", "height", "19"],
25832 ["figure img", "attr", "width", "170"]
25833 ]
25834 }
25835 !! wikitext
25836 [[Image:Foobar.jpg|thumb]]
25837 !! wikitext/edited
25838 [[Image:Foobar.jpg|thumb|170x170px]]
25839 !!end
25840
25841 !! test
25842 Image: Modifying alignment of an image (bug 48665)
25843 !! options
25844 parsoid={
25845 "modes": ["wt2wt"],
25846 "changes": [
25847 ["figure[class]", "removeClass", "mw-halign-right"],
25848 ["figure[class]", "addClass", "mw-halign-left"]
25849 ]
25850 }
25851 !! wikitext
25852 [[Image:Foobar.jpg|thumb|caption|right]]
25853 !! wikitext/edited
25854 [[Image:Foobar.jpg|thumb|caption|left]]
25855 !! end
25856
25857 !! test
25858 Image: Modifying mw-default-size of an frameless image (bug 62805)
25859 !! options
25860 parsoid={
25861 "modes": ["wt2wt"],
25862 "changes": [
25863 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25864 ]
25865 }
25866 !! wikitext
25867 [[Image:Foobar.jpg|frameless|right]]
25868 !! wikitext/edited
25869 [[Image:Foobar.jpg|frameless|right|220x220px]]
25870 !! end
25871
25872 !! test
25873 Image: Modifying valign of an image (bug 49221)
25874 !! options
25875 parsoid={
25876 "modes": ["wt2wt"],
25877 "changes": [
25878 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25879 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25880 ]
25881 }
25882 !! wikitext
25883 [[File:Foobar.jpg|20px|middle]]
25884 !! wikitext/edited
25885 [[File:Foobar.jpg|20px|text-top]]
25886 !! end
25887
25888 !! test
25889 Image: Modifying alt attribute of an image (bug 56400)
25890 !! options
25891 parsoid={
25892 "modes": ["wt2wt"],
25893 "changes": [
25894 ["img[alt]", "attr", "alt", "some alternate edited text"]
25895 ]
25896 }
25897 !! wikitext
25898 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25899 !! wikitext/edited
25900 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25901 !!end
25902
25903 !! test
25904 Image: Modifying caption of an image
25905 !! options
25906 parsoid={
25907 "modes": ["wt2wt"],
25908 "changes": [
25909 ["figcaption", "text", "new caption"]
25910 ]
25911 }
25912 !! wikitext
25913 [[Image:Foobar.jpg|thumb|original caption]]
25914 !! wikitext/edited
25915 [[Image:Foobar.jpg|thumb|new caption]]
25916 !!end
25917
25918 !! test
25919 Image: empty alt attribute (bug 48924)
25920 !! options
25921 parsoid
25922 !! wikitext
25923 [[File:Foobar.jpg|thumb|alt=|bar]]
25924 !! html
25925 <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>
25926 !! end
25927
25928 !! test
25929 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25930 !! options
25931 parsoid=html2wt
25932 language=ar
25933 disabled
25934 !! html/parsoid
25935 <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>
25936 !! wikitext
25937 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25938 !! end
25939
25940 !! test
25941 Image: Block level image should have \n before and after
25942 !! wikitext
25943 123
25944 [[File:Foobar.jpg|right|thumb|150x150px]]
25945 456
25946 !! html/parsoid
25947 <p>123</p>
25948 <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>
25949 <p>456</p>
25950 !!end
25951
25952 !! test
25953 Image: New block level image should have \n before and after (existing content)
25954 !! wikitext
25955 123
25956 [[File:Foobar.jpg|right|thumb|150x150px]]
25957 456
25958 !! html/parsoid
25959 <p>123</p>
25960 <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>
25961 <p>456</p>
25962 !!end
25963
25964 !! test
25965 Image: upright option (parsoid)
25966 !! wikitext
25967 [[File:Foobar.jpg|thumb|upright|caption]]
25968 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25969 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25970 !! html/parsoid
25971 <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>
25972 <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>
25973 <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>
25974 !!end
25975
25976 !! test
25977 Image: upright option is ignored on inline and frame images (parsoid)
25978 !! wikitext
25979 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25980 !! html/parsoid
25981 <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>
25982 !!end
25983
25984 !! test
25985 Image: from basic HTML (1)
25986 !! options
25987 parsoid=html2wt
25988 !! html/parsoid
25989 <span typeof="mw:Image">
25990 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25991 </span>
25992 !! wikitext
25993 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25994 !! end
25995
25996 !! test
25997 Image: from basic HTML (2)
25998 !! options
25999 parsoid=html2wt
26000 !! html/parsoid
26001 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
26002 !! wikitext
26003 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
26004 !! end
26005
26006 !! test
26007 Image: from basic HTML (3)
26008 !! options
26009 parsoid=html2wt
26010 !! html/parsoid
26011 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
26012 !! wikitext
26013 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
26014 !! end
26015
26016 !! test
26017 Image: from basic HTML (4)
26018 !! options
26019 parsoid=html2wt
26020 !! html/parsoid
26021 <img src="./File:Foobar.jpg">
26022 !! wikitext
26023 [[File:Foobar.jpg|link=]]
26024 !! end
26025
26026 !! test
26027 Image: Invalid title as link
26028 !! wikitext
26029 [[File:Foobar.jpg|link=<]]
26030 !! html/php
26031 <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>
26032 </p>
26033 !! html/parsoid
26034 <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>
26035 !! end
26036
26037 !! test
26038 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
26039 !! options
26040 parsoid=html2wt
26041 !! html/parsoid
26042 <ul>
26043 <li><p>foo</p></li>
26044 </ul>
26045 !! wikitext
26046 * foo
26047 !! end
26048
26049 !! test
26050 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
26051 !! options
26052 parsoid=html2wt
26053 !! html/parsoid
26054 <ul> <li>foo</li></ul>
26055 !! wikitext
26056 * foo
26057 !! end
26058
26059 !! test
26060 Don't strip leading whitespace when handling indent-pre suppressing tags
26061 !! options
26062 parsoid=html2wt
26063 !! html/parsoid
26064 <table>
26065 <tr><td> indented row</td></tr>
26066 </table>
26067 <blockquote><p>
26068 <b>This is very bold of you!</b>
26069 </p>
26070 <table><tr><td>
26071 indented cell (no pre-wrapping!)
26072 </td></tr></table>
26073 </blockquote>
26074 <p>foo</p>
26075 <div>bar</div>
26076 !! wikitext
26077 {|
26078 | indented row
26079 |}
26080 <blockquote>
26081 '''This is very bold of you!'''
26082
26083 {|
26084 |
26085 indented cell (no pre-wrapping!)
26086 |}
26087 </blockquote>
26088 foo
26089 <div>bar</div>
26090 !! end
26091
26092 !! test
26093 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
26094 !! options
26095 parsoid=html2wt
26096 !! html/parsoid
26097 <p>foo</p>
26098 <span>bar</span>
26099
26100 <span>foo2
26101 </span>bar2
26102
26103 <div>foo</div>
26104 <span>bar</span>
26105
26106 <div>
26107 <span>foo</span>
26108 </div>
26109 !! wikitext
26110 foo
26111
26112 <span>bar</span>
26113
26114 <span>foo2
26115 <nowiki> </nowiki></span>bar2
26116
26117 <div>foo</div>
26118 <nowiki> </nowiki><span>bar</span>
26119
26120 <div>
26121 <nowiki> </nowiki><span>foo</span>
26122 </div>
26123 !! end
26124
26125 !! test
26126 Lists: Dont insert newlines in a serialized list item.
26127 !! options
26128 parsoid=html2wt
26129 !! html/parsoid
26130 <ul><li>a<br>b</li><li>c</li></ul>
26131 !! wikitext
26132 * a<br>b
26133 * c
26134 !! end
26135
26136 !! test
26137 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
26138 !! options
26139 parsoid={
26140 "modes": ["html2wt"],
26141 "scrubWikitext": false
26142 }
26143 !! html/parsoid
26144 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26145 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26146
26147 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26148 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26149
26150 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
26151
26152 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26153 !! wikitext
26154 == hello there [[Category:A1]] ==
26155
26156 == [[Category:A2]] hi pal ==
26157
26158 == <!--foo--> [[Category:A3]] how goes it ==
26159
26160 == it goes well [[Category:A4]] <!--bar--> ==
26161
26162 ==howdy [[Category:A5]]==
26163
26164 == __TOC__ ok ==
26165 !! end
26166
26167 !! test
26168 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
26169 !! options
26170 parsoid={
26171 "modes": ["html2wt"],
26172 "scrubWikitext": true
26173 }
26174 !! html/parsoid
26175 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26176 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26177
26178 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26179 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26180
26181 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26182 !! wikitext
26183 == hello there ==
26184 [[Category:A1]]
26185 [[Category:A2]]
26186
26187 == hi pal ==
26188
26189 <!--foo--> [[Category:A3]]
26190
26191 == how goes it ==
26192
26193 == it goes well ==
26194 [[Category:A4]] <!--bar-->
26195
26196 __TOC__
26197
26198 == ok ==
26199 !! end
26200
26201 !! test
26202 Headings: Don't hoist metas that come from templates
26203 !! options
26204 parsoid={
26205 "modes": ["html2wt"],
26206 "scrubWikitext": true
26207 }
26208 !! html/parsoid
26209 <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>
26210 !! wikitext
26211 == {{echo|foo [[Category:Foo]]}} ==
26212 !! end
26213
26214 !! test
26215 Headings: Category in ref isn't hoisted
26216 !! options
26217 parsoid={
26218 "modes": ["html2wt"],
26219 "scrubWikitext": true
26220 }
26221 !! html/parsoid
26222 <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>
26223
26224 <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>
26225 !! wikitext
26226 == foo <ref>bar
26227 [[Category:Baz]] </ref> ==
26228
26229 <references />
26230 !! end
26231
26232 !! test
26233 Parsoid: Serialize positional parameters with = in them as named parameter
26234 !! options
26235 parsoid=html2wt
26236 !! html/parsoid
26237 <p about="#mwt1" typeof="mw:Transclusion"
26238 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
26239
26240 <p about="#mwt1" typeof="mw:Transclusion"
26241 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
26242
26243 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26244 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26245 <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>
26246 !! wikitext
26247 {{echo|1=f=oo}}
26248
26249 {{echo|1=f=oo|2=bar}}
26250
26251 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26252 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26253 {{echo|<nowiki>f=oo</nowiki>|bar}}
26254 !! end
26255
26256 !! test
26257 Parsoid: Serialize positional parameters with = in extlink as named parameter
26258 !! options
26259 parsoid=html2wt
26260 !! html/parsoid
26261 <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>
26262 !! wikitext
26263 {{echo|1=http://stuff?is=ok}}
26264 !! end
26265
26266 !! test
26267 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
26268 !! options
26269 parsoid=html2wt
26270 !! html/parsoid
26271 <div>a<p>b</p></div>
26272 <div>a
26273 <p>b</p></div>
26274 <div>
26275 a
26276 <p>b</p></div>
26277 !! wikitext
26278 <div>a
26279 b
26280 </div>
26281 <div>a
26282 b
26283 </div>
26284 <div>
26285 a
26286
26287 b
26288 </div>
26289 !! end
26290
26291 !! test
26292 Substrings resembling wikitext in hrefs should not get nowiki escapes
26293 !! options
26294 parsoid=html2wt
26295 !! html/parsoid
26296 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
26297 !! wikitext
26298 [[Foo''bar''baz]]
26299 !! end
26300
26301 !! test
26302 Enforce single-line context in the serializer
26303 !! options
26304 parsoid=html2wt
26305 !! html/parsoid
26306 <h2>testing
26307 123</h2>
26308
26309 <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">
26310 </span><span about="#mwt1">you</span> </h2>
26311
26312 <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>
26313
26314 <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
26315 there</span></li></ol>
26316
26317 <ul><li>asd
26318 sdf</li></ul>
26319
26320 <ul><li>foo
26321 bar
26322 baz</li>
26323 <li>foo <b>bar</b>
26324 baz</li></ul>
26325
26326 <dl><dt>hi
26327 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
26328 ho</dd></dl>
26329
26330 <dl><dd> <table>
26331 <tbody><tr><td> ha
26332 ha
26333 ha</td></tr>
26334 </tbody></table></dd></dl>
26335 !! wikitext
26336 == testing 123 ==
26337
26338 == hi {{bogus|there
26339 you}} ==
26340
26341 == foo <ref>hello
26342 there</ref> ==
26343
26344 <references />
26345
26346 * asd sdf
26347
26348 * foo bar baz
26349 * foo '''bar''' baz
26350
26351 ; hi ho : hi ho
26352
26353 : {|
26354 | ha
26355 ha
26356 ha
26357 |}
26358 !! end
26359
26360 !! test
26361 Serialize new placeholder space without spans
26362 !! options
26363 parsoid=html2wt
26364 !! html/parsoid
26365 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
26366
26367 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
26368
26369 <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>
26370 !! wikitext
26371 foo : bar
26372
26373 foo : bar
26374
26375 <ref>foo : bar</ref>ok
26376 !! end
26377
26378
26379 #-----------------------
26380 # Tag minimization tests
26381 #-----------------------
26382
26383 !! test
26384 1. I/B quote minimization: wikitext-only tags should be combined
26385 !! options
26386 parsoid=html2wt
26387 !! html/parsoid
26388 <p><i>A</i><i>B</i></p>
26389 <p><b>A</b><b>B</b></p>
26390 <p><i>A</i><b><i>B</i></b></p>
26391 <p><b>A</b><i><b>B</b></i></p>
26392 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
26393 <p><i><b>A</b></i><i><b>B</b></i></p>
26394 <p><i><b>A</b></i><b><i>B</i></b></p>
26395 <p><b><i>A</i></b><i><b>B</b></i></p>
26396 !! wikitext
26397 ''AB''
26398
26399 '''AB'''
26400
26401 ''A'''B'''''
26402
26403 '''A''B'''''
26404
26405 '''A''BC''D'''
26406
26407 '''''AB'''''
26408
26409 '''''AB'''''
26410
26411 '''''AB'''''
26412 !! end
26413
26414 !! test
26415 2. I/B quote minimization: wikitext and html tags should not be combined
26416 !! options
26417 parsoid=html2wt
26418 !! html/parsoid
26419 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26420 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26421 !! wikitext
26422 ''A''<i>B</i>
26423
26424 ''A''<nowiki/>'''<i>B</i>'''
26425 !! end
26426
26427 !! test
26428 3. I/B quote minimization: templated content stops minimization
26429 !! options
26430 parsoid=html2wt
26431 !! html/parsoid
26432 <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>
26433 <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>
26434 !! wikitext
26435 ''A''{{echo|''B''}}
26436
26437 ''A''{{echo|'''''B'''''}}
26438 !! end
26439
26440 !! test
26441 4. I/B quote minimization: new content should be mimimized with adjacent old content
26442 !! options
26443 parsoid=html2wt
26444 !! html/parsoid
26445 <p><i>A</i><i>B</i></p>
26446 <p><b>A</b><b>B</b></p>
26447 <p><i>A</i><b><i>B</i></b></p>
26448 !! wikitext
26449 ''AB''
26450
26451 '''AB'''
26452
26453 ''A'''B'''''
26454 !! end
26455
26456 !! test
26457 5a. Merge adjacent quote nodes if they've been edited
26458 !! options
26459 parsoid={
26460 "modes": ["wt2wt", "selser"],
26461 "changes": [
26462 ["p", "contents", "remove", ":contains('b')"]
26463 ]
26464 }
26465 !! wikitext
26466 ''a''b''c''
26467 !! wikitext/edited
26468 ''ac''
26469 !! end
26470
26471 !! test
26472 5b. Merge adjacent quote nodes if they've been edited
26473 !! options
26474 parsoid={
26475 "modes": ["wt2wt", "selser"],
26476 "changes": [
26477 ["#x", "remove"]
26478 ]
26479 }
26480 !! wikitext
26481 ''a''<span id="x">b</span>''c''
26482 !! wikitext/edited
26483 ''ac''
26484 !! end
26485
26486 !! test
26487 1. Merge adjacent link nodes as long as at least one element is new
26488 !! options
26489 parsoid={
26490 "modes": ["html2wt"],
26491 "scrubWikitext": true
26492 }
26493 !! html/parsoid
26494 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26495 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26496 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26497 !! wikitext
26498 [[Football]]
26499 [[Football]]
26500 [[Football|Foot]][[Football|ball]]
26501 !! end
26502
26503 !! test
26504 2. Merge adjacent link nodes and enable additional normalizations
26505 !! options
26506 parsoid={
26507 "modes": ["html2wt"],
26508 "scrubWikitext": true
26509 }
26510 !! html/parsoid
26511 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26512 !! wikitext
26513 [[Football|''Football'']]
26514 !! end
26515
26516 !! test
26517 3. Don't merge adjacent link nodes if scrubWikitext is false
26518 !! options
26519 parsoid={
26520 "modes": ["html2wt"],
26521 "scrubWikitext": false
26522 }
26523 !! html/parsoid
26524 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26525 !! wikitext
26526 [[Football|Foot]][[Football|ball]]
26527 !! end
26528
26529 #------------------------------
26530 # End of tag minimization tests
26531 #------------------------------
26532
26533 !!test
26534 Bug 54262: New entities
26535 !! options
26536 parsoid=html2wt
26537 !! html/parsoid
26538 <span typeof="mw:Entity">&nbsp;</span>
26539 !! wikitext
26540 &nbsp;
26541 !! end
26542
26543 ## Note that there is no wikitext output for 'unknownproperty' ##
26544 ## Unknown magic words are silently dropped ##
26545
26546 !! test
26547 Magic words
26548 !! options
26549 parsoid=html2wt
26550 !! html/parsoid
26551 <meta property='mw:PageProp/toc' />
26552 <meta property='mw:PageProp/notoc' />
26553 <meta property='mw:PageProp/forcetoc' />
26554 <meta property='mw:PageProp/index' />
26555 <meta property='mw:PageProp/noindex' />
26556 <meta property='mw:PageProp/nogallery' />
26557 <meta property='mw:PageProp/noeditsection' />
26558 <meta property='mw:PageProp/notitleconvert' />
26559 <meta property='mw:PageProp/nocontentconvert' />
26560 <meta property='mw:PageProp/unknownproperty' />
26561 !! wikitext
26562 __TOC__
26563 __NOTOC__
26564 __FORCETOC__
26565 __INDEX__
26566 __NOINDEX__
26567 __NOGALLERY__
26568 __NOEDITSECTION__
26569 __NOTITLECONVERT__
26570 __NOCONTENTCONVERT__
26571 !! end
26572
26573 !! test
26574 Consecutive <pre>s should not get merged
26575 !! options
26576 parsoid=html2wt,html2html
26577 !! html/parsoid
26578 <pre>a</pre><pre>b</pre>
26579
26580 <pre>c
26581 </pre><pre>
26582 d</pre>
26583
26584 <pre>e
26585
26586 </pre><pre>
26587
26588 f</pre>
26589 !! wikitext
26590 a
26591
26592 b
26593
26594 c
26595
26596 d
26597
26598 e
26599
26600
26601
26602 f
26603 !! end
26604
26605 !! test
26606 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26607 !! options
26608 parsoid=html2wt
26609 !! html/parsoid
26610 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26611 !! wikitext
26612 [[Special:BookSources/1234567890|ISBN 1234567895]]
26613 !! end
26614
26615 !! test
26616 Edited RFC links not serializable as RFC links should serialize as extlinks
26617 !! options
26618 parsoid=html2wt
26619 !! html/parsoid
26620 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26621 !! wikitext
26622 [//tools.ietf.org/html/rfc123 New RFC]
26623 !! end
26624
26625 !! test
26626 Edited PMID links not serializable as PMID links should serialize as extlinks
26627 !! options
26628 parsoid=html2wt
26629 !! html/parsoid
26630 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26631 !! wikitext
26632 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26633 !! end
26634
26635 !! test
26636 WTS of autolinks with trailing/surrounding context
26637 !! options
26638 parsoid=html2wt
26639 !! html/parsoid
26640 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26641 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26642 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26643 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26644 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26645 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26646 !! wikitext
26647 http://cscott.net'''foo'''
26648
26649 http://cscott.net<b>foo</b>
26650
26651 '''http://cscott.net'''
26652
26653 '''http://cscott.net '''
26654
26655 '''http://cscott.net<nowiki/>x'''
26656
26657 http://cscott.net<nowiki/>x
26658 !! end
26659
26660 !! test
26661 WTS of autolinks with nowikis (round-trip)
26662 !! wikitext
26663 x<nowiki/>http://cscott.net<nowiki/>x
26664 !! html/parsoid
26665 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26666 !! end
26667
26668 # this is the "easy" test because it leaves in place all the
26669 # data-parsoid information indicating this is an autolink
26670 !! test
26671 WTS of autolinks with escapes (editing)
26672 !! options
26673 parsoid={
26674 "modes": ["wt2wt"],
26675 "changes": [
26676 [ "meta", "remove" ]
26677 ]
26678 }
26679 !! wikitext
26680 x<nowiki/>http://cscott.net<nowiki/>x
26681 !! wikitext/edited
26682 x<nowiki/>http://cscott.net<nowiki/>x
26683 !! end
26684
26685 !! test
26686 WTS of edited autolink-like text (T103364)
26687 !! options
26688 parsoid={
26689 "modes": ["wt2wt"],
26690 "changes": [
26691 [ "span[typeof]", "removeAttr", "typeof" ]
26692 ]
26693 }
26694 !! wikitext
26695 Not a link: <nowiki>http://example.com</nowiki>.
26696 !! wikitext/edited
26697 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26698 !! end
26699
26700 !! test
26701 WTS of newly-authored autolink-like text (T103364)
26702 !! options
26703 parsoid=html2wt
26704 !! html/parsoid
26705 <p>http://example.com is not a link.</p>
26706 !! wikitext
26707 <nowiki>http://example.com</nowiki> is not a link.
26708 !! end
26709
26710 !! test
26711 WTS of autolink-like text after an autolink (T108563)
26712 !! options
26713 parsoid=html2wt
26714 !! html/parsoid
26715 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26716 !! wikitext
26717 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26718 !! end
26719
26720 !! test
26721 Magic links inside links (not autolinked)
26722 !! wikitext
26723 [[Foo|http://example.com]]
26724 [[Foo|RFC 1234]]
26725 [[Foo|PMID 1234]]
26726 [[Foo|ISBN 123456789x]]
26727
26728 [http://foo.com http://example.com]
26729 [http://foo.com RFC 1234]
26730 [http://foo.com PMID 1234]
26731 [http://foo.com ISBN 123456789x]
26732 !! html+tidy
26733 <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>
26734 <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>
26735 !! html/parsoid
26736 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26737 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26738 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26739 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26740
26741 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26742 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26743 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26744 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26745 !! end
26746
26747 !! test
26748 Magic links inside image captions (autolinked)
26749 !! wikitext
26750 [[File:Foobar.jpg|thumb|http://example.com]]
26751 [[File:Foobar.jpg|thumb|RFC 1234]]
26752 [[File:Foobar.jpg|thumb|PMID 1234]]
26753 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26754 !! html+tidy
26755 <div class="thumb tright">
26756 <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>
26757 <div class="thumbcaption">
26758 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26759 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26760 </div>
26761 </div>
26762 <div class="thumb tright">
26763 <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>
26764 <div class="thumbcaption">
26765 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26766 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26767 </div>
26768 </div>
26769 <div class="thumb tright">
26770 <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>
26771 <div class="thumbcaption">
26772 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26773 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26774 </div>
26775 </div>
26776 <div class="thumb tright">
26777 <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>
26778 <div class="thumbcaption">
26779 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26780 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26781 </div>
26782 </div>
26783 !! html/parsoid
26784 <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>
26785 <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>
26786 <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>
26787 <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>
26788 !! end
26789
26790 !! test
26791 WTS of magic word text (T109371)
26792 !! options
26793 parsoid=html2wt
26794 !! html/parsoid
26795 <p>RFC 1234</p>
26796 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26797 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26798 !! wikitext
26799 <nowiki>RFC 1234</nowiki>
26800
26801 [http://foo.com RFC 1234]
26802
26803 [[Foo|RFC 1234]]
26804 !! end
26805
26806 !! test
26807 Edited Redirect link should emit a non-piped wikitext link
26808 !! options
26809 parsoid=html2wt
26810 !! html/parsoid
26811 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26812 !! wikitext
26813 #REDIRECT [[Bar]]
26814 !! end
26815
26816 !! test
26817 T75121: Infer extension name from typeOf if data-mw is not present
26818 !! options
26819 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26820 !! html/parsoid
26821 <div typeOf="mw:Extension/foo"></div>
26822 !! wikitext
26823 <foo />
26824 !! end
26825
26826 # Note that the <p> wrapping isn't present in PHP parser output
26827 # The important thing for this test is that P-wrapping doesn't
26828 # interfere with the <nowiki> protection for leading - in <td>
26829 # (which isn't necessary for <th>).
26830 !! test
26831 T88318: p-wrapped dash in table.
26832 !! options
26833 parsoid=html2wt,wt2wt
26834 !! html/parsoid
26835 <table><tbody>
26836 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26837 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26838 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26839 </tbody></table>
26840 !! wikitext
26841 {|
26842 !-
26843 !-
26844 |-
26845 |<nowiki>-</nowiki>
26846 |<nowiki>- </nowiki>
26847 |-
26848 |<small>-</small>
26849 |<br>
26850 -
26851 |<br>
26852 -
26853 |}
26854 !! html/php+tidy
26855 <table>
26856 <tr>
26857 <th>-</th>
26858 <th>-</th>
26859 </tr>
26860 <tr>
26861 <td>-</td>
26862 <td>-</td>
26863 </tr>
26864 <tr>
26865 <td><small>-</small></td>
26866 <td><br />
26867 <p>-</p>
26868 </td>
26869 <td><br />
26870 <p>-</p>
26871 </td>
26872 </tr>
26873 </table>
26874 !! end
26875
26876 !! test
26877 T149209: WTS: Handle newlines in table cells properly
26878 !! options
26879 parsoid=html2wt
26880 !! html/parsoid
26881 <table>
26882 <tbody>
26883 <tr><td>a
26884 b
26885 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
26886 <tr><td><p>x</p>
26887 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
26888 </tbody></table>
26889 <table>
26890 <tbody>
26891 <tr><th>a
26892 b
26893 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
26894 <tr><th><p>x</h>
26895 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
26896 </tbody></table>
26897 !! wikitext
26898 {|
26899 |a
26900 b
26901 |c
26902 |-
26903 |x
26904 {{!}}y
26905 |}
26906 {|
26907 !a
26908 b
26909 !c
26910 |-
26911 !x
26912 !y
26913 |}
26914 !! end
26915
26916 !! test
26917 T149209: Selser: Handle newlines in table cells properly
26918 !! options
26919 parsoid={
26920 "modes": ["selser"],
26921 "changes": [
26922 [ "#h1", "html", "a\nb\n" ],
26923 [ "#h2", "html", "a\nb\n" ],
26924 [ "#c1", "html", "a\nb\n" ],
26925 [ "#c2", "html", "<p>a</p>" ],
26926 [ "#c3", "html", "<p>a</p>" ],
26927 [ "#c4", "html", "edit-me<p>a</p>" ]
26928 ]
26929 }
26930 !! wikitext
26931 {|
26932 ! id="h1" |edit-me!!1
26933 |-
26934 ! id="h2" |edit-me||2
26935 |-
26936 | id="c1" |edit-me||3
26937 |-
26938 | id="c2" |edit-me||4
26939 |-
26940 | id="c3" |edit-me||p||q||r
26941 |-
26942 | id="c4" |edit-me||p||q||r
26943 |}
26944 !! wikitext/edited
26945 {|
26946 ! id="h1" |a
26947 b
26948 !1
26949 |-
26950 ! id="h2" |a
26951 b
26952 !2
26953 |-
26954 | id="c1" |a
26955 b
26956 |3
26957 |-
26958 | id="c2" |a
26959 |4
26960 |-
26961 | id="c3" |a
26962 |p||q||r
26963 |-
26964 | id="c4" |edit-me
26965 a
26966 |p||q||r
26967 |}
26968 !! end
26969
26970 !! test
26971 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26972 !! options
26973 parsoid=html2wt
26974 !! html/parsoid
26975 <table id='mwAb'>
26976 <td id='mwAc'>foo</td>
26977 <td id='serialize-this'>bar</td>
26978 </table>
26979 !! wikitext
26980 {|
26981 |foo
26982 | id="serialize-this" |bar
26983 |}
26984 !! end
26985
26986 !! test
26987 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26988 !! options
26989 parsoid=html2wt
26990 !! html/parsoid
26991 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26992 !! wikitext
26993 <div id="hello">ok</div>
26994 !! end
26995
26996 !! test
26997 WTS change modes
26998 !! options
26999 parsoid={
27000 "modes": ["wt2wt"],
27001 "changes": [
27002 [ "#xyz", "before", "<b>before</b> stuff " ],
27003 [ "#xyz", "after", " stuff <i>after</i>" ],
27004 [ "#xyz", "html", "x <b>y</b> z" ]
27005 ]
27006 }
27007 !! wikitext
27008 <span id="xyz">hello</span>
27009 !! wikitext/edited
27010 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
27011 !! end
27012
27013 !! test
27014 Never serialize a-tag as html, regardless of what data-parsoid has to say
27015 !! options
27016 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27017 !! html/parsoid
27018 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
27019 !! wikitext
27020 [[Foo]]
27021 !! end
27022
27023 ## SSS FIXME: This is broken output nevertheless.
27024 ## What might be a reasonable non-broken output for this?
27025 ## This is an edge case unlikely to be seen in production
27026 ## that I am not wasting more time on this right now.
27027 !! test
27028 Never serialize a-tag as html, no matter what attributes it has
27029 !! options
27030 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27031 !! html/parsoid
27032 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
27033 !! wikitext
27034 [http://boo.org http://boohoo.org]
27035 !! end
27036
27037 # Misnested is an indication that selser can reuse the source but these have
27038 # shown to sneak through on occasion. See T101768.
27039 # The original wikitext here is: [http://test.com [[one]] two three]
27040 !! test
27041 Strip span tags added to mark misnested links
27042 !! options
27043 parsoid=html2wt
27044 !! html/parsoid
27045 <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>
27046 !! wikitext
27047 [http://test.com][[one]] two three
27048 !! end
27049
27050 !! test
27051 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
27052 !! options
27053 parsoid=html2wt
27054 !! html/parsoid
27055 <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|}"]}'>
27056 <tbody><tr><td>d
27057 </td></tr>
27058 </tbody></table>
27059 !! wikitext
27060 {{echo|a}}
27061 {|{{echo|c
27062 {{!}}d
27063 }}
27064 |}
27065 !! end
27066
27067 ## This test verifies the presence and computation of this attribute indirectly
27068 ## by making an edit and ensuring that the serialization is correct (which it would be
27069 ## only if firstWikitextNode is properly set).
27070 !! test
27071 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
27072 !! options
27073 parsoid= {
27074 "modes": ["wt2wt"],
27075 "changes": [
27076 [ "div#x", "remove" ],
27077 [ "div", "before", "<div>new</div>" ]
27078 ]
27079 }
27080 !! wikitext
27081 <div id="x">foo</div>
27082 {|
27083 {{echo|<div>boo</div>
27084 {{!}}b}}
27085 |c
27086 |}
27087 !! wikitext/edited
27088
27089 <div>new</div>
27090 {|
27091 {{echo|<div>boo</div>
27092 {{!}}b}}
27093 |c
27094 |}
27095 !! end
27096
27097 # --------------------------------------------
27098 # Tests spec'ing wikitext serialization norms |
27099 # --------------------------------------------
27100
27101 !! test
27102 1. Categories should always be serialized on their own line
27103 !! options
27104 parsoid=html2wt
27105 !! html/parsoid
27106 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
27107 !! wikitext
27108 foo
27109 [[Category:Foo]]
27110 bar
27111 !! end
27112
27113 !! test
27114 2. Categories that are part of templates should not introduce a line break
27115 !! wikitext
27116 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
27117 !! html/parsoid
27118 <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>
27119 !! end
27120
27121 # Careful while editing these next 2 tests. There are \u200f characters
27122 # before and after the <link> tags in the HTML and following some
27123 # of the categories in wikitext
27124 # Do not remove these characters in edits.
27125 #
27126 # As part of the serialization, these bidi characters will get stripped.
27127 !! test
27128 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
27129 !! options
27130 parsoid={
27131 "modes": ["html2wt"],
27132 "scrubWikitext": true
27133 }
27134 !! html/parsoid
27135 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
27136 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
27137 !! wikitext
27138 [[קטגוריה:טקסים]]
27139 [[קטגוריה: שיטות משפט]]
27140 !! end
27141
27142 !! test
27143 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
27144 !! options
27145 parsoid={
27146 "modes": ["html2wt"],
27147 "scrubWikitext": true
27148 }
27149 !! html/parsoid
27150 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
27151 !! wikitext
27152 [[קטגוריה:טקסים]]
27153 ‏y
27154 !! end
27155
27156 !! test
27157 Lists: Add space after bullets
27158 !! options
27159 parsoid=html2wt
27160 !! html/parsoid
27161 <ul>
27162 <li>foo</li>
27163 <li> bar</li>
27164 <li><span> baz</span></li>
27165 </ul>
27166 !! wikitext
27167 * foo
27168 * bar
27169 * <span> baz</span>
27170 !! end
27171
27172 !! test
27173 1. Headings: Add space before/after == (T53744)
27174 !! options
27175 parsoid=html2wt
27176 !! html/parsoid
27177 <h2>foo</h2>
27178 <h2> bar</h2>
27179 <h2>baz </h2>
27180 <h2><span> baz</span></h2>
27181 !! wikitext
27182 == foo ==
27183
27184 == bar ==
27185
27186 == baz ==
27187
27188 == <span> baz</span> ==
27189 !! end
27190
27191 !! test
27192 2. Headings: Add space before/after == even after hoisted content
27193 !! options
27194 parsoid={
27195 "modes": ["html2wt"],
27196 "scrubWikitext": true
27197 }
27198 !! html/parsoid
27199 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
27200 !! wikitext
27201 [[Category:A2]]
27202
27203 == ok ==
27204 !! end
27205
27206 !! test
27207 1. Headings: suppress newly created empty headings
27208 !! options
27209 parsoid={
27210 "modes": ["html2wt"],
27211 "scrubWikitext": true
27212 }
27213 !! html/parsoid
27214 <h2></h2>
27215 !! wikitext
27216 !! end
27217
27218 !! test
27219 2. Headings: don't suppress empty headings if scrubWikitext is false
27220 !! options
27221 parsoid=html2wt
27222 !! html/parsoid
27223 <h2></h2>
27224 !! wikitext
27225 ==<nowiki/>==
27226 !! end
27227
27228 !! test
27229 3. Headings: suppress empty headings on edits
27230 !! options
27231 parsoid={
27232 "modes": ["selser"],
27233 "scrubWikitext": true,
27234 "changes": [
27235 [ "#x", "remove"]
27236 ]
27237 }
27238 !! wikitext
27239 ==<span id="x">foo</span>==
27240 !! wikitext/edited
27241 !! end
27242
27243 !! test
27244 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
27245 !! options
27246 parsoid={
27247 "modes": ["html2wt"],
27248 "scrubWikitext": true
27249 }
27250 !! html/parsoid
27251 <h2>foo<br/>bar</h2>
27252 <h2>foo <span><br/>bar</span> baz</h2>
27253 !! wikitext
27254 == foo bar ==
27255
27256 == foo <span> bar</span> baz ==
27257 !! end
27258
27259 !! test
27260 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
27261 !! options
27262 parsoid={
27263 "modes": ["html2wt"],
27264 "scrubWikitext": false
27265 }
27266 !! html/parsoid
27267 <h2>foo<br/>bar</h2>
27268 !! wikitext
27269 == foo<br> bar ==
27270 !! end
27271
27272 !! test
27273 1. WT Quote Tags: suppress newly created empty style tags
27274 !! options
27275 parsoid={
27276 "modes": ["html2wt"],
27277 "scrubWikitext": true
27278 }
27279 !! html/parsoid
27280 <i></i><b></b>
27281 !! wikitext
27282 !! end
27283
27284 !! test
27285 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
27286 !! options
27287 parsoid=html2wt
27288 !! html/parsoid
27289 <i></i><b></b>
27290 !! wikitext
27291 ''<nowiki/>'''''<nowiki/>'''
27292 !! end
27293
27294 !! test
27295 3. WT Quote Tags: suppress empty style tags on edits
27296 !! options
27297 parsoid={
27298 "modes": ["selser"],
27299 "scrubWikitext": true,
27300 "changes": [
27301 [ "#x", "remove"]
27302 ]
27303 }
27304 !! wikitext
27305 '''<span id="x">foo</span>'''
27306 !! wikitext/edited
27307 !! end
27308
27309 !! test
27310 1. Anchors: suppress newly created empty anchors
27311 !! options
27312 parsoid={
27313 "modes": ["html2wt"],
27314 "scrubWikitext": true
27315 }
27316 !! html/parsoid
27317 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27318 !! wikitext
27319 !! end
27320
27321 !! test
27322 2. Anchors: don't suppress empty anchors if scrubWikitext is false
27323 !! options
27324 parsoid={
27325 "modes": ["html2wt"],
27326 "scrubWikitext": false
27327 }
27328 !! html/parsoid
27329 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27330 !! wikitext
27331 [[Test|<nowiki/>]]
27332 !! end
27333
27334 !! test
27335 3. Anchors: suppress empty anchors on edits
27336 !! options
27337 parsoid={
27338 "modes": ["selser"],
27339 "scrubWikitext": true,
27340 "changes": [
27341 [ "#x", "remove"]
27342 ]
27343 }
27344 !! wikitext
27345 [[Test|<span id="x">foo</span>]]
27346 !! wikitext/edited
27347 !! end
27348
27349 !! test
27350 3a. Anchors: do not suppress numbered extlinks
27351 !! options
27352 parsoid={
27353 "modes": ["wt2wt"],
27354 "scrubWikitext": true
27355 }
27356 !! wikitext
27357 [http://foo.com]
27358 !! html/parsoid
27359 <a rel="mw:ExtLink" href="http://foo.com"></a>
27360 !! end
27361
27362 !! test
27363 3b. Anchors: do not suppress numbered extlinks
27364 !! options
27365 parsoid={
27366 "modes": ["wt2wt"],
27367 "scrubWikitext": true,
27368 "changes": [
27369 [ "#x", "remove"]
27370 ]
27371 }
27372 !! wikitext
27373 [http://foo.com <span id="x">foo</span>]
27374 !! wikitext/edited
27375 [http://foo.com]
27376 !! end
27377
27378 !!test
27379 Normalizations should be restricted to edited content
27380 !!options
27381 parsoid={
27382 "modes": ["selser"],
27383 "scrubWikitext": true,
27384 "changes": [
27385 [ "h1", "before", "<i></i>"]
27386 ]
27387 }
27388 !!wikitext
27389 a
27390 = =
27391 b
27392 !!wikitext/edited
27393 a
27394 = =
27395 b
27396 !!end
27397
27398 !! test
27399 1. Multiple normalizations (html2wt)
27400 !! options
27401 parsoid={
27402 "modes": ["html2wt"],
27403 "scrubWikitext": true
27404 }
27405 !! html
27406 <h2><i></i></h2>
27407 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27408 </a><b><i></i></b>x</p>
27409 !! wikitext
27410
27411 [[foo]]
27412 x
27413
27414 !! end
27415
27416 !! test
27417 2. Multiple normalizations (selser)
27418 !! options
27419 parsoid={
27420 "modes": ["selser"],
27421 "scrubWikitext": true,
27422 "changes": [
27423 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27424 ]
27425 }
27426 !! wikitext
27427 <span id="x">foo</span>
27428 !! wikitext/edited
27429 <span id="x">foo</span>
27430
27431 x
27432 !! end
27433
27434 !! test
27435 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27436 !! options
27437 parsoid={
27438 "modes": ["html2wt"],
27439 "scrubWikitext": true
27440 }
27441 !! html/parsoid
27442 <p> hi</p>
27443 <p> hello</p>
27444 !! wikitext
27445 hi
27446
27447 hello
27448 !! end
27449
27450 !! test
27451 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27452 !! options
27453 parsoid=html2wt
27454 !! html/parsoid
27455 <p> hi</p>
27456 <p> hello</p>
27457 !! wikitext
27458 <nowiki> </nowiki>hi
27459
27460 <nowiki> </nowiki> hello
27461 !! end
27462
27463 !! test
27464 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27465 !! options
27466 parsoid={
27467 "modes": ["html2wt"],
27468 "scrubWikitext": true
27469 }
27470 !! html/parsoid
27471 <p>Foo
27472 bar
27473 baz</p>
27474
27475 <table><tr><td>Foo
27476 bar
27477 baz bang</td></tr></table>
27478
27479 <p><!--boo--> foo
27480 bar</p>
27481
27482 <p> foo
27483 bar<span>boo</span></p>
27484 !! wikitext
27485 Foo
27486 bar
27487 baz
27488
27489 {|
27490 |Foo
27491 bar
27492 baz bang
27493 |}
27494
27495 <!--boo-->foo
27496 bar
27497
27498 foo
27499 bar<span>boo</span>
27500 !! end
27501
27502 !! test
27503 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27504 !! options
27505 parsoid={
27506 "modes": ["selser"],
27507 "scrubWikitext": true,
27508 "changes": [
27509 [ "p", "html", " a\n b" ]
27510 ]
27511 }
27512 !! wikitext
27513 xyz
27514 !! wikitext/edited
27515 a
27516 b
27517 !! end
27518
27519 !! test
27520 1. New links that end in spaces
27521 !! options
27522 parsoid={
27523 "modes": ["html2wt"],
27524 "scrubWikitext": false
27525 }
27526 !! html/parsoid
27527 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27528 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27529 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27530 !! wikitext
27531 [[Berlin ]]<nowiki/>is the capital of Germany.
27532
27533 [[Foo ]]'''bar'''
27534
27535 [[Boston ]] is a city.
27536 !! end
27537
27538 !! test
27539 2. New links that end in spaces
27540 !! options
27541 parsoid={
27542 "modes": ["html2wt"],
27543 "scrubWikitext": true
27544 }
27545 !! html/parsoid
27546 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27547 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27548 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27549 !! wikitext
27550 [[Berlin]] is the capital of Germany.
27551
27552 [[Foo]] '''bar'''
27553
27554 [[Boston]] is a city.
27555 !! end
27556
27557 !! test
27558 1. Table cells with escapable prefixes
27559 !! options
27560 parsoid={
27561 "modes": ["html2wt"],
27562 "scrubWikitext": false
27563 }
27564 !! html
27565 <table>
27566 <tr><td>a</td></tr>
27567 <tr><td>-</td></tr>
27568 <tr><td>+</td></tr>
27569 </table>
27570 !! wikitext
27571 {|
27572 |a
27573 |-
27574 |<nowiki>-</nowiki>
27575 |-
27576 |<nowiki>+</nowiki>
27577 |}
27578 !! end
27579
27580 !! test
27581 2. Table cells with escapable prefixes
27582 !! options
27583 parsoid={
27584 "modes": ["html2wt"],
27585 "scrubWikitext": true
27586 }
27587 !! html
27588 <table>
27589 <tr><td>a</td></tr>
27590 <tr><td>-</td></tr>
27591 <tr><td>+</td></tr>
27592 </table>
27593 !! wikitext
27594 {|
27595 |a
27596 |-
27597 | -
27598 |-
27599 | +
27600 |}
27601 !! end
27602
27603 !! test
27604 3a. Table cells with escapable prefixes after edits
27605 !! options
27606 parsoid={
27607 "modes": ["selser"],
27608 "scrubWikitext": true,
27609 "changes": [
27610 [ "table tbody tr:first-child td:first-child", "remove"]
27611 ]
27612 }
27613 !! wikitext
27614 {|
27615 |a||-
27616 |}
27617 !! wikitext/edited
27618 {|
27619 | -
27620 |}
27621 !! end
27622
27623 !! test
27624 3b. Table cells with escapable prefixes after edits
27625 !! options
27626 parsoid={
27627 "modes": ["selser"],
27628 "scrubWikitext": true,
27629 "changes": [
27630 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27631 [ "#x", "remove" ]
27632 ]
27633 }
27634 !! wikitext
27635 {|
27636 |pqr
27637 |<span id="x">foo</span>+
27638 |}
27639 !! wikitext/edited
27640 {|
27641 | -
27642 | +
27643 |}
27644 !! end
27645
27646 # FIXME: This test will fail because
27647 # normalization doesn't realize that the id attribute
27648 # will eliminate the escapable scenario
27649 !! test
27650 4a. Table cells without escapable prefixes after edits
27651 !! options
27652 parsoid={
27653 "modes": ["selser"],
27654 "scrubWikitext": true,
27655 "changes": [
27656 [ "#x", "html", "-" ]
27657 ]
27658 }
27659 !! wikitext
27660 {|
27661 | id="x" |abcd
27662 |}
27663 !! wikitext/edited
27664 {|
27665 | id="x" |-
27666 |}
27667 !! end
27668
27669 ## This tests normalizer's ability to discriminate between
27670 ## cells having identical content.
27671 !! test
27672 4b. Table cells without escapable prefixes after edits
27673 !! options
27674 parsoid={
27675 "modes": ["selser"],
27676 "scrubWikitext": true,
27677 "changes": [
27678 [ "td", "html", "-" ]
27679 ]
27680 }
27681 !! wikitext
27682 {|
27683 |a||b
27684 |}
27685 !! wikitext/edited
27686 {|
27687 | -||-
27688 |}
27689 !! end
27690
27691 ## This tests normalizer's ability to not be tripped by
27692 ## comments (and whitespace)
27693 !! test
27694 4c. Table cells without escapable prefixes after edits
27695 !! options
27696 parsoid={
27697 "modes": ["selser"],
27698 "scrubWikitext": true,
27699 "changes": [
27700 [ "table tbody tr td:first-child", "remove" ]
27701 ]
27702 }
27703 !! wikitext
27704 {|
27705 |-
27706 <!--foo--> |a||-
27707 |}
27708 !! wikitext/edited
27709 {|
27710 |-
27711 <!--foo--> | -
27712 |}
27713 !! end
27714
27715 ## This tests normalizer's ability to handle HTML cells
27716 !! test
27717 4d. Table cells without escapable prefixes after edits
27718 !! options
27719 parsoid={
27720 "modes": ["selser"],
27721 "scrubWikitext": true,
27722 "changes": [
27723 [ "td", "html", "-" ]
27724 ]
27725 }
27726 !! wikitext
27727 <table>
27728 <tr><td>a</td></tr>
27729 </table>
27730 !! wikitext/edited
27731 <table>
27732 <tr><td>-</td></tr>
27733 </table>
27734 !! end
27735
27736 ## T111151 Remove font elements without attributes
27737 !! test
27738 5a. font tags without attributes should be dropped in scrubWikitext mode
27739 !! options
27740 parsoid={
27741 "modes": ["html2wt"],
27742 "scrubWikitext": true
27743 }
27744 !! html
27745 <font>foo</font>
27746 <font><font>bar</font></font>
27747 <font class="x">boo</font>
27748 !! wikitext
27749 foo
27750 bar
27751 <font class="x">boo</font>
27752 !! end
27753
27754 !! test
27755 5b. font tags should not be dropped without scrubWikitext being enabled
27756 !! options
27757 parsoid={
27758 "modes": ["html2wt"],
27759 "scrubWikitext": false
27760 }
27761 !! html
27762 <font>foo</font>
27763 !! wikitext
27764 <font>foo</font>
27765 !! end
27766
27767 !! test
27768 Escape nowiki DOM elements
27769 !! options
27770 parsoid=html2wt
27771 !! html/parsoid
27772 <nowiki><i>foo</i></nowiki>
27773 !! wikitext
27774 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27775 !! end
27776
27777 # This is meant to be an interim fix while we go about figuring out
27778 # how to not introduce these trailing <nowiki/>s in the first place.
27779 !! test
27780 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27781 !! options
27782 parsoid=html2wt
27783 !! html/parsoid
27784 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27785 y</p>
27786 <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>
27787 <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>
27788 !! wikitext
27789 x
27790 y
27791
27792 {{echo|
27793 1 = <nowiki/>}}
27794
27795 {{echo|
27796 1 = <nowiki/>
27797 }}
27798 !! end
27799
27800 # ---------------------------------------------------
27801 # End of tests spec'ing wikitext serialization norms |
27802 # ---------------------------------------------------
27803
27804 # T104032
27805 !! test
27806 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27807 !! options
27808 parsoid=html2wt
27809 !! html/parsoid
27810 a<p>b</p>
27811 <b>c</b><p>d</p>
27812 <table><tr>
27813 <td>a<p>b</p></td>
27814 <td><b>c</b><p>d</p></td>
27815 </tr></table>
27816 !! wikitext
27817 a
27818
27819 b
27820
27821 '''c'''
27822
27823 d
27824 {|
27825 |a
27826 b
27827 |'''c'''
27828 d
27829 |}
27830 !! end
27831
27832 # -----------------------------------------------------------------
27833 # End of section for Parsoid-only html2wt tests for serialization
27834 # of new content
27835 # -----------------------------------------------------------------
27836
27837 # -----------------------------------------------------------------
27838 # The following section of tests are primarily to spec behavior of
27839 # the selective serializer. All these tests have manual selser
27840 # changes. The automated selser changes for all tests handle the
27841 # wide variation of changes, but these tests here capture specs
27842 # deterministically.
27843 # ----------------------------------------------------------------
27844
27845 ## T90517
27846 !! test
27847 Selser: New comments should not be lost
27848 !! options
27849 parsoid={
27850 "modes": ["selser"],
27851 "changes": [
27852 [ "#a", "after", "<!--c1-->" ],
27853 [ "#b", "before", "<!--c2-->" ]
27854 ]
27855 }
27856 !! wikitext
27857 <span id="a">a</span>
27858
27859 <span id="b">b</span>
27860 !! wikitext/edited
27861 <span id="a">a</span><!--c1-->
27862
27863 <!--c2--><span id="b">b</span>
27864 !! end
27865
27866 ## T89383
27867 !! test
27868 Selser: Check for validity of DSR before using it
27869 !! options
27870 parsoid={
27871 "modes": ["selser"],
27872 "changes": [
27873 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27874 ]
27875 }
27876 !! wikitext
27877 <span id="a">a</span>
27878 !! wikitext/edited
27879 {{DISPLAYTITLE:foo}}
27880 <span id="a">a</span>
27881 !! end
27882
27883 !! test
27884 1. DOMDiff: Changes to <ref> content should be looked up using id
27885 !! options
27886 parsoid={
27887 "modes": ["selser"],
27888 "changes": [
27889 ["#X", "after", "bar"],
27890 ["#Y", "after", "baz"]
27891 ]
27892 }
27893 !! wikitext
27894 X <ref><span id="X">foo</span></ref>
27895 Y <ref name="a" />
27896 <references>
27897 <ref name="a"><span id="Y">foo</span></ref>
27898 </references>
27899 !! wikitext/edited
27900 X <ref><span id="X">foo</span>bar</ref>
27901 Y <ref name="a" />
27902 <references>
27903 <ref name="a"><span id="Y">foo</span>baz</ref>
27904 </references>
27905 !! end
27906
27907 !! test
27908 2. DOMDiff: Changes to <ref> content should be looked up using id
27909 !! options
27910 parsoid={
27911 "modes": ["selser"],
27912 "changes": [
27913 ["#Z", "after", "bar"]
27914 ]
27915 }
27916 !! wikitext
27917 A <ref>foo bar for a</ref>
27918 B <ref group="X" name="b" />
27919
27920 <references />
27921
27922 <references group="X">
27923 <ref name="b"><span id="Z">foo</span></ref>
27924 </references>
27925 !! wikitext/edited
27926 A <ref>foo bar for a</ref>
27927 B <ref group="X" name="b" />
27928
27929 <references />
27930
27931 <references group="X">
27932 <ref name="b"><span id="Z">foo</span>bar</ref>
27933 </references>
27934 !! end
27935
27936 !! test
27937 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27938 !! options
27939 parsoid={
27940 "modes": ["selser"],
27941 "changes": [
27942 [ "div:first-child", "text", "bar" ]
27943 ]
27944 }
27945 !! wikitext
27946 <div style="{{1x|color:red;}}%">foo</div>
27947 !! wikitext/edited
27948 <div style="{{1x|color:red;}}%">bar</div>
27949 !! end
27950
27951 !! test
27952 Empty LI (T49673)
27953 !! wikitext
27954 * a
27955 *
27956 *
27957 * b
27958 !! html/php+tidy
27959 <ul>
27960 <li>a</li>
27961 <li class="mw-empty-elt"></li>
27962 <li class="mw-empty-elt"></li>
27963 <li>b</li>
27964 </ul>
27965 !! end
27966
27967 !! test
27968 Thumbnail output
27969 !! wikitext
27970 [[File:Thumb.png|thumb]]
27971 !! html/php+tidy
27972 <div class="thumb tright">
27973 <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>
27974 <div class="thumbcaption">
27975 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27976 </div>
27977 </div>
27978 </div>
27979 !! end
27980
27981 !! test
27982 unclosed internal link XSS (T137264)
27983 !! wikitext
27984 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27985 !! html/php
27986 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27987 </p>
27988 !! html/parsoid
27989 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
27990 !! end