Sync up with Parsoid parserTests.
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from https://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 #
36 # You can also set the following parser properties via test options:
37 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
38 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
39 # wgEnableMagicLinks
40 #
41 # For testing purposes, temporary articles can created:
42 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
43 # where '/' denotes a newline.
44
45 # This is the standard article assumed to exist.
46 !! article
47 Main Page
48 !! text
49 blah blah
50 !! endarticle
51
52 !!article
53 Foo
54 !!text
55 FOO
56 !!endarticle
57
58 !!article
59 Template:Foo
60 !!text
61 FOO
62 !!endarticle
63
64 !! article
65 Template:Blank
66 !! text
67 !! endarticle
68
69 !! article
70 Template:pipe
71 !! text
72 |
73 !! endarticle
74
75 !! article
76 Template:=
77 !! text
78 <nowiki>=</nowiki>
79 !! endarticle
80
81 !!article
82 MediaWiki:bad image list
83 !!text
84 * [[File:Bad.jpg]] except [[Nasty page]]
85 !!endarticle
86
87 !! article
88 Template:inner list
89 !! text
90 * item 1
91 !! endarticle
92
93 !! article
94 Template:tbl-start
95 !! text
96 {|
97 !! endarticle
98
99 !! article
100 Template:tbl-end
101 !! text
102 |}
103 !! endarticle
104
105 !! article
106 Template:echo
107 !! text
108 {{{1}}}
109 !! endarticle
110
111 !! article
112 Template:echo_with_span
113 !! text
114 <span>{{{1}}}</span>
115 !! endarticle
116
117 !! article
118 Template:echo_with_div
119 !! text
120 <div>{{{1}}}</div>
121 !! endarticle
122
123 !! article
124 Template:blank_param
125 !! text
126 {{{1}}}
127 {{{}}}
128 !! endarticle
129
130 !! article
131 Template:table_attribs
132 !! text
133 <noinclude>
134 |</noinclude>style="color:red;"|Foo
135 !! endarticle
136
137 !! article
138 Template:table_attribs_2
139 !! text
140 <noinclude>
141 |</noinclude>style="color:red;"|Foo
142 |Bar||Baz
143 !! endarticle
144
145 !! article
146 Template:table_attribs_3
147 !! text
148 <noinclude>
149 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
150 !! endarticle
151
152 !! article
153 Template:table_attribs_4
154 !! text
155 | style="background-color:#DC241f;" width="10px" |
156 !! endarticle
157
158 !! article
159 Template:table_attribs_5
160 !! text
161 <noinclude>
162 |</noinclude>style="color:red;"||Bar
163 !! endarticle
164
165 !! article
166 Template:table_attribs_6
167 !! text
168 style="background: <nowiki>
169
170
171 red;</nowiki>" |
172 !! endarticle
173
174 !! article
175 Template:table_attribs_7
176 !! text
177 <noinclude>
178 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
179 !! endarticle
180
181 !! article
182 Template:table_header_cells
183 !! text
184 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
185 !! endarticle
186
187 !! article
188 Template:table_cells
189 !! text
190 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
191 !! endarticle
192
193 !! article
194 Template:PartialTable
195 !! text
196 {|
197 |-
198 !! endarticle
199
200 !! article
201 Template:image_attribs
202 !! text
203 <noinclude>
204 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
205 !! endarticle
206
207 ## See T48811 for details
208 !! article
209 Template:mixed_attr_content_template
210 !! text
211 style="color:red;" title="T48811"
212 |-
213 |foo
214 !! endarticle
215
216 !! article
217 Template:definition_list
218 !! text
219 one
220 ::two
221 !! endarticle
222
223 !! article
224 A?b
225 !! text
226 Weirdo titles!
227 !! endarticle
228
229 !!article
230 Template:Bullet
231 !!text
232 * Bar
233 !!endarticle
234
235 !!article
236 Template:OpenTable
237 !!text
238 {|
239 !!endarticle
240
241 !!article
242 Template:EmptyLITest
243 !!text
244 *a
245 *
246 *
247 *b
248 !!endarticle
249
250 !!article
251 Template:EmptyTRTest
252 !!text
253 {|
254 |-
255 |-
256 |foo
257 |-
258 |-
259 |bar
260 |}
261 !!endarticle
262
263 !!article
264 Template:EmptyTRWithHTMLAttrTest
265 !!text
266 <table>
267 <tr align="center"></tr>
268 <tr><td>foo</td></tr>
269 <tr align="center"></tr>
270 <tr><td>bar</td></tr>
271 </table>
272 !!endarticle
273
274 !! article
275 Template:CircularRef
276 !! text
277 <ref>{{CircularRef}}</ref>
278 !! endarticle
279
280 ###
281 ### Basic tests
282 ###
283 !! test
284 Blank input
285 !! wikitext
286 !! html
287 !! end
288
289 !! test
290 CircularRef
291 !! wikitext
292 {{CircularRef}}
293 <references />
294 !! html/parsoid
295 <p><span about="#mwt1" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"CircularRef","href":"./Template:CircularRef"},"params":{},"i":0}}]}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
296 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">Error: Expansion loop detected at <a data-parsoid='{"a":{"href":null},"sa":{"href":"Template:CircularRef"}}'>Template:CircularRef</a></span></li></ol>
297 !! end
298
299 !! test
300 Simple paragraph
301 !! wikitext
302 This is a simple paragraph.
303 !! html
304 <p>This is a simple paragraph.
305 </p>
306 !! end
307
308 !! test
309 Paragraphs with extra newline spacing
310 !! wikitext
311 foo
312
313 bar
314
315
316 baz
317
318
319
320 booz
321 !! html
322 <p>foo
323 </p><p>bar
324 </p><p><br />
325 baz
326 </p><p><br />
327 </p><p>booz
328 </p>
329 !! end
330
331 !! test
332 Paragraphs with newline spacing with comment lines in between
333 !! wikitext
334 ----
335 a
336 <!--foo-->
337 b
338 ----
339 a
340 <!--foo--><!--More than 1 comment, still stripped-->
341 b
342 ----
343 a
344 <!--foo--> <!----> <!-- bar -->
345 b
346 ----
347 a
348 <!--foo-->
349
350 b
351 ----
352 a
353
354 <!--foo-->
355 b
356 ----
357 a
358 <!--foo-->
359
360
361 b
362 ----
363 a
364
365
366 <!--foo-->
367 b
368 ----
369 !! html
370 <hr />
371 <p>a
372 b
373 </p>
374 <hr />
375 <p>a
376 b
377 </p>
378 <hr />
379 <p>a
380 b
381 </p>
382 <hr />
383 <p>a
384 </p><p>b
385 </p>
386 <hr />
387 <p>a
388 </p><p>b
389 </p>
390 <hr />
391 <p>a
392 </p><p><br />
393 b
394 </p>
395 <hr />
396 <p>a
397 </p><p><br />
398 b
399 </p>
400 <hr />
401
402 !! end
403
404 !! test
405 Paragraphs with newline spacing with non-empty white-space lines in between
406 !! wikitext
407 ----
408 a
409
410 b
411 ----
412 a
413
414
415 b
416 ----
417 !! html
418 <hr />
419 <p>a
420 </p><p>b
421 </p>
422 <hr />
423 <p>a
424 </p><p><br />
425 b
426 </p>
427 <hr />
428
429 !! end
430
431 !! test
432 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
433 !! wikitext
434 ----
435 a
436 <!--foo-->
437 b
438 ----
439 a
440 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
441 b
442 ----
443 a
444
445 <!--foo-->
446 <!--bar-->
447 b
448 ----
449 a
450
451 <!--foo-->
452 <!--bar-->
453
454 b
455 ----
456 !! html
457 <hr />
458 <p>a
459 b
460 </p>
461 <hr />
462 <p>a
463 b
464 </p>
465 <hr />
466 <p>a
467 </p><p>b
468 </p>
469 <hr />
470 <p>a
471 </p><p><br />
472 b
473 </p>
474 <hr />
475
476 !! end
477
478 !! test
479 Extra newlines: More paragraphs with indented comment
480 !! wikitext
481 a
482
483 <!--boo-->
484
485 b
486 !! html
487 <p>a
488 </p><p><br />
489 b
490 </p>
491 !!end
492
493 !! test
494 Extra newlines followed by heading
495 !! wikitext
496 a
497
498
499
500 =b=
501 [[a]]
502
503
504 =b=
505 !! html
506 <p>a
507 </p><p><br />
508 </p>
509 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
510 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
511 </p><p><br />
512 </p>
513 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
514
515 !! end
516
517 !! test
518 Extra newlines between heading and content are swallowed
519 !! wikitext
520 =b=
521
522
523
524 [[a]]
525 !! html
526 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
527 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
528 </p>
529 !! end
530
531 !! test
532 Parsing an URL
533 !! wikitext
534 http://fr.wikipedia.org/wiki/🍺
535 <!-- EasterEgg we love beer, better be able be able to link to it -->
536 !! html
537 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
538 </p>
539 !! end
540
541 # Note that the html+tidy output removes the spaces after the <li>,
542 # which is a bug (https://sourceforge.net/p/tidy/bugs/945/, etc).
543 # This is an issue for all tests with lists. We intentionally do
544 # *not* add html+tidy clauses for these, as we don't want to
545 # document/test the broken behavior. (Parsoid matches the non-tidy
546 # output in these cases.)
547
548 !! test
549 Simple list
550 !! wikitext
551 * Item 1
552 * Item 2
553 !! html
554 <ul><li> Item 1</li>
555 <li> Item 2</li></ul>
556
557 !! end
558
559 !! test
560 Italics and bold
561 !! wikitext
562 * plain
563 * plain''italic''plain
564 * plain''italic''plain''italic''plain
565 * plain'''bold'''plain
566 * plain'''bold'''plain'''bold'''plain
567 * plain''italic''plain'''bold'''plain
568 * plain'''bold'''plain''italic''plain
569 * plain''italic'''bold-italic'''italic''plain
570 * plain'''bold''bold-italic''bold'''plain
571 * plain'''''bold-italic'''italic''plain
572 * plain'''''bold-italic''bold'''plain
573 * plain''italic'''bold-italic'''''plain
574 * plain'''bold''bold-italic'''''plain
575 * plain l'''italic''plain
576 * plain l''''bold''' plain
577 !! html
578 <ul><li> plain</li>
579 <li> plain<i>italic</i>plain</li>
580 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
581 <li> plain<b>bold</b>plain</li>
582 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
583 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
584 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
585 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
586 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
587 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
588 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
589 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
590 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
591 <li> plain l'<i>italic</i>plain</li>
592 <li> plain l'<b>bold</b> plain</li></ul>
593
594 !! end
595
596 # this example taken from the [[simple:Moon]] article (bug 47326)
597 !! test
598 Italics and possessives (1)
599 !! wikitext
600 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
601 !! html
602 <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
603 </p>
604 !! end
605
606 # this example taken from [[en:Flaming Pie]] (bug 49926)
607 !! test
608 Italics and possessives (2)
609 !! wikitext
610 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
611 !! html
612 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
613 </p>
614 !! end
615
616 # this example taken from [[en:Dictionary]] (bug 49926)
617 !! test
618 Italics and possessives (3)
619 !! wikitext
620 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''.
621 !! html
622 <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>.
623 </p>
624 !! end
625
626
627 ###
628 ### 2-quote opening sequence tests
629 ###
630 !! test
631 Italics and bold: 2-quote opening sequence: (2,2)
632 !! wikitext
633 ''foo''
634 !! html
635 <p><i>foo</i>
636 </p>
637 !!end
638
639 !! test
640 Italics and bold: 2-quote opening sequence: (2,3)
641 !! wikitext
642 ''foo'''
643 !! html/*
644 <p><i>foo'</i>
645 </p>
646 !!end
647
648 !! test
649 Italics and bold: 2-quote opening sequence: (2,4)
650 !! options
651 parsoid=wt2html
652 !! wikitext
653 ''foo''''
654 !! html/*
655 <p><i>foo''</i>
656 </p>
657 !!end
658
659 # same html as previous, but wikitext adjusted to match parsoid html2wt
660 !! test
661 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
662 !! wikitext
663 ''foo<nowiki>''</nowiki>''
664 !! html
665 <p><i>foo''</i>
666 </p>
667 !! end
668
669 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
670 !! test
671 Italics and bold: 2-quote opening sequence: (2,5)
672 !! options
673 parsoid=wt2html
674 !! wikitext
675 ''foo'''''
676 !! html/php
677 <p><i>foo</i>
678 </p>
679 !! html/parsoid
680 <p><i>foo</i><b></b>
681 </p>
682 !!end
683
684 # same html as previous, but wikitext adjusted to match parsoid html2wt
685 !! test
686 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
687 !! wikitext
688 ''foo'''''<nowiki/>'''
689 !! html/php
690 <p><i>foo</i>
691 </p>
692 !! html/parsoid
693 <p><i>foo</i><b></b>
694 </p>
695 !! end
696
697
698 ###
699 ### 3-quote opening sequence tests
700 ###
701
702 !! test
703 Italics and bold: 3-quote opening sequence: (3,2)
704 !! wikitext
705 '''foo''
706 !! html/*
707 <p>'<i>foo</i>
708 </p>
709 !!end
710
711 !! test
712 Italics and bold: 3-quote opening sequence: (3,3)
713 !! wikitext
714 '''foo'''
715 !! html
716 <p><b>foo</b>
717 </p>
718 !!end
719
720 !! test
721 Italics and bold: 3-quote opening sequence: (3,4)
722 !! wikitext
723 '''foo''''
724 !! html/*
725 <p><b>foo'</b>
726 </p>
727 !!end
728
729 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
730 !! test
731 Italics and bold: 3-quote opening sequence: (3,5)
732 !! options
733 parsoid=wt2html
734 !! wikitext
735 '''foo'''''
736 !! html/php
737 <p><b>foo</b>
738 </p>
739 !! html/parsoid
740 <p><b>foo</b><i></i>
741 </p>
742 !!end
743
744 # same html as previous, but wikitext adjusted to match parsoid html2wt
745 !! test
746 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
747 !! wikitext
748 '''foo'''''<nowiki/>''
749 !! html/php
750 <p><b>foo</b>
751 </p>
752 !! html/parsoid
753 <p><b>foo</b><i></i>
754 </p>
755 !! end
756
757
758 ###
759 ### 4-quote opening sequence tests
760 ###
761
762 !! test
763 Italics and bold: 4-quote opening sequence: (4,2)
764 !! options
765 parsoid=wt2html
766 !! wikitext
767 ''''foo''
768 !! html/*
769 <p>''<i>foo</i>
770 </p>
771 !!end
772
773 # same html as previous, but wikitext adjusted to match parsoid html2wt
774 !! test
775 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
776 !! wikitext
777 <nowiki>''</nowiki>''foo''
778 !! html
779 <p>''<i>foo</i>
780 </p>
781 !! end
782
783 !! test
784 Italics and bold: 4-quote opening sequence: (4,3)
785 !! wikitext
786 ''''foo'''
787 !! html/*
788 <p>'<b>foo</b>
789 </p>
790 !!end
791
792 !! test
793 Italics and bold: 4-quote opening sequence: (4,4)
794 !! options
795 parsoid=wt2html
796 !! wikitext
797 ''''foo''''
798 !! html/*
799 <p>'<b>foo'</b>
800 </p>
801 !!end
802
803 # same html as previous, but wikitext adjusted to match parsoid html2wt
804 !! test
805 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
806 !! wikitext
807 '<nowiki/>'''foo''''
808 !! html
809 <p>'<b>foo'</b>
810 </p>
811 !! end
812
813 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
814 !! test
815 Italics and bold: 4-quote opening sequence: (4,5)
816 !! options
817 parsoid=wt2html
818 !! wikitext
819 ''''foo'''''
820 !! html/php
821 <p>'<b>foo</b>
822 </p>
823 !! html/parsoid
824 <p>'<b>foo</b><i></i>
825 </p>
826 !!end
827
828 # same html as previous, but wikitext adjusted to match parsoid html2wt
829 !! test
830 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
831 !! wikitext
832 '<nowiki/>'''foo'''''<nowiki/>''
833 !! html/php
834 <p>'<b>foo</b>
835 </p>
836 !! html/parsoid
837 <p>'<b>foo</b><i></i>
838 </p>
839 !! end
840
841
842 ###
843 ### 5-quote opening sequence tests
844 ###
845
846 !! test
847 Italics and bold: 5-quote opening sequence: (5,2)
848 !! options
849 parsoid=wt2html
850 !! wikitext
851 '''''foo''
852 !! html/*
853 <p><b><i>foo</i></b>
854 </p>
855 !!end
856
857 # same html as previous, but wikitext adjusted to match parsoid html2wt
858 !! test
859 Italics and bold: 5-quote opening sequence: (5,2+3)
860 !! wikitext
861 '''''foo'''''
862 !! html/*
863 <p><i><b>foo</b></i>
864 </p>
865 !! end
866
867 !! test
868 Italics and bold: 5-quote opening sequence: (5,3)
869 !! options
870 parsoid=wt2html
871 !! wikitext
872 '''''foo'''
873 !! html/*
874 <p><i><b>foo</b></i>
875 </p>
876 !!end
877
878 # same html as previous, but wikitext adjusted to match parsoid html2wt
879 !! test
880 Italics and bold: 5-quote opening sequence: (5,3+2)
881 !! wikitext
882 '''''foo'''''
883 !! html
884 <p><i><b>foo</b></i>
885 </p>
886 !! end
887
888 !! test
889 Italics and bold: 5-quote opening sequence: (5,4)
890 !! options
891 parsoid=wt2html
892 !! wikitext
893 '''''foo''''
894 !! html/*
895 <p><i><b>foo'</b></i>
896 </p>
897 !!end
898
899 !! test
900 Italics and bold: 5-quote opening sequence: (5,5)
901 !! wikitext
902 '''''foo'''''
903 !! html
904 <p><i><b>foo</b></i>
905 </p>
906 !!end
907
908 !! test
909 Italics and bold: 5-quote opening sequence: (5,6)
910 !! wikitext
911 '''''foo''''''
912 !! html/*
913 <p><i><b>foo'</b></i>
914 </p>
915 !! end
916
917 ###
918 ### multiple quote sequences in a line
919 ###
920 !! test
921 Italics and bold: multiple quote sequences: (2,4,2)
922 !! options
923 parsoid=wt2html
924 !! wikitext
925 ''foo''''bar''
926 !! html/*
927 <p><i>foo'<b>bar</b></i>
928 </p>
929 !!end
930
931
932 # same html as previous, but wikitext adjusted to match parsoid html2wt
933 !! test
934 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
935 !! wikitext
936 ''foo'<nowiki/>'''bar'''''
937 !! html
938 <p><i>foo'<b>bar</b></i>
939 </p>
940 !! end
941
942
943 !! test
944 Italics and bold: multiple quote sequences: (2,4,3)
945 !! options
946 parsoid=wt2html
947 !! wikitext
948 ''foo''''bar'''
949 !! html/*
950 <p><i>foo'<b>bar</b></i>
951 </p>
952 !!end
953
954
955 # same html as previous, but wikitext adjusted to match parsoid html2wt
956 !! test
957 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
958 !! wikitext
959 ''foo'<nowiki/>'''bar'''''
960 !! html
961 <p><i>foo'<b>bar</b></i>
962 </p>
963 !! end
964
965
966 !! test
967 Italics and bold: multiple quote sequences: (2,4,4)
968 !! options
969 parsoid=wt2html
970 !! wikitext
971 ''foo''''bar''''
972 !! html/*
973 <p><i>foo'<b>bar'</b></i>
974 </p>
975 !!end
976
977
978 # same html as previous, but wikitext adjusted to match parsoid html2wt
979 !! test
980 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
981 !! wikitext
982 ''foo'<nowiki/>'''bar'<nowiki/>'''''
983 !! html
984 <p><i>foo'<b>bar'</b></i>
985 </p>
986 !! end
987
988
989 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
990 !! test
991 Italics and bold: multiple quote sequences: (3,4,2)
992 !! options
993 parsoid=wt2html
994 !! wikitext
995 '''foo''''bar''
996 !! html/php
997 <p><b>foo'</b>bar
998 </p>
999 !! html/parsoid
1000 <p><b>foo'</b>bar<i></i>
1001 </p>
1002 !!end
1003
1004 # same html as previous, but wikitext adjusted to match parsoid html2wt
1005 !! test
1006 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1007 !! options
1008 parsoid
1009 !! wikitext
1010 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
1011 !! html/php
1012 <p><b>foo'</b>bar
1013 </p>
1014 !! html/parsoid
1015 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1016 </p>
1017 !! end
1018
1019
1020 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1021 !! test
1022 Italics and bold: multiple quote sequences: (3,4,3)
1023 !! options
1024 parsoid=wt2html
1025 !! wikitext
1026 '''foo''''bar'''
1027 !! html/php
1028 <p><b>foo'</b>bar
1029 </p>
1030 !! html/parsoid
1031 <p><b>foo'</b>bar<b></b>
1032 </p>
1033 !!end
1034
1035 # same html as previous, but wikitext adjusted to match parsoid html2wt
1036 !! test
1037 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1038 !! wikitext
1039 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1040 !! html/php
1041 <p><b>foo'</b>bar
1042 </p>
1043 !! html/parsoid
1044 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1045 </p>
1046 !! end
1047
1048 ###
1049 ### other quote tests
1050 ###
1051 !! test
1052 Italics and bold: other quote tests: (2,3,5)
1053 !! wikitext
1054 ''this is about '''foo's family'''''
1055 !! html
1056 <p><i>this is about <b>foo's family</b></i>
1057 </p>
1058 !!end
1059
1060
1061 !! test
1062 Italics and bold: other quote tests: (2,(3,3),2)
1063 !! wikitext
1064 ''this is about '''foo's''' family''
1065 !! html
1066 <p><i>this is about <b>foo's</b> family</i>
1067 </p>
1068 !!end
1069
1070
1071 !! test
1072 Italics and bold: other quote tests: (3,2,3,2)
1073 !! options
1074 parsoid=wt2html
1075 !! wikitext
1076 '''this is about ''foo'''s family''
1077 !! html/*
1078 <p><b>this is about <i>foo</i></b><i>s family</i>
1079 </p>
1080 !!end
1081
1082
1083 # same html as previous, but wikitext adjusted to match parsoid html2wt
1084 !! test
1085 Italics and bold: other quote tests: (3,2,3+2+2,2)
1086 !! wikitext
1087 '''this is about ''foo'''''<nowiki/>''s family''
1088 !! html
1089 <p><b>this is about <i>foo</i></b><i>s family</i>
1090 </p>
1091 !! end
1092
1093
1094 !! test
1095 Italics and bold: other quote tests: (3,2,3,3)
1096 !! wikitext
1097 '''this is about ''foo'''s family'''
1098 !! html/*
1099 <p>'<i>this is about </i>foo<b>s family</b>
1100 </p>
1101 !!end
1102
1103
1104 !! test
1105 Italics and bold: other quote tests: (3,(2,2),3)
1106 !! wikitext
1107 '''this is about ''foo's'' family'''
1108 !! html
1109 <p><b>this is about <i>foo's</i> family</b>
1110 </p>
1111 !!end
1112
1113
1114 !! test
1115 Italicized possessive
1116 !! wikitext
1117 The ''[[Main Page]]'''s talk page.
1118 !! html/php
1119 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1120 </p>
1121 !! html/parsoid
1122 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1123 !! end
1124
1125 !! test
1126 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1127 (Requires tidy for PHP parser output to be fixed up)
1128 !! options
1129 parsoid=wt2html,wt2wt
1130 !! wikitext
1131 {|
1132 !''a!!''b
1133 |''a||''b
1134 |}
1135 !! html/php+tidy
1136 <table>
1137 <tr>
1138 <th><i>a</i></th>
1139 <th><i>b</i></th>
1140 <td><i>a</i></td>
1141 <td><i>b</i></td>
1142 </tr>
1143 </table>
1144 !! html/parsoid
1145 <table>
1146 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1147 <td><i>a</i></td><td><i>b</i></td></tr>
1148 </tbody></table>
1149 !! end
1150
1151 ###
1152 ### Non-html5 tags
1153 ###
1154
1155 !! test
1156 Non-html5 tags should be accepted
1157 !! wikitext
1158 <center>''foo''</center>
1159 <big>''foo''</big>
1160 <font>''foo''</font>
1161 <strike>''foo''</strike>
1162 <tt>''foo''</tt>
1163 !! html
1164 <center><i>foo</i></center>
1165 <p><big><i>foo</i></big>
1166 <font><i>foo</i></font>
1167 <strike><i>foo</i></strike>
1168 <tt><i>foo</i></tt>
1169 </p>
1170 !! end
1171
1172 !! test
1173 <wbr> is valid wikitext (bug 52468)
1174 !! wikitext
1175 <wbr>
1176 !! html
1177 <p><wbr />
1178 </p>
1179 !! end
1180
1181 # <strike> is HTML4, <s> is HTML4/5.
1182 !! test
1183 <s> or <strike> for strikethrough
1184 !! wikitext
1185 <strike>strike</strike>
1186
1187 <s>s</s>
1188 !! html
1189 <p><strike>strike</strike>
1190 </p><p><s>s</s>
1191 </p>
1192 !! end
1193
1194 ## a not permitted
1195 ## i,b,br omitted
1196 !! test
1197 Text-level semantic html elements in wikitext
1198 !! wikitext
1199 <em>text</em>
1200 <strong>text</strong>
1201 <small>text</small>
1202 <s>text</s>
1203 <cite>text</cite>
1204 <q>text</q>
1205 <dfn>text</dfn>
1206 <abbr>text</abbr>
1207 <data>text</data>
1208 <time>text</time>
1209 <code>text</code>
1210 <var>text</var>
1211 <samp>text</samp>
1212 <kbd>text</kbd>
1213 <sub>text</sub>
1214 <u>text</u>
1215 <mark>text</mark>
1216 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1217 <bdi>text</bdi>
1218 <bdo>text</bdo>
1219 <span>text</span>
1220 <wbr />
1221 !! html
1222 <p><em>text</em>
1223 <strong>text</strong>
1224 <small>text</small>
1225 <s>text</s>
1226 <cite>text</cite>
1227 <q>text</q>
1228 <dfn>text</dfn>
1229 <abbr>text</abbr>
1230 <data>text</data>
1231 <time>text</time>
1232 <code>text</code>
1233 <var>text</var>
1234 <samp>text</samp>
1235 <kbd>text</kbd>
1236 <sub>text</sub>
1237 <u>text</u>
1238 <mark>text</mark>
1239 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1240 <bdi>text</bdi>
1241 <bdo>text</bdo>
1242 <span>text</span>
1243 <wbr />
1244 </p>
1245 !! end
1246
1247 # test cases taken from
1248 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1249 !! test
1250 Ruby markup (W3C-style)
1251 !! wikitext
1252 ; Mono-ruby for individual base characters
1253 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1254 ; Group ruby
1255 : <ruby>今日<rt>きょう</rt></ruby>
1256 ; Jukugo ruby
1257 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1258 ; Inline ruby
1259 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1260 ; Double-sided ruby
1261 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1262 <ruby>
1263 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1264 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1265 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1266 </ruby>
1267 !! html
1268 <dl><dt> Mono-ruby for individual base characters</dt>
1269 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1270 <dt> Group ruby</dt>
1271 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1272 <dt> Jukugo ruby</dt>
1273 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1274 <dt> Inline ruby</dt>
1275 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1276 <dt> Double-sided ruby</dt>
1277 <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>
1278 <p><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 </p>
1284 !! end
1285
1286 # The next two test different paths in the sanitizer.
1287 !! test
1288 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1289 !! wikitext
1290 <blockquote|>a</blockquote>
1291
1292 <b→> doesn't terminate </b→>
1293
1294 <bä> doesn't terminate </bä>
1295
1296 <boo> doesn't terminate </boo>
1297
1298 <s.foo> doesn't terminate </s.foo>
1299
1300 <sub-ID#1>
1301 !! html
1302 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1303 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1304 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1305 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1306 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1307 </p><p>&lt;sub-ID#1&gt;
1308 </p>
1309 !! end
1310
1311 # There is a tidy bug here: https://sourceforge.net/p/tidy/bugs/946/
1312 # If the non-word-character tag made it through the sanitizer, tidy
1313 # would munge it up.
1314 !! test
1315 Non-word characters don't terminate tag names + tidy
1316 !! wikitext
1317 <blockquote|>a</blockquote>
1318
1319 <b→> doesn't terminate </b→>
1320
1321 <bä> doesn't terminate </bä>
1322
1323 <boo> doesn't terminate </boo>
1324
1325 <s.foo> doesn't terminate </s.foo>
1326
1327 <sub-ID#1>
1328 !! html+tidy
1329 <p>&lt;blockquote|&gt;a</p>
1330 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1331 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1332 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1333 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1334 <p>&lt;sub-ID#1&gt;</p>
1335 !! end
1336
1337 ###
1338 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1339 ### This checks that HTML5 tags (with non-word characters in the tag
1340 ### name) make it safely through the parser -- the Sanitizer will
1341 ### munge them later, as it should.
1342 ###
1343 !! test
1344 Non-word characters are valid in extension tags (T19663)
1345 !! wikitext
1346 <tåg>tåg</tåg>
1347 !! html/php
1348 <pre>
1349 'tåg'
1350 array (
1351 )
1352 </pre>
1353
1354 !! html/parsoid
1355 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1356 !! end
1357
1358 !! test
1359 Isolated close tags should be treated as literal text (bug 52760)
1360 !! options
1361 parsoid=wt2html
1362 !! wikitext
1363 </b>
1364
1365 <s.foo>s</s>
1366 !! html/php+tidy
1367 <p>&lt;s.foo&gt;s</p>
1368 !! html/parsoid
1369 <p>&lt;s.foo&gt;s</p>
1370 !! end
1371
1372 ###
1373 ### Special characters
1374 ###
1375
1376 !! test
1377 Bare pipe character (bug 52363)
1378 !! wikitext
1379 |
1380 !! html
1381 <p>|
1382 </p>
1383 !! end
1384
1385 !! test
1386 Bare pipe character from a template (bug 52363)
1387 !! wikitext
1388 {{pipe}}
1389 !! html
1390 <p>|
1391 </p>
1392 !! end
1393
1394 ###
1395 ### <nowiki> test cases
1396 ###
1397
1398 !! test
1399 <nowiki> unordered list
1400 !! wikitext
1401 <nowiki>* This is not an unordered list item.</nowiki>
1402 !! html/php
1403 <p>* This is not an unordered list item.
1404 </p>
1405 !! html/parsoid
1406 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1407 !! end
1408
1409 !! test
1410 <nowiki> spacing
1411 !! wikitext
1412 <nowiki>Lorem ipsum dolor
1413
1414 sed abit.
1415 sed nullum.
1416
1417 :and a colon
1418 </nowiki>
1419 !! html/php
1420 <p>Lorem ipsum dolor
1421
1422 sed abit.
1423 sed nullum.
1424
1425 :and a colon
1426
1427 </p>
1428 !! html/parsoid
1429 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1430
1431 sed abit.
1432 sed nullum.
1433
1434 :and a colon
1435 </span></p>
1436 !! end
1437
1438 !! test
1439 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1440 !! wikitext
1441 <nowiki><span class="error"></nowiki>
1442 !! html/php
1443 <p>&lt;span class="error"&gt;
1444 </p>
1445 !! html/parsoid
1446 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1447 !! end
1448
1449 !! test
1450 nowiki 3
1451 !! wikitext
1452 :There is not nowiki.
1453 :There is <nowiki>nowiki</nowiki>.
1454
1455 #There is not nowiki.
1456 #There is <nowiki>nowiki</nowiki>.
1457
1458 *There is not nowiki.
1459 *There is <nowiki>nowiki</nowiki>.
1460 !! html/php
1461 <dl><dd>There is not nowiki.</dd>
1462 <dd>There is nowiki.</dd></dl>
1463 <ol><li>There is not nowiki.</li>
1464 <li>There is nowiki.</li></ol>
1465 <ul><li>There is not nowiki.</li>
1466 <li>There is nowiki.</li></ul>
1467
1468 !! html/parsoid
1469 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1470 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1471
1472 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1473 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1474
1475 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1476 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1477 !! end
1478
1479 !! test
1480 Entities inside <nowiki>
1481 !! wikitext
1482 <nowiki>&lt;</nowiki>
1483 !! html
1484 <p>&lt;
1485 </p>
1486 !! end
1487
1488 !! test
1489 Entities inside template parameters
1490 !! wikitext
1491 {{echo|&ndash;}}
1492 !! html/php+tidy
1493 <p>–</p>
1494 !! html/parsoid
1495 <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>
1496 !! end
1497
1498 !! test
1499 Properly escape nowiki when combined with other wiki markup
1500 !! options
1501 parsoid=html2wt
1502 !! html/parsoid
1503 <p>* &lt;/nowiki&gt; tag</p>
1504 !! wikitext
1505 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1506 !! end
1507
1508 !! test
1509 T93824: Put escaped HTML tags inside nowiki
1510 !! options
1511 parsoid=html2wt
1512 !! html/parsoid
1513 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1514 !! wikitext
1515 <nowiki><h2>foo</h2></nowiki>
1516 !! end
1517
1518 !! test
1519 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1520 !! options
1521 parsoid=html2wt
1522 !! html/parsoid
1523 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1524 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1525 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1526 !! wikitext
1527 This text: L'[[Foo]]
1528 This text: L<nowiki>''</nowiki>[[Foo]]
1529 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1530 !! end
1531
1532 # This test fails because wikitext whitespace is not normalized before comparing.
1533 !! test
1534 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1535 !! options
1536 parsoid=html2wt
1537 !! html/parsoid
1538 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1539 </p>
1540 !! wikitext
1541 This text : L<nowiki>''</nowiki>[[Foo]]
1542 !! end
1543
1544 # This test and the next one are html2wt only as they test that incorrect wikitext
1545 # passed in template arguments gets escaped or wrapped in nowikis where required.
1546 !! test
1547 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1548 !! options
1549 parsoid=html2wt
1550 !! html/parsoid
1551 <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>
1552 <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>
1553 !! wikitext
1554 {{echo|foo{{!}}bar}}
1555 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1556 !! end
1557
1558 !! test
1559 T53961: Output correct nowikis in template arguments
1560 !! options
1561 parsoid=html2wt
1562 !! html/parsoid
1563 <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>
1564 <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>
1565 <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>
1566 <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>
1567 <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>
1568 !! wikitext
1569 {{echo|a [ b}}
1570 {{echo|<nowiki>a }} b</nowiki>}}
1571 {{echo|<nowiki>a [[ b</nowiki>}}
1572 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1573 {{echo|a <nowiki>}</nowiki>}}
1574 !! end
1575
1576 !! test
1577 Cases where "!!" needs nowiki protection
1578 !! options
1579 parsoid=html2wt
1580 !! html/parsoid
1581 <table>
1582 <tr><th>this needs protection !! here</th></tr>
1583 </table>
1584
1585 <table>
1586 <tr><th>this does not need
1587 protection !! here</th></tr>
1588 </table>
1589 !! wikitext
1590 {|
1591 !<nowiki>this needs protection !! here</nowiki>
1592 |}
1593
1594 {|
1595 !this does not need
1596 protection !! here
1597 |}
1598 !! end
1599
1600 ###
1601 ### Comments
1602 ###
1603 !! test
1604 Comments and Indent-Pre
1605 !! wikitext
1606 <!-- comment 1 --> asdf
1607
1608 <!-- comment 1 --> asdf
1609 <!-- comment 2 -->
1610
1611 <!-- comment 1 --> asdf
1612 <!-- comment 2 -->xyz
1613
1614 <!-- comment 1 --> asdf
1615 <!-- comment 2 --> xyz
1616 !! html
1617 <pre>asdf
1618 </pre>
1619 <pre>asdf
1620 </pre>
1621 <pre>asdf
1622 </pre>
1623 <p>xyz
1624 </p>
1625 <pre>asdf
1626 xyz
1627 </pre>
1628 !! end
1629
1630 !! test
1631 Comment test 2a
1632 !! wikitext
1633 asdf
1634 <!-- comment 1 -->
1635 jkl
1636 !! html
1637 <p>asdf
1638 jkl
1639 </p>
1640 !! end
1641
1642 !! test
1643 Comment test 2b
1644 !! wikitext
1645 asdf
1646 <!-- comment 1 -->
1647
1648 jkl
1649 !! html
1650 <p>asdf
1651 </p><p>jkl
1652 </p>
1653 !! end
1654
1655 !! test
1656 Comment test 3
1657 !! wikitext
1658 asdf
1659 <!-- comment 1 -->
1660 <!-- comment 2 -->
1661 jkl
1662 !! html
1663 <p>asdf
1664 jkl
1665 </p>
1666 !! end
1667
1668 !! test
1669 Comment test 4
1670 !! wikitext
1671 asdf<!-- comment 1 -->jkl
1672 !! html
1673 <p>asdfjkl
1674 </p>
1675 !! end
1676
1677 !! test
1678 Comment spacing
1679 !! wikitext
1680 a
1681 <!-- foo --> b <!-- bar -->
1682 c
1683 !! html
1684 <p>a
1685 </p>
1686 <pre> b
1687 </pre>
1688 <p>c
1689 </p>
1690 !! end
1691
1692 !! test
1693 Comment whitespace
1694 !! wikitext
1695 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1696 !! html
1697
1698 !! end
1699
1700 !! test
1701 Comment semantics and delimiters
1702 !! wikitext
1703 <!-- --><!----><!-----><!------>
1704 !! html/php
1705
1706 !! html/parsoid
1707 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1708 !! end
1709
1710 !! test
1711 Comment semantics and delimiters, redux
1712 !! wikitext
1713 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1714 -- foo -- funky huh? ... -->
1715 !! html/php
1716
1717 !! html/parsoid
1718 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1719 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1720 !! end
1721
1722 !! test
1723 Comment semantics and delimiters: directors cut
1724 !! wikitext
1725 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1726 everything starting with < followed by !-- until the first -- and > we see,
1727 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1728 -->-->
1729 !! html/php
1730 <p>--&gt;
1731 </p>
1732 !! html/parsoid
1733 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1734 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1735 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1736 --><p>--></p>
1737 !! end
1738
1739 !! test
1740 Comment semantics: nesting
1741 !! wikitext
1742 <!--<!-- no, we're not going to do anything fancy here -->-->
1743 !! html/php
1744 <p>--&gt;
1745 </p>
1746 !! html/parsoid
1747 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1748 !! end
1749
1750 # Parsoid closes the unclosed comment, even if it means a slight
1751 # round-trip diff.
1752 !! test
1753 Comment semantics: unclosed comment at end
1754 !! options
1755 parsoid=wt2html,html2html
1756 !! wikitext
1757 <!--This comment will run out to the end of the document
1758 !! html/php
1759
1760 !! html/parsoid
1761 <!--This comment will run out to the end of the document-->
1762 !! end
1763
1764 !! test
1765 Comment semantics: normalize comments to play nice with XML and browsers
1766 !! wikitext
1767 <!-- Browsers --!> think this is closed -->
1768 <!--> This would normally be text -->
1769 <!---> As would this -->
1770 <!-- XML doesn't like trailing dashes -------->
1771 <!-- Nor doubled hyphens -- anywhere in the data -->
1772 But this is not a comment.
1773 !! html/php
1774 <p>But this is not a comment.
1775 </p>
1776 !! html/parsoid
1777 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1778 <!--&#x3E; This would normally be text -->
1779 <!--&#x2D;&#x3E; As would this -->
1780 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1781 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1782 <p>But this is not a comment.</p>
1783 !! end
1784
1785 !! test
1786 Comment semantics: round-trip even text which contains encoded -->
1787 !! wikitext
1788 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1789 !! html/parsoid
1790 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1791 !! end
1792
1793 !! test
1794 Comment in template title
1795 !! wikitext
1796 {{f<!---->oo}}
1797 !! html
1798 <p>FOO
1799 </p>
1800 !! end
1801
1802 !! test
1803 Comment on its own line post-expand
1804 !! wikitext
1805 a
1806 {{blank}}<!---->
1807 b
1808 !! html
1809 <p>a
1810 </p><p>b
1811 </p>
1812 !! end
1813
1814 !! test
1815 Comment on its own line post-expand with non-significant whitespace
1816 !! wikitext
1817 a
1818 {{blank}} <!---->
1819 b
1820 !! html
1821 <p>a
1822 </p><p>b
1823 </p>
1824 !! end
1825
1826 !! test
1827 Multiple comments should still parse as SOL-transparent
1828 !! options
1829 parsoid=wt2html,wt2wt
1830 !! wikitext
1831 <!--c1-->*a
1832 <!--c2--><!--c3--><!--c4-->*b
1833 !! html/php
1834 <ul><li>a</li>
1835 <li>b</li></ul>
1836
1837 !! html/parsoid
1838 <!--c1--><ul>
1839 <li>a
1840 </li>
1841 <!--c2--><!--c3--><!--c4-->
1842 <li>b
1843 </li>
1844 </ul>
1845 !! end
1846
1847 ###
1848 ### paragraph wrapping tests
1849 ###
1850 !! test
1851 No block tags
1852 !! wikitext
1853 a
1854
1855 b
1856 !! html
1857 <p>a
1858 </p><p>b
1859 </p>
1860 !! end
1861
1862 !! test
1863 Block tag on one line (<div>)
1864 !! wikitext
1865 a <div>foo</div>
1866
1867 b
1868 !! html
1869 a <div>foo</div>
1870 <p>b
1871 </p>
1872 !! html+tidy
1873 <p>a</p>
1874 <div>foo</div>
1875 <p>b</p>
1876 !! end
1877
1878 !! test
1879 Block tag on one line (<blockquote>)
1880 !! wikitext
1881 a <blockquote>foo</blockquote>
1882
1883 b
1884 !! html
1885 a <blockquote>foo</blockquote>
1886 <p>b
1887 </p>
1888 !! html+tidy
1889 <p>a</p>
1890 <blockquote>
1891 <p>foo</p>
1892 </blockquote>
1893 <p>b</p>
1894 !! end
1895
1896 !! test
1897 Block tag on both lines (<div>)
1898 !! wikitext
1899 a <div>foo</div>
1900
1901 b <div>foo</div>
1902 !! html
1903 a <div>foo</div>
1904 b <div>foo</div>
1905
1906 !! html+tidy
1907 <p>a</p>
1908 <div>foo</div>
1909 <p>b</p>
1910 <div>foo</div>
1911 !! end
1912
1913 !! test
1914 Block tag on both lines (<blockquote>)
1915 !! wikitext
1916 a <blockquote>foo</blockquote>
1917
1918 b <blockquote>foo</blockquote>
1919 !! html
1920 a <blockquote>foo</blockquote>
1921 b <blockquote>foo</blockquote>
1922
1923 !! html+tidy
1924 <p>a</p>
1925 <blockquote>
1926 <p>foo</p>
1927 </blockquote>
1928 <p>b</p>
1929 <blockquote>
1930 <p>foo</p>
1931 </blockquote>
1932 !! end
1933
1934 !! test
1935 Multiple lines without block tags
1936 !! wikitext
1937 <div>foo</div> a
1938 b
1939 c
1940 d<!--foo--> e
1941 x <div>foo</div> z
1942 !! html
1943 <div>foo</div> a
1944 <p>b
1945 c
1946 d e
1947 </p>
1948 x <div>foo</div> z
1949
1950 !! html+tidy
1951 <div>foo</div>
1952 <p>a</p>
1953 <p>b c d e</p>
1954 <p>x</p>
1955 <div>foo</div>
1956 <p>z</p>
1957 !! end
1958
1959 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1960 # So, we have a separate section for Parsoid. We don't want
1961 # to mimic this stripping behavior in Parsoid. It affects
1962 # editing experience and also requires us to maintain additional
1963 # info for RT-ing.
1964 !! test
1965 Empty lines between lines with block tags
1966 !! wikitext
1967 <div></div>
1968
1969
1970 <div></div>a
1971
1972 b
1973 <div>a</div>b
1974
1975 <div>b</div>d
1976
1977
1978 <div>e</div>
1979 !! html
1980 <div></div>
1981 <p><br />
1982 </p>
1983 <div></div>a
1984 <p>b
1985 </p>
1986 <div>a</div>b
1987 <div>b</div>d
1988 <p><br />
1989 </p>
1990 <div>e</div>
1991
1992 !! html+tidy
1993 <p><br /></p>
1994 <p>a</p>
1995 <p>b</p>
1996 <div>a</div>
1997 <p>b</p>
1998 <div>b</div>
1999 <p>d</p>
2000 <p><br /></p>
2001 <div>e</div>
2002 !! html/parsoid
2003 <div data-parsoid='{"stx":"html"}'></div>
2004
2005 <p><br /></p>
2006 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2007
2008 <p>b</p>
2009 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2010
2011 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2012
2013 <p><br /></p>
2014 <div data-parsoid='{"stx":"html"}'>e</div>
2015 !! end
2016
2017 ## PHP parser emits output which is broken
2018 !! test
2019 Unclosed HTML p-tags should be handled properly
2020 !! wikitext
2021 <div><p>foo</div>
2022 a
2023
2024 b
2025 !! html/php+tidy
2026 <div>
2027 <p>foo</p>
2028 </div>
2029 <p>a</p>
2030 <p>b</p>
2031 !! html/parsoid
2032 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2033 <p>a</p>
2034 <p>b</p>
2035 !! end
2036
2037 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2038 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2039 ## them for now.
2040 !! test
2041 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2042 !! options
2043 parsoid=wt2html
2044 !! wikitext
2045 a [[Category:A1]] [[Category:A2]]
2046 [[Category:A3]]
2047 [[Category:A4]]
2048 !! html/parsoid
2049 <p>a</p>
2050 <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"/>
2051 !! end
2052
2053 !! test
2054 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2055 !! options
2056 parsoid=wt2html
2057 !! wikitext
2058 [[Category:A1]]a
2059 !! html/parsoid
2060 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2061 !! end
2062
2063 ###
2064 ### Preformatted text
2065 ###
2066 !! test
2067 Preformatted text
2068 !! wikitext
2069 This is some
2070 Preformatted text
2071 With ''italic''
2072 And '''bold'''
2073 And a [[Main Page|link]]
2074 !! html
2075 <pre>This is some
2076 Preformatted text
2077 With <i>italic</i>
2078 And <b>bold</b>
2079 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2080 </pre>
2081 !! end
2082
2083 !! test
2084 Tabs don't trigger preformatted text
2085 !! wikitext
2086 This is not
2087 preformatted text.
2088 This is preformatted text.
2089 So is this.
2090 !! html/php
2091 <p> This is not
2092 preformatted text.
2093 </p>
2094 <pre>This is preformatted text.
2095 So is this.
2096 </pre>
2097 !! html/parsoid
2098 <p> This is not
2099 preformatted text.</p>
2100 <pre>This is preformatted text.
2101 So is this.</pre>
2102 !! end
2103
2104 !! test
2105 Space before tab needs nowiki pre protection
2106 !! options
2107 parsoid=html2wt
2108 !! html/parsoid
2109 <p> a</p>
2110 !! wikitext
2111 <nowiki> </nowiki> a
2112 !! end
2113
2114 !! test
2115 Ident preformatting with inline content
2116 !! wikitext
2117 a
2118 ''b''
2119 !! html
2120 <pre>a
2121 <i>b</i>
2122 </pre>
2123 !! end
2124
2125 !! test
2126 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2127 !! wikitext
2128 <pre><nowiki>
2129 <b>
2130 <cite>
2131 <em>
2132 </nowiki></pre>
2133 !! html
2134 <pre>
2135 &lt;b&gt;
2136 &lt;cite&gt;
2137 &lt;em&gt;
2138 </pre>
2139
2140 !! end
2141
2142 !! test
2143 Regression with preformatted in <center>
2144 !! wikitext
2145 <center>
2146 Blah
2147 </center>
2148 !! html
2149 <center>
2150 <pre>Blah
2151 </pre>
2152 </center>
2153
2154 !! end
2155
2156 !! test
2157 Bug 52763: Preformatted in <blockquote>
2158 !! wikitext
2159 <blockquote>
2160 Blah
2161 {|
2162 |
2163 indented cell (no pre-wrapping!)
2164 |}
2165 </blockquote>
2166 !! html
2167 <blockquote>
2168 <p> Blah
2169 </p>
2170 <table>
2171 <tr>
2172 <td>
2173 <p> indented cell (no pre-wrapping!)
2174 </p>
2175 </td></tr></table>
2176 </blockquote>
2177
2178 !! end
2179
2180 !! test
2181 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2182 !! wikitext
2183 <blockquote>
2184 Foo
2185
2186 Bar
2187 </blockquote>
2188 !! html
2189 <blockquote>
2190 <p>Foo
2191 </p><p>Bar
2192 </p>
2193 </blockquote>
2194
2195 !! end
2196
2197 !! test
2198 Bug 15491: <ins>/<del> in blockquote
2199 !! wikitext
2200 <blockquote>
2201 Foo <del>bar</del> <ins>baz</ins> quux
2202 </blockquote>
2203 !! html
2204 <blockquote>
2205 <p>Foo <del>bar</del> <ins>baz</ins> quux
2206 </p>
2207 </blockquote>
2208
2209 !! end
2210
2211 # Note that the p-wrapping is newline sensitive, which could be
2212 # considered a bug: tidy will wrap only the 'Foo' in the example
2213 # below in a <p> tag. (see comment 23-25 of bug #6200)
2214 !! test
2215 Bug 15491: <ins>/<del> in blockquote (2)
2216 !! wikitext
2217 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2218 </blockquote>
2219 !! html
2220 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2221 </blockquote>
2222
2223 !! html+tidy
2224 <blockquote>
2225 <p>Foo</p>
2226 <del>bar</del> <ins>baz</ins> quux</blockquote>
2227 !! end
2228
2229 !! test
2230 <pre> with attributes (bug 3202)
2231 !! wikitext
2232 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2233 !! html
2234 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2235
2236 !! end
2237
2238 !! test
2239 <pre> with width attribute (bug 3202)
2240 !! wikitext
2241 <pre width="8">Narrow screen goodies</pre>
2242 !! html
2243 <pre width="8">Narrow screen goodies</pre>
2244
2245 !! end
2246
2247 !! test
2248 <pre> with forbidden attribute (bug 3202)
2249 !! wikitext
2250 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2251 !! html
2252 <pre width="8">Narrow screen goodies</pre>
2253
2254 !! end
2255
2256 !! test
2257 Entities inside <pre>
2258 !! wikitext
2259 <pre>&lt;</pre>
2260 !! html
2261 <pre>&lt;</pre>
2262
2263 !! end
2264
2265 !! test
2266 <pre> with forbidden attribute values (bug 3202)
2267 !! wikitext
2268 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2269 !! html
2270 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2271
2272 !! end
2273
2274 !! test
2275 <nowiki> inside <pre> (bug 13238)
2276 !! wikitext
2277 <pre>
2278 <nowiki>
2279 </pre>
2280 <pre>
2281 <nowiki></nowiki>
2282 </pre>
2283 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2284 !! html
2285 <pre>
2286 &lt;nowiki&gt;
2287 </pre>
2288 <pre>
2289
2290 </pre>
2291 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2292
2293 !! end
2294
2295 !! test
2296 <nowiki> inside of #tag:pre
2297 !! wikitext
2298 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2299 !! html/php
2300 <pre>Foo &#8594;bar</pre>
2301
2302 !! html/parsoid
2303 <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>
2304 !! end
2305
2306 !! test
2307 <nowiki> and <pre> preference (first one wins)
2308 !! wikitext
2309 <pre>
2310 <nowiki>
2311 </pre>
2312 </nowiki>
2313 </pre>
2314
2315 <nowiki>
2316 <pre>
2317 <nowiki>
2318 </pre>
2319 </nowiki>
2320 </pre>
2321
2322 !! html/php
2323 <pre>
2324 &lt;nowiki&gt;
2325 </pre>
2326 <p>&lt;/nowiki&gt;
2327 &lt;/pre&gt;
2328 </p><p>
2329 &lt;pre&gt;
2330 &lt;nowiki&gt;
2331 &lt;/pre&gt;
2332
2333 &lt;/pre&gt;
2334 </p>
2335 !! html/parsoid
2336 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2337 </pre>
2338 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2339 &lt;/pre></p>
2340
2341 <p><span typeof="mw:Nowiki">
2342 &lt;pre>
2343 &lt;nowiki>
2344 &lt;/pre>
2345 </span>
2346 &lt;/pre></p>
2347 !! end
2348
2349 !! test
2350 </pre> inside nowiki
2351 !! wikitext
2352 <nowiki></pre></nowiki>
2353 !! html
2354 <p>&lt;/pre&gt;
2355 </p>
2356 !! end
2357
2358 # Parsoid doesn't strip empty tags, like Tidy does.
2359 !! test
2360 Empty pre; pre inside other HTML tags (bug 54946)
2361 !! options
2362 parsoid=wt2html,wt2wt
2363 !! wikitext
2364 a
2365
2366 <div><pre>
2367 foo
2368 </pre></div>
2369 <pre></pre>
2370 !! html/php
2371 <p>a
2372 </p>
2373 <div><pre>
2374 foo
2375 </pre></div>
2376 <pre></pre>
2377
2378 !! html/php+tidy
2379 <p>a</p>
2380 <div>
2381 <pre>
2382 foo
2383 </pre></div>
2384 !! html/parsoid
2385 <p>a</p>
2386
2387 <div><pre>foo
2388 </pre></div>
2389 <pre></pre>
2390 !! end
2391
2392 !! test
2393 HTML pre followed by indent-pre
2394 !! wikitext
2395 <pre>foo</pre>
2396 bar
2397 !! html
2398 <pre>foo</pre>
2399 <pre>bar
2400 </pre>
2401 !! end
2402
2403 # Note that tidy removes the empty <p> tags from the start and end.
2404 # Parsoid does not, by design.
2405 !!test
2406 Block tag pre
2407 !! wikitext
2408 <p><pre>foo</pre></p>
2409 !! html/php+tidy
2410 <pre>
2411 foo
2412 </pre>
2413 !! html/parsoid
2414 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2415 !!end
2416
2417 !!test
2418 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2419 !! wikitext
2420 {{echo|}}
2421 !! html
2422
2423 !!end
2424
2425 !!test
2426 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2427 !! wikitext
2428 {{echo|
2429 foo}}
2430 !! html
2431 <p>foo
2432 </p>
2433 !!end
2434
2435 !! test
2436 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2437 !! wikitext
2438 {{echo|a
2439 b}}
2440 !! html
2441 <pre>a
2442 </pre>
2443 <p>b
2444 </p>
2445 !!end
2446
2447 !! test
2448 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2449 !! wikitext
2450 {{echo|a
2451 b
2452 c
2453 d
2454 e
2455 }}
2456 !! html
2457 <pre>a
2458 </pre>
2459 <p>b
2460 c
2461 </p>
2462 <pre>d
2463 </pre>
2464 <p>e
2465 </p>
2466 !!end
2467
2468 !!test
2469 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2470 !! wikitext
2471 {{echo| foo}}
2472
2473 {{echo| foo}}{{echo| bar}}
2474
2475 {{echo| foo}}
2476 {{echo| bar}}
2477
2478 {{echo|<!--cmt--> foo}}
2479
2480 <!--cmt-->{{echo| foo}}
2481
2482 {{echo|{{echo| }}bar}}
2483 !! html
2484 <pre>foo
2485 </pre>
2486 <pre>foo bar
2487 </pre>
2488 <pre>foo
2489 bar
2490 </pre>
2491 <pre>foo
2492 </pre>
2493 <pre>foo
2494 </pre>
2495 <pre>bar
2496 </pre>
2497 !!end
2498
2499 !! test
2500 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2501 !! wikitext
2502 {{echo| }}a
2503
2504 {{echo|
2505 }}a
2506
2507 {{echo|
2508 b}}
2509
2510 {{echo|a
2511 }}b
2512
2513 {{echo|a
2514 }} b
2515 !! html
2516 <pre>a
2517 </pre>
2518 <p><br />
2519 </p>
2520 <pre>a
2521 </pre>
2522 <p><br />
2523 </p>
2524 <pre>b
2525 </pre>
2526 <p>a
2527 </p>
2528 <pre>b
2529 </pre>
2530 <p>a
2531 </p>
2532 <pre>b
2533 </pre>
2534 !!end
2535
2536 !! test
2537 Pres with newline attributes
2538 !! wikitext
2539 <pre class="one
2540 two">hi</pre>
2541 !! html/php
2542 <pre class="one two">hi</pre>
2543
2544 !! html/parsoid
2545 <pre class="one
2546 two" data-parsoid='{"stx":"html"}'>hi</pre>
2547 !! end
2548
2549 !! test
2550 Things that look like <pre> tags aren't treated as such
2551 !! wikitext
2552 Barack Obama <President> of the United States
2553 <President></President>
2554 !! html
2555 <p>Barack Obama &lt;President&gt; of the United States
2556 &lt;President&gt;&lt;/President&gt;
2557 </p>
2558 !! end
2559
2560 !! test
2561 Handle broken pre-like tags (bug 64025)
2562 !! options
2563 parsoid=wt2html
2564 !! wikitext
2565 {{echo|<pre <pre>x</pre>}}
2566
2567 <table><pre </table>
2568 !! html/php
2569 <pre>x</pre>
2570 <table>&lt;pre </table>
2571
2572 !! html/php+tidy
2573 <pre>
2574 x
2575 </pre>
2576 <p>&lt;pre</p>
2577 !! html/parsoid
2578 <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>
2579
2580
2581 <p>&lt;pre </p>
2582
2583 <table></table>
2584 !! end
2585
2586 !! test
2587 Parsoid: handle pre with space after attribute
2588 !! options
2589 parsoid=wt2html
2590 !! wikitext
2591 <pre style="width:50%;" >{{echo|foo}}</pre>
2592 !! html/php
2593 <pre style="width:50%;">{{echo|foo}}</pre>
2594
2595 !! html/parsoid
2596 <pre style="width:50%;">{{echo|foo}}</pre>
2597 !! end
2598
2599 # TODO / maybe: fix wt2wt for this
2600 !! test
2601 Parsoid: Don't paragraph-wrap fosterable content
2602 !! options
2603 parsoid=wt2html
2604 !! wikitext
2605 {|
2606 <td></td>
2607 <td></td>
2608
2609
2610
2611 |}
2612 !! html
2613 <table>
2614
2615 <tbody>
2616 <tr>
2617 <td></td>
2618
2619 <td></td></tr>
2620
2621
2622
2623 </tbody></table>
2624 !! end
2625
2626 !! test
2627 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2628 !! options
2629 parsoid=wt2html
2630 !! wikitext
2631 {|
2632 <td>
2633 <td>
2634 </td>
2635
2636
2637
2638 |}
2639 !! html
2640 <table>
2641
2642 <tbody>
2643 <tr>
2644 <td></td>
2645
2646 <td>
2647 </td></tr>
2648
2649
2650
2651 </tbody></table>
2652 !! end
2653
2654
2655 #--------------------------------------------------------------------
2656 # Transclusion parameter whitespace stripping tests
2657 # Behavior is different for positional and named parameters
2658 #--------------------------------------------------------------------
2659 !! test
2660 Templates: Strip leading and trailing whitespace from named-param values
2661 !! wikitext
2662 {{echo|1= a }}
2663
2664 {{echo|1= {{echo|b}} }}
2665
2666 {{echo| 1 =
2667 c }}
2668
2669 {{echo| 1 =
2670 * d
2671 }}
2672 !! html
2673 <p>a
2674 </p><p>b
2675 </p><p>c
2676 </p>
2677 <ul><li> d</li></ul>
2678
2679 !! end
2680
2681 !! test
2682 Templates: Don't strip whitespace from positional-param values
2683 !! wikitext
2684 {{echo|a }}
2685
2686 {{echo|{{echo|b}} }}
2687
2688 {{echo| c
2689 }}
2690
2691 {{echo| {{echo|d}}
2692 }}
2693
2694 {{echo|
2695 e}}
2696
2697 {{echo|
2698 * f}}
2699
2700 {{echo|
2701 }}g
2702 !! html
2703 <p>a
2704 </p><p>b
2705 </p>
2706 <pre>c
2707 </pre>
2708 <p><br />
2709 </p>
2710 <pre>d
2711 </pre>
2712 <p><br />
2713 </p>
2714 <pre>e
2715 </pre>
2716 <p><br />
2717 </p>
2718 <ul><li> f</li></ul>
2719 <p><br />
2720 </p>
2721 <pre>g
2722 </pre>
2723 !! end
2724
2725 !! test
2726 Templates: Handle empty comment-and-ws-only lines correctly
2727 !! wikitext
2728 {{echo|foo
2729 <!--should be ignored-->
2730 <!--should be ignored as well-->
2731 bar}}
2732 !! html/php
2733 <p>foo
2734 bar
2735 </p>
2736 !! html/parsoid
2737 <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>
2738 !! end
2739
2740 !! test
2741 Templates: Handle comments in the target
2742 !! wikitext
2743 {{echo
2744 <!-- should be ignored -->
2745 |foo}}
2746
2747 {{echo
2748 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2749 |foo}}
2750
2751 {{echo<!-- should be ignored -->
2752 |foo}}
2753
2754 {{echo<!-- should be ignored -->|foo}}
2755
2756 {{<!-- should be ignored -->echo|foo}}
2757 !! html/php
2758 <p>foo
2759 </p><p>foo
2760 </p><p>foo
2761 </p><p>foo
2762 </p><p>foo
2763 </p>
2764 !! html/parsoid
2765 <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>
2766
2767 <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>
2768
2769 <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>
2770
2771 <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>
2772
2773 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2774 !!end
2775
2776 !! test
2777 Templates: Handle comments in parameter names (bug 67657)
2778 !! wikitext
2779 {{echo|1
2780 <!-- should be ignored -->
2781 =foo}}
2782
2783 {{echo|
2784 <!-- should be ignored -->
2785 1 = foo}}
2786
2787 {{echo|1<!-- should be ignored -->=foo}}
2788
2789 {{echo|<!-- should be ignored -->1=foo}}
2790 !! html/php
2791 <p>foo
2792 </p><p>foo
2793 </p><p>foo
2794 </p><p>foo
2795 </p>
2796 !! html/parsoid
2797 <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>
2798
2799 <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>
2800
2801 <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>
2802
2803 <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>
2804 !!end
2805
2806 !! test
2807 Templates: Other wikitext in parameter names (bug 67657)
2808 !! wikitext
2809 {{echo|''1''=foo}}
2810 !! html/php
2811 <p>{{{1}}}
2812 </p>
2813 !! html/parsoid
2814 <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>
2815 !!end
2816
2817 #--------------------------------------------------------------------
2818 # Transclusion parameter escaping tests
2819 #--------------------------------------------------------------------
2820 !! test
2821 Templates: Parsoid parameter escaping test 1
2822 !! wikitext
2823 {{echo|[foo]|{{echo|[bar]}}}}
2824 !! html/php+tidy
2825 <p>[foo]</p>
2826 !! html/parsoid
2827 <p about="#mwt1" typeof="mw:Transclusion"
2828 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2829 !! end
2830
2831 !! test
2832 Parsoid: Pipes in external links in template parameter
2833 !! wikitext
2834 {{echo|[{{echo|http://example.com}} link]}}
2835 !! html/php+tidy
2836 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2837 !! html/parsoid
2838 <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>
2839 !! end
2840
2841 !! test
2842 Parsoid: pipe in transclusion parameter
2843 !! wikitext
2844 {{echo|http://foo.com/a&#124;b}}
2845 !! html/php+tidy
2846 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2847 !! html/parsoid
2848 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2849 typeof="mw:Transclusion"
2850 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>
2851 !! end
2852
2853 !! test
2854 Parsoid: Pipe in external link target and content in template parameter
2855 !! options
2856 parsoid=html2wt,wt2wt
2857 !! wikitext
2858 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2859 !! html/php+tidy
2860 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2861 !! html/parsoid
2862 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2863 typeof="mw:Transclusion"
2864 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2865 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2866 !! end
2867
2868 !! test
2869 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2870 !! options
2871 parsoid
2872 !! wikitext
2873 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2874 !! html
2875 <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>
2876 !! end
2877
2878 !! test
2879 Templates: Don't escape already nowiki-escaped text in template parameters
2880 !! options
2881 parsoid=html2wt,wt2wt
2882 !! wikitext
2883 {{echo|foo<nowiki>|</nowiki>bar}}
2884 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2885 {{echo|<nowiki></nowiki>}}
2886 !! html/php+tidy
2887 <p>foo|bar &lt;div&gt;</p>
2888 !! html/parsoid
2889 <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>
2890 <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>
2891 <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>
2892 </p>
2893 !! end
2894
2895 ## Bug 52824
2896 !! test
2897 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2898 !! options
2899 parsoid=html2wt,wt2wt
2900 !! wikitext
2901 {{echo|{{echo|1=bar}}}}
2902 !! html/php+tidy
2903 <p>bar</p>
2904 !! html/parsoid
2905 <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>
2906 !! end
2907
2908 ## Bug 56733
2909 !! test
2910 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2911 !! wikitext
2912 {{echo|a : b}}
2913 !! html/php+tidy
2914 <p>a&#160;: b</p>
2915 !! html/parsoid
2916 <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>
2917 !! end
2918
2919 ## Bug T73412
2920 !! test
2921 Templates: Preserve blank parameter names
2922 !! wikitext
2923 {{echo|=foo}}
2924 !! html/php+tidy
2925 <p>{{{1}}}</p>
2926 !! html/parsoid
2927 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2928 !! end
2929
2930 !! test
2931 Templates: Preserve blank parameter names in other positions
2932 !! wikitext
2933 {{blank_param|bar|=foo}}
2934 !! html/php+tidy
2935 <p>bar foo</p>
2936 !! html/parsoid
2937 <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
2938 foo</p>
2939 !! end
2940
2941 ###
2942 ### Parsoid-centric tests for testing RT edge cases for pre
2943 ###
2944
2945 !!test
2946 1a. Indent-Pre and Comments
2947 !! wikitext
2948 a
2949 <!--a-->
2950 c
2951 !! html
2952 <pre>a
2953 </pre>
2954 <p>c
2955 </p>
2956 !!end
2957
2958 !!test
2959 1b. Indent-Pre and Comments
2960 !! wikitext
2961 a
2962 <!--a-->
2963 c
2964 !! html
2965 <pre>a
2966 </pre>
2967 <p>c
2968 </p>
2969 !!end
2970
2971 !!test
2972 1c. Indent-Pre and Comments
2973 !! wikitext
2974 <!--a--> a
2975
2976 <!--a--> a
2977 !! html
2978 <pre> a
2979 </pre>
2980 <pre> a
2981 </pre>
2982 !!end
2983
2984 !!test
2985 1d. Indent-Pre and Comments
2986 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2987 !! wikitext
2988 <!--a--> a
2989
2990 <!--b-->b
2991 !! html
2992 <pre>a
2993 </pre>
2994 <pre>b
2995 </pre>
2996 !!end
2997
2998 !!test
2999 2a. Indent-Pre and tables
3000 !! wikitext
3001 {|
3002 |-
3003 !h1!!h2
3004 |foo||bar
3005 |}
3006 !! html
3007 <table>
3008
3009 <tr>
3010 <th>h1</th>
3011 <th>h2
3012 </th>
3013 <td>foo</td>
3014 <td>bar
3015 </td></tr></table>
3016
3017 !!end
3018
3019 !!test
3020 2b. Indent-Pre and tables
3021 !! wikitext
3022 {|
3023 |-
3024 |foo
3025 |}
3026 !! html
3027 <table>
3028
3029 <tr>
3030 <td>foo
3031 </td></tr></table>
3032
3033 !!end
3034
3035 !!test
3036 2c. Indent-Pre and tables (bug 42252)
3037 !! wikitext
3038 {|
3039 |+ foo
3040 ! | bar
3041 |}
3042 !! html
3043 <table>
3044 <caption> foo
3045 </caption>
3046 <tr>
3047 <th> bar
3048 </th></tr></table>
3049
3050 !!end
3051
3052 !!test
3053 2d. Indent-Pre and tables
3054 !! wikitext
3055 a
3056 {|
3057 | b
3058 |}
3059 !! html/php
3060 <pre>a
3061 </pre>
3062 <table>
3063 <tr>
3064 <td> b
3065 </td></tr></table>
3066
3067 !! html/parsoid
3068 <pre>a</pre>
3069 <table>
3070 <tbody><tr><td> b</td></tr>
3071 </tbody></table>
3072 !!end
3073
3074 !!test
3075 2e. Indent-Pre and table-line syntax
3076 !! wikitext
3077 a
3078 | b
3079 | c
3080 !! html/php
3081 <pre>a
3082 | b
3083 | c
3084 </pre>
3085 !!end
3086
3087 !!test
3088 2f. Indent-pre started by table-line syntax
3089 !! wikitext
3090 a
3091 | b
3092 | c
3093 !! html/php
3094 <p>a
3095 </p>
3096 <pre>| b
3097 | c
3098 </pre>
3099 !! html/parsoid
3100 <p>a</p>
3101 <pre>
3102 | b
3103 | c</pre>
3104 !!end
3105
3106 !! test
3107 2g. Indented table markup mixed with indented pre content (proposed in bug 6200)
3108 !! wikitext
3109 <table>
3110 <tr>
3111 <td>
3112 Text that should be rendered preformatted
3113 </td>
3114 </tr>
3115 </table>
3116 !! html
3117 <table>
3118 <tr>
3119 <td>
3120 <pre>Text that should be rendered preformatted
3121 </pre>
3122 </td>
3123 </tr>
3124 </table>
3125
3126 !! end
3127
3128 !!test
3129 3a. Indent-Pre and block tags (single-line html)
3130 !! wikitext
3131 a <p> foo </p>
3132 b <div> foo </div>
3133 c <blockquote> foo </blockquote>
3134 <span> foo </span>
3135 !! html
3136 a <p> foo </p>
3137 b <div> foo </div>
3138 c <blockquote> foo </blockquote>
3139 <pre><span> foo </span>
3140 </pre>
3141 !! html/parsoid
3142 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3143 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3144 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3145 <pre><span> foo </span>
3146 </pre>
3147 !! html+tidy
3148 <p>a</p>
3149 <p>foo</p>
3150 <p>b</p>
3151 <div>foo</div>
3152 <p>c</p>
3153 <blockquote>
3154 <p>foo</p>
3155 </blockquote>
3156 <pre>
3157 <span> foo </span>
3158 </pre>
3159 !! end
3160
3161 !!test
3162 3b. Indent-Pre and block tags (multi-line html)
3163 !! wikitext
3164 a <span>foo</span>
3165 b <div> foo </div>
3166 !! html
3167 <pre>a <span>foo</span>
3168 </pre>
3169 b <div> foo </div>
3170
3171 !! html/parsoid
3172 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3173 b <div data-parsoid='{"stx":"html"}'> foo </div>
3174 !! html+tidy
3175 <pre>
3176 a <span>foo</span>
3177 </pre>
3178 <p>b</p>
3179 <div>foo</div>
3180 !!end
3181
3182 !!test
3183 3c. Indent-Pre and block tags (pre-content on separate line)
3184 !! wikitext
3185 <p>
3186 foo
3187 </p>
3188
3189 <div>
3190 foo
3191 </div>
3192
3193 <center>
3194 foo
3195 </center>
3196
3197 <blockquote>
3198 foo
3199 </blockquote>
3200
3201 <blockquote>
3202 <pre>
3203 foo
3204 </pre>
3205 </blockquote>
3206
3207 <table><tr><td>
3208 foo
3209 </td></tr></table>
3210
3211 <ul><li>
3212 foo
3213 </li></ul>
3214
3215 !! html
3216 <p>
3217 foo
3218 </p>
3219 <div>
3220 <pre>foo
3221 </pre>
3222 </div>
3223 <center>
3224 <pre>foo
3225 </pre>
3226 </center>
3227 <blockquote>
3228 <p> foo
3229 </p>
3230 </blockquote>
3231 <blockquote>
3232 <pre>
3233 foo
3234 </pre>
3235 </blockquote>
3236 <table><tr><td>
3237 <pre>foo
3238 </pre>
3239 </td></tr></table>
3240 <ul><li>
3241 foo
3242 </li></ul>
3243
3244 !!end
3245
3246 !! test
3247 4. Indent-Pre and extension tags
3248 !! wikitext
3249 a <tag />
3250 !! html/php
3251 a <pre>
3252 NULL
3253 array (
3254 )
3255 </pre>
3256
3257 !! html/parsoid
3258 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3259 !! end
3260
3261 !!test
3262 Render paragraphs when indent-pre is suppressed in blocklevels
3263 !! wikitext
3264 <blockquote>
3265 foo
3266
3267 bar
3268 </blockquote>
3269 !! html
3270 <blockquote>
3271 <p> foo
3272 </p><p> bar
3273 </p>
3274 </blockquote>
3275
3276 !!end
3277
3278 !!test
3279 4. Multiple spaces at start-of-line
3280 !! wikitext
3281 <p> foo </p>
3282 foo
3283 {|
3284 |foo
3285 |}
3286 !! html
3287 <p> foo </p>
3288 <pre> foo
3289 </pre>
3290 <table>
3291 <tr>
3292 <td>foo
3293 </td></tr></table>
3294
3295 !!end
3296
3297 ## NOTE: the leading white-space chars on empty line are significant
3298 !! test
3299 5a. White-space in indent-pre
3300 !! wikitext
3301 a<br />
3302
3303 b
3304 !! html
3305 <pre>a<br />
3306
3307 b
3308 </pre>
3309 !! end
3310
3311 ## NOTE: the leading white-space chars on empty line are significant
3312 !! test
3313 5b. White-space in indent-pre
3314 !! wikitext
3315 a
3316
3317 b
3318
3319
3320 c
3321 !! html
3322 <pre>a
3323
3324 b
3325
3326
3327 c
3328 </pre>
3329 !! end
3330
3331 !! test
3332 5c. White-space in indent-pre
3333 !! wikitext
3334 ''a''
3335 ''b''
3336 ''c''
3337 !! html
3338 <pre><i>a</i>
3339 <i>b</i>
3340 <i>c</i>
3341 </pre>
3342 !! end
3343
3344 !! test
3345 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3346 !! wikitext
3347 a
3348
3349 <!-- continue -->
3350 b
3351
3352 c
3353
3354 d
3355 !! html
3356 <pre>a
3357
3358 b
3359 </pre>
3360 <pre>c
3361
3362 </pre>
3363 <p>d
3364 </p>
3365 !! end
3366
3367 !! test
3368 7a. Indent-pre and category links
3369 !! options
3370 parsoid=wt2html,wt2wt
3371 !! wikitext
3372 [[Category:foo]] <!-- No pre-wrapping -->
3373 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3374 !! html/php+tidy
3375 !! html/parsoid
3376 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3377 <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 -->
3378 !! end
3379
3380 ## We used to, but no longer wt2wt this test since the default serializer
3381 ## will normalize all categories to serialize on their own line.
3382 ## This wikitext usage is going to be fairly uncommon in production and
3383 ## selser will take care of preserving formatting in those scenarios.
3384 !! test
3385 7b. Indent-pre and category links
3386 !! options
3387 parsoid=wt2html
3388 !! wikitext
3389 [[Category:foo]] a
3390 [[Category:foo]] {{echo|b}}
3391 !! html/parsoid
3392 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3393 <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>
3394 !! end
3395
3396 !! test
3397 Indent-Pre: Newlines in comments shouldn't affect sol state
3398 !! wikitext
3399 a <!--
3400 foo
3401 --> b
3402 !! html/php+tidy
3403 <p>a b</p>
3404 !! html/parsoid
3405 <p>a <!--
3406 foo
3407 --> b</p>
3408 !! end
3409
3410 ###
3411 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3412 ###
3413
3414 !!test
3415 HTML-pre: 1. embedded newlines
3416 !! wikitext
3417 <pre>foo</pre>
3418
3419 <pre>
3420 foo
3421 </pre>
3422
3423 <pre>
3424
3425 foo
3426 </pre>
3427
3428 <pre>
3429
3430
3431 foo
3432 </pre>
3433 !! html/php+tidy
3434 <pre>
3435 foo
3436 </pre>
3437 <pre>
3438 foo
3439 </pre>
3440 <pre>
3441
3442 foo
3443 </pre>
3444 <pre>
3445
3446
3447 foo
3448 </pre>
3449 !! html/parsoid
3450 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3451
3452 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3453 foo
3454 </pre>
3455
3456 <pre data-parsoid='{"stx":"html"}'>
3457
3458 foo
3459 </pre>
3460
3461 <pre data-parsoid='{"stx":"html"}'>
3462
3463
3464 foo
3465 </pre>
3466 !!end
3467
3468 !! test
3469 HTML-pre: big spaces
3470 !! wikitext
3471 <pre>
3472
3473
3474
3475
3476 haha
3477
3478
3479
3480
3481 haha
3482
3483
3484
3485
3486 </pre>
3487 !! html/php+tidy
3488 <pre>
3489
3490
3491
3492
3493 haha
3494
3495
3496
3497
3498 haha
3499
3500
3501
3502
3503 </pre>
3504 !! html/parsoid
3505 <pre data-parsoid='{"stx":"html"}'>
3506
3507
3508
3509
3510 haha
3511
3512
3513
3514
3515 haha
3516
3517
3518
3519
3520 </pre>
3521 !! end
3522
3523 !!test
3524 HTML-pre: 2: indented text
3525 !! wikitext
3526 <pre>
3527 foo
3528 </pre>
3529 !! html
3530 <pre>
3531 foo
3532 </pre>
3533
3534 !!end
3535
3536 !!test
3537 HTML-pre: 3: other wikitext
3538 !! wikitext
3539 <pre>
3540 * foo
3541 # bar
3542 = no-h =
3543 '' no-italic ''
3544 [[ NoLink ]]
3545 </pre>
3546 !! html/php
3547 <pre>
3548 * foo
3549 # bar
3550 = no-h =
3551 '' no-italic ''
3552 [[ NoLink ]]
3553 </pre>
3554
3555 !! html/parsoid
3556 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3557 # bar
3558 = no-h =
3559 '' no-italic ''
3560 [[ NoLink ]]
3561 </pre>
3562 !!end
3563
3564 ###
3565 ### Definition lists
3566 ###
3567 !! test
3568 Simple definition
3569 !! wikitext
3570 ; name : Definition
3571 !! html
3572 <dl><dt> name&#160;</dt>
3573 <dd> Definition</dd></dl>
3574
3575 !! end
3576
3577 !! test
3578 Definition list for indentation only
3579 !! wikitext
3580 : Indented text
3581 !! html
3582 <dl><dd> Indented text</dd></dl>
3583
3584 !! end
3585
3586 !! test
3587 Definition list with no space
3588 !! wikitext
3589 ;name:Definition
3590 !! html
3591 <dl><dt>name</dt>
3592 <dd>Definition</dd></dl>
3593
3594 !!end
3595
3596 !! test
3597 Definition list with URL link
3598 !! wikitext
3599 ; http://example.com/ : definition
3600 !! html
3601 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3602 <dd> definition</dd></dl>
3603
3604 !! end
3605
3606 !! test
3607 Definition list with bracketed URL link
3608 !! wikitext
3609 ;[http://www.example.com/ Example]:Something about it
3610 !! html
3611 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3612 <dd>Something about it</dd></dl>
3613
3614 !! end
3615
3616 !! test
3617 Definition list with wikilink containing colon
3618 !! wikitext
3619 ; [[Help:FAQ]]: The least-read page on Wikipedia
3620 !! html
3621 <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>
3622 <dd> The least-read page on Wikipedia</dd></dl>
3623
3624 !! end
3625
3626 # At Brion's and JeLuF's insistence... :)
3627 !! test
3628 Definition list with news link containing colon
3629 !! wikitext
3630 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3631 !! html/php
3632 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3633 <dd> This isn't even a real newsgroup!</dd></dl>
3634
3635 !! html/parsoid
3636 <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>
3637 !! end
3638
3639 !! test
3640 Malformed definition list with colon
3641 !! wikitext
3642 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3643 !! html
3644 <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>
3645
3646 !! end
3647
3648 !! test
3649 Definition lists: colon in external link text
3650 !! wikitext
3651 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3652 !! html
3653 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3654 <dd> OK, I made that up</dd></dl>
3655
3656 !! end
3657
3658 !! test
3659 Definition lists: colon in HTML attribute
3660 !! wikitext
3661 ;<b style="display: inline">bold</b>
3662 !! html
3663 <dl><dt><b style="display: inline">bold</b></dt></dl>
3664
3665 !! end
3666
3667 !! test
3668 Definition lists: self-closed tag
3669 !! wikitext
3670 ;one<br/>two : two-line fun
3671 !! html
3672 <dl><dt>one<br />two&#160;</dt>
3673 <dd> two-line fun</dd></dl>
3674
3675 !! end
3676
3677 !! test
3678 Bug 11748: Literal closing tags
3679 !! wikitext
3680 <dl>
3681 <dt>test 1</dt>
3682 <dd>test test test test test</dd>
3683 <dt>test 2</dt>
3684 <dd>test test test test test</dd>
3685 </dl>
3686 !! html
3687 <dl>
3688 <dt>test 1</dt>
3689 <dd>test test test test test</dd>
3690 <dt>test 2</dt>
3691 <dd>test test test test test</dd>
3692 </dl>
3693
3694 !! end
3695
3696 !! test
3697 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3698 !! wikitext
3699 <ul><li>
3700 ; term : description
3701 * unordered
3702 </li></ul>
3703 !! html
3704 <ul><li>
3705 <dl><dt> term&#160;</dt>
3706 <dd> description</dd></dl>
3707 <ul><li> unordered</li></ul>
3708 </li></ul>
3709
3710 !! end
3711
3712 !! test
3713 Definition list with empty definition and following paragraph
3714 !! wikitext
3715 ; term:
3716 Paragraph text
3717 !! html
3718 <dl><dt> term</dt>
3719 <dd></dd></dl>
3720 <p>Paragraph text
3721 </p>
3722 !! end
3723
3724 !! test
3725 Nested definition lists using html syntax
3726 !! wikitext
3727 <dl><dt>x</dt>
3728 <dd>a</dd>
3729 <dd>b</dd></dl>
3730 !! html
3731 <dl><dt>x</dt>
3732 <dd>a</dd>
3733 <dd>b</dd></dl>
3734
3735 !! end
3736
3737 !! test
3738 Definition Lists: No nesting: Multiple dd's
3739 !! wikitext
3740 ;x
3741 :a
3742 :b
3743 !! html
3744 <dl><dt>x</dt>
3745 <dd>a</dd>
3746 <dd>b</dd></dl>
3747
3748 !! end
3749
3750 !! test
3751 Definition Lists: Indentation: Regular
3752 !! wikitext
3753 :i1
3754 ::i2
3755 :::i3
3756 !! html
3757 <dl><dd>i1
3758 <dl><dd>i2
3759 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3760
3761 !! end
3762
3763 !! test
3764 Definition Lists: Indentation: Missing 1st level
3765 !! wikitext
3766 ::i2
3767 :::i3
3768 !! html
3769 <dl><dd><dl><dd>i2
3770 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3771
3772 !! end
3773
3774 !! test
3775 Definition Lists: Indentation: Multi-level indent
3776 !! wikitext
3777 :::i3
3778 !! html
3779 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3780
3781 !! end
3782
3783 !! test
3784 Definition Lists: Hacky use to indent tables
3785 !! wikitext
3786 ::{|
3787 |foo
3788 |bar
3789 |}
3790 this text
3791 should be left alone
3792 !! html
3793 <dl><dd><dl><dd><table>
3794 <tr>
3795 <td>foo
3796 </td>
3797 <td>bar
3798 </td></tr></table></dd></dl></dd></dl>
3799 <p>this text
3800 should be left alone
3801 </p>
3802 !! end
3803
3804 !! test
3805 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3806 !! wikitext
3807 <!-- foo -->
3808 ::{|
3809 |foo
3810 |bar
3811 |}<!-- bar -->
3812 this text
3813 should be left alone
3814 !! html/parsoid
3815 <!-- foo -->
3816 <dl><dd><dl><dd><table><tr>
3817 <td>foo</td>
3818 <td>bar</td>
3819 </tr></table><!-- bar --></dd></dl></dd></dl>
3820 <p>this text
3821 should be left alone</p>
3822 !! end
3823
3824 !! test
3825 Definition Lists: Hacky use to indent tables, with comment before table
3826 !! wikitext
3827 ::<!-- foo -->{|
3828 |foo
3829 |}
3830 !! html/parsoid
3831 <dl><dd><dl><dd><!-- foo --><table><tr>
3832 <td>foo</td>
3833 </tr></table></dd></dl></dd></dl>
3834 !! end
3835
3836 # The trailing whitespace in this test is to catch a regression in
3837 # Parsoid after T54473.
3838 !! test
3839 Definition Lists: Hacky use to indent tables (WS-insensitive)
3840 !! wikitext
3841 : {|
3842 |a
3843 |}
3844 !! html/php
3845 <dl><dd><table>
3846 <tr>
3847 <td>a
3848 </td></tr></table></dd></dl>
3849
3850 !! html/parsoid
3851 <dl><dd> <table>
3852 <tbody><tr><td>a</td></tr>
3853 </tbody></table> </dd></dl>
3854 !! end
3855
3856 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3857 ## as an empty dt item. It also ignores all but the last ";" when followed
3858 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3859 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3860 ## ";"s.
3861 ##
3862 ## Ex: ";;t2 ::d2" is transformed into:
3863 ##
3864 ## <dl>
3865 ## <dt>t2 </dt>
3866 ## <dd>
3867 ## <dl>
3868 ## <dt></dt>
3869 ## <dd>d2</dd>
3870 ## </dl>
3871 ## </dd>
3872 ## </dl>
3873 ##
3874 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3875 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3876 ##
3877 ## <dl>
3878 ## <dt>
3879 ## <dl>
3880 ## <dt>t2 </dt>
3881 ## <dd>:d2</dd>
3882 ## </dl>
3883 ## </dt>
3884 ## </dl>
3885 ##
3886 ## All Parsoid only definition list tests have this difference.
3887 ##
3888 ## See also: https://phabricator.wikimedia.org/T8569
3889 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3890
3891 !! test
3892 Table / list interaction: indented table with lists in table contents
3893 !! wikitext
3894 :{|
3895 |-
3896 | a
3897 * b
3898 |-
3899 | c
3900 * d
3901 |}
3902 !! html
3903 <dl><dd><table>
3904
3905 <tr>
3906 <td> a
3907 <ul><li> b</li></ul>
3908 </td></tr>
3909 <tr>
3910 <td> c
3911 <ul><li> d</li></ul>
3912 </td></tr></table></dd></dl>
3913
3914 !! end
3915
3916 !!test
3917 Table / list interaction: lists nested in tables nested in indented lists
3918 !! wikitext
3919 :{|
3920 |
3921 :a
3922 :b
3923 |
3924 *c
3925 *d
3926 |}
3927
3928 *e
3929 *f
3930 !! html
3931 <dl><dd><table>
3932 <tr>
3933 <td>
3934 <dl><dd>a</dd>
3935 <dd>b</dd></dl>
3936 </td>
3937 <td>
3938 <ul><li>c</li>
3939 <li>d</li></ul>
3940 </td></tr></table></dd></dl>
3941 <ul><li>e</li>
3942 <li>f</li></ul>
3943
3944 !!end
3945
3946 !! test
3947 Definition Lists: Nesting: Multi-level (Parsoid only)
3948 !! options
3949 parsoid
3950 !! wikitext
3951 ;t1 :d1
3952 ;;t2 ::d2
3953 ;;;t3 :::d3
3954 !! html
3955 <dl>
3956 <dt>t1 </dt>
3957 <dd>d1</dd>
3958 <dt>
3959 <dl>
3960 <dt>t2 </dt>
3961 <dd>:d2</dd>
3962 <dt>
3963 <dl>
3964 <dt>t3 </dt>
3965 <dd>::d3</dd>
3966 </dl>
3967 </dt>
3968 </dl>
3969 </dt>
3970 </dl>
3971
3972
3973 !! end
3974
3975
3976 !! test
3977 Definition Lists: Nesting: Test 2 (Parsoid only)
3978 !! wikitext
3979 ;t1
3980 ::d2
3981 !! html/php+tidy
3982 <dl>
3983 <dt>t1</dt>
3984 <dd>
3985 <dl>
3986 <dd>d2</dd>
3987 </dl>
3988 </dd>
3989 </dl>
3990 !! html/parsoid
3991 <dl>
3992 <dt>t1</dt>
3993 <dd>
3994 <dl>
3995 <dd>d2</dd>
3996 </dl>
3997 </dd>
3998 </dl>
3999
4000 !! end
4001
4002
4003 !! test
4004 Definition Lists: Nesting: Test 3 (Parsoid only)
4005 !! wikitext
4006 :;t1
4007 ::::d2
4008 !! html/php+tidy
4009 <dl>
4010 <dd>
4011 <dl>
4012 <dt>t1</dt>
4013 <dd>
4014 <dl>
4015 <dd>
4016 <dl>
4017 <dd>d2</dd>
4018 </dl>
4019 </dd>
4020 </dl>
4021 </dd>
4022 </dl>
4023 </dd>
4024 </dl>
4025 !! html/parsoid
4026 <dl>
4027 <dd>
4028 <dl>
4029 <dt>t1</dt>
4030 <dd>
4031 <dl>
4032 <dd>
4033 <dl>
4034 <dd>d2</dd>
4035 </dl>
4036 </dd>
4037 </dl>
4038 </dd>
4039 </dl>
4040 </dd>
4041 </dl>
4042
4043 !! end
4044
4045
4046 !! test
4047 Definition Lists: Nesting: Test 4
4048 !! wikitext
4049 ::;t3
4050 :::d3
4051 !! html
4052 <dl><dd><dl><dd><dl><dt>t3</dt>
4053 <dd>d3</dd></dl></dd></dl></dd></dl>
4054
4055 !! end
4056
4057
4058 ## The Parsoid team believes the following three test exposes a
4059 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4060 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4061 ## It also exposes a "misfeature" in tidy, which doesn't like
4062 ## <dl> tags with a single <dt> child; it converts the <dt> into
4063 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4064 !! test
4065 Definition Lists: Mixed Lists: Test 1
4066 !! wikitext
4067 :;* foo
4068 ::* bar
4069 :; baz
4070 !! html/php
4071 <dl><dd><dl><dt><ul><li> foo</li>
4072 <li> bar</li></ul></dt></dl>
4073 <dl><dt> baz</dt></dl></dd></dl>
4074
4075 !! html/php+tidy
4076 <dl>
4077 <dd>
4078 <dl>
4079 <dd>
4080 <ul>
4081 <li>foo</li>
4082 <li>bar</li>
4083 </ul>
4084 </dd>
4085 </dl>
4086 <dl>
4087 <dt>baz</dt>
4088 </dl>
4089 </dd>
4090 </dl>
4091 !! html/parsoid
4092 <dl>
4093 <dd><dl>
4094 <dt><ul>
4095 <li> foo
4096 </li>
4097 </ul></dt>
4098 <dd><ul>
4099 <li> bar
4100 </li>
4101 </ul></dd>
4102 <dt> baz</dt>
4103 </dl></dd>
4104 </dl>
4105 !! end
4106
4107 !! test
4108 Definition Lists: Mixed Lists: Test 2
4109 !! wikitext
4110 *: d1
4111 *: d2
4112 !! html
4113 <ul><li><dl><dd> d1</dd>
4114 <dd> d2</dd></dl></li></ul>
4115
4116 !! end
4117
4118
4119 !! test
4120 Definition Lists: Mixed Lists: Test 3
4121 !! wikitext
4122 *::: d1
4123 *::: d2
4124 !! html
4125 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4126 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4127
4128 !! end
4129
4130
4131 !! test
4132 Definition Lists: Mixed Lists: Test 4
4133 !! wikitext
4134 *;d1 :d2
4135 *;d3 :d4
4136 !! html
4137 <ul><li><dl><dt>d1&#160;</dt>
4138 <dd>d2</dd>
4139 <dt>d3&#160;</dt>
4140 <dd>d4</dd></dl></li></ul>
4141
4142 !! end
4143
4144
4145 !! test
4146 Definition Lists: Mixed Lists: Test 5
4147 !! wikitext
4148 *:d1
4149 *:: d2
4150 !! html
4151 <ul><li><dl><dd>d1
4152 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4153
4154 !! end
4155
4156
4157 !! test
4158 Definition Lists: Mixed Lists: Test 6
4159 !! wikitext
4160 #*:d1
4161 #*::: d3
4162 !! html
4163 <ol><li><ul><li><dl><dd>d1
4164 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4165
4166 !! end
4167
4168
4169 !! test
4170 Definition Lists: Mixed Lists: Test 7
4171 !! wikitext
4172 :* d1
4173 :* d2
4174 !! html
4175 <dl><dd><ul><li> d1</li>
4176 <li> d2</li></ul></dd></dl>
4177
4178 !! end
4179
4180
4181 !! test
4182 Definition Lists: Mixed Lists: Test 8
4183 !! wikitext
4184 :* d1
4185 ::* d2
4186 !! html
4187 <dl><dd><ul><li> d1</li></ul>
4188 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4189
4190 !! end
4191
4192
4193 !! test
4194 Definition Lists: Mixed Lists: Test 9
4195 !! wikitext
4196 *;foo :bar
4197 !! html
4198 <ul><li><dl><dt>foo&#160;</dt>
4199 <dd>bar</dd></dl></li></ul>
4200
4201 !! end
4202
4203
4204 !! test
4205 Definition Lists: Mixed Lists: Test 10
4206 !! wikitext
4207 *#;foo :bar
4208 !! html
4209 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4210 <dd>bar</dd></dl></li></ol></li></ul>
4211
4212 !! end
4213
4214 # The Parsoid team disagrees with the PHP parser's seemingly-random
4215 # rules regarding dd/dt on the next two tests. Parsoid is more
4216 # consistent, and recognizes the shared nesting and keeps the
4217 # still-open tags around until the nesting is complete.
4218 # (And tidy again converts <dt> to <dd> before 'bar'.)
4219
4220 !! test
4221 Definition Lists: Mixed Lists: Test 11
4222 !! wikitext
4223 *#*#;*;;foo :bar
4224 *#*#;boo :baz
4225 !! html/php
4226 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4227 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4228 <dl><dt>boo&#160;</dt>
4229 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4230
4231 !! html/php+tidy
4232 <ul>
4233 <li>
4234 <ol>
4235 <li>
4236 <ul>
4237 <li>
4238 <ol>
4239 <li>
4240 <dl>
4241 <dt>foo&#160;</dt>
4242 <dd>
4243 <ul>
4244 <li>
4245 <dl>
4246 <dd>
4247 <dl>
4248 <dt>bar</dt>
4249 </dl>
4250 </dd>
4251 </dl>
4252 </li>
4253 </ul>
4254 </dd>
4255 </dl>
4256 <dl>
4257 <dt>boo&#160;</dt>
4258 <dd>baz</dd>
4259 </dl>
4260 </li>
4261 </ol>
4262 </li>
4263 </ul>
4264 </li>
4265 </ol>
4266 </li>
4267 </ul>
4268 !! html/parsoid
4269 <ul>
4270 <li>
4271 <ol>
4272 <li>
4273 <ul>
4274 <li>
4275 <ol>
4276 <li>
4277 <dl>
4278 <dt>
4279 <ul>
4280 <li>
4281 <dl>
4282 <dt>
4283 <dl>
4284 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4285 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4286 </dl></dt>
4287 </dl></li>
4288 </ul></dt>
4289 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4290 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4291 </dl></li>
4292 </ol></li>
4293 </ul></li>
4294 </ol></li>
4295 </ul>
4296 !! end
4297
4298
4299 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4300 # From whitelist:
4301 # * The test is wrong, there are two colons where there should be :;
4302 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4303 !! test
4304 Definition Lists: Weird Ones: Test 1
4305 !! wikitext
4306 *#;*::;; foo : bar (who uses this?)
4307 !! html/php
4308 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4309 <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>
4310
4311 !! html/php+tidy
4312 <ul>
4313 <li>
4314 <ol>
4315 <li>
4316 <dl>
4317 <dt>foo&#160;</dt>
4318 <dd>
4319 <ul>
4320 <li>
4321 <dl>
4322 <dd>
4323 <dl>
4324 <dd>
4325 <dl>
4326 <dd>
4327 <dl>
4328 <dt>bar (who uses this?)</dt>
4329 </dl>
4330 </dd>
4331 </dl>
4332 </dd>
4333 </dl>
4334 </dd>
4335 </dl>
4336 </li>
4337 </ul>
4338 </dd>
4339 </dl>
4340 </li>
4341 </ol>
4342 </li>
4343 </ul>
4344 !! html/parsoid
4345 <ul>
4346 <li>
4347 <ol>
4348 <li>
4349 <dl>
4350 <dt>
4351 <ul>
4352 <li>
4353 <dl>
4354 <dd>
4355 <dl>
4356 <dd>
4357 <dl>
4358 <dt>
4359 <dl>
4360 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4361 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4362 </dl></dt>
4363 </dl></dd>
4364 </dl></dd>
4365 </dl></li>
4366 </ul></dt>
4367 </dl></li>
4368 </ol></li>
4369 </ul>
4370 !! end
4371
4372 !! test
4373 Definition Lists: colons occurring in tags
4374 !! wikitext
4375 ;a:b
4376 ;'''a:b'''
4377 ;<i>a:b</i>
4378 ;<span>a:b</span>
4379 ;<div>a:b</div>
4380 ;<div>a
4381 :b</div>
4382 ;{{echo|a:b}}
4383 ;{{echo|''a:b''}}
4384 ;;;''a:b''
4385 !! html+tidy
4386 <dl>
4387 <dt>a</dt>
4388 <dd>b</dd>
4389 <dt><b>a:b</b></dt>
4390 <dt><i>a:b</i></dt>
4391 <dt><span>a:b</span></dt>
4392 <dd>
4393 <div>a:b</div>
4394 </dd>
4395 <dd>
4396 <div>a
4397 <dl>
4398 <dd>b</dd>
4399 </dl>
4400 </div>
4401 </dd>
4402 <dt>a</dt>
4403 <dd>b</dd>
4404 <dt><i>a:b</i></dt>
4405 </dl>
4406 <dl>
4407 <dd>
4408 <dl>
4409 <dd>
4410 <dl>
4411 <dt><i>a:b</i></dt>
4412 </dl>
4413 </dd>
4414 </dl>
4415 </dd>
4416 </dl>
4417 !! html/parsoid
4418 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4419 <dt><b>a:b</b></dt>
4420 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4421 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4422 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4423 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4424 <dd>b</dd>
4425 <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>
4426 <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>
4427 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4428 !! end
4429
4430 !! test
4431 Definition Lists: colons and tables 1
4432 !! wikitext
4433 :{|
4434 | x
4435 |}
4436 :{|
4437 | y
4438 |}
4439 !! html
4440 <dl><dd><table>
4441 <tr>
4442 <td> x
4443 </td></tr></table></dd></dl>
4444 <dl><dd><table>
4445 <tr>
4446 <td> y
4447 </td></tr></table></dd></dl>
4448
4449 !! end
4450
4451 # Parsoid's output (as documented below) differs from php's in this case.
4452 # This is probably a bug. If we fixup parsoid to match php's output, the
4453 # above test should pass and the below test case can be removed. It is
4454 # unclear which output is more desirable.
4455
4456 !! test
4457 Definition Lists: colons and tables 2
4458 !! wikitext
4459 :{|
4460 | x
4461 |}
4462 :{|
4463 | y
4464 |}
4465 !! html/parsoid
4466 <dl><dd><table>
4467 <tr>
4468 <td> x
4469 </td></tr></table></dd>
4470 <dd><table>
4471 <tr>
4472 <td> y
4473 </td></tr></table></dd></dl>
4474 !! end
4475
4476 !! test
4477 Definition Lists: template interaction
4478 !! wikitext
4479 ::{{definition_list}}
4480
4481 :one
4482 ::{{definition_list}}
4483 :::two
4484 :::three
4485 ::four
4486 !! html/parsoid
4487 <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">
4488 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4489
4490 <dl><dd data-parsoid='{}'>one
4491 <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">
4492 </span><dd about="#mwt2">two
4493 <dl><dd>two</dd>
4494 <dd>three</dd></dl></dd>
4495 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4496 !! end
4497
4498
4499 ###
4500 ### External links
4501 ###
4502 !! test
4503 External links: non-bracketed
4504 !! wikitext
4505 Non-bracketed: http://example.com
4506 !! html
4507 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4508 </p>
4509 !! end
4510
4511 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4512 !! test
4513 External links: numbered
4514 !! wikitext
4515 Numbered: [http://example.com]
4516 Numbered: [http://example.net]
4517 Numbered: [http://example.com]
4518 !! html/php
4519 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4520 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4521 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4522 </p>
4523 !! html/parsoid
4524 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4525 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4526 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4527 !!end
4528
4529 !! test
4530 External links: specified text
4531 !! wikitext
4532 Specified text: [http://example.com link]
4533 !! html
4534 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4535 </p>
4536 !!end
4537
4538 !! test
4539 External links: trail
4540 !! wikitext
4541 Linktrails should not work for external links: [http://example.com link]s
4542 !! html
4543 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4544 </p>
4545 !! end
4546
4547 !! test
4548 External links: dollar sign in URL
4549 !! wikitext
4550 http://example.com/1$2345
4551 !! html
4552 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4553 </p>
4554 !! end
4555
4556 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4557 !! test
4558 External links: dollar sign in URL (autonumber)
4559 !! wikitext
4560 [http://example.com/1$2345]
4561 !! html/php
4562 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4563 </p>
4564 !! html/parsoid
4565 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4566 !!end
4567
4568 !! test
4569 External links: open square bracket forbidden in URL (bug 4377)
4570 !! options
4571 parsoid=wt2html,wt2wt,html2html
4572 !! wikitext
4573 http://example.com/1[2345
4574 !! html/php
4575 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4576 </p>
4577 !! html/parsoid
4578 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4579 !! end
4580
4581 !! test
4582 External links: open square bracket forbidden in URL (named) (bug 4377)
4583 !! options
4584 parsoid=wt2html,html2html
4585 !! wikitext
4586 [http://example.com/1[2345]
4587 !! html/php
4588 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4589 </p>
4590 !! html/parsoid
4591 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4592 !!end
4593
4594 # parsoid adds a space before the link name
4595 !! test
4596 External links: open square bracket forbidden in URL (named) (bug 4377)
4597 Parsoid variant.
4598 !! wikitext
4599 [http://example.com/1 [2345]
4600 !! html
4601 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4602 </p>
4603 !!end
4604
4605 !! test
4606 External links: nowiki in URL link text (bug 6230)
4607 !! wikitext
4608 [http://example.com/ <nowiki>''example site''</nowiki>]
4609 !! html
4610 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4611 </p>
4612 !! end
4613
4614 !! test
4615 External links: newline forbidden in text (bug 6230 regression check)
4616 !! wikitext
4617 [http://example.com/ first
4618 second]
4619 !! html
4620 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4621 second]
4622 </p>
4623 !!end
4624
4625 !! test
4626 External links: Pipe char between url and text
4627 !! wikitext
4628 [http://example.com | link]
4629 !! html
4630 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4631 </p>
4632 !!end
4633
4634 !! test
4635 External links: protocol-relative URL in brackets
4636 !! wikitext
4637 [//example.com/ Test]
4638 !! html
4639 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4640 </p>
4641 !! end
4642
4643 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4644 !! test
4645 External links: protocol-relative URL in brackets without text
4646 !! wikitext
4647 [//example.com]
4648 !! html/php
4649 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4650 </p>
4651 !! html/parsoid
4652 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4653 !! end
4654
4655 !! test
4656 External links: protocol-relative URL in free text is left alone
4657 !! wikitext
4658 //example.com/Foo
4659 !! html
4660 <p>//example.com/Foo
4661 </p>
4662 !!end
4663
4664 !! test
4665 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4666 !! wikitext
4667 foo//example.com/Foo
4668 !! html
4669 <p>foo//example.com/Foo
4670 </p>
4671 !! end
4672
4673 !! test
4674 External links: with no contents
4675 !! wikitext
4676 [http://en.wikipedia.org/wiki/Foo]
4677
4678 [[wikipedia:Foo|Bar]]
4679
4680 [[wikipedia:Foo|<span>Bar</span>]]
4681 !! html/php
4682 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4683 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4684 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4685 </p>
4686 !! html/parsoid
4687 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4688 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4689 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4690 !! end
4691
4692 !! test
4693 External links: Free with trailing punctuation
4694 !! wikitext
4695 http://example.com,
4696 http://example.com;
4697 http://example.com\
4698 http://example.com.
4699 http://example.com:
4700 http://example.com!
4701 http://example.com?
4702 http://example.com)
4703 http://example.com/url_with_(brackets)
4704 (http://example.com/url_without_brackets)
4705 http://example.com/url_with_entity&amp;
4706 http://example.com/url_with_entity&#x26;
4707 http://example.com/url_with_entity&#038;
4708 http://example.com/url_with_entity&nbsp;
4709 http://example.com/url_with_entity&#xA0;
4710 http://example.com/url_with_entity&#160;
4711 http://example.com/url_with_entity&lt;
4712 http://example.com/url_with_entity&#x3C;
4713 http://example.com/url_with_entity&#60;
4714 !! html/php
4715 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4716 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4717 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4718 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4719 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4720 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4721 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4722 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4723 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4724 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4725 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4726 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4727 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4728 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4729 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4730 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4731 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4732 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4733 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4734 </p>
4735 !! html/parsoid
4736 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4737 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4738 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4739 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4740 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4741 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4742 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4743 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4744 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4745 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4746 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4747 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4748 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4749 <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>
4750 <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>
4751 <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>
4752 <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>
4753 <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>
4754 <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>
4755 !! end
4756
4757 !! test
4758 External links: tricky Parsoid html2html case
4759 !! options
4760 parsoid=wt2html,wt2wt,html2html
4761 !! wikitext
4762 http://example.com/url_with_entity&amp;amp;
4763 !! html/php
4764 <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>;
4765 </p>
4766 !! html/parsoid
4767 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4768 !! end
4769
4770 !! test
4771 External links: Free with trailing quotes (T113666)
4772 !! wikitext
4773 '''News:''' Stuff here
4774
4775 news:'a'b''c''d e
4776 !! html/php
4777 <p><b>News:</b> Stuff here
4778 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4779 </p>
4780 !! html/parsoid
4781 <p><b>News:</b> Stuff here</p>
4782 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4783 !! end
4784
4785 !! test
4786 External links: Lone protocols are never linked (T105697)
4787 !! wikitext
4788 http://
4789 http://;
4790 (http://)
4791 bitcoin:
4792 bitcoin:;
4793 (bitcoin:)
4794 !! html
4795 <p>http://
4796 http://;
4797 (http://)
4798 bitcoin:
4799 bitcoin:;
4800 (bitcoin:)
4801 </p>
4802 !! end
4803
4804 !! test
4805 External links: No preceding word characters allowed (bug 65278)
4806 !! wikitext
4807 NOPEhttp://example.com
4808 N0http://example.com
4809 ok:http://example.com
4810 ok-http://example.com
4811 !! html
4812 <p>NOPEhttp://example.com
4813 N0http://example.com
4814 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4815 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4816 </p>
4817 !! end
4818
4819 !! test
4820 External links: nofollow domain exception
4821 !! wikitext
4822 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4823 !! html
4824 <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>.
4825 </p>
4826 !!end
4827
4828 !! test
4829 External image
4830 !! wikitext
4831 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4832 !! html
4833 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4834 </p>
4835 !! end
4836
4837 !! test
4838 External image from https
4839 !! wikitext
4840 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4841 !! html
4842 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4843 </p>
4844 !! end
4845
4846 !! test
4847 External image (when not allowed)
4848 !! options
4849 wgAllowExternalImages=0
4850 !! wikitext
4851 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4852 !! html
4853 <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>
4854 </p>
4855 !! end
4856
4857 !! test
4858 Link to non-http image, no img tag
4859 !! wikitext
4860 Link to non-http image, no img tag: ftp://example.com/test.jpg
4861 !! html
4862 <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>
4863 </p>
4864 !! end
4865
4866 !! test
4867 External links: terminating separator
4868 !! wikitext
4869 Terminating separator: http://example.com/thing,
4870 !! html
4871 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4872 </p>
4873 !! end
4874
4875 !! test
4876 External links: intervening separator
4877 !! wikitext
4878 Intervening separator: http://example.com/1,2,3
4879 !! html
4880 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4881 </p>
4882 !! end
4883
4884 !! test
4885 External links: old bug with URL in query
4886 !! wikitext
4887 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4888 !! html
4889 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4890 </p>
4891 !! end
4892
4893 !! test
4894 External links: old URL-in-URL bug, mixed protocols
4895 !! wikitext
4896 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4897 !! html
4898 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4899 </p>
4900 !!end
4901
4902 # Since Parsoid is starting to emit canonical wikitext for links,
4903 # [http://example.com http://example.com] will not RT back to that
4904 # form anymore.
4905 !! test
4906 External links: URL in text
4907 !! options
4908 parsoid=wt2html
4909 !! wikitext
4910 URL in text: [http://example.com http://example.com]
4911 !! html/php
4912 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4913 </p>
4914 !! html/parsoid
4915 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4916 !! end
4917
4918 !! test
4919 External links: Clickable images
4920 !! wikitext
4921 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4922 !! html/php
4923 <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>
4924 </p>
4925 !! html/parsoid
4926 <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>
4927 !! end
4928
4929 !! test
4930 External links: raw ampersand
4931 !! wikitext
4932 Old &amp; use: http://x&y
4933 !! html
4934 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4935 </p>
4936 !! end
4937
4938 !! test
4939 External links: encoded ampersand
4940 !! wikitext
4941 Old &amp; use: http://x&amp;y
4942 !! html/php
4943 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4944 </p>
4945 !! html/parsoid
4946 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4947 !! end
4948
4949 !! test
4950 External links: encoded equals (bug 6102)
4951 !! wikitext
4952 http://example.com/?foo&#61;bar
4953 !! html/php
4954 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4955 </p>
4956 !! html/parsoid
4957 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4958 !! end
4959
4960 ##
4961 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4962 ## does it number them. As discussed in bug 53505, we can identify
4963 ## autonumbered links via CSS.
4964 ##
4965
4966 !! test
4967 External links: [raw ampersand]
4968 !! wikitext
4969 Old &amp; use: [http://x&y]
4970 !! html/php
4971 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4972 </p>
4973 !! html/parsoid
4974 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4975 !! end
4976
4977 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4978 # mode will return the [raw ampersand] wikitext
4979 !! test
4980 External links: [encoded ampersand]
4981 !! options
4982 parsoid=wt2html,wt2wt,html2html
4983 !! wikitext
4984 Old &amp; use: [http://x&amp;y]
4985 !! html/php
4986 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4987 </p>
4988 !! html/parsoid
4989 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4990 !! end
4991
4992 !! test
4993 External links: [raw equals]
4994 !! wikitext
4995 [http://example.com/?foo=bar]
4996 !! html/php
4997 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4998 </p>
4999 !! html/parsoid
5000 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5001 !! end
5002
5003 # note that parsoid html is identical to [raw equals] case; so html2wt
5004 # mode will return the [raw equals] wikitext
5005 !! test
5006 External links: [encoded equals] (bug 6102)
5007 !! options
5008 parsoid=wt2html,wt2wt,html2html
5009 !! wikitext
5010 [http://example.com/?foo&#61;bar]
5011 !! html/php
5012 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5013 </p>
5014 !! html/parsoid
5015 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5016 !! end
5017
5018 # xxx parsoid strips the IDN character, so the round-trip tests will
5019 # obviously fail and are disabled. --cscott
5020 !! test
5021 External links: [IDN ignored character reference in hostname; strip it right off]
5022 !! options
5023 parsoid=wt2html,wt2wt,html2html
5024 !! wikitext
5025 [http://e&zwnj;xample.com/]
5026 !! html/php
5027 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5028 </p>
5029 !! html/parsoid
5030 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5031 !! end
5032
5033 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5034 # Where an external link could easily circumvent the sanitization of the text of
5035 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5036 # test demands a higher standard. That's a bit strange.
5037 #
5038 # Example:
5039 #
5040 # http://e‌xample.com -> [http://example.com|http://example.com]
5041 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5042 #
5043 # The first example is sanitized, but the second is not. Any security benefits
5044 # from this production are trivial to circumvent. Either remove this test and
5045 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5046 # the test accordingly.
5047 #
5048 # All our love,
5049 # The Parsoid team.
5050 # xxx parsoid strips the IDN character, so the round-trip tests will
5051 # obviously fail and are disabled. --cscott
5052 !! test
5053 External links: IDN ignored character reference in hostname; strip it right off
5054 !! options
5055 parsoid=wt2html,html2html
5056 !! wikitext
5057 http://e&zwnj;xample.com/
5058 !! html/php
5059 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5060 </p>
5061 !! html/parsoid
5062 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5063 !! end
5064
5065 !! test
5066 External links: www.jpeg.org (bug 554)
5067 !! wikitext
5068 http://www.jpeg.org
5069 !! html
5070 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5071 </p>
5072 !! end
5073
5074 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5075 !! test
5076 External links: URL within URL (original bug 2)
5077 !! wikitext
5078 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5079 !! html/php
5080 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5081 </p>
5082 !! html/parsoid
5083 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5084 !! end
5085
5086 !! test
5087 BUG 361: URL inside bracketed URL
5088 !! wikitext
5089 [http://www.example.com/foo http://www.example.com/bar]
5090 !! html
5091 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5092 </p>
5093 !! end
5094
5095 !! test
5096 BUG 361: URL within URL, not bracketed
5097 !! wikitext
5098 http://www.example.com/foo?=http://www.example.com/bar
5099 !! html
5100 <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>
5101 </p>
5102 !! end
5103
5104 !! test
5105 BUG 289: ">"-token in URL-tail
5106 !! wikitext
5107 http://www.example.com/<hello>
5108 !! html
5109 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5110 </p>
5111 !!end
5112
5113 !! test
5114 BUG 289: literal ">"-token in URL-tail
5115 !! wikitext
5116 http://www.example.com/<b>html</b>
5117 !! html/php
5118 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5119 </p>
5120 !! html/parsoid
5121 <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>
5122 !! end
5123
5124 !! test
5125 BUG 289: ">"-token in bracketed URL
5126 !! wikitext
5127 [http://www.example.com/<hello> stuff]
5128 !! html
5129 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5130 </p>
5131 !!end
5132
5133 !! test
5134 BUG 289: literal ">"-token in bracketed URL
5135 !! wikitext
5136 [http://www.example.com/<b>html</b> stuff]
5137 !! html
5138 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5139 </p>
5140 !!end
5141
5142 !! test
5143 BUG 289: literal double quote at end of URL
5144 !! wikitext
5145 http://www.example.com/"hello"
5146 !! html
5147 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5148 </p>
5149 !!end
5150
5151 !! test
5152 BUG 289: literal double quote in bracketed URL
5153 !! wikitext
5154 [http://www.example.com/"hello" stuff]
5155 !! html
5156 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5157 </p>
5158 !!end
5159
5160 !! test
5161 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5162 !! wikitext
5163 [http://www.example.com test]
5164 !! html
5165 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5166 </p>
5167 !! end
5168
5169 !! test
5170 External links: link text with spaces
5171 !! wikitext
5172 [http://www.example.com a b c]
5173 [http://www.example.com ''a'' ''b'']
5174 !! html
5175 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5176 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5177 </p>
5178 !! end
5179
5180 !! test
5181 External links: wiki links within external link (Bug 3695)
5182 !! options
5183 parsoid=wt2html,html2html
5184 !! wikitext
5185 [http://example.com [[wikilink]] embedded in ext link]
5186 !! html/php
5187 <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>
5188 </p>
5189 !! html/parsoid
5190 <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>
5191 !! end
5192
5193 !! test
5194 BUG 787: Links with one slash after the url protocol are invalid
5195 !! wikitext
5196 http:/example.com
5197
5198 [http:/example.com title]
5199 !! html
5200 <p>http:/example.com
5201 </p><p>[http:/example.com title]
5202 </p>
5203 !! end
5204
5205 !! test
5206 Bracketed external links with template-generated invalid target
5207 !! wikitext
5208 [{{echo|http:/example.com}} title]
5209 !! html
5210 <p>[http:/example.com title]
5211 </p>
5212 !! end
5213
5214 !! test
5215 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5216 !! wikitext
5217 ''[http://example.com text'']
5218 [http://example.com '''text]'''
5219 ''Something [http://example.com in italic'']
5220 ''Something [http://example.com mixed''''', even bold]'''
5221 '''''Now [http://example.com both''''']
5222 !! html
5223 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5224 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5225 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5226 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5227 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5228 </p>
5229 !! end
5230
5231
5232 !! test
5233 Bug 4781: %26 in URL
5234 !! wikitext
5235 http://www.example.com/?title=AT%26T
5236 !! html/php
5237 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5238 </p>
5239 !! html/parsoid
5240 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5241 !! end
5242
5243 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5244 # % is actually legal in HTML5. Any change in output would need testing though.
5245 !! test
5246 Bug 4781, 5267: %25 in URL
5247 !! wikitext
5248 http://www.example.com/?title=100%25_Bran
5249 !! html/php
5250 <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>
5251 </p>
5252 !! html/parsoid
5253 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5254 !! end
5255
5256 !! test
5257 Bug 4781, 5267: %28, %29 in URL
5258 !! wikitext
5259 http://www.example.com/?title=Ben-Hur_%281959_film%29
5260 !! html/php
5261 <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>
5262 </p>
5263 !! html/parsoid
5264 <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>
5265 !! end
5266
5267
5268 !! test
5269 Bug 4781: %26 in autonumber URL
5270 !! wikitext
5271 [http://www.example.com/?title=AT%26T]
5272 !! html/php
5273 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5274 </p>
5275 !! html/parsoid
5276 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5277 !! end
5278
5279 !! test
5280 Bug 4781, 5267: %26 in autonumber URL
5281 !! wikitext
5282 [http://www.example.com/?title=100%25_Bran]
5283 !! html/php
5284 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5285 </p>
5286 !! html/parsoid
5287 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5288 !! end
5289
5290 !! test
5291 Bug 4781, 5267: %28, %29 in autonumber URL
5292 !! wikitext
5293 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5294 !! html/php
5295 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5296 </p>
5297 !! html/parsoid
5298 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5299 !! end
5300
5301
5302 !! test
5303 Bug 4781: %26 in bracketed URL
5304 !! wikitext
5305 [http://www.example.com/?title=AT%26T link]
5306 !! html/php
5307 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5308 </p>
5309 !! html/parsoid
5310 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5311 !! end
5312
5313 !! test
5314 Bug 4781, 5267: %25 in bracketed URL
5315 !! wikitext
5316 [http://www.example.com/?title=100%25_Bran link]
5317 !! html
5318 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5319 </p>
5320 !! end
5321
5322 !! test
5323 Bug 4781, 5267: %28, %29 in bracketed URL
5324 !! wikitext
5325 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5326 !! html/php
5327 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5328 </p>
5329 !! html/parsoid
5330 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5331 !! end
5332
5333 !! test
5334 External link containing a period in the anchor. (bug 63947)
5335 !! wikitext
5336 [//foo.org/bar#baz. bang]
5337
5338 [//foo.org/bar. bang]
5339 !! html/php
5340 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5341 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5342 </p>
5343 !! html/parsoid
5344 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5345 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5346 !! end
5347
5348 !! test
5349 External link containing a single quote. (bug 63947)
5350 !! wikitext
5351 [//foo.org/bar'baz]
5352
5353 [//foo.org/bar'baz bang]
5354 !! html/php
5355 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5356 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5357 </p>
5358 !! html/parsoid
5359 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5360 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5361 !! end
5362
5363 !! test
5364 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5365 !! wikitext
5366 Some [http://example.com/ pretty ''italics'' and stuff]!
5367 !! html
5368 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5369 </p>
5370 !! end
5371
5372 !! test
5373 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5374 !! wikitext
5375 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5376 !! html
5377 <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>
5378 </p>
5379 !! end
5380
5381 !! test
5382 External link containing double-single-quotes with no space separating the url from text in italics
5383 !! wikitext
5384 [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]].]
5385 !! html/php
5386 <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>
5387 </p>
5388 !! html/php+tidy
5389 <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>
5390 !! html/parsoid
5391 <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>
5392 !! end
5393
5394 !! test
5395 External link with comments in link text
5396 !! wikitext
5397 [http://www.google.com Google <!-- comment -->]
5398 !! html/php
5399 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5400 </p>
5401 !! html/parsoid
5402 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5403 !! end
5404
5405 !! test
5406 External link to bare IPv4 address
5407 !! wikitext
5408 [http://192.168.0.1 Link]
5409 !! html/php
5410 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5411 </p>
5412 !! html/parsoid
5413 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5414 !! end
5415
5416 !! test
5417 URL-encoding in URL functions (single parameter)
5418 !! wikitext
5419 {{localurl:Some page|amp=&}}
5420 !! html
5421 <p>/index.php?title=Some_page&amp;amp=&amp;
5422 </p>
5423 !! end
5424
5425 !! test
5426 URL-encoding in URL functions (multiple parameters)
5427 !! wikitext
5428 {{localurl:Some page|q=?&amp=&}}
5429 !! html
5430 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5431 </p>
5432 !! end
5433
5434 !! test
5435 Brackets in urls
5436 !! wikitext
5437 http://example.com/index.php?foozoid%5B%5D=bar
5438
5439 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5440 !! html/php
5441 <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>
5442 </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>
5443 </p>
5444 !! html/parsoid
5445 <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>
5446
5447 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5448 !! end
5449
5450 !! test
5451 IPv6 urls, autolink format (T23261)
5452 !! wikitext
5453 http://[2404:130:0:1000::187:2]/index.php
5454
5455 Examples from RFC 2373, section 2.2:
5456 * http://[1080::8:800:200C:417A]/unicast
5457 * http://[FF01::101]/multicast
5458 * http://[::1]/loopback
5459 * http://[::]/unspecified
5460 * http://[::13.1.68.3]/ipv4compat
5461 * http://[::FFFF:129.144.52.38]/ipv4compat
5462
5463 Examples from RFC 2732, section 2:
5464 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5465 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5466 * http://[3ffe:2a00:100:7031::1]
5467 * http://[1080::8:800:200C:417A]/foo
5468 * http://[::192.9.5.5]/ipng
5469 * http://[::FFFF:129.144.52.38]:80/index.html
5470 * http://[2010:836B:4179::836B:4179]
5471
5472 !! html/php
5473 <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>
5474 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5475 </p>
5476 <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>
5477 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5478 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5479 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5480 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5481 <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>
5482 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5483 </p>
5484 <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>
5485 <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>
5486 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5487 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5488 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5489 <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>
5490 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5491
5492 !! html/parsoid
5493 <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>
5494
5495 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5496 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5497 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5498 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5499 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5500 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5501 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5502
5503 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5504 <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>
5505 <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>
5506 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5507 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5508 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5509 <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>
5510 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5511 !! end
5512
5513 !! test
5514 IPv6 urls, bracketed format (T23261)
5515 !! wikitext
5516 [http://[2404:130:0:1000::187:2]/index.php test]
5517
5518 Examples from RFC 2373, section 2.2:
5519 * [http://[1080::8:800:200C:417A] unicast]
5520 * [http://[FF01::101] multicast]
5521 * [http://[::1]/ loopback]
5522 * [http://[::] unspecified]
5523 * [http://[::13.1.68.3] ipv4compat]
5524 * [http://[::FFFF:129.144.52.38] ipv4compat]
5525
5526 Examples from RFC 2732, section 2:
5527 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5528 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5529 * [http://[3ffe:2a00:100:7031::1] 3]
5530 * [http://[1080::8:800:200C:417A]/foo 4]
5531 * [http://[::192.9.5.5]/ipng 5]
5532 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5533 * [http://[2010:836B:4179::836B:4179] 7]
5534
5535 !! html/php
5536 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5537 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5538 </p>
5539 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5540 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5541 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5542 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5543 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5544 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5545 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5546 </p>
5547 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5548 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5549 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5550 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5551 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5552 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5553 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5554
5555 !! html/parsoid
5556 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5557
5558 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5559 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5560 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5561 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5562 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5563 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5564 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5565
5566 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5567 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5568 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5569 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5570 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5571 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5572 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5573 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5574 !! end
5575
5576 !! test
5577 Non-extlinks in brackets
5578 !! wikitext
5579 [foo]
5580 [foo bar]
5581 [foo ''bar'']
5582 [fool's] errand
5583 [fool's errand]
5584 [{{echo|foo}}]
5585 [{{echo|foo}} bar]
5586 [{{echo|foo}} ''bar'']
5587 [{{echo|foo}}l's] errand
5588 [{{echo|foo}}l's errand]
5589 [url={{echo|foo}}]
5590 [url=http://example.com]
5591 [http:// bare protocols don't count]
5592 !! html/php
5593 <p>[foo]
5594 [foo bar]
5595 [foo <i>bar</i>]
5596 [fool's] errand
5597 [fool's errand]
5598 [foo]
5599 [foo bar]
5600 [foo <i>bar</i>]
5601 [fool's] errand
5602 [fool's errand]
5603 [url=foo]
5604 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5605 [http:// bare protocols don't count]
5606 </p>
5607 !! html/parsoid
5608 <p>[foo]
5609 [foo bar]
5610 [foo <i>bar</i>]
5611 [fool's] errand
5612 [fool's errand]
5613 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5614 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5615 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5616 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5617 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5618 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5619 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5620 [http:// bare protocols don't count]</p>
5621 !! end
5622
5623 !! test
5624 Percent encoding in external links
5625 !! wikitext
5626 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5627 !! html/php
5628 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5629 </p>
5630 !! html/parsoid
5631 <p><a rel="mw:ExtLink"
5632 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5633 !! end
5634
5635 !! test
5636 Use url link syntax for links where the content is equal the link target
5637 !! wikitext
5638 http://example.com
5639 !! html/php
5640 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5641 </p>
5642 !! html/parsoid
5643 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5644 !! end
5645
5646 !! test
5647 Parenthesis in external links, especially URL links
5648 !! wikitext
5649 http://example.com)
5650
5651 http://example.com/test)
5652
5653 http://example.com/(test)
5654
5655 http://example.com/((test)
5656
5657 (http://example.com/(test))
5658
5659 (http://example.com/(test)))))
5660
5661 http://example.com/a)b
5662
5663 [http://example.com) foo]
5664 !! html/php
5665 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5666 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5667 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5668 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5669 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5670 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5671 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5672 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5673 </p>
5674 !! html/parsoid
5675 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5676 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5677 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5678 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5679 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5680 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5681 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5682 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5683 !! end
5684
5685 !! test
5686 Parenthesis in external links, w/ transclusion or comment
5687 !! wikitext
5688 (http://example.com/{{echo|hi}})
5689
5690 (http://example.com<!-- hi -->)
5691 !! html/php
5692 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5693 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5694 </p>
5695 !! html/parsoid
5696 <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>
5697
5698 <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>
5699 !! end
5700
5701 !! test
5702 Serialize <a> tags with invalid link targets as plain text
5703 !! options
5704 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5705 !! html/parsoid
5706 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5707 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5708 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5709 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5710 !! wikitext
5711 text
5712 <nowiki>*</nowiki>text
5713 <nowiki>[[foo]]</nowiki>
5714 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5715 !! end
5716
5717 !! test
5718 mw:ExtLink -vs- mw:WikiLink (T94723)
5719 !! options
5720 parsoid=html2wt
5721 !! html/parsoid
5722 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5723 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5724 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5725 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5726 <p>
5727 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5728 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5729 </p>
5730 !! wikitext
5731 [[Foo|Bar]]
5732 [[Foo|Bar]]
5733 [[wikipedia:Foo|Bar]]
5734 [[wikipedia:Foo|Bar]]
5735
5736 [[wikipedia:European_Robin|European Robin]]
5737 [[wikipedia:European_Robin|European Robin]]
5738 !! end
5739
5740 !! test
5741 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5742 !! options
5743 parsoid=wt2wt
5744 !! wikitext
5745 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5746 !! html/parsoid
5747 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5748 !! end
5749
5750
5751 ###
5752 ### Quotes
5753 ###
5754
5755 !! test
5756 Quotes
5757 !! wikitext
5758 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5759
5760 Normal text. '''''Bold italic text.''''' Normal text.
5761 !! html
5762 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5763 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5764 </p>
5765 !! end
5766
5767
5768 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5769 # parser strips. The wikitext contains just the first half of the bold
5770 # quote pair.
5771 !! test
5772 Unclosed and unmatched quotes
5773 !! wikitext
5774 '''''Bold italic text '''with bold deactivated''' in between.'''''
5775
5776 '''''Bold italic text ''with italic deactivated'' in between.'''''
5777
5778 '''Bold text..
5779
5780 ..spanning two paragraphs (should not work).'''
5781
5782 '''Bold tag left open
5783
5784 ''Italic tag left open
5785
5786 Normal text.
5787
5788 <!-- Unmatching number of opening, closing tags: -->
5789 '''This year''''s election ''should'' beat '''last year''''s.
5790
5791 ''Tom'''s car is bigger than ''Susan'''s.
5792
5793 Plain ''italic'''s plain
5794 !! html/php
5795 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5796 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5797 </p><p><b>Bold text..</b>
5798 </p><p>..spanning two paragraphs (should not work).
5799 </p><p><b>Bold tag left open</b>
5800 </p><p><i>Italic tag left open</i>
5801 </p><p>Normal text.
5802 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5803 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5804 </p><p>Plain <i>italic'</i>s plain
5805 </p>
5806 !! html/parsoid
5807 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5808 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5809 </p><p><b>Bold text..</b>
5810 </p><p>..spanning two paragraphs (should not work).<b></b>
5811 </p><p><b>Bold tag left open</b>
5812 </p><p><i>Italic tag left open</i>
5813 </p><p>Normal text.
5814 </p>
5815 <!-- Unmatching number of opening, closing tags: -->
5816 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5817 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5818 </p><p>Plain <i>italic'</i>s plain
5819 </p>
5820 !! end
5821
5822 ###
5823 ### Tables
5824 ###
5825 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5826 ###
5827
5828 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5829 # is the bare minimum required by the spec, see:
5830 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5831 # Parsoid team replies: empty table tags are legal in HTML5
5832 !! test
5833 A table with no data.
5834 !! options
5835 parsoid=wt2html
5836 !! wikitext
5837 {||}
5838 !! html/php
5839
5840 !! html/parsoid
5841 <table></table>
5842
5843 !! end
5844
5845 !! test
5846 A table with stray table end tags on start tag line (wt2html)
5847 !! options
5848 parsoid=wt2html
5849 !! wikitext
5850 {|style="color: red;"|}
5851
5852 {|style="color: red;" |}
5853 |foo
5854 |}
5855
5856 {|style="color: red;"|} id="foo"
5857 |foo
5858 |}
5859
5860 {|style="color: red;" |} id="foo"
5861 |foo
5862 |}
5863 !! html
5864 <table style="color: red;"></table>
5865
5866 <table style="color: red;">
5867 <tbody><tr>
5868 <td>foo</td>
5869 </tr></tbody>
5870 </table>
5871
5872 <table style="color: red;" id="foo">
5873 <tbody><tr>
5874 <td>foo</td>
5875 </tr></tbody>
5876 </table>
5877
5878 <table style="color: red;" id="foo">
5879 <tbody><tr>
5880 <td>foo</td>
5881 </tr></tbody>
5882 </table>
5883
5884 !! end
5885
5886 !! test
5887 A table with no data (take 2)
5888 !! wikitext
5889 {|
5890 |}
5891 !! html/parsoid
5892 <table></table>
5893 !! end
5894
5895 # A table with nothing but a caption is invalid XHTML, we might want to render
5896 # this as <p>caption</p>
5897 # Parsoid team replies: table with only a caption is legal in HTML5
5898 !! test
5899 A table with nothing but a caption
5900 !! wikitext
5901 {|
5902 |+ caption
5903 |}
5904 !! html/php
5905 <table>
5906 <caption> caption
5907 </caption><tr><td></td></tr></table>
5908
5909 !! html/parsoid
5910 <table><caption> caption</caption></table>
5911 !! end
5912
5913 !! test
5914 A table with caption with default-spaced attributes and a table row
5915 !! wikitext
5916 {|
5917 |+ style="color: red;" | caption1
5918 |-
5919 | foo
5920 |}
5921 !! html
5922 <table>
5923 <caption style="color: red;"> caption1
5924 </caption>
5925 <tr>
5926 <td> foo
5927 </td></tr></table>
5928
5929 !! end
5930
5931 !! test
5932 A table with captions with non-default spaced attributes and a table row
5933 !! wikitext
5934 {|
5935 |+style="color: red;"|caption2
5936 |+ style="color: red;"| caption3
5937 |-
5938 | foo
5939 |}
5940 !! html
5941 <table>
5942 <caption style="color: red;">caption2
5943 </caption>
5944 <caption style="color: red;"> caption3
5945 </caption>
5946 <tr>
5947 <td> foo
5948 </td></tr></table>
5949
5950 !! end
5951
5952 !! test
5953 Table td-cell syntax variations
5954 !! wikitext
5955 {|
5956 | foo bar foo | baz
5957 | foo bar foo || baz
5958 | style='color:red;' | baz
5959 | style='color:red;' || baz
5960 |}
5961 !! html
5962 <table>
5963 <tr>
5964 <td> baz
5965 </td>
5966 <td> foo bar foo </td>
5967 <td> baz
5968 </td>
5969 <td style="color:red;"> baz
5970 </td>
5971 <td> style='color:red;' </td>
5972 <td> baz
5973 </td></tr></table>
5974
5975 !! end
5976
5977 !! test
5978 Simple table
5979 !! wikitext
5980 {|
5981 | 1 || 2
5982 |-
5983 | 3 || 4
5984 |}
5985 !! html
5986 <table>
5987 <tr>
5988 <td> 1 </td>
5989 <td> 2
5990 </td></tr>
5991 <tr>
5992 <td> 3 </td>
5993 <td> 4
5994 </td></tr></table>
5995
5996 !! end
5997
5998 !! test
5999 Simple table but with multiple dashes for row wikitext
6000 !! wikitext
6001 {|
6002 | foo
6003 |-----
6004 | bar
6005 |}
6006 !! html
6007 <table>
6008 <tr>
6009 <td> foo
6010 </td></tr>
6011 <tr>
6012 <td> bar
6013 </td></tr></table>
6014
6015 !! end
6016
6017 !! test
6018 Multiplication table
6019 !! wikitext
6020 {| border="1" cellpadding="2"
6021 |+Multiplication table
6022 |-
6023 ! &times; !! 1 !! 2 !! 3
6024 |-
6025 ! 1
6026 | 1 || 2 || 3
6027 |-
6028 ! 2
6029 | 2 || 4 || 6
6030 |-
6031 ! 3
6032 | 3 || 6 || 9
6033 |-
6034 ! 4
6035 | 4 || 8 || 12
6036 |-
6037 ! 5
6038 | 5 || 10 || 15
6039 |}
6040 !! html
6041 <table border="1" cellpadding="2">
6042 <caption>Multiplication table
6043 </caption>
6044 <tr>
6045 <th> &#215; </th>
6046 <th> 1 </th>
6047 <th> 2 </th>
6048 <th> 3
6049 </th></tr>
6050 <tr>
6051 <th> 1
6052 </th>
6053 <td> 1 </td>
6054 <td> 2 </td>
6055 <td> 3
6056 </td></tr>
6057 <tr>
6058 <th> 2
6059 </th>
6060 <td> 2 </td>
6061 <td> 4 </td>
6062 <td> 6
6063 </td></tr>
6064 <tr>
6065 <th> 3
6066 </th>
6067 <td> 3 </td>
6068 <td> 6 </td>
6069 <td> 9
6070 </td></tr>
6071 <tr>
6072 <th> 4
6073 </th>
6074 <td> 4 </td>
6075 <td> 8 </td>
6076 <td> 12
6077 </td></tr>
6078 <tr>
6079 <th> 5
6080 </th>
6081 <td> 5 </td>
6082 <td> 10 </td>
6083 <td> 15
6084 </td></tr></table>
6085
6086 !! end
6087
6088 !! test
6089 Accept "||" in table headings
6090 !! wikitext
6091 {|
6092 !h1 || h2
6093 |}
6094 !! html
6095 <table>
6096 <tr>
6097 <th>h1 </th>
6098 <th> h2
6099 </th></tr></table>
6100
6101 !! end
6102
6103 !! test
6104 Accept "!!" in table data
6105 !! wikitext
6106 {|
6107 | Foo!! ||
6108 |}
6109 !! html
6110 <table>
6111 <tr>
6112 <td> Foo!! </td>
6113 <td>
6114 </td></tr></table>
6115
6116 !! html/parsoid
6117 <table>
6118 <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>
6119 </tbody></table>
6120 !! end
6121
6122 !! test
6123 Accept "||" in indented table headings
6124 !! wikitext
6125 :{|
6126 !h1 || h2
6127 |}
6128 !! html
6129 <dl><dd><table>
6130 <tr>
6131 <th>h1 </th>
6132 <th> h2
6133 </th></tr></table></dd></dl>
6134
6135 !! end
6136
6137 !! test
6138 Accept "!!" in templates
6139 !! wikitext
6140 {|
6141 !a {{echo|b!!c}}
6142 |}
6143 !! html/php
6144 <table>
6145 <tr>
6146 <th>a b</th>
6147 <th>c
6148 </th></tr></table>
6149
6150 !! html/parsoid
6151 <table>
6152 <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>
6153 !! end
6154
6155 !! test
6156 Accept "!!" in table headings after newline
6157 !! wikitext
6158 {|
6159 !a
6160 b!!c
6161 |}
6162 !! html/php
6163 <table>
6164 <tr>
6165 <th>a
6166 <p>b!!c
6167 </p>
6168 </th></tr></table>
6169
6170 !! html/parsoid
6171 <table>
6172 <tbody><tr><th>a
6173 <p>b!!c</p></th></tr>
6174 </tbody></table>
6175 !! end
6176
6177 !! test
6178 Accept "!!" in table data of mixed wikitext / html syntax
6179 !! wikitext
6180 {|
6181 !a
6182 <tr><td>b!!c</td></tr>
6183 |}
6184 !! html+tidy
6185 <table>
6186 <tr>
6187 <th>a</th>
6188 </tr>
6189 <tr>
6190 <td>b!!c</td>
6191 </tr>
6192 </table>
6193 !! html/parsoid
6194 <table>
6195 <tbody><tr><th>a</th></tr>
6196 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6197 </tbody></table>
6198 !! end
6199
6200 !! test
6201 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6202 !! wikitext
6203 {|
6204 !| h1
6205 || a
6206 |}
6207 !! html
6208 <table>
6209 <tr>
6210 <th> h1
6211 </th>
6212 <td> a
6213 </td></tr></table>
6214
6215 !! end
6216
6217 !!test
6218 Accept "| !" at start of line in tables (ignore !-attribute)
6219 !! wikitext
6220 {|
6221 |-
6222 | !style="color:red" | bar
6223 |}
6224 !! html
6225 <table>
6226
6227 <tr>
6228 <td> bar
6229 </td></tr></table>
6230
6231 !!end
6232
6233 !!test
6234 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 +/-
6235 !! wikitext
6236 {|
6237 |-
6238 |style='color:red;'|+1
6239 |style='color:blue;'|-1
6240 |-
6241 | 1 || 2 || 3
6242 | 1 ||+2 ||-3
6243 |-
6244 | +1
6245 | -1
6246 |}
6247 !! html
6248 <table>
6249
6250 <tr>
6251 <td style="color:red;">+1
6252 </td>
6253 <td style="color:blue;">-1
6254 </td></tr>
6255 <tr>
6256 <td> 1 </td>
6257 <td> 2 </td>
6258 <td> 3
6259 </td>
6260 <td> 1 </td>
6261 <td>+2 </td>
6262 <td>-3
6263 </td></tr>
6264 <tr>
6265 <td> +1
6266 </td>
6267 <td> -1
6268 </td></tr></table>
6269
6270 !!end
6271
6272 !! test
6273 Table rowspan
6274 !! wikitext
6275 {| border=1
6276 | Cell 1, row 1
6277 |rowspan=2| Cell 2, row 1 (and 2)
6278 | Cell 3, row 1
6279 |-
6280 | Cell 1, row 2
6281 | Cell 3, row 2
6282 |}
6283 !! html
6284 <table border="1">
6285 <tr>
6286 <td> Cell 1, row 1
6287 </td>
6288 <td rowspan="2"> Cell 2, row 1 (and 2)
6289 </td>
6290 <td> Cell 3, row 1
6291 </td></tr>
6292 <tr>
6293 <td> Cell 1, row 2
6294 </td>
6295 <td> Cell 3, row 2
6296 </td></tr></table>
6297
6298 !! end
6299
6300 !! test
6301 Nested table
6302 !! wikitext
6303 {| border=1
6304 | &alpha;
6305 |
6306 {| bgcolor=#ABCDEF border=2
6307 |nested
6308 |-
6309 |table
6310 |}
6311 |the original table again
6312 |}
6313 !! html
6314 <table border="1">
6315 <tr>
6316 <td> &#945;
6317 </td>
6318 <td>
6319 <table bgcolor="#ABCDEF" border="2">
6320 <tr>
6321 <td>nested
6322 </td></tr>
6323 <tr>
6324 <td>table
6325 </td></tr></table>
6326 </td>
6327 <td>the original table again
6328 </td></tr></table>
6329
6330 !! end
6331
6332 !! test
6333 Invalid attributes in table cell (bug 1830)
6334 !! wikitext
6335 {|
6336 |Cell:|broken
6337 |}
6338 !! html
6339 <table>
6340 <tr>
6341 <td>broken
6342 </td></tr></table>
6343
6344 !! end
6345
6346 !! test
6347 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6348 !! wikitext
6349 {|
6350 | title="foo" |bar
6351 | title="foo<nowiki>|</nowiki>" |bar
6352 | title="foo<nowiki>|</nowiki>" bar
6353 |}
6354 !! html/php
6355 <table>
6356 <tr>
6357 <td title="foo">bar
6358 </td>
6359 <td title="foo&#124;">bar
6360 </td>
6361 <td> title="foo|" bar
6362 </td></tr></table>
6363
6364 !! html/parsoid
6365 <table>
6366 <tbody><tr><td title="foo">bar</td>
6367 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6368 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6369 </tbody></table>
6370 !! end
6371
6372 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6373 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6374 # *2wt modes will fail.
6375 !! test
6376 Table security: embedded pipes
6377 !! options
6378 parsoid=wt2html,html2html
6379 !! wikitext
6380 {|
6381 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6382 !! html/php
6383 <table>
6384 <tr>
6385 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6386 <td>]" onmouseover="alert(document.cookie)"&gt;test
6387 </td>
6388 </tr>
6389 </table>
6390
6391 !! html/parsoid
6392 <table><tbody>
6393 <tr>
6394 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6395 !! end
6396
6397 !! test
6398 Element attributes with double ! should not be broken up by <th>
6399 !! wikitext
6400 {|
6401 ! hi <div class="!!">ha</div> ho
6402 |}
6403 !! html/php
6404 <table>
6405 <tr>
6406 <th> hi <div class="!!">ha</div> ho
6407 </th></tr></table>
6408
6409 !! html/parsoid
6410 <table>
6411 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6412 </tbody></table>
6413 !! end
6414
6415 !! test
6416 ! and || in element attributes should not be parsed as <th>/<td>
6417 !! wikitext
6418 {|
6419 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6420 |}
6421 !! html/php
6422 <table>
6423 <tr>
6424 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6425 </td></tr></table>
6426
6427 !! html/parsoid
6428 <table>
6429 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6430 </tbody></table>
6431 !! end
6432
6433 # FIXME: The output seems broken. Filed as T110268.
6434 !! test
6435 ! and || in td attributes should not be parsed as <th>/<td>
6436 !! options
6437 parsoid=wt2html
6438 !! wikitext
6439 {|
6440 | style="color: red !important;" data-contrived="put this here ||" | foo
6441 |}
6442 !! html/php
6443 <table>
6444 <tr>
6445 <td> style="color: red !important;" data-contrived="put this here </td>
6446 <td> foo
6447 </td></tr></table>
6448
6449 !! html/parsoid
6450 <table>
6451 <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>
6452 </tbody></table>
6453 !! end
6454
6455 !! test
6456 Break on | in element attribute in template
6457 !! options
6458 parsoid=wt2html,html2html
6459 !! wikitext
6460 {{echo|1=<div class="hi|ho">ha</div>}}
6461 !! html/php
6462 <p>ho"&gt;ha&lt;/div&gt;
6463 </p>
6464 !! html/parsoid
6465 <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>
6466 !! end
6467
6468 !! test
6469 Don't break on | in extension attribute in template
6470 !! wikitext
6471 {{echo|<ref name="hi|ho">ha</ref>}}
6472
6473 <references />
6474 !! html/parsoid
6475 <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>
6476
6477 <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>
6478 !! end
6479
6480 ## We don't support roundtripping of these attributes in Parsoid.
6481 ## Selective serialization takes care of preventing dirty diffs.
6482 ## But, on edits, we dirty-diff the invalid attribute text.
6483 !! test
6484 Invalid text in table attributes should be discarded
6485 !! options
6486 parsoid=wt2html
6487 !! wikitext
6488 {| <span>boo</span> style='border:1px solid black'
6489 | <span>boo</span> style='color:blue' | 1
6490 |<span>boo</span> style='color:blue'| 2
6491 |}
6492 !! html/php
6493 <table style="border:1px solid black">
6494 <tr>
6495 <td style="color:blue"> 1
6496 </td>
6497 <td style="color:blue"> 2
6498 </td></tr></table>
6499
6500 !! html/parsoid
6501 <table style="border:1px solid black">
6502 <tr>
6503 <td style="color:blue"> 1</td>
6504 <td style="color:blue"> 2</td>
6505 </tr>
6506 </table>
6507 !! end
6508
6509 !! test
6510 Invalid text in table attributes should be preserved by selective serializer
6511 !! options
6512 parsoid={
6513 "modes": ["selser"],
6514 "changes": [
6515 ["td:first-child", "text", "abc"],
6516 ["td + td", "text", "xyz"]
6517 ]
6518 }
6519 !! wikitext
6520 {| <span>boo</span> style='border:1px solid black'
6521 | <span>boo</span> style='color:blue' | 1
6522 |<span>boo</span> style='color:blue'| 2
6523 |}
6524 !! wikitext/edited
6525 {| <span>boo</span> style='border:1px solid black'
6526 | <span>boo</span> style='color:blue' |abc
6527 |<span>boo</span> style='color:blue'|xyz
6528 |}
6529 !! end
6530
6531 !! test
6532 1. Template-generated table cell attributes and cell content
6533 !! wikitext
6534 {|
6535 |{{table_attribs}}
6536 | {{table_attribs}}
6537 || {{table_attribs_5}}
6538 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6539 |align=center {{table_attribs}}
6540 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6541 |}
6542 !! html
6543 <table>
6544 <tr>
6545 <td style="color:red;">Foo
6546 </td>
6547 <td style="color:red;">Foo
6548 </td>
6549 <td> style="color:red;"</td>
6550 <td>Bar
6551 </td>
6552 <td style="color:red;">Foo
6553 </td>
6554 <td align="center" style="color:red;">Foo
6555 </td>
6556 <td align="center" style="color:red;">Foo
6557 </td></tr></table>
6558
6559 !! end
6560
6561 !! test
6562 2. Template-generated table cell attributes and cell content
6563 !! wikitext
6564 {|
6565 |{{table_attribs_2}}
6566 |}
6567 !! html/php
6568 <table>
6569 <tr>
6570 <td style="color:red;">Foo
6571 </td>
6572 <td>Bar</td>
6573 <td>Baz
6574 </td></tr></table>
6575
6576 !! html/parsoid
6577 <table>
6578 <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>
6579 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6580 </tbody></table>
6581 !! end
6582
6583 !! test
6584 3. Template-generated table cell attributes and cell content
6585 !! wikitext
6586 {|
6587 !align=center {{table_header_cells}}
6588 |-
6589 |align=center {{table_cells}}
6590 |}
6591 !! html/php
6592 <table>
6593 <tr>
6594 <th align="center" style="color:red;">Foo</th>
6595 <th style="color:red;"><i>Bar</i></th>
6596 <th style="color:brown;"><i>Foo</i> and Baz
6597 </th></tr>
6598 <tr>
6599 <td align="center" style="color:red;">Foo</td>
6600 <td style="color:red;"><i>Bar</i></td>
6601 <td style="color:brown;"><i>Foo</i> and Baz
6602 </td></tr></table>
6603
6604 !! html/parsoid
6605 <table>
6606 <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>
6607 <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>
6608 </tbody></table>
6609 !! end
6610
6611 !! test
6612 4. Template-generated table cell attributes and cell content inside a templated table
6613 !! wikitext
6614 {{tbl-start}}
6615 !align=center {{table_header_cells}}
6616 |-
6617 |align=center {{table_cells}}
6618 {{tbl-end}}
6619 !! html/php
6620 <table>
6621 <tr>
6622 <th align="center" style="color:red;">Foo</th>
6623 <th style="color:red;"><i>Bar</i></th>
6624 <th style="color:brown;"><i>Foo</i> and Baz
6625 </th></tr>
6626 <tr>
6627 <td align="center" style="color:red;">Foo</td>
6628 <td style="color:red;"><i>Bar</i></td>
6629 <td style="color:brown;"><i>Foo</i> and Baz
6630 </td></tr></table>
6631
6632 !! html/parsoid
6633 <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}}]}'>
6634 <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>
6635 <tr>
6636 <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>
6637 </tbody></table>
6638 !! end
6639
6640 ## Edge case fix to prevent future regressions
6641 !! test
6642 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6643 !! wikitext
6644 {|
6645 |{{table_attribs_7}}
6646 |}
6647 <references />
6648 !! html/parsoid
6649 <table>
6650 <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>
6651 </tbody></table>
6652 <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>
6653 !! end
6654
6655 !! test
6656 Table with row followed by newlines and table heading
6657 !! options
6658 parsoid=wt2html,html2html
6659 !! wikitext
6660 {|
6661 |-
6662
6663 ! foo
6664 |}
6665 !! html/*
6666 <table>
6667
6668
6669 <tr>
6670 <th> foo
6671 </th></tr></table>
6672
6673 !! end
6674
6675 !! test
6676 Table with empty line following the start tag
6677 !! options
6678 parsoid=wt2html,html2html
6679 !! wikitext
6680 {|
6681
6682 |-
6683 | foo
6684 |}
6685 !! html/*
6686 <table>
6687
6688
6689 <tr>
6690 <td> foo
6691 </td></tr></table>
6692
6693 !! end
6694
6695 !! test
6696 Table attributes with empty value
6697 !! options
6698 parsoid=wt2html,html2html
6699 !! wikitext
6700 {|
6701 | style=| hello
6702 |}
6703 !! html/php
6704 <table>
6705 <tr>
6706 <td style=""> hello
6707 </td></tr></table>
6708
6709 !! html/parsoid
6710 <table>
6711 <tbody><tr><td style=""> hello</td></tr>
6712 </tbody></table>
6713 !! end
6714
6715 !! test
6716 Wikitext table with a lot of comments
6717 !! wikitext
6718 {|
6719 <!-- c0 -->
6720 | foo
6721 <!-- c1 -->
6722 |-<!-- c2 -->
6723 <!-- c3 -->
6724 |<!-- c4 -->
6725 <!-- c5 -->
6726 |}
6727 !! html
6728 <table>
6729 <tr>
6730 <td> foo
6731 </td></tr>
6732 <tr>
6733 <td>
6734 </td></tr></table>
6735
6736 !! end
6737
6738 !! test
6739 Wikitext table comments represented in parsoid dom
6740 !! wikitext
6741 {|<!--c1--><!--c2-->
6742 |-<!--c3-->
6743 | x
6744 |}
6745 !! html/php+tidy
6746 <table>
6747 <tr>
6748 <td>x</td>
6749 </tr>
6750 </table>
6751 !! html/parsoid
6752 <table><!--c1--><!--c2-->
6753 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6754 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6755 </tbody></table>
6756 !! end
6757
6758 !! test
6759 Wikitext table with double-line table cell
6760 !! wikitext
6761 {|
6762 |a
6763 b
6764 |}
6765 !! html
6766 <table>
6767 <tr>
6768 <td>a
6769 <p>b
6770 </p>
6771 </td></tr></table>
6772
6773 !! end
6774
6775 !! test
6776 Table cell with a single comment
6777 !! wikitext
6778 {|
6779 | <!-- c1 -->
6780 | a
6781 |}
6782 !! html
6783 <table>
6784 <tr>
6785 <td>
6786 </td>
6787 <td> a
6788 </td></tr></table>
6789
6790 !! end
6791
6792 !! test
6793 Table-cell after a comment-only-empty-line
6794 !! wikitext
6795 {|
6796 |a
6797 <!--c1-->
6798 <!--c2-->| b
6799 |}
6800 !! html
6801 <table>
6802 <tr>
6803 <td>a
6804 </td>
6805 <td> b
6806 </td></tr></table>
6807
6808 !! html/parsoid
6809 <table>
6810 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6811 <!--c1-->
6812 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6813 </tbody></table>
6814
6815 !! end
6816
6817 !! test
6818 Build table with {{!}}
6819 !! wikitext
6820 {{{!}} class="wikitable"
6821 ! header
6822 ! second header
6823 {{!}}- style="color:red;"
6824 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6825 {{!}}}
6826 !! html
6827 <table class="wikitable">
6828 <tr>
6829 <th> header
6830 </th>
6831 <th> second header
6832 </th></tr>
6833 <tr style="color:red;">
6834 <td> data </td>
6835 <td style="color:red;"> second data
6836 </td></tr></table>
6837
6838 !! end
6839
6840 !! test
6841 Build table with pipe as data
6842 !! wikitext
6843 {| class="wikitable"
6844 ! header
6845 ! second header
6846 |- style="color:red;"
6847 | data || style="color:red;" | second data
6848 |-
6849 | style="color:red;" | data with | || style="color:red;" | second data with |
6850 |-
6851 || data with | ||| second data with |
6852 |}
6853 !! html
6854 <table class="wikitable">
6855 <tr>
6856 <th> header
6857 </th>
6858 <th> second header
6859 </th></tr>
6860 <tr style="color:red;">
6861 <td> data </td>
6862 <td style="color:red;"> second data
6863 </td></tr>
6864 <tr>
6865 <td style="color:red;"> data with | </td>
6866 <td style="color:red;"> second data with |
6867 </td></tr>
6868 <tr>
6869 <td> data with | </td>
6870 <td> second data with |
6871 </td></tr></table>
6872
6873 !! end
6874
6875 !! test
6876 Build table with wikilink
6877 !! wikitext
6878 {| class="wikitable"
6879 ! header || second header
6880 |- style="color:red;"
6881 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6882 |-
6883 | data || second data [[Main Page|link|text with pipe]]
6884 |}
6885 !! html
6886 <table class="wikitable">
6887 <tr>
6888 <th> header </th>
6889 <th> second header
6890 </th></tr>
6891 <tr style="color:red;">
6892 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6893 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6894 </td></tr>
6895 <tr>
6896 <td> data </td>
6897 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6898 </td></tr></table>
6899
6900 !! end
6901
6902 # The expected HTML structure in this test is debatable. The PHP parser does
6903 # not parse this kind of table at all. The main focus for Parsoid is on
6904 # round-tripping, so this output is ok for now. TODO: revisit!
6905 !! test
6906 Wikitext table with html-syntax row
6907 !! wikitext
6908 {|
6909 |-
6910 <td>foo</td>
6911 |}
6912 !! html/parsoid
6913 <table>
6914 <tbody>
6915 <tr>
6916 <td>foo</td></tr></tbody></table>
6917 !! end
6918
6919 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6920 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6921 ## PHP parser, which tidy then compounds by fostering the content
6922 ## entirely out of the table. Parsoid recognizes the table context
6923 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6924 ## depends on PHP's treatment of broken table markup!
6925 !! test
6926 Implicit <td> after a |-
6927 !! options
6928 parsoid=wt2html,html2html
6929 !! wikitext
6930 {|
6931 |-
6932 a
6933 |}
6934 !! html/php
6935 <table>
6936
6937 a
6938 </table>
6939
6940 !! html/php+tidy
6941 <p>a</p>
6942 !! html/parsoid
6943 <table>
6944 <tr><td>a</td></tr>
6945 </table>
6946 !! end
6947
6948 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6949 !! test
6950 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6951 !! options
6952 parsoid=wt2html,html2html
6953 !! wikitext
6954 {|
6955 |-
6956 |
6957 a
6958 |-
6959 b
6960 |}
6961 !! html/php
6962 <table>
6963
6964 <tr>
6965 <td>
6966 <pre>a
6967 </pre>
6968 </td></tr>
6969 b
6970 </table>
6971
6972 !! html/php+tidy
6973 <p>b</p>
6974 <table>
6975 <tr>
6976 <td>
6977 <pre>
6978 a
6979 </pre></td>
6980 </tr>
6981 </table>
6982 !! html/parsoid
6983 <table>
6984 <tbody>
6985 <tr><td><pre>a</pre></td></tr>
6986 <tr><td> b</td></tr>
6987 </tbody>
6988 </table>
6989 !! end
6990
6991 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6992 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6993 !! test
6994 Lists should be recognized in an implicit <td> context
6995 !! options
6996 parsoid=wt2html,html2html
6997 !! wikitext
6998 {|
6999 |-
7000 *a
7001 |}
7002 !! html/php
7003 <table>
7004
7005 <ul><li>a</li></ul>
7006 </table>
7007
7008 !! html/php+tidy
7009 <ul>
7010 <li>a</li>
7011 </ul>
7012 !! html/parsoid
7013 <table>
7014 <tr>
7015 <td><ul>
7016 <li>a</li>
7017 </ul></td>
7018 </tr>
7019 </table>
7020 !! end
7021
7022 !! test
7023 Table cells not properly parsed in an implicit-td context
7024 !! wikitext
7025 {|
7026 |-
7027 {{table_attribs_4}} || a || b
7028 |}
7029 !! html/php+tidy
7030 <table>
7031 <tr>
7032 <td style="background-color:#DC241f;" width="10px"></td>
7033 <td>a</td>
7034 <td>b</td>
7035 </tr>
7036 </table>
7037 !! html/parsoid
7038 <table>
7039 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7040 <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>
7041 </tbody></table>
7042 !! end
7043
7044 !! test
7045 Parsoid: Round-trip tables directly followed by content (bug 51219)
7046 !! options
7047 parsoid=wt2html,wt2wt
7048 !! wikitext
7049 {|
7050 |foo
7051 |} bar
7052
7053 {|
7054 |baz
7055 |}<b>quux</b>
7056 !! html+tidy
7057 <table>
7058 <tr>
7059 <td>foo</td>
7060 </tr>
7061 </table>
7062 <p>bar</p>
7063 <table>
7064 <tr>
7065 <td>baz</td>
7066 </tr>
7067 </table>
7068 <p><b>quux</b></p>
7069 !! end
7070
7071 !! test
7072 Parsoid: Default to a newline after tables in new content (bug 51219)
7073 !! options
7074 parsoid=html2wt
7075 !! html/parsoid
7076 <table><tbody>
7077 <tr><td>foo</td></tr></tbody></table> bar
7078 <table><tbody>
7079 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7080 !! wikitext
7081 {|
7082 |foo
7083 |}
7084 <nowiki> </nowiki>bar
7085 {|
7086 |baz
7087 |}
7088 '''quux'''
7089 !! end
7090
7091 !! test
7092 Parsoid: newline inducing block nodes don't suppress <nowiki>
7093 !! options
7094 parsoid=html2wt
7095 !! html/parsoid
7096 a<h1>foo</h1>
7097 !! wikitext
7098 <nowiki> </nowiki>a
7099
7100 = foo =
7101 !! end
7102
7103 !! test
7104 Parsoid: Row-syntax table headings followed by comment & table cells
7105 !! options
7106 parsoid=wt2html,wt2wt
7107 !! wikitext
7108 {|
7109 ! foo || bar
7110 <!-- foo --> || baz || quux
7111 |}
7112 !! html/php
7113 <table>
7114 <tr>
7115 <th> foo </th>
7116 <th> bar
7117 </th>
7118 <td> baz </td>
7119 <td> quux
7120 </td></tr></table>
7121
7122 !! html/parsoid
7123 <table>
7124 <tbody><tr><th> foo </th><th> bar
7125 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7126 </tbody></table>
7127 !! end
7128
7129 !!test
7130 Parsoid: Recover better from broken table attributes
7131 !!options
7132 parsoid=wt2html
7133 !!wikitext
7134 {| class="foo
7135 | class="bar" |
7136 foo
7137 |}
7138 !!html/php+tidy
7139 <table class="foo">
7140 <tr>
7141 <td class="bar">
7142 <p>foo</p>
7143 </td>
7144 </tr>
7145 </table>
7146 !!html/parsoid
7147 <table class="foo">
7148 <tr>
7149 <td class="bar">
7150 <p>foo</p></td></tr>
7151 </tbody></table>
7152 !!end
7153
7154 !! test
7155 Tables: Digest broken attributes on table and tr tag
7156 !! options
7157 parsoid=wt2html
7158 !! wikitext
7159 {| || |} ++
7160 |- || || ++ --
7161 |- > [
7162 |}
7163 !! html
7164 <table>
7165 <tbody>
7166 <tr></tr>
7167 <tr></tr>
7168 </tbody></table>
7169 !! end
7170
7171 # T137406: Whitespace in the HTML
7172 !! test
7173 1. Generate correct wikitext for tables with thead/tbody/tfoot
7174 !! options
7175 parsoid=html2wt
7176 !! html/parsoid
7177 <table>
7178 <caption>Test</caption>
7179 <thead>
7180 <tr>
7181 <th>Month</th>
7182 <th>Savings</th>
7183 </tr>
7184 </thead>
7185 <tbody>
7186 <tr>
7187 <td>January</td>
7188 <td>$100</td>
7189 </tr>
7190 <tr>
7191 <td>February</td>
7192 <td>$80</td>
7193 </tr>
7194 </tbody>
7195 <tfoot>
7196 <tr>
7197 <td>Sum</td>
7198 <td>$180</td>
7199 </tr>
7200 </tfoot>
7201 </table>
7202 !! wikitext
7203 {|
7204 |+Test
7205 !Month
7206 !Savings
7207 |-
7208 |January
7209 |$100
7210 |-
7211 |February
7212 |$80
7213 |-
7214 |Sum
7215 |$180
7216 |}
7217 !! html/php+tidy
7218 <table>
7219 <caption>Test</caption>
7220 <tr>
7221 <th>Month</th>
7222 <th>Savings</th>
7223 </tr>
7224 <tr>
7225 <td>January</td>
7226 <td>$100</td>
7227 </tr>
7228 <tr>
7229 <td>February</td>
7230 <td>$80</td>
7231 </tr>
7232 <tr>
7233 <td>Sum</td>
7234 <td>$180</td>
7235 </tr>
7236 </table>
7237 !! end
7238
7239 # T137406: No whitespace in the HTML
7240 !! test
7241 2. Generate correct wikitext for tables with thead/tbody/tfoot
7242 !! options
7243 parsoid=html2wt
7244 !! html/parsoid
7245 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7246 !! wikitext
7247 {|
7248 !heading
7249 |-
7250 |foo
7251 |}
7252 !! end
7253
7254 !! test
7255 Testing serialization after deletion in references
7256 !! options
7257 parsoid={
7258 "modes": ["wt2wt"],
7259 "changes": [
7260 ["#x", "remove"]
7261 ]
7262 }
7263 !! wikitext
7264 hi <ref><div id="x">ho</div></ref>
7265
7266 <references />
7267 !! wikitext/edited
7268 hi <ref></ref>
7269
7270 <references />
7271 !! end
7272
7273 !!test
7274 Testing serialization after deletion of table cells
7275 !!options
7276 parsoid={
7277 "modes": ["wt2wt", "selser"],
7278 "changes": [
7279 ["#x", "remove"]
7280 ]
7281 }
7282 !!wikitext
7283 {|
7284 !h1 !!h2 !!h3
7285 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7286 |}
7287 !! wikitext/edited
7288 {|
7289 !h1 !!h2 !!h3
7290 |c2 |||c3
7291 |}
7292 !!end
7293
7294 !! test
7295 Testing selser after addition of new row before first row (T125419)
7296 !! options
7297 parsoid={
7298 "modes": ["wt2wt", "selser"],
7299 "changes": [
7300 [ "tr", "before", "<tr><td>X</td></tr>" ]
7301 ]
7302 }
7303 !! wikitext
7304 {|
7305 |a
7306 |}
7307 !! wikitext/edited
7308 {|
7309 |X
7310 |-
7311 |a
7312 |}
7313 !! end
7314
7315 !! test
7316 Serialize new table rows in a HTML table using HTML tags
7317 !! options
7318 parsoid={
7319 "modes": ["wt2wt", "selser"],
7320 "changes": [
7321 [ "tr", "before", "<tr><td>X</td></tr>" ]
7322 ]
7323 }
7324 !! wikitext
7325 <table><tr><td>a</td></tr></table>
7326 !! wikitext/edited
7327 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7328 !! end
7329
7330 !! test
7331 Serialize new table cells in a HTML row using HTML tags
7332 !! options
7333 parsoid={
7334 "modes": ["wt2wt", "selser"],
7335 "changes": [
7336 [ "td", "before", "<td>X</td>" ]
7337 ]
7338 }
7339 !! wikitext
7340 <table><tr><td>a</td></tr></table>
7341 !! wikitext/edited
7342 <table><tr><td>X</td><td>a</td></tr></table>
7343 !! end
7344
7345 !! test
7346 Wikitext tables can be nested inside HTML tables
7347 !! options
7348 parsoid=html2wt
7349 !! html
7350 <table data-parsoid='{"stx":"html"}'>
7351 <tr><td>
7352 <table>
7353 <tr><td>foo</td></tr>
7354 </table>
7355 </td></tr>
7356 </table>
7357 !! wikitext
7358 <table>
7359 <tr><td>
7360 {|
7361 |foo
7362 |}
7363 </td></tr>
7364 </table>
7365 !! end
7366
7367 !! test
7368 Serialize wikitext list items as HTML list items when embedded in a HTML list
7369 !! options
7370 parsoid=html2wt
7371 !! html
7372 <ul data-parsoid='{"stx": "html"}'>
7373 <li data-parsoid='{}'>a</li>
7374 <li>b</li>
7375 </ul>
7376 !! wikitext
7377 <ul>
7378 <li>a</li>
7379 <li>b</li>
7380 </ul>
7381 !! end
7382
7383 # SSS FIXME: Is this actually a good thing given the
7384 # odd nested list output that is generated by MW?
7385 # <ul><li>foo<ul>..</ul></li></ul> instead of
7386 # <ul><li>foo</li><ul>..</ul></ul>
7387 !! test
7388 Wikitext lists can be nested inside HTML lists
7389 !! options
7390 parsoid=html2wt
7391 !! html
7392 <ul data-parsoid='{"stx": "html"}'>
7393 <li data-parsoid='{"stx": "html"}'>a
7394 <ul><li>b</li></ul>
7395 </li>
7396 </ul>
7397
7398 <ul data-parsoid='{"stx": "html"}'>
7399 <li>x
7400 <ul><li>y</li></ul>
7401 </li>
7402 </ul>
7403 !! wikitext
7404 <ul>
7405 <li>a
7406 * b
7407 </li>
7408 </ul>
7409
7410 <ul>
7411 <li>x
7412 * y
7413 </li>
7414 </ul>
7415 !! end
7416
7417 ###
7418 ### Internal links
7419 ###
7420 !! test
7421 Plain link, capitalized
7422 !! wikitext
7423 [[Main Page]]
7424 !! html
7425 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7426 </p>
7427 !! end
7428
7429 !! test
7430 Plain link, uncapitalized
7431 !! wikitext
7432 [[main Page]]
7433 !! html
7434 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7435 </p>
7436 !! end
7437
7438 !! test
7439 Piped link
7440 !! wikitext
7441 [[Main Page|The Main Page]]
7442 !! html
7443 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7444 </p>
7445 !! end
7446
7447 !! test
7448 Piped link with comment in link text
7449 !! wikitext
7450 [[Main Page|The Main<!--front--> Page]]
7451 !! html
7452 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7453 </p>
7454 !! end
7455
7456 !! test
7457 Piped link with multiple pipe characters in link text
7458 !! wikitext
7459 [[Main Page||The|Main|Page|]]
7460 !! html/php
7461 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7462 </p>
7463 !! html/parsoid
7464 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7465 !! end
7466
7467 !! test
7468 Piped link with no link text
7469 !! wikitext
7470 [[Thomas Bek (bishop of St David's)|]]
7471 !! html/php
7472 <p>[[Thomas Bek (bishop of St David's)|]]
7473 </p>
7474 !! html/parsoid
7475 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7476 !! end
7477
7478 !! test
7479 Piped link with empty link text
7480 !! wikitext
7481 [[Main Page|<nowiki />]] - empty nowiki
7482 [[Main Page| ]] - empty space
7483 [[Main Page|&nbsp;]] - empty non breaking space
7484 !! html/php
7485 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7486 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7487 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7488 </p>
7489 !! html/parsoid
7490 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki />"}'/></a> - empty nowiki
7491 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7492 <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>
7493 !! end
7494
7495 !! test
7496 Broken link
7497 !! wikitext
7498 [[Zigzagzogzagzig]]
7499 !! html
7500 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7501 </p>
7502 !! end
7503
7504 !! test
7505 Broken link with fragment
7506 !! wikitext
7507 [[Zigzagzogzagzig#zug]]
7508 !! html
7509 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7510 </p>
7511 !! end
7512
7513 !! test
7514 Special page link with fragment
7515 !! wikitext
7516 [[Special:Version#anchor]]
7517 !! html
7518 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7519 </p>
7520 !! end
7521
7522 !! test
7523 Nonexistent special page link with fragment
7524 !! wikitext
7525 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7526 !! html
7527 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7528 </p>
7529 !! end
7530
7531 !! test
7532 Link with prefix
7533 !! wikitext
7534 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7535 !! html
7536 <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>
7537 </p>
7538 !! end
7539
7540 !! test
7541 Link with suffix
7542 !! wikitext
7543 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7544 !! html
7545 <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>!!!
7546 </p>
7547 !! end
7548
7549 !! article
7550 prefixed article
7551 !! text
7552 Some text
7553 !! endarticle
7554
7555 !! test
7556 Bug 43661: Piped links with identical prefixes
7557 !! wikitext
7558 [[prefixed article|prefixed articles with spaces]]
7559
7560 [[prefixed article|prefixed articlesaoeu]]
7561
7562 [[Main Page|Main Page test]]
7563 !! html
7564 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7565 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7566 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7567 </p>
7568 !! end
7569
7570
7571 !! test
7572 Link with HTML entity in suffix / tail
7573 !! wikitext
7574 [[Main Page]]&quot;, [[Main Page]]&#97;
7575 !! html/php
7576 <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;
7577 </p>
7578 !! html/parsoid
7579 <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>
7580 !! end
7581
7582 !! test
7583 Link with 3 brackets
7584 !! wikitext
7585 [[[Main Page]]]
7586 Foo [[[Main Page]]]
7587 !! html
7588 <p>[[[Main Page]]]
7589 Foo [[[Main Page]]]
7590 </p>
7591 !! end
7592
7593 !! test
7594 Link with 4 brackets
7595 !! wikitext
7596 [[[[Main Page]]]]
7597 !! html
7598 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7599 </p>
7600 !! end
7601
7602 !! test
7603 Piped link with 3 brackets
7604 !! wikitext
7605 [[[main page|the main page]]]
7606 !! html
7607 <p>[[[main page|the main page]]]
7608 </p>
7609 !! end
7610
7611 !! test
7612 Piped link with extlink-like text
7613 !! wikitext
7614 [[Main Page|[bar]]]
7615 [[Main Page|This is a [bar]]]
7616 !! html/php
7617 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7618 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7619 </p>
7620 !! html/parsoid
7621 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7622 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7623 !! end
7624
7625 !! test
7626 Link with multiple pipes
7627 !! wikitext
7628 [[Main Page|The|Main|Page]]
7629 !! html
7630 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7631 </p>
7632 !! end
7633
7634 !! test
7635 Anchor containing a #. (bug 63430)
7636 !! wikitext
7637 [[Main Page#And#Link]]
7638 !! html/php
7639 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7640 </p>
7641 !! html/parsoid
7642 <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>
7643 !! end
7644
7645 !! test
7646 Link to namespaces
7647 !! wikitext
7648 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7649 !! html
7650 <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>
7651 </p>
7652 !! end
7653
7654 !! test
7655 Link with space in namespace
7656 !! wikitext
7657 [[User talk:Foo bar]]
7658 !! html
7659 <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>
7660 </p>
7661 !! end
7662
7663 !! article
7664 MemoryAlpha:AlphaTest
7665 !! text
7666 This is an article in the MemoryAlpha namespace
7667 (which shadows the memoryalpha interwiki link).
7668 !! endarticle
7669
7670 !! test
7671 Namespace takes precedence over interwiki link (bug 51680)
7672 !! wikitext
7673 [[MemoryAlpha:AlphaTest]]
7674 !! html
7675 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7676 </p>
7677 !! end
7678
7679 # The previous test doesn't work correctly in html2*, due to not recognizing the
7680 # link as an internal one. This one checks for the correct behavior.
7681 !! test
7682 Link to namespace preferred over interwiki with correct rel attribute
7683 !! options
7684 parsoid=html2wt,html2html
7685 !! html/parsoid
7686 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7687 !! wikitext
7688 [[MemoryAlpha:AlphaTest]]
7689 !! end
7690
7691 !! test
7692 Piped link to namespace
7693 !! wikitext
7694 [[Meta:Disclaimers|The disclaimers]]
7695 !! html
7696 <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>
7697 </p>
7698 !! end
7699
7700 !! test
7701 Link containing }
7702 !! wikitext
7703 [[Usually caused by a typo (oops}]]
7704 !! html
7705 <p>[[Usually caused by a typo (oops}]]
7706 </p>
7707 !! end
7708
7709 !! article
7710 7% Solution
7711 !! text
7712 Just a test of an article title containing a percent.
7713 !! endarticle
7714
7715 !! test
7716 Link containing % (not as a hex sequence)
7717 !! wikitext
7718 [[7% Solution]]
7719 [[7% Solution|7%25 Solution]]
7720 !! html/php
7721 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7722 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7723 </p>
7724 !! html/parsoid
7725 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7726 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7727 !! end
7728
7729 # note that the parsoid HTML is identical to the previous test output,
7730 # so the previous test ensures that the html2wt mode will generate the
7731 # "not as a hex sequence" wikitext.
7732 !! test
7733 Link containing % as a single hex sequence interpreted to char
7734 !! options
7735 parsoid=wt2wt,wt2html,html2html
7736 !! wikitext
7737 [[7%25 Solution]]
7738 [[7%25 Solution|7%25 Solution]]
7739 !! html/php
7740 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7741 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7742 </p>
7743 !! html/parsoid
7744 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7745 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7746 !!end
7747
7748 !! test
7749 Link containing % as a double hex sequence interpreted to hex sequence
7750 !! wikitext
7751 [[7%2525 Solution]]
7752 !! html
7753 <p>[[7%2525 Solution]]
7754 </p>
7755 !!end
7756
7757 ## Example for such a section: == < ==
7758 !! test
7759 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7760 !! wikitext
7761 [[%23%3c]][[%23%3e]]
7762 !! html/php
7763 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7764 </p>
7765 !! html/parsoid
7766 <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>
7767 !! end
7768
7769 !! test
7770 Link containing "<#" and ">#" as a hex sequences
7771 !! wikitext
7772 [[%3c%23]][[%3e%23]]
7773 !! html
7774 <p>[[%3c%23]][[%3e%23]]
7775 </p>
7776 !! end
7777
7778 !! test
7779 Link containing an equals sign
7780 !! wikitext
7781 [[Special:BookSources/isbn=4-00-026157-6]]
7782 !! html/php
7783 <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>
7784 </p>
7785 !! html/parsoid
7786 <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>
7787 !! end
7788
7789 !! article
7790 Foo~bar
7791 !! text
7792 Just a test of an article title containing a tilde.
7793 !! endarticle
7794
7795 # note that links containing signatures, like [[Foo~~~~]], are
7796 # massaged by the pre-save transform (PST) and so the tildes are never
7797 # seen by the parser.
7798 !! test
7799 Link containing a tilde
7800 !! wikitext
7801 [[Foo~bar]]
7802 !! html/php
7803 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7804 </p>
7805 !! html/parsoid
7806 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7807 !! end
7808
7809 !! test
7810 Link containing double-single-quotes '' (bug 4598)
7811 !! wikitext
7812 [[Lista d''e paise d''o munno]]
7813 !! html/php
7814 <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>
7815 </p>
7816 !! html/parsoid
7817 <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>
7818 !! end
7819
7820 !! test
7821 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7822 !! wikitext
7823 Some [[Link|pretty ''italics'' and stuff]]!
7824 !! html/php
7825 <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>!
7826 </p>
7827 !! html/parsoid
7828 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7829 !! end
7830
7831 !! test
7832 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7833 !! wikitext
7834 ''Some [[Link|pretty ''italics'' and stuff]]!''
7835 !! html
7836 <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>
7837 </p>
7838 !! end
7839
7840 !! test
7841 Link with double quotes in title part (literal) and alternate part (interpreted)
7842 !! wikitext
7843 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7844
7845 [[''Pentecoste'']]
7846
7847 [[''Pentecoste''|Pentecoste]]
7848
7849 [[''Pentecoste''|''Pentecoste'']]
7850 !! html/php
7851 <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>
7852 </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>
7853 </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>
7854 </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>
7855 </p>
7856 !! html/parsoid
7857 <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>
7858 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7859 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7860 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7861 !! end
7862
7863 !! test
7864 Broken image links with HTML captions (bug 39700)
7865 !! wikitext
7866 [[File:Nonexistent|<script></script>]]
7867 [[File:Nonexistent|100x100px|<script></script>]]
7868 [[File:Nonexistent|&lt;]]
7869 [[File:Nonexistent|a<i>b</i>c]]
7870 !! html/php
7871 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7872 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7873 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7874 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7875 </p>
7876 !! html/parsoid
7877 <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>
7878 <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>
7879 <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>
7880 <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>
7881 !! end
7882
7883 !! test
7884 Plain link to URL
7885 !! wikitext
7886 [[http://www.example.com]]
7887 !! html/php
7888 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7889 </p>
7890 !! html/parsoid
7891 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7892 !! end
7893
7894 !! test
7895 Plain link to URL with link text
7896 !! wikitext
7897 [[http://www.example.com Link text]]
7898 !! html
7899 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7900 </p>
7901 !! end
7902
7903 !! test
7904 Plain link to protocol-relative URL
7905 !! wikitext
7906 [[//www.example.com]]
7907 !! html/php
7908 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7909 </p>
7910 !! html/parsoid
7911 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7912 !! end
7913
7914 !! test
7915 Plain link to protocol-relative URL with link text
7916 !! wikitext
7917 [[//www.example.com Link text]]
7918 !! html
7919 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7920 </p>
7921 !! end
7922
7923 !! test
7924 Plain link to page with question mark in title
7925 !! wikitext
7926 [[A?b]]
7927
7928 [[A?b|Baz]]
7929 !! html
7930 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7931 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7932 </p>
7933 !! end
7934
7935
7936 # I'm fairly sure the expected result here is wrong.
7937 # We want these to be URL links, not pseudo-pages with URLs for titles....
7938 # However the current output is also pretty screwy.
7939 #
7940 # ----
7941 # I'm changing it to match the current output--it arguably makes more
7942 # sense in the light of the test above. Old expected result was:
7943 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7944 #</p>
7945 # But I think this test is bordering on "garbage in, garbage out" anyway.
7946 # -- wtm
7947 !! test
7948 Piped link to URL
7949 !! wikitext
7950 Piped link to URL: [[http://www.example.com|an example URL]]
7951 !! html/php
7952 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7953 </p>
7954 !! html/parsoid
7955 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7956 !! end
7957
7958 !! test
7959 BUG 2: [[page|http://url/]] should link to page, not http://url/
7960 !! wikitext
7961 [[Main Page|http://url/]]
7962 !! html/php
7963 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7964 </p>
7965 !! html/parsoid
7966 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7967 !! end
7968
7969 # Parsoid does not mark self-links, by design.
7970 !! test
7971 BUG 337: Escaped self-links should be bold
7972 !! options
7973 title=[[Bug462]]
7974 !! wikitext
7975 [[Bu&#103;462]] [[Bug462]]
7976 !! html/php
7977 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7978 </p>
7979 !! html/php+tidy
7980 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7981 !! html/parsoid
7982 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7983 !! end
7984
7985 !! test
7986 Self-link to section should not be bold
7987 !! options
7988 title=[[Main Page]]
7989 !! wikitext
7990 [[Main Page#section]]
7991 !! html
7992 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7993 </p>
7994 !! end
7995
7996 !! article
7997 00
7998 !! text
7999 This is 00.
8000 !! endarticle
8001
8002 !!test
8003 Self-link to numeric title
8004 !!options
8005 title=[[0]]
8006 !! wikitext
8007 [[0]]
8008 !! html
8009 <p><strong class="selflink">0</strong>
8010 </p>
8011 !!end
8012
8013 !!test
8014 Link to numeric-equivalent title
8015 !!options
8016 title=[[0]]
8017 !! wikitext
8018 [[00]]
8019 !! html
8020 <p><a href="/wiki/00" title="00">00</a>
8021 </p>
8022 !!end
8023
8024 !! test
8025 <nowiki> inside a link
8026 !! wikitext
8027 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8028 !! html
8029 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8030 </p>
8031 !! end
8032
8033 !! test
8034 Non-breaking spaces in title
8035 !! wikitext
8036 [[&nbsp; Main &nbsp; Page &nbsp;]]
8037 !! html
8038 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8039 </p>
8040 !!end
8041
8042 !! test
8043 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
8044 !! options
8045 language=ca
8046 !! wikitext
8047 '''[[Main Page]]'''
8048 !! html
8049 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8050 </p>
8051 !! end
8052
8053 !! test
8054 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
8055 !! options
8056 language=ca
8057 !! wikitext
8058 ''[[Main Page]]''
8059 !! html
8060 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8061 </p>
8062 !! end
8063
8064 !! test
8065 Internal link with en linktrail: no apostrophes (bug 27473)
8066 !! options
8067 language=en
8068 !! wikitext
8069 [[Something]]'nice
8070 !! html
8071 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8072 </p>
8073 !! end
8074
8075 !! test
8076 Internal link with ca linktrail with apostrophes (bug 27473)
8077 !! options
8078 language=ca
8079 !! wikitext
8080 [[Something]]'nice
8081 !! html
8082 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8083 </p>
8084 !! end
8085
8086 !! test
8087 Internal link with kaa linktrail with apostrophes (bug 27473)
8088 !! options
8089 language=kaa
8090 !! wikitext
8091 [[Something]]'nice
8092 !! html
8093 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
8094 </p>
8095 !! end
8096
8097 !! test
8098 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
8099 !! wikitext
8100 [[User:Foo/Test/63636:Bar|Test]]
8101 !! html/php
8102 <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>
8103 </p>
8104 !! html/parsoid
8105 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8106 !! end
8107
8108 ## Mainly a sanity check for Parsoid
8109 !! test
8110 Handle title parsing for subpages
8111 !! options
8112 title=[[/123123]]
8113 !! wikitext
8114 123
8115 !! html/parsoid
8116 <p>123</p>
8117 !! end
8118
8119 ## FIXME: Add a working php section here
8120 !! test
8121 Link to a subpage from a namespace other than main
8122 !! options
8123 title=[[User:test]]
8124 !! wikitext
8125 [[/123]]
8126 !! html/parsoid
8127 <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>
8128 !! end
8129
8130 !! test
8131 Ensure that transclusion titles are not url-decoded
8132 !! options
8133 subpage title=[[Test]]
8134 parsoid=wt2html
8135 !! wikitext
8136 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8137 !! html/php
8138 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8139 </p>
8140 !! html/parsoid
8141 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8142 !! end
8143
8144 !! test
8145 Purely hash wikilink
8146 !! options
8147 title=[[User:test/123]]
8148 !! wikitext
8149 [[#a|b]]
8150 !! html/php
8151 <p><a href="#a">b</a>
8152 </p>
8153 !! html/parsoid
8154 <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>
8155 !! end
8156
8157 !! test
8158 1. Interaction of linktrail and template encapsulation
8159 !! options
8160 parsoid
8161 !! wikitext
8162 {{echo|[[Foo]]}}l
8163 !! html
8164 <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>
8165 !! end
8166
8167 !! test
8168 2. Interaction of linktrail and template encapsulation
8169 !! options
8170 parsoid
8171 !! wikitext
8172 {{echo|Some [[Fool]]}}s
8173 !! html
8174 <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>
8175 !! end
8176
8177 !! test
8178 3. Interaction of linktrail and template encapsulation
8179 !! options
8180 parsoid
8181 !! wikitext
8182 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8183 !! html
8184 <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>
8185 !! end
8186
8187 !! article
8188 Söfnuður
8189 !! text
8190 Test.
8191 !! endarticle
8192
8193 !! test
8194 Internal link with is link prefix
8195 !! options
8196 language=is
8197 !! wikitext
8198 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8199 !! html
8200 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8201 </p>
8202 !! end
8203
8204 !! article
8205 Mótmælendatrú
8206 !! text
8207 Test.
8208 !! endarticle
8209
8210 !! test
8211 Internal link with is link trail and link prefix
8212 !! options
8213 language=is
8214 !! wikitext
8215 [[mótmælendatrú|xxx]]ar
8216 [[mótmælendatrú]]ar
8217 mótmælenda[[söfnuður]]
8218 mótmælenda[[söfnuður|söfnuðir]]
8219 mótmælenda[[söfnuður|söfnuðir]]xxx
8220 !! html
8221 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8222 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8223 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8224 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8225 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8226 </p>
8227 !! end
8228
8229 !! test
8230 Parsoid link trail escaping
8231 !! options
8232 parsoid=html2wt,html2html
8233 !! html/parsoid
8234 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
8235 !! wikitext
8236 [[apple]]<nowiki/>s
8237 !! end
8238
8239 !! test
8240 Parsoid link prefix escaping
8241 !! options
8242 language=is
8243 parsoid=html2wt,html2html
8244 !! html/parsoid
8245 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
8246 !! wikitext
8247 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8248 !! end
8249
8250 !! test
8251 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8252 !! wikitext
8253 [[Foo| bar]]
8254
8255 [[Foo| ''bar'']]
8256
8257 [http://wp.org foo]
8258
8259 [http://wp.org ''foo'']
8260 !! html
8261 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8262 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8263 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8264 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8265 </p>
8266 !! end
8267
8268 !! test
8269 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8270 !! options
8271 parsoid
8272 !! wikitext
8273 [[Foo|{{echo|a}} b {{echo|c}}]]
8274 !! html
8275 <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>
8276 !! end
8277
8278 !! test
8279 Link with angle bracket after anchor
8280 !! wikitext
8281 [[Foo#<bar>]]
8282 !! html/php
8283 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8284 </p>
8285 !! html/parsoid
8286 <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>
8287 !! end
8288
8289 ###
8290 ### Interwiki links (see maintenance/interwiki.sql)
8291 ###
8292
8293 !! test
8294 Inline interwiki link
8295 !! options
8296 parsoid=wt2html,wt2wt,html2html
8297 !! wikitext
8298 [[MeatBall:SoftSecurity]]
8299 !! html/php
8300 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8301 </p>
8302 !! html/parsoid
8303 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8304 !! end
8305
8306 !! test
8307 Inline interwiki link with empty title (bug 2372)
8308 !! options
8309 parsoid=wt2html,wt2wt,html2html
8310 !! wikitext
8311 [[MeatBall:]]
8312 !! html/php
8313 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8314 </p>
8315 !! html/parsoid
8316 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8317 !! end
8318
8319 !! test
8320 Interwiki link encoding conversion (bug 1636)
8321 !! wikitext
8322 *[[Wikipedia:ro:Olteni&#0355;a]]
8323 *[[Wikipedia:ro:Olteni&#355;a]]
8324 !! html
8325 <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>
8326 <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>
8327
8328 !! html+tidy
8329 <ul>
8330 <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>
8331 <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>
8332 </ul>
8333 !! end
8334
8335 !! test
8336 Interwiki link with fragment (bug 2130)
8337 !! wikitext
8338 [[MeatBall:SoftSecurity#foo]]
8339 !! html
8340 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8341 </p>
8342 !! end
8343
8344 !! test
8345 Link scenarios with escaped fragments
8346 !! wikitext
8347 [[#Is this great?]]
8348 [[Foo#Is this great?]]
8349 [[meatball:Foo#Is this great?]]
8350 !! html/php
8351 <p><a href="#Is_this_great.3F">#Is this great?</a>
8352 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8353 <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>
8354 </p>
8355 !! html/parsoid
8356 <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>
8357 <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>
8358 <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>
8359 !! end
8360
8361 # Ideally the wikipedia: prefix here should be proto-relative too
8362 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8363 # define the 'en' prefix, and originally the test used 'wikipedia',
8364 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8365 # article.
8366 !! test
8367 Different interwiki prefixes mapping to the same URL
8368 !! wikitext
8369 [[:en:Foo]]
8370
8371 [[:en:Foo|Foo]]
8372
8373 [[wikipedia:Foo]]
8374
8375 [[:wikipedia:Foo|Foo]]
8376
8377 [[wikipedia:en:Foo]]
8378
8379 [[:wikipedia:en:Foo]]
8380
8381 [[ wikiPEdia :Foo]]
8382 !! html/parsoid
8383 <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>
8384
8385 <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>
8386
8387 <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>
8388
8389 <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>
8390
8391 <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>
8392
8393 <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>
8394
8395 <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>
8396 !! end
8397
8398 !! test
8399 Interwiki links that cannot be represented in wiki syntax
8400 !! wikitext
8401 [[meatball:ok]]
8402 [[meatball:ok#foo|ok with fragment]]
8403 [[meatball:ok_as_well?|ok ending with ? mark]]
8404 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8405 [http://de.wikipedia.org/wiki/#foo is just fragment]
8406
8407 !! html/php
8408 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8409 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8410 <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>
8411 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8412 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8413 </p>
8414 !! html/parsoid
8415 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8416 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8417 <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>
8418 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8419 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8420 !! end
8421
8422 !! test
8423 Interwiki links: trail
8424 !! wikitext
8425 [[wikipedia:Foo|Ba]]r
8426 !! html/php
8427 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8428 </p>
8429 !! html/parsoid
8430 <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>
8431 !! end
8432
8433 !! test
8434 Local interwiki link
8435 !! options
8436 parsoid=wt2html,wt2wt,html2html
8437 !! wikitext
8438 [[local:Template:Foo]]
8439 !! html/php
8440 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8441 </p>
8442 !! html/parsoid
8443 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8444 !! end
8445
8446 # Parsoid does not mark self-links, by design.
8447 !! test
8448 Local interwiki link: self-link to current page
8449 !! options
8450 title=[[Main Page]]
8451 parsoid=wt2html,wt2wt,html2html
8452 !! wikitext
8453 [[local:Main Page]]
8454 !! html/php
8455 <p><strong class="selflink">local:Main Page</strong>
8456 </p>
8457 !! html/parsoid
8458 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8459 !! end
8460
8461 !! test
8462 Local interwiki link: prefix only (bug 64167)
8463 !! options
8464 parsoid=wt2html,wt2wt,html2html
8465 !! wikitext
8466 [[local:]]
8467 !! html/php
8468 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8469 </p>
8470 !! html/parsoid
8471 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8472 !! end
8473
8474 !! test
8475 Local interwiki link: with additional interwiki prefix (bug 61357)
8476 !! options
8477 parsoid=wt2html,wt2wt,html2html
8478 !! wikitext
8479 [[local:meatball:Hello]]
8480 !! html/php
8481 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8482 </p>
8483 !! html/parsoid
8484 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8485 !! end
8486
8487 !! test
8488 Multiple local interwiki link prefixes
8489 !! wikitext
8490 [[local:local:local:local:mi:local:Foo]]
8491 !! options
8492 parsoid=wt2html,wt2wt,html2html
8493 !! html/php
8494 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8495 </p>
8496 !! html/parsoid
8497 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8498 !! end
8499
8500 ###
8501 ### Interlanguage links
8502 ### Language links (so that searching for '### language' matches..)
8503 ###
8504
8505 !! test
8506 Interlanguage link
8507 !! wikitext
8508 Blah blah blah
8509 [[zh:Chinese]]
8510 !! html/php
8511 <p>Blah blah blah
8512 </p>
8513 !! html/parsoid
8514 <p>Blah blah blah</p>
8515 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8516 !! end
8517
8518 ## parsoid html2wt will lose the space variations
8519 !! test
8520 Interlanguage link with spacing
8521 !! options
8522 parsoid=wt2html,wt2wt,html2html
8523 !! wikitext
8524 Blah blah blah
8525 [[ zh : Chinese ]]
8526 !! html/php
8527 <p>Blah blah blah
8528 </p>
8529 !! html/parsoid
8530 <p>Blah blah blah</p>
8531 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8532 !! end
8533
8534 !! test
8535 Double interlanguage link
8536 !! wikitext
8537 Blah blah blah
8538 [[es:Spanish]]
8539 [[zh:Chinese]]
8540 !! html/php
8541 <p>Blah blah blah
8542 </p>
8543 !! html/parsoid
8544 <p>Blah blah blah</p>
8545 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8546 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8547 !! end
8548
8549 ## parsoid html2wt will lose the space variations
8550 !! test
8551 Interlanguage link variations
8552 !! options
8553 parsoid=wt2html,wt2wt,html2html
8554 !! wikitext
8555 Blah blah blah
8556 [[ es :Spanish]]
8557 [[ ZH :Chinese]]
8558 [[es:Foo_bar]]
8559 !! html/php
8560 <p>Blah blah blah
8561 </p>
8562 !! html/parsoid
8563 <p>Blah blah blah</p>
8564 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8565 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8566 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8567 !! end
8568
8569 ## parsoid html2wt will normalize the space to _
8570 !! test
8571 Space and question mark encoding in interlanguage links (T95473)
8572 !! options
8573 parsoid=wt2html,wt2wt,html2html
8574 !! wikitext
8575 Blah blah blah
8576 [[es:Foo bar?]]
8577 !! html/php
8578 <p>Blah blah blah
8579 </p>
8580 !! html/parsoid
8581 <p>Blah blah blah</p>
8582 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8583 !! end
8584
8585 !! test
8586 Interlanguage link, with prefix links
8587 !! options
8588 language=ln
8589 !! wikitext
8590 Blah blah blah
8591 [[zh:Chinese]]
8592 !! html/php
8593 <p>Blah blah blah
8594 </p>
8595 !! html/parsoid
8596 <p>Blah blah blah</p>
8597 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8598 !! end
8599
8600 !! test
8601 Double interlanguage link, with prefix links (bug 8897)
8602 !! options
8603 language=ln
8604 !! wikitext
8605 Blah blah blah
8606 [[es:Spanish]]
8607 [[zh:Chinese]]
8608 !! html/php
8609 <p>Blah blah blah
8610 </p>
8611 !! html/parsoid
8612 <p>Blah blah blah</p>
8613 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8614 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8615 !! end
8616
8617 !! test
8618 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8619 !! wikitext
8620 Blah blah blah
8621 [[mul:Article]]
8622 !! html/php
8623 <p>Blah blah blah
8624 </p>
8625 !! html/parsoid
8626 <p>Blah blah blah</p>
8627 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8628 !! end
8629
8630 ## PHP parser tests script needs an update
8631 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8632 !! test
8633 Language links render as inline links if $wgInterwikiMagic=false
8634 !! options
8635 wgInterwikiMagic=false
8636 parsoid=wt2html,wt2wt,html2html
8637 !! wikitext
8638 Blah blah blah
8639 [[zh:Chinese]]
8640 !! html/parsoid
8641 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8642 !! end
8643
8644 ## PHP parser tests script needs an update
8645 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8646 !! test
8647 Language links render as inline links in the Talk namespace
8648 !! options
8649 title=Talk:Foo
8650 parsoid=wt2html,wt2wt,html2html
8651 !! wikitext
8652 Blah blah blah
8653 [[zh:Chinese]]
8654 !! html/parsoid
8655 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8656 !! end
8657
8658 !! test
8659 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8660 !! options
8661 language=ln
8662 !! wikitext
8663 [[WW&nbsp;II]]
8664 !! html
8665 <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>
8666 </p>
8667 !! end
8668
8669 !! test
8670 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8671 !! options
8672 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8673 !! html/parsoid
8674 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8675 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8676 !! wikitext
8677 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8678
8679 He&amp;nbsp;llo He&amp;nbsp;llo
8680 !! html/php
8681 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8682 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8683 </p>
8684 !! end
8685
8686 # html2wt will fail because of title normalization without data-parsoid
8687 !! test
8688 Parsoid: handle constructor well
8689 !! options
8690 parsoid=wt2html,wt2wt
8691 !! wikitext
8692 [[constructor]]
8693
8694 [[constructor:foo]]
8695 !! html/php
8696 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8697 </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>
8698 </p>
8699 !! html/parsoid
8700 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8701
8702 <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>
8703 !! end
8704
8705 !! article
8706 ko:
8707 !! text
8708 Test.
8709 !! endarticle
8710
8711 # Note that `ko` isn't a known interlanguage prefix
8712 !! test
8713 Parsoid: recognize interlanguage links without a target page
8714 !! options
8715 ill
8716 !! wikitext
8717 [[es:]]
8718
8719 [[ko:]]
8720 !! html/php
8721 es:
8722 !! html/parsoid
8723 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8724
8725 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8726 !! end
8727
8728 # Note that `ko` isn't a known interwiki prefix
8729 !! test
8730 Parsoid: recognize interwiki links without a target page
8731 !! options
8732 parsoid=wt2html,wt2wt,html2html
8733 !! wikitext
8734 [[:es:]]
8735
8736 [[:ko:]]
8737 !! html/php
8738 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8739 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8740 </p>
8741 !! html/parsoid
8742 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8743 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8744 !! end
8745
8746 !! test
8747 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8748 !! wikitext
8749 [[mi:Foo]]
8750 !! html/php
8751 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8752 </p>
8753 !! html/parsoid
8754 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8755 !! end
8756
8757 !! test
8758 Interlanguage link with preceding local interwiki link (bug 68085)
8759 !! options
8760 parsoid=wt2html,wt2wt,html2html
8761 !! wikitext
8762 Blah blah blah
8763 [[local:es:Spanish]]
8764 !! html/php
8765 <p>Blah blah blah
8766 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8767 </p>
8768 !! html/parsoid
8769 <p>Blah blah blah
8770 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8771 !! end
8772
8773 !! test
8774 Looks like an interlanguage link, but is actually a local interwiki
8775 !! options
8776 parsoid=wt2html,wt2wt,html2html
8777 !! wikitext
8778 Blah blah blah
8779 [[mi:Template:Foo]]
8780 !! html/php
8781 <p>Blah blah blah
8782 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8783 </p>
8784 !! html/parsoid
8785 <p>Blah blah blah
8786 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8787 !! end
8788
8789 ###
8790 ### Redirects, Parsoid-only
8791 ###
8792
8793 !! test
8794 1. Simple redirect to page
8795 !! wikitext
8796 #REDIRECT [[Main Page]]
8797 !! html/parsoid
8798 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8799 !! end
8800
8801 !! test
8802 2. Other redirect variants
8803 !! wikitext
8804 #REDIRECT [[Main_Page]]
8805 !! html/parsoid
8806 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8807 !! end
8808
8809 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8810 # This tests the Parsoid bail-out code.
8811 !! test
8812 3. Other redirect variants
8813 !! wikitext
8814 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8815 !! html/parsoid
8816 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8817 !! end
8818
8819 !! test
8820 4. Redirect to a templated destination
8821 !! wikitext
8822 #REDIRECT [[{{echo|Foo}}bar]]
8823 !! html/parsoid
8824 <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"}]]}'/>
8825 !! end
8826
8827 !! test
8828 Empty redirect
8829 !! options
8830 parsoid=wt2html,wt2wt
8831 !! wikitext
8832 #REDIRECT [[]]
8833 !! html/parsoid
8834 <ol>
8835 <li>REDIRECT [[]]</li></ol>
8836 !! end
8837
8838 !! test
8839 Optional colon in #REDIRECT
8840 !! options
8841 # the colon is archaic syntax. we support it for wt2html, but we
8842 # don't care that it roundtrips back to the modern syntax.
8843 parsoid=wt2html,html2html
8844 !! wikitext
8845 #REDIRECT:[[Main Page]]
8846 !! html/parsoid
8847 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8848 !! end
8849
8850 !! test
8851 Whitespace in #REDIRECT with optional colon
8852 !! options
8853 # the colon and gratuitous whitespace is archaic syntax. we support
8854 # it for wt2html, but we don't care that it roundtrips back to the
8855 # modern syntax (without extra whitespace)
8856 parsoid=wt2html,html2html
8857 !! wikitext
8858
8859 #REDIRECT
8860 :
8861 [[Main Page]]
8862 !! html/parsoid
8863 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8864 !! end
8865
8866 !! test
8867 Piped link in #REDIRECT
8868 !! options
8869 # content after piped link is ignored. we support this syntax,
8870 # but don't care that the piped link is lost when we roundtrip this.
8871 parsoid=wt2html
8872 !! wikitext
8873 #REDIRECT [[Main Page|bar]]
8874 !! html/parsoid
8875 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8876 !! end
8877
8878 !! test
8879 Redirect to category (T104502)
8880 !! options
8881 parsoid=wt2html,wt2wt
8882 !! wikitext
8883 #REDIRECT [[Category:Foo]]
8884 !! html/parsoid
8885 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8886 !! end
8887
8888 !! test
8889 Redirect to category with URL encoding (T104502)
8890 !! options
8891 parsoid=wt2html
8892 !! wikitext
8893 #REDIRECT [[Category%3AFoo]]
8894 !! html/parsoid
8895 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8896 !! end
8897
8898 !! test
8899 Redirect to category page
8900 !! wikitext
8901 #REDIRECT [[:Category:Foo]]
8902 !! html/parsoid
8903 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8904 !! end
8905
8906 !! test
8907 Redirect to image page (1)
8908 !! wikitext
8909 #REDIRECT [[File:Wiki.png]]
8910 !! html/parsoid
8911 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8912 !! end
8913
8914 !! test
8915 Redirect to image page (2)
8916 !! wikitext
8917 #REDIRECT [[Image:Wiki.png]]
8918 !! html/parsoid
8919 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8920 !! end
8921
8922 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8923 # Next test confirms this.
8924 !! test
8925 Redirect to language (1) (T104918)
8926 !! options
8927 parsoid=wt2html,wt2wt,html2html
8928 !! wikitext
8929 #REDIRECT [[en:File:Wiki.png]]
8930 !! html/parsoid
8931 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8932 !! end
8933
8934 !! test
8935 Redirect to language (2) (T104918)
8936 !! wikitext
8937 #REDIRECT [[:en:File:Wiki.png]]
8938 !! html/parsoid
8939 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8940 !! end
8941
8942 !! test
8943 Redirect to interwiki (T104918)
8944 !! wikitext
8945 #REDIRECT [[meatball:File:Wiki.png]]
8946 !! html/parsoid
8947 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8948 !! end
8949
8950 !! test
8951 Non-English #REDIRECT
8952 !! options
8953 language=is
8954 !! wikitext
8955 #TILVÍSUN [[Main Page]]
8956 !! html/parsoid
8957 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8958 !! end
8959
8960 !! test
8961 Redirect syntax under text isn't considered a redirect
8962 !! wikitext
8963 some text
8964 #redirect [[Main Page]]
8965 !! html/parsoid
8966 <p>some text</p>
8967 <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>
8968 !! end
8969
8970 # FIXME: Should hoist the redirect to the top of the page and ensure there
8971 # is only one.
8972 !! test
8973 New redirect
8974 !! options
8975 parsoid=html2wt
8976 !! html/parsoid
8977 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8978 !! wikitext
8979 Foo
8980 #REDIRECT [[Foo]]
8981 !! end
8982
8983 ##
8984 ## XHTML tidiness
8985 ###
8986
8987 !! test
8988 <br> to <br />
8989 !! wikitext
8990 1<br>2<br />3
8991 !! html
8992 <p>1<br />2<br />3
8993 </p>
8994 !! end
8995
8996 !! test
8997 Broken br tag sanitization
8998 !! wikitext
8999 </br>
9000 !! html/php
9001 <p>&lt;/br&gt;
9002 </p>
9003 !! end
9004
9005 # TODO: Fix html2html mode (bug 51055)!
9006 !! test
9007 Parsoid: Broken br tag recognition
9008 !! options
9009 parsoid=wt2html
9010 !! wikitext
9011 </br>
9012
9013 <br/ >
9014 !! html+tidy
9015 <p><br /></p>
9016 <p><br /></p>
9017 !! end
9018
9019 !! test
9020 Incorrecly removing closing slashes from correctly formed XHTML
9021 !! wikitext
9022 <br style="clear:both;" />
9023 !! html
9024 <p><br style="clear:both;" />
9025 </p>
9026 !! end
9027
9028 !! test
9029 Failing to transform badly formed HTML into correct XHTML
9030 !! wikitext
9031 <br style="clear: left;">
9032 <br style="clear: right;">
9033 <br style="clear: both;">
9034 !! html
9035 <p><br style="clear: left;" />
9036 <br style="clear: right;" />
9037 <br style="clear: both;" />
9038 </p>
9039 !!end
9040
9041 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9042 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9043 !! test
9044 Handling html with a div self-closing tag
9045 !! wikitext
9046 <div title />
9047 <div title/>
9048 <div title/ >
9049 <div title=bar />
9050 <div title=bar/>
9051 <div title=bar/ >
9052 !! html/php
9053 <p>&lt;div title /&gt;
9054 &lt;div title/&gt;
9055 </p>
9056 <div>
9057 <p>&lt;div title=bar /&gt;
9058 &lt;div title=bar/&gt;
9059 </p>
9060 <div title="bar/"></div>
9061 </div>
9062
9063 !! html/parsoid
9064 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9065 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9066 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9067 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9068 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9069 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9070 !! end
9071
9072 !! test
9073 Handling html with a br self-closing tag
9074 !! wikitext
9075 <br title />
9076 <br title/>
9077 <br title/ >
9078 <br title=bar />
9079 <br title=bar/>
9080 <br title=bar/ >
9081 !! html/php
9082 <p><br title="" />
9083 <br title="" />
9084 <br />
9085 <br title="bar" />
9086 <br title="bar" />
9087 <br title="bar/" />
9088 </p>
9089 !! html/parsoid
9090 <p><br title="" />
9091 <br title="" />
9092 <br title="" />
9093 <br title="bar" />
9094 <br title="bar" />
9095 <br title="bar/" />
9096 </p>
9097 !! end
9098
9099 !! test
9100 Horizontal ruler (should it add that extra space?)
9101 !! wikitext
9102 <hr>
9103 <hr >
9104 foo <hr
9105 > bar
9106 !! html+tidy
9107 <hr />
9108 <hr />
9109 <p>foo</p>
9110 <hr />
9111 <p>bar</p>
9112 !! end
9113
9114 !! test
9115 Horizontal ruler -- 4+ dashes render hr
9116 !! wikitext
9117 ----
9118 !! html
9119 <hr />
9120
9121 !! end
9122
9123 !! test
9124 Horizontal ruler -- eats additional dashes on the same line
9125 !! wikitext
9126 ---------
9127 !! html
9128 <hr />
9129
9130 !! end
9131
9132 !! test
9133 Horizontal ruler -- does not collapse dashes on consecutive lines
9134 !! wikitext
9135 ----
9136 ----
9137 !! html
9138 <hr />
9139 <hr />
9140
9141 !! end
9142
9143 !! test
9144 Horizontal ruler -- <4 dashes render as plain text
9145 !! wikitext
9146 ---
9147 !! html
9148 <p>---
9149 </p>
9150 !! end
9151
9152 !! test
9153 Horizontal ruler -- Supports content following dashes on same line
9154 !! wikitext
9155 ---- Foo
9156 !! html
9157 <hr /> Foo
9158
9159 !! html+tidy
9160 <hr />
9161 <p>Foo</p>
9162 !! end
9163
9164 ###
9165 ### Block-level elements
9166 ###
9167 !! test
9168 Common list
9169 !! wikitext
9170 *Common list
9171 * item 2
9172 *item 3
9173 !! html
9174 <ul><li>Common list</li>
9175 <li> item 2</li>
9176 <li>item 3</li></ul>
9177
9178 !! end
9179
9180 !! test
9181 Numbered list
9182 !! wikitext
9183 #Numbered list
9184 #item 2
9185 # item 3
9186 !! html
9187 <ol><li>Numbered list</li>
9188 <li>item 2</li>
9189 <li> item 3</li></ol>
9190
9191 !! end
9192
9193 !! test
9194 Mixed list
9195 !! wikitext
9196 *Mixed list
9197 *# with numbers
9198 ** and bullets
9199 *# and numbers
9200 *bullets again
9201 **bullet level 2
9202 ***bullet level 3
9203 ***#Number on level 4
9204 **bullet level 2
9205 **#Number on level 3
9206 **#Number on level 3
9207 *#number level 2
9208 *Level 1
9209 *** Level 3
9210 #** Level 3, but ordered
9211 !! html
9212 <ul><li>Mixed list
9213 <ol><li> with numbers</li></ol>
9214 <ul><li> and bullets</li></ul>
9215 <ol><li> and numbers</li></ol></li>
9216 <li>bullets again
9217 <ul><li>bullet level 2
9218 <ul><li>bullet level 3
9219 <ol><li>Number on level 4</li></ol></li></ul></li>
9220 <li>bullet level 2
9221 <ol><li>Number on level 3</li>
9222 <li>Number on level 3</li></ol></li></ul>
9223 <ol><li>number level 2</li></ol></li>
9224 <li>Level 1
9225 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9226 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9227
9228 !! end
9229
9230 !! test
9231 1. Nested mixed wikitext and html list
9232 !! wikitext
9233 * hi
9234 * <ul><li>ho</li></ul>
9235 * hi
9236 ** ho
9237 !! html/php
9238 <ul><li> hi</li>
9239 <li> <ul><li>ho</li></ul></li>
9240 <li> hi
9241 <ul><li> ho</li></ul></li></ul>
9242
9243 !! html/parsoid
9244 <ul><li> hi</li>
9245 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9246 <li> hi
9247 <ul><li> ho</li></ul></li></ul>
9248 !! end
9249
9250 !! test
9251 2. Nested mixed wikitext and html list (incompatible)
9252 !! wikitext
9253 ; hi
9254 : {{echo|<li>ho</li>}}
9255 !! html/php
9256 <dl><dt> hi</dt>
9257 <dd> <li>ho</li></dd></dl>
9258
9259 !! html/parsoid
9260 <dl><dt> hi</dt>
9261 <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>
9262 !! end
9263
9264 !! test
9265 Nested lists 1
9266 !! wikitext
9267 *foo
9268 **bar
9269 !! html
9270 <ul><li>foo
9271 <ul><li>bar</li></ul></li></ul>
9272
9273 !! end
9274
9275 !! test
9276 Nested lists 2
9277 !! wikitext
9278 **foo
9279 *bar
9280 !! html
9281 <ul><li><ul><li>foo</li></ul></li>
9282 <li>bar</li></ul>
9283
9284 !! end
9285
9286 !! test
9287 Nested lists 3 (first element empty)
9288 !! wikitext
9289 *
9290 **bar
9291 !! html
9292 <ul><li>
9293 <ul><li>bar</li></ul></li></ul>
9294
9295 !! end
9296
9297 !! test
9298 Nested lists 4 (first element empty)
9299 !! wikitext
9300 **
9301 *bar
9302 !! html
9303 <ul><li><ul><li></li></ul></li>
9304 <li>bar</li></ul>
9305
9306 !! end
9307
9308 !! test
9309 Nested lists 5 (both elements empty)
9310 !! wikitext
9311 **
9312 *
9313 !! html
9314 <ul><li><ul><li></li></ul></li>
9315 <li></li></ul>
9316
9317 !! end
9318
9319 !! test
9320 Nested lists 6 (both elements empty)
9321 !! wikitext
9322 *
9323 **
9324 !! html
9325 <ul><li>
9326 <ul><li></li></ul></li></ul>
9327
9328 !! end
9329
9330 !! test
9331 Nested lists 7 (skip initial nesting levels)
9332 !! wikitext
9333 *** foo
9334 !! html
9335 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9336
9337 !! end
9338
9339 !! test
9340 Nested lists 8 (multiple nesting transitions)
9341 !! wikitext
9342 * foo
9343 *** bar
9344 ** baz
9345 * boo
9346 !! html
9347 <ul><li> foo
9348 <ul><li><ul><li> bar</li></ul></li>
9349 <li> baz</li></ul></li>
9350 <li> boo</li></ul>
9351
9352 !! end
9353
9354 !! test
9355 Nested lists 9 (extension interaction)
9356 !! options
9357 parsoid
9358 !! wikitext
9359 *<references />
9360 !! html/parsoid
9361 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9362 !! end
9363
9364 !! test
9365 1. Lists with start-of-line-transparent tokens before bullets: Comments
9366 !! wikitext
9367 *foo
9368 *<!--cmt-->bar
9369 <!--cmt-->*baz
9370 !! html
9371 <ul><li>foo</li>
9372 <li>bar</li>
9373 <li>baz</li></ul>
9374
9375 !! end
9376
9377 !! test
9378 2. Lists with start-of-line-transparent tokens before bullets: Template close
9379 !! wikitext
9380 *foo {{echo|bar
9381 }}*baz
9382 !! html
9383 <ul><li>foo bar</li>
9384 <li>baz</li></ul>
9385
9386 !! end
9387
9388 !! test
9389 List items are not parsed correctly following a <pre> block (bug 785)
9390 !! wikitext
9391 * <pre>foo</pre>
9392 * <pre>bar</pre>
9393 * zar
9394 !! html/php
9395 <ul><li> <pre>foo</pre></li>
9396 <li> <pre>bar</pre></li>
9397 <li> zar</li></ul>
9398
9399 !! html/parsoid
9400 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9401 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9402 <li> zar</li></ul>
9403 !! end
9404
9405 !! test
9406 List items from template
9407 !! wikitext
9408
9409 {{inner list}}
9410 * item 2
9411
9412 * item 0
9413 {{inner list}}
9414 * item 2
9415
9416 * item 0
9417 * notSOL{{inner list}}
9418 * item 2
9419 !! html
9420 <ul><li> item 1</li>
9421 <li> item 2</li></ul>
9422 <ul><li> item 0</li>
9423 <li> item 1</li>
9424 <li> item 2</li></ul>
9425 <ul><li> item 0</li>
9426 <li> notSOL</li>
9427 <li> item 1</li>
9428 <li> item 2</li></ul>
9429
9430 !! end
9431
9432 !! test
9433 List interrupted by empty line or heading
9434 !! wikitext
9435 * foo
9436
9437 ** bar
9438 == A heading ==
9439 * Another list item
9440 !! html
9441 <ul><li> foo</li></ul>
9442 <ul><li><ul><li> bar</li></ul></li></ul>
9443 <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>
9444 <ul><li> Another list item</li></ul>
9445
9446 !!end
9447
9448 !!test
9449 Multiple list tags generated by templates
9450 !! wikitext
9451 {{echo|<li>}}a
9452 {{echo|<li>}}b
9453 {{echo|<li>}}c
9454 !! html
9455 <li>a
9456 <li>b
9457 <li>c</li>
9458 </li>
9459 </li>
9460
9461 !! html+tidy
9462 <ul>
9463 <li>a</li>
9464 <li>b</li>
9465 <li>c</li>
9466 </ul>
9467 !!end
9468
9469 !!test
9470 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9471 !! wikitext
9472 *a
9473 <!--This line will NOT split the list-->
9474 *b
9475 <!--This line will NOT split the list either-->
9476 *c
9477 <!--foo--> <!----> <!--This line NOT split the list either-->
9478 *d
9479 !! html
9480 <ul><li>a</li>
9481 <li>b</li>
9482 <li>c</li>
9483 <li>d</li></ul>
9484
9485 !!end
9486
9487 !!test
9488 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9489 !! wikitext
9490 *a
9491 <!--This line will NOT split the list-->
9492 *b
9493 <!--This line will NOT split the list either-->
9494 *c
9495 <!--foo--> <!----> <!--This line NOT split the list
9496 either-->
9497 *d
9498 !! html
9499 <ul><li>a</li>
9500 <li>b</li>
9501 <li>c</li>
9502 <li>d</li></ul>
9503
9504 !!end
9505
9506 !!test
9507 Test the li-hack
9508 (The PHP parser relies on Tidy for the hack)
9509 !!options
9510 parsoid=wt2html,wt2wt
9511 !! wikitext
9512 * foo
9513 * <li>li-hack
9514 * {{echo|<li>templated li-hack}}
9515 * <!--foo--> <li> unsupported li-hack with preceding comments
9516
9517 <ul>
9518 <li><li>not a li-hack
9519 </li>
9520 </ul>
9521 !! html+tidy
9522 <ul>
9523 <li>foo</li>
9524 <li>li-hack</li>
9525 <li>templated li-hack</li>
9526 <li>unsupported li-hack with preceding comments</li>
9527 </ul>
9528 <ul>
9529 <li>not a li-hack</li>
9530 </ul>
9531 !!end
9532
9533 !! test
9534 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9535 !! options
9536 parsoid
9537 !! wikitext
9538 # foo
9539 ## bar
9540 * foo
9541 ** bar
9542 : foo
9543 :: bar
9544 !! html
9545 <ol>
9546 <li> foo<ol>
9547 <li> bar</li>
9548 </ol></li>
9549 </ol><ul>
9550 <li> foo<ul>
9551 <li> bar</li>
9552 </ul></li>
9553 </ul><dl>
9554 <dd> foo<dl>
9555 <dd> bar</dd>
9556 </dl></dd>
9557 </dl>
9558 !! end
9559
9560 !! test
9561 Parsoid: Test of whitespace serialization with Templated bullets
9562 !! options
9563 parsoid
9564 !! wikitext
9565 * {{bullet}}
9566 !! html
9567 <ul>
9568 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9569 </ul>
9570 !! end
9571
9572 # ------------------------------------------------------------------------
9573 # The next set of tests are about Parsoid's ability to handle badly nested
9574 # tags (parse, minimize scope of fixup, and roundtrip back)
9575 # ------------------------------------------------------------------------
9576
9577 !! test
9578 Unbalanced closing block tags break a list
9579 (php parser relies on Tidy to fix up)
9580 !! wikitext
9581 <div>
9582 *a</div><div>
9583 *b</div>
9584 !! html+tidy
9585 <div>
9586 <ul>
9587 <li>a</li>
9588 </ul>
9589 </div>
9590 <div>
9591 <ul>
9592 <li>b</li>
9593 </ul>
9594 </div>
9595 !! end
9596
9597 # Parsoid fails this test, but it might be tricky to support properly.
9598 # See bug 68395.
9599 !! test
9600 Unbalanced closing non-block tags don't break a list
9601 (php parser relies on Tidy to fix up)
9602 !! wikitext
9603 <span>
9604 *a</span><span>
9605 *b</span>
9606 !! html/php+tidy
9607 <ul>
9608 <li><span>a</span></li>
9609 <li><span>b</span></li>
9610 </ul>
9611 !! html/parsoid
9612 <span>
9613 <ul>
9614 <li>a<span></span>
9615 </li>
9616 <li>b
9617 </li>
9618 </ul>
9619 </span>
9620 !! end
9621
9622 !! test
9623 Unclosed formatting tags that straddle lists are closed and reopened
9624 (php parser relies on Tidy to fix up)
9625 !! options
9626 parsoid=wt2html,wt2wt,html2html
9627 !! wikitext
9628 # <s> a
9629 # b </s>
9630 !! html/php+tidy
9631 <ol>
9632 <li><s>a</s></li>
9633 <li><s>b</s></li>
9634 </ol>
9635 !! html/parsoid
9636 <ol><li> <s> a</s></li>
9637 <li><s> b </s></li></ol>
9638 !! end
9639
9640 # See bug 68395.
9641 !!test
9642 1. List embedded in a formatting tag
9643 !! wikitext
9644 <small>
9645 * foo
9646 </small>
9647 !! html/php+tidy
9648 <ul>
9649 <li><small>foo</small></li>
9650 </ul>
9651 !! html/parsoid
9652 <small>
9653 <ul>
9654 <li> foo</li>
9655 </ul>
9656 </small>
9657 !!end
9658
9659 ## Ugly Parsoid output here
9660 ## Not sure what the right output is.
9661 !!test
9662 2. List embedded in a formatting tag
9663 !! wikitext
9664 <small>
9665 *a
9666 *b</small>
9667 !! html/php+tidy
9668 <ul>
9669 <li><small>a</small></li>
9670 <li><small>b</small></li>
9671 </ul>
9672 !! html/parsoid
9673 <small></small>
9674 <ul><small>
9675 <li>a</li>
9676 </small>
9677 <li><small>b</small></li>
9678 </ul>
9679 !!end
9680
9681 # Ugly Parsoid and PHP parser output here
9682 # Not sure if we want to make this a test!
9683 #
9684 ## !!test
9685 ## 3. Unclosed formatting tags in list elements
9686 ## !! wikitext
9687 ## *<small>a
9688 ## *<small>b
9689 ## !! html/php+tidy
9690 ## <ul>
9691 ## <li><small>a</small></li>
9692 ## <li><small><small>b</small></small></li>
9693 ## </ul>
9694 ## !! html/parsoid
9695 ## <ul>
9696 ## <li><small>a</small></li>
9697 ## <small>
9698 ## <li><small>b</small></li>
9699 ## </small></ul>
9700 ## !!end
9701
9702 # This is a bug in the PHP parser + tidy combination.
9703 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9704 # and then fostered out of the table by tidy.)
9705 # We believe the Parsoid output to be correct.
9706 !! test
9707 Table with missing opening <tr> tag
9708 !! options
9709 parsoid=wt2html,wt2wt
9710 !! wikitext
9711 <table>
9712 <td>foo</td>
9713 </tr>
9714 </table>
9715 !! html+tidy
9716 <table>
9717 <tr>
9718 <td>foo</td>
9719 </tr>
9720 </table>
9721 !! end
9722
9723 ###
9724 ### Magic Words
9725 ###
9726
9727 # Note that the current date is hard-coded as
9728 # 1970-01-01T00:02:03Z (a Thursday)
9729 # when running parser tests. The timezone is also fixed to GMT, so
9730 # local date will be identical to current date.
9731
9732 !! test
9733 Magic Word: {{CURRENTDAY}}
9734 !! wikitext
9735 {{CURRENTDAY}}
9736 !! html
9737 <p>1
9738 </p>
9739 !! end
9740
9741 !! test
9742 Magic Word: {{CURRENTDAY2}}
9743 !! wikitext
9744 {{CURRENTDAY2}}
9745 !! html
9746 <p>01
9747 </p>
9748 !! end
9749
9750 !! test
9751 Magic Word: {{CURRENTDAYNAME}}
9752 !! wikitext
9753 {{CURRENTDAYNAME}}
9754 !! html
9755 <p>Thursday
9756 </p>
9757 !! end
9758
9759 !! test
9760 Magic Word: {{CURRENTDOW}}
9761 !! wikitext
9762 {{CURRENTDOW}}
9763 !! html
9764 <p>4
9765 </p>
9766 !! end
9767
9768 !! test
9769 Magic Word: {{CURRENTMONTH}}
9770 !! wikitext
9771 {{CURRENTMONTH}}
9772 !! html
9773 <p>01
9774 </p>
9775 !! end
9776
9777 !! test
9778 Magic Word: {{CURRENTMONTH1}}
9779 !! wikitext
9780 {{CURRENTMONTH1}}
9781 !! html
9782 <p>1
9783 </p>
9784 !! end
9785
9786 !! test
9787 Magic Word: {{CURRENTMONTHABBREV}}
9788 !! wikitext
9789 {{CURRENTMONTHABBREV}}
9790 !! html
9791 <p>Jan
9792 </p>
9793 !! end
9794
9795 !! test
9796 Magic Word: {{CURRENTMONTHNAME}}
9797 !! wikitext
9798 {{CURRENTMONTHNAME}}
9799 !! html
9800 <p>January
9801 </p>
9802 !! end
9803
9804 !! test
9805 Magic Word: {{CURRENTMONTHNAMEGEN}}
9806 !! wikitext
9807 {{CURRENTMONTHNAMEGEN}}
9808 !! html
9809 <p>January
9810 </p>
9811 !! end
9812
9813 !! test
9814 Magic Word: {{CURRENTTIME}}
9815 !! wikitext
9816 {{CURRENTTIME}}
9817 !! html
9818 <p>00:02
9819 </p>
9820 !! end
9821
9822 !! test
9823 Magic Word: {{CURRENTHOUR}}
9824 !! wikitext
9825 {{CURRENTHOUR}}
9826 !! html
9827 <p>00
9828 </p>
9829 !! end
9830
9831 !! test
9832 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9833 !! wikitext
9834 {{CURRENTWEEK}}
9835 !! html
9836 <p>1
9837 </p>
9838 !! end
9839
9840 !! test
9841 Magic Word: {{CURRENTYEAR}}
9842 !! wikitext
9843 {{CURRENTYEAR}}
9844 !! html
9845 <p>1970
9846 </p>
9847 !! end
9848
9849 !! test
9850 Magic Word: {{CURRENTTIMESTAMP}}
9851 !! wikitext
9852 {{CURRENTTIMESTAMP}}
9853 !! html
9854 <p>19700101000203
9855 </p>
9856 !! end
9857
9858 !! test
9859 Magic Words LOCAL (UTC)
9860 !! wikitext
9861 * {{LOCALMONTH}}
9862 * {{LOCALMONTH1}}
9863 * {{LOCALMONTHNAME}}
9864 * {{LOCALMONTHNAMEGEN}}
9865 * {{LOCALMONTHABBREV}}
9866 * {{LOCALDAY}}
9867 * {{LOCALDAY2}}
9868 * {{LOCALDAYNAME}}
9869 * {{LOCALYEAR}}
9870 * {{LOCALTIME}}
9871 * {{LOCALHOUR}}
9872 * {{LOCALWEEK}}
9873 * {{LOCALDOW}}
9874 * {{LOCALTIMESTAMP}}
9875 !! html
9876 <ul><li> 01</li>
9877 <li> 1</li>
9878 <li> January</li>
9879 <li> January</li>
9880 <li> Jan</li>
9881 <li> 1</li>
9882 <li> 01</li>
9883 <li> Thursday</li>
9884 <li> 1970</li>
9885 <li> 00:02</li>
9886 <li> 00</li>
9887 <li> 1</li>
9888 <li> 4</li>
9889 <li> 19700101000203</li></ul>
9890
9891 !! end
9892
9893 !! test
9894 Magic Word: {{FULLPAGENAME}}
9895 !! options
9896 title=[[User:Ævar Arnfjörð Bjarmason]]
9897 !! wikitext
9898 {{FULLPAGENAME}}
9899 !! html
9900 <p>User:Ævar Arnfjörð Bjarmason
9901 </p>
9902 !! end
9903
9904 !! test
9905 Magic Word: {{FULLPAGENAMEE}}
9906 !! options
9907 title=[[User:Ævar Arnfjörð Bjarmason]]
9908 !! wikitext
9909 {{FULLPAGENAMEE}}
9910 !! html
9911 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9912 </p>
9913 !! end
9914
9915 !! test
9916 Magic Word: {{TALKSPACE}}
9917 !! options
9918 title=[[User:Ævar Arnfjörð Bjarmason]]
9919 !! wikitext
9920 {{TALKSPACE}}
9921 !! html
9922 <p>User talk
9923 </p>
9924 !! end
9925
9926 !! test
9927 Magic Word: {{TALKSPACE}}, same namespace
9928 !! options
9929 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9930 !! wikitext
9931 {{TALKSPACE}}
9932 !! html
9933 <p>User talk
9934 </p>
9935 !! end
9936
9937 !! test
9938 Magic Word: {{TALKSPACE}}, main namespace
9939 !! options
9940 title=[[Parser Test]]
9941 !! wikitext
9942 {{TALKSPACE}}
9943 !! html
9944 <p>Talk
9945 </p>
9946 !! end
9947
9948 !! test
9949 Magic Word: {{TALKSPACEE}}
9950 !! options
9951 title=[[User:Ævar Arnfjörð Bjarmason]]
9952 !! wikitext
9953 {{TALKSPACEE}}
9954 !! html
9955 <p>User_talk
9956 </p>
9957 !! end
9958
9959 !! test
9960 Magic Word: {{SUBJECTSPACE}}
9961 !! options
9962 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9963 !! wikitext
9964 {{SUBJECTSPACE}}
9965 !! html
9966 <p>User
9967 </p>
9968 !! end
9969
9970 !! test
9971 Magic Word: {{SUBJECTSPACE}}, same namespace
9972 !! options
9973 title=[[User:Ævar Arnfjörð Bjarmason]]
9974 !! wikitext
9975 {{SUBJECTSPACE}}
9976 !! html
9977 <p>User
9978 </p>
9979 !! end
9980
9981 !! test
9982 Magic Word: {{SUBJECTSPACE}}, main namespace
9983 !! options
9984 title=[[Parser Test]]
9985 !! wikitext
9986 {{SUBJECTSPACE}}
9987 !! html
9988
9989 !! end
9990
9991 !! test
9992 Magic Word: {{SUBJECTSPACEE}}
9993 !! options
9994 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9995 !! wikitext
9996 {{SUBJECTSPACEE}}
9997 !! html
9998 <p>User
9999 </p>
10000 !! end
10001
10002 !! test
10003 Magic Word: {{NAMESPACE}}
10004 !! options
10005 title=[[User:Ævar Arnfjörð Bjarmason]]
10006 !! wikitext
10007 {{NAMESPACE}}
10008 !! html
10009 <p>User
10010 </p>
10011 !! end
10012
10013 !! test
10014 Magic Word: {{NAMESPACEE}}
10015 !! options
10016 title=[[User:Ævar Arnfjörð Bjarmason]]
10017 !! wikitext
10018 {{NAMESPACEE}}
10019 !! html
10020 <p>User
10021 </p>
10022 !! end
10023
10024 !! test
10025 Magic Word: {{NAMESPACENUMBER}}
10026 !! options
10027 title=[[User:Ævar Arnfjörð Bjarmason]]
10028 !! wikitext
10029 {{NAMESPACENUMBER}}
10030 !! html
10031 <p>2
10032 </p>
10033 !! end
10034
10035 !! test
10036 Magic Word: {{SUBPAGENAME}}
10037 !! options
10038 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10039 !! wikitext
10040 {{SUBPAGENAME}}
10041 !! html
10042 <p>sub ö
10043 </p>
10044 !! end
10045
10046 !! test
10047 Magic Word: {{SUBPAGENAMEE}}
10048 !! options
10049 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10050 !! wikitext
10051 {{SUBPAGENAMEE}}
10052 !! html
10053 <p>sub_%C3%B6
10054 </p>
10055 !! end
10056
10057 !! test
10058 Magic Word: {{ROOTPAGENAME}}
10059 !! options
10060 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10061 !! wikitext
10062 {{ROOTPAGENAME}}
10063 !! html
10064 <p>Ævar Arnfjörð Bjarmason
10065 </p>
10066 !! end
10067
10068 !! test
10069 Magic Word: {{ROOTPAGENAMEE}}
10070 !! options
10071 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10072 !! wikitext
10073 {{ROOTPAGENAMEE}}
10074 !! html
10075 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10076 </p>
10077 !! end
10078
10079 !! test
10080 Magic Word: {{BASEPAGENAME}}
10081 !! options
10082 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10083 !! wikitext
10084 {{BASEPAGENAME}}
10085 !! html
10086 <p>Ævar Arnfjörð Bjarmason
10087 </p>
10088 !! end
10089
10090 !! test
10091 Magic Word: {{BASEPAGENAMEE}}
10092 !! options
10093 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10094 !! wikitext
10095 {{BASEPAGENAMEE}}
10096 !! html
10097 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10098 </p>
10099 !! end
10100
10101 !! test
10102 Magic Word: {{TALKPAGENAME}}
10103 !! options
10104 title=[[User:Ævar Arnfjörð Bjarmason]]
10105 !! wikitext
10106 {{TALKPAGENAME}}
10107 !! html
10108 <p>User talk:Ævar Arnfjörð Bjarmason
10109 </p>
10110 !! end
10111
10112 !! test
10113 Magic Word: {{TALKPAGENAMEE}}
10114 !! options
10115 title=[[User:Ævar Arnfjörð Bjarmason]]
10116 !! wikitext
10117 {{TALKPAGENAMEE}}
10118 !! html
10119 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10120 </p>
10121 !! end
10122
10123 !! test
10124 Magic Word: {{SUBJECTPAGENAME}}
10125 !! options
10126 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10127 !! wikitext
10128 {{SUBJECTPAGENAME}}
10129 !! html
10130 <p>User:Ævar Arnfjörð Bjarmason
10131 </p>
10132 !! end
10133
10134 !! test
10135 Magic Word: {{SUBJECTPAGENAMEE}}
10136 !! options
10137 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10138 !! wikitext
10139 {{SUBJECTPAGENAMEE}}
10140 !! html
10141 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10142 </p>
10143 !! end
10144
10145 !! test
10146 Magic Word: {{NUMBEROFFILES}}
10147 !! wikitext
10148 {{NUMBEROFFILES}}
10149 !! html
10150 <p>7
10151 </p>
10152 !! end
10153
10154 !! test
10155 Magic Word: {{PAGENAME}}
10156 !! options
10157 title=[[User:Ævar Arnfjörð Bjarmason]]
10158 !! wikitext
10159 {{PAGENAME}}
10160 !! html
10161 <p>Ævar Arnfjörð Bjarmason
10162 </p>
10163 !! end
10164
10165 !! test
10166 Magic Word: {{PAGENAME}} with metacharacters
10167 !! options
10168 title=[['foo & bar = baz']]
10169 !! wikitext
10170 ''{{PAGENAME}}''
10171 !! html/php
10172 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10173 </p>
10174 !! html+tidy
10175 <p><i>'foo &amp; bar = baz'</i></p>
10176 !! end
10177
10178 !! test
10179 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
10180 !! options
10181 title=[[*RFC 1234 http://example.com/]]
10182 !! wikitext
10183 {{PAGENAME}}
10184 !! html/php
10185 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10186 </p>
10187 !! html+tidy
10188 <p>*RFC 1234 http://example.com/</p>
10189 !! end
10190
10191 !! test
10192 Magic Word: {{PAGENAMEE}}
10193 !! options
10194 title=[[User:Ævar Arnfjörð Bjarmason]]
10195 !! wikitext
10196 {{PAGENAMEE}}
10197 !! html
10198 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10199 </p>
10200 !! end
10201
10202 !! test
10203 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10204 !! options
10205 title=[[*RFC 1234 http://example.com/]]
10206 !! wikitext
10207 {{PAGENAMEE}}
10208 !! html/php
10209 <p>&#42;RFC_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: {{REVISIONID}}
10217 !! wikitext
10218 {{REVISIONID}}
10219 !! html
10220 <p>1337
10221 </p>
10222 !! end
10223
10224 !! test
10225 Magic Word: {{SCRIPTPATH}}
10226 !! wikitext
10227 {{SCRIPTPATH}}
10228 !! html
10229
10230 !! end
10231
10232 !! test
10233 Magic Word: {{STYLEPATH}}
10234 !! wikitext
10235 {{STYLEPATH}}
10236 !! html
10237 <p>/skins
10238 </p>
10239 !! end
10240
10241 !! test
10242 Magic Word: {{SERVER}}
10243 !! wikitext
10244 {{SERVER}}
10245 !! html
10246 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10247 </p>
10248 !! end
10249
10250 !! test
10251 Magic Word: {{SERVERNAME}}
10252 !! wikitext
10253 {{SERVERNAME}}
10254 !! html
10255 <p>example.org
10256 </p>
10257 !! end
10258
10259 !! test
10260 Magic Word: {{SITENAME}}
10261 !! wikitext
10262 {{SITENAME}}
10263 !! html
10264 <p>MediaWiki
10265 </p>
10266 !! end
10267
10268 !! test
10269 Case-sensitive magic words, when cased differently, should just be template transclusions
10270 !! wikitext
10271 {{CurrentMonth}}
10272 {{currentday}}
10273 {{cURreNTweEK}}
10274 {{currentHour}}
10275 !! html
10276 <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>
10277 <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>
10278 <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>
10279 <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>
10280 </p>
10281 !! end
10282
10283 !! test
10284 Case-insensitive magic words should still work with weird casing.
10285 !! wikitext
10286 {{sErVeRNaMe}}
10287 {{LCFirst:AOEU}}
10288 {{ucFIRST:aoeu}}
10289 {{SERver}}
10290 !! html
10291 <p>example.org
10292 aOEU
10293 Aoeu
10294 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10295 </p>
10296 !! end
10297
10298 # From plwiki:PLOS_ONE
10299 !! test
10300 Parsoid: Page property magic word with magic word contents
10301 !! wikitext
10302 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10303 !! html/parsoid
10304 <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>"}]]}'/>
10305 !! end
10306
10307 !! test
10308 Parsoid: Template-generated DISPLAYTITLE
10309 !! wikitext
10310 {{{{echo|DISPLAYTITLE}}:Foo}}
10311 !! html/parsoid
10312 <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}}]}'/>
10313 !! end
10314
10315 !! test
10316 Namespace 1 {{ns:1}}
10317 !! wikitext
10318 {{ns:1}}
10319 !! html
10320 <p>Talk
10321 </p>
10322 !! end
10323
10324 !! test
10325 Namespace 1 {{ns:01}}
10326 !! wikitext
10327 {{ns:01}}
10328 !! html
10329 <p>Talk
10330 </p>
10331 !! end
10332
10333 !! test
10334 Namespace 0 {{ns:0}} (bug 4783)
10335 !! wikitext
10336 {{ns:0}}
10337 !! html
10338
10339 !! end
10340
10341 !! test
10342 Namespace 0 {{ns:00}} (bug 4783)
10343 !! wikitext
10344 {{ns:00}}
10345 !! html
10346
10347 !! end
10348
10349 !! test
10350 Namespace -1 {{ns:-1}}
10351 !! wikitext
10352 {{ns:-1}}
10353 !! html
10354 <p>Special
10355 </p>
10356 !! end
10357
10358 !! test
10359 Namespace User {{ns:User}}
10360 !! wikitext
10361 {{ns:User}}
10362 !! html
10363 <p>User
10364 </p>
10365 !! end
10366
10367 !! test
10368 Namespace User talk {{ns:User_talk}}
10369 !! wikitext
10370 {{ns:User_talk}}
10371 !! html
10372 <p>User talk
10373 </p>
10374 !! end
10375
10376 !! test
10377 Namespace User talk {{ns:uSeR tAlK}}
10378 !! wikitext
10379 {{ns:uSeR tAlK}}
10380 !! html
10381 <p>User talk
10382 </p>
10383 !! end
10384
10385 !! test
10386 Namespace File {{ns:File}}
10387 !! wikitext
10388 {{ns:File}}
10389 !! html
10390 <p>File
10391 </p>
10392 !! end
10393
10394 !! test
10395 Namespace File {{ns:Image}}
10396 !! wikitext
10397 {{ns:Image}}
10398 !! html
10399 <p>File
10400 </p>
10401 !! end
10402
10403 !! test
10404 Namespace (lang=de) Benutzer {{ns:User}}
10405 !! options
10406 language=de
10407 !! wikitext
10408 {{ns:User}}
10409 !! html
10410 <p>Benutzer
10411 </p>
10412 !! end
10413
10414 !! test
10415 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10416 !! options
10417 language=de
10418 !! wikitext
10419 {{ns:3}}
10420 !! html
10421 <p>Benutzer Diskussion
10422 </p>
10423 !! end
10424
10425 !! test
10426 Urlencode
10427 !! wikitext
10428 {{urlencode:hi world?!}}
10429 {{urlencode:hi world?!|WIKI}}
10430 {{urlencode:hi world?!|PATH}}
10431 {{urlencode:hi world?!|QUERY}}
10432 !! html/php
10433 <p>hi+world%3F%21
10434 hi_world%3F!
10435 hi%20world%3F%21
10436 hi+world%3F%21
10437 </p>
10438 !! end
10439
10440 !! test
10441 Magic Word: prioritize type info over data-parsoid
10442 !! options
10443 parsoid=html2wt
10444 !! html/parsoid
10445 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10446 !! wikitext
10447 __FORCETOC__
10448 !! end
10449
10450 !! test
10451 Magic Word: serialize on separate line (parsoid)
10452 !! options
10453 parsoid=wt2wt,html2wt
10454 !! wikitext
10455 foo
10456 __NOTOC__
10457 bar
10458 !! html/parsoid
10459 foo<meta property="mw:PageProp/notoc"/>bar
10460 !! end
10461
10462 !! test
10463 Magic Word: rt non-english wikis
10464 !! options
10465 parsoid=wt2wt
10466 language=de
10467 !! wikitext
10468 __NOEDITSECTION__
10469 !! html/parsoid
10470 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10471 !! end
10472
10473 !!test
10474 __proto__ is treated as normal wikitext (T105997)
10475 !!wikitext
10476 __proto__
10477 !!html
10478 <p>__proto__
10479 </p>
10480 !!end
10481
10482 ###
10483 ### Magic links
10484 ###
10485 !! test
10486 Magic links: internal link to RFC (bug 479)
10487 !! wikitext
10488 [[RFC 123]]
10489 !! html/php
10490 <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>
10491 </p>
10492 !! html/parsoid
10493 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10494 !! end
10495
10496 !! test
10497 Magic links: RFC (bug 479)
10498 !! wikitext
10499 RFC 822
10500 !! html/php
10501 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10502 </p>
10503 !! html/parsoid
10504 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10505 !! end
10506
10507 !! test
10508 Magic links: RFC (bug 65278)
10509 !! wikitext
10510 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10511 !! html/php
10512 <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.
10513 </p>
10514 !! html/parsoid
10515 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10516 !! end
10517
10518 !! test
10519 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10520 !! wikitext
10521 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10522 RFC
10523 822
10524 !! html/php
10525 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10526 RFC
10527 822
10528 </p>
10529 !! html/parsoid
10530 <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>
10531 RFC
10532 822</p>
10533 !! end
10534
10535 !! test
10536 Magic links: ISBN (bug 1937)
10537 !! wikitext
10538 ISBN 0-306-40615-2
10539 !! html/php
10540 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10541 </p>
10542 !! html/parsoid
10543 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10544 !! end
10545
10546 !! test
10547 Magic links: ISBN (bug 65278)
10548 !! wikitext
10549 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10550 !! html/php
10551 <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.
10552 </p>
10553 !! html/parsoid
10554 <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>
10555 !! end
10556
10557 !! test
10558 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10559 !! wikitext
10560 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10561 ISBN
10562 9780316098113
10563 ISBN 978
10564 0316098113
10565 !! html/php
10566 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10567 ISBN
10568 9780316098113
10569 ISBN 978
10570 0316098113
10571 </p>
10572 !! html/parsoid
10573 <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>
10574 ISBN
10575 9780316098113
10576 ISBN 978
10577 0316098113</p>
10578 !! end
10579
10580 !! test
10581 Magic links: PMID incorrectly converts space to underscore
10582 !! wikitext
10583 PMID 1234
10584 !! html/php
10585 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10586 </p>
10587 !! html/parsoid
10588 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10589 !! end
10590
10591 !! test
10592 Magic links: PMID (bug 65278)
10593 !! wikitext
10594 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10595 !! html/php
10596 <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.
10597 </p>
10598 !! html/parsoid
10599 <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>
10600 !! end
10601
10602 !! test
10603 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10604 !! wikitext
10605 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10606 PMID
10607 1234
10608 !! html/php
10609 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10610 PMID
10611 1234
10612 </p>
10613 !! html/parsoid
10614 <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>
10615 PMID
10616 1234</p>
10617 !! end
10618
10619 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10620 # since these are ExtLinkText, not MagicLinkText
10621 !! test
10622 Magic links: use appropriate serialization for "almost" magic links.
10623 !! wikitext
10624 X[[Special:BookSources/0978739256|foo]]
10625
10626 X[//tools.ietf.org/html/rfc1234 foo]
10627 !! html/php
10628 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10629 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10630 </p>
10631 !! html/parsoid
10632 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10633 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10634 !! end
10635
10636 !! test
10637 Magic links: All disabled (T47942)
10638 !! options
10639 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10640 !! wikitext
10641 ISBN 0-306-40615-2
10642 PMID 1234
10643 RFC 4321
10644 !! html/php
10645 <p>ISBN 0-306-40615-2
10646 PMID 1234
10647 RFC 4321
10648 </p>
10649 !! end
10650
10651 ###
10652 ### Templates
10653 ####
10654
10655 !! test
10656 Nonexistent template
10657 !! wikitext
10658 {{thistemplatedoesnotexist}}
10659 !! html
10660 <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>
10661 </p>
10662 !! end
10663
10664 !! test
10665 Template with invalid target containing tags
10666 !! wikitext
10667 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10668 !! html
10669 <p>{{a<b>b</b>|foo|a=b|a = b}}
10670 </p>
10671 !! end
10672
10673 !! test
10674 Template with invalid target containing unclosed tag
10675 !! wikitext
10676 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10677 !! html
10678 <p>{{a<b>|foo|a=b|a = b}}</b>
10679 </p>
10680 !! end
10681
10682 !! test
10683 Template with invalid target containing wikilink
10684 !! wikitext
10685 {{[[Main Page]]}}
10686 !! html/php
10687 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10688 </p>
10689 !! html/parsoid
10690 <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>
10691 !! end
10692
10693 !! test
10694 Template with just whitespace in it, bug #68421
10695 !! wikitext
10696 {{echo|{{ }}}}
10697 !! html/parsoid
10698 <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>
10699 !! end
10700
10701 !! article
10702 Template:test
10703 !! text
10704 This is a test template
10705 !! endarticle
10706
10707 !! test
10708 Simple template
10709 !! wikitext
10710 {{test}}
10711 !! html
10712 <p>This is a test template
10713 </p>
10714 !! end
10715
10716 !! test
10717 Template with explicit namespace
10718 !! wikitext
10719 {{Template:test}}
10720 !! html
10721 <p>This is a test template
10722 </p>
10723 !! end
10724
10725
10726 !! article
10727 Template:paramtest
10728 !! text
10729 This is a test template with parameter {{{param}}}
10730 !! endarticle
10731
10732 !! test
10733 Template parameter
10734 !! wikitext
10735 {{paramtest|param=foo}}
10736 !! html
10737 <p>This is a test template with parameter foo
10738 </p>
10739 !! end
10740
10741 !! article
10742 Template:paramtestnum
10743 !! text
10744 [[{{{1}}}|{{{2}}}]]
10745 !! endarticle
10746
10747 !! test
10748 Template unnamed parameter
10749 !! wikitext
10750 {{paramtestnum|Main Page|the main page}}
10751 !! html
10752 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10753 </p>
10754 !! end
10755
10756 !! article
10757 Template:templatesimple
10758 !! text
10759 (test)
10760 !! endarticle
10761
10762 !! article
10763 Template:templateredirect
10764 !! text
10765 #redirect [[Template:templatesimple]]
10766 !! endarticle
10767
10768 !! article
10769 Template:templateasargtestnum
10770 !! text
10771 {{{{{1}}}}}
10772 !! endarticle
10773
10774 !! article
10775 Template:templateasargtest
10776 !! text
10777 {{template{{{templ}}}}}
10778 !! endarticle
10779
10780 !! article
10781 Template:templateasargtest2
10782 !! text
10783 {{{{{templ}}}}}
10784 !! endarticle
10785
10786 !! test
10787 Template with template name as unnamed argument
10788 !! wikitext
10789 {{templateasargtestnum|templatesimple}}
10790 !! html
10791 <p>(test)
10792 </p>
10793 !! end
10794
10795 !! test
10796 Template with template name as argument
10797 !! wikitext
10798 {{templateasargtest|templ=simple}}
10799 !! html
10800 <p>(test)
10801 </p>
10802 !! end
10803
10804 !! test
10805 Template with template name as argument (2)
10806 !! wikitext
10807 {{templateasargtest2|templ=templatesimple}}
10808 !! html
10809 <p>(test)
10810 </p>
10811 !! end
10812
10813 !! article
10814 Template:templateasargtestdefault
10815 !! text
10816 {{{{{templ|templatesimple}}}}}
10817 !! endarticle
10818
10819 !! article
10820 Template:templa
10821 !! text
10822 '''templ'''
10823 !! endarticle
10824
10825 !! test
10826 Template with default value
10827 !! wikitext
10828 {{templateasargtestdefault}}
10829 !! html
10830 <p>(test)
10831 </p>
10832 !! end
10833
10834 !! test
10835 Template with default value (value set)
10836 !! wikitext
10837 {{templateasargtestdefault|templ=templa}}
10838 !! html
10839 <p><b>templ</b>
10840 </p>
10841 !! end
10842
10843 !! test
10844 Template redirect
10845 !! wikitext
10846 {{templateredirect}}
10847 !! html/php
10848 <p>(test)
10849 </p>
10850 !! html/parsoid
10851 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10852 !! end
10853
10854 !! test
10855 Template with argument in separate line
10856 !! wikitext
10857 {{ templateasargtest |
10858 templ = simple }}
10859 !! html
10860 <p>(test)
10861 </p>
10862 !! end
10863
10864 !! test
10865 Template with complex template as argument
10866 !! wikitext
10867 {{paramtest|
10868 param ={{ templateasargtest |
10869 templ = simple }}}}
10870 !! html
10871 <p>This is a test template with parameter (test)
10872 </p>
10873 !! end
10874
10875 !! test
10876 Template with thumb image (with link in description)
10877 !! wikitext
10878 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10879 !! html/php
10880 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>
10881
10882 !! html+tidy
10883 <p>This is a test template with parameter</p>
10884 <div class="thumb tright">
10885 <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>
10886 <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>
10887 </div>
10888 </div>
10889 !! html/parsoid
10890 <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>
10891 !! end
10892
10893 !! article
10894 Template:complextemplate
10895 !! text
10896 {{{1}}} {{paramtest|
10897 param ={{{param}}}}}
10898 !! endarticle
10899
10900 !! test
10901 Template with complex arguments
10902 !! wikitext
10903 {{complextemplate|
10904 param ={{ templateasargtest |
10905 templ = simple }}|[[Template:complextemplate|link]]}}
10906 !! html
10907 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10908 </p>
10909 !! end
10910
10911 !! test
10912 BUG 553: link with two variables in a piped link
10913 !! wikitext
10914 {|
10915 |[[{{{1}}}|{{{2}}}]]
10916 |}
10917 !! html/php
10918 <table>
10919 <tr>
10920 <td>[[{{{1}}}|{{{2}}}]]
10921 </td></tr></table>
10922
10923 !! html/parsoid
10924 <table>
10925 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-parsoid='{"src":"{{{1}}}"}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-parsoid='{"src":"{{{2}}}"}'>{{{2}}}</span>]]</td></tr>
10926 !! end
10927
10928 # See: T2553
10929 !! test
10930 Abort table cell attribute parsing on wikilink
10931 !! wikitext
10932 {|
10933 | testing [[one|two]] | three || four
10934 | testing one two | three || four
10935 | testing="[[one|two]]" | three || four
10936 |}
10937 !! html/php
10938 <table>
10939 <tr>
10940 <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>
10941 <td> four
10942 </td>
10943 <td> three </td>
10944 <td> four
10945 </td>
10946 <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>
10947 <td> four
10948 </td></tr></table>
10949
10950 !! html/parsoid
10951 <table>
10952 <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>
10953 <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>
10954 <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>
10955 </tbody></table>
10956 !! end
10957
10958 !! test
10959 Don't abort table cell attribute parsing if wikilink is found in template arg
10960 !! wikitext
10961 {|
10962 | Test {{#tag:ref|One two "[[three]]" four}}
10963 |}
10964 !! html/parsoid
10965 <table>
10966 <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>
10967 </tbody></table>
10968 !! end
10969
10970 !! test
10971 Magic variable as template parameter
10972 !! wikitext
10973 {{paramtest|param={{SITENAME}}}}
10974 !! html
10975 <p>This is a test template with parameter MediaWiki
10976 </p>
10977 !! end
10978
10979 !! article
10980 Template:linktest
10981 !! text
10982 [[{{{param}}}|link]]
10983 !! endarticle
10984
10985 !! test
10986 Template parameter as link source
10987 !! wikitext
10988 {{linktest|param=Main Page}}
10989 !! html
10990 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10991 </p>
10992 !! end
10993
10994 !!article
10995 Template:paramtest2
10996 !! text
10997 including another template, {{paramtest|param={{{arg}}}}}
10998 !! endarticle
10999
11000 !! test
11001 Template passing argument to another template
11002 !! wikitext
11003 {{paramtest2|arg='hmm'}}
11004 !! html
11005 <p>including another template, This is a test template with parameter 'hmm'
11006 </p>
11007 !! end
11008
11009 !! article
11010 Template:Linktest2
11011 !! text
11012 Main Page
11013 !! endarticle
11014
11015 !! test
11016 Template as link source
11017 !! wikitext
11018 [[{{linktest2}}]]
11019
11020 [[{{linktest2}}|Main Page]]
11021
11022 [[{{linktest2}}]]Page
11023 !! html
11024 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11025 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11026 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11027 </p>
11028 !! end
11029
11030
11031 !! article
11032 Template:loop1
11033 !! text
11034 {{loop2}}
11035 !! endarticle
11036
11037 !! article
11038 Template:loop2
11039 !! text
11040 {{loop1}}
11041 !! endarticle
11042
11043 !! test
11044 Template infinite loop
11045 !! wikitext
11046 {{loop1}}
11047 !! html
11048 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11049 </p>
11050 !! end
11051
11052 !! test
11053 Template from main namespace
11054 !! wikitext
11055 {{:Main Page}}
11056 !! html
11057 <p>blah blah
11058 </p>
11059 !! end
11060
11061 !! article
11062 Template:table
11063 !! text
11064 {|
11065 | 1 || 2
11066 |-
11067 | 3 || 4
11068 |}
11069 !! endarticle
11070
11071 !! test
11072 BUG 529: Template with table, not included at beginning of line
11073 !! wikitext
11074 foo {{table}}
11075 !! html
11076 <p>foo
11077 </p>
11078 <table>
11079 <tr>
11080 <td> 1 </td>
11081 <td> 2
11082 </td></tr>
11083 <tr>
11084 <td> 3 </td>
11085 <td> 4
11086 </td></tr></table>
11087
11088 !! end
11089
11090 !! test
11091 BUG 523: Template shouldn't eat newline (or add an extra one before table)
11092 !! wikitext
11093 foo
11094 {{table}}
11095 !! html
11096 <p>foo
11097 </p>
11098 <table>
11099 <tr>
11100 <td> 1 </td>
11101 <td> 2
11102 </td></tr>
11103 <tr>
11104 <td> 3 </td>
11105 <td> 4
11106 </td></tr></table>
11107
11108 !! end
11109
11110 !! test
11111 BUG 41: Template parameters shown as broken links
11112 !! wikitext
11113 {{{parameter}}}
11114 !! html
11115 <p>{{{parameter}}}
11116 </p>
11117 !! end
11118
11119 !! test
11120 Template with targets containing wikilinks
11121 !! wikitext
11122 {{[[foo]]}}
11123
11124 {{[[{{echo|foo}}]]}}
11125
11126 {{{{echo|[[foo}}]]}}
11127 !! html
11128 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11129 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11130 </p><p>{{[[foo}}]]
11131 </p>
11132 !! end
11133
11134 !! article
11135 Template:''
11136 !! text
11137 bar
11138 !! endarticle
11139
11140 !! test
11141 Templates: Double quotes as template target
11142 !! wikitext
11143 foo {{''}} baz
11144 !! html/php
11145 <p>foo bar baz
11146 </p>
11147 !! html/parsoid
11148 <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
11149 </p>
11150 !! end
11151
11152 ## This test is about making sure Parsoid's data-mw is well formed in the
11153 ## face of multiple templates with intersecting and overlapping ranges. The
11154 ## wikitext itself is wretched.
11155 !! test
11156 Templates with intersecting and overlapping ranges
11157 !! wikitext
11158 {|{{echo|
11159 <p>ha</p>}}
11160 {|{{echo|
11161 <p>ho</p>}}
11162 {{echo|{{!}}hi}}
11163 |}
11164 !! html/php+tidy
11165 <p>ha</p>
11166 <p>ho</p>
11167 <table>
11168 <tr>
11169 <td></td>
11170 </tr>
11171 <tr>
11172 <td>hi</td>
11173 </tr>
11174 </table>
11175 <table>
11176 <tr>
11177 <td></td>
11178 </tr>
11179 </table>
11180 !! html/parsoid
11181 <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":""}]]}'>
11182
11183 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11184
11185 <tbody><tr><td>hi</td></tr>
11186 </tbody></table>
11187 !! end
11188
11189 !! article
11190 Template:MSGNW test
11191 !! text
11192 ''None'' of '''this''' should be
11193 * interpreted
11194 but rather passed unmodified
11195 {{test}}
11196 <gallery>
11197 File:Foobar.jpg
11198 </gallery>
11199 <!-- comment -->
11200 !! endarticle
11201
11202 # hmm, fix this or just deprecate msgnw and document its behavior?
11203 !! test
11204 msgnw keyword
11205 !! wikitext
11206 {{msgnw:MSGNW test}}
11207 !! html/php
11208 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11209 &#42; interpreted
11210 &#32;but rather passed unmodified
11211 &#123;&#123;test&#125;&#125;
11212 &#60;gallery&#62;
11213 File:Foobar.jpg
11214 &#60;/gallery&#62;
11215 &#60;!-- comment --&#62;
11216 </p>
11217 !! end
11218
11219 !! test
11220 int keyword
11221 !! wikitext
11222 {{int:youhavenewmessages|lots of money|not!}}
11223 !! html
11224 <p>You have lots of money (not!).
11225 </p>
11226 !! end
11227
11228 !! test
11229 int keyword - non-existing message
11230 !! wikitext
11231 {{int:var}}
11232 !! html
11233 <p>⧼var⧽
11234 </p>
11235 !! end
11236
11237 !! article
11238 Template:Includes
11239 !! text
11240 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11241 !! endarticle
11242
11243 !! test
11244 <includeonly> and <noinclude> being included
11245 !! wikitext
11246 {{Includes}}
11247 !! html
11248 <p>Foobar
11249 </p>
11250 !! end
11251
11252 !! article
11253 Template:Includes2
11254 !! text
11255 <onlyinclude>Foo</onlyinclude>bar
11256 !! endarticle
11257
11258 !! test
11259 <onlyinclude> being included
11260 !! wikitext
11261 {{Includes2}}
11262 !! html
11263 <p>Foo
11264 </p>
11265 !! end
11266
11267
11268 !! article
11269 Template:Includes3
11270 !! text
11271 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11272 !! endarticle
11273
11274 !! test
11275 <onlyinclude> and <includeonly> being included
11276 !! wikitext
11277 {{Includes3}}
11278 !! html
11279 <p>Foo
11280 </p>
11281 !! end
11282
11283 !! test
11284 <includeonly> and <noinclude> on a page
11285 !! wikitext
11286 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11287 !! html
11288 <p>Foozar
11289 </p>
11290 !! end
11291
11292 !! test
11293 Un-closed <noinclude>
11294 !! wikitext
11295 <noinclude>
11296 !! html
11297 !! end
11298
11299 !! test
11300 <onlyinclude> on a page
11301 !! wikitext
11302 <onlyinclude>Foo</onlyinclude>bar
11303 !! html
11304 <p>Foobar
11305 </p>
11306 !! end
11307
11308 !! test
11309 Un-closed <onlyinclude>
11310 !! wikitext
11311 <onlyinclude>
11312 !! html
11313 !! end
11314
11315 !!test
11316 Self-closed noinclude, includeonly, onlyinclude tags
11317 !! wikitext
11318 <noinclude />
11319 <includeonly />
11320 <onlyinclude />
11321 !! html
11322 <p><br />
11323 </p>
11324 !!end
11325
11326 !!test
11327 Unbalanced includeonly and noinclude tags
11328 !! wikitext
11329 {|
11330 |a</noinclude>
11331 |b</noinclude></noinclude>
11332 |c</noinclude></includeonly>
11333 |d</includeonly></includeonly>
11334 |}
11335 !! html
11336 <table>
11337 <tr>
11338 <td>a
11339 </td>
11340 <td>b
11341 </td>
11342 <td>c&lt;/includeonly&gt;
11343 </td>
11344 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11345 </td></tr></table>
11346
11347 !!end
11348
11349 !! article
11350 Template:Includeonly section
11351 !! text
11352 <includeonly>
11353 ==Includeonly section==
11354 </includeonly>
11355 ==Section T-1==
11356 !!endarticle
11357
11358 !! test
11359 Bug 6563: Edit link generation for section shown by <includeonly>
11360 !! wikitext
11361 {{includeonly section}}
11362 !! html
11363 <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>
11364 <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>
11365
11366 !! end
11367
11368 # Uses same input as the contents of [[Template:Includeonly section]]
11369 !! test
11370 Bug 6563: Section extraction for section shown by <includeonly>
11371 !! options
11372 section=T-2
11373 !! wikitext
11374 <includeonly>
11375 ==Includeonly section==
11376 </includeonly>
11377 ==Section T-2==
11378 !! html
11379 ==Section T-2==
11380 !! end
11381
11382 !! test
11383 Bug 6563: Edit link generation for section suppressed by <includeonly>
11384 !! wikitext
11385 <includeonly>
11386 ==Includeonly section==
11387 </includeonly>
11388 ==Section 1==
11389 !! html
11390 <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>
11391
11392 !! end
11393
11394 !! test
11395 Bug 6563: Section extraction for section suppressed by <includeonly>
11396 !! options
11397 section=1
11398 !! wikitext
11399 <includeonly>
11400 ==Includeonly section==
11401 </includeonly>
11402 ==Section 1==
11403 !! html
11404 ==Section 1==
11405 !! end
11406
11407 !! test
11408 Un-closed <includeonly>
11409 !! wikitext
11410 <includeonly>
11411 !! html/php
11412 !! html/parsoid
11413 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11414 !! end
11415
11416 ## We used to, but no longer wt2wt this test since the default serializer
11417 ## will normalize the include directives to serialize on their own line.
11418 ## Selser will take care of preserving formatting in scenarios where they
11419 ## intermingled with other wikitext.
11420 !! test
11421 Includes and comments at SOL
11422 !! options
11423 parsoid=wt2html,html2html
11424 !! wikitext
11425 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11426
11427 <noinclude>
11428 some
11429 </noinclude>* stuff
11430 * here
11431
11432 <includeonly>can have stuff</includeonly>=== here ===
11433
11434 !! html/php
11435 <h2><span class="mw-headline" id="hu">hu</span></h2>
11436 <p>some
11437 </p>
11438 <ul><li> stuff</li>
11439 <li> here</li></ul>
11440 <h3><span class="mw-headline" id="here">here</span></h3>
11441
11442 !! html/parsoid
11443 <!-- 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>
11444
11445 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11446 <p>some</p>
11447 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11448 <li> here</li></ul>
11449
11450 <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>
11451
11452 !! end
11453
11454 # TODO: test with DOM fragment reuse!
11455 !! test
11456 Parsoid: DOM fragment reuse
11457 !! options
11458 parsoid=wt2wt,wt2html
11459 !! wikitext
11460 a{{echo|b<table></table>c}}d
11461
11462 a{{echo|b
11463 <table></table>
11464 c}}d
11465
11466 {{echo|a
11467
11468 <table></table>
11469
11470 b}}
11471 !! html
11472 <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>
11473
11474 <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">
11475 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11476 </span><p about="#mwt2">cd</p>
11477
11478 <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">
11479
11480 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11481
11482 </span><p about="#mwt3">b</p>
11483 !! end
11484
11485 !! test
11486 Parsoid: Merge double tds (T52603)
11487 !! options
11488 parsoid
11489 !! wikitext
11490 {|
11491 |{{echo|{{!}} foo}}
11492 |}
11493 !! html
11494 <table><tbody>
11495 <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>
11496 </tbody></table>
11497 !! end
11498
11499 !! test
11500 Parsoid: Merge double tds in nested transclusion content (T52603)
11501 !! options
11502 parsoid
11503 !! wikitext
11504 {{echo|<div>}}
11505 {|
11506 |{{echo|{{!}} foo}}
11507 |}
11508 {{echo|</div>}}
11509 !! html
11510 <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}}]}'>
11511 <table><tbody>
11512 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11513 </tbody></table>
11514 </div>
11515 !! end
11516
11517 ###
11518 ### <includeonly> and <noinclude> in attributes
11519 ###
11520 !!test
11521 0. includeonly around the entire attribute
11522 !! wikitext
11523 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11524 !! html
11525 <p><span id="v2">bar</span>
11526 </p>
11527 !!end
11528
11529 !!test
11530 1. includeonly in html attr key
11531 !! wikitext
11532 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11533 !! html
11534 <p><span id="foo">bar</span>
11535 </p>
11536 !!end
11537
11538 !!test
11539 2. includeonly in html attr value
11540 !! wikitext
11541 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11542 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11543 !! html
11544 <p><span id="v1">bar</span>
11545 <span id="v1">bar</span>
11546 </p>
11547 !!end
11548
11549 !!test
11550 3. includeonly in part of an attr value
11551 !! wikitext
11552 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11553 !! html
11554 <p><span style="color:red;">bar</span>
11555 </p>
11556 !!end
11557
11558 !!test
11559 4. includeonly in table attributes
11560 !! wikitext
11561 {|
11562 |- <noinclude>
11563 |-
11564 |a
11565 </noinclude>
11566 |- <includeonly>
11567 |-
11568 |b
11569 </includeonly>
11570 |}
11571 !! html
11572 <table>
11573
11574
11575 <tr>
11576 <td>a
11577 </td></tr>
11578 </table>
11579
11580 !!end
11581
11582 ###
11583 ### Token Stream Patcher tests
11584 ###
11585 ### These tests won't always pass wt2wt and other modes because
11586 ### on serialization, the table will be output on a new line.
11587 ### For now, we are blacklisting them, and using this to test selser.
11588 ###
11589
11590 !!test
11591 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11592 !!options
11593 parsoid=wt2html,wt2wt
11594 !!wikitext
11595 {{echo|}}{| width = '100%'
11596 |foo
11597 |}
11598 !!html/parsoid
11599 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11600 <tbody><tr><td>foo</td></tr>
11601 </tbody></table>
11602 !!end
11603
11604 ## We used to, but no longer wt2wt this test since the default serializer
11605 ## will normalize the include directives to serialize on their own line.
11606 ## Selser will take care of preserving formatting in scenarios where they
11607 ## intermingled with other wikitext.
11608 !!test
11609 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11610 !!options
11611 parsoid=wt2html
11612 !!wikitext
11613 <includeonly>a</includeonly>{| {{{b}}}
11614 |c
11615 |}
11616 !!html/parsoid
11617 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}' data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"dsr\":[31,38,null,null],\"src\":\"{{{b}}}\"}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
11618 <tbody><tr><td>c</td></tr>
11619 </tbody></table>
11620 !!end
11621
11622 !! test
11623 Table wikitext syntax outside wiki-tables
11624 !! wikitext
11625 a
11626 |+ not a caption
11627 ! not a table heading
11628 |- not a table row
11629 | not a table cell
11630 | class="foo bar" | baz
11631 b
11632 |}
11633 |-
11634 c
11635 !! html
11636 <p>a
11637 |+ not a caption
11638 ! not a table heading
11639 |- not a table row
11640 | not a table cell
11641 | class="foo bar" | baz
11642 b
11643 |}
11644 |-
11645 c
11646 </p>
11647 !! end
11648
11649 ###
11650 ### Testing parsing of templates where a template arg
11651 ### has the same name as the template itself.
11652 ###
11653
11654 !! article
11655 Template:quote
11656 !! text
11657 {{{quote|{{{1}}}}}}
11658 !! endarticle
11659
11660 !!test
11661 Templates: Template Name/Arg clash: 1. Use of positional param
11662 !! wikitext
11663 {{quote|foo}}
11664 !! html
11665 <p>foo
11666 </p>
11667 !!end
11668
11669 !!test
11670 Templates: Template Name/Arg clash: 2. Use of named param
11671 !! wikitext
11672 {{quote|quote=foo}}
11673 !! html
11674 <p>foo
11675 </p>
11676 !!end
11677
11678 !!test
11679 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11680 !! wikitext
11681 {{quote|quote}}
11682 !! html
11683 <p>quote
11684 </p>
11685 !!end
11686
11687 ###
11688 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11689 ###
11690
11691 !!test
11692 Templates: 1. Simple use
11693 !! wikitext
11694 {{echo|Foo}}
11695 !! html
11696 <p>Foo
11697 </p>
11698 !!end
11699
11700 !!test
11701 Templates: 2. Inside a block tag
11702 !! wikitext
11703 <div>{{echo|Foo}}</div>
11704 <blockquote>{{echo|Foo}}</blockquote>
11705 !! html
11706 <div>Foo</div>
11707 <blockquote>Foo</blockquote>
11708
11709 !! html+tidy
11710 <div>Foo</div>
11711 <blockquote>
11712 <p>Foo</p>
11713 </blockquote>
11714 !!end
11715
11716 !!test
11717 Templates: P-wrapping: 1a. Templates on consecutive lines
11718 !! wikitext
11719 {{echo|Foo}}
11720 {{echo|bar}}
11721 !! html
11722 <p>Foo
11723 bar
11724 </p>
11725 !!end
11726
11727 !!test
11728 Templates: P-wrapping: 1b. Templates on consecutive lines
11729 !! wikitext
11730 Foo
11731
11732 {{echo|bar}}
11733 {{echo|baz}}
11734 !! html
11735 <p>Foo
11736 </p><p>bar
11737 baz
11738 </p>
11739 !!end
11740
11741 !!test
11742 Templates: P-wrapping: 1c. Templates on consecutive lines
11743 !! wikitext
11744 {{echo|Foo}}
11745 {{echo|bar}} <div>baz</div>
11746 !! html
11747 <p>Foo
11748 </p>
11749 bar <div>baz</div>
11750
11751 !! html+tidy
11752 <p>Foo</p>
11753 <p>bar</p>
11754 <div>baz</div>
11755 !! end
11756
11757 !!test
11758 Templates: P-wrapping: 1d. Template preceded by comment-only line
11759 !!options
11760 parsoid
11761 !! wikitext
11762 <!-- foo -->
11763 {{echo|Bar}}
11764 !! html
11765 <!-- foo -->
11766
11767 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11768 !!end
11769
11770 !!test
11771 Templates: Inline Text: 1. Multiple template uses
11772 !! wikitext
11773 {{echo|Foo}}bar{{echo|baz}}
11774 !! html
11775 <p>Foobarbaz
11776 </p>
11777 !!end
11778
11779 !!test
11780 Templates: Inline Text: 2. Back-to-back template uses
11781 !! wikitext
11782 {{echo|Foo}}{{echo|bar}}
11783 !! html
11784 <p>Foobar
11785 </p>
11786 !!end
11787
11788 !!test
11789 Templates: Block Tags: 1. Multiple template uses
11790 !! wikitext
11791 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11792 !! html
11793 <div>Foo</div><div>bar</div><div>baz</div>
11794
11795 !!end
11796
11797 !!test
11798 Templates: Block Tags: 2. Back-to-back template uses
11799 !! wikitext
11800 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11801 !! html
11802 <div>Foo</div><div>bar</div>
11803
11804 !!end
11805
11806 # This is an edge case relating to paragraph wrapping.
11807 !!test
11808 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11809 !! wikitext
11810 {{echo|a
11811 b</p>}}
11812 !! html/parsoid
11813 <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
11814 b</p>
11815 !!end
11816
11817 !!test
11818 Templates: Links: 1. Simple example
11819 !! wikitext
11820 {{echo|[[Foo|bar]]}}
11821 !! html
11822 <p><a href="/wiki/Foo" title="Foo">bar</a>
11823 </p>
11824 !!end
11825
11826 !!test
11827 Templates: Links: 2. Generation of link href
11828 !! wikitext
11829 [[{{echo|Foo}}|bar]]
11830 !! html
11831 <p><a href="/wiki/Foo" title="Foo">bar</a>
11832 </p>
11833 !!end
11834
11835 !!test
11836 Templates: Links: 3. Generation of part of a link href
11837 !! wikitext
11838 [[Fo{{echo|o}}|bar]]
11839
11840 [[Foo{{echo|bar}}]]
11841
11842 [[Foo{{echo|bar}}baz]]
11843
11844 [[Foo{{echo|bar}}|bar]]
11845
11846 [[:Foo{{echo|bar}}]]
11847
11848 [[:Foo{{echo|bar}}|bar]]
11849 !! html
11850 <p><a href="/wiki/Foo" title="Foo">bar</a>
11851 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11852 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11853 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11854 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11855 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11856 </p>
11857 !!end
11858
11859 !!test
11860 Templates: Links: 4. Multiple templates generating link href
11861 !! wikitext
11862 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11863 !! html
11864 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11865 </p>
11866 !!end
11867
11868 !!test
11869 Templates: Links: 5. Generation of link text
11870 !! wikitext
11871 [[Foo|{{echo|bar}}]]
11872 !! html
11873 <p><a href="/wiki/Foo" title="Foo">bar</a>
11874 </p>
11875 !!end
11876
11877 !!test
11878 Templates: Links: 5. Nested templates (only outermost template should be marked)
11879 !! wikitext
11880 {{echo|[[{{echo|Foo}}|bar]]}}
11881 !! html
11882 <p><a href="/wiki/Foo" title="Foo">bar</a>
11883 </p>
11884 !!end
11885
11886 !!test
11887 Templates: HTML Tag: 1. Generation of HTML attr. key
11888 !! wikitext
11889 <div {{echo|style}}="color:red;">foo</div>
11890 !! html
11891 <div style="color:red;">foo</div>
11892
11893 !!end
11894
11895 !!test
11896 Templates: HTML Tag: 2. Generation of HTML attr. value
11897 !! wikitext
11898 <div style={{echo|'color:red;'}}>foo</div>
11899 !! html
11900 <div style="color:red;">foo</div>
11901
11902 !!end
11903
11904 !!test
11905 Templates: HTML Tag: 3. Generation of HTML attr key and value
11906 !! wikitext
11907 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11908 !! html
11909 <div style="color:red;">foo</div>
11910
11911 !!end
11912
11913 !!test
11914 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11915 !! wikitext
11916 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11917 !! html
11918 <div title="This is a long title with just one piece templated">foo</div>
11919
11920 !!end
11921
11922 !!test
11923 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11924 !! wikitext
11925 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11926 !! html
11927 <div title="This is a long title with just one piece templated">foo</div>
11928
11929 !!end
11930
11931 !!test
11932 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11933 !! wikitext
11934 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11935 !! html
11936 <div title="This is a long title with just one piece templated">foo</div>
11937
11938 !!end
11939
11940 # SSS FIXME: While it is great we added support for all this,
11941 # do we want to make this part of the spec? Maybe we want to
11942 # deprecate this kind of usage in the future?
11943 !!test
11944 Templates: HTML Tag: 7. Generation of partial attribute key string
11945 !! wikitext
11946 <div st{{echo|yle}}="color:red;">foo</div>
11947 !! html
11948 <div style="color:red;">foo</div>
11949
11950 !!end
11951
11952 !! test
11953 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11954 !! wikitext
11955 <div {{echo|1=id="v1"}}>bar</div>
11956 !! html
11957 <div id="v1">bar</div>
11958
11959 !!end
11960
11961 !! test
11962 Templates: HTML Tag: 9. Multiple template-generated attributes
11963 !! wikitext
11964 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11965 !! html
11966 <div id="v1" title="foo">bar</div>
11967
11968 !!end
11969
11970 !! test
11971 Templates: Support for templates generating attributes and content
11972 !! wikitext
11973 {| {{mixed_attr_content_template}}
11974 |-
11975 |bar
11976 |}
11977 !! html/php
11978 <table style="color:red;" title="T48811">
11979
11980 <tr>
11981 <td>foo
11982 </td></tr>
11983 <tr>
11984 <td>bar
11985 </td></tr></table>
11986
11987 !! html/parsoid
11988 <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|}"]}'>
11989 <tbody><tr>
11990 <td>foo</td></tr>
11991 <tr>
11992 <td>bar</td></tr>
11993 </tbody></table>
11994 !!end
11995
11996 !! test
11997 1. Entities and nowikis inside templated attributes should be handled correctly
11998 !! wikitext
11999 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12000 !! html/php
12001 <div style="background:#f9f9f9;">foo</div>
12002
12003 !! html/parsoid
12004 <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>
12005 !! end
12006
12007 !! test
12008 2. Entities and nowikis inside templated attributes should be handled correctly
12009 !! wikitext
12010 {|
12011 |{{table_attribs_3}}
12012 |}
12013 !! html/php
12014 <table>
12015 <tr>
12016 <td style="background:#f9f9f9;">Foo
12017 </td></tr></table>
12018
12019 !! html/parsoid
12020 <table>
12021 <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>
12022 </tbody></table>
12023 !! end
12024
12025 !! test
12026 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12027 !! wikitext
12028 {{tbl-start}}
12029 |{{table_attribs_3}}
12030 {{tbl-end}}
12031 !! html/php
12032 <table>
12033 <tr>
12034 <td style="background:#f9f9f9;">Foo
12035 </td></tr></table>
12036
12037 !! html/parsoid
12038 <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}}]}'>
12039 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12040 </tbody></table>
12041 !! end
12042
12043 # T107622
12044 !! test
12045 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12046 !! wikitext
12047 {|
12048 | {{table_attribs_6}} hi
12049 |}
12050 !! html/php
12051 <table>
12052 <tr>
12053 <td style="background: red;"> hi
12054 </td></tr></table>
12055
12056 !! html/parsoid
12057 <table>
12058 <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>
12059 </tbody></table>
12060 !! end
12061
12062 !!test
12063 Templates: HTML Tables: 1. Generating start of a HTML table
12064 !! wikitext
12065 {{echo|<table><tr><td>foo</td>}}</tr></table>
12066 !! html
12067 <table><tr><td>foo</td></tr></table>
12068
12069 !!end
12070
12071 !!test
12072 Templates: HTML Tables: 2a. Generating middle of a HTML table
12073 !! wikitext
12074 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12075 !! html
12076 <table><tr><td>foo</td></tr></table>
12077
12078 !!end
12079
12080 !!test
12081 Templates: HTML Tables: 2b. Generating middle of a HTML table
12082 !! wikitext
12083 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12084 !! html
12085 <table><tr><td>foo</td></tr></table>
12086
12087 !!end
12088
12089 !!test
12090 Templates: HTML Tables: 3. Generating end of a HTML table
12091 !! wikitext
12092 <table><tr>{{echo|<td>foo</td></tr></table>}}
12093 !! html
12094 <table><tr><td>foo</td></tr></table>
12095
12096 !!end
12097
12098 !!test
12099 Templates: HTML Tables: 4a. Generating a single tag 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: 4b. Generating a single tag of a HTML table
12109 !! wikitext
12110 <table>{{echo|<tr>}}<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: 4c. Generating a single tag of a HTML table
12118 !! wikitext
12119 <table><tr>{{echo|<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: 4d. Generating a single tag of a HTML table
12127 !! wikitext
12128 <table><tr><td>foo{{echo|</td>}}</tr></table>
12129 !! html
12130 <table><tr><td>foo</td></tr></table>
12131
12132 !!end
12133
12134 !!test
12135 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12136 !! wikitext
12137 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12138 !! html
12139 <table><tr><td>foo</td></tr></table>
12140
12141 !!end
12142
12143 !!test
12144 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12145 !! wikitext
12146 <table><tr><td>foo</td></tr>{{echo|</table>}}
12147 !! html
12148 <table><tr><td>foo</td></tr></table>
12149
12150 !!end
12151
12152 !!test
12153 Templates: HTML Tables: 5. Proper fostering of categories from inside
12154 !!options
12155 parsoid=wt2html,wt2wt
12156 !! wikitext
12157 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12158 <!--Two categories (Bug 50330)-->
12159 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12160 !! html
12161 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12162 <!--Two categories (Bug 50330)-->
12163 <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>
12164 !!end
12165
12166 !!test
12167 Templates: Wiki Tables: 1a. Fostering of entire template content
12168 !! wikitext
12169 {|
12170 {{echo|a}}
12171 |}
12172 !! html
12173 <table>
12174 a
12175 <tr><td></td></tr></table>
12176
12177 !! html+tidy
12178 <p>a</p>
12179 <table>
12180 <tr>
12181 <td></td>
12182 </tr>
12183 </table>
12184 !! end
12185
12186 !!test
12187 Templates: Wiki Tables: 1b. Fostering of entire template content
12188 !! wikitext
12189 {|
12190 {{echo|<div>}}
12191 foo
12192 {{echo|</div>}}
12193 |}
12194 !! html
12195 <table>
12196 <div>
12197 <p>foo
12198 </p>
12199 </div>
12200 <tr><td></td></tr></table>
12201
12202 !! html+tidy
12203 <div>
12204 <p>foo</p>
12205 </div>
12206 <table>
12207 <tr>
12208 <td></td>
12209 </tr>
12210 </table>
12211 !! end
12212
12213 !!test
12214 Templates: Wiki Tables: 2. Fostering of partial template content
12215 !! wikitext
12216 {|
12217 {{echo|a
12218 <div>b</div>}}
12219 |}
12220 !! html
12221 <table>
12222 a
12223 <div>b</div>
12224 <tr><td></td></tr></table>
12225
12226 !! html+tidy
12227 <p>a</p>
12228 <div>b</div>
12229 <table>
12230 <tr>
12231 <td></td>
12232 </tr>
12233 </table>
12234 !! end
12235
12236 !!test
12237 Templates: Wiki Tables: 3. td-content via multiple templates
12238 !! wikitext
12239 {|
12240 {{echo|{{pipe}}a}}{{echo|b}}
12241 |}
12242 !! html
12243 <table>
12244 <tr>
12245 <td>ab
12246 </td></tr></table>
12247
12248 !!end
12249
12250 !!test
12251 Templates: Wiki Tables: 4. Templated tags, no content
12252 !! wikitext
12253 {{tbl-start}}
12254 {{tbl-end}}
12255 !! html
12256 <table>
12257 <tr><td></td></tr></table>
12258
12259 !!end
12260
12261 !!test
12262 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12263 !! wikitext
12264 {{tbl-start}}
12265 |foo
12266 {{tbl-end}}
12267 !! html
12268 <table>
12269 <tr>
12270 <td>foo
12271 </td></tr></table>
12272
12273 !!end
12274
12275 !!test
12276 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12277 !! wikitext
12278 {{tbl-start}}
12279 {{!}}foo
12280 {{tbl-end}}
12281 !! html
12282 <table>
12283 <tr>
12284 <td>foo
12285 </td></tr></table>
12286
12287 !!end
12288
12289 ## This test case is very specific to Parsoid's internals
12290 ## and is hence only tested for Parsoid's code. Parsoid uses
12291 ## a <meta> marker tag for <ref> tags and they are expanded
12292 ## much later. We are verifying that this <meta> tag usage
12293 ## doesn't prevent foster parenting.
12294 !!test
12295 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12296 !!wikitext
12297 {{PartialTable}}<ref>foo</ref>
12298 |}
12299
12300 <references />
12301 !!html/parsoid
12302 <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">
12303 <tbody>
12304 </tbody></table>
12305
12306 <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>
12307 !!end
12308
12309 !! test
12310 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12311 !! wikitext
12312 {{echo|
12313 {{{!}}
12314 {{!}}-}}
12315 <onlyinclude>
12316 |foo
12317 </onlyinclude>
12318 {{!}}}
12319 !! html/parsoid
12320 <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{{!}}}"]}'>
12321 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12322 <tbody><tr>
12323
12324 <td>foo
12325 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12326 </tbody></table>
12327 !! end
12328
12329 !!test
12330 Templates: Lists: Multi-line list-items via templates
12331 !! wikitext
12332 *{{echo|a {{nonexistent|
12333 unused}}}}
12334 *{{echo|b {{nonexistent|
12335 unused}}}}
12336 !! html
12337 <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>
12338 <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>
12339
12340 !!end
12341
12342 !!test
12343 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12344 !! wikitext
12345 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12346 !! html
12347 <p><i>ab</i>c<i>d</i>e
12348 </p>
12349 !!end
12350
12351 !!test
12352 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12353 (PHP parser generates misnested html)
12354 !! wikitext
12355 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12356 !! html/parsoid
12357 <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>
12358 !!end
12359
12360 !!test
12361 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12362 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12363 !! options
12364 parsoid=wt2html,wt2wt
12365 !! wikitext
12366 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12367 !! html
12368 <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>
12369 <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>
12370 <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>
12371 !!end
12372
12373 !!test
12374 Templates: Ugly nesting: 4. Divs opened/closed across templates
12375 !! wikitext
12376 a<div>b{{echo|c</div>d}}e
12377 !! html
12378 a<div>bc</div>de
12379
12380 !! html+tidy
12381 <p>a</p>
12382 <div>bc</div>
12383 <p>de</p>
12384 !! end
12385
12386 !!test
12387 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12388 (Parsoid-centric)
12389 !! options
12390 parsoid
12391 !! wikitext
12392 {|
12393 |{{echo|foo</table>}}
12394 |bar
12395 |}
12396 !! html
12397 <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|}"]}'>
12398
12399 <tbody>
12400 <tr>
12401 <td>foo</td></tr></tbody></table><span about="#mwt1">
12402 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12403 |}</span>
12404 !!end
12405
12406 !!test
12407 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12408 (Parsoid-centric)
12409 !! options
12410 parsoid
12411 !! wikitext
12412 <table>
12413 <tr>
12414 <td>
12415 <table>
12416 <tr>
12417 <td>1. {{echo|foo </table>}}</td>
12418 <td> bar </td>
12419 <td>2. {{echo|baz </table>}}</td>
12420 </tr>
12421 <tr>
12422 <td>abc</td>
12423 </tr>
12424 </table>
12425 </td>
12426 </tr>
12427 <tr>
12428 <td>xyz</td>
12429 </tr>
12430 </table>
12431 !! html
12432 <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>"]}'>
12433 <tbody><tr>
12434 <td>
12435 <table>
12436 <tbody><tr>
12437 <td>1. foo </td></tr></tbody></table></td>
12438 <td> bar </td>
12439 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12440 </span><span about="#mwt2">
12441 </span><span about="#mwt2">
12442 </span><span about="#mwt2">abc</span><span about="#mwt2">
12443 </span><span about="#mwt2">
12444 </span><span about="#mwt2">
12445 </span><span about="#mwt2">
12446 </span><span about="#mwt2">
12447 </span><span about="#mwt2">
12448 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12449 </span><span about="#mwt2">
12450 </span>
12451 !!end
12452
12453 !! test
12454 Templates: Ugly templates: 3. newline-only template parameter
12455 !! wikitext
12456 foo {{echo|
12457 }}
12458 !! html
12459 <p>foo
12460 </p>
12461 !! end
12462
12463 # This looks like a bug: a single newline triggers p/br for some reason.
12464 !! test
12465 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12466 !! wikitext
12467 {{echo|
12468 }}
12469 !! html
12470 <p><br />
12471 </p>
12472 !! end
12473
12474 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12475 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12476 !! test
12477 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12478 !! wikitext
12479 {{echo|<table>}}
12480 {{echo|<div>foo}}
12481 {{echo|</table>}}
12482 !! html/parsoid
12483 <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
12484 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12485 </table>
12486 !! end
12487
12488 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12489 # that are "identical" and generate nesting cycles in the algorithm
12490 !! test
12491 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12492 !! wikitext
12493 {{echo|<table><tr><td><table>}}
12494 {{echo|<div>}}
12495 {{echo|</div>}}
12496 !! html/parsoid
12497 <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"}'>
12498 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12499 </table></td></tr></tbody></table>
12500 !! end
12501
12502 !! test
12503 Templates: Parameters substituted at the top-level
12504 !! wikitext
12505 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12506 !! html/php
12507 <p><i>who</i> me? <b>never!</b>
12508 </p>
12509 !! html/parsoid
12510 <p about="#mwt2" typeof="mw:Param" data-parsoid="{&quot;src&quot;:&quot;{{{foo|''who'' {{echo|me}}? '''never!'''}}}&quot;}"><i>who</i> me? <b>never!</b></p>
12511 !! end
12512
12513 !!test
12514 Parser Functions: 1. Simple example
12515 !! wikitext
12516 {{uc:foo}}
12517 !! html
12518 <p>FOO
12519 </p>
12520 !!end
12521
12522 !!test
12523 Parser Functions: 2. Nested use (only outermost should be marked up)
12524 !! wikitext
12525 {{uc:{{lc:FOO}}}}
12526 !! html
12527 <p>FOO
12528 </p>
12529 !!end
12530
12531 ###
12532 ### Pre-save transform tests
12533 ###
12534 !! test
12535 pre-save transform: subst:
12536 !! options
12537 pst
12538 !! wikitext
12539 {{subst:test}}
12540 !! html/php
12541 This is a test template
12542 !! end
12543
12544 !! test
12545 pre-save transform: normal template
12546 !! options
12547 pst
12548 !! wikitext
12549 {{test}}
12550 !! html/php
12551 {{test}}
12552 !! end
12553
12554 !! test
12555 pre-save transform: nonexistent template
12556 !! options
12557 pst
12558 !! wikitext
12559 {{thistemplatedoesnotexist}}
12560 !! html/php
12561 {{thistemplatedoesnotexist}}
12562 !! end
12563
12564 !! test
12565 pre-save transform: subst magic variables
12566 !! options
12567 pst
12568 !! wikitext
12569 {{subst:SITENAME}}
12570 !! html/php
12571 MediaWiki
12572 !! end
12573
12574 # This is bug 89, which I fixed. -- wtm
12575 !! test
12576 pre-save transform: subst: templates with parameters
12577 !! options
12578 pst
12579 !! wikitext
12580 {{subst:paramtest|param="something else"}}
12581 !! html/php
12582 This is a test template with parameter "something else"
12583 !! end
12584
12585 !! article
12586 Template:nowikitest
12587 !! text
12588 <nowiki>'''not wiki'''</nowiki>
12589 !! endarticle
12590
12591 !! test
12592 pre-save transform: nowiki in subst (bug 1188)
12593 !! options
12594 pst
12595 !! wikitext
12596 {{subst:nowikitest}}
12597 !! html/php
12598 <nowiki>'''not wiki'''</nowiki>
12599 !! end
12600
12601 !! article
12602 Template:commenttest
12603 !! text
12604 This template has <!-- a comment --> in it.
12605 !! endarticle
12606
12607 !! test
12608 pre-save transform: comment in subst (bug 1936)
12609 !! options
12610 pst
12611 !! wikitext
12612 {{subst:commenttest}}
12613 !! html/php
12614 This template has <!-- a comment --> in it.
12615 !! end
12616
12617 !! test
12618 pre-save transform: unclosed tag
12619 !! options
12620 pst
12621 !! wikitext
12622 <nowiki>'''not wiki'''
12623 !! html/php
12624 <nowiki>'''not wiki'''
12625 !! end
12626
12627 !! test
12628 pre-save transform: mixed tag case
12629 !! options
12630 pst
12631 !! wikitext
12632 <NOwiki>'''not wiki'''</noWIKI>
12633 !! html/php
12634 <NOwiki>'''not wiki'''</noWIKI>
12635 !! end
12636
12637 !! test
12638 pre-save transform: unclosed comment in <nowiki>
12639 !! options
12640 pst
12641 !! wikitext
12642 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12643 !! html/php
12644 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12645 !!end
12646
12647 # Leading @ in this template definition works around a limitation
12648 # in parsoid's parserTests which otherwise strips the <span> from the
12649 # result (confusing it for a template wrapper)
12650 !! article
12651 Template:dangerous
12652 !!text
12653 @<span onmouseover="alert('crap')">Oh no</span>
12654 !!endarticle
12655
12656 !!test
12657 (confirming safety of fix for subst bug 1936)
12658 !! wikitext
12659 {{Template:dangerous}}
12660 !! html
12661 <p>@<span>Oh no</span>
12662 </p>
12663 !! end
12664
12665 !! test
12666 pre-save transform: comment containing gallery (bug 5024)
12667 !! options
12668 pst
12669 !! wikitext
12670 <!-- <gallery>data</gallery> -->
12671 !! html/php
12672 <!-- <gallery>data</gallery> -->
12673 !!end
12674
12675 !! test
12676 pre-save transform: comment containing extension
12677 !! options
12678 pst
12679 !! wikitext
12680 <!-- <tag>data</tag> -->
12681 !! html/php
12682 <!-- <tag>data</tag> -->
12683 !!end
12684
12685 !! test
12686 pre-save transform: comment containing nowiki
12687 !! options
12688 pst
12689 !! wikitext
12690 <!-- <nowiki>data</nowiki> -->
12691 !! html/php
12692 <!-- <nowiki>data</nowiki> -->
12693 !!end
12694
12695 !! test
12696 pre-save transform: <noinclude> in subst (bug 3298)
12697 !! options
12698 pst
12699 !! wikitext
12700 {{subst:Includes}}
12701 !! html/php
12702 Foobar
12703 !! end
12704
12705 !! test
12706 pre-save transform: <onlyinclude> in subst (bug 3298)
12707 !! options
12708 pst
12709 !! wikitext
12710 {{subst:Includes2}}
12711 !! html/php
12712 Foo
12713 !! end
12714
12715 !! article
12716 Template:SubstTest
12717 !!text
12718 {{<includeonly>subst:</includeonly>Includes}}
12719 !! endarticle
12720
12721 !! article
12722 Template:SafeSubstTest
12723 !! text
12724 {{<includeonly>safesubst:</includeonly>Includes}}
12725 !! endarticle
12726
12727 !! test
12728 bug 22297: safesubst: works during PST
12729 !! options
12730 pst
12731 !! wikitext
12732 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12733 !! html/php
12734 FoobarFoobar
12735 !! end
12736
12737 !! test
12738 bug 22297: safesubst: works during normal parse
12739 !! wikitext
12740 {{SafeSubstTest}}
12741 !! html
12742 <p>Foobar
12743 </p>
12744 !! end
12745
12746 !! test
12747 subst: does not work during normal parse
12748 !! wikitext
12749 {{SubstTest}}
12750 !! html
12751 <p>{{subst:Includes}}
12752 </p>
12753 !! end
12754
12755 !! test
12756 pre-save transform: context links ("pipe trick")
12757 !! options
12758 pst
12759 !! wikitext
12760 [[Article (context)|]]
12761 [[Bar:Article|]]
12762 [[:Bar:Article|]]
12763 [[Bar:Article (context)|]]
12764 [[:Bar:Article (context)|]]
12765 [[|Article]]
12766 [[|Article (context)]]
12767 [[Bar:X (Y) Z|]]
12768 [[:Bar:X (Y) Z|]]
12769 !! html/php
12770 [[Article (context)|Article]]
12771 [[Bar:Article|Article]]
12772 [[:Bar:Article|Article]]
12773 [[Bar:Article (context)|Article]]
12774 [[:Bar:Article (context)|Article]]
12775 [[Article]]
12776 [[Article (context)]]
12777 [[Bar:X (Y) Z|X (Y) Z]]
12778 [[:Bar:X (Y) Z|X (Y) Z]]
12779 !! end
12780
12781 !! test
12782 pre-save transform: context links ("pipe trick") with interwiki prefix
12783 !! options
12784 pst
12785 !! wikitext
12786 [[interwiki:Article|]]
12787 [[:interwiki:Article|]]
12788 [[interwiki:Bar:Article|]]
12789 [[:interwiki:Bar:Article|]]
12790 !! html/php
12791 [[interwiki:Article|Article]]
12792 [[:interwiki:Article|Article]]
12793 [[interwiki:Bar:Article|Bar:Article]]
12794 [[:interwiki:Bar:Article|Bar:Article]]
12795 !! end
12796
12797 !! test
12798 pre-save transform: context links ("pipe trick") with parens in title
12799 !! options
12800 pst title=[[Somearticle (context)]]
12801 !! wikitext
12802 [[|Article]]
12803 !! html/php
12804 [[Article (context)|Article]]
12805 !! end
12806
12807 !! test
12808 pre-save transform: context links ("pipe trick") with comma in title
12809 !! options
12810 pst title=[[Someplace, Somewhere]]
12811 !! wikitext
12812 [[|Otherplace]]
12813 [[Otherplace, Elsewhere|]]
12814 [[Otherplace, Elsewhere, Anywhere|]]
12815 !! html/php
12816 [[Otherplace, Somewhere|Otherplace]]
12817 [[Otherplace, Elsewhere|Otherplace]]
12818 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12819 !! end
12820
12821 !! test
12822 pre-save transform: context links ("pipe trick") with parens and comma
12823 !! options
12824 pst title=[[Someplace (IGNORED), Somewhere]]
12825 !! wikitext
12826 [[|Otherplace]]
12827 [[Otherplace (place), Elsewhere|]]
12828 !! html/php
12829 [[Otherplace, Somewhere|Otherplace]]
12830 [[Otherplace (place), Elsewhere|Otherplace]]
12831 !! end
12832
12833 !! test
12834 pre-save transform: context links ("pipe trick") with comma and parens
12835 !! options
12836 pst title=[[Who, me? (context)]]
12837 !! wikitext
12838 [[|Yes, you.]]
12839 [[Me, Myself, and I (1937 song)|]]
12840 !! html/php
12841 [[Yes, you. (context)|Yes, you.]]
12842 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12843 !! end
12844
12845 !! test
12846 pre-save transform: context links ("pipe trick") with namespace
12847 !! options
12848 pst title=[[Ns:Somearticle]]
12849 !! wikitext
12850 [[|Article]]
12851 !! html/php
12852 [[Ns:Article|Article]]
12853 !! end
12854
12855 !! test
12856 pre-save transform: context links ("pipe trick") with namespace and parens
12857 !! options
12858 pst title=[[Ns:Somearticle (context)]]
12859 !! wikitext
12860 [[|Article]]
12861 !! html/php
12862 [[Ns:Article (context)|Article]]
12863 !! end
12864
12865 !! test
12866 pre-save transform: context links ("pipe trick") with namespace and comma
12867 !! options
12868 pst title=[[Ns:Somearticle, Context, Whatever]]
12869 !! wikitext
12870 [[|Article]]
12871 !! html/php
12872 [[Ns:Article, Context, Whatever|Article]]
12873 !! end
12874
12875 !! test
12876 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12877 !! options
12878 pst title=[[Ns:Somearticle, Context (context)]]
12879 !! wikitext
12880 [[|Article]]
12881 !! html/php
12882 [[Ns:Article (context)|Article]]
12883 !! end
12884
12885 !! test
12886 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12887 !! options
12888 pst title=[[Ns:Somearticle (IGNORED), Context]]
12889 !! wikitext
12890 [[|Article]]
12891 !! html/php
12892 [[Ns:Article, Context|Article]]
12893 !! end
12894
12895 !! test
12896 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12897 !! options
12898 pst
12899 !! wikitext
12900 [[Article(context)|]]
12901 [[Bar:Article(context)|]]
12902 [[:Bar:Article(context)|]]
12903 [[|Article(context)]]
12904 [[Bar:X(Y)Z|]]
12905 [[:Bar:X(Y)Z|]]
12906 !! html/php
12907 [[Article(context)|Article]]
12908 [[Bar:Article(context)|Article]]
12909 [[:Bar:Article(context)|Article]]
12910 [[Article(context)]]
12911 [[Bar:X(Y)Z|X(Y)Z]]
12912 [[:Bar:X(Y)Z|X(Y)Z]]
12913 !! end
12914
12915 !! test
12916 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12917 !! options
12918 pst
12919 !! wikitext
12920 [[Article (context)|]]
12921 [[Bar:Article (context)|]]
12922 [[:Bar:Article (context)|]]
12923 [[|Article (context)]]
12924 [[Bar:X (Y) Z|]]
12925 [[:Bar:X (Y) Z|]]
12926 !! html/php
12927 [[Article (context)|Article]]
12928 [[Bar:Article (context)|Article]]
12929 [[:Bar:Article (context)|Article]]
12930 [[Article (context)]]
12931 [[Bar:X (Y) Z|X (Y) Z]]
12932 [[:Bar:X (Y) Z|X (Y) Z]]
12933 !! end
12934
12935 !! test
12936 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12937 !! options
12938 pst
12939 !! wikitext
12940 [[Article(context)|]]
12941 [[Bar:Article(context)|]]
12942 [[:Bar:Article(context)|]]
12943 [[|Article(context)]]
12944 [[Bar:X(Y)Z|]]
12945 [[:Bar:X(Y)Z|]]
12946 !! html/php
12947 [[Article(context)|Article]]
12948 [[Bar:Article(context)|Article]]
12949 [[:Bar:Article(context)|Article]]
12950 [[Article(context)]]
12951 [[Bar:X(Y)Z|X(Y)Z]]
12952 [[:Bar:X(Y)Z|X(Y)Z]]
12953 !! end
12954
12955 !! test
12956 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12957 !! options
12958 pst
12959 !! wikitext
12960 [[Article (context), context|]]
12961 [[Article (context),context|]]
12962 [[Bar:Article (context), context|]]
12963 [[Bar:Article (context),context|]]
12964 [[:Bar:Article (context), context|]]
12965 [[:Bar:Article (context),context|]]
12966 !! html/php
12967 [[Article (context), context|Article]]
12968 [[Article (context),context|Article]]
12969 [[Bar:Article (context), context|Article]]
12970 [[Bar:Article (context),context|Article]]
12971 [[:Bar:Article (context), context|Article]]
12972 [[:Bar:Article (context),context|Article]]
12973 !! end
12974
12975 !! test
12976 pre-save transform: trim trailing empty lines
12977 !! options
12978 pst
12979 !! wikitext
12980 Empty lines are trimmed
12981
12982
12983
12984
12985 !! html/php
12986 Empty lines are trimmed
12987 !! end
12988
12989 !! test
12990 pre-save transform: Signature expansion
12991 !! options
12992 pst
12993 !! wikitext
12994 * ~~~
12995 * <noinclude>~~~</noinclude>
12996 * <includeonly>~~~</includeonly>
12997 * <onlyinclude>~~~</onlyinclude>
12998 !! html/php
12999 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13000 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13001 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13002 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13003 !! end
13004
13005
13006 !! test
13007 pre-save transform: Signature expansion in nowiki tags (bug 93)
13008 !! options
13009 pst disabled
13010 !! wikitext
13011 Shall not expand:
13012
13013 <nowiki>~~~~</nowiki>
13014
13015 <includeonly><nowiki>~~~~</nowiki></includeonly>
13016
13017 <noinclude><nowiki>~~~~</nowiki></noinclude>
13018
13019 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13020
13021 {{subst:Foo}} shall be converted to FOO
13022
13023 As well as inside noinclude/onlyinclude
13024 <noinclude>{{subst:Foo}}</noinclude>
13025 <onlyinclude>{{subst:Foo}}</onlyinclude>
13026
13027 But not inside includeonly
13028 <includeonly>{{subst:Foo}}</includeonly>
13029 !! html/php
13030 Shall not expand:
13031
13032 <nowiki>~~~~</nowiki>
13033
13034 <includeonly><nowiki>~~~~</nowiki></includeonly>
13035
13036 <noinclude><nowiki>~~~~</nowiki></noinclude>
13037
13038 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13039
13040 FOO shall be converted to FOO
13041
13042 As well as inside noinclude/onlyinclude
13043 <noinclude>FOO</noinclude>
13044 <onlyinclude>FOO</onlyinclude>
13045
13046 But not inside includeonly
13047 <includeonly>{{subst:Foo}}</includeonly>
13048 !! end
13049
13050 !! test
13051 Parsoid: Recognize nowiki with trailing space in tags
13052 !! options
13053 parsoid=wt2html
13054 !! wikitext
13055 <nowiki ><div>[[foo]]</nowiki >
13056
13057 a<nowiki / >b
13058
13059 c<nowiki />d
13060
13061 e<nowiki/ >f
13062 !! html
13063 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13064 <p>ab</p>
13065 <p>cd</p>
13066 <p>ef</p>
13067 !! end
13068
13069 !! test
13070 Parsoid: Recognize nowiki with odd capitalization
13071 !! options
13072 parsoid=wt2html
13073 !! wikitext
13074 <noWikI ><div>[[foo]]</Nowiki >
13075 !! html
13076 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13077 !! end
13078
13079
13080 !! test
13081 Parsoid: Escape nowiki with trailing space in tags
13082 !! options
13083 parsoid=html2wt
13084 !! html/parsoid
13085 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13086 <p>a&lt;nowiki /&gt;b</p>
13087 <p>c&lt;nowiki/ &gt;d</p>
13088 !! wikitext
13089 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13090
13091 a&lt;nowiki /&gt;b
13092
13093 c&lt;nowiki/ &gt;d
13094 !! end
13095
13096 !! test
13097 Parsoid: Escape weird noWikI capitalizations
13098 !! options
13099 parsoid=html2wt
13100 !! html/parsoid
13101 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13102 !! wikitext
13103 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13104 !! end
13105
13106 ###
13107 ### Message transform tests
13108 ###
13109 !! test
13110 message transform: magic variables
13111 !! options
13112 msg
13113 !! wikitext
13114 {{SITENAME}}
13115 !! html
13116 MediaWiki
13117 !! end
13118
13119 !! test
13120 message transform: should not transform wiki markup
13121 !! options
13122 msg
13123 !! wikitext
13124 ''test''
13125 !! html
13126 ''test''
13127 !! end
13128
13129 !! test
13130 message transform: <noinclude> in transcluded template (bug 4926)
13131 !! options
13132 msg
13133 !! wikitext
13134 {{Includes}}
13135 !! html
13136 Foobar
13137 !! end
13138
13139 !! test
13140 message transform: <onlyinclude> in transcluded template (bug 4926)
13141 !! options
13142 msg
13143 !! wikitext
13144 {{Includes2}}
13145 !! html
13146 Foo
13147 !! end
13148
13149 !! test
13150 {{#special:}} page name, known
13151 !! options
13152 msg
13153 !! wikitext
13154 {{#special:Recentchanges}}
13155 !! html
13156 Special:RecentChanges
13157 !! end
13158
13159 !! test
13160 {{#special:}} page name with subpage, known
13161 !! options
13162 msg
13163 !! wikitext
13164 {{#special:Recentchanges/param}}
13165 !! html
13166 Special:RecentChanges/param
13167 !! end
13168
13169 !! test
13170 {{#special:}} page name, unknown
13171 !! options
13172 msg
13173 !! wikitext
13174 {{#special:foobar nonexistent}}
13175 !! html
13176 Special:Foobar nonexistent
13177 !! end
13178
13179 !! test
13180 {{#speciale:}} page name, known
13181 !! options
13182 msg
13183 !! wikitext
13184 {{#speciale:Recentchanges}}
13185 !! html
13186 Special:RecentChanges
13187 !! end
13188
13189 !! test
13190 {{#speciale:}} page name with subpage, known
13191 !! options
13192 msg
13193 !! wikitext
13194 {{#speciale:Recentchanges/param}}
13195 !! html
13196 Special:RecentChanges/param
13197 !! end
13198
13199 !! test
13200 {{#speciale:}} page name, unknown
13201 !! options
13202 msg
13203 !! wikitext
13204 {{#speciale:foobar nonexistent}}
13205 !! html
13206 Special:Foobar_nonexistent
13207 !! end
13208
13209 ###
13210 ### Images
13211 ###
13212 ### For Parsoid-specific tests, see
13213 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13214
13215 !! test
13216 Simple image
13217 !! options
13218 parsoid=wt2html,wt2wt,html2html
13219 !! wikitext
13220 [[Image:foobar.jpg]]
13221 !! html/php
13222 <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>
13223 </p>
13224 !! html/parsoid
13225 <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>
13226 !! end
13227
13228 !! test
13229 Simple image (using File: namespace, now canonical)
13230 !! wikitext
13231 [[File:Foobar.jpg]]
13232 !! html/php
13233 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13234 </p>
13235 !! html/parsoid
13236 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13237 !! end
13238
13239 !! test
13240 Right-aligned image
13241 !! wikitext
13242 [[File:Foobar.jpg|right]]
13243 !! html/php
13244 <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>
13245
13246 !! html/parsoid
13247 <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>
13248 !! end
13249
13250 !! test
13251 Image with caption
13252 !! wikitext
13253 [[File:Foobar.jpg|right|Caption text]]
13254 !! html/php
13255 <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>
13256
13257 !! html/parsoid
13258 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
13259 !! end
13260
13261 !! test
13262 Image with caption, bug 53312 #1
13263 !! wikitext
13264 [[File:Foobar.jpg|right|Caption page stuff]]
13265 !! html/php
13266 <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>
13267
13268 !! html/parsoid
13269 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page stuff</figcaption></figure>
13270 !! end
13271
13272 !! test
13273 Image with caption, bug 53312 #2
13274 !! wikitext
13275 [[File:Foobar.jpg|right|Caption page=]]
13276 !! html/php
13277 <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>
13278
13279 !! html/parsoid
13280 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=</figcaption></figure>
13281 !! end
13282
13283 !! test
13284 Image with caption, bug 53312 #3
13285 !! wikitext
13286 [[File:Foobar.jpg|right|Caption page=stuff]]
13287 !! html/php
13288 <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>
13289
13290 !! html/parsoid
13291 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=stuff</figcaption></figure>
13292 !! end
13293
13294 !! test
13295 Allow empty links in image captions (Bug 60753)
13296 !! options
13297 thumbsize=220
13298 !! wikitext
13299 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13300 [[]]
13301 [[Link2]]
13302 ]]
13303 !! html/php
13304 <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>
13305
13306 !! html/parsoid
13307 <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>
13308 [[]]
13309 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13310 </figcaption></figure>
13311 !! end
13312
13313 !! test
13314 Titles in unlinked images (T23454)
13315 !! wikitext
13316 [[File:Foobar.jpg|link=|stuff]]
13317 !! html/php
13318 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13319 </p>
13320 !! end
13321
13322 !! test
13323 Link with empty target
13324 !! wikitext
13325 [[]]
13326 !! html
13327 <p>[[]]
13328 </p>
13329 !! end
13330
13331 !! test
13332 Image with link trail
13333 !! wikitext
13334 Linktrails should not work for images: [[File:Foobar.jpg]]s
13335 !! html/php
13336 <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
13337 </p>
13338 !! html/parsoid
13339 <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>
13340 !! end
13341
13342 !! test
13343 Image with empty attribute
13344 !! options
13345 parsoid=wt2html,wt2wt,html2html
13346 !! wikitext
13347 [[File:Foobar.jpg|right||Caption text]]
13348 !! html/php
13349 <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>
13350
13351 !! html/parsoid
13352 <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>
13353 !! end
13354
13355 !! test
13356 1. Block image with individual attributes from templates
13357 !! wikitext
13358 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13359 !! html/php
13360 <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>
13361
13362 !! html/parsoid
13363 <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>
13364 !! end
13365
13366 !! test
13367 2. Block Image with individual attributes from templates
13368 !! wikitext
13369 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13370 !! html/php
13371 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
13372
13373 !! html/parsoid
13374 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#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>
13375 !! end
13376
13377 !! test
13378 3. Inline image with individual attributes from templates
13379 !! wikitext
13380 [[File:Foobar.jpg|{{echo|50px}}]]
13381 !! html/php
13382 <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>
13383 </p>
13384 !! html/parsoid
13385 <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>
13386 !! end
13387
13388 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13389 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13390 !! test
13391 Image with multiple attributes from the same template
13392 !! wikitext
13393 [[File:Foobar.jpg|{{image_attribs}}]]
13394 !! html/php
13395 <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>
13396
13397 !! html/parsoid
13398 <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>
13399 !! end
13400
13401 !! test
13402 Image with link tails
13403 !! options
13404 thumbsize=220
13405 !! wikitext
13406 123[[File:Foobar.jpg]]456
13407 123[[File:Foobar.jpg|right]]456
13408 123[[File:Foobar.jpg|thumb]]456
13409 !! html/php
13410 <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
13411 </p>
13412 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
13413 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
13414
13415 !! html/php+tidy
13416 <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>
13417 <p>123</p>
13418 <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>
13419 <p>456 123</p>
13420 <div class="thumb tright">
13421 <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>
13422 <div class="thumbcaption">
13423 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13424 </div>
13425 </div>
13426 </div>
13427 <p>456</p>
13428 !! html/parsoid
13429 <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>
13430 <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>
13431 <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>
13432 !! end
13433
13434 !! test
13435 Image with multiple captions -- only last one is accepted
13436 !! wikitext
13437 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13438 !! html/php
13439 <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>
13440
13441 !! html/parsoid
13442 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption3 - accepted</figcaption></figure>
13443 !! end
13444
13445 !! test
13446 Image with multiple widths -- use last
13447 !! wikitext
13448 [[File:Foobar.jpg|200px|300px|caption]]
13449 !! html/php
13450 <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>
13451 </p>
13452 !! html/parsoid
13453 <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>
13454 !! end
13455
13456 !! test
13457 Image with multiple alignments -- use first (bug 48664)
13458 !! options
13459 thumbsize=220
13460 !! wikitext
13461 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13462
13463 [[File:Foobar.jpg|middle|text-top|caption]]
13464 !! html/php
13465 <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>
13466 <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>
13467 </p>
13468 !! html/parsoid
13469 <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>
13470 <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>
13471 !! end
13472
13473 !! test
13474 Image with width attribute at different positions
13475 !! wikitext
13476 [[File:Foobar.jpg|200px|right|Caption]]
13477 [[File:Foobar.jpg|right|200px|Caption]]
13478 [[File:Foobar.jpg|right|Caption|200px]]
13479 !! html/php
13480 <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>
13481 <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>
13482 <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>
13483
13484 !! html/parsoid
13485 <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>
13486 <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>
13487 <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>
13488 !! end
13489
13490 # a sad bit of backward-compatibility
13491 !! test
13492 Image with size specified with pxpx (bug 13500, 51628)
13493 !! options
13494 parsoid=wt2html,wt2wt,html2html
13495 !! wikitext
13496 [[File:Foobar.jpg|20pxpx]]
13497 [[File:Foobar.jpg|200x20pxpx]]
13498 !! html/php
13499 <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>
13500 <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>
13501 </p>
13502 !! html/parsoid
13503 <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>
13504 !! end
13505
13506 !! test
13507 Image with link parameter, wiki target
13508 !! wikitext
13509 [[File:Foobar.jpg|link=Main Page]]
13510 !! html/php
13511 <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>
13512 </p>
13513 !! html/parsoid
13514 <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>
13515 !! end
13516
13517 # parsoid bug 49293 (part 1)
13518 !! test
13519 Image with link parameter, URL target
13520 !! wikitext
13521 [[File:Foobar.jpg|link=http://example.com/]]
13522 !! html/php
13523 <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>
13524 </p>
13525 !! html/parsoid
13526 <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>
13527 !! end
13528
13529 # parsoid bug 49293 (part 2)
13530 !! test
13531 Image with link parameter, protocol-less URL target
13532 !! wikitext
13533 [[File:Foobar.jpg|link=//example.com/]]
13534 !! html/php
13535 <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>
13536 </p>
13537 !! html/parsoid
13538 <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>
13539 !! end
13540
13541 !! test
13542 Escaping non-block captions (T107435)
13543 !! options
13544 parsoid={
13545 "modes": ["wt2wt"],
13546 "changes": [
13547 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13548 ]
13549 }
13550 !! wikitext
13551 [[Image:Foobar.jpg|caption]]
13552 !! wikitext/edited
13553 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13554 !! end
13555
13556 # wgExternalLinkTarget not supported by Parsoid
13557 !! test
13558 Image with link parameter, wgExternalLinkTarget
13559 !! wikitext
13560 [[Image:foobar.jpg|link=http://example.com/]]
13561 !! config
13562 wgExternalLinkTarget='foobar'
13563 !! html/php
13564 <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>
13565 </p>
13566 !! end
13567
13568 !! test
13569 Image with link parameter, wgNoFollowLinks set to false
13570 !! wikitext
13571 [[Image:foobar.jpg|link=http://example.com/]]
13572 !! config
13573 wgNoFollowLinks=false
13574 !! html
13575 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13576 </p>
13577 !! end
13578
13579 !! test
13580 Image with link parameter, wgNoFollowDomainExceptions
13581 !! wikitext
13582 [[Image:foobar.jpg|link=http://example.com/]]
13583 !! config
13584 wgNoFollowDomainExceptions='example.com'
13585 !! html
13586 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13587 </p>
13588 !! end
13589
13590 # wgExternalLinkTarget not supported by Parsoid
13591 !! test
13592 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13593 !! wikitext
13594 [[Image:foobar.jpg|link=http://example.com/|Title]]
13595 !! config
13596 wgExternalLinkTarget='foobar'
13597 !! html/php
13598 <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>
13599 </p>
13600 !! end
13601
13602 !! test
13603 Image with empty link parameter
13604 !! wikitext
13605 [[File:Foobar.jpg|link=]]
13606 !! html/php
13607 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13608 </p>
13609 !! html/parsoid
13610 <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>
13611 !! end
13612
13613 !! test
13614 Image with link parameter (wiki target) and unnamed parameter
13615 !! wikitext
13616 [[File:Foobar.jpg|link=Main_Page|Title]]
13617 !! html/php
13618 <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>
13619 </p>
13620 !! html/parsoid
13621 <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>
13622 !! end
13623
13624 !! test
13625 Image with link parameter (URL target) and unnamed parameter
13626 !! wikitext
13627 [[File:Foobar.jpg|link=http://example.com/|Title]]
13628 !! html/php
13629 <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>
13630 </p>
13631 !! html/parsoid
13632 <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>
13633 !! end
13634
13635 !! test
13636 Thumbnail image with link parameter
13637 !! options
13638 thumbsize=220
13639 parsoid=wt2html,wt2wt,html2html
13640 !! wikitext
13641 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13642 !! html/php
13643 <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>
13644
13645 !! html/parsoid
13646 <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>
13647 !! end
13648
13649 !! test
13650 Manually-specified thumbnail image
13651 !! options
13652 thumbsize=220
13653 !! wikitext
13654 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13655 !! html/php
13656 <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>
13657
13658 !! html/parsoid
13659 <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>
13660 !! end
13661
13662 !! test
13663 Manually-specified thumbnail image with explicit link to wiki page
13664 !! options
13665 thumbsize=220
13666 parsoid=wt2html,wt2wt,html2html
13667 !! wikitext
13668 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13669 !! html/php
13670 <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>
13671
13672 !! html/parsoid
13673 <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>
13674 !! end
13675
13676 !! test
13677 Manually-specified thumbnail image with explicit link to url
13678 !! options
13679 thumbsize=220
13680 parsoid=wt2html,wt2wt,html2html
13681 !! wikitext
13682 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13683 !! html/php
13684 <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>
13685
13686 !! html/parsoid
13687 <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>
13688 !! end
13689
13690 !! test
13691 Manually-specified thumbnail image with explicit no link
13692 !! options
13693 thumbsize=220
13694 parsoid=wt2html,wt2wt,html2html
13695 !! wikitext
13696 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13697 !! html/php
13698 <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>
13699
13700 !! html/parsoid
13701 <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>
13702 !! end
13703
13704 !! test
13705 Manually-specified thumbnail image with explicit link and alt text
13706 !! options
13707 thumbsize=220
13708 parsoid=wt2html,wt2wt,html2html
13709 !! wikitext
13710 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13711 !! html/php
13712 <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>
13713
13714 !! html/parsoid
13715 <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>
13716 !! end
13717
13718 !! test
13719 Image with frame and link
13720 !! options
13721 parsoid=wt2html,wt2wt,html2html
13722 !! wikitext
13723 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13724 !! html/php
13725 <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>
13726
13727 !! html/parsoid
13728 <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>
13729 !! end
13730
13731 !! test
13732 Image with frame and link and explicit alt
13733 !! options
13734 parsoid=wt2html,wt2wt,html2html
13735 !! wikitext
13736 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13737 !! html/php
13738 <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>
13739
13740 !! html/parsoid
13741 <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>
13742 !! end
13743
13744 !! test
13745 Image with wiki markup in implicit alt
13746 !! wikitext
13747 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13748
13749 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13750 !! html/php
13751 <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>
13752 </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>
13753 </p>
13754 !! html/parsoid
13755 <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>
13756
13757 <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>
13758 !! end
13759
13760 !! test
13761 Alt image option should handle most kinds of wikitext without barfing
13762 !! wikitext
13763 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13764 !! html/php
13765 <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>
13766
13767 !! html/parsoid
13768 <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>
13769 !! end
13770
13771 ###################
13772 # Conflicting image format options.
13773 # First option specified should 'win'.
13774 # All three cases in each test should be identical.
13775
13776 !! test
13777 Image with 'frameless' first.
13778 !! options
13779 parsoid=wt2html,wt2wt,html2html
13780 !! wikitext
13781 [[File:Foobar.jpg|frameless|caption]]
13782
13783 [[File:Foobar.jpg|frameless|frame|caption]]
13784
13785 [[File:Foobar.jpg|frameless|thumb|caption]]
13786 !! html/php
13787 <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>
13788 </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>
13789 </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>
13790 </p>
13791 !! html/parsoid
13792 <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>
13793 <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>
13794 <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>
13795 !! end
13796
13797 !! test
13798 Image with 'frame' first.
13799 !! options
13800 parsoid=wt2html,wt2wt,html2html
13801 !! wikitext
13802 [[File:Foobar.jpg|frame|caption]]
13803 [[File:Foobar.jpg|frame|frameless|caption]]
13804 [[File:Foobar.jpg|frame|thumb|caption]]
13805 !! html/php
13806 <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>
13807 <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>
13808 <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>
13809
13810 !! html/parsoid
13811 <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>
13812 <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>
13813 <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>
13814 !! end
13815
13816 !! test
13817 Image with 'thumb' first.
13818 !! options
13819 parsoid=wt2html,wt2wt,html2html
13820 !! wikitext
13821 [[File:Foobar.jpg|thumb|caption]]
13822 [[File:Foobar.jpg|thumb|frameless|caption]]
13823 [[File:Foobar.jpg|thumb|frame|caption]]
13824 !! html/php
13825 <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>
13826 <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>
13827 <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>
13828
13829 !! html/parsoid
13830 <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>
13831 <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>
13832 <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>
13833 !! end
13834
13835 ###################
13836 # Image sizing.
13837 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13838 # and https://phabricator.wikimedia.org/T64258
13839 # Foobar has actual size of 1941x220
13840 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13841 # a scalable format.
13842 # 2. Framed images always ignore size options; always render at default size.
13843 # 3. "Unspecified format" and border are the only types which can be
13844 # enlarged.
13845
13846 !! test
13847 Image: "unspecified format" and border enlarge
13848 !! options
13849 parsoid=wt2html,wt2wt,html2html
13850 !! wikitext
13851 [[File:Foobar.jpg|2000px]]
13852
13853 [[File:Foobar.jpg|border|2000px]]
13854 !! html/php
13855 <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>
13856 </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>
13857 </p>
13858 !! html/parsoid
13859 <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>
13860 <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>
13861 !! end
13862
13863 !! test
13864 Image: "unspecified format" and border reduce
13865 !! options
13866 parsoid=wt2html,wt2wt,html2html
13867 !! wikitext
13868 [[File:Foobar.jpg|1000px]]
13869
13870 [[File:Foobar.jpg|border|1000px]]
13871 !! html/php
13872 <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>
13873 </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>
13874 </p>
13875 !! html/parsoid
13876 <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>
13877 <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>
13878 !! end
13879
13880 !! test
13881 Image: thumbs reduce
13882 !! options
13883 parsoid=wt2html,wt2wt,html2html
13884 !! wikitext
13885 [[File:Foobar.jpg|thumb|50px]]
13886 !! html/php
13887 <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>
13888
13889 !! html/parsoid
13890 <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>
13891 !! end
13892
13893 !! test
13894 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13895 !! options
13896 parsoid=wt2html,wt2wt,html2html
13897 !! wikitext
13898 [[File:Foobar.jpg|thumb|2000px]]
13899
13900 [[File:Foobar.svg|thumb|2000px]]
13901 !! html/php
13902 <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>
13903 <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>
13904
13905 !! html/parsoid
13906 <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>
13907 <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>
13908 !! end
13909
13910 !! test
13911 Image: frameless can reduce in size
13912 !! options
13913 parsoid=wt2html,wt2wt,html2html
13914 !! wikitext
13915 [[File:Foobar.jpg|frameless|50px]]
13916 !! html/php
13917 <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>
13918 </p>
13919 !! html/parsoid
13920 <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>
13921 !! end
13922
13923 !! test
13924 Image: bitmap frameless can't be enlarged past original size, but vector can
13925 !! options
13926 parsoid=wt2html,wt2wt,html2html
13927 !! wikitext
13928 [[File:Foobar.jpg|frameless|2000px]]
13929
13930 [[File:Foobar.svg|frameless|2000px]]
13931 !! html/php
13932 <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>
13933 </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>
13934 </p>
13935 !! html/parsoid
13936 <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>
13937 <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>
13938 !! end
13939
13940 !! test
13941 Image: framed images are always unscaled.
13942 !! options
13943 parsoid=wt2html,wt2wt,html2html
13944 !! wikitext
13945 [[File:Foobar.jpg|frame]]
13946
13947 [[File:Foobar.jpg|frame|50px]]
13948
13949 [[File:Foobar.jpg|frame|50x50px]]
13950
13951 [[File:Foobar.jpg|frame|2000px]]
13952 !! html/php
13953 <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>
13954 <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>
13955 <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>
13956 <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>
13957
13958 !! html/parsoid
13959 <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>
13960 <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>
13961 <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>
13962 <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>
13963 !! end
13964
13965 ###################
13966
13967 !! test
13968 Link to image page- image page normally doesn't exists, hence edit link
13969 Add test with existing image page
13970 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13971 !! wikitext
13972 [[:Image:test]]
13973 !! html
13974 <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>
13975 </p>
13976 !! end
13977
13978 !! test
13979 bug 18784 Link to non-existent image page with caption should use caption as link text
13980 !! wikitext
13981 [[:Image:test|caption]]
13982 !! html
13983 <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>
13984 </p>
13985 !! end
13986
13987 !! test
13988 Frameless image caption with a free URL
13989 !! wikitext
13990 [[File:Foobar.jpg|http://example.com]]
13991 !! html/php
13992 <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>
13993 </p>
13994 !! html/parsoid
13995 <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>
13996 !! end
13997
13998 !! test
13999 Thumbnail image caption with a free URL
14000 !! options
14001 thumbsize=220
14002 !! wikitext
14003 [[File:Foobar.jpg|thumb|http://example.com]]
14004 !! html/php
14005 <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>
14006
14007 !! html/parsoid
14008 <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>
14009 !! end
14010
14011 !! test
14012 Thumbnail image caption with a free URL and explicit alt
14013 !! options
14014 thumbsize=220
14015 parsoid=wt2html,wt2wt,html2html
14016 !! wikitext
14017 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14018 !! html/php
14019 <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>
14020
14021 !! html/parsoid
14022 <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>
14023 !! end
14024
14025 !! test
14026 SVG thumbnails with no language set
14027 !! options
14028 !! wikitext
14029 [[File:Foobar.svg|thumb|caption]]
14030 !! html/php
14031 <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>
14032
14033 !! html/parsoid
14034 <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>
14035 !! end
14036
14037 !! test
14038 SVG thumbnails with language de
14039 !! options
14040 parsoid=wt2html,wt2wt,html2html
14041 !! wikitext
14042 [[File:Foobar.svg|thumb|caption|lang=de]]
14043 !! html/php
14044 <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>
14045
14046 !! html/parsoid
14047 <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>
14048 !! end
14049
14050 !! test
14051 SVG thumbnails with invalid language code
14052 !! options
14053 parsoid=wt2html,wt2wt,html2html
14054 !! wikitext
14055 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14056 !! html/php
14057 <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>
14058
14059 !! html/parsoid
14060 <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>
14061 !! end
14062
14063 !! test
14064 BUG 1887: A ISBN with a thumbnail
14065 !! wikitext
14066 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14067 !! html/php
14068 <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>
14069
14070 !! html/parsoid
14071 <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>
14072 !! end
14073
14074 !! test
14075 BUG 1887: A RFC with a thumbnail
14076 !! wikitext
14077 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14078 !! html/php
14079 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
14080
14081 !! html/parsoid
14082 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
14083 !! end
14084
14085 !! test
14086 BUG 1887: A mailto link with a thumbnail
14087 !! wikitext
14088 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14089 !! html/php
14090 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
14091
14092 !! html/parsoid
14093 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Please <a rel="mw:ExtLink" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
14094 !! end
14095
14096 # Pending resolution to bug 368
14097 !! test
14098 BUG 648: Frameless image caption with a link
14099 !! wikitext
14100 [[File:Foobar.jpg|text with a [[link]] in it]]
14101 !! html/php
14102 <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>
14103 </p>
14104 !! html/parsoid
14105 <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>
14106 !! end
14107
14108 !! test
14109 BUG 648: Frameless image caption with a link (suffix)
14110 !! wikitext
14111 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14112 !! html/php
14113 <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>
14114 </p>
14115 !! html/parsoid
14116 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]]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>
14117 !! end
14118
14119 !! test
14120 BUG 648: Frameless image caption with an interwiki link
14121 !! wikitext
14122 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14123 !! html/php
14124 <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>
14125 </p>
14126 !! html/parsoid
14127 <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>
14128 !! end
14129
14130 !! test
14131 BUG 648: Frameless image caption with a piped interwiki link
14132 !! wikitext
14133 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14134 !! html/php
14135 <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>
14136 </p>
14137 !! html/parsoid
14138 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link|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>
14139 !! end
14140
14141 !! test
14142 T107474: Frameless image caption with <nowiki>
14143 !! wikitext
14144 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14145 !! html/parsoid
14146 <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>
14147 !! end
14148
14149 !! test
14150 Escape HTML special chars in image alt text
14151 !! wikitext
14152 [[File:Foobar.jpg|& < > "]]
14153 !! html/php
14154 <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>
14155 </p>
14156 !! html/parsoid
14157 <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>
14158 !! end
14159
14160 !! test
14161 Entities in file name and attributes
14162 !! wikitext
14163 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14164 !! html/php
14165 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14166 </p>
14167 !! html/parsoid
14168 <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>
14169 !! end
14170
14171 !! test
14172 BUG 499: Alt text should have &#1234;, not &amp;1234;
14173 !! wikitext
14174 [[File:Foobar.jpg|&#9792;]]
14175 !! html/php
14176 <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>
14177 </p>
14178 !! html/parsoid
14179 <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>
14180 !! end
14181
14182 !! test
14183 Broken image caption with link
14184 !! options
14185 parsoid=wt2html,wt2wt,html2html
14186 !! wikitext
14187 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14188 !! html/php
14189 <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.
14190 </p>
14191 !! html/parsoid
14192 <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>
14193 !! end
14194
14195 !! test
14196 Image caption containing another image
14197 !! wikitext
14198 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14199 !! html/php
14200 <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>
14201
14202 !! html/parsoid
14203 <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>
14204 !! end
14205
14206 !! test
14207 Image: caption containing a newline
14208 !! wikitext
14209 [[File:Foobar.jpg|This
14210 *is some text]]
14211 !! html/php
14212 <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>
14213 </p>
14214 !! html/parsoid
14215 <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>
14216 !!end
14217
14218 !!test
14219 Image: caption containing leading space
14220 (The leading space should not trigger nowiki escaping in wt2wt mode)
14221 !! wikitext
14222 [[File:Foobar.jpg|thumb| bar]]
14223 !! html/php
14224 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>bar</div></div></div>
14225
14226 !! html/parsoid
14227 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
14228 !!end
14229
14230 !! test
14231 Image: caption containing a table
14232 !! options
14233 parsoid=wt2html,wt2wt,html2html
14234 !! wikitext
14235 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14236 {|
14237 ! Foo !! Bar
14238 |-
14239 | Foo1 || Bar1
14240 |}
14241 and some more text.]]
14242 !! html/php
14243 <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>
14244
14245 !! html/parsoid
14246 <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
14247 <table>
14248 <tbody>
14249 <tr><th>Foo </th><th>Bar</th></tr>
14250 <tr>
14251 <td>Foo1 </td>
14252 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14253 !! end
14254
14255 !! test
14256 Bug 3090: External links other than http: in image captions
14257 !! wikitext
14258 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14259 !! html/php
14260 <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>
14261
14262 !! html/parsoid
14263 <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>
14264 !! end
14265
14266 !! test
14267 Custom class
14268 !! options
14269 parsoid=wt2html,wt2wt,html2html
14270 !! wikitext
14271 [[Image:foobar.jpg|a|class=b]]
14272 !! html/php
14273 <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>
14274 </p>
14275 !! html/parsoid
14276 <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>
14277 !! end
14278
14279 !! test
14280 Localized image handling (1).
14281 !! options
14282 parsoid=wt2html,wt2wt,html2html
14283 language=es
14284 !! wikitext
14285 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14286 !! html/php
14287 <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>
14288
14289 !! html/parsoid
14290 <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>
14291 !! end
14292
14293 !! test
14294 Localized image handling (2).
14295 !! options
14296 thumbsize=220
14297 parsoid=wt2html,wt2wt,html2html
14298 language=es
14299 !! wikitext
14300 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14301 !! html/php
14302 <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>
14303
14304 !! html/parsoid
14305 <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>
14306 !! end
14307
14308 !! test
14309 Localized image handling (3).
14310 !! options
14311 language=fa
14312 parsoid=html2wt
14313 !! html/parsoid
14314 <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>
14315 !! wikitext
14316 [[File:Foobar.jpg|بندانگشتی]]
14317 !! end
14318
14319 !! test
14320 "border", "frameless" and "class" attributes on an image.
14321 !! options
14322 thumbsize=220
14323 parsoid=wt2html,wt2wt,html2html
14324 !! wikitext
14325 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14326 !! html/php
14327 <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>
14328 </p>
14329 !! html/parsoid
14330 <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>
14331 !! end
14332
14333 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14334 !! test
14335 Invalid image attributes (bug 62500)
14336 !! options
14337 thumbsize=220
14338 parsoid=wt2html,wt2wt,html2html
14339 !! wikitext
14340 [[File:Foobar.jpg|thumb|float|left|caption]]
14341
14342 [[File:Foobar.jpg|thumb|righ|caption]]
14343
14344 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14345 !! html/php
14346 <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>
14347 <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>
14348 <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>
14349
14350 !! html/parsoid
14351 <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>
14352 <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>
14353 <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>
14354 !! end
14355
14356 !! article
14357 File:Barfoo.jpg
14358 !! text
14359 #REDIRECT [[File:Barfoo.jpg]]
14360 !! endarticle
14361
14362 # FIXME: Parsoid should run this test -- but we'd need to teach the
14363 # mockAPI about the redirected Barfoo.jpg image.
14364 !! test
14365 Redirected image
14366 !! wikitext
14367 [[Image:Barfoo.jpg]]
14368 !! html/php
14369 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14370 </p>
14371 !! end
14372
14373 !! test
14374 Missing image with uploads disabled
14375 !! options
14376 wgEnableUploads=0
14377 !! wikitext
14378 [[File:Foobaz.jpg]]
14379 !! html/php
14380 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14381 </p>
14382 !! html/parsoid
14383 <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>
14384 !! end
14385
14386 # Parsoid-specific testing for images
14387 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14388 # Currently imperfect due to a flaw in the Parsoid testrunner
14389 # Work in progress
14390 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14391 # image tests.
14392
14393 !! test
14394 Parsoid-specific image handling - simple image with size and middle alignment
14395 !! wikitext
14396 [[File:Foobar.jpg|middle|50px]]
14397 !! html/parsoid
14398 <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>
14399 !! end
14400
14401 !! test
14402 Parsoid-specific image handling - simple image with size, middle alignment,
14403 non-standard namespace alias
14404 !! options
14405 parsoid=wt2wt,wt2html,html2html
14406 !! wikitext
14407 [[Image:Foobar.jpg|middle|50px]]
14408 !! html/parsoid
14409 <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>
14410 !! end
14411
14412 !! test
14413 Parsoid-specific image handling - simple image with size and middle alignment
14414 (existing content)
14415 !! wikitext
14416 [[File:Foobar.jpg|50px|middle]]
14417 !! html/parsoid
14418 <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>
14419 !! end
14420
14421 !! test
14422 Parsoid-specific image handling - simple image with size and middle alignment
14423 and non-standard namespace name
14424 !! options
14425 parsoid=wt2html,wt2wt,html2html
14426 !! wikitext
14427 [[Image:Foobar.jpg|50px|middle]]
14428 !! html/parsoid
14429 <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>
14430 !! end
14431
14432 !! test
14433 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14434 !! wikitext
14435 [[File:Foobar.jpg|500x10px|baseline|caption]]
14436 !! html/parsoid
14437 <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>
14438 !! end
14439
14440 !! test
14441 Parsoid-specific image handling - simple image with border and size spec
14442 !! wikitext
14443 [[File:Foobar.jpg|50px|border|caption]]
14444 !! html/parsoid
14445 <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>
14446 !! end
14447
14448 !! test
14449 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14450 !! wikitext
14451 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14452 !! html/parsoid
14453 <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>
14454 !! end
14455
14456 !! test
14457 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14458 (existing content)
14459 !! wikitext
14460 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14461 !! html/parsoid
14462 <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>
14463 !! end
14464
14465 !! test
14466 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14467 !! wikitext
14468 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14469 !! html/parsoid
14470 <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>
14471 !! end
14472
14473 !! test
14474 Parsoid-specific image handling - thumbnail with specific size, halign,
14475 valign, and caption (existing content)
14476 !! wikitext
14477 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14478 !! html/parsoid
14479 <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>
14480 !! end
14481
14482 !! test
14483 Parsoid-specific image handling - framed image with specific size and caption
14484 (size is ignored)
14485 !! options
14486 parsoid=wt2html,wt2wt,html2html
14487 !! wikitext
14488 [[File:Foobar.jpg|frame|500x50px|caption]]
14489 !! html/parsoid
14490 <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>
14491 !! end
14492
14493 !! test
14494 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14495 (size is ignored)
14496 !! options
14497 parsoid=wt2html,wt2wt,html2html
14498 !! wikitext
14499 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14500 !! html/parsoid
14501 <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>
14502 !! end
14503
14504 !! test
14505 Parsoid-specific image handling - frameless image with specific size, border, and caption
14506 !! wikitext
14507 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14508 !! html/parsoid
14509 <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>
14510 !! end
14511
14512 !! test
14513 Parsoid-specific image handling - simple image with a formatted caption
14514 !! wikitext
14515 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14516 !! html/parsoid
14517 <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>
14518 !! end
14519
14520 !! test
14521 Parsoid-specific image handling - caption with a template in it
14522 !! wikitext
14523 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14524 !! html/parsoid
14525 <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>
14526 !! end
14527
14528 !! test
14529 Parsoid-specific image handling - caption with unbalanced tags in it
14530 !! options
14531 parsoid=wt2html,wt2wt,html2html
14532 !! wikitext
14533 foo
14534 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14535 bar
14536 !! html/parsoid
14537 <p>foo</p>
14538 <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>
14539 <p>bar</p>
14540 !! end
14541
14542 !! test
14543 Parsoid-specific image handling - empty caption (1)
14544 !! options
14545 parsoid=wt2html,wt2wt
14546 !! wikitext
14547 [[File:Foobar.jpg|thumb|]]
14548 !! html/parsoid
14549 <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>
14550 !! end
14551
14552 # empty captions don't get serialized unless we're in the "round trip" case
14553 !! test
14554 Parsoid-specific image handling - empty caption (2)
14555 !! options
14556 parsoid=html2wt
14557 !! html/parsoid
14558 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14559 <a href="./File:Foobar.jpg">
14560 <img resource="./File:Foobar.jpg"
14561 src="//example.com/images/3/3a/Foobar.jpg"
14562 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14563 height="25" width="220"/>
14564 </a>
14565 <figcaption></figcaption>
14566 </figure>
14567 !! wikitext
14568 [[File:Foobar.jpg|thumb]]
14569 !! end
14570
14571 !! test
14572 Parsoid-specific image handling - whitespace caption
14573 !! wikitext
14574 [[File:Foobar.jpg|thumb| ]]
14575 !! html/parsoid
14576 <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>
14577 !! end
14578
14579 !! test
14580 Parsoid-specific image handling - lang option
14581 !! wikitext
14582 foo
14583 [[File:Foobar.svg|lang=de|caption]]
14584 bar
14585 !! html/parsoid
14586 <p>foo
14587 <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>
14588 bar</p>
14589 !! end
14590
14591 ## Edge case bugs in Parsoid from T93580
14592 !! test
14593 T93580: 1. Templated <ref> inside block images
14594 !! wikitext
14595 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14596
14597 <references />
14598 !! html/parsoid
14599 <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>
14600
14601 <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>
14602 !! end
14603
14604 !! test
14605 T93580: 2. <ref> inside inline images
14606 !! wikitext
14607 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14608
14609 <references />
14610 !! html/parsoid
14611 <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>
14612
14613 <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>
14614 !! end
14615
14616 !! test
14617 T93580: 3. Templated <ref> inside inline images
14618 !! wikitext
14619 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14620
14621 <references />
14622 !! html/parsoid
14623 <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>
14624
14625 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
14626 !! end
14627
14628 ###
14629 ### Subpages
14630 ###
14631 !! article
14632 Subpage test/subpage
14633 !! text
14634 foo
14635 !! endarticle
14636
14637 !! test
14638 Subpage link
14639 !! options
14640 subpage title=[[Subpage test]]
14641 !! wikitext
14642 [[/subpage]]
14643 !! html
14644 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14645 </p>
14646 !! end
14647
14648 !! test
14649 Subpage noslash link
14650 !! options
14651 subpage title=[[Subpage test]]
14652 !! wikitext
14653 [[/subpage/]]
14654 !! html
14655 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14656 </p>
14657 !! end
14658
14659 !! article
14660 Subpage test/1/2/subpage
14661 !! text
14662 blah
14663 !! endarticle
14664
14665 !! test
14666 Relative subpage noslash link
14667 !! options
14668 parsoid=wt2wt,wt2html,html2html
14669 subpage title=[[Subpage test/1/2/3/4]]
14670 !! wikitext
14671 [[../../subpage/]]
14672
14673 [[../../subpage]]
14674 !! html/php
14675 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14676 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14677 </p>
14678 !! html/parsoid
14679 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14680 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14681 !! end
14682
14683 !! test
14684 Parsoid: dot-slash prefixed wikilinks
14685 !! wikitext
14686 [[./foo]]
14687
14688 [[././bar]]
14689
14690 [[././baz/]]
14691 !! html/php
14692 <p>[[./foo]]
14693 </p><p>[[././bar]]
14694 </p><p>[[././baz/]]
14695 </p>
14696 !! html/parsoid
14697 <p>[[./foo]]
14698 </p><p>[[././bar]]
14699 </p><p>[[././baz/]]
14700 </p>
14701 !! end
14702
14703 !! test
14704 Render invalid page names as plain text (bug 51090)
14705 !! wikitext
14706 [[./../foo|bar]]
14707 [[foo�|bar]]
14708 [[foo/.|bar]]
14709 [[foo/..|bar]]
14710 [[foo~~~bar]]
14711 [[foo>bar]]
14712 [[foo[bar]]
14713 [[.]]
14714 [[..]]
14715 [[foo././bar]]
14716
14717 [[{{echo|./../foo}}|bar]]
14718 [[{{echo|foo/.}}|bar]]
14719 [[{{echo|foo/..}}|bar]]
14720 [[{{echo|foo~~~~bar}}]]
14721 [[{{echo|foo>bar}}]]
14722 [[{{echo|foo././bar}}]]
14723 [[{{echo|foo{bar}}]]
14724 [[{{echo|foo}bar}}]]
14725 [[{{echo|foo[bar}}]]
14726 [[{{echo|foo]bar}}]]
14727 [[{{echo|foo<bar}}]]
14728 !!html/php
14729 <p>[[./../foo|bar]]
14730 [[foo�|bar]]
14731 [[foo/.|bar]]
14732 [[foo/..|bar]]
14733 [[foo~~~bar]]
14734 [[foo&gt;bar]]
14735 [[foo[bar]]
14736 [[.]]
14737 [[..]]
14738 [[foo././bar]]
14739 </p><p>[[./../foo|bar]]
14740 [[foo/.|bar]]
14741 [[foo/..|bar]]
14742 [[foo~~~~bar]]
14743 [[foo&gt;bar]]
14744 [[foo././bar]]
14745 [[foo{bar]]
14746 [[foo}bar]]
14747 [[foo[bar]]
14748 [[foo]bar]]
14749 [[foo&lt;bar]]
14750 </p>
14751 !!html/parsoid
14752 <p>[[./../foo|bar]]
14753 [[foo�|bar]]
14754 [[foo/.|bar]]
14755 [[foo/..|bar]]
14756 [[foo~~~bar]]
14757 [[foo>bar]]
14758 [[foo[bar]]
14759 [[.]]
14760 [[..]]
14761 [[foo././bar]]</p>
14762
14763 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14764 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14765 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14766 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14767 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14768 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14769 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14770 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14771 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14772 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14773 [[<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>
14774 !!end
14775
14776 !! test
14777 Disabled subpages
14778 !! wikitext
14779 [[/subpage]]
14780 !! html
14781 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14782 </p>
14783 !! end
14784
14785 !! test
14786 BUG 561: {{/Subpage}}
14787 !! options
14788 subpage title=[[Page]]
14789 !! wikitext
14790 {{/Subpage}}
14791 !! html
14792 <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>
14793 </p>
14794 !! end
14795
14796 ###
14797 ### Categories
14798 ###
14799 !! article
14800 Category:MediaWiki User's Guide
14801 !! text
14802 blah
14803 !! endarticle
14804
14805 !! test
14806 Link to category
14807 !! wikitext
14808 [[:Category:MediaWiki User's Guide]]
14809 !! html
14810 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14811 </p>
14812 !! end
14813
14814 !! test
14815 Simple category
14816 !! options
14817 cat
14818 !! wikitext
14819 [[Category:MediaWiki User's Guide]]
14820 !! html/php
14821 cat=MediaWiki_User's_Guide sort=
14822 !! html/parsoid
14823 <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"}}'/>
14824 !! end
14825
14826 !! test
14827 PAGESINCATEGORY invalid title fatal (r33546 fix)
14828 !! wikitext
14829 {{PAGESINCATEGORY:<bogus>}}
14830 !! html
14831 <p>0
14832 </p>
14833 !! end
14834
14835 !! test
14836 Category with different sort key
14837 !! options
14838 cat
14839 !! wikitext
14840 [[Category:MediaWiki User's Guide|Foo]]
14841 !! html/php
14842 cat=MediaWiki_User's_Guide sort=Foo
14843 !! html/parsoid
14844 <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"}}'/>
14845 !! end
14846
14847 !! test
14848 Category with identical sort key
14849 !! options
14850 cat
14851 !! wikitext
14852 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14853 !! html/php
14854 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
14855 !! html/parsoid
14856 <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"}}'/>
14857 !! end
14858
14859 !! test
14860 Category with empty sort key
14861 !! options
14862 cat
14863 pst
14864 !! wikitext
14865 [[Category:MediaWiki User's Guide|]]
14866 !! html/php
14867 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14868 !! end
14869
14870 !! test
14871 Category with empty sort key and parentheses
14872 !! options
14873 cat
14874 pst
14875 !! wikitext
14876 [[Category:Foo (bar)|]]
14877 !! html/php
14878 [[Category:Foo (bar)|Foo]]
14879 !! end
14880
14881 !! test
14882 Category with link tail
14883 !! options
14884 cat
14885 pst
14886 !! wikitext
14887 123[[Category:Foo]]456
14888 !! html/php
14889 123[[Category:Foo]]456
14890 !! end
14891
14892 !! test
14893 Category with template
14894 !! options
14895 cat
14896 pst
14897 !! wikitext
14898 [[Category:{{echo|Foo}}]]
14899 !! html/php
14900 [[Category:{{echo|Foo}}]]
14901 !! end
14902
14903 !! test
14904 Category with template in sort key
14905 !! options
14906 cat
14907 pst
14908 !! wikitext
14909 [[Category:Foo|{{echo|Bar}}]]
14910 !! html/php
14911 [[Category:Foo|{{echo|Bar}}]]
14912 !! end
14913
14914 !! test
14915 Category with template in sort key and title
14916 !! options
14917 cat
14918 pst
14919 !! wikitext
14920 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14921 !! html/php
14922 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14923 !! end
14924
14925 ## We used to, but no longer wt2wt this test since the default serializer
14926 ## will normalize all categories to serialize on their own line.
14927 ## This wikitext usage is going to be fairly uncommon in production and
14928 ## selser will take care of preserving formatting in those scenarios.
14929 !! test
14930 Category / paragraph interactions
14931 !! options
14932 parsoid=wt2html
14933 !! wikitext
14934 Foo [[Category:Baz]] Bar
14935
14936 Foo [[Category:Baz]]
14937 Bar
14938
14939 Foo
14940 [[Category:Baz]]
14941 Bar
14942
14943 Foo
14944 [[Category:Baz]] Bar
14945
14946 Foo
14947 [[Category:Baz]]
14948 [[Category:Baz]]
14949 [[Category:Baz]]
14950 Bar
14951
14952 [[Category:Baz]]
14953 [[Category:Baz]]
14954 [[Category:Baz]]
14955
14956 [[Category:Baz]]
14957 {{echo|[[Category:Baz]]}}
14958 [[Category:Baz]]
14959 !! html/php
14960 <p>Foo Bar
14961 </p><p>Foo
14962 Bar
14963 </p><p>Foo
14964 Bar
14965 </p><p>Foo Bar
14966 </p><p>Foo
14967 Bar
14968 </p>
14969 !! html/parsoid
14970 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14971 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14972 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14973 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14974 <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>
14975 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14976 !! end
14977
14978 ## We used to, but no longer wt2wt this test since the default serializer
14979 ## will normalize all categories to serialize on their own line.
14980 ## This wikitext usage is going to be fairly uncommon in production and
14981 ## selser will take care of preserving formatting in those scenarios.
14982 ##
14983 ## The whitespace on the empty line is part of the test. Please do not delete
14984 !! test
14985 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14986 !! options
14987 parsoid=wt2html
14988 !! wikitext
14989 This
14990
14991 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14992
14993 {{echo|[[Category:Foo]] and so should this!}}
14994 !! html/php
14995 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14996 </p>
14997 !! html/parsoid
14998 <p>This
14999
15000 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15001
15002 <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>
15003 !! end
15004
15005 ## Parsoid will not try to wt2wt this while preserving newlines because
15006 ## it suppresses excess newlines within list items -- and we don't want to
15007 ## introduce a special case just for categories, which is, in reality somewhat
15008 ## odd behavior -- categories are unlikely to be used in list items like this
15009 ## in top-level pages and are only likely to show up in template-generated
15010 ## list items where this RT-ing is a non-issue.
15011 ##
15012 ## The whitespace on the empty line is part of the test. Please do not delete
15013 !! test
15014 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
15015 !! options
15016 parsoid=wt2html
15017 !! wikitext
15018 * This
15019
15020 [[Category:Foo]] and this should be part of the same list item
15021 * So should this
15022
15023 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15024 !! html
15025 <ul><li>This and this should be part of the same list item</li>
15026 <li>So should this and this should be part of the same list item</li></ul>
15027 !! html/parsoid
15028 <ul>
15029 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15030 <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>
15031 </ul>
15032 !! end
15033
15034 ## Newlines and categories that follow the last item of a list
15035 ## are treated differently because this (list followed by categories)
15036 ## is an extremely common pattern on wikis.
15037 !! test
15038 3. Categories and newlines: newline suppression for last list item should RT properly
15039 !! wikitext
15040 * a
15041 * b
15042
15043 [[Category:Foo]]
15044
15045 [[Category:Bar]]
15046 [[Category:Baz]]
15047 !! html/parsoid
15048 <ul><li> a</li>
15049 <li> b</li></ul>
15050
15051 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15052
15053 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15054 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15055 !! end
15056
15057 !! test
15058 4. Categories and newlines: newline suppression for last list item should RT properly
15059 !! wikitext
15060 * a
15061 **** b
15062
15063 [[Category:Foo]]
15064 !! html/parsoid
15065 <ul><li> a
15066 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15067
15068 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15069 !! end
15070
15071 ## only wt2html for this to make sure the algo only applies to the rightmost path
15072 !! test
15073 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15074 !! options
15075 parsoid=wt2html
15076 !! wikitext
15077 * a
15078 ** b
15079 [[Category:Foo]]
15080 * c
15081 ** d
15082 [[Category:Foo]]
15083 !! html/parsoid
15084 <ul><li> a
15085 <ul><li> b
15086 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15087 <li> c
15088 <ul><li> d</li></ul></li></ul>
15089 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15090 !! end
15091
15092 ## We used to, but no longer wt2wt this test since the default serializer
15093 ## will normalize all categories to serialize on their own line.
15094 ## This wikitext usage is going to be fairly uncommon in production and
15095 ## selser will take care of preserving formatting in those scenarios.
15096 !! test
15097 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15098 !! options
15099 parsoid=wt2html
15100 !! wikitext
15101 * a [[Category:Foo]]
15102 !! html/parsoid
15103 <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>
15104 !! end
15105
15106 # This test also demonstrates because of newline+category tunneling
15107 # through the list hander, template wrapping doesn't expand to the
15108 # containing list when the list item swallows the category.
15109 !! test
15110 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15111 !! wikitext
15112 * {{echo|a
15113 [[Category:Foo]]}}
15114 !! html/parsoid
15115 <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
15116 </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>
15117 !! end
15118
15119 !! test
15120 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15121 !! wikitext
15122 * a
15123
15124 {{echo|[[Category:Foo]]
15125 [[Category:Bar]]}}
15126 [[Category:Baz]]
15127 !! html/parsoid
15128 <ul><li> a</li></ul>
15129
15130 <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">
15131 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15132 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15133 !! end
15134
15135 !! test
15136 Category links with multiple namespaces
15137 !! wikitext
15138 [[Category:Project:Foo]]
15139 !! html/parsoid
15140 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15141 !! end
15142
15143 !! test
15144 Parsoid: Serialize link to category page with colon escape
15145 !! options
15146 parsoid
15147 !! wikitext
15148
15149 [[:Category:Foo]]
15150 [[:Category:Foo|Bar]]
15151 !! html
15152 <p>
15153 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15154 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15155 </p>
15156 !! end
15157
15158 # We used to, but no longer wt2wt this test since the default serializer
15159 # will normalize all categories to serialize on their own line.
15160 # This wikitext usage is going to be fairly uncommon in production and
15161 # selser will take care of preventing whitespace insertion if this
15162 # occurs in an article.
15163 #
15164 # html2html disabled for the same reason (whitespace insertion between
15165 # x and y).
15166 #
15167 # html2wt disabled because it localizes the "Category" namespace.
15168 !! test
15169 Link prefix/suffixes aren't applied to category links
15170 !! options
15171 parsoid=wt2html
15172 language=is
15173 !! wikitext
15174 x[[Category:Foo]]y
15175 !! html/php
15176 <p>xy
15177 </p>
15178 !! html/parsoid
15179 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15180 !! end
15181
15182 !! test
15183 Parsoid: Serialize link to file page with colon escape
15184 !! options
15185 parsoid
15186 !! wikitext
15187
15188 [[:File:Foo.png]]
15189 [[:File:Foo.png|Bar]]
15190 !! html
15191 <p>
15192 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15193 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15194 </p>
15195 !! end
15196
15197 !! test
15198 Parsoid: Serialize a genuine category link without colon escape
15199 !! options
15200 parsoid
15201 !! wikitext
15202 [[Category:Foo]]
15203 [[Category:Foo|Bar]]
15204 !! html
15205 <link rel="mw:PageProp/Category" href="./Category:Foo">
15206 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15207 !! end
15208
15209 !! test
15210 Normalize hrefs properly before testing for invalid link targets (bug 70894)
15211 !! options
15212 parsoid=html2wt
15213 !! html/parsoid
15214 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15215 !! wikitext
15216 [[Category:Toxine bactérienne]]
15217 !! end
15218
15219 !! test
15220 Parsoid: Defaultsort
15221 !! wikitext
15222 {{DEFAULTSORT:Foo}}
15223 !! html/parsoid
15224 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15225 !! end
15226
15227 !! test
15228 Parsoid: Defaultsort (template-generated)
15229 !! wikitext
15230 {{{{echo|DEFAULTSORT}}:Foo}}
15231 !! html/parsoid
15232 <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}}]}'/>
15233 !! end
15234
15235 ###
15236 ### Inter-language links
15237 ###
15238 !! test
15239 Interlanguage links
15240 !! options
15241 ill
15242 !! wikitext
15243 [[es:Alimento]]
15244 [[fr:Nourriture]]
15245 [[zh:食品]]
15246 !! html/php
15247 es:Alimento fr:Nourriture zh:食品
15248 !! html/parsoid
15249 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15250 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15251 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15252 !! end
15253
15254 !! test
15255 Duplicate interlanguage links (bug 24502)
15256 !! options
15257 ill
15258 !! wikitext
15259 [[es:1]]
15260 [[es:2]]
15261 [[fr:1]]
15262 [[fr:2]]
15263 !! html/php
15264 es:1 fr:1
15265 !! html/parsoid
15266 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15267 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15268 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15269 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15270 !! end
15271
15272 ###
15273 ### Sections
15274 ###
15275 !! test
15276 Basic section headings
15277 !! wikitext
15278 == Headline 1 ==
15279 Some text
15280
15281 ==Headline 2==
15282 More
15283 ===Smaller headline===
15284 Blah blah
15285 !! html
15286 <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>
15287 <p>Some text
15288 </p>
15289 <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>
15290 <p>More
15291 </p>
15292 <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>
15293 <p>Blah blah
15294 </p>
15295 !! end
15296
15297 !! test
15298 Section headings with TOC
15299 !! wikitext
15300 == Headline 1 ==
15301 === Subheadline 1 ===
15302 ===== Skipping a level =====
15303 ====== Skipping a level ======
15304
15305 == Headline 2 ==
15306 Some text
15307 ===Another headline===
15308 !! html
15309 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15310 <ul>
15311 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15312 <ul>
15313 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15314 <ul>
15315 <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>
15316 <ul>
15317 <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>
15318 </ul>
15319 </li>
15320 </ul>
15321 </li>
15322 </ul>
15323 </li>
15324 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15325 <ul>
15326 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15327 </ul>
15328 </li>
15329 </ul>
15330 </div>
15331
15332 <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>
15333 <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>
15334 <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>
15335 <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>
15336 <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>
15337 <p>Some text
15338 </p>
15339 <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>
15340
15341 !! end
15342
15343 !! test
15344 TOC anchors don't collide
15345 !! wikitext
15346 __FORCETOC__
15347 == Headline 2 ==
15348 == Headline ==
15349 == Headline 2 ==
15350 == Headline ==
15351 !! html/php
15352 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15353 <ul>
15354 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15355 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15356 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15357 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15358 </ul>
15359 </div>
15360
15361 <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>
15362 <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>
15363 <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>
15364 <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>
15365
15366 !! end
15367
15368 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15369 !! test
15370 Handling of sections up to level 6 and beyond
15371 !! wikitext
15372 = Level 1 Heading=
15373 == Level 2 Heading==
15374 === Level 3 Heading===
15375 ==== Level 4 Heading====
15376 ===== Level 5 Heading=====
15377 ====== Level 6 Heading======
15378 ======= Level 7 Heading=======
15379 ======== Level 8 Heading========
15380 ========= Level 9 Heading=========
15381 ========== Level 10 Heading==========
15382 !! html
15383 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15384 <ul>
15385 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15386 <ul>
15387 <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>
15388 <ul>
15389 <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>
15390 <ul>
15391 <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>
15392 <ul>
15393 <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>
15394 <ul>
15395 <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>
15396 <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>
15397 <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>
15398 <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>
15399 <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>
15400 </ul>
15401 </li>
15402 </ul>
15403 </li>
15404 </ul>
15405 </li>
15406 </ul>
15407 </li>
15408 </ul>
15409 </li>
15410 </ul>
15411 </div>
15412
15413 <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>
15414 <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>
15415 <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>
15416 <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>
15417 <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>
15418 <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>
15419 <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>
15420 <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>
15421 <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>
15422 <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>
15423
15424 !! end
15425
15426 !! test
15427 TOC regression (T11764)
15428 !! wikitext
15429 == title 1 ==
15430 === title 1.1 ===
15431 ==== title 1.1.1 ====
15432 === title 1.2 ===
15433 == title 2 ==
15434 === title 2.1 ===
15435 !! html
15436 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15437 <ul>
15438 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15439 <ul>
15440 <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>
15441 <ul>
15442 <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>
15443 </ul>
15444 </li>
15445 <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>
15446 </ul>
15447 </li>
15448 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15449 <ul>
15450 <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>
15451 </ul>
15452 </li>
15453 </ul>
15454 </div>
15455
15456 <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>
15457 <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>
15458 <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>
15459 <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>
15460 <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>
15461 <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>
15462
15463 !! end
15464
15465 !! test
15466 TOC for heading containing <span id="..."></span> (T96153)
15467 !! wikitext
15468 __FORCETOC__
15469 ==<span id="old-anchor"></span>New title==
15470 !! html/php
15471 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15472 <ul>
15473 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15474 </ul>
15475 </div>
15476
15477 <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>
15478
15479 !! end
15480
15481 !! test
15482 TOC with wgMaxTocLevel=3 (bug 6204)
15483 !! options
15484 wgMaxTocLevel=3
15485 !! wikitext
15486 == title 1 ==
15487 === title 1.1 ===
15488 ==== title 1.1.1 ====
15489 === title 1.2 ===
15490 == title 2 ==
15491 === title 2.1 ===
15492 !! html
15493 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15494 <ul>
15495 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15496 <ul>
15497 <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>
15498 <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>
15499 </ul>
15500 </li>
15501 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15502 <ul>
15503 <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>
15504 </ul>
15505 </li>
15506 </ul>
15507 </div>
15508
15509 <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>
15510 <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>
15511 <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>
15512 <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>
15513 <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>
15514 <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>
15515
15516 !! end
15517
15518 !! test
15519 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15520 !! options
15521 wgMaxTocLevel=3
15522 !! wikitext
15523 ==Section 1==
15524 ===Section 1.1===
15525 ====Section 1.1.1====
15526 ====Section 1.1.1.1====
15527 ==Section 2==
15528 !! html
15529 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15530 <ul>
15531 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15532 <ul>
15533 <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>
15534 </ul>
15535 </li>
15536 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15537 </ul>
15538 </div>
15539
15540 <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>
15541 <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>
15542 <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>
15543 <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>
15544 <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>
15545
15546 !! end
15547
15548
15549 !! test
15550 Resolving duplicate section names
15551 !! wikitext
15552 == Foo bar ==
15553 == Foo bar ==
15554 !! html
15555 <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>
15556 <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>
15557
15558 !! end
15559
15560 !! test
15561 Resolving duplicate section names with differing case (bug 10721)
15562 !! wikitext
15563 == Foo bar ==
15564 == Foo Bar ==
15565 !! html
15566 <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>
15567 <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>
15568
15569 !! end
15570
15571 !! article
15572 Template:sections
15573 !! text
15574 ===Section 1===
15575 ==Section 2==
15576 !! endarticle
15577
15578 !! test
15579 Template with sections, __NOTOC__
15580 !! wikitext
15581 __NOTOC__
15582 ==Section 0==
15583 {{sections}}
15584 ==Section 4==
15585 !! html
15586 <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>
15587 <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>
15588 <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>
15589 <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>
15590
15591 !! end
15592
15593 !! test
15594 __NOEDITSECTION__ keyword
15595 !! wikitext
15596 __NOEDITSECTION__
15597 ==Section 1==
15598 ==Section 2==
15599 !! html
15600 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15601 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15602
15603 !! end
15604
15605 !! test
15606 Link inside a section heading
15607 !! wikitext
15608 ==Section with a [[Main Page|link]] in it==
15609 !! html
15610 <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>
15611
15612 !! end
15613
15614 !! test
15615 TOC regression (T14077)
15616 !! wikitext
15617 __TOC__
15618 == title 1 ==
15619 === title 1.1 ===
15620 == title 2 ==
15621 !! html
15622 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15623 <ul>
15624 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15625 <ul>
15626 <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>
15627 </ul>
15628 </li>
15629 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15630 </ul>
15631 </div>
15632
15633 <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>
15634 <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>
15635 <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>
15636
15637 !! end
15638
15639 !! test
15640 BUG 1219 URL next to image (good)
15641 !! wikitext
15642 http://example.com [[File:Foobar.jpg]]
15643 !! html/php
15644 <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>
15645 </p>
15646 !! html/parsoid
15647 <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>
15648 !!end
15649
15650 !! test
15651 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15652 !! wikitext
15653 ===
15654 The line above must have a trailing space!
15655 === <!--
15656 --> <!-- -->
15657 But just in case it doesn't...
15658 !! html
15659 <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>
15660 <p>The line above must have a trailing space!
15661 </p>
15662 <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>
15663 <p>But just in case it doesn't...
15664 </p>
15665 !! end
15666
15667 !! test
15668 Header with special characters (bug 25462)
15669 !! wikitext
15670 The tooltips shall not show entities to the user (ie. be double escaped)
15671
15672 == text > text ==
15673 section 1
15674
15675 == text < text ==
15676 section 2
15677
15678 == text & text ==
15679 section 3
15680
15681 == text ' text ==
15682 section 4
15683
15684 == text " text ==
15685 section 5
15686 !! html
15687 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15688 </p>
15689 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15690 <ul>
15691 <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>
15692 <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>
15693 <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>
15694 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15695 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15696 </ul>
15697 </div>
15698
15699 <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>
15700 <p>section 1
15701 </p>
15702 <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>
15703 <p>section 2
15704 </p>
15705 <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>
15706 <p>section 3
15707 </p>
15708 <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>
15709 <p>section 4
15710 </p>
15711 <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>
15712 <p>section 5
15713 </p>
15714 !! end
15715
15716 !! test
15717 Header with space, plus and underscore as entity
15718 !! wikitext
15719 Id should not contain + for spaces
15720
15721 == Space between Text ==
15722 section 1
15723
15724 == Space-Entity&#32;between&#32;Text ==
15725 section 2
15726
15727 == Plus+between+Text ==
15728 section 3
15729
15730 == Plus-Entity&#43;between&#43;Text ==
15731 section 4
15732
15733 == Underscore_between_Text ==
15734 section 5
15735
15736 == Underscore-Entity&#95;between&#95;Text ==
15737 section 6
15738
15739 [[#Space between Text]]
15740 [[#Space-Entity&#32;between&#32;Text]]
15741 [[#Plus+between+Text]]
15742 [[#Plus-Entity&#43;between&#43;Text]]
15743 [[#Underscore_between_Text]]
15744 [[#Underscore-Entity&#95;between&#95;Text]]
15745 !! html
15746 <p>Id should not contain + for spaces
15747 </p>
15748 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15749 <ul>
15750 <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>
15751 <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>
15752 <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>
15753 <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>
15754 <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>
15755 <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>
15756 </ul>
15757 </div>
15758
15759 <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>
15760 <p>section 1
15761 </p>
15762 <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>
15763 <p>section 2
15764 </p>
15765 <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>
15766 <p>section 3
15767 </p>
15768 <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>
15769 <p>section 4
15770 </p>
15771 <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>
15772 <p>section 5
15773 </p>
15774 <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>
15775 <p>section 6
15776 </p><p><a href="#Space_between_Text">#Space between Text</a>
15777 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15778 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15779 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15780 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15781 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15782 </p>
15783 !! end
15784
15785 !! test
15786 Headers with excess '=' characters
15787 (Are similar tests necessary beyond the 1st level?)
15788 !! wikitext
15789 =foo==
15790 ==foo=
15791 =''italic'' heading==
15792 ==''italic'' heading=
15793 !! html
15794 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15795 <ul>
15796 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15797 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15798 <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>
15799 <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>
15800 </ul>
15801 </div>
15802
15803 <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>
15804 <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>
15805 <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>
15806 <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>
15807
15808 !! end
15809
15810 !! test
15811 HTML headers vs TOC (bug 23393)
15812 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15813 !! wikitext
15814 <h1>Header 1</h1>
15815 == Header 1.1 ==
15816 == Header 1.2 ==
15817
15818 <h1>Header 2
15819 </h1>
15820 == Header 2.1 ==
15821 == Header 2.2 ==
15822 __NOEDITSECTION__
15823 !! html
15824 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15825 <ul>
15826 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15827 <ul>
15828 <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>
15829 <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>
15830 </ul>
15831 </li>
15832 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15833 <ul>
15834 <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>
15835 <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>
15836 </ul>
15837 </li>
15838 </ul>
15839 </div>
15840
15841 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15842 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15843 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15844 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15845 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15846 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15847
15848 !! end
15849
15850 !! test
15851 Single-line or multiline-comments can follow headings
15852 !! options
15853 parsoid=wt2html,wt2wt
15854 !! wikitext
15855 ==foo==<!---->
15856 ==bar==<!--c1-->
15857 ==baz==<!--
15858 c2
15859 c3-->
15860 !! html
15861 <h2><span class="mw-headline" id="foo">foo</span></h2>
15862 <h2><span class="mw-headline" id="bar">bar</span></h2>
15863 <h2><span class="mw-headline" id="baz">baz</span></h2>
15864
15865 !! end
15866
15867 !! test
15868 BUG 1219 URL next to image (broken)
15869 !! wikitext
15870 http://example.com[[File:Foobar.jpg]]
15871 !! html/php
15872 <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>
15873 </p>
15874 !! html/parsoid
15875 <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>
15876 !!end
15877
15878 !! test
15879 Bug 1186 news: in the middle of text
15880 !! wikitext
15881 http://en.wikinews.org/wiki/Wikinews:Workplace
15882 !! html
15883 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15884 </p>
15885 !!end
15886
15887
15888 !! test
15889 Namespaced link must have a title
15890 !! wikitext
15891 [[Project:]]
15892 !! html
15893 <p>[[Project:]]
15894 </p>
15895 !!end
15896
15897 !! test
15898 Namespaced link must have a title (bad fragment version)
15899 !! wikitext
15900 [[Project:#fragment]]
15901 !! html
15902 <p>[[Project:#fragment]]
15903 </p>
15904 !!end
15905
15906
15907 ###
15908 ### HTML tags and HTML attributes
15909 ###
15910
15911 !! test
15912 div with no attributes
15913 !! wikitext
15914 <div>HTML rocks</div>
15915 !! html
15916 <div>HTML rocks</div>
15917
15918 !! end
15919
15920 !! test
15921 div with double-quoted attribute
15922 !! wikitext
15923 <div id="rock">HTML rocks</div>
15924 !! html
15925 <div id="rock">HTML rocks</div>
15926
15927 !! end
15928
15929 !! test
15930 div with single-quoted attribute
15931 !! wikitext
15932 <div id='rock'>HTML rocks</div>
15933 !! html
15934 <div id="rock">HTML rocks</div>
15935
15936 !! end
15937
15938 !! test
15939 div with unquoted attribute
15940 !! wikitext
15941 <div id=rock>HTML rocks</div>
15942 !! html
15943 <div id="rock">HTML rocks</div>
15944
15945 !! end
15946
15947 !! test
15948 div with illegal double attributes
15949 !! wikitext
15950 <div id="a" id="b">HTML rocks</div>
15951 !! html
15952 <div id="b">HTML rocks</div>
15953
15954 !!end
15955
15956 !! test
15957 div with empty attribute value, space before equals
15958 !! options
15959 parsoid=wt2html,html2html
15960 !! wikitext
15961 <div class =>HTML rocks</div>
15962 !! html/php
15963 <div class="">HTML rocks</div>
15964
15965 !! html/parsoid
15966 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15967 !! end
15968
15969 !! test
15970 div with multiple empty attribute values
15971 !! options
15972 parsoid=wt2html,html2html
15973 !! wikitext
15974 <div id= title=>HTML rocks</div>
15975 !! html/php
15976 <div id="title.3D">HTML rocks</div>
15977
15978 !! html/parsoid
15979 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15980 !! end
15981
15982 !! test
15983 table with multiple empty attribute values
15984 !! options
15985 parsoid=wt2html,html2html
15986 !! wikitext
15987 {| title= id=
15988 | hi
15989 |}
15990 !! html/php
15991 <table title="id=">
15992 <tr>
15993 <td> hi
15994 </td></tr></table>
15995
15996 !! html/parsoid
15997 <table title="id=">
15998 <tbody><tr><td> hi</td></tr>
15999 </tbody></table>
16000 !! end
16001
16002 !! test
16003 div with braces in attribute value
16004 !! wikitext
16005 <div title="{}">Foo</div>
16006 !! html/php
16007 <div title="&#123;}">Foo</div>
16008
16009 !! html/parsoid
16010 <div title="{}">Foo</div>
16011 !! end
16012
16013 !! test
16014 div with empty attribute value, no space before equals
16015 !! options
16016 parsoid=wt2html,html2html
16017 !! wikitext
16018 <div class=>HTML rocks</div>
16019 !! html/php
16020 <div class="">HTML rocks</div>
16021
16022 !! html/parsoid
16023 <div class="">HTML rocks</div>
16024 !! end
16025
16026 !! test
16027 HTML multiple attributes correction
16028 !! wikitext
16029 <p class="error" class="awesome">Awesome!</p>
16030 !! html
16031 <p class="awesome">Awesome!</p>
16032
16033 !!end
16034
16035 !! test
16036 Table multiple attributes correction
16037 !! wikitext
16038 {|
16039 !+ class="error" class="awesome"| status
16040 |}
16041 !! html
16042 <table>
16043 <tr>
16044 <th class="awesome"> status
16045 </th></tr></table>
16046
16047 !!end
16048
16049 !! test
16050 DIV IN UPPERCASE
16051 !! wikitext
16052 <DIV ID="x">HTML ROCKS</DIV>
16053 !! html
16054 <div id="x">HTML ROCKS</div>
16055
16056 !!end
16057
16058 !! test
16059 Non-ASCII pseudo-tags are rendered as text
16060 !! wikitext
16061 <khyô>
16062 !! html
16063 <p>&lt;khyô&gt;
16064 </p>
16065 !! end
16066
16067 !! test
16068 Pseudo-tag with URL 'name' renders as url link
16069 !! wikitext
16070 <http://example.com/>
16071 !! html
16072 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16073 </p>
16074 !! end
16075
16076 !! test
16077 text with amp in the middle of nowhere
16078 !! wikitext
16079 Remember AT&T?
16080 !! html
16081 <p>Remember AT&amp;T?
16082 </p>
16083 !! end
16084
16085 !! test
16086 text with character entity: eacute
16087 !! wikitext
16088 I always thought &eacute; was a cute letter.
16089 !! html
16090 <p>I always thought &#233; was a cute letter.
16091 </p>
16092 !! html+tidy
16093 <p>I always thought é was a cute letter.</p>
16094 !! end
16095
16096 !! test
16097 text with entity-escaped character entity-like string: eacute
16098 !! wikitext
16099 I always thought &amp;eacute; was a cute letter.
16100 !! html
16101 <p>I always thought &amp;eacute; was a cute letter.
16102 </p>
16103 !! end
16104
16105 !! test
16106 text with undefined character entity: xacute
16107 !! wikitext
16108 I always thought &xacute; was a cute letter.
16109 !! html
16110 <p>I always thought &amp;xacute; was a cute letter.
16111 </p>
16112 !! end
16113
16114 !! test
16115 HTML5 tags
16116 !! wikitext
16117 <data value="5">five</data>
16118 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16119 <mark>This highlighted text</mark>
16120 !! html
16121 <p><data value="5">five</data>
16122 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16123 <mark>This highlighted text</mark>
16124 </p>
16125 !! end
16126
16127 !! test
16128 HTML tag with leading space is parsed as text
16129 !! wikitext
16130 < div>foo< /div>
16131 !! html
16132 <p>&lt; div&gt;foo&lt; /div&gt;
16133 </p>
16134 !! end
16135
16136 ###
16137 ### Nesting tests (see bug 41545, 50604, 51081)
16138 ###
16139
16140 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
16141 # Note that html2wt is considerably more difficult if we use <b> in
16142 # the test case, instead of <big>
16143 !! test
16144 Ensure that HTML adoption agency algorithm is properly implemented.
16145 !! wikitext
16146 <big>X<big>Y</big>Z</big>
16147 !! html
16148 <p><big>X<big>Y</big>Z</big>
16149 </p>
16150 !! end
16151
16152 # This was bug 41545 in the PHP parser.
16153 # Note that tidy doesn't handle this correctly.
16154 !! test
16155 Nesting of <kbd>
16156 !! wikitext
16157 <kbd>X<kbd>Y</kbd>Z</kbd>
16158 !! html
16159 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16160 </p>
16161 !! end
16162
16163 # The following cases were bug 51081 in the PHP parser.
16164 # Note that there are some other nestable tags (b, i, etc) which are
16165 # not covered; see bug 51081 for discussion.
16166
16167 # Note that tidy doesn't handle this correctly.
16168 !! test
16169 Nesting of <em>
16170 !! wikitext
16171 <em>X<em>Y</em>Z</em>
16172 !! html
16173 <p><em>X<em>Y</em>Z</em>
16174 </p>
16175 !! end
16176
16177 # Note that tidy doesn't handle this correctly.
16178 !! test
16179 Nesting of <strong>
16180 !! wikitext
16181 <strong>X<strong>Y</strong>Z</strong>
16182 !! html
16183 <p><strong>X<strong>Y</strong>Z</strong>
16184 </p>
16185 !! end
16186
16187 !! test
16188 Nesting of <q>
16189 !! wikitext
16190 <q>X<q>Y</q>Z</q>
16191 !! html+tidy
16192 <p><q>X<q>Y</q>Z</q></p>
16193 !! end
16194
16195 # Note that tidy doesn't handle this correctly.
16196 !! test
16197 Nesting of <ruby>
16198 !! wikitext
16199 <ruby>X<ruby>Y</ruby>Z</ruby>
16200 !! html
16201 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16202 </p>
16203 !! end
16204
16205 # Note that tidy doesn't handle this correctly.
16206 !! test
16207 Nesting of <bdo>
16208 !! wikitext
16209 <bdo>X<bdo>Y</bdo>Z</bdo>
16210 !! html
16211 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16212 </p>
16213 !! end
16214
16215
16216 ###
16217 ### Media links
16218 ###
16219
16220 !! test
16221 Media link
16222 !! wikitext
16223 [[Media:Foobar.jpg]]
16224 !! html
16225 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16226 </p>
16227 !! end
16228
16229 !! test
16230 Media link with text
16231 !! wikitext
16232 [[Media:Foobar.jpg|A neat file to look at]]
16233 !! html
16234 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16235 </p>
16236 !! end
16237
16238 # FIXME: this is still bad HTML tag nesting
16239 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16240 !! test
16241 Media link with nasty text
16242 !! wikitext
16243 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16244 !! html
16245 <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>
16246
16247 !! html+tidy
16248 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16249 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16250 !! end
16251
16252 !! test
16253 Media link to nonexistent file (bug 1702)
16254 !! wikitext
16255 [[Media:No such.jpg]]
16256 !! html
16257 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16258 </p>
16259 !! end
16260
16261 !! test
16262 Image link to nonexistent file (bug 1850 - good)
16263 !! wikitext
16264 [[File:No_such.jpg]]
16265 !! html/php
16266 <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>
16267 </p>
16268 !! html/parsoid
16269 <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>
16270 !! end
16271
16272 !! test
16273 :Image link to nonexistent file (bug 1850 - bad)
16274 !! wikitext
16275 [[:Image:No such.jpg]]
16276 !! html/php
16277 <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>
16278 </p>
16279 !! html/parsoid
16280 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16281 !! end
16282
16283
16284
16285 !! test
16286 Character reference normalization in link text (bug 1938)
16287 !! wikitext
16288 [[Main Page|this&that]]
16289 !! html
16290 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16291 </p>
16292 !!end
16293
16294 !! article
16295 אַ
16296 !! text
16297 Test for unicode normalization
16298
16299 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16300 !! endarticle
16301
16302 !! test
16303 (bug 19451) Links should refer to the normalized form.
16304 !! wikitext
16305 [[&#xFB2E;]]
16306 [[&#x5d0;&#x5b7;]]
16307 [[&#x5d0;ַ]]
16308 [[א&#x5b7;]]
16309 [[אַ]]
16310 !! html
16311 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16312 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16313 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16314 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16315 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16316 </p>
16317 !! end
16318
16319 !! test
16320 Empty attribute crash test (bug 2067)
16321 !! wikitext
16322 <font color="">foo</font>
16323 !! html
16324 <p><font color="">foo</font>
16325 </p>
16326 !! end
16327
16328 !! test
16329 Empty attribute crash test single-quotes (bug 2067)
16330 !! wikitext
16331 <font color=''>foo</font>
16332 !! html
16333 <p><font color="">foo</font>
16334 </p>
16335 !! end
16336
16337 !! test
16338 Attribute test: equals, then nothing
16339 !! options
16340 parsoid=wt2html,html2html
16341 !! wikitext
16342 <font color=>foo</font>
16343 !! html/php
16344 <p><font color="">foo</font>
16345 </p>
16346 !! html/parsoid
16347 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16348 !! end
16349
16350 !! test
16351 Attribute test: unquoted value
16352 !! options
16353 parsoid=wt2html,html2html
16354 !! wikitext
16355 <font color=x>foo</font>
16356 !! html/php
16357 <p><font color="x">foo</font>
16358 </p>
16359 !! html/parsoid
16360 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16361 !! end
16362
16363 !! test
16364 Attribute test: unquoted but illegal value (hash)
16365 !! wikitext
16366 <font color=#x>foo</font>
16367 !! html
16368 <p><font color="#x">foo</font>
16369 </p>
16370 !! end
16371
16372 # Parsoid does not serialize to empty attribute syntax,
16373 # so wt2wt and html2wt cases are skipped
16374 !! test
16375 Attribute test: no value (T54330)
16376 !! options
16377 parsoid=wt2html,html2html
16378 !! wikitext
16379 <font color>foo</font>
16380 !! html/php
16381 <p><font color="">foo</font>
16382 </p>
16383 !! html/parsoid
16384 <p><font color="">foo</font></p>
16385 !! end
16386
16387 !! test
16388 Bug 2095: link with three closing brackets
16389 !! wikitext
16390 [[Main Page]]]
16391 !! html/php
16392 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16393 </p>
16394 !! html/parsoid
16395 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16396 !! end
16397
16398 !! test
16399 Bug 2095: link with pipe and three closing brackets
16400 !! wikitext
16401 [[Main Page|link]]]
16402 !! html/php
16403 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16404 </p>
16405 !! html/parsoid
16406 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16407 !! end
16408
16409 !! test
16410 Bug 2095: link with pipe and three closing brackets, version 2
16411 !! wikitext
16412 [[Main Page|[http://example.com/]]]
16413 !! html/php
16414 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16415 </p>
16416 !! html/parsoid
16417 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16418 !! end
16419
16420
16421 ###
16422 ### Safety
16423 ###
16424
16425 !! article
16426 Template:Dangerous attribute
16427 !! text
16428 " onmouseover="alert(document.cookie)
16429 !! endarticle
16430
16431 !! article
16432 Template:Dangerous style attribute
16433 !! text
16434 border-size: expression(alert(document.cookie))
16435 !! endarticle
16436
16437 !! article
16438 Template:Div style
16439 !! text
16440 <div style="float: right; {{{1}}}">Magic div</div>
16441 !! endarticle
16442
16443 !! test
16444 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16445 !! wikitext
16446 <div title="{{test}}"></div>
16447 !! html
16448 <div title="This is a test template"></div>
16449
16450 !! end
16451
16452 # Parsoid has enough context to handle this case
16453 !! test
16454 Bug 2304: HTML attribute safety (dangerous template; 2309)
16455 !! wikitext
16456 <div title="{{dangerous attribute}}"></div>
16457 !! html/php
16458 <div title=""></div>
16459
16460 !! html/parsoid
16461 <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>
16462 !! end
16463
16464 !! test
16465 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16466 !! wikitext
16467 <div style="{{dangerous style attribute}}"></div>
16468 !! html
16469 <div style="/* insecure input */"></div>
16470
16471 !! end
16472
16473 !! test
16474 Bug 2304: HTML attribute safety (safe parameter; 2309)
16475 !! wikitext
16476 {{div style|width: 200px}}
16477 !! html
16478 <div style="float: right; width: 200px">Magic div</div>
16479
16480 !! end
16481
16482 !! test
16483 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16484 !! wikitext
16485 {{div style|width: expression(alert(document.cookie))}}
16486 !! html
16487 <div style="/* insecure input */">Magic div</div>
16488
16489 !! end
16490
16491 !! test
16492 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16493 !! wikitext
16494 {{div style|"><script>alert(document.cookie)</script>}}
16495 !! html
16496 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16497
16498 !! end
16499
16500 !! test
16501 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16502 !! wikitext
16503 {{div style|" ><script>alert(document.cookie)</script>}}
16504 !! html
16505 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16506
16507 !! end
16508
16509 !! test
16510 Bug 2304: HTML attribute safety (link)
16511 !! wikitext
16512 <div title="[[Main Page]]"></div>
16513 !! html
16514 <div title="&#91;&#91;Main Page]]"></div>
16515
16516 !! end
16517
16518 !! test
16519 Bug 2304: HTML attribute safety (italics)
16520 !! wikitext
16521 <div title="''foobar''"></div>
16522 !! html
16523 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16524
16525 !! end
16526
16527 !! test
16528 Bug 2304: HTML attribute safety (bold)
16529 !! wikitext
16530 <div title="'''foobar'''"></div>
16531 !! html
16532 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16533
16534 !! end
16535
16536
16537 !! test
16538 Bug 2304: HTML attribute safety (ISBN)
16539 !! wikitext
16540 <div title="ISBN 1234567890"></div>
16541 !! html
16542 <div title="&#73;SBN 1234567890"></div>
16543
16544 !! end
16545
16546 !! test
16547 Bug 2304: HTML attribute safety (RFC)
16548 !! wikitext
16549 <div title="RFC 1234"></div>
16550 !! html
16551 <div title="&#82;FC 1234"></div>
16552
16553 !! end
16554
16555 !! test
16556 Bug 2304: HTML attribute safety (PMID)
16557 !! wikitext
16558 <div title="PMID 1234567890"></div>
16559 !! html
16560 <div title="&#80;MID 1234567890"></div>
16561
16562 !! end
16563
16564 !! test
16565 Bug 2304: HTML attribute safety (web link)
16566 !! wikitext
16567 <div title="http://example.com/"></div>
16568 !! html
16569 <div title="http&#58;//example.com/"></div>
16570
16571 !! end
16572
16573 !! test
16574 Bug 2304: HTML attribute safety (named web link)
16575 !! wikitext
16576 <div title="[http://example.com/ link]"></div>
16577 !! html
16578 <div title="&#91;http&#58;//example.com/ link]"></div>
16579
16580 !! end
16581
16582 !! test
16583 Bug 3244: HTML attribute safety (extension; safe)
16584 !! wikitext
16585 <div style="<nowiki>background:blue</nowiki>"></div>
16586 !! html
16587 <div style="background:blue"></div>
16588
16589 !! end
16590
16591 !! test
16592 Bug 3244: HTML attribute safety (extension; unsafe)
16593 !! wikitext
16594 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16595 !! html
16596 <div style="/* insecure input */"></div>
16597
16598 !! end
16599
16600 # More MSIE fun discovered by Tom Gilder
16601
16602 !! test
16603 MSIE CSS safety test: spurious slash
16604 !! wikitext
16605 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16606 !! html
16607 <div style="/* insecure input */">evil</div>
16608
16609 !! end
16610
16611 !! test
16612 MSIE CSS safety test: hex code
16613 !! wikitext
16614 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16615 !! html
16616 <div style="/* insecure input */">evil</div>
16617
16618 !! end
16619
16620 !! test
16621 MSIE CSS safety test: comment in url
16622 !! wikitext
16623 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16624 !! html
16625 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16626
16627 !! end
16628
16629 !! test
16630 MSIE CSS safety test: comment in expression
16631 !! wikitext
16632 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16633 !! html
16634 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16635
16636 !! end
16637
16638 !! test
16639 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16640 !! wikitext
16641 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16642 !! html
16643 <p style="/* invalid control char */">A</p>
16644
16645 !! end
16646
16647 !! test
16648 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16649 !! wikitext
16650 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16651 <div style="top:EXPRESSION(alert())">B</div>
16652 !! html
16653 <p style="/* insecure input */">A</p>
16654 <div style="/* insecure input */">B</div>
16655
16656 !! end
16657
16658 !! test
16659 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16660 !! wikitext
16661 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16662 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16663 !! html
16664 <div style="/* insecure input */">A</div>
16665 <p style="/* insecure input */">B</p>
16666
16667 !! end
16668
16669 !! test
16670 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16671 !! wikitext
16672 <div style="background-image:url⁽javascript:alert())">A</div>
16673 <div style="background-image:url₍javascript:alert())">B</div>
16674 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16675 !! html
16676 <div style="/* insecure input */">A</div>
16677 <div style="/* insecure input */">B</div>
16678 <p style="/* insecure input */">C</p>
16679
16680 !! end
16681
16682 # FIXME: Parsoid fails to sanitize this! See T58846.
16683 !! test
16684 Opera -o-link CSS
16685 !! wikitext
16686 <div
16687 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;"
16688 style="-o-link:attr(title);-o-link-source:current">X</div>
16689 !! html
16690 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16691
16692 !! end
16693
16694 !! test
16695 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16696 !! wikitext
16697 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16698 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16699 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16700 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16701 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16702 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16703 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16704 !! html
16705 <p style="/* insecure input */">A</p>
16706 <p style="/* insecure input */">B</p>
16707 <p style="/* insecure input */">C</p>
16708 <p style="/* insecure input */">D</p>
16709 <p style="/* insecure input */">E</p>
16710 <p style="/* insecure input */">F</p>
16711 <p style="/* insecure input */">G</p>
16712
16713 !! end
16714
16715 !! test
16716 Table attribute legitimate extension
16717 !! wikitext
16718 {|
16719 !+ style="<nowiki>color:blue</nowiki>"| status
16720 |}
16721 !! html
16722 <table>
16723 <tr>
16724 <th style="color:blue"> status
16725 </th></tr></table>
16726
16727 !!end
16728
16729 !! test
16730 Table attribute safety
16731 !! wikitext
16732 {|
16733 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16734 |}
16735 !! html
16736 <table>
16737 <tr>
16738 <th style="/* insecure input */"> status
16739 </th></tr></table>
16740
16741 !! end
16742
16743 !! test
16744 CSS line continuation 1
16745 !! wikitext
16746 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16747 !! html
16748 <div style="/* insecure input */"></div>
16749
16750 !! end
16751
16752 !! test
16753 CSS line continuation 2
16754 !! wikitext
16755 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16756 !! html
16757 <div style="/* invalid control char */"></div>
16758
16759 !! end
16760
16761 !! article
16762 Template:Identity
16763 !! text
16764 {{{1}}}
16765 !! endarticle
16766
16767 !! test
16768 Expansion of multi-line templates in attribute values (bug 6255)
16769 !! wikitext
16770 <div style="background: {{identity|#00FF00}}">-</div>
16771 !! html
16772 <div style="background: #00FF00">-</div>
16773
16774 !! end
16775
16776
16777 !! test
16778 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16779 !! wikitext
16780 <div style="background:
16781 #00FF00">-</div>
16782 !! html/php
16783 <div style="background: #00FF00">-</div>
16784
16785 !! html/parsoid
16786 <div style="background:
16787 #00FF00">-</div>
16788 !! end
16789
16790 !! test
16791 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16792 !! wikitext
16793 <div style="background: &#10;#00FF00">-</div>
16794 !! html
16795 <div style="background: &#10;#00FF00">-</div>
16796
16797 !! end
16798
16799 !! test
16800 Tags which are hidden from Tidy cannot pass through the Sanitizer
16801 !! wikitext
16802 <mw:toc><script>alert();</script></mw:toc>
16803 !! html+tidy
16804 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
16805 !! end
16806
16807 ###
16808 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16809 ###
16810 !! test
16811 Parser hook: empty input
16812 !! wikitext
16813 <tag></tag>
16814 !! html/php
16815 <pre>
16816 ''
16817 array (
16818 )
16819 </pre>
16820
16821 !! html/parsoid
16822 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16823 !! end
16824
16825 ## Don't expect parsoid to rt this form.
16826 !! test
16827 Parser hook: empty input using terminated empty elements
16828 !! options
16829 parsoid=wt2html,html2html
16830 !! wikitext
16831 <tag/>
16832 !! html/php
16833 <pre>
16834 NULL
16835 array (
16836 )
16837 </pre>
16838
16839 !! html/parsoid
16840 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16841 !! end
16842
16843 !! test
16844 Parser hook: empty input using terminated empty elements (space before)
16845 !! wikitext
16846 <tag />
16847 !! html/php
16848 <pre>
16849 NULL
16850 array (
16851 )
16852 </pre>
16853
16854 !! html/parsoid
16855 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16856 !! end
16857
16858 !! test
16859 Parser hook: basic input
16860 !! wikitext
16861 <tag>input</tag>
16862 !! html/php
16863 <pre>
16864 'input'
16865 array (
16866 )
16867 </pre>
16868
16869 !! html/parsoid
16870 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16871 !! end
16872
16873 ## Don't expect parsoid to rt this form.
16874 !! test
16875 Parser hook: case insensitive
16876 !! options
16877 parsoid=wt2html,html2html
16878 !! wikitext
16879 <TAG>input</TAG>
16880 !! html/php
16881 <pre>
16882 'input'
16883 array (
16884 )
16885 </pre>
16886
16887 !! html/parsoid
16888 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16889 !! end
16890
16891 ## Don't expect parsoid to rt this form.
16892 !! test
16893 Parser hook: case insensitive, redux
16894 !! options
16895 parsoid=wt2html,html2html
16896 !! wikitext
16897 <TaG>input</TAg>
16898 !! html/php
16899 <pre>
16900 'input'
16901 array (
16902 )
16903 </pre>
16904
16905 !! html/parsoid
16906 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16907 !! end
16908
16909 !! test
16910 Parser hook: nested tags
16911 !! wikitext
16912 <tag><tag></tag></tag>
16913 !! html/php
16914 <pre>
16915 '<tag>'
16916 array (
16917 )
16918 </pre>&lt;/tag&gt;
16919
16920 !! html/parsoid
16921 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16922 !! end
16923
16924 !! test
16925 Parser hook: basic arguments
16926 !! wikitext
16927 <tag width="200" height="100" depth="50" square=""></tag>
16928 !! html/php
16929 <pre>
16930 ''
16931 array (
16932 'width' => '200',
16933 'height' => '100',
16934 'depth' => '50',
16935 'square' => '',
16936 )
16937 </pre>
16938
16939 !! html/parsoid
16940 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16941 !! end
16942
16943 ## Don't expect parsoid to rt this form.
16944 !! test
16945 Parser hook: basic arguments, variations
16946 !! options
16947 parsoid=wt2html,html2html
16948 !! wikitext
16949 <tag width=200 height = "100" depth = '50' square></tag>
16950 !! html/php
16951 <pre>
16952 ''
16953 array (
16954 'width' => '200',
16955 'height' => '100',
16956 'depth' => '50',
16957 'square' => '',
16958 )
16959 </pre>
16960
16961 !! html/parsoid
16962 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16963 !! end
16964
16965 !! test
16966 Parser hook: argument containing a forward slash (bug 5344)
16967 !! wikitext
16968 <tag filename="/tmp/bla"></tag>
16969 !! html/php
16970 <pre>
16971 ''
16972 array (
16973 'filename' => '/tmp/bla',
16974 )
16975 </pre>
16976
16977 !! html/parsoid
16978 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16979 !! end
16980
16981 ## Don't expect parsoid to rt this form.
16982 !! test
16983 Parser hook: empty input using terminated empty elements (bug 2374)
16984 !! options
16985 parsoid=wt2html,html2html
16986 !! wikitext
16987 <tag foo=bar/>text
16988 !! html/php
16989 <pre>
16990 NULL
16991 array (
16992 'foo' => 'bar',
16993 )
16994 </pre>text
16995
16996 !! html/parsoid
16997 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16998 !! end
16999
17000 ## </tag> should be output literally since there is no matching tag that begins it
17001 ## Don't expect parsoid to rt this form.
17002 !! test
17003 Parser hook: basic arguments using terminated empty elements (bug 2374)
17004 !! options
17005 parsoid=wt2html
17006 !! wikitext
17007 <tag width=200 height = "100" depth = '50' square/>
17008 other stuff
17009 </tag>
17010 !! html/php
17011 <pre>
17012 NULL
17013 array (
17014 'width' => '200',
17015 'height' => '100',
17016 'depth' => '50',
17017 'square' => '',
17018 )
17019 </pre>
17020 <p>other stuff
17021 &lt;/tag&gt;
17022 </p>
17023 !! html/parsoid
17024 <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
17025 &lt;/tag></p>
17026 !! end
17027
17028 ## Don't expect parsoid to rt this form.
17029 !! test
17030 Parser hook: Don't allow unclosed extension tags
17031 !! options
17032 parsoid=wt2html
17033 !! wikitext
17034 test <tag>123
17035
17036 this is a '''test'''
17037 !! html/php
17038 <p>test &lt;tag&gt;123
17039 </p><p>this is a <b>test</b>
17040 </p>
17041 !! html/parsoid
17042 <p>test &lt;tag>123</p>
17043
17044 <p>this is a <b>test</b></p>
17045 !! end
17046
17047 ###
17048 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17049 ###
17050
17051 !! test
17052 Parser hook: static parser hook not inside a comment
17053 !! wikitext
17054 <statictag>hello, world</statictag>
17055
17056 <statictag action="flush" />
17057 !! html/php
17058 <p><br />
17059 hello, world
17060 </p>
17061 !! html/parsoid
17062 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17063 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17064 !! end
17065
17066 !! test
17067 Parser hook: static parser hook inside a comment
17068 !! wikitext
17069 <!-- <statictag>hello, world</statictag> -->
17070 <statictag action="flush" />
17071 !! html/php
17072 <p><br />
17073 </p>
17074 !! html/parsoid
17075 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17076 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17077 !! end
17078
17079 # Nested template calls; this case was broken by Parser.php rev 1.506,
17080 # since reverted.
17081
17082 !! article
17083 Template:One-parameter
17084 !! text
17085 (My parameter is: {{{1}}})
17086 !! endarticle
17087
17088 !! article
17089 Template:Map-one-parameter
17090 !! text
17091 {{{{{1}}}|{{{2}}}}}
17092 !! endarticle
17093
17094 !! test
17095 Nested template calls
17096 !! wikitext
17097 {{Map-one-parameter|One-parameter|param}}
17098 !! html
17099 <p>(My parameter is: param)
17100 </p>
17101 !! end
17102
17103
17104 ###
17105 ### Sanitizer
17106 ###
17107
17108 # HTML+Tidy effectively strips out the empty tags completely
17109 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17110 # which Tidy would have done for the PHP parser had there been content inside it.
17111 !! test
17112 Sanitizer: Closing of open tags
17113 !! wikitext
17114 <s></s><table></table>
17115 !! html
17116 <s></s><table></table>
17117
17118 !! html/parsoid
17119 <p><s></s></p><table></table>
17120 !! end
17121
17122 !! test
17123 Sanitizer: Closing of open but not closed tags
17124 !! wikitext
17125 <s>foo
17126 !! html
17127 <p><s>foo</s>
17128 </p>
17129 !! end
17130
17131 !! test
17132 Sanitizer: Closing of closed but not open tags
17133 !! options
17134 parsoid=wt2html
17135 !! wikitext
17136 </s>
17137 !! html/php+tidy
17138 !! html/parsoid
17139 !! end
17140
17141 !! test
17142 Sanitizer: Closing of closed but not open table tags
17143 !! options
17144 parsoid=wt2html
17145 !! wikitext
17146 Table not started</td></tr></table>
17147 !! html/php+tidy
17148 <p>Table not started</p>
17149 !! html/parsoid
17150 <p>Table not started</p>
17151 !! end
17152
17153 !! test
17154 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17155 !! wikitext
17156 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17157 !! html/php
17158 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17159 </p>
17160 !! html/parsoid
17161 <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>
17162 !! end
17163
17164 # In HTML5, the restrictions are that id must contain at least one character,
17165 # and must not contain any space characters.
17166 !! test
17167 Sanitizer: Validating the contents of the id attribute (bug 4515)
17168 !! options
17169 disabled
17170 !! wikitext
17171 <br id="" /><br id="a space" />
17172 !! html
17173 Something ...
17174 !! end
17175
17176 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17177 !! test
17178 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
17179 !! options
17180 disabled
17181 !! wikitext
17182 <br id="foo" /><br id="foo" />
17183 !! html
17184 Something need to be done. foo-2 ?
17185 !! end
17186
17187 !! test
17188 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17189 !! wikitext
17190 <div itemscope>
17191 <meta itemprop="hello" content="world">
17192 <meta http-equiv="refresh" content="5">
17193 <meta itemprop="hello" http-equiv="refresh" content="5">
17194 <link itemprop="hello" href="{{SERVER}}">
17195 <link rel="stylesheet" href="{{SERVER}}">
17196 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17197 </div>
17198 !! html
17199 <div itemscope="">
17200 <p> <meta itemprop="hello" content="world" />
17201 &lt;meta http-equiv="refresh" content="5"&gt;
17202 <meta itemprop="hello" content="5" />
17203 </p>
17204 <link itemprop="hello" href="http&#58;//example.org" />
17205 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17206 <link itemprop="hello" href="http&#58;//example.org" />
17207 </div>
17208
17209 !! end
17210
17211 !! test
17212 Language converter: output gets cut off unexpectedly (bug 5757)
17213 !! options
17214 language=zh
17215 !! wikitext
17216 this bit is safe: }-
17217
17218 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17219
17220 then we get cut off here: }-
17221
17222 all additional text is vanished
17223 !! html
17224 <p>this bit is safe: }-
17225 </p><p>but if we add a conversion instance: xxx
17226 </p><p>then we get cut off here: }-
17227 </p><p>all additional text is vanished
17228 </p>
17229 !! end
17230
17231 !! test
17232 Self closed html pairs (bug 5487)
17233 !! options
17234 !! wikitext
17235 <center><font id="bug" />Centered text</center>
17236 <div><font id="bug2" />In div text</div>
17237 !! html
17238 <center>&lt;font id="bug" /&gt;Centered text</center>
17239 <div>&lt;font id="bug2" /&gt;In div text</div>
17240
17241 !! end
17242
17243 #
17244 #
17245 #
17246
17247 !! test
17248 Punctuation: nbsp before exclamation
17249 !! wikitext
17250 C'est grave !
17251 !! html
17252 <p>C'est grave&#160;!
17253 </p>
17254 !! end
17255
17256 !! test
17257 Punctuation: CSS !important (bug 11874)
17258 !! wikitext
17259 <div style="width:50% !important">important</div>
17260 !! html
17261 <div style="width:50% !important">important</div>
17262
17263 !!end
17264
17265 !! test
17266 Punctuation: CSS ! important (bug 11874; with space after)
17267 !! wikitext
17268 <div style="width:50% ! important">important</div>
17269 !! html
17270 <div style="width:50% ! important">important</div>
17271
17272 !!end
17273
17274 !! test
17275 HTML bullet list, closed tags (bug 5497)
17276 !! wikitext
17277 <ul>
17278 <li>One</li>
17279 <li>Two</li>
17280 </ul>
17281 !! html/php
17282 <ul>
17283 <li>One</li>
17284 <li>Two</li>
17285 </ul>
17286
17287 !! html/parsoid
17288 <ul data-parsoid='{"stx":"html"}'>
17289 <li data-parsoid='{"stx":"html"}'>One</li>
17290 <li data-parsoid='{"stx":"html"}'>Two</li>
17291 </ul>
17292
17293 !! end
17294
17295 !! test
17296 HTML bullet list, unclosed tags (bug 5497)
17297 !! wikitext
17298 <ul>
17299 <li>One
17300 <li>Two
17301 </ul>
17302 !! html/php+tidy
17303 <ul>
17304 <li>One</li>
17305 <li>Two</li>
17306 </ul>
17307 !! html/parsoid
17308 <ul data-parsoid='{"stx":"html"}'>
17309 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17310 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17311 </ul>
17312
17313 !! end
17314
17315 !! test
17316 HTML ordered list, closed tags (bug 5497)
17317 !! wikitext
17318 <ol>
17319 <li>One</li>
17320 <li>Two</li>
17321 </ol>
17322 !! html/php
17323 <ol>
17324 <li>One</li>
17325 <li>Two</li>
17326 </ol>
17327
17328 !! html/parsoid
17329 <ol data-parsoid='{"stx":"html"}'>
17330 <li data-parsoid='{"stx":"html"}'>One</li>
17331 <li data-parsoid='{"stx":"html"}'>Two</li>
17332 </ol>
17333
17334 !! end
17335
17336 !! test
17337 HTML ordered list, unclosed tags (bug 5497)
17338 !! options
17339 !! wikitext
17340 <ol>
17341 <li>One
17342 <li>Two
17343 </ol>
17344 !! html/php+tidy
17345 <ol>
17346 <li>One</li>
17347 <li>Two</li>
17348 </ol>
17349 !! html/parsoid
17350 <ol data-parsoid='{"stx":"html"}'>
17351 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17352 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17353 </ol>
17354
17355 !! end
17356
17357 !! test
17358 HTML nested bullet list, closed tags (bug 5497)
17359 !! wikitext
17360 <ul>
17361 <li>One</li>
17362 <li>Two:
17363 <ul>
17364 <li>Sub-one</li>
17365 <li>Sub-two</li>
17366 </ul>
17367 </li>
17368 </ul>
17369 !! html/php
17370 <ul>
17371 <li>One</li>
17372 <li>Two:
17373 <ul>
17374 <li>Sub-one</li>
17375 <li>Sub-two</li>
17376 </ul>
17377 </li>
17378 </ul>
17379
17380 !! html/parsoid
17381 <ul data-parsoid='{"stx":"html"}'>
17382 <li data-parsoid='{"stx":"html"}'>One</li>
17383 <li data-parsoid='{"stx":"html"}'>Two:
17384 <ul data-parsoid='{"stx":"html"}'>
17385 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17386 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17387 </ul>
17388 </li>
17389 </ul>
17390 !! end
17391
17392 !! test
17393 HTML nested bullet list, open tags (bug 5497)
17394 !! wikitext
17395 <ul>
17396 <li>One
17397 <li>Two:
17398 <ul>
17399 <li>Sub-one
17400 <li>Sub-two
17401 </ul>
17402 </ul>
17403 !! html/php+tidy
17404 <ul>
17405 <li>One</li>
17406 <li>Two:
17407 <ul>
17408 <li>Sub-one</li>
17409 <li>Sub-two</li>
17410 </ul>
17411 </li>
17412 </ul>
17413 !! html/parsoid
17414 <ul>
17415 <li>One
17416 </li>
17417 <li>Two:
17418 <ul>
17419 <li>Sub-one
17420 </li>
17421 <li>Sub-two
17422 </li>
17423 </ul>
17424 </li>
17425 </ul>
17426
17427 !! end
17428
17429 !! test
17430 HTML nested ordered list, closed tags (bug 5497)
17431 !! wikitext
17432 <ol>
17433 <li>One</li>
17434 <li>Two:
17435 <ol>
17436 <li>Sub-one</li>
17437 <li>Sub-two</li>
17438 </ol>
17439 </li>
17440 </ol>
17441 !! html
17442 <ol>
17443 <li>One</li>
17444 <li>Two:
17445 <ol>
17446 <li>Sub-one</li>
17447 <li>Sub-two</li>
17448 </ol>
17449 </li>
17450 </ol>
17451
17452 !! end
17453
17454 !! test
17455 HTML nested ordered list, open tags (bug 5497)
17456 !! wikitext
17457 <ol>
17458 <li>One
17459 <li>Two:
17460 <ol>
17461 <li>Sub-one
17462 <li>Sub-two
17463 </ol>
17464 </ol>
17465 !! html/php
17466 <ol>
17467 <li>One
17468 <li>Two:
17469 <ol>
17470 <li>Sub-one
17471 <li>Sub-two
17472 </ol>
17473 </ol>
17474
17475 !! html/parsoid
17476 <ol>
17477 <li>One
17478 </li>
17479 <li>Two:
17480 <ol>
17481 <li>Sub-one
17482 </li>
17483 <li>Sub-two
17484 </li>
17485 </ol>
17486 </li>
17487 </ol>
17488
17489 !! end
17490
17491 !! test
17492 HTML ordered list item with parameters oddity
17493 !! wikitext
17494 <ol><li id="fragment">One</li>
17495 </ol>
17496 !! html
17497 <ol><li id="fragment">One</li>
17498 </ol>
17499
17500 !! end
17501
17502 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17503 !!test
17504 bug 5918: autonumbering
17505 !! wikitext
17506 [http://first/] [http://second] [ftp://ftp]
17507
17508 ftp://inlineftp
17509
17510 [mailto:enclosed@mail.tld With target]
17511
17512 [mailto:enclosed@mail.tld]
17513
17514 mailto:inline@mail.tld
17515 !! html/php
17516 <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>
17517 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17518 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17519 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17520 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17521 </p>
17522 !! html/parsoid
17523 <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>
17524 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17525 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17526 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17527 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17528 !! end
17529
17530
17531 #
17532 # Security and HTML correctness
17533 # From Nick Jenkins' fuzz testing
17534 #
17535
17536 !! test
17537 Fuzz testing: Parser13
17538 !! wikitext
17539 {|
17540 | http://a|
17541 !! html
17542 <table>
17543 <tr>
17544 <td>
17545 </td>
17546 </tr>
17547 </table>
17548
17549 !! end
17550
17551 !! test
17552 Fuzz testing: Parser14
17553 !! wikitext
17554 == onmouseover= ==
17555 http://__TOC__
17556 !! html
17557 <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>
17558 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17559 <ul>
17560 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17561 </ul>
17562 </div>
17563
17564
17565 !! html+tidy
17566 <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>
17567 <p>http://</p>
17568 <div id="toc" class="toc">
17569 <div id="toctitle">
17570 <h2>Contents</h2>
17571 </div>
17572 <ul>
17573 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17574 </ul>
17575 </div>
17576 <p></p>
17577 !! end
17578
17579 !! test
17580 Fuzz testing: Parser14-table
17581 !! options
17582 parsoid=wt2html,html2html
17583 !! wikitext
17584 ==a==
17585 {| STYLE=__TOC__
17586 !! html
17587 <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>
17588 <table style="&#95;_TOC&#95;_">
17589 <tr><td></td></tr>
17590 </table>
17591
17592 !! html+tidy
17593 <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>
17594 <table style="__TOC__">
17595 <tr>
17596 <td></td>
17597 </tr>
17598 </table>
17599 !! html/parsoid
17600 <h2>a</h2>
17601 <table style="__TOC__"></table>
17602 !! end
17603
17604 # Known to produce bogus xml (extra </td>)
17605 !! test
17606 Fuzz testing: Parser16
17607 !! wikitext
17608 {|
17609 !https://||||||
17610 !! html
17611 <table>
17612 <tr>
17613 <th>https://</th>
17614 <th></th>
17615 <th></th>
17616 <th>
17617 </td>
17618 </tr>
17619 </table>
17620
17621 !! html+tidy
17622 <table>
17623 <tr>
17624 <th>https://</th>
17625 <th></th>
17626 <th></th>
17627 <th></th>
17628 </tr>
17629 </table>
17630 !! end
17631
17632 !! test
17633 Fuzz testing: Parser21
17634 !! wikitext
17635 {|
17636 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17637 |
17638 !! html
17639 <table>
17640 <tr>
17641 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17642 </th>
17643 <td>
17644 </td>
17645 </tr>
17646 </table>
17647
17648 !! end
17649
17650 !! test
17651 Fuzz testing: Parser22
17652 !! wikitext
17653 http://===r:::https://b
17654
17655 {|
17656 !! html
17657 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17658 </p>
17659 <table>
17660 <tr><td></td></tr>
17661 </table>
17662
17663 !! end
17664
17665 # Known to produce bad XML for now
17666 !! test
17667 Fuzz testing: Parser24
17668 !! wikitext
17669 {|
17670 {{{|
17671 <u CLASS=
17672 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17673 <br style="onmouseover='alert(document.cookie);' " />
17674
17675 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17676 |
17677 !! html
17678 <table>
17679 {{{|
17680 <u class="&#124;">}}}} &gt;
17681 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17682
17683 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17684 <tr>
17685 <td></u>
17686 </td>
17687 </tr>
17688 </table>
17689
17690 !! end
17691
17692 # Note: the current result listed for this is not what the original one was,
17693 # but the original bug was JavaScript injection, which is fixed in any case.
17694 # It's not clear that the original result listed was any more correct than the
17695 # current one. Original result:
17696 # <p>{{{|
17697 # </p>
17698 # <li class="&#124;&#124;">
17699 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17700 !!test
17701 Fuzz testing: Parser25 (bug 6055)
17702 !! wikitext
17703 {{{
17704 |
17705 <LI CLASS=||
17706 >
17707 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17708 !! html
17709 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17710 </p>
17711 !! end
17712
17713 !!test
17714 Fuzz testing: URL adjacent extension (with space, clean)
17715 !! wikitext
17716 http://example.com <nowiki>junk</nowiki>
17717 !! html/php
17718 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17719 </p>
17720 !! html/parsoid
17721 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17722 !! end
17723
17724 !!test
17725 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17726 !! wikitext
17727 http://example.com<nowiki>junk</nowiki>
17728 !! html/php
17729 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17730 </p>
17731 !! html/parsoid
17732 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17733 !! end
17734
17735 !!test
17736 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17737 !! wikitext
17738 http://example.com<pre>junk</pre>
17739 !! html/php
17740 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17741
17742 !! html/php+tidy
17743 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17744 <pre>
17745 junk
17746 </pre>
17747 !! html/parsoid
17748 <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>
17749 !!end
17750
17751 !!test
17752 Fuzz testing: image with bogus manual thumbnail
17753 !! wikitext
17754 [[Image:foobar.jpg|thumbnail= ]]
17755 !! html/php
17756 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17757
17758 !! html/parsoid
17759 <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>
17760 !!end
17761
17762 !! test
17763 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17764 !! wikitext
17765 <pre dir="&#10;"></pre>
17766 !! html
17767 <pre dir="&#10;"></pre>
17768
17769 !! end
17770
17771 !! test
17772 Parsing optional HTML elements (Bug 6171)
17773 !! options
17774 !! wikitext
17775 <table>
17776 <tr>
17777 <td> Some tabular data</td>
17778 <td> More tabular data ...
17779 <td> And yet som tabular data</td>
17780 </tr>
17781 </table>
17782 !! html
17783 <table>
17784 <tr>
17785 <td> Some tabular data</td>
17786 <td> More tabular data ...
17787 </td><td> And yet som tabular data</td>
17788 </tr>
17789 </table>
17790
17791 !! end
17792
17793 !! test
17794 Correct handling of <td>, <tr> (Bug 6171)
17795 !! options
17796 !! wikitext
17797 <table>
17798 <tr>
17799 <td> Some tabular data</td>
17800 <td> More tabular data ...</td>
17801 <td> And yet som tabular data</td>
17802 </tr>
17803 </table>
17804 !! html
17805 <table>
17806 <tr>
17807 <td> Some tabular data</td>
17808 <td> More tabular data ...</td>
17809 <td> And yet som tabular data</td>
17810 </tr>
17811 </table>
17812
17813 !! end
17814
17815
17816 !! test
17817 Parsing crashing regression (fr:JavaScript)
17818 !! wikitext
17819 </body></x>
17820 !! html
17821 <p>&lt;/body&gt;&lt;/x&gt;
17822 </p>
17823 !! end
17824
17825 !! test
17826 Inline wiki vs wiki block nesting
17827 !! wikitext
17828 '''Bold paragraph
17829
17830 New wiki paragraph
17831 !! html
17832 <p><b>Bold paragraph</b>
17833 </p><p>New wiki paragraph
17834 </p>
17835 !! end
17836
17837 # FIXME: The current php output is documented
17838 # and desired output is the parsoid target.
17839 !! test
17840 Inline HTML vs wiki block nesting
17841 !! wikitext
17842 <b>Bold paragraph
17843
17844 New wiki paragraph
17845 !! html/php
17846 <p><b>Bold paragraph
17847 </p><p>New wiki paragraph</b>
17848 </p>
17849 !! html/parsoid
17850 <p><b>Bold paragraph</b>
17851 </p><p>New wiki paragraph
17852 </p>
17853 !! end
17854
17855 # Original result was this:
17856 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17857 # </p>
17858 # While that might be marginally more intuitive, maybe, the six-apostrophe
17859 # construct is clearly pathological and the result stated here (which is what
17860 # the parser actually does) is about as reasonable as anything.
17861 !!test
17862 Mixing markup for italics and bold
17863 !! options
17864 !! wikitext
17865 '''bold''''''bold''bolditalics'''''
17866 !! html
17867 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17868 </p>
17869 !! end
17870
17871
17872 !! article
17873 Xyzzyx
17874 !! text
17875 Article for special page transclusion test
17876 !! endarticle
17877
17878 !! test
17879 Special page transclusion
17880 !! options
17881 !! wikitext
17882 {{Special:Prefixindex/Xyzzyx}}
17883 !! html
17884 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17885 </ul>
17886
17887 !! end
17888
17889 !! test
17890 Special page transclusion twice (bug 5021)
17891 !! options
17892 !! wikitext
17893 {{Special:Prefixindex/Xyzzyx}}
17894 {{Special:Prefixindex/Xyzzyx}}
17895 !! html
17896 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17897 </ul>
17898 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17899 </ul>
17900
17901 !! end
17902
17903 !! test
17904 Transclusion of default MediaWiki message
17905 !! wikitext
17906 {{MediaWiki:Mainpage}}
17907 !! html
17908 <p>Main Page
17909 </p>
17910 !! end
17911
17912 !! test
17913 Transclusion of nonexistent MediaWiki message
17914 !! wikitext
17915 {{MediaWiki:Mainpagexxx}}
17916 !! html
17917 <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>
17918 </p>
17919 !! end
17920
17921 !! test
17922 Transclusion of MediaWiki message with underscore
17923 !! wikitext
17924 {{MediaWiki:history_short}}
17925 !! html
17926 <p>History
17927 </p>
17928 !! end
17929
17930 !! test
17931 Transclusion of MediaWiki message with space
17932 !! wikitext
17933 {{MediaWiki:history short}}
17934 !! html
17935 <p>History
17936 </p>
17937 !! end
17938
17939 !! test
17940 Invalid header with following text
17941 !! wikitext
17942 = x = y
17943 !! html
17944 <p>= x = y
17945 </p>
17946 !! end
17947
17948
17949 !! test
17950 Section extraction test (section 0)
17951 !! options
17952 section=0
17953 !! wikitext
17954 start
17955 ==a==
17956 ===aa===
17957 ====aaa====
17958 ==b==
17959 ===ba===
17960 ===bb===
17961 ====bba====
17962 ===bc===
17963 ==c==
17964 ===ca===
17965 !! html/php
17966 start
17967 !! end
17968
17969 !! test
17970 Section extraction test (section 1)
17971 !! options
17972 section=1
17973 !! wikitext
17974 start
17975 ==a==
17976 ===aa===
17977 ====aaa====
17978 ==b==
17979 ===ba===
17980 ===bb===
17981 ====bba====
17982 ===bc===
17983 ==c==
17984 ===ca===
17985 !! html/php
17986 ==a==
17987 ===aa===
17988 ====aaa====
17989 !! end
17990
17991 !! test
17992 Section extraction test (section 2)
17993 !! options
17994 section=2
17995 !! wikitext
17996 start
17997 ==a==
17998 ===aa===
17999 ====aaa====
18000 ==b==
18001 ===ba===
18002 ===bb===
18003 ====bba====
18004 ===bc===
18005 ==c==
18006 ===ca===
18007 !! html/php
18008 ===aa===
18009 ====aaa====
18010 !! end
18011
18012 !! test
18013 Section extraction test (section 3)
18014 !! options
18015 section=3
18016 !! wikitext
18017 start
18018 ==a==
18019 ===aa===
18020 ====aaa====
18021 ==b==
18022 ===ba===
18023 ===bb===
18024 ====bba====
18025 ===bc===
18026 ==c==
18027 ===ca===
18028 !! html/php
18029 ====aaa====
18030 !! end
18031
18032 !! test
18033 Section extraction test (section 4)
18034 !! options
18035 section=4
18036 !! wikitext
18037 start
18038 ==a==
18039 ===aa===
18040 ====aaa====
18041 ==b==
18042 ===ba===
18043 ===bb===
18044 ====bba====
18045 ===bc===
18046 ==c==
18047 ===ca===
18048 !! html/php
18049 ==b==
18050 ===ba===
18051 ===bb===
18052 ====bba====
18053 ===bc===
18054 !! end
18055
18056 !! test
18057 Section extraction test (section 5)
18058 !! options
18059 section=5
18060 !! wikitext
18061 start
18062 ==a==
18063 ===aa===
18064 ====aaa====
18065 ==b==
18066 ===ba===
18067 ===bb===
18068 ====bba====
18069 ===bc===
18070 ==c==
18071 ===ca===
18072 !! html/php
18073 ===ba===
18074 !! end
18075
18076 !! test
18077 Section extraction test (section 6)
18078 !! options
18079 section=6
18080 !! wikitext
18081 start
18082 ==a==
18083 ===aa===
18084 ====aaa====
18085 ==b==
18086 ===ba===
18087 ===bb===
18088 ====bba====
18089 ===bc===
18090 ==c==
18091 ===ca===
18092 !! html/php
18093 ===bb===
18094 ====bba====
18095 !! end
18096
18097 !! test
18098 Section extraction test (section 7)
18099 !! options
18100 section=7
18101 !! wikitext
18102 start
18103 ==a==
18104 ===aa===
18105 ====aaa====
18106 ==b==
18107 ===ba===
18108 ===bb===
18109 ====bba====
18110 ===bc===
18111 ==c==
18112 ===ca===
18113 !! html/php
18114 ====bba====
18115 !! end
18116
18117 !! test
18118 Section extraction test (section 8)
18119 !! options
18120 section=8
18121 !! wikitext
18122 start
18123 ==a==
18124 ===aa===
18125 ====aaa====
18126 ==b==
18127 ===ba===
18128 ===bb===
18129 ====bba====
18130 ===bc===
18131 ==c==
18132 ===ca===
18133 !! html/php
18134 ===bc===
18135 !! end
18136
18137 !! test
18138 Section extraction test (section 9)
18139 !! options
18140 section=9
18141 !! wikitext
18142 start
18143 ==a==
18144 ===aa===
18145 ====aaa====
18146 ==b==
18147 ===ba===
18148 ===bb===
18149 ====bba====
18150 ===bc===
18151 ==c==
18152 ===ca===
18153 !! html/php
18154 ==c==
18155 ===ca===
18156 !! end
18157
18158 !! test
18159 Section extraction test (section 10)
18160 !! options
18161 section=10
18162 !! wikitext
18163 start
18164 ==a==
18165 ===aa===
18166 ====aaa====
18167 ==b==
18168 ===ba===
18169 ===bb===
18170 ====bba====
18171 ===bc===
18172 ==c==
18173 ===ca===
18174 !! html/php
18175 ===ca===
18176 !! end
18177
18178 !! test
18179 Section extraction test (nonexistent section 11)
18180 !! options
18181 section=11
18182 !! wikitext
18183 start
18184 ==a==
18185 ===aa===
18186 ====aaa====
18187 ==b==
18188 ===ba===
18189 ===bb===
18190 ====bba====
18191 ===bc===
18192 ==c==
18193 ===ca===
18194 !! html/php
18195 !! end
18196
18197 !! test
18198 Section extraction test with bogus heading (section 1)
18199 !! options
18200 section=1
18201 !! wikitext
18202 ==a==
18203 ==bogus== not a legal section
18204 ==b==
18205 !! html/php
18206 ==a==
18207 ==bogus== not a legal section
18208 !! end
18209
18210 !! test
18211 Section extraction test with bogus heading (section 2)
18212 !! options
18213 section=2
18214 !! wikitext
18215 ==a==
18216 ==bogus== not a legal section
18217 ==b==
18218 !! html/php
18219 ==b==
18220 !! end
18221
18222 !! test
18223 Section extraction test with comment after heading (section 1)
18224 !! options
18225 section=1
18226 !! wikitext
18227 ==a==
18228 ==b== <!-- -->
18229 ==c==
18230 !! html/php
18231 ==a==
18232 !! end
18233
18234 !! test
18235 Section extraction test with comment after heading (section 2)
18236 !! options
18237 section=2
18238 !! wikitext
18239 ==a==
18240 ==b== <!-- -->
18241 ==c==
18242 !! html/php
18243 ==b== <!-- -->
18244 !! end
18245
18246 !! test
18247 Section extraction test with bogus <nowiki> heading (section 1)
18248 !! options
18249 section=1
18250 !! wikitext
18251 ==a==
18252 ==bogus== <nowiki>not a legal section</nowiki>
18253 ==b==
18254 !! html/php
18255 ==a==
18256 ==bogus== <nowiki>not a legal section</nowiki>
18257 !! end
18258
18259 !! test
18260 Section extraction test with bogus <nowiki> heading (section 2)
18261 !! options
18262 section=2
18263 !! wikitext
18264 ==a==
18265 ==bogus== <nowiki>not a legal section</nowiki>
18266 ==b==
18267 !! html/php
18268 ==b==
18269 !! end
18270
18271 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18272 # instead of respecting commented sections
18273 !! test
18274 Section extraction prefixed by comment (section 1)
18275 !! options
18276 section=1
18277 !! wikitext
18278 <!-- -->==sec1==
18279 ==sec2==
18280 !! html/php
18281 ==sec2==
18282 !!end
18283
18284 !! test
18285 Section extraction prefixed by comment (section 2)
18286 !! options
18287 section=2
18288 !! wikitext
18289 <!-- -->==sec1==
18290 ==sec2==
18291 !! html/php
18292
18293 !!end
18294
18295 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18296 # instead of respecting HTML-style headings
18297 !! test
18298 Section extraction, mixed wiki and html (section 1)
18299 !! options
18300 section=1
18301 !! wikitext
18302 <h2>unmarked</h2>
18303 unmarked
18304 ==1==
18305 one
18306 ==2==
18307 two
18308 !! html/php
18309 ==1==
18310 one
18311 !! end
18312
18313 !! test
18314 Section extraction, mixed wiki and html (section 2)
18315 !! options
18316 section=2
18317 !! wikitext
18318 <h2>unmarked</h2>
18319 unmarked
18320 ==1==
18321 one
18322 ==2==
18323 two
18324 !! html/php
18325 ==2==
18326 two
18327 !! end
18328
18329
18330 # Formerly testing for bug 3342
18331 !! test
18332 Section extraction, heading surrounded by <noinclude>
18333 !! options
18334 section=1
18335 !! wikitext
18336 <noinclude>==unmarked==</noinclude>
18337 ==marked==
18338 !! html/php
18339 ==marked==
18340 !!end
18341
18342 # Test behavior of bug 19910
18343 !! test
18344 Sectiion with all-equals
18345 !! options
18346 section=2
18347 !! wikitext
18348 ===
18349 The line above must have a trailing space
18350 === <!--
18351 --> <!-- -->
18352 But just in case it doesn't...
18353 !! html/php
18354 === <!--
18355 --> <!-- -->
18356 But just in case it doesn't...
18357 !! end
18358
18359 !! test
18360 Section replacement test (section 0)
18361 !! options
18362 replace=0,"xxx"
18363 !! wikitext
18364 start
18365 ==a==
18366 ===aa===
18367 ====aaa====
18368 ==b==
18369 ===ba===
18370 ===bb===
18371 ====bba====
18372 ===bc===
18373 ==c==
18374 ===ca===
18375 !! html/php
18376 xxx
18377
18378 ==a==
18379 ===aa===
18380 ====aaa====
18381 ==b==
18382 ===ba===
18383 ===bb===
18384 ====bba====
18385 ===bc===
18386 ==c==
18387 ===ca===
18388 !! end
18389
18390 !! test
18391 Section replacement test (section 1)
18392 !! options
18393 replace=1,"xxx"
18394 !! wikitext
18395 start
18396 ==a==
18397 ===aa===
18398 ====aaa====
18399 ==b==
18400 ===ba===
18401 ===bb===
18402 ====bba====
18403 ===bc===
18404 ==c==
18405 ===ca===
18406 !! html/php
18407 start
18408 xxx
18409
18410 ==b==
18411 ===ba===
18412 ===bb===
18413 ====bba====
18414 ===bc===
18415 ==c==
18416 ===ca===
18417 !! end
18418
18419 !! test
18420 Section replacement test (section 2)
18421 !! options
18422 replace=2,"xxx"
18423 !! wikitext
18424 start
18425 ==a==
18426 ===aa===
18427 ====aaa====
18428 ==b==
18429 ===ba===
18430 ===bb===
18431 ====bba====
18432 ===bc===
18433 ==c==
18434 ===ca===
18435 !! html/php
18436 start
18437 ==a==
18438 xxx
18439
18440 ==b==
18441 ===ba===
18442 ===bb===
18443 ====bba====
18444 ===bc===
18445 ==c==
18446 ===ca===
18447 !! end
18448
18449 !! test
18450 Section replacement test (section 3)
18451 !! options
18452 replace=3,"xxx"
18453 !! wikitext
18454 start
18455 ==a==
18456 ===aa===
18457 ====aaa====
18458 ==b==
18459 ===ba===
18460 ===bb===
18461 ====bba====
18462 ===bc===
18463 ==c==
18464 ===ca===
18465 !! html/php
18466 start
18467 ==a==
18468 ===aa===
18469 xxx
18470
18471 ==b==
18472 ===ba===
18473 ===bb===
18474 ====bba====
18475 ===bc===
18476 ==c==
18477 ===ca===
18478 !! end
18479
18480 !! test
18481 Section replacement test (section 4)
18482 !! options
18483 replace=4,"xxx"
18484 !! wikitext
18485 start
18486 ==a==
18487 ===aa===
18488 ====aaa====
18489 ==b==
18490 ===ba===
18491 ===bb===
18492 ====bba====
18493 ===bc===
18494 ==c==
18495 ===ca===
18496 !! html/php
18497 start
18498 ==a==
18499 ===aa===
18500 ====aaa====
18501 xxx
18502
18503 ==c==
18504 ===ca===
18505 !! end
18506
18507 !! test
18508 Section replacement test (section 5)
18509 !! options
18510 replace=5,"xxx"
18511 !! wikitext
18512 start
18513 ==a==
18514 ===aa===
18515 ====aaa====
18516 ==b==
18517 ===ba===
18518 ===bb===
18519 ====bba====
18520 ===bc===
18521 ==c==
18522 ===ca===
18523 !! html/php
18524 start
18525 ==a==
18526 ===aa===
18527 ====aaa====
18528 ==b==
18529 xxx
18530
18531 ===bb===
18532 ====bba====
18533 ===bc===
18534 ==c==
18535 ===ca===
18536 !! end
18537
18538 !! test
18539 Section replacement test (section 6)
18540 !! options
18541 replace=6,"xxx"
18542 !! wikitext
18543 start
18544 ==a==
18545 ===aa===
18546 ====aaa====
18547 ==b==
18548 ===ba===
18549 ===bb===
18550 ====bba====
18551 ===bc===
18552 ==c==
18553 ===ca===
18554 !! html/php
18555 start
18556 ==a==
18557 ===aa===
18558 ====aaa====
18559 ==b==
18560 ===ba===
18561 xxx
18562
18563 ===bc===
18564 ==c==
18565 ===ca===
18566 !! end
18567
18568 !! test
18569 Section replacement test (section 7)
18570 !! options
18571 replace=7,"xxx"
18572 !! wikitext
18573 start
18574 ==a==
18575 ===aa===
18576 ====aaa====
18577 ==b==
18578 ===ba===
18579 ===bb===
18580 ====bba====
18581 ===bc===
18582 ==c==
18583 ===ca===
18584 !! html/php
18585 start
18586 ==a==
18587 ===aa===
18588 ====aaa====
18589 ==b==
18590 ===ba===
18591 ===bb===
18592 xxx
18593
18594 ===bc===
18595 ==c==
18596 ===ca===
18597 !! end
18598
18599 !! test
18600 Section replacement test (section 8)
18601 !! options
18602 replace=8,"xxx"
18603 !! wikitext
18604 start
18605 ==a==
18606 ===aa===
18607 ====aaa====
18608 ==b==
18609 ===ba===
18610 ===bb===
18611 ====bba====
18612 ===bc===
18613 ==c==
18614 ===ca===
18615 !! html/php
18616 start
18617 ==a==
18618 ===aa===
18619 ====aaa====
18620 ==b==
18621 ===ba===
18622 ===bb===
18623 ====bba====
18624 xxx
18625
18626 ==c==
18627 ===ca===
18628 !!end
18629
18630 !! test
18631 Section replacement test (section 9)
18632 !! options
18633 replace=9,"xxx"
18634 !! wikitext
18635 start
18636 ==a==
18637 ===aa===
18638 ====aaa====
18639 ==b==
18640 ===ba===
18641 ===bb===
18642 ====bba====
18643 ===bc===
18644 ==c==
18645 ===ca===
18646 !! html/php
18647 start
18648 ==a==
18649 ===aa===
18650 ====aaa====
18651 ==b==
18652 ===ba===
18653 ===bb===
18654 ====bba====
18655 ===bc===
18656 xxx
18657 !! end
18658
18659 !! test
18660 Section replacement test (section 10)
18661 !! options
18662 replace=10,"xxx"
18663 !! wikitext
18664 start
18665 ==a==
18666 ===aa===
18667 ====aaa====
18668 ==b==
18669 ===ba===
18670 ===bb===
18671 ====bba====
18672 ===bc===
18673 ==c==
18674 ===ca===
18675 !! html/php
18676 start
18677 ==a==
18678 ===aa===
18679 ====aaa====
18680 ==b==
18681 ===ba===
18682 ===bb===
18683 ====bba====
18684 ===bc===
18685 ==c==
18686 xxx
18687 !! end
18688
18689 !! test
18690 Section replacement test with initial whitespace (bug 13728)
18691 !! options
18692 replace=2,"xxx"
18693 !! wikitext
18694 Preformatted initial line
18695 ==a==
18696 ===a===
18697 !! html/php
18698 Preformatted initial line
18699 ==a==
18700 xxx
18701 !! end
18702
18703
18704 !! test
18705 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18706 !! options
18707 section=1
18708 !! wikitext
18709 ==a==
18710 a
18711 !! html/php
18712 ==a==
18713 a
18714 !! end
18715
18716 !! test
18717 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18718 !! options
18719 section=1
18720 !! wikitext
18721 ==a==
18722 a
18723 !! html/php
18724 ==a==
18725 a
18726 !! end
18727
18728
18729 !! test
18730 Section extraction, <pre> around bogus header (bug 10309)
18731 !! options
18732 section=2
18733 !! wikitext
18734 == Section One ==
18735 <pre>
18736 =======
18737 </pre>
18738
18739 == Section Two ==
18740 stuff
18741 !! html/php
18742 == Section Two ==
18743 stuff
18744 !! end
18745
18746 !! test
18747 Section replacement, <pre> around bogus header (bug 10309)
18748 !! options
18749 replace=2,"xxx"
18750 !! wikitext
18751 == Section One ==
18752 <pre>
18753 =======
18754 </pre>
18755
18756 == Section Two ==
18757 stuff
18758 !! html/php
18759 == Section One ==
18760 <pre>
18761 =======
18762 </pre>
18763
18764 xxx
18765 !! end
18766
18767
18768 !! test
18769 Handling of &#x0A; in URLs
18770 !! wikitext
18771 ** irc://&#x0A;a
18772 !! html/php
18773 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18774
18775 !! html/parsoid
18776 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18777 a">irc://
18778 a</a></li></ul></li></ul>
18779 !! end
18780
18781 !! test
18782 Handling of %0A in URLs
18783 !! wikitext
18784 ** irc://%0Aa
18785 !! html/php
18786 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18787
18788 !! html/parsoid
18789 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18790 !! end
18791
18792
18793 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18794 !! test
18795 5 quotes, code coverage +1 line
18796 !! options
18797 parsoid=wt2html
18798 !! wikitext
18799 '''''
18800 !! html/php
18801 !! html/parsoid
18802 <p><b><i></i></b></p>
18803 !! end
18804
18805 # same html as previous, but wikitext adjusted to match parsoid html2wt
18806 # note that wt2html and html2html will put the <i> before the <b>
18807 !! test
18808 5 quotes, code coverage +1 line w/ nowiki (1)
18809 !! options
18810 parsoid=wt2wt,html2wt
18811 !! wikitext
18812 '''''<nowiki/>'''''
18813 !! html/php
18814 <p><i></i>
18815 </p>
18816 !! html/parsoid
18817 <p><b><i></i></b></p>
18818 !! end
18819
18820 # same as previous, just swapping the <i> and <b>
18821 !! test
18822 5 quotes, code coverage +1 line w/ nowiki (2)
18823 !! wikitext
18824 '''''<nowiki/>'''''
18825 !! html/php
18826 <p><i></i>
18827 </p>
18828 !! html/parsoid
18829 <p><i><b></b></i></p>
18830 !! end
18831
18832 !! test
18833 Special:Search page linking.
18834 !! wikitext
18835 {{Special:search}}
18836 !! html
18837 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18838 </p>
18839 !! end
18840
18841 !! test
18842 {{!}} is a magic word
18843 !! wikitext
18844 {{!}} is a magic word there and {{!}} is still a magic word here
18845 | is not a magic word here but {{!}} is still a magic word here
18846 !! html/php
18847 <p>| is a magic word there and | is still a magic word here
18848 | is not a magic word here but | is still a magic word here
18849 </p>
18850 !! html/parsoid
18851 <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
18852 | 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>
18853
18854 !! end
18855
18856 !! test
18857 Say the magic word
18858 !! options
18859 title=[[Parser test]]
18860 !! wikitext
18861 * {{PAGENAME}}
18862 * {{PAGENAMEE}}
18863 * {{FULLPAGENAME}}
18864 * {{FULLPAGENAMEE}}
18865 * {{BASEPAGENAME}}
18866 * {{BASEPAGENAMEE}}
18867 * {{SUBPAGENAME}}
18868 * {{SUBPAGENAMEE}}
18869 * {{ROOTPAGENAME}}
18870 * {{ROOTPAGENAMEE}}
18871 * {{TALKPAGENAME}}
18872 * {{TALKPAGENAMEE}}
18873 * {{SUBJECTPAGENAME}}
18874 * {{SUBJECTPAGENAMEE}}
18875 * {{NAMESPACEE}}
18876 * {{NAMESPACE}}
18877 * {{NAMESPACENUMBER}}
18878 * {{TALKSPACE}}
18879 * {{TALKSPACEE}}
18880 * {{SUBJECTSPACE}}
18881 * {{SUBJECTSPACEE}}
18882 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18883 !! html
18884 <ul><li> Parser test</li>
18885 <li> Parser_test</li>
18886 <li> Parser test</li>
18887 <li> Parser_test</li>
18888 <li> Parser test</li>
18889 <li> Parser_test</li>
18890 <li> Parser test</li>
18891 <li> Parser_test</li>
18892 <li> Parser test</li>
18893 <li> Parser_test</li>
18894 <li> Talk:Parser test</li>
18895 <li> Talk:Parser_test</li>
18896 <li> Parser test</li>
18897 <li> Parser_test</li>
18898 <li> </li>
18899 <li> </li>
18900 <li> 0</li>
18901 <li> Talk</li>
18902 <li> Talk</li>
18903 <li> </li>
18904 <li> </li>
18905 <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>
18906
18907 !! end
18908 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18909
18910 ## Parsoid thinks the "centre" here is a property, not a caption.
18911 !! test
18912 Gallery
18913 !! options
18914 parsoid={
18915 "modes": ["wt2html"],
18916 "nativeGallery": true
18917 }
18918 !! wikitext
18919 <gallery>
18920 image1.png |
18921 image2.gif|||||
18922
18923 image3|
18924 image4 |300px| centre
18925 image5.svg| http://///////
18926 [[x|xx]]]]
18927 * image6
18928 </gallery>
18929 !! html/php
18930 <ul class="gallery mw-gallery-traditional">
18931 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18932 <div class="thumb" style="height: 150px;">Image1.png</div>
18933 <div class="gallerytext">
18934 </div>
18935 </div></li>
18936 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18937 <div class="thumb" style="height: 150px;">Image2.gif</div>
18938 <div class="gallerytext">
18939 </div>
18940 </div></li>
18941 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18942 <div class="thumb" style="height: 150px;">Image3</div>
18943 <div class="gallerytext">
18944 </div>
18945 </div></li>
18946 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18947 <div class="thumb" style="height: 150px;">Image4</div>
18948 <div class="gallerytext">
18949 <pre>centre
18950 </pre>
18951 </div>
18952 </div></li>
18953 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18954 <div class="thumb" style="height: 150px;">Image5.svg</div>
18955 <div class="gallerytext">
18956 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18957 </p>
18958 </div>
18959 </div></li>
18960 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18961 <div class="thumb" style="height: 150px;">* image6</div>
18962 <div class="gallerytext">
18963 </div>
18964 </div></li>
18965 </ul>
18966
18967 !! html/parsoid
18968 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
18969 <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>
18970 <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>
18971 <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>
18972 <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>
18973 <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>
18974 <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>
18975 </ul>
18976 !! end
18977
18978 !! test
18979 Gallery (with options, html)
18980 !! options
18981 parsoid={
18982 "modes": ["wt2html", "html2html"],
18983 "nativeGallery": true
18984 }
18985 !! wikitext
18986 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
18987 File:Nonexistent.jpg|caption
18988 File:Nonexistent.jpg
18989 image:foobar.jpg|some '''caption''' [[Main Page]]
18990 image:foobar.jpg
18991 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18992 </gallery>
18993 !! html/php
18994 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18995 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18996 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18997 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18998 <div class="gallerytext">
18999 <p>caption
19000 </p>
19001 </div>
19002 </div></li>
19003 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19004 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19005 <div class="gallerytext">
19006 </div>
19007 </div></li>
19008 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19009 <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>
19010 <div class="gallerytext">
19011 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19012 </p>
19013 </div>
19014 </div></li>
19015 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19016 <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>
19017 <div class="gallerytext">
19018 </div>
19019 </div></li>
19020 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19021 <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>
19022 <div class="gallerytext">
19023 <p>blabla.
19024 </p>
19025 </div>
19026 </div></li>
19027 </ul>
19028
19029 !! html/parsoid
19030 <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":{}}'>
19031 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19032 <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>
19033 <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>
19034 <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>
19035 <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>
19036 <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>
19037 </ul>
19038 !! end
19039
19040 !! test
19041 Gallery (with options, extsrc)
19042 !! options
19043 parsoid={
19044 "nativeGallery": false
19045 }
19046 !! wikitext
19047 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19048 File:Nonexistent.jpg|caption
19049 File:Nonexistent.jpg
19050 image:foobar.jpg|some '''caption''' [[Main Page]]
19051 image:foobar.jpg
19052 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19053 </gallery>
19054 !! html/php
19055 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19056 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19057 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19058 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19059 <div class="gallerytext">
19060 <p>caption
19061 </p>
19062 </div>
19063 </div></li>
19064 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19065 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19066 <div class="gallerytext">
19067 </div>
19068 </div></li>
19069 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19070 <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>
19071 <div class="gallerytext">
19072 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19073 </p>
19074 </div>
19075 </div></li>
19076 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19077 <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>
19078 <div class="gallerytext">
19079 </div>
19080 </div></li>
19081 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19082 <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>
19083 <div class="gallerytext">
19084 <p>blabla.
19085 </p>
19086 </div>
19087 </div></li>
19088 </ul>
19089
19090 !! html/parsoid
19091 <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"}}'>
19092 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19093 <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>
19094 <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>
19095 <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>
19096 <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>
19097 <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>
19098 </ul>
19099 !! end
19100
19101 !! test
19102 Gallery with link that has fragment
19103 !! options
19104 parsoid={
19105 "modes": ["wt2html", "html2html"],
19106 "nativeGallery": true
19107 }
19108 !! wikitext
19109 <gallery>
19110 image:foobar.jpg|link=Main_Page
19111 image:foobar.jpg|link=Main_Page#section
19112 image:foobar.jpg|link=Main Page#section|caption
19113 </gallery>
19114 !! html/php
19115 <ul class="gallery mw-gallery-traditional">
19116 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19117 <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>
19118 <div class="gallerytext">
19119 </div>
19120 </div></li>
19121 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19122 <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>
19123 <div class="gallerytext">
19124 </div>
19125 </div></li>
19126 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19127 <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>
19128 <div class="gallerytext">
19129 <p>caption
19130 </p>
19131 </div>
19132 </div></li>
19133 </ul>
19134
19135 !! html/parsoid
19136 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19137 <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>
19138 <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>
19139 <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>
19140 </ul>
19141 !! end
19142
19143 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19144 !! test
19145 Gallery with template inside caption
19146 !! options
19147 parsoid={
19148 "nativeGallery": true
19149 }
19150 !! wikitext
19151 <gallery caption="{{echo|hi}}">
19152 File:Foobar.jpg|{{echo|ho}}
19153 </gallery>
19154 !! html/php
19155 <ul class="gallery mw-gallery-traditional">
19156 <li class='gallerycaption'>{{echo|hi}}</li>
19157 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19158 <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>
19159 <div class="gallerytext">
19160 <p>ho
19161 </p>
19162 </div>
19163 </div></li>
19164 </ul>
19165
19166 !! html/parsoid
19167 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19168 <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>
19169 <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>
19170 </ul>
19171 !! end
19172
19173 !! test
19174 Gallery with wikitext inside caption
19175 !! options
19176 parsoid={
19177 "nativeGallery": true
19178 }
19179 !! wikitext
19180 <gallery>
19181 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19182 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19183 </gallery>
19184 !! html/php
19185 <ul class="gallery mw-gallery-traditional">
19186 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19187 <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>
19188 <div class="gallerytext">
19189 <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>
19190 </p>
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/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>
19195 <div class="gallerytext">
19196 <p>This is a test template
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="#mwt6" 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="./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>
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="./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>
19206 </ul>
19207 !! end
19208
19209 !! test
19210 Gallery (with showfilename option)
19211 !! options
19212 parsoid={
19213 "nativeGallery": true
19214 }
19215 !! wikitext
19216 <gallery showfilename="">
19217 File:Nonexistent.jpg|caption
19218 File:Nonexistent.jpg
19219 File:Foobar.jpg|some '''caption''' [[Main Page]]
19220 File:Foobar.jpg
19221 </gallery>
19222 !! html/php
19223 <ul class="gallery mw-gallery-traditional">
19224 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19225 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19226 <div class="gallerytext">
19227 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19228 caption
19229 </p>
19230 </div>
19231 </div></li>
19232 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19233 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19234 <div class="gallerytext">
19235 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19236 </p>
19237 </div>
19238 </div></li>
19239 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19240 <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>
19241 <div class="gallerytext">
19242 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19243 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19244 </p>
19245 </div>
19246 </div></li>
19247 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19248 <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>
19249 <div class="gallerytext">
19250 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19251 </p>
19252 </div>
19253 </div></li>
19254 </ul>
19255
19256 !! html/parsoid
19257 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
19258 <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>
19259 <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>
19260 <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>
19261 <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>
19262 </ul>
19263 !! end
19264
19265 ## Should Parsoid be preserving these variations?
19266 !! test
19267 Gallery (with namespace-less filenames)
19268 !! options
19269 parsoid={
19270 "modes": ["wt2html", "html2html"],
19271 "nativeGallery": true
19272 }
19273 !! wikitext
19274 <gallery>
19275 File:Nonexistent.jpg
19276 Nonexistent.jpg
19277 image:foobar.jpg
19278 foobar.jpg
19279 </gallery>
19280 !! html/php
19281 <ul class="gallery mw-gallery-traditional">
19282 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19283 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19284 <div class="gallerytext">
19285 </div>
19286 </div></li>
19287 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19288 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19289 <div class="gallerytext">
19290 </div>
19291 </div></li>
19292 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19293 <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>
19294 <div class="gallerytext">
19295 </div>
19296 </div></li>
19297 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19298 <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>
19299 <div class="gallerytext">
19300 </div>
19301 </div></li>
19302 </ul>
19303
19304 !! html/parsoid
19305 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19306 <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>
19307 <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>
19308 <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>
19309 <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>
19310 </ul>
19311 !! end
19312
19313 !! test
19314 Gallery override link with WikiLink (T36852)
19315 !! options
19316 parsoid={
19317 "nativeGallery": true
19318 }
19319 !! wikitext
19320 <gallery>
19321 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
19322 </gallery>
19323 !! html/php
19324 <ul class="gallery mw-gallery-traditional">
19325 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19326 <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>
19327 <div class="gallerytext">
19328 </div>
19329 </div></li>
19330 </ul>
19331
19332 !! html/parsoid
19333 <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":{}}'>
19334 <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>
19335 </ul>
19336 !! end
19337
19338 !! test
19339 Gallery override link with absolute external link (T36852)
19340 !! options
19341 parsoid={
19342 "nativeGallery": true
19343 }
19344 !! wikitext
19345 <gallery>
19346 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
19347 </gallery>
19348 !! html/php
19349 <ul class="gallery mw-gallery-traditional">
19350 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19351 <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>
19352 <div class="gallerytext">
19353 </div>
19354 </div></li>
19355 </ul>
19356
19357 !! html/parsoid
19358 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19359 <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>
19360 </ul>
19361 !! end
19362
19363 !! test
19364 Gallery override link with malicious javascript (T36852)
19365 !! options
19366 parsoid={
19367 "modes": ["wt2html", "html2html"],
19368 "nativeGallery": true
19369 }
19370 !! wikitext
19371 <gallery>
19372 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19373 </gallery>
19374 !! html/php
19375 <ul class="gallery mw-gallery-traditional">
19376 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19377 <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>
19378 <div class="gallerytext">
19379 </div>
19380 </div></li>
19381 </ul>
19382
19383 !! html/parsoid
19384 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19385 <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>
19386 </ul>
19387 !! end
19388
19389 !! test
19390 Gallery with invalid title as link (T45964)
19391 !! options
19392 parsoid={
19393 "modes": ["wt2html", "html2html"],
19394 "nativeGallery": true
19395 }
19396 !! wikitext
19397 <gallery>
19398 File:Foobar.jpg|link=<
19399 </gallery>
19400 !! html/php
19401 <ul class="gallery mw-gallery-traditional">
19402 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19403 <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>
19404 <div class="gallerytext">
19405 </div>
19406 </div></li>
19407 </ul>
19408
19409 !! html/parsoid
19410 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19411 <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>
19412 </ul>
19413 !! end
19414
19415 !! test
19416 HTML Hex character encoding (spells the word "JavaScript")
19417 !! options
19418 parsoid=wt2html,wt2wt,html2html
19419 !! wikitext
19420 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19421 !! html/php
19422 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19423 </p>
19424 !! html/php+tidy
19425 <p>JavaScript</p>
19426 !! html/parsoid
19427 <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>
19428 !! end
19429
19430 !! test
19431 HTML Hex character encoding bogus encoding (bug 26437 regression check)
19432 !! wikitext
19433 &#xsee;&#XSEE;
19434 !! html/php
19435 <p>&amp;#xsee;&amp;#XSEE;
19436 </p>
19437 !! html/parsoid
19438 <p>&amp;#xsee;&amp;#XSEE;</p>
19439 !! end
19440
19441 !! test
19442 HTML Hex character encoding mixed case
19443 !! options
19444 parsoid=wt2html,wt2wt,html2html
19445 !! wikitext
19446 &#xEE;&#Xee;
19447 !! html/php
19448 <p>&#xee;&#xee;
19449 </p>
19450 !! html/php+tidy
19451 <p>îî</p>
19452 !! html/parsoid
19453 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19454 !! end
19455
19456 # See: https://www.w3.org/TR/html5/syntax.html#character-references
19457 # Note that U+000C (form feed) is not a valid XML character, so
19458 # it is banned even though allowed in HTML5.
19459 !! test
19460 Illegal character references (T106578)
19461 !! wikitext
19462 ; Null: &#00;
19463 ; FF: &#xC;
19464 ; CR: &#xD;
19465 ; Control (low): &#8;
19466 ; Control (high): &#x7F; &#x9F;
19467 ; Surrogate: &#xD83D;&#xDCA9;
19468 ; This is an okay astral character: &#x1F4A9;
19469 !! html+tidy
19470 <dl>
19471 <dt>Null</dt>
19472 <dd>&amp;#00;</dd>
19473 <dt>FF</dt>
19474 <dd>&amp;#xC;</dd>
19475 <dt>CR</dt>
19476 <dd>&amp;#xD;</dd>
19477 <dt>Control (low)</dt>
19478 <dd>&amp;#8;</dd>
19479 <dt>Control (high)</dt>
19480 <dd>&amp;#x7F; &amp;#x9F;</dd>
19481 <dt>Surrogate</dt>
19482 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19483 <dt>This is an okay astral character</dt>
19484 <dd>💩</dd>
19485 </dl>
19486 !! end
19487
19488 !! test
19489 __FORCETOC__ override
19490 !! wikitext
19491 __NEWSECTIONLINK__
19492 __FORCETOC__
19493 !! html/php
19494 <p><br />
19495 </p>
19496 !! end
19497
19498 !! test
19499 ISBN code coverage
19500 !! wikitext
19501 ISBN 978-0-1234-56&#x20;789
19502 !! html
19503 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19504 </p>
19505 !! html+tidy
19506 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19507 !! html/parsoid
19508 <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>
19509 !! end
19510
19511 !! test
19512 ISBN followed by 5 spaces
19513 !! wikitext
19514 ISBN
19515 !! html
19516 <p>ISBN
19517 </p>
19518 !! end
19519
19520 !! test
19521 Double ISBN
19522 !! wikitext
19523 ISBN ISBN 1234567890
19524 !! html/php
19525 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19526 </p>
19527 !! html/parsoid
19528 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19529 !! end
19530
19531 # Uppercase X and lowercase x as well
19532 !! test
19533 ISBN with an X
19534 !! wikitext
19535 ISBN 3-462-04561-X
19536 ISBN 3-462-04561-x
19537 ISBN 080442957X
19538 ISBN 080442957x
19539 ISBN 978080442957X
19540 ISBN 978080442957x
19541 !! html/php
19542 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19543 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19544 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19545 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19546 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19547 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19548 </p>
19549 !! html/parsoid
19550 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19551 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19552 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19553 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19554 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19555 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19556 !! end
19557
19558 !! test
19559 ISBN with empty prefix (parsoid test)
19560 !! wikitext
19561 ISBN 1234567890
19562 !! html/php
19563 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19564 </p>
19565 !! html/parsoid
19566 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19567 !! end
19568
19569 !! test
19570 Bug 22905: <abbr> followed by ISBN followed by </a>
19571 !! wikitext
19572 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19573 !! html/php
19574 <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>
19575 </p>
19576 !! html/parsoid
19577 <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>
19578 !! end
19579
19580 !! test
19581 Double RFC
19582 !! wikitext
19583 RFC RFC 1234
19584 !! html
19585 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19586 </p>
19587 !! end
19588
19589 !! test
19590 Double RFC with a wiki link
19591 !! wikitext
19592 RFC [[RFC 1234]]
19593 !! html
19594 <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>
19595 </p>
19596 !! end
19597
19598 !! test
19599 RFC code coverage
19600 !! wikitext
19601 RFC 983&#x20;987
19602 !! html
19603 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19604 </p>
19605 !! html+tidy
19606 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19607 !! end
19608
19609 !! test
19610 Centre-aligned image
19611 !! wikitext
19612 [[Image:foobar.jpg|centre]]
19613 !! html
19614 <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>
19615
19616 !!end
19617
19618 !! test
19619 None-aligned image
19620 !! wikitext
19621 [[Image:foobar.jpg|none]]
19622 !! html
19623 <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>
19624
19625 !!end
19626
19627 !! test
19628 Width + Height sized image (using px) (height is ignored)
19629 !! wikitext
19630 [[Image:foobar.jpg|640x480px]]
19631 !! html
19632 <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>
19633 </p>
19634 !!end
19635
19636 !! test
19637 Width-sized image (using px, no following whitespace)
19638 !! wikitext
19639 [[Image:foobar.jpg|640px]]
19640 !! html
19641 <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>
19642 </p>
19643 !!end
19644
19645 !! test
19646 Width-sized image (using px, with following whitespace - test regression from r39467)
19647 !! wikitext
19648 [[Image:foobar.jpg|640px ]]
19649 !! html
19650 <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>
19651 </p>
19652 !!end
19653
19654 !! test
19655 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19656 !! wikitext
19657 [[Image:foobar.jpg| 640px]]
19658 !! html
19659 <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>
19660 </p>
19661 !!end
19662
19663 !! test
19664 Image with page parameter
19665 !! options
19666 djvu
19667 !! wikitext
19668 [[File:LoremIpsum.djvu|page=2]]
19669 !! html/php
19670 <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>
19671 </p>
19672 !! html/parsoid
19673 <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>
19674 !! end
19675
19676 !! test
19677 Another italics / bold test
19678 !! wikitext
19679 ''' ''x'
19680 !! html
19681 <pre>'<i> </i>x'
19682 </pre>
19683 !!end
19684
19685 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19686 !! test
19687 dt/dd/dl test
19688 !! wikitext
19689 :;;;::
19690 !! html/php
19691 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19692
19693 !! html/parsoid
19694 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19695
19696 !!end
19697
19698
19699 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19700 !! test
19701 Images with the "|" character in the comment
19702 !! wikitext
19703 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19704 !! html/php
19705 <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>
19706
19707 !! html/parsoid
19708 <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>
19709 !! end
19710
19711 !! test
19712 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19713 !! wikitext
19714 <html><script>alert(1);</script></html>
19715 !! html
19716 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19717 </p>
19718 !! end
19719
19720 !! test
19721 HTML with raw HTML ($wgRawHtml==true)
19722 !! options
19723 wgRawHtml=1
19724 !! wikitext
19725 <html><script>alert(1);</script></html>
19726 !! html
19727 <p><script>alert(1);</script>
19728 </p>
19729 !! end
19730
19731 !! test
19732 Parents of subpages, one level up
19733 !! options
19734 subpage title=[[Subpage test/L1/L2/L3]]
19735 !! wikitext
19736 [[../|L2]]
19737 !! html
19738 <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>
19739 </p>
19740 !! end
19741
19742
19743 !! test
19744 Parents of subpages, one level up, not named
19745 !! options
19746 subpage title=[[Subpage test/L1/L2/L3]]
19747 !! wikitext
19748 [[../]]
19749 !! html
19750 <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>
19751 </p>
19752 !! end
19753
19754
19755
19756 !! test
19757 Parents of subpages, two levels up
19758 !! options
19759 subpage title=[[Subpage test/L1/L2/L3]]
19760 !! wikitext
19761 [[../../|L1]]2
19762
19763 [[../../|L1]]l
19764 !! html
19765 <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
19766 </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>
19767 </p>
19768 !! end
19769
19770 !! test
19771 Parents of subpages, two levels up, without trailing slash or name.
19772 !! options
19773 subpage title=[[Subpage test/L1/L2/L3]]
19774 !! wikitext
19775 [[../..]]
19776 !! html
19777 <p>[[../..]]
19778 </p>
19779 !! end
19780
19781 !! test
19782 Parents of subpages, two levels up, with lots of extra trailing slashes.
19783 !! options
19784 subpage title=[[Subpage test/L1/L2/L3]]
19785 !! wikitext
19786 [[../../////]]
19787 !! html
19788 <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>
19789 </p>
19790 !! end
19791
19792 !! article
19793 Subpage test/L1/L2/L3Sibling
19794 !! text
19795 Sibling article
19796 !! endarticle
19797
19798 !! test
19799 Transclusion of a sibling page (one level up)
19800 !! options
19801 subpage title=[[Subpage test/L1/L2/L3]]
19802 !! wikitext
19803 {{../L3Sibling}}
19804 !! html
19805 <p>Sibling article
19806 </p>
19807 !! end
19808
19809 !! test
19810 Transclusion of a child page
19811 !! options
19812 subpage title=[[Subpage test/L1/L2]]
19813 !! wikitext
19814 {{/L3Sibling}}
19815 !! html
19816 <p>Sibling article
19817 </p>
19818 !! end
19819
19820 # This is wt2html only in Parsoid because we add <nowiki>
19821 # because of {{..}} and we don't expect to fix that to
19822 # eliminate the nowikis selective for {{..}} markup.
19823 !! test
19824 Non-transclusion because of too many up levels
19825 !! options
19826 subpage title=[[Subpage test/L1/L2/L3]]
19827 parsoid=wt2html
19828 !! wikitext
19829 {{../../../../More than parent}}
19830 !! html/php
19831 <p>{{../../../../More than parent}}
19832 </p>
19833 !! html/parsoid
19834 <p>{{../../../../More than parent}}</p>
19835 !! end
19836
19837 !! test
19838 Definition list code coverage
19839 !! wikitext
19840 ; title : def
19841 ; title : def
19842 ;title: def
19843 !! html/php
19844 <dl><dt> title &#160;</dt>
19845 <dd> def</dd>
19846 <dt> title&#160;</dt>
19847 <dd> def</dd>
19848 <dt>title</dt>
19849 <dd> def</dd></dl>
19850
19851 !! html/parsoid
19852 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19853 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19854 <dt>title</dt><dd> def</dd></dl>
19855 !! end
19856
19857 !! test
19858 Don't fall for the self-closing div
19859 !! wikitext
19860 <div>hello world</div/>
19861 !! html
19862 <div>hello world</div>
19863
19864 !! end
19865
19866 !! test
19867 MSGNW magic word
19868 !! wikitext
19869 {{MSGNW:msg}}
19870 !! html/php
19871 <p>&#91;&#91;:Template:Msg&#93;&#93;
19872 </p>
19873 !! end
19874
19875 !! test
19876 RAW magic word
19877 !! wikitext
19878 {{RAW:QUERTY}}
19879 !! html
19880 <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>
19881 </p>
19882 !! end
19883
19884 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19885 !! test
19886 Always escape literal '>' in output, not just after '<'
19887 !! wikitext
19888 ><>
19889 !! html
19890 <p>&gt;&lt;&gt;
19891 </p>
19892 !! end
19893
19894 !! test
19895 Template caching
19896 !! wikitext
19897 {{Test}}
19898 {{Test}}
19899 !! html
19900 <p>This is a test template
19901 This is a test template
19902 </p>
19903 !! end
19904
19905
19906 !! article
19907 MediaWiki:Fake
19908 !! text
19909 ==header==
19910 !! endarticle
19911
19912 !! test
19913 Inclusion of !userCanEdit() content
19914 !! wikitext
19915 {{MediaWiki:Fake}}
19916 !! html
19917 <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>
19918
19919 !! end
19920
19921
19922 !! test
19923 Out-of-order TOC heading levels
19924 !! wikitext
19925 ==2==
19926 ======6======
19927 ===3===
19928 =1=
19929 =====5=====
19930 ==2==
19931 !! html
19932 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19933 <ul>
19934 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19935 <ul>
19936 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19937 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19938 </ul>
19939 </li>
19940 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19941 <ul>
19942 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19943 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19944 </ul>
19945 </li>
19946 </ul>
19947 </div>
19948
19949 <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>
19950 <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>
19951 <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>
19952 <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>
19953 <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>
19954 <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>
19955
19956 !! end
19957
19958
19959 !! test
19960 ISBN with a dummy number
19961 !! wikitext
19962 ISBN ---
19963 !! html
19964 <p>ISBN ---
19965 </p>
19966 !! end
19967
19968
19969 !! test
19970 ISBN with space-delimited number
19971 !! wikitext
19972 ISBN 92 9017 032 8
19973 !! html
19974 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19975 </p>
19976 !! end
19977
19978
19979 !! test
19980 ISBN with multiple spaces, no number
19981 !! wikitext
19982 ISBN foo
19983 !! html
19984 <p>ISBN foo
19985 </p>
19986 !! end
19987
19988
19989 !! test
19990 ISBN length
19991 !! wikitext
19992 ISBN 123456789
19993
19994 ISBN 1234567890
19995
19996 ISBN 12345678901
19997 !! html
19998 <p>ISBN 123456789
19999 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20000 </p><p>ISBN 12345678901
20001 </p>
20002 !! end
20003
20004
20005 !! test
20006 ISBN with trailing year (bug 8110)
20007 !! wikitext
20008 ISBN 1-234-56789-0 - 2006
20009
20010 ISBN 1 234 56789 0 - 2006
20011 !! html
20012 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
20013 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20014 </p>
20015 !! end
20016
20017
20018 !! test
20019 anchorencode
20020 !! wikitext
20021 {{anchorencode:foo bar©#%n}}
20022 !! html
20023 <p>foo_bar.C2.A9.23.25n
20024 </p>
20025 !! end
20026
20027 !! test
20028 anchorencode trims spaces
20029 !! wikitext
20030 {{anchorencode: __pretty__please__}}
20031 !! html
20032 <p>pretty_please
20033 </p>
20034 !! end
20035
20036 !! test
20037 anchorencode deals with links
20038 !! wikitext
20039 {{anchorencode: [[hello|world]] [[hi]]}}
20040 !! html
20041 <p>world_hi
20042 </p>
20043 !! end
20044
20045 !! test
20046 anchorencode deals with templates
20047 !! wikitext
20048 {{anchorencode: {{Foo}} }}
20049 !! html
20050 <p>FOO
20051 </p>
20052 !! end
20053
20054 !! test
20055 anchorencode encodes like the TOC generator: (bug 18431)
20056 !! wikitext
20057 === _ +:.3A%3A&&amp;]] ===
20058 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20059 __NOEDITSECTION__
20060 !! html
20061 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20062 <p>.2B:.3A.253A.26.26.5D.5D
20063 </p>
20064 !! end
20065
20066 !! test
20067 Bug 6200: blockquotes and paragraph formatting
20068 !! wikitext
20069 <blockquote>
20070 foo
20071 </blockquote>
20072
20073 bar
20074
20075 baz
20076 !! html
20077 <blockquote>
20078 <p>foo
20079 </p>
20080 </blockquote>
20081 <p>bar
20082 </p>
20083 <pre>baz
20084 </pre>
20085 !! end
20086
20087 !! test
20088 Bug 8293: Use of center tag ruins paragraph formatting
20089 !! wikitext
20090 <center>
20091 foo
20092 </center>
20093
20094 bar
20095
20096 baz
20097 !! html
20098 <center>
20099 <p>foo
20100 </p>
20101 </center>
20102 <p>bar
20103 </p>
20104 <pre>baz
20105 </pre>
20106 !! end
20107
20108 !!test
20109 Parsing of overlapping (improperly nested) inline html tags
20110 !! wikitext
20111 <span><s>x</span></s>
20112 !! html/php
20113 <p><span><s>x&lt;/span&gt;</s></span>
20114 </p>
20115 !! html/parsoid
20116 <p><span><s>x</s></span>
20117 </p>
20118 !!end
20119
20120 ###
20121 ### Language variants related tests
20122 ###
20123 !! test
20124 Self-link in language variants
20125 !! options
20126 title=[[Dunav]] language=sr
20127 !! wikitext
20128 Both [[Dunav]] and [[Дунав]] are names for this river.
20129 !! html
20130 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
20131 </p>
20132 !!end
20133
20134 !! article
20135 Дуна
20136 !! text
20137 content
20138 !! endarticle
20139
20140 !! test
20141 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
20142 !! options
20143 title=[[Duna]] language=sr
20144 !! wikitext
20145 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
20146 !! html
20147 <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.
20148 </p>
20149 !! end
20150
20151 !! test
20152 Link to a section of a variant of this title shouldn't be parsed as self-link
20153 !! options
20154 title=[[Duna]] language=sr
20155 !! wikitext
20156 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
20157 !! html
20158 <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.
20159 </p>
20160 !! end
20161
20162 !! test
20163 Link to pages in language variants
20164 !! options
20165 language=sr
20166 !! wikitext
20167 Main Page can be written as [[Маин Паге]]
20168 !! html
20169 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
20170 </p>
20171 !!end
20172
20173
20174 !! test
20175 Multiple links to pages in language variants
20176 !! options
20177 language=sr
20178 !! wikitext
20179 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
20180 !! html
20181 <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>.
20182 </p>
20183 !!end
20184
20185
20186 !! test
20187 Simple template in language variants
20188 !! options
20189 language=sr
20190 !! wikitext
20191 {{тест}}
20192 !! html
20193 <p>This is a test template
20194 </p>
20195 !! end
20196
20197
20198 !! test
20199 Template with explicit namespace in language variants
20200 !! options
20201 language=sr
20202 !! wikitext
20203 {{Template:тест}}
20204 !! html
20205 <p>This is a test template
20206 </p>
20207 !! end
20208
20209
20210 !! test
20211 Basic test for template parameter in language variants
20212 !! options
20213 language=sr
20214 !! wikitext
20215 {{парамтест|param=foo}}
20216 !! html
20217 <p>This is a test template with parameter foo
20218 </p>
20219 !! end
20220
20221 !! test
20222 Simple category in language variants
20223 !! options
20224 language=sr cat
20225 !! wikitext
20226 [[Category:МедиаWики Усер'с Гуиде]]
20227 !! html/php
20228 cat=МедиаWики_Усер'с_Гуиде sort=
20229 !! html/parsoid
20230 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
20231 !! end
20232
20233 !! article
20234 Category:分类
20235 !! text
20236 blah
20237 !! endarticle
20238
20239 !! article
20240 Category:分類
20241 !! text
20242 blah
20243 !! endarticle
20244
20245 ## We used to, but no longer wt2wt this test since the default serializer
20246 ## will normalize all categories to serialize on their own line.
20247 ## This wikitext usage is going to be fairly uncommon in production and
20248 ## selser will take care of preserving formatting in those scenarios.
20249 !! test
20250 Don't convert blue categorylinks to another variant (bug 33210)
20251 !! options
20252 cat
20253 language=zh
20254 parsoid=wt2html
20255 !! wikitext
20256 [[A]][[Category:分类]]
20257 !! html/php
20258 cat=分类 sort=
20259 !! html/parsoid
20260 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
20261 <link rel="mw:PageProp/Category" href="Category:分类"/>
20262 !! end
20263
20264 !! test
20265 Stripping -{}- tags (language variants)
20266 !! options
20267 language=sr
20268 !! wikitext
20269 Latin proverb: -{Ne nuntium necare}-
20270 !! html
20271 <p>Latin proverb: Ne nuntium necare
20272 </p>
20273 !! end
20274
20275
20276 !! test
20277 Prevent conversion with -{}- tags (language variants)
20278 !! options
20279 language=sr variant=sr-ec
20280 !! wikitext
20281 Latinski: -{Ne nuntium necare}-
20282 !! html
20283 <p>Латински: Ne nuntium necare
20284 </p>
20285 !! end
20286
20287
20288 !! test
20289 Prevent conversion of text with -{}- tags (language variants)
20290 !! options
20291 language=sr variant=sr-ec
20292 !! wikitext
20293 Latinski: -{Ne nuntium necare}-
20294 !! html
20295 <p>Латински: Ne nuntium necare
20296 </p>
20297 !! end
20298
20299
20300 !! test
20301 Prevent conversion of links with -{}- tags (language variants)
20302 !! options
20303 language=sr variant=sr-ec
20304 !! wikitext
20305 -{[[Main Page]]}-
20306 !! html
20307 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20308 </p>
20309 !! end
20310
20311
20312 !! test
20313 -{}- tags within headlines (within html for parserConvert())
20314 !! options
20315 language=sr variant=sr-ec
20316 !! wikitext
20317 == -{Naslov}- ==
20318 !! html
20319 <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>
20320
20321 !! end
20322
20323
20324 !! test
20325 Explicit definition of language variant alternatives
20326 !! options
20327 language=zh variant=zh-tw
20328 !! wikitext
20329 -{zh:China;zh-tw:Taiwan}-, not China
20330 !! html
20331 <p>Taiwan, not China
20332 </p>
20333 !! end
20334
20335
20336 !! test
20337 Conversion around HTML tags
20338 !! options
20339 language=sr variant=sr-ec
20340 !! wikitext
20341 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
20342 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
20343 !! html
20344 <p>
20345 <span title="ЛаCтин">ски</span>
20346 </p>
20347 !! end
20348
20349
20350 !! test
20351 Explicit session-wise language variant mapping (A flag and - flag)
20352 !! options
20353 language=zh variant=zh-tw
20354 !! wikitext
20355 Taiwan is not China.
20356 But -{A|zh:China;zh-tw:Taiwan}- is China,
20357 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20358 and -{China}- is China.
20359 !! html
20360 <p>Taiwan is not China.
20361 But Taiwan is Taiwan,
20362 (This should be stripped!)
20363 and China is China.
20364 </p>
20365 !! end
20366
20367 !! test
20368 Explicit session-wise language variant mapping (H flag for hide)
20369 !! options
20370 language=zh variant=zh-tw
20371 !! wikitext
20372 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20373 Taiwan is China.
20374 !! html
20375 <p>(This should be stripped!)
20376 Taiwan is Taiwan.
20377 </p>
20378 !! end
20379
20380 !! test
20381 Adding explicit conversion rule for title (T flag)
20382 !! options
20383 language=zh variant=zh-tw showtitle
20384 !! wikitext
20385 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20386 !! html
20387 Taiwan
20388 <p>Should be stripped!
20389 </p>
20390 !! end
20391
20392 !! test
20393 Testing that changing the language variant here in the tests actually works
20394 !! options
20395 language=zh variant=zh showtitle
20396 !! wikitext
20397 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20398 !! html
20399 China
20400 <p>Should be stripped!
20401 </p>
20402 !! end
20403
20404 !! test
20405 Recursive conversion of alt and title attrs shouldn't clear converter state
20406 !! options
20407 language=zh variant=zh-cn showtitle
20408 !! wikitext
20409 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20410 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20411 !! html
20412 China
20413 <p>
20414 Should be stripped<span title="Exclamation">!</span>
20415 </p>
20416 !! end
20417
20418 !! test
20419 Bug 24072: more test on conversion rule for title
20420 !! options
20421 language=zh variant=zh-tw showtitle
20422 !! wikitext
20423 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20424 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20425 !! html
20426 Taiwan
20427 <p>This should be stripped!
20428 This won't take interferes with the title rule.
20429 </p>
20430 !! end
20431
20432 !! test
20433 Partly disable title conversion if variant == main language code
20434 !! options
20435 language=zh variant=zh title=[[ZH]] showtitle
20436 !! wikitext
20437 -{T|zh-cn:CN;zh-tw:TW}-
20438 !! html
20439 ZH
20440 <p>
20441 </p>
20442 !! end
20443
20444 !! test
20445 Partly disable title conversion if variant == main language code, more
20446 !! options
20447 language=zh variant=zh title=[[ZH]] showtitle
20448 !! wikitext
20449 -{T|TW}-
20450 !! html
20451 ZH
20452 <p>
20453 </p>
20454 !! end
20455
20456 !! test
20457 Raw output of variant escape tags (R flag)
20458 !! options
20459 language=zh variant=zh-tw
20460 !! wikitext
20461 Raw: -{R|zh:China;zh-tw:Taiwan}-
20462 !! html
20463 <p>Raw: zh:China;zh-tw:Taiwan
20464 </p>
20465 !! end
20466
20467 !! test
20468 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20469 !! options
20470 language=zh variant=zh-cn
20471 !! input
20472 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20473 !! result
20474 <p>0
20475 </p>
20476 !! end
20477
20478 !! test
20479 Conversion rules from [numeric-only string] to [something else] (T48634)
20480 !! options
20481 language=zh variant=zh-cn
20482 !! input
20483 -{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
20484 !! result
20485 <p>D12345EE12345
20486 </p>
20487 !! end
20488
20489 !! test
20490 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20491 !! options
20492 language=zh variant=zh-cn
20493 !! input
20494 -{H|zh-cn:foo;zh-tw:;}-foobar
20495 !! result
20496 <p>foobar
20497 </p>
20498 !! end
20499
20500 !! test
20501 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20502 !! options
20503 language=zh variant=zh-cn
20504 !! input
20505 -{H|=>zh-cn:foo;}-foobar
20506 !! result
20507 <p>foobar
20508 </p>
20509 !! end
20510
20511 !! test
20512 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20513 !! options
20514 language=zh variant=zh-cn
20515 !! input
20516 -{H|}-foobar
20517 !! result
20518 <p>foobar
20519 </p>
20520 !! end
20521
20522 !! test
20523 Nested using of manual convert syntax
20524 !! options
20525 language=zh variant=zh-hk
20526 !! wikitext
20527 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20528 !! html
20529 <p>Nested: Hello Hong Kong!
20530 </p>
20531 !! end
20532
20533 # Since Parsoid is starting to emit canonical wikitext for links,
20534 # [http://example.com http://example.com] will not RT back to that
20535 # form anymore.
20536 !! test
20537 Proper conversion of text in external links
20538 !! options
20539 language=sr variant=sr-ec
20540 parsoid=wt2html
20541 !! wikitext
20542 http://www.google.com
20543 gopher://www.google.com
20544 [http://www.google.com http://www.google.com]
20545 [gopher://www.google.com gopher://www.google.com]
20546 [https://www.google.com irc://www.google.com]
20547 [ftp://www.google.com www.google.com/ftp://dir]
20548 [//www.google.com www.google.com]
20549 !! html/php
20550 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20551 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20552 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20553 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20554 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20555 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20556 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20557 </p>
20558 !! html/parsoid
20559 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20560 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20561 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20562 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20563 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20564 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20565 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20566 !! end
20567
20568 !! test
20569 Do not convert roman numbers to language variants
20570 !! options
20571 language=sr variant=sr-ec
20572 !! wikitext
20573 Fridrih IV je car.
20574 !! html
20575 <p>Фридрих IV је цар.
20576 </p>
20577 !! end
20578
20579 !! test
20580 Unclosed language converter markup "-{"
20581 !! options
20582 language=sr
20583 !! wikitext
20584 -{T|hello
20585 !! html
20586 <p>-{T|hello
20587 </p>
20588 !! end
20589
20590 !! test
20591 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20592 !! options
20593 language=sr
20594 !! wikitext
20595 -{R|=&gt;}-
20596 !! html
20597 <p>=&gt;
20598 </p>
20599 !!end
20600
20601 !! test
20602 Don't break link parsing if language converter markup is in the caption.
20603 !! options
20604 language=sr variant=sr-ec
20605 !! wikitext
20606 [[Main Page|-{R|main page}-]]
20607 !! html
20608 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20609 </p>
20610 !! end
20611
20612 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20613 !! test
20614 Don't break image parsing if language converter markup is in the caption.
20615 !! options
20616 language=sr
20617 !! wikitext
20618 [[File:Foobar.jpg|-{R|caption}-]]
20619 !! html/parsoid
20620 <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" /></a>
20621 </p>
20622 !! end
20623
20624 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20625 !! test
20626 Don't break list handling if language converter markup is in the item.
20627 !! options
20628 language=zh variant=zh-cn
20629 !! wikitext
20630 ;-{zh-cn:AAA;zh-tw:BBB}-
20631 !! html/php
20632 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20633
20634 !! html/parsoid
20635 <dl><dt>AAA
20636 </dt></dl>
20637 !! end
20638
20639 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20640 !! test
20641 Don't break table handling if language converter markup is in the cell.
20642 !! options
20643 language=sr variant=sr-ec
20644 !! wikitext
20645 {|
20646 |-
20647 | -{R|B}-
20648 |}
20649 !! html/php
20650 <table>
20651
20652 <tr>
20653 <td>Б}-
20654 </td></tr></table>
20655
20656 !! html/parsoid
20657 <table>
20658
20659 <tr>
20660 <td> B
20661 </td></tr></table>
20662
20663 !! end
20664
20665 !! test
20666 Bug 529: Uncovered bullet
20667 !! wikitext
20668 * Foo {{bullet}}
20669 !! html
20670 <ul><li> Foo </li>
20671 <li> Bar</li></ul>
20672
20673 !! end
20674
20675 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20676 # Templates in Wikipedia rely on this behavior, as tidy has always been
20677 # enabled there. These tests are normally run *without* tidy, so specify the
20678 # full output here.
20679 # To test realistic parsing behavior, apply a tidy-like transformation to both
20680 # the expected output and your parser's output.
20681 !! test
20682 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20683 !! wikitext
20684 ******* Foo {{bullet}}
20685 !! html
20686 <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>
20687 <li> Bar</li></ul>
20688
20689 !! end
20690
20691 !! test
20692 Bug 529: Uncovered table already at line-start
20693 !! wikitext
20694 x
20695
20696 {{table}}
20697 y
20698 !! html
20699 <p>x
20700 </p>
20701 <table>
20702 <tr>
20703 <td> 1 </td>
20704 <td> 2
20705 </td></tr>
20706 <tr>
20707 <td> 3 </td>
20708 <td> 4
20709 </td></tr></table>
20710 <p>y
20711 </p>
20712 !! end
20713
20714 !! test
20715 Bug 529: Uncovered bullet in parser function result
20716 !! wikitext
20717 * Foo {{lc:{{bullet}} }}
20718 !! html
20719 <ul><li> Foo </li>
20720 <li> bar</li></ul>
20721
20722 !! end
20723
20724 !! test
20725 Bug 5678: Double-parsed template argument
20726 !! wikitext
20727 {{lc:{{{1}}}|hello}}
20728 !! html
20729 <p>{{{1}}}
20730 </p>
20731 !! end
20732
20733 !! test
20734 Bug 5678: Double-parsed template invocation
20735 !! wikitext
20736 {{lc:{{paramtest {{!}} param = hello }} }}
20737 !! html
20738 <p>{{paramtest | param = hello }}
20739 </p>
20740 !! end
20741
20742 !! test
20743 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20744 !! options
20745 language=cs
20746 title=[[Main Page]]
20747 !! wikitext
20748 {{PRVNÍVELKÉ:ěščř}}
20749 {{prvnívelké:ěščř}}
20750 {{PRVNÍMALÉ:ěščř}}
20751 {{prvnímalé:ěščř}}
20752 {{MALÁ:ěščř}}
20753 {{malá:ěščř}}
20754 {{VELKÁ:ěščř}}
20755 {{velká:ěščř}}
20756 !! html
20757 <p>Ěščř
20758 Ěščř
20759 ěščř
20760 ěščř
20761 ěščř
20762 ěščř
20763 ĚŠČŘ
20764 ĚŠČŘ
20765 </p>
20766 !! end
20767
20768 !! test
20769 Morwen/13: Unclosed link followed by heading
20770 !! wikitext
20771 [[link
20772 ==heading==
20773 !! html
20774 <p>[[link
20775 </p>
20776 <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>
20777
20778 !! end
20779
20780 !! test
20781 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20782 !! wikitext
20783 {{foo|
20784 =heading=
20785 !! html
20786 <p>{{foo|
20787 </p>
20788 <h1><span class="mw-headline" id="heading">heading</span></h1>
20789
20790 !! end
20791
20792 !! test
20793 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20794 !! wikitext
20795 {{foo|
20796 ==heading==
20797 !! html
20798 <p>{{foo|
20799 </p>
20800 <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>
20801
20802 !! end
20803
20804 !! test
20805 Tildes in comments
20806 !! options
20807 pst
20808 !! wikitext
20809 <!-- ~~~~ -->
20810 !! html/php
20811 <!-- ~~~~ -->
20812 !! end
20813
20814 !! test
20815 Paragraphs inside divs (no extra line breaks)
20816 !! wikitext
20817 <div>Line one
20818
20819 Line two</div>
20820 !! html
20821 <div>Line one
20822 Line two</div>
20823
20824 !! end
20825
20826 !! test
20827 Paragraphs inside divs (extra line break on open)
20828 !! wikitext
20829 <div>
20830 Line one
20831
20832 Line two</div>
20833 !! html
20834 <div>
20835 <p>Line one
20836 </p>
20837 Line two</div>
20838
20839 !! end
20840
20841 !! test
20842 Paragraphs inside divs (extra line break on close)
20843 !! wikitext
20844 <div>Line one
20845
20846 Line two
20847 </div>
20848 !! html
20849 <div>Line one
20850 <p>Line two
20851 </p>
20852 </div>
20853
20854 !! end
20855
20856 !! test
20857 Paragraphs inside divs (extra line break on open and close)
20858 !! wikitext
20859 <div>
20860 Line one
20861
20862 Line two
20863 </div>
20864 !! html
20865 <div>
20866 <p>Line one
20867 </p><p>Line two
20868 </p>
20869 </div>
20870
20871 !! end
20872
20873 !! test
20874 Nesting tags, paragraphs on lines which begin with <div>
20875 !! wikitext
20876 <div></div><strong>A
20877 B</strong>
20878 !! html/php+tidy
20879 <p><strong>A</strong></p>
20880 <p><strong>B</strong></p>
20881 !! html/parsoid
20882 <div></div>
20883 <p><strong>A
20884 B</strong>
20885 </p>
20886 !! end
20887
20888 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20889 !! test
20890 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20891 !! wikitext
20892 <blockquote>Line one
20893
20894 Line two</blockquote>
20895 !! html
20896 <blockquote>Line one
20897 Line two</blockquote>
20898
20899 !! html+tidy
20900 <blockquote>
20901 <p>Line one Line two</p>
20902 </blockquote>
20903 !! end
20904
20905 !! test
20906 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20907 !! wikitext
20908 <blockquote>
20909 Line one
20910
20911 Line two</blockquote>
20912 !! html
20913 <blockquote>
20914 <p>Line one
20915 </p>
20916 Line two</blockquote>
20917
20918 !! html+tidy
20919 <blockquote>
20920 <p>Line one</p>
20921 Line two</blockquote>
20922 !! end
20923
20924 !! test
20925 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20926 !! wikitext
20927 <blockquote>Line one
20928
20929 Line two
20930 </blockquote>
20931 !! html
20932 <blockquote>Line one
20933 <p>Line two
20934 </p>
20935 </blockquote>
20936
20937 !! html+tidy
20938 <blockquote>
20939 <p>Line one</p>
20940 <p>Line two</p>
20941 </blockquote>
20942 !! end
20943
20944 !! test
20945 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20946 !! wikitext
20947 <blockquote>
20948 Line one
20949
20950 Line two
20951 </blockquote>
20952 !! html
20953 <blockquote>
20954 <p>Line one
20955 </p><p>Line two
20956 </p>
20957 </blockquote>
20958
20959 !! html+tidy
20960 <blockquote>
20961 <p>Line one</p>
20962 <p>Line two</p>
20963 </blockquote>
20964 !! end
20965
20966 !! test
20967 Paragraphs inside blockquotes/divs (no extra line breaks)
20968 !! wikitext
20969 <blockquote><div>Line one
20970
20971 Line two</div></blockquote>
20972 !! html
20973 <blockquote><div>Line one
20974 Line two</div></blockquote>
20975
20976 !! end
20977
20978 !! test
20979 Paragraphs inside blockquotes/divs (extra line break on open)
20980 !! wikitext
20981 <blockquote><div>
20982 Line one
20983
20984 Line two</div></blockquote>
20985 !! html
20986 <blockquote><div>
20987 <p>Line one
20988 </p>
20989 Line two</div></blockquote>
20990
20991 !! end
20992
20993 !! test
20994 Paragraphs inside blockquotes/divs (extra line break on close)
20995 !! wikitext
20996 <blockquote><div>Line one
20997
20998 Line two
20999 </div></blockquote>
21000 !! html
21001 <blockquote><div>Line one
21002 <p>Line two
21003 </p>
21004 </div></blockquote>
21005
21006 !! end
21007
21008 !! test
21009 Paragraphs inside blockquotes/divs (extra line break on open and close)
21010 !! wikitext
21011 <blockquote><div>
21012 Line one
21013
21014 Line two
21015 </div></blockquote>
21016 !! html
21017 <blockquote><div>
21018 <p>Line one
21019 </p><p>Line two
21020 </p>
21021 </div></blockquote>
21022
21023 !! end
21024
21025 !! test
21026 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
21027 !! options
21028 wgLinkHolderBatchSize=0
21029 !! wikitext
21030 [[meatball:1]]
21031 [[meatball:2]]
21032 [[meatball:3]]
21033 !! html
21034 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
21035 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
21036 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
21037 </p>
21038 !! end
21039
21040 !! test
21041 Free external link invading image caption
21042 !! wikitext
21043 [[Image:Foobar.jpg|thumb|http://x|hello]]
21044 !! html
21045 <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>
21046
21047 !! end
21048
21049 !! test
21050 Bug 15196: localised external link numbers
21051 !! options
21052 language=fa
21053 !! wikitext
21054 [http://en.wikipedia.org/]
21055 !! html/php
21056 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
21057 </p>
21058 !! html/parsoid
21059 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
21060 !! end
21061
21062 !! test
21063 Multibyte character in padleft
21064 !! wikitext
21065 {{padleft:-Hello|7|Æ}}
21066 !! html
21067 <p>Æ-Hello
21068 </p>
21069 !! end
21070
21071 !! test
21072 Multibyte character in padright
21073 !! wikitext
21074 {{padright:Hello-|7|Æ}}
21075 !! html
21076 <p>Hello-Æ
21077 </p>
21078 !! end
21079
21080 !!test
21081 formatdate parser function
21082 !! wikitext
21083 {{#formatdate:2009-03-24}}
21084 !! html
21085 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
21086 </p>
21087 !! end
21088
21089 !!test
21090 formatdate parser function, with default format
21091 !! wikitext
21092 {{#formatdate:2009-03-24|mdy}}
21093 !! html
21094 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
21095 </p>
21096 !! end
21097
21098 !! test
21099 Spacing of numbers in formatted dates
21100 !! wikitext
21101 {{#formatdate:January 15}}
21102 !! html
21103 <p><span class="mw-formatted-date" title="01-15">January 15</span>
21104 </p>
21105 !! end
21106
21107 !! test
21108 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
21109 !! options
21110 language=nl title=[[MediaWiki:Common.css]]
21111 !! wikitext
21112 {{#formatdate:2009-03-24|dmy}}
21113 !! html
21114 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
21115 </p>
21116 !! end
21117
21118 #
21119 #
21120 #
21121
21122 #
21123 # Edit comments
21124 #
21125
21126 !! test
21127 Edit comment with link
21128 !! options
21129 comment
21130 !! wikitext
21131 I like the [[Main Page]] a lot
21132 !! html/php
21133 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
21134 !!end
21135
21136 !! test
21137 Edit comment with link and link text
21138 !! options
21139 comment
21140 !! wikitext
21141 I like the [[Main Page|best pages]] a lot
21142 !! html/php
21143 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21144 !!end
21145
21146 !! test
21147 Edit comment with link and link text with suffix
21148 !! options
21149 comment
21150 !! wikitext
21151 I like the [[Main Page|best page]]s a lot
21152 !! html/php
21153 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21154 !!end
21155
21156 !! test
21157 Edit comment with section link (non-local, eg in history list)
21158 !! options
21159 comment title=[[Main Page]]
21160 !! wikitext
21161 /* External links */ removed bogus entries
21162 !! html/php
21163 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21164 !!end
21165
21166 !! test
21167 Edit comment with section link and text before it (non-local, eg in history list)
21168 !! options
21169 comment title=[[Main Page]]
21170 !! wikitext
21171 pre-comment text /* External links */ removed bogus entries
21172 !! html/php
21173 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>
21174 !!end
21175
21176 !! test
21177 Edit comment with section link (local, eg in diff view)
21178 !! options
21179 comment local title=[[Main Page]]
21180 !! wikitext
21181 /* External links */ removed bogus entries
21182 !! html/php
21183 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21184 !!end
21185
21186 !! test
21187 Edit comment with subpage link (bug 14080)
21188 !! options
21189 comment
21190 subpage
21191 title=[[Subpage test]]
21192 !! wikitext
21193 Poked at a [[/subpage]] here...
21194 !! html/php
21195 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
21196 !!end
21197
21198 !! test
21199 Edit comment with subpage link and link text (bug 14080)
21200 !! options
21201 comment
21202 subpage
21203 title=[[Subpage test]]
21204 !! wikitext
21205 Poked at a [[/subpage|neat little page]] here...
21206 !! html/php
21207 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
21208 !!end
21209
21210 !! test
21211 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
21212 !! options
21213 comment
21214 title=[[Subpage test]]
21215 !! wikitext
21216 Poked at a [[/subpage]] here...
21217 !! html/php
21218 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...
21219 !!end
21220
21221 !! test
21222 Edit comment with bare anchor link (local, as on diff)
21223 !! options
21224 comment
21225 local
21226 title=[[Main Page]]
21227 !! wikitext
21228 [[#section]]
21229 !! html/php
21230 <a href="#section">#section</a>
21231 !! end
21232
21233 !! test
21234 Edit comment with bare anchor link (non-local, as on history)
21235 !! options
21236 comment
21237 title=[[Main Page]]
21238 !! wikitext
21239 [[#section]]
21240 !! html/php
21241 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
21242 !! end
21243
21244 !! test
21245 Anchor starting with underscore
21246 !! options
21247 title=[[Foo]]
21248 !! wikitext
21249 [[#_ref|One]]
21250 !! html/php
21251 <p><a href="#_ref">One</a>
21252 </p>
21253 !! html/parsoid
21254 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
21255 !! end
21256
21257 !! test
21258 Id starting with underscore
21259 !! wikitext
21260 <div id="_ref"></div>
21261 !! html/*
21262 <div id="_ref"></div>
21263
21264 !! end
21265
21266 !! test
21267 Edit comment with link with more than one pipe (T99346)
21268 !! options
21269 comment
21270 !! wikitext
21271 [[Main Page|Many|pipes]]
21272 !! html/php
21273 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
21274 !! end
21275
21276 !! test
21277 Complex edit comment with link with more than one pipe (T99346)
21278 !! options
21279 comment
21280 !! wikitext
21281 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
21282 !! html/php
21283 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;
21284 !! end
21285
21286 !! test
21287 Space normalisation on autocomment (bug 22784)
21288 !! options
21289 comment
21290 title=[[Main Page]]
21291 !! wikitext
21292 /* __hello__world__ */
21293 !! html/php
21294 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
21295 !! end
21296
21297 !! test
21298 percent-encoding and + signs in comments (Bug 26410)
21299 !! options
21300 comment
21301 !! wikitext
21302 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
21303 !! html/php
21304 <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>
21305 !! end
21306
21307 # Parsoid doesn't support this yet: see bug 73581
21308 # but it *should* omit the 'src' attribute if the image is bad.
21309 # PHP side of tests was disabled in
21310 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
21311 # because of issues in the PHP parserTests infrastructure
21312 # (but the output below is indeed what the PHP side emits)
21313 !! test
21314 Bad images - basic functionality
21315 !! wikitext
21316 [[File:Bad.jpg]]
21317 !! DISABLED/html/php
21318 !! html/parsoid
21319 <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>
21320 !! end
21321
21322 !! test
21323 Bad images - bug 16039: text after bad image disappears
21324 !! wikitext
21325 Foo bar
21326 [[File:Bad.jpg]]
21327 Bar foo
21328 !! DISABLED/html/php
21329 <p>Foo bar
21330 </p><p>Bar foo
21331 </p>
21332 !! html/parsoid
21333 <p>Foo bar
21334 <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>
21335 Bar foo</p>
21336 !! end
21337
21338 !! test
21339 Verify that displaytitle works (bug #22501) no displaytitle
21340 !! options
21341 showtitle
21342 !! config
21343 wgAllowDisplayTitle=true
21344 wgRestrictDisplayTitle=false
21345 !! wikitext
21346 this is not the the title
21347 !! html/php
21348 Parser test
21349 <p>this is not the the title
21350 </p>
21351 !! end
21352
21353 !! test
21354 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
21355 !! options
21356 showtitle
21357 title=[[Screen]]
21358 !! config
21359 wgAllowDisplayTitle=true
21360 wgRestrictDisplayTitle=false
21361 !! wikitext
21362 this is not the the title
21363 {{DISPLAYTITLE:whatever}}
21364 !! html/php
21365 whatever
21366 <p>this is not the the title
21367 </p>
21368 !! end
21369
21370 !! test
21371 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
21372 !! options
21373 showtitle
21374 title=[[Screen]]
21375 !! config
21376 wgAllowDisplayTitle=true
21377 wgRestrictDisplayTitle=true
21378 !! wikitext
21379 this is not the the title
21380 {{DISPLAYTITLE:whatever}}
21381 !! html/php
21382 Screen
21383 <p>this is not the the title
21384 </p>
21385 !! end
21386
21387 !! test
21388 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
21389 !! options
21390 showtitle
21391 title=[[Screen]]
21392 !! config
21393 wgAllowDisplayTitle=true
21394 wgRestrictDisplayTitle=true
21395 !! wikitext
21396 this is not the the title
21397 {{DISPLAYTITLE:screen}}
21398 !! html/php
21399 screen
21400 <p>this is not the the title
21401 </p>
21402 !! end
21403
21404 !! test
21405 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
21406 !! options
21407 showtitle
21408 title=[[Screen]]
21409 !! config
21410 wgAllowDisplayTitle=false
21411 !! wikitext
21412 this is not the the title
21413 {{DISPLAYTITLE:screen}}
21414 !! html/php
21415 Screen
21416 <p>this is not the the title
21417 <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>
21418 </p>
21419 !! end
21420
21421 !! test
21422 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
21423 !! options
21424 showtitle
21425 title=[[Screen]]
21426 !! config
21427 wgAllowDisplayTitle=false
21428 !! wikitext
21429 this is not the the title
21430 !! html/php
21431 Screen
21432 <p>this is not the the title
21433 </p>
21434 !! end
21435
21436 !! test
21437 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
21438 !! options
21439 showtitle
21440 title=[[Screen]]
21441 !! config
21442 wgAllowDisplayTitle=true
21443 wgRestrictDisplayTitle=true
21444 !! wikitext
21445 this is not the the title
21446 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21447 !! html/php
21448 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21449 <p>this is not the the title
21450 </p>
21451 !! end
21452
21453 !! test
21454 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
21455 !! options
21456 showtitle
21457 title=[[Screen]]
21458 !! config
21459 wgAllowDisplayTitle=true
21460 wgRestrictDisplayTitle=true
21461 !! wikitext
21462 this is not the the title
21463 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21464 !! html/php
21465 <span style="color: red;">s</span>creen
21466 <p>this is not the the title
21467 </p>
21468 !! end
21469
21470 !! test
21471 Page status indicators: Empty name is invalid
21472 !! options
21473 showindicators
21474 !! wikitext
21475 <indicator name=" "></indicator>
21476 <indicator></indicator>
21477 !! html
21478 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21479 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21480 </p>
21481 !! end
21482
21483 !! test
21484 Page status indicators: Weird syntaxes that are okay
21485 !! options
21486 showindicators
21487 !! wikitext
21488 <indicator name="empty" />
21489 <indicator name="name"></indicator>
21490 !! html
21491 empty=
21492 name=
21493 <p><br />
21494 </p>
21495 !! end
21496
21497 !! test
21498 Page status indicators: Torture test
21499 !! options
21500 showindicators
21501 !! wikitext
21502 <indicator name="01">hello world</indicator>
21503 <indicator name="02">[[Main Page]]</indicator>
21504 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21505 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21506 <indicator name="05">* foo
21507 * bar</indicator>
21508 <indicator name="06"><nowiki>foo</nowiki></indicator>
21509 <indicator name="07"> Preformatted</indicator>
21510 <indicator name="08"><div>Broken tag</indicator>
21511 <indicator name="09">{| class=wikitable
21512 | cell
21513 |}</indicator>
21514 <indicator name="10">Two
21515
21516 paragraphs</indicator>
21517 !! html
21518 01=hello world
21519 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21520 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" />
21521 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>
21522 05=<ul><li> foo</li>
21523 <li> bar</li></ul>
21524
21525 06=foo
21526 07=<pre>Preformatted
21527 </pre>
21528 08=<div>Broken tag</div>
21529
21530 09=<table class="wikitable">
21531 <tr>
21532 <td> cell
21533 </td></tr></table>
21534
21535 10=<p>Two
21536 </p><p>paragraphs
21537 </p>
21538 <p><br />
21539 </p><p><br />
21540 </p><p><br />
21541 </p><p><br />
21542 </p><p><br />
21543 </p>
21544 !! end
21545
21546 !! test
21547 preload: check <noinclude> and <includeonly>
21548 !! options
21549 preload
21550 !! wikitext
21551 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21552 !! html/php
21553 Hello kind world.
21554 !! end
21555
21556 !! test
21557 preload: check <onlyinclude>
21558 !! options
21559 preload
21560 !! wikitext
21561 Goodbye <onlyinclude>Hello world</onlyinclude>
21562 !! html/php
21563 Hello world
21564 !! end
21565
21566 !! test
21567 preload: can pass tags through if we want to
21568 !! options
21569 preload
21570 !! wikitext
21571 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21572 !! html/php
21573 <includeonly>Hello world</includeonly>
21574 !! end
21575
21576 !! test
21577 preload: check that it doesn't try to do tricks
21578 !! options
21579 preload
21580 !! wikitext
21581 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21582 !! html/php
21583 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21584 !! end
21585
21586 !! test
21587 Play a bit with r67090 and bug 3158
21588 !! wikitext
21589 <div style="width:50% !important">&nbsp;</div>
21590 <div style="width:50%&nbsp;!important">&nbsp;</div>
21591 <div style="width:50%&#160;!important">&nbsp;</div>
21592 <div style="border : solid;">&nbsp;</div>
21593 !! html/php
21594 <div style="width:50% !important">&#160;</div>
21595 <div style="width:50% !important">&#160;</div>
21596 <div style="width:50% !important">&#160;</div>
21597 <div style="border&#160;: solid;">&#160;</div>
21598
21599 !! html/parsoid
21600 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21601 <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>
21602 <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>
21603 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21604
21605 !! end
21606
21607 !! test
21608 HTML5 data attributes
21609 !! wikitext
21610 <span data-foo="bar">Baz</span>
21611 <p data-abc-def_hij="">Quuz</p>
21612 !! html/php
21613 <p><span data-foo="bar">Baz</span>
21614 </p>
21615 <p data-abc-def_hij="">Quuz</p>
21616
21617 !! html/parsoid
21618 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21619 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21620 !! end
21621
21622 !! test
21623 Strip reserved data attributes
21624 !! wikitext
21625 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21626 !! html/php
21627 <div data-ok="fred">d</div>
21628
21629 !! html/parsoid
21630 <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>
21631 !! end
21632
21633 !! test
21634 percent-encoding and + signs in internal links (Bug 26410)
21635 !! wikitext
21636 [[User:+%]] [[Page+title%]]
21637 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21638 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21639 [[%33%45]] [[%33%45+]]
21640 !! html/php
21641 <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>
21642 <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>
21643 <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>
21644 <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>
21645 </p>
21646 !! html/parsoid
21647 <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>
21648 <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>
21649 <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>
21650 <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>
21651 !! end
21652
21653 !! test
21654 Special characters in embedded file links (bug 27679)
21655 !! wikitext
21656 [[File:Contains & ampersand.jpg]]
21657 [[File:Does not exist.jpg|Title with & ampersand]]
21658 !! html/php
21659 <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>
21660 <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>
21661 </p>
21662 !! html/parsoid
21663 <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>
21664 <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>
21665 !! end
21666
21667 !! test
21668 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21669 !! wikitext
21670 Text&apos;s been normalized?
21671 !! html
21672 <p>Text&#39;s been normalized?
21673 </p>
21674 !! end
21675
21676 !! test
21677 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21678 !! wikitext
21679 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21680 !! html
21681 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21682 </p>
21683 !! end
21684
21685 !! test
21686 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21687 !! wikitext
21688 [http://www.example.org/ ideograms]
21689 !! html
21690 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21691 </p>
21692 !! end
21693
21694 !! test
21695 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21696 !! wikitext
21697 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21698 !! html
21699 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21700 </p>
21701 !! end
21702
21703 !! article
21704 Mediawiki:loop1
21705 !! text
21706 {{Identical|A}}
21707 !! endarticle
21708
21709 !! article
21710 Mediawiki:loop2
21711 !! text
21712 {{Identical|B}}
21713 !! endarticle
21714
21715 !! article
21716 Template:Identical
21717 !! text
21718 {{int:loop1}}
21719 {{int:loop2}}
21720 !! endarticle
21721
21722 !! test
21723 Bug 31098 Template which includes system messages which includes the template
21724 !! wikitext
21725 {{Identical}}
21726 !! html
21727 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21728 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21729 </p>
21730 !! end
21731
21732 !! test
21733 Bug31490 Turkish: ucfirst 'blah'
21734 !! options
21735 language=tr
21736 !! wikitext
21737 {{ucfirst:blah}}
21738 !! html
21739 <p>Blah
21740 </p>
21741 !! end
21742
21743 !! test
21744 Bug31490 Turkish: ucfirst 'ix'
21745 !! options
21746 language=tr
21747 !! wikitext
21748 {{ucfirst:ix}}
21749 !! html
21750 <p>İx
21751 </p>
21752 !! end
21753
21754 !! test
21755 Bug31490 Turkish: lcfirst 'BLAH'
21756 !! options
21757 language=tr
21758 !! wikitext
21759 {{lcfirst:BLAH}}
21760 !! html
21761 <p>bLAH
21762 </p>
21763 !! end
21764
21765 !! test
21766 Bug31490 Turkish: ucfırst (with a dotless i)
21767 !! options
21768 language=tr
21769 !! wikitext
21770 {{ucfırst:blah}}
21771 !! html
21772 <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>
21773 </p>
21774 !! end
21775
21776 !! test
21777 Bug31490 ucfırst (with a dotless i) with English language
21778 !! options
21779 language=en
21780 !! wikitext
21781 {{ucfırst:blah}}
21782 !! html
21783 <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>
21784 </p>
21785 !! end
21786
21787 !! test
21788 Bug 26375: TOC with italics
21789 !! options
21790 title=[[Main Page]]
21791 !! wikitext
21792 __TOC__
21793 == ''Lost'' episodes ==
21794 !! html
21795 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21796 <ul>
21797 <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>
21798 </ul>
21799 </div>
21800
21801 <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>
21802
21803 !! end
21804
21805 !! test
21806 Bug 26375: TOC with bold
21807 !! options
21808 title=[[Main Page]]
21809 !! wikitext
21810 __TOC__
21811 == '''should be bold''' then normal text ==
21812 !! html
21813 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21814 <ul>
21815 <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>
21816 </ul>
21817 </div>
21818
21819 <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>
21820
21821 !! end
21822
21823 !! test
21824 Bug 33845: Headings become cursive in TOC when they contain an image
21825 !! options
21826 title=[[Main Page]]
21827 !! wikitext
21828 __TOC__
21829 == Image [[Image:foobar.jpg]] ==
21830 !! html
21831 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21832 <ul>
21833 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21834 </ul>
21835 </div>
21836
21837 <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>
21838
21839 !! end
21840
21841 !! test
21842 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21843 !! options
21844 title=[[Main Page]]
21845 !! wikitext
21846 __TOC__
21847 == <blockquote>Quote</blockquote> ==
21848 !! html
21849 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21850 <ul>
21851 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21852 </ul>
21853 </div>
21854
21855 <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>
21856
21857 !! html+tidy
21858 <p></p>
21859 <div id="toc" class="toc">
21860 <div id="toctitle">
21861 <h2>Contents</h2>
21862 </div>
21863 <ul>
21864 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21865 </ul>
21866 </div>
21867 <p></p>
21868 <h2><span class="mw-headline" id="Quote"></span></h2>
21869 <blockquote>
21870 <p><span class="mw-headline" id="Quote">Quote</span></p>
21871 </blockquote>
21872 <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>
21873 !! end
21874
21875 !! test
21876 Unclosed tags in TOC
21877 !! options
21878 title=[[Main Page]]
21879 !! wikitext
21880 __TOC__
21881 == Proof: 2 < 3 ==
21882 <small>Hanc marginis exiguitas non caperet.</small>
21883 QED
21884 !! html
21885 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21886 <ul>
21887 <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>
21888 </ul>
21889 </div>
21890
21891 <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>
21892 <p><small>Hanc marginis exiguitas non caperet.</small>
21893 QED
21894 </p>
21895 !! end
21896
21897 !! test
21898 Multiple tags in TOC
21899 !! wikitext
21900 __TOC__
21901 == <i>Foo</i> <b>Bar</b> ==
21902
21903 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21904 !! html
21905 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21906 <ul>
21907 <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>
21908 <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>
21909 </ul>
21910 </div>
21911
21912 <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>
21913 <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>
21914
21915 !! html+tidy
21916 <p></p>
21917 <div id="toc" class="toc">
21918 <div id="toctitle">
21919 <h2>Contents</h2>
21920 </div>
21921 <ul>
21922 <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>
21923 <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>
21924 </ul>
21925 </div>
21926 <p></p>
21927 <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>
21928 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21929 <blockquote>
21930 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21931 </blockquote>
21932 <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>
21933 !! end
21934
21935 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21936 # html5 tag parsing.
21937 !! test
21938 Tags with parameters in TOC
21939 !! options
21940 parsoid=wt2html
21941 !! wikitext
21942 __TOC__
21943 == <sup class="in-h2">Hello</sup> ==
21944
21945 == <sup class="a > b">Evilbye</sup> ==
21946 !! html/php
21947 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21948 <ul>
21949 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21950 <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>
21951 </ul>
21952 </div>
21953
21954 <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>
21955 <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>
21956
21957 !! html/parsoid
21958 <meta property="mw:PageProp/toc" />
21959 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21960
21961 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21962 !! end
21963
21964 !! test
21965 span tags with directionality in TOC
21966 !! wikitext
21967 __TOC__
21968 == <span dir="ltr">C++</span> ==
21969
21970 == <span dir="rtl">זבנג!</span> ==
21971
21972 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21973
21974 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21975
21976 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21977 !! html
21978 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21979 <ul>
21980 <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>
21981 <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>
21982 <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>
21983 <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>
21984 <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>
21985 </ul>
21986 </div>
21987
21988 <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>
21989 <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>
21990 <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>
21991 <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>
21992 <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>
21993
21994 !! end
21995
21996 !! test
21997 Bug 72884: bdi element in ToC
21998 !! wikitext
21999 __TOC__
22000 == <bdi>test</bdi> ==
22001 !! html
22002 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22003 <ul>
22004 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
22005 </ul>
22006 </div>
22007
22008 <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>
22009
22010 !! end
22011
22012 !! test
22013 T35715: s/strike element in ToC
22014 !! wikitext
22015 __TOC__
22016 == <s>test</s> test <strike>test</strike> ==
22017 !! html
22018 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22019 <ul>
22020 <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>
22021 </ul>
22022 </div>
22023
22024 <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>
22025
22026 !! end
22027
22028 # Note that the html output does not have the <p></p>, but the
22029 # html+tidy output *does*. This is because the empty <p></p> is
22030 # removed by the sanitizer, but only when tidy is *not* enabled (!).
22031 !! test
22032 Empty <p> tag in TOC, removed by Sanitizer (T92892)
22033 !! wikitext
22034 __TOC__
22035 == x ==
22036 !! html
22037 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22038 <ul>
22039 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22040 </ul>
22041 </div>
22042
22043 <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>
22044
22045 !! html+tidy
22046 <p></p>
22047 <div id="toc" class="toc">
22048 <div id="toctitle">
22049 <h2>Contents</h2>
22050 </div>
22051 <ul>
22052 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22053 </ul>
22054 </div>
22055 <p></p>
22056 <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>
22057 !! end
22058
22059 !! article
22060 MediaWiki:Bug32057
22061 !! text
22062 == {{int:headline_sample}} ==
22063 !! endarticle
22064
22065 !! test
22066 Bug 32057: Title needed when expanding <h> nodes.
22067 !! options
22068 title=[[Main Page]]
22069 !! wikitext
22070 {{int:Bug32057}}
22071 !! html
22072 <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>
22073
22074 !! end
22075
22076 !! test
22077 Strip marker in urlencode
22078 !! wikitext
22079 {{urlencode:x<nowiki/>y}}
22080 {{urlencode:x<nowiki/>y|wiki}}
22081 {{urlencode:x<nowiki/>y|path}}
22082 {{urlencode:x<pre id="one">two</pre>y}}
22083 !! html/php
22084 <p>xy
22085 xy
22086 xy
22087 xy
22088 </p>
22089 !! end
22090
22091 !! test
22092 Strip marker in lc
22093 !! wikitext
22094 {{lc:x<nowiki/>y}}
22095 !! html
22096 <p>xy
22097 </p>
22098 !! end
22099
22100 !! test
22101 Strip marker in uc
22102 !! wikitext
22103 {{uc:x<nowiki/>y}}
22104 !! html
22105 <p>XY
22106 </p>
22107 !! end
22108
22109 !! test
22110 Strip marker in formatNum
22111 !! wikitext
22112 {{formatnum:1<nowiki/>2}}
22113 {{formatnum:1<nowiki/>2|R}}
22114 !! html
22115 <p>12
22116 12
22117 </p>
22118 !! end
22119
22120 !! test
22121 Check noCommafy in formatNum
22122 !! options
22123 language=be-tarask
22124 !! wikitext
22125 {{formatnum:123456.78}}
22126 {{formatnum:123456.78|NOSEP}}
22127 !! html
22128 <p>123 456,78
22129 123456.78
22130 </p>
22131 !! end
22132
22133 !! test
22134 Wrong option for formatNum (bug 56199)
22135 !! wikitext
22136 {{formatnum:1,234.56|Random}}
22137 {{formatnum:1,234.56|EVERYTHING}}
22138 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
22139 !! html
22140 <p>1,234.56
22141 1,234.56
22142 1,234.56
22143 </p>
22144 !! end
22145
22146 !! test
22147 Strip marker in grammar
22148 !! options
22149 language=fi
22150 !! wikitext
22151 {{grammar:elative|foo<nowiki/>bar}}
22152 !! html
22153 <p>foobarista
22154 </p>
22155 !! end
22156
22157 !! test
22158 Strip marker in padleft
22159 !! wikitext
22160 {{padleft:|2|x<nowiki/>y}}
22161 !! html
22162 <p>xy
22163 </p>
22164 !! end
22165
22166 !! test
22167 Strip marker in padright
22168 !! wikitext
22169 {{padright:|2|x<nowiki/>y}}
22170 !! html
22171 <p>xy
22172 </p>
22173 !! end
22174
22175 !! test
22176 Strip marker in anchorencode
22177 !! wikitext
22178 {{anchorencode:x<nowiki/>y}}
22179 !! html
22180 <p>xy
22181 </p>
22182 !! end
22183
22184 !! test
22185 nowiki inside link inside heading (bug 18295)
22186 !! wikitext
22187 ==[[foo|x<nowiki>y</nowiki>z]]==
22188 !! html
22189 <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>
22190
22191 !! end
22192
22193 !! test
22194 new support for bdi element (bug 31817)
22195 !! wikitext
22196 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22197 !! html
22198 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22199
22200 !!end
22201
22202 !! test
22203 Ignore pipe between table row attributes
22204 !! wikitext
22205 {|
22206 | quux
22207 |- id=foo | style='color: red'
22208 | bar
22209 |}
22210 !! html
22211 <table>
22212 <tr>
22213 <td> quux
22214 </td></tr>
22215 <tr id="foo" style="color: red">
22216 <td> bar
22217 </td></tr></table>
22218
22219 !! end
22220
22221 !! test
22222 Language parser function
22223 !! wikitext
22224 {{#language:ar}}
22225 !! html
22226 <p>العربية
22227 </p>
22228 !! end
22229
22230 !!test
22231 Padleft and padright as substr
22232 !! wikitext
22233 {{padleft:|3|abcde}}
22234 {{padright:|3|abcde}}
22235 !! html
22236 <p>abc
22237 abc
22238 </p>
22239 !! end
22240
22241 !!test
22242 Special parser function
22243 !! wikitext
22244 {{#special:RandomPage}}
22245 {{#special:BaDtItLe}}
22246 {{#special:Foobar}}
22247 !! html
22248 <p>Special:Random
22249 Special:Badtitle
22250 Special:Foobar
22251 </p>
22252 !! end
22253
22254 !!test
22255 Bug 34939 - Case insensitive link parsing ([HttP://])
22256 !! wikitext
22257 [HttP://MediaWiki.Org/]
22258 !! html/php
22259 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
22260 </p>
22261 !! html/parsoid
22262 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
22263 !! end
22264
22265 !!test
22266 Bug 34939 - Case insensitive link parsing ([HttP:// title])
22267 !! wikitext
22268 [HttP://MediaWiki.Org/ MediaWiki]
22269 !! html
22270 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22271 </p>
22272 !! end
22273
22274 !!test
22275 Bug 34939 - Case insensitive link parsing (HttP://)
22276 !! wikitext
22277 HttP://MediaWiki.Org/
22278 !! html/php
22279 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22280 </p>
22281 !! html/parsoid
22282 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22283 !! end
22284
22285 !!test
22286 Disable TOC
22287 !! options
22288 notoc
22289 !! wikitext
22290 Lead
22291 == Section 1 ==
22292 == Section 2 ==
22293 == Section 3 ==
22294 == Section 4 ==
22295 == Section 5 ==
22296 !! html
22297 <p>Lead
22298 </p>
22299
22300 <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>
22301 <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>
22302 <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>
22303 <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>
22304 <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>
22305
22306 !! end
22307
22308
22309 ###
22310 ### Parsoid-specific tests
22311 ### Parsoid-PHP parser incompatibilities
22312 ###
22313 !!test
22314 1. SOL-sensitive wikitext tokens as template-args
22315 !!options
22316 parsoid=wt2html,wt2wt
22317 !! wikitext
22318 {{echo|*a}}
22319 {{echo|#a}}
22320 {{echo|:a}}
22321 !! html
22322 <span about="#mwt1" typeof="mw:Transclusion">
22323 </span><ul about="#mwt1"><li>a</li>
22324 </ul>
22325 <span about="#mwt2" typeof="mw:Transclusion">
22326 </span><ol about="#mwt2"><li>a</li>
22327 </ol>
22328 <span about="#mwt3" typeof="mw:Transclusion">
22329 </span><dl about="#mwt3"><dd>a</dd>
22330 </dl>
22331 !!end
22332
22333 #### -----------------------------------------------------------------
22334 #### Parsoid-specific functionality tests
22335 #### -----------------------------------------------------------------
22336
22337 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
22338 # We know wt2wt will fail, but we expect selser to pass.
22339 # Due to the nature of our testing, wt2wt and selser tests will enter the
22340 # blacklist and we'll catch selser regressions based on changes to the
22341 # blacklist entries for selser tests.
22342 !! test
22343 1. Bad treebuilder fixup of formatting elt is cleaned up
22344 !! options
22345 parsoid=wt2html,wt2wt
22346 !! wikitext
22347 {|
22348 |
22349 <small>
22350 [[Image:Foobar.jpg|right|Test]]
22351 </small>
22352 |}
22353 !! html/parsoid
22354 <table>
22355 <tbody><tr><td>
22356 <small>
22357 <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>
22358 </small>
22359 </td></tr>
22360 </tbody></table>
22361 !! end
22362
22363 !! test
22364 2. Bad treebuilder fixup of formatting elt is cleaned up
22365 !! options
22366 parsoid=wt2html,wt2wt
22367 !! wikitext
22368 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22369
22370 <small>[[Image:Foobar.jpg|right|300px]]</small>
22371 !! html/parsoid
22372
22373 <p><b>foo</b></p>
22374 <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>
22375 <p><b>bar</b></p>
22376 <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>
22377 !! end
22378
22379 !! test
22380 3. Bad treebuilder fixup of formatting elt is cleaned up
22381 !! options
22382 parsoid=wt2html,wt2wt
22383 !! wikitext
22384 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22385 !! html/parsoid
22386 <p><small><b>foo</b></small></p>
22387 <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>
22388 <p><small><b>bar</b></small></p>
22389 !! end
22390
22391 !! test
22392 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22393 !! options
22394 parsoid=wt2html,wt2wt
22395 !! wikitext
22396 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22397 !! html/parsoid
22398 <p><b><small></small></b></p>
22399 <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>
22400 <p></p>
22401 !! end
22402
22403 #### ----------------------------------------------------------------
22404 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22405 #### tags. Parsoid's output for these tags differs from that of the
22406 #### PHP parser.
22407 #### ----------------------------------------------------------------
22408
22409 !!test
22410 Ref: 1. ref-location should be replaced with an index span
22411 !! wikitext
22412 A <ref>foo</ref>
22413 B <ref name="x">foo</ref>
22414 C <ref name="y" />
22415 <references />
22416 !! html/parsoid
22417 <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>
22418 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>
22419 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>
22420 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22421 <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>
22422 <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>
22423 <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>
22424 </ol>
22425 !!end
22426
22427 !!test
22428 Ref: 2. ref-tags with identical names should all get the same index
22429 !! wikitext
22430 A <ref name="x">foo</ref>
22431 B <ref name="x" />
22432 <references />
22433 !! html/parsoid
22434 <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>
22435 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>
22436 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22437 <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>
22438 </ol>
22439 !!end
22440
22441 !!test
22442 Ref: 3. spaces in ref-names should be ignored
22443 !! wikitext
22444 A <ref name="x">foo</ref>
22445 B <ref name=" x " />
22446 C <ref name= x />
22447 <references />
22448 !! html/parsoid
22449 <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>
22450 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>
22451 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>
22452 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22453 <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>
22454 </ol>
22455 !!end
22456
22457 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22458 !!test
22459 Ref: 4. 'constructor' should be accepted as a valid ref-name
22460 !! wikitext
22461 A <ref name="constructor">foo</ref>
22462 <references />
22463 !! html/parsoid
22464 <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>
22465 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22466 <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>
22467 </ol>
22468 !!end
22469
22470 !!test
22471 Ref: 5. body should accept generic wikitext
22472 !! wikitext
22473 A <ref>
22474 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22475 </ref>
22476
22477 <references />
22478 !! html/parsoid
22479 <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>
22480
22481 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22482 <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>
22483 </span></li>
22484 </ol>
22485 !!end
22486
22487 !!test
22488 Ref: 6. indent-pres should not be output in ref-body
22489 !! wikitext
22490 A <ref>
22491 foo
22492 bar
22493 baz
22494 </ref>
22495
22496 <references />
22497 !! html/parsoid
22498 <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>
22499
22500 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22501 <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
22502 bar
22503 baz
22504 </span></li>
22505 </ol>
22506 !!end
22507
22508 !!test
22509 Ref: 7. No p-wrapping in ref-body
22510 !! wikitext
22511 A <ref>
22512 foo
22513
22514 bar
22515
22516
22517 baz
22518
22519
22520
22521 booz
22522 </ref>
22523
22524 <references />
22525 !! html/parsoid
22526 <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>
22527
22528 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22529 <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
22530
22531 bar
22532
22533
22534 baz
22535
22536
22537
22538 booz
22539 </span></li>
22540 </ol>
22541 !!end
22542
22543 !!test
22544 Ref: 8. transclusion wikitext has lower precedence
22545 !! wikitext
22546 A <ref> foo {{echo|</ref> B C}}
22547
22548 <references />
22549 !! html/parsoid
22550 <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>
22551 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22552 <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>
22553 </ol>
22554 !!end
22555
22556 !!test
22557 Ref: 9. unclosed comments should not leak out of ref-body
22558 !! wikitext
22559 A <ref> foo <!--</ref> B C
22560 <references />
22561 !! html/parsoid
22562 <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>
22563 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22564 <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>
22565 </ol>
22566 !!end
22567
22568 !!test
22569 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22570 !! wikitext
22571 A <ref> <b> foo </ref> B C
22572
22573 <references />
22574 !! html/parsoid
22575 <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>
22576
22577
22578 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22579 <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>
22580 </ol>
22581 !!end
22582
22583 !!test
22584 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22585 !! wikitext
22586 A <ref>foo</ref> B
22587 C <ref>bar</ref> D
22588 <references />
22589 !! html/parsoid
22590 <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
22591 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>
22592 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22593 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
22594 <li about="#cite_note-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>
22595 </ol>
22596 !!end
22597
22598 !!test
22599 Ref: 12. ref-tags act as trailing newline migration barrier
22600 !! wikitext
22601 <!--the newline at the end of this line moves out of the p tag-->a
22602
22603 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22604 <ref />
22605
22606 c
22607 <references />
22608 !! html/parsoid
22609 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22610
22611
22612 <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>
22613 <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>
22614
22615 <p>c</p>
22616 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22617 <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>
22618 <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>
22619 !!end
22620
22621 !!test
22622 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22623 !! wikitext
22624 <ref>foo</ref> A
22625 <ref>bar
22626 </ref> B
22627 <references />
22628 !! html/parsoid
22629 <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
22630 <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>
22631 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22632 <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>
22633 <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
22634 </span></li>
22635 </ol>
22636 !!end
22637
22638 ## Roundtripping fails because of nowiki'ing
22639 !! test
22640 Ref: 14. A nested ref-tag should be emitted as plain text
22641 !! options
22642 parsoid=wt2html
22643 !! wikitext
22644 <ref>foo <ref>bar</ref> baz</ref>
22645
22646 <references />
22647 !! html/parsoid
22648 <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>
22649
22650 <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>
22651 !! end
22652
22653 !!test
22654 Ref: 15. ref-tags with identical names should get identical indexes
22655 !! wikitext
22656 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22657 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22658
22659 <references />
22660 !! html/parsoid
22661 <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>
22662 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>
22663
22664 <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>
22665 </ol>
22666 !!end
22667
22668 ## We don't bother wt2wt-ing non-standard whitespace
22669 !!test
22670 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22671 !!options
22672 parsoid=wt2html
22673 !! wikitext
22674 A <ref >foo</ref >
22675
22676 <references />
22677 !! html/parsoid
22678 <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>
22679 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22680 <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>
22681 !!end
22682
22683 !!test
22684 Ref: 17. Generate valid HTML5 id/about attributes
22685 !!wikitext
22686 <ref name="a b">foo</ref>
22687 <ref name=":0">ve-created name</ref>
22688
22689 <references />
22690 !!html/parsoid
22691 <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>
22692 <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>
22693
22694 <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>
22695
22696 !!end
22697
22698 !!test
22699 Ref: 18. T58916: Extension attributes should be parsed as plain text
22700 !!wikitext
22701 <ref name="{{echo|a}}">foo</ref>
22702
22703 <references />
22704 !!html/parsoid
22705 <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>
22706 </p>
22707
22708 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22709 <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>
22710 </ol>
22711 !!end
22712
22713 !!test
22714 Ref: 19. ref-tags with identical name encodings should get identical indexes
22715 !! wikitext
22716 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22717
22718 <references />
22719 !! html/parsoid
22720 <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>
22721 </p>
22722 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22723 <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>
22724 </ol>
22725 !!end
22726
22727 !!test
22728 Ref: 20. ref-tags with identical names but different content should keep it
22729 !! wikitext
22730 A <ref name="foo">Foo one</ref>
22731 B <ref name="foo">Foo two</ref>
22732 C <ref name="foo" />
22733
22734 <references />
22735 !! html/parsoid
22736 <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>
22737 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>
22738 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>
22739
22740 <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>
22741 </ol>
22742 !!end
22743
22744 !!test
22745 References: 1. references tag without any refs should be handled properly
22746 !! wikitext
22747 <references />
22748 !! html/parsoid
22749 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22750 !!end
22751
22752 !!test
22753 References: 2. references tag with group only outputs references from that group
22754 !! wikitext
22755 A <ref group="a">foo</ref>
22756 B <ref group="b">bar</ref>
22757 C <ref>baz</ref>
22758
22759 <references group="a" />
22760 <references />
22761 <references group="b" />
22762 !! html/parsoid
22763 <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>
22764 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>
22765 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>
22766
22767 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22768 <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>
22769 </ol>
22770 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22771 <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>
22772 </ol>
22773 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22774 <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>
22775 </ol>
22776 !!end
22777
22778 !!test
22779 References: 3. ref list should be cleared after processing references
22780 !! wikitext
22781 A <ref>foo</ref>
22782
22783 <references />
22784
22785 B <ref>bar</ref>
22786
22787 <references />
22788 !! html/parsoid
22789 <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>
22790
22791 <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>
22792 </ol>
22793
22794 <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>
22795
22796 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22797 <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>
22798 </ol>
22799 !!end
22800
22801 !!test
22802 References: 4. only referenced group should be cleared after processing references
22803 !! wikitext
22804 A <ref group="a">afoo</ref>
22805 B <ref>bfoo</ref>
22806
22807 <references group="a" />
22808
22809 C <ref>cfoo</ref>
22810
22811 <references />
22812 !! html/parsoid
22813 <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>
22814 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>
22815
22816 <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>
22817 </ol>
22818
22819 <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>
22820
22821 <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>
22822 </ol>
22823 !!end
22824
22825 ## Don't expect this to rt since we're dropping content
22826 !! test
22827 References: 5. ref tags in references should be processed while ignoring all other content
22828 !! options
22829 parsoid=wt2html,html2html
22830 !! wikitext
22831 A <ref name="a" />
22832 B <ref name="b">bar</ref>
22833
22834 <references>
22835 <ref name="a">foo</ref>
22836 This should just get lost.
22837 </references>
22838 !! html/parsoid
22839 <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>
22840 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>
22841
22842
22843 <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>
22844 </ol>
22845 !! end
22846
22847 !! test
22848 References: 6. <references /> from a transclusion
22849 !! wikitext
22850 <ref>Foo</ref> {{echo|<references />}}
22851 !! html/parsoid
22852 <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>
22853 </ol>
22854 !! end
22855
22856 !! test
22857 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22858 !! wikitext
22859 A <ref>foo bar for a</ref>
22860 B <ref group="X" name="b" />
22861
22862 <references />
22863
22864 <references group="X">
22865 <ref name="b">foo</ref>
22866 </references>
22867 !! html/parsoid
22868 <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>
22869 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>
22870 </p>
22871
22872 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22873 <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>
22874 </ol>
22875
22876 <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"}}'>
22877 <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>
22878 </ol>
22879 !! end
22880
22881 !! test
22882 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22883 !! wikitext
22884 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22885 <references />
22886 !! html/parsoid
22887 <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>
22888 <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>
22889 </ol>
22890 !!end
22891
22892 # This test only works in wt2html now as the <references /> are always generated
22893 # unless selser is active. Once T72722 is fixed, we should add a changes test
22894 # here to ensure that unrelated changes don't add the new <references />
22895 # when selser is active.
22896 !! test
22897 References: 9. Generate missing references list at the end
22898 !! wikitext
22899 A <ref>foo</ref>
22900 B <ref group="inexistent">bar</ref>
22901 !! html/parsoid
22902 <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>
22903 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
22904 <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>
22905 </ol>
22906 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
22907 <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>
22908 </ol>
22909 !! end
22910
22911 !! test
22912 References: 10. New <references/> shouldn't be added for unrelated edits.
22913 !! options
22914 parsoid={
22915 "modes": ["selser"],
22916 "changes": [["#x", "remove"]],
22917 "selser": "noauto"
22918 }
22919 !! wikitext
22920 Unrelated text<span id="x"> that's going to disappear</span>.
22921 A <ref>foo</ref>
22922 !! wikitext/edited
22923 Unrelated text.
22924 A <ref>foo</ref>
22925 !!end
22926
22927 !! test
22928 Entities in ref name
22929 !! wikitext
22930 <ref name="test &amp; me">hi</ref>
22931 <references />
22932 !! html/parsoid
22933 <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>
22934 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22935 <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>
22936 </ol>
22937 !! end
22938
22939 ## The output here may look funny, but it's what the php parser will do. The
22940 ## unclosed references tag becomes escaped text, and then a new references
22941 ## tag is auto-generated. The test is wt2html only because it roundtrips with
22942 ## nowiki tags, and the auto-generated references tag is only dropped in
22943 ## rtTestMode.
22944 !! test
22945 Generate references for unclosed references tag
22946 !! options
22947 parsoid=wt2html
22948 !! wikitext
22949 a<ref>foo</ref>
22950
22951 <references>
22952 !! html/parsoid
22953 <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>
22954
22955 <p>&lt;references></p>
22956 <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>
22957 !! end
22958
22959 !! test
22960 New reference serializes on its own line
22961 !! options
22962 parsoid=wt2wt,html2wt
22963 !! wikitext
22964 foo
22965 <references />
22966 !! html/parsoid
22967 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22968 !! end
22969
22970 #### ----------------------------------------------------------------
22971 #### Parsoid-only testing of Parsoid's impl of LST
22972 #### Not implemented yet, see
22973 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22974 #### ----------------------------------------------------------------
22975
22976 ## We still need to support serializing the older format while content is stored.
22977 !! test
22978 LST Sections: Backwards compatibility
22979 !! options
22980 parsoid={
22981 "suppressErrors": true,
22982 "modes": ["html2wt"]
22983 }
22984 !! wikitext
22985 <section begin="2011-05-16" />
22986 <section end="2014-04-10 (MW 1.23wmf22)" />
22987 !! html/parsoid
22988 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22989 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22990 !! end
22991
22992 ## The unconventional output is the result of `usePHPPreProcessor` being
22993 ## disabled in parserTests.js. This test is mainly just to show <section> is
22994 ## recognized as an extension tag w/o a native handler.
22995 !! test
22996 LST Sections: Newfangled approach
22997 !! options
22998 parsoid={ "suppressErrors": true }
22999 !! wikitext
23000 <section begin="2011-05-16" />
23001 <section end="2014-04-10 (MW 1.23wmf22)" />
23002 !! html/parsoid
23003 <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>
23004 <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>
23005 !! end
23006
23007 #--------- Test stripping of empty nodes in template content ----------
23008 !!test
23009 Empty LI and TR nodes should be stripped from template content
23010 !!wikitext
23011 {{EmptyLITest}}
23012 {{EmptyTRTest}}
23013 !!html/parsoid
23014 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
23015 <li>a</li>
23016 <li>b</li>
23017 </ul>
23018 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
23019 <tbody>
23020 <tr>
23021 <td>foo</td>
23022 </tr>
23023 <tr>
23024 <td>bar</td>
23025 </tr>
23026 </tbody>
23027 </table>
23028 !!end
23029
23030 !!test
23031 Empty LI and TR nodes should not be stripped from top-level content
23032 !!wikitext
23033 * a
23034 *
23035 * b
23036 {|
23037 |-
23038 |-
23039 |foo
23040 |}
23041 !!html/parsoid
23042 <ul>
23043 <li> a</li>
23044 <li></li>
23045 <li> b</li>
23046 </ul>
23047 <table>
23048 <tbody>
23049 <tr></tr>
23050 <tr>
23051 <td>foo</td>
23052 </tr>
23053 </tbody>
23054 </table>
23055 !!end
23056
23057 !!test
23058 Empty TR nodes should not be stripped if they have any attributes set
23059 !!wikitext
23060 {{EmptyTRWithHTMLAttrTest}}
23061 !!html/parsoid
23062 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
23063 <tr align="center"></tr>
23064 <tr><td>foo</td></tr>
23065 <tr align="center"></tr>
23066 <tr><td>bar</td></tr>
23067 </table>
23068 !!end
23069
23070 #### ----------------------------------------------------------------
23071 #### The following section of tests are primarily to test
23072 #### wikitext escaping capabilities of Parsoid. Given that
23073 #### escaping can be done any number of ways, the wikitext (input)
23074 #### is always adjusted to reflect how Parsoid adds nowiki
23075 #### escape tags.
23076 ####
23077 #### We are marking several tests as parsoid-only since the
23078 #### HTML in the result section is different from what the
23079 #### PHP parser generates for it.
23080 #### ----------------------------------------------------------------
23081
23082
23083 #### --------------- Headings ---------------
23084 #### 0. Unnested
23085 #### 1. Nested inside html <h1>=foo=</h1>
23086 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
23087 #### 3. Nested inside html with wikitext split by html tags
23088 #### 4. No escape needed
23089 #### 5. Empty headings <h1></h1>
23090 #### 6. Heading chars in SOL context
23091 #### ----------------------------------------
23092 !! test
23093 Headings: 0. Unnested
23094 !! options
23095 parsoid=html2wt
23096 !! html/parsoid
23097 <p>=foo=</p>
23098
23099 <p> =foo=
23100 <!--cmt-->
23101 =foo=</p>
23102
23103 <p>=foo<i>a</i>=</p>
23104 !! wikitext
23105 <nowiki>=foo=</nowiki>
23106
23107 <nowiki> </nowiki>=foo=
23108 <!--cmt-->
23109 <nowiki>=foo=</nowiki>
23110
23111 =foo''a''<nowiki>=</nowiki>
23112 !!end
23113
23114 # New headings and existing headings are handled differently
23115 !! test
23116 Headings: 1. Nested inside html
23117 !! options
23118 parsoid=html2wt
23119 !! html/parsoid
23120 <h1>=foo=</h1>
23121 <h2>=foo=</h2>
23122 <h3>=foo=</h3>
23123
23124 <h1 data-parsoid=''>=foo=</h1>
23125 <h2 data-parsoid=''>=foo=</h2>
23126 <h3 data-parsoid=''>=foo=</h3>
23127 <h4 data-parsoid=''>=foo=</h4>
23128 <h5 data-parsoid=''>=foo=</h5>
23129 <h6 data-parsoid=''>=foo=</h6>
23130 !! wikitext
23131 = =foo= =
23132
23133 == =foo= ==
23134
23135 === =foo= ===
23136
23137 =<nowiki>=foo=</nowiki>=
23138 ==<nowiki>=foo=</nowiki>==
23139 ===<nowiki>=foo=</nowiki>===
23140 ====<nowiki>=foo=</nowiki>====
23141 =====<nowiki>=foo=</nowiki>=====
23142 ======<nowiki>=foo=</nowiki>======
23143
23144 !!end
23145
23146 !! test
23147 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
23148 !! options
23149 parsoid=html2wt
23150 !! html/parsoid
23151 <h1>foo</h1>*bar
23152 <h1>foo</h1>=bar
23153 <h1>foo</h1>=bar=
23154 !! wikitext
23155 = foo =
23156 <nowiki>*</nowiki>bar
23157
23158 = foo =
23159 =bar
23160
23161 = foo =
23162 <nowiki>=bar=</nowiki>
23163 !!end
23164
23165 !! test
23166 Headings: 3. Nested inside html with wikitext split by html tags
23167 !! options
23168 parsoid=html2wt
23169 !! html/parsoid
23170 <h1>=<b>bold</b>foo=</h1>
23171 !! wikitext
23172 = ='''bold'''foo= =
23173 !!end
23174
23175 !! test
23176 Headings: 4a. No escaping needed (testing just h1 and h2)
23177 !! options
23178 parsoid=html2wt
23179 !! html/parsoid
23180 <h1>=foo</h1>
23181 <h1>foo=</h1>
23182 <h1> =foo= </h1>
23183 <h1>=foo= bar</h1>
23184 <h2>=foo</h2>
23185 <h2>foo=</h2>
23186 <h1>=</h1>
23187 <h1><i>=</i>foo=</h1>
23188 !! wikitext
23189 = =foo =
23190
23191 = foo= =
23192
23193 = =foo= =
23194
23195 = =foo= bar =
23196
23197 == =foo ==
23198
23199 == foo= ==
23200
23201 = = =
23202
23203 = ''=''foo= =
23204 !!end
23205
23206 !! test
23207 Headings: 4b. No escaping needed (inside p-tags)
23208 !! options
23209 parsoid=html2wt
23210 !! html/parsoid
23211 <p>===
23212 =foo= x
23213 =foo= <s></s>
23214 </p>
23215 !! wikitext
23216 ===
23217 =foo= x
23218 =foo= <s></s>
23219 !!end
23220
23221 !! test
23222 Headings: 5. Empty headings
23223 !! options
23224 parsoid=html2wt
23225 !! html/parsoid
23226 <h1 data-parsoid='{}'></h1>
23227
23228 <h2 data-parsoid='{}'></h2>
23229
23230 <h3 data-parsoid='{}'></h3>
23231
23232 <h4 data-parsoid='{}'></h4>
23233
23234 <h5 data-parsoid='{}'></h5>
23235
23236 <h6 data-parsoid='{}'></h6>
23237 !! wikitext
23238 =<nowiki/>=
23239
23240 ==<nowiki/>==
23241
23242 ===<nowiki/>===
23243
23244 ====<nowiki/>====
23245
23246 =====<nowiki/>=====
23247
23248 ======<nowiki/>======
23249 !!end
23250
23251 !! test
23252 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23253 !! options
23254 parsoid=html2wt
23255 !! html/parsoid
23256 <p>=a=</p>
23257
23258 <p>=a=</p>
23259
23260 <p>=a=</p>
23261 !! wikitext
23262 <nowiki>=a=</nowiki>
23263
23264 <nowiki>=a=</nowiki>
23265
23266 <nowiki>=a=</nowiki>
23267 !!end
23268
23269 !! test
23270 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23271 !! options
23272 parsoid=html2wt
23273 !! html/parsoid
23274 <p>=a=
23275 b</p>
23276
23277 <p>=a=
23278 b</p>
23279
23280 <p>=a=
23281 b</p>
23282 !! wikitext
23283 <nowiki>=a=</nowiki>
23284 b
23285
23286 <nowiki>=a=</nowiki>
23287 b
23288
23289 <nowiki>=a=</nowiki>
23290 b
23291 !!end
23292
23293 !! test
23294 Headings: 6c. Heading chars in SOL context (leading newline break)
23295 !! options
23296 parsoid=html2wt
23297 !! html/parsoid
23298 <p>a
23299 =b=</p>
23300 !! wikitext
23301 a
23302 <nowiki>=b=</nowiki>
23303 !!end
23304
23305 !! test
23306 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23307 !! options
23308 parsoid=html2wt
23309 !! html/parsoid
23310 <!--c0--><p>=a=</p>
23311
23312 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23313 !! wikitext
23314 <!--c0--><nowiki>=a=</nowiki>
23315
23316 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23317 !!end
23318
23319 !! test
23320 Headings: 6d. Heading chars in SOL context (No escaping needed)
23321 !! options
23322 parsoid=html2wt
23323 !! html/parsoid
23324 =a=<div>b</div>
23325 !! wikitext
23326 =a=<div>b</div>
23327 !!end
23328
23329 !! test
23330 Headings: 7. Insert a newline between new content and headings
23331 !! options
23332 parsoid=html2wt
23333 !! html/parsoid
23334 <h2>NEW</h2>
23335 <p>new</p>
23336 <h2 data-parsoid='{}'>A</h2>
23337 <p data-parsoid='{}'>a</p>
23338 !! wikitext
23339 == NEW ==
23340 new
23341
23342 ==A==
23343 a
23344
23345 !! end
23346
23347 #### --------------- Lists ---------------
23348 #### 0. Outside nests (*foo, etc.)
23349 #### 1. Nested inside html <ul><li>*foo</li></ul>
23350 #### 2. Inside definition lists
23351 #### 3. Only bullets at start should be escaped
23352 #### 4. No escapes needed
23353 #### 5. No unnecessary escapes
23354 #### 6. Escape bullets in SOL position
23355 #### 7. Escape bullets in a multi-line context
23356 #### ----------------------------------------
23357
23358 !! test
23359 Lists: 0. Outside nests
23360 !! options
23361 parsoid=html2wt
23362 !! html/parsoid
23363 <p>*foo</p>
23364
23365 <p>#foo</p>
23366
23367 <p>;Foo:bar</p>
23368 !! wikitext
23369 <nowiki>*</nowiki>foo
23370
23371 <nowiki>#</nowiki>foo
23372
23373 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23374 !!end
23375
23376 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23377 ## to test wikitext escaping, and insignificant whitespace diffs
23378 ## cause PHP parser tests to barf
23379 !! test
23380 Lists: 1. Nested inside html (No unnecessary escapes)
23381 !! options
23382 parsoid=html2wt
23383 !! html/parsoid
23384 <ul>
23385 <li>*foo</li>
23386 <li>#foo</li>
23387 <li>:foo</li>
23388 <li>;foo</li>
23389 <li data-parsoid='{}'>*foo</li>
23390 <li data-parsoid='{}'>#foo</li>
23391 <li data-parsoid='{}'>:foo</li>
23392 <li data-parsoid='{}'>;foo</li>
23393 </ul>
23394
23395 <ol>
23396 <li>*foo</li>
23397 <li>#foo</li>
23398 <li>:foo</li>
23399 <li>;foo</li>
23400 <li data-parsoid='{}'>*foo</li>
23401 <li data-parsoid='{}'>#foo</li>
23402 <li data-parsoid='{}'>:foo</li>
23403 <li data-parsoid='{}'>;foo</li>
23404 </ol>
23405 !! wikitext
23406 * *foo
23407 * #foo
23408 * :foo
23409 * ;foo
23410 *<nowiki>*foo</nowiki>
23411 *<nowiki>#foo</nowiki>
23412 *<nowiki>:foo</nowiki>
23413 *<nowiki>;foo</nowiki>
23414
23415 # *foo
23416 # #foo
23417 # :foo
23418 # ;foo
23419 #<nowiki>*foo</nowiki>
23420 #<nowiki>#foo</nowiki>
23421 #<nowiki>:foo</nowiki>
23422 #<nowiki>;foo</nowiki>
23423 !!end
23424
23425 !! test
23426 Lists: 2. Inside definition lists
23427 !! options
23428 parsoid=html2wt
23429 !! html/parsoid
23430 <dl><dt>;foo</dt></dl>
23431 <dl><dt>:foo</dt></dl>
23432 <dl><dt>:foo</dt>
23433 <dd>bar</dd></dl>
23434 <dl><dd>:foo</dd></dl>
23435 !! wikitext
23436 ; ;foo
23437
23438 ; <nowiki>:foo</nowiki>
23439
23440 ; <nowiki>:foo</nowiki>
23441 : bar
23442
23443 : :foo
23444 !!end
23445
23446 !! test
23447 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23448 !! options
23449 parsoid=html2wt
23450 !! html/parsoid
23451 <ul>
23452 <li>*foo*bar</li>
23453 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23454 </ul>
23455 !! wikitext
23456 * *foo*bar
23457 *<nowiki>*foo</nowiki>''it''*bar
23458 !!end
23459
23460 !! test
23461 Lists: 4. No escapes needed
23462 !! options
23463 parsoid=html2wt
23464 !! html/parsoid
23465 <ul>
23466 <li>foo*bar
23467 </li>
23468 </ul>
23469 <ul>
23470 <li><i>foo</i>*bar
23471 </li>
23472 </ul>
23473 <ul>
23474 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23475 </li>
23476 </ul>
23477 <ul>
23478 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23479 </li>
23480 </ul>
23481 !! wikitext
23482 *foo*bar
23483
23484 *''foo''*bar
23485
23486 *[[Foo]]: bar
23487
23488 *[[Foo]]*bar
23489 !!end
23490
23491 !! test
23492 Lists: 5. No unnecessary escapes
23493 !! options
23494 parsoid=html2wt
23495 !! html/parsoid
23496 <ul><li> bar <span>[[foo]]</span></li></ul>
23497 <ul><li> =bar <span>[[foo]]</span></li></ul>
23498 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23499 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23500 <ul><li> =bar <span>foo]]</span>=</li></ul>
23501 <ul><li> <s></s>: a</li></ul>
23502 <ul><li> <i>* foo</i></li></ul>
23503
23504 !! wikitext
23505 * bar <span><nowiki>[[foo]]</nowiki></span>
23506
23507 * =bar <span><nowiki>[[foo]]</nowiki></span>
23508
23509 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23510
23511 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23512
23513 * =bar <span>foo]]</span>=
23514
23515 * <s></s>: a
23516
23517 * ''* foo''
23518 !!end
23519
23520 !! test
23521 Lists: 6. Escape bullets in SOL position
23522 !! options
23523 parsoid=html2wt
23524 !! html/parsoid
23525 <p><!--cmt-->*foo</p>
23526 !! wikitext
23527 <!--cmt--><nowiki>*</nowiki>foo
23528 !!end
23529
23530 !! test
23531 Lists: 7. Escape bullets in a multi-line context
23532 !! options
23533 parsoid=html2wt
23534 !! html/parsoid
23535 <p>a
23536 *b
23537 </p>
23538 !! wikitext
23539 a
23540 <nowiki>*</nowiki>b
23541 !!end
23542
23543 !! test
23544 Lists: 8. Escape colons only if not present in tags
23545 !! options
23546 parsoid=html2wt
23547 !! html/parsoid
23548 <dl><dt>a:b<i>c:d</i></dt></dl>
23549 !! wikitext
23550 ; <nowiki>a:b</nowiki>''c:d''
23551 !! end
23552
23553 #### --------------- HRs ---------------
23554 #### 1. Single line
23555 #### -----------------------------------
23556
23557 !! test
23558 HRs: 1. Single line
23559 !! options
23560 parsoid=html2wt
23561 !! html/parsoid
23562 <hr />----
23563 <hr />=foo=
23564 <hr />*foo
23565 !! wikitext
23566 ----<nowiki>----</nowiki>
23567 ----=foo=
23568 ----*foo
23569 !! end
23570
23571 #### --------------- Tables ---------------
23572 #### 1a. Simple example
23573 #### 1b. No escaping needed (!foo)
23574 #### 1c. No escaping needed (|foo)
23575 #### 1d. No escaping needed (|}foo)
23576 ####
23577 #### 2a. Nested in td (<td>foo|bar</td>)
23578 #### 2b. Nested in td (<td>foo||bar</td>)
23579 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23580 ####
23581 #### 3a. Nested in th (<th>foo!bar</th>)
23582 #### 3b. Nested in th (<th>foo!!bar</th>)
23583 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23584 ####
23585 #### 4a. Escape -
23586 #### 4b. Escape +
23587 #### 4c. No escaping needed
23588 #### --------------------------------------
23589
23590 !! test
23591 Tables: 1a. Simple example
23592 !! options
23593 parsoid=html2wt
23594 !! html/parsoid
23595 <p>{|
23596 |}
23597 </p>
23598 !! wikitext
23599 <nowiki>{|</nowiki>
23600 |}
23601 !! end
23602
23603 !! test
23604 Tables: 1b. No escaping needed
23605 !! options
23606 parsoid=html2wt
23607 !! html/parsoid
23608 <p>!foo
23609 </p>
23610 !! wikitext
23611 !foo
23612 !! end
23613
23614 !! test
23615 Tables: 1c. No escaping needed
23616 !! options
23617 parsoid=html2wt
23618 !! html/parsoid
23619 <p>|foo
23620 </p>
23621 !! wikitext
23622 |foo
23623 !! end
23624
23625 !! test
23626 Tables: 1d. No escaping needed
23627 !! options
23628 parsoid=html2wt
23629 !! html/parsoid
23630 <p>|}foo
23631 </p>
23632 !! wikitext
23633 |}foo
23634 !! end
23635
23636 !! test
23637 Tables: 2a. Nested in td
23638 !! options
23639 parsoid=html2wt
23640 !! html/parsoid
23641 <table><tbody><tr>
23642 <td>foo|bar</td></tr>
23643 <tr><td>x<div>a|b</div></td>
23644 </tbody></table>
23645 !! wikitext
23646 {|
23647 |<nowiki>foo|bar</nowiki>
23648 |-
23649 |x<div><nowiki>a|b</nowiki></div>
23650 |}
23651 !! html/php+tidy
23652 <table>
23653 <tr>
23654 <td>foo|bar</td>
23655 </tr>
23656 <tr>
23657 <td>x
23658 <div>a|b</div>
23659 </td>
23660 </tr>
23661 </table>
23662 !! end
23663
23664 !! test
23665 Tables: 2b. Nested in td
23666 !! options
23667 parsoid=html2wt
23668 !! html/parsoid
23669 <table><tbody><tr>
23670 <td>foo||bar</td>
23671 <td>a<i>b||c</i></td>
23672 <td>a<i><div>b||c</div></i></td>
23673 </tr></tbody></table>
23674 !! wikitext
23675 {|
23676 |<nowiki>foo||bar</nowiki>
23677 |a''<nowiki>b||c</nowiki>''
23678 |a''<div><nowiki>b||c</nowiki></div>''
23679 |}
23680 !! html/php
23681 <table>
23682 <tr>
23683 <td>foo||bar
23684 </td>
23685 <td>a<i>b||c</i>
23686 </td>
23687 <td>a<i><div>b||c</div></i>
23688 </td></tr></table>
23689
23690 !! end
23691
23692 !! test
23693 Tables: 2c. Nested in td -- no escaping needed
23694 !! options
23695 parsoid=html2wt
23696 !! html/*
23697 <table>
23698 <tr>
23699 <td>foo!!bar
23700 </td></tr></table>
23701
23702 !! wikitext
23703 {|
23704 |foo!!bar
23705 |}
23706 !! end
23707
23708 !! test
23709 Tables: 3a. Nested in th
23710 !! options
23711 parsoid=html2wt
23712 !! html/*
23713 <table>
23714 <tr>
23715 <th>foo!bar
23716 </th></tr></table>
23717
23718 !! wikitext
23719 {|
23720 !foo!bar
23721 |}
23722 !! end
23723
23724 !! test
23725 Tables: 3b. Nested in th
23726 !! options
23727 parsoid=html2wt
23728 !! html/parsoid
23729 <table><tbody>
23730 <tr><th>foo!!bar</th>
23731 <th><i>foo|bar</i></th>
23732 <th><i>foo!!bar</i></th>
23733 <th><i><span>foo!!bar</span></i></th>
23734 </tr></tbody></table>
23735 !! wikitext
23736 {|
23737 !<nowiki>foo!!bar</nowiki>
23738 !''<nowiki>foo|bar</nowiki>''
23739 !''<nowiki>foo!!bar</nowiki>''
23740 !''<span><nowiki>foo!!bar</nowiki></span>''
23741 |}
23742 !! html/php
23743 <table>
23744 <tr>
23745 <th>foo!!bar
23746 </th>
23747 <th><i>foo|bar</i>
23748 </th>
23749 <th><i>foo!!bar</i>
23750 </th>
23751 <th><i><span>foo!!bar</span></i>
23752 </th></tr></table>
23753
23754 !! end
23755
23756 !! test
23757 Tables: 3c. Nested in th
23758 !! options
23759 parsoid=html2wt
23760 !! html/parsoid
23761 <table><tbody>
23762 <tr><th>foo||bar</th>
23763 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23764 </tr></tbody></table>
23765 !! wikitext
23766 {|
23767 !<nowiki>foo||bar</nowiki>
23768 !<nowiki>foo||bar</nowiki>
23769 |}
23770 !! html/php
23771 <table>
23772 <tr>
23773 <th>foo||bar
23774 </th>
23775 <th>foo||bar
23776 </th></tr></table>
23777
23778 !! end
23779
23780 !! test
23781 Tables: 4a. Escape -
23782 !! options
23783 parsoid=html2wt
23784 !! html/*
23785 <table>
23786 <tr>
23787 <th>-bar
23788 </th></tr>
23789 <tr>
23790 <td>-bar
23791 </td></tr></table>
23792
23793 !! wikitext
23794 {|
23795 !-bar
23796 |-
23797 |<nowiki>-bar</nowiki>
23798 |}
23799 !! end
23800
23801 !! test
23802 Tables: 4b. Escape +
23803 !! options
23804 parsoid=html2wt
23805 !! html/*
23806 <table>
23807 <tr>
23808 <th>+bar
23809 </th></tr>
23810 <tr>
23811 <td>+bar
23812 </td></tr></table>
23813
23814 !! wikitext
23815 {|
23816 !+bar
23817 |-
23818 |<nowiki>+bar</nowiki>
23819 |}
23820 !! end
23821
23822 !! test
23823 Tables: 4c. No escaping needed
23824 !! options
23825 parsoid=html2wt
23826 !! html/parsoid
23827 <table><tbody>
23828 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23829 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23830 <tr><td>foo
23831 <p>bar|baz
23832 +bar
23833 -bar</p></td></tr>
23834 <tr><td>x
23835 <div>a|b</div></td>
23836 </tbody></table>
23837 !! wikitext
23838 {|
23839 |foo-bar
23840 |foo+bar
23841 |-
23842 |''foo''-bar
23843 |''foo''+bar
23844 |-
23845 |foo
23846 bar|baz
23847 +bar
23848 -bar
23849 |-
23850 |x
23851 <div>a|b</div>
23852 |}
23853 !! html/php
23854 <table>
23855 <tr>
23856 <td>foo-bar
23857 </td>
23858 <td>foo+bar
23859 </td></tr>
23860 <tr>
23861 <td><i>foo</i>-bar
23862 </td>
23863 <td><i>foo</i>+bar
23864 </td></tr>
23865 <tr>
23866 <td>foo
23867 <p>bar|baz
23868 +bar
23869 -bar
23870 </p>
23871 </td></tr>
23872 <tr>
23873 <td>x
23874 <div>a|b</div>
23875 </td></tr></table>
23876
23877 !! end
23878
23879 !! test
23880 Tables: 4d. No escaping needed
23881 !! options
23882 parsoid=html2wt
23883 !! html/parsoid
23884 <table>
23885 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23886 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23887 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23888 </tbody></table>
23889 !! wikitext
23890 {|
23891 |[[Foo]]-bar
23892 ||+1
23893 ||-2
23894 |}
23895 !! html/php
23896 <table>
23897 <tr>
23898 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23899 </td>
23900 <td>+1
23901 </td>
23902 <td>-2
23903 </td></tr></table>
23904
23905 !! end
23906
23907 !! test
23908 T97430: Don't emit empty nowiki pairs around marker meta tags
23909 !! options
23910 parsoid=html2wt
23911 !! html/parsoid
23912 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23913 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23914 !! wikitext
23915 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23916 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23917 !! end
23918
23919 !! test
23920 Unclosed xmlish element in table line shouldn't eat end delimiters
23921 !! options
23922 parsoid=html2wt
23923 !! html/parsoid
23924 <table>
23925 <tbody><tr><td> &lt;foo</td>
23926 <td> bar></td></tr>
23927 </tbody></table>
23928 !! wikitext
23929 {|
23930 | <foo
23931 | bar>
23932 |}
23933 !! html/php
23934 <table>
23935 <tr>
23936 <td> &lt;foo
23937 </td>
23938 <td> bar&gt;
23939 </td></tr></table>
23940
23941 !! end
23942
23943 #### --------------- Links ----------------
23944 #### 1. Quote marks in link text
23945 #### 2. Wikilinks: Escapes needed
23946 #### 3. Wikilinks: No escapes needed
23947 #### 4. Extlinks: Escapes needed
23948 #### 5. Extlinks: No escapes needed
23949 #### --------------------------------------
23950 !! test
23951 Links 1. WikiLinks: No escapes needed
23952 !! options
23953 parsoid=html2wt
23954 !! html/parsoid
23955 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23956 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23957 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23958 !! wikitext
23959 [[Foo|Foo''boo'']]
23960 [[Foo|[Foobar]]]
23961 [[Foo|x [Foobar] x]]
23962 !! html/php
23963 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23964 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23965 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23966 </p>
23967 !! end
23968
23969 !! test
23970 Links 2. WikiLinks: Escapes needed
23971 !! options
23972 parsoid=html2wt
23973 !! html/parsoid
23974 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23975 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23976 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23977 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23978 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23979 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23980 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23981 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23982 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23983 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23984 !! wikitext
23985 [[Foo|<nowiki>Foobar]</nowiki>]]
23986 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23987 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23988 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23989 [[Foo|<nowiki>|Bar</nowiki>]]
23990 [[Foo|<nowiki>]]bar</nowiki>]]
23991 [[Foo|<nowiki>[[bar</nowiki>]]
23992 [[Foo|<nowiki>x [[ y</nowiki>]]
23993 [[Foo|<nowiki>x ]] y</nowiki>]]
23994 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23995 !! html/php
23996 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23997 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23998 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23999 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
24000 <a href="/wiki/Foo" title="Foo">|Bar</a>
24001 <a href="/wiki/Foo" title="Foo">]]bar</a>
24002 <a href="/wiki/Foo" title="Foo">[[bar</a>
24003 <a href="/wiki/Foo" title="Foo">x [[ y</a>
24004 <a href="/wiki/Foo" title="Foo">x ]] y</a>
24005 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
24006 </p>
24007 !! end
24008
24009 !! test
24010 Links 3. WikiLinks: No escapes needed
24011 !! options
24012 parsoid=html2wt
24013 !! html/parsoid
24014 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
24015 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
24016 !! wikitext
24017 [[Foo|[Foobar]]
24018 [[Foo|foo|bar]]
24019 !! html/php
24020 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
24021 <a href="/wiki/Foo" title="Foo">foo|bar</a>
24022 </p>
24023 !! end
24024
24025 !! test
24026 Links 4. ExtLinks: Escapes needed
24027 !! options
24028 parsoid=html2wt
24029 !! html/parsoid
24030 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
24031 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
24032 <p>[http://google.com]</p>
24033 <p>[http://google.com google]</p>
24034 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
24035 <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>
24036 !! wikitext
24037 [http://google.com <nowiki>[google]</nowiki>]
24038 [http://google.com <nowiki>google]</nowiki>]
24039
24040 <nowiki>[http://google.com]</nowiki>
24041
24042 <nowiki>[http://google.com google]</nowiki>
24043
24044 [http://google.com<nowiki>]</nowiki>
24045
24046 [{{echo|http://google.com}}<nowiki>]</nowiki>
24047 !! html/php
24048 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
24049 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
24050 </p><p>[http://google.com]
24051 </p><p>[http://google.com google]
24052 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24053 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24054 </p>
24055 !! end
24056
24057 !! test
24058 Links 5. ExtLinks: No escapes needed
24059 !! options
24060 parsoid=html2wt
24061 !! html/parsoid
24062 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
24063 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
24064 !! wikitext
24065 [http://google.com [google]
24066
24067 [[http://google.com]]
24068 !! html/php
24069 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
24070 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
24071 </p>
24072 !! end
24073
24074 !! test
24075 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
24076 !! options
24077 parsoid=html2wt
24078 !! html/parsoid
24079 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
24080 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
24081 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
24082 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
24083 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
24084 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
24085 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24086 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
24087 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24088 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
24089 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
24090 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
24091 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
24092 </p>
24093 !! wikitext
24094 x<nowiki/>http://example.com<nowiki/>y
24095 http://example.com<nowiki/>?x
24096 http://example.com<nowiki/>&x
24097 http://example.com<nowiki/>'x
24098 http://example.com<nowiki/>,x
24099 http://example.com<nowiki/>.x
24100 http://example.com<nowiki/>;x
24101 http://example.com<nowiki/>:x
24102 http://example.com<nowiki/>;x
24103 http://example.com<nowiki/>!x
24104 http://example.com<nowiki/>=x
24105 http://example.com<nowiki/>(x)
24106 http://example.com(x<nowiki/>)
24107 !! end
24108
24109 !! test
24110 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24111 !! options
24112 parsoid=html2wt
24113 !! html/parsoid
24114 <p>x
24115 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
24116 y
24117 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
24118 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
24119 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
24120 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
24121 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
24122 </p>
24123 !! wikitext
24124 x
24125 http://example.com
24126 y
24127 "http://example.com"
24128 (http://example.com)
24129 (http://example.com) foo
24130 http://example.com,
24131 http://example.com, foo
24132 !! html/php
24133 <p>x
24134 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
24135 y
24136 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
24137 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
24138 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
24139 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
24140 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
24141 </p>
24142 !! end
24143
24144 !! test
24145 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24146 !! options
24147 parsoid=html2wt
24148 !! html/parsoid
24149 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
24150 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
24151 !! wikitext
24152 http://example.com.,;:!?\
24153 -http://example.com:
24154 !! html/php
24155 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
24156 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
24157 </p>
24158 !! end
24159
24160 !! test
24161 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
24162 !! options
24163 parsoid=html2wt
24164 !! html/parsoid
24165 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
24166 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
24167 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
24168 !! wikitext
24169 RFC 123<nowiki/>4
24170 RFC 123<nowiki/>y
24171 X<nowiki/>RFC 123<nowiki/>y
24172 !! end
24173
24174 !! test
24175 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
24176 !! options
24177 parsoid=html2wt
24178 !! html/parsoid
24179 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24180 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24181 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24182 </p>
24183 !! wikitext
24184 RFC 123?foo
24185 RFC 123&foo
24186 -RFC 123-
24187 !! html/php
24188 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24189 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24190 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24191 </p>
24192 !! end
24193
24194 !! test
24195 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
24196 !! options
24197 parsoid=html2wt
24198 !! html/parsoid
24199 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24200 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24201 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24202 !! wikitext
24203 PMID 123<nowiki/>4
24204 PMID 123<nowiki/>y
24205 X<nowiki/>PMID 123<nowiki/>y
24206 !! end
24207
24208 !! test
24209 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
24210 !! options
24211 parsoid=html2wt
24212 !! html/parsoid
24213 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24214 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24215 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24216 </p>
24217 !! wikitext
24218 PMID 123?foo
24219 PMID 123&foo
24220 -PMID 123-
24221 !! html/php
24222 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24223 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24224 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24225 </p>
24226 !! end
24227
24228 !! test
24229 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
24230 !! options
24231 parsoid=html2wt
24232 !! html/parsoid
24233 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24234 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24235 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24236 </p>
24237 !! wikitext
24238 ISBN 1234567890<nowiki/>1
24239 ISBN 1234567890<nowiki/>x
24240 a<nowiki/>ISBN 1234567890<nowiki/>b
24241 !! end
24242
24243 !! test
24244 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
24245 !! options
24246 parsoid=html2wt
24247 !! html/parsoid
24248 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24249 !! wikitext
24250 -ISBN 1234567890's
24251 !! html/php
24252 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24253 </p>
24254 !! end
24255
24256 !! test
24257 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24258 !! options
24259 parsoid=html2wt
24260 !! html/*
24261 <p>this is not a link: http://example.com
24262 </p>
24263 !! wikitext
24264 this is not a link: <nowiki>http://example.com</nowiki>
24265 !! end
24266
24267 !! test
24268 Links 15. Link trails can't become link prefixes.
24269 !! options
24270 language=is
24271 parsoid=html2wt
24272 !! html/parsoid
24273 <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>
24274 !! wikitext
24275 [[Söfnuður]]-[[00]]
24276 !! html/php
24277 <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>
24278 </p>
24279 !! end
24280
24281 #### --------------- Quotes ---------------
24282 #### 1. Quotes inside <b> and <i>
24283 #### 2. Link fragments separated by <i> and <b> tags
24284 #### 3. Link fragments inside <i> and <b>
24285 #### 4. No escaping needed
24286 #### --------------------------------------
24287 !! test
24288 1a. Quotes inside <b> and <i>
24289 !! options
24290 parsoid=html2wt
24291 !! html/*
24292 <p><i>'foo'</i>
24293 <i>''foo''</i>
24294 <i>'''foo'''</i>
24295 <i>foo</i>'s
24296 <b>'foo'</b>
24297 <b>''foo''</b>
24298 <b>'''foo'''</b>
24299 <b>foo'<i>bar'</i>baz</b>
24300 <b>foo</b>'s
24301 '<i>foo</i>
24302 <i>foo</i>'
24303 <i>foo'</i>'
24304 '<i>foo</i>'
24305 '<b>foo</b>
24306 <b>foo</b>'
24307 '<b>foo</b>'
24308 <i>fools'<span> errand</span></i>
24309 <i><span>fool</span>'s errand</i>
24310 '<i>foo</i> bar '<i>baz</i>
24311 a|!*#-:;+-~[]{}b'<i>x</i>
24312 </p>
24313 !! wikitext
24314 ''<nowiki/>'foo'''
24315 ''<nowiki>''foo''</nowiki>''
24316 ''<nowiki>'''foo'''</nowiki>''
24317 ''foo''<nowiki/>'s
24318 '''<nowiki/>'foo''''
24319 '''<nowiki>''foo''</nowiki>'''
24320 '''<nowiki>'''foo'''</nowiki>'''
24321 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24322 '''foo'''<nowiki/>'s
24323 '''foo''
24324 ''foo''<nowiki/>'
24325 ''foo'''<nowiki/>'
24326 '''foo''<nowiki/>'
24327 ''''foo'''
24328 '''foo'''<nowiki/>'
24329 ''''foo'''<nowiki/>'
24330 ''fools'<span> errand</span>''
24331 ''<span>fool</span>'s errand''
24332 '<nowiki/>''foo'' bar '''baz''
24333 a|!*#-:;+-~[]{}b'''x''
24334 !! end
24335
24336 !! test
24337 1b. Quotes inside <b> and <i> with other tags on same line
24338 !! options
24339 parsoid=html2wt
24340 !! html/parsoid
24341 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24342 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24343 <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>
24344 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24345 '<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>
24346 '<i>foo</i> <div title="name">test</div>
24347 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24348 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24349 <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>
24350 </ol>
24351 !! wikitext
24352 '''a'' foo ''[[bar]]''
24353 ''a''' foo ''[[bar]]''
24354 ''a''' foo '''{{echo|[[bar]]}}'''
24355 [[foo]] x'''[[bar]]''
24356 '''foo'' <ref>test</ref>
24357 '''foo'' <div title="name">test</div>
24358 '''foo'' and <br> bar
24359 <references />
24360 !! end
24361
24362 !! test
24363 2. Link fragments separated by <i> and <b> tags
24364 !! options
24365 parsoid=html2wt
24366 !! html/parsoid
24367 <p>[[<i>foo</i>hello]]</p>
24368 <p>[[<b>foo</b>hello]]</p>
24369 !! wikitext
24370 [[''foo''<nowiki>hello]]</nowiki>
24371
24372 [['''foo'''<nowiki>hello]]</nowiki>
24373 !! end
24374
24375 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24376 # this is one of the shortcomings of this format
24377 !! test
24378 3. Link fragments inside <i> and <b>
24379 !! options
24380 parsoid=html2wt
24381 !! html/parsoid
24382 <p><i>[[foo</i>]]</p>
24383 <p><b>[[foo</b>]]</p>
24384 !! wikitext
24385 ''[[foo''<nowiki>]]</nowiki>
24386
24387 '''[[foo'''<nowiki>]]</nowiki>
24388 !! end
24389
24390 !! test
24391 4. No escaping needed
24392 !! options
24393 options=html2wt
24394 !! html/parsoid
24395 <p>'<span><i>bar</i></span>'
24396 '<span><b>bar</b></span>'
24397 'a:b'foo
24398 </p>
24399 !! wikitext
24400 '<span>''bar''</span>'
24401 '<span>'''bar'''</span>'
24402 'a:b'foo
24403 !! end
24404
24405 #### ----------- Paragraphs ---------------
24406 #### 1. No unnecessary escapes
24407 #### --------------------------------------
24408
24409 !! test
24410 1. No unnecessary escapes
24411 !! options
24412 parsoid=html2wt
24413 !! html/parsoid
24414 <p>bar <span>[[foo]]</span>
24415 </p><p>=bar <span>[[foo]]</span>
24416 </p><p>[[bar <span>[[foo]]</span>
24417 </p><p>]]bar <span>[[foo]]</span>
24418 </p><p>=bar <span>foo]]</span>=
24419 </p>
24420 !! wikitext
24421 bar <span><nowiki>[[foo]]</nowiki></span>
24422
24423 =bar <span><nowiki>[[foo]]</nowiki></span>
24424
24425 [[bar <span><nowiki>[[foo]]</nowiki></span>
24426
24427 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24428
24429 =bar <span>foo]]</span><nowiki>=</nowiki>
24430 !!end
24431
24432 #### ----------------------- PRE --------------------------
24433 #### 1. Leading whitespace in SOL context should be escaped
24434 #### ------------------------------------------------------
24435 !! test
24436 1. Leading whitespace in SOL context should be escaped
24437 !! options
24438 parsoid=html2wt
24439 !! html/parsoid
24440 <p> a</p>
24441
24442 <p> a</p>
24443
24444 <p> a(tab)</p>
24445
24446 <p> a
24447 <!--cmt-->
24448 a</p>
24449
24450 <p>a
24451 b</p>
24452
24453 <p>a
24454 b</p>
24455
24456 <p>a
24457 b</p>
24458 !! wikitext
24459 <nowiki> </nowiki>a
24460
24461 <nowiki> </nowiki> a
24462
24463 a(tab)
24464
24465 <nowiki> </nowiki> a
24466 <!--cmt-->
24467 <nowiki> </nowiki>a
24468
24469 a
24470 <nowiki> </nowiki>b
24471
24472 a
24473 b
24474
24475 a
24476 b
24477 !! html/php
24478 <p> a
24479 </p><p> a
24480 </p><p> a(tab)
24481 </p><p> a
24482 a
24483 </p><p>a
24484 b
24485 </p><p>a
24486 b
24487 </p><p>a
24488 b
24489 </p>
24490 !! end
24491
24492 !! test
24493 2. Leading whitespace in non-indent-pre contexts should not be escaped
24494 !! options
24495 parsoid=html2wt
24496 !! html/parsoid
24497 <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>
24498 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24499 <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>
24500 b</span></li>
24501 </ol>
24502 !! wikitext
24503 foo <ref>''a''
24504 b</ref>
24505 <references />
24506 !! end
24507
24508 !! test
24509 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24510 !! options
24511 parsoid=html2wt
24512 !! html/parsoid
24513 <blockquote>
24514 <p>
24515 a
24516 <span>b</span>
24517 c</p>
24518 </blockquote>
24519 !! wikitext
24520 <blockquote>
24521 a
24522 <span>b</span>
24523 c
24524 </blockquote>
24525 !! end
24526
24527 !! test
24528 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24529 !! options
24530 options=html2wt
24531 !! html/parsoid
24532 <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>
24533 !! wikitext
24534 [[File:Foobar.jpg|thumb|caption]]
24535 !! end
24536
24537 !! test
24538 5. Nowiki escaping should account for indent-pres
24539 !! options
24540 parsoid=html2wt
24541 !! html/parsoid
24542 <pre>==foo==</pre>
24543 !! wikitext
24544 ==foo==
24545 !! end
24546
24547 !!test
24548 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24549 !! options
24550 parsoid=html2wt
24551 !! html/parsoid
24552 <pre>
24553 * foo
24554 * bar
24555 </pre>
24556 !! wikitext
24557 * foo
24558 * bar
24559 !! end
24560
24561 #### --------------- Behavior Switches --------------------
24562
24563 !! test
24564 1. Valid behavior switches should be escaped
24565 !! options
24566 parsoid=html2wt
24567 !! html/parsoid
24568 __TOC__
24569 <i>__TOC__</i>
24570 !! wikitext
24571 <nowiki>__TOC__</nowiki>
24572 ''<nowiki>__TOC__</nowiki>''
24573 !! end
24574
24575 !! test
24576 2. Invalid behavior switches should not be escaped
24577 !! options
24578 parsoid=html2wt
24579 !! html/parsoid
24580 __TOO__
24581 __|__
24582 !! wikitext
24583 __TOO__
24584 __|__
24585 !! end
24586
24587 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24588 !! test
24589 Behavior switches should be SOL-transparent
24590 !! options
24591 parsoid=html2wt
24592 !! html/parsoid
24593 <meta property="mw:PageProp/toc" />
24594
24595 <!-- this one's bogus -->
24596 <pre>__TOO__</pre>
24597
24598 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24599
24600 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24601 !! wikitext
24602 __TOC__
24603
24604 <!-- this one's bogus -->
24605 __TOO__
24606
24607 __TOC__ foo
24608
24609 __TOC__
24610 bar
24611 !! end
24612
24613 #### --------------- HTML tags ---------------
24614 #### 1. a tags
24615 #### 2. other tags
24616 #### 3. multi-line html tag
24617 #### 4. extension tags
24618 #### -----------------------------------------
24619 !! test
24620 1. a tags
24621 !! options
24622 parsoid=html2wt
24623 !! html/parsoid
24624 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24625 !! wikitext
24626 <a href="http://google.com">google</a>
24627 !! end
24628
24629 !! test
24630 2. other tags
24631 !! options
24632 parsoid=html2wt
24633 !! html/parsoid
24634 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24635 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24636 <li> &lt;td&gt;</li></ul>
24637
24638 !! wikitext
24639 * <nowiki><div>foo</div></nowiki>
24640 * <nowiki><div style="color:red">foo</div></nowiki>
24641 * <nowiki><td></nowiki>
24642 !! end
24643
24644 !! test
24645 3. multi-line html tag
24646 !! options
24647 parsoid=html2wt
24648 !! html/parsoid
24649 <p>&lt;div
24650 &gt;foo&lt;/div
24651 &gt;
24652 </p>
24653 !! wikitext
24654 <nowiki><div
24655 >foo</div
24656 ></nowiki>
24657 !! end
24658
24659 !! test
24660 4. extension tags
24661 !! options
24662 parsoid=html2wt
24663 !! html/parsoid
24664 <p>&lt;ref&gt;foo&lt;/ref&gt;
24665 </p><p>&lt;ref&gt;bar
24666 </p><p>baz&lt;/ref&gt;
24667 </p>
24668 !! wikitext
24669 <nowiki><ref>foo</ref></nowiki>
24670
24671 <nowiki><ref>bar</nowiki>
24672
24673 baz<nowiki></ref></nowiki>
24674 !! end
24675
24676 #### --------------- Others ---------------
24677 !! test
24678 Escaping nowikis
24679 !! options
24680 parsoid=html2wt
24681 !! html/parsoid
24682 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24683 </p>
24684 !! wikitext
24685 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24686 !! end
24687
24688 ## The quote-char in the input is necessary for triggering the bug
24689 !! test
24690 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24691 !! options
24692 parsoid=html2wt
24693 !! html/parsoid
24694 <p>foo's bar :</p>
24695 !! wikitext
24696 foo's bar :
24697 !! end
24698
24699 #----------- End of wikitext escaping tests --------------
24700
24701 !! test
24702
24703 Tag-like HTML structures are passed through as text
24704 !! wikitext
24705 <x y>
24706
24707 <x.y>
24708
24709 <x-y>
24710
24711 1>2
24712
24713 x<y
24714
24715 a>b
24716
24717 1<d e>f
24718 !! html
24719 <p>&lt;x y&gt;
24720 </p><p>&lt;x.y&gt;
24721 </p><p>&lt;x-y&gt;
24722 </p><p>1&gt;2
24723 </p><p>x&lt;y
24724 </p><p>a&gt;b
24725 </p><p>1&lt;d e&gt;f
24726 </p>
24727 !! end
24728
24729 !! test
24730 HTML tag with necessary entities in attributes
24731 !! wikitext
24732 <span title="&amp;amp;">foo</span>
24733 !! html
24734 <p><span title="&amp;amp;">foo</span>
24735 </p>
24736 !! end
24737
24738 !! test
24739 HTML tag with 'unnecessary' entity encoding in attributes
24740 !! wikitext
24741 <span title="&amp;">foo</span>
24742 !! html
24743 <p><span title="&amp;">foo</span>
24744 </p>
24745 !! end
24746
24747 !! test
24748 HTML tag with broken attribute value quoting
24749 !! options
24750 parsoid=wt2html,html2html
24751 !! wikitext
24752 <span title="Hello world>Foo</span>
24753 !! html/php
24754 <p><span title="Hello world">Foo</span>
24755 </p>
24756 !! html/parsoid
24757 <p><span title="Hello world">Foo</span></p>
24758 !! end
24759
24760 !! test
24761 Self-closed tag with broken attribute value quoting
24762 !! options
24763 parsoid=wt2html,html2html
24764 !! wikitext
24765 <div title="Hello world />Foo
24766 !! html/php+tidy
24767 <div title="Hello world"></div>
24768 <p>Foo</p>
24769 !! html/parsoid
24770 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24771 !! end
24772
24773 !! test
24774 Table with broken attribute value quoting
24775 !! options
24776 parsoid=wt2html,html2html
24777 !! wikitext
24778 {|
24779 | title="Hello world|Foo
24780 |}
24781 !! html/php
24782 <table>
24783 <tr>
24784 <td title="Hello world">Foo
24785 </td></tr></table>
24786
24787 !! html/parsoid
24788 <table>
24789 <tr>
24790 <td title="Hello world">Foo
24791 </td></tr></table>
24792
24793 !! end
24794
24795 !! test
24796 Table with broken attribute value quoting on consecutive lines
24797 !! options
24798 parsoid=wt2html,html2html
24799 !! wikitext
24800 {|
24801 | title="Hello world|Foo
24802 | style="color:red|Bar
24803 |}
24804 !! html/php
24805 <table>
24806 <tr>
24807 <td title="Hello world">Foo
24808 </td>
24809 <td style="color:red">Bar
24810 </td></tr></table>
24811
24812 !! html/parsoid
24813 <table><tbody>
24814 <tr>
24815 <td title="Hello world">Foo
24816 </td><td style="color: red">Bar
24817 </td></tr></tbody></table>
24818
24819 !! end
24820
24821 !!test
24822 Accept empty td cell attribute
24823 !! wikitext
24824 {|
24825 | align="center" | foo || |
24826 |}
24827 !! html
24828 <table>
24829 <tr>
24830 <td align="center"> foo </td>
24831 <td>
24832 </td></tr></table>
24833
24834 !!end
24835
24836 !!test
24837 Non-empty attributes in th-cells
24838 !! wikitext
24839 {|
24840 ! Foo !! style="color: red" | Bar
24841 |}
24842 !! html
24843 <table>
24844 <tr>
24845 <th> Foo </th>
24846 <th style="color: red"> Bar
24847 </th></tr></table>
24848
24849 !!end
24850
24851 !!test
24852 Accept empty attributes in th-cells
24853 !! wikitext
24854 {|
24855 !| foo !!| bar
24856 |}
24857 !! html
24858 <table>
24859 <tr>
24860 <th> foo </th>
24861 <th> bar
24862 </th></tr></table>
24863
24864 !!end
24865
24866 !!test
24867 Empty table rows go away
24868 !! wikitext
24869 {|
24870 | Hello
24871 | there
24872 |- class="foo"
24873 |-
24874 |}
24875 !! html
24876 <table>
24877 <tr>
24878 <td> Hello
24879 </td>
24880 <td> there
24881 </td></tr>
24882
24883 </table>
24884
24885 !! end
24886
24887 ###
24888 ### Parsoid-centric tests for testing RTing of inter-element separators
24889 ### Edge cases not tested by existing parser tests and specific to
24890 ### Parsoid-specific serialization strategies.
24891 ###
24892
24893 !!test
24894 RT-ed inter-element separators should be valid separators
24895 !! wikitext
24896 {|
24897 |- [[foo]]
24898 |}
24899 !! html/php
24900 <table>
24901
24902 </table>
24903
24904 !! html/parsoid
24905 <table>
24906 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24907 </tbody></table>
24908 !!end
24909
24910 # Parsoid-only since PHP parser relies on Tidy for correct output
24911 !!test
24912 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24913 !!options
24914 parsoid
24915 !! wikitext
24916 {|
24917 |<small>foo
24918 bar
24919 |}
24920
24921 {|
24922 |<small>foo<small>
24923 |}
24924 !! html
24925 <table>
24926 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24927 <p>bar</p></small></td></tr>
24928 </tbody></table>
24929
24930 <table>
24931 <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>
24932 </tbody></table>
24933 !!end
24934
24935 # Note that the "style" attribute is really a template parameter here.
24936 # The = would have to be {{=}} if you wanted the literal.
24937 !!test
24938 Empty TD followed by TD with tpl-generated attribute
24939 !! wikitext
24940 {|
24941 |-
24942 |
24943 |{{echo|style='color:red'}}|foo
24944 |}
24945 !! html
24946 <table>
24947
24948 <tr>
24949 <td>
24950 </td>
24951 <td>foo
24952 </td></tr></table>
24953
24954 !!end
24955
24956 !!test
24957 Indented table with an empty td
24958 !! wikitext
24959 {|
24960 |-
24961 |
24962 |foo
24963 |}
24964 !! html
24965 <table>
24966
24967 <tr>
24968 <td>
24969 </td>
24970 <td>foo
24971 </td></tr></table>
24972
24973 !!end
24974
24975 ## We have some newline diffs RT-ing this edge case
24976 ## and it is not important enough -- we seem to be emitting
24977 ## at most 2 newlines after a </tr> and this is unrelated to
24978 ## the issue from T85627 that this is testing.
24979 !!test
24980 Indented table with blank lines in between (T85627)
24981 !! options
24982 parsoid=wt2html
24983 !! wikitext
24984 {|
24985 |foo
24986
24987
24988 |}
24989 !! html
24990 <table>
24991
24992 <tr>
24993 <td>foo
24994 </td></tr></table>
24995
24996 !!end
24997
24998 !!test
24999 Indented block & table
25000 !! wikitext
25001 <div>foo</div>
25002 {|
25003 |foo
25004 |}
25005 !! html/php
25006 <div>foo</div>
25007 <table>
25008 <tr>
25009 <td>foo
25010 </td></tr></table>
25011
25012 !! html/parsoid
25013 <div data-parsoid='{"stx":"html"}'>foo</div>
25014 <table><tbody>
25015 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
25016 </tbody></table>
25017 !!end
25018
25019 !! test
25020 Indent and comment before table row
25021 !! wikitext
25022 {|
25023 <!--hi-->|-
25024 | there
25025 |}
25026 !! html/php
25027 <table>
25028
25029 <tr>
25030 <td> there
25031 </td></tr></table>
25032
25033 !! html/parsoid
25034 <table>
25035 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
25036 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
25037 </tbody></table>
25038 !! end
25039
25040 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
25041 !!test
25042 Empty TR followed by a template-generated TR
25043 !!options
25044 parsoid
25045 !! wikitext
25046 {|
25047 |-
25048 {{echo|<tr><td>foo</td></tr>}}
25049 |}
25050 !! html
25051 <table>
25052 <tbody>
25053 <tr></tr>
25054 <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}}]}'>
25055 <td>foo</td></tr>
25056 </tbody></table>
25057 !!end
25058
25059 ## PHP and parsoid output differ for this, and since this is primarily
25060 ## for testing Parsoid's serializer, marking this Parsoid only
25061 !!test
25062 Empty TR followed by mixed-ws-comment line should RT correctly
25063 !!options
25064 parsoid
25065 !! wikitext
25066 {|
25067 |-
25068 <!--c-->
25069 |-
25070 <!--c--> <!--d-->
25071 |}
25072 !! html
25073 <table>
25074 <tbody>
25075 <tr></tr>
25076 <!--c-->
25077 <tr>
25078 <!--c--> </tr><!--d-->
25079 </tbody></table>
25080
25081 !!end
25082
25083 !!test
25084 Multi-line image caption generated by templates with/without trailing newlines
25085 !! wikitext
25086 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
25087 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
25088 !! html/parsoid
25089 <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>
25090 <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>
25091 !!end
25092
25093 !! test
25094 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
25095 !! options
25096 parsoid=html2wt
25097 !! html/parsoid
25098 <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>
25099
25100 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
25101 !! wikitext
25102 <includeonly>foo</includeonly>
25103 new para
25104
25105 [[Category:Foo]]
25106
25107 = new heading =
25108 !! end
25109
25110 ## PHP emits broken html for this, and since this is primarily
25111 ## a Parsoid serializer test, marking this Parsoid only
25112 !!test
25113 Improperly nested inline or quotes tags with whitespace in between
25114 !! wikitext
25115 <span> <s>x</span> </s>
25116 ''' ''x''' ''
25117 !! html/parsoid
25118 <p><span> <s>x</s></span><s> </s>
25119 <b> <i>x</i></b><i> </i>
25120 </p>
25121 !!end
25122
25123 !!test
25124 Encapsulate protected attributes from wt
25125 !! wikitext
25126 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
25127
25128 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
25129 | ok
25130 |}
25131 !! html/parsoid
25132 <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>
25133
25134 <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">
25135 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
25136 </tbody></table>
25137 !!end
25138
25139 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
25140 ## Having nested or stray pre tags results in the attempt to add duplicates,
25141 ## causing an assertion fail. This test tries to prevent that situation.
25142 !!test
25143 Ensure ParagraphWrapper can deal with stray closing pre tags
25144 !!options
25145 parsoid=wt2html
25146 !! wikitext
25147 plain text</pre>
25148 !! html/parsoid
25149 plain text
25150 !!end
25151
25152 !!test
25153 1. Ensure fostered text content is wrapped in element nodes
25154 !!options
25155 parsoid=wt2html
25156 !! wikitext
25157 <table>hi</table><table>ho</table>
25158 !! html/parsoid
25159 <p>hi</p>
25160 <table></table>
25161 <p>ho</p>
25162 <table></table>
25163 !!end
25164
25165 !!test
25166 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
25167 !!options
25168 parsoid=wt2html,wt2wt
25169 !! wikitext
25170 <table>
25171 <tr> || ||
25172 <td> a
25173 </table>
25174 !! html/parsoid
25175 <p> || ||
25176 </p><table>
25177 <tbody><tr><td> a</td></tr>
25178 </tbody></table>
25179 !!end
25180
25181 !!test
25182 Encapsulation properly handles null DSR information from foster box
25183 !!options
25184 parsoid=wt2html,wt2wt
25185 !! wikitext
25186 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25187 !! html/parsoid
25188 <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>
25189 !!end
25190
25191 !!test
25192 1. Encapsulate foster-parented transclusion content
25193 !!options
25194 parsoid=wt2wt,wt2html
25195 !! wikitext
25196 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25197 !! html/parsoid
25198 <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>
25199 <tbody>
25200 <tr>
25201 <td>bar</td>
25202 </tr>
25203 </tbody>
25204 </table>
25205 !!end
25206
25207 !!test
25208 2. Encapsulate foster-parented transclusion content
25209 !!options
25210 parsoid=wt2wt,wt2html
25211 !! wikitext
25212 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25213 !! html/parsoid
25214 <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>
25215 <table>
25216 <tbody>
25217 <tr>
25218 <td>bar</td>
25219 </tr>
25220 </tbody>
25221 </table>
25222 !!end
25223
25224 !!test
25225 3. Encapsulate foster-parented transclusion content
25226 !!options
25227 parsoid=wt2wt,wt2html
25228 !! wikitext
25229 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25230 !! html/parsoid
25231 <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;]}">
25232 <p>foo</p>
25233 </div>
25234 <table>
25235 <tbody>
25236 <tr>
25237 <td>bar</td>
25238 </tr>
25239 </tbody>
25240 </table>
25241 !!end
25242
25243 !!test
25244 4. Encapsulate foster-parented transclusion content
25245 !!options
25246 parsoid=wt2wt,wt2html
25247 !! wikitext
25248 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25249 !! html/parsoid
25250 <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;]}">
25251 <p>foo</p>
25252 </div>
25253 <table>
25254 <tbody>
25255 <tr>
25256 <td>bar</td>
25257 </tr>
25258 </tbody>
25259 </table>
25260 !!end
25261
25262 !!test
25263 5. Encapsulate foster-parented transclusion content
25264 !!options
25265 parsoid=wt2wt,wt2html
25266 !! wikitext
25267 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25268 !! html/parsoid
25269 <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>
25270 <table>
25271 <tbody>
25272 <tr>
25273 <td>
25274 <div>
25275 <p>foo</p>
25276 </div>
25277 </td>
25278 </tr>
25279 </tbody>
25280 </table>
25281 !!end
25282
25283 !!test
25284 6. Encapsulate foster-parented transclusion content
25285 !!options
25286 parsoid=wt2wt,wt2html
25287 !! wikitext
25288 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25289 !! html/parsoid
25290 <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>
25291 <table>
25292 <tbody>
25293 <tr>
25294 <td>
25295 <div>
25296 <p>foo</p>
25297 </div>
25298 </td>
25299 </tr>
25300 </tbody>
25301 </table>
25302 <p>ok</p>
25303 !!end
25304
25305 !!test
25306 7. Encapsulate foster-parented transclusion content
25307 !!options
25308 parsoid=wt2wt,wt2html
25309 !! wikitext
25310 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25311 !! html/parsoid
25312 <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>
25313 <table>
25314 <tbody>
25315 <tr>
25316 <td>bar</td>
25317 </tr>
25318 </tbody>
25319 </table>
25320 !!end
25321
25322 # Note that the wt is broken on purpose: the = should be {{=}} if you
25323 # don't want it to be a template parameter key.
25324 !!test
25325 8. Encapsulate foster-parented transclusion content
25326 !!options
25327 parsoid=wt2wt,wt2html
25328 !! wikitext
25329 {{echo|a
25330 }}{|{{echo|style='color:red'}}
25331 |-
25332 |b
25333 |}
25334 !! html/parsoid
25335 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25336 <span> </span>
25337 <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>
25338 <table>
25339 <tbody>
25340 <tr>
25341 <td>b</td>
25342 </tr>
25343 </tbody>
25344 </table>
25345 !!end
25346
25347 !!test
25348 9. Encapsulate foster-parented transclusion content
25349 !!options
25350 parsoid=wt2wt,wt2html
25351 !! wikitext
25352 <table>{{echo|hi</table>hello}}
25353 !! html/parsoid
25354 <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>
25355 !!end
25356
25357 !!test
25358 Table in fosterable position
25359 !!options
25360 parsoid=wt2html
25361 !! wikitext
25362 {{OpenTable}}
25363 <div>
25364 {|
25365 |}
25366 </div>
25367 |}
25368 !! html/parsoid
25369 <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">
25370 </span>
25371 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25372
25373 <table>
25374 </table>
25375 !!end
25376
25377 # Parsoid only for bug 64747
25378 !! test
25379 Properly encapsulate empty-content transclusions in fosterable positions
25380 !! wikitext
25381 <table>
25382 {{#if:|
25383 <td>foo</td>
25384 }}
25385 </table>
25386 !! html/parsoid
25387 <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"}]]}'>
25388
25389 </table>
25390 !! end
25391
25392 !! test
25393 Always encapsulate foster box when template range is expanded to table
25394 !! options
25395 parsoid=wt2wt
25396 !! wikitext
25397 {|
25398 hello
25399 {{OpenTable}}
25400 |}
25401 !! html/parsoid
25402
25403 !! end
25404
25405 !! test
25406 T115289: Unclosed table
25407 !! wikitext
25408 {{echo|<table>}}<!--c-->[[Category:Two]]
25409 !! html/parsoid
25410 <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>
25411 !! end
25412
25413 !! test
25414 T115289: Don't migrate newlines out of tables with fostered content
25415 !! wikitext
25416 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25417 !! html/parsoid
25418 <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>
25419 !! end
25420
25421 !! test
25422 T73074: More fostering fun
25423 !! wikitext
25424 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25425 !! html/parsoid
25426 <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>
25427 !! end
25428
25429 !!test
25430 Support <object> element with .data attribute
25431 !!options
25432 parsoid=html2wt
25433 !! html/parsoid
25434 <object data="test.swf"></object>
25435 !! wikitext
25436 <object data="test.swf"></object>
25437 !!end
25438
25439 !! test
25440 Don't block XML namespace declaration
25441 !! wikitext
25442 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25443 !! html/php
25444 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25445 </p>
25446 !! html/parsoid
25447 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25448 !! end
25449
25450 # -----------------------------------------------------------------
25451 # The following section of tests are primarily to spec requirements
25452 # around Parsoid's serialization (old, new, edited content)
25453 #
25454 # All these tests are marked Parsoid html2wt and html2html only
25455 # ----------------------------------------------------------------
25456
25457 !! test
25458 Ignore rel attribute in a-tags during serialization to url-links
25459 !! options
25460 parsoid=html2wt
25461 !! html/parsoid
25462 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25463 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25464 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25465 !! wikitext
25466 http://en.wikipedia.org/wiki/Foobar
25467 http://en.wikipedia.org/wiki/Foobar
25468 http://en.wikipedia.org/wiki/Foobar
25469 !! end
25470
25471 # 'mi' is a localinterwiki prefix as well as a language
25472 !! test
25473 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
25474 !! options
25475 parsoid=html2wt
25476 !! html/parsoid
25477 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25478 !! wikitext
25479 [[Foo]]
25480 !! end
25481
25482 # See T93839
25483 !! test
25484 New wikilinks should be serialized properly
25485 !! options
25486 parsoid=html2wt
25487 !! html/parsoid
25488 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25489 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25490 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25491 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25492 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25493 !! wikitext
25494 [[Foo]]
25495 [[Foo]]
25496 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25497 http://en.wikipedia.org/wiki/Foo
25498 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25499 !! end
25500
25501 !! test
25502 New wiki links (href variations)
25503 !! options
25504 parsoid=html2wt
25505 !! html/parsoid
25506 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25507 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25508 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25509 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25510 !! wikitext
25511 [[Foo_bar]]
25512 [[Foo_bar]]
25513 [[Foo_bar]]
25514 [[Toxine bactérienne]]
25515 !! end
25516
25517 !! test
25518 New wiki links (content string variations)
25519 !! options
25520 parsoid=html2wt
25521 !! html/parsoid
25522 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25523 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25524 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25525 !! wikitext
25526 [[Foo_bar]]
25527 [[Foo bar]]
25528 [[Foo_bar|./Foo_bar]]
25529 !! end
25530
25531 !! test
25532 New category links (href variations)
25533 !! options
25534 parsoid=html2wt
25535 !! html/parsoid
25536 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25537 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25538 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25539 !! wikitext
25540 [[Category:Toxine bactérienne]]
25541 [[Category:Toxine bactérienne]]
25542 [[Category:Toxine bactérienne]]
25543 !! end
25544
25545 !! test
25546 New sol transparent links don't need indent-pre nowiki protection
25547 !! options
25548 parsoid=html2wt
25549 language=de
25550 !! html/parsoid
25551 <link rel="mw:PageProp/redirect" href="./Main_Page">
25552 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25553 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25554 !! wikitext
25555 #WEITERLEITUNG [[Main Page]]
25556 <!-- this is good --> [[Category:Good]]
25557 <!-- this is great --> [[Kategorie:Great]]
25558 !! end
25559
25560 !! test
25561 New interlanguage links (href variations)
25562 !! options
25563 parsoid=html2wt
25564 !! html/parsoid
25565 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25566 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25567 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25568 !! wikitext
25569 [[es:Toxine bactérienne]]
25570 [[es:Toxine_bactérienne]]
25571 [[es:Toxine_bactérienne]]
25572 !! end
25573
25574 !! test
25575 Image: Modifying size of an image (1)
25576 !! options
25577 parsoid={
25578 "modes": ["wt2wt"],
25579 "changes": [
25580 ["img[height]", "attr", "height", "22"],
25581 ["img[width]", "attr", "width", "200"]
25582 ]
25583 }
25584 !! wikitext
25585 [[Image:Foobar.jpg|230x230px]]
25586 !! wikitext/edited
25587 [[Image:Foobar.jpg|200x200px]]
25588 !!end
25589
25590 !! test
25591 Image: Modifying size of an image (2)
25592 !! options
25593 parsoid={
25594 "modes": ["wt2wt"],
25595 "changes": [
25596 ["img[height]", "attr", "height", "100"],
25597 ["img[width]", "attr", "width", "500"]
25598 ]
25599 }
25600 !! wikitext
25601 [[Image:Foobar.jpg|230x230px]]
25602 !! wikitext/edited
25603 [[Image:Foobar.jpg|500x500px]]
25604 !!end
25605
25606 # Change in size is ignored so long as class='mw-default-size'
25607 !! test
25608 Image: Modifying size of an image (3)
25609 !! options
25610 parsoid={
25611 "modes": ["wt2wt"],
25612 "changes": [
25613 ["figure[class]", "removeClass", "mw-default-size"],
25614 ["figure img", "attr", "height", "19"],
25615 ["figure img", "attr", "width", "170"]
25616 ]
25617 }
25618 !! wikitext
25619 [[Image:Foobar.jpg|thumb]]
25620 !! wikitext/edited
25621 [[Image:Foobar.jpg|thumb|170x170px]]
25622 !!end
25623
25624 !! test
25625 Image: Modifying alignment of an image (bug 48665)
25626 !! options
25627 parsoid={
25628 "modes": ["wt2wt"],
25629 "changes": [
25630 ["figure[class]", "removeClass", "mw-halign-right"],
25631 ["figure[class]", "addClass", "mw-halign-left"]
25632 ]
25633 }
25634 !! wikitext
25635 [[Image:Foobar.jpg|thumb|caption|right]]
25636 !! wikitext/edited
25637 [[Image:Foobar.jpg|thumb|caption|left]]
25638 !! end
25639
25640 !! test
25641 Image: Modifying mw-default-size of an frameless image (bug 62805)
25642 !! options
25643 parsoid={
25644 "modes": ["wt2wt"],
25645 "changes": [
25646 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25647 ]
25648 }
25649 !! wikitext
25650 [[Image:Foobar.jpg|frameless|right]]
25651 !! wikitext/edited
25652 [[Image:Foobar.jpg|frameless|right|220x220px]]
25653 !! end
25654
25655 !! test
25656 Image: Modifying valign of an image (bug 49221)
25657 !! options
25658 parsoid={
25659 "modes": ["wt2wt"],
25660 "changes": [
25661 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25662 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25663 ]
25664 }
25665 !! wikitext
25666 [[File:Foobar.jpg|20px|middle]]
25667 !! wikitext/edited
25668 [[File:Foobar.jpg|20px|text-top]]
25669 !! end
25670
25671 !! test
25672 Image: Modifying alt attribute of an image (bug 56400)
25673 !! options
25674 parsoid={
25675 "modes": ["wt2wt"],
25676 "changes": [
25677 ["img[alt]", "attr", "alt", "some alternate edited text"]
25678 ]
25679 }
25680 !! wikitext
25681 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25682 !! wikitext/edited
25683 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25684 !!end
25685
25686 !! test
25687 Image: Modifying caption of an image
25688 !! options
25689 parsoid={
25690 "modes": ["wt2wt"],
25691 "changes": [
25692 ["figcaption", "text", "new caption"]
25693 ]
25694 }
25695 !! wikitext
25696 [[Image:Foobar.jpg|thumb|original caption]]
25697 !! wikitext/edited
25698 [[Image:Foobar.jpg|thumb|new caption]]
25699 !!end
25700
25701 !! test
25702 Image: empty alt attribute (bug 48924)
25703 !! options
25704 parsoid
25705 !! wikitext
25706 [[File:Foobar.jpg|thumb|alt=|bar]]
25707 !! html
25708 <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>
25709 !! end
25710
25711 !! test
25712 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25713 !! options
25714 parsoid=html2wt
25715 language=ar
25716 disabled
25717 !! html/parsoid
25718 <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>
25719 !! wikitext
25720 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25721 !! end
25722
25723 !! test
25724 Image: Block level image should have \n before and after
25725 !! wikitext
25726 123
25727 [[File:Foobar.jpg|right|thumb|150x150px]]
25728 456
25729 !! html/parsoid
25730 <p>123</p>
25731 <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>
25732 <p>456</p>
25733 !!end
25734
25735 !! test
25736 Image: New block level image should have \n before and after (existing content)
25737 !! wikitext
25738 123
25739 [[File:Foobar.jpg|right|thumb|150x150px]]
25740 456
25741 !! html/parsoid
25742 <p>123</p>
25743 <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>
25744 <p>456</p>
25745 !!end
25746
25747 !! test
25748 Image: upright option (parsoid)
25749 !! wikitext
25750 [[File:Foobar.jpg|thumb|upright|caption]]
25751 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25752 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25753 !! html/parsoid
25754 <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>
25755 <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>
25756 <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>
25757 !!end
25758
25759 !! test
25760 Image: upright option is ignored on inline and frame images (parsoid)
25761 !! wikitext
25762 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25763 !! html/parsoid
25764 <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>
25765 !!end
25766
25767 !! test
25768 Image: from basic HTML (1)
25769 !! options
25770 parsoid=html2wt
25771 !! html/parsoid
25772 <span typeof="mw:Image">
25773 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25774 </span>
25775 !! wikitext
25776 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25777 !! end
25778
25779 !! test
25780 Image: from basic HTML (2)
25781 !! options
25782 parsoid=html2wt
25783 !! html/parsoid
25784 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25785 !! wikitext
25786 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25787 !! end
25788
25789 !! test
25790 Image: from basic HTML (3)
25791 !! options
25792 parsoid=html2wt
25793 !! html/parsoid
25794 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25795 !! wikitext
25796 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25797 !! end
25798
25799 !! test
25800 Image: from basic HTML (4)
25801 !! options
25802 parsoid=html2wt
25803 !! html/parsoid
25804 <img src="./File:Foobar.jpg">
25805 !! wikitext
25806 [[File:Foobar.jpg|link=]]
25807 !! end
25808
25809 !! test
25810 Image: Invalid title as link
25811 !! wikitext
25812 [[File:Foobar.jpg|link=<]]
25813 !! html/php
25814 <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>
25815 </p>
25816 !! html/parsoid
25817 <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>
25818 !! end
25819
25820 !! test
25821 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25822 !! options
25823 parsoid=html2wt
25824 !! html/parsoid
25825 <ul>
25826 <li><p>foo</p></li>
25827 </ul>
25828 !! wikitext
25829 * foo
25830 !! end
25831
25832 !! test
25833 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25834 !! options
25835 parsoid=html2wt
25836 !! html/parsoid
25837 <ul> <li>foo</li></ul>
25838 !! wikitext
25839 * foo
25840 !! end
25841
25842 !! test
25843 Don't strip leading whitespace when handling indent-pre suppressing tags
25844 !! options
25845 parsoid=html2wt
25846 !! html/parsoid
25847 <table>
25848 <tr><td> indented row</td></tr>
25849 </table>
25850 <blockquote><p>
25851 <b>This is very bold of you!</b>
25852 </p>
25853 <table><tr><td>
25854 indented cell (no pre-wrapping!)
25855 </td></tr></table>
25856 </blockquote>
25857 <p>foo</p>
25858 <div>bar</div>
25859 !! wikitext
25860 {|
25861 | indented row
25862 |}
25863 <blockquote>
25864 '''This is very bold of you!'''
25865
25866 {|
25867 |
25868 indented cell (no pre-wrapping!)
25869 |}
25870 </blockquote>
25871 foo
25872 <div>bar</div>
25873 !! end
25874
25875 !! test
25876 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25877 !! options
25878 parsoid=html2wt
25879 !! html/parsoid
25880 <p>foo</p>
25881 <span>bar</span>
25882
25883 <span>foo2
25884 </span>bar2
25885
25886 <div>foo</div>
25887 <span>bar</span>
25888
25889 <div>
25890 <span>foo</span>
25891 </div>
25892 !! wikitext
25893 foo
25894
25895 <span>bar</span>
25896
25897 <span>foo2
25898 <nowiki> </nowiki></span>bar2
25899
25900 <div>foo</div>
25901 <nowiki> </nowiki><span>bar</span>
25902
25903 <div>
25904 <nowiki> </nowiki><span>foo</span>
25905 </div>
25906 !! end
25907
25908 !! test
25909 Lists: Dont insert newlines in a serialized list item.
25910 !! options
25911 parsoid=html2wt
25912 !! html/parsoid
25913 <ul><li>a<br>b</li><li>c</li></ul>
25914 !! wikitext
25915 * a<br>b
25916 * c
25917 !! end
25918
25919 !! test
25920 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25921 !! options
25922 parsoid={
25923 "modes": ["html2wt"],
25924 "scrubWikitext": false
25925 }
25926 !! html/parsoid
25927 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25928 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25929
25930 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25931 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25932
25933 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25934
25935 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25936 !! wikitext
25937 == hello there [[Category:A1]] ==
25938
25939 == [[Category:A2]] hi pal ==
25940
25941 == <!--foo--> [[Category:A3]] how goes it ==
25942
25943 == it goes well [[Category:A4]] <!--bar--> ==
25944
25945 ==howdy [[Category:A5]]==
25946
25947 == __TOC__ ok ==
25948 !! end
25949
25950 !! test
25951 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25952 !! options
25953 parsoid={
25954 "modes": ["html2wt"],
25955 "scrubWikitext": true
25956 }
25957 !! html/parsoid
25958 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25959 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25960
25961 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25962 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25963
25964 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25965 !! wikitext
25966 == hello there ==
25967 [[Category:A1]]
25968 [[Category:A2]]
25969
25970 == hi pal ==
25971
25972 <!--foo--> [[Category:A3]]
25973
25974 == how goes it ==
25975
25976 == it goes well ==
25977 [[Category:A4]] <!--bar-->
25978
25979 __TOC__
25980
25981 == ok ==
25982 !! end
25983
25984 !! test
25985 Headings: Don't hoist metas that come from templates
25986 !! options
25987 parsoid={
25988 "modes": ["html2wt"],
25989 "scrubWikitext": true
25990 }
25991 !! html/parsoid
25992 <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>
25993 !! wikitext
25994 == {{echo|foo [[Category:Foo]]}} ==
25995 !! end
25996
25997 !! test
25998 Headings: Category in ref isn't hoisted
25999 !! options
26000 parsoid={
26001 "modes": ["html2wt"],
26002 "scrubWikitext": true
26003 }
26004 !! html/parsoid
26005 <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>
26006
26007 <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>
26008 !! wikitext
26009 == foo <ref>bar
26010 [[Category:Baz]] </ref> ==
26011
26012 <references />
26013 !! end
26014
26015 !! test
26016 Parsoid: Serialize positional parameters with = in them as named parameter
26017 !! options
26018 parsoid=html2wt
26019 !! html/parsoid
26020 <p about="#mwt1" typeof="mw:Transclusion"
26021 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
26022
26023 <p about="#mwt1" typeof="mw:Transclusion"
26024 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
26025
26026 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26027 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26028 <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>
26029 !! wikitext
26030 {{echo|1=f=oo}}
26031
26032 {{echo|1=f=oo|2=bar}}
26033
26034 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26035 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26036 {{echo|<nowiki>f=oo</nowiki>|bar}}
26037 !! end
26038
26039 !! test
26040 Parsoid: Serialize positional parameters with = in extlink as named parameter
26041 !! options
26042 parsoid=html2wt
26043 !! html/parsoid
26044 <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>
26045 !! wikitext
26046 {{echo|1=http://stuff?is=ok}}
26047 !! end
26048
26049 !! test
26050 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
26051 !! options
26052 parsoid=html2wt
26053 !! html/parsoid
26054 <div>a<p>b</p></div>
26055 <div>a
26056 <p>b</p></div>
26057 <div>
26058 a
26059 <p>b</p></div>
26060 !! wikitext
26061 <div>a
26062 b
26063 </div>
26064 <div>a
26065 b
26066 </div>
26067 <div>
26068 a
26069
26070 b
26071 </div>
26072 !! end
26073
26074 !! test
26075 Substrings resembling wikitext in hrefs should not get nowiki escapes
26076 !! options
26077 parsoid=html2wt
26078 !! html/parsoid
26079 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
26080 !! wikitext
26081 [[Foo''bar''baz]]
26082 !! end
26083
26084 !! test
26085 Enforce single-line context in the serializer
26086 !! options
26087 parsoid=html2wt
26088 !! html/parsoid
26089 <h2>testing
26090 123</h2>
26091
26092 <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">
26093 </span><span about="#mwt1">you</span> </h2>
26094
26095 <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>
26096
26097 <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
26098 there</span></li></ol>
26099
26100 <ul><li>asd
26101 sdf</li></ul>
26102
26103 <ul><li>foo
26104 bar
26105 baz</li>
26106 <li>foo <b>bar</b>
26107 baz</li></ul>
26108
26109 <dl><dt>hi
26110 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
26111 ho</dd></dl>
26112
26113 <dl><dd> <table>
26114 <tbody><tr><td> ha
26115 ha
26116 ha</td></tr>
26117 </tbody></table></dd></dl>
26118 !! wikitext
26119 == testing 123 ==
26120
26121 == hi {{bogus|there
26122 you}} ==
26123
26124 == foo <ref>hello
26125 there</ref> ==
26126
26127 <references />
26128
26129 * asd sdf
26130
26131 * foo bar baz
26132 * foo '''bar''' baz
26133
26134 ; hi ho : hi ho
26135
26136 : {|
26137 | ha
26138 ha
26139 ha
26140 |}
26141 !! end
26142
26143 !! test
26144 Serialize new placeholder space without spans
26145 !! options
26146 parsoid=html2wt
26147 !! html/parsoid
26148 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
26149
26150 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
26151
26152 <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>
26153 !! wikitext
26154 foo : bar
26155
26156 foo : bar
26157
26158 <ref>foo : bar</ref>ok
26159 !! end
26160
26161
26162 #-----------------------
26163 # Tag minimization tests
26164 #-----------------------
26165
26166 !! test
26167 1. I/B quote minimization: wikitext-only tags should be combined
26168 !! options
26169 parsoid=html2wt
26170 !! html/parsoid
26171 <p><i>A</i><i>B</i></p>
26172 <p><b>A</b><b>B</b></p>
26173 <p><i>A</i><b><i>B</i></b></p>
26174 <p><b>A</b><i><b>B</b></i></p>
26175 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
26176 <p><i><b>A</b></i><i><b>B</b></i></p>
26177 <p><i><b>A</b></i><b><i>B</i></b></p>
26178 <p><b><i>A</i></b><i><b>B</b></i></p>
26179 !! wikitext
26180 ''AB''
26181
26182 '''AB'''
26183
26184 ''A'''B'''''
26185
26186 '''A''B'''''
26187
26188 '''A''BC''D'''
26189
26190 '''''AB'''''
26191
26192 '''''AB'''''
26193
26194 '''''AB'''''
26195 !! end
26196
26197 !! test
26198 2. I/B quote minimization: wikitext and html tags should not be combined
26199 !! options
26200 parsoid=html2wt
26201 !! html/parsoid
26202 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26203 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26204 !! wikitext
26205 ''A''<i>B</i>
26206
26207 ''A''<nowiki/>'''<i>B</i>'''
26208 !! end
26209
26210 !! test
26211 3. I/B quote minimization: templated content stops minimization
26212 !! options
26213 parsoid=html2wt
26214 !! html/parsoid
26215 <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>
26216 <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>
26217 !! wikitext
26218 ''A''{{echo|''B''}}
26219
26220 ''A''{{echo|'''''B'''''}}
26221 !! end
26222
26223 !! test
26224 4. I/B quote minimization: new content should be mimimized with adjacent old content
26225 !! options
26226 parsoid=html2wt
26227 !! html/parsoid
26228 <p><i>A</i><i>B</i></p>
26229 <p><b>A</b><b>B</b></p>
26230 <p><i>A</i><b><i>B</i></b></p>
26231 !! wikitext
26232 ''AB''
26233
26234 '''AB'''
26235
26236 ''A'''B'''''
26237 !! end
26238
26239 !! test
26240 5a. Merge adjacent quote nodes if they've been edited
26241 !! options
26242 parsoid={
26243 "modes": ["wt2wt", "selser"],
26244 "changes": [
26245 ["p", "contents", "remove", ":contains('b')"]
26246 ]
26247 }
26248 !! wikitext
26249 ''a''b''c''
26250 !! wikitext/edited
26251 ''ac''
26252 !! end
26253
26254 !! test
26255 5b. Merge adjacent quote nodes if they've been edited
26256 !! options
26257 parsoid={
26258 "modes": ["wt2wt", "selser"],
26259 "changes": [
26260 ["#x", "remove"]
26261 ]
26262 }
26263 !! wikitext
26264 ''a''<span id="x">b</span>''c''
26265 !! wikitext/edited
26266 ''ac''
26267 !! end
26268
26269 !! test
26270 1. Merge adjacent link nodes as long as at least one element is new
26271 !! options
26272 parsoid={
26273 "modes": ["html2wt"],
26274 "scrubWikitext": true
26275 }
26276 !! html/parsoid
26277 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26278 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26279 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26280 !! wikitext
26281 [[Football]]
26282 [[Football]]
26283 [[Football|Foot]][[Football|ball]]
26284 !! end
26285
26286 !! test
26287 2. Merge adjacent link nodes and enable additional normalizations
26288 !! options
26289 parsoid={
26290 "modes": ["html2wt"],
26291 "scrubWikitext": true
26292 }
26293 !! html/parsoid
26294 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26295 !! wikitext
26296 [[Football|''Football'']]
26297 !! end
26298
26299 !! test
26300 3. Don't merge adjacent link nodes if scrubWikitext is false
26301 !! options
26302 parsoid={
26303 "modes": ["html2wt"],
26304 "scrubWikitext": false
26305 }
26306 !! html/parsoid
26307 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26308 !! wikitext
26309 [[Football|Foot]][[Football|ball]]
26310 !! end
26311
26312 #------------------------------
26313 # End of tag minimization tests
26314 #------------------------------
26315
26316 !!test
26317 Bug 54262: New entities
26318 !! options
26319 parsoid=html2wt
26320 !! html/parsoid
26321 <span typeof="mw:Entity">&nbsp;</span>
26322 !! wikitext
26323 &nbsp;
26324 !! end
26325
26326 ## Note that there is no wikitext output for 'unknownproperty' ##
26327 ## Unknown magic words are silently dropped ##
26328
26329 !! test
26330 Magic words
26331 !! options
26332 parsoid=html2wt
26333 !! html/parsoid
26334 <meta property='mw:PageProp/toc' />
26335 <meta property='mw:PageProp/notoc' />
26336 <meta property='mw:PageProp/forcetoc' />
26337 <meta property='mw:PageProp/index' />
26338 <meta property='mw:PageProp/noindex' />
26339 <meta property='mw:PageProp/nogallery' />
26340 <meta property='mw:PageProp/noeditsection' />
26341 <meta property='mw:PageProp/notitleconvert' />
26342 <meta property='mw:PageProp/nocontentconvert' />
26343 <meta property='mw:PageProp/unknownproperty' />
26344 !! wikitext
26345 __TOC__
26346 __NOTOC__
26347 __FORCETOC__
26348 __INDEX__
26349 __NOINDEX__
26350 __NOGALLERY__
26351 __NOEDITSECTION__
26352 __NOTITLECONVERT__
26353 __NOCONTENTCONVERT__
26354 !! end
26355
26356 !! test
26357 Consecutive <pre>s should not get merged
26358 !! options
26359 parsoid=html2wt,html2html
26360 !! html/parsoid
26361 <pre>a</pre><pre>b</pre>
26362
26363 <pre>c
26364 </pre><pre>
26365 d</pre>
26366
26367 <pre>e
26368
26369 </pre><pre>
26370
26371 f</pre>
26372 !! wikitext
26373 a
26374
26375 b
26376
26377 c
26378
26379 d
26380
26381 e
26382
26383
26384
26385 f
26386 !! end
26387
26388 !! test
26389 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26390 !! options
26391 parsoid=html2wt
26392 !! html/parsoid
26393 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26394 !! wikitext
26395 [[Special:BookSources/1234567890|ISBN 1234567895]]
26396 !! end
26397
26398 !! test
26399 Edited RFC links not serializable as RFC links should serialize as extlinks
26400 !! options
26401 parsoid=html2wt
26402 !! html/parsoid
26403 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26404 !! wikitext
26405 [//tools.ietf.org/html/rfc123 New RFC]
26406 !! end
26407
26408 !! test
26409 Edited PMID links not serializable as PMID links should serialize as extlinks
26410 !! options
26411 parsoid=html2wt
26412 !! html/parsoid
26413 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26414 !! wikitext
26415 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26416 !! end
26417
26418 !! test
26419 WTS of autolinks with trailing/surrounding context
26420 !! options
26421 parsoid=html2wt
26422 !! html/parsoid
26423 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26424 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26425 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26426 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26427 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26428 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26429 !! wikitext
26430 http://cscott.net'''foo'''
26431
26432 http://cscott.net<b>foo</b>
26433
26434 '''http://cscott.net'''
26435
26436 '''http://cscott.net '''
26437
26438 '''http://cscott.net<nowiki/>x'''
26439
26440 http://cscott.net<nowiki/>x
26441 !! end
26442
26443 !! test
26444 WTS of autolinks with nowikis (round-trip)
26445 !! wikitext
26446 x<nowiki/>http://cscott.net<nowiki/>x
26447 !! html/parsoid
26448 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26449 !! end
26450
26451 # this is the "easy" test because it leaves in place all the
26452 # data-parsoid information indicating this is an autolink
26453 !! test
26454 WTS of autolinks with escapes (editing)
26455 !! options
26456 parsoid={
26457 "modes": ["wt2wt"],
26458 "changes": [
26459 [ "meta", "remove" ]
26460 ]
26461 }
26462 !! wikitext
26463 x<nowiki/>http://cscott.net<nowiki/>x
26464 !! wikitext/edited
26465 x<nowiki/>http://cscott.net<nowiki/>x
26466 !! end
26467
26468 !! test
26469 WTS of edited autolink-like text (T103364)
26470 !! options
26471 parsoid={
26472 "modes": ["wt2wt"],
26473 "changes": [
26474 [ "span[typeof]", "removeAttr", "typeof" ]
26475 ]
26476 }
26477 !! wikitext
26478 Not a link: <nowiki>http://example.com</nowiki>.
26479 !! wikitext/edited
26480 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26481 !! end
26482
26483 !! test
26484 WTS of newly-authored autolink-like text (T103364)
26485 !! options
26486 parsoid=html2wt
26487 !! html/parsoid
26488 <p>http://example.com is not a link.</p>
26489 !! wikitext
26490 <nowiki>http://example.com</nowiki> is not a link.
26491 !! end
26492
26493 !! test
26494 WTS of autolink-like text after an autolink (T108563)
26495 !! options
26496 parsoid=html2wt
26497 !! html/parsoid
26498 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26499 !! wikitext
26500 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26501 !! end
26502
26503 !! test
26504 Magic links inside links (not autolinked)
26505 !! wikitext
26506 [[Foo|http://example.com]]
26507 [[Foo|RFC 1234]]
26508 [[Foo|PMID 1234]]
26509 [[Foo|ISBN 123456789x]]
26510
26511 [http://foo.com http://example.com]
26512 [http://foo.com RFC 1234]
26513 [http://foo.com PMID 1234]
26514 [http://foo.com ISBN 123456789x]
26515 !! html+tidy
26516 <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>
26517 <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>
26518 !! html/parsoid
26519 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26520 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26521 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26522 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26523
26524 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26525 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26526 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26527 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26528 !! end
26529
26530 !! test
26531 Magic links inside image captions (autolinked)
26532 !! wikitext
26533 [[File:Foobar.jpg|thumb|http://example.com]]
26534 [[File:Foobar.jpg|thumb|RFC 1234]]
26535 [[File:Foobar.jpg|thumb|PMID 1234]]
26536 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26537 !! html+tidy
26538 <div class="thumb tright">
26539 <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>
26540 <div class="thumbcaption">
26541 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26542 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26543 </div>
26544 </div>
26545 <div class="thumb tright">
26546 <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>
26547 <div class="thumbcaption">
26548 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26549 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26550 </div>
26551 </div>
26552 <div class="thumb tright">
26553 <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>
26554 <div class="thumbcaption">
26555 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26556 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26557 </div>
26558 </div>
26559 <div class="thumb tright">
26560 <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>
26561 <div class="thumbcaption">
26562 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26563 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26564 </div>
26565 </div>
26566 !! html/parsoid
26567 <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>
26568 <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>
26569 <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>
26570 <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>
26571 !! end
26572
26573 !! test
26574 WTS of magic word text (T109371)
26575 !! options
26576 parsoid=html2wt
26577 !! html/parsoid
26578 <p>RFC 1234</p>
26579 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26580 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26581 !! wikitext
26582 <nowiki>RFC 1234</nowiki>
26583
26584 [http://foo.com RFC 1234]
26585
26586 [[Foo|RFC 1234]]
26587 !! end
26588
26589 !! test
26590 Edited Redirect link should emit a non-piped wikitext link
26591 !! options
26592 parsoid=html2wt
26593 !! html/parsoid
26594 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26595 !! wikitext
26596 #REDIRECT [[Bar]]
26597 !! end
26598
26599 !! test
26600 T75121: Infer extension name from typeOf if data-mw is not present
26601 !! options
26602 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26603 !! html/parsoid
26604 <div typeOf="mw:Extension/foo"></div>
26605 !! wikitext
26606 <foo />
26607 !! end
26608
26609 # Note that the <p> wrapping isn't present in PHP parser output
26610 # The important thing for this test is that P-wrapping doesn't
26611 # interfere with the <nowiki> protection for leading - in <td>
26612 # (which isn't necessary for <th>).
26613 !! test
26614 T88318: p-wrapped dash in table.
26615 !! options
26616 parsoid=html2wt,wt2wt
26617 !! html/parsoid
26618 <table><tbody>
26619 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26620 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26621 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26622 </tbody></table>
26623 !! wikitext
26624 {|
26625 !-
26626 !-
26627 |-
26628 |<nowiki>-</nowiki>
26629 |<nowiki>- </nowiki>
26630 |-
26631 |<small>-</small>
26632 |<br>
26633 -
26634 |<br>
26635 -
26636 |}
26637 !! html/php+tidy
26638 <table>
26639 <tr>
26640 <th>-</th>
26641 <th>-</th>
26642 </tr>
26643 <tr>
26644 <td>-</td>
26645 <td>-</td>
26646 </tr>
26647 <tr>
26648 <td><small>-</small></td>
26649 <td><br />
26650 <p>-</p>
26651 </td>
26652 <td><br />
26653 <p>-</p>
26654 </td>
26655 </tr>
26656 </table>
26657 !! end
26658
26659 !! test
26660 T149209: WTS: Handle newlines in table cells properly
26661 !! options
26662 parsoid=html2wt
26663 !! html/parsoid
26664 <table>
26665 <tbody>
26666 <tr><td>a
26667 b
26668 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
26669 <tr><td><p>x</p>
26670 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
26671 </tbody></table>
26672 <table>
26673 <tbody>
26674 <tr><th>a
26675 b
26676 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
26677 <tr><th><p>x</h>
26678 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
26679 </tbody></table>
26680 !! wikitext
26681 {|
26682 |a
26683 b
26684 |c
26685 |-
26686 |x
26687 {{!}}y
26688 |}
26689 {|
26690 !a
26691 b
26692 !c
26693 |-
26694 !x
26695 !y
26696 |}
26697 !! end
26698
26699 !! test
26700 T149209: Selser: Handle newlines in table cells properly
26701 !! options
26702 parsoid={
26703 "modes": ["selser"],
26704 "changes": [
26705 [ "#h1", "html", "a\nb\n" ],
26706 [ "#h2", "html", "a\nb\n" ],
26707 [ "#c1", "html", "a\nb\n" ],
26708 [ "#c2", "html", "<p>a</p>" ],
26709 [ "#c3", "html", "<p>a</p>" ],
26710 [ "#c4", "html", "edit-me<p>a</p>" ]
26711 ]
26712 }
26713 !! wikitext
26714 {|
26715 ! id="h1" |edit-me!!1
26716 |-
26717 ! id="h2" |edit-me||2
26718 |-
26719 | id="c1" |edit-me||3
26720 |-
26721 | id="c2" |edit-me||4
26722 |-
26723 | id="c3" |edit-me||p||q||r
26724 |-
26725 | id="c4" |edit-me||p||q||r
26726 |}
26727 !! wikitext/edited
26728 {|
26729 ! id="h1" |a
26730 b
26731 !1
26732 |-
26733 ! id="h2" |a
26734 b
26735 !2
26736 |-
26737 | id="c1" |a
26738 b
26739 |3
26740 |-
26741 | id="c2" |a
26742 |4
26743 |-
26744 | id="c3" |a
26745 |p||q||r
26746 |-
26747 | id="c4" |edit-me
26748 a
26749 |p||q||r
26750 |}
26751 !! end
26752
26753 !! test
26754 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26755 !! options
26756 parsoid=html2wt
26757 !! html/parsoid
26758 <table id='mwAb'>
26759 <td id='mwAc'>foo</td>
26760 <td id='serialize-this'>bar</td>
26761 </table>
26762 !! wikitext
26763 {|
26764 |foo
26765 | id="serialize-this" |bar
26766 |}
26767 !! end
26768
26769 !! test
26770 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26771 !! options
26772 parsoid=html2wt
26773 !! html/parsoid
26774 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26775 !! wikitext
26776 <div id="hello">ok</div>
26777 !! end
26778
26779 !! test
26780 WTS change modes
26781 !! options
26782 parsoid={
26783 "modes": ["wt2wt"],
26784 "changes": [
26785 [ "#xyz", "before", "<b>before</b> stuff " ],
26786 [ "#xyz", "after", " stuff <i>after</i>" ],
26787 [ "#xyz", "html", "x <b>y</b> z" ]
26788 ]
26789 }
26790 !! wikitext
26791 <span id="xyz">hello</span>
26792 !! wikitext/edited
26793 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26794 !! end
26795
26796 !! test
26797 Never serialize a-tag as html, regardless of what data-parsoid has to say
26798 !! options
26799 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26800 !! html/parsoid
26801 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26802 !! wikitext
26803 [[Foo]]
26804 !! end
26805
26806 ## SSS FIXME: This is broken output nevertheless.
26807 ## What might be a reasonable non-broken output for this?
26808 ## This is an edge case unlikely to be seen in production
26809 ## that I am not wasting more time on this right now.
26810 !! test
26811 Never serialize a-tag as html, no matter what attributes it has
26812 !! options
26813 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26814 !! html/parsoid
26815 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26816 !! wikitext
26817 [http://boo.org http://boohoo.org]
26818 !! end
26819
26820 # Misnested is an indication that selser can reuse the source but these have
26821 # shown to sneak through on occasion. See T101768.
26822 # The original wikitext here is: [http://test.com [[one]] two three]
26823 !! test
26824 Strip span tags added to mark misnested links
26825 !! options
26826 parsoid=html2wt
26827 !! html/parsoid
26828 <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>
26829 !! wikitext
26830 [http://test.com][[one]] two three
26831 !! end
26832
26833 !! test
26834 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26835 !! options
26836 parsoid=html2wt
26837 !! html/parsoid
26838 <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|}"]}'>
26839 <tbody><tr><td>d
26840 </td></tr>
26841 </tbody></table>
26842 !! wikitext
26843 {{echo|a}}
26844 {|{{echo|c
26845 {{!}}d
26846 }}
26847 |}
26848 !! end
26849
26850 ## This test verifies the presence and computation of this attribute indirectly
26851 ## by making an edit and ensuring that the serialization is correct (which it would be
26852 ## only if firstWikitextNode is properly set).
26853 !! test
26854 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26855 !! options
26856 parsoid= {
26857 "modes": ["wt2wt"],
26858 "changes": [
26859 [ "div#x", "remove" ],
26860 [ "div", "before", "<div>new</div>" ]
26861 ]
26862 }
26863 !! wikitext
26864 <div id="x">foo</div>
26865 {|
26866 {{echo|<div>boo</div>
26867 {{!}}b}}
26868 |c
26869 |}
26870 !! wikitext/edited
26871
26872 <div>new</div>
26873 {|
26874 {{echo|<div>boo</div>
26875 {{!}}b}}
26876 |c
26877 |}
26878 !! end
26879
26880 # --------------------------------------------
26881 # Tests spec'ing wikitext serialization norms |
26882 # --------------------------------------------
26883
26884 !! test
26885 1. Categories should always be serialized on their own line
26886 !! options
26887 parsoid=html2wt
26888 !! html/parsoid
26889 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26890 !! wikitext
26891 foo
26892 [[Category:Foo]]
26893 bar
26894 !! end
26895
26896 !! test
26897 2. Categories that are part of templates should not introduce a line break
26898 !! wikitext
26899 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26900 !! html/parsoid
26901 <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>
26902 !! end
26903
26904 # Careful while editing these next 2 tests. There are \u200f characters
26905 # before and after the <link> tags in the HTML and following some
26906 # of the categories in wikitext
26907 # Do not remove these characters in edits.
26908 #
26909 # As part of the serialization, these bidi characters will get stripped.
26910 !! test
26911 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26912 !! options
26913 parsoid={
26914 "modes": ["html2wt"],
26915 "scrubWikitext": true
26916 }
26917 !! html/parsoid
26918 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26919 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26920 !! wikitext
26921 [[קטגוריה:טקסים]]
26922 [[קטגוריה: שיטות משפט]]
26923 !! end
26924
26925 !! test
26926 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26927 !! options
26928 parsoid={
26929 "modes": ["html2wt"],
26930 "scrubWikitext": true
26931 }
26932 !! html/parsoid
26933 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26934 !! wikitext
26935 [[קטגוריה:טקסים]]
26936 ‏y
26937 !! end
26938
26939 !! test
26940 Lists: Add space after bullets
26941 !! options
26942 parsoid=html2wt
26943 !! html/parsoid
26944 <ul>
26945 <li>foo</li>
26946 <li> bar</li>
26947 <li><span> baz</span></li>
26948 </ul>
26949 !! wikitext
26950 * foo
26951 * bar
26952 * <span> baz</span>
26953 !! end
26954
26955 !! test
26956 1. Headings: Add space before/after == (T53744)
26957 !! options
26958 parsoid=html2wt
26959 !! html/parsoid
26960 <h2>foo</h2>
26961 <h2> bar</h2>
26962 <h2>baz </h2>
26963 <h2><span> baz</span></h2>
26964 !! wikitext
26965 == foo ==
26966
26967 == bar ==
26968
26969 == baz ==
26970
26971 == <span> baz</span> ==
26972 !! end
26973
26974 !! test
26975 2. Headings: Add space before/after == even after hoisted content
26976 !! options
26977 parsoid={
26978 "modes": ["html2wt"],
26979 "scrubWikitext": true
26980 }
26981 !! html/parsoid
26982 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26983 !! wikitext
26984 [[Category:A2]]
26985
26986 == ok ==
26987 !! end
26988
26989 !! test
26990 1. Headings: suppress newly created empty headings
26991 !! options
26992 parsoid={
26993 "modes": ["html2wt"],
26994 "scrubWikitext": true
26995 }
26996 !! html/parsoid
26997 <h2></h2>
26998 !! wikitext
26999 !! end
27000
27001 !! test
27002 2. Headings: don't suppress empty headings if scrubWikitext is false
27003 !! options
27004 parsoid=html2wt
27005 !! html/parsoid
27006 <h2></h2>
27007 !! wikitext
27008 ==<nowiki/>==
27009 !! end
27010
27011 !! test
27012 3. Headings: suppress empty headings on edits
27013 !! options
27014 parsoid={
27015 "modes": ["selser"],
27016 "scrubWikitext": true,
27017 "changes": [
27018 [ "#x", "remove"]
27019 ]
27020 }
27021 !! wikitext
27022 ==<span id="x">foo</span>==
27023 !! wikitext/edited
27024 !! end
27025
27026 !! test
27027 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
27028 !! options
27029 parsoid={
27030 "modes": ["html2wt"],
27031 "scrubWikitext": true
27032 }
27033 !! html/parsoid
27034 <h2>foo<br/>bar</h2>
27035 <h2>foo <span><br/>bar</span> baz</h2>
27036 !! wikitext
27037 == foo bar ==
27038
27039 == foo <span> bar</span> baz ==
27040 !! end
27041
27042 !! test
27043 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
27044 !! options
27045 parsoid={
27046 "modes": ["html2wt"],
27047 "scrubWikitext": false
27048 }
27049 !! html/parsoid
27050 <h2>foo<br/>bar</h2>
27051 !! wikitext
27052 == foo<br> bar ==
27053 !! end
27054
27055 !! test
27056 1. WT Quote Tags: suppress newly created empty style tags
27057 !! options
27058 parsoid={
27059 "modes": ["html2wt"],
27060 "scrubWikitext": true
27061 }
27062 !! html/parsoid
27063 <i></i><b></b>
27064 !! wikitext
27065 !! end
27066
27067 !! test
27068 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
27069 !! options
27070 parsoid=html2wt
27071 !! html/parsoid
27072 <i></i><b></b>
27073 !! wikitext
27074 ''<nowiki/>'''''<nowiki/>'''
27075 !! end
27076
27077 !! test
27078 3. WT Quote Tags: suppress empty style tags on edits
27079 !! options
27080 parsoid={
27081 "modes": ["selser"],
27082 "scrubWikitext": true,
27083 "changes": [
27084 [ "#x", "remove"]
27085 ]
27086 }
27087 !! wikitext
27088 '''<span id="x">foo</span>'''
27089 !! wikitext/edited
27090 !! end
27091
27092 !! test
27093 1. Anchors: suppress newly created empty anchors
27094 !! options
27095 parsoid={
27096 "modes": ["html2wt"],
27097 "scrubWikitext": true
27098 }
27099 !! html/parsoid
27100 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27101 !! wikitext
27102 !! end
27103
27104 !! test
27105 2. Anchors: don't suppress empty anchors if scrubWikitext is false
27106 !! options
27107 parsoid={
27108 "modes": ["html2wt"],
27109 "scrubWikitext": false
27110 }
27111 !! html/parsoid
27112 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27113 !! wikitext
27114 [[Test|<nowiki/>]]
27115 !! end
27116
27117 !! test
27118 3. Anchors: suppress empty anchors on edits
27119 !! options
27120 parsoid={
27121 "modes": ["selser"],
27122 "scrubWikitext": true,
27123 "changes": [
27124 [ "#x", "remove"]
27125 ]
27126 }
27127 !! wikitext
27128 [[Test|<span id="x">foo</span>]]
27129 !! wikitext/edited
27130 !! end
27131
27132 !! test
27133 3a. Anchors: do not suppress numbered extlinks
27134 !! options
27135 parsoid={
27136 "modes": ["wt2wt"],
27137 "scrubWikitext": true
27138 }
27139 !! wikitext
27140 [http://foo.com]
27141 !! html/parsoid
27142 <a rel="mw:ExtLink" href="http://foo.com"></a>
27143 !! end
27144
27145 !! test
27146 3b. Anchors: do not suppress numbered extlinks
27147 !! options
27148 parsoid={
27149 "modes": ["wt2wt"],
27150 "scrubWikitext": true,
27151 "changes": [
27152 [ "#x", "remove"]
27153 ]
27154 }
27155 !! wikitext
27156 [http://foo.com <span id="x">foo</span>]
27157 !! wikitext/edited
27158 [http://foo.com]
27159 !! end
27160
27161 !!test
27162 Normalizations should be restricted to edited content
27163 !!options
27164 parsoid={
27165 "modes": ["selser"],
27166 "scrubWikitext": true,
27167 "changes": [
27168 [ "h1", "before", "<i></i>"]
27169 ]
27170 }
27171 !!wikitext
27172 a
27173 = =
27174 b
27175 !!wikitext/edited
27176 a
27177 = =
27178 b
27179 !!end
27180
27181 !! test
27182 1. Multiple normalizations (html2wt)
27183 !! options
27184 parsoid={
27185 "modes": ["html2wt"],
27186 "scrubWikitext": true
27187 }
27188 !! html
27189 <h2><i></i></h2>
27190 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27191 </a><b><i></i></b>x</p>
27192 !! wikitext
27193
27194 [[foo]]
27195 x
27196
27197 !! end
27198
27199 !! test
27200 2. Multiple normalizations (selser)
27201 !! options
27202 parsoid={
27203 "modes": ["selser"],
27204 "scrubWikitext": true,
27205 "changes": [
27206 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27207 ]
27208 }
27209 !! wikitext
27210 <span id="x">foo</span>
27211 !! wikitext/edited
27212 <span id="x">foo</span>
27213
27214 x
27215 !! end
27216
27217 !! test
27218 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27219 !! options
27220 parsoid={
27221 "modes": ["html2wt"],
27222 "scrubWikitext": true
27223 }
27224 !! html/parsoid
27225 <p> hi</p>
27226 <p> hello</p>
27227 !! wikitext
27228 hi
27229
27230 hello
27231 !! end
27232
27233 !! test
27234 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27235 !! options
27236 parsoid=html2wt
27237 !! html/parsoid
27238 <p> hi</p>
27239 <p> hello</p>
27240 !! wikitext
27241 <nowiki> </nowiki>hi
27242
27243 <nowiki> </nowiki> hello
27244 !! end
27245
27246 !! test
27247 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27248 !! options
27249 parsoid={
27250 "modes": ["html2wt"],
27251 "scrubWikitext": true
27252 }
27253 !! html/parsoid
27254 <p>Foo
27255 bar
27256 baz</p>
27257
27258 <table><tr><td>Foo
27259 bar
27260 baz bang</td></tr></table>
27261
27262 <p><!--boo--> foo
27263 bar</p>
27264
27265 <p> foo
27266 bar<span>boo</span></p>
27267 !! wikitext
27268 Foo
27269 bar
27270 baz
27271
27272 {|
27273 |Foo
27274 bar
27275 baz bang
27276 |}
27277
27278 <!--boo-->foo
27279 bar
27280
27281 foo
27282 bar<span>boo</span>
27283 !! end
27284
27285 !! test
27286 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27287 !! options
27288 parsoid={
27289 "modes": ["selser"],
27290 "scrubWikitext": true,
27291 "changes": [
27292 [ "p", "html", " a\n b" ]
27293 ]
27294 }
27295 !! wikitext
27296 xyz
27297 !! wikitext/edited
27298 a
27299 b
27300 !! end
27301
27302 !! test
27303 1. New links that end in spaces
27304 !! options
27305 parsoid={
27306 "modes": ["html2wt"],
27307 "scrubWikitext": false
27308 }
27309 !! html/parsoid
27310 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27311 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27312 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27313 !! wikitext
27314 [[Berlin ]]<nowiki/>is the capital of Germany.
27315
27316 [[Foo ]]'''bar'''
27317
27318 [[Boston ]] is a city.
27319 !! end
27320
27321 !! test
27322 2. New links that end in spaces
27323 !! options
27324 parsoid={
27325 "modes": ["html2wt"],
27326 "scrubWikitext": true
27327 }
27328 !! html/parsoid
27329 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27330 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27331 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27332 !! wikitext
27333 [[Berlin]] is the capital of Germany.
27334
27335 [[Foo]] '''bar'''
27336
27337 [[Boston]] is a city.
27338 !! end
27339
27340 !! test
27341 1. Table cells with escapable prefixes
27342 !! options
27343 parsoid={
27344 "modes": ["html2wt"],
27345 "scrubWikitext": false
27346 }
27347 !! html
27348 <table>
27349 <tr><td>a</td></tr>
27350 <tr><td>-</td></tr>
27351 <tr><td>+</td></tr>
27352 </table>
27353 !! wikitext
27354 {|
27355 |a
27356 |-
27357 |<nowiki>-</nowiki>
27358 |-
27359 |<nowiki>+</nowiki>
27360 |}
27361 !! end
27362
27363 !! test
27364 2. Table cells with escapable prefixes
27365 !! options
27366 parsoid={
27367 "modes": ["html2wt"],
27368 "scrubWikitext": true
27369 }
27370 !! html
27371 <table>
27372 <tr><td>a</td></tr>
27373 <tr><td>-</td></tr>
27374 <tr><td>+</td></tr>
27375 </table>
27376 !! wikitext
27377 {|
27378 |a
27379 |-
27380 | -
27381 |-
27382 | +
27383 |}
27384 !! end
27385
27386 !! test
27387 3a. Table cells with escapable prefixes after edits
27388 !! options
27389 parsoid={
27390 "modes": ["selser"],
27391 "scrubWikitext": true,
27392 "changes": [
27393 [ "table tbody tr:first-child td:first-child", "remove"]
27394 ]
27395 }
27396 !! wikitext
27397 {|
27398 |a||-
27399 |}
27400 !! wikitext/edited
27401 {|
27402 | -
27403 |}
27404 !! end
27405
27406 !! test
27407 3b. Table cells with escapable prefixes after edits
27408 !! options
27409 parsoid={
27410 "modes": ["selser"],
27411 "scrubWikitext": true,
27412 "changes": [
27413 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27414 [ "#x", "remove" ]
27415 ]
27416 }
27417 !! wikitext
27418 {|
27419 |pqr
27420 |<span id="x">foo</span>+
27421 |}
27422 !! wikitext/edited
27423 {|
27424 | -
27425 | +
27426 |}
27427 !! end
27428
27429 # FIXME: This test will fail because
27430 # normalization doesn't realize that the id attribute
27431 # will eliminate the escapable scenario
27432 !! test
27433 4a. Table cells without escapable prefixes after edits
27434 !! options
27435 parsoid={
27436 "modes": ["selser"],
27437 "scrubWikitext": true,
27438 "changes": [
27439 [ "#x", "html", "-" ]
27440 ]
27441 }
27442 !! wikitext
27443 {|
27444 | id="x" |abcd
27445 |}
27446 !! wikitext/edited
27447 {|
27448 | id="x" |-
27449 |}
27450 !! end
27451
27452 ## This tests normalizer's ability to discriminate between
27453 ## cells having identical content.
27454 !! test
27455 4b. Table cells without escapable prefixes after edits
27456 !! options
27457 parsoid={
27458 "modes": ["selser"],
27459 "scrubWikitext": true,
27460 "changes": [
27461 [ "td", "html", "-" ]
27462 ]
27463 }
27464 !! wikitext
27465 {|
27466 |a||b
27467 |}
27468 !! wikitext/edited
27469 {|
27470 | -||-
27471 |}
27472 !! end
27473
27474 ## This tests normalizer's ability to not be tripped by
27475 ## comments (and whitespace)
27476 !! test
27477 4c. Table cells without escapable prefixes after edits
27478 !! options
27479 parsoid={
27480 "modes": ["selser"],
27481 "scrubWikitext": true,
27482 "changes": [
27483 [ "table tbody tr td:first-child", "remove" ]
27484 ]
27485 }
27486 !! wikitext
27487 {|
27488 |-
27489 <!--foo--> |a||-
27490 |}
27491 !! wikitext/edited
27492 {|
27493 |-
27494 <!--foo--> | -
27495 |}
27496 !! end
27497
27498 ## This tests normalizer's ability to handle HTML cells
27499 !! test
27500 4d. Table cells without escapable prefixes after edits
27501 !! options
27502 parsoid={
27503 "modes": ["selser"],
27504 "scrubWikitext": true,
27505 "changes": [
27506 [ "td", "html", "-" ]
27507 ]
27508 }
27509 !! wikitext
27510 <table>
27511 <tr><td>a</td></tr>
27512 </table>
27513 !! wikitext/edited
27514 <table>
27515 <tr><td>-</td></tr>
27516 </table>
27517 !! end
27518
27519 ## T111151 Remove font elements without attributes
27520 !! test
27521 5a. font tags without attributes should be dropped in scrubWikitext mode
27522 !! options
27523 parsoid={
27524 "modes": ["html2wt"],
27525 "scrubWikitext": true
27526 }
27527 !! html
27528 <font>foo</font>
27529 <font><font>bar</font></font>
27530 <font class="x">boo</font>
27531 !! wikitext
27532 foo
27533 bar
27534 <font class="x">boo</font>
27535 !! end
27536
27537 !! test
27538 5b. font tags should not be dropped without scrubWikitext being enabled
27539 !! options
27540 parsoid={
27541 "modes": ["html2wt"],
27542 "scrubWikitext": false
27543 }
27544 !! html
27545 <font>foo</font>
27546 !! wikitext
27547 <font>foo</font>
27548 !! end
27549
27550 !! test
27551 Escape nowiki DOM elements
27552 !! options
27553 parsoid=html2wt
27554 !! html/parsoid
27555 <nowiki><i>foo</i></nowiki>
27556 !! wikitext
27557 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27558 !! end
27559
27560 # This is meant to be an interim fix while we go about figuring out
27561 # how to not introduce these trailing <nowiki/>s in the first place.
27562 !! test
27563 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27564 !! options
27565 parsoid=html2wt
27566 !! html/parsoid
27567 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27568 y</p>
27569 <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>
27570 <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>
27571 !! wikitext
27572 x
27573 y
27574
27575 {{echo|
27576 1 = <nowiki/>}}
27577
27578 {{echo|
27579 1 = <nowiki/>
27580 }}
27581 !! end
27582
27583 # ---------------------------------------------------
27584 # End of tests spec'ing wikitext serialization norms |
27585 # ---------------------------------------------------
27586
27587 # T104032
27588 !! test
27589 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27590 !! options
27591 parsoid=html2wt
27592 !! html/parsoid
27593 a<p>b</p>
27594 <b>c</b><p>d</p>
27595 <table><tr>
27596 <td>a<p>b</p></td>
27597 <td><b>c</b><p>d</p></td>
27598 </tr></table>
27599 !! wikitext
27600 a
27601
27602 b
27603
27604 '''c'''
27605
27606 d
27607 {|
27608 |a
27609 b
27610 |'''c'''
27611 d
27612 |}
27613 !! end
27614
27615 # -----------------------------------------------------------------
27616 # End of section for Parsoid-only html2wt tests for serialization
27617 # of new content
27618 # -----------------------------------------------------------------
27619
27620 # -----------------------------------------------------------------
27621 # The following section of tests are primarily to spec behavior of
27622 # the selective serializer. All these tests have manual selser
27623 # changes. The automated selser changes for all tests handle the
27624 # wide variation of changes, but these tests here capture specs
27625 # deterministically.
27626 # ----------------------------------------------------------------
27627
27628 ## T90517
27629 !! test
27630 Selser: New comments should not be lost
27631 !! options
27632 parsoid={
27633 "modes": ["selser"],
27634 "changes": [
27635 [ "#a", "after", "<!--c1-->" ],
27636 [ "#b", "before", "<!--c2-->" ]
27637 ]
27638 }
27639 !! wikitext
27640 <span id="a">a</span>
27641
27642 <span id="b">b</span>
27643 !! wikitext/edited
27644 <span id="a">a</span><!--c1-->
27645
27646 <!--c2--><span id="b">b</span>
27647 !! end
27648
27649 ## T89383
27650 !! test
27651 Selser: Check for validity of DSR before using it
27652 !! options
27653 parsoid={
27654 "modes": ["selser"],
27655 "changes": [
27656 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27657 ]
27658 }
27659 !! wikitext
27660 <span id="a">a</span>
27661 !! wikitext/edited
27662 {{DISPLAYTITLE:foo}}
27663 <span id="a">a</span>
27664 !! end
27665
27666 !! test
27667 1. DOMDiff: Changes to <ref> content should be looked up using id
27668 !! options
27669 parsoid={
27670 "modes": ["selser"],
27671 "changes": [
27672 ["#X", "after", "bar"],
27673 ["#Y", "after", "baz"]
27674 ]
27675 }
27676 !! wikitext
27677 X <ref><span id="X">foo</span></ref>
27678 Y <ref name="a" />
27679 <references>
27680 <ref name="a"><span id="Y">foo</span></ref>
27681 </references>
27682 !! wikitext/edited
27683 X <ref><span id="X">foo</span>bar</ref>
27684 Y <ref name="a" />
27685 <references>
27686 <ref name="a"><span id="Y">foo</span>baz</ref>
27687 </references>
27688 !! end
27689
27690 !! test
27691 2. DOMDiff: Changes to <ref> content should be looked up using id
27692 !! options
27693 parsoid={
27694 "modes": ["selser"],
27695 "changes": [
27696 ["#Z", "after", "bar"]
27697 ]
27698 }
27699 !! wikitext
27700 A <ref>foo bar for a</ref>
27701 B <ref group="X" name="b" />
27702
27703 <references />
27704
27705 <references group="X">
27706 <ref name="b"><span id="Z">foo</span></ref>
27707 </references>
27708 !! wikitext/edited
27709 A <ref>foo bar for a</ref>
27710 B <ref group="X" name="b" />
27711
27712 <references />
27713
27714 <references group="X">
27715 <ref name="b"><span id="Z">foo</span>bar</ref>
27716 </references>
27717 !! end
27718
27719 !! test
27720 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27721 !! options
27722 parsoid={
27723 "modes": ["selser"],
27724 "changes": [
27725 [ "div:first-child", "text", "bar" ]
27726 ]
27727 }
27728 !! wikitext
27729 <div style="{{1x|color:red;}}%">foo</div>
27730 !! wikitext/edited
27731 <div style="{{1x|color:red;}}%">bar</div>
27732 !! end
27733
27734 !! test
27735 Empty LI (T49673)
27736 !! wikitext
27737 * a
27738 *
27739 *
27740 * b
27741 !! html/php+tidy
27742 <ul>
27743 <li>a</li>
27744 <li class="mw-empty-elt"></li>
27745 <li class="mw-empty-elt"></li>
27746 <li>b</li>
27747 </ul>
27748 !! end
27749
27750 !! test
27751 Thumbnail output
27752 !! wikitext
27753 [[File:Thumb.png|thumb]]
27754 !! html/php+tidy
27755 <div class="thumb tright">
27756 <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>
27757 <div class="thumbcaption">
27758 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27759 </div>
27760 </div>
27761 </div>
27762 !! end
27763
27764 !! test
27765 unclosed internal link XSS (T137264)
27766 !! wikitext
27767 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27768 !! html/php
27769 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27770 </p>
27771 !! html/parsoid
27772 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
27773 !! end